mirror of
https://github.com/izzy2lost/Diddy-Kong-Racing.git
synced 2026-06-19 01:16:26 -07:00
match spawn_object (#637)
* clean up Object-unk68 * rename field * remove unused struct * remove padding * match spawn_object * spawn flags * clean up
This commit is contained in:
@@ -5,9 +5,9 @@ This repo contains a work-in-progress decompilation of Diddy Kong Racing for the
|
||||
All versions are supported, and the US 1.0 version (SHA1 = 0cb115d8716dbbc2922fda38e533b9fe63bb9670) of the game is the default if not specified.
|
||||
|
||||
<!-- README_SCORE_SUMMARY_BEGIN -->
|
||||
As of June 19, 2025, this is our current score:
|
||||
As of June 20, 2025, this is our current score:
|
||||
|
||||
    Decomp progress: 92.93%
|
||||
    Decomp progress: 93.28%
|
||||
|
||||
    Documentation progress: 59.95%
|
||||
<!-- README_SCORE_SUMMARY_END -->
|
||||
@@ -117,20 +117,20 @@ s32 is_drumstick_unlocked(void) {
|
||||
```
|
||||
|
||||
<!-- README_SCORE_BEGIN -->
|
||||
As of June 19, 2025, this is our current score:
|
||||
As of June 20, 2025, this is our current score:
|
||||
```
|
||||
======================================================================
|
||||
ADVENTURE ONE (ASM -> C Decompilation)
|
||||
--------------- 92.93% Complete (93.81% NON_MATCHING) ----------------
|
||||
# Decompiled functions: 1926
|
||||
# GLOBAL_ASM remaining: 24
|
||||
--------------- 93.28% Complete (94.16% NON_MATCHING) ----------------
|
||||
# Decompiled functions: 1927
|
||||
# GLOBAL_ASM remaining: 23
|
||||
# NON_MATCHING functions: 5
|
||||
# NON_EQUIVALENT WIP functions: 19
|
||||
# NON_EQUIVALENT WIP functions: 18
|
||||
---------------------------- Game Status -----------------------------
|
||||
Balloons: 44/47, Keys: 4/4, Trophies: 4/5
|
||||
T.T. Amulets: 4/4, Wizpig Amulets: 4/4
|
||||
----------------------------------------------------------------------
|
||||
We are collecting silver coins in Darkmoon Caverns. (3/8 silver coins)
|
||||
We are collecting silver coins in Darkmoon Caverns. (5/8 silver coins)
|
||||
======================================================================
|
||||
ADVENTURE TWO (Cleanup & Documentation)
|
||||
-------------------------- 59.95% Complete ---------------------------
|
||||
|
||||
+22
-45
@@ -673,7 +673,23 @@ typedef struct ObjectModel {
|
||||
/* 0x50 */ s16 unk50;
|
||||
/* 0x52 */ s16 texOffsetUpdateRate; // Set to the current updaterate for the first model.
|
||||
/* 0x54 */ u8 pad[0x2C];
|
||||
} ObjectModel;
|
||||
} ObjectModel;
|
||||
|
||||
/* Size: 0x24 bytes */
|
||||
typedef struct ModelInstance {
|
||||
/* 0x00 */ ObjectModel *objModel;
|
||||
/* 0x04 */ Vertex *vertices[3];
|
||||
/* 0x10 */ s16 animationID;
|
||||
/* 0x12 */ s16 animationFrame;
|
||||
/* 0x14 */ s16 animationFrameCount;
|
||||
/* 0x16 */ s16 offsetX;
|
||||
/* 0x18 */ s16 offsetY;
|
||||
/* 0x1A */ s16 offsetZ;
|
||||
/* 0x1C */ s16 headTilt;
|
||||
/* 0x1E */ s8 modelType;
|
||||
/* 0x1F */ s8 animationTaskNum;
|
||||
/* 0x20 */ s8 animUpdateTimer;
|
||||
} ModelInstance;
|
||||
|
||||
typedef struct CollisionNode {
|
||||
u16 triangleIndex; // This triangle index
|
||||
@@ -1729,42 +1745,6 @@ typedef struct Object_64 {
|
||||
Object_OverridePos override_pos;
|
||||
};
|
||||
} Object_64;
|
||||
|
||||
// Size: 0xC
|
||||
typedef struct Object_68_38 {
|
||||
/* 0x00 */ u8 unk0[8];
|
||||
/* 0x08 */ s32 unk8;
|
||||
} Object_68_38;
|
||||
|
||||
typedef struct Object_68 {
|
||||
/* 0x00 */ union {
|
||||
ObjectModel *objModel;
|
||||
Sprite *sprite;
|
||||
TextureHeader *texHeader;
|
||||
};
|
||||
/* 0x04 */ Vertex *vertices[3];
|
||||
/* 0x10 */ s16 animationID;
|
||||
/* 0x12 */ s16 animationFrame;
|
||||
/* 0x14 */ s16 animationFrameCount;
|
||||
/* 0x16 */ s16 offsetX;
|
||||
/* 0x18 */ s16 offsetY;
|
||||
/* 0x1A */ s16 offsetZ;
|
||||
/* 0x1C */ s16 headTilt;
|
||||
/* 0x1E */ s8 modelType;
|
||||
/* 0x1F */ s8 animationTaskNum;
|
||||
/* 0x20 */ s8 animUpdateTimer;
|
||||
/* 0x21 */ s8 unk21;
|
||||
/* 0x22 */ s16 unk22;
|
||||
/* 0x24 */ s32 unk24;
|
||||
/* 0x28 */ s16 unk28;
|
||||
/* 0x2A */ s16 unk2A;
|
||||
/* 0x2C */ s32 unk2C;
|
||||
/* 0x30 */ s32 unk30;
|
||||
/* 0x34 */ u8 pad34[0x4];
|
||||
/* 0x38 */ Object_68_38 *unk38; //Array Size unknown
|
||||
/* 0x40 */ u8 pad40[0x14];
|
||||
/* 0x50 */ s16 unk50;
|
||||
} Object_68;
|
||||
|
||||
typedef struct unk800B2260_C {
|
||||
s32 unk0;
|
||||
@@ -1861,18 +1841,15 @@ typedef struct Object {
|
||||
/* 0x005C */ Object_5C *unk5C;
|
||||
/* 0x0060 */ Object_60 *unk60; //player + 0x340
|
||||
/* 0x0064 */ Object_64 *unk64; //player + 0x98
|
||||
/* 0x0068 */ Object_68 **unk68; //player + 0x80
|
||||
/* 0x0068 */ union {
|
||||
ModelInstance **modelInstances;
|
||||
TextureHeader **textures;
|
||||
Sprite **sprites;
|
||||
};
|
||||
/* 0x006C */ struct ParticleEmitter *particleEmitter; //player + 0x370
|
||||
/* 0x0070 */ struct ObjectLight **lightData;
|
||||
/* 0x0074 */ u32 particleEmittersEnabled;
|
||||
/* 0x0078 */ ObjProperties properties;
|
||||
/* 0x0080 */ void *unk80;
|
||||
/* 0x0084 */ u32 unk84;
|
||||
/* 0x0088 */ u32 unk88;
|
||||
/* 0x008C */ u32 unk8C;
|
||||
/* 0x0090 */ u32 unk90;
|
||||
/* 0x0094 */ u32 unk94;
|
||||
/* 0x0098 */ s32 unk98;
|
||||
} Object;
|
||||
|
||||
// Unused
|
||||
|
||||
+6
-6
@@ -1472,7 +1472,7 @@ s32 mtx_cam_push(Gfx **dList, Mtx **mtx, ObjectTransform *trans, f32 scaleY, f32
|
||||
/**
|
||||
* Calculate the rotation matrix for an actors head, then run it.
|
||||
*/
|
||||
void mtx_head_push(Gfx **dList, Mtx **mtx, Object_68 *objGfx, s16 headAngle) {
|
||||
void mtx_head_push(Gfx **dList, Mtx **mtx, ModelInstance *modInst, s16 headAngle) {
|
||||
f32 coss_headAngle;
|
||||
f32 sins_headAngle;
|
||||
f32 offsetX;
|
||||
@@ -1483,11 +1483,11 @@ void mtx_head_push(Gfx **dList, Mtx **mtx, Object_68 *objGfx, s16 headAngle) {
|
||||
MtxF rotationMtxF;
|
||||
MtxF headMtxF;
|
||||
|
||||
offsetX = (f32) objGfx->offsetX;
|
||||
offsetY = (f32) objGfx->offsetY;
|
||||
offsetZ = (f32) objGfx->offsetZ;
|
||||
coss_unk1C = coss_f(objGfx->headTilt);
|
||||
sins_unk1C = sins_f(objGfx->headTilt);
|
||||
offsetX = (f32) modInst->offsetX;
|
||||
offsetY = (f32) modInst->offsetY;
|
||||
offsetZ = (f32) modInst->offsetZ;
|
||||
coss_unk1C = coss_f(modInst->headTilt);
|
||||
sins_unk1C = sins_f(modInst->headTilt);
|
||||
coss_headAngle = coss_f(headAngle);
|
||||
sins_headAngle = sins_f(headAngle);
|
||||
headMtxF[0][0] = (coss_headAngle * coss_unk1C);
|
||||
|
||||
+1
-1
@@ -146,7 +146,7 @@ s32 mtx_cam_push(Gfx **dList, Mtx **mtx, ObjectTransform *trans, f32 scaleY, f32
|
||||
void viewport_scissor(Gfx **dList);
|
||||
void mtx_pop(Gfx **dList);
|
||||
void copy_viewports_to_stack(void);
|
||||
void mtx_head_push(Gfx **dList, Mtx **mtx, Object_68 *objGfx, s16 headAngle);
|
||||
void mtx_head_push(Gfx **dList, Mtx **mtx, ModelInstance *modInst, s16 headAngle);
|
||||
void mtx_shear_push(Gfx **dList, Mtx **mtx, Object *obj, Object *objBase, f32 shear);
|
||||
void cam_init(void);
|
||||
void viewport_main(Gfx **dlist, Mtx **mats);
|
||||
|
||||
+30
-30
@@ -649,7 +649,7 @@ void hud_free(void) {
|
||||
} else if (gAssetHudElementIds[i] & ASSET_MASK_OBJECT) {
|
||||
free_object((Object *) gAssetHudElements->entry[i]);
|
||||
} else {
|
||||
free_3d_model((ObjectModel **) gAssetHudElements->entry[i]);
|
||||
free_3d_model((ModelInstance *) gAssetHudElements->entry[i]);
|
||||
}
|
||||
gAssetHudElements->entry[i] = NULL;
|
||||
}
|
||||
@@ -1461,7 +1461,7 @@ void hud_main_time_trial(s32 arg0, Object *playerRacerObj, s32 updateRate) {
|
||||
s32 temp_lo;
|
||||
Object_Racer *curRacer;
|
||||
Object *ttSWBodyObject;
|
||||
Object_68 *obj68;
|
||||
ModelInstance *modInst;
|
||||
LevelObjectEntryCommon ttSWBody;
|
||||
LevelObjectEntryCommon ttSWArms;
|
||||
UNUSED s32 pad;
|
||||
@@ -1481,7 +1481,7 @@ void hud_main_time_trial(s32 arg0, Object *playerRacerObj, s32 updateRate) {
|
||||
ttSWBody.x = 0;
|
||||
ttSWBody.y = 0;
|
||||
ttSWBody.z = 0;
|
||||
gAssetHudElements->entry[HUD_BALLOON_COUNT_X] = spawn_object(&ttSWBody, 0);
|
||||
gAssetHudElements->entry[HUD_BALLOON_COUNT_X] = spawn_object(&ttSWBody, OBJECT_SPAWN_NONE);
|
||||
gCurrentHud->entry[HUD_STOPWATCH_HANDS].rotation.y_rotation = -0x8000;
|
||||
if (gAssetHudElements->entry[HUD_BALLOON_COUNT_X] != NULL) {
|
||||
((Object *) gAssetHudElements->entry[HUD_BALLOON_COUNT_X])->segment.animFrame = 0;
|
||||
@@ -1494,7 +1494,7 @@ void hud_main_time_trial(s32 arg0, Object *playerRacerObj, s32 updateRate) {
|
||||
ttSWArms.x = 0;
|
||||
ttSWArms.y = 0;
|
||||
ttSWArms.z = 0;
|
||||
gAssetHudElements->entry[HUD_STOPWATCH] = spawn_object(&ttSWArms, 0);
|
||||
gAssetHudElements->entry[HUD_STOPWATCH] = spawn_object(&ttSWArms, OBJECT_SPAWN_NONE);
|
||||
gCurrentHud->entry[HUD_STOPWATCH].rotation.y_rotation = -0x8000;
|
||||
}
|
||||
|
||||
@@ -1504,14 +1504,14 @@ void hud_main_time_trial(s32 arg0, Object *playerRacerObj, s32 updateRate) {
|
||||
}
|
||||
|
||||
ttSWBodyObject->segment.object.animationID = gStopwatchAnimID;
|
||||
obj68 = ttSWBodyObject->unk68[0];
|
||||
obj68->objModel->texOffsetUpdateRate = updateRate;
|
||||
modInst = ttSWBodyObject->modelInstances[0];
|
||||
modInst->objModel->texOffsetUpdateRate = updateRate;
|
||||
if (gStopwatchAnimID != 0xFF) {
|
||||
if (gStopwatchAnimID == 4 && (get_race_countdown() || !music_is_playing())) {
|
||||
ttSWBodyObject->segment.animFrame = 16;
|
||||
} else if (gStopwatchAnimID == 4) {
|
||||
animcationFraction = music_animation_fraction();
|
||||
temp_t6 = (obj68->objModel->animations[gStopwatchAnimID].animLength - 1) << 4;
|
||||
temp_t6 = (modInst->objModel->animations[gStopwatchAnimID].animLength - 1) << 4;
|
||||
if (animcationFraction == -1.0) {
|
||||
ttSWBodyObject->segment.animFrame = 0.0;
|
||||
} else if (animcationFraction > 0.5) {
|
||||
@@ -1532,7 +1532,7 @@ void hud_main_time_trial(s32 arg0, Object *playerRacerObj, s32 updateRate) {
|
||||
}
|
||||
} else {
|
||||
ttSWBodyObject->segment.animFrame += (updateRate * D_80126D69);
|
||||
temp_lo = (obj68->objModel->animations[gStopwatchAnimID].animLength - 1) << 4;
|
||||
temp_lo = (modInst->objModel->animations[gStopwatchAnimID].animLength - 1) << 4;
|
||||
if (ttSWBodyObject->segment.animFrame >= temp_lo) {
|
||||
if (D_80126D68 != 0) {
|
||||
D_80126D69 = -D_80126D69;
|
||||
@@ -1575,7 +1575,7 @@ void hud_main_time_trial(s32 arg0, Object *playerRacerObj, s32 updateRate) {
|
||||
hud_element_render(&gHudDL, &gHudMtx, &gHudVtx, &gCurrentHud->entry[HUD_STOPWATCH]);
|
||||
}
|
||||
|
||||
obj68->animUpdateTimer = 0;
|
||||
modInst->animUpdateTimer = 0;
|
||||
cam_set_sprite_anim_mode(SPRITE_ANIM_FRAME_INDEX);
|
||||
hud_course_arrows(curRacer, updateRate);
|
||||
if (curRacer->raceFinished == FALSE) {
|
||||
@@ -1765,32 +1765,31 @@ void hud_main_time_trial(s32 arg0, Object *playerRacerObj, s32 updateRate) {
|
||||
}
|
||||
|
||||
void hud_stopwatch_face(u8 arg0, u8 arg1, u8 animID, u8 arg3, u8 arg4) {
|
||||
s32 var_a3;
|
||||
s32 numberOfBatches;
|
||||
s32 i;
|
||||
UNUSED u8 *temp_v0_2;
|
||||
Object_68 **unk68;
|
||||
ModelInstance *modInst;
|
||||
Object *hud20;
|
||||
|
||||
if (is_in_time_trial()) {
|
||||
hud20 = gAssetHudElements->entry[HUD_ELEMENT_UNK_14];
|
||||
if (hud20 != NULL) {
|
||||
unk68 = (Object_68 **) hud20->unk68[0];
|
||||
var_a3 = unk68[0]->unk28;
|
||||
modInst = hud20->modelInstances[0];
|
||||
numberOfBatches = modInst->objModel->numberOfBatches;
|
||||
|
||||
for (i = 0; i < var_a3; i++) {
|
||||
if (D_80126D66 == unk68[0]->unk38[i].unk0[0]) {
|
||||
unk68[0]->unk38[i].unk0[0] = arg0;
|
||||
for (i = 0; i < numberOfBatches; i++) {
|
||||
if (D_80126D66 == modInst->objModel->batches[i].textureIndex) {
|
||||
modInst->objModel->batches[i].textureIndex = arg0;
|
||||
if (arg0 == 4) {
|
||||
unk68[0]->unk38[i].unk8 |= (0x800000 | 0x10000);
|
||||
unk68[0]->unk50 = 1;
|
||||
modInst->objModel->batches[i].flags |= (RENDER_UNK_0800000 | RENDER_TEX_ANIM);
|
||||
modInst->objModel->unk50 = 1;
|
||||
} else {
|
||||
unk68[0]->unk38[i].unk8 &= ~(0x800000 | 0x10000);
|
||||
unk68[0]->unk50 = 0;
|
||||
modInst->objModel->batches[i].flags &= ~(RENDER_UNK_0800000 | RENDER_TEX_ANIM);
|
||||
modInst->objModel->unk50 = 0;
|
||||
}
|
||||
var_a3 = unk68[0]->unk28;
|
||||
} else if (D_80126D65 == unk68[0]->unk38[i].unk0[0]) {
|
||||
unk68[0]->unk38[i].unk0[0] = arg1;
|
||||
var_a3 = unk68[0]->unk28;
|
||||
numberOfBatches = modInst->objModel->numberOfBatches;
|
||||
} else if (D_80126D65 == modInst->objModel->batches[i].textureIndex) {
|
||||
modInst->objModel->batches[i].textureIndex = arg1;
|
||||
numberOfBatches = modInst->objModel->numberOfBatches;
|
||||
}
|
||||
}
|
||||
D_80126D66 = arg0;
|
||||
@@ -3382,7 +3381,7 @@ void hud_render_general(Gfx **dList, Mtx **mtx, Vertex **vtx, s32 updateRate) {
|
||||
} else if (gAssetHudElementIds[i] & ASSET_MASK_OBJECT) {
|
||||
free_object((Object *) gAssetHudElements->entry[i]);
|
||||
} else {
|
||||
free_3d_model((ObjectModel **) gAssetHudElements->entry[i]);
|
||||
free_3d_model((ModelInstance *) gAssetHudElements->entry[i]);
|
||||
}
|
||||
gAssetHudElements->entry[i] = 0;
|
||||
}
|
||||
@@ -3810,7 +3809,7 @@ void minimap_marker_pos(f32 x, f32 z, f32 angleSin, f32 angleCos, f32 modelAspec
|
||||
* deciding to draw a texture rectangle, ortho tris, or a 3D model entirely.
|
||||
*/
|
||||
void hud_element_render(Gfx **dList, Mtx **mtx, Vertex **vtxList, HudElement *hud) {
|
||||
ObjectModel **objModels;
|
||||
ModelInstance *model;
|
||||
TextureHeader *textureHeader2;
|
||||
TextureHeader *textureHeader;
|
||||
Camera *camera;
|
||||
@@ -3849,7 +3848,8 @@ void hud_element_render(Gfx **dList, Mtx **mtx, Vertex **vtxList, HudElement *hu
|
||||
objEntry.common.x = 0;
|
||||
objEntry.common.y = 0;
|
||||
objEntry.common.z = 0;
|
||||
gAssetHudElements->entry[hud->spriteID] = spawn_object((LevelObjectEntryCommon *) &objEntry, 0);
|
||||
gAssetHudElements->entry[hud->spriteID] =
|
||||
spawn_object((LevelObjectEntryCommon *) &objEntry, OBJECT_SPAWN_NONE);
|
||||
} else {
|
||||
gAssetHudElements->entry[hud->spriteID] = object_model_init(spriteElementId, 0);
|
||||
}
|
||||
@@ -3972,8 +3972,8 @@ void hud_element_render(Gfx **dList, Mtx **mtx, Vertex **vtxList, HudElement *hu
|
||||
} else {
|
||||
mtx_cam_push(&gHudDL, &gHudMtx, (ObjectTransform *) hud, 1.0f, 0.0f);
|
||||
if (0) {}
|
||||
objModels = gAssetHudElements->entry[hud->spriteID];
|
||||
hud_draw_model(*objModels);
|
||||
model = gAssetHudElements->entry[hud->spriteID];
|
||||
hud_draw_model(model->objModel);
|
||||
mtx_pop(&gHudDL);
|
||||
}
|
||||
spriteID = hud->spriteID;
|
||||
|
||||
+5
-5
@@ -13702,7 +13702,7 @@ void menu_asset_free(s32 assetID) {
|
||||
if ((*gAssetsMenuElementIds)[assetID] & ASSET_MASK_OBJECT) {
|
||||
free_object((Object *) (u32) gMenuAssets[assetID]);
|
||||
} else {
|
||||
free_3d_model((ObjectModel **) (u32) gMenuAssets[assetID]);
|
||||
free_3d_model((ModelInstance *) (u32) gMenuAssets[assetID]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13769,7 +13769,7 @@ void menu_asset_load(s32 assetID) {
|
||||
entry.x = 0;
|
||||
entry.y = 0;
|
||||
entry.z = 0;
|
||||
gMenuAssets[assetID] = spawn_object(&entry, 0);
|
||||
gMenuAssets[assetID] = spawn_object(&entry, OBJECT_SPAWN_NONE);
|
||||
} else {
|
||||
gMenuAssets[assetID] = object_model_init(i & 0x3FFF, 0);
|
||||
}
|
||||
@@ -13826,7 +13826,7 @@ void menu_element_render(s32 elementID) {
|
||||
Object *object;
|
||||
MenuAsset *asset;
|
||||
Sprite *sprite;
|
||||
ObjectModel **model;
|
||||
ModelInstance *model;
|
||||
|
||||
if (gMenuAssets[gMenuImages[elementID].trans.spriteID] != NULL) {
|
||||
if (((*gAssetsMenuElementIds)[gMenuImages[elementID].trans.spriteID] & ASSET_MASK_TEXTURE) !=
|
||||
@@ -13866,8 +13866,8 @@ void menu_element_render(s32 elementID) {
|
||||
gDPSetEnvColor(sMenuCurrDisplayList++, 255, 255, 255, 0);
|
||||
mtx_cam_push(&sMenuCurrDisplayList, &sMenuCurrHudMat, &gMenuImages[elementID].trans,
|
||||
gTrackSelectWoodFrameHeightScale, 0);
|
||||
model = ((ObjectModel **) gMenuAssets[gMenuImages[elementID].trans.spriteID]);
|
||||
render_track_selection_viewport_border(*model);
|
||||
model = gMenuAssets[gMenuImages[elementID].trans.spriteID];
|
||||
render_track_selection_viewport_border(model->objModel);
|
||||
mtx_pop(&sMenuCurrDisplayList);
|
||||
if (sMenuGuiOpacity < 255) {
|
||||
gDPSetPrimColor(sMenuCurrDisplayList++, 0, 0, 255, 255, 255, 255);
|
||||
|
||||
+24
-24
@@ -383,7 +383,7 @@ void obj_loop_lasergun(Object *obj, s32 updateRate) {
|
||||
audspat_play_sound_at_position(SOUND_LASER_GUN, obj->segment.trans.x_position,
|
||||
obj->segment.trans.y_position, obj->segment.trans.z_position,
|
||||
AUDIO_POINT_FLAG_ONE_TIME_TRIGGER, NULL);
|
||||
laserBoltObj = spawn_object(&spawnObj, 1);
|
||||
laserBoltObj = spawn_object(&spawnObj, OBJECT_SPAWN_UNK01);
|
||||
if (laserBoltObj != NULL) {
|
||||
laserBoltObj->segment.level_entry = NULL;
|
||||
laserBoltObj->segment.trans.rotation.y_rotation = obj->segment.trans.rotation.y_rotation;
|
||||
@@ -614,7 +614,7 @@ void obj_loop_trophycab(Object *obj, s32 updateRate) {
|
||||
newObject.y = obj->segment.level_entry->animation.common.y;
|
||||
newObject.z = obj->segment.level_entry->animation.common.z;
|
||||
newObject.size = sizeof(LevelObjectEntryCommon);
|
||||
tempObj = spawn_object(&newObject, 1);
|
||||
tempObj = spawn_object(&newObject, OBJECT_SPAWN_UNK01);
|
||||
if (tempObj != NULL) {
|
||||
tempObj->segment.level_entry = NULL;
|
||||
tempObj->segment.trans.rotation.y_rotation = obj->segment.trans.rotation.y_rotation;
|
||||
@@ -830,7 +830,7 @@ void obj_loop_eggcreator(Object *obj, UNUSED s32 updateRate) {
|
||||
spawnObj.z = obj->segment.trans.z_position;
|
||||
spawnObj.size = sizeof(LevelObjectEntryCommon);
|
||||
spawnObj.objectID = ASSET_OBJECT_ID_COLLECTEGG;
|
||||
eggObj = spawn_object(&spawnObj, 1);
|
||||
eggObj = spawn_object(&spawnObj, OBJECT_SPAWN_UNK01);
|
||||
if (eggObj != NULL) {
|
||||
Object_EggCreator *eggSpawner = &eggObj->unk64->egg_creator;
|
||||
eggSpawner->currentEgg = obj;
|
||||
@@ -1121,7 +1121,7 @@ void obj_loop_characterflag(Object *obj, UNUSED s32 updateRate) {
|
||||
obj->properties.characterFlag.characterID = 0;
|
||||
}
|
||||
flag->vertices = gCharacterFlagVertices;
|
||||
flag->texture = (TextureHeader *) &obj->unk68[obj->properties.characterFlag.characterID]->texHeader;
|
||||
flag->texture = obj->textures[obj->properties.characterFlag.characterID];
|
||||
temp_t4 = (flag->texture->width - 1) << 21;
|
||||
temp_t5 = (flag->texture->height - 1) << 5;
|
||||
// 0x40 = Draw backface
|
||||
@@ -1501,9 +1501,9 @@ void obj_init_fish(Object *fishObj, LevelObjectEntry_Fish *fishEntry, s32 param)
|
||||
}
|
||||
fishObj->segment.trans.scale = fishEntry->unkC * 0.01f;
|
||||
if (fishEntry->unkB < fishObj->segment.header->numberOfModelIds) {
|
||||
fish->texture = (TextureHeader *) fishObj->unk68[fishEntry->unkB];
|
||||
fish->texture = fishObj->textures[fishEntry->unkB];
|
||||
} else {
|
||||
fish->texture = (TextureHeader *) fishObj->unk68[0];
|
||||
fish->texture = fishObj->textures[0];
|
||||
}
|
||||
if (fish->texture != NULL) {
|
||||
uMask = (fish->texture->width - 1) << 5;
|
||||
@@ -1898,8 +1898,8 @@ void obj_loop_wizpigship(Object *wizShipObj, s32 updateRate) {
|
||||
ObjectTransform trans;
|
||||
|
||||
func_8001F460(wizShipObj, updateRate, wizShipObj);
|
||||
if ((*wizShipObj->unk68) != NULL) {
|
||||
wizShipModel = (*wizShipObj->unk68)->objModel;
|
||||
if (wizShipObj->modelInstances[0] != NULL) {
|
||||
wizShipModel = wizShipObj->modelInstances[0]->objModel;
|
||||
if (wizShipObj->properties.fireball.timer > 0) {
|
||||
wizShipObj->properties.fireball.timer -= updateRate;
|
||||
} else {
|
||||
@@ -1931,7 +1931,7 @@ void obj_loop_wizpigship(Object *wizShipObj, s32 updateRate) {
|
||||
newObject.z = posZ;
|
||||
newObject.size = sizeof(LevelObjectEntryCommon);
|
||||
newObject.objectID = ASSET_OBJECT_ID_LASERBOLT;
|
||||
newObj = spawn_object(&newObject, 1);
|
||||
newObj = spawn_object(&newObject, OBJECT_SPAWN_UNK01);
|
||||
if (newObj != NULL) {
|
||||
newObj->segment.level_entry = NULL;
|
||||
newObj->segment.trans.rotation.y_rotation =
|
||||
@@ -2048,7 +2048,7 @@ void obj_loop_char_select(Object *charSelectObj, s32 updateRate) {
|
||||
s32 charCount;
|
||||
s32 var_s0;
|
||||
s8 *status = NULL;
|
||||
Object_68 *gfxData;
|
||||
ModelInstance *modInst;
|
||||
u8 sp50[4];
|
||||
u8 sp4F;
|
||||
u8 *var_a2;
|
||||
@@ -2058,9 +2058,9 @@ void obj_loop_char_select(Object *charSelectObj, s32 updateRate) {
|
||||
charSelect = &charSelectObj->unk64->characterSelect;
|
||||
charSelectObj->particleEmittersEnabled = OBJ_EMIT_NONE;
|
||||
if (charSelect != NULL) {
|
||||
gfxData = charSelectObj->unk68[charSelectObj->segment.object.modelIndex];
|
||||
if (gfxData != NULL) {
|
||||
objMdl = gfxData->objModel;
|
||||
modInst = charSelectObj->modelInstances[charSelectObj->segment.object.modelIndex];
|
||||
if (modInst != NULL) {
|
||||
objMdl = modInst->objModel;
|
||||
if (is_drumstick_unlocked()) {
|
||||
if (is_tt_unlocked()) {
|
||||
var_a2 = D_800DCA70;
|
||||
@@ -4216,7 +4216,7 @@ void obj_loop_treasuresucker(Object *obj, s32 updateRate) {
|
||||
spawnObj.z = racerObj->segment.trans.z_position;
|
||||
spawnObj.size = sizeof(LevelObjectEntryCommon);
|
||||
spawnObj.objectID = ASSET_OBJECT_ID_FLYCOIN;
|
||||
newObj = spawn_object(&spawnObj, 1);
|
||||
newObj = spawn_object(&spawnObj, OBJECT_SPAWN_UNK01);
|
||||
if (newObj != NULL) {
|
||||
newObj->segment.level_entry = NULL;
|
||||
newObj->segment.y_velocity = 10.0f;
|
||||
@@ -4296,7 +4296,7 @@ void obj_loop_bananacreator(Object *obj, s32 updateRate) {
|
||||
newEntry.z = obj->segment.trans.z_position;
|
||||
newEntry.size = sizeof(LevelObjectEntryCommon);
|
||||
newEntry.objectID = ASSET_OBJECT_ID_COIN;
|
||||
newBananaObj = spawn_object(&newEntry, 1);
|
||||
newBananaObj = spawn_object(&newEntry, OBJECT_SPAWN_UNK01);
|
||||
obj->properties.bananaSpawner.spawn = TRUE;
|
||||
if (newBananaObj) {
|
||||
newBananaObj->segment.level_entry = NULL;
|
||||
@@ -5384,7 +5384,7 @@ void obj_spawn_effect(f32 x, f32 y, f32 z, s32 objectID, s32 soundID, f32 scale,
|
||||
spawnObj.common.size = 10;
|
||||
spawnObj.common.objectID = objectID;
|
||||
spawnObj.unk9 = arg6;
|
||||
newObj = spawn_object((LevelObjectEntryCommon *) &spawnObj, 1);
|
||||
newObj = spawn_object((LevelObjectEntryCommon *) &spawnObj, OBJECT_SPAWN_UNK01);
|
||||
if (newObj != NULL) {
|
||||
newObj->segment.level_entry = NULL;
|
||||
newObj->segment.x_velocity = 0.0f;
|
||||
@@ -5808,9 +5808,9 @@ void obj_init_butterfly(Object *butterflyObj, LevelObjectEntry_Butterfly *butter
|
||||
}
|
||||
butterflyObj->segment.trans.scale = butterflyEntry->unkB * 0.01f;
|
||||
if (butterflyEntry->unkA < butterflyObj->segment.header->numberOfModelIds) {
|
||||
butterfly->texture = (TextureHeader *) butterflyObj->unk68[butterflyEntry->unkA];
|
||||
butterfly->texture = butterflyObj->textures[butterflyEntry->unkA];
|
||||
} else {
|
||||
butterfly->texture = (TextureHeader *) butterflyObj->unk68[0];
|
||||
butterfly->texture = butterflyObj->textures[0];
|
||||
}
|
||||
if (butterfly->texture != NULL) {
|
||||
uMask = (butterfly->texture->width - 1) << 5;
|
||||
@@ -6135,7 +6135,7 @@ void obj_loop_butterfly(Object *butterflyObj, s32 updateRate) {
|
||||
|
||||
void obj_init_midifade(Object *obj, LevelObjectEntry_MidiFade *entry) {
|
||||
Object_MidiFade *midiFade;
|
||||
Object_68 *obj68;
|
||||
ModelInstance *modInst;
|
||||
ObjectTransform transform;
|
||||
f32 ox;
|
||||
f32 oy;
|
||||
@@ -6186,8 +6186,8 @@ void obj_init_midifade(Object *obj, LevelObjectEntry_MidiFade *entry) {
|
||||
midiFade->unk2F[i] = entry->unkA[i];
|
||||
}
|
||||
|
||||
obj68 = *obj->unk68;
|
||||
objModel = obj68->objModel;
|
||||
modInst = obj->modelInstances[0];
|
||||
objModel = modInst->objModel;
|
||||
vertex = &objModel->vertices[1];
|
||||
maxX = vertex->x;
|
||||
maxY = vertex->y;
|
||||
@@ -6245,7 +6245,7 @@ void obj_init_midifade(Object *obj, LevelObjectEntry_MidiFade *entry) {
|
||||
|
||||
void obj_init_midifadepoint(Object *obj, LevelObjectEntry_MidiFadePoint *entry) {
|
||||
Object_MidiFadePoint *obj64;
|
||||
ObjectModel **models;
|
||||
ModelInstance *modInst;
|
||||
ObjectModel *objModel;
|
||||
Vertex *vertex;
|
||||
s32 i;
|
||||
@@ -6269,8 +6269,8 @@ void obj_init_midifadepoint(Object *obj, LevelObjectEntry_MidiFadePoint *entry)
|
||||
obj64->unkC[i] = entry->unkC[i];
|
||||
}
|
||||
|
||||
models = *((ObjectModel ***) obj->unk68);
|
||||
objModel = models[0];
|
||||
modInst = obj->modelInstances[0];
|
||||
objModel = modInst->objModel;
|
||||
vertex = objModel->vertices + 1;
|
||||
x = vertex->x;
|
||||
y = vertex->y;
|
||||
|
||||
+32
-31
@@ -83,13 +83,13 @@ void allocate_object_model_pools(void) {
|
||||
* Also loads textures and animations.
|
||||
* v79 and newer have a bugfix that revert the cache count if allocation fails.
|
||||
*/
|
||||
Object_68 *object_model_init(s32 modelID, s32 flags) {
|
||||
ModelInstance *object_model_init(s32 modelID, s32 flags) {
|
||||
s32 i;
|
||||
s32 cacheIndex;
|
||||
ObjectModel *objMdl;
|
||||
s32 sp48;
|
||||
s32 temp_s0;
|
||||
Object_68 *ret;
|
||||
ModelInstance *instance;
|
||||
s8 sp3F;
|
||||
#if VERSION >= VERSION_79
|
||||
s8 var_a2;
|
||||
@@ -107,11 +107,11 @@ Object_68 *object_model_init(s32 modelID, s32 flags) {
|
||||
for (i = 0; i < gModelCacheCount; i++) {
|
||||
if (modelID == gModelCache[ASSETCACHE_ID(i)]) {
|
||||
objMdl = (ObjectModel *) gModelCache[ASSETCACHE_PTR(i)];
|
||||
ret = model_init_type(objMdl, flags);
|
||||
if (ret != NULL) {
|
||||
instance = model_init_type(objMdl, flags);
|
||||
if (instance != NULL) {
|
||||
objMdl->references++;
|
||||
}
|
||||
return ret;
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,13 +182,13 @@ Object_68 *object_model_init(s32 modelID, s32 flags) {
|
||||
}
|
||||
}
|
||||
if (func_80060EA8(objMdl) == 0 && func_80061A00(objMdl, modelID) == 0) {
|
||||
ret = model_init_type(objMdl, flags);
|
||||
if (ret != NULL) {
|
||||
instance = model_init_type(objMdl, flags);
|
||||
if (instance != NULL) {
|
||||
gModelCache[ASSETCACHE_ID(cacheIndex)] = modelID;
|
||||
gModelCache[ASSETCACHE_PTR(cacheIndex)] = (s32) objMdl;
|
||||
if (gModelCacheCount < MODEL_LOADED_MAX) {
|
||||
ret->animUpdateTimer = 0;
|
||||
return ret;
|
||||
instance->animUpdateTimer = 0;
|
||||
return instance;
|
||||
} else {
|
||||
stubbed_printf(D_800E6B64);
|
||||
}
|
||||
@@ -208,36 +208,37 @@ block_30:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Object_68 *model_init_type(ObjectModel *model, s32 flags) {
|
||||
ModelInstance *model_init_type(ObjectModel *model, s32 flags) {
|
||||
s32 temp;
|
||||
Object_68 *result;
|
||||
ModelInstance *result;
|
||||
Vertex *var_v1;
|
||||
Vertex *vertex;
|
||||
Vertex *mdlVertex;
|
||||
|
||||
if (model->numberOfAnimations != 0 && (flags & OBJECT_SPAWN_ANIMATION)) {
|
||||
temp = ((model->numberOfVertices * 2) * sizeof(Vertex)) + 36;
|
||||
result = (Object_68 *) mempool_alloc((model->unk4A * 6) + temp, COLOUR_TAG_BLUE);
|
||||
if (model->numberOfAnimations != 0 && (flags & OBJECT_BEHAVIOUR_ANIMATION)) {
|
||||
temp = ((model->numberOfVertices * 2) * sizeof(Vertex)) + sizeof(ModelInstance);
|
||||
result = (ModelInstance *) mempool_alloc((model->unk4A * 6) + temp, COLOUR_TAG_BLUE);
|
||||
if (result == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
result->vertices[0] = (Vertex *) ((u8 *) result + 36);
|
||||
result->vertices[1] = (Vertex *) ((u8 *) result + (model->numberOfVertices * sizeof(Vertex)) + 36);
|
||||
result->vertices[0] = (Vertex *) ((u8 *) result + sizeof(ModelInstance));
|
||||
result->vertices[1] =
|
||||
(Vertex *) ((u8 *) result + (model->numberOfVertices * sizeof(Vertex)) + sizeof(ModelInstance));
|
||||
result->vertices[2] = (Vertex *) ((u8 *) result + temp);
|
||||
result->modelType = MODELTYPE_ANIMATED;
|
||||
} else if (model->unk40 != NULL && (flags & OBJECT_SPAWN_UNK01)) {
|
||||
temp = (model->numberOfVertices * sizeof(Vertex)) + 36;
|
||||
result = (Object_68 *) mempool_alloc(temp, COLOUR_TAG_BLUE);
|
||||
} else if (model->unk40 != NULL && (flags & OBJECT_BEHAVIOUR_SHADED)) {
|
||||
temp = (model->numberOfVertices * sizeof(Vertex)) + sizeof(ModelInstance);
|
||||
result = (ModelInstance *) mempool_alloc(temp, COLOUR_TAG_BLUE);
|
||||
if (result == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
var_v1 = (Vertex *) ((u8 *) result + 36);
|
||||
var_v1 = (Vertex *) ((u8 *) result + sizeof(ModelInstance));
|
||||
result->vertices[0] = var_v1;
|
||||
result->vertices[1] = var_v1;
|
||||
result->vertices[2] = NULL;
|
||||
result->modelType = MODELTYPE_SHADE;
|
||||
} else {
|
||||
result = (Object_68 *) mempool_alloc(36, COLOUR_TAG_BLUE);
|
||||
result = (ModelInstance *) mempool_alloc(sizeof(ModelInstance), COLOUR_TAG_BLUE);
|
||||
if (result == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -293,21 +294,21 @@ Object_68 *model_init_type(ObjectModel *model, s32 flags) {
|
||||
/**
|
||||
* Attempts to free the object model from RAM.
|
||||
*/
|
||||
void free_3d_model(ObjectModel **modelPtr) {
|
||||
void free_3d_model(ModelInstance *modInst) {
|
||||
UNUSED s32 pad;
|
||||
s32 modelIndex;
|
||||
ObjectModel *model;
|
||||
s32 i;
|
||||
|
||||
if (modelPtr == 0) {
|
||||
if (modInst == NULL) {
|
||||
stubbed_printf(D_800E6BC0);
|
||||
return;
|
||||
}
|
||||
|
||||
model = *modelPtr;
|
||||
model = modInst->objModel;
|
||||
model->references--;
|
||||
if (model->references > 0) { // Model is still used, so free the reference and return.
|
||||
mempool_free(modelPtr);
|
||||
mempool_free(modInst);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -324,7 +325,7 @@ void free_3d_model(ObjectModel **modelPtr) {
|
||||
D_8011D634++;
|
||||
gModelCache[ASSETCACHE_ID(modelIndex)] = -1;
|
||||
gModelCache[ASSETCACHE_PTR(modelIndex)] = -1;
|
||||
mempool_free(modelPtr);
|
||||
mempool_free(modInst);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -931,7 +932,7 @@ s32 func_80061A00(ObjectModel *model, s32 animTableIndex) {
|
||||
|
||||
void func_80061C0C(Object *obj) {
|
||||
ObjectModel *mdl;
|
||||
Object_68 *gfxData;
|
||||
ModelInstance *modInst;
|
||||
s32 var_v1;
|
||||
|
||||
if (obj->segment.object.modelIndex < 0) {
|
||||
@@ -941,9 +942,9 @@ void func_80061C0C(Object *obj) {
|
||||
if (var_v1 < obj->segment.object.modelIndex) {
|
||||
obj->segment.object.modelIndex = var_v1;
|
||||
}
|
||||
gfxData = obj->unk68[obj->segment.object.modelIndex];
|
||||
mdl = gfxData->objModel;
|
||||
if (gfxData->objModel->animations != NULL) {
|
||||
modInst = obj->modelInstances[obj->segment.object.modelIndex];
|
||||
mdl = modInst->objModel;
|
||||
if (modInst->objModel->animations != NULL) {
|
||||
if (obj->segment.object.animationID < 0) {
|
||||
obj->segment.object.animationID = 0;
|
||||
}
|
||||
@@ -960,7 +961,7 @@ void func_80061C0C(Object *obj) {
|
||||
}
|
||||
if (var_v1 < obj->segment.animFrame >> 4) {
|
||||
obj->segment.animFrame = 0;
|
||||
gfxData->animationID = -1;
|
||||
modInst->animationID = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -23,11 +23,11 @@ extern s32 gTrackRenderFuncLength;
|
||||
void allocate_object_model_pools(void);
|
||||
void func_800619F4(s32 arg0);
|
||||
void func_80061C0C(Object* obj);
|
||||
void free_3d_model(ObjectModel **modelPtr);
|
||||
void free_3d_model(ModelInstance *modInst);
|
||||
s32 func_80061A00(ObjectModel *model, s32 animTableIndex);
|
||||
s32 check_nearby_vertices(Vertex *vertices, s32 arg1, s32 arg2, s32 arg3, s32 arg4);
|
||||
Object_68 *model_init_type(ObjectModel *model, s32 flags);
|
||||
Object_68 *object_model_init(s32 modelID, s32 flags);
|
||||
ModelInstance *model_init_type(ObjectModel *model, s32 flags);
|
||||
ModelInstance *object_model_init(s32 modelID, s32 flags);
|
||||
s32 func_80060C58(Vertex *vertices, s32 i1, s32 i2, s32 i3, s32 i4);
|
||||
|
||||
void free_model_data(ObjectModel *mdl); // Non Matching
|
||||
|
||||
+324
-311
File diff suppressed because it is too large
Load Diff
+13
-4
@@ -175,11 +175,20 @@ enum ObjectInteractionFlags {
|
||||
enum ObjectSpawnFlags {
|
||||
OBJECT_SPAWN_NONE,
|
||||
OBJECT_SPAWN_UNK01 = (1 << 0),
|
||||
OBJECT_SPAWN_SHADOW = (1 << 1),
|
||||
OBJECT_SPAWN_UNK02 = (1 << 1),
|
||||
OBJECT_SPAWN_UNK04 = (1 << 2),
|
||||
OBJECT_SPAWN_ANIMATION = (1 << 3),
|
||||
OBJECT_SPAWN_INTERACTIVE = (1 << 4),
|
||||
OBJECT_SPAWN_UNK20 = (1 << 5)
|
||||
OBJECT_SPAWN_UNK08 = (1 << 3),
|
||||
OBJECT_SPAWN_UNK10 = (1 << 4)
|
||||
};
|
||||
|
||||
enum ObjectBehaviourFlags {
|
||||
OBJECT_BEHAVIOUR_NONE,
|
||||
OBJECT_BEHAVIOUR_SHADED = (1 << 0),
|
||||
OBJECT_BEHAVIOUR_SHADOW = (1 << 1),
|
||||
OBJECT_BEHAVIOUR_WATER_EFFECT = (1 << 2),
|
||||
OBJECT_BEHAVIOUR_ANIMATION = (1 << 3),
|
||||
OBJECT_BEHAVIOUR_INTERACTIVE = (1 << 4),
|
||||
OBJECT_BEHAVIOUR_UNK20 = (1 << 5)
|
||||
};
|
||||
|
||||
enum ContPakErrors {
|
||||
|
||||
+2
-2
@@ -6970,8 +6970,8 @@ void handle_racer_items(Object *obj, Object_Racer *racer, UNUSED s32 updateRate)
|
||||
if (gCurrentButtonsPressed & Z_TRIG || racer->raceFinished || racer->attackType) {
|
||||
scaleY = 0;
|
||||
scaleZ = 0;
|
||||
if (obj->unk68[obj->segment.object.modelIndex] != NULL) {
|
||||
model = obj->unk68[obj->segment.object.modelIndex]->objModel;
|
||||
if (obj->modelInstances[obj->segment.object.modelIndex] != NULL) {
|
||||
model = obj->modelInstances[obj->segment.object.modelIndex]->objModel;
|
||||
if (obj->segment.header->unk58 > -1 && obj->segment.header->unk58 < model->unk18) {
|
||||
if (obj->curVertData != NULL) {
|
||||
heldObjData = obj->curVertData;
|
||||
|
||||
@@ -112,10 +112,8 @@ typedef enum TransFlags {
|
||||
typedef enum HeaderFlags {
|
||||
HEADER_FLAGS_NONE,
|
||||
HEADER_FLAGS_UNK_0001 = (1 << 0),
|
||||
HEADER_FLAGS_UNK_0002 = (1 << 1),
|
||||
HEADER_FLAGS_UNK_0004 = (1 << 2),
|
||||
HEADER_FLAGS_UNK_0008 = (1 << 3),
|
||||
HEADER_FLAGS_WATER_EFFECT = (1 << 4),
|
||||
HEADER_FLAGS_UNK_0080 = (1 << 7),
|
||||
} HeaderFlags;
|
||||
|
||||
typedef enum BasicRenderIDs {
|
||||
|
||||
+2
-2
@@ -1343,7 +1343,7 @@ void spawn_skydome(s32 objectID) {
|
||||
spawnObject.z = 0;
|
||||
spawnObject.size = sizeof(LevelObjectEntryCommon);
|
||||
spawnObject.objectID = objectID;
|
||||
gSkydomeSegment = spawn_object(&spawnObject, OBJECT_SPAWN_SHADOW);
|
||||
gSkydomeSegment = spawn_object(&spawnObject, OBJECT_SPAWN_UNK02);
|
||||
if (gSkydomeSegment != NULL) {
|
||||
gSkydomeSegment->segment.level_entry = NULL;
|
||||
gSkydomeSegment->objectID = -1;
|
||||
@@ -1867,7 +1867,7 @@ void render_level_geometry_and_objects(void) {
|
||||
shadow_render(obj, obj->shadow);
|
||||
}
|
||||
render_object(&gTrackDL, &gTrackMtxPtr, &gTrackVtxPtr, obj);
|
||||
if ((obj->waterEffect != 0) && (obj->segment.header->flags & 0x10)) {
|
||||
if ((obj->waterEffect != 0) && (obj->segment.header->flags & HEADER_FLAGS_WATER_EFFECT)) {
|
||||
watereffect_render(obj, obj->waterEffect);
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -53,7 +53,7 @@ void update_bluey(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *ra
|
||||
s32 steerVel;
|
||||
s32 tempStartTimer;
|
||||
ObjectModel *objModel;
|
||||
Object_68 *gfxData;
|
||||
ModelInstance *modInst;
|
||||
s32 sp3C;
|
||||
UNUSED s32 pad;
|
||||
Object *firstRacerObj;
|
||||
@@ -151,18 +151,18 @@ void update_bluey(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *ra
|
||||
} else {
|
||||
racer->animationSpeed += updateRateF * 1.0;
|
||||
}
|
||||
gfxData = *obj->unk68;
|
||||
objModel = gfxData->objModel;
|
||||
modInst = obj->modelInstances[0];
|
||||
objModel = modInst->objModel;
|
||||
diffX = (objModel->animations[obj->segment.object.animationID].animLength * 16) - 17;
|
||||
while (racer->animationSpeed < 0.0f) {
|
||||
racer->animationSpeed += diffX;
|
||||
gfxData->animationID = -1;
|
||||
modInst->animationID = -1;
|
||||
}
|
||||
while (diffX < racer->animationSpeed) {
|
||||
racer->animationSpeed -= diffX;
|
||||
gfxData->animationID = -1;
|
||||
modInst->animationID = -1;
|
||||
}
|
||||
if (gfxData->animationID == -1 && obj->segment.object.animationID == ANIM_BLUEY_DAMAGE) {
|
||||
if (modInst->animationID == -1 && obj->segment.object.animationID == ANIM_BLUEY_DAMAGE) {
|
||||
obj->segment.object.animationID = racer->unk1CD;
|
||||
}
|
||||
animFrame = obj->segment.animFrame;
|
||||
|
||||
@@ -52,7 +52,7 @@ void update_bubbler(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *
|
||||
s16 tempHeadAngle;
|
||||
s32 objectID;
|
||||
f32 diffZ;
|
||||
Object_68 *gfxData;
|
||||
ModelInstance *modInst;
|
||||
s32 timer;
|
||||
UNUSED s32 pad;
|
||||
s32 headAngleRange;
|
||||
@@ -111,20 +111,20 @@ void update_bubbler(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *
|
||||
diffZ = obj->segment.z_velocity * obj->segment.z_velocity;
|
||||
racer->velocity = -sqrtf((diffX * diffX) + (diffZ * diffZ));
|
||||
}
|
||||
gfxData = *obj->unk68;
|
||||
model = gfxData->objModel;
|
||||
modInst = obj->modelInstances[0];
|
||||
model = modInst->objModel;
|
||||
diffX = (model->animations[obj->segment.object.animationID].animLength * 16) - 17;
|
||||
obj->segment.object.animationID = ANIM_BUBBLER_MOVE;
|
||||
racer->animationSpeed += 2.0 * updateRateF;
|
||||
while (racer->animationSpeed < 0.0f) {
|
||||
racer->animationSpeed += diffX;
|
||||
gfxData->animationID = -1;
|
||||
modInst->animationID = -1;
|
||||
}
|
||||
while (diffX < racer->animationSpeed) {
|
||||
racer->animationSpeed -= diffX;
|
||||
gfxData->animationID = -1;
|
||||
modInst->animationID = -1;
|
||||
}
|
||||
if (gfxData->animationID == -1 && obj->segment.object.animationID == ANIM_BUBBLER_DAMAGE) {
|
||||
if (modInst->animationID == -1 && obj->segment.object.animationID == ANIM_BUBBLER_DAMAGE) {
|
||||
obj->segment.object.animationID = ANIM_BUBBLER_MOVE;
|
||||
racer->animationSpeed = 0.0f;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ void update_rocket(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r
|
||||
Object *someObj;
|
||||
Object *firstRacerObj;
|
||||
Object_WizpigRocket *rocket;
|
||||
Object_68 *gfxData;
|
||||
ModelInstance *modInst;
|
||||
ObjectModel *objModel;
|
||||
|
||||
set_boss_voice_clip_offset((u16 *) gRocketVoiceTable);
|
||||
@@ -112,18 +112,18 @@ void update_rocket(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r
|
||||
}
|
||||
}
|
||||
racer->animationSpeed += 2.0 * updateRateF;
|
||||
gfxData = *obj->unk68;
|
||||
objModel = gfxData->objModel;
|
||||
modInst = obj->modelInstances[0];
|
||||
objModel = modInst->objModel;
|
||||
diffX = (objModel->animations[obj->segment.object.animationID].animLength * 16) - 17;
|
||||
while (diffX <= racer->animationSpeed) {
|
||||
racer->animationSpeed -= diffX;
|
||||
gfxData->animationID = -1;
|
||||
modInst->animationID = -1;
|
||||
}
|
||||
while (racer->animationSpeed <= 0.0f) {
|
||||
racer->animationSpeed += diffX;
|
||||
gfxData->animationID = -1;
|
||||
modInst->animationID = -1;
|
||||
}
|
||||
if (obj->segment.object.animationID == ANIM_ROCKET_DAMAGE && gfxData->animationID == -1) {
|
||||
if (obj->segment.object.animationID == ANIM_ROCKET_DAMAGE && modInst->animationID == -1) {
|
||||
obj->segment.object.animationID = ANIM_ROCKET_IDLE;
|
||||
racer->animationSpeed = 0.0f;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ void update_smokey(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r
|
||||
f32 diffX;
|
||||
f32 diffZ;
|
||||
ObjectModel *objModel;
|
||||
Object_68 *gfxData;
|
||||
ModelInstance *modInst;
|
||||
s32 headAngleRange;
|
||||
f32 animVelocity;
|
||||
UNUSED s32 pad;
|
||||
@@ -126,8 +126,8 @@ void update_smokey(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r
|
||||
obj->segment.z_velocity = 0.0f;
|
||||
}
|
||||
}
|
||||
gfxData = *obj->unk68;
|
||||
objModel = gfxData->objModel;
|
||||
modInst = obj->modelInstances[0];
|
||||
objModel = modInst->objModel;
|
||||
diffX = (objModel->animations[obj->segment.object.animationID].animLength * 16) - 17;
|
||||
animVelocity = (racer->velocity * updateRateF) * 0.45;
|
||||
if (animVelocity <= 0.0) {
|
||||
@@ -172,17 +172,17 @@ void update_smokey(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r
|
||||
}
|
||||
while (diffX <= racer->animationSpeed) {
|
||||
racer->animationSpeed -= diffX;
|
||||
gfxData->animationID = -1;
|
||||
modInst->animationID = -1;
|
||||
}
|
||||
while (racer->animationSpeed <= 0.0f) {
|
||||
racer->animationSpeed += diffX;
|
||||
gfxData->animationID = -1;
|
||||
modInst->animationID = -1;
|
||||
}
|
||||
if (obj->segment.object.animationID == ANIM_SMOKEY_WALK && racer->groundedWheels == 0 && racer->velocity < -6.5) {
|
||||
obj->segment.object.animationID = ANIM_SMOKEY_LAND;
|
||||
racer->animationSpeed = 0.0f;
|
||||
}
|
||||
if (gfxData->animationID == -1 || obj->segment.object.animationID == ANIM_SMOKEY_IDLE) {
|
||||
if (modInst->animationID == -1 || obj->segment.object.animationID == ANIM_SMOKEY_IDLE) {
|
||||
if (obj->segment.object.animationID == ANIM_SMOKEY_DAMAGE) {
|
||||
obj->segment.object.animationID = racer->unk1CD;
|
||||
racer->animationSpeed = 0.0f;
|
||||
|
||||
@@ -75,7 +75,7 @@ void update_tricky(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r
|
||||
f32 diffZ;
|
||||
ObjectModel *objModel;
|
||||
s32 tempStartTimer;
|
||||
Object_68 *gfxData;
|
||||
ModelInstance *modInst;
|
||||
s32 headAngleRange;
|
||||
UNUSED s32 pad;
|
||||
Object *firstRacerObj;
|
||||
@@ -130,8 +130,8 @@ void update_tricky(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r
|
||||
diffZ = obj->segment.z_velocity * obj->segment.z_velocity;
|
||||
racer->velocity = -sqrtf((diffX * diffX) + (diffZ * diffZ));
|
||||
}
|
||||
gfxData = *obj->unk68;
|
||||
objModel = gfxData->objModel;
|
||||
modInst = obj->modelInstances[0];
|
||||
objModel = modInst->objModel;
|
||||
diffX = (objModel->animations[obj->segment.object.animationID].animLength * 16) - 17;
|
||||
if (obj->segment.object.animationID != ANIM_TRICKY_DAMAGE) {
|
||||
if (racer->velocity < -2.0) {
|
||||
@@ -149,13 +149,13 @@ void update_tricky(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r
|
||||
}
|
||||
while (racer->animationSpeed < 0.0f) {
|
||||
racer->animationSpeed += diffX;
|
||||
gfxData->animationID = -1;
|
||||
modInst->animationID = -1;
|
||||
}
|
||||
while (diffX < racer->animationSpeed) {
|
||||
racer->animationSpeed -= diffX;
|
||||
gfxData->animationID = -1;
|
||||
modInst->animationID = -1;
|
||||
}
|
||||
if (gfxData->animationID == -1 && obj->segment.object.animationID == ANIM_TRICKY_DAMAGE) {
|
||||
if (modInst->animationID == -1 && obj->segment.object.animationID == ANIM_TRICKY_DAMAGE) {
|
||||
obj->segment.object.animationID = racer->unk1CD;
|
||||
}
|
||||
animFrame = obj->segment.animFrame;
|
||||
|
||||
@@ -52,7 +52,7 @@ void update_wizpig(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r
|
||||
s32 tempStartTimer;
|
||||
Object *firstRacerObj;
|
||||
ObjectModel *objModel;
|
||||
Object_68 *gfxData;
|
||||
ModelInstance *modInst;
|
||||
|
||||
set_boss_voice_clip_offset((u16 *) gWizpigVoiceTable);
|
||||
racer->tappedR = 0;
|
||||
@@ -123,8 +123,8 @@ void update_wizpig(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r
|
||||
nextCheckpoint = TRUE;
|
||||
}
|
||||
racer->x_rotation_offset = -obj->segment.trans.rotation.x_rotation;
|
||||
gfxData = *obj->unk68;
|
||||
objModel = gfxData->objModel;
|
||||
modInst = obj->modelInstances[0];
|
||||
objModel = modInst->objModel;
|
||||
diffX = (objModel->animations[obj->segment.object.animationID].animLength * 16) - 17;
|
||||
animVelocity = (racer->velocity * updateRateF) * 0.45;
|
||||
if (animVelocity <= 0.0) {
|
||||
@@ -170,17 +170,17 @@ void update_wizpig(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r
|
||||
|
||||
while (diffX <= racer->animationSpeed) {
|
||||
racer->animationSpeed -= diffX;
|
||||
gfxData->animationID = -1;
|
||||
modInst->animationID = -1;
|
||||
}
|
||||
while (racer->animationSpeed <= 0.0f) {
|
||||
racer->animationSpeed += diffX;
|
||||
gfxData->animationID = -1;
|
||||
modInst->animationID = -1;
|
||||
}
|
||||
if (obj->segment.object.animationID == ANIM_WIZPIG_RUN && nextCheckpoint) {
|
||||
obj->segment.object.animationID = ANIM_WIZPIG_JUMP;
|
||||
racer->animationSpeed = 0.0f;
|
||||
}
|
||||
if (gfxData->animationID == -1 || obj->segment.object.animationID == ANIM_WIZPIG_IDLE) {
|
||||
if (modInst->animationID == -1 || obj->segment.object.animationID == ANIM_WIZPIG_IDLE) {
|
||||
if (obj->segment.object.animationID == ANIM_WIZPIG_DAMAGE) {
|
||||
obj->segment.object.animationID = racer->unk1CD;
|
||||
racer->animationSpeed = 0.0f;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user