From 29307ec75ab1d2b091e38fdcbf2b50027312e6b0 Mon Sep 17 00:00:00 2001 From: Fazana <52551480+FazanaJ@users.noreply.github.com> Date: Sun, 14 May 2023 22:48:05 +0100 Subject: [PATCH] Clean up Object struct quite a lot (#390) * yo I finally went and figured out what the majority of unk6 is lmao * rename entry * man honestly game.c is a mess they really did just throw every old thing here * Name some initialiser funcs * more * destroyed another temp struct * potassium * tweak * pain * it never ends * a new pain arises * Update README.md * quick fixes * add colour macro * name a func * Object78 is much cleaner now. * object struct cleanup for particles * object segment struct cleanup * quick fix * style fix * Update racer.c * Update structs.h * squeeze in a bit more renaming * ok last one * fix funny typo * smile emote * Update racer.c --- include/level_object_entries.h | 42 +- include/object_properties.h | 185 ++++++ include/structs.h | 263 ++------ src/audio.c | 8 +- src/audio.h | 2 +- src/camera.c | 36 +- src/game.c | 2 +- src/game_ui.c | 4 +- src/menu.c | 2 +- src/object_functions.c | 1119 ++++++++++++++++---------------- src/object_functions.h | 22 +- src/object_models.c | 20 +- src/objects.c | 72 +- src/particles.c | 148 ++--- src/particles.h | 44 +- src/racer.c | 72 +- src/unknown_0255E0.c | 44 +- src/vehicle_bluey.c | 34 +- src/vehicle_bubbler.c | 24 +- src/vehicle_rocket.c | 18 +- src/vehicle_smokey.c | 74 +-- src/vehicle_tricky.c | 34 +- src/vehicle_wizpig.c | 56 +- src/waves.c | 4 +- 24 files changed, 1185 insertions(+), 1144 deletions(-) create mode 100644 include/object_properties.h diff --git a/include/level_object_entries.h b/include/level_object_entries.h index 86cae3ee..2b068c78 100644 --- a/include/level_object_entries.h +++ b/include/level_object_entries.h @@ -18,9 +18,9 @@ typedef struct LevelObjectEntry_Racer { typedef struct LevelObjectEntry_Scenery { /* 0x00 */ LevelObjectEntryCommon common; - /* 0x08 */ u8 unk8; + /* 0x08 */ u8 numModelIDs; /* 0x09 */ u8 radius; - /* 0x0A */ u8 unkA; + /* 0x0A */ u8 angleY; /* 0x0B */ u8 solid; } LevelObjectEntry_Scenery; @@ -62,7 +62,7 @@ typedef struct LevelObjectEntry_Exit { /* 0x0B */ u8 padB[5]; /* 0x10 */ u8 radius; // Activation radius. - /* 0x11 */ u8 unk11; + /* 0x11 */ u8 angleY; /* 0x12 */ u8 pad12[5]; // Defines the location in a hub world the player will spawn at when exiting `destinationMapId`. @@ -95,7 +95,7 @@ typedef struct LevelObjectEntry_AudioLine { /* 0x00 */ LevelObjectEntryCommon common; /* 0x08 */ u8 unk8; /* 0x09 */ u8 unk9; - /* 0x0A */ u16 unkA; + /* 0x0A */ u16 soundID; /* 0x0C */ u8 unkC; /* 0x0D */ u8 unkD; /* 0x0E */ u16 unkE; @@ -185,7 +185,7 @@ typedef struct LevelObjectEntry_WeaponBalloon { /* 0x00 */ LevelObjectEntryCommon common; /* 0x08 */ u8 unk8; // Unused? /* 0x09 */ u8 balloonType; - /* 0x0A */ u8 scale; // This is divided by 64 to get actual scale. + /* 0x0A */ u8 radius; // This is divided by 64 to get actual scale. } LevelObjectEntry_WeaponBalloon; typedef struct LevelObjectEntry_AudioSeqLine { @@ -207,7 +207,7 @@ typedef struct LevelObjectEntry_Unknown25 { typedef struct LevelObjectEntry_SkyControl { /* 0x00 */ LevelObjectEntryCommon common; - /* 0x08 */ u8 unk8; + /* 0x08 */ u8 setting; /* 0x09 */ u8 radius; } LevelObjectEntry_SkyControl; @@ -267,14 +267,14 @@ typedef struct LevelObjectEntry_Weather { typedef struct LevelObjectEntry_Bridge_WhaleRamp { /* 0x00 */ LevelObjectEntryCommon common; - /* 0x08 */ u8 unk8; - /* 0x09 */ u8 unk9; + /* 0x08 */ u8 numModelIDs; + /* 0x09 */ u8 angleY; /* 0x0A */ u8 unkA; /* 0x0B */ u8 unkB; - /* 0x0C */ u8 unkC; + /* 0x0C */ u8 radius; /* 0x0D */ u8 unkD; /* 0x0E */ s8 unkE; - /* 0x0F */ u8 unkF; + /* 0x0F */ u8 allowedVehicles; } LevelObjectEntry_Bridge_WhaleRamp; typedef struct LevelObjectEntry_RampSwitch { @@ -368,8 +368,8 @@ typedef struct LevelObjectEntry_InfoPoint { typedef struct LevelObjectEntry_Trigger { /* 0x00 */ LevelObjectEntryCommon common; /* 0x08 */ u8 scale; - /* 0x09 */ s8 unk9; - /* 0x0A */ u8 rotation; + /* 0x09 */ s8 index; + /* 0x0A */ u8 angleY; /* 0x0B */ u8 unkB; /* 0x0C */ u8 unkC; /* 0x0D */ u8 unkD; @@ -413,12 +413,12 @@ typedef struct LevelObjectEntry_BananaCreator { typedef struct LevelObjectEntry_TreasureSucker { /* 0x00 */ LevelObjectEntryCommon common; - /* 0x08 */ s8 unk8; + /* 0x08 */ s8 playerID; } LevelObjectEntry_TreasureSucker; typedef struct LevelObjectEntry_Log { /* 0x00 */ LevelObjectEntryCommon common; - /* 0x08 */ u8 unk8; + /* 0x08 */ u8 numModelIDs; /* 0x09 */ u8 radius; /* 0x0A */ u8 angleY; } LevelObjectEntry_Log; @@ -440,7 +440,7 @@ typedef struct LevelObjectEntry_HitTester { typedef struct LevelObjectEntry_MidiFade { /* 0x00 */ LevelObjectEntryCommon common; /* 0x08 */ u8 scale; - /* 0x09 */ u8 rotation; + /* 0x09 */ u8 angleY; /* 0x0A */ u8 unkA[16]; // Is this 16 bytes or 15 bytes with a padded 0? /* 0x1A */ u8 unk1A; /* 0x1B */ u8 unk1B; @@ -462,7 +462,7 @@ typedef struct LevelObjectEntry_EffectBox { typedef struct LevelObjectEntry_TrophyCab { /* 0x00 */ LevelObjectEntryCommon common; - /* 0x08 */ u8 rotation; + /* 0x08 */ u8 angleY; } LevelObjectEntry_TrophyCab; typedef struct LevelObjectEntry_Bubbler { @@ -489,8 +489,8 @@ typedef struct LevelObjectEntry_Laserbolt { typedef struct LevelObjectEntry_Lasergun { /* 0x00 */ LevelObjectEntryCommon common; - /* 0x08 */ u8 angleX; - /* 0x09 */ u8 angleY; + /* 0x08 */ u8 angleY; + /* 0x09 */ u8 angleX; /* 0x0A */ s8 targeting; /* 0x0B */ s8 fireRate; /* 0x0C */ u8 laserDuration; @@ -501,7 +501,7 @@ typedef struct LevelObjectEntry_GroundZipper { /* 0x00 */ LevelObjectEntryCommon common; /* 0x08 */ u8 unk8; /* 0x09 */ u8 scale; - /* 0x0A */ u8 rotation; + /* 0x0A */ u8 angleY; } LevelObjectEntry_GroundZipper; typedef struct LevelObjectEntry_OverridePos { @@ -598,8 +598,8 @@ typedef struct LevelObjectEntry_OctoBubble { typedef struct LevelObjectEntry_LevelName { /* 0x00 */ LevelObjectEntryCommon common; - /* 0x08 */ s8 unk8; - /* 0x09 */ s8 unk9; + /* 0x08 */ s8 levelID; + /* 0x09 */ s8 radius; } LevelObjectEntry_LevelName; typedef struct LevelObjectEntry_Midichset { diff --git a/include/object_properties.h b/include/object_properties.h new file mode 100644 index 00000000..2411a50f --- /dev/null +++ b/include/object_properties.h @@ -0,0 +1,185 @@ +#ifndef _OBJECT_PROPERTIES_H_ +#define _OBJECT_PROPERTIES_H_ + +#include "types.h" +#include "enums.h" +#include "level_object_entries.h" + +/** + * Objects have a union at offset 0x78, that's 8 bytes large. + * Here's a collection of unions to help improve readability for them. +*/ + +typedef struct ObjPropertyCommon { + s32 unk0; + s32 unk4; +} ObjPropertyCommon; + +typedef struct ObjPropertyDistance { + f32 radius; + s32 unk4; +} ObjPropertyDistance; + +typedef struct ObjPropertySpeed { + s32 speed; + s32 unk4; +} ObjPropertySpeed; + +typedef struct ObjPropertyBanana { + s32 unk0; + s16 unk4; + s16 unk6; +} ObjPropertyBanana; + +typedef struct ObjPropertyName { + f32 radius; + s16 levelID; + s16 opacity; +} ObjPropertyName; + +typedef struct ObjPropertyProjectile { + s32 timer; + s32 unk4; +} ObjPropertyProjectile; + +typedef struct ObjPropertyLog { + s32 angleVel; + s32 velocityY; +} ObjPropertyLog; + +typedef struct ObjPropertyScenery { + struct Object *interactObj; + s16 hitTimer; + s16 angleVel; +} ObjPropertyScenery; + +typedef struct ObjPropertyFireball { + struct Object *obj; + s32 timer; +} ObjPropertyFireball; + +typedef struct ObjPropertyLasergun { + s32 timer; + struct Object_LaserGun *obj; +} ObjPropertyLasergun; + +typedef struct ObjPropertyTrophyCabinet { + s32 action; + s32 trophy; +} ObjPropertyTrophyCabinet; + +typedef struct ObjPropertyEggSpawner { + struct Object *egg; +} ObjPropertyEggSpawner; + +typedef struct ObjPropertyZipper { + s32 radius; +} ObjPropertyZipper; + +typedef struct ObjPropertyCharacterFlag { + s32 playerID; + s32 characterID; +} ObjPropertyCharacterFlag; + +typedef struct ObjPropertyNPC { + s32 action; + s32 timer; +} ObjPropertyNPC; + +typedef struct ObjPropertyLavaSpurt { + s32 actionTimer; + s32 delayTimer; +} ObjPropertyLavaSpurt; + +typedef struct ObjPropertyAnimation { + s32 action; + s32 behaviourID; +} ObjPropertyAnimation; + +typedef struct ObjPropertyInfoPoint { + s32 radius; + s32 visible; +} ObjPropertyInfoPoint; + +typedef struct ObjPropertyBombExplosion { + s32 timer; + s32 unk4; +} ObjPropertyBombExplosion; + +typedef struct ObjPropertyLighthouse { + s32 active; +} ObjPropertyLighthouse; + +typedef struct ObjPropertyDoor { + s32 closeAngle; + s32 openAngle; +} ObjPropertyDoor; + +typedef struct ObjPropertySkyControl { + s32 setting; + s32 radius; +} ObjPropertySkyControl; + +typedef struct ObjPropertyTreasureSucker { + s32 playerID; + s32 spawnTimer; +} ObjPropertyTreasureSucker; + +typedef struct ObjPropertyTreasureBanana { + s32 diff; + struct Object_Racer *racer; +} ObjPropertyTreasureBanana; + +typedef struct ObjPropertyBananaSpawner { + s32 timer; + s32 spawn; +} ObjPropertyBananaSpawner; + +typedef struct ObjPropertyWorldKey { + s32 keyID; +} ObjPropertyWorldKey; + +typedef struct ObjPropertyWeaponBalloon { + s32 balloonID; + s32 unk4; +} ObjPropertyWeaponBalloon; + +typedef struct ObjPropertyRacer { + struct Object *unk0; + s32 unk4; +} ObjPropertyRacer; + +typedef struct ObjProperties { + union { + ObjPropertyCommon common; + ObjPropertyDistance distance; + ObjPropertySpeed speed; + ObjPropertyBanana banana; + ObjPropertyName levelName; + ObjPropertyProjectile projectile; + ObjPropertyLog log; + ObjPropertyScenery scenery; + ObjPropertyFireball fireball; + ObjPropertyLasergun lasergun; + ObjPropertyTrophyCabinet trophyCabinet; + ObjPropertyEggSpawner eggSpawner; + ObjPropertyZipper zipper; + ObjPropertyCharacterFlag characterFlag; + ObjPropertyNPC npc; + ObjPropertyLavaSpurt lavaSpurt; + ObjPropertyAnimation animatedObj; + ObjPropertyInfoPoint infoPoint; + ObjPropertyBombExplosion bombExplosion; + ObjPropertyLighthouse lighthouse; + ObjPropertyDoor door; + ObjPropertySkyControl skyControl; + ObjPropertyTreasureSucker treasureSucker; + ObjPropertyTreasureBanana treasureBanana; + ObjPropertyBananaSpawner bananaSpawner; + ObjPropertyWorldKey worldKey; + ObjPropertyWeaponBalloon weaponBalloon; + ObjPropertyRacer racer; + }; +} ObjProperties; + +#endif diff --git a/include/structs.h b/include/structs.h index e175a2ae..46963da3 100644 --- a/include/structs.h +++ b/include/structs.h @@ -6,6 +6,7 @@ #include "types.h" #include "enums.h" #include "level_object_entries.h" +#include "object_properties.h" // Stolen from PD // This hacky structure allows coords to be accessed using @@ -832,7 +833,7 @@ typedef struct Object_Animation { } Object_Animation; typedef struct Object_WeaponBalloon { - /* 0x0 */ f32 unk0; + /* 0x0 */ f32 radius; /* 0x4 */ s16 unk4; /* 0x6 */ s8 unk6[0x2]; } Object_WeaponBalloon; @@ -848,7 +849,7 @@ typedef struct Object_Weapon { /* 0x18 */ u8 weaponID; /* 0x19 */ s8 checkpoint; /* 0x19 */ s16 unk1A; - /* 0x19 */ s32 unk1C; + /* 0x19 */ s32 soundMask; } Object_Weapon; typedef struct Object_Butterfly { @@ -898,7 +899,7 @@ typedef struct Object_EggCreator { typedef struct Object_CollectEgg { /* 0x0 */ u8 pad0[4]; - /* 0x4 */ struct Object *unk4; + /* 0x4 */ struct Object *spawnerObj; /* 0x8 */ s16 hatchTimer; /* 0xA */ s8 racerID; /* 0xB */ s8 status; @@ -935,7 +936,7 @@ typedef struct Object_InfoPoint { } Object_InfoPoint; typedef struct Object_TTDoor { - /* 0x00 */ f32 unk0; + /* 0x00 */ f32 homeY; /* 0x04 */ s32 *soundMask; /* 0x08 */ s32 unk8; /* 0x0C */ s16 unkC; @@ -953,7 +954,7 @@ typedef struct Object_WorldKey { typedef struct Object_AudioLine { /* 0x00 */ u8 unk0; /* 0x01 */ u8 pad1; - /* 0x02 */ u16 unk2; + /* 0x02 */ u16 soundID; /* 0x04 */ u16 unk4; /* 0x06 */ u16 unk6; /* 0x08 */ union { @@ -1245,24 +1246,6 @@ typedef struct Object_Racer { /* 0x220 */ s32 unk220; } Object_Racer; -typedef struct Object_Bonus { - /* 0x00 */ f32 directionX; - /* 0x04 */ f32 directionY; - /* 0x08 */ f32 directionZ; - /* 0x0C */ f32 rotationDiff; // Rotational offset, to test intersection when the exit is rotated. - /* 0x10 */ s32 radius; // Activation radius. - /* 0x14 */ s8 unk14; -} Object_Bonus; - -typedef struct Object_ModeChange { - /* 0x00 */ f32 directionX; - /* 0x04 */ f32 directionY; - /* 0x08 */ f32 directionZ; - /* 0x0C */ f32 rotationDiff; // Rotational offset, to test intersection when the exit is rotated. - /* 0x10 */ s32 radius; // Activation radius. - /* 0x14 */ u8 vehicleID; -} Object_ModeChange; - typedef struct Object_Door { /* 0x00 */ f32 homeY; /* 0x04 */ u8 pad4[0x4]; @@ -1278,12 +1261,15 @@ typedef struct Object_Door { } Object_Door; typedef struct Object_Trigger { - /* 0x00 */ f32 unk0; - /* 0x04 */ f32 unk4; - /* 0x08 */ f32 unk8; - /* 0x0C */ f32 unkC; - /* 0x10 */ s32 unk10; + /* 0x00 */ f32 directionX; + /* 0x04 */ f32 directionY; + /* 0x08 */ f32 directionZ; + /* 0x0C */ f32 rotationDiff; // Rotational offset, to test intersection when the exit is rotated. + /* 0x10 */ s32 radius; + union { + /* 0x14 */ u8 vehicleID; /* 0x14 */ u8 unk14; + }; } Object_Trigger; typedef struct Object_Audio { @@ -1293,7 +1279,7 @@ typedef struct Object_Audio { /* 0x05 */ u8 unk5; /* 0x06 */ u8 unk6; /* 0x07 */ u8 unk7; - /* 0x08 */ s32 unk8; + /* 0x08 */ s32 soundMask; /* 0x0C */ u8 unkC; /* 0x0D */ u8 unkD; } Object_Audio; @@ -1381,19 +1367,6 @@ typedef struct Object_Bridge_WhaleRamp { /* 0x4 */ s32 unk4; } Object_Bridge_WhaleRamp; -typedef struct Object_80011AD0 { - /* 0x00 */ u8 pad0[0x20]; - /* 0x20 */ u32 unk20; - /* 0x24 */ u32 unk24; //TextureHeader *? - /* 0x28 */ u8 pad28[0x48]; - /* 0x70 */ u8 unk70; - /* 0x71 */ u8 pad71[0x3]; - /* 0x74 */ f32 unk74; - /* 0x78 */ u8 pad78[0x80]; - /* 0xF8 */ u32 unkF8; //TextureHeader *? - /* 0xFC */ u8 unkFC; -} Object_80011AD0; - typedef struct Object_8001B7A8 { u8 pad0[0x112]; /* 0x112 */ s16 unk112; @@ -1464,8 +1437,6 @@ typedef struct Object_64 { Object_Wizpig2 wizpig2; Object_Exit exit; Object_Racer racer; - Object_Bonus bonus; - Object_ModeChange mode_change; Object_Door door; Object_Trigger trigger; Object_Audio audio; @@ -1477,7 +1448,6 @@ typedef struct Object_64 { Object_NPC npc; Object_TT tt; Object_Bridge_WhaleRamp bridge_whale_ramp; - Object_80011AD0 obj80011AD0; Object_8001B7A8 obj8001B7A8; Object_80021400_64 obj80021400_64; Object_Log log; @@ -1524,7 +1494,7 @@ typedef struct ParticleBehavior { f32 unk4; f32 unk8; f32 unkC; - u8 pad10[0x4]; + f32 unk10; s16 unk14; s16 unk16; s16 unk18; @@ -1539,7 +1509,10 @@ typedef struct ParticleBehavior { s16 unk2A; s16 unk2C; s16 unk2E; - u8 pad30[0x10]; + f32 unk30; + f32 unk34; + f32 unk38; + f32 unk3C; s16 unk40; s16 unk42; s16 unk44; @@ -1550,9 +1523,19 @@ typedef struct ParticleBehavior { s16 unk4E; f32 unk50; f32 unk54; - u8 pad58[0x4]; + f32 unk58; s32 unk5C; - u8 pad60[0x20]; + s32 unk60; + s16 unk64; + s16 unk66; + s16 unk68; + s16 unk6A; + s16 unk6C; + s16 unk6E; + s32 unk70; + s32 unk74; + s32 unk78; + s32 unk7C; s16 unk80; s16 unk82; s16 unk84; @@ -1561,7 +1544,7 @@ typedef struct ParticleBehavior { s16 unk8A; s32 unk8C; s32 unk90; - u8 pad94[0x4]; + s32 unk94; u8 unk98; u8 unk99; u8 unk9A; @@ -1612,93 +1595,41 @@ typedef struct ObjectTransform { /* 0x0014 */ f32 z_position; } ObjectTransform; -/* Size: 0x018 bytes */ -typedef struct ObjectTransform_2 { - /* 0x0000 */ s32 unk0; - /* 0x0004 */ s32 unk4; - /* 0x0008 */ s32 unk8; - /* 0x000C */ f32 x_position; - /* 0x0010 */ f32 y_position; - /* 0x0014 */ f32 z_position; -} ObjectTransform_2; +typedef struct SegmentPropertiesObject { + /* 0x002C */ s16 unk2C; + /* 0x002E */ s16 segmentID; + /* 0x0030 */ f32 distanceToCamera; + /* 0x0034 */ s16 cameraSegmentID; + /* 0x0036 */ s16 unk36; + /* 0x0038 */ u8 unk38; + /* 0x0039 */ u8 opacity; + /* 0x003A */ s8 numModelIDs; + /* 0x003B */ s8 animationID; +} SegmentPropertiesObject; -typedef struct ParticleProperties { - /* 0x0000 */ ParticleBehavior *behaviour; - /* 0x0004 */ s16 unk4; - /* 0x0006 */ u8 unk6; - /* 0x0007 */ u8 unk7; - /* 0x0004 */ s16 unk8; - /* 0x0004 */ s16 unkA; - union { - Vec3f pos; - unk800AF29C_C unkC; - unk800B2260_C **unkC_60; - unk800AF29C_C_400 unkC_400; - }; -} ParticleProperties; +typedef struct SegmentPropertiesCamera { + /* 0x002C */ f32 unk2C; + /* 0x0030 */ f32 distanceToCamera; + /* 0x0034 */ f32 unk34; + /* 0x0038 */ s16 unk38; + /* 0x003A */ s16 unk3A; +} SegmentPropertiesCamera; /* Size: 0x44 bytes */ typedef struct ObjectSegment { - union { /* 0x0000 */ ObjectTransform trans; - /* 0x0000 */ ObjectTransform_2 trans_unk; - /* 0x0000 */ ParticleProperties particle; - }; /* 0x0018 */ s16 animFrame; /* 0x001A */ s16 unk1A; - union { /* 0x001C */ f32 x_velocity; - struct { - /* 0x001A */ s16 unk1C; - /* 0x001A */ s16 unk1E; - } unk1C_half; - }; /* 0x0020 */ f32 y_velocity; /* 0x0024 */ f32 z_velocity; /* 0x0028 */ f32 unk28; - union { - struct { - /* 0x002C */ s16 upper; - /* 0x002E */ s16 lower; - } half; - /* 0x002C */ f32 word; - } unk2C; - - /* 0x0030 */ f32 unk30; - - union { - /* 0x0034 */ f32 unk34; - struct { - /* 0x0034 */ s16 levelSegmentIndex; - /* 0x0036 */ s16 unk36; - }; - } unk34_a; - - union { - struct { - /* 0x0038 */ u8 unk38; - /* 0x0039 */ u8 unk39; - /* 0x003A */ s8 unk3A; // Index value for unk68 array - /* 0x003B */ s8 unk3B; - } byte; - struct { - /* 0x0038 */ s16 unk38; - /* 0x003A */ s16 unk3A; - } half; - f32 unk38_f32; - } unk38; - - union { - /* 0x003C */ LevelObjectEntry* level_entry; - /* 0x003C */ void *unk3C_ptr; - /* 0x003C */ f32 unk3C_f; - } unk3C_a; - - union { - /* 0x0040 */ ObjectHeader *header; - /* 0x0040 */ s32 unk40; + SegmentPropertiesObject object; + SegmentPropertiesCamera camera; }; + /* 0x003C */ LevelObjectEntry* level_entry; + /* 0x0040 */ ObjectHeader *header; } ObjectSegment; typedef struct unk800B0698_44_0 { @@ -1722,102 +1653,24 @@ typedef struct Object { }; /* 0x0048 */ s16 behaviorId; /* 0x004A */ s16 unk4A; - union { /* 0x004C */ ObjectInteraction *interactObj; //player + 0x318 - /* 0x004C */ f32 unk4C_f32; - }; - union { /* 0x0050 */ ShadowData *shadow; //player + 0x2F4 - /* 0x0050 */ f32 unk50_f32; - }; - union { /* 0x0054 */ Object_54 *unk54; //player + 0x2C0 - /* 0x0054 */ f32 unk54_f32; - }; - union { /* 0x0058 */ void *unk58; //player + 0x304 - /* 0x0058 */ f32 unk58_f32; - }; - union { /* 0x005C */ Object_5C *unk5C; - struct { - /* 0x005C */ s16 unk5C; - /* 0x005E */ s16 unk5E; - } unk5C_halfs; - /* 0x005C */ s32 unk5C_s32; - }; - union { /* 0x0060 */ Object_60 *unk60; //player + 0x340 - struct { - /* 0x0060 */ s16 unk60; - /* 0x0062 */ s16 unk62; - } unk60_halfs; - /* 0x0060 */ s32 unk60_s32; - }; - union { /* 0x0064 */ Object_64 *unk64; //player + 0x98 - struct { - /* 0x0064 */ s16 unk64; - /* 0x0066 */ s16 unk66; - } unk64_halfs; - }; - union { /* 0x0068 */ Object_68 **unk68; //player + 0x80 - struct { - /* 0x0068 */ s16 unk68; - /* 0x006A */ s16 unk6A; - } unk68_halfs; - }; - union { /* 0x006C */ Object_6C *unk6C; //player + 0x370 - struct { - /* 0x006C */ s16 unk6C; - /* 0x006E */ s16 unk6E; - } unk6C_halfs; - }; - union { - /* 0x0070 */ u32 *unk70; - /* 0x0070 */ s32 unk70_s32; - }; - - union { + /* 0x0070 */ u32 *unk70; /* 0x0074 */ u32 unk74; - /* 0x0074 */ s32 unk74_signed; - struct { - /* 0x0074 */ u8 first; - /* 0x0074 */ u8 second; - /* 0x0074 */ u8 third; - /* 0x0074 */ u8 fourth; - } unk74_bytes; - }; - - union { - /* 0x0078 */ s32 unk78; - /* 0x0078 */ ObjectTransform *trans78; - /* 0x0078 */ s32 action; - /* 0x0078 */ f32 unk78f; - /* 0x0078 */ struct Object *unk78_obj; - }; - - union { - struct { - s16 upper; - s16 lower; - } half; - s32 word; - } unk7C; - + /* 0x0078 */ ObjProperties properties; /* 0x0080 */ void *unk80; /* 0x0084 */ u32 unk84; /* 0x0088 */ u32 unk88; - /* 0x008C */ u32 unk8C; /* 0x0090 */ u32 unk90; - union { - /* 0x0094 */ u32 unk94; - /* 0x0094 */ s32 unk94_signed; - }; - + /* 0x0094 */ u32 unk94; /* 0x0098 */ Object_64 obj; // May be a part of obj (likely Object_Player). diff --git a/src/audio.c b/src/audio.c index b5b1a97e..882349a0 100644 --- a/src/audio.c +++ b/src/audio.c @@ -474,8 +474,12 @@ void func_80001440(u8 *arg0) { return; } -void func_800014BC(f32 arg0) { - musicSetTempo((s32)((f32)(u32)(musicGetTempo() & 0xFF) * arg0)); +/** + * Multiplies the current tempo of the background music. + * Since it calls musicGetTempo and multiplies it by the result, calling this repeatedly can recursively change the music's speed. +*/ +void multiply_music_tempo(f32 tempo) { + musicSetTempo((s32)((f32)(u32)(musicGetTempo() & 0xFF) * tempo)); } /** diff --git a/src/audio.h b/src/audio.h index a743ccb1..1d52db37 100644 --- a/src/audio.h +++ b/src/audio.h @@ -86,7 +86,7 @@ u8 func_800012A8(u8 arg0); void func_800012E8(void); u8 func_80001358(u8 arg0, u8 arg1, s32 arg2); void func_80001440(u8 *arg0); -void func_800014BC(f32 arg0); +void multiply_music_tempo(f32 tempo); void musicSetTempo(s32 tempo); s16 musicGetTempo(void); u8 music_is_playing(void); diff --git a/src/camera.c b/src/camera.c index cfab9302..db4a2684 100644 --- a/src/camera.c +++ b/src/camera.c @@ -175,7 +175,7 @@ GLOBAL_ASM("asm/non_matchings/camera/func_80065EA0.s") void func_80066060(s32 arg0, s32 arg1) { if (arg0 >= 0 && arg0 < 4) { D_800DD2F8[arg0] = arg1; - gActiveCameraStack[arg0].unk38.byte.unk3B = arg1; + gActiveCameraStack[arg0].object.animationID = arg1; } } @@ -263,17 +263,17 @@ void func_80066230(Gfx **dlist, MatrixS **mats) { posX = cam->trans.x_position; posY = cam->trans.y_position; posZ = cam->trans.z_position; - sp24 = cam->unk38.half.unk38; + sp24 = cam->camera.unk38; cam->trans.z_rotation = 0; cam->trans.x_rotation = 0; cam->trans.y_rotation = -0x8000; - cam->unk38.half.unk38 = 0; + cam->camera.unk38 = 0; cam->trans.x_position = 0.0f; cam->trans.y_position = 0.0f; cam->trans.z_position = 0.0f; update_envmap_position(0.0f, 0.0f, -1.0f); func_80066CDC(dlist, mats); - cam->unk38.half.unk38 = sp24; + cam->camera.unk38 = sp24; cam->trans.y_rotation = angleY; cam->trans.x_rotation = angleX; cam->trans.z_rotation = angleZ; @@ -307,14 +307,14 @@ void func_800663DC(s32 xPos, s32 yPos, s32 zPos, s32 arg3, s32 arg4, s32 arg5) { gActiveCameraStack[gActiveCameraID].trans.y_position = (f32) yPos; gActiveCameraStack[gActiveCameraID].trans.z_position = (f32) zPos; gActiveCameraStack[gActiveCameraID].trans.x_rotation = (s16) (arg4 * 0xB6); - gActiveCameraStack[gActiveCameraID].unk38.half.unk38 = (s16) 0; + gActiveCameraStack[gActiveCameraID].camera.unk38 = (s16) 0; gActiveCameraStack[gActiveCameraID].z_velocity = 0.0f; gActiveCameraStack[gActiveCameraID].unk28 = 0.0f; - gActiveCameraStack[gActiveCameraID].unk2C.word = 0.0f; - gActiveCameraStack[gActiveCameraID].unk30 = 0.0f; + gActiveCameraStack[gActiveCameraID].camera.unk2C = 0.0f; + gActiveCameraStack[gActiveCameraID].camera.distanceToCamera = 0.0f; gActiveCameraStack[gActiveCameraID].x_velocity = 160.0f; gActiveCameraStack[gActiveCameraID].trans.y_rotation = (s16) (arg5 * 0xB6); - gActiveCameraStack[gActiveCameraID].unk38.byte.unk3B = D_800DD2F8[gActiveCameraID]; + gActiveCameraStack[gActiveCameraID].object.animationID = D_800DD2F8[gActiveCameraID]; } /** @@ -324,14 +324,14 @@ void func_800663DC(s32 xPos, s32 yPos, s32 zPos, s32 arg3, s32 arg4, s32 arg5) { */ void write_to_object_render_stack(s32 stackPos, f32 xPos, f32 yPos, f32 zPos, s16 arg4, s16 arg5, s16 arg6) { stackPos += 4; - gActiveCameraStack[stackPos].unk38.half.unk38 = 0; + gActiveCameraStack[stackPos].camera.unk38 = 0; gActiveCameraStack[stackPos].trans.x_position = xPos; gActiveCameraStack[stackPos].trans.y_position = yPos; gActiveCameraStack[stackPos].trans.z_position = zPos; gActiveCameraStack[stackPos].trans.y_rotation = arg4; gActiveCameraStack[stackPos].trans.x_rotation = arg5; gActiveCameraStack[stackPos].trans.z_rotation = arg6; - gActiveCameraStack[stackPos].unk34_a.levelSegmentIndex = get_level_segment_index_from_position(xPos, yPos, zPos); + gActiveCameraStack[stackPos].object.cameraSegmentID = get_level_segment_index_from_position(xPos, yPos, zPos); gCutsceneCameraActive = TRUE; } @@ -857,13 +857,13 @@ void func_80067D3C(Gfx **dlist, UNUSED MatrixS **mats) { } gCameraTransform.y_rotation = 0x8000 + gActiveCameraStack[gActiveCameraID].trans.y_rotation; - gCameraTransform.x_rotation = gActiveCameraStack[gActiveCameraID].trans.x_rotation + gActiveCameraStack[gActiveCameraID].unk38.half.unk38; + gCameraTransform.x_rotation = gActiveCameraStack[gActiveCameraID].trans.x_rotation + gActiveCameraStack[gActiveCameraID].camera.unk38; gCameraTransform.z_rotation = gActiveCameraStack[gActiveCameraID].trans.z_rotation; gCameraTransform.x_position = -gActiveCameraStack[gActiveCameraID].trans.x_position; gCameraTransform.y_position = -gActiveCameraStack[gActiveCameraID].trans.y_position; if (D_80120D18 != 0) { - gCameraTransform.y_position -= gActiveCameraStack[gActiveCameraID].unk30; + gCameraTransform.y_position -= gActiveCameraStack[gActiveCameraID].camera.distanceToCamera; } gCameraTransform.z_position = -gActiveCameraStack[gActiveCameraID].trans.z_position; @@ -871,13 +871,13 @@ void func_80067D3C(Gfx **dlist, UNUSED MatrixS **mats) { f32_matrix_mult(&D_80120F60, &gPerspectiveMatrixF, &D_80120F20); gCameraTransform.y_rotation = -0x8000 - gActiveCameraStack[gActiveCameraID].trans.y_rotation; - gCameraTransform.x_rotation = -(gActiveCameraStack[gActiveCameraID].trans.x_rotation + gActiveCameraStack[gActiveCameraID].unk38.half.unk38); + gCameraTransform.x_rotation = -(gActiveCameraStack[gActiveCameraID].trans.x_rotation + gActiveCameraStack[gActiveCameraID].camera.unk38); gCameraTransform.z_rotation = -gActiveCameraStack[gActiveCameraID].trans.z_rotation; gCameraTransform.scale = 1.0f; gCameraTransform.x_position = gActiveCameraStack[gActiveCameraID].trans.x_position; gCameraTransform.y_position = gActiveCameraStack[gActiveCameraID].trans.y_position; if (D_80120D18 != 0) { - gCameraTransform.y_position += gActiveCameraStack[gActiveCameraID].unk30; + gCameraTransform.y_position += gActiveCameraStack[gActiveCameraID].camera.distanceToCamera; } gCameraTransform.z_position = gActiveCameraStack[gActiveCameraID].trans.z_position; @@ -1342,7 +1342,7 @@ UNUSED void func_80069ACC(f32 x, f32 y, f32 z) { gActiveCameraStack[gActiveCameraID].trans.x_position += x; gActiveCameraStack[gActiveCameraID].trans.y_position += y; gActiveCameraStack[gActiveCameraID].trans.z_position += z; - gActiveCameraStack[gActiveCameraID].unk34_a.levelSegmentIndex = + gActiveCameraStack[gActiveCameraID].object.cameraSegmentID = get_level_segment_index_from_position( gActiveCameraStack[gActiveCameraID].trans.x_position, gActiveCameraStack[gActiveCameraID].trans.y_position, @@ -1354,7 +1354,7 @@ UNUSED void func_80069B70(f32 x, UNUSED f32 y, f32 z) { gActiveCameraStack[gActiveCameraID].trans.z_position -= x * sins_f(gActiveCameraStack[gActiveCameraID].trans.y_rotation); gActiveCameraStack[gActiveCameraID].trans.x_position -= z * sins_f(gActiveCameraStack[gActiveCameraID].trans.y_rotation); gActiveCameraStack[gActiveCameraID].trans.z_position += z * coss_f(gActiveCameraStack[gActiveCameraID].trans.y_rotation); - gActiveCameraStack[gActiveCameraID].unk34_a.levelSegmentIndex = + gActiveCameraStack[gActiveCameraID].object.cameraSegmentID = get_level_segment_index_from_position( gActiveCameraStack[gActiveCameraID].trans.x_position, gActiveCameraStack[gActiveCameraID].trans.y_position, @@ -1431,7 +1431,7 @@ void set_camera_shake_by_distance(f32 x, f32 y, f32 z, f32 dist, f32 magnitude) diffZ = z - gActiveCameraStack[i].trans.z_position; distance = sqrtf(((diffX * diffX) + (diffY * diffY)) + (diffZ * diffZ)); if (distance < dist) { - gActiveCameraStack[i].unk30 = ((dist - distance) * magnitude) / dist; + gActiveCameraStack[i].camera.distanceToCamera = ((dist - distance) * magnitude) / dist; } } } @@ -1442,7 +1442,7 @@ void set_camera_shake_by_distance(f32 x, f32 y, f32 z, f32 dist, f32 magnitude) void set_camera_shake(f32 magnitude) { s32 i; for (i = 0; i <= gNumberOfViewports; i++) { - gActiveCameraStack[i].unk30 = magnitude; + gActiveCameraStack[i].camera.distanceToCamera = magnitude; } } diff --git a/src/game.c b/src/game.c index f8dd78e5..0b0f8ade 100644 --- a/src/game.c +++ b/src/game.c @@ -698,7 +698,7 @@ void func_8006BD10(f32 arg0) { if (gCurrentLevelHeader->music != 0) { func_800012E8(); play_music(gCurrentLevelHeader->music); - func_800014BC(arg0); + multiply_music_tempo(arg0); func_80001074(gCurrentLevelHeader->instruments); } } diff --git a/src/game_ui.c b/src/game_ui.c index 5f0bd6bb..19dae1db 100644 --- a/src/game_ui.c +++ b/src/game_ui.c @@ -1889,7 +1889,7 @@ void render_minimap_and_misc_hud(Gfx **dList, MatrixS **mtx, Vertex **vtx, s32 u D_80126CDC->unk1E6 = 14; D_80126CDC->unk1E4 = 0; D_80126CDC->unk1E8 = 1.0f; - tempVar1 = (opacity * (f32) temp_v0_8->segment.unk38.byte.unk39) * 0.0078125; + tempVar1 = (opacity * (f32) temp_v0_8->segment.object.opacity) * 0.0078125; gDPSetPrimColor(gHUDCurrDisplayList++, 0, 0, 60, 60, 60, tempVar1); func_800AA600(&gHUDCurrDisplayList, &gHUDCurrMatrix, &gHUDCurrVertex, &D_80126CDC->unk1E0); } @@ -1898,7 +1898,7 @@ void render_minimap_and_misc_hud(Gfx **dList, MatrixS **mtx, Vertex **vtx, s32 u if (temp_v0_8 != NULL) { func_800AA3EC(temp_v0_8->segment.trans.x_position, temp_v0_8->segment.trans.z_position, sp114, sp118, sp11C); D_80126CDC->unk1E4 = 0; - tempVar1 = (opacity * (f32) temp_v0_8->segment.unk38.byte.unk39) * 0.0078125; + tempVar1 = (opacity * (f32) temp_v0_8->segment.object.opacity) * 0.0078125; gDPSetPrimColor(gHUDCurrDisplayList++, 0, 0, gHudMinimapColours[8].red, gHudMinimapColours[8].green, gHudMinimapColours[8].blue, tempVar1); D_80126CDC->unk1E8 = 1.0f; D_80126CDC->unk1E6 = 14; diff --git a/src/menu.c b/src/menu.c index ad71259c..0f84ca98 100644 --- a/src/menu.c +++ b/src/menu.c @@ -2575,7 +2575,7 @@ s32 menu_title_screen_loop(s32 updateRate) { gTitleRevealTimer += updateRate; if (gTitleRevealTimer >= 32) { gTitleRevealTimer = 32; - sp18->unk30 = 8.0f; + sp18->object.distanceToCamera = 8.0f; play_sound_global(SOUND_EXPLOSION, 0); } } else { diff --git a/src/object_functions.c b/src/object_functions.c index e18d8fef..9047d9cc 100644 --- a/src/object_functions.c +++ b/src/object_functions.c @@ -145,8 +145,8 @@ void obj_init_scenery(Object *obj, LevelObjectEntry_Scenery *entry) { radius /= 64; obj->segment.trans.scale = obj->segment.header->scale * radius; obj->shadow->scale = obj->segment.header->shadowScale * radius; - obj->segment.unk38.byte.unk3A = entry->unk8; - obj->segment.trans.y_rotation = entry->unkA << 6 << 4; + obj->segment.object.numModelIDs = entry->numModelIDs; + obj->segment.trans.y_rotation = U8_ANGLE_TO_U16(entry->angleY); if (entry->solid) { obj->interactObj->flags = INTERACT_FLAGS_SOLID; obj->interactObj->unk11 = 1; @@ -155,11 +155,11 @@ void obj_init_scenery(Object *obj, LevelObjectEntry_Scenery *entry) { obj->interactObj->unk16 = -5; obj->interactObj->unk17 = entry->solid; } - if (obj->segment.unk38.byte.unk3A >= obj->segment.header->numberOfModelIds) { - obj->segment.unk38.byte.unk3A = 0; + if (obj->segment.object.numModelIDs >= obj->segment.header->numberOfModelIds) { + obj->segment.object.numModelIDs = 0; } - obj->action = 0; - obj->unk7C.word = 0; + obj->properties.scenery.interactObj = NULL; + obj->properties.common.unk4 = 0; } /** @@ -167,19 +167,19 @@ void obj_init_scenery(Object *obj, LevelObjectEntry_Scenery *entry) { * When hit by a racer, give it an elastic behaviour as feedback. */ void obj_loop_scenery(Object *obj, s32 updateRate) { - Object78_80033DD0 *obj78; + ObjPropertyScenery *properties; s32 temp_v0; if (obj->interactObj != NULL) { - obj78 = (Object78_80033DD0 *) &obj->action; - if (obj->unk7C.half.upper > 0) { - obj78->unk4 -= updateRate; + properties = &obj->properties.scenery; + if (properties->hitTimer > 0) { + properties->hitTimer -= updateRate; } - if (obj->interactObj->flags & INTERACT_FLAGS_COLLIDED && obj78->unk4 <= 0) { + if (obj->interactObj->flags & INTERACT_FLAGS_COLLIDED && properties->hitTimer <= 0) { play_sound_at_position(SOUND_TWANG, obj->segment.trans.x_position, obj->segment.trans.y_position, obj->segment.trans.z_position, 4, NULL); - obj78->unk0 = (s32 *) obj->interactObj->obj; - obj78->unk6 = 1820; - obj78->unk4 = 10; + properties->interactObj = obj->interactObj->obj; + properties->angleVel = 0x71C; + properties->hitTimer = 10; if (get_number_of_active_players() < 2) { if (obj->segment.header->unk57 > 0) { if (obj->segment.header->unk57 == 1) { @@ -191,11 +191,11 @@ void obj_loop_scenery(Object *obj, s32 updateRate) { func_800AFC3C(obj, 2); } } - } else if (obj78->unk4 <= 0) { - obj78->unk0 = 0; + } else if (properties->hitTimer <= 0) { + properties->interactObj = NULL; } - obj->segment.trans.z_rotation = obj78->unk6; - obj78->unk6 = (obj78->unk6 * -200) >> 8; + obj->segment.trans.z_rotation = properties->angleVel; + properties->angleVel = (properties->angleVel * -200) >> 8; } } @@ -225,12 +225,12 @@ void obj_loop_fireball_octoweapon(Object *obj, s32 updateRate) { s32 soundMask; f32 waveHeight; - someObj = (Object *) obj->unk78; + someObj = obj->properties.fireball.obj; updateRateF = updateRate; if (osTvType == TV_TYPE_PAL) { updateRateF *= 1.2; } - if (obj->behaviorId == BHV_FIREBALL_OCTOWEAPON_2 && obj->unk7C.word < 0) { + if (obj->behaviorId == BHV_FIREBALL_OCTOWEAPON_2 && obj->properties.fireball.timer < 0) { obj->segment.trans.x_position = 0.0f; obj->segment.trans.y_position = 0.0f; obj->segment.trans.z_position = 0.0f; @@ -278,18 +278,18 @@ void obj_loop_fireball_octoweapon(Object *obj, s32 updateRate) { if ((interactObj->obj)) { if ((interactObj->distance < 60)) { someObj = interactObj->obj; - if((someObj->segment.header->behaviorId == BHV_RACER)) { + if ((someObj->segment.header->behaviorId == BHV_RACER)) { racer = (Object_Racer *) someObj->unk64; if (racer->playerIndex != PLAYER_COMPUTER) { if (obj->behaviorId == BHV_FIREBALL_OCTOWEAPON) { racer->attackType = ATTACK_EXPLOSION; - obj->unk7C.word = 20; + obj->properties.fireball.timer = 20; func_8003FC44(obj->segment.trans.x_position, obj->segment.trans.y_position, obj->segment.trans.z_position, 44, SOUND_EXPLOSION, 1.0f, 1); gParticlePtrList_addObject(obj); - } else if (obj->unk7C.word > 0) { + } else if (obj->properties.fireball.timer > 0) { racer->unk204 = 60; - obj->unk7C.word = -60; - obj->unk78 = (s32) someObj; + obj->properties.fireball.timer = -60; + obj->properties.fireball.obj = someObj; play_sound_global(SOUND_BUBBLE_RISE, &weapon->soundMask); } } @@ -299,30 +299,30 @@ void obj_loop_fireball_octoweapon(Object *obj, s32 updateRate) { if (obj->behaviorId == BHV_FIREBALL_OCTOWEAPON) { obj->unk74 = 1; func_800AFC3C(obj, updateRate); - obj->unk7C.word -= updateRate; - if (obj->unk7C.word < 0) { + obj->properties.fireball.timer -= updateRate; + if (obj->properties.fireball.timer < 0) { if (obj->unk4A == 298) { gParticlePtrList_addObject(obj); func_8003FC44(obj->segment.trans.x_position, obj->segment.trans.y_position, obj->segment.trans.z_position, 44, SOUND_EXPLOSION, 1.0f, 1); } - obj->segment.trans.scale *= 0.9; + obj->segment.trans.scale *= 0.9; //!@Delta if (obj->segment.trans.scale < 0.5) { gParticlePtrList_addObject(obj); } } } else { - if (obj->unk7C.word < 0) { - obj->unk7C.word += updateRate; - if (obj->unk7C.word >= 0) { - obj->unk7C.word = 0; + if (obj->properties.fireball.timer < 0) { + obj->properties.fireball.timer += updateRate; + if (obj->properties.fireball.timer >= 0) { + obj->properties.fireball.timer = 0; } } else { - obj->unk7C.word -= updateRate; - if (obj->unk7C.word <= 0) { - obj->unk7C.word = 0; + obj->properties.fireball.timer -= updateRate; + if (obj->properties.fireball.timer <= 0) { + obj->properties.fireball.timer = 0; } } - if (obj->unk7C.word == 0) { + if (obj->properties.fireball.timer == 0) { soundMask = weapon->soundMask; if (soundMask != NULL) { func_8000488C(soundMask); @@ -348,8 +348,8 @@ void obj_init_lasergun(Object *obj, LevelObjectEntry_Lasergun *entry) { laserGun->laserDuration = entry->laserDuration; laserGun->radius = entry->radius; laserGun->fireTimer = laserGun->fireRate; - obj->segment.trans.y_rotation = entry->angleX << 4 << 4; // Not sure about the shift amounts here, but it - obj->segment.trans.x_rotation = entry->angleY << 4 << 4; // just needs to be 2 left shifts that add up to 8. + obj->segment.trans.y_rotation = entry->angleY << 4 << 4; // Not sure about the shift amounts here, but it + obj->segment.trans.x_rotation = entry->angleX << 4 << 4; // just needs to be 2 left shifts that add up to 8. } /** @@ -401,11 +401,11 @@ void obj_loop_lasergun(Object *obj, s32 updateRate) { play_sound_at_position(SOUND_LASER_GUN, obj->segment.trans.x_position, obj->segment.trans.y_position, obj->segment.trans.z_position, 4, NULL); laserBoltObj = spawn_object(&spawnObj, 1); if (laserBoltObj != NULL) { - laserBoltObj->segment.unk3C_a.level_entry = NULL; + laserBoltObj->segment.level_entry = NULL; laserBoltObj->segment.trans.y_rotation = obj->segment.trans.y_rotation; laserBoltObj->segment.trans.x_rotation = obj->segment.trans.x_rotation; - laserBoltObj->unk78 = lasergun->laserDuration; - laserBoltObj->unk7C.word = (s32) lasergun; + laserBoltObj->properties.lasergun.timer = lasergun->laserDuration; + laserBoltObj->properties.lasergun.obj = lasergun; trans.x_position = 0.0f; trans.y_position = 0.0f; trans.z_position = 0.0f; @@ -483,8 +483,8 @@ void obj_loop_laserbolt(Object *obj, s32 updateRate) { delete = TRUE; } - if (obj->unk78 > 0) { - obj->unk78 -= updateRate; + if (obj->properties.lasergun.timer > 0) { + obj->properties.lasergun.timer -= updateRate; } else { delete = TRUE; } @@ -497,7 +497,7 @@ void obj_loop_laserbolt(Object *obj, s32 updateRate) { if (laser->unk0 != -1) { laser->unk187 = 1; } - obj7C = (Object_7C_80034860 *) obj->unk7C.word; + obj7C = (Object_7C_80034860 *) obj->properties.lasergun.obj; if (obj7C) { obj7C->unkC = 180; } @@ -521,7 +521,7 @@ void obj_init_torch_mist(Object *obj, LevelObjectEntry_Torch_Mist *entry) { } radius /= 64; obj->segment.trans.scale = obj->segment.header->scale * radius; - obj->unk78 = entry->animSpeed; + obj->properties.speed.speed = entry->animSpeed; } /** @@ -529,7 +529,7 @@ void obj_init_torch_mist(Object *obj, LevelObjectEntry_Torch_Mist *entry) { * Updates the animation frame based on spawn info's animation speed. */ void obj_loop_torch_mist(Object *obj, s32 updateRate) { - obj->segment.animFrame += obj->unk78 * updateRate; + obj->segment.animFrame += obj->properties.speed.speed * updateRate; } void obj_init_effectbox(UNUSED Object *obj, UNUSED LevelObjectEntry_EffectBox *entry) { @@ -554,7 +554,7 @@ void obj_loop_effectbox(Object *obj, UNUSED s32 updateRate) { f32 temp4; f32 temp5; - level_entry = &obj->segment.unk3C_a.level_entry->effectBox; + level_entry = &obj->segment.level_entry->effectBox; objList = get_racer_objects(&numberOfObjects); temp0 = coss_f((level_entry->unkB << 8) * -1); temp1 = sins_f((level_entry->unkB << 8) * -1); @@ -595,7 +595,7 @@ GLOBAL_ASM("asm/non_matchings/unknown_032760/obj_loop_effectbox.s") void obj_init_trophycab(Object *obj, LevelObjectEntry_TrophyCab *entry) { obj->interactObj->flags = INTERACT_FLAGS_SOLID; obj->interactObj->unk11 = 2; - obj->segment.trans.y_rotation = entry->rotation << 6 << 4; // Not sure about the values here. + obj->segment.trans.y_rotation = U8_ANGLE_TO_U16(entry->angleY); } /** @@ -619,19 +619,19 @@ void obj_loop_trophycab(Object *obj, s32 updateRate) { settings = get_settings(); header = get_current_level_header(); - gfxData = (Object_TrophyCabinet *)obj->unk64; - if (obj->unk7C.word == 0) { + gfxData = (Object_TrophyCabinet *) obj->unk64; + if (obj->properties.trophyCabinet.trophy == FALSE) { if (header->race_type != RACETYPE_CUTSCENE_2 && header->race_type != RACETYPE_CUTSCENE_1) { - obj->unk7C.word = 1; + obj->properties.trophyCabinet.trophy = TRUE; if ((settings->trophies >> (((settings->worldId - 1) ^ 0) * 2)) & 3) { // Fakematch newObject.objectID = 0x80; - newObject.x = obj->segment.unk3C_a.level_entry->animation.common.x; - newObject.y = obj->segment.unk3C_a.level_entry->animation.common.y; - newObject.z = obj->segment.unk3C_a.level_entry->animation.common.z; + newObject.x = obj->segment.level_entry->animation.common.x; + newObject.y = obj->segment.level_entry->animation.common.y; + newObject.z = obj->segment.level_entry->animation.common.z; newObject.size = 8; tempObj = spawn_object(&newObject, 1); if (tempObj != NULL) { - tempObj->segment.unk3C_a.level_entry = NULL; + tempObj->segment.level_entry = NULL; tempObj->segment.trans.y_rotation = obj->segment.trans.y_rotation; } } @@ -650,11 +650,11 @@ void obj_loop_trophycab(Object *obj, s32 updateRate) { if (worldBalloons) { worldBalloons = ((1 << (settings->worldId + 6)) & bossFlags) != 0; } - if (obj->action == NULL && func_800C3400() == FALSE) { + if (obj->properties.trophyCabinet.action == NULL && func_800C3400() == FALSE) { if (obj->unk5C->unk100 != NULL) { if (gfxData->unk4 == 0) { if (worldBalloons) { - obj->action = 1; + obj->properties.trophyCabinet.action = 1; play_sound_global(SOUND_VOICE_TT_TROPHY_RACE, NULL); func_800A3870(); } else { @@ -685,16 +685,16 @@ void obj_loop_trophycab(Object *obj, s32 updateRate) { } else { gfxData->unk4 = 0; } - if (obj->action == 1) { + if (obj->properties.trophyCabinet.action == 1) { func_800AB1AC(3); set_hud_visibility(0U); dialogueID = func_8009CFEC(4); if (dialogueID) { - obj->action = 0; + obj->properties.trophyCabinet.action = 0; func_8009CF68(4); if (dialogueID == 1) { begin_trophy_race_teleport(); - obj->action = 2; + obj->properties.trophyCabinet.action = 2; } else { set_hud_visibility(1); } @@ -764,8 +764,8 @@ void obj_loop_collectegg(Object *obj, s32 updateRate) { obj->segment.y_velocity *= 0.95; // Destroy the egg if it lands on an invalid surface. if (obj->segment.trans.y_position < -2000.0f || (hasCollision && (surface < SURFACE_EGG_SPAWN || surface > SURFACE_EGG_04))) { - if (egg->unk4 != NULL) { - egg->unk4->action = 0; + if (egg->spawnerObj != NULL) { + egg->spawnerObj->properties.eggSpawner.egg = NULL; } gParticlePtrList_addObject(obj); } @@ -798,7 +798,7 @@ void obj_loop_collectegg(Object *obj, s32 updateRate) { racer->lap += 1; } egg->status = EGG_HATCHED; - egg->unk4->action = 0; + egg->spawnerObj->properties.eggSpawner.egg = NULL; } if (egg->hatchTimer < 540) { func_80036040(obj, (Object_64 *) egg); @@ -836,7 +836,7 @@ void obj_loop_eggcreator(Object *obj, UNUSED s32 updateRate) { LevelObjectEntryCommon spawnObj; Object *eggObj; - if (obj->action == 0) { + if (obj->properties.eggSpawner.egg == NULL) { spawnObj.x = obj->segment.trans.x_position; spawnObj.y = obj->segment.trans.y_position; spawnObj.z = obj->segment.trans.z_position; @@ -846,8 +846,8 @@ void obj_loop_eggcreator(Object *obj, UNUSED s32 updateRate) { if (eggObj != NULL) { Object_EggCreator *eggSpawner = &eggObj->unk64->egg_creator; eggSpawner->currentEgg = obj; - obj->unk78 = (s32) eggObj; - eggObj->segment.unk3C_a.level_entry = NULL; + obj->properties.eggSpawner.egg = eggObj; + eggObj->segment.level_entry = NULL; } } } @@ -863,9 +863,9 @@ void obj_init_lighthouse_rocketsignpost(Object *obj, LevelObjectEntry_Lighthouse } radius /= 64; obj->segment.trans.scale = obj->segment.header->scale * radius; - obj->segment.trans.y_rotation = entry->angleY << 6 << 4; - if (obj->segment.unk38.byte.unk3A >= obj->segment.header->numberOfModelIds) { - obj->segment.unk38.byte.unk3A = 0; + obj->segment.trans.y_rotation = U8_ANGLE_TO_U16(entry->angleY); + if (obj->segment.object.numModelIDs >= obj->segment.header->numberOfModelIds) { + obj->segment.object.numModelIDs = 0; } obj->interactObj->flags = INTERACT_FLAGS_SOLID; obj->interactObj->unk11 = 2; @@ -912,9 +912,9 @@ void obj_init_airzippers_waterzippers(Object *obj, LevelObjectEntry_AirZippers_W objHeader = obj->segment.header; radius /= 64; obj->segment.trans.scale = objHeader->scale * radius; - obj->segment.trans.y_rotation = entry->angleY << 6 << 4; - if (obj->segment.unk38.byte.unk3A >= objHeader->numberOfModelIds) { - obj->segment.unk38.byte.unk3A = 0; + obj->segment.trans.y_rotation = U8_ANGLE_TO_U16(entry->angleY); + if (obj->segment.object.numModelIDs >= objHeader->numberOfModelIds) { + obj->segment.object.numModelIDs = 0; } obj->interactObj->flags = INTERACT_FLAGS_TANGIBLE; obj->interactObj->unk11 = 0; @@ -970,26 +970,26 @@ void obj_loop_airzippers_waterzippers(Object *obj, UNUSED s32 updateRate) { */ void obj_init_groundzipper(Object *obj, LevelObjectEntry_GroundZipper *entry) { ObjectHeader *header; - f32 objScale; + f32 radius; - objScale = entry->scale & 0xFF; - if (objScale < 10.0f) { - objScale = 10.0f; + radius = entry->scale & 0xFF; + if (radius < 10.0f) { + radius = 10.0f; } - objScale /= 64; + radius /= 64; header = obj->segment.header; - obj->segment.trans.scale = header->scale * objScale; - obj->shadow->scale = header->shadowScale * objScale; - obj->segment.trans.y_rotation = entry->rotation << 6 << 4; - if (obj->segment.unk38.byte.unk3A >= obj->segment.header->numberOfModelIds) { - obj->segment.unk38.byte.unk3A = 0; + obj->segment.trans.scale = header->scale * radius; + obj->shadow->scale = header->shadowScale * radius; + obj->segment.trans.y_rotation = U8_ANGLE_TO_U16(entry->angleY); + if (obj->segment.object.numModelIDs >= obj->segment.header->numberOfModelIds) { + obj->segment.object.numModelIDs = 0; } - obj->unk78 = (s32) (28.0f * objScale) + 15; - if (obj->unk78 < 0) { - obj->unk78 = 0; + obj->properties.zipper.radius = (s32) (28.0f * radius) + 15; + if (obj->properties.zipper.radius < 0) { + obj->properties.zipper.radius = 0; } - if (obj->unk78 > 255) { - obj->unk78 = 255; + if (obj->properties.zipper.radius > 255) { + obj->properties.zipper.radius = 255; } obj->interactObj->flags = INTERACT_FLAGS_TANGIBLE; obj->interactObj->unk11 = 0; @@ -1020,7 +1020,7 @@ void obj_loop_groundzipper(Object *obj, UNUSED s32 updateRate) { obj->segment.trans.flags &= (0xFFFF - OBJ_FLAGS_INVISIBLE); obj->segment.trans.flags |= OBJ_FLAGS_SHADOW_ONLY; get_racer_object(PLAYER_ONE); // Unused. I guess the developers forgot to remove this? - if (obj->interactObj->distance < obj->unk78) { + if (obj->interactObj->distance < obj->properties.zipper.radius) { racerObjs = get_racer_objects(&numObjects); for (i = 0; i < numObjects; i++) { racerObj = racerObjs[i]; @@ -1029,7 +1029,7 @@ void obj_loop_groundzipper(Object *obj, UNUSED s32 updateRate) { diffX = racerObj->segment.trans.x_position - obj->segment.trans.x_position; diffY = racerObj->segment.trans.y_position - obj->segment.trans.y_position; diffZ = racerObj->segment.trans.z_position - obj->segment.trans.z_position; - if ((s32) sqrtf((diffX * diffX) + (diffY * diffY) + (diffZ * diffZ)) < obj->unk78) { + if ((s32) sqrtf((diffX * diffX) + (diffY * diffY) + (diffZ * diffZ)) < obj->properties.zipper.radius) { if (racer->playerIndex != PLAYER_COMPUTER) { play_sound_spatial(SOUND_ZIP_PAD_BOOST, racerObj->segment.trans.x_position, racerObj->segment.trans.y_position, racerObj->segment.trans.z_position, NULL); } @@ -1049,8 +1049,8 @@ void obj_loop_groundzipper(Object *obj, UNUSED s32 updateRate) { // This I'm quite sure is related to time trial checkpoints. void obj_init_unknown58(Object *obj, UNUSED LevelObjectEntry_Unknown58 *entry) { - obj->unk78 = 0; - obj->unk7C.word = (s32) obj->segment.header; + obj->properties.common.unk0 = 0; + obj->properties.common.unk4 = (s32) obj->segment.header; } void obj_loop_unknown58(Object *obj, s32 updateRate) { @@ -1060,10 +1060,10 @@ void obj_loop_unknown58(Object *obj, s32 updateRate) { Object_60 *obj60; s8 vehicleID; - obj->segment.unk38.byte.unk3B = 0; + obj->segment.object.animationID = 0; obj->segment.animFrame = 40; if (func_8001139C() == 0) { - obj->unk78 += updateRate; + obj->properties.common.unk0 += updateRate; } set_ghost_position_and_rotation(obj); func_800AFC3C(obj, updateRate); @@ -1075,17 +1075,17 @@ void obj_loop_unknown58(Object *obj, s32 updateRate) { if (vehicleID == VEHICLE_HOVERCRAFT || vehicleID == VEHICLE_PLANE) { someObj = (Object *) obj60->unk4; someObj->segment.trans.y_rotation = 0x4000; - someObj->segment.unk38.byte.unk3A++; - someObj->segment.unk38.byte.unk3A &= 1; + someObj->segment.object.numModelIDs++; + someObj->segment.object.numModelIDs &= 1; } } } void obj_init_characterflag(Object *obj, LevelObjectEntry_CharacterFlag *entry) { f32 radius; - obj->unk78 = entry->playerIndex; - obj->unk7C.word = -1; - obj->segment.trans.y_rotation = entry->angleY << 6 << 4; // Not sure about the values here. + obj->properties.characterFlag.playerID = entry->playerIndex; + obj->properties.characterFlag.characterID = -1; + obj->segment.trans.y_rotation = U8_ANGLE_TO_U16(entry->angleY); radius = entry->radius & 0xFF; if (radius < 10.0f) { radius = 10.0f; @@ -1101,17 +1101,17 @@ void obj_loop_characterflag(Object *obj, UNUSED s32 updateRate) { Object_CharacterFlag *flag; Object_Racer *racer; - if (obj->unk7C.word < 0) { - racerObj = get_racer_object(obj->unk78); + if (obj->properties.characterFlag.characterID < 0) { + racerObj = get_racer_object(obj->properties.characterFlag.playerID); if (racerObj != NULL) { flag = &obj->unk64->character_flag; racer = &racerObj->unk64->racer; - obj->unk7C.word = racer->characterId; - if (obj->unk7C.word < 0 || obj->unk7C.word >= 10) { - obj->unk7C.word = 0; + obj->properties.characterFlag.characterID = racer->characterId; + if (obj->properties.characterFlag.characterID < 0 || obj->properties.characterFlag.characterID >= 10) { + obj->properties.characterFlag.characterID = 0; } flag->vertices = gCharacterFlagVertices; - flag->texture = (TextureHeader *) &obj->unk68[obj->unk7C.word]->texHeader; + flag->texture = (TextureHeader *) &obj->unk68[obj->properties.characterFlag.characterID]->texHeader; temp_t4 = (flag->texture->width - 1) << 21; temp_t5 = (flag->texture->height - 1) << 5; //0x40 = Draw backface @@ -1195,18 +1195,18 @@ void obj_loop_stopwatchman(Object *obj, s32 updateRate) { angleDiff = 0xFFFF; } if (racer->exitObj != NULL) { - obj->action = TT_MODE_ROAM; - obj->unk7C.word = 1; + obj->properties.npc.action = TT_MODE_ROAM; + obj->properties.npc.timer = 1; } } index = get_buttons_pressed_from_player(PLAYER_ONE); - if (obj->action == TT_MODE_ROAM && distance < 300.0 && obj->unk7C.word == 0) { + if (obj->properties.npc.action == TT_MODE_ROAM && distance < 300.0 && obj->properties.npc.timer == 0) { if (angleDiff > -0x2000 && angleDiff < 0x2000) { if ((obj->interactObj->flags & INTERACT_FLAGS_PUSHING && racerObj == obj->interactObj->obj) || index & Z_TRIG) { if (index & Z_TRIG) { play_char_horn_sound(racerObj, racer); } - obj->action = TT_MODE_APPROACH_PLAYER; + obj->properties.npc.action = TT_MODE_APPROACH_PLAYER; get_fog_settings(PLAYER_ONE, &tt->fogNear, &tt->fogFar, &tt->fogR, &tt->fogG, &tt->fogB); func_80030DE0(PLAYER_ONE, 128, 128, 255, 900, 998, 240); func_800012E8(); @@ -1218,19 +1218,19 @@ void obj_loop_stopwatchman(Object *obj, s32 updateRate) { } } } - if (obj->action != TT_MODE_ROAM) { + if (obj->properties.npc.action != TT_MODE_ROAM) { disable_racer_input(); func_800AB194(3); } - if (obj->action >= TT_MODE_TURN_TOWARDS_PLAYER) { + if (obj->properties.npc.action >= TT_MODE_TURN_TOWARDS_PLAYER) { index = func_8009CFEC(2U); } else { func_8009CF68(2); index = 0; } - switch (obj->action) { + switch (obj->properties.npc.action) { case TT_MODE_APPROACH_PLAYER: - obj->segment.unk38.byte.unk3B = 0; + obj->segment.object.animationID = 0; tt->unkD = 255; if (distance < 100.0) { racer_set_dialogue_camera(); @@ -1258,14 +1258,14 @@ void obj_loop_stopwatchman(Object *obj, s32 updateRate) { obj->segment.z_velocity = coss_f(obj->segment.trans.y_rotation) * tt->forwardVel; tt->animFrameF -= (tt->forwardVel * 2 * updateRateF); } else { - obj->action = TT_MODE_TURN_TOWARDS_PLAYER; + obj->properties.npc.action = TT_MODE_TURN_TOWARDS_PLAYER; } move_object(obj, obj->segment.x_velocity * updateRateF, obj->segment.y_velocity * updateRateF, obj->segment.z_velocity * updateRateF); func_8006F388(1); break; case TT_MODE_TURN_TOWARDS_PLAYER: racer_set_dialogue_camera(); - obj->segment.unk38.byte.unk3B = 0; + obj->segment.object.animationID = 0; tt->animFrameF += 3.0 * updateRateF; angleDiff = (racerObj->segment.trans.y_rotation - (obj->segment.trans.y_rotation & 0xFFFF)) + 0x8000; if (angleDiff > 0x8000) { @@ -1284,7 +1284,7 @@ void obj_loop_stopwatchman(Object *obj, s32 updateRate) { obj->segment.z_velocity = diffZ * 0.05; if (angleDiff < 0x500) { if (angleDiff >= -0x4FF) { - obj->action = TT_MODE_DIALOGUE; + obj->properties.npc.action = TT_MODE_DIALOGUE; play_tt_voice_clip(SOUND_VOICE_TT_INTRO, 1); // Hi there, I'm T.T! } } @@ -1293,11 +1293,11 @@ void obj_loop_stopwatchman(Object *obj, s32 updateRate) { case TT_MODE_DIALOGUE: obj->segment.x_velocity = diffX * 0.05; obj->segment.z_velocity = diffZ * 0.05; - obj->segment.unk38.byte.unk3B = 1; + obj->segment.object.animationID = 1; tt->animFrameF += 1.0 * updateRateF; racer_set_dialogue_camera(); if (index == 3) { - obj->action = TT_MODE_DIALOGUE_END; + obj->properties.npc.action = TT_MODE_DIALOGUE_END; if (is_time_trial_enabled()) { play_tt_voice_clip(SOUND_VOICE_TT_SEE_YOU, 1); } else { @@ -1308,20 +1308,20 @@ void obj_loop_stopwatchman(Object *obj, s32 updateRate) { func_80001074(header->instruments); racer->unk118 = func_80004B40(racer->characterId, racer->vehicleID); } - obj->unk7C.word = 0xB4; + obj->properties.npc.timer = 180; move_object(obj, obj->segment.x_velocity * updateRateF, obj->segment.y_velocity * updateRateF, obj->segment.z_velocity * updateRateF); break; case TT_MODE_DIALOGUE_END: tt->animFrameF += 1.0 * updateRateF; racer_set_dialogue_camera(); - if (obj->unk7C.word < 140) { - obj->unk7C.word += 60; - obj->action = TT_MODE_ROAM; - obj->segment.unk38.byte.unk3B = 0; + if (obj->properties.npc.timer < 140) { + obj->properties.npc.timer += 60; + obj->properties.npc.action = TT_MODE_ROAM; + obj->segment.object.animationID = 0; } break; default: - obj->segment.unk38.byte.unk3B = 0; + obj->segment.object.animationID = 0; tt->forwardVel = 0.0f; if (tt->unkD == 0xFF) { tt->unkD = func_8001C524(obj->segment.trans.x_position, obj->segment.trans.y_position, obj->segment.trans.z_position, 0); @@ -1338,7 +1338,7 @@ void obj_loop_stopwatchman(Object *obj, s32 updateRate) { break; } obj->segment.trans.y_position = tempPosY; - index = func_8002B0F4(obj->segment.unk2C.half.lower, obj->segment.trans.x_position, obj->segment.trans.z_position, &water); + index = func_8002B0F4(obj->segment.object.segmentID, obj->segment.trans.x_position, obj->segment.trans.z_position, &water); if(index != 0) { index--; while(index >= 0) { @@ -1350,16 +1350,16 @@ void obj_loop_stopwatchman(Object *obj, s32 updateRate) { } obj->segment.trans.x_rotation = 0; obj->segment.trans.z_rotation = 0; - if (obj->action != TT_MODE_ROAM) { + if (obj->properties.npc.action != TT_MODE_ROAM) { gNPCPosY = obj->segment.trans.y_position; } obj->segment.animFrame = 1.0 * tt->animFrameF; func_80061C0C(obj); if (0) { } // Fakematch - if (obj->unk7C.word > 0) { - obj->unk7C.word -= updateRate; + if (obj->properties.npc.timer > 0) { + obj->properties.npc.timer -= updateRate; } else { - obj->unk7C.word = 0; + obj->properties.npc.timer = 0; } } @@ -1386,8 +1386,8 @@ GLOBAL_ASM("asm/non_matchings/unknown_032760/obj_loop_fish.s") * Set the timer between animations, and also set the timer to wait before playing the first animation. */ void obj_init_lavaspurt(Object *obj, LevelObjectEntry_LavaSpurt *entry) { - obj->unk78 = entry->initialTimer * 2; - obj->unk7C.word = entry->delayTimer; + obj->properties.lavaSpurt.actionTimer = entry->initialTimer * 2; + obj->properties.lavaSpurt.delayTimer = entry->delayTimer; } /** @@ -1395,15 +1395,15 @@ void obj_init_lavaspurt(Object *obj, LevelObjectEntry_LavaSpurt *entry) { * Count down until zero, then play an animation, after which, set the down time to a random amount with an offset based on spawn properties. */ void obj_loop_lavaspurt(Object *obj, s32 updateRate) { - if (obj->unk78 > 0) { - obj->unk78 -= updateRate; + if (obj->properties.lavaSpurt.actionTimer > 0) { + obj->properties.lavaSpurt.actionTimer -= updateRate; obj->segment.trans.flags |= OBJ_FLAGS_INVISIBLE; } else { obj->segment.trans.flags &= ~OBJ_FLAGS_INVISIBLE; obj->segment.animFrame += updateRate * 4; if (obj->segment.animFrame > 255) { obj->segment.animFrame = 0; - obj->unk78 = get_random_number_from_range(0, 30) + obj->unk7C.word; + obj->properties.lavaSpurt.actionTimer = get_random_number_from_range(0, 30) + obj->properties.lavaSpurt.delayTimer; } } } @@ -1420,14 +1420,14 @@ void obj_loop_posarrow(Object *obj, UNUSED s32 updateRate) { obj->segment.trans.flags |= OBJ_FLAGS_INVISIBLE; someObjList = get_racer_objects_by_position(&numberOfObjects); - if (obj->unk78 < numberOfObjects) { - someObj = someObjList[obj->unk78]; + if (obj->properties.common.unk0 < numberOfObjects) { + someObj = someObjList[obj->properties.common.unk0]; posArrow = &someObj->unk64->pos_arrow; if (posArrow->unk0 == -1) { obj->segment.trans.flags &= ~OBJ_FLAGS_INVISIBLE; posArrow->unk150 = obj; } - obj->segment.animFrame = obj->unk78 * 127; + obj->segment.animFrame = obj->properties.common.unk0 * 127; } } @@ -1590,10 +1590,10 @@ void obj_init_animation(Object *obj, LevelObjectEntry_Animation *entry, s32 arg2 } } func_80011390(); - obj->unk7C.word = entry->actorIndex; - obj->action = arg2; + obj->properties.animatedObj.behaviourID = entry->actorIndex; + obj->properties.animatedObj.action = arg2; if (arg2 != 0 && (get_buttons_pressed_from_player(PLAYER_ONE) & R_CBUTTONS)) { - obj->action = 2; + obj->properties.animatedObj.action = 2; } if (((func_8001E440() == entry->channel) || (entry->channel == 20)) && (obj->unk64 == NULL) && (entry->order == 0) && (entry->objectIdToSpawn != -1)) { func_8001F23C(obj, entry); @@ -1606,7 +1606,7 @@ void obj_init_animation(Object *obj, LevelObjectEntry_Animation *entry, s32 arg2 obj->unk64 = NULL; } } - if (func_80021600(obj->unk7C.word)) { + if (func_80021600(obj->properties.animatedObj.behaviourID)) { func_8001EE74(); } } @@ -1661,14 +1661,14 @@ void obj_loop_wizpigship(Object *wizShipObj, s32 updateRate) { func_8001F460(wizShipObj, updateRate, wizShipObj); if ((*wizShipObj->unk68) != NULL) { wizShipModel = (*wizShipObj->unk68)->objModel; - if (wizShipObj->unk7C.word > 0) { - wizShipObj->unk7C.word -= updateRate; + if (wizShipObj->properties.fireball.timer > 0) { + wizShipObj->properties.fireball.timer -= updateRate; } else { - wizShipObj->unk7C.word = 0; + wizShipObj->properties.fireball.timer = 0; } - if ((wizShipObj->unk60 != NULL) && (wizShipObj->unk7C.word == 0)) { + if ((wizShipObj->unk60 != NULL) && (wizShipObj->properties.fireball.timer == 0)) { if (wizShipObj->unk74 & 1) { - wizShipObj->unk7C.word = 0x14; + wizShipObj->properties.fireball.timer = 20; object_transform_to_matrix(shipMtx, &wizShipObj->segment.trans); trans.x_position = 0.0f; trans.y_position = 0.0f; @@ -1694,10 +1694,10 @@ void obj_loop_wizpigship(Object *wizShipObj, s32 updateRate) { newObject.objectID = 0xC6; newObj = spawn_object(&newObject, 1); if (newObj != NULL) { - newObj->segment.unk3C_a.level_entry = NULL; + newObj->segment.level_entry = NULL; newObj->segment.trans.y_rotation = wizShipObj->segment.trans.y_rotation + 0x8000; newObj->segment.trans.x_rotation = -wizShipObj->segment.trans.x_rotation; - newObj->unk78 = 0x3C; + newObj->properties.lasergun.timer = 0x3C; guMtxXFMF(laserMtx, 0.0f, 0.0f, -30.0f, &newObj->segment.x_velocity, &newObj->segment.y_velocity, &newObj->segment.z_velocity); play_sound_at_position(SOUND_LASER_GUN, wizShipObj->segment.trans.x_position, wizShipObj->segment.trans.y_position, wizShipObj->segment.trans.z_position, 4, NULL); } @@ -1719,9 +1719,9 @@ void obj_loop_vehicleanim(Object *obj, s32 updateRate) { if (obj60->unk0 > 0) { someObj = obj60->unk0 == 3 ? obj60->unkC : obj60->unk4; someObj->segment.trans.y_rotation = 0x4000; - someObj->segment.unk38.byte.unk3A++; - if (someObj->segment.unk38.byte.unk3A == someObj->segment.header->numberOfModelIds) { - someObj->segment.unk38.byte.unk3A = 0; + someObj->segment.object.numModelIDs++; + if (someObj->segment.object.numModelIDs == someObj->segment.header->numberOfModelIds) { + someObj->segment.object.numModelIDs = 0; } } } @@ -1827,14 +1827,14 @@ UNUSED void obj_init_animcar(UNUSED Object *obj, UNUSED s32 arg1) { void obj_loop_animcar(Object *obj, s32 updateRate) { Object *racerObj; s32 racerID; - racerID = obj->action; + racerID = obj->properties.common.unk0; racerObj = NULL; if (racerID != 0) { racerObj = get_racer_object(racerID - 1); } - obj->unk7C.word = func_8001F460(obj, updateRate, obj); + obj->properties.common.unk4 = func_8001F460(obj, updateRate, obj); obj->segment.trans.flags |= OBJ_FLAGS_INVISIBLE; - if (obj->unk7C.word == 0 && racerObj != NULL) { + if (obj->properties.common.unk4 == 0 && racerObj != NULL) { Object_Racer *racer = &racerObj->unk64->racer; racer->approachTarget = obj; } @@ -1849,8 +1849,8 @@ void obj_init_infopoint(Object *obj, LevelObjectEntry_InfoPoint *entry) { obj->interactObj->unk11 = 0; obj->interactObj->hitboxRadius = 15; obj->interactObj->pushForce = 0; - obj->unk78 = (entry->unk8[2] << 16) | entry->unk8[0]; // Not sure about the values here. - obj->unk7C.word = entry->unk8[1]; + obj->properties.infoPoint.radius = (entry->unk8[2] << 16) | entry->unk8[0]; // Not sure about the values here. + obj->properties.infoPoint.visible = entry->unk8[1]; obj->segment.trans.y_rotation = entry->unkB << 10; // Not sure about the values here. } @@ -1859,20 +1859,20 @@ void obj_loop_infopoint(Object *obj, UNUSED s32 updateRate) { ObjectInteraction *interactObj; Object *playerObj; - if (obj->unk7C.word == 0) { + if (obj->properties.infoPoint.visible == FALSE) { obj->segment.trans.flags |= OBJ_FLAGS_INVISIBLE; } else { obj->segment.trans.flags &= ~OBJ_FLAGS_INVISIBLE; } interactObj = obj->interactObj; - if (interactObj->distance < ((obj->unk78 >> 16) & 0xFF)) { + if (interactObj->distance < ((obj->properties.infoPoint.radius >> 16) & 0xFF)) { playerObj = interactObj->obj; if (playerObj->segment.header->behaviorId == 1) { Object_InfoPoint *playerObj64 = &playerObj->unk64->info_point; player = playerObj64->unk0; if ((player != PLAYER_COMPUTER) && (get_buttons_pressed_from_player(player) & Z_TRIG)) { - func_800C31EC(obj->unk78 & 0xFF); + func_800C31EC(obj->properties.infoPoint.radius & 0xFF); } } } @@ -1929,12 +1929,12 @@ void obj_init_bombexplosion(Object *obj, LevelObjectEntry_BombExplosion *entry) LevelObjectEntry_BombExplosion *entry2; obj->segment.animFrame = 0; obj->segment.trans.scale = 0.5f; - obj->segment.unk38.byte.unk3A = get_random_number_from_range(0, obj->segment.header->numberOfModelIds - 1); + obj->segment.object.numModelIDs = get_random_number_from_range(0, obj->segment.header->numberOfModelIds - 1); entry2 = entry; // Needed for a match. - obj->unk78 = 0; - obj->unk7C.word = 0xFF; + obj->properties.bombExplosion.timer = 0; + obj->properties.bombExplosion.unk4 = 0xFF; if (entry->unk8) { - obj->unk7C.word |= (entry2->unk8 << 8) & 0xFF00; + obj->properties.bombExplosion.unk4 |= (entry2->unk8 << 8) & 0xFF00; } obj->unk74 = 1; } @@ -1942,18 +1942,18 @@ void obj_init_bombexplosion(Object *obj, LevelObjectEntry_BombExplosion *entry) void obj_loop_bombexplosion(Object *obj, s32 updateRate) { s32 temp_t8; - obj->unk78 += updateRate; - temp_t8 = (obj->unk7C.word >> 8) & 0xFF; - if (obj->unk78 > 10 && temp_t8 != 0) { - obj->unk7C.word ^= (temp_t8 << 8); + obj->properties.bombExplosion.timer += updateRate; + temp_t8 = (obj->properties.bombExplosion.unk4 >> 8) & 0xFF; + if (obj->properties.bombExplosion.timer > 10 && temp_t8 != 0) { + obj->properties.bombExplosion.unk4 ^= (temp_t8 << 8); func_8003FC44(obj->segment.trans.x_position, obj->segment.trans.y_position, obj->segment.trans.z_position, 44, SOUND_NONE, 1.0f, temp_t8 - 1); } - if (obj->unk78 < 20) { - obj->segment.trans.scale = ((obj->unk78 / 20.0f) * 10.0f) + 0.5f; - obj->unk7C.word |= 0xFF; - } else if (obj->unk78 < 0x28) { - obj->segment.trans.scale = (((obj->unk78 - 20) / 20.0f) * 5.0f) + 10.5f; - obj->unk7C.word = 0x1EF - (obj->unk78 * 0xC); + if (obj->properties.bombExplosion.timer < 20) { + obj->segment.trans.scale = ((obj->properties.bombExplosion.timer / 20.0f) * 10.0f) + 0.5f; + obj->properties.bombExplosion.unk4 |= 0xFF; + } else if (obj->properties.bombExplosion.timer < 0x28) { + obj->segment.trans.scale = (((obj->properties.bombExplosion.timer - 20) / 20.0f) * 5.0f) + 10.5f; + obj->properties.bombExplosion.unk4 = 0x1EF - (obj->properties.bombExplosion.timer * 0xC); } else { gParticlePtrList_addObject(obj); } @@ -1977,7 +1977,7 @@ void obj_init_teleport(Object *obj, UNUSED LevelObjectEntry_Teleport *entry) { obj->interactObj->hitboxRadius = 15; obj->interactObj->pushForce = 0; if (get_settings()->cutsceneFlags & CUTSCENE_LIGHTHOUSE_ROCKET) { - obj->action = 1; + obj->properties.lighthouse.active = TRUE; } } @@ -1986,11 +1986,11 @@ void obj_init_teleport(Object *obj, UNUSED LevelObjectEntry_Teleport *entry) { * Triggers a warp to the space hub world when entered, if active. */ void obj_loop_teleport(Object *obj, UNUSED s32 updateRate) { - if (obj->action != 0) { - LevelObjectEntry_Teleport *level_entry = &obj->segment.unk3C_a.level_entry->teleport; + if (obj->properties.lighthouse.active) { + LevelObjectEntry_Teleport *level_entry = &obj->segment.level_entry->teleport; if (obj->interactObj->distance < 120) { begin_level_teleport(level_entry->levelID); - obj->action = 0; + obj->properties.lighthouse.active = FALSE; play_sound_global(SOUND_WHOOSH2, NULL); func_80000FDC(SOUND_VOICE_TT_FUTURE_FUN_LAND, 0, 1.0f); } @@ -2012,7 +2012,7 @@ void obj_init_exit(Object *obj, LevelObjectEntry_Exit *entry) { exit = &obj->unk64->exit; radius /= 128; obj->segment.trans.scale = radius; - obj->segment.trans.y_rotation = entry->unk11 << 6 << 4; + obj->segment.trans.y_rotation = U8_ANGLE_TO_U16(entry->angleY); exit->directionX = sins_f(obj->segment.trans.y_rotation); exit->directionY = 0.0f; exit->directionZ = coss_f(obj->segment.trans.y_rotation); @@ -2048,31 +2048,29 @@ void obj_loop_exit(Object *obj, UNUSED s32 updateRate) { enableWarp = TRUE; settings = get_settings(); // Disable the warp if it's for the first boss encounter, having collected every balloon. - if ((exit->bossFlag == WARP_BOSS_FIRST) && (settings->balloonsPtr[settings->worldId] == 8)) { + if (exit->bossFlag == WARP_BOSS_FIRST && settings->balloonsPtr[settings->worldId] == 8) { enableWarp = FALSE; } // Disable the warp if it's for the second boss encounter, having not collected every balloon. - if ((exit->bossFlag == WARP_BOSS_REMATCH) && (settings->balloonsPtr[settings->worldId] < 8)) { + if (exit->bossFlag == WARP_BOSS_REMATCH && settings->balloonsPtr[settings->worldId] < 8) { enableWarp = FALSE; } // The above ensures only one of the boss warps is active so they don't overlap. This could also probably have been done in the initialiser. - if (enableWarp) { - if (obj->interactObj->distance < exit->radius) { - dist = exit->radius; - racerObjects = get_racer_objects(&numberOfRacers); - for (i = 0; i < numberOfRacers; i++) { - racerObj = racerObjects[i]; - racer = &racerObj->unk64->racer; - if ((racer->playerIndex != PLAYER_COMPUTER) && (racer->exitObj == NULL)) { - diffX = racerObj->segment.trans.x_position - obj->segment.trans.x_position; - diffY = racerObj->segment.trans.y_position - obj->segment.trans.y_position; - diffZ = racerObj->segment.trans.z_position - obj->segment.trans.z_position; - if ((sqrtf((diffX * diffX) + (diffY * diffY) + (diffZ * diffZ)) < dist)) { - rotDiff = (exit->directionX * racerObj->segment.trans.x_position) + (exit->directionZ * racerObj->segment.trans.z_position) + exit->rotationDiff; - if (rotDiff < 0.0f) { - racer->exitObj = obj; - racer->transitionTimer = -120; - } + if (enableWarp && obj->interactObj->distance < exit->radius) { + dist = exit->radius; + racerObjects = get_racer_objects(&numberOfRacers); + for (i = 0; i < numberOfRacers; i++) { + racerObj = racerObjects[i]; + racer = &racerObj->unk64->racer; + if (racer->playerIndex != PLAYER_COMPUTER && racer->exitObj == NULL) { + diffX = racerObj->segment.trans.x_position - obj->segment.trans.x_position; + diffY = racerObj->segment.trans.y_position - obj->segment.trans.y_position; + diffZ = racerObj->segment.trans.z_position - obj->segment.trans.z_position; + if ((sqrtf((diffX * diffX) + (diffY * diffY) + (diffZ * diffZ)) < dist)) { + rotDiff = (exit->directionX * racerObj->segment.trans.x_position) + (exit->directionZ * racerObj->segment.trans.z_position) + exit->rotationDiff; + if (rotDiff < 0.0f) { + racer->exitObj = obj; + racer->transitionTimer = -120; } } } @@ -2082,7 +2080,7 @@ void obj_loop_exit(Object *obj, UNUSED s32 updateRate) { void obj_init_cameracontrol(Object *obj, LevelObjectEntry_CameraControl *entry) { - obj->action = entry->unk8; + obj->properties.common.unk0 = entry->unk8; func_80011390(); } @@ -2090,9 +2088,9 @@ void obj_loop_cameracontrol(UNUSED Object *obj, UNUSED s32 updateRate) { } void obj_init_setuppoint(Object *obj, LevelObjectEntry_SetupPoint *entry) { - obj->action = entry->unk8; - obj->unk7C.word = entry->unk9; - obj->segment.trans.y_rotation = entry->angleY << 6 << 4; // Not sure about the values here. + obj->properties.common.unk0 = entry->unk8; + obj->properties.common.unk4 = entry->unk9; + obj->segment.trans.y_rotation = U8_ANGLE_TO_U16(entry->angleY); } void obj_loop_setuppoint(UNUSED Object *obj, UNUSED s32 updateRate) { @@ -2116,18 +2114,18 @@ void obj_init_dino_whale(Object *obj, UNUSED LevelObjectEntry_Dino_Whale *entry) void obj_loop_dino_whale(Object *obj, s32 updateRate) { s32 animFrame; - if (obj->unk78 > 0) { - obj->unk78 -= updateRate; + if (obj->properties.common.unk0 > 0) { + obj->properties.common.unk0 -= updateRate; updateRate *= 2; } else { - obj->unk78 = 0; + obj->properties.common.unk0 = 0; } animFrame = obj->segment.animFrame; func_8001F460(obj, updateRate, obj); func_800113CC(obj, 0, animFrame, SOUND_STOMP2, SOUND_STOMP3); if (obj->interactObj->distance < 255) { - if (obj->unk78 == 0) { - obj->unk78 = 60; + if (obj->properties.common.unk0 == 0) { + obj->properties.common.unk0 = 60; play_sound_at_position(SOUND_VOICE_BRONTO_ROAR, obj->segment.trans.x_position, obj->segment.trans.y_position, obj->segment.trans.z_position, 4, NULL); } } @@ -2219,7 +2217,7 @@ void obj_loop_parkwarden(Object *obj, s32 updateRate) { buttonsPressed = get_buttons_pressed_from_player(PLAYER_ONE); var_a2 = FALSE; if ( - (obj->action == NULL) && + (obj->properties.npc.action == NULL) && (distance < 300.0) && ( ((obj->interactObj->flags & INTERACT_FLAGS_PUSHING) && (racerObj == obj->interactObj->obj)) || @@ -2242,7 +2240,7 @@ void obj_loop_parkwarden(Object *obj, s32 updateRate) { } } obj->interactObj->flags = INTERACT_FLAGS_SOLID; - if ((func_80052188() || (var_a2)) && ((obj->action == 0 || obj->action == 31))) { + if ((func_80052188() || var_a2) && (obj->properties.npc.action == TAJ_MODE_ROAM || obj->properties.npc.action == TAJ_MODE_UNK1F)) { func_800012E8(); set_music_player_voice_limit(24); play_music(SEQUENCE_ENTRANCED); @@ -2258,12 +2256,12 @@ void obj_loop_parkwarden(Object *obj, s32 updateRate) { arctan -= (racerObj->segment.trans.y_rotation & 0xFFFF); if((arctan > 0x8000)) { // Probably had a debug statement here. - if ((obj->action) && (!obj->action) && (!obj->action)){} // Fakematch + if ((obj->properties.npc.action) && (!obj->properties.npc.action) && (!obj->properties.npc.action)){} // Fakematch } if (var_a2) { - obj->action = 1; + obj->properties.npc.action = TAJ_MODE_APPROACH_PLAYER; } else { - obj->action = 10; + obj->properties.npc.action = TAJ_MODE_TELEPORT_TO_PLAYER_BEGIN; sp6B = 1; } get_fog_settings(PLAYER_ONE, &taj->fogNear, &taj->fogFar, &taj->fogR, &taj->fogG, &taj->fogB); @@ -2271,12 +2269,13 @@ void obj_loop_parkwarden(Object *obj, s32 updateRate) { taj->animFrameF = 0.0f; } - if (!(obj->action == TAJ_MODE_ROAM || obj->action == TAJ_MODE_RACE || obj->action == TAJ_MODE_TELEPORT_AWAY_BEGIN || obj->action == TAJ_MODE_TELEPORT_AWAY_END)) { + if (!(obj->properties.npc.action == TAJ_MODE_ROAM || obj->properties.npc.action == TAJ_MODE_RACE || + obj->properties.npc.action == TAJ_MODE_TELEPORT_AWAY_BEGIN || obj->properties.npc.action == TAJ_MODE_TELEPORT_AWAY_END)) { disable_racer_input(); func_800AB194(3); } - switch (obj->action) { + switch (obj->properties.npc.action) { case TAJ_MODE_GREET_PLAYER: case TAJ_MODE_DIALOGUE: case TAJ_MODE_TRANSFORM_BEGIN: @@ -2289,7 +2288,7 @@ void obj_loop_parkwarden(Object *obj, s32 updateRate) { break; } - switch (obj->action) { + switch (obj->properties.npc.action) { case TAJ_MODE_APPROACH_PLAYER: case TAJ_MODE_TURN_TOWARDS_PLAYER: case TAJ_MODE_GREET_PLAYER: @@ -2303,12 +2302,12 @@ void obj_loop_parkwarden(Object *obj, s32 updateRate) { func_8006F388(1); break; } - if (obj->action != TAJ_MODE_ROAM && var_a2_2 != 0 && obj->action < 4) { - obj->action = TAJ_MODE_DIALOGUE; + if (obj->properties.npc.action != TAJ_MODE_ROAM && var_a2_2 != 0 && obj->properties.npc.action < 4) { + obj->properties.npc.action = TAJ_MODE_DIALOGUE; } - switch (obj->action) { + switch (obj->properties.npc.action) { case TAJ_MODE_APPROACH_PLAYER: - obj->segment.unk38.byte.unk3B = 0; + obj->segment.object.animationID = 0; taj->unkD = 0xFF; if (distance < 100.0) { racer_set_dialogue_camera(); @@ -2334,13 +2333,13 @@ void obj_loop_parkwarden(Object *obj, s32 updateRate) { obj->segment.z_velocity = coss_f(obj->segment.trans.y_rotation) * taj->forwardVel; taj->animFrameF -= taj->forwardVel * 2 * updateRateF; } else { - obj->action = TAJ_MODE_TURN_TOWARDS_PLAYER; + obj->properties.npc.action = TAJ_MODE_TURN_TOWARDS_PLAYER; } move_object(obj, obj->segment.x_velocity * updateRateF, obj->segment.y_velocity * updateRateF, obj->segment.z_velocity * updateRateF); break; case TAJ_MODE_TURN_TOWARDS_PLAYER: racer_set_dialogue_camera(); - obj->segment.unk38.byte.unk3B = 0; + obj->segment.object.animationID = 0; taj->animFrameF += updateRateF * 2.0; arctan = (racerObj->segment.trans.y_rotation - (obj->segment.trans.y_rotation & 0xFFFF)) + 0x8000; if (arctan > 0x8000) { @@ -2354,7 +2353,7 @@ void obj_loop_parkwarden(Object *obj, s32 updateRate) { } obj->segment.trans.y_rotation += arctan >> 3; if (arctan < 0x400 && arctan > -0x400 && distance < 2.0) { - obj->action = TAJ_MODE_GREET_PLAYER; + obj->properties.npc.action = TAJ_MODE_GREET_PLAYER; taj->animFrameF = 0; play_taj_voice_clip(gTajSoundID, TRUE); gTajSoundID = SOUND_VOICE_TAJ_HELLO; @@ -2365,13 +2364,13 @@ void obj_loop_parkwarden(Object *obj, s32 updateRate) { move_object(obj, obj->segment.x_velocity * updateRateF, obj->segment.y_velocity * updateRateF, obj->segment.z_velocity * updateRateF); break; case TAJ_MODE_GREET_PLAYER: - obj->segment.unk38.byte.unk3B = 1; + obj->segment.object.animationID = 1; taj->forwardVel = 0.0f; taj->animFrameF += updateRateF * 1.0; if (taj->animFrameF > 77.0) { taj->animFrameF = 77.0; taj->unk18 = -1.0f; - obj->action = TAJ_MODE_DIALOGUE; + obj->properties.npc.action = TAJ_MODE_DIALOGUE; } arctan = (racerObj->segment.trans.y_rotation - (obj->segment.trans.y_rotation & 0xFFFF)) + 0x8000; if (arctan > 0x8000) { @@ -2387,13 +2386,13 @@ void obj_loop_parkwarden(Object *obj, s32 updateRate) { racer_set_dialogue_camera(); break; case TAJ_MODE_DIALOGUE: - obj->segment.unk38.byte.unk3B = 4; + obj->segment.object.animationID = 4; taj->animFrameF += updateRateF * 1.0; racer_set_dialogue_camera(); if (var_a2_2 == 3 || var_a2_2 == 4) { - obj->action = (var_a2_2 == 4) ? TAJ_MODE_END_DIALOGUE_UNUSED : TAJ_MODE_END_DIALOGUE; + obj->properties.npc.action = (var_a2_2 == 4) ? TAJ_MODE_END_DIALOGUE_UNUSED : TAJ_MODE_END_DIALOGUE; taj->animFrameF = 0.1f; - obj->segment.unk38.byte.unk3B = 2; + obj->segment.object.animationID = 2; taj->unk1C = 0; play_taj_voice_clip(SOUND_VOICE_TAJ_BYE, TRUE); func_80030DE0(PLAYER_ONE, taj->fogR, taj->fogG, taj->fogB, taj->fogNear, taj->fogFar, 180); @@ -2405,7 +2404,7 @@ void obj_loop_parkwarden(Object *obj, s32 updateRate) { if (var_a2_2 & 0x80) { D_8011D4E0 = var_a2_2 & 0x7F; if (D_8011D4E0 != racer64->racer.vehicleID) { - obj->action = TAJ_MODE_TRANSFORM_BEGIN; + obj->properties.npc.action = TAJ_MODE_TRANSFORM_BEGIN; taj->animFrameF = 0; // Voice clips: Abrakadabra, Alakazam, Alakazoom? play_taj_voice_clip((racer64->racer.vehicleID + SOUND_VOICE_TAJ_ABRAKADABRA), TRUE); @@ -2417,12 +2416,12 @@ void obj_loop_parkwarden(Object *obj, s32 updateRate) { D_8011D4E0 = var_a2_2 & 0xF; if (D_8011D4E0 != racer64->racer.vehicleID) { D_8011D4E0 |= 0x80; - obj->action = TAJ_MODE_TRANSFORM_BEGIN; + obj->properties.npc.action = TAJ_MODE_TRANSFORM_BEGIN; taj->animFrameF = 0.0f; // Voice clips: Abrakadabra, Alakazam, Alakazoom? play_taj_voice_clip((racer64->racer.vehicleID + SOUND_VOICE_TAJ_ABRAKADABRA), TRUE); } else { - obj->action = TAJ_MODE_SET_CHALLENGE; + obj->properties.npc.action = TAJ_MODE_SET_CHALLENGE; transition_begin(&D_800DC978); sp6B = 1; play_taj_voice_clip(SOUND_WHOOSH4, TRUE); @@ -2431,7 +2430,7 @@ void obj_loop_parkwarden(Object *obj, s32 updateRate) { } break; case TAJ_MODE_TRANSFORM_BEGIN: - obj->segment.unk38.byte.unk3B = 5; + obj->segment.object.animationID = 5; racer_set_dialogue_camera(); taj->animFrameF += updateRateF * 2.0; if (taj->animFrameF > 25.0) { @@ -2447,7 +2446,7 @@ void obj_loop_parkwarden(Object *obj, s32 updateRate) { } else { racer64->racer.transparency = 0; func_8000E1EC(racerObj, D_8011D4E0 & 0xF); - obj->action = TAJ_MODE_TRANSFORM_END; + obj->properties.npc.action = TAJ_MODE_TRANSFORM_END; play_sound_global(SOUND_CYMBAL, NULL); transition_begin(&D_800DC970); } @@ -2472,11 +2471,11 @@ void obj_loop_parkwarden(Object *obj, s32 updateRate) { if (D_8011D4E0 & 0x80) { transition_begin(&D_800DC978); sp6B = 1; - obj->action = TAJ_MODE_SET_CHALLENGE; + obj->properties.npc.action = TAJ_MODE_SET_CHALLENGE; play_sound_global(SOUND_WHOOSH4, NULL); taj->animFrameF = 0.0f; } else { - obj->action = TAJ_MODE_DIALOGUE; + obj->properties.npc.action = TAJ_MODE_DIALOGUE; set_menu_id_if_option_equal(0x62, 2); } } @@ -2490,21 +2489,21 @@ void obj_loop_parkwarden(Object *obj, s32 updateRate) { } if (taj->animFrameF == 0) { sp6B = 1; - if (obj->action == TAJ_MODE_END_DIALOGUE_UNUSED) { + if (obj->properties.npc.action == TAJ_MODE_END_DIALOGUE_UNUSED) { func_80022CFC( - obj->segment.unk2C.half.lower, + obj->segment.object.segmentID, obj->segment.trans.x_position - (racer64->racer.ox1 * 50.0f), obj->segment.trans.y_position, obj->segment.trans.z_position - (racer64->racer.oz1 * 50.0f) ); } - obj->action = TAJ_MODE_TELEPORT_AWAY_BEGIN; + obj->properties.npc.action = TAJ_MODE_TELEPORT_AWAY_BEGIN; play_sound_global(SOUND_WHOOSH4, NULL); racer64->racer.unk118 = func_80004B40(racer64->racer.characterId, racer64->racer.vehicleID); } break; case TAJ_MODE_TELEPORT_TO_PLAYER_BEGIN: - obj->segment.unk38.byte.unk3B = 3; + obj->segment.object.animationID = 3; taj->unkD = 0xFF; taj->forwardVel = 0.0f; taj->animFrameF += updateRateF * 2.0; @@ -2516,35 +2515,35 @@ void obj_loop_parkwarden(Object *obj, s32 updateRate) { if (taj->animFrameF < 20.0f) { var_a2 = 0; } - if (obj->segment.unk38.byte.unk39 > var_a2) { - obj->segment.unk38.byte.unk39 -= var_a2; + if (obj->segment.object.opacity > var_a2) { + obj->segment.object.opacity -= var_a2; } else { play_sound_global(SOUND_WHOOSH4, NULL); sp6B = 1; - obj->segment.unk38.byte.unk39 = 0; - obj->action = TAJ_MODE_TELEPORT_TO_PLAYER_END; + obj->segment.object.opacity = 0; + obj->properties.npc.action = TAJ_MODE_TELEPORT_TO_PLAYER_END; obj->segment.trans.x_position = racerObj->segment.trans.x_position - (racer64->racer.ox1 * 150.0f); obj->segment.trans.z_position = racerObj->segment.trans.z_position - (racer64->racer.oz1 * 150.0f); - obj->segment.unk2C.half.lower = get_level_segment_index_from_position(obj->segment.trans.x_position, obj->segment.trans.y_position, obj->segment.trans.z_position); + obj->segment.object.segmentID = get_level_segment_index_from_position(obj->segment.trans.x_position, obj->segment.trans.y_position, obj->segment.trans.z_position); obj->segment.trans.y_rotation = racerObj->segment.trans.y_rotation + 0x8000; } break; case TAJ_MODE_TELEPORT_TO_PLAYER_END: - obj->segment.unk38.byte.unk3B = 3; + obj->segment.object.animationID = 3; taj->animFrameF -= updateRateF * 2.0; if (taj->animFrameF < 0.0f) { taj->animFrameF = 0.0f; } var_a2 = updateRate * 4; - if (obj->segment.unk38.byte.unk39 < (255 - var_a2)) { - obj->segment.unk38.byte.unk39 += var_a2; + if (obj->segment.object.opacity < (255 - var_a2)) { + obj->segment.object.opacity += var_a2; } else { - obj->segment.unk38.byte.unk39 = 0xFF; - obj->action = TAJ_MODE_APPROACH_PLAYER; + obj->segment.object.opacity = 0xFF; + obj->properties.npc.action = TAJ_MODE_APPROACH_PLAYER; } break; case TAJ_MODE_SET_CHALLENGE: - obj->segment.unk38.byte.unk3B = 3; + obj->segment.object.animationID = 3; taj->unkD = 0xFF; taj->forwardVel = 0.0f; taj->animFrameF += updateRateF * 2.0; @@ -2555,8 +2554,8 @@ void obj_loop_parkwarden(Object *obj, s32 updateRate) { if (taj->animFrameF < 20.0f) { var_a2 = 0; } - if (obj->segment.unk38.byte.unk39 > var_a2) { - obj->segment.unk38.byte.unk39 -= var_a2; + if (obj->segment.object.opacity > var_a2) { + obj->segment.object.opacity -= var_a2; } else { racer64->racer.unk118 = func_80004B40(racer64->racer.characterId, racer64->racer.vehicleID); func_80030DE0(PLAYER_ONE, taj->fogR, taj->fogG, taj->fogB, taj->fogNear, taj->fogFar, 180); @@ -2568,14 +2567,14 @@ void obj_loop_parkwarden(Object *obj, s32 updateRate) { if (temp_v0_12 != NULL) { obj->segment.trans.x_position = temp_v0_12->segment.trans.x_position; obj->segment.trans.z_position = temp_v0_12->segment.trans.z_position; - obj->segment.unk2C.half.lower = temp_v0_12->segment.unk2C.half.lower; + obj->segment.object.segmentID = temp_v0_12->segment.object.segmentID; obj->segment.trans.y_rotation = racerObj->segment.trans.y_rotation + 0x8000; } - obj->action = TAJ_MODE_RACE; + obj->properties.npc.action = TAJ_MODE_RACE; } break; case TAJ_MODE_TELEPORT_AWAY_BEGIN: - obj->segment.unk38.byte.unk3B = 3; + obj->segment.object.animationID = 3; taj->unkD = 0xFF; taj->forwardVel = 0.0f; taj->animFrameF += updateRateF * 2.0; @@ -2586,42 +2585,42 @@ void obj_loop_parkwarden(Object *obj, s32 updateRate) { if (taj->animFrameF < 20.0f) { var_a2 = 0; } - if (obj->segment.unk38.byte.unk39 > var_a2) { - obj->segment.unk38.byte.unk39 -= var_a2; + if (obj->segment.object.opacity > var_a2) { + obj->segment.object.opacity -= var_a2; } else { - obj->segment.unk38.byte.unk39 = 0; - obj->action = TAJ_MODE_TELEPORT_AWAY_END; + obj->segment.object.opacity = 0; + obj->properties.npc.action = TAJ_MODE_TELEPORT_AWAY_END; temp_v0_12 = func_8002342C(obj->segment.trans.x_position, obj->segment.trans.z_position); if (temp_v0_12 != NULL) { obj->segment.trans.x_position = temp_v0_12->segment.trans.x_position; obj->segment.trans.z_position = temp_v0_12->segment.trans.z_position; - obj->segment.unk2C.half.lower = temp_v0_12->segment.unk2C.half.lower; + obj->segment.object.segmentID = temp_v0_12->segment.object.segmentID; obj->segment.trans.y_rotation = racerObj->segment.trans.y_rotation + 0x8000; } } break; case TAJ_MODE_TELEPORT_AWAY_END: - obj->segment.unk38.byte.unk3B = 3; + obj->segment.object.animationID = 3; taj->animFrameF -= updateRateF * 2.0; if (taj->animFrameF < 0.0f) { taj->animFrameF = 0.0f; } var_a2 = updateRate * 4; - if (obj->segment.unk38.byte.unk39 < (0xFF - var_a2)) { - obj->segment.unk38.byte.unk39 += var_a2; + if (obj->segment.object.opacity < (0xFF - var_a2)) { + obj->segment.object.opacity += var_a2; } else { - obj->segment.unk38.byte.unk39 = 0xFF; - obj->action = TAJ_MODE_ROAM; + obj->segment.object.opacity = 0xFF; + obj->properties.npc.action = TAJ_MODE_ROAM; } break; case TAJ_MODE_RACE: obj->interactObj->flags = INTERACT_FLAGS_NONE; - obj->segment.unk38.byte.unk3B = 6; - obj->segment.unk38.byte.unk39 = 0xFF; + obj->segment.object.animationID = 6; + obj->segment.object.opacity = 0xFF; taj->animFrameF += updateRateF * 1.0; break; default: - obj->segment.unk38.byte.unk3B = 0; + obj->segment.object.animationID = 0; taj->forwardVel = 0.0f; if (taj->unkD == 0xFF) { taj->unkD = func_8001C524(obj->segment.trans.x_position, obj->segment.trans.y_position, obj->segment.trans.z_position, 0); @@ -2737,7 +2736,7 @@ void obj_loop_parkwarden(Object *obj, s32 updateRate) { break; } obj->segment.trans.y_position = tempPosY; - var_a2 = func_8002B0F4(obj->segment.unk2C.half.lower, obj->segment.trans.x_position, obj->segment.trans.z_position, &water); + var_a2 = func_8002B0F4(obj->segment.object.segmentID, obj->segment.trans.x_position, obj->segment.trans.z_position, &water); if(var_a2 != 0) { var_a2--; while(var_a2 >= 0) { @@ -2749,7 +2748,7 @@ void obj_loop_parkwarden(Object *obj, s32 updateRate) { } obj->segment.trans.x_rotation = 0; obj->segment.trans.z_rotation = 0; - if (obj->action != TAJ_MODE_ROAM) { + if (obj->properties.npc.action != TAJ_MODE_ROAM) { gNPCPosY = obj->segment.trans.y_position; } if (sp6B != 0) { @@ -2796,7 +2795,7 @@ void obj_init_checkpoint(Object *obj, LevelObjectEntry_Checkpoint *entry, UNUSED } scale /= 64; obj->segment.trans.scale = scale; - obj->segment.trans.y_rotation = entry->angleY << 6 << 4; // Not sure about the values here. + obj->segment.trans.y_rotation = U8_ANGLE_TO_U16(entry->angleY); func_80011390(); } @@ -2813,15 +2812,15 @@ void obj_loop_checkpoint(UNUSED Object *obj, UNUSED s32 updateRate) { */ void obj_init_modechange(Object *obj, LevelObjectEntry_ModeChange *entry) { f32 radius; - Object_ModeChange *obj64; + Object_Trigger *obj64; radius = entry->radius & 0xFF; if (radius < 5) { radius = 5; } - obj64 = &obj->unk64->mode_change; + obj64 = &obj->unk64->trigger; radius /= 128; obj->segment.trans.scale = radius; - obj->segment.trans.y_rotation = entry->angleY << 6 << 4; + obj->segment.trans.y_rotation = U8_ANGLE_TO_U16(entry->angleY); obj64->directionX = sins_f(obj->segment.trans.y_rotation); obj64->directionY = 0.0f; obj64->directionZ = coss_f(obj->segment.trans.y_rotation); @@ -2843,7 +2842,7 @@ void obj_loop_modechange(Object *obj, UNUSED s32 updateRate) { Object **racerObjects; s32 numRacers; Object_Racer *racer; - Object_ModeChange *modeChange; + Object_Trigger *modeChange; f32 diffX; f32 diffY; f32 diffZ; @@ -2852,7 +2851,7 @@ void obj_loop_modechange(Object *obj, UNUSED s32 updateRate) { f32 radiusF; f32 dist; - modeChange = (Object_ModeChange *) obj->unk64; + modeChange = (Object_Trigger *) obj->unk64; if (obj->interactObj->distance < modeChange->radius) { radiusF = modeChange->radius; racerObjects = get_racer_objects(&numRacers); @@ -2898,21 +2897,21 @@ void obj_loop_modechange(Object *obj, UNUSED s32 updateRate) { void obj_init_bonus(Object *obj, LevelObjectEntry_Bonus *entry) { f32 radius; - Object_Bonus *obj64; + Object_Trigger *bonus; radius = entry->radius & 0xFF; if (radius < 5) { radius = 5; } - obj64 = &obj->unk64->bonus; + bonus = &obj->unk64->trigger; radius /= 128; obj->segment.trans.scale = radius; - obj->segment.trans.y_rotation = entry->angleY << 6 << 4; - obj64->directionX = sins_f(obj->segment.trans.y_rotation); - obj64->directionY = 0.0f; - obj64->directionZ = coss_f(obj->segment.trans.y_rotation); - obj64->rotationDiff = -((obj64->directionX * obj->segment.trans.x_position) + (obj64->directionZ * obj->segment.trans.z_position)); - obj64->radius = entry->radius; - obj64->unk14 = entry->unkA; + obj->segment.trans.y_rotation = U8_ANGLE_TO_U16(entry->angleY); + bonus->directionX = sins_f(obj->segment.trans.y_rotation); + bonus->directionY = 0.0f; + bonus->directionZ = coss_f(obj->segment.trans.y_rotation); + bonus->rotationDiff = -((bonus->directionX * obj->segment.trans.x_position) + (bonus->directionZ * obj->segment.trans.z_position)); + bonus->radius = entry->radius; + bonus->unk14 = entry->unkA; // Unused? obj->interactObj->flags = INTERACT_FLAGS_TANGIBLE; obj->interactObj->unk11 = 0; obj->interactObj->hitboxRadius = entry->radius; @@ -2928,11 +2927,11 @@ void obj_loop_bonus(Object *obj, UNUSED s32 updateRate) { f32 halfDist; f32 dist; f32 diffZ; - Object_Bonus *obj64; + Object_Trigger *obj64; Object **racerObjects; s32 i; - obj64 = &obj->unk64->bonus; + obj64 = &obj->unk64->trigger; if (obj->interactObj->distance < obj64->radius) { dist = obj64->radius; halfDist = dist * 0.5; @@ -2984,12 +2983,12 @@ void obj_init_goldenballoon(Object *obj, LevelObjectEntry_GoldenBalloon *entry) obj64 = &obj->unk64->npc; obj64->unkD = 255; obj64->unk0 = 0.0f; - obj->action = 0; + obj->properties.npc.action = 0; if (entry->challengeID) { if (get_settings()->tajFlags & (1 << (entry->challengeID + 2))) { - obj->action = 0; + obj->properties.npc.action = 0; } else { - obj->action = 1; + obj->properties.npc.action = 1; } } } @@ -3018,25 +3017,25 @@ void obj_loop_goldenballoon(Object *obj, s32 updateRate) { } speedf = updateRateF; settings = get_settings(); - levelEntry = obj->segment.unk3C_a.level_entry; + levelEntry = obj->segment.level_entry; flag = 0x10000 << levelEntry->goldenBalloon.balloonID; if (settings->courseFlagsPtr[settings->courseId] & flag) { - if (obj->unk7C.word > 0) { + if (obj->properties.npc.timer > 0) { obj->unk74 = 2; func_800AFC3C(obj, updateRate); - obj->unk7C.word -= updateRate; + obj->properties.npc.timer -= updateRate; } else { gParticlePtrList_addObject(obj); } } else { obj->segment.trans.flags |= OBJ_FLAGS_INVISIBLE; - if (obj->action == 0) { + if (obj->properties.npc.action == 0) { obj->segment.trans.flags &= (0xFFFF - OBJ_FLAGS_INVISIBLE); doubleSpeed = updateRate * 2; - if (obj->segment.unk38.byte.unk39 < (255 - doubleSpeed)) { - obj->segment.unk38.byte.unk39 += doubleSpeed; + if (obj->segment.object.opacity < (255 - doubleSpeed)) { + obj->segment.object.opacity += doubleSpeed; } else { - obj->segment.unk38.byte.unk39 = 255; + obj->segment.object.opacity = 255; } interactObj = obj->interactObj; if ((interactObj->distance < 45) && (isPirated == FALSE)) { @@ -3052,7 +3051,7 @@ void obj_loop_goldenballoon(Object *obj, s32 updateRate) { settings->courseFlagsPtr[settings->courseId] |= flag; if (1) {} // Fakematch play_sound_spatial(SOUND_COLLECT_BALLOON, obj->segment.trans.x_position, obj->segment.trans.y_position, obj->segment.trans.z_position, NULL); - obj->unk7C.word = 16; + obj->properties.npc.timer = 16; obj->unk74 = 2; obj->segment.trans.flags |= OBJ_FLAGS_INVISIBLE; func_800AFC3C(obj, updateRate); @@ -3060,9 +3059,9 @@ void obj_loop_goldenballoon(Object *obj, s32 updateRate) { } } obj64 = &obj->unk64->npc; - obj->segment.unk38.byte.unk3B = 0; + obj->segment.object.animationID = 0; obj64->forwardVel = 0.0f; - speedf = (obj->segment.unk38.byte.unk39 < 255) ? 0 : 1; + speedf = (obj->segment.object.opacity < 255) ? 0 : 1; if (obj64->unkD == 255) { obj64->unkD = func_8001C524(obj->segment.trans.x_position, obj->segment.trans.y_position, obj->segment.trans.z_position, 0); if (obj64->unkD != 255) { @@ -3096,12 +3095,12 @@ void obj_init_door(Object *obj, LevelObjectEntry_Door *entry) { if (obj64->unkE == -1) { rmonPrintf("Illegal door no!!!\n"); } - obj->segment.unk38.byte.unk3A = entry->modelIndex; - obj->segment.trans.y_rotation = entry->closedRotation << 6 << 4; + obj->segment.object.numModelIDs = entry->modelIndex; + obj->segment.trans.y_rotation = U8_ANGLE_TO_U16(entry->closedRotation); obj64->homeY = obj->segment.trans.y_position; obj64->unk8 = 0; - obj->unk78 = obj->segment.trans.y_rotation; - obj->unk7C.word = (s32) ((entry->openRotation & 0x3F) << 10); + obj->properties.door.closeAngle = obj->segment.trans.y_rotation; + obj->properties.door.openAngle = (s32) ((entry->openRotation & 0x3F) << 10); radius = entry->scale & 0xFF; if (radius < 10.0f) { radius = 10.0f; @@ -3114,8 +3113,8 @@ void obj_init_door(Object *obj, LevelObjectEntry_Door *entry) { obj->interactObj->unk11 = 2; obj->interactObj->hitboxRadius = 20; obj->interactObj->pushForce = 0; - if (obj->segment.unk38.byte.unk3A >= obj->segment.header->numberOfModelIds) { - obj->segment.unk38.byte.unk3A = 0; + if (obj->segment.object.numModelIDs >= obj->segment.header->numberOfModelIds) { + obj->segment.object.numModelIDs = 0; } } @@ -3125,16 +3124,16 @@ void obj_init_ttdoor(Object *obj, LevelObjectEntry_TTDoor *entry) { Object_TTDoor *obj64; f32 radius; - obj->segment.unk38.byte.unk3A = 0; + obj->segment.object.numModelIDs = 0; obj64 = &obj->unk64->tt_door; - obj->segment.trans.y_rotation = entry->angleY << 6 << 4; + obj->segment.trans.y_rotation = U8_ANGLE_TO_U16(entry->angleY); obj64->doorID = entry->doorID; obj64->unk13 = entry->unkB; - obj64->unk0 = obj->segment.trans.y_position; + obj64->homeY = obj->segment.trans.y_position; obj64->unk8 = 0; obj64->unk12 = entry->unkA; - obj->action = obj->segment.trans.y_rotation; - obj->unk7C.word = (entry->unk9 & 0x3F) << 0xA; + obj->properties.door.closeAngle = obj->segment.trans.y_rotation; + obj->properties.door.openAngle = (entry->unk9 & 0x3F) << 0xA; radius = entry->radius & 0xFF; if (radius < 10) { radius = 10; @@ -3145,8 +3144,8 @@ void obj_init_ttdoor(Object *obj, LevelObjectEntry_TTDoor *entry) { obj->interactObj->unk11 = 2; obj->interactObj->hitboxRadius = 20; obj->interactObj->pushForce = 0; - if (obj->segment.unk38.byte.unk3A >= obj->segment.header->numberOfModelIds) { - obj->segment.unk38.byte.unk3A = 0; + if (obj->segment.object.numModelIDs >= obj->segment.header->numberOfModelIds) { + obj->segment.object.numModelIDs = 0; } } @@ -3166,9 +3165,9 @@ void obj_loop_ttdoor(Object *obj, s32 updateRate) { ttDoor = (Object_TTDoor *) obj->unk64; settings = get_settings(); if (ttDoor->doorID == 0) { - obj->segment.unk38.byte.unk3A = D_800DCA94[settings->ttAmulet]; + obj->segment.object.numModelIDs = D_800DCA94[settings->ttAmulet]; } else { - obj->segment.unk38.byte.unk3A = D_800DCA9C[settings->ttAmulet]; + obj->segment.object.numModelIDs = D_800DCA9C[settings->ttAmulet]; } if (obj->interactObj->distance < ttDoor->unk12 && (settings->ttAmulet < 4 || *settings->balloonsPtr < 47)) { racerObj = obj->interactObj->obj; @@ -3205,9 +3204,9 @@ void obj_loop_ttdoor(Object *obj, s32 updateRate) { } openDoor = TRUE; if (settings->ttAmulet >= 4 && obj->interactObj->distance < ttDoor->unk12 && *settings->balloonsPtr >= 47) { - angle = obj->segment.trans.y_rotation - obj->unk7C.word; + angle = obj->segment.trans.y_rotation - obj->properties.door.openAngle; } else { - angle = obj->segment.trans.y_rotation - obj->unk78; + angle = obj->segment.trans.y_rotation - obj->properties.door.closeAngle; } angle >>= 3; if (angle > 0x200) { @@ -3241,12 +3240,12 @@ void obj_init_trigger(Object *obj, LevelObjectEntry_Trigger *entry) { f32 radius; Object_Trigger *obj64; - if (entry->unk9 == -1) { - entry->unk9 = func_8000CC20(obj); + if (entry->index == -1) { + entry->index = func_8000CC20(obj); } else { - func_8000CBF0(obj, entry->unk9); + func_8000CBF0(obj, entry->index); } - if (entry->unk9 == -1) { + if (entry->index == -1) { rmonPrintf("Illegal door no!!!\n"); } radius = (s32)entry->scale & 0xFF; @@ -3256,12 +3255,12 @@ void obj_init_trigger(Object *obj, LevelObjectEntry_Trigger *entry) { obj64 = &obj->unk64->trigger; radius /= 128; obj->segment.trans.scale = radius; - obj->segment.trans.y_rotation = entry->rotation << 6 << 4; - obj64->unk0 = sins_f(obj->segment.trans.y_rotation); - obj64->unk4 = 0.0f; - obj64->unk8 = coss_f(obj->segment.trans.y_rotation); - obj64->unkC = -((obj64->unk0 * obj->segment.trans.x_position) + (obj64->unk8 * obj->segment.trans.z_position)); - obj64->unk10 = entry->scale; + obj->segment.trans.y_rotation = U8_ANGLE_TO_U16(entry->angleY); + obj64->directionX = sins_f(obj->segment.trans.y_rotation); + obj64->directionY = 0.0f; + obj64->directionZ = coss_f(obj->segment.trans.y_rotation); + obj64->rotationDiff = -((obj64->directionX * obj->segment.trans.x_position) + (obj64->directionZ * obj->segment.trans.z_position)); + obj64->radius = entry->scale; obj64->unk14 = entry->unkD; obj->interactObj->flags = INTERACT_FLAGS_TANGIBLE; obj->interactObj->unk11 = 0; @@ -3288,27 +3287,27 @@ void obj_loop_trigger(Object *obj, UNUSED s32 updateRate) { f32 distance; s32 courseFlags; - triggerEntry = (LevelObjectEntry_Trigger *) obj->segment.unk3C_a.level_entry; + triggerEntry = (LevelObjectEntry_Trigger *) obj->segment.level_entry; trigger = (Object_Trigger *) obj->unk64; settings = get_settings(); courseFlags = settings->courseFlagsPtr[settings->courseId]; curRaceType = get_current_level_race_type(); - if (triggerEntry->unk9 >= 0) { - flags = 0x10000 << triggerEntry->unk9; - if (obj->interactObj->distance < trigger->unk10) { + if (triggerEntry->index >= 0) { + flags = 0x10000 << triggerEntry->index; + if (obj->interactObj->distance < trigger->radius) { if (((u8) curRaceType != RACETYPE_HUBWORLD) || !(courseFlags & flags)) { - radiusF = trigger->unk10; + radiusF = trigger->radius; racers = get_racer_objects(&numRacers); for (i = 0; i < numRacers; i++) { racerObj = racers[i]; - racer = (Object_Racer*)racerObj->unk64; + racer = (Object_Racer *) racerObj->unk64; if ((!(trigger->unk14 & 1) && racer->playerIndex == PLAYER_COMPUTER) || (!(trigger->unk14 & 2) && racer->playerIndex != PLAYER_COMPUTER)) { diffX = racerObj->segment.trans.x_position - obj->segment.trans.x_position; diffY = racerObj->segment.trans.y_position - obj->segment.trans.y_position; diffZ = racerObj->segment.trans.z_position - obj->segment.trans.z_position; distance = sqrtf((diffX * diffX) + (diffY * diffY) + (diffZ * diffZ)); if (distance < radiusF) { - distance = (trigger->unk0 * racerObj->segment.trans.x_position) + (trigger->unk8 * racerObj->segment.trans.z_position) + trigger->unkC; + distance = (trigger->directionX * racerObj->segment.trans.x_position) + (trigger->directionZ * racerObj->segment.trans.z_position) + trigger->rotationDiff; if (distance < 0.0f) { settings->courseFlagsPtr[settings->courseId] |= flags; if (triggerEntry->unkB != 0xFF) { @@ -3328,16 +3327,16 @@ void obj_loop_trigger(Object *obj, UNUSED s32 updateRate) { void obj_init_bridge_whaleramp(Object *obj, LevelObjectEntry_Bridge_WhaleRamp *entry) { Object_Bridge_WhaleRamp *temp = &obj->unk64->bridge_whale_ramp; - obj->segment.unk38.byte.unk3A = entry->unk8; - obj->segment.trans.y_rotation = entry->unk9 << 6 << 4; + obj->segment.object.numModelIDs = entry->numModelIDs; + obj->segment.trans.y_rotation = U8_ANGLE_TO_U16(entry->angleY); temp->unk0 = obj->segment.trans.y_position; obj->interactObj->flags = INTERACT_FLAGS_SOLID | INTERACT_FLAGS_UNK_0020; obj->interactObj->unk11 = 2; obj->interactObj->hitboxRadius = 20; obj->interactObj->pushForce = 0; temp->unk4 = 0; - if (obj->segment.unk38.byte.unk3A >= obj->segment.header->numberOfModelIds) { - obj->segment.unk38.byte.unk3A = 0; + if (obj->segment.object.numModelIDs >= obj->segment.header->numberOfModelIds) { + obj->segment.object.numModelIDs = 0; } } @@ -3354,7 +3353,7 @@ void obj_loop_bridge_whaleramp(Object *obj, s32 updateRate) { Object_Bridge_WhaleRamp *whaleRamp; LevelObjectEntry_Bridge_WhaleRamp *entry; f32 updateRateF; - s32 var_v0; + s32 vehicleID; f32 sp50; f32 sp4C; f32 sp48; @@ -3364,7 +3363,7 @@ void obj_loop_bridge_whaleramp(Object *obj, s32 updateRate) { Object_Racer *racer; whaleRamp = (Object_Bridge_WhaleRamp *) obj->unk64; - entry = (LevelObjectEntry_Bridge_WhaleRamp *) obj->segment.unk3C_a.level_entry; + entry = (LevelObjectEntry_Bridge_WhaleRamp *) obj->segment.level_entry; updateRateF = updateRate; if (osTvType == TV_TYPE_PAL) { @@ -3372,7 +3371,7 @@ void obj_loop_bridge_whaleramp(Object *obj, s32 updateRate) { } if (entry->unkB != 3) { - if (obj->unk78 != 0) { + if (obj->properties.common.unk0 != 0) { temp_f2 = (2.0 * (f32) entry->unkE); if (temp_f2 > 0.0f) { if (obj->segment.trans.y_position < (whaleRamp->unk0 + temp_f2)) { @@ -3383,7 +3382,7 @@ void obj_loop_bridge_whaleramp(Object *obj, s32 updateRate) { obj->segment.trans.y_position -= (updateRateF * 2); } } - } else if (entry->unkC > 0) { + } else if (entry->radius > 0) { if (whaleRamp->unk0 < obj->segment.trans.y_position) { obj->segment.trans.y_position -= (updateRateF * 2); } @@ -3392,7 +3391,7 @@ void obj_loop_bridge_whaleramp(Object *obj, s32 updateRate) { obj->segment.trans.y_position += (updateRateF * 2); } } - } else if (obj->unk78 != 0) { + } else if (obj->properties.common.unk0 != 0) { if (obj->segment.trans.x_rotation >= -0x12FF) { obj->segment.trans.x_rotation -= (updateRate * 0x2D); } @@ -3419,40 +3418,40 @@ void obj_loop_bridge_whaleramp(Object *obj, s32 updateRate) { switch (entry->unkB) { case 0: - obj->unk78 = 0; - if (obj->interactObj->distance < entry->unkC) { - obj->unk78 = 1; + obj->properties.common.unk0 = 0; + if (obj->interactObj->distance < entry->radius) { + obj->properties.common.unk0 = 1; } break; case 2: - obj->unk78 = 1; + obj->properties.common.unk0 = 1; racerObj = get_racer_object(0); if (racerObj != NULL) { racer = (Object_Racer *) racerObj->unk64; switch(racer->vehicleID) { default: - var_v0 = VEHICLE_HOVERCRAFT; + vehicleID = VEHICLE_HOVERCRAFT; break; case 1: - var_v0 = VEHICLE_PLANE; + vehicleID = VEHICLE_PLANE; break; case 2: - var_v0 = VEHICLE_LOOPDELOOP; + vehicleID = VEHICLE_LOOPDELOOP; break; } - if (entry->unkF & var_v0) { - obj->unk78 = NULL; + if (entry->allowedVehicles & vehicleID) { + obj->properties.common.unk0 = NULL; } } break; default: if (func_8001E2EC(entry->unkA) != 0) { - obj->unk78 = (entry->unkD * 2); + obj->properties.common.unk0 = (entry->unkD * 2); } - if (obj->unk78 > 0) { - obj->unk78 -= updateRate; + if (obj->properties.common.unk0 > 0) { + obj->properties.common.unk0 -= updateRate; } else { - obj->unk78 = 0; + obj->properties.common.unk0 = 0; } break; } @@ -3467,14 +3466,14 @@ void obj_init_rampswitch(Object *obj, LevelObjectEntry_RampSwitch *entry) { obj->interactObj->unk11 = 0; obj->interactObj->hitboxRadius = 20; obj->interactObj->pushForce = 0; - obj->action = entry->unk8; + obj->properties.common.unk0 = entry->unk8; } void obj_loop_rampswitch(Object *obj, UNUSED s32 updateRate) { - if (obj->interactObj->distance < 0x2D) { - func_8001E344(obj->action); + if (obj->interactObj->distance < 45) { + func_8001E344(obj->properties.common.unk0); } - obj->interactObj->distance = (u8)0xFF; + obj->interactObj->distance = 255; } void obj_init_seamonster(UNUSED Object *obj, UNUSED LevelObjectEntry_SeaMonster *entry) { @@ -3488,20 +3487,29 @@ void obj_init_fogchanger(Object *obj, LevelObjectEntry_FogChanger *entry) { f32 dist; dist = entry->distance * 8.0f; dist = dist * dist; - obj->unk78f = dist; + obj->properties.distance.radius = dist; } +/** + * Skydome control init behaviour. + * Sets hitbox data and on or off setting based off spawn info. +*/ void obj_init_skycontrol(Object *obj, LevelObjectEntry_SkyControl *entry) { obj->interactObj->flags = INTERACT_FLAGS_TANGIBLE; obj->interactObj->unk11 = 0; obj->interactObj->hitboxRadius = entry->radius; - obj->action = entry->unk8; - obj->unk7C.word = entry->radius; + obj->properties.skyControl.setting = entry->setting; + obj->properties.skyControl.radius = entry->radius; } +/** + * Skydome control loop behaviour. + * When a player goes through this object, enable or disable rendering the skydome depending on setting. + * Used for transitions between indoors and outdoors. +*/ void obj_loop_skycontrol(Object *obj, UNUSED s32 updateRate) { - if (obj->interactObj->distance < obj->unk7C.word) { - set_skydome_visbility(obj->action); + if (obj->interactObj->distance < obj->properties.skyControl.radius) { + set_skydome_visbility(obj->properties.skyControl.setting); } } @@ -3516,9 +3524,13 @@ void obj_init_ainode(Object *obj, LevelObjectEntry_AiNode *entry) { void obj_loop_ainode(UNUSED Object *obj, UNUSED s32 updateRate) { } +/** + * Smokey's castle treasure box init function. + * Sets up player ID, making sure the value doesn't go over 4 players. +*/ void obj_init_treasuresucker(Object *obj, LevelObjectEntry_TreasureSucker *entry) { obj->segment.animFrame = 120; - obj->action = (entry->unk8 - 1) & 3; + obj->properties.treasureSucker.playerID = (entry->playerID - 1) & 3; } /** @@ -3536,31 +3548,31 @@ void obj_loop_treasuresucker(Object *obj, s32 updateRate) { LevelObjectEntryCommon spawnObj; s32 doSpawnObj; - racerObj = get_racer_object(obj->unk78); + racerObj = get_racer_object(obj->properties.treasureSucker.playerID); if (racerObj != NULL) { racer = (Object_Racer *) racerObj->unk64; doSpawnObj = FALSE; - if (racer->bananas != 0 && obj->unk7C.word == 0) { + if (racer->bananas != 0 && obj->properties.treasureSucker.spawnTimer == 0) { diffX = obj->segment.trans.x_position - racerObj->segment.trans.x_position; diffY = obj->segment.trans.y_position - racerObj->segment.trans.y_position; diffZ = obj->segment.trans.z_position - racerObj->segment.trans.z_position; diffX = (diffX * diffX) + (diffY * diffY) + (diffZ * diffZ); // Required to match. if (diffX < 225 * 225) { - obj->unk7C.word = 8; + obj->properties.treasureSucker.spawnTimer = 8; doSpawnObj = TRUE; } } - if (obj->unk7C.word > 0) { - obj->unk7C.word -= updateRate; - if (obj->unk7C.word <= 0) { + if (obj->properties.treasureSucker.spawnTimer > 0) { + obj->properties.treasureSucker.spawnTimer -= updateRate; + if (obj->properties.treasureSucker.spawnTimer <= 0) { if (racer->bananas > 0) { racer->bananas--; if (racer->bananas != 0) { doSpawnObj = TRUE; } - obj->unk7C.word = 8; + obj->properties.treasureSucker.spawnTimer = 8; } else { - obj->unk7C.word = 0; + obj->properties.treasureSucker.spawnTimer = 0; } } } @@ -3572,13 +3584,13 @@ void obj_loop_treasuresucker(Object *obj, s32 updateRate) { spawnObj.objectID = BHV_SNOWBALL_2; newObj = spawn_object(&spawnObj, 1); if (newObj != NULL) { - newObj->segment.unk3C_a.level_entry = NULL; + newObj->segment.level_entry = NULL; newObj->segment.y_velocity = 10.0f; scale = (newObj->segment.y_velocity * 2) / 0.5; newObj->segment.x_velocity = (obj->segment.trans.x_position - racerObj->segment.trans.x_position) / scale; newObj->segment.z_velocity = (obj->segment.trans.z_position - racerObj->segment.trans.z_position) / scale; - newObj->unk7C.word = (s32) racer; - newObj->unk78 = scale; + newObj->properties.treasureBanana.racer = racer; + newObj->properties.treasureBanana.diff = scale; } } } @@ -3599,9 +3611,9 @@ void obj_loop_flycoin(Object *obj, s32 updateRate) { } obj->segment.y_velocity -= 0.5 * updateRateF; move_object(obj, obj->segment.x_velocity * updateRateF, obj->segment.y_velocity * updateRateF, obj->segment.z_velocity * updateRateF); - obj->unk78 -= updateRate; - if (obj->unk78 <= 0) { - racerObj = (Object_Racer *) obj->unk7C.word; + obj->properties.treasureBanana.diff -= updateRate; + if (obj->properties.treasureBanana.diff <= 0) { + racerObj = obj->properties.treasureBanana.racer; racerObj->lap++; if (racerObj->lap >= 10) { racerObj->raceFinished = TRUE; @@ -3619,31 +3631,31 @@ void obj_init_bananacreator(Object *obj, UNUSED LevelObjectEntry_BananaCreator * } void obj_loop_bananacreator(Object *obj, s32 updateRate) { - LevelObjectEntryCommon newEntry; - Object *newBananaObj; - Object_Banana *newBananaObj64; + LevelObjectEntryCommon newEntry; + Object *newBananaObj; + Object_Banana *newBananaObj64; - if (obj->unk7C.word != 0) { - obj->unk78 -= updateRate; - } + if (obj->properties.bananaSpawner.spawn != 0) { + obj->properties.bananaSpawner.timer -= updateRate; + } - if (obj->unk78 <= 0) { - newEntry.x = (s32) obj->segment.trans.x_position; - newEntry.y = ((s32) ((s16) obj->segment.trans.y_position)) - 3; - newEntry.z = (s32) obj->segment.trans.z_position; - newEntry.size = 8; - newEntry.objectID = 83; - newBananaObj = spawn_object(&newEntry, 1); - obj->unk7C.word = 1; - if (newBananaObj) { - newBananaObj->segment.unk3C_a.level_entry = NULL; - newBananaObj64 = &newBananaObj->unk64->banana; - newBananaObj64->spawner = obj; - func_8003FC44(obj->segment.trans.x_position, obj->segment.trans.y_position - 14.0f, obj->segment.trans.z_position, 44, SOUND_SELECT, 0.25f, 0); - obj->unk7C.word = 0; + if (obj->properties.bananaSpawner.timer <= 0) { + newEntry.x = (s32) obj->segment.trans.x_position; + newEntry.y = ((s32) ((s16) obj->segment.trans.y_position)) - 3; + newEntry.z = (s32) obj->segment.trans.z_position; + newEntry.size = 8; + newEntry.objectID = 83; + newBananaObj = spawn_object(&newEntry, 1); + obj->properties.bananaSpawner.spawn = TRUE; + if (newBananaObj) { + newBananaObj->segment.level_entry = NULL; + newBananaObj64 = &newBananaObj->unk64->banana; + newBananaObj64->spawner = obj; + func_8003FC44(obj->segment.trans.x_position, obj->segment.trans.y_position - 14.0f, obj->segment.trans.z_position, 44, SOUND_SELECT, 0.25f, 0); + obj->properties.bananaSpawner.spawn = FALSE; + } + obj->properties.bananaSpawner.timer = TIME_SECONDS(20); // Set delay to respawn banana to 20 seconds. } - obj->unk78 = TIME_SECONDS(20); // Set delay to respawn banana to 20 seconds. - } } @@ -3651,8 +3663,8 @@ void obj_init_banana(Object *obj, UNUSED LevelObjectEntry_Banana *entry) { obj->interactObj->flags = INTERACT_FLAGS_TANGIBLE; obj->interactObj->unk11 = 0; obj->interactObj->hitboxRadius = 30; - obj->unk7C.half.upper = 0x14; - obj->unk7C.half.lower = 0x10; + obj->properties.banana.unk4 = 20; + obj->properties.banana.unk6 = 16; if (get_filtered_cheats() & CHEAT_DISABLE_BANANAS) { gParticlePtrList_addObject(obj); } @@ -3675,7 +3687,7 @@ void obj_loop_banana(Object *obj, s32 updateRate) { s32 sp44; s8 sp43; Object_Banana *banana; - Object_78_Banana *obj78; + ObjPropertyBanana *properties; s32 prevSoundMask; updateRateF = updateRate; @@ -3684,13 +3696,13 @@ void obj_loop_banana(Object *obj, s32 updateRate) { } banana = (Object_Banana *) obj->unk64; obj->segment.animFrame += updateRate * 8; - obj78 = (Object_78_Banana *) &obj->unk78; - if (obj->unk78 == -1) { + properties = (ObjPropertyBanana *) &obj->properties.banana; + if (properties->unk0 == -1) { obj->segment.trans.flags |= OBJ_FLAGS_INVISIBLE; - obj78->unk6 -= updateRate; + properties->unk6 -= updateRate; obj->unk74 = 1; func_800AFC3C(obj, updateRate); - if (obj78->unk6 <= 0) { + if (properties->unk6 <= 0) { gParticlePtrList_addObject(obj); } } else { @@ -3700,7 +3712,7 @@ void obj_loop_banana(Object *obj, s32 updateRate) { banana->unk8 = 0; banana->unk0 = 0; } - if (obj78->unk0 == 1) { + if (properties->unk0 == 1) { tempPos[0] = obj->segment.trans.x_position + (obj->segment.x_velocity * updateRateF); tempPos[1] = obj->segment.trans.y_position + (obj->segment.y_velocity * updateRateF); tempPos[2] = obj->segment.trans.z_position + (obj->segment.z_velocity * updateRateF); @@ -3732,11 +3744,11 @@ void obj_loop_banana(Object *obj, s32 updateRate) { velZ = -velZ; } if (sp48 > 0 && velX < 0.5 && velZ < 0.5) { - obj78->unk0 = 0; + properties->unk0 = 0; } radius = -10000.0f; if (func_8002B9BC(obj, &radius, NULL, 1) != 0 && obj->segment.trans.y_position < radius) { - obj78->unk0 = 0; + properties->unk0 = 0; obj->segment.trans.y_position = radius; } } @@ -3745,10 +3757,10 @@ void obj_loop_banana(Object *obj, s32 updateRate) { sp44 = 55; } - if (obj78->unk4 > 0) { - obj78->unk4 -= updateRate; + if (properties->unk4 > 0) { + properties->unk4 -= updateRate; } else { - obj78->unk4 = 0; + properties->unk4 = 0; } if (obj->interactObj->distance < 120) { if (get_current_level_race_type() == RACETYPE_CHALLENGE_BANANAS) { @@ -3761,7 +3773,7 @@ void obj_loop_banana(Object *obj, s32 updateRate) { } } } - if (obj->interactObj->distance < sp44 && obj78->unk4 == 0) { + if (obj->interactObj->distance < sp44 && properties->unk4 == 0) { racerObj = obj->interactObj->obj; if (racerObj != NULL && racerObj->segment.header->behaviorId == BHV_RACER) { racer = (Object_Racer *) racerObj->unk64; @@ -3776,12 +3788,12 @@ void obj_loop_banana(Object *obj, s32 updateRate) { } racer->bananas++; if (banana->spawner != NULL) { - banana->spawner->unk7C.word = 1; + banana->spawner->properties.bananaSpawner.spawn = TRUE; } if (get_number_of_active_players() > TWO_PLAYERS) { gParticlePtrList_addObject(obj); } else { - obj78->unk0 = -1; + properties->unk0 = -1; obj->unk74 = 1; func_800AFC3C(obj, updateRate); } @@ -3802,16 +3814,16 @@ void obj_init_silvercoin_adv2(Object *obj, UNUSED LevelObjectEntry_SilverCoinAdv obj->interactObj->flags = INTERACT_FLAGS_TANGIBLE; obj->interactObj->unk11 = 0; obj->interactObj->hitboxRadius = 30; - obj->action = 3; - obj->unk7C.word = 16; + obj->properties.npc.action = SILVER_COIN_INACTIVE; + obj->properties.npc.timer = 16; if (!is_in_tracks_mode()) { if (check_if_silver_coin_race() && is_in_adventure_two()) { - obj->action = SILVER_COIN_ACTIVE; + obj->properties.npc.action = SILVER_COIN_ACTIVE; } else { - obj->action = SILVER_COIN_INACTIVE; + obj->properties.npc.action = SILVER_COIN_INACTIVE; } } - if (obj->action == SILVER_COIN_INACTIVE) { + if (obj->properties.npc.action == SILVER_COIN_INACTIVE) { obj->segment.trans.flags |= OBJ_FLAGS_INVIS_PLAYER1 | OBJ_FLAGS_INVIS_PLAYER2; gParticlePtrList_addObject(obj); } @@ -3826,16 +3838,16 @@ void obj_init_silvercoin(Object *obj, UNUSED LevelObjectEntry_SilverCoin *entry) obj->interactObj->flags = INTERACT_FLAGS_TANGIBLE; obj->interactObj->unk11 = 0; obj->interactObj->hitboxRadius = 30; - obj->action = SILVER_COIN_INACTIVE; - obj->unk7C.word = 0; + obj->properties.npc.action = SILVER_COIN_INACTIVE; + obj->properties.npc.timer = 0; if (!is_in_tracks_mode()) { if (check_if_silver_coin_race() && !is_in_adventure_two()) { - obj->action = SILVER_COIN_ACTIVE; + obj->properties.npc.action = SILVER_COIN_ACTIVE; } else { - obj->action = SILVER_COIN_INACTIVE; + obj->properties.npc.action = SILVER_COIN_INACTIVE; } } - if (obj->action == SILVER_COIN_INACTIVE) { + if (obj->properties.npc.action == SILVER_COIN_INACTIVE) { obj->segment.trans.flags |= OBJ_FLAGS_INVIS_PLAYER2 | OBJ_FLAGS_INVIS_PLAYER1; gParticlePtrList_addObject(obj); } @@ -3848,22 +3860,22 @@ void obj_init_silvercoin(Object *obj, UNUSED LevelObjectEntry_SilverCoin *entry) * When collected, the coins are hidden for that player, rather than being removed outright. */ void obj_loop_silvercoin(Object *obj, s32 updateRate) { - ObjectInteraction *silverCoin4C; + ObjectInteraction *interactObj; Object_Racer* racer; Object *racerObj; s32 temp; temp = func_8006C19C(); - if ((temp && obj->action != SILVER_COIN_INACTIVE) || (!temp && obj->action == SILVER_COIN_ACTIVE)) { - silverCoin4C = obj->interactObj; - if (silverCoin4C->distance < 80) { - racerObj = (Object *) silverCoin4C->obj; + if ((temp && obj->properties.npc.action != SILVER_COIN_INACTIVE) || (!temp && obj->properties.npc.action == SILVER_COIN_ACTIVE)) { + interactObj = obj->interactObj; + if (interactObj->distance < 80) { + racerObj = interactObj->obj; if (racerObj != NULL && racerObj->segment.header->behaviorId == BHV_RACER) { racer = (Object_Racer *) racerObj->unk64; if (racer->playerIndex != PLAYER_COMPUTER) { - if (racer->raceFinished == FALSE && !(obj->action & (SILVER_COIN_COLLECTED << racer->playerIndex))) { - obj->action |= SILVER_COIN_COLLECTED << racer->playerIndex; - obj->unk7C.word = 0x10; + if (racer->raceFinished == FALSE && !(obj->properties.npc.action & (SILVER_COIN_COLLECTED << racer->playerIndex))) { + obj->properties.npc.action |= SILVER_COIN_COLLECTED << racer->playerIndex; + obj->properties.npc.timer = 16; obj->segment.trans.flags |= OBJ_FLAGS_INVIS_PLAYER1 << racer->playerIndex; play_sequence(SEQUENCE_SILVER_COIN_1 + racer->silverCoinCount); racer->silverCoinCount++; @@ -3873,8 +3885,8 @@ void obj_loop_silvercoin(Object *obj, s32 updateRate) { } obj->segment.animFrame += 8 * updateRate; } - if (obj->unk7C.word > 0) { - obj->unk7C.word -= updateRate; + if (obj->properties.npc.timer > 0) { + obj->properties.npc.timer -= updateRate; obj->unk74 = 1; func_800AFC3C(obj, updateRate); } @@ -3891,9 +3903,9 @@ void obj_init_worldkey(Object *obj, LevelObjectEntry_WorldKey *entry) { obj->interactObj->unk11 = 0; obj->interactObj->hitboxRadius = 30; entry->keyID &= 0xF; - obj->action = entry->keyID; + obj->properties.worldKey.keyID = entry->keyID; settings = get_settings(); - if (!is_in_tracks_mode() && !(settings->keys & (1 << obj->action))) { + if (!is_in_tracks_mode() && !(settings->keys & (1 << obj->properties.worldKey.keyID))) { return; } gParticlePtrList_addObject(obj); @@ -3920,7 +3932,7 @@ void obj_loop_worldkey(Object *worldKeyObj, s32 updateRate) { // Player has grabbed the key! play_sequence(SEQUENCE_KEY_COLLECT); settings = get_settings(); - settings->keys |= 1 << worldKeyObj->action; // Set key flag + settings->keys |= 1 << worldKeyObj->properties.worldKey.keyID; // Set key flag gParticlePtrList_addObject(worldKeyObj); // Makes the key unload. } } @@ -3938,8 +3950,8 @@ void obj_loop_worldkey(Object *worldKeyObj, s32 updateRate) { */ void obj_init_weaponballoon(Object *obj, LevelObjectEntry_WeaponBalloon *entry) { s32 cheats; - Object_WeaponBalloon *obj64; - f32 scalef; + Object_WeaponBalloon *balloon; + f32 radius; obj->interactObj->flags = INTERACT_FLAGS_TANGIBLE; obj->interactObj->unk11 = 4; @@ -3964,25 +3976,25 @@ void obj_init_weaponballoon(Object *obj, LevelObjectEntry_WeaponBalloon *entry) entry->unk8 = 0; } - if (obj->segment.unk38.byte.unk3A >= obj->segment.header->numberOfModelIds) { - obj->segment.unk38.byte.unk3A = 0; + if (obj->segment.object.numModelIDs >= obj->segment.header->numberOfModelIds) { + obj->segment.object.numModelIDs = 0; } - obj->segment.unk38.byte.unk3A = entry->balloonType; - obj->unk78 = obj->segment.unk38.byte.unk3A; + obj->segment.object.numModelIDs = entry->balloonType; + obj->properties.weaponBalloon.balloonID = obj->segment.object.numModelIDs; - scalef = entry->scale & 0xFF; - if (scalef < 10) { - scalef = 10; + radius = entry->radius & 0xFF; + if (radius < 10) { + radius = 10; } - scalef /= 64; + radius /= 64; - obj64 = &obj->unk64->weapon_balloon; + balloon = &obj->unk64->weapon_balloon; - obj->segment.trans.scale = obj->segment.header->scale * scalef; - obj64->unk0 = obj->segment.trans.scale; - obj64->unk4 = 0; - obj->unk7C.word = 0; + obj->segment.trans.scale = obj->segment.header->scale * radius; + balloon->radius = obj->segment.trans.scale; + balloon->unk4 = 0; + obj->properties.weaponBalloon.unk4 = 0; if (get_filtered_cheats() & CHEAT_DISABLE_WEAPONS) { gParticlePtrList_addObject(obj); @@ -4001,7 +4013,7 @@ void obj_loop_weaponballoon(Object *obj, s32 updateRate) { s32 newvar; balloon = (Object_WeaponBalloon *) obj->unk64; - obj->segment.trans.scale = balloon->unk0 * (1.0 - (balloon->unk4 / 90.0f)); + obj->segment.trans.scale = balloon->radius * (1.0 - (balloon->unk4 / 90.0f)); if (obj->segment.trans.scale < 0.001) { obj->segment.trans.scale = 0.001f; } @@ -4010,10 +4022,10 @@ void obj_loop_weaponballoon(Object *obj, s32 updateRate) { } else { obj->segment.trans.flags &= 0xBFFF; } - if (obj->unk7C.word > 0) { + if (obj->properties.weaponBalloon.unk4 > 0) { obj->unk74 = 1; func_800AFC3C(obj, updateRate); - obj->unk7C.word -= updateRate; + obj->properties.weaponBalloon.unk4 -= updateRate; } if (balloon->unk4 != 0) { if (!(balloon->unk4 == 90 && obj->interactObj->distance < 45)) { @@ -4029,7 +4041,7 @@ void obj_loop_weaponballoon(Object *obj, s32 updateRate) { racer = (Object_Racer *) interactObj->unk64; if (racer->vehicleID < VEHICLE_TRICKY|| racer->playerIndex != PLAYER_COMPUTER) { currentBalloon = racer->balloon_type; - racer->balloon_type = obj->unk78; + racer->balloon_type = obj->properties.weaponBalloon.balloonID; if (currentBalloon == racer->balloon_type && racer->balloon_quantity != 0) { racer->balloon_level++; } else { @@ -4058,7 +4070,7 @@ void obj_loop_weaponballoon(Object *obj, s32 updateRate) { racer->balloon_quantity = balloonAsset[(racer->balloon_type * 10) + (racer->balloon_level * 2) + 1]; racer->unk209 |= 1; if (get_number_of_active_players() < THREE_PLAYERS) { - obj->unk7C.word = 0x10; + obj->properties.weaponBalloon.unk4 = 0x10; } if (racer->playerIndex == PLAYER_COMPUTER) { play_sound_at_position(SOUND_BALLOON_POP, obj->segment.trans.x_position, obj->segment.trans.y_position, obj->segment.trans.z_position, 4, NULL); @@ -4120,8 +4132,8 @@ void obj_init_weapon(Object *obj, UNUSED LevelObjectEntry_Weapon *entry) { obj->interactObj->unk11 = 0; obj->interactObj->hitboxRadius = 24; obj->interactObj->pushForce = 0; - obj->unk78 = normalise_time(480); - obj->unk7C.word = 0; + obj->properties.projectile.timer = normalise_time(480); + obj->properties.projectile.unk4 = 0; } /** @@ -4204,21 +4216,21 @@ void handle_rocket_projectile(Object *obj, s32 updateRate) { surface = SURFACE_NONE; func_80031600(&obj->segment.trans.x_position, &offsetX, &radius, &surface, TRUE, &hasCollision); if (hasCollision > 0) { - if (func_8002ACD4(&diffX, &diffY, &diffZ) != 0) { - obj->unk78 = 0; + if (func_8002ACD4(&diffX, &diffY, &diffZ)) { + obj->properties.projectile.timer = 0; } } } diffX = offsetX - posX; diffY = offsetY - posY; diffZ = offsetZ - posZ; - if (move_object(obj, diffX, diffY, diffZ) != 0) { - obj->unk78 = 0; + if (move_object(obj, diffX, diffY, diffZ)) { + obj->properties.projectile.timer = 0; } diffX = ((diffX * diffX) + (diffZ * diffZ)) / updateRateF; diffZ = (weapon->forwardVel * weapon->forwardVel) / 2; if (diffX < diffZ) { - obj->unk78 = 0; + obj->properties.projectile.timer = 0; } if (weapon->weaponID == WEAPON_ROCKET_HOMING) { numCheckpoints = get_checkpoint_count(); @@ -4242,7 +4254,7 @@ void handle_rocket_projectile(Object *obj, s32 updateRate) { if (obj->interactObj->obj != NULL) { interactObj = obj->interactObj->obj; if (interactObj == weapon->owner) { - if (obj->unk78 < normalise_time(450) && obj->unk78 != 0) { + if (obj->properties.projectile.timer < normalise_time(450) && obj->properties.projectile.timer) { goto block_25; } goto block_37; @@ -4275,19 +4287,19 @@ block_25: } } block_37: - obj->unk7C.word += updateRate; + obj->properties.projectile.unk4 += updateRate; if (obj->unk60 != NULL) { temp_s1_2 = (Object *) obj->unk60->unk4; - if (obj->unk7C.word < 8) { - temp_s1_2->segment.trans.scale = obj->unk7C.word * 0.5f; - } else if (obj->unk7C.word < 16) { - temp_s1_2->segment.trans.scale = 4.0f - ((obj->unk7C.word - 8) * 0.25f); + if (obj->properties.projectile.unk4 < 8) { + temp_s1_2->segment.trans.scale = obj->properties.projectile.unk4 * 0.5f; + } else if (obj->properties.projectile.unk4 < 16) { + temp_s1_2->segment.trans.scale = 4.0f - ((obj->properties.projectile.unk4 - 8) * 0.25f); } else { - temp_s1_2->segment.trans.scale = (sins_f(obj->unk7C.word << 12) * 0.25f) + 2.0f; + temp_s1_2->segment.trans.scale = (sins_f(obj->properties.projectile.unk4 << 12) * 0.25f) + 2.0f; } } - obj->unk78 -= updateRate; - if (obj->unk78 < 0) { + obj->properties.projectile.timer -= updateRate; + if (obj->properties.projectile.timer < 0) { func_8003FC44(obj->segment.trans.x_position, obj->segment.trans.y_position, obj->segment.trans.z_position, 44, SOUND_EXPLOSION, 1.0f, 1); gParticlePtrList_addObject(obj); return; @@ -4324,12 +4336,7 @@ void rocket_prevent_overshoot(Object *obj, UNUSED s32 updateRate, Object_Weapon rocket->forwardVel = -25.0f; angle = (arctan2_f(diffX, diffZ) - 0x8000) & 0xFFFF; angleDiff = angle - (obj->segment.trans.y_rotation & 0xFFFF); - if (angleDiff > 0x8000) { - angleDiff -= 0xFFFF; - } - if (angleDiff < -0x8000) { - angleDiff += 0xFFFF; - } + WRAP(angleDiff, -0x8000, 0x8000); if (angleDiff > 0x6000 || angleDiff < -0x6000) { obj->interactObj->obj = (Object *) interactedObj; obj->interactObj->distance = 1; @@ -4448,18 +4455,18 @@ void play_rocket_trailing_sound(Object *obj, struct Object_Weapon *weapon, u16 s } } if (shouldPlaySound) { - if (weapon->unk1C == 0) { + if (weapon->soundMask == 0) { if (D_8011D4DC < 8) { - play_sound_at_position(soundID, obj->segment.trans.x_position, obj->segment.trans.y_position, obj->segment.trans.z_position, 1, &weapon->unk1C); + play_sound_at_position(soundID, obj->segment.trans.x_position, obj->segment.trans.y_position, obj->segment.trans.z_position, 1, &weapon->soundMask); D_8011D4DC += 1; } } else { - update_spatial_audio_position(weapon->unk1C, obj->segment.trans.x_position, obj->segment.trans.y_position, obj->segment.trans.z_position); + update_spatial_audio_position(weapon->soundMask, obj->segment.trans.x_position, obj->segment.trans.y_position, obj->segment.trans.z_position); } } else { - if (weapon->unk1C != 0) { - func_800096F8(weapon->unk1C); - weapon->unk1C = 0; + if (weapon->soundMask) { + func_800096F8(weapon->soundMask); + weapon->soundMask = NULL; D_8011D4DC -= 1; } } @@ -4479,7 +4486,7 @@ void func_8003FC44(f32 x, f32 y, f32 z, s32 objectID, s32 soundID, f32 scale, s3 spawnObj.unk9 = arg6; newObj = spawn_object(&spawnObj, 1); if (newObj != NULL) { - newObj->segment.unk3C_a.level_entry = NULL; + newObj->segment.level_entry = NULL; newObj->segment.x_velocity = 0.0f; newObj->segment.y_velocity = 0.0f; newObj->segment.z_velocity = 0.0f; @@ -4501,15 +4508,15 @@ void obj_init_audio(Object *obj, LevelObjectEntry_Audio *entry) { obj64->unk4 = entry->unkC; obj64->unk5 = entry->unkD; obj64->unkD = entry->unk10; - obj64->unk8 = 0; + obj64->soundMask = NULL; if (ALBankFile_80115D14_GetSoundDecayTime(obj64->soundId)) { func_8000974C(obj64->soundId, entry->common.x, entry->common.y, entry->common.z, 9, obj64->unk5, obj64->unk4, obj64->unk2, obj64->unkC, - obj64->unk6, obj64->unkD, (s32 *) &obj64->unk8); + obj64->unk6, obj64->unkD, (s32 *) &obj64->soundMask); } else { func_8000974C(obj64->soundId, entry->common.x, entry->common.y, entry->common.z, 10, obj64->unk5, obj64->unk4, obj64->unk2, obj64->unkC, - obj64->unk6, obj64->unkD, (s32 *) &obj64->unk8); + obj64->unk6, obj64->unkD, (s32 *) &obj64->soundMask); } gParticlePtrList_addObject(obj); } @@ -4520,7 +4527,7 @@ void obj_init_audioline(Object *obj, LevelObjectEntry_AudioLine *entry) { obj64 = &obj->unk64->audio_line; obj64->unk0 = entry->unk8; - obj64->unk2 = entry->unkA; + obj64->soundID = entry->soundID; obj64->unkC = entry->unkC; obj64->unkD = entry->unkD; obj64->unk_union.unk8_word = 0; @@ -4530,7 +4537,7 @@ void obj_init_audioline(Object *obj, LevelObjectEntry_AudioLine *entry) { obj64->unkE = entry->unk9; obj64->unkF = entry->unk10; obj64->unk12 = entry->unk13; - func_800098A4(obj64->unk0, obj64->unk2, entry->common.x, entry->common.y, entry->common.z, + func_800098A4(obj64->unk0, obj64->soundID, entry->common.x, entry->common.y, entry->common.z, obj64->unkF, obj64->unkE, obj64->unk10, obj64->unk12, obj64->unk4, obj64->unk11, obj64->unkC, obj64->unkD); gParticlePtrList_addObject(obj); @@ -4583,7 +4590,7 @@ void obj_init_rgbalight(Object *obj, LevelObjectEntry_RgbaLight *entry, UNUSED s * Sets hitbox data from spawn info. */ void obj_init_buoy_pirateship(Object *obj, UNUSED LevelObjectEntry_Buoy_PirateShip *entry, UNUSED s32 arg2) { - obj->unk64 = func_800BE654(obj->segment.unk2C.half.lower, obj->segment.trans.x_position, obj->segment.trans.z_position); + obj->unk64 = func_800BE654(obj->segment.object.segmentID, obj->segment.trans.x_position, obj->segment.trans.z_position); obj->interactObj->flags = INTERACT_FLAGS_SOLID; obj->interactObj->unk11 = 0; obj->interactObj->hitboxRadius = 30; @@ -4608,7 +4615,7 @@ void obj_loop_buoy_pirateship(Object *obj, s32 updateRate) { */ void obj_init_log(Object *obj, LevelObjectEntry_Log *entry, UNUSED s32 arg2) { f32 radius; - obj->unk64 = func_800BE654(obj->segment.unk2C.half.lower, obj->segment.trans.x_position, obj->segment.trans.z_position); + obj->unk64 = func_800BE654(obj->segment.object.segmentID, obj->segment.trans.x_position, obj->segment.trans.z_position); obj->interactObj->flags = INTERACT_FLAGS_SOLID; obj->interactObj->unk11 = 2; obj->interactObj->hitboxRadius = 30; @@ -4618,8 +4625,8 @@ void obj_init_log(Object *obj, LevelObjectEntry_Log *entry, UNUSED s32 arg2) { } radius /= 64; obj->segment.trans.scale = obj->segment.header->scale * radius; - obj->segment.unk38.byte.unk3A = entry->unk8; - obj->segment.trans.y_rotation = entry->angleY << 6 << 4; + obj->segment.object.numModelIDs = entry->numModelIDs; + obj->segment.trans.y_rotation = U8_ANGLE_TO_U16(entry->angleY); } /** @@ -4639,10 +4646,10 @@ void obj_loop_log(Object *obj, s32 updateRate) { if (log != NULL) { obj->segment.trans.y_position = func_800BEEB4((Object_64 *) log); } else { - obj->segment.trans.y_position = ((LevelObjectEntryCommon *) obj->segment.unk3C_a.level_entry)->y; + obj->segment.trans.y_position = ((LevelObjectEntryCommon *) obj->segment.level_entry)->y; } if (obj->unk5C->unk100 != NULL) { - obj->unk7C.word++; + obj->properties.log.velocityY++; racerObj = (Object *) obj->unk5C->unk100; if (racerObj->behaviorId == BHV_RACER) { racer = (Object_Racer *) racerObj->unk64; @@ -4659,33 +4666,33 @@ void obj_loop_log(Object *obj, s32 updateRate) { diffX = (diffX * cosine) + (diffZ * sine); diffZ = (racerObj->segment.x_velocity * sine) - (racerObj->segment.z_velocity * cosine); diffX *= diffZ; - obj->unk78 -= (s32) (diffX / 4); + obj->properties.log.angleVel -= (s32) (diffX / 4); - if (obj->unk78 > 0x200) { - obj->unk78 = 0x200; + if (obj->properties.log.angleVel > 0x200) { + obj->properties.log.angleVel = 0x200; } - if (obj->unk78 < -0x200) { - obj->unk78 = -0x200; + if (obj->properties.log.angleVel < -0x200) { + obj->properties.log.angleVel = -0x200; } } else { - if (obj->unk7C.word > 0) { - obj->unk7C.word--; + if (obj->properties.log.velocityY > 0) { + obj->properties.log.velocityY--; } } - obj->segment.trans.y_position -= (f32) obj->unk7C.word * 1.0; - if (obj->unk78 > 0) { - obj->unk78 -= updateRate; - if (obj->unk78 < 0) { - obj->unk78 = 0; + obj->segment.trans.y_position -= (f32) obj->properties.log.velocityY * 1.0; + if (obj->properties.log.angleVel > 0) { + obj->properties.log.angleVel -= updateRate; + if (obj->properties.log.angleVel < 0) { + obj->properties.log.angleVel = 0; } } - if (obj->unk78 < 0) { - obj->unk78 += updateRate; - if (obj->unk78 > 0) { - obj->unk78 = 0; + if (obj->properties.log.angleVel < 0) { + obj->properties.log.angleVel += updateRate; + if (obj->properties.log.angleVel > 0) { + obj->properties.log.angleVel = 0; } } - obj->segment.trans.y_rotation += obj->unk78 * updateRate; + obj->segment.trans.y_rotation += obj->properties.log.angleVel * updateRate; obj->unk5C->unk100 = NULL; } @@ -4693,7 +4700,7 @@ void obj_loop_log(Object *obj, s32 updateRate) { void obj_init_weather(Object *obj, LevelObjectEntry_Weather *entry) { f32 radius = entry->radius; radius *= radius; - obj->unk78f = radius; + obj->properties.distance.radius = radius; } /** @@ -4718,21 +4725,21 @@ void obj_loop_weather(Object *obj, UNUSED s32 updateRate) { objects = get_racer_objects(&numberOfObjects); cur = -1; if (numberOfObjects != 0) { - last = numberOfObjects - 1; - do { - curObj = objects[cur + 1]; - curObj64 = (Object_Racer *) curObj->unk64; - } while (++cur < last && currViewport != curObj64->playerIndex); - - diffX = obj->segment.trans.x_position - curObj->segment.trans.x_position; - diffZ = obj->segment.trans.z_position - curObj->segment.trans.z_position; - dist = obj->unk78f; - entry = (LevelObjectEntry_Weather *)obj->segment.unk3C_a.level_entry; - if ((diffX * diffX) + (diffZ * diffZ) <= dist){ - if (((!obj->segment.unk3C_a.level_entry) && (!obj->segment.unk3C_a.level_entry)) && (!obj->segment.unk3C_a.level_entry)){} // Fakematch - changeWeather(entry->unkA * 256, entry->unkC * 256, entry->unkE * 256, entry->unk10 * 257, entry->unk11 * 257, entry->unk12); + last = numberOfObjects - 1; + do { + curObj = objects[cur + 1]; + curObj64 = (Object_Racer *) curObj->unk64; + } while (++cur < last && currViewport != curObj64->playerIndex); + + diffX = obj->segment.trans.x_position - curObj->segment.trans.x_position; + diffZ = obj->segment.trans.z_position - curObj->segment.trans.z_position; + dist = obj->properties.distance.radius; + entry = (LevelObjectEntry_Weather *)obj->segment.level_entry; + if ((diffX * diffX) + (diffZ * diffZ) <= dist){ + if (((!obj->segment.level_entry) && (!obj->segment.level_entry)) && (!obj->segment.level_entry)){} // Fakematch + changeWeather(entry->unkA * 256, entry->unkC * 256, entry->unkE * 256, entry->unk10 * 257, entry->unk11 * 257, entry->unk12); + } } - } } void obj_init_lensflare(Object *obj, UNUSED LevelObjectEntry_LensFlare *entry) { @@ -4873,11 +4880,11 @@ void obj_init_midichset(Object *obj, LevelObjectEntry_Midichset *entry) { /* Official name: bubblerInit */ void obj_init_bubbler(Object *obj, LevelObjectEntry_Bubbler *entry) { func_800AF134((Particle *) obj->unk6C, entry->unk9, entry->unk8, 0, 0, 0); - obj->unk78 = entry->unkA; + obj->properties.common.unk0 = entry->unkA; } void obj_loop_bubbler(Object *obj, s32 updateRate) { - if (obj->unk78 >= get_random_number_from_range(0, 1024)) { + if (obj->properties.common.unk0 >= get_random_number_from_range(0, 1024)) { obj->unk74 = 1; } else { obj->unk74 = 0; @@ -4889,7 +4896,7 @@ void obj_loop_bubbler(Object *obj, s32 updateRate) { void obj_init_boost(Object *obj, LevelObjectEntry_Boost *entry) { obj->unk64 = (Object_64 *) ((s32) get_misc_asset(MISC_ASSET_UNK14) + (entry->unk8[0] << 7)); - obj->segment.unk3C_a.level_entry = NULL; + obj->segment.level_entry = NULL; } void obj_init_unknown94(UNUSED Object *obj, UNUSED LevelObjectEntry_Unknown94 *entry, UNUSED s32 arg2) { @@ -4907,7 +4914,7 @@ void obj_loop_rangetrigger(Object *obj, s32 updateRate) { LevelObjectEntry_RangeTrigger *level_entry; unk80042178 sp20; - level_entry = &obj->segment.unk3C_a.level_entry->rangeTrigger; + level_entry = &obj->segment.level_entry->rangeTrigger; if (func_80016DE8(obj->segment.trans.x_position, 0, obj->segment.trans.z_position, (f32)level_entry->unk8, 1, &sp20) > 0) { obj->unk74 = level_entry->unkA; } else { @@ -4933,7 +4940,7 @@ void obj_init_frog(Object *obj, LevelObjectEntry_Frog *entry) { obj64->scaleY = 1.0f; if (obj64->drumstick) { - obj->segment.unk38.byte.unk3A = TRUE; + obj->segment.object.numModelIDs = TRUE; /** * Don't spawn the chicken frog if drumstick is already unlocked, or * if the player hasn't completed the trophy races yet. @@ -4942,7 +4949,7 @@ void obj_init_frog(Object *obj, LevelObjectEntry_Frog *entry) { gParticlePtrList_addObject(obj); } } else { - obj->segment.unk38.byte.unk3A = FALSE; + obj->segment.object.numModelIDs = FALSE; } } @@ -5059,7 +5066,7 @@ void obj_loop_frog(Object *obj, s32 updateRate) { obj->segment.z_velocity = frog->hopTargetZ * cosine; ignore_bounds_check(); move_object(obj, obj->segment.x_velocity, 0.0f, obj->segment.z_velocity); - if (func_8002BAB0(obj->segment.unk2C.half.lower, obj->segment.trans.x_position, obj->segment.trans.z_position, &sp6C) != 0) { + if (func_8002BAB0(obj->segment.object.segmentID, obj->segment.trans.x_position, obj->segment.trans.z_position, &sp6C) != 0) { obj->segment.trans.y_position = 0.0f; ignore_bounds_check(); move_object(obj, 0.0f, sp6C, 0.0f); @@ -5116,7 +5123,7 @@ void obj_loop_pigrocketeer(Object *obj, s32 updateRate) { if (someObj != NULL) { obj64 = &someObj->unk64->wizpig2; - someObj->action = 0; + someObj->properties.common.unk0 = 0; if (obj64 != 0) { obj64->unk72 += updateRate; obj64->unk70 = 2; @@ -5131,12 +5138,10 @@ void obj_loop_pigrocketeer(Object *obj, s32 updateRate) { * Sets level name and radius based off spawn info. */ void obj_init_levelname(Object *obj, LevelObjectEntry_LevelName *entry) { - Object_LevelName_78 *temp_s0; - temp_s0 = (Object_LevelName_78 *) &obj->unk78; - temp_s0->radius = entry->unk9 * 8.0f; - temp_s0->radius *= temp_s0->radius; - temp_s0->levelID = entry->unk8; - temp_s0->opacity = 0; + obj->properties.levelName.radius = entry->radius * 8.0f; + obj->properties.levelName.radius *= obj->properties.levelName.radius; + obj->properties.levelName.levelID = entry->levelID; + obj->properties.levelName.opacity = 0; if (is_in_tracks_mode()) { gParticlePtrList_addObject(obj); } @@ -5158,26 +5163,26 @@ void obj_loop_levelname(Object *obj, s32 updateRate) { Object *racerObj; f32 diffX; f32 diffZ; - Object_LevelName_78 *temp_s0; + ObjPropertyName *properties; racerObj = get_racer_object_by_port(PLAYER_ONE); if (racerObj != NULL) { diffX = obj->segment.trans.x_position - racerObj->segment.trans.x_position; diffZ = obj->segment.trans.z_position - racerObj->segment.trans.z_position; - temp_s0 = (Object_LevelName_78 *) &obj->unk78; - if ((diffX * diffX) + (diffZ * diffZ) < temp_s0->radius) { - temp_s0->opacity += updateRate * 16; - if (temp_s0->opacity > 256) { - temp_s0->opacity = 256; + properties = &obj->properties.levelName; + if ((diffX * diffX) + (diffZ * diffZ) < properties->radius) { + properties->opacity += updateRate * 16; + if (properties->opacity > 256) { + properties->opacity = 256; } } else { - temp_s0->opacity -= updateRate * 16; - if (temp_s0->opacity < 0) { - temp_s0->opacity = 0; + properties->opacity -= updateRate * 16; + if (properties->opacity < 0) { + properties->opacity = 0; } } - if (temp_s0->opacity > 0) { - levelName = get_level_name(temp_s0->levelID); + if (properties->opacity > 0) { + levelName = get_level_name(properties->levelID); textWidth = (get_text_width(levelName, 0, 0) + 24) >> 1; x1 = SCREEN_WIDTH_HALF - textWidth; x2 = textWidth + SCREEN_WIDTH_HALF; @@ -5190,10 +5195,10 @@ void obj_loop_levelname(Object *obj, s32 updateRate) { } assign_dialogue_box_id(4); set_current_dialogue_box_coords(4, x1, y1, x2, y2); - set_current_dialogue_background_colour(4, 128, 64, 128, (temp_s0->opacity * SCREEN_WIDTH_HALF) >> 8); + set_current_dialogue_background_colour(4, 128, 64, 128, (properties->opacity * SCREEN_WIDTH_HALF) >> 8); set_current_text_background_colour(4, 0, 0, 0, 0); set_dialogue_font(4, FONT_COLOURFUL); - set_current_text_colour(4, 255, 255, 255, 0, (temp_s0->opacity * 255) >> 8); + set_current_text_colour(4, 255, 255, 255, 0, (properties->opacity * 255) >> 8); render_dialogue_text(4, (x2 - x1) >> 1, ((y2 - y1) >> 1) + 2, levelName, 1, 12); open_dialogue_box(4); } diff --git a/src/object_functions.h b/src/object_functions.h index fdf8b3b2..339b1c46 100644 --- a/src/object_functions.h +++ b/src/object_functions.h @@ -11,6 +11,7 @@ #define TIME_JIFFIES_PER_SECOND 60 #define TIME_SECONDS(sec) sec * TIME_JIFFIES_PER_SECOND +#define U8_ANGLE_TO_U16(x) (x << 6 << 4) enum BossRaceWarps { WARP_STANDARD = -1, @@ -33,7 +34,8 @@ enum TajBehaviours { TAJ_MODE_SET_CHALLENGE = 15, TAJ_MODE_TELEPORT_AWAY_BEGIN = 20, TAJ_MODE_TELEPORT_AWAY_END, - TAJ_MODE_RACE = 30 + TAJ_MODE_RACE = 30, + TAJ_MODE_UNK1F }; enum TTBehaviours { @@ -67,12 +69,6 @@ enum FrogActions { FROG_UNSQUISH }; -typedef struct Object78_80033DD0 { - s32 *unk0; - s16 unk4; - s16 unk6; -} Object78_80033DD0; - typedef struct unk80034B4C { u8 pad0[0x18]; s16 unk18; @@ -243,18 +239,6 @@ typedef struct unk80041A90_MidiFade { f32 unk14; } unk80041A90_MidiFade; -typedef struct Object_78_Banana { - s32 unk0; - s16 unk4; - s16 unk6; -} Object_78_Banana; - -typedef struct Object_LevelName_78 { - f32 radius; - s16 levelID; - s16 opacity; -} Object_LevelName_78; - // Unsure about the signed/unsigned with these arrays. extern u16 D_800DC9A8[20]; extern u16 D_800DC9D0[64]; diff --git a/src/object_models.c b/src/object_models.c index 9ede2bdc..6d55384f 100644 --- a/src/object_models.c +++ b/src/object_models.c @@ -176,24 +176,24 @@ void func_80061C0C(Object *obj) { Object_68 *temp_a1; s32 var_v1; - if (obj->segment.unk38.byte.unk3A < 0) { - obj->segment.unk38.byte.unk3A = 0; + if (obj->segment.object.numModelIDs < 0) { + obj->segment.object.numModelIDs = 0; } var_v1 = obj->segment.header->numberOfModelIds - 1; - if (var_v1 < obj->segment.unk38.byte.unk3A) { - obj->segment.unk38.byte.unk3A = var_v1; + if (var_v1 < obj->segment.object.numModelIDs) { + obj->segment.object.numModelIDs = var_v1; } - temp_a1 = obj->unk68[obj->segment.unk38.byte.unk3A]; + temp_a1 = obj->unk68[obj->segment.object.numModelIDs]; mdl = temp_a1->objModel; if (temp_a1->objModel->animations != NULL) { - if (obj->segment.unk38.byte.unk3B < 0) { - obj->segment.unk38.byte.unk3B = 0; + if (obj->segment.object.animationID < 0) { + obj->segment.object.animationID = 0; } - if (obj->segment.unk38.byte.unk3B >= mdl->numberOfAnimations) { - obj->segment.unk38.byte.unk3B = mdl->numberOfAnimations - 1; + if (obj->segment.object.animationID >= mdl->numberOfAnimations) { + obj->segment.object.animationID = mdl->numberOfAnimations - 1; } if (mdl->numberOfAnimations > 0) { - var_v1 = mdl->animations[obj->segment.unk38.byte.unk3B].unk4 - 2; + var_v1 = mdl->animations[obj->segment.object.animationID].unk4 - 2; } else { var_v1 = 0; } diff --git a/src/objects.c b/src/objects.c index ccf09562..f911e589 100644 --- a/src/objects.c +++ b/src/objects.c @@ -692,7 +692,7 @@ void func_8000E2B4(void) { if (get_filtered_cheats() & CHEAT_SMALL_CHARACTERS) { player->segment.trans.scale *= 0.714f; } - player->segment.unk3C_a.level_entry = NULL; + player->segment.level_entry = NULL; player->segment.trans.y_rotation = D_8011AD4C; player->segment.trans.y_position = D_8011AD48; } @@ -741,10 +741,10 @@ void func_8000E4E8(s32 index) { s32 func_8000E558(Object *arg0){ s32 temp_v0; s32 new_var, new_var2; - if (arg0->segment.unk3C_a.level_entry == NULL) { + if (arg0->segment.level_entry == NULL) { return TRUE; } - temp_v0 = (s32) arg0->segment.unk3C_a.level_entry; + temp_v0 = (s32) arg0->segment.level_entry; new_var2 = (s32) D_8011AE98[0]; if ((temp_v0 >= new_var2) && (((D_8011AEA0[0] * 8) + new_var2) >= temp_v0)) { return FALSE; @@ -788,7 +788,7 @@ UNUSED s32 func_8000E9C0(void) { void func_8000E9D0(Object *arg0) { arg0->segment.trans.flags |= OBJ_FLAGS_DEACTIVATED; - func_800245B4(arg0->segment.unk2C.half.upper | 0xC000); + func_800245B4(arg0->segment.object.unk2C | 0xC000); gObjPtrList[objCount++] = arg0; if (1) {} // Fakematch D_8011AE64++; @@ -1125,7 +1125,7 @@ void func_80011134(Object *arg0, s32 arg1) { s32 var_s1; u8 temp_v0; - temp_s3 = arg0->unk68[arg0->segment.unk38.byte.unk3A]->objModel; + temp_s3 = arg0->unk68[arg0->segment.object.numModelIDs]->objModel; temp_s5 = temp_s3->unk50; temp_s4 = temp_s3->batches; for (var_s1 = 0; temp_s5 > 0 && var_s1 < temp_s3->numberOfBatches; var_s1++) { @@ -1303,20 +1303,20 @@ s32 move_object(Object *obj, f32 xPos, f32 yPos, f32 zPos) { gNoBoundsCheck = FALSE; if (outOfBounds) { - obj->segment.unk2C.half.lower = -1; + obj->segment.object.segmentID = -1; return 1; } obj->segment.trans.x_position = newXPos; obj->segment.trans.y_position = newYPos; obj->segment.trans.z_position = newZPos; - box = get_segment_bounding_box(obj->segment.unk2C.half.lower); + box = get_segment_bounding_box(obj->segment.object.segmentID); //For some reason the XYZ positions are converted into integers for the next section intXPos = newXPos, intYPos = newYPos, intZPos = newZPos; if (box == NULL) { - obj->segment.unk2C.half.lower = get_level_segment_index_from_position(intXPos, intYPos, intZPos); + obj->segment.object.segmentID = get_level_segment_index_from_position(intXPos, intYPos, intZPos); return 0; } else { outsideBBox = FALSE; @@ -1332,7 +1332,7 @@ s32 move_object(Object *obj, f32 xPos, f32 yPos, f32 zPos) { if (outsideBBox) { segmentID = get_level_segment_index_from_position(intXPos, intYPos, intZPos); if (segmentID != -1) { - obj->segment.unk2C.half.lower = segmentID; + obj->segment.object.segmentID = segmentID; } } } @@ -1359,7 +1359,7 @@ void func_80011AD0(Object *this) { switch (this->behaviorId) { case BHV_CHARACTER_FLAG: - if (this->unk7C.word >= 0) { + if (this->properties.characterFlag.characterID >= 0) { obj64 = this->unk64; func_80011960(this, obj64->character_flag.vertices, 4, obj64->character_flag.triangles, 2, obj64->character_flag.texture, 11, 0, 1.0f); @@ -1372,13 +1372,13 @@ void func_80011AD0(Object *this) { case BHV_FISH: obj64 = this->unk64; - tmp_f0 = this->segment.unk3C_a.level_entry->fish.unkC[1]; + tmp_f0 = this->segment.level_entry->fish.unkC[1]; tmp_f0 *= 0.01f; func_80011960(this, &obj64->fish.vertices[obj64->fish.unkFC * 6], 6, obj64->fish.triangles, 8, obj64->fish.texture, 26, 0, tmp_f0); break; case BHV_BOOST: - if ((this->unk78 != 0) && ((this->unk64->boost.unk70 > 0) || (this->unk64->boost.unk74 > 0.0f))) { + if ((this->properties.common.unk0 != 0) && ((this->unk64->boost.unk70 > 0) || (this->unk64->boost.unk74 > 0.0f))) { func_800135B8(this); } break; @@ -1412,14 +1412,14 @@ void render_3d_billboard(Object *obj) { if (obj->behaviorId == BHV_BOMB_EXPLOSION) { //!@bug Never true, because the type is u8. - if (obj->segment.unk38.byte.unk39 > 255) { - obj->segment.unk38.byte.unk39 = obj->unk7C.word & 0xFF; + if (obj->segment.object.opacity > 255) { + obj->segment.object.opacity = obj->properties.bombExplosion.unk4 & 0xFF; } else { - obj->segment.unk38.byte.unk39 = (obj->segment.unk38.byte.unk39 * (obj->unk7C.word & 0xFF)) >> 8; + obj->segment.object.opacity = (obj->segment.object.opacity * (obj->properties.bombExplosion.unk4 & 0xFF)) >> 8; } } - alpha = obj->segment.unk38.byte.unk39; + alpha = obj->segment.object.opacity; if (alpha > 255) { alpha = 255; } @@ -1452,11 +1452,11 @@ void render_3d_billboard(Object *obj) { } else { gDPSetEnvColor(gObjectCurrDisplayList++, 255, 255, 255, 0); } - sp58 = (unk80068514_arg4 *) obj->unk68[obj->segment.unk38.byte.unk3A]; + sp58 = (unk80068514_arg4 *) obj->unk68[obj->segment.object.numModelIDs]; var_a0 = NULL; if (obj->behaviorId == BHV_FIREBALL_OCTOWEAPON_2) { - var_a0 = (Object *) obj->trans78; - if (obj->unk7C.word > 0) { + var_a0 = obj->properties.fireball.obj; + if (obj->properties.fireball.timer > 0) { var_a0 = obj; } } @@ -1518,7 +1518,7 @@ void render_3d_model(Object *obj) { ObjectModel *objModel; Object_68 *something; - obj68 = obj->unk68[obj->segment.unk38.byte.unk3A]; + obj68 = obj->unk68[obj->segment.object.numModelIDs]; if (obj68 != NULL) { objModel = obj68->objModel; hasOpacity = FALSE; @@ -1575,14 +1575,14 @@ void render_3d_model(Object *obj) { spB0 = FALSE; if (racerObj != NULL) { object_undo_player_tumble(obj); - if (obj->segment.unk38.byte.unk3B == 0 || racerObj->vehicleID >= VEHICLE_TRICKY) { + if (obj->segment.object.animationID == 0 || racerObj->vehicleID >= VEHICLE_TRICKY) { func_80069790(&gObjectCurrDisplayList, &gObjectCurrMatrix, obj68, racerObj->headAngle); spB0 = TRUE; } else { racerObj->headAngle = 0; } } - alpha = obj->segment.unk38.byte.unk39; + alpha = obj->segment.object.opacity; if (alpha > 255) { alpha = 255; } @@ -1629,7 +1629,7 @@ void render_3d_model(Object *obj) { if (!(loopObj->segment.trans.flags & OBJ_FLAGS_INVISIBLE)) { index = obj->unk60->unk2C[i]; if (index >= 0 && index < objModel->unk18) { - something = loopObj->unk68[loopObj->segment.unk38.byte.unk3A]; + something = loopObj->unk68[loopObj->segment.object.numModelIDs]; vtxX = obj->unk44[objModel->unk14[index]].x; vtxY = obj->unk44[objModel->unk14[index]].y; vtxZ = obj->unk44[objModel->unk14[index]].z; @@ -1659,7 +1659,7 @@ void render_3d_model(Object *obj) { gDPSetEnvColor(gObjectCurrDisplayList++, 255, 255, 255, 0); gDPSetPrimColor(gObjectCurrDisplayList++, 0, 0, intensity, intensity, intensity, alpha); } - loopObj->unk78 = render_sprite_billboard(&gObjectCurrDisplayList, &gObjectCurrMatrix, &gObjectCurrVertexList, loopObj, (unk80068514_arg4 *) something, flags); + loopObj->properties.common.unk0 = render_sprite_billboard(&gObjectCurrDisplayList, &gObjectCurrMatrix, &gObjectCurrVertexList, loopObj, (unk80068514_arg4 *) something, flags); if (var_v0_2) { gDkrInsertMatrix(gObjectCurrDisplayList++, 0, 0); func_80012CE8(&gObjectCurrDisplayList); @@ -1679,7 +1679,7 @@ void render_3d_model(Object *obj) { index = obj->segment.header->unk58; if (index >= 0 && index < objModel->unk18) { flags = (RENDER_Z_COMPARE | RENDER_FOG_ACTIVE | RENDER_Z_UPDATE); - something = loopObj->unk68[loopObj->segment.unk38.byte.unk3A]; + something = loopObj->unk68[loopObj->segment.object.numModelIDs]; vtxX = obj->unk44[objModel->unk14[index]].x; vtxY = obj->unk44[objModel->unk14[index]].y; vtxZ = obj->unk44[objModel->unk14[index]].z; @@ -1860,9 +1860,9 @@ void func_80012F94(Object *obj) { if (get_current_viewport() != objRacer->playerIndex) { var_a1 += 5; } - var_f0_2 = obj->segment.unk30; + var_f0_2 = obj->segment.object.distanceToCamera; temp_v1 = (s32) var_f0_2 >> 3; - if (obj->segment.unk30 < 0.0f) { + if (obj->segment.object.distanceToCamera < 0.0f) { var_f0_2 = 0.0f; } else if (var_f0_2 > 3500.0f) { var_f0_2 = 3500.0f; @@ -1914,14 +1914,14 @@ void func_80012F94(Object *obj) { if (numberOfModels < var_t0) { var_t0 = numberOfModels; } - obj->segment.unk38.byte.unk3A = var_t0; + obj->segment.object.numModelIDs = var_t0; if ((obj->unk54 != NULL) && (obj->unk54->unk0 < 0.6f)) { objRacer->lightFlags |= RACER_LIGHT_NIGHT; } else { objRacer->lightFlags &= ~RACER_LIGHT_NIGHT; } racerLightTimer = objRacer->lightFlags & RACER_LIGHT_TIMER; - new_var = obj->unk68[obj->segment.unk38.byte.unk3A]; + new_var = obj->unk68[obj->segment.object.numModelIDs]; temp_a1_3 = new_var->objModel; if (racerLightTimer != 0) { racerLightTimer--; @@ -2751,7 +2751,7 @@ void func_8001BC54(void) { for (i = 0; i < gCameraObjCount - 1; i++) { objPtr = (*gCameraObjList)[i+1]; temp = (*gCameraObjList)[i]; - if (temp->unk78 > objPtr->unk78) { + if (temp->properties.common.unk0 > objPtr->properties.common.unk0) { (*gCameraObjList)[i] = (*gCameraObjList)[i+1]; (*gCameraObjList)[i+1] = temp; continueLoop = FALSE; @@ -2868,7 +2868,7 @@ s32 func_8001C524(f32 diffX, f32 diffY, f32 diffZ, s32 someFlag) { for (numSteps = 0; numSteps != 128; numSteps++) { segment = (ObjectSegment*) (*D_8011AF04)[numSteps]; if (segment) { - levelObj = &((segment->unk3C_a.level_entry)->ttDoor); + levelObj = &((segment->level_entry)->ttDoor); var_a0 = 1; if (someFlag && (sp64 != levelObj->doorID)) { var_a0 = 0; @@ -3047,7 +3047,7 @@ void func_8001E36C(s32 arg0, f32 *arg1, f32 *arg2, f32 *arg3) { if (current_obj != NULL && !(current_obj->segment.trans.flags & OBJ_FLAGS_DEACTIVATED) && current_obj->behaviorId == BHV_RAMP_SWITCH - && current_obj->action == arg0) { + && current_obj->properties.common.unk0 == arg0) { *arg1 = current_obj->segment.trans.x_position; *arg2 = current_obj->segment.trans.y_position; *arg3 = current_obj->segment.trans.z_position; @@ -3107,7 +3107,7 @@ s32 func_8001F3EC(s32 arg0){ count = 0; for (i = 0; i < D_8011AE78; i++) { - if (D_8011AE74[i]->unk7C.word == arg0){ + if (D_8011AE74[i]->properties.common.unk4 == arg0){ count++; } } @@ -3137,7 +3137,7 @@ void func_80021400(s32 arg0) { arg0 &= 0xFF; //? - for (i = 0; i < D_8011AE78 && (arg0 != (D_8011AE74[i]->unk7C.word & 0xFF)); i++) {} + for (i = 0; i < D_8011AE78 && (arg0 != (D_8011AE74[i]->properties.common.unk4 & 0xFF)); i++) {} if (i < D_8011AE78) { if (D_8011AE74[i]->unk64 != NULL) { @@ -3175,11 +3175,11 @@ s8 func_800214E4(Object *obj, s32 updateRate) { i = 0; if (D_8011AE78 > 0) { temp_v1 = animObj->unk28; - if (temp_v1 != (s32) (*D_8011AE74)->unk7C.word) { + if (temp_v1 != (s32) (*D_8011AE74)->properties.common.unk4) { loop_11: i++; if (i < D_8011AE78) { - if (temp_v1 != (s32) D_8011AE74[i]->unk7C.word) { + if (temp_v1 != (s32) D_8011AE74[i]->properties.common.unk4) { goto loop_11; } } diff --git a/src/particles.c b/src/particles.c index 2311399a..e2ae9873 100644 --- a/src/particles.c +++ b/src/particles.c @@ -541,7 +541,7 @@ void func_800AF52C(Object *obj, s32 arg1) { if (temp_v0->unk6 > 0) { // Useless if statement, since the loop already does this. for (i = 0; i < temp_v0->unk6; i++){ temp = temp_v0->unkC_60[i]; - temp->unk38.half.unk3A = 0; + temp->segment.unk38.half.unk3A = 0; } } if (temp_v1->flags & 1) { @@ -609,7 +609,7 @@ void func_800AFE5C(unk800B1CB8 *arg0, Particle *arg1) { if (temp_s0 != NULL) { func_8000E9D0((Object *) temp_s0); temp_s0->unk74 = arg1->unk6; - temp_s0->unk40 |= 0x2000; + temp_s0->segment.unk40 |= 0x2000; arg1->unkC_60[arg1->unk6] = temp_s0; arg1->unk6++; } @@ -629,33 +629,33 @@ void func_800AFE5C(unk800B1CB8 *arg0, Particle *arg1) { } } -void func_800B0010(Object *arg0, Object *arg1, unk800B03C0_arg2 *arg2, Object *arg3) { +void func_800B0010(Particle2 *arg0, Particle2 *arg1, unk800B03C0_arg2 *arg2, ParticleBehavior *arg3) { s32 sp3C; Vec3f sp30; Vec3s sp28; - if (arg3->segment.trans_unk.unk0 & 0x70) { - arg0->segment.x_velocity = arg3->segment.unk30; - arg0->segment.y_velocity = arg3->segment.unk34_a.unk34; - arg0->segment.z_velocity = arg3->segment.unk38.unk38_f32; + if (arg3->flags & 0x70) { + arg0->segment.x_velocity = arg3->unk30; + arg0->segment.y_velocity = arg3->unk34; + arg0->segment.z_velocity = arg3->unk38; } else { arg0->segment.x_velocity = 0.0f; arg0->segment.y_velocity = 0.0f; arg0->segment.z_velocity = 0.0f; } - sp3C = arg3->unk5C_s32 & 0x700; + sp3C = arg3->unk5C & 0x700; if (sp3C) { if (sp3C & 0x100) { - arg0->segment.x_velocity += (f32) get_random_number_from_range(-arg3->unk74_signed, arg3->unk74_signed) * 0.00001525878906; + arg0->segment.x_velocity += (f32) get_random_number_from_range(-arg3->unk74, arg3->unk74) * 0.00001525878906; } if (sp3C & 0x200) { arg0->segment.y_velocity += (f32) get_random_number_from_range(-arg3->unk78, arg3->unk78) * 0.00001525878906; } if (sp3C & 0x400) { - arg0->segment.z_velocity += (f32) get_random_number_from_range(-arg3->unk7C.word, arg3->unk7C.word) * 0.00001525878906; + arg0->segment.z_velocity += (f32) get_random_number_from_range(-arg3->unk7C, arg3->unk7C) * 0.00001525878906; } } - switch (arg3->segment.trans_unk.unk0 & 0x70) { + switch (arg3->flags & 0x70) { case 0x10: arg0->segment.x_velocity += arg1->segment.x_velocity; arg0->segment.y_velocity += arg1->segment.y_velocity; @@ -667,22 +667,22 @@ void func_800B0010(Object *arg0, Object *arg1, unk800B03C0_arg2 *arg2, Object *a arg0->segment.z_velocity *= arg1->segment.z_velocity; break; } - if (arg3->segment.trans_unk.unk0 & 4) { + if (arg3->flags & 4) { sp30.x = 0.0f; sp30.y = 0.0f; - sp30.z = -arg3->segment.unk3C_a.unk3C_f; - sp3C = arg3->unk5C_s32; + sp30.z = -arg3->unk3C; + sp3C = arg3->unk5C; if (sp3C & 0x10) { - sp30.z += (f32) get_random_number_from_range(-arg3->unk70_s32, arg3->unk70_s32) * 0.00001525878906; + sp30.z += (f32) get_random_number_from_range(-arg3->unk70, arg3->unk70) * 0.00001525878906; } if (sp3C & 0x60) { sp28.y_rotation = arg2->unk12; if (sp3C & 0x20) { - sp28.y_rotation += get_random_number_from_range((s32) -arg3->unk68_halfs.unk6A, (s32) arg3->unk68_halfs.unk6A); + sp28.y_rotation += get_random_number_from_range(-arg3->unk6A, arg3->unk6A); } sp28.x_rotation = arg2->unk14; if (sp3C & 0x40) { - sp28.x_rotation += get_random_number_from_range((s32) -arg3->unk6C_halfs.unk6C, (s32) arg3->unk6C_halfs.unk6C); + sp28.x_rotation += get_random_number_from_range((s32) -arg3->unk6C, (s32) arg3->unk6C); } f32_vec3_apply_object_rotation3((ObjectTransform* ) &sp28, (f32*) &sp30); } else { @@ -695,7 +695,7 @@ void func_800B0010(Object *arg0, Object *arg1, unk800B03C0_arg2 *arg2, Object *a } } -void func_800B03C0(Object *arg0, ObjectTransform *arg1, unk800B03C0_arg2 *arg2, Object *arg3) { +void func_800B03C0(Particle2 *arg0, ObjectTransform *arg1, unk800B03C0_arg2 *arg2, ParticleBehavior *arg3) { s32 sp3C; Vec3f sp30; Vec3s sp28; @@ -703,26 +703,26 @@ void func_800B03C0(Object *arg0, ObjectTransform *arg1, unk800B03C0_arg2 *arg2, arg0->unk4C_f32 = arg2->unk18; arg0->unk50_f32 = arg2->unk1A; arg0->unk54_f32 = arg2->unk1C; - arg0->unk58_f32 = arg3->unk58_f32; - if (arg3->unk5C_s32 & 0x80000) { - arg0->unk58_f32 += (f32) get_random_number_from_range(-arg3->unk94_signed, arg3->unk94_signed) * 0.00001525878906; // 0.00001525878906 ~= 1.0/65536.0 + arg0->unk58_f32 = arg3->unk58; + if (arg3->unk5C & 0x80000) { + arg0->unk58_f32 += (f32) get_random_number_from_range(-arg3->unk94, arg3->unk94) * 0.00001525878906; // 0.00001525878906 ~= 1.0/65536.0 } - if (arg3->segment.trans_unk.unk0 & 1) { + if (arg3->flags & 1) { sp30.x = 0.0f; sp30.y = 0.0f; - sp30.z = -arg3->segment.trans_unk.y_position; - sp3C = arg3->unk5C_s32; + sp30.z = -arg3->unk10; + sp3C = arg3->unk5C; if (sp3C & 1) { - sp30.z += (f32) get_random_number_from_range(-arg3->unk60_s32, arg3->unk60_s32) * 0.00001525878906; + sp30.z += (f32) get_random_number_from_range(-arg3->unk60, arg3->unk60) * 0.00001525878906; } if (sp3C & 6) { sp28.y_rotation = arg2->y_rotation; if (sp3C & 2) { - sp28.y_rotation += get_random_number_from_range(-arg3->unk64_halfs.unk64, arg3->unk64_halfs.unk64); + sp28.y_rotation += get_random_number_from_range(-arg3->unk64, arg3->unk64); } sp28.x_rotation = arg2->x_rotation; if (sp3C & 4) { - sp28.x_rotation += get_random_number_from_range(-arg3->unk64_halfs.unk66, arg3->unk64_halfs.unk66); + sp28.x_rotation += get_random_number_from_range(-arg3->unk66, arg3->unk66); } f32_vec3_apply_object_rotation3((ObjectTransform* ) &sp28, (f32 *) &sp30); } else { @@ -802,7 +802,7 @@ Particle2 *func_800B0698(unk800B1CB8 *arg0, Particle *arg1) { } else { var_v0->unk0.unk5E = 0; } - func_800B03C0((Object *) var_v0, (ObjectTransform *) arg0, (unk800B03C0_arg2 *) arg1, (Object *)sp20); + func_800B03C0((Particle2 *) var_v0, (ObjectTransform *) arg0, (unk800B03C0_arg2 *) arg1, (ParticleBehavior *)sp20); if (sp20->flags & 0x80) { var_v0->unk0.unk0 = sp20->unk44; var_v0->unk0.unk2 = sp20->unk46; @@ -815,7 +815,7 @@ Particle2 *func_800B0698(unk800B1CB8 *arg0, Particle *arg1) { var_v0->unk0.unk62 = sp20->unk4A; var_v0->unk0.unk64 = sp20->unk4C; var_v0->unk0.unk66 = sp20->unk4E; - func_800B0010((Object *) var_v0, (Object *) arg0, (unk800B03C0_arg2 *) arg1, (Object *)sp20); + func_800B0010((Particle2 *) var_v0, (Particle2 *) arg0, (unk800B03C0_arg2 *) arg1, (ParticleBehavior *)sp20); var_v0->unk0.unk68 = D_800E2E2C[(var_v0->unk0.unk40 >> 4) & 7]; if (var_v0->unk0.unk39 == 5) { temp_f0 = var_v0->unk0.unk1C; @@ -1017,7 +1017,7 @@ Particle2 *func_800B1130(unk800B1CB8 *arg0, Particle *arg1) { func_800AF0F0((Object* ) var_v0); } } - func_800B03C0((Object *) var_v0, (ObjectTransform *) arg0, (unk800B03C0_arg2 *) arg1, (Object *) partBeh); + func_800B03C0((Particle2 *) var_v0, (ObjectTransform *) arg0, (unk800B03C0_arg2 *) arg1, (ParticleBehavior *) partBeh); if (partBeh->flags & 0x80) { var_v0->unk0 = partBeh->unk44; var_v0->unk2 = partBeh->unk46; @@ -1054,7 +1054,7 @@ Particle2 *func_800B1130(unk800B1CB8 *arg0, Particle *arg1) { var_v0->unk66 += get_random_number_from_range(-partBeh->unk8A, partBeh->unk8A); } } - func_800B0010((Object *) var_v0, (Object *) arg0, (unk800B03C0_arg2 *) arg1, (Object *) partBeh); + func_800B0010((Particle2 *) var_v0, (Particle2 *) arg0, (unk800B03C0_arg2 *) arg1, (ParticleBehavior *) partBeh); var_v0->unk68 = D_800E2E2C[(var_v0->unk40 >> 4) & 7]; if (var_v0->unk39 == 5) { var_v0->unk58 = sqrtf((var_v0->unk1C * var_v0->unk1C) + (var_v0->unk20 * var_v0->unk20) + (var_v0->unk24 * var_v0->unk24)); @@ -1184,14 +1184,14 @@ unk800B1CB8 *func_800B1CB8(s32 arg0) { void func_800B2040(Particle2 *arg0) { TextureHeader *tex; - switch (arg0->unk2C) { + switch (arg0->segment.unk2C) { case 0x80: if (D_800E2CB8 > 0) { if (arg0->unk44 != NULL) { free_sprite((Sprite *) arg0->unk44); } D_800E2CB8--; - arg0->unk2C = 0; + arg0->segment.unk2C = 0; } break; case 0: @@ -1202,7 +1202,7 @@ void func_800B2040(Particle2 *arg0) { free_texture(arg0->unk44_1->texture); } D_800E2CA0--; - arg0->unk2C = 0; + arg0->segment.unk2C = 0; } break; case 2: @@ -1212,7 +1212,7 @@ void func_800B2040(Particle2 *arg0) { free_texture(tex); } D_800E2CAC--; - arg0->unk2C = 0; + arg0->segment.unk2C = 0; } break; case 3: @@ -1222,7 +1222,7 @@ void func_800B2040(Particle2 *arg0) { free_texture(tex); } D_800E2CC4--; - arg0->unk2C = 0; + arg0->segment.unk2C = 0; } break; case 4: @@ -1233,7 +1233,7 @@ void func_800B2040(Particle2 *arg0) { free_texture(tex); } D_800E2CD0--; - arg0->unk2C = 0; + arg0->segment.unk2C = 0; } break; } @@ -1248,7 +1248,7 @@ void func_800B2260(Particle *arg0) { if (arg0->unkC_60 != NULL) { for (i = 0; i < arg0->unk6; i++) { temp_v0 = arg0->unkC_60[i]; - temp_v0->unk38.half.unk3A = 0; + temp_v0->segment.unk38.half.unk3A = 0; temp_v0->unk70 = 0; } free_from_memory_pool(arg0->unkC_60); @@ -1263,53 +1263,55 @@ void func_800B22FC(Particle2 *arg0, s32 arg1) { D_80127C80 = arg1; sp20 = NULL; - if (arg0->unk2C == 3) { + if (arg0->segment.unk2C == 3) { func_800B26E0(); } else { - if (arg0->unk40 & 3) { + if (arg0->segment.unk40 & 3) { if (D_80127C80 > 0) { sp20 = NULL; func_800B2FBC(arg0); sp20 = NULL; } } - if (arg0->unk2C == 4) { + if (arg0->segment.unk2C == 4) { sp20 = arg0; arg0->unk75 = 1 - arg0->unk75; arg0->unk77 = 0; } if (sp20 == NULL || (sp20 != NULL && sp20->unk70 != 0)) { - if (arg0->unk38.byte.unk39 == 2) { + if (arg0->segment.unk38.byte.unk39 == 2) { func_800B3358(arg0); - } else if (arg0->unk38.byte.unk39 == 3) { + } else if (arg0->segment.unk38.byte.unk39 == 3) { func_800B3240(arg0); - } else if (arg0->unk38.byte.unk39 == 4) { + } else if (arg0->segment.unk38.byte.unk39 == 4) { func_800B3140(arg0); - } else if (arg0->unk38.byte.unk39 == 5) { + } else if (arg0->segment.unk38.byte.unk39 == 5) { func_800B3564(arg0); } else { func_800B34B0(arg0); } } - temp_v0_2 = get_segment_bounding_box(arg0->unk2E); + temp_v0_2 = get_segment_bounding_box(arg0->segment.unk2E); if (temp_v0_2 != NULL) { - if (arg0->trans.x_position < temp_v0_2->x1 || temp_v0_2->x2 < arg0->trans.x_position || arg0->trans.y_position < temp_v0_2->y1 || temp_v0_2->y2 < arg0->trans.y_position || arg0->trans.z_position < temp_v0_2->z1 || temp_v0_2->z2 < arg0->trans.z_position) { - arg0->unk2E = get_level_segment_index_from_position(arg0->trans.x_position, arg0->trans.y_position, arg0->trans.z_position); + if (arg0->segment.trans.x_position < temp_v0_2->x1 || temp_v0_2->x2 < arg0->segment.trans.x_position || + arg0->segment.trans.y_position < temp_v0_2->y1 || temp_v0_2->y2 < arg0->segment.trans.y_position || + arg0->segment.trans.z_position < temp_v0_2->z1 || temp_v0_2->z2 < arg0->segment.trans.z_position) { + arg0->segment.unk2E = get_level_segment_index_from_position(arg0->segment.trans.x_position, arg0->segment.trans.y_position, arg0->segment.trans.z_position); } } else { - arg0->unk2E = get_level_segment_index_from_position(arg0->trans.x_position, arg0->trans.y_position, arg0->trans.z_position); + arg0->segment.unk2E = get_level_segment_index_from_position(arg0->segment.trans.x_position, arg0->segment.trans.y_position, arg0->segment.trans.z_position); } - arg0->unk38.half.unk3A -= D_80127C80; - if (arg0->unk38.half.unk3A <= 0) { + arg0->segment.unk38.half.unk3A -= D_80127C80; + if (arg0->segment.unk38.half.unk3A <= 0) { gParticlePtrList_addObject((Object*) arg0); } else { if (arg0->unk60_halfs.unk60 == 0) { arg0->unk5C_halfs.unk5C += D_80127C80 * arg0->unk5C_halfs.unk5E; if (arg0->unk5C_halfs.unk5C < 0xFF) { - if (arg0->unk40 & 0x1000) { - arg0->trans.flags |= OBJ_FLAGS_UNK_0100; + if (arg0->segment.unk40 & 0x1000) { + arg0->segment.trans.flags |= OBJ_FLAGS_UNK_0100; } else { - arg0->trans.flags |= OBJ_FLAGS_UNK_0080; + arg0->segment.trans.flags |= OBJ_FLAGS_UNK_0080; } } } else { @@ -1360,47 +1362,47 @@ void func_800B2FBC(Particle2 *arg0) { keepGoing = -1; i = 128; // This is needed to match. - if (arg0->unk2C == i) { + if (arg0->segment.unk2C == i) { var_a1 = arg0->unk44->unk0 * 256; } else { var_a1 = arg0->unk44->unk0Ptr->unk12; } - someFlag4 = arg0->unk40 & 1; - someFlag2 = arg0->unk40 & 2; - someFlag3 = arg0->unk40 & 4; - someFlag = arg0->unk40 & 8; + someFlag4 = arg0->segment.unk40 & 1; + someFlag2 = arg0->segment.unk40 & 2; + someFlag3 = arg0->segment.unk40 & 4; + someFlag = arg0->segment.unk40 & 8; for (i = 0; (i++ < D_80127C80) && keepGoing;) { if (!someFlag) { - arg0->unk18 += arg0->unk1A; - if (arg0->unk18 >= var_a1) { + arg0->segment.unk18 += arg0->segment.unk1A; + if (arg0->segment.unk18 >= var_a1) { if (someFlag2) { - arg0->unk18 = ((var_a1 * 2) - arg0->unk18) - 1; + arg0->segment.unk18 = ((var_a1 * 2) - arg0->segment.unk18) - 1; someFlag = TRUE; - arg0->unk40 |= 8; + arg0->segment.unk40 |= 8; } else if (someFlag3) { - arg0->unk18 -= var_a1; + arg0->segment.unk18 -= var_a1; } else { - arg0->unk18 = var_a1 - 1; + arg0->segment.unk18 = var_a1 - 1; keepGoing = FALSE; - arg0->unk40 &= ~3; + arg0->segment.unk40 &= ~3; } } } else { - arg0->unk18 -= arg0->unk1A; - if (arg0->unk18 < 0) { + arg0->segment.unk18 -= arg0->segment.unk1A; + if (arg0->segment.unk18 < 0) { if (someFlag3) { if (someFlag4) { - arg0->unk18 = -arg0->unk18; + arg0->segment.unk18 = -arg0->segment.unk18; someFlag = FALSE; - arg0->unk40 &= ~8; + arg0->segment.unk40 &= ~8; } else { - arg0->unk18 += var_a1; + arg0->segment.unk18 += var_a1; } } else { - arg0->unk18 = 0; + arg0->segment.unk18 = 0; keepGoing = FALSE; - arg0->unk40 &= ~3; + arg0->segment.unk40 &= ~3; } } } diff --git a/src/particles.h b/src/particles.h index f985b930..36e0e87d 100644 --- a/src/particles.h +++ b/src/particles.h @@ -218,38 +218,48 @@ typedef struct Particle { /* 0x006E */ s16 unk6E; } Particle; -typedef struct Particle2 { +typedef struct ParticleSegment { /* 0x0000 */ ObjectTransform trans; /* 0x0018 */ s16 unk18; - /* 0x0018 */ s16 unk1A; - /* 0x001C */ s16 unk1C; - /* 0x001E */ s16 unk1E; - /* 0x0020 */ s16 unk20; - /* 0x0022 */ s16 unk22; - /* 0x0024 */ s16 unk24; - /* 0x0026 */ s16 unk26; - /* 0x0028 */ s16 unk28; - /* 0x002A */ s16 unk2A; + /* 0x001A */ s16 unk1A; + /* 0x001C */ f32 x_velocity; + /* 0x0020 */ f32 y_velocity; + /* 0x0024 */ f32 z_velocity; + /* 0x0028 */ f32 unk28; /* 0x002C */ s16 unk2C; /* 0x002E */ s16 unk2E; /* 0x0030 */ f32 unk30; - /* 0x0034 */ f32 unk34; + + union { + /* 0x0034 */ f32 unk34; + struct { + /* 0x0034 */ s16 levelSegmentIndex; + /* 0x0036 */ s16 unk36; + }; + } unk34_a; + union { struct { /* 0x0038 */ u8 unk38; /* 0x0039 */ u8 unk39; - /* 0x003A */ s8 unk3A; + /* 0x003A */ s8 unk3A; // Index value for unk68 array /* 0x003B */ s8 unk3B; } byte; struct { /* 0x0038 */ s16 unk38; /* 0x003A */ s16 unk3A; } half; - f32 unk38_f32; } unk38; - /* 0x003C */ f32 unk3C; - /* 0x0040 */ s32 unk40; + union { + /* 0x003C */ void *unk3C_ptr; + /* 0x003C */ f32 unk3C_f; + } unk3C_a; + /* 0x0040 */ s32 unk40; +} ParticleSegment; + +typedef struct Particle2 { + /* 0x0000 */ ParticleSegment segment; union { /* 0x0044 */ unk800B0698_44 *unk44; /* 0x0044 */ TextureHeader *unk44_0; @@ -312,10 +322,10 @@ void func_800B2260(Particle *arg0); void func_800B263C(Particle2 *arg0); void init_particle_assets(void); void func_800B2FBC(Particle2 *arg0); -void func_800B03C0(Object *arg0, ObjectTransform *arg1, unk800B03C0_arg2 *arg2, Object *arg3); +void func_800B03C0(Particle2 *arg0, ObjectTransform *arg1, unk800B03C0_arg2 *arg2, ParticleBehavior *arg3); void func_800B2040(Particle2 *arg0); void func_800B22FC(Particle2 *arg0, s32 arg1); -void func_800B0010(Object *arg0, Object *arg1, unk800B03C0_arg2 *arg2, Object *arg3); +void func_800B0010(Particle2 *arg0, Particle2 *arg1, unk800B03C0_arg2 *arg2, ParticleBehavior *arg3); Particle2 *func_800B0698(unk800B1CB8 *arg0, Particle *arg1); unk800B1CB8 *func_800B1CB8(s32 arg0); void func_800AFE5C(unk800B1CB8 *arg0, Particle *arg1); diff --git a/src/racer.c b/src/racer.c index 1b9feb0b..806d9a7e 100644 --- a/src/racer.c +++ b/src/racer.c @@ -218,7 +218,7 @@ s16 D_8011D5B8; /******************************/ -#ifdef NON_MATCHING +#ifdef NON_EQUIVALENT void func_80042D20(Object *obj, Object_Racer *racer, s32 updateRate) { s32 numRacers; u8 *miscAsset4; @@ -968,7 +968,7 @@ void func_80046524(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r guMtxXFMF(sp68, 0.0f, 1.0f, 0.0f, &racer->ox2, &racer->oy2, &racer->oz2); guMtxXFMF(sp68, 1.0f, 0.0f, 0.0f, &racer->ox3, &racer->oy3, &racer->oz3); if (racer->approachTarget == 0) { - obj->segment.unk38.byte.unk3B = 0; + obj->segment.object.animationID = 0; var_v0 = racer->steerAngle; var_v0 >>= 1; var_v0 = 40 - var_v0; @@ -2060,17 +2060,17 @@ void update_carpet(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r racer->vehicleID = VEHICLE_CARPET; func_80049794(updateRate, updateRateF, obj, racer); racer->vehicleID = racer->vehicleIDPrev; - obj->segment.unk38.byte.unk3B = 0; + obj->segment.object.animationID = 0; if (racer->vehicleID == VEHICLE_CARPET) { if (racer->unk154 != NULL) { racer->unk154->segment.trans.x_position = obj->segment.trans.x_position; racer->unk154->segment.trans.y_position = obj->segment.trans.y_position; racer->unk154->segment.trans.z_position = obj->segment.trans.z_position; - racer->unk154->segment.unk2C.half.lower = obj->segment.unk2C.half.lower; + racer->unk154->segment.object.segmentID = obj->segment.object.segmentID; racer->unk154->segment.trans.y_rotation = obj->segment.trans.y_rotation; racer->unk154->segment.trans.x_rotation = obj->segment.trans.x_rotation; racer->unk154->segment.trans.z_rotation = obj->segment.trans.z_rotation; - obj->segment.unk38.byte.unk3B = 0; + obj->segment.object.animationID = 0; obj->segment.animFrame = sp26 + updateRate; func_80061C0C(obj); } @@ -2431,7 +2431,7 @@ void update_player_racer(Object *obj, s32 updateRate) { if (gCurrentPlayerIndex != PLAYER_COMPUTER) { gCameraObject = (ObjectCamera *) get_active_camera_segment_no_cutscenes(); } - gRacerWaveCount = func_8002B0F4(obj->segment.unk2C.half.lower, obj->segment.trans.x_position, obj->segment.trans.z_position, &gRacerCurrentWave); + gRacerWaveCount = func_8002B0F4(obj->segment.object.segmentID, obj->segment.trans.x_position, obj->segment.trans.z_position, &gRacerCurrentWave); if (gRacerWaveCount) { for (i = 0; i < gRacerWaveCount; i++) { if (gRacerCurrentWave[i]->type == WATER_UNK_F) { @@ -2521,7 +2521,7 @@ void update_player_racer(Object *obj, s32 updateRate) { } if (tempRacer->playerIndex != PLAYER_COMPUTER && tempRacer->lap + 1 == header->laps && !D_8011D580 && get_current_level_race_type() == RACETYPE_DEFAULT) { - func_800014BC(1.12f); + multiply_music_tempo(1.12f); D_8011D580 = 1; } } @@ -2536,8 +2536,8 @@ void update_player_racer(Object *obj, s32 updateRate) { newObject.size = 8; tempRacer->unk15C = spawn_object(&newObject, 1); if (tempRacer->unk15C) { - tempRacer->unk15C->segment.unk3C_a.level_entry = NULL; - tempRacer->unk15C->segment.unk38.byte.unk39 = 128; + tempRacer->unk15C->segment.level_entry = NULL; + tempRacer->unk15C->segment.object.opacity = 128; } } if (tempRacer->unk15C) { @@ -2549,7 +2549,7 @@ void update_player_racer(Object *obj, s32 updateRate) { tempRacer->unk15C->segment.trans.z_position = checkpointNode->obj->segment.trans.z_position; tempRacer->unk15C->segment.trans.y_rotation = checkpointNode->obj->segment.trans.y_rotation; tempRacer->unk15C->segment.trans.x_rotation = checkpointNode->obj->segment.trans.x_rotation; - tempRacer->unk15C->segment.unk2C.half.lower = checkpointNode->obj->segment.unk2C.half.lower; + tempRacer->unk15C->segment.object.segmentID = checkpointNode->obj->segment.object.segmentID; } } } @@ -2652,8 +2652,8 @@ void update_player_racer(Object *obj, s32 updateRate) { tempRacer->unk150->segment.trans.y_position = obj->segment.trans.y_position + yAsset[tempRacer->characterId]; tempRacer->unk150->segment.trans.z_position = obj->segment.trans.z_position; - tempRacer->unk150->segment.trans.scale = obj->segment.unk30 / 265.0f; - if (obj->segment.unk30 < 1500.0 || get_filtered_cheats() & CHEAT_MIRRORED_TRACKS) { + tempRacer->unk150->segment.trans.scale = obj->segment.object.distanceToCamera / 265.0f; + if (obj->segment.object.distanceToCamera < 1500.0 || get_filtered_cheats() & CHEAT_MIRRORED_TRACKS) { tempObj = tempRacer->unk150; tempObj->segment.trans.flags |= OBJ_FLAGS_INVISIBLE; } @@ -2728,7 +2728,7 @@ void racer_approach_object(Object *obj, Object_Racer *racer, f32 divisor) { f32 diffY; f32 diffZ; - obj->segment.unk38.byte.unk3B = 0; + obj->segment.object.animationID = 0; obj->segment.animFrame = 40; diffX = racer->approachTarget->segment.trans.x_position - obj->segment.trans.x_position; diffY = racer->approachTarget->segment.trans.y_position - obj->segment.trans.y_position; @@ -2795,9 +2795,7 @@ void apply_vehicle_rotation_offset(Object_Racer *obj, s32 max, s16 yRotation, s1 tempAngle = diff; } obj->z_rotation_offset += tempAngle; - return; - } - if (tempAngle < 0) { + } else if (tempAngle < 0) { diff = -(max * 0x600); if (tempAngle < diff) { tempAngle = diff; @@ -3454,7 +3452,7 @@ void func_8005250C(Object* obj, Object_Racer* racer, s32 updateRate) { } } obj->segment.animFrame += angleVel; - obj->segment.unk38.byte.unk3B = 0; + obj->segment.object.animationID = 0; if (angleVel) {} // Fakematch if (racer->unk1F3 & 4) { racer->unk1F2 = 3; @@ -3504,34 +3502,34 @@ void func_80052988(Object *obj, Object_Racer *racer, s32 action, s32 arg3, s32 d arg5 *= arg7; if (gCurrentPlayerIndex == PLAYER_COMPUTER && action >= 3) { - obj->segment.unk38.byte.unk3B = 0; + obj->segment.object.animationID = 0; racer->unk1F2 = 0; - } else if (obj->segment.unk38.byte.unk3B == 0) { + } else if (obj->segment.object.animationID == 0) { if (flags & 1) { if (obj->segment.animFrame > 40) { obj->segment.animFrame -= arg7 * 4; if (obj->segment.animFrame <= 40) { - obj->segment.unk38.byte.unk3B = action; + obj->segment.object.animationID = action; obj->segment.animFrame = arg3; } } else { obj->segment.animFrame += arg7 * 4; if (obj->segment.animFrame >= 40) { - obj->segment.unk38.byte.unk3B = action; + obj->segment.object.animationID = action; obj->segment.animFrame = arg3; } } } else { - obj->segment.unk38.byte.unk3B = action; + obj->segment.object.animationID = action; obj->segment.animFrame = arg3; racer->unk1F3 &= ~0x80; } - } else if (obj->segment.unk38.byte.unk3B == action) { + } else if (obj->segment.object.animationID == action) { if (flags & 2) { if (racer->unk1F3 & 0x80) { obj->segment.animFrame -= arg5; //!@Delta if (obj->segment.animFrame <= 0) { - obj->segment.unk38.byte.unk3B = 0; + obj->segment.object.animationID = 0; racer->unk1F2 = 0; obj->segment.animFrame = 40; racer->unk1F3 = 0; @@ -3548,7 +3546,7 @@ void func_80052988(Object *obj, Object_Racer *racer, s32 action, s32 arg3, s32 d } else { obj->segment.animFrame += arg5; //!@Delta if (obj->segment.animFrame >= duration) { - obj->segment.unk38.byte.unk3B = 0; + obj->segment.object.animationID = 0; racer->unk1F2 = 0; obj->segment.animFrame = 40; racer->unk1F3 = 0; @@ -3556,7 +3554,7 @@ void func_80052988(Object *obj, Object_Racer *racer, s32 action, s32 arg3, s32 d } } else { obj->segment.animFrame = arg3; - obj->segment.unk38.byte.unk3B = action; + obj->segment.object.animationID = action; } } @@ -3958,7 +3956,7 @@ void update_onscreen_AI_racer(Object *obj, Object_Racer *racer, s32 updateRate, } else if (racer->groundedWheels > 2) { racer->unk1F0 = 0; } - obj->segment.unk38.byte.unk3B = 0; + obj->segment.object.animationID = 0; steerVel = ((-racer->y_rotation_vel >> 8) / gCurrentRacerHandlingStat); steerVel = 40 - steerVel; if (steerVel < 0) { @@ -4336,8 +4334,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.unk38.byte.unk3A] != NULL) { - model = obj->unk68[obj->segment.unk38.byte.unk3A]->objModel; + if (obj->unk68[obj->segment.object.numModelIDs] != NULL) { + model = obj->unk68[obj->segment.object.numModelIDs]->objModel; if (obj->segment.header->unk58 > -1 && obj->segment.header->unk58 < model->unk18) { if (obj->unk44 != NULL) { heldObjData = obj->unk44; @@ -4352,7 +4350,7 @@ void handle_racer_items(Object *obj, Object_Racer *racer, UNUSED s32 updateRate) heldObj->segment.trans.x_position = obj->segment.trans.x_position + (racer->ox1 * scaleZ) + (racer->ox2 * scaleY); heldObj->segment.trans.y_position = obj->segment.trans.y_position + (racer->oy1 * scaleZ) + (racer->oy2 * scaleY); heldObj->segment.trans.z_position = obj->segment.trans.z_position + (racer->oz1 * scaleZ) + (racer->oz2 * scaleY); - heldObj->segment.unk2C.half.lower = obj->segment.unk2C.half.lower; + heldObj->segment.object.segmentID = obj->segment.object.segmentID; heldObj->segment.x_velocity = obj->segment.x_velocity * 0.7; heldObj->segment.y_velocity = obj->segment.y_velocity - 2.0; heldObj->segment.z_velocity = obj->segment.z_velocity * 0.7; @@ -4551,7 +4549,7 @@ void handle_racer_items(Object *obj, Object_Racer *racer, UNUSED s32 updateRate) newObject.objectID = objID; spawnedObj = spawn_object(&newObject, 1); if (spawnedObj != NULL) { - spawnedObj->segment.unk3C_a.level_entry = NULL; + spawnedObj->segment.level_entry = NULL; spawnedObj->segment.x_velocity = obj->segment.x_velocity - (racer->ox1 * velocity); spawnedObj->segment.y_velocity = obj->segment.y_velocity - (racer->oy1 * velocity); spawnedObj->segment.z_velocity = obj->segment.z_velocity - (racer->oz1 * velocity); @@ -4904,7 +4902,7 @@ void drop_bananas(Object *obj, Object_Racer *racer, s32 number) { if (get_current_level_race_type() != RACETYPE_CHALLENGE) { bananaObj = spawn_object(&newObject, 1); if (bananaObj != NULL) { - bananaObj->segment.unk3C_a.level_entry = NULL; + bananaObj->segment.level_entry = NULL; banana = (Object_Banana *) bananaObj->unk64; banana->unk9 = racer->vehicleID; bananaObj->segment.x_velocity = racer->ox1 * 2; @@ -4919,7 +4917,7 @@ void drop_bananas(Object *obj, Object_Racer *racer, s32 number) { bananaObj->segment.y_velocity -= racer->oy3 * variance; bananaObj->segment.z_velocity -= (racer->oz3 - racer->oz1) * variance; } - bananaObj->action = 1; + bananaObj->properties.banana.unk0 = 1; } } number--; @@ -5749,7 +5747,7 @@ void racer_enter_door(Object_Racer* racer, s32 updateRate) { if (racer->transitionTimer > 0) { racer->transitionTimer -= updateRate; if (racer->transitionTimer <= 0) { - func_8006D968((s8* ) racer->exitObj->segment.unk3C_a.level_entry); + func_8006D968((s8* ) racer->exitObj->segment.level_entry); racer->transitionTimer = 0; } } @@ -5891,7 +5889,7 @@ void update_AI_racer(Object *obj, Object_Racer *racer, s32 updateRate, f32 updat racer->buoyancy = 0; gRacerWaveCount = 0; } else { - gRacerWaveCount = func_8002B0F4(obj->segment.unk2C.half.lower, obj->segment.trans.x_position, obj->segment.trans.z_position, &gRacerCurrentWave); + gRacerWaveCount = func_8002B0F4(obj->segment.object.segmentID, obj->segment.trans.x_position, obj->segment.trans.z_position, &gRacerCurrentWave); } func_8002ACC8(0); if ((racer->approachTarget != NULL) || (gRaceStartTimer != 0) || (racer->unk204 > 0)) { @@ -6034,8 +6032,8 @@ void update_AI_racer(Object *obj, Object_Racer *racer, s32 updateRate, f32 updat temp = (s8 *) get_misc_asset(MISC_ASSET_UNK00); racer->unk150->segment.trans.y_position = obj->segment.trans.y_position + temp[racer->characterId]; racer->unk150->segment.trans.z_position = obj->segment.trans.z_position; - racer->unk150->segment.trans.scale = obj->segment.unk30 / 265.0f; - if (obj->segment.unk30 < 1500.0) { + racer->unk150->segment.trans.scale = obj->segment.object.distanceToCamera / 265.0f; + if (obj->segment.object.distanceToCamera < 1500.0) { racer->unk150->segment.trans.flags |= OBJ_FLAGS_INVISIBLE; } if (racer->unk150->segment.trans.scale < 1.0) { diff --git a/src/unknown_0255E0.c b/src/unknown_0255E0.c index 31e40f5e..dc2f07b5 100644 --- a/src/unknown_0255E0.c +++ b/src/unknown_0255E0.c @@ -671,7 +671,7 @@ void spawn_skydome(s32 objectID) { spawnObject.objectID = objectID; gSkydomeSegment = spawn_object(&spawnObject, 2); if (gSkydomeSegment != NULL) { - gSkydomeSegment->segment.unk3C_a.level_entry = NULL; + gSkydomeSegment->segment.level_entry = NULL; gSkydomeSegment->unk4A = -1; } } @@ -823,7 +823,7 @@ void initialise_player_viewport_vars(s32 updateRate) { viewportID = get_current_viewport(); compute_scene_camera_transform_matrix(); update_envmap_position((f32) gScenePerspectivePos.x / 65536.0f, (f32) gScenePerspectivePos.y / 65536.0f, (f32) gScenePerspectivePos.z / 65536.0f); - segmentIndex = gSceneActiveCamera->unk34_a.levelSegmentIndex; + segmentIndex = gSceneActiveCamera->object.cameraSegmentID; if (segmentIndex > -1 && (segmentIndex < gCurrentLevelModel->numberOfSegments)) { gSceneStartSegment = gCurrentLevelModel->segments[segmentIndex].unk28; } else { @@ -835,7 +835,7 @@ void initialise_player_viewport_vars(s32 updateRate) { if (D_8011D384 != 0) { func_800B8B8C(); racers = get_racer_objects(&numRacers); - if (gSceneActiveCamera->unk34_a.unk36 != 7 && numRacers > 0 && !check_if_showing_cutscene_camera()) { + if (gSceneActiveCamera->object.unk36 != 7 && numRacers > 0 && !check_if_showing_cutscene_camera()) { i = -1; do { i++; @@ -919,12 +919,12 @@ void render_level_geometry_and_objects(void) { if (objFlags & OBJ_FLAGS_UNK_0080) { visible = 0; } else if (!(objFlags & OBJ_FLAGS_DEACTIVATED)) { - visible = obj->segment.unk38.byte.unk39; + visible = obj->segment.object.opacity; } if (objFlags & visibleFlags) { visible = 0; } - if (obj != NULL && visible == 255 && check_if_in_draw_range(obj) && (objectsVisible[obj->segment.unk2C.half.lower + 1] || obj->segment.unk34_a.unk34 > 1000.0)) { + if (obj != NULL && visible == 255 && check_if_in_draw_range(obj) && (objectsVisible[obj->segment.object.segmentID + 1] || obj->segment.camera.unk34 > 1000.0)) { if (obj->segment.trans.flags & OBJ_FLAGS_DEACTIVATED) { func_80012D5C(&gSceneCurrDisplayList, &gSceneCurrMatrix, &gSceneCurrVertexList, obj); continue; @@ -946,7 +946,7 @@ void render_level_geometry_and_objects(void) { } else { visible = TRUE; } - if (obj != NULL && visible && objFlags & OBJ_FLAGS_UNK_0100 && objectsVisible[obj->segment.unk2C.half.lower + 1] && check_if_in_draw_range(obj)) { + if (obj != NULL && visible && objFlags & OBJ_FLAGS_UNK_0100 && objectsVisible[obj->segment.object.segmentID + 1] && check_if_in_draw_range(obj)) { if (obj->segment.trans.flags & OBJ_FLAGS_DEACTIVATED) { func_80012D5C(&gSceneCurrDisplayList, &gSceneCurrMatrix, &gSceneCurrVertexList, obj); continue; @@ -982,7 +982,7 @@ void render_level_geometry_and_objects(void) { if (objFlags & OBJ_FLAGS_UNK_0080) { visible = TRUE; } else if (!(objFlags & OBJ_FLAGS_DEACTIVATED)) { - visible = obj->segment.unk38.byte.unk39; + visible = obj->segment.object.opacity; } if (objFlags & visibleFlags) { visible = FALSE; @@ -990,7 +990,7 @@ void render_level_geometry_and_objects(void) { if (obj->behaviorId == BHV_RACER && visible >= 255) { visible = FALSE; } - if (obj != NULL && visible < 255 && objectsVisible[obj->segment.unk2C.half.lower + 1] && check_if_in_draw_range(obj)) { + if (obj != NULL && visible < 255 && objectsVisible[obj->segment.object.segmentID + 1] && check_if_in_draw_range(obj)) { if (visible > 0) { if (obj->segment.trans.flags & OBJ_FLAGS_DEACTIVATED) { func_80012D5C(&gSceneCurrDisplayList, &gSceneCurrMatrix, &gSceneCurrVertexList, obj); @@ -1487,11 +1487,11 @@ s32 check_if_in_draw_range(Object *obj) { switch (obj->behaviorId) { case BHV_RACER: obj64 = obj->unk64; - obj->segment.unk38.byte.unk39 = ((obj64->racer.transparency + 1) * alpha) >> 8; + obj->segment.object.opacity = ((obj64->racer.transparency + 1) * alpha) >> 8; break; case BHV_UNK_3A: //Ghost Object? obj64 = obj->unk64; - obj->segment.unk38.byte.unk39 = obj64->racer.transparency; + obj->segment.object.opacity = obj64->racer.transparency; break; case BHV_ANIMATED_OBJECT: // Cutscene object? case BHV_CAMERA_ANIMATION: @@ -1502,14 +1502,14 @@ s32 check_if_in_draw_range(Object *obj) { case BHV_HIT_TESTER_2: // animated objects? case BHV_ANIMATED_OBJECT_2: // space ships obj64 = obj->unk64; - obj->segment.unk38.byte.unk39 = obj64->effect_box.pad0[0x42]; + obj->segment.object.opacity = obj64->effect_box.pad0[0x42]; break; case BHV_PARK_WARDEN: case BHV_GOLDEN_BALLOON: case BHV_PARK_WARDEN_2: // GBParkwarden break; default: - obj->segment.unk38.byte.unk39 = alpha; + obj->segment.object.opacity = alpha; break; } for (i = 0; i < 3; i++) { @@ -1517,7 +1517,7 @@ s32 check_if_in_draw_range(Object *obj) { z = D_8011D0F8[i].z; w = D_8011D0F8[i].w; y = D_8011D0F8[i].y; - accum = (x * obj->segment.trans.x_position) + (y * obj->segment.trans.y_position) + (z * obj->segment.trans.z_position) + w + obj->segment.unk34_a.unk34; + accum = (x * obj->segment.trans.x_position) + (y * obj->segment.trans.y_position) + (z * obj->segment.trans.z_position) + w + obj->segment.camera.unk34; if (accum < 0.0f) { return FALSE; } @@ -1624,12 +1624,12 @@ s32 func_8002B9BC(Object *obj, f32 *arg1, f32 *arg2, s32 arg3) { arg2[2] = 0.0f; arg2[1] = 1.0f; } - if ((obj->segment.unk2C.half.lower < 0) || (obj->segment.unk2C.half.lower >= gCurrentLevelModel->numberOfSegments)) { + if ((obj->segment.object.segmentID < 0) || (obj->segment.object.segmentID >= gCurrentLevelModel->numberOfSegments)) { return FALSE; } - seg = &gCurrentLevelModel->segments[obj->segment.unk2C.half.lower]; + seg = &gCurrentLevelModel->segments[obj->segment.object.segmentID]; if ((seg->unk2B != 0) && (D_8011D384 != 0) && (arg3 == 1)) { - *arg1 = func_800BB2F4(obj->segment.unk2C.half.lower, obj->segment.trans.x_position, obj->segment.trans.z_position, arg2); + *arg1 = func_800BB2F4(obj->segment.object.segmentID, obj->segment.trans.x_position, obj->segment.trans.z_position, arg2); return TRUE; } else { *arg1 = seg->unk38; @@ -1931,11 +1931,11 @@ void render_object_shadow(Object *obj, ShadowData *shadow) { D_8011D348 = (unk8011D348 *) D_8011D338[D_8011B0CC]; someAlpha = D_8011D348[D_8011D360[i].unk6].unk9; flags = RENDER_FOG_ACTIVE | RENDER_Z_COMPARE; - if (someAlpha == 0 || obj->segment.unk38.byte.unk39 == 0) { + if (someAlpha == 0 || obj->segment.object.opacity == 0) { i = shadow->unkA; - } else if (someAlpha != 255 || obj->segment.unk38.byte.unk39 != 255) { + } else if (someAlpha != 255 || obj->segment.object.opacity != 255) { flags = RENDER_FOG_ACTIVE | RENDER_SEMI_TRANSPARENT | RENDER_Z_COMPARE; - someAlpha = (obj->segment.unk38.byte.unk39 * someAlpha) >> 8; + someAlpha = (obj->segment.object.opacity * someAlpha) >> 8; gDPSetPrimColor(gSceneCurrDisplayList++, 0, 0, 255, 255, 255, someAlpha); } while (i < shadow->unkA) { @@ -2144,7 +2144,7 @@ void func_8002DE30(Object *obj) { obj_yPos = obj->segment.trans.y_position; sp94 = obj_yPos + objHeader->unk44; sp90 = obj_yPos + objHeader->unk42; - segmentIndex = obj->segment.unk2C.half.lower; + segmentIndex = obj->segment.object.segmentID; var_s7 = 0; if (segmentIndex != -1) { //func_800314DC = collision @@ -2384,7 +2384,7 @@ void obj_loop_fogchanger(Object *obj) { ObjectSegment *camera; racers = NULL; - fogChanger = (LevelObjectEntry_FogChanger *) obj->segment.unk3C_a.level_entry; + fogChanger = (LevelObjectEntry_FogChanger *) obj->segment.level_entry; camera = NULL; if (check_if_showing_cutscene_camera()) { @@ -2413,7 +2413,7 @@ void obj_loop_fogchanger(Object *obj) { x -= obj->segment.trans.x_position; z -= obj->segment.trans.z_position; if (1) {} // Fakematch - if ((x * x) + (z * z) < obj->unk78f) { + if ((x * x) + (z * z) < obj->properties.distance.radius) { fogNear = fogChanger->near; fogFar = fogChanger->far; fogR = fogChanger->r; diff --git a/src/vehicle_bluey.c b/src/vehicle_bluey.c index f66b80bf..deec7ec7 100644 --- a/src/vehicle_bluey.c +++ b/src/vehicle_bluey.c @@ -81,7 +81,7 @@ void update_bluey(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *ra set_boss_voice_clip_offset(D_800DCE00); *buttonsPressed &= ~R_TRIG; *input &= ~R_TRIG; - sp5E = obj->segment.unk38.byte.unk3B; + sp5E = obj->segment.object.animationID; sp5C = obj->segment.animFrame; sp5A = racer->headAngle; if (racer->raceFinished == TRUE && func_80023568()) { @@ -113,12 +113,12 @@ void update_bluey(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *ra *startTimer = sp48; racer->lateral_velocity = 0.0f; racer->headAngle = sp5A; - obj->segment.unk38.byte.unk3B = (s8) sp5E; + obj->segment.object.animationID = (s8) sp5E; obj->segment.animFrame = sp5C; if (racer->attackType != ATTACK_NONE) { - if (obj->segment.unk38.byte.unk3B != 4) { - racer->unk1CD = obj->segment.unk38.byte.unk3B; - obj->segment.unk38.byte.unk3B = 4; + if (obj->segment.object.animationID != 4) { + racer->unk1CD = obj->segment.object.animationID; + obj->segment.object.animationID = 4; racer->unkC = 0.0f; func_8005CB04(1); play_sound_global(SOUND_EXPLOSION, NULL); @@ -137,13 +137,13 @@ void update_bluey(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *ra if ((find_next_checkpoint_node(racer->checkpoint, racer->unk1C8))->unk36[racer->unk1CA] == 1) { sp3C = TRUE; } - if (obj->segment.unk38.byte.unk3B != 4) { + if (obj->segment.object.animationID != 4) { if (racer->velocity < -2.0) { if (sp3C) { if (racer->unk1CD != 3) { racer->unkC = 40.0f; } - obj->segment.unk38.byte.unk3B = 3; + obj->segment.object.animationID = 3; var_v0 = racer->steerAngle; var_v0 *= 2; var_v0 = 40 - var_v0; @@ -157,16 +157,16 @@ void update_bluey(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *ra racer->unkC += (var_v0 - racer->unkC) * 0.25; } else { racer->unk1CD = 0; - obj->segment.unk38.byte.unk3B = 0; + obj->segment.object.animationID = 0; racer->unkC -= (racer->velocity * updateRateF) * 0.5; } } else if (racer->velocity < -0.1 || 0.1 < racer->velocity) { racer->unk1CD = 1; - obj->segment.unk38.byte.unk3B = 1; + obj->segment.object.animationID = 1; racer->unkC -= racer->velocity * updateRateF * 2; } else { racer->unk1CD = 2; - obj->segment.unk38.byte.unk3B = 2; + obj->segment.object.animationID = 2; racer->unkC += updateRateF * 1.0; } } else { @@ -174,7 +174,7 @@ void update_bluey(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *ra } obj68 = *obj->unk68; objModel = obj68->objModel; - diffX = (objModel->animations[obj->segment.unk38.byte.unk3B].unk4 * 16) - 17; + diffX = (objModel->animations[obj->segment.object.animationID].unk4 * 16) - 17; while (racer->unkC < 0.0f) { racer->unkC += diffX; obj68->unk10 = -1; @@ -183,13 +183,13 @@ void update_bluey(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *ra racer->unkC -= diffX; obj68->unk10 = -1; } - if ((obj68->unk10 == -1) && (obj->segment.unk38.byte.unk3B == 4)) { - obj->segment.unk38.byte.unk3B = racer->unk1CD; + if ((obj68->unk10 == -1) && (obj->segment.object.animationID == 4)) { + obj->segment.object.animationID = racer->unk1CD; } sp5C = obj->segment.animFrame; obj->segment.animFrame = racer->unkC; obj->unk74 = 0; - if (obj->segment.unk38.byte.unk3B == 0) { + if (obj->segment.object.animationID == 0) { func_800113CC(obj, 2, sp5C, SOUND_STOMP2, SOUND_STOMP3); obj->unk74 |= 3; } @@ -204,16 +204,16 @@ void update_bluey(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *ra CLAMP(sp48, -0xC00, 0xC00); racer->headAngleTarget = sp48; } - if (obj->segment.unk38.byte.unk3B == 1) { + if (obj->segment.object.animationID == 1) { if ((racer->miscAnimCounter & 0x1F) < 10) { racer->headAngleTarget >>= 1; } } - if (obj->segment.unk38.byte.unk3B == 3) { + if (obj->segment.object.animationID == 3) { racer->headAngleTarget = 0; } racer = (Object_Racer *) firstRacerObj->unk64; - if (obj == firstRacerObj->interactObj->obj && firstRacerObj->interactObj->flags & INTERACT_FLAGS_PUSHING && obj->segment.unk38.byte.unk3B == 1) { + if (obj == firstRacerObj->interactObj->obj && firstRacerObj->interactObj->flags & INTERACT_FLAGS_PUSHING && obj->segment.object.animationID == 1) { racer->attackType = ATTACK_SQUISHED; } if (racer->raceFinished) { diff --git a/src/vehicle_bubbler.c b/src/vehicle_bubbler.c index dc68066d..5b0dfb41 100644 --- a/src/vehicle_bubbler.c +++ b/src/vehicle_bubbler.c @@ -63,7 +63,7 @@ void update_bubbler(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer * set_boss_voice_clip_offset(D_800DCE40); *buttonsPressed &= ~R_TRIG; *input &= ~R_TRIG; - sp56 = obj->segment.unk38.byte.unk3B; + sp56 = obj->segment.object.animationID; animFrame = obj->segment.animFrame; sp52 = racer->headAngle; if (racer->raceFinished == TRUE) { @@ -92,11 +92,11 @@ void update_bubbler(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer * *startTimer = timer; racer->lateral_velocity = 0.0f; racer->headAngle = sp52; - obj->segment.unk38.byte.unk3B = sp56; + obj->segment.object.animationID = sp56; obj->segment.animFrame = animFrame; - if (racer->attackType != ATTACK_NONE && obj->segment.unk38.byte.unk3B != 2) { - racer->unk1CD = obj->segment.unk38.byte.unk3B; - obj->segment.unk38.byte.unk3B = 2; + if (racer->attackType != ATTACK_NONE && obj->segment.object.animationID != 2) { + racer->unk1CD = obj->segment.object.animationID; + obj->segment.object.animationID = 2; obj->segment.y_velocity += 7.5; func_8005CB04(1); play_sound_global(SOUND_EXPLOSION, 0); @@ -112,8 +112,8 @@ void update_bubbler(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer * } gfxData = *obj->unk68; model = gfxData->objModel; - diffX = (model->animations[obj->segment.unk38.byte.unk3B].unk4 * 16) - 17; - obj->segment.unk38.byte.unk3B = 1; + diffX = (model->animations[obj->segment.object.animationID].unk4 * 16) - 17; + obj->segment.object.animationID = 1; racer->unkC += 2.0 * updateRateF; while (racer->unkC < 0.0f) { racer->unkC += diffX; @@ -123,8 +123,8 @@ void update_bubbler(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer * racer->unkC -= diffX; gfxData->unk10 = -1; } - if (gfxData->unk10 == -1 && obj->segment.unk38.byte.unk3B == 2) { - obj->segment.unk38.byte.unk3B = 1; + if (gfxData->unk10 == -1 && obj->segment.object.animationID == 2) { + obj->segment.object.animationID = 1; racer->unkC = 0.0f; } obj->segment.animFrame = racer->unkC; @@ -141,7 +141,7 @@ void update_bubbler(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer * obj->unk74 = 0; func_800AFC3C(obj, updateRate); fade_when_near_camera(obj, racer, 0x28); - switch (obj->segment.unk38.byte.unk3B) { + switch (obj->segment.object.animationID) { case 1: sp38 = 0x2500; break; @@ -161,13 +161,13 @@ void update_bubbler(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer * CLAMP(timer, -sp38, sp38); racer->headAngleTarget = timer; } - if (obj->segment.unk38.byte.unk3B == 1) { + if (obj->segment.object.animationID == 1) { if ((racer->miscAnimCounter & 0x1F) < 10) { racer->headAngleTarget >>= 1; } } racer = (Object_Racer *) firstRacerObj->unk64; - if (obj == firstRacerObj->interactObj->obj && firstRacerObj->interactObj->flags & INTERACT_FLAGS_PUSHING && obj->segment.unk38.byte.unk3B == 1) { + if (obj == firstRacerObj->interactObj->obj && firstRacerObj->interactObj->flags & INTERACT_FLAGS_PUSHING && obj->segment.object.animationID == 1) { racer->attackType = ATTACK_SQUISHED; } if (racer->raceFinished) { diff --git a/src/vehicle_rocket.c b/src/vehicle_rocket.c index 16e3119b..01d0e930 100644 --- a/src/vehicle_rocket.c +++ b/src/vehicle_rocket.c @@ -58,7 +58,7 @@ void update_rocket(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r set_boss_voice_clip_offset((u16* ) D_800DCE80); racer->unk1EC = 0; - sp3E = obj->segment.unk38.byte.unk3B; + sp3E = obj->segment.object.animationID; sp3C = obj->segment.animFrame; sp3A = racer->headAngle; if ((racer->velocity < 0.3) && (-0.3 < racer->velocity)) { @@ -94,14 +94,14 @@ void update_rocket(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r *startTimer = sp2C; obj->unk74 = 0; racer->headAngle = sp3A; - obj->segment.unk38.byte.unk3B = sp3E; + obj->segment.object.animationID = sp3E; obj->segment.animFrame = sp3C; - if (racer->attackType != ATTACK_NONE && obj->segment.unk38.byte.unk3B != 1) { + if (racer->attackType != ATTACK_NONE && obj->segment.object.animationID != 1) { func_8005CB04(1); play_sound_global(SOUND_EXPLOSION, NULL); set_camera_shake(12.0f); obj->segment.x_velocity *= 0.4; - obj->segment.unk38.byte.unk3B = 1; + obj->segment.object.animationID = 1; obj->segment.z_velocity *= 0.4; racer->unkC = 0.0f; obj->segment.y_velocity += 4.0; @@ -121,7 +121,7 @@ void update_rocket(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r racer->unkC += 2.0 * updateRateF; gfxData = *obj->unk68; objModel = gfxData->objModel; - diffX = (objModel->animations[obj->segment.unk38.byte.unk3B].unk4 * 16) - 17; + diffX = (objModel->animations[obj->segment.object.animationID].unk4 * 16) - 17; while (diffX <= racer->unkC) { racer->unkC -= diffX; gfxData->unk10 = -1; @@ -130,8 +130,8 @@ void update_rocket(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r racer->unkC += diffX; gfxData->unk10 = -1; } - if (obj->segment.unk38.byte.unk3B == 1 && gfxData->unk10 == -1) { - obj->segment.unk38.byte.unk3B = 0; + if (obj->segment.object.animationID == 1 && gfxData->unk10 == -1) { + obj->segment.object.animationID = 0; racer->unkC = 0.0f; } obj->segment.animFrame = racer->unkC; @@ -142,7 +142,7 @@ void update_rocket(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r someObj = func_8000BF44(-1); if (someObj != NULL) { rocket = (Object_WizpigRocket *) someObj->unk64; - someObj->unk78 = 0; + someObj->properties.racer.unk0 = 0; if (rocket != NULL) { rocket->unk72 += updateRate; rocket->unk70 = 2; @@ -153,7 +153,7 @@ void update_rocket(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r } firstRacerObj = get_racer_object(0); racer = (Object_Racer*)firstRacerObj->unk64; - if (obj == firstRacerObj->interactObj->obj && firstRacerObj->interactObj->flags & INTERACT_FLAGS_PUSHING && obj->segment.unk38.byte.unk3B == 1) { + if (obj == firstRacerObj->interactObj->obj && firstRacerObj->interactObj->flags & INTERACT_FLAGS_PUSHING && obj->segment.object.animationID == 1) { racer->attackType = ATTACK_SQUISHED; } if (racer->raceFinished != 0) { diff --git a/src/vehicle_smokey.c b/src/vehicle_smokey.c index 47164e3a..455641b1 100644 --- a/src/vehicle_smokey.c +++ b/src/vehicle_smokey.c @@ -38,7 +38,7 @@ void update_smokey(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r Object *firstRacerObj; set_boss_voice_clip_offset(D_800DCE20); - sp5E = obj->segment.unk38.byte.unk3B; + sp5E = obj->segment.object.animationID; sp5C = obj->segment.animFrame; sp5A = racer->headAngle; if (racer->velocity < 0.3 && -0.3 < racer->velocity) { @@ -72,13 +72,13 @@ void update_smokey(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r *startTimer = sp44; obj->unk74 = 0; racer->headAngle = sp5A; - obj->segment.unk38.byte.unk3B = sp5E; + obj->segment.object.animationID = sp5E; obj->segment.animFrame = sp5C; - if (racer->attackType != ATTACK_NONE && obj->segment.unk38.byte.unk3B != 5) { + if (racer->attackType != ATTACK_NONE && obj->segment.object.animationID != 5) { func_8005CB04(1); play_sound_global(SOUND_EXPLOSION, 0); set_camera_shake(12.0f); - obj->segment.unk38.byte.unk3B = 5; + obj->segment.object.animationID = 5; obj->segment.x_velocity *= 0.27; obj->segment.z_velocity *= 0.27; racer->unkC = 0.0f; @@ -98,7 +98,7 @@ void update_smokey(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r } obj68 = *obj->unk68; objModel = obj68->objModel; - diffX = (objModel->animations[obj->segment.unk38.byte.unk3B].unk4 * 16) - 17; + diffX = (objModel->animations[obj->segment.object.animationID].unk4 * 16) - 17; var_f2 = (racer->velocity * updateRateF) * 0.45; if (var_f2 <= 0.0) { if (var_f2 > -2.0) { @@ -107,7 +107,7 @@ void update_smokey(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r } else if (var_f2 < 2.0) { var_f2 = 2.0f; } - switch (obj->segment.unk38.byte.unk3B) { + switch (obj->segment.object.animationID) { case 0: racer->unk1CD = 0; racer->unkC += 1.0 * updateRateF; @@ -149,41 +149,41 @@ void update_smokey(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r racer->unkC += diffX; obj68->unk10 = -1; } - if (obj->segment.unk38.byte.unk3B == 2 && racer->groundedWheels == 0 && racer->velocity < -6.5) { - obj->segment.unk38.byte.unk3B = 3; + if (obj->segment.object.animationID == 2 && racer->groundedWheels == 0 && racer->velocity < -6.5) { + obj->segment.object.animationID = 3; racer->unkC = 0.0f; } - if (obj68->unk10 == -1 || obj->segment.unk38.byte.unk3B == 0) { - if (obj->segment.unk38.byte.unk3B == 5) { - obj->segment.unk38.byte.unk3B = racer->unk1CD; + if (obj68->unk10 == -1 || obj->segment.object.animationID == 0) { + if (obj->segment.object.animationID == 5) { + obj->segment.object.animationID = racer->unk1CD; racer->unkC = 0.0f; - } else if (obj->segment.unk38.byte.unk3B == 1) { + } else if (obj->segment.object.animationID == 1) { if (racer->unk1CD == 0) { - obj->segment.unk38.byte.unk3B = 2; + obj->segment.object.animationID = 2; } else { - obj->segment.unk38.byte.unk3B = 0; + obj->segment.object.animationID = 0; } - } else if (obj->segment.unk38.byte.unk3B == 3) { + } else if (obj->segment.object.animationID == 3) { if (racer->unk1CD == 4) { - obj->segment.unk38.byte.unk3B = 2; + obj->segment.object.animationID = 2; } else { - obj->segment.unk38.byte.unk3B = 4; + obj->segment.object.animationID = 4; } } else if (-0.1 < racer->velocity && racer->velocity < 0.1) { - if (obj->segment.unk38.byte.unk3B == 2) { - obj->segment.unk38.byte.unk3B = 1; - racer->unkC = (objModel->animations[obj->segment.unk38.byte.unk3B].unk4 * 16) - 17; + if (obj->segment.object.animationID == 2) { + obj->segment.object.animationID = 1; + racer->unkC = (objModel->animations[obj->segment.object.animationID].unk4 * 16) - 17; } else { - obj->segment.unk38.byte.unk3B = 0; + obj->segment.object.animationID = 0; } } else { - if (obj->segment.unk38.byte.unk3B == 0) { - obj->segment.unk38.byte.unk3B = 1; + if (obj->segment.object.animationID == 0) { + obj->segment.object.animationID = 1; racer->unkC = 0.0f; } - if (obj->segment.unk38.byte.unk3B == 4 && racer->groundedWheels && racer->velocity > -6.0) { - obj->segment.unk38.byte.unk3B = 3; - racer->unkC = (objModel->animations[obj->segment.unk38.byte.unk3B].unk4 * 16) - 17; + if (obj->segment.object.animationID == 4 && racer->groundedWheels && racer->velocity > -6.0) { + obj->segment.object.animationID = 3; + racer->unkC = (objModel->animations[obj->segment.object.animationID].unk4 * 16) - 17; } } } @@ -191,10 +191,10 @@ void update_smokey(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r obj->segment.animFrame = racer->unkC; newvar = obj->segment.animFrame >> 4; obj->unk74 = 0; - if (obj->segment.unk38.byte.unk3B != 1 && obj->segment.unk38.byte.unk3B != 2) { + if (obj->segment.object.animationID != 1 && obj->segment.object.animationID != 2) { sp5C >>= 4; newvar = 1; - if (obj->segment.unk38.byte.unk3B == 0) { + if (obj->segment.object.animationID == 0) { newvar = 3; } if (sp5C == newvar && newvar + 1 == obj->segment.animFrame >> 4) { @@ -225,13 +225,13 @@ void update_smokey(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r } racer->headAngleTarget = sp44; } - if (obj->segment.unk38.byte.unk3B >= 2) { + if (obj->segment.object.animationID >= 2) { if ((racer->miscAnimCounter & 0x1F) < 10) { racer->headAngleTarget >>= 1; } } racer = (Object_Racer *) firstRacerObj->unk64; - if (obj == firstRacerObj->interactObj->obj && firstRacerObj->interactObj->flags & INTERACT_FLAGS_PUSHING && obj->segment.unk38.byte.unk3B == 1) { + if (obj == firstRacerObj->interactObj->obj && firstRacerObj->interactObj->flags & INTERACT_FLAGS_PUSHING && obj->segment.object.animationID == 1) { racer->attackType = ATTACK_SQUISHED; } if (racer->raceFinished != FALSE) { @@ -265,28 +265,28 @@ void func_8005E204(Object *obj, Object_Racer *racer, f32 arg2, s32 objectID, s32 for (i = 0; i < sp7C; i++) { temp_s1 = var_s6[i]; if (temp_s1->behaviorId == BHV_UNK_6B) { - temp_s2 = temp_s1->segment.unk3C_a.level_entry; + temp_s2 = temp_s1->segment.level_entry; if ((s8) temp_s2->animation.z_rotation == racer->lap + 1 || (s8) temp_s2->animation.z_rotation == 0) { diffX = temp_s1->segment.trans.x_position - obj->segment.trans.x_position; diffY = temp_s1->segment.trans.y_position - obj->segment.trans.y_position; diffZ = temp_s1->segment.trans.z_position - obj->segment.trans.z_position; if (sqrtf((diffX * diffX) + (diffY * diffY) + (diffZ * diffZ)) < (f32) ((s8) temp_s2->animation.x_rotation & 0xFF) * 4.0) { - if (temp_s1->unk78 == 0) { - temp_s1->unk78 = 1; + if (temp_s1->properties.racer.unk0 == 0) { + temp_s1->properties.racer.unk0 = (Object *) 1; // ??? newObj = spawn_object(&spawnObj, 1); if (newObj != NULL) { - newObj->segment.unk3C_a.level_entry = NULL; + newObj->segment.level_entry = NULL; newObj->segment.x_velocity = obj->segment.x_velocity; newObj->segment.y_velocity = obj->segment.y_velocity; newObj->segment.z_velocity = obj->segment.z_velocity; - newObj->unk78_obj = temp_s1; - newObj->unk7C.word = (s8) temp_s2->animation.y_rotation * 60; + newObj->properties.racer.unk0 = temp_s1; + newObj->properties.racer.unk4 = (s8) temp_s2->animation.y_rotation * 60; newObj->segment.animFrame = get_random_number_from_range(0, 255); play_sound_at_position(arg4, newObj->segment.trans.x_position, newObj->segment.trans.y_position, newObj->segment.trans.z_position, 4, NULL); } } } else { - temp_s1->unk78 = 0; + temp_s1->properties.racer.unk0 = 0; } } } diff --git a/src/vehicle_tricky.c b/src/vehicle_tricky.c index ff05ab5c..7f55e980 100644 --- a/src/vehicle_tricky.c +++ b/src/vehicle_tricky.c @@ -79,7 +79,7 @@ void update_tricky(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r set_boss_voice_clip_offset(D_800DCDE0); *buttonsPressed &= ~R_TRIG; *input &= ~R_TRIG; - sp56 = obj->segment.unk38.byte.unk3B; + sp56 = obj->segment.object.animationID; sp54 = obj->segment.animFrame; sp52 = racer->headAngle; if (racer->raceFinished == TRUE) { @@ -108,11 +108,11 @@ void update_tricky(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r *startTimer = tempStartTimer; racer->lateral_velocity = 0.0f; racer->headAngle = sp52; - obj->segment.unk38.byte.unk3B = sp56; + obj->segment.object.animationID = sp56; obj->segment.animFrame = sp54; - if ((racer->attackType != ATTACK_NONE) && (obj->segment.unk38.byte.unk3B != 3)) { - racer->unk1CD = obj->segment.unk38.byte.unk3B; - obj->segment.unk38.byte.unk3B = 3; + if ((racer->attackType != ATTACK_NONE) && (obj->segment.object.animationID != 3)) { + racer->unk1CD = obj->segment.object.animationID; + obj->segment.object.animationID = 3; obj->segment.y_velocity += 7.5; func_8005CB04(1); play_sound_global(SOUND_EXPLOSION, NULL); @@ -128,16 +128,16 @@ void update_tricky(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r } obj68 = *obj->unk68; objModel = obj68->objModel; - diffX = (objModel->animations[obj->segment.unk38.byte.unk3B].unk4 * 16) - 17; - if (obj->segment.unk38.byte.unk3B != 3) { + diffX = (objModel->animations[obj->segment.object.animationID].unk4 * 16) - 17; + if (obj->segment.object.animationID != 3) { if (racer->velocity < -2.0) { - obj->segment.unk38.byte.unk3B = 1; + obj->segment.object.animationID = 1; racer->unkC -= (racer->velocity * updateRateF) * 0.5; } else if ((racer->velocity < -0.1) || (racer->velocity > 0.1)) { - obj->segment.unk38.byte.unk3B = 2; + obj->segment.object.animationID = 2; racer->unkC -= (racer->velocity * updateRateF) * 2; } else { - obj->segment.unk38.byte.unk3B = 0; + obj->segment.object.animationID = 0; racer->unkC += 1.0 * updateRateF; } } else { @@ -151,19 +151,19 @@ void update_tricky(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r racer->unkC -= diffX; obj68->unk10 = -1; } - if (obj68->unk10 == -1 && obj->segment.unk38.byte.unk3B == 3) { - obj->segment.unk38.byte.unk3B = racer->unk1CD; + if (obj68->unk10 == -1 && obj->segment.object.animationID == 3) { + obj->segment.object.animationID = racer->unk1CD; } sp54 = obj->segment.animFrame; obj->segment.animFrame = racer->unkC; obj->unk74 = 0; - if (obj->segment.unk38.byte.unk3B == 1) { + if (obj->segment.object.animationID == 1) { func_800113CC(obj, 2, sp54, SOUND_STOMP2, SOUND_STOMP3); obj->unk74 |= 3; } func_800AFC3C(obj, updateRate); fade_when_near_camera(obj, racer, 120); - switch( obj->segment.unk38.byte.unk3B) { + switch( obj->segment.object.animationID) { case 1: sp38 = 0x2500; break; @@ -183,7 +183,7 @@ void update_tricky(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r CLAMP(tempStartTimer, -sp38, sp38); racer->headAngleTarget = tempStartTimer; } - if (obj->segment.unk38.byte.unk3B == 1) { + if (obj->segment.object.animationID == 1) { if ((racer->miscAnimCounter & 0x1F) < 0xA) { racer->headAngleTarget >>= 1; } @@ -198,7 +198,7 @@ void update_tricky(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r } func_8006F140(1); } - if (obj == firstRacerObj->interactObj->obj && firstRacerObj->interactObj->flags & INTERACT_FLAGS_PUSHING && obj->segment.unk38.byte.unk3B == 1) { + if (obj == firstRacerObj->interactObj->obj && firstRacerObj->interactObj->flags & INTERACT_FLAGS_PUSHING && obj->segment.object.animationID == 1) { racer->attackType = ATTACK_SQUISHED; } if (racer->raceFinished != FALSE) { @@ -380,7 +380,7 @@ void fade_when_near_camera(Object *object, Object_Racer *racer, s32 distance) { Object *player = get_racer_object(0); racer->transparency = 255; if (!func_8001139C()) { - if ((object->segment.unk30 + distance) < player->segment.unk30) { + if ((object->segment.object.distanceToCamera + distance) < player->segment.object.distanceToCamera) { racer->transparency = 64; } } diff --git a/src/vehicle_wizpig.c b/src/vehicle_wizpig.c index 8eb1ac76..accbc077 100644 --- a/src/vehicle_wizpig.c +++ b/src/vehicle_wizpig.c @@ -56,7 +56,7 @@ void update_wizpig(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r set_boss_voice_clip_offset((u16* ) D_800DCE60); racer->unk1EC = 0; - sp3E = obj->segment.unk38.byte.unk3B; + sp3E = obj->segment.object.animationID; sp3C = obj->segment.animFrame; sp3A = racer->headAngle; if (racer->velocity < 0.3 && -0.3 < racer->velocity) { @@ -93,13 +93,13 @@ void update_wizpig(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r *startTimer = sp28; obj->unk74 = 0; racer->headAngle = sp3A; - obj->segment.unk38.byte.unk3B = sp3E; + obj->segment.object.animationID = sp3E; obj->segment.animFrame = sp3C; - if (racer->attackType != 0 && obj->segment.unk38.byte.unk3B != 5) { + if (racer->attackType != 0 && obj->segment.object.animationID != 5) { func_8005CB04(1); play_sound_global(SOUND_EXPLOSION, NULL); set_camera_shake(12.0f); - obj->segment.unk38.byte.unk3B = 5; + obj->segment.object.animationID = 5; obj->segment.x_velocity *= 0.4; obj->segment.z_velocity *= 0.4; racer->unkC = 0.0f; @@ -125,7 +125,7 @@ void update_wizpig(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r racer->x_rotation_offset = -obj->segment.trans.x_rotation; gfxData = *obj->unk68; objModel = gfxData->objModel; - diffX = (objModel->animations[obj->segment.unk38.byte.unk3B].unk4 * 0x10) - 0x11; + diffX = (objModel->animations[obj->segment.object.animationID].unk4 * 0x10) - 0x11; var_f12 = (racer->velocity * updateRateF) * 0.45; if (var_f12 <= 0.0) { if (var_f12 > -2.0) { @@ -134,7 +134,7 @@ void update_wizpig(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r } else if (var_f12 < 2.0) { var_f12 = 2.0f; } - switch (obj->segment.unk38.byte.unk3B) { + switch (obj->segment.object.animationID) { case 0: racer->unk1CD = 0; racer->unkC += 1.0 * updateRateF; @@ -176,42 +176,42 @@ void update_wizpig(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r racer->unkC += diffX; gfxData->unk10 = -1; } - if (obj->segment.unk38.byte.unk3B == 2 && sp38 != 0) { - obj->segment.unk38.byte.unk3B = 3; + if (obj->segment.object.animationID == 2 && sp38 != 0) { + obj->segment.object.animationID = 3; racer->unkC = 0.0f; } - if (gfxData->unk10 == -1 || obj->segment.unk38.byte.unk3B == 0) { - if (obj->segment.unk38.byte.unk3B == 5) { - obj->segment.unk38.byte.unk3B = (s8) racer->unk1CD; + if (gfxData->unk10 == -1 || obj->segment.object.animationID == 0) { + if (obj->segment.object.animationID == 5) { + obj->segment.object.animationID = (s8) racer->unk1CD; racer->unkC = 0.0f; - } else if (obj->segment.unk38.byte.unk3B == 1) { + } else if (obj->segment.object.animationID == 1) { if (racer->unk1CD == 0) { - obj->segment.unk38.byte.unk3B = 2; + obj->segment.object.animationID = 2; } else { - obj->segment.unk38.byte.unk3B = 0; + obj->segment.object.animationID = 0; } - } else if (obj->segment.unk38.byte.unk3B == 3) { + } else if (obj->segment.object.animationID == 3) { if (racer->unk1CD == 4) { - obj->segment.unk38.byte.unk3B = 2; + obj->segment.object.animationID = 2; } else { - obj->segment.unk38.byte.unk3B = 4; + obj->segment.object.animationID = 4; } } else { if (-0.1 < racer->velocity && racer->velocity < 0.1) { - if (obj->segment.unk38.byte.unk3B == 2) { - obj->segment.unk38.byte.unk3B = 1; - racer->unkC = (objModel->animations[obj->segment.unk38.byte.unk3B].unk4 * 0x10) - 0x11; + if (obj->segment.object.animationID == 2) { + obj->segment.object.animationID = 1; + racer->unkC = (objModel->animations[obj->segment.object.animationID].unk4 * 0x10) - 0x11; } else { - obj->segment.unk38.byte.unk3B = 0; + obj->segment.object.animationID = 0; } } else { - if (obj->segment.unk38.byte.unk3B == 0) { - obj->segment.unk38.byte.unk3B = 1; + if (obj->segment.object.animationID == 0) { + obj->segment.object.animationID = 1; racer->unkC = 0.0f; } - if ((obj->segment.unk38.byte.unk3B == 4) && (sp38 == 0)) { - obj->segment.unk38.byte.unk3B = 3; - racer->unkC = (objModel->animations[obj->segment.unk38.byte.unk3B].unk4 * 0x10) - 0x11; + if ((obj->segment.object.animationID == 4) && (sp38 == 0)) { + obj->segment.object.animationID = 3; + racer->unkC = (objModel->animations[obj->segment.object.animationID].unk4 * 0x10) - 0x11; } } } @@ -219,7 +219,7 @@ void update_wizpig(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r sp3C = obj->segment.animFrame; obj->segment.animFrame = racer->unkC; obj->unk74 = 0; - if (obj->segment.unk38.byte.unk3B == 2) { + if (obj->segment.object.animationID == 2) { func_800113CC(obj, 2, sp3C, SOUND_STOMP2, SOUND_STOMP3); } if (racer->playerIndex == PLAYER_COMPUTER) { @@ -231,7 +231,7 @@ void update_wizpig(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r fade_when_near_camera(obj, racer, 0x28); firstRacerObj = get_racer_object(0); racer = (Object_Racer *) firstRacerObj->unk64; - if (obj == firstRacerObj->interactObj->obj && firstRacerObj->interactObj->flags & INTERACT_FLAGS_PUSHING && obj->segment.unk38.byte.unk3B == 1) { + if (obj == firstRacerObj->interactObj->obj && firstRacerObj->interactObj->flags & INTERACT_FLAGS_PUSHING && obj->segment.object.animationID == 1) { racer->attackType = ATTACK_SQUISHED; } if (racer->raceFinished) { diff --git a/src/waves.c b/src/waves.c index 929f7b57..fa643c95 100644 --- a/src/waves.c +++ b/src/waves.c @@ -349,7 +349,7 @@ void func_800BF524(Object *obj) { LevelObjectEntry800BF524 *temp_v0; s32 var_v1; - temp_v0 = (LevelObjectEntry800BF524 *) obj->segment.unk3C_a.level_entry; + temp_v0 = (LevelObjectEntry800BF524 *) obj->segment.level_entry; var_v1 = 0; if (temp_v0->unk10 != 0) { var_v1 = 1; @@ -421,7 +421,7 @@ void obj_loop_wavepower(Object *obj) { } } if (racerObj != NULL) { - entry = (LevelObjectEntry_WavePower *) obj->segment.unk3C_a.level_entry; + entry = (LevelObjectEntry_WavePower *) obj->segment.level_entry; distance = entry->radius; distance *= distance; diffX = racerObj->segment.trans.x_position - obj->segment.trans.x_position;