mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2026-04-26 20:11:42 +00:00
just because
This commit is contained in:
parent
7bb88169ad
commit
3e140b9e80
2 changed files with 39 additions and 1 deletions
|
|
@ -782,6 +782,13 @@ static struct PlayerColor geo_mario_get_player_color(const struct PlayerPalette
|
|||
return color;
|
||||
}
|
||||
|
||||
void get_player_color(u8 index, u8 part, f32 *out) {
|
||||
const struct PlayerPalette *palette = &gNetworkPlayers[index].overridePalette;
|
||||
out[0] = palette->parts[part][0] / 255.0f;
|
||||
out[1] = palette->parts[part][1] / 255.0f;
|
||||
out[2] = palette->parts[part][2] / 255.0f;
|
||||
}
|
||||
|
||||
static Gfx *geo_mario_create_player_colors_dl(s32 index, Gfx *capEnemyGfx, Gfx *capEnemyDecalGfx) {
|
||||
s32 size = ((PLAYER_PART_MAX * 2) + 1) + (capEnemyGfx != NULL) + (capEnemyDecalGfx != NULL);
|
||||
Gfx *gfx = alloc_display_list(size * sizeof(Gfx));
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ void calc_face_normal(struct ObjFace *face) {
|
|||
p3.z = vtx3->pos.z;
|
||||
|
||||
// calculate the cross product of edges (p2 - p1) and (p3 - p2)
|
||||
// not sure why each component is multiplied by 1000. maybe to avoid loss of precision when normalizing?
|
||||
// not sure why each component is multiplied by 1000. maybe to avoid loss of precision when normalizing?
|
||||
normal.x = (((p2.y - p1.y) * (p3.z - p2.z)) - ((p2.z - p1.z) * (p3.y - p2.y))) * mul;
|
||||
normal.y = (((p2.z - p1.z) * (p3.x - p2.x)) - ((p2.x - p1.x) * (p3.z - p2.z))) * mul;
|
||||
normal.z = (((p2.x - p1.x) * (p3.y - p2.y)) - ((p2.y - p1.y) * (p3.x - p2.x))) * mul;
|
||||
|
|
@ -1366,6 +1366,37 @@ s32 load_mario_head(void (*aniFn)(struct ObjAnimator *)) {
|
|||
particle->shapePtr = gShapeRedSpark;
|
||||
addto_group(gGdLightGroup, &particle->header);
|
||||
|
||||
f32 color[3];
|
||||
void get_player_color(u8 index, u8 part, f32 *out);
|
||||
|
||||
struct ObjGroup *mtls = (struct ObjGroup *) d_use_obj("N224l"); // DYNOBJ_MARIO_FACE_MTL_GROUP
|
||||
for (struct ListNode *n = mtls->firstMember; n; n = n->next) {
|
||||
struct ObjMaterial *m = (struct ObjMaterial *)n->obj;
|
||||
|
||||
switch (m->id) {
|
||||
// skin color
|
||||
case 1:
|
||||
get_player_color(0, 5, color);
|
||||
break;
|
||||
|
||||
// hair color
|
||||
case 5:
|
||||
get_player_color(0, 4, color);
|
||||
break;
|
||||
|
||||
// cap color
|
||||
case 7:
|
||||
get_player_color(0, 6, color);
|
||||
break;
|
||||
|
||||
// skip this part
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
m->Ka = (struct GdColour) { color[0], color[1], color[2] };
|
||||
m->Kd = (struct GdColour) { color[0], color[1], color[2] };
|
||||
}
|
||||
|
||||
mainShapesGrp = (struct ObjGroup *) d_use_obj("N1000l"); // DYNOBJ_MARIO_MAIN_SHAPES_GROUP
|
||||
create_gddl_for_shapes(mainShapesGrp);
|
||||
sp38 = gGdObjectList;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue