This commit is contained in:
Sonicxryan 2023-07-06 21:21:37 +01:00 committed by GitHub
parent ddde827f85
commit 3258064a7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 43 additions and 7 deletions

View file

@ -708,8 +708,14 @@
--- @field public headAngle Vec3s
--- @field public headPos Vec3f
--- @field public heldObjLastPosition Vec3f
--- @field public lightB number
--- @field public lightG number
--- @field public lightR number
--- @field public modelState integer
--- @field public punchState integer
--- @field public shadeB number
--- @field public shadeG number
--- @field public shadeR number
--- @field public torsoAngle Vec3s
--- @field public torsoPos Vec3f
--- @field public updateTorsoTime integer

View file

@ -1035,8 +1035,14 @@
| headAngle | [Vec3s](structs.md#Vec3s) | read-only |
| headPos | [Vec3f](structs.md#Vec3f) | read-only |
| heldObjLastPosition | [Vec3f](structs.md#Vec3f) | read-only |
| lightB | `number` | |
| lightG | `number` | |
| lightR | `number` | |
| modelState | `integer` | |
| punchState | `integer` | |
| shadeB | `number` | |
| shadeG | `number` | |
| shadeR | `number` | |
| torsoAngle | [Vec3s](structs.md#Vec3s) | read-only |
| torsoPos | [Vec3f](structs.md#Vec3f) | read-only |
| updateTorsoTime | `integer` | read-only |

View file

@ -307,6 +307,12 @@ struct MarioBodyState
/*????*/ u32 updateTorsoTime;
/*????*/ Vec3f headPos;
//u8 padding[4];
/*????*/ f32 shadeR; // Shadow Red Value
/*????*/ f32 shadeG; // Shadow Green Value
/*????*/ f32 shadeB; // Shadow Blue Value
/*????*/ f32 lightR; // Shadow Red Value
/*????*/ f32 lightG; // Shadow Green Value
/*????*/ f32 lightB; // Shadow Blue Value
};
struct OffsetSizePair

View file

@ -2291,6 +2291,14 @@ void init_single_mario(struct MarioState* m) {
update_mario_info_for_cam(m);
m->marioBodyState->punchState = 0;
m->marioBodyState->shadeR = 127.0f;
m->marioBodyState->shadeG = 127.0f;
m->marioBodyState->shadeB = 127.0f;
m->marioBodyState->lightR = 255.0f;
m->marioBodyState->lightG = 255.0f;
m->marioBodyState->lightB = 255.0f;
m->marioObj->oPosX = m->pos[0];
m->marioObj->oPosY = m->pos[1];
m->marioObj->oPosZ = m->pos[2];

View file

@ -750,14 +750,18 @@ Gfx* geo_mirror_mario_backface_culling(s32 callContext, struct GraphNode* node,
static struct PlayerColor geo_mario_get_player_color(const struct PlayerPalette *palette) {
struct PlayerColor color = { 0 };
u8 index = geo_get_processing_object_index();
struct MarioBodyState* bodyState = &gBodyStates[index];
for (s32 part = 0; part != PLAYER_PART_MAX; ++part) {
color.parts[part] = (Lights1) gdSPDefLights1(
palette->parts[part][0] / 2,
palette->parts[part][1] / 2,
palette->parts[part][2] / 2,
palette->parts[part][0],
palette->parts[part][1],
palette->parts[part][2],
// Shadow
palette->parts[part][0] * bodyState->shadeR/255.0f,
palette->parts[part][1] * bodyState->shadeG/255.0f,
palette->parts[part][2] * bodyState->shadeB/255.0f,
// Light
palette->parts[part][0] * bodyState->lightR/255.0f,
palette->parts[part][1] * bodyState->lightG/255.0f,
palette->parts[part][2] * bodyState->lightB/255.0f,
0x28, 0x28, 0x28
);
}

View file

@ -809,7 +809,7 @@ static struct LuaObjectField sMarioAnimationFields[LUA_MARIO_ANIMATION_FIELD_COU
{ "targetAnim", LVT_COBJECT_P, offsetof(struct MarioAnimation, targetAnim), false, LOT_ANIMATION },
};
#define LUA_MARIO_BODY_STATE_FIELD_COUNT 14
#define LUA_MARIO_BODY_STATE_FIELD_COUNT 20
static struct LuaObjectField sMarioBodyStateFields[LUA_MARIO_BODY_STATE_FIELD_COUNT] = {
{ "action", LVT_U32, offsetof(struct MarioBodyState, action), false, LOT_NONE },
{ "capState", LVT_S8, offsetof(struct MarioBodyState, capState), false, LOT_NONE },
@ -820,8 +820,14 @@ static struct LuaObjectField sMarioBodyStateFields[LUA_MARIO_BODY_STATE_FIELD_CO
{ "headAngle", LVT_COBJECT, offsetof(struct MarioBodyState, headAngle), true, LOT_VEC3S },
{ "headPos", LVT_COBJECT, offsetof(struct MarioBodyState, headPos), true, LOT_VEC3F },
{ "heldObjLastPosition", LVT_COBJECT, offsetof(struct MarioBodyState, heldObjLastPosition), true, LOT_VEC3F },
{ "lightB", LVT_F32, offsetof(struct MarioBodyState, lightB), false, LOT_NONE },
{ "lightG", LVT_F32, offsetof(struct MarioBodyState, lightG), false, LOT_NONE },
{ "lightR", LVT_F32, offsetof(struct MarioBodyState, lightR), false, LOT_NONE },
{ "modelState", LVT_S16, offsetof(struct MarioBodyState, modelState), false, LOT_NONE },
{ "punchState", LVT_U8, offsetof(struct MarioBodyState, punchState), false, LOT_NONE },
{ "shadeB", LVT_F32, offsetof(struct MarioBodyState, shadeB), false, LOT_NONE },
{ "shadeG", LVT_F32, offsetof(struct MarioBodyState, shadeG), false, LOT_NONE },
{ "shadeR", LVT_F32, offsetof(struct MarioBodyState, shadeR), false, LOT_NONE },
{ "torsoAngle", LVT_COBJECT, offsetof(struct MarioBodyState, torsoAngle), true, LOT_VEC3S },
{ "torsoPos", LVT_COBJECT, offsetof(struct MarioBodyState, torsoPos), true, LOT_VEC3F },
{ "updateTorsoTime", LVT_U32, offsetof(struct MarioBodyState, updateTorsoTime), true, LOT_NONE },