diff --git a/Makefile b/Makefile index 1f74791573..13667947ee 100644 --- a/Makefile +++ b/Makefile @@ -383,7 +383,7 @@ LEVEL_DIRS := $(patsubst levels/%,%,$(dir $(wildcard levels/*/header.h))) VNL_ACTRS_DIRS := $(patsubst actors/vanilla_actors/%,%,$(dir $(wildcard actors/vanilla_actors/*/header.h))) # Directories containing source files -SRC_DIRS += src src/boot src/game src/engine src/audio src/menu src/buffers actors levels bin data assets asm lib sound +SRC_DIRS += src src/boot src/game src/game/behaviors src/engine src/audio src/menu src/buffers actors levels bin data assets asm lib sound LIBZ_SRC_DIRS := src/libz GODDARD_SRC_DIRS := src/goddard src/goddard/dynlists BIN_DIRS := bin bin/$(VERSION) diff --git a/data/behavior_data.c b/data/behavior_data.c index bec8edb3b2..1e28c04372 100644 --- a/data/behavior_data.c +++ b/data/behavior_data.c @@ -7,7 +7,7 @@ #include "game/interaction.h" #include "game/behavior_actions.h" #include "game/mario_actions_cutscene.h" -#include "game/mario_misc.h" +#include "game/mario_geo.h" #include "game/object_helpers.h" #include "game/debug.h" #include "menu/file_select.h" diff --git a/include/geo_commands.h b/include/geo_commands.h index 56706cc7e8..bdc8da1ff9 100644 --- a/include/geo_commands.h +++ b/include/geo_commands.h @@ -7,7 +7,7 @@ #include "game/object_helpers.h" #include "game/behavior_actions.h" #include "game/segment2.h" -#include "game/mario_misc.h" +#include "game/mario_geo.h" #include "game/mario_actions_cutscene.h" // sky background params diff --git a/include/global_object_fields.h b/include/global_object_fields.h new file mode 100644 index 0000000000..dd7e254ec6 --- /dev/null +++ b/include/global_object_fields.h @@ -0,0 +1,429 @@ +#ifndef GLOBAL_OBJECT_FIELDS_H +#define GLOBAL_OBJECT_FIELDS_H + +/** + * The array [0x88, 0x1C8) in struct Object consists of fields that can vary by + * object type. These macros provide access to these fields. + */ + +#ifdef OBJECT_FIELDS_INDEX_DIRECTLY +#define OBJECT_FIELD_U32(index) index +#define OBJECT_FIELD_S32(index) index +#define OBJECT_FIELD_S16(index, subIndex) index +#define OBJECT_FIELD_F32(index) index +#define OBJECT_FIELD_S16P(index) index +#define OBJECT_FIELD_S32P(index) index +#define OBJECT_FIELD_ANIMS(index) index +#define OBJECT_FIELD_WAYPOINT(index) index +#define OBJECT_FIELD_CHAIN_SEGMENT(index) index +#define OBJECT_FIELD_OBJ(index) index +#define OBJECT_FIELD_SURFACE(index) index +#define OBJECT_FIELD_VPTR(index) index +#define OBJECT_FIELD_CVPTR(index) index +#else +#define OBJECT_FIELD_U32(index) rawData.asU32[index] +#define OBJECT_FIELD_S32(index) rawData.asS32[index] +#define OBJECT_FIELD_S16(index, subIndex) rawData.asS16[index][subIndex] +#define OBJECT_FIELD_F32(index) rawData.asF32[index] +#if !IS_64_BIT +#define OBJECT_FIELD_S16P(index) rawData.asS16P[index] +#define OBJECT_FIELD_S32P(index) rawData.asS32P[index] +#define OBJECT_FIELD_ANIMS(index) rawData.asAnims[index] +#define OBJECT_FIELD_WAYPOINT(index) rawData.asWaypoint[index] +#define OBJECT_FIELD_CHAIN_SEGMENT(index) rawData.asChainSegment[index] +#define OBJECT_FIELD_OBJ(index) rawData.asObject[index] +#define OBJECT_FIELD_SURFACE(index) rawData.asSurface[index] +#define OBJECT_FIELD_VPTR(index) rawData.asVoidPtr[index] +#define OBJECT_FIELD_CVPTR(index) rawData.asConstVoidPtr[index] +#else +#define OBJECT_FIELD_S16P(index) ptrData.asS16P[index] +#define OBJECT_FIELD_S32P(index) ptrData.asS32P[index] +#define OBJECT_FIELD_ANIMS(index) ptrData.asAnims[index] +#define OBJECT_FIELD_WAYPOINT(index) ptrData.asWaypoint[index] +#define OBJECT_FIELD_CHAIN_SEGMENT(index) ptrData.asChainSegment[index] +#define OBJECT_FIELD_OBJ(index) ptrData.asObject[index] +#define OBJECT_FIELD_SURFACE(index) ptrData.asSurface[index] +#define OBJECT_FIELD_VPTR(index) ptrData.asVoidPtr[index] +#define OBJECT_FIELD_CVPTR(index) ptrData.asConstVoidPtr[index] +#endif +#endif + +// 0x088 (0x00), the first field, is object-specific and defined below the common fields. +/* Common fields */ +#define /*0x08C*/ oFlags OBJECT_FIELD_U32(0x01) +#define /*0x090*/ oDialogResponse OBJECT_FIELD_S16(0x02, 0) +#define /*0x092*/ oDialogState OBJECT_FIELD_S16(0x02, 1) +#define /*0x094*/ oUnk94 OBJECT_FIELD_U32(0x03) +// 0x98 unused/removed. +#define /*0x09C*/ oIntangibleTimer OBJECT_FIELD_S32(0x05) +/* Position vector */ +#define /*0x0A0*/ O_POS_INDEX 0x06 +#define /*0x0A0*/ oPosVec OBJECT_FIELD_F32(O_POS_INDEX) +#define /*0x0A0*/ oPosX OBJECT_FIELD_F32(O_POS_INDEX + 0) +#define /*0x0A4*/ oPosY OBJECT_FIELD_F32(O_POS_INDEX + 1) +#define /*0x0A8*/ oPosZ OBJECT_FIELD_F32(O_POS_INDEX + 2) +/* Velocity vector */ +#define /*0x0AC*/ O_VEL_INDEX 0x09 +#define /*0x0AC*/ oVelVec OBJECT_FIELD_F32(O_VEL_INDEX) +#define /*0x0AC*/ oVelX OBJECT_FIELD_F32(O_VEL_INDEX + 0) +#define /*0x0B0*/ oVelY OBJECT_FIELD_F32(O_VEL_INDEX + 1) +#define /*0x0B4*/ oVelZ OBJECT_FIELD_F32(O_VEL_INDEX + 2) +/* Local Position vector */ +#define /*0x0B8*/ O_LOCAL_VEL_INDEX 0x0C +#define /*0x0B8*/ O_LOCAL_VEL_X_INDEX (O_LOCAL_VEL_INDEX + 0) // 0x0C +#define /*0x0BC*/ O_LOCAL_VEL_Y_INDEX (O_LOCAL_VEL_INDEX + 1) // 0x0D +#define /*0x0C0*/ O_LOCAL_VEL_Z_INDEX (O_LOCAL_VEL_INDEX + 2) // 0x0E +#define /*0x0B8*/ oLocalVelVec OBJECT_FIELD_F32(O_LOCAL_VEL_INDEX) +#define /*0x0B8*/ oLeftVel OBJECT_FIELD_F32(O_LOCAL_VEL_X_INDEX) +#define /*0x0BC*/ oUpVel OBJECT_FIELD_F32(O_LOCAL_VEL_Y_INDEX) +#define /*0x0C0*/ oForwardVel OBJECT_FIELD_F32(O_LOCAL_VEL_Z_INDEX) // moved +/* Move Angle vector */ +#define /*0x0C4*/ O_MOVE_ANGLE_INDEX 0x0F +#define /*0x0C4*/ O_MOVE_ANGLE_PITCH_INDEX (O_MOVE_ANGLE_INDEX + 0) // 0x0F +#define /*0x0C8*/ O_MOVE_ANGLE_YAW_INDEX (O_MOVE_ANGLE_INDEX + 1) // 0x10 +#define /*0x0CC*/ O_MOVE_ANGLE_ROLL_INDEX (O_MOVE_ANGLE_INDEX + 2) // 0x11 +#define /*0x0C4*/ oMoveAngleVec OBJECT_FIELD_S32(O_MOVE_ANGLE_INDEX) +#define /*0x0C4*/ oMoveAnglePitch OBJECT_FIELD_S32(O_MOVE_ANGLE_PITCH_INDEX) +#define /*0x0C8*/ oMoveAngleYaw OBJECT_FIELD_S32(O_MOVE_ANGLE_YAW_INDEX) +#define /*0x0CC*/ oMoveAngleRoll OBJECT_FIELD_S32(O_MOVE_ANGLE_ROLL_INDEX) +/* Face Angle vector */ +#define /*0x0D0*/ O_FACE_ANGLE_INDEX 0x12 +#define /*0x0D0*/ O_FACE_ANGLE_PITCH_INDEX (O_FACE_ANGLE_INDEX + 0) // 0x12 +#define /*0x0D4*/ O_FACE_ANGLE_YAW_INDEX (O_FACE_ANGLE_INDEX + 1) // 0x13 +#define /*0x0D8*/ O_FACE_ANGLE_ROLL_INDEX (O_FACE_ANGLE_INDEX + 2) // 0x14 +#define /*0x0D0*/ oFaceAngleVec OBJECT_FIELD_S32(O_FACE_ANGLE_INDEX) +#define /*0x0D0*/ oFaceAnglePitch OBJECT_FIELD_S32(O_FACE_ANGLE_PITCH_INDEX) +#define /*0x0D4*/ oFaceAngleYaw OBJECT_FIELD_S32(O_FACE_ANGLE_YAW_INDEX) +#define /*0x0D8*/ oFaceAngleRoll OBJECT_FIELD_S32(O_FACE_ANGLE_ROLL_INDEX) +/* Common fields */ +#define /*0x0DC*/ oGraphYOffset OBJECT_FIELD_F32(0x15) +#define /*0x0E0*/ oActiveParticleFlags OBJECT_FIELD_U32(0x16) +#define /*0x0E4*/ oGravity OBJECT_FIELD_F32(0x17) +#define /*0x0E8*/ oFloorHeight OBJECT_FIELD_F32(0x18) +#define /*0x0EC*/ oMoveFlags OBJECT_FIELD_U32(0x19) +#define /*0x0F0*/ oAnimState OBJECT_FIELD_S32(0x1A) +// 0x0F4-0x110 (0x1B-0x22) are object specific and defined below the common fields. +/* Angle Velocity vector */ +#define /*0x114*/ O_ANGLE_VEL_INDEX 0x23 +#define /*0x114*/ O_ANGLE_VEL_PITCH_INDEX (O_ANGLE_VEL_INDEX + 0) // 0x23 +#define /*0x118*/ O_ANGLE_VEL_YAW_INDEX (O_ANGLE_VEL_INDEX + 1) // 0x24 +#define /*0x11C*/ O_ANGLE_VEL_ROLL_INDEX (O_ANGLE_VEL_INDEX + 2) // 0x25 +#define /*0x114*/ oAngleVelVec OBJECT_FIELD_S32(O_ANGLE_VEL_INDEX) +#define /*0x114*/ oAngleVelPitch OBJECT_FIELD_S32(O_ANGLE_VEL_PITCH_INDEX) +#define /*0x118*/ oAngleVelYaw OBJECT_FIELD_S32(O_ANGLE_VEL_YAW_INDEX) +#define /*0x11C*/ oAngleVelRoll OBJECT_FIELD_S32(O_ANGLE_VEL_ROLL_INDEX) +/* Common fields */ +#define /*0x120*/ oAnimations OBJECT_FIELD_ANIMS(0x26) +#define /*0x124*/ oHeldState OBJECT_FIELD_U32(0x27) +#define /*0x128*/ oWallHitboxRadius OBJECT_FIELD_F32(0x28) +#define /*0x12C*/ oDragStrength OBJECT_FIELD_F32(0x29) +#define /*0x130*/ oInteractType OBJECT_FIELD_U32(0x2A) +#define /*0x134*/ oInteractStatus OBJECT_FIELD_S32(0x2B) +/* Parent Relative Position vector */ +#define /*0x138*/ O_PARENT_RELATIVE_POS_INDEX 0x2C +#define /*0x138*/ O_PARENT_RELATIVE_POS_X_INDEX (O_PARENT_RELATIVE_POS_INDEX + 0) // 0x2C +#define /*0x13C*/ O_PARENT_RELATIVE_POS_Y_INDEX (O_PARENT_RELATIVE_POS_INDEX + 1) // 0x2D +#define /*0x140*/ O_PARENT_RELATIVE_POS_Z_INDEX (O_PARENT_RELATIVE_POS_INDEX + 2) // 0x2E +#define /*0x138*/ oParentRelativePosVec OBJECT_FIELD_F32(O_PARENT_RELATIVE_POS_INDEX) +#define /*0x138*/ oParentRelativePosX OBJECT_FIELD_F32(O_PARENT_RELATIVE_POS_X_INDEX) +#define /*0x13C*/ oParentRelativePosY OBJECT_FIELD_F32(O_PARENT_RELATIVE_POS_Y_INDEX) +#define /*0x140*/ oParentRelativePosZ OBJECT_FIELD_F32(O_PARENT_RELATIVE_POS_Z_INDEX) +/* Common fields */ +#define /*0x144*/ oBehParams2ndByte OBJECT_FIELD_S32(0x2F) +// 0x148 unused, possibly a third param byte. +#define /*0x14C*/ oAction OBJECT_FIELD_S32(0x31) +#define /*0x150*/ oSubAction OBJECT_FIELD_S32(0x32) +#define /*0x154*/ oTimer OBJECT_FIELD_S32(0x33) +#define /*0x158*/ oBounciness OBJECT_FIELD_F32(0x34) +#define /*0x15C*/ oDistanceToMario OBJECT_FIELD_F32(0x35) +#define /*0x160*/ oAngleToMario OBJECT_FIELD_S32(0x36) +/* Home Position vector */ +#define /*0x164*/ O_HOME_INDEX 0x37 +#define /*0x164*/ O_HOME_X_INDEX (O_HOME_INDEX + 0) // 0x37 +#define /*0x168*/ O_HOME_Y_INDEX (O_HOME_INDEX + 1) // 0x38 +#define /*0x16C*/ O_HOME_Z_INDEX (O_HOME_INDEX + 2) // 0x39 +#define /*0x164*/ oHomeVec OBJECT_FIELD_F32(O_HOME_INDEX) +#define /*0x164*/ oHomeX OBJECT_FIELD_F32(O_HOME_X_INDEX) +#define /*0x168*/ oHomeY OBJECT_FIELD_F32(O_HOME_Y_INDEX) +#define /*0x16C*/ oHomeZ OBJECT_FIELD_F32(O_HOME_Z_INDEX) +/* Common fields */ +#define /*0x170*/ oFriction OBJECT_FIELD_F32(0x3A) +#define /*0x174*/ oBuoyancy OBJECT_FIELD_F32(0x3B) +#define /*0x178*/ oSoundStateID OBJECT_FIELD_S32(0x3C) +#define /*0x17C*/ oOpacity OBJECT_FIELD_S32(0x3D) +#define /*0x180*/ oDamageOrCoinValue OBJECT_FIELD_S32(0x3E) +#define /*0x184*/ oHealth OBJECT_FIELD_S32(0x3F) +#define /*0x188*/ oBehParams OBJECT_FIELD_U32(0x40) +#define /*0x18C*/ oPrevAction OBJECT_FIELD_S32(0x41) +#define /*0x190*/ oInteractionSubtype OBJECT_FIELD_U32(0x42) +#define /*0x194*/ oCollisionDistance OBJECT_FIELD_F32(0x43) +#define /*0x198*/ oNumLootCoins OBJECT_FIELD_S32(0x44) +#define /*0x19C*/ oDrawingDistance OBJECT_FIELD_F32(0x45) +#define /*0x1A0*/ oRoom OBJECT_FIELD_S32(0x46) +// 0x1A4 is unused, possibly related to 0x1A8 in removed macro purposes. +#define /*0x1A8*/ oUnusedCoinParams OBJECT_FIELD_U32(0x48) +// 0x1AC-0x1B2 (0x48-0x4A) are object specific and defined below the common fields. +#define /*0x1B4*/ oWallAngle OBJECT_FIELD_S32(0x4B) +#define /*0x1B8*/ oFloorType OBJECT_FIELD_S16(0x4C, 0) +#define /*0x1BA*/ oFloorRoom OBJECT_FIELD_S16(0x4C, 1) +#define /*0x1BC*/ oAngleToHome OBJECT_FIELD_S32(0x4D) +#define /*0x1C0*/ oFloor OBJECT_FIELD_SURFACE(0x4E) +#define /*0x1C4*/ oDeathSound OBJECT_FIELD_S32(0x4F) +#ifdef PUPPYLIGHTS +#define /*0x1C4*/ oLightID OBJECT_FIELD_S32(0x50) +#endif + +/* Pathed (see obj_follow_path) */ +#define /*0x0FC*/ oPathedStartWaypoint OBJECT_FIELD_WAYPOINT(0x1D) +#define /*0x100*/ oPathedPrevWaypoint OBJECT_FIELD_WAYPOINT(0x1E) +#define /*0x104*/ oPathedPrevWaypointFlags OBJECT_FIELD_S32(0x1F) +#define /*0x108*/ oPathedTargetPitch OBJECT_FIELD_S32(0x20) +#define /*0x10C*/ oPathedTargetYaw OBJECT_FIELD_S32(0x21) + +/* Special Object Macro */ +#define /*0x108*/ oMacroUnk108 OBJECT_FIELD_F32(0x20) +#define /*0x10C*/ oMacroUnk10C OBJECT_FIELD_F32(0x21) +#define /*0x110*/ oMacroUnk110 OBJECT_FIELD_F32(0x22) + +/** + * These are object-specific but used globally in code + **/ + +/* Mario */ +#define /*0x0F4*/ oMarioParticleFlags OBJECT_FIELD_S32(0x1B) +#define /*0x108*/ oMarioReadingSignDYaw OBJECT_FIELD_S32(0x20) +#define /*0x10C*/ oMarioCannonObjectYaw OBJECT_FIELD_S32(0x21) +#define /*0x10C*/ oMarioTornadoYawVel OBJECT_FIELD_S32(0x21) +#define /*0x10C*/ oMarioReadingSignDPosX OBJECT_FIELD_F32(0x21) +#define /*0x110*/ oMarioReadingSignDPosZ OBJECT_FIELD_F32(0x22) +#define /*0x110*/ oMarioPolePos OBJECT_FIELD_F32(0x22) +#define /*0x110*/ oMarioCannonInputYaw OBJECT_FIELD_S32(0x22) +#define /*0x110*/ oMarioTornadoPosY OBJECT_FIELD_F32(0x22) +#define /*0x110*/ oMarioWhirlpoolPosY OBJECT_FIELD_F32(0x22) +#define /*0x110*/ oMarioJumboStarCutscenePosZ OBJECT_FIELD_F32(0x22) +#define /*0x110*/ oMarioBurnTimer OBJECT_FIELD_S32(0x22) +#define /*0x110*/ oMarioLongJumpIsSlow OBJECT_FIELD_S32(0x22) +#define /*0x110*/ oMarioSteepJumpYaw OBJECT_FIELD_S32(0x22) +#define /*0x110*/ oMarioWalkingPitch OBJECT_FIELD_S32(0x22) + +/* Bowser */ +#define /*0x088*/ oBowserCamAct OBJECT_FIELD_S32(0x00) +#define /*0x0F4*/ oBowserStatus OBJECT_FIELD_S32(0x1B) + +/* Hoot */ +#define /*0x110*/ oHootMarioReleaseTime OBJECT_FIELD_S32(0x22) + +/* Orange Number */ +#define /*0x110*/ oOrangeNumberOffset OBJECT_FIELD_S32(0x22) + +/* Coin */ +#define /*0x110*/ oCoinBaseYVel OBJECT_FIELD_F32(0x22) + +/* Smoke */ +#define /*0x0F4*/ oSmokeTimer OBJECT_FIELD_S32(0x1B) + +/* Platform on Tracks */ +#define /*0x1B0*/ oPlatformOnTrackType OBJECT_FIELD_S16(0x4A, 0) + +/* Sound Effect */ +#define /*0x0F4*/ oSoundEffectBits OBJECT_FIELD_S32(0x1B) + +/* Boo */ +#define /*0x088*/ oBooDeathStatus OBJECT_FIELD_S32(0x00) + +/* Hidden Object */ +#define /*0x0F4*/ oHiddenObjectSwitchObj OBJECT_FIELD_OBJ(0x1B) + +/* Flame */ +#define /*0x0F4*/ oFlameScale OBJECT_FIELD_F32(0x1B) + +/* Hidden Star */ +// Secrets/Red Coins +#define /*0x0F4*/ oHiddenStarTriggerCounter OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oHiddenStarTriggerTotal OBJECT_FIELD_S32(0x1C) + +/* SL Walking Penguin */ +#define /*0x100*/ oSLWalkingPenguinWindCollisionXPos OBJECT_FIELD_F32(0x1E) +#define /*0x104*/ oSLWalkingPenguinWindCollisionZPos OBJECT_FIELD_F32(0x1F) + +/* Water Ring Spawner (Jet Stream Ring Spawner and Manta Ray) */ +#define /*0x1AC*/ oWaterRingSpawnerRingsCollected OBJECT_FIELD_S32(0x49) + +/* Water Objects */ +#define /*0x0F4*/ oWaterObjScaleXAngle OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oWaterObjScaleYAngle OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oWaterObjScaleXAngleVel OBJECT_FIELD_S32(0x1D) + +/* Water Ring Manager (Jet Stream Ring Spawner and Manta Ray Ring Manager) */ +#define /*0x0F4*/ oWaterRingMgrNextRingIndex OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oWaterRingMgrLastRingCollected OBJECT_FIELD_S32(0x1C) + +/* Flame */ +#define /*0x0F4*/ oFlameScale OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oFlameSpeedTimerOffset OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oFlameUnusedRand OBJECT_FIELD_F32(0x1D) + +/* Water Ring */ +#define /*0x110*/ oWaterRingIndex OBJECT_FIELD_S32(0x22) + +/* Evil Lakitu */ +#define /*0x0F4*/ oEnemyLakituNumSpinies OBJECT_FIELD_S32(0x1B) + +/* Ukiki Cage*/ +#define /*0x088*/ oUkikiCageNextAction OBJECT_FIELD_S32(0x00) + +/** + * These are object-specific but are used globally in behavior_data.c + **/ + +/* Bird Chirp Chirp */ +#define /*0x0F4*/ oCheepCheepSpawnerSpawnAmount OBJECT_FIELD_S32(0x1B) + +/* Big Boo */ +#define /*0x1AC*/ oBigBooNumMinionBoosKilled OBJECT_FIELD_S32(0x49) + +/* Bob-omb Buddy */ +#define /*0x0FC*/ oBobombBuddyRole OBJECT_FIELD_S32(0x1D) + +/* Wooden Post */ +#define /*0x0F4*/ oWoodenPostTotalMarioAngle OBJECT_FIELD_S32(0x1B) + +/* Bully (all variants) */ +#define /*0x0F4*/ oBullySubtype OBJECT_FIELD_S32(0x1B) + +/* Bowling Ball Spawner (Generic) */ +#define /*0x0FC*/ oBBallSpawnerPeriodMinus1 OBJECT_FIELD_S32(0x1D) + +/* Floating Platform */ +#define /*0x0FC*/ oFloatingPlatformHeightOffset OBJECT_FIELD_F32(0x1D) + +/* Koopa */ +#define /*0x0F4*/ oKoopaAgility OBJECT_FIELD_F32(0x1B) + +#ifdef FLOOMBAS +#define /*0x110*/ oIsFloomba OBJECT_FIELD_S32(0x22) +#endif + +/* Wiggler */ +#define /*0x0F4*/ oWigglerFallThroughFloorsHeight OBJECT_FIELD_F32(0x1B) + +/* TTC Rotating Solid */ +#define /*0x0F4*/ oTTCRotatingSolidNumTurns OBJECT_FIELD_S32(0x1B) + +/* TTC Pendulum */ +#define /*0x0F4*/ oTTCPendulumAccelDir OBJECT_FIELD_F32(0x1B) + +/* TTC Elevator */ +#define /*0x0F4*/ oTTCElevatorDir OBJECT_FIELD_F32(0x1B) + +/* Mr. Blizzard */ +#define /*0x0F4*/ oMrBlizzardScale OBJECT_FIELD_F32(0x1B) + +/* Snufit */ +#define /*0x0F4*/ oSnufitRecoil OBJECT_FIELD_S32(0x1B) + +/* DDD Pole */ +#define /*0x0F4*/ oDDDPoleVel OBJECT_FIELD_F32(0x1B) + +/* Triplet Butterfly */ +#define /*0x0F4*/ oTripletButterflyScale OBJECT_FIELD_F32(0x1B) + +/* End Birds, Intro Scene Bird Spawner */ +#define /*0x104*/ oEndBirdCutsceneVars9PointX OBJECT_FIELD_F32(0x1F) + +/** + * These are just wrong + **/ + +/* TODO: Not Small Piranha Flame */ +#define /*0x0F4*/ oSmallPiranhaFlameStartSpeed OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oSmallPiranhaFlameEndSpeed OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oSmallPiranhaFlameModel OBJECT_FIELD_S32(0x1D) +#define /*0x100*/ oSmallPiranhaFlameNextFlameTimer OBJECT_FIELD_S32(0x1E) +#define /*0x104*/ oSmallPiranhaFlameSpeed OBJECT_FIELD_F32(0x1F) + +/* TODO: Not King Bob-omb */ +#define /*0x088*/ oKingBobombHoldingMarioState OBJECT_FIELD_S32(0x00) + +/*Custom general defines: + +For general s32 ints, use o->oF4, oF8, oFC, o100, o104, o108, o10C, and o110 + +For floats, apply the prefix "oFloat" before the index. For object pointers, apply "oObj", and for surface pointers, apply "oSurf" + +Examples: o->oFloatF4, o->oSurf10C + +s16 variables are also supported, and using them effectly can double the number of available members. The full list of s16 defines is: + +os16F4 +os16F6 +os16F8 +os16FA +os16FC +os16FE +os16100 +os16102 +os16104 +os16106 +os16108 +os1610A +os1610C +os1610E +os16110 +os16112*/ + +#define /*0x0F4*/ oF4 OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oF8 OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oFC OBJECT_FIELD_S32(0x1D) +#define /*0x100*/ o100 OBJECT_FIELD_S32(0x1E) +#define /*0x104*/ o104 OBJECT_FIELD_S32(0x1F) +#define /*0x108*/ o108 OBJECT_FIELD_S32(0x20) +#define /*0x10C*/ o10C OBJECT_FIELD_S32(0x21) +#define /*0x110*/ o110 OBJECT_FIELD_S32(0x22) + +#define /*0x0F4*/ oFloatF4 OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oFloatF8 OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oFloatFC OBJECT_FIELD_F32(0x1D) +#define /*0x100*/ oFloat100 OBJECT_FIELD_F32(0x1E) +#define /*0x104*/ oFloat104 OBJECT_FIELD_F32(0x1F) +#define /*0x108*/ oFloat108 OBJECT_FIELD_F32(0x20) +#define /*0x10C*/ oFloat10C OBJECT_FIELD_F32(0x21) +#define /*0x110*/ oFloat110 OBJECT_FIELD_F32(0x22) + +#define /*0x0F4*/ oObjF4 OBJECT_FIELD_OBJ(0x1B) +#define /*0x0F8*/ oObjF8 OBJECT_FIELD_OBJ(0x1C) +#define /*0x0FC*/ oObjFC OBJECT_FIELD_OBJ(0x1D) +#define /*0x100*/ oObj100 OBJECT_FIELD_OBJ(0x1E) +#define /*0x104*/ oObj104 OBJECT_FIELD_OBJ(0x1F) +#define /*0x108*/ oObj108 OBJECT_FIELD_OBJ(0x20) +#define /*0x10C*/ oObj10C OBJECT_FIELD_OBJ(0x21) +#define /*0x110*/ oObj110 OBJECT_FIELD_OBJ(0x22) + +#define /*0x0F4*/ oSurfF4 OBJECT_FIELD_SURFACE(0x1B) +#define /*0x0F8*/ oSurfF8 OBJECT_FIELD_SURFACE(0x1C) +#define /*0x0FC*/ oSurfFC OBJECT_FIELD_SURFACE(0x1D) +#define /*0x100*/ oSurf100 OBJECT_FIELD_SURFACE(0x1E) +#define /*0x104*/ oSurf104 OBJECT_FIELD_SURFACE(0x1F) +#define /*0x108*/ oSurf108 OBJECT_FIELD_SURFACE(0x20) +#define /*0x10C*/ oSurf10C OBJECT_FIELD_SURFACE(0x21) +#define /*0x110*/ oSurf110 OBJECT_FIELD_SURFACE(0x22) + +#define /*0x0F4*/ os16F4 OBJECT_FIELD_S16(0x1B, 0) +#define /*0x0F6*/ os16F6 OBJECT_FIELD_S16(0x1B, 1) +#define /*0x0F8*/ os16F8 OBJECT_FIELD_S16(0x1C, 0) +#define /*0x0FA*/ os16FA OBJECT_FIELD_S16(0x1C, 1) +#define /*0x0FC*/ os16FC OBJECT_FIELD_S16(0x1D, 0) +#define /*0x0FE*/ os16FE OBJECT_FIELD_S16(0x1D, 1) +#define /*0x100*/ os16100 OBJECT_FIELD_S16(0x1E, 0) +#define /*0x102*/ os16102 OBJECT_FIELD_S16(0x1E, 1) +#define /*0x104*/ os16104 OBJECT_FIELD_S16(0x1F, 0) +#define /*0x106*/ os16106 OBJECT_FIELD_S16(0x1F, 1) +#define /*0x108*/ os16108 OBJECT_FIELD_S16(0x20, 0) +#define /*0x10A*/ os1610A OBJECT_FIELD_S16(0x20, 1) +#define /*0x10C*/ os1610C OBJECT_FIELD_S16(0x21, 0) +#define /*0x10E*/ os1610E OBJECT_FIELD_S16(0x21, 1) +#define /*0x110*/ os16110 OBJECT_FIELD_S16(0x22, 0) +#define /*0x112*/ os16112 OBJECT_FIELD_S16(0x22, 1) + + +#endif // GLOBAL_OBJECT_FIELDS_H diff --git a/include/object_fields.h b/include/object_fields.h deleted file mode 100644 index 49af1a168b..0000000000 --- a/include/object_fields.h +++ /dev/null @@ -1,1335 +0,0 @@ -#ifndef OBJECT_FIELDS_H -#define OBJECT_FIELDS_H - -/** - * The array [0x88, 0x1C8) in struct Object consists of fields that can vary by - * object type. These macros provide access to these fields. - */ - -#ifdef OBJECT_FIELDS_INDEX_DIRECTLY -#define OBJECT_FIELD_U32(index) index -#define OBJECT_FIELD_S32(index) index -#define OBJECT_FIELD_S16(index, subIndex) index -#define OBJECT_FIELD_F32(index) index -#define OBJECT_FIELD_S16P(index) index -#define OBJECT_FIELD_S32P(index) index -#define OBJECT_FIELD_ANIMS(index) index -#define OBJECT_FIELD_WAYPOINT(index) index -#define OBJECT_FIELD_CHAIN_SEGMENT(index) index -#define OBJECT_FIELD_OBJ(index) index -#define OBJECT_FIELD_SURFACE(index) index -#define OBJECT_FIELD_VPTR(index) index -#define OBJECT_FIELD_CVPTR(index) index -#else -#define OBJECT_FIELD_U32(index) rawData.asU32[index] -#define OBJECT_FIELD_S32(index) rawData.asS32[index] -#define OBJECT_FIELD_S16(index, subIndex) rawData.asS16[index][subIndex] -#define OBJECT_FIELD_F32(index) rawData.asF32[index] -#if !IS_64_BIT -#define OBJECT_FIELD_S16P(index) rawData.asS16P[index] -#define OBJECT_FIELD_S32P(index) rawData.asS32P[index] -#define OBJECT_FIELD_ANIMS(index) rawData.asAnims[index] -#define OBJECT_FIELD_WAYPOINT(index) rawData.asWaypoint[index] -#define OBJECT_FIELD_CHAIN_SEGMENT(index) rawData.asChainSegment[index] -#define OBJECT_FIELD_OBJ(index) rawData.asObject[index] -#define OBJECT_FIELD_SURFACE(index) rawData.asSurface[index] -#define OBJECT_FIELD_VPTR(index) rawData.asVoidPtr[index] -#define OBJECT_FIELD_CVPTR(index) rawData.asConstVoidPtr[index] -#else -#define OBJECT_FIELD_S16P(index) ptrData.asS16P[index] -#define OBJECT_FIELD_S32P(index) ptrData.asS32P[index] -#define OBJECT_FIELD_ANIMS(index) ptrData.asAnims[index] -#define OBJECT_FIELD_WAYPOINT(index) ptrData.asWaypoint[index] -#define OBJECT_FIELD_CHAIN_SEGMENT(index) ptrData.asChainSegment[index] -#define OBJECT_FIELD_OBJ(index) ptrData.asObject[index] -#define OBJECT_FIELD_SURFACE(index) ptrData.asSurface[index] -#define OBJECT_FIELD_VPTR(index) ptrData.asVoidPtr[index] -#define OBJECT_FIELD_CVPTR(index) ptrData.asConstVoidPtr[index] -#endif -#endif - -// 0x088 (0x00), the first field, is object-specific and defined below the common fields. -/* Common fields */ -#define /*0x08C*/ oFlags OBJECT_FIELD_U32(0x01) -#define /*0x090*/ oDialogResponse OBJECT_FIELD_S16(0x02, 0) -#define /*0x092*/ oDialogState OBJECT_FIELD_S16(0x02, 1) -#define /*0x094*/ oUnk94 OBJECT_FIELD_U32(0x03) -// 0x98 unused/removed. -#define /*0x09C*/ oIntangibleTimer OBJECT_FIELD_S32(0x05) -/* Position vector */ -#define /*0x0A0*/ O_POS_INDEX 0x06 -#define /*0x0A0*/ oPosVec OBJECT_FIELD_F32(O_POS_INDEX) -#define /*0x0A0*/ oPosX OBJECT_FIELD_F32(O_POS_INDEX + 0) -#define /*0x0A4*/ oPosY OBJECT_FIELD_F32(O_POS_INDEX + 1) -#define /*0x0A8*/ oPosZ OBJECT_FIELD_F32(O_POS_INDEX + 2) -/* Velocity vector */ -#define /*0x0AC*/ O_VEL_INDEX 0x09 -#define /*0x0AC*/ oVelVec OBJECT_FIELD_F32(O_VEL_INDEX) -#define /*0x0AC*/ oVelX OBJECT_FIELD_F32(O_VEL_INDEX + 0) -#define /*0x0B0*/ oVelY OBJECT_FIELD_F32(O_VEL_INDEX + 1) -#define /*0x0B4*/ oVelZ OBJECT_FIELD_F32(O_VEL_INDEX + 2) -/* Local Position vector */ -#define /*0x0B8*/ O_LOCAL_VEL_INDEX 0x0C -#define /*0x0B8*/ O_LOCAL_VEL_X_INDEX (O_LOCAL_VEL_INDEX + 0) // 0x0C -#define /*0x0BC*/ O_LOCAL_VEL_Y_INDEX (O_LOCAL_VEL_INDEX + 1) // 0x0D -#define /*0x0C0*/ O_LOCAL_VEL_Z_INDEX (O_LOCAL_VEL_INDEX + 2) // 0x0E -#define /*0x0B8*/ oLocalVelVec OBJECT_FIELD_F32(O_LOCAL_VEL_INDEX) -#define /*0x0B8*/ oLeftVel OBJECT_FIELD_F32(O_LOCAL_VEL_X_INDEX) -#define /*0x0BC*/ oUpVel OBJECT_FIELD_F32(O_LOCAL_VEL_Y_INDEX) -#define /*0x0C0*/ oForwardVel OBJECT_FIELD_F32(O_LOCAL_VEL_Z_INDEX) // moved -/* Move Angle vector */ -#define /*0x0C4*/ O_MOVE_ANGLE_INDEX 0x0F -#define /*0x0C4*/ O_MOVE_ANGLE_PITCH_INDEX (O_MOVE_ANGLE_INDEX + 0) // 0x0F -#define /*0x0C8*/ O_MOVE_ANGLE_YAW_INDEX (O_MOVE_ANGLE_INDEX + 1) // 0x10 -#define /*0x0CC*/ O_MOVE_ANGLE_ROLL_INDEX (O_MOVE_ANGLE_INDEX + 2) // 0x11 -#define /*0x0C4*/ oMoveAngleVec OBJECT_FIELD_S32(O_MOVE_ANGLE_INDEX) -#define /*0x0C4*/ oMoveAnglePitch OBJECT_FIELD_S32(O_MOVE_ANGLE_PITCH_INDEX) -#define /*0x0C8*/ oMoveAngleYaw OBJECT_FIELD_S32(O_MOVE_ANGLE_YAW_INDEX) -#define /*0x0CC*/ oMoveAngleRoll OBJECT_FIELD_S32(O_MOVE_ANGLE_ROLL_INDEX) -/* Face Angle vector */ -#define /*0x0D0*/ O_FACE_ANGLE_INDEX 0x12 -#define /*0x0D0*/ O_FACE_ANGLE_PITCH_INDEX (O_FACE_ANGLE_INDEX + 0) // 0x12 -#define /*0x0D4*/ O_FACE_ANGLE_YAW_INDEX (O_FACE_ANGLE_INDEX + 1) // 0x13 -#define /*0x0D8*/ O_FACE_ANGLE_ROLL_INDEX (O_FACE_ANGLE_INDEX + 2) // 0x14 -#define /*0x0D0*/ oFaceAngleVec OBJECT_FIELD_S32(O_FACE_ANGLE_INDEX) -#define /*0x0D0*/ oFaceAnglePitch OBJECT_FIELD_S32(O_FACE_ANGLE_PITCH_INDEX) -#define /*0x0D4*/ oFaceAngleYaw OBJECT_FIELD_S32(O_FACE_ANGLE_YAW_INDEX) -#define /*0x0D8*/ oFaceAngleRoll OBJECT_FIELD_S32(O_FACE_ANGLE_ROLL_INDEX) -/* Common fields */ -#define /*0x0DC*/ oGraphYOffset OBJECT_FIELD_F32(0x15) -#define /*0x0E0*/ oActiveParticleFlags OBJECT_FIELD_U32(0x16) -#define /*0x0E4*/ oGravity OBJECT_FIELD_F32(0x17) -#define /*0x0E8*/ oFloorHeight OBJECT_FIELD_F32(0x18) -#define /*0x0EC*/ oMoveFlags OBJECT_FIELD_U32(0x19) -#define /*0x0F0*/ oAnimState OBJECT_FIELD_S32(0x1A) -// 0x0F4-0x110 (0x1B-0x22) are object specific and defined below the common fields. -/* Angle Velocity vector */ -#define /*0x114*/ O_ANGLE_VEL_INDEX 0x23 -#define /*0x114*/ O_ANGLE_VEL_PITCH_INDEX (O_ANGLE_VEL_INDEX + 0) // 0x23 -#define /*0x118*/ O_ANGLE_VEL_YAW_INDEX (O_ANGLE_VEL_INDEX + 1) // 0x24 -#define /*0x11C*/ O_ANGLE_VEL_ROLL_INDEX (O_ANGLE_VEL_INDEX + 2) // 0x25 -#define /*0x114*/ oAngleVelVec OBJECT_FIELD_S32(O_ANGLE_VEL_INDEX) -#define /*0x114*/ oAngleVelPitch OBJECT_FIELD_S32(O_ANGLE_VEL_PITCH_INDEX) -#define /*0x118*/ oAngleVelYaw OBJECT_FIELD_S32(O_ANGLE_VEL_YAW_INDEX) -#define /*0x11C*/ oAngleVelRoll OBJECT_FIELD_S32(O_ANGLE_VEL_ROLL_INDEX) -/* Common fields */ -#define /*0x120*/ oAnimations OBJECT_FIELD_ANIMS(0x26) -#define /*0x124*/ oHeldState OBJECT_FIELD_U32(0x27) -#define /*0x128*/ oWallHitboxRadius OBJECT_FIELD_F32(0x28) -#define /*0x12C*/ oDragStrength OBJECT_FIELD_F32(0x29) -#define /*0x130*/ oInteractType OBJECT_FIELD_U32(0x2A) -#define /*0x134*/ oInteractStatus OBJECT_FIELD_S32(0x2B) -/* Parent Relative Position vector */ -#define /*0x138*/ O_PARENT_RELATIVE_POS_INDEX 0x2C -#define /*0x138*/ O_PARENT_RELATIVE_POS_X_INDEX (O_PARENT_RELATIVE_POS_INDEX + 0) // 0x2C -#define /*0x13C*/ O_PARENT_RELATIVE_POS_Y_INDEX (O_PARENT_RELATIVE_POS_INDEX + 1) // 0x2D -#define /*0x140*/ O_PARENT_RELATIVE_POS_Z_INDEX (O_PARENT_RELATIVE_POS_INDEX + 2) // 0x2E -#define /*0x138*/ oParentRelativePosVec OBJECT_FIELD_F32(O_PARENT_RELATIVE_POS_INDEX) -#define /*0x138*/ oParentRelativePosX OBJECT_FIELD_F32(O_PARENT_RELATIVE_POS_X_INDEX) -#define /*0x13C*/ oParentRelativePosY OBJECT_FIELD_F32(O_PARENT_RELATIVE_POS_Y_INDEX) -#define /*0x140*/ oParentRelativePosZ OBJECT_FIELD_F32(O_PARENT_RELATIVE_POS_Z_INDEX) -/* Common fields */ -#define /*0x144*/ oBehParams2ndByte OBJECT_FIELD_S32(0x2F) -// 0x148 unused, possibly a third param byte. -#define /*0x14C*/ oAction OBJECT_FIELD_S32(0x31) -#define /*0x150*/ oSubAction OBJECT_FIELD_S32(0x32) -#define /*0x154*/ oTimer OBJECT_FIELD_S32(0x33) -#define /*0x158*/ oBounciness OBJECT_FIELD_F32(0x34) -#define /*0x15C*/ oDistanceToMario OBJECT_FIELD_F32(0x35) -#define /*0x160*/ oAngleToMario OBJECT_FIELD_S32(0x36) -/* Home Position vector */ -#define /*0x164*/ O_HOME_INDEX 0x37 -#define /*0x164*/ O_HOME_X_INDEX (O_HOME_INDEX + 0) // 0x37 -#define /*0x168*/ O_HOME_Y_INDEX (O_HOME_INDEX + 1) // 0x38 -#define /*0x16C*/ O_HOME_Z_INDEX (O_HOME_INDEX + 2) // 0x39 -#define /*0x164*/ oHomeVec OBJECT_FIELD_F32(O_HOME_INDEX) -#define /*0x164*/ oHomeX OBJECT_FIELD_F32(O_HOME_X_INDEX) -#define /*0x168*/ oHomeY OBJECT_FIELD_F32(O_HOME_Y_INDEX) -#define /*0x16C*/ oHomeZ OBJECT_FIELD_F32(O_HOME_Z_INDEX) -/* Common fields */ -#define /*0x170*/ oFriction OBJECT_FIELD_F32(0x3A) -#define /*0x174*/ oBuoyancy OBJECT_FIELD_F32(0x3B) -#define /*0x178*/ oSoundStateID OBJECT_FIELD_S32(0x3C) -#define /*0x17C*/ oOpacity OBJECT_FIELD_S32(0x3D) -#define /*0x180*/ oDamageOrCoinValue OBJECT_FIELD_S32(0x3E) -#define /*0x184*/ oHealth OBJECT_FIELD_S32(0x3F) -#define /*0x188*/ oBehParams OBJECT_FIELD_U32(0x40) -#define /*0x18C*/ oPrevAction OBJECT_FIELD_S32(0x41) -#define /*0x190*/ oInteractionSubtype OBJECT_FIELD_U32(0x42) -#define /*0x194*/ oCollisionDistance OBJECT_FIELD_F32(0x43) -#define /*0x198*/ oNumLootCoins OBJECT_FIELD_S32(0x44) -#define /*0x19C*/ oDrawingDistance OBJECT_FIELD_F32(0x45) -#define /*0x1A0*/ oRoom OBJECT_FIELD_S32(0x46) -// 0x1A4 is unused, possibly related to 0x1A8 in removed macro purposes. -#define /*0x1A8*/ oUnusedCoinParams OBJECT_FIELD_U32(0x48) -// 0x1AC-0x1B2 (0x48-0x4A) are object specific and defined below the common fields. -#define /*0x1B4*/ oWallAngle OBJECT_FIELD_S32(0x4B) -#define /*0x1B8*/ oFloorType OBJECT_FIELD_S16(0x4C, 0) -#define /*0x1BA*/ oFloorRoom OBJECT_FIELD_S16(0x4C, 1) -#define /*0x1BC*/ oAngleToHome OBJECT_FIELD_S32(0x4D) -#define /*0x1C0*/ oFloor OBJECT_FIELD_SURFACE(0x4E) -#define /*0x1C4*/ oDeathSound OBJECT_FIELD_S32(0x4F) - -/* Pathed (see obj_follow_path) */ -#define /*0x0FC*/ oPathedStartWaypoint OBJECT_FIELD_WAYPOINT(0x1D) -#define /*0x100*/ oPathedPrevWaypoint OBJECT_FIELD_WAYPOINT(0x1E) -#define /*0x104*/ oPathedPrevWaypointFlags OBJECT_FIELD_S32(0x1F) -#define /*0x108*/ oPathedTargetPitch OBJECT_FIELD_S32(0x20) -#define /*0x10C*/ oPathedTargetYaw OBJECT_FIELD_S32(0x21) - -/* Mario */ -#define /*0x0F4*/ oMarioParticleFlags OBJECT_FIELD_S32(0x1B) -#define /*0x108*/ oMarioReadingSignDYaw OBJECT_FIELD_S32(0x20) -#define /*0x10C*/ oMarioCannonObjectYaw OBJECT_FIELD_S32(0x21) -#define /*0x10C*/ oMarioTornadoYawVel OBJECT_FIELD_S32(0x21) -#define /*0x10C*/ oMarioReadingSignDPosX OBJECT_FIELD_F32(0x21) -#define /*0x110*/ oMarioPolePos OBJECT_FIELD_F32(0x22) -#define /*0x110*/ oMarioCannonInputYaw OBJECT_FIELD_S32(0x22) -#define /*0x110*/ oMarioTornadoPosY OBJECT_FIELD_F32(0x22) -#define /*0x110*/ oMarioReadingSignDPosZ OBJECT_FIELD_F32(0x22) -#define /*0x110*/ oMarioWhirlpoolPosY OBJECT_FIELD_F32(0x22) -#define /*0x110*/ oMarioJumboStarCutscenePosZ OBJECT_FIELD_F32(0x22) -#define /*0x110*/ oMarioBurnTimer OBJECT_FIELD_S32(0x22) -#define /*0x110*/ oMarioLongJumpIsSlow OBJECT_FIELD_S32(0x22) -#define /*0x110*/ oMarioSteepJumpYaw OBJECT_FIELD_S32(0x22) -#define /*0x110*/ oMarioWalkingPitch OBJECT_FIELD_S32(0x22) - -/* 1-Up Hidden */ -#define /*0x0F4*/ o1UpHiddenTimesTriggered OBJECT_FIELD_S32(0x1B) - -/* Activated Back and Forth Platform */ -#define /*0x0F4*/ oActivatedBackAndForthPlatformMaxOffset OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oActivatedBackAndForthPlatformOffset OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oActivatedBackAndForthPlatformVel OBJECT_FIELD_F32(0x1D) -#define /*0x100*/ oActivatedBackAndForthPlatformCountdown OBJECT_FIELD_S32(0x1E) -#define /*0x104*/ oActivatedBackAndForthPlatformStartYaw OBJECT_FIELD_S32(0x1F) -#define /*0x108*/ oActivatedBackAndForthPlatformVertical OBJECT_FIELD_S32(0x20) -#define /*0x10C*/ oActivatedBackAndForthPlatformFlipRotation OBJECT_FIELD_S32(0x21) - -/* Amp */ -#define /*0x0F4*/ oAmpRadiusOfRotation OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oAmpYPhase OBJECT_FIELD_S32(0x1C) - -/* Homing Amp */ -#define /*0x0F4*/ oHomingAmpLockedOn OBJECT_FIELD_S32(0x1B) -#define /*0x0FC*/ oHomingAmpAvgY OBJECT_FIELD_F32(0x1D) - -/* Arrow Lift */ -#define /*0x0F4*/ oArrowLiftDisplacement OBJECT_FIELD_F32(0x1B) - -/* Back-and-Forth Platform */ -#define /*0x0F4*/ oBackAndForthPlatformDirection OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oBackAndForthPlatformPathLength OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oBackAndForthPlatformDistance OBJECT_FIELD_F32(0x1D) -#define /*0x100*/ oBackAndForthPlatformVel OBJECT_FIELD_F32(0x1E) - -/* Bird */ -#define /*0x0F4*/ oBirdSpeed OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ O_BIRD_TARGET_ANGLE_INDEX 0x1C -#define /*0x0F8*/ O_BIRD_TARGET_PITCH_INDEX (O_BIRD_TARGET_ANGLE_INDEX + 0) // 0x1C -#define /*0x0FC*/ O_BIRD_TARGET_YAW_INDEX (O_BIRD_TARGET_ANGLE_INDEX + 1) // 0x1D -#define /*0x100*/ O_BIRD_TARGET_ROLL_INDEX (O_BIRD_TARGET_ANGLE_INDEX + 2) // 0x1E -#define /*0x0F8*/ oBirdTargetAngleVec OBJECT_FIELD_S32(O_BIRD_TARGET_ANGLE_INDEX) -#define /*0x0F8*/ oBirdTargetPitch OBJECT_FIELD_S32(O_BIRD_TARGET_PITCH_INDEX) -#define /*0x0FC*/ oBirdTargetYaw OBJECT_FIELD_S32(O_BIRD_TARGET_YAW_INDEX) -#define /*0x100*/ oBirdTargetRoll OBJECT_FIELD_S32(O_BIRD_TARGET_ROLL_INDEX) // unused - -/* Bird Chirp Chirp */ -#define /*0x0F4*/ oCheepCheepSpawnerSpawnAmount OBJECT_FIELD_S32(0x1B) - -/* End Birds */ -#define /*0x104*/ oEndBirdCutsceneVars9PointX OBJECT_FIELD_F32(0x1F) - -/* Hidden Blue Coin */ -#define /*0x0F8*/ oHiddenBlueCoinSwitch OBJECT_FIELD_OBJ(0x1C) - -/* Bob-omb */ -#define /*0x0F4*/ oBobombBlinkTimer OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oBobombFuseLit OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oBobombFuseTimer OBJECT_FIELD_S32(0x1D) - -/* Bob-omb Buddy */ -#define /*0x0F4*/ oBobombBuddyBlinkTimer OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oBobombBuddyHasTalkedToMario OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oBobombBuddyRole OBJECT_FIELD_S32(0x1D) -#define /*0x100*/ oBobombBuddyCannonStatus OBJECT_FIELD_S32(0x1E) -#define /*0x108*/ O_BOBOMB_BUDDY_POS_COPY_INDEX 0x20 -#define /*0x108*/ oBobombBuddyPosCopyVec OBJECT_FIELD_F32(O_BOBOMB_BUDDY_POS_COPY_INDEX) -#define /*0x108*/ oBobombBuddyPosXCopy OBJECT_FIELD_F32(O_BOBOMB_BUDDY_POS_COPY_INDEX + 0) -#define /*0x10C*/ oBobombBuddyPosYCopy OBJECT_FIELD_F32(O_BOBOMB_BUDDY_POS_COPY_INDEX + 1) -#define /*0x110*/ oBobombBuddyPosZCopy OBJECT_FIELD_F32(O_BOBOMB_BUDDY_POS_COPY_INDEX + 2) - -/* Bob-omb Explosion Bubble */ -#define /*0x0FC*/ oBobombExpBubGfxScaleFacX OBJECT_FIELD_S32(0x1D) -#define /*0x100*/ oBobombExpBubGfxScaleFacY OBJECT_FIELD_S32(0x1E) -#define /*0x104*/ oBobombExpBubGfxExpRateX OBJECT_FIELD_S32(0x1F) -#define /*0x108*/ oBobombExpBubGfxExpRateY OBJECT_FIELD_S32(0x20) - -/* Bomp (Small) */ -#define /*0x100*/ oSmallBompInitX OBJECT_FIELD_F32(0x1E) - -/* Boo */ -#define /*0x088*/ oBooDeathStatus OBJECT_FIELD_S32(0x00) -#define /*0x0F4*/ oBooTargetOpacity OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oBooBaseScale OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oBooOscillationTimer OBJECT_FIELD_S32(0x1D) -#define /*0x100*/ oBooMoveYawDuringHit OBJECT_FIELD_S32(0x1E) -#define /*0x104*/ oBooMoveYawBeforeHit OBJECT_FIELD_F32(0x1F) -#define /*0x108*/ oBooParentBigBoo OBJECT_FIELD_OBJ(0x20) -#define /*0x10C*/ oBooNegatedAggressiveness OBJECT_FIELD_F32(0x21) -#define /*0x110*/ oBooInitialMoveYaw OBJECT_FIELD_S32(0x22) -#define /*0x1B0*/ oBooTurningSpeed OBJECT_FIELD_S16(0x4A, 0) - -/* Big Boo */ -#define /*0x1AC*/ oBigBooNumMinionBoosKilled OBJECT_FIELD_S32(0x49) - -/* Bookend */ -#define /*0x0F4*/ oBookendTargetPitch OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oBookendTargetRoll OBJECT_FIELD_S32(0x1C) - -/* Book Switch */ -#define /*0x0F4*/ oBookSwitchDistFromHome OBJECT_FIELD_F32(0x1B) - -/* Book Switch Manager */ -#define /*0x0F4*/ oBookSwitchManagerNumCorrectChoices OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oBookSwitchManagerIsActive OBJECT_FIELD_S32(0x1C) - -/* Haunted Bookshelf */ -#define /*0x088*/ oHauntedBookshelfShouldOpen OBJECT_FIELD_S32(0x00) - -/* Bouncing FireBall */ -#define /*0x0F4*/ oBouncingFireBallSpawnerRandomCooldown OBJECT_FIELD_S32(0x1B) - -/* Bowling Ball */ -#define /*0x0F4*/ oBowlingBallTargetYaw OBJECT_FIELD_S32(0x1B) -// 0x1D-0x21 reserved for pathing - -/* Bowling Ball Spawner (Generic) */ -#define /*0x0F4*/ oBBallSpawnerMaxSpawnDist OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oBBallSpawnerSpawnOdds OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oBBallSpawnerPeriodMinus1 OBJECT_FIELD_S32(0x1D) - -/* Bowser */ -#define /*0x088*/ oBowserCamAct OBJECT_FIELD_S32(0x00) -#define /*0x0F4*/ oBowserStatus OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oBowserTimer OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oBowserDistToCenter OBJECT_FIELD_F32(0x1D) -#define /*0x106*/ oBowserBitsJustJump OBJECT_FIELD_S16(0x1F, 1) -#define /*0x108*/ oBowserRandSplitFloor OBJECT_FIELD_S16(0x20, 0) -#define /*0x10A*/ oBowserHeldAnglePitch OBJECT_FIELD_S16(0x20, 1) -#define /*0x10D*/ oBowserHeldAngleVelYaw OBJECT_FIELD_S16(0x21, 0) -#define /*0x10E*/ oBowserGrabbedStatus OBJECT_FIELD_S16(0x21, 1) -#define /*0x110*/ oBowserIsReacting OBJECT_FIELD_S16(0x22, 0) -#define /*0x112*/ oBowserAngleToCenter OBJECT_FIELD_S16(0x22, 1) -#define /*0x1AC*/ oBowserTargetOpacity OBJECT_FIELD_S16(0x49, 0) -#define /*0x1AE*/ oBowserEyesTimer OBJECT_FIELD_S16(0x49, 1) -#define /*0x1B0*/ oBowserEyesShut OBJECT_FIELD_S16(0x4A, 0) -#define /*0x1B2*/ oBowserRainbowLight OBJECT_FIELD_S16(0x4A, 1) - -/* Bowser Shockwave */ -#define /*0x0F4*/ oBowserShockWaveScale OBJECT_FIELD_F32(0x1B) - -/* Bowser Key Cutscene */ -#define /*0x0F4*/ oBowserKeyScale OBJECT_FIELD_F32(0x1B) - -/* Bowser Puzzle */ -#define /*0x0F4*/ oBowserPuzzleCompletionFlags OBJECT_FIELD_S32(0x1B) - -/* Bowser Puzzle Piece */ -#define /*0x0FC*/ O_BOWSER_PUZZLE_PIECE_OFFSET_INDEX 0x1D -#define /*0x0FC*/ O_BOWSER_PUZZLE_PIECE_OFFSET_X_INDEX (O_BOWSER_PUZZLE_PIECE_OFFSET_INDEX + 0) // 0x1D -#define /*0x100*/ O_BOWSER_PUZZLE_PIECE_OFFSET_Y_INDEX (O_BOWSER_PUZZLE_PIECE_OFFSET_INDEX + 1) // 0x1E -#define /*0x104*/ O_BOWSER_PUZZLE_PIECE_OFFSET_Z_INDEX (O_BOWSER_PUZZLE_PIECE_OFFSET_INDEX + 2) // 0x1F -#define /*0x0FC*/ oBowserPuzzlePieceOffsetVec OBJECT_FIELD_F32(O_BOWSER_PUZZLE_PIECE_OFFSET_INDEX) -#define /*0x0FC*/ oBowserPuzzlePieceOffsetX OBJECT_FIELD_F32(O_BOWSER_PUZZLE_PIECE_OFFSET_X_INDEX) -#define /*0x100*/ oBowserPuzzlePieceOffsetY OBJECT_FIELD_F32(O_BOWSER_PUZZLE_PIECE_OFFSET_Y_INDEX) -#define /*0x104*/ oBowserPuzzlePieceOffsetZ OBJECT_FIELD_F32(O_BOWSER_PUZZLE_PIECE_OFFSET_Z_INDEX) -#define /*0x108*/ oBowserPuzzlePieceContinuePerformingAction OBJECT_FIELD_S32(0x20) -#define /*0x10C*/ oBowserPuzzlePieceActionList OBJECT_FIELD_VPTR(0x21) -#define /*0x110*/ oBowserPuzzlePieceNextAction OBJECT_FIELD_VPTR(0x22) - -/* Bubba */ -#define /*0x0F4*/ oBubbaMovePitch OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oBubbaRandomTimer OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oBubbaHitWall OBJECT_FIELD_S32(0x1D) -#define /*0x100*/ oBubbaLungeTimer OBJECT_FIELD_S32(0x1E) -#define /*0x104*/ oBubbaNextTargetPitchTowardMario OBJECT_FIELD_S32(0x1F) -#define /*0x108*/ oBubbaAirVelY OBJECT_FIELD_F32(0x20) -#define /*0x10C*/ oBubbaJumpHeight OBJECT_FIELD_F32(0x21) -#define /*0x1AC*/ oBubbaTargetPitch OBJECT_FIELD_S16(0x49, 0) -#define /*0x1AE*/ oBubbaTargetYaw OBJECT_FIELD_S16(0x49, 1) -#define /*0x1B0*/ oBubbaPitchVel OBJECT_FIELD_S16(0x4A, 0) -#define /*0x1B2*/ oBubbaYawVel OBJECT_FIELD_S16(0x4A, 1) - -/* Bullet Bill */ -#define /*0x0F8*/ oBulletBillInitialMoveYaw OBJECT_FIELD_S32(0x1C) - -/* Bully (all variants) */ -#define /*0x0F4*/ oBullySubtype OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ O_BULLY_PREV_INDEX 0x1C -#define /*0x0F8*/ O_BULLY_PREV_X_INDEX (O_BULLY_PREV_INDEX + 0) // 0x1C -#define /*0x0FC*/ O_BULLY_PREV_Y_INDEX (O_BULLY_PREV_INDEX + 1) // 0x1D -#define /*0x100*/ O_BULLY_PREV_Z_INDEX (O_BULLY_PREV_INDEX + 2) // 0x1E -#define /*0x0F8*/ oBullyPrevVec OBJECT_FIELD_F32(O_BULLY_PREV_INDEX) -#define /*0x0F8*/ oBullyPrevX OBJECT_FIELD_F32(O_BULLY_PREV_X_INDEX) -#define /*0x0FC*/ oBullyPrevY OBJECT_FIELD_F32(O_BULLY_PREV_Y_INDEX) -#define /*0x100*/ oBullyPrevZ OBJECT_FIELD_F32(O_BULLY_PREV_Z_INDEX) -#define /*0x104*/ oBullyKBTimerAndMinionKOCounter OBJECT_FIELD_S32(0x1F) -#define /*0x108*/ oBullyMarioCollisionAngle OBJECT_FIELD_S32(0x20) - -/* Butterfly */ -#define /*0x0F4*/ oButterflyYPhase OBJECT_FIELD_S32(0x1B) - -/* Triplet Butterfly */ -#define /*0x0F4*/ oTripletButterflyScale OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oTripletButterflySpeed OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oTripletButterflyBaseYaw OBJECT_FIELD_F32(0x1D) -#define /*0x100*/ oTripletButterflyTargetPitch OBJECT_FIELD_S32(0x1E) -#define /*0x104*/ oTripletButterflyTargetYaw OBJECT_FIELD_S32(0x1F) -#define /*0x108*/ oTripletButterflyType OBJECT_FIELD_S32(0x20) -#define /*0x10C*/ oTripletButterflyModel OBJECT_FIELD_S32(0x21) -#define /*0x110*/ oTripletButterflySelectedButterfly OBJECT_FIELD_S32(0x22) -#define /*0x1AC*/ oTripletButterflyScalePhase OBJECT_FIELD_S32(0x49) - -/* Cannon */ -#define /*0x0F4*/ oCannonAngle OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oCannonTimeSinceActivated OBJECT_FIELD_S32(0x1C) -#define /*0x10C*/ oCannonIsActive OBJECT_FIELD_S32(0x21) - -/* Cap */ -#define /*0x0F4*/ oCapDoScaleVertically OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oCapScaleAngle OBJECT_FIELD_S32(0x1C) - -/* Chain Chomp */ -#define /*0x0F4*/ oChainChompSegments OBJECT_FIELD_CHAIN_SEGMENT(0x1B) -#define /*0x0F8*/ oChainChompMaxDistFromPivotPerChainPart OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oChainChompMaxDistBetweenChainParts OBJECT_FIELD_F32(0x1D) -#define /*0x100*/ oChainChompDistToPivot OBJECT_FIELD_F32(0x1E) -#define /*0x104*/ oChainChompSignedMaxDistBetweenChainParts OBJECT_FIELD_F32(0x1F) -#define /*0x108*/ oChainChompRestrictedByChain OBJECT_FIELD_S32(0x20) -#define /*0x10C*/ oChainChompTargetPitch OBJECT_FIELD_S32(0x21) -#define /*0x110*/ oChainChompNumLunges OBJECT_FIELD_S32(0x22) -#define /*0x1AC*/ oChainChompReleaseStatus OBJECT_FIELD_S32(0x49) -#define /*0x1B0*/ oChainChompHitGate OBJECT_FIELD_S32(0x4A) - -/* Checkerboard Platform */ -#define /*0x0F8*/ oCheckerBoardPlatformRotateAction OBJECT_FIELD_S32(0x1C) // oAction like -#define /*0x0FC*/ oCheckerBoardPlatformHeight OBJECT_FIELD_S32(0x1D) -#define /*0x1AC*/ oCheckerBoardPlatformRadius OBJECT_FIELD_F32(0x49) - -/* Cheep Cheep */ -#define /*0x0F4*/ oCheepCheepWaterLevel OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oCheepCheepTargetY OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oCheepCheepTargetYOffset OBJECT_FIELD_F32(0x1D) -#define /*0x104*/ oCheepCheepMaxYOffset OBJECT_FIELD_F32(0x1F) -#define /*0x108*/ oCheepCheepRandomSwimAway OBJECT_FIELD_F32(0x20) - -/* Chuckya */ -#define /*0x088*/ oCommonAnchorAction OBJECT_FIELD_S32(0x00) -#define /*0x0F8*/ oChuckyaUnused OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oChuckyaSubActionTimer OBJECT_FIELD_S32(0x1D) -#define /*0x100*/ oChuckyaNumPlayerEscapeActions OBJECT_FIELD_S32(0x1E) - -/* Clam */ -#define /*0x0F4*/ oClamShakeTimer OBJECT_FIELD_S32(0x1B) - -/* Cloud */ -#define /*0x0F4*/ oCloudCenterX OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oCloudCenterY OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oCloudBlowing OBJECT_FIELD_S32(0x1D) -#define /*0x100*/ oCloudGrowSpeed OBJECT_FIELD_F32(0x1E) -#define /*0x1AC*/ oCloudFwooshMovementRadius OBJECT_FIELD_S16(0x49, 0) - -/* Coin */ -#define /*0x0F4*/ oCoinRespawnBits OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oCoinSnapToGround OBJECT_FIELD_S32(0x1C) -#define /*0x110*/ oCoinBaseYVel OBJECT_FIELD_F32(0x22) -#define /*0x1B0*/ oCoinBounceTimer OBJECT_FIELD_S32(0x4A) - -/* Collision Particle */ -#define /*0x0F4*/ oCollisionParticleScale OBJECT_FIELD_F32(0x1B) - -/* Controllable Platform */ -#define /*0x0F8*/ oControllablePlatformWallHitDirection OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oControllablePlatformInitPosY OBJECT_FIELD_F32(0x1D) -#define /*0x100*/ oControllablePlatformIsFarFromMario OBJECT_FIELD_S32(0x1E) - -/* Breakable Box Small (Small Cork Box) */ -#define /*0x0F4*/ oBreakableBoxSmallReleased OBJECT_FIELD_S32(0x1B) -#define /*0x0FC*/ oBreakableBoxSmallFramesSinceReleased OBJECT_FIELD_S32(0x1D) - -/* Jumping Box (Crazy Box) */ -#define /*0x0F4*/ oJumpingBoxUnusedTimerMin OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oJumpingBoxRandomTimer OBJECT_FIELD_S32(0x1C) - -/* RR Cruiser Wing */ -#define /*0x0F4*/ oRRCruiserWingInitYaw OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oRRCruiserWingInitPitch OBJECT_FIELD_S32(0x1C) - -/* Donut Platform Spawner */ -#define /*0x0F4*/ oDonutPlatformSpawnerSpawnedPlatforms OBJECT_FIELD_S32(0x1B) - -/* Door */ -#define /*0x088*/ oDoorIsRendering OBJECT_FIELD_S32(0x00) -#define /*0x0F8*/ oDoorSelfRoom OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oDoorForwardRoom OBJECT_FIELD_S32(0x1D) -#define /*0x100*/ oDoorBackwardRoom OBJECT_FIELD_S32(0x1E) - -/* Dorrie */ -#define /*0x0F4*/ oDorrieDistToHome OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oDorrieOffsetY OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oDorrieVelY OBJECT_FIELD_F32(0x1D) -#define /*0x100*/ oDorrieForwardDistToMario OBJECT_FIELD_F32(0x1E) -#define /*0x104*/ oDorrieYawVel OBJECT_FIELD_S32(0x1F) -#define /*0x10C*/ oDorrieLiftingMario OBJECT_FIELD_S32(0x21) -#define /*0x1AC*/ oDorrieGroundPounded OBJECT_FIELD_S16(0x49, 0) -#define /*0x1AE*/ oDorrieAngleToHome OBJECT_FIELD_S16(0x49, 1) -#define /*0x1B0*/ oDorrieNeckAngle OBJECT_FIELD_S16(0x4A, 0) -#define /*0x1B2*/ oDorrieHeadRaiseSpeed OBJECT_FIELD_S16(0x4A, 1) - -/* Elevator */ -#define /*0x0F4*/ oElevatorMinY OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oElevatorMaxY OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oElevatorMidY OBJECT_FIELD_F32(0x1D) -#define /*0x100*/ oElevatorType OBJECT_FIELD_S32(0x1E) - -/* Exclamation Box */ -#define /*0x0F4*/ oExclamationBoxHorizontalScale OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oExclamationBoxVerticalScale OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oExclamationBoxScaleAngle OBJECT_FIELD_S32(0x1D) - -/* Eyerok Boss */ -#define /*0x0F8*/ oEyerokBossNumHands OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oEyerokBossAttackPhase OBJECT_FIELD_S32(0x1D) -#define /*0x100*/ oEyerokBossActiveHand OBJECT_FIELD_S32(0x1E) -#define /*0x104*/ oEyerokBossAttackCountdown OBJECT_FIELD_S32(0x1F) -#define /*0x108*/ oEyerokBossFightSideZ OBJECT_FIELD_F32(0x20) -#define /*0x10C*/ oEyerokBossClampedMarioPosZ OBJECT_FIELD_F32(0x21) -#define /*0x110*/ oEyerokBossOffsetFromHome OBJECT_FIELD_F32(0x22) -#define /*0x1AC*/ oEyerokBossActiveHandId OBJECT_FIELD_S32(0x49) - -/* Eyerok Hand */ -#define /*0x0F4*/ oEyerokHandWakeUpTimer OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oEyerokReceivedAttack OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oEyerokHandAnimStateIndex OBJECT_FIELD_S32(0x1D) -#define /*0x100*/ oEyerokHandEyeShownTimer OBJECT_FIELD_S32(0x1E) - -/* Falling Pillar */ -#define /*0x0F4*/ oFallingPillarPitchAcceleration OBJECT_FIELD_F32(0x1B) - -/* Fire Spitter */ -#define /*0x0F4*/ oFireSpitterScaleVel OBJECT_FIELD_F32(0x1B) - -/* Blue Fish */ -#define /*0x0F4*/ oBlueFishRandomVel OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oBlueFishRandomTime OBJECT_FIELD_S32(0x1C) -#define /*0x100*/ oBlueFishRandomAngle OBJECT_FIELD_F32(0x1E) - -/* Fish Group */ -#define /*0x0F4*/ oFishWaterLevel OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oFishGoalY OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oFishHeightOffset OBJECT_FIELD_F32(0x1D) -#define /*0x100*/ oFishYawVel OBJECT_FIELD_S32(0x1E) -#define /*0x104*/ oFishRoamDistance OBJECT_FIELD_F32(0x1F) -#define /*0x108*/ oFishGoalVel OBJECT_FIELD_F32(0x20) -#define /*0x10C*/ oFishDepthDistance OBJECT_FIELD_F32(0x21) -#define /*0x110*/ oFishActiveDistance OBJECT_FIELD_F32(0x22) - -/* Flame */ -#define /*0x0F4*/ oFlameScale OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oFlameSpeedTimerOffset OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oFlameUnusedRand OBJECT_FIELD_F32(0x1D) -#define /*0x100*/ oFlameBowser OBJECT_FIELD_OBJ(0x1E) - -/* Blue Flame */ -#define /*0x0F8*/ oBlueFlameNextScale OBJECT_FIELD_F32(0x1C) - -/* Small Piranha Flame */ -#define /*0x0F4*/ oSmallPiranhaFlameStartSpeed OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oSmallPiranhaFlameEndSpeed OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oSmallPiranhaFlameModel OBJECT_FIELD_S32(0x1D) -#define /*0x100*/ oSmallPiranhaFlameNextFlameTimer OBJECT_FIELD_S32(0x1E) -#define /*0x104*/ oSmallPiranhaFlameSpeed OBJECT_FIELD_F32(0x1F) - -/* Moving Flame */ -#define /*0x0F4*/ oMovingFlameTimer OBJECT_FIELD_S32(0x1B) - -/* Flamethrower */ -#define /*0x110*/ oFlameThowerTimeRemaining OBJECT_FIELD_S32(0x22) - -/* Floating Platform */ -#define /*0x0F4*/ oFloatingPlatformIsOnFloor OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oFloatingPlatformMarioWeightWobbleOffset OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oFloatingPlatformHeightOffset OBJECT_FIELD_F32(0x1D) -#define /*0x100*/ oFloatingPlatformWaterSurfaceWobbleOffset OBJECT_FIELD_S32(0x1E) - -/* Floor Switch Press Animation */ -#define /*0x0F4*/ oFloorSwitchPressAnimationTickTimer OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oFloorSwitchPressAnimationDoubleFrame OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oFloorSwitchPressAnimationDoResetTime OBJECT_FIELD_S32(0x1D) -#define /*0x100*/ oFloorSwitchPressAnimationSwitchNotTicking OBJECT_FIELD_S32(0x1E) - -/* Fly Guy */ -#define /*0x0F4*/ oFlyGuyIdleTimer OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oFlyGuyOscTimer OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oFlyGuyUnusedJitter OBJECT_FIELD_S32(0x1D) -#define /*0x100*/ oFlyGuyLungeYDecel OBJECT_FIELD_F32(0x1E) -#define /*0x104*/ oFlyGuyLungeTargetPitch OBJECT_FIELD_S32(0x1F) -#define /*0x108*/ oFlyGuyTargetRoll OBJECT_FIELD_S32(0x20) -#define /*0x10C*/ oFlyGuyScaleVel OBJECT_FIELD_F32(0x21) - -/* Grand Star */ -#define /*0x108*/ oGrandStarArcTime OBJECT_FIELD_S32(0x20) - -/* Horizontal Grindel */ -#define /*0x0F4*/ oHorizontalGrindelTargetYaw OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oHorizontalGrindelDistToHome OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oHorizontalGrindelOnGround OBJECT_FIELD_S32(0x1D) - -/* Goomba */ -#define /*0x0F4*/ oGoombaSize OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oGoombaScale OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oGoombaWalkTimer OBJECT_FIELD_S32(0x1D) -#define /*0x100*/ oGoombaTargetYaw OBJECT_FIELD_S32(0x1E) -#define /*0x104*/ oGoombaBlinkTimer OBJECT_FIELD_S32(0x1F) -#define /*0x108*/ oGoombaTurningAwayFromWall OBJECT_FIELD_S32(0x20) -#define /*0x10C*/ oGoombaRelativeSpeed OBJECT_FIELD_F32(0x21) -#ifdef FLOOMBAS -#define /*0x110*/ oIsFloomba OBJECT_FIELD_S32(0x22) - -#ifdef INTRO_FLOOMBAS -#define /*0x1AC*/ oZoomCounter OBJECT_FIELD_U32(0x49) -#define /*0x1B0*/ oZoomPosZ OBJECT_FIELD_F32(0x4A) -#endif -#endif - -/* Haunted Chair */ -#define /*0x0F4*/ oHauntedChairSpinTimer OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oHauntedChairPitchVel OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oHauntedChairRollVel OBJECT_FIELD_F32(0x1D) -#define /*0x100*/ oHauntedChairFallFromPianoAngle OBJECT_FIELD_S32P(0x1E) -#define /*0x104*/ oHauntedChairFallTargetAngle OBJECT_FIELD_S32(0x1F) - -/* Heave-Ho */ -#define /*0x088*/ oHeaveHoThrowState OBJECT_FIELD_S32(0x00) -#define /*0x0F4*/ oHeaveHoTimedSpeed OBJECT_FIELD_F32(0x1B) - -/* Hidden Object */ -#define /*0x0F4*/ oHiddenObjectSwitchObj OBJECT_FIELD_OBJ(0x1B) - -/* Hoot */ -#define /*0x0F4*/ oHootAvailability OBJECT_FIELD_S32(0x1B) -#define /*0x110*/ oHootMarioReleaseTime OBJECT_FIELD_S32(0x22) - -/* Horizontal Movement */ -#define /*0x0F4*/ oLllOctMeshWaveTimer OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oLllOctMeshActionOffset OBJECT_FIELD_S32(0x1C) -#define /*0x100*/ oLllOctMeshWaveYOffset OBJECT_FIELD_F32(0x1E) -#define /*0x104*/ oLllOctMeshStandTimer OBJECT_FIELD_S32(0x1F) -#define /*0x108*/ oLllOctMeshYOffsetFromHome OBJECT_FIELD_F32(0x20) - -/* Kickable Board */ -#define /*0x0F4*/ oKickableBoardRockingAngleAmount OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oKickableBoardRockingTimer OBJECT_FIELD_S32(0x1C) - - /* King Bob-omb */ -#define /*0x088*/ oKingBobombHoldingMarioState OBJECT_FIELD_S32(0x00) -#define /*0x0F8*/ oKingBobombIsJumping OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oKingBobombPlayerGrabEscapeActions OBJECT_FIELD_S32(0x1D) -#define /*0x100*/ oKingBobombShouldStomp OBJECT_FIELD_S32(0x1E) -#define /*0x104*/ oKingBobombStationaryTimer OBJECT_FIELD_S32(0x1F) -#define /*0x108*/ oKingBobombPlayerGrabEscapeCooldown OBJECT_FIELD_S32(0x20) -#define /*0x10C*/ oKingBobombBlinkTimer OBJECT_FIELD_S32(0x21) - -/* Klepto */ -#define /*0x0F4*/ oKleptoDistanceToTarget OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oKleptoHomeYOffset OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oKleptoHalfLateralDistToHome OBJECT_FIELD_F32(0x1D) -#define /*0x100*/ oKleptoSpeed OBJECT_FIELD_F32(0x1E) -#define /*0x104*/ O_KLEPTO_START_POS_INDEX 0x1F -#define /*0x104*/ O_KLEPTO_START_POS_X_INDEX (O_KLEPTO_START_POS_INDEX + 0) // 0x1F -#define /*0x108*/ O_KLEPTO_START_POS_Y_INDEX (O_KLEPTO_START_POS_INDEX + 1) // 0x20 -#define /*0x10C*/ O_KLEPTO_START_POS_Z_INDEX (O_KLEPTO_START_POS_INDEX + 2) // 0x21 -#define /*0x104*/ oKleptoStartPosVec OBJECT_FIELD_F32(O_KLEPTO_START_POS_INDEX) -#define /*0x104*/ oKleptoStartPosX OBJECT_FIELD_F32(O_KLEPTO_START_POS_X_INDEX) -#define /*0x108*/ oKleptoStartPosY OBJECT_FIELD_F32(O_KLEPTO_START_POS_Y_INDEX) -#define /*0x10C*/ oKleptoStartPosZ OBJECT_FIELD_F32(O_KLEPTO_START_POS_Z_INDEX) -#define /*0x110*/ oKleptoTimeUntilTargetChange OBJECT_FIELD_S32(0x22) -#define /*0x1AC*/ oKleptoTargetNumber OBJECT_FIELD_S16(0x49, 0) -#define /*0x1AE*/ oKleptoDiveTimer OBJECT_FIELD_S16(0x49, 1) -#define /*0x1B0*/ oKleptoPitchToTarget OBJECT_FIELD_S16(0x4A, 0) -#define /*0x1B2*/ oKleptoYawToTarget OBJECT_FIELD_S16(0x4A, 1) - -/* Koopa */ -#define /*0x0F4*/ oKoopaAgility OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oKoopaMovementType OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oKoopaTargetYaw OBJECT_FIELD_S32(0x1D) -#define /*0x100*/ oKoopaUnshelledTimeUntilTurn OBJECT_FIELD_S32(0x1E) -#define /*0x104*/ oKoopaTurningAwayFromWall OBJECT_FIELD_S32(0x1F) -#define /*0x108*/ oKoopaDistanceToMario OBJECT_FIELD_F32(0x20) -#define /*0x10C*/ oKoopaAngleToMario OBJECT_FIELD_S32(0x21) -#define /*0x110*/ oKoopaBlinkTimer OBJECT_FIELD_S32(0x22) -#define /*0x1AC*/ oKoopaCountdown OBJECT_FIELD_S16(0x49, 0) -#define /*0x1AE*/ oKoopaTheQuickRaceIndex OBJECT_FIELD_S16(0x49, 1) -#define /*0x1B0*/ oKoopaTheQuickInitTextboxCooldown OBJECT_FIELD_S16(0x4A, 0) -// 0x1D-0x21 for koopa the quick reserved for pathing - -/* Koopa Race Endpoint */ -#define /*0x0F4*/ oKoopaRaceEndpointRaceBegun OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oKoopaRaceEndpointKoopaFinished OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oKoopaRaceEndpointRaceStatus OBJECT_FIELD_S32(0x1D) -#define /*0x100*/ oKoopaRaceEndpointDialog OBJECT_FIELD_S32(0x1E) -#define /*0x104*/ oKoopaRaceEndpointRaceEnded OBJECT_FIELD_S32(0x1F) - -/* Koopa Shell Flame */ -#define /*0x0F4*/ oKoopaShellFlameUnused OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oKoopaShellFlameScale OBJECT_FIELD_F32(0x1C) - -/* Camera Lakitu */ -#define /*0x0F4*/ oCameraLakituBlinkTimer OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oCameraLakituSpeed OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oCameraLakituCircleRadius OBJECT_FIELD_F32(0x1D) -#define /*0x100*/ oCameraLakituFinishedDialog OBJECT_FIELD_S32(0x1E) -#define /*0x104*/ oCameraLakituIntroMusicPlayed OBJECT_FIELD_S32(0x1F) -#define /*0x1AC*/ oCameraLakituPitchVel OBJECT_FIELD_S16(0x49, 0) -#define /*0x1AE*/ oCameraLakituYawVel OBJECT_FIELD_S16(0x49, 1) - -/* Evil Lakitu */ -#define /*0x0F4*/ oEnemyLakituNumSpinies OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oEnemyLakituBlinkTimer OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oEnemyLakituSpinyCooldown OBJECT_FIELD_S32(0x1D) -#define /*0x100*/ oEnemyLakituFaceForwardCountdown OBJECT_FIELD_S32(0x1E) - -/* Intro Cutscene Lakitu */ -#define /*0x0F8*/ oIntroLakituSplineSegmentProgress OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oIntroLakituSplineSegment OBJECT_FIELD_F32(0x1D) -#define /*0x100*/ oIntroLakituDistToBirdsX OBJECT_FIELD_F32(0x1E) -#define /*0x104*/ oIntroLakituDistToBirdsZ OBJECT_FIELD_F32(0x1F) -#define /*0x108*/ O_INTRO_LAKITU_END_BIRDS_DEST_INDEX 0x20 -#define /*0x108*/ O_INTRO_LAKITU_END_BIRDS_DEST_X_INDEX (O_INTRO_LAKITU_END_BIRDS_DEST_INDEX + 0) // 0x20 -#define /*0x10C*/ O_INTRO_LAKITU_END_BIRDS_DEST_Y_INDEX (O_INTRO_LAKITU_END_BIRDS_DEST_INDEX + 1) // 0x21 -#define /*0x110*/ O_INTRO_LAKITU_END_BIRDS_DEST_Z_INDEX (O_INTRO_LAKITU_END_BIRDS_DEST_INDEX + 2) // 0x22 -#define /*0x108*/ oIntroLakituEndBirds1DestVec OBJECT_FIELD_F32(O_INTRO_LAKITU_END_BIRDS_DEST_INDEX) -#define /*0x110*/ oIntroLakituEndBirds1DestX OBJECT_FIELD_F32(O_INTRO_LAKITU_END_BIRDS_DEST_X_INDEX) -#define /*0x10C*/ oIntroLakituEndBirds1DestY OBJECT_FIELD_F32(O_INTRO_LAKITU_END_BIRDS_DEST_Y_INDEX) -#define /*0x108*/ oIntroLakituEndBirds1DestZ OBJECT_FIELD_F32(O_INTRO_LAKITU_END_BIRDS_DEST_Z_INDEX) -#define /*0x1AC*/ oIntroLakituCloud OBJECT_FIELD_OBJ(0x49) - -/* Main Menu Button */ -#define /*0x0F4*/ oMenuButtonState OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oMenuButtonTimer OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ O_MENU_BUTTON_ORIG_POS_INDEX 0x1D -#define /*0x0FC*/ O_MENU_BUTTON_ORIG_POS_X_INDEX (O_MENU_BUTTON_ORIG_POS_INDEX + 0) // 0x1D -#define /*0x100*/ O_MENU_BUTTON_ORIG_POS_Y_INDEX (O_MENU_BUTTON_ORIG_POS_INDEX + 1) // 0x1E -#define /*0x104*/ O_MENU_BUTTON_ORIG_POS_Z_INDEX (O_MENU_BUTTON_ORIG_POS_INDEX + 2) // 0x1F -#define /*0x0FC*/ oMenuButtonOrigPosVec OBJECT_FIELD_F32(O_MENU_BUTTON_ORIG_POS_INDEX) -#define /*0x0FC*/ oMenuButtonOrigPosX OBJECT_FIELD_F32(O_MENU_BUTTON_ORIG_POS_X_INDEX) -#define /*0x100*/ oMenuButtonOrigPosY OBJECT_FIELD_F32(O_MENU_BUTTON_ORIG_POS_Y_INDEX) -#define /*0x104*/ oMenuButtonOrigPosZ OBJECT_FIELD_F32(O_MENU_BUTTON_ORIG_POS_Z_INDEX) -#define /*0x108*/ oMenuButtonScale OBJECT_FIELD_F32(0x20) -#define /*0x10C*/ oMenuButtonActionPhase OBJECT_FIELD_S32(0x21) - -/* Manta Ray */ -#define /*0x0F4*/ O_MANTA_TARGET_ANGLE_INDEX 0x1B -#define /*0x0F4*/ O_MANTA_TARGET_PITCH_INDEX (O_MANTA_TARGET_ANGLE_INDEX + 0) // 0x1B -#define /*0x0F8*/ O_MANTA_TARGET_YAW_INDEX (O_MANTA_TARGET_ANGLE_INDEX + 1) // 0x1C -#define /*0x0FC*/ O_MANTA_TARGET_ROLL_INDEX (O_MANTA_TARGET_ANGLE_INDEX + 2) // 0x1D -#define /*0x0F4*/ oMantaTargetAngleVec OBJECT_FIELD_S32(O_MANTA_TARGET_ANGLE_INDEX) -#define /*0x0F4*/ oMantaTargetPitch OBJECT_FIELD_S32(O_MANTA_TARGET_PITCH_INDEX) -#define /*0x0F8*/ oMantaTargetYaw OBJECT_FIELD_S32(O_MANTA_TARGET_YAW_INDEX) -#define /*0x0FC*/ oMantaTargetRoll OBJECT_FIELD_S32(O_MANTA_TARGET_ROLL_INDEX) // unused - -/* Merry-Go-Round */ -#define /*0x088*/ oMerryGoRoundStopped OBJECT_FIELD_S32(0x00) -#define /*0x0F8*/ oMerryGoRoundMusicShouldPlay OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oMerryGoRoundMarioIsOutside OBJECT_FIELD_S32(0x1D) - -/* Merry-Go-Round Boo Manager */ -#define /*0x088*/ oMerryGoRoundBooManagerNumBoosKilled OBJECT_FIELD_S32(0x00) -#define /*0x0FC*/ oMerryGoRoundBooManagerNumBoosSpawned OBJECT_FIELD_S32(0x1D) - -/* Mips */ -#define /*0x0F4*/ oMipsStarStatus OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oMipsStartWaypointIndex OBJECT_FIELD_S32(0x1C) - // 0x1D-0x21 reserved for pathing -#define /*0x1AC*/ oMipsForwardVelocity OBJECT_FIELD_F32(0x49) - -/* Moneybag */ -#define /*0x0F4*/ oMoneybagJumpState OBJECT_FIELD_S32(0x1B) - -/* Monty Mole */ -#define /*0x0F4*/ oMontyMoleCurrentHole OBJECT_FIELD_OBJ(0x1B) -#define /*0x0F8*/ oMontyMoleHeightRelativeToFloor OBJECT_FIELD_F32(0x1C) - -/* Monty Mole Hole */ -#define /*0x0F4*/ oMontyMoleHoleCooldown OBJECT_FIELD_S32(0x1B) - -/* Mr. Blizzard */ -#define /*0x0F4*/ oMrBlizzardScale OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oMrBlizzardHeldObj OBJECT_FIELD_OBJ(0x1C) -#define /*0x0FC*/ oMrBlizzardGraphYVel OBJECT_FIELD_F32(0x1D) -#define /*0x100*/ oMrBlizzardTimer OBJECT_FIELD_S32(0x1E) -#define /*0x104*/ oMrBlizzardDizziness OBJECT_FIELD_F32(0x1F) -#define /*0x108*/ oMrBlizzardChangeInDizziness OBJECT_FIELD_F32(0x20) -#define /*0x10C*/ oMrBlizzardGraphYOffset OBJECT_FIELD_F32(0x21) -#define /*0x110*/ oMrBlizzardDistFromHome OBJECT_FIELD_S32(0x22) -#define /*0x1AC*/ oMrBlizzardTargetMoveYaw OBJECT_FIELD_S32(0x49) - -/* Mr. I */ -#define /*0x0F4*/ oMrISpinAngle OBJECT_FIELD_S32(0x1B) -#define /*0x0FC*/ oMrISpinAmount OBJECT_FIELD_S32(0x1D) -#define /*0x100*/ oMrISpinDirection OBJECT_FIELD_S32(0x1E) -#define /*0x104*/ oMrIParticleTimer OBJECT_FIELD_S32(0x1F) -#define /*0x108*/ oMrIParticleTimerTarget OBJECT_FIELD_S32(0x20) -#define /*0x10C*/ oMrIScale OBJECT_FIELD_F32(0x21) -#define /*0x110*/ oMrIBlinking OBJECT_FIELD_S32(0x22) - -/* Object Respawner */ -#define /*0x0F4*/ oRespawnerModelToRespawn OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oRespawnerMinSpawnDist OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oRespawnerBehaviorToRespawn OBJECT_FIELD_CVPTR(0x1D) - -/* Orange Number */ -#define /*0x110*/ oOrangeNumberOffset OBJECT_FIELD_S32(0x22) - -/* Openable Grill */ -#define /*0x088*/ oOpenableGrillIsOpen OBJECT_FIELD_S32(0x00) -#define /*0x0F4*/ oOpenableGrillFloorSwitchObj OBJECT_FIELD_OBJ(0x1B) - -/* Intro Cutscene Peach */ -#define /*0x108*/ oIntroPeachYawFromFocus OBJECT_FIELD_F32(0x20) -#define /*0x10C*/ oIntroPeachPitchFromFocus OBJECT_FIELD_F32(0x21) -#define /*0x110*/ oIntroPeachDistToCamera OBJECT_FIELD_F32(0x22) - -/* Racing Penguin */ -#define /*0x0F4*/ oRacingPenguinInitTextCooldown OBJECT_FIELD_S32(0x1B) -// 0x1D-0x21 reserved for pathing -#define /*0x110*/ oRacingPenguinWeightedNewTargetSpeed OBJECT_FIELD_F32(0x22) -#define /*0x1AC*/ oRacingPenguinFinalTextbox OBJECT_FIELD_S16(0x49, 0) -#define /*0x1AE*/ oRacingPenguinMarioWon OBJECT_FIELD_S16(0x49, 1) -#define /*0x1B0*/ oRacingPenguinReachedBottom OBJECT_FIELD_S16(0x4A, 0) -#define /*0x1B2*/ oRacingPenguinMarioCheated OBJECT_FIELD_S16(0x4A, 1) - -/* Small Penguin */ -#define /*0x088*/ oSmallPenguinReturnedToMother OBJECT_FIELD_S32(0x00) -#define /*0x100*/ oSmallPenguinStoredAction OBJECT_FIELD_S32(0x1E) -#define /*0x104*/ oSmallPenguinNextForwardVel OBJECT_FIELD_F32(0x1F) -#define /*0x108*/ oSmallPenguinRandomDistanceCheck OBJECT_FIELD_F32(0x20) -#define /*0x110*/ oSmallPenguinYawIncrement OBJECT_FIELD_S32(0x22) - -/* SL Walking Penguin */ -#define /*0x100*/ oSLWalkingPenguinWindCollisionXPos OBJECT_FIELD_F32(0x1E) -#define /*0x104*/ oSLWalkingPenguinWindCollisionZPos OBJECT_FIELD_F32(0x1F) -#define /*0x10C*/ oSLWalkingPenguinCurStep OBJECT_FIELD_S32(0x21) -#define /*0x110*/ oSLWalkingPenguinCurStepTimer OBJECT_FIELD_S32(0x22) - -/* Piranha Plant */ -#define /*0x0F4*/ oPiranhaPlantSleepMusicState OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oPiranhaPlantScale OBJECT_FIELD_F32(0x1C) - -/* Fire Piranha Plant */ -#define /*0x0F4*/ oFirePiranhaPlantNeutralScale OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oFirePiranhaPlantScale OBJECT_FIELD_F32(0x1C) // Shared with above obj? Coincidence? -#define /*0x0FC*/ oFirePiranhaPlantActive OBJECT_FIELD_S32(0x1D) -#define /*0x100*/ oFirePiranhaPlantDeathSpinTimer OBJECT_FIELD_S32(0x1E) -#define /*0x104*/ oFirePiranhaPlantDeathSpinVel OBJECT_FIELD_F32(0x1F) - -/* Rolling Log */ -#define /*0x0F4*/ oRollingLogMaxDist OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oRollingLogX OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oRollingLogZ OBJECT_FIELD_F32(0x1D) - -/* Falling Rising Bitfs Platform */ -#define /*0x0F4*/ oBitfsPlatformTimer OBJECT_FIELD_S32(0x1B) - -/* Falling Bowser Bits Platform */ -#define /*0x0F8*/ oBitsPlatformBowser OBJECT_FIELD_OBJ(0x1C) -#define /*0x0FC*/ oBitsPlatformTimer OBJECT_FIELD_S32(0x1D) - -/* WF Platform */ -#define /*0x10C*/ oPlatformWFTowerForwardVel OBJECT_FIELD_F32(0x21) -#define /*0x110*/ oPlatformWFTowerMoveDistance OBJECT_FIELD_F32(0x22) - -/* Platform on Tracks */ -#define /*0x088*/ oPlatformOnTrackBaseBallIndex OBJECT_FIELD_S32(0x00) -#define /*0x0F4*/ oPlatformOnTrackDistMovedSinceLastBall OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oPlatformOnTrackSkiLiftRollVel OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oPlatformOnTrackStartWaypoint OBJECT_FIELD_WAYPOINT(0x1D) -#define /*0x100*/ oPlatformOnTrackPrevWaypoint OBJECT_FIELD_WAYPOINT(0x1E) -#define /*0x104*/ oPlatformOnTrackPrevWaypointFlags OBJECT_FIELD_S32(0x1F) -#define /*0x108*/ oPlatformOnTrackPitch OBJECT_FIELD_S32(0x20) -#define /*0x10C*/ oPlatformOnTrackYaw OBJECT_FIELD_S32(0x21) -#define /*0x110*/ oPlatformOnTrackOffsetY OBJECT_FIELD_F32(0x22) -#define /*0x1AC*/ oPlatformOnTrackIsNotSkiLift OBJECT_FIELD_S16(0x49, 0) -#define /*0x1AE*/ oPlatformOnTrackIsNotHMC OBJECT_FIELD_S16(0x49, 1) -#define /*0x1B0*/ oPlatformOnTrackType OBJECT_FIELD_S16(0x4A, 0) -#define /*0x1B2*/ oPlatformOnTrackWasStoodOn OBJECT_FIELD_S16(0x4A, 1) - -/* Platform Spawner */ -#define /*0x0F4*/ oPlatformSpawnerWFTowerPlatformNum OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oPlatformSpawnerWFTowerYawOffset OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oPlatformSpawnerWFTowerDYaw OBJECT_FIELD_S32(0x1D) -#define /*0x100*/ oPlatformSpawnerWFTowerRadius OBJECT_FIELD_F32(0x1E) -#define /*0x104*/ oPlatformSpawnerWFTowerMoveDistance OBJECT_FIELD_F32(0x1F) -#define /*0x108*/ oPlatformSpawnerWFTowerForwardVel OBJECT_FIELD_F32(0x20) - -/* Pokey */ -#define /*0x0F4*/ oPokeyAliveBodyPartFlags OBJECT_FIELD_U32(0x1B) -#define /*0x0F8*/ oPokeyNumAliveBodyParts OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oPokeyBottomBodyPartSize OBJECT_FIELD_F32(0x1D) -#define /*0x100*/ oPokeyHeadWasKilled OBJECT_FIELD_S32(0x1E) -#define /*0x104*/ oPokeyTargetYaw OBJECT_FIELD_S32(0x1F) -#define /*0x108*/ oPokeyChangeTargetTimer OBJECT_FIELD_S32(0x20) -#define /*0x10C*/ oPokeyTurningAwayFromWall OBJECT_FIELD_S32(0x21) - -/* Pokey Body Part */ -#define /*0x0F8*/ oPokeyBodyPartDeathDelayAfterHeadKilled OBJECT_FIELD_S32(0x1C) -#define /*0x110*/ oPokeyBodyPartBlinkTimer OBJECT_FIELD_S32(0x22) - -/* DDD Pole */ -#define /*0x0F4*/ oDDDPoleVel OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oDDDPoleMaxOffset OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oDDDPoleOffset OBJECT_FIELD_F32(0x1D) - -/* Pyramid Top */ -#define /*0x0F4*/ oPyramidTopPillarsTouched OBJECT_FIELD_S32(0x1B) - -/* Pyramid Top Explosion */ -#define /*0x0F4*/ oPyramidTopFragmentsScale OBJECT_FIELD_F32(0x1B) - -/* Volcano Trap */ -#define /*0x0F4*/ oVolcanoTrapPitchVel OBJECT_FIELD_F32(0x1B) - -/* Lll Rotating Hex Flame */ -#define /*0x0F4*/ O_LLL_ROTATING_HEX_FLAME_RELATIVE_POS_INDEX 0x1B -#define /*0x0F4*/ O_LLL_ROTATING_HEX_FLAME_RELATIVE_POS_X_INDEX (O_LLL_ROTATING_HEX_FLAME_RELATIVE_POS_INDEX + 0) // 0x1B -#define /*0x0F8*/ O_LLL_ROTATING_HEX_FLAME_RELATIVE_POS_Y_INDEX (O_LLL_ROTATING_HEX_FLAME_RELATIVE_POS_INDEX + 1) // 0x1C -#define /*0x0FC*/ O_LLL_ROTATING_HEX_FLAME_RELATIVE_POS_Z_INDEX (O_LLL_ROTATING_HEX_FLAME_RELATIVE_POS_INDEX + 2) // 0x1D -#define /*0x0F4*/ oLllRotatingHexFlameRelativePosVec OBJECT_FIELD_F32(O_LLL_ROTATING_HEX_FLAME_RELATIVE_POS_INDEX) -#define /*0x0F4*/ oLllRotatingHexFlameRelativePosX OBJECT_FIELD_F32(O_LLL_ROTATING_HEX_FLAME_RELATIVE_POS_X_INDEX) -#define /*0x0F8*/ oLllRotatingHexFlameRelativePosY OBJECT_FIELD_F32(O_LLL_ROTATING_HEX_FLAME_RELATIVE_POS_Y_INDEX) -#define /*0x0FC*/ oLllRotatingHexFlameRelativePosZ OBJECT_FIELD_F32(O_LLL_ROTATING_HEX_FLAME_RELATIVE_POS_Z_INDEX) - -/* Scuttlebug */ -#define /*0x0F4*/ oScuttlebugHasNoLootCoins OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oScuttlebugIsAtttacking OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oScuttlebugTimer OBJECT_FIELD_S32(0x1D) - -/* Scuttlebug Spawner */ -#define /*0x088*/ oScuttlebugSpawnerIsDeactivated OBJECT_FIELD_S32(0x00) -#define /*0x0F4*/ oScuttlebugSpawnerSpawnWithNoLootCoins OBJECT_FIELD_S32(0x1B) - -/* Seesaw Platform */ -#define /*0x0F4*/ oSeesawPlatformPitchVel OBJECT_FIELD_F32(0x1B) - -/* Ship Part 3 */ -#define /*0x0F4*/ oShipPart3LoopPitch OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oShipPart3LoopRoll OBJECT_FIELD_S32(0x1C) - -/* Sink When Stepped On */ -#define /*0x104*/ oSinkWhenSteppedOnTimer OBJECT_FIELD_S32(0x1F) -#define /*0x108*/ oSinkWhenSteppedOnYOffsetFromHome OBJECT_FIELD_F32(0x20) - -/* Skeeter */ -#define /*0x0F4*/ oSkeeterTargetAngle OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oSkeeterTurningAwayFromWall OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oSkeeterTargetForwardVel OBJECT_FIELD_F32(0x1D) -#define /*0x100*/ oSkeeterWaitTime OBJECT_FIELD_S32(0x1E) -#define /*0x1AC*/ oSkeeterAngleVel OBJECT_FIELD_S16(0x49, 0) - -/* Jrb Sliding Box */ -#define /*0x0F4*/ oJrbSlidingBoxShipObj OBJECT_FIELD_OBJ(0x1B) -#define /*0x0F8*/ oJrbSlidingBoxAngle OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oJrbSlidingBoxAdditiveZ OBJECT_FIELD_F32(0x1D) - -/* WF Sliding Brick Platform */ -#define /*0x0F4*/ oWFSlidBrickPtfmMovVel OBJECT_FIELD_F32(0x1B) - -/* Smoke */ -#define /*0x0F4*/ oSmokeTimer OBJECT_FIELD_S32(0x1B) - -/* Snowman's Bottom */ -#define /*0x0F4*/ oSnowmansBottomScale OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oSnowmansBottomTargetYaw OBJECT_FIELD_S32(0x1C) -#define /*0x1AC*/ oSnowmansBottomHitCheckpointNearMario OBJECT_FIELD_S32(0x49) -// 0x1D-0x21 reserved for pathing - -/* Snowman's Head */ -#define /*0x0F4*/ oSnowmansHeadDialogActive OBJECT_FIELD_S32(0x1B) - -/* Snowman Wind Blowing */ -#define /*0x0F4*/ oSLSnowmanWindOriginalYaw OBJECT_FIELD_S32(0x1B) - -/* Snufit */ -#define /*0x0F4*/ oSnufitRecoil OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oSnufitScale OBJECT_FIELD_F32(0x1C) -// 0x1D -#define /*0x100*/ oSnufitCircularPeriod OBJECT_FIELD_S32(0x1E) -#define /*0x104*/ oSnufitBodyScalePeriod OBJECT_FIELD_S32(0x1F) -#define /*0x108*/ oSnufitBodyBaseScale OBJECT_FIELD_S32(0x20) -#define /*0x10C*/ oSnufitBullets OBJECT_FIELD_S32(0x21) -#define /*0x1AC*/ oSnufitBodyScale OBJECT_FIELD_S16(0x49, 0) - -/* Spindel */ -#define /*0x0F4*/ oSpindelMoveTimer OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oSpindelMoveDirection OBJECT_FIELD_S32(0x1C) - -/* Spinning Heart */ -#define /*0x0F4*/ oSpinningHeartTotalSpin OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oSpinningHeartPlayedSound OBJECT_FIELD_S32(0x1C) - -/* Spiny */ -#define /*0x0F4*/ oSpinyTimeUntilTurn OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oSpinyTargetYaw OBJECT_FIELD_S32(0x1C) -#define /*0x100*/ oSpinyTurningAwayFromWall OBJECT_FIELD_S32(0x1E) - -/* Sound Effect */ -#define /*0x0F4*/ oSoundEffectBits OBJECT_FIELD_S32(0x1B) - -/* Star Spawn */ -#define /*0x0F4*/ oStarSpawnDisFromHome OBJECT_FIELD_F32(0x1B) -#define /*0x0FC*/ oStarSpawnVelY OBJECT_FIELD_F32(0x1D) - -/* Hidden Star */ -// Secrets/Red Coins -#define /*0x0F4*/ oHiddenStarTriggerCounter OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oHiddenStarTriggerTotal OBJECT_FIELD_S32(0x1C) - -/* Sealed Door Star */ -#define /*0x108*/ oUnlockDoorStarState OBJECT_FIELD_U32(0x20) -#define /*0x10C*/ oUnlockDoorStarTimer OBJECT_FIELD_S32(0x21) -#define /*0x110*/ oUnlockDoorStarYawVel OBJECT_FIELD_S32(0x22) - -/* Celebration Star */ -#define /*0x0F4*/ oCelebStarIsBowserKey OBJECT_FIELD_S32(0x1B) -#define /*0x108*/ oCelebStarDiameterOfRotation OBJECT_FIELD_S32(0x20) - -/* Star Selector */ -#define /*0x0F4*/ oStarSelectorType OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oStarSelectorTimer OBJECT_FIELD_S32(0x1C) -#define /*0x108*/ oStarSelectorSize OBJECT_FIELD_F32(0x20) - -/* Sushi Shark */ -#define /*0x0F4*/ oSushiSharkAngleFromHome OBJECT_FIELD_S32(0x1B) - -/* Swing Platform */ -#define /*0x0F4*/ oSwingPlatformAngle OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oSwingPlatformSpeed OBJECT_FIELD_F32(0x1C) - -/* Swoop */ -#define /*0x0F4*/ oSwoopBonkCountdown OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ O_SWOOP_TARGET_ANGLE_INDEX 0x1C -#define /*0x0F8*/ O_SWOOP_TARGET_PITCH_INDEX (O_SWOOP_TARGET_ANGLE_INDEX + 0) // 0x1C -#define /*0x0F8*/ O_SWOOP_TARGET_YAW_INDEX (O_SWOOP_TARGET_ANGLE_INDEX + 1) // 0x1D -#define /*0x0F8*/ O_SWOOP_TARGET_ROLL_INDEX (O_SWOOP_TARGET_ANGLE_INDEX + 2) // 0x1E -#define /*0x0F8*/ oSwoopTargetAngleVec OBJECT_FIELD_S32(O_SWOOP_TARGET_ANGLE_INDEX) -#define /*0x0F8*/ oSwoopTargetPitch OBJECT_FIELD_S32(O_SWOOP_TARGET_PITCH_INDEX) -#define /*0x0FC*/ oSwoopTargetYaw OBJECT_FIELD_S32(O_SWOOP_TARGET_YAW_INDEX) -#define /*0x100*/ oSwoopTargetRoll OBJECT_FIELD_S32(O_SWOOP_TARGET_ROLL_INDEX) // unused - -/* Thwomp */ -#define /*0x0F4*/ oThwompRandomTimer OBJECT_FIELD_S32(0x1B) - -/* Tilting Platform */ -#define /*0x0F4*/ O_TILTING_PYRAMID_NORMAL_INDEX 0x1B -#define /*0x0F4*/ O_TILTING_PYRAMID_NORMAL_X_INDEX (O_TILTING_PYRAMID_NORMAL_INDEX + 0) // 0x1B -#define /*0x0F8*/ O_TILTING_PYRAMID_NORMAL_Y_INDEX (O_TILTING_PYRAMID_NORMAL_INDEX + 1) // 0x1C -#define /*0x0FC*/ O_TILTING_PYRAMID_NORMAL_Z_INDEX (O_TILTING_PYRAMID_NORMAL_INDEX + 2) // 0x1D -#define /*0x0F4*/ oTiltingPyramidNormalVec OBJECT_FIELD_F32(O_TILTING_PYRAMID_NORMAL_INDEX) -#define /*0x0F4*/ oTiltingPyramidNormalX OBJECT_FIELD_F32(O_TILTING_PYRAMID_NORMAL_X_INDEX) -#define /*0x0F8*/ oTiltingPyramidNormalY OBJECT_FIELD_F32(O_TILTING_PYRAMID_NORMAL_Y_INDEX) -#define /*0x0FC*/ oTiltingPyramidNormalZ OBJECT_FIELD_F32(O_TILTING_PYRAMID_NORMAL_Z_INDEX) - -/* Toad Message */ -#define /*0x108*/ oToadMessageDialogId OBJECT_FIELD_U32(0x20) -#define /*0x10C*/ oToadMessageRecentlyTalked OBJECT_FIELD_S32(0x21) -#define /*0x110*/ oToadMessageState OBJECT_FIELD_S32(0x22) - -/* Tox Box */ -#define /*0x1AC*/ oToxBoxMovementPattern OBJECT_FIELD_VPTR(0x49) -#define /*0x1B0*/ oToxBoxMovementStep OBJECT_FIELD_S32(0x4A) - -/* TTC Rotating Solid */ -#define /*0x0F4*/ oTTCRotatingSolidNumTurns OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oTTCRotatingSolidNumSides OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oTTCRotatingSolidRotationDelay OBJECT_FIELD_S32(0x1D) -#define /*0x100*/ oTTCRotatingSolidVelY OBJECT_FIELD_F32(0x1E) -#define /*0x104*/ oTTCRotatingSolidSoundTimer OBJECT_FIELD_S32(0x1F) - -/* TTC Pendulum */ -#define /*0x0F4*/ oTTCPendulumAccelDir OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oTTCPendulumAngle OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oTTCPendulumAngleVel OBJECT_FIELD_F32(0x1D) -#define /*0x100*/ oTTCPendulumAngleAccel OBJECT_FIELD_F32(0x1E) -#define /*0x104*/ oTTCPendulumDelay OBJECT_FIELD_S32(0x1F) -#define /*0x108*/ oTTCPendulumSoundTimer OBJECT_FIELD_S32(0x20) - -/* TTC Treadmill */ -#define /*0x0F4*/ oTTCTreadmillBigSurface OBJECT_FIELD_S16P(0x1B) -#define /*0x0F8*/ oTTCTreadmillSmallSurface OBJECT_FIELD_S16P(0x1C) -#define /*0x0FC*/ oTTCTreadmillSpeed OBJECT_FIELD_F32(0x1D) -#define /*0x100*/ oTTCTreadmillTargetSpeed OBJECT_FIELD_F32(0x1E) -#define /*0x104*/ oTTCTreadmillTimeUntilSwitch OBJECT_FIELD_S32(0x1F) - -/* TTC Moving Bar */ -#define /*0x0F4*/ oTTCMovingBarDelay OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oTTCMovingBarStoppedTimer OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oTTCMovingBarOffset OBJECT_FIELD_F32(0x1D) -#define /*0x100*/ oTTCMovingBarSpeed OBJECT_FIELD_F32(0x1E) -#define /*0x104*/ oTTCMovingBarStartOffset OBJECT_FIELD_F32(0x1F) - -/* TTC Cog */ -#define /*0x0F4*/ oTTCCogDir OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oTTCCogSpeed OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oTTCCogTargetVel OBJECT_FIELD_F32(0x1D) - -/* TTC Pit Block */ -#define /*0x0F4*/ oTTCPitBlockPeakY OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oTTCPitBlockDir OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oTTCPitBlockWaitTime OBJECT_FIELD_S32(0x1D) - -/* TTC Elevator */ -#define /*0x0F4*/ oTTCElevatorDir OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oTTCElevatorPeakY OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oTTCElevatorMoveTime OBJECT_FIELD_S32(0x1D) - -/* TTC 2D Rotator */ -#define /*0x0F4*/ oTTC2DRotatorMinTimeUntilNextTurn OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oTTC2DRotatorTargetYaw OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oTTC2DRotatorIncrement OBJECT_FIELD_S32(0x1D) -#define /*0x104*/ oTTC2DRotatorRandomDirTimer OBJECT_FIELD_S32(0x1F) -#define /*0x108*/ oTTC2DRotatorSpeed OBJECT_FIELD_S32(0x20) - -/* TTC Spinner */ -#define /*0x0F4*/ oTTCSpinnerDir OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oTTCChangeDirTimer OBJECT_FIELD_S32(0x1C) - -/* Beta Trampoline */ -#define /*0x110*/ oBetaTrampolineMarioOnTrampoline OBJECT_FIELD_S32(0x22) - -/* Treasure Chest */ -#define /*0x0F4*/ oTreasureChestNumOpenedChests OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oTreasureChestDoCloseChests OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oTreasureChestAboveWater OBJECT_FIELD_S32(0x1D) - -/* Tree Snow Or Leaf */ -#define /*0x0F4*/ oTreeSnowOrLeafSidewardAngle OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oTreeSnowOrLeafSidewardVel OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oTreeSnowOrLeafSidewardAngleVel OBJECT_FIELD_S32(0x1D) - -/* Tumbling Bridge */ -#define /*0x0F4*/ oTumblingBridgeRollAccel OBJECT_FIELD_S32(0x1B) - -/* Tweester */ -#define /*0x0F4*/ oTweesterScaleTimer OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oTweesterUnused OBJECT_FIELD_S32(0x1C) - -/* Ukiki */ -#define /*0x0F4*/ oUkikiTauntCounter OBJECT_FIELD_S16(0x1B, 0) -#define /*0x0F6*/ oUkikiTauntsToBeDone OBJECT_FIELD_S16(0x1B, 1) -// 0x1D-0x21 reserved for pathing -#define /*0x110*/ oUkikiChaseFleeRange OBJECT_FIELD_F32(0x22) -#define /*0x1AC*/ oUkikiTextState OBJECT_FIELD_S16(0x49, 0) -#define /*0x1AE*/ oUkikiTextboxTimer OBJECT_FIELD_S16(0x49, 1) -#define /*0x1B0*/ oUkikiCageSpinTimer OBJECT_FIELD_S16(0x4A, 0) -#define /*0x1B2*/ oUkikiHasCap OBJECT_FIELD_S16(0x4A, 1) - -/* Ukiki Cage*/ -#define /*0x088*/ oUkikiCageNextAction OBJECT_FIELD_S32(0x00) - -/* Unagi */ -#define /*0x0F4*/ oUnagiDistFromHome OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oUnagiNextForwardVel OBJECT_FIELD_F32(0x1C) -// 0x1D-0x21 reserved for pathing -#define /*0x110*/ oUnagiTargetNextForwardVel OBJECT_FIELD_F32(0x22) -#define /*0x1AC*/ oUnagiDistanceToMario OBJECT_FIELD_F32(0x49) -#define /*0x1B0*/ oUnagiInitMoveYaw OBJECT_FIELD_S16(0x4A, 0) -#define /*0x1B2*/ oUnagiHasStar OBJECT_FIELD_S16(0x4A, 1) - -/* Water Bomb */ -#define /*0x0F8*/ oWaterBombVerticalStretch OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oWaterBombStretchSpeed OBJECT_FIELD_F32(0x1D) -#define /*0x100*/ oWaterBombOnGround OBJECT_FIELD_S32(0x1E) -#define /*0x104*/ oWaterBombNumBounces OBJECT_FIELD_F32(0x1F) - -/* Water Bomb Spawner */ -#define /*0x0F4*/ oWaterBombSpawnerBombActive OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oWaterBombSpawnerTimeToSpawn OBJECT_FIELD_S32(0x1C) - -/* Water Bomb Cannon */ -#define /*0x0F4*/ oWaterCannonIdleTimer OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oWaterCannonRotationTimer OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oWaterCannonTargetMovePitch OBJECT_FIELD_S32(0x1D) -#define /*0x100*/ oWaterCannonTargetFaceYaw OBJECT_FIELD_S32(0x1E) - -/* Cannon Barrel Bubbles */ -#define /*0x0F4*/ oCannonBarrelBubblesForwardVelCheck OBJECT_FIELD_F32(0x1B) - -/* Water Level Pillar */ -#define /*0x0F8*/ oWaterLevelPillarDrained OBJECT_FIELD_S32(0x1C) - -/* Water Level Trigger */ -#define /*0x0F4*/ oWaterLevelTriggerAmbientWaves OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oWaterLevelTriggerTargetWaterLevel OBJECT_FIELD_S32(0x1C) - -/* Water Objects */ -#define /*0x0F4*/ oWaterObjScaleXAngle OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oWaterObjScaleYAngle OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oWaterObjScaleXAngleVel OBJECT_FIELD_S32(0x1D) -#define /*0x100*/ oWaterObjScaleYAngleVel OBJECT_FIELD_S32(0x1E) - -/* Water Ring (both variants) */ -#define /*0x0F4*/ O_WATER_RING_SCALE_PHASE_INDEX 0x1B -#define /*0x0F4*/ O_WATER_RING_SCALE_PHASE_X_INDEX (O_WATER_RING_SCALE_PHASE_INDEX + 0) // 0x1B -#define /*0x0F8*/ O_WATER_RING_SCALE_PHASE_Y_INDEX (O_WATER_RING_SCALE_PHASE_INDEX + 1) // 0x1C -#define /*0x0FC*/ O_WATER_RING_SCALE_PHASE_Z_INDEX (O_WATER_RING_SCALE_PHASE_INDEX + 2) // 0x1D -#define /*0x0F4*/ oWaterRingScalePhaseVec OBJECT_FIELD_S32(O_WATER_RING_SCALE_PHASE_INDEX) -#define /*0x0F4*/ oWaterRingScalePhaseX OBJECT_FIELD_S32(O_WATER_RING_SCALE_PHASE_X_INDEX) -#define /*0x0F8*/ oWaterRingScalePhaseY OBJECT_FIELD_S32(O_WATER_RING_SCALE_PHASE_Y_INDEX) -#define /*0x0FC*/ oWaterRingScalePhaseZ OBJECT_FIELD_S32(O_WATER_RING_SCALE_PHASE_Z_INDEX) -#define /*0x100*/ O_WATER_RING_NORMAL_INDEX 0x1E -#define /*0x100*/ O_WATER_RING_NORMAL_X_INDEX (O_WATER_RING_NORMAL_INDEX + 0) // 0x1E -#define /*0x104*/ O_WATER_RING_NORMAL_Y_INDEX (O_WATER_RING_NORMAL_INDEX + 1) // 0x1F -#define /*0x108*/ O_WATER_RING_NORMAL_Z_INDEX (O_WATER_RING_NORMAL_INDEX + 2) // 0x20 -#define /*0x100*/ oWaterRingNormalVec OBJECT_FIELD_F32(O_WATER_RING_NORMAL_INDEX) -#define /*0x100*/ oWaterRingNormalX OBJECT_FIELD_F32(O_WATER_RING_NORMAL_X_INDEX) -#define /*0x104*/ oWaterRingNormalY OBJECT_FIELD_F32(O_WATER_RING_NORMAL_Y_INDEX) -#define /*0x108*/ oWaterRingNormalZ OBJECT_FIELD_F32(O_WATER_RING_NORMAL_Z_INDEX) -#define /*0x10C*/ oWaterRingMarioDistInFront OBJECT_FIELD_F32(0x21) -#define /*0x110*/ oWaterRingIndex OBJECT_FIELD_S32(0x22) -#define /*0x1AC*/ oWaterRingAvgScale OBJECT_FIELD_F32(0x49) - -/* Water Ring Spawner (Jet Stream Ring Spawner and Manta Ray) */ -#define /*0x1AC*/ oWaterRingSpawnerRingsCollected OBJECT_FIELD_S32(0x49) - -/* Water Ring Manager (Jet Stream Ring Spawner and Manta Ray Ring Manager) */ -#define /*0x0F4*/ oWaterRingMgrNextRingIndex OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oWaterRingMgrLastRingCollected OBJECT_FIELD_S32(0x1C) - -/* Wave Trail */ -#define /*0x0F8*/ oWaveTrailSize OBJECT_FIELD_F32(0x1C) - -/* Whirlpool */ -#define /*0x0F4*/ oWhirlpoolInitFacePitch OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oWhirlpoolInitFaceRoll OBJECT_FIELD_S32(0x1C) - -/* White Puff Explode */ -#define /*0x0F4*/ oWhitePuffScaleX OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oWhitePuffOpacityDiff OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oWhitePuffSlowFade OBJECT_FIELD_S32(0x1D) - -/* White Wind Particle */ -#define /*0x0F4*/ oStrongWindParticlePenguinObj OBJECT_FIELD_OBJ(0x1B) - -/* Whomp */ -#define /*0x0F8*/ oWhompShakeVal OBJECT_FIELD_S32(0x1C) - -/* Wiggler */ -#define /*0x0F4*/ oWigglerFallThroughFloorsHeight OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oWigglerSegments OBJECT_FIELD_CHAIN_SEGMENT(0x1C) -#define /*0x0FC*/ oWigglerWalkAnimSpeed OBJECT_FIELD_F32(0x1D) -#define /*0x104*/ oWigglerSquishSpeed OBJECT_FIELD_F32(0x1F) -#define /*0x108*/ oWigglerTimeUntilRandomTurn OBJECT_FIELD_S32(0x20) -#define /*0x10C*/ oWigglerTargetYaw OBJECT_FIELD_S32(0x21) -#define /*0x110*/ oWigglerWalkAwayFromWallTimer OBJECT_FIELD_S32(0x22) -#define /*0x1AC*/ oWigglerUnused OBJECT_FIELD_S16(0x49, 0) -#define /*0x1AE*/ oWigglerTextStatus OBJECT_FIELD_S16(0x49, 1) - -/* Lll Wood Piece */ -#define /*0x0F4*/ oLllWoodPieceOscillationTimer OBJECT_FIELD_S32(0x1B) - -/* Wooden Post */ -#define /*0x0F4*/ oWoodenPostTotalMarioAngle OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oWoodenPostPrevAngleToMario OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oWoodenPostSpeedY OBJECT_FIELD_F32(0x1D) -#define /*0x100*/ oWoodenPostMarioPounding OBJECT_FIELD_S32(0x1E) -#define /*0x104*/ oWoodenPostOffsetY OBJECT_FIELD_F32(0x1F) - -/* Yoshi */ -#define /*0x0F4*/ oYoshiBlinkTimer OBJECT_FIELD_S32(0x1B) -#define /*0x0FC*/ oYoshiChosenHome OBJECT_FIELD_S32(0x1D) -#define /*0x100*/ oYoshiTargetYaw OBJECT_FIELD_S32(0x1E) - - -/*Custom general defines: - -For general s32 ints, use o->oF4, oF8, oFC, o100, o104, o108, o10C, and o110 - -For floats, apply the prefix "oFloat" before the index. For object pointers, apply "oObj", and for surface pointers, apply "oSurf" - -Examples: o->oFloatF4, o->oSurf10C - -s16 variables are also supported, and using them effectly can double the number of available members. The full list of s16 defines is: - -os16F4 -os16F6 -os16F8 -os16FA -os16FC -os16FE -os16100 -os16102 -os16104 -os16106 -os16108 -os1610A -os1610C -os1610E -os16110 -os16112*/ - -#define /*0x0F4*/ oF4 OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oF8 OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oFC OBJECT_FIELD_S32(0x1D) -#define /*0x100*/ o100 OBJECT_FIELD_S32(0x1E) -#define /*0x104*/ o104 OBJECT_FIELD_S32(0x1F) -#define /*0x108*/ o108 OBJECT_FIELD_S32(0x20) -#define /*0x10C*/ o10C OBJECT_FIELD_S32(0x21) -#define /*0x110*/ o110 OBJECT_FIELD_S32(0x22) - -#define /*0x0F4*/ oFloatF4 OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oFloatF8 OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oFloatFC OBJECT_FIELD_F32(0x1D) -#define /*0x100*/ oFloat100 OBJECT_FIELD_F32(0x1E) -#define /*0x104*/ oFloat104 OBJECT_FIELD_F32(0x1F) -#define /*0x108*/ oFloat108 OBJECT_FIELD_F32(0x20) -#define /*0x10C*/ oFloat10C OBJECT_FIELD_F32(0x21) -#define /*0x110*/ oFloat110 OBJECT_FIELD_F32(0x22) - -#define /*0x0F4*/ oObjF4 OBJECT_FIELD_OBJ(0x1B) -#define /*0x0F8*/ oObjF8 OBJECT_FIELD_OBJ(0x1C) -#define /*0x0FC*/ oObjFC OBJECT_FIELD_OBJ(0x1D) -#define /*0x100*/ oObj100 OBJECT_FIELD_OBJ(0x1E) -#define /*0x104*/ oObj104 OBJECT_FIELD_OBJ(0x1F) -#define /*0x108*/ oObj108 OBJECT_FIELD_OBJ(0x20) -#define /*0x10C*/ oObj10C OBJECT_FIELD_OBJ(0x21) -#define /*0x110*/ oObj110 OBJECT_FIELD_OBJ(0x22) - -#define /*0x0F4*/ oSurfF4 OBJECT_FIELD_SURFACE(0x1B) -#define /*0x0F8*/ oSurfF8 OBJECT_FIELD_SURFACE(0x1C) -#define /*0x0FC*/ oSurfFC OBJECT_FIELD_SURFACE(0x1D) -#define /*0x100*/ oSurf100 OBJECT_FIELD_SURFACE(0x1E) -#define /*0x104*/ oSurf104 OBJECT_FIELD_SURFACE(0x1F) -#define /*0x108*/ oSurf108 OBJECT_FIELD_SURFACE(0x20) -#define /*0x10C*/ oSurf10C OBJECT_FIELD_SURFACE(0x21) -#define /*0x110*/ oSurf110 OBJECT_FIELD_SURFACE(0x22) - -#define /*0x0F4*/ os16F4 OBJECT_FIELD_S16(0x1B, 0) -#define /*0x0F6*/ os16F6 OBJECT_FIELD_S16(0x1B, 1) -#define /*0x0F8*/ os16F8 OBJECT_FIELD_S16(0x1C, 0) -#define /*0x0FA*/ os16FA OBJECT_FIELD_S16(0x1C, 1) -#define /*0x0FC*/ os16FC OBJECT_FIELD_S16(0x1D, 0) -#define /*0x0FE*/ os16FE OBJECT_FIELD_S16(0x1D, 1) -#define /*0x100*/ os16100 OBJECT_FIELD_S16(0x1E, 0) -#define /*0x102*/ os16102 OBJECT_FIELD_S16(0x1E, 1) -#define /*0x104*/ os16104 OBJECT_FIELD_S16(0x1F, 0) -#define /*0x106*/ os16106 OBJECT_FIELD_S16(0x1F, 1) -#define /*0x108*/ os16108 OBJECT_FIELD_S16(0x20, 0) -#define /*0x10A*/ os1610A OBJECT_FIELD_S16(0x20, 1) -#define /*0x10C*/ os1610C OBJECT_FIELD_S16(0x21, 0) -#define /*0x10E*/ os1610E OBJECT_FIELD_S16(0x21, 1) -#define /*0x110*/ os16110 OBJECT_FIELD_S16(0x22, 0) -#define /*0x112*/ os16112 OBJECT_FIELD_S16(0x22, 1) - - -#endif // OBJECT_FIELDS_H diff --git a/include/sm64.h b/include/sm64.h index f9c44cd092..a631f989eb 100644 --- a/include/sm64.h +++ b/include/sm64.h @@ -5,7 +5,7 @@ #include "types.h" #include "config.h" -#include "object_fields.h" +#include "global_object_fields.h" #include "object_constants.h" #include "sounds.h" #include "model_ids.h" diff --git a/sm64.ld b/sm64.ld index 43f3590928..85f98a4028 100755 --- a/sm64.ld +++ b/sm64.ld @@ -261,8 +261,7 @@ SECTIONS BEGIN_SEG(engine, .) { BUILD_DIR/src/game*.o(.text*); - BUILD_DIR/src/game/behavior_actions.o(.text*); - BUILD_DIR/src/game/obj_behaviors_2.o(.text*); + BUILD_DIR/src/game/behaviors*.o(.text*); BUILD_DIR/src/game/obj_behaviors.o(.text*); BUILD_DIR/src/game/object_helpers.o(.text*); BUILD_DIR/src/game/rendering_graph_node.o(.text*); diff --git a/src/engine/behavior_script.c b/src/engine/behavior_script.c index 282b8b3b11..054fbf13ae 100644 --- a/src/engine/behavior_script.c +++ b/src/engine/behavior_script.c @@ -8,7 +8,6 @@ #include "game/game_init.h" #include "game/mario.h" #include "game/memory.h" -#include "game/obj_behaviors_2.h" #include "game/object_helpers.h" #include "game/object_list_processor.h" #include "math_util.h" diff --git a/src/game/behavior_actions.c b/src/game/behavior_actions.c deleted file mode 100644 index ee66b6b02a..0000000000 --- a/src/game/behavior_actions.c +++ /dev/null @@ -1,236 +0,0 @@ -#include - -#include "types.h" -#include "actors/vanilla_actors/bob/header.h" -#include "actors/vanilla_actors/wf/header.h" -#include "actors/vanilla_actors/bbh/header.h" -#include "actors/vanilla_actors/hmc/header.h" -#include "actors/vanilla_actors/lll/header.h" -#include "actors/vanilla_actors/wdw/header.h" -#include "actors/vanilla_actors/bitfs/header.h" -#include "actors/vanilla_actors/castle_inside/header.h" -#include "actors/common1.h" -#include "actors/group12.h" -#include "actors/group13.h" -#include "area.h" -#include "audio/external.h" -#include "behavior_actions.h" -#include "behavior_data.h" -#include "camera.h" -#include "debug.h" -#include "dialog_ids.h" -#include "engine/behavior_script.h" -#include "engine/graph_node.h" -#include "engine/math_util.h" -#include "engine/surface_collision.h" -#include "engine/surface_load.h" -#include "game_init.h" -#include "ingame_menu.h" -#include "interaction.h" -#include "level_table.h" -#include "level_update.h" -#include "main.h" -#include "mario.h" -#include "mario_actions_cutscene.h" -#include "mario_step.h" -#include "obj_behaviors.h" -#include "obj_behaviors_2.h" -#include "object_constants.h" -#include "object_helpers.h" -#include "object_list_processor.h" -#include "paintings.h" -#include "platform_displacement.h" -#include "rendering_graph_node.h" -#include "save_file.h" -#include "seq_ids.h" -#include "sm64.h" -#include "spawn_object.h" -#include "spawn_sound.h" -#include "rumble_init.h" - -#include "behaviors/star_door.inc.c" -#include "behaviors/mr_i.inc.c" -#include "behaviors/pole.inc.c" -#include "behaviors/thi_top.inc.c" -#include "behaviors/capswitch.inc.c" -#include "behaviors/king_bobomb.inc.c" -#include "behaviors/beta_chest.inc.c" -#include "behaviors/water_objs.inc.c" -#include "behaviors/cannon.inc.c" -#include "behaviors/chuckya.inc.c" -#include "behaviors/breakable_wall.inc.c" -#include "behaviors/kickable_board.inc.c" -#include "behaviors/tower_door.inc.c" -#include "behaviors/rotating_platform.inc.c" -#include "behaviors/koopa_shell_underwater.inc.c" -#include "behaviors/warp.inc.c" -#include "behaviors/white_puff_explode.inc.c" - -// not in behavior file -static struct SpawnParticlesInfo sMistParticles = { - /* behParam: */ 2, - /* count: */ 20, - /* model: */ MODEL_MIST, - /* offsetY: */ 0, - /* forwardVelBase: */ 40, - /* forwardVelRange: */ 5, - /* velYBase: */ 30, - /* velYRange: */ 20, - /* gravity: */ 252, - /* dragStrength: */ 30, - /* sizeBase: */ 330.0f, - /* sizeRange: */ 10.0f, -}; - -// generate_wind_puffs/dust (something like that) -void spawn_mist_particles_variable(s32 count, s32 offsetY, f32 size) { - sMistParticles.sizeBase = size; - sMistParticles.sizeRange = size / 20.0f; - sMistParticles.offsetY = offsetY; - - if (count == 0) { - sMistParticles.count = 20; - } else if (count > 20) { - sMistParticles.count = count; - } else { - sMistParticles.count = 4; - } - - cur_obj_spawn_particles(&sMistParticles); -} - -#include "behaviors/sparkle_spawn_star.inc.c" -#include "behaviors/coin.inc.c" -#include "behaviors/collide_particles.inc.c" -#include "behaviors/door.inc.c" -#include "behaviors/thwomp.inc.c" -#include "behaviors/tumbling_bridge.inc.c" -#include "behaviors/elevator.inc.c" -#include "behaviors/water_mist_particle.inc.c" -#include "behaviors/break_particles.inc.c" -#include "behaviors/water_mist.inc.c" -#include "behaviors/ground_particles.inc.c" -#include "behaviors/wind.inc.c" -#include "behaviors/unused_particle_spawn.inc.c" -#include "behaviors/ukiki_cage.inc.c" -#include "behaviors/falling_rising_platform.inc.c" -#include "behaviors/fishing_boo.inc.c" -#include "behaviors/flamethrower.inc.c" -#include "behaviors/bouncing_fireball.inc.c" -#include "behaviors/shock_wave.inc.c" -#include "behaviors/flame_mario.inc.c" -#include "behaviors/beta_fish_splash_spawner.inc.c" -#include "behaviors/spindrift.inc.c" -#include "behaviors/tower_platform.inc.c" -#include "behaviors/tree_particles.inc.c" -#include "behaviors/square_platform_cycle.inc.c" -#include "behaviors/piranha_bubbles.inc.c" -#include "behaviors/purple_switch.inc.c" -#include "behaviors/metal_box.inc.c" -#include "behaviors/breakable_box.inc.c" - -// not sure what this is doing here. not in a behavior file. -Gfx *geo_move_mario_part_from_parent(s32 callContext, UNUSED struct GraphNode *node, Mat4 mtx) { - - if (callContext == GEO_CONTEXT_RENDER) { - struct Object *obj = (struct Object *) gCurGraphNodeObject; - if (obj == gMarioObject && obj->prevObj != NULL) { - obj_update_pos_from_parent_transformation(mtx, obj->prevObj); - obj_set_gfx_pos_from_pos(obj->prevObj); - } - } - - return NULL; -} - -#include "behaviors/heave_ho.inc.c" -#include "behaviors/spawn_star_exit.inc.c" -#include "behaviors/unused_poundable_platform.inc.c" -#include "behaviors/beta_trampoline.inc.c" -#include "behaviors/jumping_box.inc.c" -#include "behaviors/boo_cage.inc.c" - -// not in behavior file -// n is the number of objects to spawn, r if the rate of change of phase (frequency?) -void spawn_sparkle_particles(s32 n, s32 radius, s32 height, s32 r) { - static s16 spawnSparkleParticleAngle = 0x0; - s32 i; - s16 separation = 0x10000 / n; // Evenly spread around a circle - - for (i = 0; i < n; i++) { - spawn_object_relative(OBJ_BP_NONE, sins(spawnSparkleParticleAngle + i * separation) * radius, (i + 1) * height, - coss(spawnSparkleParticleAngle + i * separation) * radius, o, MODEL_NONE, bhvSparkleSpawn); - } - - spawnSparkleParticleAngle += r * 0x100; -} - -#include "behaviors/beta_boo_key.inc.c" -#include "behaviors/grand_star.inc.c" -#include "behaviors/bowser_key.inc.c" -#include "behaviors/bullet_bill.inc.c" -#include "behaviors/bowser.inc.c" -#include "behaviors/bowser_falling_platform.inc.c" -#include "behaviors/bowser_flame.inc.c" -#include "behaviors/blue_fish.inc.c" -#include "behaviors/checkerboard_platform.inc.c" -#include "behaviors/ddd_warp.inc.c" -#include "behaviors/water_pillar.inc.c" -#include "behaviors/moat_drainer.inc.c" -#include "behaviors/bowser_key_cutscene.inc.c" -#include "behaviors/moat_grill.inc.c" -#include "behaviors/clock_arm.inc.c" -#include "behaviors/ukiki.inc.c" -#include "behaviors/lll_octagonal_rotating_mesh.inc.c" -#include "behaviors/lll_sinking_rock_block.inc.c" -#include "behaviors/lll_rotating_hex_flame.inc.c" -#include "behaviors/lll_floating_wood_piece.inc.c" -#include "behaviors/lll_volcano_flames.inc.c" -#include "behaviors/lll_hexagonal_ring.inc.c" -#include "behaviors/lll_sinking_rectangle.inc.c" -#include "behaviors/tilting_inverted_pyramid.inc.c" -#include "behaviors/tox_box.inc.c" -#include "behaviors/piranha_plant.inc.c" -#include "behaviors/bowser_puzzle_piece.inc.c" - -void set_obj_anim_with_accel_and_sound(s16 frame1, s16 frame2, s32 sound) { - s32 range = o->header.gfx.animInfo.animAccel / 0x10000; - if (range == 0) { - range = 1; - } - - if (cur_obj_check_anim_frame_in_range(frame1, range) || cur_obj_check_anim_frame_in_range(frame2, range)) { - cur_obj_play_sound_2(sound); - } -} - -#include "behaviors/tuxie.inc.c" -#include "behaviors/fish.inc.c" -#include "behaviors/express_elevator.inc.c" -#include "behaviors/bub.inc.c" -#include "behaviors/exclamation_box.inc.c" -#include "behaviors/sound_spawner.inc.c" -#include "behaviors/ddd_sub.inc.c" -#include "behaviors/sushi.inc.c" -#include "behaviors/jrb_ship.inc.c" -#include "behaviors/white_puff.inc.c" -#include "behaviors/blue_coin.inc.c" -#include "behaviors/grill_door.inc.c" -#include "behaviors/wdw_water_level.inc.c" -#include "behaviors/tweester.inc.c" -#include "behaviors/boo.inc.c" -#include "behaviors/bbh_tilting_trap.inc.c" -#include "behaviors/bbh_haunted_bookshelf.inc.c" -#include "behaviors/bbh_merry_go_round.inc.c" -#include "behaviors/static_checkered_platform.inc.c" -#include "behaviors/beta_bowser_anchor.inc.c" -#include "behaviors/music_touch.inc.c" -#include "behaviors/castle_floor_trap.inc.c" -#include "behaviors/pole_base.inc.c" -#include "behaviors/sparkle_spawn.inc.c" -#include "behaviors/scuttlebug.inc.c" // :scuttleeyes: -#include "behaviors/whomp.inc.c" -#include "behaviors/water_splashes_and_waves.inc.c" -#include "behaviors/strong_wind_particle.inc.c" -#include "behaviors/sl_snowman_wind.inc.c" -#include "behaviors/sl_walking_penguin.inc.c" diff --git a/src/game/behavior_actions.h b/src/game/behavior_actions.h index 1bf0d9c413..95f2160164 100644 --- a/src/game/behavior_actions.h +++ b/src/game/behavior_actions.h @@ -15,6 +15,8 @@ void tox_box_move(f32 forwardVel, f32 a1, s16 deltaPitch, s16 deltaRoll); void play_penguin_walking_sound(s32 walk); s32 update_angle_from_move_flags(s32 *angle); void cur_obj_spawn_strong_wind_particles(s32 windSpread, f32 scale, f32 relPosX, f32 relPosY, f32 relPosZ); +void spawn_sparkle_particles(s32 n, s32 radius, s32 height, s32 r); +void set_obj_anim_with_accel_and_sound(s16 frame1, s16 frame2, s32 sound); //! Lots of these are duplicates void bhv_cap_switch_loop(void); @@ -550,6 +552,10 @@ void bhv_intro_scene_loop(void); void bhv_dust_smoke_loop(void); void bhv_yoshi_loop(void); void bhv_volcano_trap_loop(void); +void bhv_toad_message_loop(void); +void bhv_toad_message_init(void); +void bhv_unlock_door_star_init(void); +void bhv_unlock_door_star_loop(void); Gfx *geo_move_mario_part_from_parent(s32 callContext, UNUSED struct GraphNode *node, Mat4 mtx); diff --git a/src/game/behaviors/activated_bf_plat.inc.c b/src/game/behaviors/activated_bf_plat.c similarity index 88% rename from src/game/behaviors/activated_bf_plat.inc.c rename to src/game/behaviors/activated_bf_plat.c index c1cfd0188e..c9d6f9ec72 100644 --- a/src/game/behaviors/activated_bf_plat.inc.c +++ b/src/game/behaviors/activated_bf_plat.c @@ -1,3 +1,10 @@ +#include +#include "actors/vanilla_actors/bitfs/header.h" +#include "actors/vanilla_actors/bits/header.h" +#include "global_object_fields.h" +#include "game/object_helpers.h" +#include "levels/bitfs/header.h" +#include "levels/bits/header.h" /** * Behavior for bhvActivatedBackAndForthPlatform. @@ -6,6 +13,15 @@ * Note: The filename is abbreviated to avoid compiler seg fault on long paths */ +/* Activated Back and Forth Platform */ +#define /*0x0F4*/ oActivatedBackAndForthPlatformMaxOffset OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oActivatedBackAndForthPlatformOffset OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oActivatedBackAndForthPlatformVel OBJECT_FIELD_F32(0x1D) +#define /*0x100*/ oActivatedBackAndForthPlatformCountdown OBJECT_FIELD_S32(0x1E) +#define /*0x104*/ oActivatedBackAndForthPlatformStartYaw OBJECT_FIELD_S32(0x1F) +#define /*0x108*/ oActivatedBackAndForthPlatformVertical OBJECT_FIELD_S32(0x20) +#define /*0x10C*/ oActivatedBackAndForthPlatformFlipRotation OBJECT_FIELD_S32(0x21) + /** * Table of activated back-and-forth platform collision models. * The second entry is unused. It corresponds to the mesh platform diff --git a/src/game/behaviors/amp.inc.c b/src/game/behaviors/amp.c similarity index 96% rename from src/game/behaviors/amp.inc.c rename to src/game/behaviors/amp.c index bb198508db..ad009b35c9 100644 --- a/src/game/behaviors/amp.inc.c +++ b/src/game/behaviors/amp.c @@ -1,3 +1,9 @@ +#include +#include "global_object_fields.h" +#include "game/interaction.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" /** * Behavior for bhvHomingAmp and bhvCirclingAmp. @@ -6,6 +12,14 @@ * of 200, 300, 400, or 0 (stationary). */ +/* Amp */ +#define /*0x0F4*/ oAmpRadiusOfRotation OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oAmpYPhase OBJECT_FIELD_S32(0x1C) + +/* Homing Amp */ +#define /*0x0F4*/ oHomingAmpLockedOn OBJECT_FIELD_S32(0x1B) +#define /*0x0FC*/ oHomingAmpAvgY OBJECT_FIELD_F32(0x1D) + static struct ObjectHitbox sAmpHitbox = { /* interactType: */ INTERACT_SHOCK, /* downOffset: */ 40, diff --git a/src/game/behaviors/animated_floor_switch.inc.c b/src/game/behaviors/animated_floor_switch.c similarity index 82% rename from src/game/behaviors/animated_floor_switch.inc.c rename to src/game/behaviors/animated_floor_switch.c index e69907cf2d..1253d4a165 100644 --- a/src/game/behaviors/animated_floor_switch.inc.c +++ b/src/game/behaviors/animated_floor_switch.c @@ -1,4 +1,17 @@ -// animated_floor_switch.inc.c +#include +#include "actors/vanilla_actors/bitdw/header.h" +#include "actors/vanilla_actors/bits/header.h" +#include "actors/vanilla_actors/rr/header.h" +#include "behavior_data.h" +#include "global_object_fields.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Floor Switch Press Animation */ +#define /*0x0F4*/ oFloorSwitchPressAnimationTickTimer OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oFloorSwitchPressAnimationDoubleFrame OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oFloorSwitchPressAnimationDoResetTime OBJECT_FIELD_S32(0x1D) +#define /*0x100*/ oFloorSwitchPressAnimationSwitchNotTicking OBJECT_FIELD_S32(0x1E) struct FloorSwitchTriggeredAnimationFrame { const Collision *collision; diff --git a/src/game/behaviors/arrow_lift.inc.c b/src/game/behaviors/arrow_lift.c similarity index 94% rename from src/game/behaviors/arrow_lift.inc.c rename to src/game/behaviors/arrow_lift.c index 84d8818dbb..e10b7391e0 100644 --- a/src/game/behaviors/arrow_lift.inc.c +++ b/src/game/behaviors/arrow_lift.c @@ -1,3 +1,8 @@ +#include +#include "global_object_fields.h" +#include "game/object_helpers.h" + +#define /*0x0F4*/ oArrowLiftDisplacement OBJECT_FIELD_F32(0x1B) /** * Behavior for WDW arrow lifts. diff --git a/src/game/behaviors/bbh_haunted_bookshelf.inc.c b/src/game/behaviors/bbh_haunted_bookshelf.c similarity index 86% rename from src/game/behaviors/bbh_haunted_bookshelf.inc.c rename to src/game/behaviors/bbh_haunted_bookshelf.c index 1570e01ac7..53b21ba03c 100644 --- a/src/game/behaviors/bbh_haunted_bookshelf.inc.c +++ b/src/game/behaviors/bbh_haunted_bookshelf.c @@ -1,3 +1,7 @@ +#include +#include "global_object_fields.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" /** * Behavior for bhvHauntedBookshelf. @@ -5,6 +9,9 @@ * Its sole purpose is to recede when its action is set to 1 by a bhvHauntedBookshelfManager. */ +/* Haunted Bookshelf */ +#define /*0x088*/ oHauntedBookshelfShouldOpen OBJECT_FIELD_S32(0x00) + /** * Update function for bhvHauntedBookshelf. */ diff --git a/src/game/behaviors/bbh_merry_go_round.inc.c b/src/game/behaviors/bbh_merry_go_round.c similarity index 90% rename from src/game/behaviors/bbh_merry_go_round.inc.c rename to src/game/behaviors/bbh_merry_go_round.c index 1af78ad930..da9a08e778 100644 --- a/src/game/behaviors/bbh_merry_go_round.inc.c +++ b/src/game/behaviors/bbh_merry_go_round.c @@ -1,9 +1,21 @@ +#include +#include "global_object_fields.h" +#include "seq_ids.h" +#include "audio/external.h" +#include "game/level_update.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" /** * Behavior for bhvMerryGoRound. * This is the merry-go-round in BBH. */ +/* Merry-Go-Round */ +#define /*0x088*/ oMerryGoRoundStopped OBJECT_FIELD_S32(0x00) +#define /*0x0F8*/ oMerryGoRoundMusicShouldPlay OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oMerryGoRoundMarioIsOutside OBJECT_FIELD_S32(0x1D) + /** * This function handles the merry-go-round's music. * It starts the music when Mario enters the room around the diff --git a/src/game/behaviors/bbh_tilting_trap.inc.c b/src/game/behaviors/bbh_tilting_trap.c similarity index 94% rename from src/game/behaviors/bbh_tilting_trap.inc.c rename to src/game/behaviors/bbh_tilting_trap.c index ad2d587efe..663f61df3c 100644 --- a/src/game/behaviors/bbh_tilting_trap.inc.c +++ b/src/game/behaviors/bbh_tilting_trap.c @@ -1,3 +1,7 @@ +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" /** * Behavior for bhvBbhTiltingTrapPlatform. diff --git a/src/game/behaviors/beta_boo_key.inc.c b/src/game/behaviors/beta_boo_key.c similarity index 97% rename from src/game/behaviors/beta_boo_key.inc.c rename to src/game/behaviors/beta_boo_key.c index 8280f87b0a..7957ef3f3f 100644 --- a/src/game/behaviors/beta_boo_key.inc.c +++ b/src/game/behaviors/beta_boo_key.c @@ -1,3 +1,9 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" + /** * Behavior for bhvAlphaBooKey and bhvBetaBooKey. diff --git a/src/game/behaviors/beta_bowser_anchor.inc.c b/src/game/behaviors/beta_bowser_anchor.c similarity index 88% rename from src/game/behaviors/beta_bowser_anchor.inc.c rename to src/game/behaviors/beta_bowser_anchor.c index f04758400f..724cd26922 100644 --- a/src/game/behaviors/beta_bowser_anchor.inc.c +++ b/src/game/behaviors/beta_bowser_anchor.c @@ -1,3 +1,7 @@ +#include +#include "global_object_fields.h" +#include "game/debug.h" +#include "game/object_helpers.h" /** * Behavior for bhvBetaBowserAnchor. diff --git a/src/game/behaviors/beta_chest.inc.c b/src/game/behaviors/beta_chest.c similarity index 93% rename from src/game/behaviors/beta_chest.inc.c rename to src/game/behaviors/beta_chest.c index 20a2665005..ea770e3c7d 100644 --- a/src/game/behaviors/beta_chest.inc.c +++ b/src/game/behaviors/beta_chest.c @@ -1,3 +1,9 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" /** * Behavior for bhvBetaChestBottom and bhvBetaChestLid. diff --git a/src/game/behaviors/beta_fish_splash_spawner.inc.c b/src/game/behaviors/beta_fish_splash_spawner.c similarity index 86% rename from src/game/behaviors/beta_fish_splash_spawner.inc.c rename to src/game/behaviors/beta_fish_splash_spawner.c index 014f2c8f45..97422be612 100644 --- a/src/game/behaviors/beta_fish_splash_spawner.inc.c +++ b/src/game/behaviors/beta_fish_splash_spawner.c @@ -1,3 +1,6 @@ +#include +#include "global_object_fields.h" +#include "game/object_helpers.h" /** * Behavior for bhvBetaFishSplashSpawner. diff --git a/src/game/behaviors/beta_holdable_object.inc.c b/src/game/behaviors/beta_holdable_object.c similarity index 95% rename from src/game/behaviors/beta_holdable_object.inc.c rename to src/game/behaviors/beta_holdable_object.c index f3038f5153..749e7410f9 100644 --- a/src/game/behaviors/beta_holdable_object.inc.c +++ b/src/game/behaviors/beta_holdable_object.c @@ -1,3 +1,6 @@ +#include +#include "global_object_fields.h" +#include "game/object_helpers.h" /** * Behavior for bhvBetaHoldableObject. diff --git a/src/game/behaviors/beta_trampoline.inc.c b/src/game/behaviors/beta_trampoline.c similarity index 93% rename from src/game/behaviors/beta_trampoline.inc.c rename to src/game/behaviors/beta_trampoline.c index 3dac6729b1..8eeb0cf579 100644 --- a/src/game/behaviors/beta_trampoline.inc.c +++ b/src/game/behaviors/beta_trampoline.c @@ -1,3 +1,8 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "game/mario_step.h" +#include "game/object_helpers.h" /** * Behavior for bhvBetaTrampolineTop and bhvBetaTrampolineSpring. @@ -7,6 +12,9 @@ * the spring, and the base. The base is a static object with no behavior. */ +/* Beta Trampoline */ +#define /*0x110*/ oBetaTrampolineMarioOnTrampoline OBJECT_FIELD_S32(0x22) + /** * Update function for bhvBetaTrampolineSpring. * The spring continuously updates to be 75 units below the top. diff --git a/src/game/behaviors/bird.inc.c b/src/game/behaviors/bird.c similarity index 83% rename from src/game/behaviors/bird.inc.c rename to src/game/behaviors/bird.c index 1282294767..26ce24fc82 100644 --- a/src/game/behaviors/bird.inc.c +++ b/src/game/behaviors/bird.c @@ -1,3 +1,9 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" /** * Behavior for bhvBird. These are the birds in the castle grounds @@ -9,6 +15,17 @@ * immediately after spawning. */ +/* Bird */ +#define /*0x0F4*/ oBirdSpeed OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ O_BIRD_TARGET_ANGLE_INDEX 0x1C +#define /*0x0F8*/ O_BIRD_TARGET_PITCH_INDEX (O_BIRD_TARGET_ANGLE_INDEX + 0) // 0x1C +#define /*0x0FC*/ O_BIRD_TARGET_YAW_INDEX (O_BIRD_TARGET_ANGLE_INDEX + 1) // 0x1D +#define /*0x100*/ O_BIRD_TARGET_ROLL_INDEX (O_BIRD_TARGET_ANGLE_INDEX + 2) // 0x1E +#define /*0x0F8*/ oBirdTargetAngleVec OBJECT_FIELD_S32(O_BIRD_TARGET_ANGLE_INDEX) +#define /*0x0F8*/ oBirdTargetPitch OBJECT_FIELD_S32(O_BIRD_TARGET_PITCH_INDEX) +#define /*0x0FC*/ oBirdTargetYaw OBJECT_FIELD_S32(O_BIRD_TARGET_YAW_INDEX) +#define /*0x100*/ oBirdTargetRoll OBJECT_FIELD_S32(O_BIRD_TARGET_ROLL_INDEX) // unused + /** * If the object is a spawned bird, start flying; if it's a spawner bird, * spawn spawned birds if Mario comes within 2000 units of it. diff --git a/src/game/behaviors/blue_coin.inc.c b/src/game/behaviors/blue_coin.c similarity index 94% rename from src/game/behaviors/blue_coin.inc.c rename to src/game/behaviors/blue_coin.c index d9beb38862..889b5a12cb 100644 --- a/src/game/behaviors/blue_coin.inc.c +++ b/src/game/behaviors/blue_coin.c @@ -1,3 +1,13 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "engine/math_util.h" +#include "engine/surface_load.h" +#include "game/interaction.h" +#include "game/level_update.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" /** * Behavior for bhvHiddenBlueCoin and bhvBlueCoinSwitch. @@ -5,6 +15,9 @@ * you press a blue coin switch (a.k.a. bhvBlueCoinSwitch). */ +/* Hidden Blue Coin */ +#define /*0x0F8*/ oHiddenBlueCoinSwitch OBJECT_FIELD_OBJ(0x1C) + /** * Update function for bhvHiddenBlueCoin. */ diff --git a/src/game/behaviors/blue_fish.inc.c b/src/game/behaviors/blue_fish.c similarity index 92% rename from src/game/behaviors/blue_fish.inc.c rename to src/game/behaviors/blue_fish.c index 452748dac7..fe2fa02809 100644 --- a/src/game/behaviors/blue_fish.inc.c +++ b/src/game/behaviors/blue_fish.c @@ -1,9 +1,19 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" /** * @file blue_fish.inc.c * Implements behaviour and spawning for bhvBlueFish located in the castle aquarium outside of SA. */ +/* Blue Fish */ +#define /*0x0F4*/ oBlueFishRandomVel OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oBlueFishRandomTime OBJECT_FIELD_S32(0x1C) +#define /*0x100*/ oBlueFishRandomAngle OBJECT_FIELD_F32(0x1E) + /** * Determines fish movement. */ diff --git a/src/game/behaviors/bobomb.inc.c b/src/game/behaviors/bobomb.c similarity index 90% rename from src/game/behaviors/bobomb.inc.c rename to src/game/behaviors/bobomb.c index 5f8a6fb645..0306f97ee5 100644 --- a/src/game/behaviors/bobomb.inc.c +++ b/src/game/behaviors/bobomb.c @@ -1,4 +1,34 @@ -// bobomb.inc.c +#include +#include "behavior_data.h" +#include "course_table.h" +#include "dialog_ids.h" +#include "model_ids.h" +#include "object_constants.h" +#include "sounds.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/ingame_menu.h" +#include "game/interaction.h" +#include "game/level_update.h" +#include "game/object_helpers.h" +#include "game/save_file.h" +#include "game/spawn_sound.h" + +/* Bob-omb */ +#define /*0x0F4*/ oBobombBlinkTimer OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oBobombFuseLit OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oBobombFuseTimer OBJECT_FIELD_S32(0x1D) + +/* Bob-omb Buddy */ +#define /*0x0F4*/ oBobombBuddyBlinkTimer OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oBobombBuddyHasTalkedToMario OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oBobombBuddyRole OBJECT_FIELD_S32(0x1D) +#define /*0x100*/ oBobombBuddyCannonStatus OBJECT_FIELD_S32(0x1E) +#define /*0x108*/ O_BOBOMB_BUDDY_POS_COPY_INDEX 0x20 +#define /*0x108*/ oBobombBuddyPosCopyVec OBJECT_FIELD_F32(O_BOBOMB_BUDDY_POS_COPY_INDEX) +#define /*0x108*/ oBobombBuddyPosXCopy OBJECT_FIELD_F32(O_BOBOMB_BUDDY_POS_COPY_INDEX + 0) +#define /*0x10C*/ oBobombBuddyPosYCopy OBJECT_FIELD_F32(O_BOBOMB_BUDDY_POS_COPY_INDEX + 1) +#define /*0x110*/ oBobombBuddyPosZCopy OBJECT_FIELD_F32(O_BOBOMB_BUDDY_POS_COPY_INDEX + 2) static struct ObjectHitbox sBobombHitbox = { /* interactType: */ INTERACT_GRABBABLE, diff --git a/src/game/behaviors/bomp.inc.c b/src/game/behaviors/bomp.c similarity index 93% rename from src/game/behaviors/bomp.inc.c rename to src/game/behaviors/bomp.c index cb8fa1e133..ed06c87c48 100644 --- a/src/game/behaviors/bomp.inc.c +++ b/src/game/behaviors/bomp.c @@ -1,4 +1,11 @@ -// bomp.inc.c +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Bomp (Small) */ +#define /*0x100*/ oSmallBompInitX OBJECT_FIELD_F32(0x1E) void bhv_small_bomp_init(void) { o->oFaceAngleYaw -= 0x4000; diff --git a/src/game/behaviors/boo.inc.c b/src/game/behaviors/boo.c similarity index 94% rename from src/game/behaviors/boo.inc.c rename to src/game/behaviors/boo.c index b9a4d8cda2..db5af11055 100644 --- a/src/game/behaviors/boo.inc.c +++ b/src/game/behaviors/boo.c @@ -1,4 +1,34 @@ -// boo.inc.c +#include +#include "behavior_data.h" +#include "dialog_ids.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "engine/math_util.h" +#include "game/debug.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Boo */ +#define /*0x088*/ oBooDeathStatus OBJECT_FIELD_S32(0x00) +#define /*0x0F4*/ oBooTargetOpacity OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oBooBaseScale OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oBooOscillationTimer OBJECT_FIELD_S32(0x1D) +#define /*0x100*/ oBooMoveYawDuringHit OBJECT_FIELD_S32(0x1E) +#define /*0x104*/ oBooMoveYawBeforeHit OBJECT_FIELD_F32(0x1F) +#define /*0x108*/ oBooParentBigBoo OBJECT_FIELD_OBJ(0x20) +#define /*0x10C*/ oBooNegatedAggressiveness OBJECT_FIELD_F32(0x21) +#define /*0x110*/ oBooInitialMoveYaw OBJECT_FIELD_S32(0x22) +#define /*0x1B0*/ oBooTurningSpeed OBJECT_FIELD_S16(0x4A, 0) + +/* Merry-Go-Round */ +#define /*0x088*/ oMerryGoRoundStopped OBJECT_FIELD_S32(0x00) +#define /*0x0F8*/ oMerryGoRoundMusicShouldPlay OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oMerryGoRoundMarioIsOutside OBJECT_FIELD_S32(0x1D) + +/* Merry-Go-Round Boo Manager */ +#define /*0x088*/ oMerryGoRoundBooManagerNumBoosKilled OBJECT_FIELD_S32(0x00) +#define /*0x0FC*/ oMerryGoRoundBooManagerNumBoosSpawned OBJECT_FIELD_S32(0x1D) #define SPAWN_CASTLE_BOO_STAR_REQUIREMENT 12 diff --git a/src/game/behaviors/boo_cage.inc.c b/src/game/behaviors/boo_cage.c similarity index 94% rename from src/game/behaviors/boo_cage.inc.c rename to src/game/behaviors/boo_cage.c index 136451d9cb..cfffe05c88 100644 --- a/src/game/behaviors/boo_cage.inc.c +++ b/src/game/behaviors/boo_cage.c @@ -1,3 +1,10 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" /** * Behavior for bhvBooCage. diff --git a/src/game/behaviors/boulder.inc.c b/src/game/behaviors/boulder.c similarity index 91% rename from src/game/behaviors/boulder.inc.c rename to src/game/behaviors/boulder.c index 418d4e5211..4f3e357826 100644 --- a/src/game/behaviors/boulder.inc.c +++ b/src/game/behaviors/boulder.c @@ -1,4 +1,9 @@ -// boulder.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" void bhv_big_boulder_init(void) { vec3f_copy(&o->oHomeVec, &o->oPosVec); diff --git a/src/game/behaviors/bouncing_fireball.inc.c b/src/game/behaviors/bouncing_fireball.c similarity index 87% rename from src/game/behaviors/bouncing_fireball.inc.c rename to src/game/behaviors/bouncing_fireball.c index ec51e7c71b..c9afac95a9 100644 --- a/src/game/behaviors/bouncing_fireball.inc.c +++ b/src/game/behaviors/bouncing_fireball.c @@ -1,4 +1,12 @@ -// bouncing_fireball.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" + +/* Bouncing FireBall */ +#define /*0x0F4*/ oBouncingFireBallSpawnerRandomCooldown OBJECT_FIELD_S32(0x1B) void bhv_bouncing_fireball_flame_loop(void) { o->activeFlags |= ACTIVE_FLAG_IGNORE_ENV_BOXES; diff --git a/src/game/behaviors/bowling_ball.inc.c b/src/game/behaviors/bowling_ball.c similarity index 94% rename from src/game/behaviors/bowling_ball.inc.c rename to src/game/behaviors/bowling_ball.c index d0996bde07..4c95e16020 100644 --- a/src/game/behaviors/bowling_ball.inc.c +++ b/src/game/behaviors/bowling_ball.c @@ -1,9 +1,22 @@ -// bowling_ball.inc.c - -// There is no good way to handle this +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" #include "levels/bob/header.h" #include "levels/ttm/header.h" +/* Bowling Ball */ +#define /*0x0F4*/ oBowlingBallTargetYaw OBJECT_FIELD_S32(0x1B) +// 0x1D-0x21 reserved for pathing + +/* Bowling Ball Spawner (Generic) */ +#define /*0x0F4*/ oBBallSpawnerMaxSpawnDist OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oBBallSpawnerSpawnOdds OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oBBallSpawnerPeriodMinus1 OBJECT_FIELD_S32(0x1D) + static struct ObjectHitbox sBowlingBallHitbox = { /* interactType: */ INTERACT_DAMAGE, /* downOffset: */ 0, diff --git a/src/game/behaviors/bowser.inc.c b/src/game/behaviors/bowser.c similarity index 97% rename from src/game/behaviors/bowser.inc.c rename to src/game/behaviors/bowser.c index d1c8aef9e9..6393096882 100644 --- a/src/game/behaviors/bowser.inc.c +++ b/src/game/behaviors/bowser.c @@ -1,4 +1,33 @@ -// bowser.inc.c +#include +#include "behavior_data.h" +#include "dialog_ids.h" +#include "global_object_fields.h" +#include "actors/group12.h" +#include "audio/external.h" +#include "engine/math_util.h" +#include "game/debug.h" +#include "game/game_init.h" +#include "game/interaction.h" +#include "game/level_update.h" +#include "game/object_helpers.h" +#include "game/platform_displacement.h" +#include "game/rendering_graph_node.h" +#include "game/spawn_sound.h" + +/* Bowser */ +#define /*0x0F8*/ oBowserTimer OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oBowserDistToCenter OBJECT_FIELD_F32(0x1D) +#define /*0x106*/ oBowserBitsJustJump OBJECT_FIELD_S16(0x1F, 1) +#define /*0x108*/ oBowserRandSplitFloor OBJECT_FIELD_S16(0x20, 0) +#define /*0x10A*/ oBowserHeldAnglePitch OBJECT_FIELD_S16(0x20, 1) +#define /*0x10D*/ oBowserHeldAngleVelYaw OBJECT_FIELD_S16(0x21, 0) +#define /*0x10E*/ oBowserGrabbedStatus OBJECT_FIELD_S16(0x21, 1) +#define /*0x110*/ oBowserIsReacting OBJECT_FIELD_S16(0x22, 0) +#define /*0x112*/ oBowserAngleToCenter OBJECT_FIELD_S16(0x22, 1) +#define /*0x1AC*/ oBowserTargetOpacity OBJECT_FIELD_S16(0x49, 0) +#define /*0x1AE*/ oBowserEyesTimer OBJECT_FIELD_S16(0x49, 1) +#define /*0x1B0*/ oBowserEyesShut OBJECT_FIELD_S16(0x4A, 0) +#define /*0x1B2*/ oBowserRainbowLight OBJECT_FIELD_S16(0x4A, 1) /** * Behavior for Bowser and it's actions (Tail, Flame, Body) diff --git a/src/game/behaviors/bowser_bomb.inc.c b/src/game/behaviors/bowser_bomb.c similarity index 88% rename from src/game/behaviors/bowser_bomb.inc.c rename to src/game/behaviors/bowser_bomb.c index 1366defdde..c27b2f828a 100644 --- a/src/game/behaviors/bowser_bomb.inc.c +++ b/src/game/behaviors/bowser_bomb.c @@ -1,4 +1,10 @@ -// bowser_bomb.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" void bhv_bowser_bomb_loop(void) { if (obj_check_if_collided_with_object(o, gMarioObject) == TRUE) { diff --git a/src/game/behaviors/bowser_falling_platform.inc.c b/src/game/behaviors/bowser_falling_platform.c similarity index 90% rename from src/game/behaviors/bowser_falling_platform.inc.c rename to src/game/behaviors/bowser_falling_platform.c index 7057e038ec..2193c2ae09 100644 --- a/src/game/behaviors/bowser_falling_platform.inc.c +++ b/src/game/behaviors/bowser_falling_platform.c @@ -1,7 +1,16 @@ -// bowser_falling_platform.inc.c - +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/debug.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" #include "levels/bowser_3/header.h" +/* Falling Bowser Bits Platform */ +#define /*0x0F8*/ oBitsPlatformBowser OBJECT_FIELD_OBJ(0x1C) +#define /*0x0FC*/ oBitsPlatformTimer OBJECT_FIELD_S32(0x1D) + struct BowserFallingPlatformData { const Collision *collision; s16 posX; diff --git a/src/game/behaviors/bowser_flame.inc.c b/src/game/behaviors/bowser_flame.c similarity index 95% rename from src/game/behaviors/bowser_flame.inc.c rename to src/game/behaviors/bowser_flame.c index 320f7c82a9..7e54909bb6 100644 --- a/src/game/behaviors/bowser_flame.inc.c +++ b/src/game/behaviors/bowser_flame.c @@ -1,4 +1,16 @@ -// bowser_flame.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/game_init.h" +#include "game/interaction.h" +#include "game/object_helpers.h" + +/* Bowser Flame */ +#define /*0x100*/ oFlameBowser OBJECT_FIELD_OBJ(0x1E) + +/* Blue Flame */ +#define /*0x0F8*/ oBlueFlameNextScale OBJECT_FIELD_F32(0x1C) struct ObjectHitbox sGrowingBowserFlameHitbox = { /* interactType: */ INTERACT_FLAME, diff --git a/src/game/behaviors/bowser_key.inc.c b/src/game/behaviors/bowser_key.c similarity index 88% rename from src/game/behaviors/bowser_key.inc.c rename to src/game/behaviors/bowser_key.c index 851e5c0594..76aae6ba09 100644 --- a/src/game/behaviors/bowser_key.inc.c +++ b/src/game/behaviors/bowser_key.c @@ -1,4 +1,9 @@ -// bowser_key.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" struct ObjectHitbox sBowserKeyHitbox = { /* interactType: */ INTERACT_STAR_OR_KEY, diff --git a/src/game/behaviors/bowser_key_cutscene.inc.c b/src/game/behaviors/bowser_key_cutscene.c similarity index 88% rename from src/game/behaviors/bowser_key_cutscene.inc.c rename to src/game/behaviors/bowser_key_cutscene.c index 2d6156db81..cf8f2af4f2 100644 --- a/src/game/behaviors/bowser_key_cutscene.inc.c +++ b/src/game/behaviors/bowser_key_cutscene.c @@ -1,4 +1,10 @@ -// bowser_key_cutscene.inc.c +#include +#include "global_object_fields.h" +#include "game/object_helpers.h" +#include "game/rendering_graph_node.h" + +/* Bowser Key Cutscene */ +#define /*0x0F4*/ oBowserKeyScale OBJECT_FIELD_F32(0x1B) Gfx *geo_scale_bowser_key(s32 callContext, struct GraphNode *node, UNUSED Mat4 mtx) { if (callContext == GEO_CONTEXT_RENDER) { diff --git a/src/game/behaviors/bowser_puzzle_piece.inc.c b/src/game/behaviors/bowser_puzzle_piece.c similarity index 93% rename from src/game/behaviors/bowser_puzzle_piece.inc.c rename to src/game/behaviors/bowser_puzzle_piece.c index efa6610691..997c85a3cb 100644 --- a/src/game/behaviors/bowser_puzzle_piece.inc.c +++ b/src/game/behaviors/bowser_puzzle_piece.c @@ -1,3 +1,25 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Bowser Puzzle */ +#define /*0x0F4*/ oBowserPuzzleCompletionFlags OBJECT_FIELD_S32(0x1B) + +/* Bowser Puzzle Piece */ +#define /*0x0FC*/ O_BOWSER_PUZZLE_PIECE_OFFSET_INDEX 0x1D +#define /*0x0FC*/ O_BOWSER_PUZZLE_PIECE_OFFSET_X_INDEX (O_BOWSER_PUZZLE_PIECE_OFFSET_INDEX + 0) // 0x1D +#define /*0x100*/ O_BOWSER_PUZZLE_PIECE_OFFSET_Y_INDEX (O_BOWSER_PUZZLE_PIECE_OFFSET_INDEX + 1) // 0x1E +#define /*0x104*/ O_BOWSER_PUZZLE_PIECE_OFFSET_Z_INDEX (O_BOWSER_PUZZLE_PIECE_OFFSET_INDEX + 2) // 0x1F +#define /*0x0FC*/ oBowserPuzzlePieceOffsetVec OBJECT_FIELD_F32(O_BOWSER_PUZZLE_PIECE_OFFSET_INDEX) +#define /*0x0FC*/ oBowserPuzzlePieceOffsetX OBJECT_FIELD_F32(O_BOWSER_PUZZLE_PIECE_OFFSET_X_INDEX) +#define /*0x100*/ oBowserPuzzlePieceOffsetY OBJECT_FIELD_F32(O_BOWSER_PUZZLE_PIECE_OFFSET_Y_INDEX) +#define /*0x104*/ oBowserPuzzlePieceOffsetZ OBJECT_FIELD_F32(O_BOWSER_PUZZLE_PIECE_OFFSET_Z_INDEX) +#define /*0x108*/ oBowserPuzzlePieceContinuePerformingAction OBJECT_FIELD_S32(0x20) +#define /*0x10C*/ oBowserPuzzlePieceActionList OBJECT_FIELD_VPTR(0x21) +#define /*0x110*/ oBowserPuzzlePieceNextAction OBJECT_FIELD_VPTR(0x22) /** * Behavior for the sliding Bowser puzzle in Lethal Lava Land. diff --git a/src/game/behaviors/break_particles.inc.c b/src/game/behaviors/break_particles.c similarity index 86% rename from src/game/behaviors/break_particles.inc.c rename to src/game/behaviors/break_particles.c index a3db1aa47e..d6c1ab09c1 100644 --- a/src/game/behaviors/break_particles.inc.c +++ b/src/game/behaviors/break_particles.c @@ -1,4 +1,8 @@ -// break_particles.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" void spawn_triangle_break_particles(s16 numTris, s16 triModel, f32 triSize, s16 triAnimState) { struct Object *triangle; diff --git a/src/game/behaviors/breakable_box.inc.c b/src/game/behaviors/breakable_box.c similarity index 93% rename from src/game/behaviors/breakable_box.inc.c rename to src/game/behaviors/breakable_box.c index c90b780eda..db4917f0ee 100644 --- a/src/game/behaviors/breakable_box.inc.c +++ b/src/game/behaviors/breakable_box.c @@ -1,4 +1,12 @@ -// breakable_box.inc.c +#include +#include "actors/vanilla_actors/wdw/header.h" +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/surface_load.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" +#include "levels/wdw/header.h" struct ObjectHitbox sBreakableBoxHitbox = { /* interactType: */ INTERACT_BREAKABLE, diff --git a/src/game/behaviors/breakable_box_small.inc.c b/src/game/behaviors/breakable_box_small.c similarity index 91% rename from src/game/behaviors/breakable_box_small.inc.c rename to src/game/behaviors/breakable_box_small.c index d4ac514b1a..425f6e62ce 100644 --- a/src/game/behaviors/breakable_box_small.inc.c +++ b/src/game/behaviors/breakable_box_small.c @@ -1,4 +1,14 @@ -// breakable_box.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Breakable Box Small (Small Cork Box) */ +#define /*0x0F4*/ oBreakableBoxSmallReleased OBJECT_FIELD_S32(0x1B) +#define /*0x0FC*/ oBreakableBoxSmallFramesSinceReleased OBJECT_FIELD_S32(0x1D) struct ObjectHitbox sBreakableBoxSmallHitbox = { /* interactType: */ INTERACT_GRABBABLE, diff --git a/src/game/behaviors/breakable_wall.inc.c b/src/game/behaviors/breakable_wall.c similarity index 71% rename from src/game/behaviors/breakable_wall.inc.c rename to src/game/behaviors/breakable_wall.c index c6dd686218..0bc83ea5b6 100644 --- a/src/game/behaviors/breakable_wall.inc.c +++ b/src/game/behaviors/breakable_wall.c @@ -1,4 +1,11 @@ -// breakable_wall.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "game/interaction.h" +#include "game/level_update.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" void bhv_wf_breakable_wall_loop(void) { if (gMarioState->action == ACT_SHOT_FROM_CANNON) { diff --git a/src/game/behaviors/bub.inc.c b/src/game/behaviors/bub.c similarity index 87% rename from src/game/behaviors/bub.inc.c rename to src/game/behaviors/bub.c index 127b1265de..0d432e9e88 100644 --- a/src/game/behaviors/bub.inc.c +++ b/src/game/behaviors/bub.c @@ -1,4 +1,18 @@ -// bub.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "engine/surface_collision.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Cheep Cheep */ +#define /*0x0F4*/ oCheepCheepWaterLevel OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oCheepCheepTargetY OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oCheepCheepTargetYOffset OBJECT_FIELD_F32(0x1D) +#define /*0x104*/ oCheepCheepMaxYOffset OBJECT_FIELD_F32(0x1F) +#define /*0x108*/ oCheepCheepRandomSwimAway OBJECT_FIELD_F32(0x20) // NOTE: These first set of functions spawn a school of bub depending on oCheepCheepSpawnerSpawnAmount's // value. The later action functions seem to check Y distance to Mario and proceed diff --git a/src/game/behaviors/bubba.inc.c b/src/game/behaviors/bubba.c similarity index 84% rename from src/game/behaviors/bubba.inc.c rename to src/game/behaviors/bubba.c index e50b74933a..1be8639a2f 100644 --- a/src/game/behaviors/bubba.inc.c +++ b/src/game/behaviors/bubba.c @@ -1,4 +1,23 @@ -// bubba.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Bubba */ +#define /*0x0F4*/ oBubbaMovePitch OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oBubbaRandomTimer OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oBubbaHitWall OBJECT_FIELD_S32(0x1D) +#define /*0x100*/ oBubbaLungeTimer OBJECT_FIELD_S32(0x1E) +#define /*0x104*/ oBubbaNextTargetPitchTowardMario OBJECT_FIELD_S32(0x1F) +#define /*0x108*/ oBubbaAirVelY OBJECT_FIELD_F32(0x20) +#define /*0x10C*/ oBubbaJumpHeight OBJECT_FIELD_F32(0x21) +#define /*0x1AC*/ oBubbaTargetPitch OBJECT_FIELD_S16(0x49, 0) +#define /*0x1AE*/ oBubbaTargetYaw OBJECT_FIELD_S16(0x49, 1) +#define /*0x1B0*/ oBubbaPitchVel OBJECT_FIELD_S16(0x4A, 0) +#define /*0x1B2*/ oBubbaYawVel OBJECT_FIELD_S16(0x4A, 1) static struct ObjectHitbox sBubbaHitbox = { /* interactType: */ INTERACT_CLAM_OR_BUBBA, diff --git a/src/game/behaviors/bubble.inc.c b/src/game/behaviors/bubble.c similarity index 82% rename from src/game/behaviors/bubble.inc.c rename to src/game/behaviors/bubble.c index 9b977015ed..a7a74d3d32 100644 --- a/src/game/behaviors/bubble.inc.c +++ b/src/game/behaviors/bubble.c @@ -1,4 +1,8 @@ -// bubble.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" void bhv_object_bubble_init(void) { o->oPosX += random_float() * 30.0f; diff --git a/src/game/behaviors/bullet_bill.inc.c b/src/game/behaviors/bullet_bill.c similarity index 89% rename from src/game/behaviors/bullet_bill.inc.c rename to src/game/behaviors/bullet_bill.c index f6d7a36159..e676efdbff 100644 --- a/src/game/behaviors/bullet_bill.inc.c +++ b/src/game/behaviors/bullet_bill.c @@ -1,4 +1,12 @@ -// bullet_bill.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Bullet Bill */ +#define /*0x0F8*/ oBulletBillInitialMoveYaw OBJECT_FIELD_S32(0x1C) void bhv_white_puff_smoke_init(void) { cur_obj_scale(random_float() * 2 + 2.0); diff --git a/src/game/behaviors/bully.inc.c b/src/game/behaviors/bully.c similarity index 90% rename from src/game/behaviors/bully.inc.c rename to src/game/behaviors/bully.c index d269e12f36..9e040e3b3c 100644 --- a/src/game/behaviors/bully.inc.c +++ b/src/game/behaviors/bully.c @@ -1,4 +1,24 @@ -// bully.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Bully (all variants) */ +#define /*0x0F4*/ oBullySubtype OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ O_BULLY_PREV_INDEX 0x1C +#define /*0x0F8*/ O_BULLY_PREV_X_INDEX (O_BULLY_PREV_INDEX + 0) // 0x1C +#define /*0x0FC*/ O_BULLY_PREV_Y_INDEX (O_BULLY_PREV_INDEX + 1) // 0x1D +#define /*0x100*/ O_BULLY_PREV_Z_INDEX (O_BULLY_PREV_INDEX + 2) // 0x1E +#define /*0x0F8*/ oBullyPrevVec OBJECT_FIELD_F32(O_BULLY_PREV_INDEX) +#define /*0x0F8*/ oBullyPrevX OBJECT_FIELD_F32(O_BULLY_PREV_X_INDEX) +#define /*0x0FC*/ oBullyPrevY OBJECT_FIELD_F32(O_BULLY_PREV_Y_INDEX) +#define /*0x100*/ oBullyPrevZ OBJECT_FIELD_F32(O_BULLY_PREV_Z_INDEX) +#define /*0x104*/ oBullyKBTimerAndMinionKOCounter OBJECT_FIELD_S32(0x1F) +#define /*0x108*/ oBullyMarioCollisionAngle OBJECT_FIELD_S32(0x20) static struct ObjectHitbox sSmallBullyHitbox = { /* interactType: */ INTERACT_BULLY, diff --git a/src/game/behaviors/butterfly.inc.c b/src/game/behaviors/butterfly.c similarity index 92% rename from src/game/behaviors/butterfly.inc.c rename to src/game/behaviors/butterfly.c index 43f496bf48..5a636eba8d 100644 --- a/src/game/behaviors/butterfly.inc.c +++ b/src/game/behaviors/butterfly.c @@ -1,4 +1,11 @@ -// butterfly.inc.c +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "engine/surface_collision.h" +#include "game/object_helpers.h" + +/* Butterfly */ +#define /*0x0F4*/ oButterflyYPhase OBJECT_FIELD_S32(0x1B) void bhv_butterfly_init(void) { cur_obj_init_animation(BUTTERFLY_ANIM_RESTING); diff --git a/src/game/behaviors/camera_lakitu.inc.c b/src/game/behaviors/camera_lakitu.c similarity index 89% rename from src/game/behaviors/camera_lakitu.inc.c rename to src/game/behaviors/camera_lakitu.c index 7319113649..d5ebd66ddc 100644 --- a/src/game/behaviors/camera_lakitu.inc.c +++ b/src/game/behaviors/camera_lakitu.c @@ -1,3 +1,13 @@ +#include +#include "behavior_data.h" +#include "dialog_ids.h" +#include "seq_ids.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "engine/math_util.h" +#include "game/level_update.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" /** * Behavior for bhvCameraLakitu. This includes both the intro lakitu and the @@ -5,6 +15,15 @@ * TODO: Processing order relative to bhvCloud */ +/* Camera Lakitu */ +#define /*0x0F4*/ oCameraLakituBlinkTimer OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oCameraLakituSpeed OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oCameraLakituCircleRadius OBJECT_FIELD_F32(0x1D) +#define /*0x100*/ oCameraLakituFinishedDialog OBJECT_FIELD_S32(0x1E) +#define /*0x104*/ oCameraLakituIntroMusicPlayed OBJECT_FIELD_S32(0x1F) +#define /*0x1AC*/ oCameraLakituPitchVel OBJECT_FIELD_S16(0x49, 0) +#define /*0x1AE*/ oCameraLakituYawVel OBJECT_FIELD_S16(0x49, 1) + /** * Init function for camera lakitu. * If this is the intro lakitu, despawn unless this is the start of the game. diff --git a/src/game/behaviors/cannon.inc.c b/src/game/behaviors/cannon.c similarity index 90% rename from src/game/behaviors/cannon.inc.c rename to src/game/behaviors/cannon.c index 582f9ff6a1..e7cb421690 100644 --- a/src/game/behaviors/cannon.inc.c +++ b/src/game/behaviors/cannon.c @@ -1,4 +1,14 @@ -// cannon.inc.c +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Cannon */ +#define /*0x0F4*/ oCannonAngle OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oCannonTimeSinceActivated OBJECT_FIELD_S32(0x1C) +#define /*0x10C*/ oCannonIsActive OBJECT_FIELD_S32(0x21) void bhv_cannon_base_unused_loop(void) { o->oPosY += o->oVelY; diff --git a/src/game/behaviors/cannon_door.inc.c b/src/game/behaviors/cannon_door.c similarity index 90% rename from src/game/behaviors/cannon_door.inc.c rename to src/game/behaviors/cannon_door.c index 52ab3e862e..a9664a951b 100644 --- a/src/game/behaviors/cannon_door.inc.c +++ b/src/game/behaviors/cannon_door.c @@ -1,4 +1,9 @@ -// cannon.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "game/object_helpers.h" +#include "game/save_file.h" +#include "game/spawn_sound.h" void bhv_cannon_closed_init(void) { if (save_file_is_cannon_unlocked() == TRUE) { diff --git a/src/game/behaviors/cap.inc.c b/src/game/behaviors/cap.c similarity index 95% rename from src/game/behaviors/cap.inc.c rename to src/game/behaviors/cap.c index d8e76b088a..2a08e24038 100644 --- a/src/game/behaviors/cap.inc.c +++ b/src/game/behaviors/cap.c @@ -1,4 +1,13 @@ -// cap.inc.c +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/save_file.h" + +/* Cap */ +#define /*0x0F4*/ oCapDoScaleVertically OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oCapScaleAngle OBJECT_FIELD_S32(0x1C) static struct ObjectHitbox sCapHitbox = { /* interactType: */ INTERACT_CAP, diff --git a/src/game/behaviors/capswitch.inc.c b/src/game/behaviors/capswitch.c similarity index 93% rename from src/game/behaviors/capswitch.inc.c rename to src/game/behaviors/capswitch.c index b86b95b897..93ffafe0b7 100644 --- a/src/game/behaviors/capswitch.inc.c +++ b/src/game/behaviors/capswitch.c @@ -1,4 +1,9 @@ -// capswitch.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "game/object_helpers.h" +#include "game/save_file.h" +#include "game/spawn_sound.h" static s32 sCapSaveFlags[] = { SAVE_FLAG_HAVE_WING_CAP, diff --git a/src/game/behaviors/castle_cannon_grate.inc.c b/src/game/behaviors/castle_cannon_grate.c similarity index 58% rename from src/game/behaviors/castle_cannon_grate.inc.c rename to src/game/behaviors/castle_cannon_grate.c index 64bd924b66..9ea3bc70a9 100644 --- a/src/game/behaviors/castle_cannon_grate.inc.c +++ b/src/game/behaviors/castle_cannon_grate.c @@ -1,4 +1,8 @@ -// castle_cannon_grate.inc.c +#include +#include "course_table.h" +#include "global_object_fields.h" +#include "game/object_helpers.h" +#include "game/save_file.h" void bhv_castle_cannon_grate_init(void) { if (save_file_get_total_star_count(gCurrSaveFileNum - 1, COURSE_MIN - 1, COURSE_MAX - 1) >= 120) { diff --git a/src/game/behaviors/castle_flag.c b/src/game/behaviors/castle_flag.c new file mode 100644 index 0000000000..6f0c5efa3e --- /dev/null +++ b/src/game/behaviors/castle_flag.c @@ -0,0 +1,8 @@ +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" + +void bhv_castle_flag_init(void) { + o->header.gfx.animInfo.animFrame = random_float() * 28.0f; +} diff --git a/src/game/behaviors/castle_flag.inc.c b/src/game/behaviors/castle_flag.inc.c deleted file mode 100644 index d589ff3b75..0000000000 --- a/src/game/behaviors/castle_flag.inc.c +++ /dev/null @@ -1,5 +0,0 @@ -// castle_flag.inc.c - -void bhv_castle_flag_init(void) { - o->header.gfx.animInfo.animFrame = random_float() * 28.0f; -} diff --git a/src/game/behaviors/castle_floor_trap.inc.c b/src/game/behaviors/castle_floor_trap.c similarity index 91% rename from src/game/behaviors/castle_floor_trap.inc.c rename to src/game/behaviors/castle_floor_trap.c index c18c20031a..112d51c419 100644 --- a/src/game/behaviors/castle_floor_trap.inc.c +++ b/src/game/behaviors/castle_floor_trap.c @@ -1,4 +1,10 @@ -// castle_floor_trap.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "game/interaction.h" +#include "game/level_update.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" void bhv_floor_trap_in_castle_loop(void) { if (gMarioObject->platform == o) { diff --git a/src/game/behaviors/celebration_star.inc.c b/src/game/behaviors/celebration_star.c similarity index 87% rename from src/game/behaviors/celebration_star.inc.c rename to src/game/behaviors/celebration_star.c index a0af43089e..a10f845f64 100644 --- a/src/game/behaviors/celebration_star.inc.c +++ b/src/game/behaviors/celebration_star.c @@ -1,4 +1,13 @@ -// celebration_star.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/level_update.h" +#include "game/object_helpers.h" + +/* Celebration Star */ +#define /*0x0F4*/ oCelebStarIsBowserKey OBJECT_FIELD_S32(0x1B) +#define /*0x108*/ oCelebStarDiameterOfRotation OBJECT_FIELD_S32(0x20) void bhv_celebration_star_init(void) { o->oHomeX = gMarioObject->header.gfx.pos[0]; diff --git a/src/game/behaviors/chain_chomp.inc.c b/src/game/behaviors/chain_chomp.c similarity index 92% rename from src/game/behaviors/chain_chomp.inc.c rename to src/game/behaviors/chain_chomp.c index 4a51c46f72..763331d42b 100644 --- a/src/game/behaviors/chain_chomp.inc.c +++ b/src/game/behaviors/chain_chomp.c @@ -1,3 +1,12 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "engine/math_util.h" +#include "game/game_init.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" /** * Behavior for bhvChainChomp, bhvChainChompChainPart, bhvWoodenPost, and bhvChainChompGate. @@ -9,6 +18,25 @@ * The chain parts are processed starting at the post and ending at the chomp. */ +/* Chain Chomp */ +#define /*0x0F4*/ oChainChompSegments OBJECT_FIELD_CHAIN_SEGMENT(0x1B) +#define /*0x0F8*/ oChainChompMaxDistFromPivotPerChainPart OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oChainChompMaxDistBetweenChainParts OBJECT_FIELD_F32(0x1D) +#define /*0x100*/ oChainChompDistToPivot OBJECT_FIELD_F32(0x1E) +#define /*0x104*/ oChainChompSignedMaxDistBetweenChainParts OBJECT_FIELD_F32(0x1F) +#define /*0x108*/ oChainChompRestrictedByChain OBJECT_FIELD_S32(0x20) +#define /*0x10C*/ oChainChompTargetPitch OBJECT_FIELD_S32(0x21) +#define /*0x110*/ oChainChompNumLunges OBJECT_FIELD_S32(0x22) +#define /*0x1AC*/ oChainChompReleaseStatus OBJECT_FIELD_S32(0x49) +#define /*0x1B0*/ oChainChompHitGate OBJECT_FIELD_S32(0x4A) + +/* Wooden Post */ +#define /*0x0F4*/ oWoodenPostTotalMarioAngle OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oWoodenPostPrevAngleToMario OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oWoodenPostSpeedY OBJECT_FIELD_F32(0x1D) +#define /*0x100*/ oWoodenPostMarioPounding OBJECT_FIELD_S32(0x1E) +#define /*0x104*/ oWoodenPostOffsetY OBJECT_FIELD_F32(0x1F) + #define CHAIN_CHOMP_CHAIN_MAX_DIST_BETWEEN_PARTS 180.0f #define CHAIN_CHOMP_LOAD_DIST (3000.0f + (CHAIN_CHOMP_NUM_SEGMENTS * CHAIN_CHOMP_CHAIN_MAX_DIST_BETWEEN_PARTS)) diff --git a/src/game/behaviors/checkerboard_platform.inc.c b/src/game/behaviors/checkerboard_platform.c similarity index 87% rename from src/game/behaviors/checkerboard_platform.inc.c rename to src/game/behaviors/checkerboard_platform.c index 33f2c60719..2c6c429b11 100644 --- a/src/game/behaviors/checkerboard_platform.inc.c +++ b/src/game/behaviors/checkerboard_platform.c @@ -1,3 +1,14 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "engine/surface_load.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +#define /*0x0F8*/ oCheckerBoardPlatformRotateAction OBJECT_FIELD_S32(0x1C) // oAction like +#define /*0x0FC*/ oCheckerBoardPlatformHeight OBJECT_FIELD_S32(0x1D) +#define /*0x1AC*/ oCheckerBoardPlatformRadius OBJECT_FIELD_F32(0x49) // checkerboard_platform.inc.c struct CheckerBoardPlatformInitPosition { diff --git a/src/game/behaviors/chuckya.inc.c b/src/game/behaviors/chuckya.c similarity index 91% rename from src/game/behaviors/chuckya.inc.c rename to src/game/behaviors/chuckya.c index 76f20142df..3f945a1d26 100644 --- a/src/game/behaviors/chuckya.inc.c +++ b/src/game/behaviors/chuckya.c @@ -1,4 +1,17 @@ -// chuckya.inc.c +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/debug.h" +#include "game/interaction.h" +#include "game/level_update.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Chuckya */ +#define /*0x088*/ oCommonAnchorAction OBJECT_FIELD_S32(0x00) +#define /*0x0F8*/ oChuckyaUnused OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oChuckyaSubActionTimer OBJECT_FIELD_S32(0x1D) +#define /*0x100*/ oChuckyaNumPlayerEscapeActions OBJECT_FIELD_S32(0x1E) void common_anchor_mario_behavior(f32 forwardVel, f32 yVel, s32 flag) { switch (o->parentObj->oCommonAnchorAction) { diff --git a/src/game/behaviors/clam.inc.c b/src/game/behaviors/clam.c similarity index 86% rename from src/game/behaviors/clam.inc.c rename to src/game/behaviors/clam.c index 359f421124..09b5da5fd5 100644 --- a/src/game/behaviors/clam.inc.c +++ b/src/game/behaviors/clam.c @@ -1,4 +1,13 @@ -// clam.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Clam */ +#define /*0x0F4*/ oClamShakeTimer OBJECT_FIELD_S32(0x1B) struct ObjectHitbox sClamShellHitbox = { /* interactType: */ INTERACT_CLAM_OR_BUBBA, diff --git a/src/game/behaviors/clock_arm.inc.c b/src/game/behaviors/clock_arm.c similarity index 94% rename from src/game/behaviors/clock_arm.inc.c rename to src/game/behaviors/clock_arm.c index f4005eced1..0c34484632 100644 --- a/src/game/behaviors/clock_arm.inc.c +++ b/src/game/behaviors/clock_arm.c @@ -1,4 +1,8 @@ -// clock_arm.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "game/level_update.h" +#include "game/object_helpers.h" /** * Main loop of the hour and minute hands of the Tick Tock Clock painting. diff --git a/src/game/behaviors/cloud.inc.c b/src/game/behaviors/cloud.c similarity index 91% rename from src/game/behaviors/cloud.inc.c rename to src/game/behaviors/cloud.c index 0efc780612..1c5f609dbd 100644 --- a/src/game/behaviors/cloud.inc.c +++ b/src/game/behaviors/cloud.c @@ -1,3 +1,10 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/game_init.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" /** * Behavior for bhvCloud and bhvCloudPart. @@ -9,6 +16,13 @@ * Processing order is lakitu -> cloud -> its cloud parts. */ +/* Cloud */ +#define /*0x0F4*/ oCloudCenterX OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oCloudCenterY OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oCloudBlowing OBJECT_FIELD_S32(0x1D) +#define /*0x100*/ oCloudGrowSpeed OBJECT_FIELD_F32(0x1E) +#define /*0x1AC*/ oCloudFwooshMovementRadius OBJECT_FIELD_S16(0x49, 0) + /** * The relative heights of each cloud part. */ diff --git a/src/game/behaviors/coffin.inc.c b/src/game/behaviors/coffin.c similarity index 95% rename from src/game/behaviors/coffin.inc.c rename to src/game/behaviors/coffin.c index eafac290e4..71e72901ff 100644 --- a/src/game/behaviors/coffin.inc.c +++ b/src/game/behaviors/coffin.c @@ -1,3 +1,12 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "engine/surface_load.h" +#include "game/game_init.h" +#include "game/level_update.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" /** * Behavior for bhvCoffinSpawner and bhvCoffin. diff --git a/src/game/behaviors/coin.inc.c b/src/game/behaviors/coin.c similarity index 94% rename from src/game/behaviors/coin.inc.c rename to src/game/behaviors/coin.c index 24666a3208..f70731d3cc 100644 --- a/src/game/behaviors/coin.inc.c +++ b/src/game/behaviors/coin.c @@ -1,4 +1,17 @@ -// coin.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "engine/surface_collision.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Coin */ +#define /*0x0F4*/ oCoinRespawnBits OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oCoinSnapToGround OBJECT_FIELD_S32(0x1C) +#define /*0x110*/ oCoinBaseYVel OBJECT_FIELD_F32(0x22) +#define /*0x1B0*/ oCoinBounceTimer OBJECT_FIELD_S32(0x4A) struct ObjectHitbox sYellowCoinHitbox = { /* interactType: */ INTERACT_COIN, diff --git a/src/game/behaviors/collide_particles.inc.c b/src/game/behaviors/collide_particles.c similarity index 91% rename from src/game/behaviors/collide_particles.inc.c rename to src/game/behaviors/collide_particles.c index cb5afaeff4..8cbe1b46b4 100644 --- a/src/game/behaviors/collide_particles.inc.c +++ b/src/game/behaviors/collide_particles.c @@ -1,4 +1,12 @@ -// collide_particles.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/debug.h" +#include "game/object_helpers.h" + +/* Collision Particle */ +#define /*0x0F4*/ oCollisionParticleScale OBJECT_FIELD_F32(0x1B) static s16 sTinyTriMovementParams[] = { 0xD000, 0, 0x3000, 0, 0xDE67, 0x2199, 0x2199, 0x2199, 0xDE67, 0xDE67, 0x2199, 0xDE67 }; diff --git a/src/game/behaviors/controllable_platform.inc.c b/src/game/behaviors/controllable_platform.c similarity index 95% rename from src/game/behaviors/controllable_platform.inc.c rename to src/game/behaviors/controllable_platform.c index 9864dc3895..d5c3583dd9 100644 --- a/src/game/behaviors/controllable_platform.inc.c +++ b/src/game/behaviors/controllable_platform.c @@ -1,4 +1,14 @@ -// controllable_platform.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Controllable Platform */ +#define /*0x0F8*/ oControllablePlatformWallHitDirection OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oControllablePlatformInitPosY OBJECT_FIELD_F32(0x1D) +#define /*0x100*/ oControllablePlatformIsFarFromMario OBJECT_FIELD_S32(0x1E) static s8 sControllablePlatformDirectionState = 0; diff --git a/src/game/behaviors/cruiser.inc.c b/src/game/behaviors/cruiser.c similarity index 70% rename from src/game/behaviors/cruiser.inc.c rename to src/game/behaviors/cruiser.c index 1d6f5164da..d4fa0639c1 100644 --- a/src/game/behaviors/cruiser.inc.c +++ b/src/game/behaviors/cruiser.c @@ -1,4 +1,12 @@ -// cruiser.inc.c +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* RR Cruiser Wing */ +#define /*0x0F4*/ oRRCruiserWingInitYaw OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oRRCruiserWingInitPitch OBJECT_FIELD_S32(0x1C) void bhv_rr_cruiser_wing_init(void) { o->oRRCruiserWingInitYaw = o->oFaceAngleYaw; diff --git a/src/game/behaviors/ddd_pole.inc.c b/src/game/behaviors/ddd_pole.c similarity index 67% rename from src/game/behaviors/ddd_pole.inc.c rename to src/game/behaviors/ddd_pole.c index 5800a5ee5f..85f4561977 100644 --- a/src/game/behaviors/ddd_pole.inc.c +++ b/src/game/behaviors/ddd_pole.c @@ -1,3 +1,10 @@ +#include +#include "global_object_fields.h" +#include "game/object_helpers.h" + +#define /*0x0F4*/ oDDDPoleVel OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oDDDPoleMaxOffset OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oDDDPoleOffset OBJECT_FIELD_F32(0x1D) // ddd_pole.inc.c void bhv_ddd_pole_init(void) { diff --git a/src/game/behaviors/ddd_sub.inc.c b/src/game/behaviors/ddd_sub.c similarity index 56% rename from src/game/behaviors/ddd_sub.inc.c rename to src/game/behaviors/ddd_sub.c index bd894126c2..3f2ad4b528 100644 --- a/src/game/behaviors/ddd_sub.inc.c +++ b/src/game/behaviors/ddd_sub.c @@ -1,4 +1,7 @@ -// ddd_sub.inc.c +#include +#include "global_object_fields.h" +#include "engine/surface_load.h" +#include "game/object_helpers.h" void bhv_bowsers_sub_init(void) { if (gCurrActNum != 1) { diff --git a/src/game/behaviors/ddd_warp.inc.c b/src/game/behaviors/ddd_warp.c similarity index 70% rename from src/game/behaviors/ddd_warp.inc.c rename to src/game/behaviors/ddd_warp.c index 95b92259c0..d11df34da1 100644 --- a/src/game/behaviors/ddd_warp.inc.c +++ b/src/game/behaviors/ddd_warp.c @@ -1,4 +1,7 @@ -// ddd_warp.inc.c +#include +#include "actors/vanilla_actors/castle_inside/header.h" +#include "global_object_fields.h" +#include "game/object_helpers.h" void bhv_ddd_warp_loop(void) { #ifndef UNLOCK_ALL diff --git a/src/game/behaviors/decorative_pendulum.inc.c b/src/game/behaviors/decorative_pendulum.c similarity index 88% rename from src/game/behaviors/decorative_pendulum.inc.c rename to src/game/behaviors/decorative_pendulum.c index 440bee776c..501986d6f2 100644 --- a/src/game/behaviors/decorative_pendulum.inc.c +++ b/src/game/behaviors/decorative_pendulum.c @@ -1,3 +1,7 @@ +#include +#include "global_object_fields.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" /** * Behavior for bhvDecorativePendulum. diff --git a/src/game/behaviors/donut_platform.inc.c b/src/game/behaviors/donut_platform.c similarity index 90% rename from src/game/behaviors/donut_platform.inc.c rename to src/game/behaviors/donut_platform.c index 2abb2485bd..ba0752da84 100644 --- a/src/game/behaviors/donut_platform.inc.c +++ b/src/game/behaviors/donut_platform.c @@ -1,4 +1,13 @@ -// donut_platform.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "engine/surface_load.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Donut Platform Spawner */ +#define /*0x0F4*/ oDonutPlatformSpawnerSpawnedPlatforms OBJECT_FIELD_S32(0x1B) static Vec3s sDonutPlatformPositions[] = { { 2892, -2089, 6564 }, { -2156, 2211, -87 }, { 1692, 2520, -32 }, diff --git a/src/game/behaviors/door.inc.c b/src/game/behaviors/door.c similarity index 90% rename from src/game/behaviors/door.inc.c rename to src/game/behaviors/door.c index 17c84832b2..fec9b4ba7c 100644 --- a/src/game/behaviors/door.inc.c +++ b/src/game/behaviors/door.c @@ -1,4 +1,19 @@ -// door.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "engine/surface_collision.h" +#include "engine/surface_load.h" +#include "game/debug.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Door */ +#define /*0x088*/ oDoorIsRendering OBJECT_FIELD_S32(0x00) +#define /*0x0F8*/ oDoorSelfRoom OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oDoorForwardRoom OBJECT_FIELD_S32(0x1D) +#define /*0x100*/ oDoorBackwardRoom OBJECT_FIELD_S32(0x1E) struct DoorAction { u32 flag; diff --git a/src/game/behaviors/door_unlock_spinning_star.c b/src/game/behaviors/door_unlock_spinning_star.c new file mode 100644 index 0000000000..ba73015479 --- /dev/null +++ b/src/game/behaviors/door_unlock_spinning_star.c @@ -0,0 +1,92 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "engine/math_util.h" +#include "game/level_update.h" +#include "game/object_helpers.h" + +enum UnlockDoorStarStates { + UNLOCK_DOOR_STAR_RISING, + UNLOCK_DOOR_STAR_WAITING, + UNLOCK_DOOR_STAR_SPAWNING_PARTICLES, + UNLOCK_DOOR_STAR_DONE +}; + +/* Sealed Door Star */ +#define /*0x108*/ oUnlockDoorStarState OBJECT_FIELD_U32(0x20) +#define /*0x10C*/ oUnlockDoorStarTimer OBJECT_FIELD_S32(0x21) +#define /*0x110*/ oUnlockDoorStarYawVel OBJECT_FIELD_S32(0x22) + +static void star_door_unlock_spawn_particles(s16 angleOffset) { + struct Object *sparkleParticle = spawn_object(o, MODEL_NONE, bhvSparkleSpawn); + + sparkleParticle->oPosX += 100.0f * sins((o->oUnlockDoorStarTimer * 0x2800) + angleOffset); + sparkleParticle->oPosZ += 100.0f * coss((o->oUnlockDoorStarTimer * 0x2800) + angleOffset); + // Particles are spawned lower each frame + sparkleParticle->oPosY -= o->oUnlockDoorStarTimer * 10.0f; +} + +void bhv_unlock_door_star_init(void) { + o->oUnlockDoorStarState = UNLOCK_DOOR_STAR_RISING; + o->oUnlockDoorStarTimer = 0; + o->oUnlockDoorStarYawVel = 0x1000; + o->oPosX += 30.0f * sins(gMarioState->faceAngle[1] - 0x4000); + o->oPosY += 160.0f; + o->oPosZ += 30.0f * coss(gMarioState->faceAngle[1] - 0x4000); + o->oMoveAngleYaw = 0x7800; + obj_scale(o, 0.5f); +} + +void bhv_unlock_door_star_loop(void) { + s16 prevYaw = o->oMoveAngleYaw; + + // Speed up the star every frame + if (o->oUnlockDoorStarYawVel < 0x2400) { + o->oUnlockDoorStarYawVel += 0x60; + } + switch (o->oUnlockDoorStarState) { + case UNLOCK_DOOR_STAR_RISING: + o->oPosY += 3.4f; // Raise the star up in the air + o->oMoveAngleYaw += + o->oUnlockDoorStarYawVel; // Apply yaw velocity + cur_obj_scale(o->oUnlockDoorStarTimer / 50.0f + 0.5f); // Scale the star to be bigger + if (++o->oUnlockDoorStarTimer == 30) { + o->oUnlockDoorStarTimer = 0; + o->oUnlockDoorStarState++; // Sets state to UNLOCK_DOOR_STAR_WAITING + } + break; + case UNLOCK_DOOR_STAR_WAITING: + o->oMoveAngleYaw += + o->oUnlockDoorStarYawVel; // Apply yaw velocity + if (++o->oUnlockDoorStarTimer == 30) { + play_sound(SOUND_MENU_STAR_SOUND, o->header.gfx.cameraToObject); // Play final sound + cur_obj_hide(); // Hide the object + o->oUnlockDoorStarTimer = 0; + o->oUnlockDoorStarState++; // Sets state to UNLOCK_DOOR_STAR_SPAWNING_PARTICLES + } + break; + case UNLOCK_DOOR_STAR_SPAWNING_PARTICLES: + // Spawn two particles, opposite sides of the star. + star_door_unlock_spawn_particles(0); + star_door_unlock_spawn_particles(0x8000); + if (o->oUnlockDoorStarTimer++ == 20) { + o->oUnlockDoorStarTimer = 0; + o->oUnlockDoorStarState++; // Sets state to UNLOCK_DOOR_STAR_DONE + } + break; + case UNLOCK_DOOR_STAR_DONE: // The object stays loaded for an additional 50 frames so that the + // sound doesn't immediately stop. + if (o->oUnlockDoorStarTimer++ == 50) { + obj_mark_for_deletion(o); + } + break; + } + // Checks if the angle has cycled back to 0. + // This means that the code will execute when the star completes a full revolution. + if (prevYaw > (s16) o->oMoveAngleYaw) { + play_sound( + SOUND_GENERAL_SHORT_STAR, + o->header.gfx.cameraToObject); // Play a sound every time the star spins once + } +} diff --git a/src/game/behaviors/dorrie.inc.c b/src/game/behaviors/dorrie.c similarity index 85% rename from src/game/behaviors/dorrie.inc.c rename to src/game/behaviors/dorrie.c index fc9b977d42..57e9e2853e 100644 --- a/src/game/behaviors/dorrie.inc.c +++ b/src/game/behaviors/dorrie.c @@ -1,4 +1,22 @@ -// dorrie.inc.c +#include +#include "global_object_fields.h" +#include "actors/group17.h" +#include "engine/math_util.h" +#include "game/level_update.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Dorrie */ +#define /*0x0F4*/ oDorrieDistToHome OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oDorrieOffsetY OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oDorrieVelY OBJECT_FIELD_F32(0x1D) +#define /*0x100*/ oDorrieForwardDistToMario OBJECT_FIELD_F32(0x1E) +#define /*0x104*/ oDorrieYawVel OBJECT_FIELD_S32(0x1F) +#define /*0x10C*/ oDorrieLiftingMario OBJECT_FIELD_S32(0x21) +#define /*0x1AC*/ oDorrieGroundPounded OBJECT_FIELD_S16(0x49, 0) +#define /*0x1AE*/ oDorrieAngleToHome OBJECT_FIELD_S16(0x49, 1) +#define /*0x1B0*/ oDorrieNeckAngle OBJECT_FIELD_S16(0x4A, 0) +#define /*0x1B2*/ oDorrieHeadRaiseSpeed OBJECT_FIELD_S16(0x4A, 1) void dorrie_raise_head(void) { s16 startAngle = o->oDorrieNeckAngle; diff --git a/src/game/behaviors/drawbridge.inc.c b/src/game/behaviors/drawbridge.c similarity index 89% rename from src/game/behaviors/drawbridge.inc.c rename to src/game/behaviors/drawbridge.c index 4361208d22..3a23648e8f 100644 --- a/src/game/behaviors/drawbridge.inc.c +++ b/src/game/behaviors/drawbridge.c @@ -1,4 +1,9 @@ -// drawbridge.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" void bhv_lll_drawbridge_spawner_loop(void) { struct Object *drawbridge1, *drawbridge2; diff --git a/src/game/behaviors/elevator.inc.c b/src/game/behaviors/elevator.c similarity index 89% rename from src/game/behaviors/elevator.inc.c rename to src/game/behaviors/elevator.c index bc0e4228b1..9503fd1f4d 100644 --- a/src/game/behaviors/elevator.inc.c +++ b/src/game/behaviors/elevator.c @@ -1,4 +1,15 @@ -// elevator.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Elevator */ +#define /*0x0F4*/ oElevatorMinY OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oElevatorMaxY OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oElevatorMidY OBJECT_FIELD_F32(0x1D) +#define /*0x100*/ oElevatorType OBJECT_FIELD_S32(0x1E) static s16 sElevatorHeights[] = { -51, 0, 0, diff --git a/src/game/behaviors/end_birds_1.c b/src/game/behaviors/end_birds_1.c new file mode 100644 index 0000000000..821c47c527 --- /dev/null +++ b/src/game/behaviors/end_birds_1.c @@ -0,0 +1,42 @@ +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/camera.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Intro Cutscene Lakitu - End Birds */ +#define /*0x108*/ O_INTRO_LAKITU_END_BIRDS_DEST_INDEX 0x20 +#define /*0x108*/ O_INTRO_LAKITU_END_BIRDS_DEST_X_INDEX (O_INTRO_LAKITU_END_BIRDS_DEST_INDEX + 0) // 0x20 +#define /*0x10C*/ O_INTRO_LAKITU_END_BIRDS_DEST_Y_INDEX (O_INTRO_LAKITU_END_BIRDS_DEST_INDEX + 1) // 0x21 +#define /*0x110*/ O_INTRO_LAKITU_END_BIRDS_DEST_Z_INDEX (O_INTRO_LAKITU_END_BIRDS_DEST_INDEX + 2) // 0x22 +#define /*0x108*/ oIntroLakituEndBirds1DestVec OBJECT_FIELD_F32(O_INTRO_LAKITU_END_BIRDS_DEST_INDEX) +#define /*0x110*/ oIntroLakituEndBirds1DestX OBJECT_FIELD_F32(O_INTRO_LAKITU_END_BIRDS_DEST_X_INDEX) +#define /*0x10C*/ oIntroLakituEndBirds1DestY OBJECT_FIELD_F32(O_INTRO_LAKITU_END_BIRDS_DEST_Y_INDEX) +#define /*0x108*/ oIntroLakituEndBirds1DestZ OBJECT_FIELD_F32(O_INTRO_LAKITU_END_BIRDS_DEST_Z_INDEX) + +void bhv_end_birds_1_loop(void) { + Vec3f pos; + + switch (o->oAction) { + case END_BIRDS_ACT_INIT: + cur_obj_scale(0.7f); + vec3f_set(&o->oIntroLakituEndBirds1DestVec, -554.0f, 3044.0f, -1314.0f); + o->oAction = END_BIRDS_ACT_ACTIVE; + break; + case END_BIRDS_ACT_ACTIVE: + vec3f_copy(pos, &o->oIntroLakituEndBirds1DestVec); + if (o->oTimer < 100) { + obj_rotate_towards_point(o, pos, 0, 0, 0x20, 0x20); + } + if ((o->oEndBirdCutsceneVars9PointX == 0.0f) && (o->oTimer == 0)) { + cur_obj_play_sound_2(SOUND_GENERAL_BIRDS_FLY_AWAY); + } + if (gCutsceneTimer == 0) { + obj_mark_for_deletion(o); + } + break; + } + + cur_obj_set_pos_via_transform(); +} diff --git a/src/game/behaviors/end_birds_1.inc.c b/src/game/behaviors/end_birds_1.inc.c deleted file mode 100644 index 4f60ab6035..0000000000 --- a/src/game/behaviors/end_birds_1.inc.c +++ /dev/null @@ -1,27 +0,0 @@ -// end_birds_1.inc.c - -void bhv_end_birds_1_loop(void) { - Vec3f pos; - - switch (o->oAction) { - case END_BIRDS_ACT_INIT: - cur_obj_scale(0.7f); - vec3f_set(&o->oIntroLakituEndBirds1DestVec, -554.0f, 3044.0f, -1314.0f); - o->oAction = END_BIRDS_ACT_ACTIVE; - break; - case END_BIRDS_ACT_ACTIVE: - vec3f_copy(pos, &o->oIntroLakituEndBirds1DestVec); - if (o->oTimer < 100) { - obj_rotate_towards_point(o, pos, 0, 0, 0x20, 0x20); - } - if ((o->oEndBirdCutsceneVars9PointX == 0.0f) && (o->oTimer == 0)) { - cur_obj_play_sound_2(SOUND_GENERAL_BIRDS_FLY_AWAY); - } - if (gCutsceneTimer == 0) { - obj_mark_for_deletion(o); - } - break; - } - - cur_obj_set_pos_via_transform(); -} diff --git a/src/game/behaviors/end_birds_2.inc.c b/src/game/behaviors/end_birds_2.c similarity index 82% rename from src/game/behaviors/end_birds_2.inc.c rename to src/game/behaviors/end_birds_2.c index afab8fef0e..438083bc5a 100644 --- a/src/game/behaviors/end_birds_2.inc.c +++ b/src/game/behaviors/end_birds_2.c @@ -1,4 +1,9 @@ -// end_birds_2.inc.c +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/camera.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" void bhv_end_birds_2_loop(void) { Vec3f pos; @@ -26,3 +31,4 @@ void bhv_end_birds_2_loop(void) { cur_obj_set_pos_via_transform(); } + diff --git a/src/game/behaviors/enemy_lakitu.inc.c b/src/game/behaviors/enemy_lakitu.c similarity index 91% rename from src/game/behaviors/enemy_lakitu.inc.c rename to src/game/behaviors/enemy_lakitu.c index b120d7dc80..1f2eb918f9 100644 --- a/src/game/behaviors/enemy_lakitu.inc.c +++ b/src/game/behaviors/enemy_lakitu.c @@ -1,3 +1,13 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "actors/group11.h" +#include "engine/math_util.h" +#include "game/camera.h" +#include "game/interaction.h" +#include "game/level_update.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" /** * Behavior for bhvEnemyLakitu. @@ -5,6 +15,11 @@ * TODO: bhvCloud processing oredr */ +/* Evil Lakitu */ +#define /*0x0F8*/ oEnemyLakituBlinkTimer OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oEnemyLakituSpinyCooldown OBJECT_FIELD_S32(0x1D) +#define /*0x100*/ oEnemyLakituFaceForwardCountdown OBJECT_FIELD_S32(0x1E) + /** * Hitbox for evil lakitu. */ diff --git a/src/game/behaviors/exclamation_box.inc.c b/src/game/behaviors/exclamation_box.c similarity index 91% rename from src/game/behaviors/exclamation_box.inc.c rename to src/game/behaviors/exclamation_box.c index f14e9722f8..6acd72122a 100644 --- a/src/game/behaviors/exclamation_box.inc.c +++ b/src/game/behaviors/exclamation_box.c @@ -1,4 +1,23 @@ -// exclamation_box.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "engine/surface_load.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" +#include "game/save_file.h" + +/* Exclamation Box */ +#define /*0x0F4*/ oExclamationBoxHorizontalScale OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oExclamationBoxVerticalScale OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oExclamationBoxScaleAngle OBJECT_FIELD_S32(0x1D) + +static s32 sCapSaveFlags[] = { + SAVE_FLAG_HAVE_WING_CAP, + SAVE_FLAG_HAVE_METAL_CAP, + SAVE_FLAG_HAVE_VANISH_CAP +}; struct ObjectHitbox sExclamationBoxHitbox = { .interactType = INTERACT_BREAKABLE, diff --git a/src/game/behaviors/explosion.inc.c b/src/game/behaviors/explosion.c similarity index 78% rename from src/game/behaviors/explosion.inc.c rename to src/game/behaviors/explosion.c index a39d1e1395..8d4388f93b 100644 --- a/src/game/behaviors/explosion.inc.c +++ b/src/game/behaviors/explosion.c @@ -1,4 +1,16 @@ -// explosion.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/level_update.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Bob-omb Explosion Bubble */ +#define /*0x0FC*/ oBobombExpBubGfxScaleFacX OBJECT_FIELD_S32(0x1D) +#define /*0x100*/ oBobombExpBubGfxScaleFacY OBJECT_FIELD_S32(0x1E) +#define /*0x104*/ oBobombExpBubGfxExpRateX OBJECT_FIELD_S32(0x1F) +#define /*0x108*/ oBobombExpBubGfxExpRateY OBJECT_FIELD_S32(0x20) void bhv_explosion_init(void) { create_sound_spawner(SOUND_GENERAL2_BOBOMB_EXPLOSION); diff --git a/src/game/behaviors/express_elevator.inc.c b/src/game/behaviors/express_elevator.c similarity index 87% rename from src/game/behaviors/express_elevator.inc.c rename to src/game/behaviors/express_elevator.c index eaadc393a2..c58bd55321 100644 --- a/src/game/behaviors/express_elevator.inc.c +++ b/src/game/behaviors/express_elevator.c @@ -1,4 +1,7 @@ -// express_elevator.inc.c +#include +#include "global_object_fields.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" void bhv_wdw_express_elevator_loop(void) { o->oVelY = 0.0f; diff --git a/src/game/behaviors/eyerok.inc.c b/src/game/behaviors/eyerok.c similarity index 94% rename from src/game/behaviors/eyerok.inc.c rename to src/game/behaviors/eyerok.c index c59d5423a3..530d0c8e38 100644 --- a/src/game/behaviors/eyerok.inc.c +++ b/src/game/behaviors/eyerok.c @@ -1,4 +1,32 @@ -// eyerok.inc.c +#include +#include "actors/vanilla_actors/ssl/header.h" +#include "behavior_data.h" +#include "dialog_ids.h" +#include "model_ids.h" +#include "seq_ids.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "engine/math_util.h" +#include "engine/surface_load.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Eyerok Boss */ +#define /*0x0F8*/ oEyerokBossNumHands OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oEyerokBossAttackPhase OBJECT_FIELD_S32(0x1D) +#define /*0x100*/ oEyerokBossActiveHand OBJECT_FIELD_S32(0x1E) +#define /*0x104*/ oEyerokBossAttackCountdown OBJECT_FIELD_S32(0x1F) +#define /*0x108*/ oEyerokBossFightSideZ OBJECT_FIELD_F32(0x20) +#define /*0x10C*/ oEyerokBossClampedMarioPosZ OBJECT_FIELD_F32(0x21) +#define /*0x110*/ oEyerokBossOffsetFromHome OBJECT_FIELD_F32(0x22) +#define /*0x1AC*/ oEyerokBossActiveHandId OBJECT_FIELD_S32(0x49) + +/* Eyerok Hand */ +#define /*0x0F4*/ oEyerokHandWakeUpTimer OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oEyerokReceivedAttack OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oEyerokHandAnimStateIndex OBJECT_FIELD_S32(0x1D) +#define /*0x100*/ oEyerokHandEyeShownTimer OBJECT_FIELD_S32(0x1E) struct ObjectHitbox sEyerokHitbox = { /* interactType: */ INTERACT_BOUNCE_TOP, diff --git a/src/game/behaviors/falling_pillar.inc.c b/src/game/behaviors/falling_pillar.c similarity index 94% rename from src/game/behaviors/falling_pillar.inc.c rename to src/game/behaviors/falling_pillar.c index 6d8fe380ee..c46bd7a3b8 100644 --- a/src/game/behaviors/falling_pillar.inc.c +++ b/src/game/behaviors/falling_pillar.c @@ -1,3 +1,10 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" /** * Behavior for the falling pillars inside the underwater cave area of @@ -6,6 +13,9 @@ * Also includes behavior for the invisible hitboxes they spawn. */ +/* Falling Pillar */ +#define /*0x0F4*/ oFallingPillarPitchAcceleration OBJECT_FIELD_F32(0x1B) + static struct ObjectHitbox sFallingPillarHitbox = { /* interactType: */ INTERACT_DAMAGE, /* downOffset: */ 150, diff --git a/src/game/behaviors/falling_rising_platform.inc.c b/src/game/behaviors/falling_rising_platform.c similarity index 77% rename from src/game/behaviors/falling_rising_platform.inc.c rename to src/game/behaviors/falling_rising_platform.c index cc00e37fd9..a63c85f5a3 100644 --- a/src/game/behaviors/falling_rising_platform.inc.c +++ b/src/game/behaviors/falling_rising_platform.c @@ -1,4 +1,10 @@ -// falling_rising_platform.inc.c +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" + +/* Falling Rising Bitfs Platform */ +#define /*0x0F4*/ oBitfsPlatformTimer OBJECT_FIELD_S32(0x1B) void bhv_squishable_platform_loop(void) { o->header.gfx.scale[1] = (sins(o->oBitfsPlatformTimer) + 1.0f) * 0.3f + 0.4f; diff --git a/src/game/behaviors/ferris_wheel.inc.c b/src/game/behaviors/ferris_wheel.c similarity index 90% rename from src/game/behaviors/ferris_wheel.inc.c rename to src/game/behaviors/ferris_wheel.c index 2fdaf04705..48385caae4 100644 --- a/src/game/behaviors/ferris_wheel.inc.c +++ b/src/game/behaviors/ferris_wheel.c @@ -1,3 +1,11 @@ +#include +#include "actors/vanilla_actors/bitdw/header.h" +#include "actors/vanilla_actors/bits/header.h" +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" + /** * Behaviors for bhvFerrisWheelAxle and bhvFerrisWheelPlatform. diff --git a/src/game/behaviors/fire_piranha_plant.inc.c b/src/game/behaviors/fire_piranha_plant.c similarity index 89% rename from src/game/behaviors/fire_piranha_plant.inc.c rename to src/game/behaviors/fire_piranha_plant.c index c49b97f36b..c0c5b12f07 100644 --- a/src/game/behaviors/fire_piranha_plant.inc.c +++ b/src/game/behaviors/fire_piranha_plant.c @@ -1,4 +1,15 @@ -// fire_piranha_plant.inc.c +#include +#include "global_object_fields.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Fire Piranha Plant */ +#define /*0x0F4*/ oFirePiranhaPlantNeutralScale OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oFirePiranhaPlantScale OBJECT_FIELD_F32(0x1C) // Shared with above obj? Coincidence? +#define /*0x0FC*/ oFirePiranhaPlantActive OBJECT_FIELD_S32(0x1D) +#define /*0x100*/ oFirePiranhaPlantDeathSpinTimer OBJECT_FIELD_S32(0x1E) +#define /*0x104*/ oFirePiranhaPlantDeathSpinVel OBJECT_FIELD_F32(0x1F) struct ObjectHitbox sFirePiranhaPlantHitbox = { /* interactType: */ INTERACT_BOUNCE_TOP, @@ -12,18 +23,6 @@ struct ObjectHitbox sFirePiranhaPlantHitbox = { /* hurtboxHeight: */ 150, }; -struct ObjectHitbox sPiranhaPlantFireHitbox = { - /* interactType: */ INTERACT_FLAME, - /* downOffset: */ 10, - /* damageOrCoinValue: */ 0, - /* health: */ 0, - /* numLootCoins: */ 0, - /* radius: */ 10, - /* height: */ 20, - /* hurtboxRadius: */ 10, - /* hurtboxHeight: */ 20, -}; - s32 sNumActiveFirePiranhaPlants; s32 sNumKilledFirePiranhaPlants; diff --git a/src/game/behaviors/fire_spitter.inc.c b/src/game/behaviors/fire_spitter.c similarity index 87% rename from src/game/behaviors/fire_spitter.inc.c rename to src/game/behaviors/fire_spitter.c index ce6e52552a..ecdd9248b3 100644 --- a/src/game/behaviors/fire_spitter.inc.c +++ b/src/game/behaviors/fire_spitter.c @@ -1,4 +1,10 @@ -// fire_spitter.inc.c +#include +#include "global_object_fields.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Fire Spitter */ +#define /*0x0F4*/ oFireSpitterScaleVel OBJECT_FIELD_F32(0x1B) static void fire_spitter_act_idle(void) { approach_f32_ptr(&o->header.gfx.scale[0], 0.2f, 0.002f); diff --git a/src/game/behaviors/fish.inc.c b/src/game/behaviors/fish.c similarity index 91% rename from src/game/behaviors/fish.inc.c rename to src/game/behaviors/fish.c index 8d3d0adaa4..6f78e9b03e 100644 --- a/src/game/behaviors/fish.inc.c +++ b/src/game/behaviors/fish.c @@ -1,9 +1,28 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "actors/common1.h" +#include "actors/group13.h" +#include "engine/math_util.h" +#include "engine/surface_collision.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" /** * @file fish.inc.c * Implements behaviour and spawning for fish located in the Secret Aquarium and other levels. */ +/* Fish Group */ +#define /*0x0F4*/ oFishWaterLevel OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oFishGoalY OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oFishHeightOffset OBJECT_FIELD_F32(0x1D) +#define /*0x100*/ oFishYawVel OBJECT_FIELD_S32(0x1E) +#define /*0x104*/ oFishRoamDistance OBJECT_FIELD_F32(0x1F) +#define /*0x108*/ oFishGoalVel OBJECT_FIELD_F32(0x20) +#define /*0x10C*/ oFishDepthDistance OBJECT_FIELD_F32(0x21) +#define /*0x110*/ oFishActiveDistance OBJECT_FIELD_F32(0x22) + /** * Spawns fish with settings chosen by oBehParams2ndByte. * These settings are animations, colour, and spawn quantity. diff --git a/src/game/behaviors/fishing_boo.inc.c b/src/game/behaviors/fishing_boo.c similarity index 81% rename from src/game/behaviors/fishing_boo.inc.c rename to src/game/behaviors/fishing_boo.c index dffe8d6979..bfff4324aa 100644 --- a/src/game/behaviors/fishing_boo.inc.c +++ b/src/game/behaviors/fishing_boo.c @@ -1,4 +1,11 @@ -// fishing_boo.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" + +/* Moving Flame */ +#define /*0x0F4*/ oMovingFlameTimer OBJECT_FIELD_S32(0x1B) // Unused behavior file for the Fishing Boo enemy. // The fire circles around mario and would make it diff --git a/src/game/behaviors/flame.inc.c b/src/game/behaviors/flame.c similarity index 78% rename from src/game/behaviors/flame.inc.c rename to src/game/behaviors/flame.c index 2767ad0217..df80539db3 100644 --- a/src/game/behaviors/flame.inc.c +++ b/src/game/behaviors/flame.c @@ -1,4 +1,21 @@ -// flame.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" + +struct ObjectHitbox sPiranhaPlantFireHitbox = { + /* interactType: */ INTERACT_FLAME, + /* downOffset: */ 10, + /* damageOrCoinValue: */ 0, + /* health: */ 0, + /* numLootCoins: */ 0, + /* radius: */ 10, + /* height: */ 20, + /* hurtboxRadius: */ 10, + /* hurtboxHeight: */ 20, +}; void bhv_moving_flame_loop(void) { if (GET_BPARAM2(o->oBehParams) == MOVING_FLAME_BP_1FRAME) { diff --git a/src/game/behaviors/flame_mario.inc.c b/src/game/behaviors/flame_mario.c similarity index 90% rename from src/game/behaviors/flame_mario.inc.c rename to src/game/behaviors/flame_mario.c index 4297ef1939..a4c22df20c 100644 --- a/src/game/behaviors/flame_mario.inc.c +++ b/src/game/behaviors/flame_mario.c @@ -1,4 +1,8 @@ -// flame_mario.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" void bhv_black_smoke_upward_loop(void) { spawn_object_with_scale(o, MODEL_BURN_SMOKE, bhvBlackSmokeBowser, o->header.gfx.scale[0]); diff --git a/src/game/behaviors/flamethrower.inc.c b/src/game/behaviors/flamethrower.c similarity index 90% rename from src/game/behaviors/flamethrower.inc.c rename to src/game/behaviors/flamethrower.c index 11bc787c5c..1cf5cbeb60 100644 --- a/src/game/behaviors/flamethrower.inc.c +++ b/src/game/behaviors/flamethrower.c @@ -1,4 +1,13 @@ -// flamethrower.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Flamethrower */ +#define /*0x110*/ oFlameThowerTimeRemaining OBJECT_FIELD_S32(0x22) void bhv_flamethrower_flame_loop(void) { f32 scale; diff --git a/src/game/behaviors/floating_box.c b/src/game/behaviors/floating_box.c new file mode 100644 index 0000000000..b7ad540b9c --- /dev/null +++ b/src/game/behaviors/floating_box.c @@ -0,0 +1,8 @@ +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" + +void bhv_jrb_floating_box_loop(void) { + o->oPosY = o->oHomeY + sins(o->oTimer * 0x400) * 10.0f; +} diff --git a/src/game/behaviors/floating_box.inc.c b/src/game/behaviors/floating_box.inc.c deleted file mode 100644 index dcfe949091..0000000000 --- a/src/game/behaviors/floating_box.inc.c +++ /dev/null @@ -1,5 +0,0 @@ -// floating_box.inc.c - -void bhv_jrb_floating_box_loop(void) { - o->oPosY = o->oHomeY + sins(o->oTimer * 0x400) * 10.0f; -} diff --git a/src/game/behaviors/floating_platform.inc.c b/src/game/behaviors/floating_platform.c similarity index 80% rename from src/game/behaviors/floating_platform.inc.c rename to src/game/behaviors/floating_platform.c index 7b4d59c31e..d3d7aacda5 100644 --- a/src/game/behaviors/floating_platform.inc.c +++ b/src/game/behaviors/floating_platform.c @@ -1,4 +1,14 @@ -// floating_platform.inc.c +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "engine/surface_collision.h" +#include "game/object_helpers.h" + +/* Floating Platform */ +#define /*0x0F4*/ oFloatingPlatformIsOnFloor OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oFloatingPlatformMarioWeightWobbleOffset OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oFloatingPlatformHeightOffset OBJECT_FIELD_F32(0x1D) +#define /*0x100*/ oFloatingPlatformWaterSurfaceWobbleOffset OBJECT_FIELD_S32(0x1E) f32 floating_platform_find_home_y(void) { struct Surface *floor; diff --git a/src/game/behaviors/fly_guy.inc.c b/src/game/behaviors/fly_guy.c similarity index 92% rename from src/game/behaviors/fly_guy.inc.c rename to src/game/behaviors/fly_guy.c index 488bb77604..3c703a1cfa 100644 --- a/src/game/behaviors/fly_guy.inc.c +++ b/src/game/behaviors/fly_guy.c @@ -1,8 +1,23 @@ +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" /** * Behavior for bhvFlyGuy. */ +/* Fly Guy */ +#define /*0x0F4*/ oFlyGuyIdleTimer OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oFlyGuyOscTimer OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oFlyGuyUnusedJitter OBJECT_FIELD_S32(0x1D) +#define /*0x100*/ oFlyGuyLungeYDecel OBJECT_FIELD_F32(0x1E) +#define /*0x104*/ oFlyGuyLungeTargetPitch OBJECT_FIELD_S32(0x1F) +#define /*0x108*/ oFlyGuyTargetRoll OBJECT_FIELD_S32(0x20) +#define /*0x10C*/ oFlyGuyScaleVel OBJECT_FIELD_F32(0x21) + /** * Hitbox for fly guy. */ diff --git a/src/game/behaviors/flying_bookend_switch.inc.c b/src/game/behaviors/flying_bookend_switch.c similarity index 93% rename from src/game/behaviors/flying_bookend_switch.inc.c rename to src/game/behaviors/flying_bookend_switch.c index c04dc2b382..88e2295251 100644 --- a/src/game/behaviors/flying_bookend_switch.inc.c +++ b/src/game/behaviors/flying_bookend_switch.c @@ -1,4 +1,23 @@ -// flying_bookend_switch.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/level_update.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Bookend */ +#define /*0x0F4*/ oBookendTargetPitch OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oBookendTargetRoll OBJECT_FIELD_S32(0x1C) + +/* Book Switch */ +#define /*0x0F4*/ oBookSwitchDistFromHome OBJECT_FIELD_F32(0x1B) + +/* Book Switch Manager */ +#define /*0x0F4*/ oBookSwitchManagerNumCorrectChoices OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oBookSwitchManagerIsActive OBJECT_FIELD_S32(0x1C) struct BookSwitchPosition { s16 relPosX; diff --git a/src/game/behaviors/goomba.inc.c b/src/game/behaviors/goomba.c similarity index 93% rename from src/game/behaviors/goomba.inc.c rename to src/game/behaviors/goomba.c index 8cfd4b2966..0bebb7ec9c 100644 --- a/src/game/behaviors/goomba.inc.c +++ b/src/game/behaviors/goomba.c @@ -1,3 +1,10 @@ +#include +#include "behavior_data.h" +#include "engine/math_util.h" +#include "global_object_fields.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" /** * Behavior for bhvGoomba and bhvGoombaTripletSpawner, @@ -5,6 +12,18 @@ * The triplet spawner comes before its spawned goombas in processing order. */ +/* Goomba */ +#define /*0x0F4*/ oGoombaSize OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oGoombaScale OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oGoombaWalkTimer OBJECT_FIELD_S32(0x1D) +#define /*0x100*/ oGoombaTargetYaw OBJECT_FIELD_S32(0x1E) +#define /*0x104*/ oGoombaBlinkTimer OBJECT_FIELD_S32(0x1F) +#define /*0x108*/ oGoombaTurningAwayFromWall OBJECT_FIELD_S32(0x20) +#define /*0x10C*/ oGoombaRelativeSpeed OBJECT_FIELD_F32(0x21) +#define /*0x110*/ oIsFloomba OBJECT_FIELD_S32(0x22) +#define /*0x1AC*/ oZoomCounter OBJECT_FIELD_U32(0x49) +#define /*0x1B0*/ oZoomPosZ OBJECT_FIELD_F32(0x4A) + /** * Hitbox for goomba. */ diff --git a/src/game/behaviors/grand_star.inc.c b/src/game/behaviors/grand_star.c similarity index 90% rename from src/game/behaviors/grand_star.inc.c rename to src/game/behaviors/grand_star.c index c6a6379ab9..3321525781 100644 --- a/src/game/behaviors/grand_star.inc.c +++ b/src/game/behaviors/grand_star.c @@ -1,4 +1,12 @@ -// grand_star.inc.c +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Grand Star */ +#define /*0x108*/ oGrandStarArcTime OBJECT_FIELD_S32(0x20) s32 arc_to_goal_pos(Vec3f a0, Vec3f a1, f32 yVel, f32 gravity) { f32 dx = a0[0] - a1[0]; diff --git a/src/game/behaviors/grill_door.inc.c b/src/game/behaviors/grill_door.c similarity index 84% rename from src/game/behaviors/grill_door.inc.c rename to src/game/behaviors/grill_door.c index ee5cb18687..cacefb0b58 100644 --- a/src/game/behaviors/grill_door.inc.c +++ b/src/game/behaviors/grill_door.c @@ -1,4 +1,15 @@ -// grill_door.inc.c +#include +#include "actors/vanilla_actors/bob/header.h" +#include "actors/vanilla_actors/hmc/header.h" +#include "behavior_data.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Openable Grill */ +#define /*0x088*/ oOpenableGrillIsOpen OBJECT_FIELD_S32(0x00) +#define /*0x0F4*/ oOpenableGrillFloorSwitchObj OBJECT_FIELD_OBJ(0x1B) struct OpenableGrill { s16 halfWidth; diff --git a/src/game/behaviors/ground_particles.inc.c b/src/game/behaviors/ground_particles.c similarity index 95% rename from src/game/behaviors/ground_particles.inc.c rename to src/game/behaviors/ground_particles.c index eeba7d4653..67662a18ca 100644 --- a/src/game/behaviors/ground_particles.inc.c +++ b/src/game/behaviors/ground_particles.c @@ -1,4 +1,7 @@ -// ground_particles.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "game/object_helpers.h" void bhv_pound_white_puffs_init(void) { clear_particle_flags(ACTIVE_PARTICLE_MIST_CIRCLE); diff --git a/src/game/behaviors/haunted_chair.inc.c b/src/game/behaviors/haunted_chair.c similarity index 87% rename from src/game/behaviors/haunted_chair.inc.c rename to src/game/behaviors/haunted_chair.c index 5c831c25fa..e89224aaeb 100644 --- a/src/game/behaviors/haunted_chair.inc.c +++ b/src/game/behaviors/haunted_chair.c @@ -1,4 +1,17 @@ -// haunted_chair.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "game/game_init.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Haunted Chair */ +#define /*0x0F4*/ oHauntedChairSpinTimer OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oHauntedChairPitchVel OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oHauntedChairRollVel OBJECT_FIELD_F32(0x1D) +#define /*0x100*/ oHauntedChairFallFromPianoAngle OBJECT_FIELD_S32P(0x1E) +#define /*0x104*/ oHauntedChairFallTargetAngle OBJECT_FIELD_S32(0x1F) struct ObjectHitbox sHauntedChairHitbox = { /* interactType: */ INTERACT_MR_BLIZZARD, diff --git a/src/game/behaviors/heave_ho.inc.c b/src/game/behaviors/heave_ho.c similarity index 90% rename from src/game/behaviors/heave_ho.inc.c rename to src/game/behaviors/heave_ho.c index 7ffc9ef007..d979e61dba 100644 --- a/src/game/behaviors/heave_ho.inc.c +++ b/src/game/behaviors/heave_ho.c @@ -1,4 +1,15 @@ -// heave_ho.inc.c +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "engine/surface_collision.h" +#include "game/interaction.h" +#include "game/level_update.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Heave-Ho */ +#define /*0x088*/ oHeaveHoThrowState OBJECT_FIELD_S32(0x00) +#define /*0x0F4*/ oHeaveHoTimedSpeed OBJECT_FIELD_F32(0x1B) s16 sHeaveHoTimings[][2] = { { 30, 0 }, diff --git a/src/game/behaviors/hidden_star.inc.c b/src/game/behaviors/hidden_star.c similarity index 88% rename from src/game/behaviors/hidden_star.inc.c rename to src/game/behaviors/hidden_star.c index d41752b04a..52375d4e27 100644 --- a/src/game/behaviors/hidden_star.inc.c +++ b/src/game/behaviors/hidden_star.c @@ -1,4 +1,13 @@ -// hidden_star.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "game/ingame_menu.h" +#include "game/object_helpers.h" + +/* Hidden Star */ +#define /*0x0F4*/ oHiddenStarTriggerCounter OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oHiddenStarTriggerTotal OBJECT_FIELD_S32(0x1C) void bhv_hidden_star_init(void) { s16 remainingTriggers = count_objects_with_behavior(bhvHiddenStarTrigger); diff --git a/src/game/behaviors/hoot.inc.c b/src/game/behaviors/hoot.c similarity index 94% rename from src/game/behaviors/hoot.inc.c rename to src/game/behaviors/hoot.c index cd4078398d..192148f55f 100644 --- a/src/game/behaviors/hoot.inc.c +++ b/src/game/behaviors/hoot.c @@ -1,4 +1,17 @@ -// hoot.inc.c +#include +#include "behavior_data.h" +#include "dialog_ids.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "engine/surface_collision.h" +#include "game/interaction.h" +#include "game/level_update.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Hoot */ +#define /*0x0F4*/ oHootAvailability OBJECT_FIELD_S32(0x1B) +#define /*0x110*/ oHootMarioReleaseTime OBJECT_FIELD_S32(0x22) void bhv_hoot_init(void) { cur_obj_init_animation(HOOT_ANIM_DEFAULT); diff --git a/src/game/behaviors/horizontal_grindel.inc.c b/src/game/behaviors/horizontal_grindel.c similarity index 80% rename from src/game/behaviors/horizontal_grindel.inc.c rename to src/game/behaviors/horizontal_grindel.c index 87d7b5b606..d75c72adf4 100644 --- a/src/game/behaviors/horizontal_grindel.inc.c +++ b/src/game/behaviors/horizontal_grindel.c @@ -1,4 +1,12 @@ -// horizontal_grindel.inc.c +#include +#include "global_object_fields.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Horizontal Grindel */ +#define /*0x0F4*/ oHorizontalGrindelTargetYaw OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oHorizontalGrindelDistToHome OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oHorizontalGrindelOnGround OBJECT_FIELD_S32(0x1D) void bhv_horizontal_grindel_init(void) { o->oHorizontalGrindelTargetYaw = o->oMoveAngleYaw; diff --git a/src/game/behaviors/intro_lakitu.inc.c b/src/game/behaviors/intro_lakitu.c similarity index 70% rename from src/game/behaviors/intro_lakitu.inc.c rename to src/game/behaviors/intro_lakitu.c index 3e63925227..7fc2dcbbdc 100644 --- a/src/game/behaviors/intro_lakitu.inc.c +++ b/src/game/behaviors/intro_lakitu.c @@ -1,3 +1,10 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/camera.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" /** * @file intro_lakitu.inc.c @@ -5,6 +12,50 @@ * It's also used during the ending cutscene. */ +/* Intro Cutscene Lakitu */ +#define /*0x0F8*/ oIntroLakituSplineSegmentProgress OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oIntroLakituSplineSegment OBJECT_FIELD_F32(0x1D) +#define /*0x100*/ oIntroLakituDistToBirdsX OBJECT_FIELD_F32(0x1E) +#define /*0x104*/ oIntroLakituDistToBirdsZ OBJECT_FIELD_F32(0x1F) +#define /*0x108*/ O_INTRO_LAKITU_END_BIRDS_DEST_INDEX 0x20 +#define /*0x108*/ O_INTRO_LAKITU_END_BIRDS_DEST_X_INDEX (O_INTRO_LAKITU_END_BIRDS_DEST_INDEX + 0) // 0x20 +#define /*0x10C*/ O_INTRO_LAKITU_END_BIRDS_DEST_Y_INDEX (O_INTRO_LAKITU_END_BIRDS_DEST_INDEX + 1) // 0x21 +#define /*0x110*/ O_INTRO_LAKITU_END_BIRDS_DEST_Z_INDEX (O_INTRO_LAKITU_END_BIRDS_DEST_INDEX + 2) // 0x22 +#define /*0x110*/ oIntroLakituEndBirds1DestX OBJECT_FIELD_F32(O_INTRO_LAKITU_END_BIRDS_DEST_X_INDEX) +#define /*0x10C*/ oIntroLakituEndBirds1DestY OBJECT_FIELD_F32(O_INTRO_LAKITU_END_BIRDS_DEST_Y_INDEX) +#define /*0x108*/ oIntroLakituEndBirds1DestZ OBJECT_FIELD_F32(O_INTRO_LAKITU_END_BIRDS_DEST_Z_INDEX) +#define /*0x1AC*/ oIntroLakituCloud OBJECT_FIELD_OBJ(0x49) + +struct CutsceneSplinePoint gIntroLakituStartToPipeFocus[] = { + { 0, 32, { 58, -250, 346 } }, { 1, 50, { -159, -382, 224 } }, { 2, 37, { 0, -277, 237 } }, + { 3, 15, { 1, -44, 245 } }, { 4, 35, { 0, -89, 228 } }, { 5, 15, { 28, 3, 259 } }, + { 6, 25, { -38, -201, 371 } }, { 7, 20, { -642, 118, 652 } }, { 8, 25, { 103, -90, 861 } }, + { 9, 25, { 294, 145, 579 } }, { 10, 30, { 220, -42, 500 } }, { 11, 20, { 10, -134, 200 } }, + { 12, 20, { -143, -145, 351 } }, { 13, 14, { -256, -65, 528 } }, { 14, 20, { -251, -52, 459 } }, + { 15, 25, { -382, 520, 395 } }, { 16, 25, { -341, 240, 653 } }, { 17, 5, { -262, 700, 143 } }, + { 18, 15, { -760, 32, 27 } }, { 19, 20, { -756, -6, -26 } }, { 20, 20, { -613, 5, 424 } }, + { 21, 20, { -22, -100, 312 } }, { 22, 25, { 212, 80, 61 } }, { 23, 20, { 230, -28, 230 } }, + { 24, 35, { -83, -51, 303 } }, { 25, 17, { 126, 90, 640 } }, { 26, 9, { 158, 95, 763 } }, + { 27, 8, { 113, -25, 1033 } }, { 28, 20, { 57, -53, 1291 } }, { 29, 15, { 73, -34, 1350 } }, + { 30, 7, { 0, 96, 1400 } }, { 31, 8, { -59, 269, 1450 } }, { 32, 15, { 57, 1705, 1500 } }, + { 0, 15, { -227, 511, 1550 } }, { -1, 15, { -227, 511, 1600 } } +}; + +struct CutsceneSplinePoint gIntroLakituStartToPipeOffsetFromCamera[] = { + { 0, 0, { -46, 87, -15 } }, { 1, 0, { -38, 91, -11 } }, { 2, 0, { -31, 93, -13 } }, + { 3, 0, { -50, 84, -16 } }, { 4, 0, { -52, 83, -17 } }, { 5, 0, { -10, 99, 3 } }, + { 6, 0, { -54, 83, -10 } }, { 7, 0, { -31, 85, -40 } }, { 8, 0, { -34, 91, 19 } }, + { 9, 0, { -9, 95, 28 } }, { 10, 0, { 17, 72, 66 } }, { 11, 0, { 88, -7, 45 } }, + { 12, 0, { 96, -6, -26 } }, { 13, 0, { 56, -1, -82 } }, { 14, 0, { 40, 65, -63 } }, + { 15, 0, { -26, -3, -96 } }, { 16, 0, { 92, 82, 19 } }, { 17, 0, { 92, 32, 19 } }, + { 18, 0, { 92, 32, 19 } }, { 19, 0, { 92, 102, 19 } }, { 20, 0, { -69, 59, -70 } }, + { 21, 0, { -77, 109, -61 } }, { 22, 0, { -87, 59, -46 } }, { 23, 0, { -99, -3, 11 } }, + { 24, 0, { -99, -11, 5 } }, { 25, 0, { -97, -6, 19 } }, { 26, 0, { -97, 22, -7 } }, + { 27, 0, { -98, -11, -13 } }, { 28, 0, { -97, -11, 19 } }, { 29, 0, { -91, -11, 38 } }, + { 30, 0, { -76, -11, 63 } }, { 31, 0, { -13, 33, 93 } }, { 32, 0, { 51, -11, 84 } }, + { 33, 0, { 51, -11, 84 } }, { -1, 0, { 51, -11, 84 } } +}; + /** * Add the camera's position to `offset`, rotate the point to be relative to the camera's focus, then * set lakitu's location. diff --git a/src/game/behaviors/intro_peach.inc.c b/src/game/behaviors/intro_peach.c similarity index 82% rename from src/game/behaviors/intro_peach.inc.c rename to src/game/behaviors/intro_peach.c index cfe3d0a9c3..742de6aa1b 100644 --- a/src/game/behaviors/intro_peach.inc.c +++ b/src/game/behaviors/intro_peach.c @@ -1,4 +1,14 @@ -// intro_peach.inc.c +#include +#include "dialog_ids.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/ingame_menu.h" +#include "game/object_helpers.h" + +/* Intro Cutscene Peach */ +#define /*0x108*/ oIntroPeachYawFromFocus OBJECT_FIELD_F32(0x20) +#define /*0x10C*/ oIntroPeachPitchFromFocus OBJECT_FIELD_F32(0x21) +#define /*0x110*/ oIntroPeachDistToCamera OBJECT_FIELD_F32(0x22) /** * Set peach's location relative to the camera focus. diff --git a/src/game/behaviors/intro_scene.inc.c b/src/game/behaviors/intro_scene.c similarity index 96% rename from src/game/behaviors/intro_scene.inc.c rename to src/game/behaviors/intro_scene.c index b7be18610e..bda7b70287 100644 --- a/src/game/behaviors/intro_scene.inc.c +++ b/src/game/behaviors/intro_scene.c @@ -1,4 +1,8 @@ -// intro_scene.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" void spawn_child_obj_relative(struct Object *parent, s16 xOffset, s16 yOffset, s16 zOffset, s16 pitchOffset, s16 yawOffset, s16 rollOffset, diff --git a/src/game/behaviors/jrb_ship.inc.c b/src/game/behaviors/jrb_ship.c similarity index 82% rename from src/game/behaviors/jrb_ship.inc.c rename to src/game/behaviors/jrb_ship.c index 322f7ae010..de371187ed 100644 --- a/src/game/behaviors/jrb_ship.inc.c +++ b/src/game/behaviors/jrb_ship.c @@ -1,4 +1,19 @@ -// jrb_ship.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Ship Part 3 */ +#define /*0x0F4*/ oShipPart3LoopPitch OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oShipPart3LoopRoll OBJECT_FIELD_S32(0x1C) + +/* Jrb Sliding Box */ +#define /*0x0F4*/ oJrbSlidingBoxShipObj OBJECT_FIELD_OBJ(0x1B) +#define /*0x0F8*/ oJrbSlidingBoxAngle OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oJrbSlidingBoxAdditiveZ OBJECT_FIELD_F32(0x1D) struct ObjectHitbox sSkullSlidingBoxHitbox = { /* interactType: */ INTERACT_DAMAGE, diff --git a/src/game/behaviors/jumping_box.inc.c b/src/game/behaviors/jumping_box.c similarity index 85% rename from src/game/behaviors/jumping_box.inc.c rename to src/game/behaviors/jumping_box.c index 565584f045..d0f5fec8ec 100644 --- a/src/game/behaviors/jumping_box.inc.c +++ b/src/game/behaviors/jumping_box.c @@ -1,4 +1,13 @@ -// jumping_box.inc.c +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Jumping Box (Crazy Box) */ +#define /*0x0F4*/ oJumpingBoxUnusedTimerMin OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oJumpingBoxRandomTimer OBJECT_FIELD_S32(0x1C) struct ObjectHitbox sJumpingBoxHitbox = { /* interactType: */ INTERACT_GRABBABLE, diff --git a/src/game/behaviors/kickable_board.inc.c b/src/game/behaviors/kickable_board.c similarity index 76% rename from src/game/behaviors/kickable_board.inc.c rename to src/game/behaviors/kickable_board.c index 5b251a6a82..aa33b4fe58 100644 --- a/src/game/behaviors/kickable_board.inc.c +++ b/src/game/behaviors/kickable_board.c @@ -1,19 +1,14 @@ -// kickable_board.inc.c - -s32 check_mario_attacking(void) { - if (obj_check_if_collided_with_object(o, gMarioObject)) { - if (abs_angle_diff(o->oMoveAngleYaw, gMarioObject->oMoveAngleYaw) > 0x6000) { - if (gMarioStates[0].action == ACT_SLIDE_KICK ) return WF_ATTACK_GROUND; - if (gMarioStates[0].action == ACT_PUNCHING ) return WF_ATTACK_GROUND; - if (gMarioStates[0].action == ACT_MOVE_PUNCHING ) return WF_ATTACK_GROUND; - if (gMarioStates[0].action == ACT_SLIDE_KICK_SLIDE) return WF_ATTACK_GROUND; - if (gMarioStates[0].action == ACT_JUMP_KICK ) return WF_ATTACK_AIR; - if (gMarioStates[0].action == ACT_WALL_KICK_AIR ) return WF_ATTACK_AIR; - } - } - - return 0; -} +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "engine/surface_load.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Kickable Board */ +#define /*0x0F4*/ oKickableBoardRockingAngleAmount OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oKickableBoardRockingTimer OBJECT_FIELD_S32(0x1C) void init_kickable_board_rock(void) { o->oKickableBoardRockingTimer = 1600; diff --git a/src/game/behaviors/king_bobomb.inc.c b/src/game/behaviors/king_bobomb.c similarity index 93% rename from src/game/behaviors/king_bobomb.inc.c rename to src/game/behaviors/king_bobomb.c index f70d03197c..2f7d0a4ae9 100644 --- a/src/game/behaviors/king_bobomb.inc.c +++ b/src/game/behaviors/king_bobomb.c @@ -1,4 +1,23 @@ -// king_bobomb.inc.c +#include +#include "dialog_ids.h" +#include "seq_ids.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "engine/math_util.h" +#include "game/debug.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/rendering_graph_node.h" +#include "game/spawn_sound.h" + + /* King Bob-omb */ +#define /*0x088*/ oKingBobombHoldingMarioState OBJECT_FIELD_S32(0x00) +#define /*0x0F8*/ oKingBobombIsJumping OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oKingBobombPlayerGrabEscapeActions OBJECT_FIELD_S32(0x1D) +#define /*0x100*/ oKingBobombShouldStomp OBJECT_FIELD_S32(0x1E) +#define /*0x104*/ oKingBobombStationaryTimer OBJECT_FIELD_S32(0x1F) +#define /*0x108*/ oKingBobombPlayerGrabEscapeCooldown OBJECT_FIELD_S32(0x20) +#define /*0x10C*/ oKingBobombBlinkTimer OBJECT_FIELD_S32(0x21) // Copy of geo_update_projectile_pos_from_parent Gfx *geo_update_held_mario_pos(s32 callContext, UNUSED struct GraphNode *node, Mat4 mtx) { diff --git a/src/game/behaviors/klepto.inc.c b/src/game/behaviors/klepto.c similarity index 89% rename from src/game/behaviors/klepto.inc.c rename to src/game/behaviors/klepto.c index a04d6380b5..9f561cd0de 100644 --- a/src/game/behaviors/klepto.inc.c +++ b/src/game/behaviors/klepto.c @@ -1,4 +1,31 @@ -// klepto.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/level_update.h" +#include "game/object_helpers.h" +#include "game/save_file.h" +#include "game/spawn_sound.h" + +/* Klepto */ +#define /*0x0F4*/ oKleptoDistanceToTarget OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oKleptoHomeYOffset OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oKleptoHalfLateralDistToHome OBJECT_FIELD_F32(0x1D) +#define /*0x100*/ oKleptoSpeed OBJECT_FIELD_F32(0x1E) +#define /*0x104*/ O_KLEPTO_START_POS_INDEX 0x1F +#define /*0x104*/ O_KLEPTO_START_POS_X_INDEX (O_KLEPTO_START_POS_INDEX + 0) // 0x1F +#define /*0x108*/ O_KLEPTO_START_POS_Y_INDEX (O_KLEPTO_START_POS_INDEX + 1) // 0x20 +#define /*0x10C*/ O_KLEPTO_START_POS_Z_INDEX (O_KLEPTO_START_POS_INDEX + 2) // 0x21 +#define /*0x104*/ oKleptoStartPosVec OBJECT_FIELD_F32(O_KLEPTO_START_POS_INDEX) +#define /*0x104*/ oKleptoStartPosX OBJECT_FIELD_F32(O_KLEPTO_START_POS_X_INDEX) +#define /*0x108*/ oKleptoStartPosY OBJECT_FIELD_F32(O_KLEPTO_START_POS_Y_INDEX) +#define /*0x10C*/ oKleptoStartPosZ OBJECT_FIELD_F32(O_KLEPTO_START_POS_Z_INDEX) +#define /*0x110*/ oKleptoTimeUntilTargetChange OBJECT_FIELD_S32(0x22) +#define /*0x1AC*/ oKleptoTargetNumber OBJECT_FIELD_S16(0x49, 0) +#define /*0x1AE*/ oKleptoDiveTimer OBJECT_FIELD_S16(0x49, 1) +#define /*0x1B0*/ oKleptoPitchToTarget OBJECT_FIELD_S16(0x4A, 0) +#define /*0x1B2*/ oKleptoYawToTarget OBJECT_FIELD_S16(0x4A, 1) static struct ObjectHitbox sKleptoHitbox = { /* interactType: */ INTERACT_HIT_FROM_BELOW, diff --git a/src/game/behaviors/koopa.inc.c b/src/game/behaviors/koopa.c similarity index 94% rename from src/game/behaviors/koopa.inc.c rename to src/game/behaviors/koopa.c index c9a2ff538a..69ecd32bc9 100644 --- a/src/game/behaviors/koopa.inc.c +++ b/src/game/behaviors/koopa.c @@ -1,3 +1,17 @@ +#include +#include "behavior_data.h" +#include "dialog_ids.h" +#include "global_object_fields.h" +#include "seq_ids.h" +#include "audio/external.h" +#include "engine/math_util.h" +#include "game/ingame_menu.h" +#include "game/interaction.h" +#include "game/level_update.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" +#include "levels/bob/header.h" +#include "levels/thi/header.h" /** * Behavior for bhvKoopa and bhvKoopaRaceEndpoint. @@ -7,9 +21,26 @@ * flag. */ -// There is no good solution for this - just keep paths in BOB and THI for now -#include "levels/bob/header.h" -#include "levels/thi/header.h" +/* Koopa */ +#define /*0x0F4*/ oKoopaAgility OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oKoopaMovementType OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oKoopaTargetYaw OBJECT_FIELD_S32(0x1D) +#define /*0x100*/ oKoopaUnshelledTimeUntilTurn OBJECT_FIELD_S32(0x1E) +#define /*0x104*/ oKoopaTurningAwayFromWall OBJECT_FIELD_S32(0x1F) +#define /*0x108*/ oKoopaDistanceToMario OBJECT_FIELD_F32(0x20) +#define /*0x10C*/ oKoopaAngleToMario OBJECT_FIELD_S32(0x21) +#define /*0x110*/ oKoopaBlinkTimer OBJECT_FIELD_S32(0x22) +#define /*0x1AC*/ oKoopaCountdown OBJECT_FIELD_S16(0x49, 0) +#define /*0x1AE*/ oKoopaTheQuickRaceIndex OBJECT_FIELD_S16(0x49, 1) +#define /*0x1B0*/ oKoopaTheQuickInitTextboxCooldown OBJECT_FIELD_S16(0x4A, 0) +// 0x1D-0x21 for koopa the quick reserved for pathing + +/* Koopa Race Endpoint */ +#define /*0x0F4*/ oKoopaRaceEndpointRaceBegun OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oKoopaRaceEndpointKoopaFinished OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oKoopaRaceEndpointRaceStatus OBJECT_FIELD_S32(0x1D) +#define /*0x100*/ oKoopaRaceEndpointDialog OBJECT_FIELD_S32(0x1E) +#define /*0x104*/ oKoopaRaceEndpointRaceEnded OBJECT_FIELD_S32(0x1F) /** * Hitbox for koopa - this is used for every form except Koopa the Quick, which diff --git a/src/game/behaviors/koopa_shell.inc.c b/src/game/behaviors/koopa_shell.c similarity index 89% rename from src/game/behaviors/koopa_shell.inc.c rename to src/game/behaviors/koopa_shell.c index a9c7364a35..46cf6a714b 100644 --- a/src/game/behaviors/koopa_shell.inc.c +++ b/src/game/behaviors/koopa_shell.c @@ -1,4 +1,15 @@ -// koopa_shell.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "engine/surface_collision.h" +#include "game/interaction.h" +#include "game/level_update.h" +#include "game/object_helpers.h" + +/* Koopa Shell Flame */ +#define /*0x0F4*/ oKoopaShellFlameUnused OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oKoopaShellFlameScale OBJECT_FIELD_F32(0x1C) struct ObjectHitbox sKoopaShellHitbox = { .interactType = INTERACT_KOOPA_SHELL, diff --git a/src/game/behaviors/koopa_shell_underwater.inc.c b/src/game/behaviors/koopa_shell_underwater.c similarity index 89% rename from src/game/behaviors/koopa_shell_underwater.inc.c rename to src/game/behaviors/koopa_shell_underwater.c index 7d65758058..e114119b8b 100644 --- a/src/game/behaviors/koopa_shell_underwater.inc.c +++ b/src/game/behaviors/koopa_shell_underwater.c @@ -1,4 +1,7 @@ -// koopa_shell_underwater.inc.c +#include +#include "global_object_fields.h" +#include "game/interaction.h" +#include "game/object_helpers.h" struct ObjectHitbox sKoopaShellUnderwaterHitbox = { /* interactType: */ INTERACT_GRABBABLE, diff --git a/src/game/behaviors/lll_floating_wood_piece.inc.c b/src/game/behaviors/lll_floating_wood_piece.c similarity index 80% rename from src/game/behaviors/lll_floating_wood_piece.inc.c rename to src/game/behaviors/lll_floating_wood_piece.c index 71b37e7fdc..374d321b62 100644 --- a/src/game/behaviors/lll_floating_wood_piece.inc.c +++ b/src/game/behaviors/lll_floating_wood_piece.c @@ -1,4 +1,11 @@ -// lll_floating_wood_piece.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" + +/* Lll Wood Piece */ +#define /*0x0F4*/ oLllWoodPieceOscillationTimer OBJECT_FIELD_S32(0x1B) void bhv_lll_wood_piece_loop(void) { if (o->oTimer == 0) { diff --git a/src/game/behaviors/lll_hexagonal_ring.inc.c b/src/game/behaviors/lll_hexagonal_ring.c similarity index 90% rename from src/game/behaviors/lll_hexagonal_ring.inc.c rename to src/game/behaviors/lll_hexagonal_ring.c index 80bb57a890..30e42ef8db 100644 --- a/src/game/behaviors/lll_hexagonal_ring.inc.c +++ b/src/game/behaviors/lll_hexagonal_ring.c @@ -1,3 +1,10 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + // lll_hexagonal_ring.inc.c void hexagonal_ring_spawn_flames(void) { diff --git a/src/game/behaviors/lll_octagonal_rotating_mesh.inc.c b/src/game/behaviors/lll_octagonal_rotating_mesh.c similarity index 89% rename from src/game/behaviors/lll_octagonal_rotating_mesh.inc.c rename to src/game/behaviors/lll_octagonal_rotating_mesh.c index 19d0e8b89b..ff17f953f1 100644 --- a/src/game/behaviors/lll_octagonal_rotating_mesh.inc.c +++ b/src/game/behaviors/lll_octagonal_rotating_mesh.c @@ -1,4 +1,15 @@ -// lll_octagonal_rotating_mesh.inc.c +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/debug.h" +#include "game/object_helpers.h" + +/* LLL Octagonal Mesh */ +#define /*0x0F4*/ oLllOctMeshWaveTimer OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oLllOctMeshActionOffset OBJECT_FIELD_S32(0x1C) +#define /*0x100*/ oLllOctMeshWaveYOffset OBJECT_FIELD_F32(0x1E) +#define /*0x104*/ oLllOctMeshStandTimer OBJECT_FIELD_S32(0x1F) +#define /*0x108*/ oLllOctMeshYOffsetFromHome OBJECT_FIELD_F32(0x20) enum LLLOctagonalMeshInstructions { LLL_OCTMESH_CHANGE_DIR = 1, // 1 diff --git a/src/game/behaviors/lll_rotating_hex_flame.inc.c b/src/game/behaviors/lll_rotating_hex_flame.c similarity index 64% rename from src/game/behaviors/lll_rotating_hex_flame.inc.c rename to src/game/behaviors/lll_rotating_hex_flame.c index 64e8566754..d224aa9ad1 100644 --- a/src/game/behaviors/lll_rotating_hex_flame.inc.c +++ b/src/game/behaviors/lll_rotating_hex_flame.c @@ -1,4 +1,19 @@ -// lll_rotating_hex_flame.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "engine/surface_load.h" +#include "game/object_helpers.h" + +/* Lll Rotating Hex Flame */ +#define /*0x0F4*/ O_LLL_ROTATING_HEX_FLAME_RELATIVE_POS_INDEX 0x1B +#define /*0x0F4*/ O_LLL_ROTATING_HEX_FLAME_RELATIVE_POS_X_INDEX (O_LLL_ROTATING_HEX_FLAME_RELATIVE_POS_INDEX + 0) // 0x1B +#define /*0x0F8*/ O_LLL_ROTATING_HEX_FLAME_RELATIVE_POS_Y_INDEX (O_LLL_ROTATING_HEX_FLAME_RELATIVE_POS_INDEX + 1) // 0x1C +#define /*0x0FC*/ O_LLL_ROTATING_HEX_FLAME_RELATIVE_POS_Z_INDEX (O_LLL_ROTATING_HEX_FLAME_RELATIVE_POS_INDEX + 2) // 0x1D +#define /*0x0F4*/ oLllRotatingHexFlameRelativePosVec OBJECT_FIELD_F32(O_LLL_ROTATING_HEX_FLAME_RELATIVE_POS_INDEX) +#define /*0x0F4*/ oLllRotatingHexFlameRelativePosX OBJECT_FIELD_F32(O_LLL_ROTATING_HEX_FLAME_RELATIVE_POS_X_INDEX) +#define /*0x0F8*/ oLllRotatingHexFlameRelativePosY OBJECT_FIELD_F32(O_LLL_ROTATING_HEX_FLAME_RELATIVE_POS_Y_INDEX) +#define /*0x0FC*/ oLllRotatingHexFlameRelativePosZ OBJECT_FIELD_F32(O_LLL_ROTATING_HEX_FLAME_RELATIVE_POS_Z_INDEX) void bhv_lll_rotating_hex_flame_loop(void) { cur_obj_set_pos_relative(o->parentObj, o->oLllRotatingHexFlameRelativePosX, o->oLllRotatingHexFlameRelativePosY, o->oLllRotatingHexFlameRelativePosZ); diff --git a/src/game/behaviors/lll_sinking_rectangle.inc.c b/src/game/behaviors/lll_sinking_rectangle.c similarity index 77% rename from src/game/behaviors/lll_sinking_rectangle.inc.c rename to src/game/behaviors/lll_sinking_rectangle.c index 07ac7409ba..0774c9d8e1 100644 --- a/src/game/behaviors/lll_sinking_rectangle.inc.c +++ b/src/game/behaviors/lll_sinking_rectangle.c @@ -1,4 +1,10 @@ -// lll_sinking_rectangle.inc.c +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" + +/* Lll Wood Piece */ +#define /*0x0F4*/ oLllWoodPieceOscillationTimer OBJECT_FIELD_S32(0x1B) void sinking_rectangular_plat_actions(f32 a0, s32 a1) { switch (o->oAction) { diff --git a/src/game/behaviors/lll_sinking_rock_block.c b/src/game/behaviors/lll_sinking_rock_block.c new file mode 100644 index 0000000000..77adb6007d --- /dev/null +++ b/src/game/behaviors/lll_sinking_rock_block.c @@ -0,0 +1,16 @@ +#include +#include "global_object_fields.h" +#include "game/object_helpers.h" + +/* Sink When Stepped On */ +#define /*0x104*/ oSinkWhenSteppedOnTimer OBJECT_FIELD_S32(0x1F) +#define /*0x108*/ oSinkWhenSteppedOnYOffsetFromHome OBJECT_FIELD_F32(0x20) + +// from lll_octagonal_rotating_mesh.c +extern s32 lll_octagonal_mesh_find_y_offset(s32 *standTimer, f32 *posOffset, s32 standTimerInc, s32 moveDownAmount); + +void bhv_lll_sinking_rock_block_loop(void) { + lll_octagonal_mesh_find_y_offset(&o->oSinkWhenSteppedOnTimer, &o->oSinkWhenSteppedOnYOffsetFromHome, 124, -110); + o->oGraphYOffset = 0.0f; + o->oPosY = o->oHomeY + o->oSinkWhenSteppedOnYOffsetFromHome; +} diff --git a/src/game/behaviors/lll_sinking_rock_block.inc.c b/src/game/behaviors/lll_sinking_rock_block.inc.c deleted file mode 100644 index bf6c4dc478..0000000000 --- a/src/game/behaviors/lll_sinking_rock_block.inc.c +++ /dev/null @@ -1,7 +0,0 @@ -// lll_sinking_rock_block.inc.c - -void bhv_lll_sinking_rock_block_loop(void) { - lll_octagonal_mesh_find_y_offset(&o->oSinkWhenSteppedOnTimer, &o->oSinkWhenSteppedOnYOffsetFromHome, 124, -110); - o->oGraphYOffset = 0.0f; - o->oPosY = o->oHomeY + o->oSinkWhenSteppedOnYOffsetFromHome; -} diff --git a/src/game/behaviors/lll_volcano_flames.inc.c b/src/game/behaviors/lll_volcano_flames.c similarity index 81% rename from src/game/behaviors/lll_volcano_flames.inc.c rename to src/game/behaviors/lll_volcano_flames.c index 56f2487a3e..73763c393c 100644 --- a/src/game/behaviors/lll_volcano_flames.inc.c +++ b/src/game/behaviors/lll_volcano_flames.c @@ -1,3 +1,7 @@ +#include +#include "global_object_fields.h" +#include "game/object_helpers.h" + // lll_volcano_flames.inc.c void bhv_volcano_flames_loop(void) { diff --git a/src/game/behaviors/mad_piano.inc.c b/src/game/behaviors/mad_piano.c similarity index 92% rename from src/game/behaviors/mad_piano.inc.c rename to src/game/behaviors/mad_piano.c index 55192e40ca..44d4408808 100644 --- a/src/game/behaviors/mad_piano.inc.c +++ b/src/game/behaviors/mad_piano.c @@ -1,3 +1,10 @@ +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/level_update.h" +#include "game/object_helpers.h" + // mad_piano.inc.c static struct ObjectHitbox sMadPianoHitbox = { diff --git a/src/game/behaviors/manta_ray.inc.c b/src/game/behaviors/manta_ray.c similarity index 81% rename from src/game/behaviors/manta_ray.inc.c rename to src/game/behaviors/manta_ray.c index 8eb12b652d..f1d211484c 100644 --- a/src/game/behaviors/manta_ray.inc.c +++ b/src/game/behaviors/manta_ray.c @@ -1,3 +1,20 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Manta Ray */ +#define /*0x0F4*/ O_MANTA_TARGET_ANGLE_INDEX 0x1B +#define /*0x0F4*/ O_MANTA_TARGET_PITCH_INDEX (O_MANTA_TARGET_ANGLE_INDEX + 0) // 0x1B +#define /*0x0F8*/ O_MANTA_TARGET_YAW_INDEX (O_MANTA_TARGET_ANGLE_INDEX + 1) // 0x1C +#define /*0x0FC*/ O_MANTA_TARGET_ROLL_INDEX (O_MANTA_TARGET_ANGLE_INDEX + 2) // 0x1D +#define /*0x0F4*/ oMantaTargetAngleVec OBJECT_FIELD_S32(O_MANTA_TARGET_ANGLE_INDEX) +#define /*0x0F4*/ oMantaTargetPitch OBJECT_FIELD_S32(O_MANTA_TARGET_PITCH_INDEX) +#define /*0x0F8*/ oMantaTargetYaw OBJECT_FIELD_S32(O_MANTA_TARGET_YAW_INDEX) +#define /*0x0FC*/ oMantaTargetRoll OBJECT_FIELD_S32(O_MANTA_TARGET_ROLL_INDEX) // unused /** * @file Behavior file for the manta ray in DDD. diff --git a/src/game/behaviors/metal_box.inc.c b/src/game/behaviors/metal_box.c similarity index 84% rename from src/game/behaviors/metal_box.inc.c rename to src/game/behaviors/metal_box.c index 4bb510a3ee..dd0ce8121d 100644 --- a/src/game/behaviors/metal_box.inc.c +++ b/src/game/behaviors/metal_box.c @@ -1,3 +1,12 @@ +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "engine/surface_collision.h" +#include "game/interaction.h" +#include "game/level_update.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + // metal_box.inc.c struct ObjectHitbox sMetalBoxHitbox = { diff --git a/src/game/behaviors/mips.inc.c b/src/game/behaviors/mips.c similarity index 94% rename from src/game/behaviors/mips.inc.c rename to src/game/behaviors/mips.c index e49657af8b..5278259609 100644 --- a/src/game/behaviors/mips.inc.c +++ b/src/game/behaviors/mips.c @@ -1,8 +1,24 @@ +#include +#include "behavior_data.h" +#include "dialog_ids.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/save_file.h" +#include "game/spawn_sound.h" +#include "levels/castle_inside/header.h" /** * Behavior for MIPS (everyone's favorite yellow rabbit). */ +/* Mips */ +#define /*0x0F4*/ oMipsStarStatus OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oMipsStartWaypointIndex OBJECT_FIELD_S32(0x1C) +// 0x1D-0x21 reserved for pathing +#define /*0x1AC*/ oMipsForwardVelocity OBJECT_FIELD_F32(0x49) + /** * Initializes MIPS' physics parameters and checks if he should be active, * hiding him if necessary. diff --git a/src/game/behaviors/moat_drainer.inc.c b/src/game/behaviors/moat_drainer.c similarity index 69% rename from src/game/behaviors/moat_drainer.inc.c rename to src/game/behaviors/moat_drainer.c index 01668e2b2f..9361c5b552 100644 --- a/src/game/behaviors/moat_drainer.inc.c +++ b/src/game/behaviors/moat_drainer.c @@ -1,3 +1,8 @@ +#include +#include "global_object_fields.h" +#include "game/object_helpers.h" +#include "game/save_file.h" + // moat_drainer.inc.c void bhv_invisible_objects_under_bridge_init(void) { diff --git a/src/game/behaviors/moat_grill.inc.c b/src/game/behaviors/moat_grill.c similarity index 58% rename from src/game/behaviors/moat_grill.inc.c rename to src/game/behaviors/moat_grill.c index 7ccfa96627..b660e978a6 100644 --- a/src/game/behaviors/moat_grill.inc.c +++ b/src/game/behaviors/moat_grill.c @@ -1,3 +1,9 @@ +#include +#include "global_object_fields.h" +#include "engine/surface_load.h" +#include "game/object_helpers.h" +#include "game/save_file.h" + // moat_grill.inc.c void bhv_moat_grills_loop(void) { diff --git a/src/game/behaviors/moneybag.inc.c b/src/game/behaviors/moneybag.c similarity index 95% rename from src/game/behaviors/moneybag.inc.c rename to src/game/behaviors/moneybag.c index dc06a877ce..1a8142e76d 100644 --- a/src/game/behaviors/moneybag.inc.c +++ b/src/game/behaviors/moneybag.c @@ -1,4 +1,13 @@ -// moneybag.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Moneybag */ +#define /*0x0F4*/ oMoneybagJumpState OBJECT_FIELD_S32(0x1B) static struct ObjectHitbox sMoneybagHitbox = { /* interactType: */ INTERACT_BOUNCE_TOP, diff --git a/src/game/behaviors/monty_mole.inc.c b/src/game/behaviors/monty_mole.c similarity index 96% rename from src/game/behaviors/monty_mole.inc.c rename to src/game/behaviors/monty_mole.c index 3d175092a0..56493daa6c 100644 --- a/src/game/behaviors/monty_mole.inc.c +++ b/src/game/behaviors/monty_mole.c @@ -1,3 +1,19 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/level_update.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Monty Mole */ +#define /*0x0F4*/ oMontyMoleCurrentHole OBJECT_FIELD_OBJ(0x1B) +#define /*0x0F8*/ oMontyMoleHeightRelativeToFloor OBJECT_FIELD_F32(0x1C) + +/* Monty Mole Hole */ +#define /*0x0F4*/ oMontyMoleHoleCooldown OBJECT_FIELD_S32(0x1B) /** * Behavior for bhvMontyMole, bhvMontyMoleHole, and bhvMontyMoleRock. diff --git a/src/game/behaviors/moving_coin.inc.c b/src/game/behaviors/moving_coin.c similarity index 97% rename from src/game/behaviors/moving_coin.inc.c rename to src/game/behaviors/moving_coin.c index dabf74915b..8b2435058b 100644 --- a/src/game/behaviors/moving_coin.inc.c +++ b/src/game/behaviors/moving_coin.c @@ -1,3 +1,10 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + // moving_coin.inc.c static struct ObjectHitbox sMovingYellowCoinHitbox = { diff --git a/src/game/behaviors/mr_blizzard.inc.c b/src/game/behaviors/mr_blizzard.c similarity index 94% rename from src/game/behaviors/mr_blizzard.inc.c rename to src/game/behaviors/mr_blizzard.c index cc0064ca3b..6f3d5bdf52 100644 --- a/src/game/behaviors/mr_blizzard.inc.c +++ b/src/game/behaviors/mr_blizzard.c @@ -1,4 +1,22 @@ -// mr_blizzard.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/save_file.h" +#include "game/spawn_sound.h" + +/* Mr. Blizzard */ +#define /*0x0F4*/ oMrBlizzardScale OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oMrBlizzardHeldObj OBJECT_FIELD_OBJ(0x1C) +#define /*0x0FC*/ oMrBlizzardGraphYVel OBJECT_FIELD_F32(0x1D) +#define /*0x100*/ oMrBlizzardTimer OBJECT_FIELD_S32(0x1E) +#define /*0x104*/ oMrBlizzardDizziness OBJECT_FIELD_F32(0x1F) +#define /*0x108*/ oMrBlizzardChangeInDizziness OBJECT_FIELD_F32(0x20) +#define /*0x10C*/ oMrBlizzardGraphYOffset OBJECT_FIELD_F32(0x21) +#define /*0x110*/ oMrBlizzardDistFromHome OBJECT_FIELD_S32(0x22) +#define /*0x1AC*/ oMrBlizzardTargetMoveYaw OBJECT_FIELD_S32(0x49) // Mr. Blizzard hitbox struct ObjectHitbox sMrBlizzardHitbox = { diff --git a/src/game/behaviors/mr_i.inc.c b/src/game/behaviors/mr_i.c similarity index 93% rename from src/game/behaviors/mr_i.inc.c rename to src/game/behaviors/mr_i.c index 09099ebf26..1041e004d4 100644 --- a/src/game/behaviors/mr_i.inc.c +++ b/src/game/behaviors/mr_i.c @@ -1,4 +1,19 @@ -// mr_i.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Mr. I */ +#define /*0x0F4*/ oMrISpinAngle OBJECT_FIELD_S32(0x1B) +#define /*0x0FC*/ oMrISpinAmount OBJECT_FIELD_S32(0x1D) +#define /*0x100*/ oMrISpinDirection OBJECT_FIELD_S32(0x1E) +#define /*0x104*/ oMrIParticleTimer OBJECT_FIELD_S32(0x1F) +#define /*0x108*/ oMrIParticleTimerTarget OBJECT_FIELD_S32(0x20) +#define /*0x10C*/ oMrIScale OBJECT_FIELD_F32(0x21) +#define /*0x110*/ oMrIBlinking OBJECT_FIELD_S32(0x22) // this is actually the MrI particle loop function. piranha // plant code later on reuses this function. diff --git a/src/game/behaviors/mushroom_1up.inc.c b/src/game/behaviors/mushroom_1up.c similarity index 96% rename from src/game/behaviors/mushroom_1up.inc.c rename to src/game/behaviors/mushroom_1up.c index d9f3fbc3af..7c550f6aab 100644 --- a/src/game/behaviors/mushroom_1up.inc.c +++ b/src/game/behaviors/mushroom_1up.c @@ -1,4 +1,13 @@ -// mushroom_1up.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "engine/math_util.h" +#include "game/level_update.h" +#include "game/object_helpers.h" + +/* Hidden 1-Up */ +#define /*0x0F4*/ o1UpHiddenTimesTriggered OBJECT_FIELD_S32(0x1B) void bhv_1up_interact(void) { if (obj_check_if_collided_with_object(o, gMarioObject)) { diff --git a/src/game/behaviors/music_touch.inc.c b/src/game/behaviors/music_touch.c similarity index 62% rename from src/game/behaviors/music_touch.inc.c rename to src/game/behaviors/music_touch.c index 5bbfd17e15..14741cc17b 100644 --- a/src/game/behaviors/music_touch.inc.c +++ b/src/game/behaviors/music_touch.c @@ -1,3 +1,8 @@ +#include +#include "global_object_fields.h" +#include "game/object_helpers.h" +#include "audio/external.h" + // music_touch.inc.c void bhv_play_music_track_when_touched_loop(void) { diff --git a/src/game/behaviors/orange_number.inc.c b/src/game/behaviors/orange_number.c similarity index 81% rename from src/game/behaviors/orange_number.inc.c rename to src/game/behaviors/orange_number.c index d171040f70..ad1508422b 100644 --- a/src/game/behaviors/orange_number.inc.c +++ b/src/game/behaviors/orange_number.c @@ -1,4 +1,11 @@ -// orange_number.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" + +/* Orange Number */ +#define /*0x110*/ oOrangeNumberOffset OBJECT_FIELD_S32(0x22) void bhv_orange_number_init(void) { o->oAnimState = o->oBehParams2ndByte; diff --git a/src/game/behaviors/piranha_bubbles.inc.c b/src/game/behaviors/piranha_bubbles.c similarity index 96% rename from src/game/behaviors/piranha_bubbles.inc.c rename to src/game/behaviors/piranha_bubbles.c index 97673af101..06225ed9ef 100644 --- a/src/game/behaviors/piranha_bubbles.inc.c +++ b/src/game/behaviors/piranha_bubbles.c @@ -1,3 +1,9 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" + /** * Behavior for bhvPiranhaPlantBubble and bhvPiranhaPlantWakingBubbles. diff --git a/src/game/behaviors/piranha_plant.inc.c b/src/game/behaviors/piranha_plant.c similarity index 96% rename from src/game/behaviors/piranha_plant.inc.c rename to src/game/behaviors/piranha_plant.c index 6d84f8e4ae..e6bd868547 100644 --- a/src/game/behaviors/piranha_plant.inc.c +++ b/src/game/behaviors/piranha_plant.c @@ -1,3 +1,13 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "seq_ids.h" +#include "audio/external.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/level_update.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" /** * Behavior for bhvPiranhaPlant. @@ -5,6 +15,10 @@ * and dying, primarily depending on Mario's proximity and interaction state. */ +/* Piranha Plant */ +#define /*0x0F4*/ oPiranhaPlantSleepMusicState OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oPiranhaPlantScale OBJECT_FIELD_F32(0x1C) + /** * Reset the Piranha Plant back to a sleeping animation, no matter what state * it was in previously, and make it intangible. If Mario is close, transition diff --git a/src/game/behaviors/platform_on_track.inc.c b/src/game/behaviors/platform_on_track.c similarity index 91% rename from src/game/behaviors/platform_on_track.inc.c rename to src/game/behaviors/platform_on_track.c index 69bb176c46..12dc75e3db 100644 --- a/src/game/behaviors/platform_on_track.inc.c +++ b/src/game/behaviors/platform_on_track.c @@ -1,3 +1,18 @@ +#include +#include "actors/vanilla_actors/bitfs/header.h" +#include "actors/vanilla_actors/ccm/header.h" +#include "actors/vanilla_actors/rr/header.h" +#include "behavior_data.h" +#include "global_object_fields.h" +#include "actors/common0.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" +#include "levels/bitfs/header.h" +#include "levels/ccm/header.h" +#include "levels/hmc/header.h" +#include "levels/lll/header.h" +#include "levels/rr/header.h" /** * Behavior for bhvPlatformOnTrack and bhvTrackBall. @@ -5,11 +20,20 @@ * themselves as the platform moves past them. */ -#include "levels/bitfs/header.h" -#include "levels/ccm/header.h" -#include "levels/hmc/header.h" -#include "levels/lll/header.h" -#include "levels/rr/header.h" +/* Platform on Tracks */ +#define /*0x088*/ oPlatformOnTrackBaseBallIndex OBJECT_FIELD_S32(0x00) +#define /*0x0F4*/ oPlatformOnTrackDistMovedSinceLastBall OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oPlatformOnTrackSkiLiftRollVel OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oPlatformOnTrackStartWaypoint OBJECT_FIELD_WAYPOINT(0x1D) +#define /*0x100*/ oPlatformOnTrackPrevWaypoint OBJECT_FIELD_WAYPOINT(0x1E) +#define /*0x104*/ oPlatformOnTrackPrevWaypointFlags OBJECT_FIELD_S32(0x1F) +#define /*0x108*/ oPlatformOnTrackPitch OBJECT_FIELD_S32(0x20) +#define /*0x10C*/ oPlatformOnTrackYaw OBJECT_FIELD_S32(0x21) +#define /*0x110*/ oPlatformOnTrackOffsetY OBJECT_FIELD_F32(0x22) +#define /*0x1AC*/ oPlatformOnTrackIsNotSkiLift OBJECT_FIELD_S16(0x49, 0) +#define /*0x1AE*/ oPlatformOnTrackIsNotHMC OBJECT_FIELD_S16(0x49, 1) +#define /*0x1B0*/ oPlatformOnTrackType OBJECT_FIELD_S16(0x4A, 0) +#define /*0x1B2*/ oPlatformOnTrackWasStoodOn OBJECT_FIELD_S16(0x4A, 1) /** * Collision models for the different types of platforms. diff --git a/src/game/behaviors/pokey.inc.c b/src/game/behaviors/pokey.c similarity index 93% rename from src/game/behaviors/pokey.inc.c rename to src/game/behaviors/pokey.c index c791056e1e..2b105f524b 100644 --- a/src/game/behaviors/pokey.inc.c +++ b/src/game/behaviors/pokey.c @@ -1,3 +1,22 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" + +/* Pokey */ +#define /*0x0F4*/ oPokeyAliveBodyPartFlags OBJECT_FIELD_U32(0x1B) +#define /*0x0F8*/ oPokeyNumAliveBodyParts OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oPokeyBottomBodyPartSize OBJECT_FIELD_F32(0x1D) +#define /*0x100*/ oPokeyHeadWasKilled OBJECT_FIELD_S32(0x1E) +#define /*0x104*/ oPokeyTargetYaw OBJECT_FIELD_S32(0x1F) +#define /*0x108*/ oPokeyChangeTargetTimer OBJECT_FIELD_S32(0x20) +#define /*0x10C*/ oPokeyTurningAwayFromWall OBJECT_FIELD_S32(0x21) + +/* Pokey Body Part */ +#define /*0x0F8*/ oPokeyBodyPartDeathDelayAfterHeadKilled OBJECT_FIELD_S32(0x1C) +#define /*0x110*/ oPokeyBodyPartBlinkTimer OBJECT_FIELD_S32(0x22) /** * Behavior for bhvPokey and bhvPokeyBodyPart. diff --git a/src/game/behaviors/pole.inc.c b/src/game/behaviors/pole.c similarity index 90% rename from src/game/behaviors/pole.inc.c rename to src/game/behaviors/pole.c index 8bcbebc54d..06474e2eb5 100644 --- a/src/game/behaviors/pole.inc.c +++ b/src/game/behaviors/pole.c @@ -1,3 +1,8 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "game/object_helpers.h" + /** * Behaviors for bhvPoleGrabbing and bhvGiantPole. diff --git a/src/game/behaviors/pole_base.inc.c b/src/game/behaviors/pole_base.c similarity index 72% rename from src/game/behaviors/pole_base.inc.c rename to src/game/behaviors/pole_base.c index eb9d4a9236..89981f2748 100644 --- a/src/game/behaviors/pole_base.inc.c +++ b/src/game/behaviors/pole_base.c @@ -1,3 +1,8 @@ +#include +#include "global_object_fields.h" +#include "game/level_update.h" +#include "game/object_helpers.h" + // pole_base.inc.c void bhv_pole_base_loop(void) { diff --git a/src/game/behaviors/purple_switch.inc.c b/src/game/behaviors/purple_switch.c similarity index 93% rename from src/game/behaviors/purple_switch.inc.c rename to src/game/behaviors/purple_switch.c index 90fed9c7ab..874cc1d8fc 100644 --- a/src/game/behaviors/purple_switch.inc.c +++ b/src/game/behaviors/purple_switch.c @@ -1,3 +1,11 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "game/level_update.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + /** * Behavior for bhvFloorSwitchHardcodedModel, bhvFloorSwitchGrills, and diff --git a/src/game/behaviors/pyramid_elevator.inc.c b/src/game/behaviors/pyramid_elevator.c similarity index 94% rename from src/game/behaviors/pyramid_elevator.inc.c rename to src/game/behaviors/pyramid_elevator.c index ac089de9be..b4b7da6040 100644 --- a/src/game/behaviors/pyramid_elevator.inc.c +++ b/src/game/behaviors/pyramid_elevator.c @@ -1,3 +1,9 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" + /** * Behaviors for bhvPyramidElevator and bhvPyramidElevatorTrajectoryMarkerBall. diff --git a/src/game/behaviors/pyramid_top.inc.c b/src/game/behaviors/pyramid_top.c similarity index 92% rename from src/game/behaviors/pyramid_top.inc.c rename to src/game/behaviors/pyramid_top.c index 8a98d6aba1..6193f4ba6e 100644 --- a/src/game/behaviors/pyramid_top.inc.c +++ b/src/game/behaviors/pyramid_top.c @@ -1,3 +1,11 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" /** * Behaviors for bhvPyramidTop, bhvPyramidTopFragment, and @@ -11,6 +19,12 @@ * Mario touches when on top of each pillar. */ +/* Pyramid Top */ +#define /*0x0F4*/ oPyramidTopPillarsTouched OBJECT_FIELD_S32(0x1B) + +/* Pyramid Top Explosion */ +#define /*0x0F4*/ oPyramidTopFragmentsScale OBJECT_FIELD_F32(0x1B) + /** * Spawn the four pillars' touch detectors. */ diff --git a/src/game/behaviors/pyramid_wall.inc.c b/src/game/behaviors/pyramid_wall.c similarity index 93% rename from src/game/behaviors/pyramid_wall.inc.c rename to src/game/behaviors/pyramid_wall.c index 8306aca61d..ce1e47c54d 100644 --- a/src/game/behaviors/pyramid_wall.inc.c +++ b/src/game/behaviors/pyramid_wall.c @@ -1,3 +1,7 @@ +#include +#include "global_object_fields.h" +#include "game/object_helpers.h" + /** * Behavior for bhvSslMovingPyramidWall. diff --git a/src/game/behaviors/racing_penguin.inc.c b/src/game/behaviors/racing_penguin.c similarity index 89% rename from src/game/behaviors/racing_penguin.inc.c rename to src/game/behaviors/racing_penguin.c index ae8ce6cc83..db1bdde350 100644 --- a/src/game/behaviors/racing_penguin.inc.c +++ b/src/game/behaviors/racing_penguin.c @@ -1,7 +1,22 @@ -// racing_penguin.inc.c - +#include +#include "behavior_data.h" +#include "dialog_ids.h" +#include "global_object_fields.h" +#include "game/ingame_menu.h" +#include "game/level_update.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" #include "levels/ccm/header.h" +/* Racing Penguin */ +#define /*0x0F4*/ oRacingPenguinInitTextCooldown OBJECT_FIELD_S32(0x1B) +// 0x1D-0x21 reserved for pathing +#define /*0x110*/ oRacingPenguinWeightedNewTargetSpeed OBJECT_FIELD_F32(0x22) +#define /*0x1AC*/ oRacingPenguinFinalTextbox OBJECT_FIELD_S16(0x49, 0) +#define /*0x1AE*/ oRacingPenguinMarioWon OBJECT_FIELD_S16(0x49, 1) +#define /*0x1B0*/ oRacingPenguinReachedBottom OBJECT_FIELD_S16(0x4A, 0) +#define /*0x1B2*/ oRacingPenguinMarioCheated OBJECT_FIELD_S16(0x4A, 1) + struct RacingPenguinData { s16 text; f32 radius; diff --git a/src/game/behaviors/recovery_heart.inc.c b/src/game/behaviors/recovery_heart.c similarity index 79% rename from src/game/behaviors/recovery_heart.inc.c rename to src/game/behaviors/recovery_heart.c index f10f037062..826291907f 100644 --- a/src/game/behaviors/recovery_heart.inc.c +++ b/src/game/behaviors/recovery_heart.c @@ -1,4 +1,12 @@ -// recovery_heart.inc.c +#include +#include "global_object_fields.h" +#include "game/level_update.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Spinning Recovery Heart */ +#define /*0x0F4*/ oSpinningHeartTotalSpin OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oSpinningHeartPlayedSound OBJECT_FIELD_S32(0x1C) struct ObjectHitbox sRecoveryHeartHitbox = { /* interactType: */ 0, diff --git a/src/game/behaviors/red_coin.inc.c b/src/game/behaviors/red_coin.c similarity index 95% rename from src/game/behaviors/red_coin.inc.c rename to src/game/behaviors/red_coin.c index 1a17044c88..db77a07e9b 100644 --- a/src/game/behaviors/red_coin.inc.c +++ b/src/game/behaviors/red_coin.c @@ -1,3 +1,10 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "game/interaction.h" +#include "game/object_helpers.h" + /** * This file contains the initialization and behavior for red coins. diff --git a/src/game/behaviors/reds_star_marker.inc.c b/src/game/behaviors/reds_star_marker.c similarity index 64% rename from src/game/behaviors/reds_star_marker.inc.c rename to src/game/behaviors/reds_star_marker.c index 03298a6426..46726bcf64 100644 --- a/src/game/behaviors/reds_star_marker.inc.c +++ b/src/game/behaviors/reds_star_marker.c @@ -1,3 +1,7 @@ +#include +#include "global_object_fields.h" +#include "game/object_helpers.h" + // reds_star_marker.inc.c // Filename is abbreviated to prevent compiler seg fault diff --git a/src/game/behaviors/respawner.inc.c b/src/game/behaviors/respawner.c similarity index 74% rename from src/game/behaviors/respawner.inc.c rename to src/game/behaviors/respawner.c index fec36766ff..3988bf3f1b 100644 --- a/src/game/behaviors/respawner.inc.c +++ b/src/game/behaviors/respawner.c @@ -1,4 +1,12 @@ -// respawner.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "game/object_helpers.h" + +/* Object Respawner */ +#define /*0x0F4*/ oRespawnerModelToRespawn OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oRespawnerMinSpawnDist OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oRespawnerBehaviorToRespawn OBJECT_FIELD_CVPTR(0x1D) void bhv_respawner_loop(void) { struct Object *spawnedObject; diff --git a/src/game/behaviors/rolling_log.inc.c b/src/game/behaviors/rolling_log.c similarity index 91% rename from src/game/behaviors/rolling_log.inc.c rename to src/game/behaviors/rolling_log.c index aa30564e0e..7b97597f6a 100644 --- a/src/game/behaviors/rolling_log.inc.c +++ b/src/game/behaviors/rolling_log.c @@ -1,4 +1,16 @@ -// rolling_log.inc.c +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Rolling Log */ +#define /*0x0F4*/ oRollingLogMaxDist OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oRollingLogX OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oRollingLogZ OBJECT_FIELD_F32(0x1D) + +/* Volcano Trap */ +#define /*0x0F4*/ oVolcanoTrapPitchVel OBJECT_FIELD_F32(0x1B) // why are the falling platforms and rolling logs grouped // together? seems strange, but it also cooresponds to the diff --git a/src/game/behaviors/rotating_octagonal_plat.inc.c b/src/game/behaviors/rotating_octagonal_plat.c similarity index 74% rename from src/game/behaviors/rotating_octagonal_plat.inc.c rename to src/game/behaviors/rotating_octagonal_plat.c index 4692cf1960..ab4815e089 100644 --- a/src/game/behaviors/rotating_octagonal_plat.inc.c +++ b/src/game/behaviors/rotating_octagonal_plat.c @@ -1,4 +1,8 @@ -// rotating_octagonal_plat.inc.c +#include +#include "actors/vanilla_actors/bits/header.h" +#include "actors/vanilla_actors/rr/header.h" +#include "global_object_fields.h" +#include "game/object_helpers.h" static const Collision *sOctagonalPlatformCollision[] = { bits_seg7_collision_0701AA84, diff --git a/src/game/behaviors/rotating_platform.inc.c b/src/game/behaviors/rotating_platform.c similarity index 85% rename from src/game/behaviors/rotating_platform.inc.c rename to src/game/behaviors/rotating_platform.c index 962c5f39f4..a3bfcb5aca 100644 --- a/src/game/behaviors/rotating_platform.inc.c +++ b/src/game/behaviors/rotating_platform.c @@ -1,4 +1,9 @@ -// rotating_platform.inc.c +#include +#include "actors/vanilla_actors/wf/header.h" +#include "actors/vanilla_actors/wdw/header.h" +#include "global_object_fields.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" struct WFRotatingPlatformData { s16 unused; diff --git a/src/game/behaviors/scuttlebug.inc.c b/src/game/behaviors/scuttlebug.c similarity index 89% rename from src/game/behaviors/scuttlebug.inc.c rename to src/game/behaviors/scuttlebug.c index b093577165..103f462d24 100644 --- a/src/game/behaviors/scuttlebug.inc.c +++ b/src/game/behaviors/scuttlebug.c @@ -1,4 +1,19 @@ -// scuttlebug.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Scuttlebug */ +#define /*0x0F4*/ oScuttlebugHasNoLootCoins OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oScuttlebugIsAtttacking OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oScuttlebugTimer OBJECT_FIELD_S32(0x1D) + +/* Scuttlebug Spawner */ +#define /*0x088*/ oScuttlebugSpawnerIsDeactivated OBJECT_FIELD_S32(0x00) +#define /*0x0F4*/ oScuttlebugSpawnerSpawnWithNoLootCoins OBJECT_FIELD_S32(0x1B) struct ObjectHitbox sScuttlebugHitbox = { /* interactType: */ INTERACT_BOUNCE_TOP, diff --git a/src/game/behaviors/seaweed.inc.c b/src/game/behaviors/seaweed.c similarity index 89% rename from src/game/behaviors/seaweed.inc.c rename to src/game/behaviors/seaweed.c index cea148ba33..99d44a31e8 100644 --- a/src/game/behaviors/seaweed.inc.c +++ b/src/game/behaviors/seaweed.c @@ -1,4 +1,8 @@ -// seaweed.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" void bhv_seaweed_init(void) { o->header.gfx.animInfo.animFrame = random_float() * 80.0f; diff --git a/src/game/behaviors/seesaw_platform.inc.c b/src/game/behaviors/seesaw_platform.c similarity index 78% rename from src/game/behaviors/seesaw_platform.inc.c rename to src/game/behaviors/seesaw_platform.c index 4271249fc1..bbcf594c1b 100644 --- a/src/game/behaviors/seesaw_platform.inc.c +++ b/src/game/behaviors/seesaw_platform.c @@ -1,8 +1,22 @@ +#include +#include "actors/vanilla_actors/bitdw/header.h" +#include "actors/vanilla_actors/bitfs/header.h" +#include "actors/vanilla_actors/bits/header.h" +#include "actors/vanilla_actors/bob/header.h" +#include "actors/vanilla_actors/rr/header.h" +#include "actors/vanilla_actors/vcutm/header.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" /** * Behavior for bhvSeesawPlatform. */ +/* Seesaw Platform */ +#define /*0x0F4*/ oSeesawPlatformPitchVel OBJECT_FIELD_F32(0x1B) + /** * Collision models for the different seesaw platforms. */ diff --git a/src/game/behaviors/shock_wave.inc.c b/src/game/behaviors/shock_wave.c similarity index 87% rename from src/game/behaviors/shock_wave.inc.c rename to src/game/behaviors/shock_wave.c index 278f4f6f86..adeac9d5a7 100644 --- a/src/game/behaviors/shock_wave.inc.c +++ b/src/game/behaviors/shock_wave.c @@ -1,4 +1,11 @@ -// shock_wave.inc.c +#include +#include "global_object_fields.h" +#include "game/game_init.h" +#include "game/interaction.h" +#include "game/object_helpers.h" + +/* Bowser Shockwave */ +#define /*0x0F4*/ oBowserShockWaveScale OBJECT_FIELD_F32(0x1B) /** * Shockwave scale distance hit points diff --git a/src/game/behaviors/skeeter.inc.c b/src/game/behaviors/skeeter.c similarity index 90% rename from src/game/behaviors/skeeter.inc.c rename to src/game/behaviors/skeeter.c index e1d6d20e2c..40701f74fe 100644 --- a/src/game/behaviors/skeeter.inc.c +++ b/src/game/behaviors/skeeter.c @@ -1,4 +1,18 @@ -// skeeter.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/game_init.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Skeeter */ +#define /*0x0F4*/ oSkeeterTargetAngle OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oSkeeterTurningAwayFromWall OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oSkeeterTargetForwardVel OBJECT_FIELD_F32(0x1D) +#define /*0x100*/ oSkeeterWaitTime OBJECT_FIELD_S32(0x1E) +#define /*0x1AC*/ oSkeeterAngleVel OBJECT_FIELD_S16(0x49, 0) struct SkeeterRelPos { s16 relPosX; diff --git a/src/game/behaviors/sl_snowman_wind.inc.c b/src/game/behaviors/sl_snowman_wind.c similarity index 88% rename from src/game/behaviors/sl_snowman_wind.inc.c rename to src/game/behaviors/sl_snowman_wind.c index 1200dfc6fc..9b035612d1 100644 --- a/src/game/behaviors/sl_snowman_wind.inc.c +++ b/src/game/behaviors/sl_snowman_wind.c @@ -1,4 +1,12 @@ -// sl_snowman_wind.inc.c +#include +#include "dialog_ids.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Snowman Wind Blowing */ +#define /*0x0F4*/ oSLSnowmanWindOriginalYaw OBJECT_FIELD_S32(0x1B) void bhv_sl_snowman_wind_loop(void) { s16 marioAngleFromWindSource; diff --git a/src/game/behaviors/sl_walking_penguin.inc.c b/src/game/behaviors/sl_walking_penguin.c similarity index 91% rename from src/game/behaviors/sl_walking_penguin.inc.c rename to src/game/behaviors/sl_walking_penguin.c index 36e4a9d20c..44f7c19506 100644 --- a/src/game/behaviors/sl_walking_penguin.inc.c +++ b/src/game/behaviors/sl_walking_penguin.c @@ -1,4 +1,14 @@ -// sl_walking_penguin.inc.c +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/debug.h" +#include "game/object_helpers.h" + +/* SL Walking Penguin */ +#define /*0x100*/ oSLWalkingPenguinWindCollisionXPos OBJECT_FIELD_F32(0x1E) +#define /*0x104*/ oSLWalkingPenguinWindCollisionZPos OBJECT_FIELD_F32(0x1F) +#define /*0x10C*/ oSLWalkingPenguinCurStep OBJECT_FIELD_S32(0x21) +#define /*0x110*/ oSLWalkingPenguinCurStepTimer OBJECT_FIELD_S32(0x22) struct SLWalkingPenguinStep { s32 stepLength; diff --git a/src/game/behaviors/sliding_platform.inc.c b/src/game/behaviors/sliding_platform.c similarity index 89% rename from src/game/behaviors/sliding_platform.inc.c rename to src/game/behaviors/sliding_platform.c index 1b8f73cedb..e3f8418e9a 100644 --- a/src/game/behaviors/sliding_platform.inc.c +++ b/src/game/behaviors/sliding_platform.c @@ -1,4 +1,10 @@ -// sliding_platform.inc.c +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" + +/* WF Sliding Brick Platform */ +#define /*0x0F4*/ oWFSlidBrickPtfmMovVel OBJECT_FIELD_F32(0x1B) void bhv_wf_sliding_platform_init(void) { o->oFaceAngleYaw -= 0x4000; diff --git a/src/game/behaviors/sliding_platform_2.inc.c b/src/game/behaviors/sliding_platform_2.c similarity index 76% rename from src/game/behaviors/sliding_platform_2.inc.c rename to src/game/behaviors/sliding_platform_2.c index 05fb0f246b..47abc89f2c 100644 --- a/src/game/behaviors/sliding_platform_2.inc.c +++ b/src/game/behaviors/sliding_platform_2.c @@ -1,4 +1,16 @@ -// sliding_platform_2.inc.c +#include +#include "actors/vanilla_actors/bitdw/header.h" +#include "actors/vanilla_actors/bitfs/header.h" +#include "actors/vanilla_actors/bits/header.h" +#include "actors/vanilla_actors/rr/header.h" +#include "global_object_fields.h" +#include "game/object_helpers.h" + +/* Back-and-Forth Platform */ +#define /*0x0F4*/ oBackAndForthPlatformDirection OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oBackAndForthPlatformPathLength OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oBackAndForthPlatformDistance OBJECT_FIELD_F32(0x1D) +#define /*0x100*/ oBackAndForthPlatformVel OBJECT_FIELD_F32(0x1E) static Collision const *sSlidingPlatformsCollisionData[] = { bits_seg7_collision_0701A9A0, diff --git a/src/game/behaviors/snow_mound.inc.c b/src/game/behaviors/snow_mound.c similarity index 89% rename from src/game/behaviors/snow_mound.inc.c rename to src/game/behaviors/snow_mound.c index 7a94e8d6e0..40c94d5f58 100644 --- a/src/game/behaviors/snow_mound.inc.c +++ b/src/game/behaviors/snow_mound.c @@ -1,3 +1,9 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + // snow_mound.inc.c void bhv_sliding_snow_mound_loop(void) { diff --git a/src/game/behaviors/snowman.inc.c b/src/game/behaviors/snowman.c similarity index 91% rename from src/game/behaviors/snowman.inc.c rename to src/game/behaviors/snowman.c index d02071be6c..3d821b86dc 100644 --- a/src/game/behaviors/snowman.inc.c +++ b/src/game/behaviors/snowman.c @@ -1,4 +1,24 @@ -// snowman.inc.c +#include +#include "behavior_data.h" +#include "course_table.h" +#include "dialog_ids.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/save_file.h" +#include "game/spawn_sound.h" +#include "levels/ccm/header.h" + +/* Snowman's Bottom */ +#define /*0x0F4*/ oSnowmansBottomScale OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oSnowmansBottomTargetYaw OBJECT_FIELD_S32(0x1C) +#define /*0x1AC*/ oSnowmansBottomHitCheckpointNearMario OBJECT_FIELD_S32(0x49) +// 0x1D-0x21 reserved for pathing + +/* Snowman's Head */ +#define /*0x0F4*/ oSnowmansHeadDialogActive OBJECT_FIELD_S32(0x1B) static struct ObjectHitbox sRollingSphereHitbox = { /* interactType: */ INTERACT_DAMAGE, diff --git a/src/game/behaviors/snufit.inc.c b/src/game/behaviors/snufit.c similarity index 90% rename from src/game/behaviors/snufit.inc.c rename to src/game/behaviors/snufit.c index 19a6d153ae..bd32bfe705 100644 --- a/src/game/behaviors/snufit.inc.c +++ b/src/game/behaviors/snufit.c @@ -1,3 +1,12 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/game_init.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/rendering_graph_node.h" +#include "game/spawn_sound.h" /** * Behavior file for bhvSnufit and bhvSnufitBalls. @@ -6,6 +15,16 @@ * the snufit shoots at Mario. */ +/* Snufit */ +#define /*0x0F4*/ oSnufitRecoil OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oSnufitScale OBJECT_FIELD_F32(0x1C) +// 0x1D +#define /*0x100*/ oSnufitCircularPeriod OBJECT_FIELD_S32(0x1E) +#define /*0x104*/ oSnufitBodyScalePeriod OBJECT_FIELD_S32(0x1F) +#define /*0x108*/ oSnufitBodyBaseScale OBJECT_FIELD_S32(0x20) +#define /*0x10C*/ oSnufitBullets OBJECT_FIELD_S32(0x21) +#define /*0x1AC*/ oSnufitBodyScale OBJECT_FIELD_S16(0x49, 0) + struct ObjectHitbox sSnufitHitbox = { /* interactType: */ INTERACT_HIT_FROM_BELOW, /* downOffset: */ 0, diff --git a/src/game/behaviors/sound_ambient.inc.c b/src/game/behaviors/sound_ambient.c similarity index 61% rename from src/game/behaviors/sound_ambient.inc.c rename to src/game/behaviors/sound_ambient.c index 73a1de7adc..504ecceb01 100644 --- a/src/game/behaviors/sound_ambient.inc.c +++ b/src/game/behaviors/sound_ambient.c @@ -1,4 +1,7 @@ -// sound_ambient.inc.c +#include +#include "global_object_fields.h" +#include "audio/external.h" +#include "game/object_helpers.h" void bhv_ambient_sounds_init(void) { if (gCamera->mode == CAMERA_MODE_BEHIND_MARIO) { diff --git a/src/game/behaviors/sound_birds.inc.c b/src/game/behaviors/sound_birds.c similarity index 78% rename from src/game/behaviors/sound_birds.inc.c rename to src/game/behaviors/sound_birds.c index 214c0c404c..4f418407b8 100644 --- a/src/game/behaviors/sound_birds.inc.c +++ b/src/game/behaviors/sound_birds.c @@ -1,4 +1,7 @@ -// sound_birds.inc.c +#include +#include "global_object_fields.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" void bhv_birds_sound_loop(void) { if (gCamera->mode == CAMERA_MODE_BEHIND_MARIO) { diff --git a/src/game/behaviors/sound_sand.inc.c b/src/game/behaviors/sound_sand.c similarity index 57% rename from src/game/behaviors/sound_sand.inc.c rename to src/game/behaviors/sound_sand.c index 9a5c3bb3eb..7c8595d8fa 100644 --- a/src/game/behaviors/sound_sand.inc.c +++ b/src/game/behaviors/sound_sand.c @@ -1,4 +1,7 @@ -// sound_sand.inc.c +#include +#include "global_object_fields.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" void bhv_sand_sound_loop(void) { if (gCamera->mode == CAMERA_MODE_BEHIND_MARIO) { diff --git a/src/game/behaviors/sound_spawner.c b/src/game/behaviors/sound_spawner.c new file mode 100644 index 0000000000..19ff6f6ba1 --- /dev/null +++ b/src/game/behaviors/sound_spawner.c @@ -0,0 +1,8 @@ +#include +#include "global_object_fields.h" +#include "audio/external.h" +#include "game/object_helpers.h" + +void bhv_sound_spawner_init(void) { + play_sound(o->oSoundEffectBits, o->header.gfx.cameraToObject); +} diff --git a/src/game/behaviors/sound_spawner.inc.c b/src/game/behaviors/sound_spawner.inc.c deleted file mode 100644 index 06e1a67a03..0000000000 --- a/src/game/behaviors/sound_spawner.inc.c +++ /dev/null @@ -1,5 +0,0 @@ -// sound_spawner.inc.c - -void bhv_sound_spawner_init(void) { - play_sound(o->oSoundEffectBits, o->header.gfx.cameraToObject); -} diff --git a/src/game/behaviors/sound_volcano.c b/src/game/behaviors/sound_volcano.c new file mode 100644 index 0000000000..700308446b --- /dev/null +++ b/src/game/behaviors/sound_volcano.c @@ -0,0 +1,8 @@ +#include +#include "global_object_fields.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +void bhv_volcano_sound_loop(void) { + cur_obj_play_sound_1(SOUND_ENV_DRONING1); +} diff --git a/src/game/behaviors/sound_volcano.inc.c b/src/game/behaviors/sound_volcano.inc.c deleted file mode 100644 index a96964dac1..0000000000 --- a/src/game/behaviors/sound_volcano.inc.c +++ /dev/null @@ -1,5 +0,0 @@ -// sound_volcano.inc.c - -void bhv_volcano_sound_loop(void) { - cur_obj_play_sound_1(SOUND_ENV_DRONING1); -} diff --git a/src/game/behaviors/sound_waterfall.c b/src/game/behaviors/sound_waterfall.c new file mode 100644 index 0000000000..28852eedd1 --- /dev/null +++ b/src/game/behaviors/sound_waterfall.c @@ -0,0 +1,8 @@ +#include +#include "global_object_fields.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +void bhv_waterfall_sound_loop(void) { + cur_obj_play_sound_1(SOUND_ENV_WATERFALL2); +} diff --git a/src/game/behaviors/sound_waterfall.inc.c b/src/game/behaviors/sound_waterfall.inc.c deleted file mode 100644 index 5763ac8b5e..0000000000 --- a/src/game/behaviors/sound_waterfall.inc.c +++ /dev/null @@ -1,5 +0,0 @@ -// sound_waterfall.inc.c - -void bhv_waterfall_sound_loop(void) { - cur_obj_play_sound_1(SOUND_ENV_WATERFALL2); -} diff --git a/src/game/behaviors/sparkle_spawn.inc.c b/src/game/behaviors/sparkle_spawn.c similarity index 83% rename from src/game/behaviors/sparkle_spawn.inc.c rename to src/game/behaviors/sparkle_spawn.c index 90b1ac2e1b..75239e7e7a 100644 --- a/src/game/behaviors/sparkle_spawn.inc.c +++ b/src/game/behaviors/sparkle_spawn.c @@ -1,3 +1,8 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "game/object_helpers.h" + /** * Behavior for bhvSparkleSpawn. diff --git a/src/game/behaviors/sparkle_spawn_star.inc.c b/src/game/behaviors/sparkle_spawn_star.c similarity index 93% rename from src/game/behaviors/sparkle_spawn_star.inc.c rename to src/game/behaviors/sparkle_spawn_star.c index 746d80bf53..7953eaf2cf 100644 --- a/src/game/behaviors/sparkle_spawn_star.inc.c +++ b/src/game/behaviors/sparkle_spawn_star.c @@ -1,4 +1,14 @@ -// sparkle_spawn_star.inc.c +#include +#include "behavior_data.h" +#include "course_table.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/level_update.h" +#include "game/object_helpers.h" +#include "game/save_file.h" +#include "game/spawn_sound.h" struct ObjectHitbox sSparkleSpawnStarHitbox = { /* interactType: */ INTERACT_STAR_OR_KEY, diff --git a/src/game/behaviors/spawn_star.inc.c b/src/game/behaviors/spawn_star.c similarity index 94% rename from src/game/behaviors/spawn_star.inc.c rename to src/game/behaviors/spawn_star.c index 84135dbe07..ee0e44d9a1 100644 --- a/src/game/behaviors/spawn_star.inc.c +++ b/src/game/behaviors/spawn_star.c @@ -1,4 +1,18 @@ -// spawn_star.inc.c +#include +#include "behavior_data.h" +#include "course_table.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "engine/math_util.h" +#include "game/ingame_menu.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/save_file.h" +#include "game/spawn_sound.h" + +/* Star Spawn */ +#define /*0x0F4*/ oStarSpawnDisFromHome OBJECT_FIELD_F32(0x1B) +#define /*0x0FC*/ oStarSpawnVelY OBJECT_FIELD_F32(0x1D) static struct ObjectHitbox sCollectStarHitbox = { /* interactType: */ INTERACT_STAR_OR_KEY, diff --git a/src/game/behaviors/spawn_star_exit.inc.c b/src/game/behaviors/spawn_star_exit.c similarity index 76% rename from src/game/behaviors/spawn_star_exit.inc.c rename to src/game/behaviors/spawn_star_exit.c index aab63b2a74..2d2f96964a 100644 --- a/src/game/behaviors/spawn_star_exit.inc.c +++ b/src/game/behaviors/spawn_star_exit.c @@ -1,3 +1,7 @@ +#include +#include "global_object_fields.h" +#include "game/object_helpers.h" + // spawn_star_exit.inc.c void bhv_ccm_touched_star_spawn_loop(void) { diff --git a/src/game/behaviors/spindel.inc.c b/src/game/behaviors/spindel.c similarity index 86% rename from src/game/behaviors/spindel.inc.c rename to src/game/behaviors/spindel.c index e148eeb743..1ef2ae15a4 100644 --- a/src/game/behaviors/spindel.inc.c +++ b/src/game/behaviors/spindel.c @@ -1,4 +1,12 @@ -// spindel.inc.c +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Spindel */ +#define /*0x0F4*/ oSpindelMoveTimer OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oSpindelMoveDirection OBJECT_FIELD_S32(0x1C) void bhv_spindel_init(void) { o->oHomeY = o->oPosY; diff --git a/src/game/behaviors/spindrift.inc.c b/src/game/behaviors/spindrift.c similarity index 90% rename from src/game/behaviors/spindrift.inc.c rename to src/game/behaviors/spindrift.c index f09707ff0e..919a182e1a 100644 --- a/src/game/behaviors/spindrift.inc.c +++ b/src/game/behaviors/spindrift.c @@ -1,4 +1,8 @@ -// spindrift.inc.c +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" struct ObjectHitbox sSpindriftHitbox = { /* interactType: */ INTERACT_BOUNCE_TOP, diff --git a/src/game/behaviors/spiny.inc.c b/src/game/behaviors/spiny.c similarity index 93% rename from src/game/behaviors/spiny.inc.c rename to src/game/behaviors/spiny.c index 5231684203..37aeebe029 100644 --- a/src/game/behaviors/spiny.inc.c +++ b/src/game/behaviors/spiny.c @@ -1,3 +1,11 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "actors/group11.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" /** * Behavior for bhvSpiny. @@ -5,6 +13,11 @@ * Lakitu comes before it spawned spinies in processing order. */ +/* Spiny */ +#define /*0x0F4*/ oSpinyTimeUntilTurn OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oSpinyTargetYaw OBJECT_FIELD_S32(0x1C) +#define /*0x100*/ oSpinyTurningAwayFromWall OBJECT_FIELD_S32(0x1E) + /** * Hitbox for spiny both while thrown and walking. The interaction type is * changed to INTERACT_SPINY_WALKING while walking. diff --git a/src/game/behaviors/square_platform_cycle.inc.c b/src/game/behaviors/square_platform_cycle.c similarity index 89% rename from src/game/behaviors/square_platform_cycle.inc.c rename to src/game/behaviors/square_platform_cycle.c index 0abf9a333a..40ee1d38f7 100644 --- a/src/game/behaviors/square_platform_cycle.inc.c +++ b/src/game/behaviors/square_platform_cycle.c @@ -1,4 +1,7 @@ -// square_platform_cycle.inc.c +#include +#include "global_object_fields.h" +#include "engine/surface_load.h" +#include "game/object_helpers.h" s32 square_plat_set_yaw_until_timer(u16 yaw, s32 a) { o->oMoveAngleYaw = yaw; diff --git a/src/game/behaviors/star_door.inc.c b/src/game/behaviors/star_door.c similarity index 90% rename from src/game/behaviors/star_door.inc.c rename to src/game/behaviors/star_door.c index 079890b724..87cbe7308e 100644 --- a/src/game/behaviors/star_door.inc.c +++ b/src/game/behaviors/star_door.c @@ -1,4 +1,10 @@ -// star_door.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" void star_door_update_pos(void) { o->oVelX = (o->oLeftVel) * coss(o->oMoveAngleYaw); diff --git a/src/game/behaviors/static_checkered_platform.inc.c b/src/game/behaviors/static_checkered_platform.c similarity index 84% rename from src/game/behaviors/static_checkered_platform.inc.c rename to src/game/behaviors/static_checkered_platform.c index b943136380..d2ca46a73c 100644 --- a/src/game/behaviors/static_checkered_platform.inc.c +++ b/src/game/behaviors/static_checkered_platform.c @@ -1,4 +1,8 @@ -// static_checkered_platform.inc.c +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/debug.h" +#include "game/object_helpers.h" void bhv_static_checkered_platform_loop(void) { if (gDebugInfo[DEBUG_PAGE_ENEMYINFO][0] == 1) { diff --git a/src/game/behaviors/strong_wind_particle.inc.c b/src/game/behaviors/strong_wind_particle.c similarity index 91% rename from src/game/behaviors/strong_wind_particle.inc.c rename to src/game/behaviors/strong_wind_particle.c index 993c22a70f..dd992c38d2 100644 --- a/src/game/behaviors/strong_wind_particle.inc.c +++ b/src/game/behaviors/strong_wind_particle.c @@ -1,4 +1,13 @@ -// strong_wind_particle.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/game_init.h" +#include "game/interaction.h" +#include "game/object_helpers.h" + +/* White Wind Particle */ +#define /*0x0F4*/ oStrongWindParticlePenguinObj OBJECT_FIELD_OBJ(0x1B) struct ObjectHitbox sStrongWindParticleHitbox = { /* interactType: */ INTERACT_STRONG_WIND, diff --git a/src/game/behaviors/sushi.inc.c b/src/game/behaviors/sushi.c similarity index 70% rename from src/game/behaviors/sushi.inc.c rename to src/game/behaviors/sushi.c index 0ce0c691ef..ebf632ba8f 100644 --- a/src/game/behaviors/sushi.inc.c +++ b/src/game/behaviors/sushi.c @@ -1,4 +1,14 @@ -// sushi.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "engine/surface_collision.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Sushi Shark */ +#define /*0x0F4*/ oSushiSharkAngleFromHome OBJECT_FIELD_S32(0x1B) void bhv_sushi_shark_loop(void) { f32 waterLevel = find_water_level(o->oPosX, o->oPosZ); diff --git a/src/game/behaviors/swing_platform.inc.c b/src/game/behaviors/swing_platform.c similarity index 69% rename from src/game/behaviors/swing_platform.inc.c rename to src/game/behaviors/swing_platform.c index b51cee9772..abf9b61362 100644 --- a/src/game/behaviors/swing_platform.inc.c +++ b/src/game/behaviors/swing_platform.c @@ -1,3 +1,9 @@ +#include +#include "global_object_fields.h" +#include "game/object_helpers.h" + +#define /*0x0F4*/ oSwingPlatformAngle OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oSwingPlatformSpeed OBJECT_FIELD_F32(0x1C) // swing_platform.inc.c void bhv_swing_platform_init(void) { diff --git a/src/game/behaviors/swoop.inc.c b/src/game/behaviors/swoop.c similarity index 79% rename from src/game/behaviors/swoop.inc.c rename to src/game/behaviors/swoop.c index 221bb2376a..6b1ba05e24 100644 --- a/src/game/behaviors/swoop.inc.c +++ b/src/game/behaviors/swoop.c @@ -1,9 +1,27 @@ +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/game_init.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" /** * Behavior for bhvSwoop. * Has a native room. */ +/* Swoop */ +#define /*0x0F4*/ oSwoopBonkCountdown OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ O_SWOOP_TARGET_ANGLE_INDEX 0x1C +#define /*0x0F8*/ O_SWOOP_TARGET_PITCH_INDEX (O_SWOOP_TARGET_ANGLE_INDEX + 0) // 0x1C +#define /*0x0F8*/ O_SWOOP_TARGET_YAW_INDEX (O_SWOOP_TARGET_ANGLE_INDEX + 1) // 0x1D +#define /*0x0F8*/ O_SWOOP_TARGET_ROLL_INDEX (O_SWOOP_TARGET_ANGLE_INDEX + 2) // 0x1E +#define /*0x0F8*/ oSwoopTargetAngleVec OBJECT_FIELD_S32(O_SWOOP_TARGET_ANGLE_INDEX) +#define /*0x0F8*/ oSwoopTargetPitch OBJECT_FIELD_S32(O_SWOOP_TARGET_PITCH_INDEX) +#define /*0x0FC*/ oSwoopTargetYaw OBJECT_FIELD_S32(O_SWOOP_TARGET_YAW_INDEX) +#define /*0x100*/ oSwoopTargetRoll OBJECT_FIELD_S32(O_SWOOP_TARGET_ROLL_INDEX) // unused + /** * Hitbox for swoop. */ diff --git a/src/game/behaviors/thi_top.inc.c b/src/game/behaviors/thi_top.c similarity index 87% rename from src/game/behaviors/thi_top.inc.c rename to src/game/behaviors/thi_top.c index 4dcd3d906d..22ae9c3ca2 100644 --- a/src/game/behaviors/thi_top.inc.c +++ b/src/game/behaviors/thi_top.c @@ -1,4 +1,11 @@ -// thi_top.inc.c +#include +#include "global_object_fields.h" +#include "audio/external.h" +#include "engine/surface_load.h" +#include "game/interaction.h" +#include "game/level_update.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" static struct SpawnParticlesInfo sThiTopPuffs = { /* behParam: */ 0, diff --git a/src/game/behaviors/thwomp.inc.c b/src/game/behaviors/thwomp.c similarity index 87% rename from src/game/behaviors/thwomp.inc.c rename to src/game/behaviors/thwomp.c index 50f74b29db..5cadc3b35e 100644 --- a/src/game/behaviors/thwomp.inc.c +++ b/src/game/behaviors/thwomp.c @@ -1,4 +1,11 @@ -// thwomp.inc.c +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Thwomp */ +#define /*0x0F4*/ oThwompRandomTimer OBJECT_FIELD_S32(0x1B) void grindel_thwomp_act_on_ground(void) { if (o->oTimer == 0) { diff --git a/src/game/behaviors/tilting_inverted_pyramid.inc.c b/src/game/behaviors/tilting_inverted_pyramid.c similarity index 65% rename from src/game/behaviors/tilting_inverted_pyramid.inc.c rename to src/game/behaviors/tilting_inverted_pyramid.c index 43eafda71c..5827b392ed 100644 --- a/src/game/behaviors/tilting_inverted_pyramid.inc.c +++ b/src/game/behaviors/tilting_inverted_pyramid.c @@ -1,9 +1,24 @@ +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/level_update.h" +#include "game/object_helpers.h" /** * This is the behavior file for the tilting inverted pyramids in BitFS/LLL. * The object essentially just tilts and moves Mario with it. */ +/* Tilting Platform */ +#define /*0x0F4*/ O_TILTING_PYRAMID_NORMAL_INDEX 0x1B +#define /*0x0F4*/ O_TILTING_PYRAMID_NORMAL_X_INDEX (O_TILTING_PYRAMID_NORMAL_INDEX + 0) // 0x1B +#define /*0x0F8*/ O_TILTING_PYRAMID_NORMAL_Y_INDEX (O_TILTING_PYRAMID_NORMAL_INDEX + 1) // 0x1C +#define /*0x0FC*/ O_TILTING_PYRAMID_NORMAL_Z_INDEX (O_TILTING_PYRAMID_NORMAL_INDEX + 2) // 0x1D +#define /*0x0F4*/ oTiltingPyramidNormalVec OBJECT_FIELD_F32(O_TILTING_PYRAMID_NORMAL_INDEX) +#define /*0x0F4*/ oTiltingPyramidNormalX OBJECT_FIELD_F32(O_TILTING_PYRAMID_NORMAL_X_INDEX) +#define /*0x0F8*/ oTiltingPyramidNormalY OBJECT_FIELD_F32(O_TILTING_PYRAMID_NORMAL_Y_INDEX) +#define /*0x0FC*/ oTiltingPyramidNormalZ OBJECT_FIELD_F32(O_TILTING_PYRAMID_NORMAL_Z_INDEX) + /** * Initialize the object's transform matrix with Y being up. */ diff --git a/src/game/behaviors/toad.c b/src/game/behaviors/toad.c new file mode 100644 index 0000000000..e96380d40c --- /dev/null +++ b/src/game/behaviors/toad.c @@ -0,0 +1,153 @@ +#include +#include "config/config_debug.h" +#include "behavior_data.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/save_file.h" + +#define TOAD_STAR_1_REQUIREMENT 12 +#define TOAD_STAR_2_REQUIREMENT 25 +#define TOAD_STAR_3_REQUIREMENT 35 + +#define TOAD_STAR_1_DIALOG DIALOG_082 +#define TOAD_STAR_2_DIALOG DIALOG_076 +#define TOAD_STAR_3_DIALOG DIALOG_083 + +#define TOAD_STAR_1_DIALOG_AFTER DIALOG_154 +#define TOAD_STAR_2_DIALOG_AFTER DIALOG_155 +#define TOAD_STAR_3_DIALOG_AFTER DIALOG_156 + +enum ToadMessageStates { + TOAD_MESSAGE_FADED, + TOAD_MESSAGE_OPAQUE, + TOAD_MESSAGE_OPACIFYING, + TOAD_MESSAGE_FADING, + TOAD_MESSAGE_TALKING +}; + +/* Toad Message */ +#define /*0x108*/ oToadMessageDialogId OBJECT_FIELD_U32(0x20) +#define /*0x10C*/ oToadMessageRecentlyTalked OBJECT_FIELD_S32(0x21) +#define /*0x110*/ oToadMessageState OBJECT_FIELD_S32(0x22) + +static void toad_message_faded(void) { + if (o->oDistanceToMario > 700.0f) { + o->oToadMessageRecentlyTalked = FALSE; + } + if (!o->oToadMessageRecentlyTalked && o->oDistanceToMario < 600.0f) { + o->oToadMessageState = TOAD_MESSAGE_OPACIFYING; + } +} + +static void toad_message_opaque(void) { + if (o->oDistanceToMario > 700.0f) { + o->oToadMessageState = TOAD_MESSAGE_FADING; + } else if (!o->oToadMessageRecentlyTalked) { + o->oInteractionSubtype = INT_SUBTYPE_NPC; + if (o->oInteractStatus & INT_STATUS_INTERACTED) { + o->oInteractStatus = INT_STATUS_NONE; + o->oToadMessageState = TOAD_MESSAGE_TALKING; + play_toads_jingle(); + } + } +} + +static void toad_message_talking(void) { + if (cur_obj_update_dialog_with_cutscene(MARIO_DIALOG_LOOK_DOWN, + DIALOG_FLAG_TURN_TO_MARIO, CUTSCENE_DIALOG, o->oToadMessageDialogId)) { + o->oToadMessageRecentlyTalked = TRUE; + o->oToadMessageState = TOAD_MESSAGE_FADING; + switch (o->oToadMessageDialogId) { + case TOAD_STAR_1_DIALOG: + o->oToadMessageDialogId = TOAD_STAR_1_DIALOG_AFTER; + bhv_spawn_star_no_level_exit(STAR_BP_ACT_1); + break; + case TOAD_STAR_2_DIALOG: + o->oToadMessageDialogId = TOAD_STAR_2_DIALOG_AFTER; + bhv_spawn_star_no_level_exit(STAR_BP_ACT_2); + break; + case TOAD_STAR_3_DIALOG: + o->oToadMessageDialogId = TOAD_STAR_3_DIALOG_AFTER; + bhv_spawn_star_no_level_exit(STAR_BP_ACT_3); + break; + } + } +} + +static void toad_message_opacifying(void) { + if ((o->oOpacity += 6) == 255) { + o->oToadMessageState = TOAD_MESSAGE_OPAQUE; + } +} + +static void toad_message_fading(void) { + if ((o->oOpacity -= 6) == 81) { + o->oToadMessageState = TOAD_MESSAGE_FADED; + } +} + +void bhv_toad_message_loop(void) { + if (o->header.gfx.node.flags & GRAPH_RENDER_ACTIVE) { + o->oInteractionSubtype = INT_STATUS_NONE; + switch (o->oToadMessageState) { + case TOAD_MESSAGE_FADED: + toad_message_faded(); + break; + case TOAD_MESSAGE_OPAQUE: + toad_message_opaque(); + break; + case TOAD_MESSAGE_OPACIFYING: + toad_message_opacifying(); + break; + case TOAD_MESSAGE_FADING: + toad_message_fading(); + break; + case TOAD_MESSAGE_TALKING: + toad_message_talking(); + break; + } + } +} + +void bhv_toad_message_init(void) { + s32 saveFlags = save_file_get_flags(); +#ifdef UNLOCK_ALL + s32 starCount = 999; +#else + s32 starCount = save_file_get_total_star_count(gCurrSaveFileNum - 1, COURSE_MIN - 1, COURSE_MAX - 1); +#endif + s32 dialogId = GET_BPARAM1(o->oBehParams); + s32 enoughStars = TRUE; + + switch (dialogId) { + case TOAD_STAR_1_DIALOG: + enoughStars = (starCount >= TOAD_STAR_1_REQUIREMENT); + if (saveFlags & SAVE_FLAG_COLLECTED_TOAD_STAR_1) { + dialogId = TOAD_STAR_1_DIALOG_AFTER; + } + break; + case TOAD_STAR_2_DIALOG: + enoughStars = (starCount >= TOAD_STAR_2_REQUIREMENT); + if (saveFlags & SAVE_FLAG_COLLECTED_TOAD_STAR_2) { + dialogId = TOAD_STAR_2_DIALOG_AFTER; + } + break; + case TOAD_STAR_3_DIALOG: + enoughStars = (starCount >= TOAD_STAR_3_REQUIREMENT); + if (saveFlags & SAVE_FLAG_COLLECTED_TOAD_STAR_3) { + dialogId = TOAD_STAR_3_DIALOG_AFTER; + } + break; + } + if (enoughStars) { + o->oToadMessageDialogId = dialogId; + o->oToadMessageRecentlyTalked = FALSE; + o->oToadMessageState = TOAD_MESSAGE_FADED; + o->oOpacity = 81; + } else { + obj_mark_for_deletion(o); + } +} + diff --git a/src/game/behaviors/tower_door.inc.c b/src/game/behaviors/tower_door.c similarity index 64% rename from src/game/behaviors/tower_door.inc.c rename to src/game/behaviors/tower_door.c index 5459fb9d26..53809f8eec 100644 --- a/src/game/behaviors/tower_door.inc.c +++ b/src/game/behaviors/tower_door.c @@ -1,4 +1,8 @@ -// tower_door.inc.c +#include +#include "global_object_fields.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" void bhv_tower_door_loop(void) { if (o->oTimer == 0) { diff --git a/src/game/behaviors/tower_platform.inc.c b/src/game/behaviors/tower_platform.c similarity index 83% rename from src/game/behaviors/tower_platform.inc.c rename to src/game/behaviors/tower_platform.c index ab05f7d772..0941c324a7 100644 --- a/src/game/behaviors/tower_platform.inc.c +++ b/src/game/behaviors/tower_platform.c @@ -1,4 +1,21 @@ -// tower_platform.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* WF Platform */ +#define /*0x10C*/ oPlatformWFTowerForwardVel OBJECT_FIELD_F32(0x21) +#define /*0x110*/ oPlatformWFTowerMoveDistance OBJECT_FIELD_F32(0x22) + +/* Platform Spawner */ +#define /*0x0F4*/ oPlatformSpawnerWFTowerPlatformNum OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oPlatformSpawnerWFTowerYawOffset OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oPlatformSpawnerWFTowerDYaw OBJECT_FIELD_S32(0x1D) +#define /*0x100*/ oPlatformSpawnerWFTowerRadius OBJECT_FIELD_F32(0x1E) +#define /*0x104*/ oPlatformSpawnerWFTowerMoveDistance OBJECT_FIELD_F32(0x1F) +#define /*0x108*/ oPlatformSpawnerWFTowerForwardVel OBJECT_FIELD_F32(0x20) void bhv_wf_solid_tower_platform_loop(void) { if (o->parentObj->oAction == 3) { diff --git a/src/game/behaviors/tox_box.inc.c b/src/game/behaviors/tox_box.c similarity index 67% rename from src/game/behaviors/tox_box.inc.c rename to src/game/behaviors/tox_box.c index a5e1f907b2..5f19f4ded9 100644 --- a/src/game/behaviors/tox_box.inc.c +++ b/src/game/behaviors/tox_box.c @@ -1,4 +1,13 @@ -// tox_box.inc.c +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "engine/surface_load.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Tox Box */ +#define /*0x1AC*/ oToxBoxMovementPattern OBJECT_FIELD_VPTR(0x49) +#define /*0x1B0*/ oToxBoxMovementStep OBJECT_FIELD_S32(0x4A) s8 sToxBoxDirectionPattern1[] = { 4, 1, 4, 1, 6, 1, 6, 1, 5, 1, 5, 1, 6, 1, 6, 1, 5, 1, 2, 4, 1, 4, 1, 4, 1, 2, 5, 1, 5, 1, 7, 1, 7, 1, 4, 1, 4, 1, 7, 1, 7, 1, 5, 1, 5, 1, 5, 1, 2, 4, 1, -1 }; @@ -12,6 +21,29 @@ s8 *sToxBoxDirectionPatterns[] = { sToxBoxDirectionPattern3 }; +s32 tox_box_set_direction_table(s8 *pattern) { + o->oToxBoxMovementPattern = pattern; + o->oToxBoxMovementStep = 0; + + return *(s8 *) o->oToxBoxMovementPattern; +} + +s32 tox_box_progress_direction_table(void) { + s8 action; + s8 *pattern = o->oToxBoxMovementPattern; + s32 nextStep = o->oToxBoxMovementStep + 1; + + if (pattern[nextStep] != -1) { + action = pattern[nextStep]; + o->oToxBoxMovementStep++; + } else { + action = pattern[0]; + o->oToxBoxMovementStep = 0; + } + + return action; +} + void tox_box_shake_screen(void) { if (o->oDistanceToMario < 3000.0f) { cur_obj_shake_screen(SHAKE_POS_SMALL); @@ -32,7 +64,7 @@ void tox_box_move(f32 forwardVel, f32 leftVel, s16 deltaPitch, s16 deltaRoll) { cur_obj_set_pos_via_transform(); if (o->oTimer == 7) { - o->oAction = cur_obj_progress_direction_table(); + o->oAction = tox_box_progress_direction_table(); cur_obj_play_sound_2(SOUND_GENERAL_TOX_BOX_MOVE); } } @@ -63,25 +95,25 @@ void tox_box_act_1(void) { o->oPosY = o->oHomeY + 3.0f; if (o->oTimer == 20) { - o->oAction = cur_obj_progress_direction_table(); + o->oAction = tox_box_progress_direction_table(); } } void tox_box_act_2(void) { if (o->oTimer == 20) { - o->oAction = cur_obj_progress_direction_table(); + o->oAction = tox_box_progress_direction_table(); } } void tox_box_act_3(void) { if (o->oTimer == 20) { - o->oAction = cur_obj_progress_direction_table(); + o->oAction = tox_box_progress_direction_table(); } } void tox_box_act_0(void) { s8 *pattern = sToxBoxDirectionPatterns[o->oBehParams2ndByte]; - o->oAction = cur_obj_set_direction_table(pattern); + o->oAction = tox_box_set_direction_table(pattern); } ObjActionFunc sToxBoxActions[] = { diff --git a/src/game/behaviors/treasure_chest.inc.c b/src/game/behaviors/treasure_chest.c similarity index 94% rename from src/game/behaviors/treasure_chest.inc.c rename to src/game/behaviors/treasure_chest.c index dbd89d9d34..79b2edf097 100644 --- a/src/game/behaviors/treasure_chest.inc.c +++ b/src/game/behaviors/treasure_chest.c @@ -1,4 +1,14 @@ -// treasure_chest.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "game/interaction.h" +#include "game/object_helpers.h" + +/* Treasure Chest */ +#define /*0x0F4*/ oTreasureChestNumOpenedChests OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oTreasureChestDoCloseChests OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oTreasureChestAboveWater OBJECT_FIELD_S32(0x1D) /** * Hitbox for treasure chest bottom. diff --git a/src/game/behaviors/tree_particles.inc.c b/src/game/behaviors/tree_particles.c similarity index 86% rename from src/game/behaviors/tree_particles.inc.c rename to src/game/behaviors/tree_particles.c index 3f60b7d3b8..05912d3a91 100644 --- a/src/game/behaviors/tree_particles.inc.c +++ b/src/game/behaviors/tree_particles.c @@ -1,4 +1,14 @@ -// tree_particles.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "engine/surface_collision.h" +#include "game/object_helpers.h" + +/* Tree Snow Or Leaf */ +#define /*0x0F4*/ oTreeSnowOrLeafSidewardAngle OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oTreeSnowOrLeafSidewardVel OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oTreeSnowOrLeafSidewardAngleVel OBJECT_FIELD_S32(0x1D) void bhv_tree_snow_or_leaf_loop(void) { cur_obj_update_floor_height(); diff --git a/src/game/behaviors/triplet_butterfly.inc.c b/src/game/behaviors/triplet_butterfly.c similarity index 87% rename from src/game/behaviors/triplet_butterfly.inc.c rename to src/game/behaviors/triplet_butterfly.c index 08fdc46799..9d498a670c 100644 --- a/src/game/behaviors/triplet_butterfly.inc.c +++ b/src/game/behaviors/triplet_butterfly.c @@ -1,4 +1,20 @@ -// triplet_butterfly.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" + +/* Triplet Butterfly */ +#define /*0x0F4*/ oTripletButterflyScale OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oTripletButterflySpeed OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oTripletButterflyBaseYaw OBJECT_FIELD_F32(0x1D) +#define /*0x100*/ oTripletButterflyTargetPitch OBJECT_FIELD_S32(0x1E) +#define /*0x104*/ oTripletButterflyTargetYaw OBJECT_FIELD_S32(0x1F) +#define /*0x108*/ oTripletButterflyType OBJECT_FIELD_S32(0x20) +#define /*0x10C*/ oTripletButterflyModel OBJECT_FIELD_S32(0x21) +#define /*0x110*/ oTripletButterflySelectedButterfly OBJECT_FIELD_S32(0x22) +#define /*0x1AC*/ oTripletButterflyScalePhase OBJECT_FIELD_S32(0x49) struct TripletButterflyActivationData { ModelID32 model; diff --git a/src/game/behaviors/ttc_2d_rotator.inc.c b/src/game/behaviors/ttc_2d_rotator.c similarity index 83% rename from src/game/behaviors/ttc_2d_rotator.inc.c rename to src/game/behaviors/ttc_2d_rotator.c index a403381c84..2f9ef4712d 100644 --- a/src/game/behaviors/ttc_2d_rotator.inc.c +++ b/src/game/behaviors/ttc_2d_rotator.c @@ -1,3 +1,9 @@ +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "engine/surface_load.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" /** * Behavior for bhvTTC2DRotator. @@ -5,6 +11,13 @@ * purely visual 2D cogs in TTC. */ +/* TTC 2D Rotator */ +#define /*0x0F4*/ oTTC2DRotatorMinTimeUntilNextTurn OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oTTC2DRotatorTargetYaw OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oTTC2DRotatorIncrement OBJECT_FIELD_S32(0x1D) +#define /*0x104*/ oTTC2DRotatorRandomDirTimer OBJECT_FIELD_S32(0x1F) +#define /*0x108*/ oTTC2DRotatorSpeed OBJECT_FIELD_S32(0x20) + /** * Speeds for the hand and the 2D cog, respectively. Negative because clockwise. */ diff --git a/src/game/behaviors/ttc_cog.inc.c b/src/game/behaviors/ttc_cog.c similarity index 80% rename from src/game/behaviors/ttc_cog.inc.c rename to src/game/behaviors/ttc_cog.c index 7d15c911f8..c0fbd61737 100644 --- a/src/game/behaviors/ttc_cog.inc.c +++ b/src/game/behaviors/ttc_cog.c @@ -1,9 +1,19 @@ +#include +#include "actors/vanilla_actors/ttc/header.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" /** * Behavior for bhvTTCCog. This includes both the hexagonal cogs and the * triangular prisms that rotate around the y axis. */ +/* TTC Cog */ +#define /*0x0F4*/ oTTCCogDir OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oTTCCogSpeed OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oTTCCogTargetVel OBJECT_FIELD_F32(0x1D) + /** * Collision model for hexagon and triangle, respectively. */ diff --git a/src/game/behaviors/ttc_elevator.inc.c b/src/game/behaviors/ttc_elevator.c similarity index 81% rename from src/game/behaviors/ttc_elevator.inc.c rename to src/game/behaviors/ttc_elevator.c index f0f4fe12cd..55b23efb24 100644 --- a/src/game/behaviors/ttc_elevator.inc.c +++ b/src/game/behaviors/ttc_elevator.c @@ -1,8 +1,17 @@ +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" /** * Behavior for bhvTTCElevator. */ +/* TTC Elevator */ +#define /*0x0F4*/ oTTCElevatorDir OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oTTCElevatorPeakY OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oTTCElevatorMoveTime OBJECT_FIELD_S32(0x1D) + /** * The speed on each setting. */ diff --git a/src/game/behaviors/ttc_moving_bar.inc.c b/src/game/behaviors/ttc_moving_bar.c similarity index 91% rename from src/game/behaviors/ttc_moving_bar.inc.c rename to src/game/behaviors/ttc_moving_bar.c index fb6efe0532..ff82ba0ce3 100644 --- a/src/game/behaviors/ttc_moving_bar.inc.c +++ b/src/game/behaviors/ttc_moving_bar.c @@ -1,8 +1,19 @@ +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" /** * Behavior for bhvTTCMovingBar. */ +/* TTC Moving Bar */ +#define /*0x0F4*/ oTTCMovingBarDelay OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oTTCMovingBarStoppedTimer OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oTTCMovingBarOffset OBJECT_FIELD_F32(0x1D) +#define /*0x100*/ oTTCMovingBarSpeed OBJECT_FIELD_F32(0x1E) +#define /*0x104*/ oTTCMovingBarStartOffset OBJECT_FIELD_F32(0x1F) + /** * The delay before each cycle on each setting. On random setting, this is * overwritten with one of the below delays after the first cycle. diff --git a/src/game/behaviors/ttc_pendulum.inc.c b/src/game/behaviors/ttc_pendulum.c similarity index 84% rename from src/game/behaviors/ttc_pendulum.inc.c rename to src/game/behaviors/ttc_pendulum.c index a096c124d5..2299ca117f 100644 --- a/src/game/behaviors/ttc_pendulum.inc.c +++ b/src/game/behaviors/ttc_pendulum.c @@ -1,9 +1,22 @@ +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" /** * Behavior for bhvTTCPendulum. This is not the pendulum inside the clock in the * castle, but rather the one in TTC itself. */ +/* TTC Pendulum */ +#define /*0x0F4*/ oTTCPendulumAccelDir OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oTTCPendulumAngle OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oTTCPendulumAngleVel OBJECT_FIELD_F32(0x1D) +#define /*0x100*/ oTTCPendulumAngleAccel OBJECT_FIELD_F32(0x1E) +#define /*0x104*/ oTTCPendulumDelay OBJECT_FIELD_S32(0x1F) +#define /*0x108*/ oTTCPendulumSoundTimer OBJECT_FIELD_S32(0x20) + /** * Initial angle acceleration. */ diff --git a/src/game/behaviors/ttc_pit_block.inc.c b/src/game/behaviors/ttc_pit_block.c similarity index 84% rename from src/game/behaviors/ttc_pit_block.inc.c rename to src/game/behaviors/ttc_pit_block.c index 2afb3d4bdd..e632689374 100644 --- a/src/game/behaviors/ttc_pit_block.inc.c +++ b/src/game/behaviors/ttc_pit_block.c @@ -1,9 +1,19 @@ +#include +#include "actors/vanilla_actors/ttc/header.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" /** * Behavior for bhvTTCPitBlock. This is the block that moves up and down near the * Pit and the Pendulum star. */ +/* TTC Pit Block */ +#define /*0x0F4*/ oTTCPitBlockPeakY OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oTTCPitBlockDir OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oTTCPitBlockWaitTime OBJECT_FIELD_S32(0x1D) + /** * Collision models. The second one is unused. */ diff --git a/src/game/behaviors/ttc_rotating_solid.inc.c b/src/game/behaviors/ttc_rotating_solid.c similarity index 83% rename from src/game/behaviors/ttc_rotating_solid.inc.c rename to src/game/behaviors/ttc_rotating_solid.c index 6a7a5a5b9b..009e0d8a54 100644 --- a/src/game/behaviors/ttc_rotating_solid.inc.c +++ b/src/game/behaviors/ttc_rotating_solid.c @@ -1,9 +1,21 @@ +#include +#include "actors/vanilla_actors/ttc/header.h" +#include "global_object_fields.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" /** * Behavior for bhvTTCRotatingSolid, which are the rotating cube and triangular * prism. */ +/* TTC Rotating Solid */ +#define /*0x0F4*/ oTTCRotatingSolidNumTurns OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oTTCRotatingSolidNumSides OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oTTCRotatingSolidRotationDelay OBJECT_FIELD_S32(0x1D) +#define /*0x100*/ oTTCRotatingSolidVelY OBJECT_FIELD_F32(0x1E) +#define /*0x104*/ oTTCRotatingSolidSoundTimer OBJECT_FIELD_S32(0x1F) + /** * The collision models for cube and triangular prism, respectively. */ diff --git a/src/game/behaviors/ttc_spinner.inc.c b/src/game/behaviors/ttc_spinner.c similarity index 77% rename from src/game/behaviors/ttc_spinner.inc.c rename to src/game/behaviors/ttc_spinner.c index 7ebc3f8e05..e0adf5ac26 100644 --- a/src/game/behaviors/ttc_spinner.inc.c +++ b/src/game/behaviors/ttc_spinner.c @@ -1,8 +1,16 @@ +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" /** * Behavior for TTC spinner. */ +/* TTC Spinner */ +#define /*0x0F4*/ oTTCSpinnerDir OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oTTCChangeDirTimer OBJECT_FIELD_S32(0x1C) + /** * Spinner speeds on each setting. */ diff --git a/src/game/behaviors/ttc_treadmill.inc.c b/src/game/behaviors/ttc_treadmill.c similarity index 81% rename from src/game/behaviors/ttc_treadmill.inc.c rename to src/game/behaviors/ttc_treadmill.c index 0b8dd77b65..7524ab857a 100644 --- a/src/game/behaviors/ttc_treadmill.inc.c +++ b/src/game/behaviors/ttc_treadmill.c @@ -1,3 +1,9 @@ +#include +#include "actors/vanilla_actors/ttc/header.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" /** * Behavior for bhvTTCTreadmill. @@ -6,6 +12,13 @@ * treadmills. */ +/* TTC Treadmill */ +#define /*0x0F4*/ oTTCTreadmillBigSurface OBJECT_FIELD_S16P(0x1B) +#define /*0x0F8*/ oTTCTreadmillSmallSurface OBJECT_FIELD_S16P(0x1C) +#define /*0x0FC*/ oTTCTreadmillSpeed OBJECT_FIELD_F32(0x1D) +#define /*0x100*/ oTTCTreadmillTargetSpeed OBJECT_FIELD_F32(0x1E) +#define /*0x104*/ oTTCTreadmillTimeUntilSwitch OBJECT_FIELD_S32(0x1F) + /** * Collision models for the different sized treadmills. */ diff --git a/src/game/behaviors/tumbling_bridge.inc.c b/src/game/behaviors/tumbling_bridge.c similarity index 89% rename from src/game/behaviors/tumbling_bridge.inc.c rename to src/game/behaviors/tumbling_bridge.c index d0a3e5ada6..c9c15eea02 100644 --- a/src/game/behaviors/tumbling_bridge.inc.c +++ b/src/game/behaviors/tumbling_bridge.c @@ -1,4 +1,16 @@ -// tumbling_bridge.inc.c +#include +#include "actors/vanilla_actors/wf/header.h" +#include "actors/vanilla_actors/bbh/header.h" +#include "actors/vanilla_actors/lll/header.h" +#include "actors/vanilla_actors/bitfs/header.h" +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Tumbling Bridge */ +#define /*0x0F4*/ oTumblingBridgeRollAccel OBJECT_FIELD_S32(0x1B) struct TumblingBridgeParams { s16 numBridgeSections; diff --git a/src/game/behaviors/tuxie.inc.c b/src/game/behaviors/tuxie.c similarity index 94% rename from src/game/behaviors/tuxie.inc.c rename to src/game/behaviors/tuxie.c index b8d3bc8910..3a1aae6053 100644 --- a/src/game/behaviors/tuxie.inc.c +++ b/src/game/behaviors/tuxie.c @@ -1,4 +1,21 @@ -// tuxie.inc.c +#include +#include "behavior_data.h" +#include "dialog_ids.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "engine/math_util.h" +#include "game/game_init.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/rendering_graph_node.h" +#include "game/spawn_sound.h" + +/* Small Penguin */ +#define /*0x088*/ oSmallPenguinReturnedToMother OBJECT_FIELD_S32(0x00) +#define /*0x100*/ oSmallPenguinStoredAction OBJECT_FIELD_S32(0x1E) +#define /*0x104*/ oSmallPenguinNextForwardVel OBJECT_FIELD_F32(0x1F) +#define /*0x108*/ oSmallPenguinRandomDistanceCheck OBJECT_FIELD_F32(0x20) +#define /*0x110*/ oSmallPenguinYawIncrement OBJECT_FIELD_S32(0x22) void play_penguin_walking_sound(s32 walk) { if (o->oSoundStateID == PENGUIN_ANIM_WALK) { diff --git a/src/game/behaviors/tweester.inc.c b/src/game/behaviors/tweester.c similarity index 92% rename from src/game/behaviors/tweester.inc.c rename to src/game/behaviors/tweester.c index a997683a15..21f5c6676f 100644 --- a/src/game/behaviors/tweester.inc.c +++ b/src/game/behaviors/tweester.c @@ -1,3 +1,12 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/debug.h" +#include "game/interaction.h" +#include "game/level_update.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" /** * Behavior file for bhvTweester and bhvTweesterSandParticle @@ -6,6 +15,10 @@ * Tweester spawns the sand particles also in this file. */ +/* Tweester */ +#define /*0x0F4*/ oTweesterScaleTimer OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oTweesterUnused OBJECT_FIELD_S32(0x1C) + struct ObjectHitbox sTweesterHitbox = { /* interactType: */ INTERACT_TORNADO, /* downOffset: */ 0, diff --git a/src/game/behaviors/ukiki.inc.c b/src/game/behaviors/ukiki.c similarity index 95% rename from src/game/behaviors/ukiki.inc.c rename to src/game/behaviors/ukiki.c index 293e0eb5ba..2054980a1c 100644 --- a/src/game/behaviors/ukiki.inc.c +++ b/src/game/behaviors/ukiki.c @@ -1,3 +1,18 @@ +#include +#include "behavior_data.h" +#include "dialog_ids.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "engine/math_util.h" +#include "game/debug.h" +#include "game/game_init.h" +#include "game/ingame_menu.h" +#include "game/interaction.h" +#include "game/level_update.h" +#include "game/object_helpers.h" +#include "game/rendering_graph_node.h" +#include "game/save_file.h" +#include "game/spawn_sound.h" /** * @file Contains behavior for the ukiki objects. @@ -6,6 +21,16 @@ * Cage ukiki is the ukiki that triggers the cage star. */ +/* Ukiki */ +#define /*0x0F4*/ oUkikiTauntCounter OBJECT_FIELD_S16(0x1B, 0) +#define /*0x0F6*/ oUkikiTauntsToBeDone OBJECT_FIELD_S16(0x1B, 1) +// 0x1D-0x21 reserved for pathing +#define /*0x110*/ oUkikiChaseFleeRange OBJECT_FIELD_F32(0x22) +#define /*0x1AC*/ oUkikiTextState OBJECT_FIELD_S16(0x49, 0) +#define /*0x1AE*/ oUkikiTextboxTimer OBJECT_FIELD_S16(0x49, 1) +#define /*0x1B0*/ oUkikiCageSpinTimer OBJECT_FIELD_S16(0x4A, 0) +#define /*0x1B2*/ oUkikiHasCap OBJECT_FIELD_S16(0x4A, 1) + /** * Sets the cap ukiki to its home if Mario is far away * or makes him wait to respawn if in water. diff --git a/src/game/behaviors/ukiki_cage.inc.c b/src/game/behaviors/ukiki_cage.c similarity index 94% rename from src/game/behaviors/ukiki_cage.inc.c rename to src/game/behaviors/ukiki_cage.c index 2cc9033413..5c18cae704 100644 --- a/src/game/behaviors/ukiki_cage.inc.c +++ b/src/game/behaviors/ukiki_cage.c @@ -1,3 +1,8 @@ +#include +#include "global_object_fields.h" +#include "engine/surface_load.h" +#include "game/object_helpers.h" +#include "game/save_file.h" /** * @file Contains behavior for the ukiki's cage diff --git a/src/game/behaviors/unagi.inc.c b/src/game/behaviors/unagi.c similarity index 91% rename from src/game/behaviors/unagi.inc.c rename to src/game/behaviors/unagi.c index de1658b959..7627254f17 100644 --- a/src/game/behaviors/unagi.inc.c +++ b/src/game/behaviors/unagi.c @@ -1,7 +1,22 @@ -// unagi.inc.c - +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "levels/jrb/header.h" +#include "game/spawn_sound.h" #include "actors/group4.h" +/* Unagi */ +#define /*0x0F4*/ oUnagiDistFromHome OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oUnagiNextForwardVel OBJECT_FIELD_F32(0x1C) +// 0x1D-0x21 reserved for pathing +#define /*0x110*/ oUnagiTargetNextForwardVel OBJECT_FIELD_F32(0x22) +#define /*0x1AC*/ oUnagiDistanceToMario OBJECT_FIELD_F32(0x49) +#define /*0x1B0*/ oUnagiInitMoveYaw OBJECT_FIELD_S16(0x4A, 0) +#define /*0x1B2*/ oUnagiHasStar OBJECT_FIELD_S16(0x4A, 1) + struct ObjectHitbox sUnagiHitbox = { /* interactType: */ INTERACT_CLAM_OR_BUBBA, /* downOffset: */ 50, diff --git a/src/game/behaviors/unused_particle_spawn.inc.c b/src/game/behaviors/unused_particle_spawn.c similarity index 83% rename from src/game/behaviors/unused_particle_spawn.inc.c rename to src/game/behaviors/unused_particle_spawn.c index 0370e2da05..71604371a7 100644 --- a/src/game/behaviors/unused_particle_spawn.inc.c +++ b/src/game/behaviors/unused_particle_spawn.c @@ -1,3 +1,8 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "game/object_helpers.h" + /** * Behavior for bhvUnusedParticleSpawn. diff --git a/src/game/behaviors/unused_poundable_platform.inc.c b/src/game/behaviors/unused_poundable_platform.c similarity index 88% rename from src/game/behaviors/unused_poundable_platform.inc.c rename to src/game/behaviors/unused_poundable_platform.c index f4c9644259..b75c46a2ca 100644 --- a/src/game/behaviors/unused_poundable_platform.inc.c +++ b/src/game/behaviors/unused_poundable_platform.c @@ -1,3 +1,8 @@ +#include +#include "global_object_fields.h" +#include "engine/surface_load.h" +#include "game/object_helpers.h" + /** * Behavior for bhvUnusedPoundablePlatform. diff --git a/src/game/behaviors/warp.inc.c b/src/game/behaviors/warp.c similarity index 88% rename from src/game/behaviors/warp.inc.c rename to src/game/behaviors/warp.c index ca1207c4c5..89555b1ba4 100644 --- a/src/game/behaviors/warp.inc.c +++ b/src/game/behaviors/warp.c @@ -1,4 +1,7 @@ -// warp.inc.c +#include +#include "global_object_fields.h" +#include "game/interaction.h" +#include "game/object_helpers.h" void bhv_warp_loop(void) { if (o->oTimer == 0) { diff --git a/src/game/behaviors/water_bomb.inc.c b/src/game/behaviors/water_bomb.c similarity index 92% rename from src/game/behaviors/water_bomb.inc.c rename to src/game/behaviors/water_bomb.c index 7ea7651d11..0b4389fda0 100644 --- a/src/game/behaviors/water_bomb.inc.c +++ b/src/game/behaviors/water_bomb.c @@ -1,3 +1,11 @@ +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/level_update.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" /** * Behaviors for bhvWaterBombSpawner, bhvWaterBomb, and bhvWaterBombShadow. @@ -8,6 +16,16 @@ * The water bomb shadow is only spawned by water bomb spawners. */ +/* Water Bomb */ +#define /*0x0F8*/ oWaterBombVerticalStretch OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oWaterBombStretchSpeed OBJECT_FIELD_F32(0x1D) +#define /*0x100*/ oWaterBombOnGround OBJECT_FIELD_S32(0x1E) +#define /*0x104*/ oWaterBombNumBounces OBJECT_FIELD_F32(0x1F) + +/* Water Bomb Spawner */ +#define /*0x0F4*/ oWaterBombSpawnerBombActive OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oWaterBombSpawnerTimeToSpawn OBJECT_FIELD_S32(0x1C) + /** * Hitbox for water bombs that are spawned by a water bomb spawner. The water * bombs that are shot from cannons are intangible. diff --git a/src/game/behaviors/water_bomb_cannon.inc.c b/src/game/behaviors/water_bomb_cannon.c similarity index 83% rename from src/game/behaviors/water_bomb_cannon.inc.c rename to src/game/behaviors/water_bomb_cannon.c index 538a6cb0c5..7506a9156a 100644 --- a/src/game/behaviors/water_bomb_cannon.inc.c +++ b/src/game/behaviors/water_bomb_cannon.c @@ -1,4 +1,18 @@ -// water_bomb_cannon.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Water Bomb Cannon */ +#define /*0x0F4*/ oWaterCannonIdleTimer OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oWaterCannonRotationTimer OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oWaterCannonTargetMovePitch OBJECT_FIELD_S32(0x1D) +#define /*0x100*/ oWaterCannonTargetFaceYaw OBJECT_FIELD_S32(0x1E) + +/* Cannon Barrel Bubbles */ +#define /*0x0F4*/ oCannonBarrelBubblesForwardVelCheck OBJECT_FIELD_F32(0x1B) void bhv_bubble_cannon_barrel_loop(void) { if (o->parentObj->oAction == 2) { diff --git a/src/game/behaviors/water_mist.inc.c b/src/game/behaviors/water_mist.c similarity index 68% rename from src/game/behaviors/water_mist.inc.c rename to src/game/behaviors/water_mist.c index a11fd24a6a..35b3210421 100644 --- a/src/game/behaviors/water_mist.inc.c +++ b/src/game/behaviors/water_mist.c @@ -1,4 +1,9 @@ -// water_mist.inc.c +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "engine/surface_collision.h" +#include "game/object_helpers.h" + // TODO: there is confusion with the earlier mist file. Clarify? void bhv_water_mist_2_loop(void) { diff --git a/src/game/behaviors/water_mist_particle.inc.c b/src/game/behaviors/water_mist_particle.c similarity index 83% rename from src/game/behaviors/water_mist_particle.inc.c rename to src/game/behaviors/water_mist_particle.c index 6df0978bc8..68d1eab740 100644 --- a/src/game/behaviors/water_mist_particle.inc.c +++ b/src/game/behaviors/water_mist_particle.c @@ -1,4 +1,8 @@ -// water_mist_particle.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "game/object_helpers.h" + // TODO: Is this really "mist"? void bhv_water_mist_spawn_loop(void) { diff --git a/src/game/behaviors/water_objs.inc.c b/src/game/behaviors/water_objs.c similarity index 87% rename from src/game/behaviors/water_objs.inc.c rename to src/game/behaviors/water_objs.c index 3928731c8c..0f121504d7 100644 --- a/src/game/behaviors/water_objs.inc.c +++ b/src/game/behaviors/water_objs.c @@ -1,12 +1,26 @@ -// water_objs.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "engine/surface_collision.h" +#include "game/game_init.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + // TODO: Better name, please +/* Water Objects */ +// Fields 0xF4 & 0xF8 seem to be angles for bubble and cannon +#define /*0x0F4*/ oWaterObjScaleXAngle OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oWaterObjScaleYAngle OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oWaterObjScaleXAngleVel OBJECT_FIELD_S32(0x1D) +#define /*0x100*/ oWaterObjScaleYAngleVel OBJECT_FIELD_S32(0x1E) + void bhv_water_air_bubble_init(void) { cur_obj_scale(4.0f); } -// Fields 0xF4 & 0xF8 seem to be angles for bubble and cannon - void bhv_water_air_bubble_loop(void) { s32 i; o->header.gfx.scale[0] = sins(o->oWaterObjScaleXAngle) * 0.5f + 4.0f; diff --git a/src/game/behaviors/water_pillar.inc.c b/src/game/behaviors/water_pillar.c similarity index 87% rename from src/game/behaviors/water_pillar.inc.c rename to src/game/behaviors/water_pillar.c index 7f37a6a8ef..990b3c9aac 100644 --- a/src/game/behaviors/water_pillar.inc.c +++ b/src/game/behaviors/water_pillar.c @@ -1,4 +1,15 @@ -// water_pillar.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" +#include "game/rumble_init.h" +#include "game/save_file.h" +#include "game/spawn_sound.h" + +/* Water Level Pillar */ +#define /*0x0F8*/ oWaterLevelPillarDrained OBJECT_FIELD_S32(0x1C) void water_level_pillar_undrained(void) { struct Object *otherWaterPillar; diff --git a/src/game/behaviors/water_ring.inc.c b/src/game/behaviors/water_ring.c similarity index 80% rename from src/game/behaviors/water_ring.inc.c rename to src/game/behaviors/water_ring.c index 1ad4418e15..85bc1ce460 100644 --- a/src/game/behaviors/water_ring.inc.c +++ b/src/game/behaviors/water_ring.c @@ -1,4 +1,30 @@ -// water_ring.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" + +/* Water Ring (both variants) */ +#define /*0x0F4*/ O_WATER_RING_SCALE_PHASE_INDEX 0x1B +#define /*0x0F4*/ O_WATER_RING_SCALE_PHASE_X_INDEX (O_WATER_RING_SCALE_PHASE_INDEX + 0) // 0x1B +#define /*0x0F8*/ O_WATER_RING_SCALE_PHASE_Y_INDEX (O_WATER_RING_SCALE_PHASE_INDEX + 1) // 0x1C +#define /*0x0FC*/ O_WATER_RING_SCALE_PHASE_Z_INDEX (O_WATER_RING_SCALE_PHASE_INDEX + 2) // 0x1D +#define /*0x0F4*/ oWaterRingScalePhaseVec OBJECT_FIELD_S32(O_WATER_RING_SCALE_PHASE_INDEX) +#define /*0x0F4*/ oWaterRingScalePhaseX OBJECT_FIELD_S32(O_WATER_RING_SCALE_PHASE_X_INDEX) +#define /*0x0F8*/ oWaterRingScalePhaseY OBJECT_FIELD_S32(O_WATER_RING_SCALE_PHASE_Y_INDEX) +#define /*0x0FC*/ oWaterRingScalePhaseZ OBJECT_FIELD_S32(O_WATER_RING_SCALE_PHASE_Z_INDEX) +#define /*0x100*/ O_WATER_RING_NORMAL_INDEX 0x1E +#define /*0x100*/ O_WATER_RING_NORMAL_X_INDEX (O_WATER_RING_NORMAL_INDEX + 0) // 0x1E +#define /*0x104*/ O_WATER_RING_NORMAL_Y_INDEX (O_WATER_RING_NORMAL_INDEX + 1) // 0x1F +#define /*0x108*/ O_WATER_RING_NORMAL_Z_INDEX (O_WATER_RING_NORMAL_INDEX + 2) // 0x20 +#define /*0x100*/ oWaterRingNormalVec OBJECT_FIELD_F32(O_WATER_RING_NORMAL_INDEX) +#define /*0x100*/ oWaterRingNormalX OBJECT_FIELD_F32(O_WATER_RING_NORMAL_X_INDEX) +#define /*0x104*/ oWaterRingNormalY OBJECT_FIELD_F32(O_WATER_RING_NORMAL_Y_INDEX) +#define /*0x108*/ oWaterRingNormalZ OBJECT_FIELD_F32(O_WATER_RING_NORMAL_Z_INDEX) +#define /*0x10C*/ oWaterRingMarioDistInFront OBJECT_FIELD_F32(0x21) +#define /*0x1AC*/ oWaterRingAvgScale OBJECT_FIELD_F32(0x49) #ifndef FIX_WATER_RINGS f32 water_ring_calc_mario_dist(void) { diff --git a/src/game/behaviors/water_splashes_and_waves.inc.c b/src/game/behaviors/water_splashes_and_waves.c similarity index 93% rename from src/game/behaviors/water_splashes_and_waves.inc.c rename to src/game/behaviors/water_splashes_and_waves.c index 5cdee023ec..ae0aa53454 100644 --- a/src/game/behaviors/water_splashes_and_waves.inc.c +++ b/src/game/behaviors/water_splashes_and_waves.c @@ -1,4 +1,15 @@ -// water_splashes_and_waves.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "actors/common1.h" +#include "engine/math_util.h" +#include "engine/surface_collision.h" +#include "game/game_init.h" +#include "game/level_update.h" +#include "game/object_helpers.h" + +/* Wave Trail */ +#define /*0x0F8*/ oWaveTrailSize OBJECT_FIELD_F32(0x1C) // Water droplets from Mario jumping in a pool of water. struct WaterDropletParams sWaterSplashDropletParams = { diff --git a/src/game/behaviors/water_wave.inc.c b/src/game/behaviors/water_wave.c similarity index 67% rename from src/game/behaviors/water_wave.inc.c rename to src/game/behaviors/water_wave.c index a18cf7c513..ae27ce4e04 100644 --- a/src/game/behaviors/water_wave.inc.c +++ b/src/game/behaviors/water_wave.c @@ -1,4 +1,9 @@ -// water_wave.inc.c +#include +#include "global_object_fields.h" +#include "engine/surface_collision.h" +#include "game/game_init.h" +#include "game/object_helpers.h" + // TODO: Rename to avoid confusion with water_splashes_and_waves void bhv_object_water_wave_init(void) { diff --git a/src/game/behaviors/wdw_water_level.inc.c b/src/game/behaviors/wdw_water_level.c similarity index 88% rename from src/game/behaviors/wdw_water_level.inc.c rename to src/game/behaviors/wdw_water_level.c index aa5eec1664..4d28327639 100644 --- a/src/game/behaviors/wdw_water_level.inc.c +++ b/src/game/behaviors/wdw_water_level.c @@ -1,4 +1,12 @@ -// wdw_water_level.inc.c +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Water Level Trigger */ +#define /*0x0F4*/ oWaterLevelTriggerAmbientWaves OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oWaterLevelTriggerTargetWaterLevel OBJECT_FIELD_S32(0x1C) // called when WDW is loaded. void bhv_init_changing_water_level_loop(void) { diff --git a/src/game/behaviors/whirlpool.inc.c b/src/game/behaviors/whirlpool.c similarity index 87% rename from src/game/behaviors/whirlpool.inc.c rename to src/game/behaviors/whirlpool.c index 84a5105dea..b76c84fa0b 100644 --- a/src/game/behaviors/whirlpool.inc.c +++ b/src/game/behaviors/whirlpool.c @@ -1,4 +1,14 @@ -// whirlpool.inc.c +#include +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/envfx_bubbles.h" +#include "game/spawn_sound.h" + +/* Whirlpool */ +#define /*0x0F4*/ oWhirlpoolInitFacePitch OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oWhirlpoolInitFaceRoll OBJECT_FIELD_S32(0x1C) static struct ObjectHitbox sWhirlpoolHitbox = { /* interactType: */ INTERACT_WHIRLPOOL, diff --git a/src/game/behaviors/white_puff.inc.c b/src/game/behaviors/white_puff.c similarity index 82% rename from src/game/behaviors/white_puff.inc.c rename to src/game/behaviors/white_puff.c index 5e18cb3f5f..6e320a5032 100644 --- a/src/game/behaviors/white_puff.inc.c +++ b/src/game/behaviors/white_puff.c @@ -1,4 +1,6 @@ -// white_puff.inc.c +#include +#include "global_object_fields.h" +#include "game/object_helpers.h" void bhv_white_puff_1_loop(void) { if (o->oTimer == 0) { diff --git a/src/game/behaviors/white_puff_explode.inc.c b/src/game/behaviors/white_puff_explode.c similarity index 81% rename from src/game/behaviors/white_puff_explode.inc.c rename to src/game/behaviors/white_puff_explode.c index 7d28802b54..b9b176b8a0 100644 --- a/src/game/behaviors/white_puff_explode.inc.c +++ b/src/game/behaviors/white_puff_explode.c @@ -1,3 +1,10 @@ +#include +#include "global_object_fields.h" +#include "game/object_helpers.h" + +#define /*0x0F4*/ oWhitePuffScaleX OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oWhitePuffOpacityDiff OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oWhitePuffSlowFade OBJECT_FIELD_S32(0x1D) // white_puff_explode.inc.c void bhv_white_puff_exploding_loop(void) { diff --git a/src/game/behaviors/whomp.inc.c b/src/game/behaviors/whomp.c similarity index 95% rename from src/game/behaviors/whomp.inc.c rename to src/game/behaviors/whomp.c index 69663b6ea3..02a5a65cc4 100644 --- a/src/game/behaviors/whomp.inc.c +++ b/src/game/behaviors/whomp.c @@ -1,4 +1,16 @@ -// whomp.inc.c +#include +#include "dialog_ids.h" +#include "seq_ids.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "engine/math_util.h" +#include "engine/surface_load.h" +#include "game/level_update.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" + +/* Whomp */ +#define /*0x0F8*/ oWhompShakeVal OBJECT_FIELD_S32(0x1C) void whomp_play_sfx_from_pound_animation(void) { s32 playSound = FALSE; diff --git a/src/game/behaviors/wiggler.inc.c b/src/game/behaviors/wiggler.c similarity index 93% rename from src/game/behaviors/wiggler.inc.c rename to src/game/behaviors/wiggler.c index 6609c72395..cd5ea74c91 100644 --- a/src/game/behaviors/wiggler.inc.c +++ b/src/game/behaviors/wiggler.c @@ -1,3 +1,14 @@ +#include +#include "behavior_data.h" +#include "dialog_ids.h" +#include "seq_ids.h" +#include "global_object_fields.h" +#include "actors/group11.h" +#include "audio/external.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/spawn_sound.h" /** * Behavior for bhvWigglerHead and bhvWigglerBody. @@ -7,6 +18,17 @@ * Processing order is bhvWigglerHead, then bhvWigglerBody 1, 2, then 3. */ +/* Wiggler */ +#define /*0x0F4*/ oWigglerFallThroughFloorsHeight OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oWigglerSegments OBJECT_FIELD_CHAIN_SEGMENT(0x1C) +#define /*0x0FC*/ oWigglerWalkAnimSpeed OBJECT_FIELD_F32(0x1D) +#define /*0x104*/ oWigglerSquishSpeed OBJECT_FIELD_F32(0x1F) +#define /*0x108*/ oWigglerTimeUntilRandomTurn OBJECT_FIELD_S32(0x20) +#define /*0x10C*/ oWigglerTargetYaw OBJECT_FIELD_S32(0x21) +#define /*0x110*/ oWigglerWalkAwayFromWallTimer OBJECT_FIELD_S32(0x22) +#define /*0x1AC*/ oWigglerUnused OBJECT_FIELD_S16(0x49, 0) +#define /*0x1AE*/ oWigglerTextStatus OBJECT_FIELD_S16(0x49, 1) + /** * Hitbox for wiggler's non-head body parts. */ diff --git a/src/game/behaviors/wind.inc.c b/src/game/behaviors/wind.c similarity index 89% rename from src/game/behaviors/wind.inc.c rename to src/game/behaviors/wind.c index a7974a9e91..d55e667aa3 100644 --- a/src/game/behaviors/wind.inc.c +++ b/src/game/behaviors/wind.c @@ -1,4 +1,8 @@ -// wind.inc.c +#include +#include "behavior_data.h" +#include "global_object_fields.h" +#include "engine/math_util.h" +#include "game/object_helpers.h" void spawn_wind_particles(s16 pitch, s16 yaw) { s32 i; diff --git a/src/game/behaviors/yoshi.inc.c b/src/game/behaviors/yoshi.c similarity index 88% rename from src/game/behaviors/yoshi.inc.c rename to src/game/behaviors/yoshi.c index e6d944b644..f299c63cec 100644 --- a/src/game/behaviors/yoshi.inc.c +++ b/src/game/behaviors/yoshi.c @@ -1,4 +1,30 @@ -// yoshi.inc.c +#include +#include "behavior_data.h" +#include "dialog_ids.h" +#include "global_object_fields.h" +#include "audio/external.h" +#include "engine/math_util.h" +#include "game/interaction.h" +#include "game/object_helpers.h" +#include "game/save_file.h" +#include "game/spawn_sound.h" + +/* Yoshi */ +#define /*0x0F4*/ oYoshiBlinkTimer OBJECT_FIELD_S32(0x1B) +#define /*0x0FC*/ oYoshiChosenHome OBJECT_FIELD_S32(0x1D) +#define /*0x100*/ oYoshiTargetYaw OBJECT_FIELD_S32(0x1E) + +/** + * Tracks whether or not Yoshi has walked/jumped off the roof. + */ +static s8 sYoshiDead = FALSE; +/** + * Resets yoshi as spawned/despawned upon new file select. + * Possibly a function with stubbed code. + */ +void set_yoshi_as_not_dead(void) { + sYoshiDead = FALSE; +} // X/Z coordinates of Yoshi's homes that he switches between. // Note that this doesn't contain the Y coordinate since the castle roof is flat, diff --git a/src/game/camera.c b/src/game/camera.c index 8cd629d0af..bbb004991d 100644 --- a/src/game/camera.c +++ b/src/game/camera.c @@ -5,7 +5,7 @@ #include "seq_ids.h" #include "dialog_ids.h" #include "audio/external.h" -#include "mario_misc.h" +#include "mario_geo.h" #include "game_init.h" #include "hud.h" #include "engine/math_util.h" @@ -106,59 +106,6 @@ s16 sCreditsPlayer2Yaw; */ u8 sFramesPaused; -extern struct CameraFOVStatus sFOVState; -extern struct TransitionInfo sModeTransition; -extern struct PlayerGeometry sMarioGeometry; -extern s16 sAvoidYawVel; -extern s16 sCameraYawAfterDoorCutscene; -extern struct HandheldShakePoint sHandheldShakeSpline[4]; -extern s16 sHandheldShakeMag; -extern f32 sHandheldShakeTimer; -extern f32 sHandheldShakeInc; -extern s16 sHandheldShakePitch; -extern s16 sHandheldShakeYaw; -extern s16 sHandheldShakeRoll; -extern s16 sSelectionFlags; -extern s16 s2ndRotateFlags; -extern s16 sCameraSoundFlags; -extern u16 sCButtonsPressed; -extern s16 sCutsceneDialogID; -extern struct LakituState gLakituState; -extern s16 sAreaYaw; -extern s16 sAreaYawChange; -extern s16 sLakituDist; -extern s16 sLakituPitch; -extern f32 sZoomAmount; -extern s16 sCSideButtonYaw; -extern s16 sBehindMarioSoundTimer; -extern f32 sZeroZoomDist; -extern s16 sCUpCameraPitch; -extern s16 sModeOffsetYaw; -extern s16 sSpiralStairsYawOffset; -extern s16 s8DirModeBaseYaw; -extern s16 s8DirModeYawOffset; -extern f32 sPanDistance; -extern f32 sCannonYOffset; -extern struct ModeTransitionInfo sModeInfo; -extern Vec3f sCastleEntranceOffset; -extern u32 sParTrackIndex; -extern struct ParallelTrackingPoint *sParTrackPath; -extern struct CameraStoredInfo sParTrackTransOff; -extern struct CameraStoredInfo sCameraStoreCUp; -extern struct CameraStoredInfo sCameraStoreCutscene; -extern s16 gCameraMovementFlags; -extern s16 sStatusFlags; -extern struct CutsceneSplinePoint sCurCreditsSplinePos[32]; -extern struct CutsceneSplinePoint sCurCreditsSplineFocus[32]; -extern s16 sCutsceneSplineSegment; -extern f32 sCutsceneSplineSegmentProgress; -extern s16 sCutsceneShot; -extern s16 gCutsceneTimer; -extern struct CutsceneVariable sCutsceneVars[10]; -extern s32 gObjCutsceneDone; -extern u32 gCutsceneObjSpawn; -extern struct Camera *gCamera; - /** * Lakitu's position and focus. * @see LakituState @@ -9278,35 +9225,6 @@ void cutscene_end_waving_start(UNUSED struct Camera *c) { } // 3rd part of data -struct CutsceneSplinePoint gIntroLakituStartToPipeFocus[] = { - { 0, 32, { 58, -250, 346 } }, { 1, 50, { -159, -382, 224 } }, { 2, 37, { 0, -277, 237 } }, - { 3, 15, { 1, -44, 245 } }, { 4, 35, { 0, -89, 228 } }, { 5, 15, { 28, 3, 259 } }, - { 6, 25, { -38, -201, 371 } }, { 7, 20, { -642, 118, 652 } }, { 8, 25, { 103, -90, 861 } }, - { 9, 25, { 294, 145, 579 } }, { 10, 30, { 220, -42, 500 } }, { 11, 20, { 10, -134, 200 } }, - { 12, 20, { -143, -145, 351 } }, { 13, 14, { -256, -65, 528 } }, { 14, 20, { -251, -52, 459 } }, - { 15, 25, { -382, 520, 395 } }, { 16, 25, { -341, 240, 653 } }, { 17, 5, { -262, 700, 143 } }, - { 18, 15, { -760, 32, 27 } }, { 19, 20, { -756, -6, -26 } }, { 20, 20, { -613, 5, 424 } }, - { 21, 20, { -22, -100, 312 } }, { 22, 25, { 212, 80, 61 } }, { 23, 20, { 230, -28, 230 } }, - { 24, 35, { -83, -51, 303 } }, { 25, 17, { 126, 90, 640 } }, { 26, 9, { 158, 95, 763 } }, - { 27, 8, { 113, -25, 1033 } }, { 28, 20, { 57, -53, 1291 } }, { 29, 15, { 73, -34, 1350 } }, - { 30, 7, { 0, 96, 1400 } }, { 31, 8, { -59, 269, 1450 } }, { 32, 15, { 57, 1705, 1500 } }, - { 0, 15, { -227, 511, 1550 } }, { -1, 15, { -227, 511, 1600 } } -}; - -struct CutsceneSplinePoint gIntroLakituStartToPipeOffsetFromCamera[] = { - { 0, 0, { -46, 87, -15 } }, { 1, 0, { -38, 91, -11 } }, { 2, 0, { -31, 93, -13 } }, - { 3, 0, { -50, 84, -16 } }, { 4, 0, { -52, 83, -17 } }, { 5, 0, { -10, 99, 3 } }, - { 6, 0, { -54, 83, -10 } }, { 7, 0, { -31, 85, -40 } }, { 8, 0, { -34, 91, 19 } }, - { 9, 0, { -9, 95, 28 } }, { 10, 0, { 17, 72, 66 } }, { 11, 0, { 88, -7, 45 } }, - { 12, 0, { 96, -6, -26 } }, { 13, 0, { 56, -1, -82 } }, { 14, 0, { 40, 65, -63 } }, - { 15, 0, { -26, -3, -96 } }, { 16, 0, { 92, 82, 19 } }, { 17, 0, { 92, 32, 19 } }, - { 18, 0, { 92, 32, 19 } }, { 19, 0, { 92, 102, 19 } }, { 20, 0, { -69, 59, -70 } }, - { 21, 0, { -77, 109, -61 } }, { 22, 0, { -87, 59, -46 } }, { 23, 0, { -99, -3, 11 } }, - { 24, 0, { -99, -11, 5 } }, { 25, 0, { -97, -6, 19 } }, { 26, 0, { -97, 22, -7 } }, - { 27, 0, { -98, -11, -13 } }, { 28, 0, { -97, -11, 19 } }, { 29, 0, { -91, -11, 38 } }, - { 30, 0, { -76, -11, 63 } }, { 31, 0, { -13, 33, 93 } }, { 32, 0, { 51, -11, 84 } }, - { 33, 0, { 51, -11, 84 } }, { -1, 0, { 51, -11, 84 } } -}; struct CutsceneSplinePoint gEndWavingPos[] = { { 0, 0, { -5, 975, -917 } }, { 0, 0, { -5, 975, -917 } }, { 0, 0, { -5, 975, -917 } }, @@ -11120,9 +11038,3 @@ void obj_rotate_towards_point(struct Object *obj, Vec3f point, s16 pitchOff, s16 obj->oMoveAnglePitch = approach_s16_asymptotic(obj->oMoveAnglePitch, pitchOff - pitch, pitchDiv); obj->oMoveAngleYaw = approach_s16_asymptotic(obj->oMoveAngleYaw, yaw + yawOff, yawDiv); } - -#include "behaviors/intro_peach.inc.c" -#include "behaviors/intro_lakitu.inc.c" -#include "behaviors/end_birds_1.inc.c" -#include "behaviors/end_birds_2.inc.c" -#include "behaviors/intro_scene.inc.c" diff --git a/src/game/camera.h b/src/game/camera.h index fcd1f59f97..2e6ac16eac 100644 --- a/src/game/camera.h +++ b/src/game/camera.h @@ -353,6 +353,9 @@ enum AvoidStatus { AVOID_STATUS_WALL_COVERING_MARIO, }; +// Forward declare struct Camera. +struct Camera; + /** * A copy of player information that is relevant to the camera. */ @@ -701,18 +704,64 @@ struct LakituState { /*0xBC*/ s16 unused; }; -// BSS +// externs +extern struct PlayerCameraState gPlayerCameraState[2]; +extern struct Object *gCutsceneFocus; +extern struct Object *gSecondCameraFocus; +extern u8 gRecentCutscene; +extern struct CameraFOVStatus sFOVState; +extern struct TransitionInfo sModeTransition; +extern struct PlayerGeometry sMarioGeometry; +extern s16 sAvoidYawVel; +extern s16 sCameraYawAfterDoorCutscene; +extern struct HandheldShakePoint sHandheldShakeSpline[4]; +extern s16 sHandheldShakeMag; +extern f32 sHandheldShakeTimer; +extern f32 sHandheldShakeInc; +extern s16 sHandheldShakePitch; +extern s16 sHandheldShakeYaw; +extern s16 sHandheldShakeRoll; extern s16 sSelectionFlags; +extern s16 s2ndRotateFlags; extern s16 sCameraSoundFlags; extern u16 sCButtonsPressed; -extern struct PlayerCameraState gPlayerCameraState[2]; +extern s16 sCutsceneDialogID; extern struct LakituState gLakituState; +extern s16 sAreaYaw; +extern s16 sAreaYawChange; +extern s16 sLakituDist; +extern s16 sLakituPitch; +extern f32 sZoomAmount; +extern s16 sCSideButtonYaw; +extern s16 sBehindMarioSoundTimer; +extern f32 sZeroZoomDist; +extern s16 sCUpCameraPitch; +extern s16 sModeOffsetYaw; +extern s16 sSpiralStairsYawOffset; +extern s16 s8DirModeBaseYaw; +extern s16 s8DirModeYawOffset; +extern f32 sPanDistance; +extern f32 sCannonYOffset; +extern struct ModeTransitionInfo sModeInfo; +extern Vec3f sCastleEntranceOffset; +extern u32 sParTrackIndex; +extern struct ParallelTrackingPoint *sParTrackPath; +extern struct CameraStoredInfo sParTrackTransOff; +extern struct CameraStoredInfo sCameraStoreCUp; +extern struct CameraStoredInfo sCameraStoreCutscene; extern s16 gCameraMovementFlags; +extern s16 sStatusFlags; +extern struct CutsceneSplinePoint sCurCreditsSplinePos[32]; +extern struct CutsceneSplinePoint sCurCreditsSplineFocus[32]; +extern s16 sCutsceneSplineSegment; +extern f32 sCutsceneSplineSegmentProgress; +extern s16 sCutsceneShot; +extern s16 gCutsceneTimer; +extern struct CutsceneVariable sCutsceneVars[10]; extern s32 gObjCutsceneDone; +extern u32 gCutsceneObjSpawn; extern struct Camera *gCamera; -extern struct Object *gCutsceneFocus; -extern struct Object *gSecondCameraFocus; -extern u8 gRecentCutscene; +extern struct PlayerCameraState *sMarioCamState; // TODO: sort all of this extremely messy shit out after the split @@ -743,6 +792,7 @@ s32 set_or_approach_f32_asymptotic(f32 *dst, f32 goal, f32 scale); void approach_vec3f_asymptotic(Vec3f current, Vec3f target, f32 xMul, f32 yMul, f32 zMul); void set_or_approach_vec3f_asymptotic(Vec3f dst, Vec3f goal, f32 xMul, f32 yMul, f32 zMul); s32 camera_approach_s16_symmetric_bool(s16 *current, s16 target, s16 increment); +s32 camera_approach_s16_symmetric(s16 current, s16 target, s16 increment); s32 set_or_approach_s16_symmetric(s16 *current, s16 target, s16 increment); s32 camera_approach_f32_symmetric_bool(f32 *current, f32 target, f32 increment); f32 camera_approach_f32_symmetric(f32 value, f32 target, f32 increment); diff --git a/src/game/debug.c b/src/game/debug.c index 471f124589..c1767e3f8f 100644 --- a/src/game/debug.c +++ b/src/game/debug.c @@ -8,7 +8,7 @@ #include "game_init.h" #include "main.h" #include "object_constants.h" -#include "object_fields.h" +#include "global_object_fields.h" #include "object_helpers.h" #include "object_list_processor.h" #include "print.h" diff --git a/src/game/farcall_helpers.h b/src/game/farcall_helpers.h index a015a4e778..3e326f8bed 100644 --- a/src/game/farcall_helpers.h +++ b/src/game/farcall_helpers.h @@ -21,7 +21,6 @@ #include "mario.h" #include "save_file.h" #include "game_init.h" -#include "obj_behaviors_2.h" #include "level_headers.h" s32 obj_is_rendering_enabled(void); diff --git a/src/game/interaction.c b/src/game/interaction.c index 3232113eef..d3f6ca91a0 100644 --- a/src/game/interaction.c +++ b/src/game/interaction.c @@ -1931,3 +1931,18 @@ void mario_handle_special_floors(struct MarioState *m) { } } } + +s32 check_mario_attacking(void) { + if (obj_check_if_collided_with_object(gCurrentObject, gMarioObject)) { + if (abs_angle_diff(gCurrentObject->oMoveAngleYaw, gMarioObject->oMoveAngleYaw) > 0x6000) { + if (gMarioStates[0].action == ACT_SLIDE_KICK ) return WF_ATTACK_GROUND; + if (gMarioStates[0].action == ACT_PUNCHING ) return WF_ATTACK_GROUND; + if (gMarioStates[0].action == ACT_MOVE_PUNCHING ) return WF_ATTACK_GROUND; + if (gMarioStates[0].action == ACT_SLIDE_KICK_SLIDE) return WF_ATTACK_GROUND; + if (gMarioStates[0].action == ACT_JUMP_KICK ) return WF_ATTACK_AIR; + if (gMarioStates[0].action == ACT_WALL_KICK_AIR ) return WF_ATTACK_AIR; + } + } + + return 0; +} diff --git a/src/game/interaction.h b/src/game/interaction.h index 591c7e7297..b412826281 100644 --- a/src/game/interaction.h +++ b/src/game/interaction.h @@ -139,5 +139,6 @@ u32 mario_check_object_grab(struct MarioState *m); u32 get_door_save_file_flag(struct Object *door); void mario_process_interactions(struct MarioState *m); void mario_handle_special_floors(struct MarioState *m); +s32 check_mario_attacking(void); #endif // INTERACTION_H diff --git a/src/game/level_geo.c b/src/game/level_geo.c index 45e892ecca..56275d0031 100644 --- a/src/game/level_geo.c +++ b/src/game/level_geo.c @@ -2,7 +2,7 @@ #include "sm64.h" #include "rendering_graph_node.h" -#include "mario_misc.h" +#include "mario_geo.h" #include "skybox.h" #include "engine/math_util.h" #include "camera.h" diff --git a/src/game/mario.c b/src/game/mario.c index af26781131..7148d1c480 100644 --- a/src/game/mario.c +++ b/src/game/mario.c @@ -22,10 +22,10 @@ #include "mario_actions_object.h" #include "mario_actions_stationary.h" #include "mario_actions_submerged.h" -#include "mario_misc.h" +#include "mario_geo.h" #include "mario_step.h" #include "memory.h" -#include "object_fields.h" +#include "global_object_fields.h" #include "object_helpers.h" #include "object_list_processor.h" #include "print.h" diff --git a/src/game/mario_misc.c b/src/game/mario_geo.c similarity index 68% rename from src/game/mario_misc.c rename to src/game/mario_geo.c index b6fa44b1c7..48586e0740 100644 --- a/src/game/mario_misc.c +++ b/src/game/mario_geo.c @@ -16,7 +16,7 @@ #include "interaction.h" #include "level_update.h" #include "mario_actions_cutscene.h" -#include "mario_misc.h" +#include "mario_geo.h" #include "memory.h" #include "object_helpers.h" #include "object_list_processor.h" @@ -28,33 +28,6 @@ #include "config.h" -#define TOAD_STAR_1_REQUIREMENT 12 -#define TOAD_STAR_2_REQUIREMENT 25 -#define TOAD_STAR_3_REQUIREMENT 35 - -#define TOAD_STAR_1_DIALOG DIALOG_082 -#define TOAD_STAR_2_DIALOG DIALOG_076 -#define TOAD_STAR_3_DIALOG DIALOG_083 - -#define TOAD_STAR_1_DIALOG_AFTER DIALOG_154 -#define TOAD_STAR_2_DIALOG_AFTER DIALOG_155 -#define TOAD_STAR_3_DIALOG_AFTER DIALOG_156 - -enum ToadMessageStates { - TOAD_MESSAGE_FADED, - TOAD_MESSAGE_OPAQUE, - TOAD_MESSAGE_OPACIFYING, - TOAD_MESSAGE_FADING, - TOAD_MESSAGE_TALKING -}; - -enum UnlockDoorStarStates { - UNLOCK_DOOR_STAR_RISING, - UNLOCK_DOOR_STAR_WAITING, - UNLOCK_DOOR_STAR_SPAWNING_PARTICLES, - UNLOCK_DOOR_STAR_DONE -}; - /** * The eye texture on succesive frames of Mario's blink animation. * He intentionally blinks twice each time. @@ -102,198 +75,6 @@ Gfx *geo_draw_mario_head_goddard(s32 callContext, struct GraphNode *node, UNUSED } #endif -static void toad_message_faded(void) { - if (o->oDistanceToMario > 700.0f) { - o->oToadMessageRecentlyTalked = FALSE; - } - if (!o->oToadMessageRecentlyTalked && o->oDistanceToMario < 600.0f) { - o->oToadMessageState = TOAD_MESSAGE_OPACIFYING; - } -} - -static void toad_message_opaque(void) { - if (o->oDistanceToMario > 700.0f) { - o->oToadMessageState = TOAD_MESSAGE_FADING; - } else if (!o->oToadMessageRecentlyTalked) { - o->oInteractionSubtype = INT_SUBTYPE_NPC; - if (o->oInteractStatus & INT_STATUS_INTERACTED) { - o->oInteractStatus = INT_STATUS_NONE; - o->oToadMessageState = TOAD_MESSAGE_TALKING; - play_toads_jingle(); - } - } -} - -static void toad_message_talking(void) { - if (cur_obj_update_dialog_with_cutscene(MARIO_DIALOG_LOOK_DOWN, - DIALOG_FLAG_TURN_TO_MARIO, CUTSCENE_DIALOG, o->oToadMessageDialogId)) { - o->oToadMessageRecentlyTalked = TRUE; - o->oToadMessageState = TOAD_MESSAGE_FADING; - switch (o->oToadMessageDialogId) { - case TOAD_STAR_1_DIALOG: - o->oToadMessageDialogId = TOAD_STAR_1_DIALOG_AFTER; - bhv_spawn_star_no_level_exit(STAR_BP_ACT_1); - break; - case TOAD_STAR_2_DIALOG: - o->oToadMessageDialogId = TOAD_STAR_2_DIALOG_AFTER; - bhv_spawn_star_no_level_exit(STAR_BP_ACT_2); - break; - case TOAD_STAR_3_DIALOG: - o->oToadMessageDialogId = TOAD_STAR_3_DIALOG_AFTER; - bhv_spawn_star_no_level_exit(STAR_BP_ACT_3); - break; - } - } -} - -static void toad_message_opacifying(void) { - if ((o->oOpacity += 6) == 255) { - o->oToadMessageState = TOAD_MESSAGE_OPAQUE; - } -} - -static void toad_message_fading(void) { - if ((o->oOpacity -= 6) == 81) { - o->oToadMessageState = TOAD_MESSAGE_FADED; - } -} - -void bhv_toad_message_loop(void) { - if (o->header.gfx.node.flags & GRAPH_RENDER_ACTIVE) { - o->oInteractionSubtype = INT_STATUS_NONE; - switch (o->oToadMessageState) { - case TOAD_MESSAGE_FADED: - toad_message_faded(); - break; - case TOAD_MESSAGE_OPAQUE: - toad_message_opaque(); - break; - case TOAD_MESSAGE_OPACIFYING: - toad_message_opacifying(); - break; - case TOAD_MESSAGE_FADING: - toad_message_fading(); - break; - case TOAD_MESSAGE_TALKING: - toad_message_talking(); - break; - } - } -} - -void bhv_toad_message_init(void) { - s32 saveFlags = save_file_get_flags(); -#ifdef UNLOCK_ALL - s32 starCount = 999; -#else - s32 starCount = save_file_get_total_star_count(gCurrSaveFileNum - 1, COURSE_MIN - 1, COURSE_MAX - 1); -#endif - s32 dialogId = GET_BPARAM1(o->oBehParams); - s32 enoughStars = TRUE; - - switch (dialogId) { - case TOAD_STAR_1_DIALOG: - enoughStars = (starCount >= TOAD_STAR_1_REQUIREMENT); - if (saveFlags & SAVE_FLAG_COLLECTED_TOAD_STAR_1) { - dialogId = TOAD_STAR_1_DIALOG_AFTER; - } - break; - case TOAD_STAR_2_DIALOG: - enoughStars = (starCount >= TOAD_STAR_2_REQUIREMENT); - if (saveFlags & SAVE_FLAG_COLLECTED_TOAD_STAR_2) { - dialogId = TOAD_STAR_2_DIALOG_AFTER; - } - break; - case TOAD_STAR_3_DIALOG: - enoughStars = (starCount >= TOAD_STAR_3_REQUIREMENT); - if (saveFlags & SAVE_FLAG_COLLECTED_TOAD_STAR_3) { - dialogId = TOAD_STAR_3_DIALOG_AFTER; - } - break; - } - if (enoughStars) { - o->oToadMessageDialogId = dialogId; - o->oToadMessageRecentlyTalked = FALSE; - o->oToadMessageState = TOAD_MESSAGE_FADED; - o->oOpacity = 81; - } else { - obj_mark_for_deletion(o); - } -} - -static void star_door_unlock_spawn_particles(s16 angleOffset) { - struct Object *sparkleParticle = spawn_object(o, MODEL_NONE, bhvSparkleSpawn); - - sparkleParticle->oPosX += 100.0f * sins((o->oUnlockDoorStarTimer * 0x2800) + angleOffset); - sparkleParticle->oPosZ += 100.0f * coss((o->oUnlockDoorStarTimer * 0x2800) + angleOffset); - // Particles are spawned lower each frame - sparkleParticle->oPosY -= o->oUnlockDoorStarTimer * 10.0f; -} - -void bhv_unlock_door_star_init(void) { - o->oUnlockDoorStarState = UNLOCK_DOOR_STAR_RISING; - o->oUnlockDoorStarTimer = 0; - o->oUnlockDoorStarYawVel = 0x1000; - o->oPosX += 30.0f * sins(gMarioState->faceAngle[1] - 0x4000); - o->oPosY += 160.0f; - o->oPosZ += 30.0f * coss(gMarioState->faceAngle[1] - 0x4000); - o->oMoveAngleYaw = 0x7800; - obj_scale(o, 0.5f); -} - -void bhv_unlock_door_star_loop(void) { - s16 prevYaw = o->oMoveAngleYaw; - - // Speed up the star every frame - if (o->oUnlockDoorStarYawVel < 0x2400) { - o->oUnlockDoorStarYawVel += 0x60; - } - switch (o->oUnlockDoorStarState) { - case UNLOCK_DOOR_STAR_RISING: - o->oPosY += 3.4f; // Raise the star up in the air - o->oMoveAngleYaw += - o->oUnlockDoorStarYawVel; // Apply yaw velocity - cur_obj_scale(o->oUnlockDoorStarTimer / 50.0f + 0.5f); // Scale the star to be bigger - if (++o->oUnlockDoorStarTimer == 30) { - o->oUnlockDoorStarTimer = 0; - o->oUnlockDoorStarState++; // Sets state to UNLOCK_DOOR_STAR_WAITING - } - break; - case UNLOCK_DOOR_STAR_WAITING: - o->oMoveAngleYaw += - o->oUnlockDoorStarYawVel; // Apply yaw velocity - if (++o->oUnlockDoorStarTimer == 30) { - play_sound(SOUND_MENU_STAR_SOUND, o->header.gfx.cameraToObject); // Play final sound - cur_obj_hide(); // Hide the object - o->oUnlockDoorStarTimer = 0; - o->oUnlockDoorStarState++; // Sets state to UNLOCK_DOOR_STAR_SPAWNING_PARTICLES - } - break; - case UNLOCK_DOOR_STAR_SPAWNING_PARTICLES: - // Spawn two particles, opposite sides of the star. - star_door_unlock_spawn_particles(0); - star_door_unlock_spawn_particles(0x8000); - if (o->oUnlockDoorStarTimer++ == 20) { - o->oUnlockDoorStarTimer = 0; - o->oUnlockDoorStarState++; // Sets state to UNLOCK_DOOR_STAR_DONE - } - break; - case UNLOCK_DOOR_STAR_DONE: // The object stays loaded for an additional 50 frames so that the - // sound doesn't immediately stop. - if (o->oUnlockDoorStarTimer++ == 50) { - obj_mark_for_deletion(o); - } - break; - } - // Checks if the angle has cycled back to 0. - // This means that the code will execute when the star completes a full revolution. - if (prevYaw > (s16) o->oMoveAngleYaw) { - play_sound( - SOUND_GENERAL_SHORT_STAR, - o->header.gfx.cameraToObject); // Play a sound every time the star spins once - } -} - /** * Generate a display list that sets the correct blend mode and color for mirror Mario. */ @@ -641,3 +422,16 @@ Gfx *geo_mirror_mario_backface_culling(s32 callContext, struct GraphNode *node, } return gfx; } + +Gfx *geo_move_mario_part_from_parent(s32 callContext, UNUSED struct GraphNode *node, Mat4 mtx) { + + if (callContext == GEO_CONTEXT_RENDER) { + struct Object *obj = (struct Object *) gCurGraphNodeObject; + if (obj == gMarioObject && obj->prevObj != NULL) { + obj_update_pos_from_parent_transformation(mtx, obj->prevObj); + obj_set_gfx_pos_from_pos(obj->prevObj); + } + } + + return NULL; +} diff --git a/src/game/mario_misc.h b/src/game/mario_geo.h similarity index 91% rename from src/game/mario_misc.h rename to src/game/mario_geo.h index ea3f183efa..bf3d4bd0eb 100644 --- a/src/game/mario_misc.h +++ b/src/game/mario_geo.h @@ -13,10 +13,6 @@ extern struct MarioBodyState gBodyStates[2]; #ifdef KEEP_MARIO_HEAD Gfx *geo_draw_mario_head_goddard(s32 callContext, struct GraphNode *node, Mat4 *mtx); #endif -void bhv_toad_message_loop(void); -void bhv_toad_message_init(void); -void bhv_unlock_door_star_init(void); -void bhv_unlock_door_star_loop(void); Gfx *geo_mirror_mario_set_alpha(s32 callContext, struct GraphNode *node, UNUSED Mat4 *mtx); Gfx *geo_switch_mario_stand_run(s32 callContext, struct GraphNode *node, UNUSED Mat4 *mtx); Gfx *geo_switch_mario_eyes(s32 callContext, struct GraphNode *node, UNUSED Mat4 *mtx); diff --git a/src/game/obj_behaviors.c b/src/game/obj_behaviors.c index 14f0b885aa..dbbb0f626e 100644 --- a/src/game/obj_behaviors.c +++ b/src/game/obj_behaviors.c @@ -19,7 +19,7 @@ #include "level_update.h" #include "mario.h" #include "mario_actions_cutscene.h" -#include "mario_misc.h" +#include "mario_geo.h" #include "memory.h" #include "obj_behaviors.h" #include "object_helpers.h" @@ -39,7 +39,7 @@ /** * Current object floor as defined in object_step. */ -static struct Surface *sObjFloor; +struct Surface *sObjFloor; /** * Set to false when an object close to the floor should not be oriented in reference @@ -53,21 +53,13 @@ static s8 sOrientObjWithFloor = TRUE; */ s16 sPrevCheckMarioRoom = 0; -/** - * Tracks whether or not Yoshi has walked/jumped off the roof. - */ -s8 sYoshiDead = FALSE; - extern void *ccm_seg7_trajectory_snowman; extern void *inside_castle_seg7_trajectory_mips; -/** - * Resets yoshi as spawned/despawned upon new file select. - * Possibly a function with stubbed code. - */ -void set_yoshi_as_not_dead(void) { - sYoshiDead = FALSE; -} +Vec3f sObjSavedPos; + +void wiggler_jumped_on_attack_handler(void); +void huge_goomba_weakly_attacked(void); /** * An unused geo function. Bears strong similarity to geo_bits_bowser_coloring, and relates something @@ -715,59 +707,711 @@ UNUSED s32 debug_sequence_tracker(s16 debugInputSequence[]) { return FALSE; } -#include "behaviors/moving_coin.inc.c" -#include "behaviors/seaweed.inc.c" -#include "behaviors/bobomb.inc.c" -#include "behaviors/cannon_door.inc.c" -#include "behaviors/whirlpool.inc.c" -#include "behaviors/amp.inc.c" -#include "behaviors/butterfly.inc.c" -#include "behaviors/hoot.inc.c" -#include "behaviors/beta_holdable_object.inc.c" -#include "behaviors/bubble.inc.c" -#include "behaviors/water_wave.inc.c" -#include "behaviors/explosion.inc.c" -#include "behaviors/respawner.inc.c" -#include "behaviors/bully.inc.c" -#include "behaviors/water_ring.inc.c" -#include "behaviors/bowser_bomb.inc.c" -#include "behaviors/celebration_star.inc.c" -#include "behaviors/drawbridge.inc.c" -#include "behaviors/bomp.inc.c" -#include "behaviors/sliding_platform.inc.c" -#include "behaviors/moneybag.inc.c" -#include "behaviors/bowling_ball.inc.c" -#include "behaviors/cruiser.inc.c" -#include "behaviors/spindel.inc.c" -#include "behaviors/pyramid_wall.inc.c" -#include "behaviors/pyramid_elevator.inc.c" -#include "behaviors/pyramid_top.inc.c" -#include "behaviors/sound_waterfall.inc.c" -#include "behaviors/sound_volcano.inc.c" -#include "behaviors/castle_flag.inc.c" -#include "behaviors/sound_birds.inc.c" -#include "behaviors/sound_ambient.inc.c" -#include "behaviors/sound_sand.inc.c" -#include "behaviors/castle_cannon_grate.inc.c" -#include "behaviors/snowman.inc.c" -#include "behaviors/boulder.inc.c" -#include "behaviors/cap.inc.c" -#include "behaviors/koopa_shell.inc.c" -#include "behaviors/spawn_star.inc.c" -#include "behaviors/red_coin.inc.c" -#include "behaviors/hidden_star.inc.c" -#include "behaviors/rolling_log.inc.c" -#include "behaviors/mushroom_1up.inc.c" -#include "behaviors/controllable_platform.inc.c" -#include "behaviors/breakable_box_small.inc.c" -#include "behaviors/snow_mound.inc.c" -#include "behaviors/floating_platform.inc.c" -#include "behaviors/arrow_lift.inc.c" -#include "behaviors/orange_number.inc.c" -#include "behaviors/manta_ray.inc.c" -#include "behaviors/falling_pillar.inc.c" -#include "behaviors/floating_box.inc.c" -#include "behaviors/decorative_pendulum.inc.c" -#include "behaviors/treasure_chest.inc.c" -#include "behaviors/mips.inc.c" -#include "behaviors/yoshi.inc.c" +s32 obj_is_rendering_enabled(void) { + if (o->header.gfx.node.flags & GRAPH_RENDER_ACTIVE) { + return TRUE; + } else { + return FALSE; + } +} + +s16 obj_get_pitch_from_vel(void) { + return -atan2s(o->oForwardVel, o->oVelY); +} + +/** + * Show dialog proposing a race. + * If the player accepts the race, then leave time stop enabled and Mario in the + * text action so that the racing object can wait before starting the race. + * If the player declines the race, then disable time stop and allow Mario to + * move again. + */ +s32 obj_update_race_proposition_dialog(s16 dialogID) { + s32 dialogResponse = cur_obj_update_dialog_with_cutscene(MARIO_DIALOG_LOOK_UP, + (DIALOG_FLAG_TURN_TO_MARIO | DIALOG_FLAG_TIME_STOP_ENABLED), CUTSCENE_RACE_DIALOG, dialogID); + + if (dialogResponse == DIALOG_RESPONSE_NO) { + set_mario_npc_dialog(MARIO_DIALOG_STOP); + disable_time_stop_including_mario(); + } + + return dialogResponse; +} + +void obj_set_dist_from_home(f32 distFromHome) { + o->oPosX = o->oHomeX + distFromHome * coss(o->oMoveAngleYaw); + o->oPosZ = o->oHomeZ + distFromHome * sins(o->oMoveAngleYaw); +} + +s32 obj_is_near_to_and_facing_mario(f32 maxDist, s16 maxAngleDiff) { + if (o->oDistanceToMario < maxDist + && abs_angle_diff(o->oMoveAngleYaw, o->oAngleToMario) < maxAngleDiff) { + return TRUE; + } + return FALSE; +} + +void obj_perform_position_op(s32 op) { + switch (op) { + case POS_OP_SAVE_POSITION: vec3f_copy(sObjSavedPos, &o->oPosVec); break; + case POS_OP_COMPUTE_VELOCITY: vec3f_diff(&o->oVelVec, &o->oPosVec, sObjSavedPos); break; + case POS_OP_RESTORE_POSITION: vec3f_copy(&o->oPosVec, sObjSavedPos); break; + } +} + +void cur_obj_spin_all_dimensions(f32 pitchSpeed, f32 rollSpeed) { + f32 pitch, yaw, roll; + f32 c, s; + f32 px, pz, ny, nz, nx; + + if (o->oForwardVel == 0.0f) { + roll = yaw = pitch = 0.0f; + + if (o->oMoveFlags & OBJ_MOVE_IN_AIR) { + yaw = 50.0f; + } else { + if (o->oFaceAnglePitch < 0x0) { + pitch = -pitchSpeed; + } else if (o->oFaceAnglePitch > 0x0) { + pitch = pitchSpeed; + } + + if (o->oFaceAngleRoll < 0x0) { + roll = -rollSpeed; + } else if (o->oFaceAngleRoll > 0x0) { + roll = rollSpeed; + } + } + + c = coss(o->oFaceAnglePitch); + s = sins(o->oFaceAnglePitch); + nz = pitch * c + yaw * s; + ny = yaw * c - pitch * s; + + c = coss(o->oFaceAngleRoll); + s = sins(o->oFaceAngleRoll); + nx = roll * c + ny * s; + ny = ny * c - roll * s; + + c = coss(o->oFaceAngleYaw); + s = sins(o->oFaceAngleYaw); + px = nx * c - nz * s; + nz = nz * c + nx * s; + + nx = roll * c - pitch * s; + pz = pitch * c + roll * s; + + o->oPosX = o->oHomeX - nx + px; + o->oGraphYOffset = yaw - ny; + o->oPosZ = o->oHomeZ + pz - nz; + } +} + +void obj_rotate_yaw_and_bounce_off_walls(s16 targetYaw, s16 turnAmount) { + if (o->oMoveFlags & OBJ_MOVE_HIT_WALL) { + targetYaw = cur_obj_reflect_move_angle_off_wall(); + } + cur_obj_rotate_yaw_toward(targetYaw, turnAmount); +} + +s16 obj_get_pitch_to_home(f32 latDistToHome) { + return atan2s(latDistToHome, o->oPosY - o->oHomeY); +} + +void obj_compute_vel_from_move_pitch(f32 speed) { + o->oForwardVel = speed * coss(o->oMoveAnglePitch); + o->oVelY = speed * -sins(o->oMoveAnglePitch); +} + +s32 clamp_s16(s16 *value, s16 minimum, s16 maximum) { + if (*value <= minimum) { + *value = minimum; + } else if (*value >= maximum) { + *value = maximum; + } else { + return FALSE; + } + + return TRUE; +} + +s32 clamp_f32(f32 *value, f32 minimum, f32 maximum) { + if (*value <= minimum) { + *value = minimum; + } else if (*value >= maximum) { + *value = maximum; + } else { + return FALSE; + } + + return TRUE; +} + +void cur_obj_init_anim_extend(s32 animIndex) { + cur_obj_init_animation_with_sound(animIndex); + cur_obj_extend_animation_if_at_end(); +} + +s32 cur_obj_init_anim_and_check_if_end(s32 animIndex) { + cur_obj_init_animation_with_sound(animIndex); + return cur_obj_check_if_near_animation_end(); +} + +s32 cur_obj_init_anim_check_frame(s32 animIndex, s32 frame) { + cur_obj_init_animation_with_sound(animIndex); + return cur_obj_check_anim_frame(frame); +} + +s32 cur_obj_set_anim_if_at_end(s32 animIndex) { + if (cur_obj_check_if_at_animation_end()) { + cur_obj_init_animation_with_sound(animIndex); + return TRUE; + } + return FALSE; +} + +void set_obj_anim_with_accel_and_sound(s16 frame1, s16 frame2, s32 sound) { + s32 range = o->header.gfx.animInfo.animAccel / 0x10000; + if (range == 0) { + range = 1; + } + + if (cur_obj_check_anim_frame_in_range(frame1, range) || cur_obj_check_anim_frame_in_range(frame2, range)) { + cur_obj_play_sound_2(sound); + } +} + +s32 cur_obj_play_sound_at_anim_range(s8 startFrame1, s8 startFrame2, u32 sound) { + s32 rangeLength = o->header.gfx.animInfo.animAccel / 0x10000; + + if (rangeLength <= 0) { + rangeLength = 1; + } + + if (cur_obj_check_anim_frame_in_range(startFrame1, rangeLength) || cur_obj_check_anim_frame_in_range(startFrame2, rangeLength)) { + cur_obj_play_sound_2(sound); + return TRUE; + } + + return FALSE; +} + +s16 obj_turn_pitch_toward_mario(f32 targetOffsetY, s16 turnAmount) { + s16 targetPitch; + + o->oPosY -= targetOffsetY; + targetPitch = obj_turn_toward_object(o, gMarioObject, O_MOVE_ANGLE_PITCH_INDEX, turnAmount); + o->oPosY += targetOffsetY; + + return targetPitch; +} + +s32 approach_f32_ptr(f32 *px, f32 target, f32 delta) { + if (*px > target) { + delta = -delta; + } + + *px += delta; + + if ((*px - target) * delta >= 0) { + *px = target; + return TRUE; + } + return FALSE; +} + +s32 obj_forward_vel_approach(f32 target, f32 delta) { + return approach_f32_ptr(&o->oForwardVel, target, delta); +} + +s32 obj_y_vel_approach(f32 target, f32 delta) { + return approach_f32_ptr(&o->oVelY, target, delta); +} + +s32 obj_move_pitch_approach(s16 target, s16 delta) { + o->oMoveAnglePitch = approach_s16_symmetric(o->oMoveAnglePitch, target, delta); + + if ((s16) o->oMoveAnglePitch == target) { + return TRUE; + } + + return FALSE; +} + +s32 obj_face_pitch_approach(s16 targetPitch, s16 deltaPitch) { + o->oFaceAnglePitch = approach_s16_symmetric(o->oFaceAnglePitch, targetPitch, deltaPitch); + + if ((s16) o->oFaceAnglePitch == targetPitch) { + return TRUE; + } + + return FALSE; +} + +s32 obj_face_yaw_approach(s16 targetYaw, s16 deltaYaw) { + o->oFaceAngleYaw = approach_s16_symmetric(o->oFaceAngleYaw, targetYaw, deltaYaw); + + if ((s16) o->oFaceAngleYaw == targetYaw) { + return TRUE; + } + + return FALSE; +} + +s32 obj_face_roll_approach(s16 targetRoll, s16 deltaRoll) { + o->oFaceAngleRoll = approach_s16_symmetric(o->oFaceAngleRoll, targetRoll, deltaRoll); + + if ((s16) o->oFaceAngleRoll == targetRoll) { + return TRUE; + } + + return FALSE; +} + +s32 obj_smooth_turn(s16 *angleVel, s32 *angle, s16 targetAngle, f32 targetSpeedProportion, + s16 accel, s16 minSpeed, s16 maxSpeed) { + s16 currentSpeed; + s16 currentAngle = (s16)(*angle); + + *angleVel = approach_s16_symmetric(*angleVel, (targetAngle - currentAngle) * targetSpeedProportion, accel); + + currentSpeed = abss(*angleVel); + clamp_s16(¤tSpeed, minSpeed, maxSpeed); + + *angle = approach_angle(*angle, targetAngle, currentSpeed); + return (s16)(*angle) == targetAngle; +} + +void obj_roll_to_match_yaw_turn(s16 targetYaw, s16 maxRoll, s16 rollSpeed) { + s16 targetRoll = o->oMoveAngleYaw - targetYaw; + clamp_s16(&targetRoll, -maxRoll, maxRoll); + obj_face_roll_approach(targetRoll, rollSpeed); +} + +s16 random_linear_offset(s16 base, s16 range) { + return base + (s16)(range * random_float()); +} + +s16 random_mod_offset(s16 base, s16 step, s16 mod) { + return base + step * (random_u16() % mod); +} + +s16 obj_random_fixed_turn(s16 delta) { + return o->oMoveAngleYaw + (s16) random_sign() * delta; +} + +/** + * Begin by increasing the object's scale by *scaleVel, and slowly decreasing + * scaleVel. Once the object starts to shrink, wait a bit, and then begin to + * scale the object toward endScale. The first time it reaches below + * shootFireScale during this time, return 1. + * Return -1 once it's reached endScale. + */ +s32 obj_grow_then_shrink(f32 *scaleVel, f32 shootFireScale, f32 endScale) { + if (o->oTimer < 2) { + o->header.gfx.scale[0] += *scaleVel; + + if ((*scaleVel -= 0.01f) > -0.03f) { + o->oTimer = 0; + } + } else if (o->oTimer > 10) { + if (approach_f32_ptr(&o->header.gfx.scale[0], endScale, 0.05f)) { + return -1; + } else if (*scaleVel != 0.0f && o->header.gfx.scale[0] < shootFireScale) { + *scaleVel = 0.0f; + return 1; + } + } + + return 0; +} + +s32 oscillate_toward(s32 *value, f32 *vel, s32 target, f32 velCloseToZero, f32 accel, f32 slowdown) { + s32 startValue = *value; + *value += (s32) *vel; + + if (*value == target + || ((*value - target) * (startValue - target) < 0 && *vel > -velCloseToZero + && *vel < velCloseToZero)) { + *value = target; + *vel = 0.0f; + return TRUE; + } else { + if (*value >= target) { + accel = -accel; + } + if (*vel * accel < 0.0f) { + accel *= slowdown; + } + + *vel += accel; + } + + return FALSE; +} + +void obj_update_blinking(s32 *blinkTimer, s16 baseCycleLength, s16 cycleLengthRange, + s16 blinkLength) { + if (*blinkTimer != 0) { + (*blinkTimer)--; + } else { + *blinkTimer = random_linear_offset(baseCycleLength, cycleLengthRange); + } + + if (*blinkTimer > blinkLength) { + o->oAnimState = OBJ_BLINKING_ANIM_STATE_EYES_OPEN; + } else { + o->oAnimState = OBJ_BLINKING_ANIM_STATE_EYES_CLOSED; + } +} + +s32 obj_resolve_object_collisions(s32 *targetYaw) { + struct Object *otherObject; + f32 dx, dz; + s16 angle; + f32 radius, otherRadius, relativeRadius; + + if (o->numCollidedObjs != 0) { + s32 i; + for (i = 0; i < o->numCollidedObjs; i++) { + otherObject = o->collidedObjs[i]; + if (otherObject == gMarioObject) continue; + if (otherObject->oInteractType & INTERACT_MASK_NO_OBJ_COLLISIONS) continue; + + dx = o->oPosX - otherObject->oPosX; + dz = o->oPosZ - otherObject->oPosZ; + + radius = o->hurtboxRadius > 0 ? o->hurtboxRadius : o->hitboxRadius; + otherRadius = otherObject->hurtboxRadius > 0 ? otherObject->hurtboxRadius : otherObject->hitboxRadius; + relativeRadius = radius + otherRadius; + + if ((sqr(dx) + sqr(dz)) > sqr(relativeRadius)) continue; + angle = atan2s(dz, dx); + o->oPosX = otherObject->oPosX + (relativeRadius * sins(angle)); + o->oPosZ = otherObject->oPosZ + (relativeRadius * coss(angle)); + + if (targetYaw != NULL && abs_angle_diff(o->oMoveAngleYaw, angle) < 0x4000) { + *targetYaw = (s16)(angle - o->oMoveAngleYaw + angle + 0x8000); + return TRUE; + } + } + } + + return FALSE; +} + +s32 obj_bounce_off_walls_edges_objects(s32 *targetYaw) { + if (o->oMoveFlags & OBJ_MOVE_HIT_WALL) { + *targetYaw = cur_obj_reflect_move_angle_off_wall(); + } else if (o->oMoveFlags & OBJ_MOVE_HIT_EDGE) { + *targetYaw = (s16)(o->oMoveAngleYaw + 0x8000); + } else if (!obj_resolve_object_collisions(targetYaw)) { + return FALSE; + } + + return TRUE; +} + +s32 obj_resolve_collisions_and_turn(s16 targetYaw, s16 turnSpeed) { + obj_resolve_object_collisions(NULL); + + if (cur_obj_rotate_yaw_toward(targetYaw, turnSpeed)) { + return FALSE; + } else { + return TRUE; + } +} + +void obj_die_if_health_non_positive(void) { + if (o->oHealth <= 0) { + if (o->oDeathSound == 0) { + spawn_mist_particles_with_sound(SOUND_OBJ_DEFAULT_DEATH); + } else if (o->oDeathSound > 0) { + spawn_mist_particles_with_sound(o->oDeathSound); + } else { + spawn_mist_particles(); + } + + if ((s32)o->oNumLootCoins < 0) { + spawn_object(o, MODEL_BLUE_COIN, bhvMrIBlueCoin); + } else { + obj_spawn_loot_yellow_coins(o, o->oNumLootCoins, 20.0f); + } + // This doesn't do anything + obj_spawn_loot_yellow_coins(o, o->oNumLootCoins, 20.0f); + + if (o->oHealth < 0) { + cur_obj_hide(); + cur_obj_become_intangible(); + } else { + obj_mark_for_deletion(o); + } + } +} +UNUSED void obj_unused_die(void) { + o->oHealth = 0; + obj_die_if_health_non_positive(); +} + +void obj_set_knockback_action(s32 attackType) { + switch (attackType) { + case ATTACK_KICK_OR_TRIP: + case ATTACK_FAST_ATTACK: + o->oAction = OBJ_ACT_VERTICAL_KNOCKBACK; + o->oForwardVel = 20.0f; + o->oVelY = 50.0f; + break; + + default: + o->oAction = OBJ_ACT_HORIZONTAL_KNOCKBACK; + o->oForwardVel = 50.0f; + o->oVelY = 30.0f; + break; + } + + o->oFlags &= ~OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW; + o->oMoveAngleYaw = obj_angle_to_object(gMarioObject, o); +} + +void obj_set_squished_action(void) { + cur_obj_play_sound_2(SOUND_OBJ_STOMPED); + o->oAction = OBJ_ACT_SQUISHED; +} + +s32 obj_die_if_above_lava_and_health_non_positive(void) { + if (o->oMoveFlags & OBJ_MOVE_UNDERWATER_ON_GROUND) { + if (o->oGravity + o->oBuoyancy > 0.0f + || find_water_level(o->oPosX, o->oPosZ) - o->oPosY < 150.0f) { + return FALSE; + } + } else if (!(o->oMoveFlags & OBJ_MOVE_ABOVE_LAVA)) { + if (o->oMoveFlags & OBJ_MOVE_ENTERED_WATER) { + if (o->oWallHitboxRadius < 200.0f) { + cur_obj_play_sound_2(SOUND_OBJ_DIVING_INTO_WATER); + } else { + cur_obj_play_sound_2(SOUND_OBJ_DIVING_IN_WATER); + } + } + return FALSE; + } + + obj_die_if_health_non_positive(); + return TRUE; +} + +s32 obj_handle_attacks(struct ObjectHitbox *hitbox, s32 attackedMarioAction, + u8 *attackHandlers) { + s32 attackType; + + obj_set_hitbox(o, hitbox); + + //! Die immediately if above lava + if (obj_die_if_above_lava_and_health_non_positive()) { + return ATTACK_HANDLER_DIE_IF_HEALTH_NON_POSITIVE; + } else if (o->oInteractStatus & INT_STATUS_INTERACTED) { + if (o->oInteractStatus & INT_STATUS_ATTACKED_MARIO) { + if (o->oAction != attackedMarioAction) { + o->oAction = attackedMarioAction; + o->oTimer = 0; + } + } else { + attackType = o->oInteractStatus & INT_STATUS_ATTACK_MASK; + + switch (attackHandlers[attackType - 1]) { + case ATTACK_HANDLER_NOP: + break; + + case ATTACK_HANDLER_DIE_IF_HEALTH_NON_POSITIVE: + obj_die_if_health_non_positive(); + break; + + case ATTACK_HANDLER_KNOCKBACK: + obj_set_knockback_action(attackType); + break; + + case ATTACK_HANDLER_SQUISHED: + obj_set_squished_action(); + break; + + case ATTACK_HANDLER_SPECIAL_KOOPA_LOSE_SHELL: + shelled_koopa_attack_handler(attackType); + break; + + case ATTACK_HANDLER_SET_SPEED_TO_ZERO: + obj_set_speed_to_zero(); + break; + + case ATTACK_HANDLER_SPECIAL_WIGGLER_JUMPED_ON: + wiggler_jumped_on_attack_handler(); + break; + + case ATTACK_HANDLER_SPECIAL_HUGE_GOOMBA_WEAKLY_ATTACKED: + huge_goomba_weakly_attacked(); + break; + + case ATTACK_HANDLER_SQUISHED_WITH_BLUE_COIN: + o->oNumLootCoins = -1; + obj_set_squished_action(); + break; + } + + o->oInteractStatus = INT_STATUS_NONE; + return attackType; + } + } + + o->oInteractStatus = INT_STATUS_NONE; + return ATTACK_HANDLER_NOP; +} + +void obj_act_knockback(UNUSED f32 baseScale) { + cur_obj_update_floor_and_walls(); + + if (o->header.gfx.animInfo.curAnim != NULL) { + cur_obj_extend_animation_if_at_end(); + } + + //! Dies immediately if above lava + if ((o->oMoveFlags + & (OBJ_MOVE_MASK_ON_GROUND | OBJ_MOVE_MASK_IN_WATER | OBJ_MOVE_HIT_WALL | OBJ_MOVE_ABOVE_LAVA)) + || (o->oAction == OBJ_ACT_VERTICAL_KNOCKBACK && o->oTimer >= 9)) { + obj_die_if_health_non_positive(); + } + + cur_obj_move_standard(-78); +} + +void obj_act_squished(f32 baseScale) { + f32 targetScaleY = baseScale * 0.3f; + + cur_obj_update_floor_and_walls(); + + if (o->header.gfx.animInfo.curAnim != NULL) { + cur_obj_extend_animation_if_at_end(); + } + + if (approach_f32_ptr(&o->header.gfx.scale[1], targetScaleY, baseScale * 0.14f)) { + o->header.gfx.scale[0] = o->header.gfx.scale[2] = baseScale * 2.0f - o->header.gfx.scale[1]; + + if (o->oTimer >= 16) { + obj_die_if_health_non_positive(); + } + } + + o->oForwardVel = 0.0f; + cur_obj_move_standard(-78); +} + +s32 obj_update_standard_actions(f32 scale) { + if (o->oAction < 100) { + return TRUE; + } else { + cur_obj_become_intangible(); + + switch (o->oAction) { + case OBJ_ACT_HORIZONTAL_KNOCKBACK: + case OBJ_ACT_VERTICAL_KNOCKBACK: + obj_act_knockback(scale); + break; + + case OBJ_ACT_SQUISHED: + obj_act_squished(scale); + break; + } + + return FALSE; + } +} + +s32 obj_check_attacks(struct ObjectHitbox *hitbox, s32 attackedMarioAction) { + s32 attackType; + + obj_set_hitbox(o, hitbox); + + //! Dies immediately if above lava + if (obj_die_if_above_lava_and_health_non_positive()) { + return ATTACK_HANDLER_DIE_IF_HEALTH_NON_POSITIVE; + } else if (o->oInteractStatus & INT_STATUS_INTERACTED) { + if (o->oInteractStatus & INT_STATUS_ATTACKED_MARIO) { + if (o->oAction != attackedMarioAction) { + o->oAction = attackedMarioAction; + o->oTimer = 0; + } + } else { + attackType = o->oInteractStatus & INT_STATUS_ATTACK_MASK; + obj_die_if_health_non_positive(); + o->oInteractStatus = INT_STATUS_NONE; + return attackType; + } + } + + o->oInteractStatus = INT_STATUS_NONE; + return ATTACK_HANDLER_NOP; +} + +s32 obj_move_for_one_second(s32 endAction) { + cur_obj_update_floor_and_walls(); + cur_obj_extend_animation_if_at_end(); + + if (o->oTimer > 30) { + o->oAction = endAction; + return TRUE; + } + + cur_obj_move_standard(-78); + return FALSE; +} + +/** + * If we are far from home (> threshold away), then set oAngleToMario to the + * angle to home and oDistanceToMario to 25000. + * If we are close to home, but Mario is far from us (> threshold away), then + * keep oAngleToMario the same and set oDistanceToMario to 20000. + * If we are close to both home and Mario, then keep both oAngleToMario and + * oDistanceToMario the same. + * + * The point of this function is to avoid having to write extra code to get + * the object to return to home. When Mario is far away and the object is far + * from home, it could theoretically re-use the "approach Mario" logic to approach + * its home instead. + * However, most objects that use this function handle the far-from-home case + * separately anyway. + * This function causes seemingly erroneous behavior in some objects that try to + * attack Mario (e.g. fly guy shooting fire or lunging), especially when combined + * with partial updates. + */ +void treat_far_home_as_mario(f32 threshold) { + Vec3f d; + vec3f_diff(d, &o->oHomeVec, &o->oPosVec); + + if (vec3_sumsq(d) > sqr(threshold)) { + o->oAngleToMario = atan2s(d[2], d[0]); + o->oDistanceToMario = 25000.0f; + } else { + if (!gMarioObject) { + o->oDistanceToMario = 20000.0f; + return; + } + + vec3f_diff(d, &o->oHomeVec, &gMarioObject->oPosVec); + if (vec3_sumsq(d) > sqr(threshold)) { + o->oDistanceToMario = 20000.0f; + } + } +} + +/** + * Used by bowser, fly guy, piranha plant, and fire spitters. + */ +void obj_spit_fire(s16 relativePosX, s16 relativePosY, s16 relativePosZ, f32 scale, ModelID32 model, + f32 startSpeed, f32 endSpeed, s16 movePitch) { + struct Object *obj = spawn_object_relative_with_scale(MOVING_FLAME_BP_MOVE, relativePosX, relativePosY, relativePosZ, + scale, o, model, bhvMovingFlame); + + if (obj != NULL) { + obj->oSmallPiranhaFlameStartSpeed = startSpeed; + obj->oSmallPiranhaFlameEndSpeed = endSpeed; + obj->oSmallPiranhaFlameModel = model; + obj->oMoveAnglePitch = movePitch; + } +} diff --git a/src/game/obj_behaviors.h b/src/game/obj_behaviors.h index 5e367daa25..91983fcb4f 100644 --- a/src/game/obj_behaviors.h +++ b/src/game/obj_behaviors.h @@ -7,170 +7,79 @@ #include "macros.h" #include "types.h" -enum ObjCollisionFlags { - OBJ_COL_FLAGS_NONE = (0 << 0), - OBJ_COL_FLAG_GROUNDED = (1 << 0), - OBJ_COL_FLAG_HIT_WALL = (1 << 1), - OBJ_COL_FLAG_UNDERWATER = (1 << 2), - OBJ_COL_FLAG_NO_Y_VEL = (1 << 3), - OBJ_COL_FLAGS_LANDED = (OBJ_COL_FLAG_GROUNDED | OBJ_COL_FLAG_NO_Y_VEL) -}; - -//! Lots of these are duplicates -void set_yoshi_as_not_dead(void); +// Object helpers still in obj_behaviors +void obj_orient_graph(struct Object *obj, f32 normalX, f32 normalY, f32 normalZ); +void calc_obj_friction(f32 *objFriction, f32 floor_nY); +void calc_new_obj_vel_and_pos_y(struct Surface *objFloor, f32 objFloorY, f32 objVelX, f32 objVelZ); +void calc_new_obj_vel_and_pos_y_underwater(struct Surface *objFloor, f32 floorY, f32 objVelX, f32 objVelZ, f32 waterY); +void obj_update_pos_vel_xz(void); +void obj_splash(s32 waterY, s32 objY); +void obj_move_xyz_using_fvel_and_yaw(struct Object *obj); +void set_object_visibility(struct Object *obj, s32 dist); +void obj_return_and_displace_home(struct Object *obj, f32 homeX, UNUSED f32 homeY, f32 homeZ, s32 baseDisp); +void obj_spawn_yellow_coins(struct Object *obj, s8 nCoins); +void obj_check_floor_death(s16 collisionFlags, struct Surface *floor); +void spawn_orange_number(s8 behParam, s16 relX, s16 relY, s16 relZ); +void obj_set_dist_from_home(f32 distFromHome); +void obj_perform_position_op(s32 op); +void cur_obj_spin_all_dimensions(f32 pitchSpeed, f32 rollSpeed); +void obj_rotate_yaw_and_bounce_off_walls(s16 targetYaw, s16 turnAmount); +void obj_compute_vel_from_move_pitch(f32 speed); +void cur_obj_init_anim_extend(s32 animIndex); +void obj_roll_to_match_yaw_turn(s16 targetYaw, s16 maxRoll, s16 rollSpeed); +void obj_die_if_health_non_positive(void); +UNUSED void obj_unused_die(void); +void obj_set_knockback_action(s32 attackType); +void obj_set_squished_action(void); +void obj_act_knockback(UNUSED f32 baseScale); +void obj_act_squished(f32 baseScale); +void treat_far_home_as_mario(f32 threshold); +s32 is_point_within_radius_of_mario(f32 x, f32 y, f32 z, s32 dist); +s32 is_point_close_to_object(struct Object *obj, f32 x, f32 y, f32 z, s32 dist); +s32 obj_return_home_if_safe(struct Object *obj, f32 homeX, f32 y, f32 homeZ, s32 dist); +s32 obj_check_if_facing_toward_angle(u32 base, u32 goal, s16 range); +s32 obj_find_wall_displacement(Vec3f dist, f32 x, f32 y, f32 z, f32 radius); s32 obj_flicker_and_disappear(struct Object *obj, s16 lifeSpan); -s32 coin_step(s16 *collisionFlagsPtr); -void moving_coin_flicker(void); -void coin_collected(void); -void bhv_moving_yellow_coin_init(void); -void bhv_moving_yellow_coin_loop(void); -void bhv_moving_blue_coin_init(void); -void bhv_moving_blue_coin_loop(void); -void bhv_blue_coin_sliding_jumping_init(void); -void blue_coin_sliding_away_from_mario(void); /* likely unused */ -void blue_coin_sliding_slow_down(void); /* likely unused */ -void bhv_blue_coin_sliding_loop(void); /* likely unused */ -void bhv_blue_coin_jumping_loop(void); /* likely unused */ -void bhv_seaweed_init(void); -void bhv_seaweed_bundle_init(void); -void bhv_bobomb_init(void); -void bobomb_spawn_coin(void); -void bobomb_act_explode(void); -void bobomb_check_interactions(void); -void bobomb_act_patrol(void); -void bobomb_act_chase_mario(void); -void bobomb_act_launched(void); -void generic_bobomb_free_loop(void); -void stationary_bobomb_free_loop(void); -void bobomb_free_loop(void); -void bobomb_held_loop(void); -void bobomb_dropped_loop(void); -void bobomb_thrown_loop(void); -void curr_obj_random_blink(s32 *blinkTimer); -void bhv_bobomb_loop(void); -void bhv_bobomb_fuse_smoke_init(void); -void bhv_bobomb_buddy_init(void); -void bobomb_buddy_act_idle(void); -void bobomb_buddy_cannon_dialog(s16 dialogFirstText, s16 dialogSecondText); -void bobomb_buddy_act_talk(void); -void bobomb_buddy_act_turn_to_talk(void); -void bobomb_buddy_actions(void); -void bhv_bobomb_buddy_loop(void); -void bhv_cannon_closed_init(void); -void cannon_door_act_opening(void); -void bhv_cannon_closed_loop(void); -void bhv_whirlpool_init(void); -void whirlpool_set_hitbox(void); -void bhv_whirlpool_loop(void); -void bhv_jet_stream_loop(void); -void bhv_homing_amp_init(void); -void bhv_homing_amp_loop(void); -void bhv_circling_amp_init(void); -void bhv_circling_amp_loop(void); -void bhv_butterfly_init(void); -void butterfly_step(s32 speed); -void butterfly_calculate_angle(void); -void butterfly_act_rest(void); -void butterfly_act_follow_mario(void); -void butterfly_act_return_home(void); -void bhv_butterfly_loop(void); -void bhv_hoot_init(void); -f32 hoot_find_next_floor(f32 dist); -void hoot_floor_bounce(void); -void hoot_free_step(s16 fastOscY, s32 speed); -void hoot_player_set_yaw(void); -void hoot_carry_step(s32 speed, UNUSED f32 xPrev, UNUSED f32 zPrev); -void hoot_surface_collision(f32 xPrev, UNUSED f32 yPrev, f32 zPrev); -void hoot_act_ascent(f32 xPrev, f32 zPrev); -void hoot_action_loop(void); -void hoot_turn_to_home(void); -void hoot_awake_loop(void); -void bhv_hoot_loop(void); -void bhv_beta_holdable_object_init(void); /* unused */ -void bhv_beta_holdable_object_loop(void); /* unused */ -void bhv_object_bubble_init(void); -void bhv_object_bubble_loop(void); -void bhv_object_water_wave_init(void); -void bhv_object_water_wave_loop(void); -void bhv_explosion_init(void); -void bhv_explosion_loop(void); -void bhv_bobomb_bully_death_smoke_init(void); -void bhv_bobomb_explosion_bubble_init(void); -void bhv_bobomb_explosion_bubble_loop(void); -void bhv_respawner_loop(void); -void create_respawner(ModelID32 model, const BehaviorScript *behToSpawn, s32 minSpawnDist); -void bhv_small_bully_init(void); -void bhv_big_bully_init(void); -void bully_check_mario_collision(void); -void bully_act_chase_mario(void); -void bully_act_knockback(void); -void bully_act_back_up(void); -void bully_backup_check(s16 collisionFlags); -void bully_play_stomping_sound(void); -void bully_step(void); -void bully_spawn_coin(void); -void bully_act_level_death(void); -void bhv_bully_loop(void); -void big_bully_spawn_minion(s32 x, s32 y, s32 z, s16 ry); -void bhv_big_bully_with_minions_init(void); -void big_bully_spawn_star(void); -void bhv_big_bully_with_minions_loop(void); -f32 water_ring_calc_mario_dist(void); -void water_ring_init(void); -void bhv_jet_stream_water_ring_init(void); -void water_ring_check_collection(f32 avgScale, struct Object *ringManager); -void water_ring_set_scale(f32 avgScale); -void water_ring_act_collected(void); -void water_ring_act_not_collected(void); -void bhv_jet_stream_water_ring_loop(void); -void spawn_manta_ray_ring_manager(void); /* unused */ -void water_ring_spawner_act_inactive(void); -void bhv_jet_stream_ring_spawner_loop(void); -void bhv_manta_ray_water_ring_init(void); -void manta_water_ring_act_not_collected(void); -void bhv_manta_ray_water_ring_loop(void); -void bhv_bowser_bomb_loop(void); -void bhv_bowser_bomb_explosion_loop(void); -void bhv_bowser_bomb_smoke_loop(void); -void bhv_celebration_star_init(void); -void celeb_star_act_spin_around_mario(void); -void celeb_star_act_face_camera(void); -void bhv_celebration_star_loop(void); -void bhv_celebration_star_sparkle_loop(void); -void bhv_star_key_collection_puff_spawner_loop(void); -void bhv_lll_drawbridge_spawner_loop(void); -void bhv_lll_drawbridge_loop(void); -void bhv_small_bomp_init(void); -void bhv_small_bomp_loop(void); -void bhv_large_bomp_init(void); -void bhv_large_bomp_loop(void); -void bhv_wf_sliding_platform_init(void); -void bhv_wf_sliding_platform_loop(void); -void bhv_moneybag_init(void); -void moneybag_check_mario_collision(void); -void moneybag_jump(s16 collisionFlags); -void moneybag_act_move_around(void); -void moneybag_act_return_home(void); -void moneybag_act_disappear(void); -void moneybag_act_death(void); -void bhv_moneybag_loop(void); -void bhv_moneybag_hidden_loop(void); -void bhv_bowling_ball_init(void); -void bowling_ball_set_hitbox(void); -void bowling_ball_set_waypoints(void); -void bhv_bowling_ball_roll_loop(void); -void bhv_bowling_ball_initialize_loop(void); -void bhv_bowling_ball_loop(void); -void bhv_generic_bowling_ball_spawner_init(void); -void bhv_generic_bowling_ball_spawner_loop(void); -void bhv_thi_bowling_ball_spawner_loop(void); -void bhv_bob_pit_bowling_ball_init(void); -void bhv_bob_pit_bowling_ball_loop(void); -void bhv_free_bowling_ball_init(void); /* likely unused */ -void bhv_free_bowling_ball_roll_loop(void); /* likely unused */ -void bhv_free_bowling_ball_loop(void); /* likely unused */ -void bhv_rr_cruiser_wing_init(void); -void bhv_rr_cruiser_wing_loop(void); -void spawn_default_star(f32 x, f32 y, f32 z); +s32 current_mario_room_check(RoomData room); +s32 trigger_obj_dialog_when_facing(s32 *inDialog, s16 dialogID, f32 dist, s32 actionArg); +s32 obj_lava_death(void); +s32 debug_sequence_tracker(s16 debugInputSequence[]); +s32 obj_is_rendering_enabled(void); +s32 obj_update_race_proposition_dialog(s16 dialogID); +s32 obj_is_near_to_and_facing_mario(f32 maxDist, s16 maxAngleDiff); +s32 clamp_s16(s16 *value, s16 minimum, s16 maximum); +s32 clamp_f32(f32 *value, f32 minimum, f32 maximum); +s32 cur_obj_init_anim_and_check_if_end(s32 animIndex); +s32 cur_obj_init_anim_check_frame(s32 animIndex, s32 frame); +s32 cur_obj_set_anim_if_at_end(s32 animIndex); +s32 cur_obj_play_sound_at_anim_range(s8 startFrame1, s8 startFrame2, u32 sound); +s32 approach_f32_ptr(f32 *px, f32 target, f32 delta); +s32 obj_forward_vel_approach(f32 target, f32 delta); +s32 obj_y_vel_approach(f32 target, f32 delta); +s32 obj_move_pitch_approach(s16 target, s16 delta); +s32 obj_face_pitch_approach(s16 targetPitch, s16 deltaPitch); +s32 obj_face_yaw_approach(s16 targetYaw, s16 deltaYaw); +s32 obj_face_roll_approach(s16 targetRoll, s16 deltaRoll); +s32 obj_grow_then_shrink(f32 *scaleVel, f32 shootFireScale, f32 endScale); +s32 oscillate_toward(s32 *value, f32 *vel, s32 target, f32 velCloseToZero, f32 accel, f32 slowdown); +s32 obj_resolve_object_collisions(s32 *targetYaw); +s32 obj_bounce_off_walls_edges_objects(s32 *targetYaw); +s32 obj_resolve_collisions_and_turn(s16 targetYaw, s16 turnSpeed); +s32 obj_die_if_above_lava_and_health_non_positive(void); +s32 obj_update_standard_actions(f32 scale); +s32 obj_check_attacks(struct ObjectHitbox *hitbox, s32 attackedMarioAction); +s32 obj_move_for_one_second(s32 endAction); + +// Cross-referenced functions that don't belong in individual behavior files. +extern s32 mario_is_far_below_object(f32 min); // king_bobomb.c +extern void set_yoshi_as_not_dead(void); // yoshi.c +void create_respawner(ModelID32 model, const BehaviorScript *behToSpawn, s32 minSpawnDist); // respawner.c +void set_rolling_sphere_hitbox(void); // snowman.c +void adjust_rolling_face_pitch(f32 f12); // snowman.c +void curr_obj_random_blink(s32 *blinkTimer); // bobomb.c +void coin_collected(void); // moving_coin.c +s32 obj_begin_race(s32 noTimer); // koopa.c +void spawn_no_exit_star(f32 x, f32 y, f32 z); // spawn_star.c +void spawn_red_coin_cutscene_star(f32 x, f32 y, f32 z); // spawn_star.c #endif // OBJ_BEHAVIORS_H diff --git a/src/game/obj_behaviors_2.c b/src/game/obj_behaviors_2.c deleted file mode 100644 index 8b396b898d..0000000000 --- a/src/game/obj_behaviors_2.c +++ /dev/null @@ -1,818 +0,0 @@ -#include - -#include "sm64.h" -#include "actors/vanilla_actors/bob/header.h" -#include "actors/vanilla_actors/ccm/header.h" -#include "actors/vanilla_actors/ssl/header.h" -#include "actors/vanilla_actors/ttc/header.h" -#include "actors/vanilla_actors/rr/header.h" -#include "actors/vanilla_actors/bitdw/header.h" -#include "actors/vanilla_actors/bitfs/header.h" -#include "actors/vanilla_actors/bits/header.h" -#include "actors/vanilla_actors/vcutm/header.h" -#include "actors/common0.h" -#include "actors/group11.h" -#include "actors/group17.h" -#include "audio/external.h" -#include "behavior_actions.h" -#include "behavior_data.h" -#include "camera.h" -#include "dialog_ids.h" -#include "engine/behavior_script.h" -#include "engine/math_util.h" -#include "engine/surface_collision.h" -#include "engine/surface_load.h" -#include "game_init.h" -#include "geo_misc.h" -#include "ingame_menu.h" -#include "interaction.h" -#include "level_table.h" -#include "level_update.h" -#include "mario.h" -#include "mario_actions_cutscene.h" -#include "memory.h" -#include "obj_behaviors.h" -#include "obj_behaviors_2.h" -#include "object_constants.h" -#include "object_helpers.h" -#include "object_list_processor.h" -#include "platform_displacement.h" -#include "rendering_graph_node.h" -#include "save_file.h" -#include "seq_ids.h" -#include "spawn_sound.h" - -//! TODO: remove static - -enum ObjPositionOperation { - POS_OP_SAVE_POSITION, - POS_OP_COMPUTE_VELOCITY, - POS_OP_RESTORE_POSITION -}; - -Vec3f sObjSavedPos; - -void wiggler_jumped_on_attack_handler(void); -void huge_goomba_weakly_attacked(void); - -static s32 obj_is_rendering_enabled(void) { - if (o->header.gfx.node.flags & GRAPH_RENDER_ACTIVE) { - return TRUE; - } else { - return FALSE; - } -} - -static s16 obj_get_pitch_from_vel(void) { - return -atan2s(o->oForwardVel, o->oVelY); -} - -/** - * Show dialog proposing a race. - * If the player accepts the race, then leave time stop enabled and Mario in the - * text action so that the racing object can wait before starting the race. - * If the player declines the race, then disable time stop and allow Mario to - * move again. - */ -static s32 obj_update_race_proposition_dialog(s16 dialogID) { - s32 dialogResponse = cur_obj_update_dialog_with_cutscene(MARIO_DIALOG_LOOK_UP, - (DIALOG_FLAG_TURN_TO_MARIO | DIALOG_FLAG_TIME_STOP_ENABLED), CUTSCENE_RACE_DIALOG, dialogID); - - if (dialogResponse == DIALOG_RESPONSE_NO) { - set_mario_npc_dialog(MARIO_DIALOG_STOP); - disable_time_stop_including_mario(); - } - - return dialogResponse; -} - -static void obj_set_dist_from_home(f32 distFromHome) { - o->oPosX = o->oHomeX + distFromHome * coss(o->oMoveAngleYaw); - o->oPosZ = o->oHomeZ + distFromHome * sins(o->oMoveAngleYaw); -} - -static s32 obj_is_near_to_and_facing_mario(f32 maxDist, s16 maxAngleDiff) { - if (o->oDistanceToMario < maxDist - && abs_angle_diff(o->oMoveAngleYaw, o->oAngleToMario) < maxAngleDiff) { - return TRUE; - } - return FALSE; -} - -static void obj_perform_position_op(s32 op) { - switch (op) { - case POS_OP_SAVE_POSITION: vec3f_copy(sObjSavedPos, &o->oPosVec); break; - case POS_OP_COMPUTE_VELOCITY: vec3f_diff(&o->oVelVec, &o->oPosVec, sObjSavedPos); break; - case POS_OP_RESTORE_POSITION: vec3f_copy(&o->oPosVec, sObjSavedPos); break; - } -} - -static void cur_obj_spin_all_dimensions(f32 pitchSpeed, f32 rollSpeed) { - f32 pitch, yaw, roll; - f32 c, s; - f32 px, pz, ny, nz, nx; - - if (o->oForwardVel == 0.0f) { - roll = yaw = pitch = 0.0f; - - if (o->oMoveFlags & OBJ_MOVE_IN_AIR) { - yaw = 50.0f; - } else { - if (o->oFaceAnglePitch < 0x0) { - pitch = -pitchSpeed; - } else if (o->oFaceAnglePitch > 0x0) { - pitch = pitchSpeed; - } - - if (o->oFaceAngleRoll < 0x0) { - roll = -rollSpeed; - } else if (o->oFaceAngleRoll > 0x0) { - roll = rollSpeed; - } - } - - c = coss(o->oFaceAnglePitch); - s = sins(o->oFaceAnglePitch); - nz = pitch * c + yaw * s; - ny = yaw * c - pitch * s; - - c = coss(o->oFaceAngleRoll); - s = sins(o->oFaceAngleRoll); - nx = roll * c + ny * s; - ny = ny * c - roll * s; - - c = coss(o->oFaceAngleYaw); - s = sins(o->oFaceAngleYaw); - px = nx * c - nz * s; - nz = nz * c + nx * s; - - nx = roll * c - pitch * s; - pz = pitch * c + roll * s; - - o->oPosX = o->oHomeX - nx + px; - o->oGraphYOffset = yaw - ny; - o->oPosZ = o->oHomeZ + pz - nz; - } -} - -static void obj_rotate_yaw_and_bounce_off_walls(s16 targetYaw, s16 turnAmount) { - if (o->oMoveFlags & OBJ_MOVE_HIT_WALL) { - targetYaw = cur_obj_reflect_move_angle_off_wall(); - } - cur_obj_rotate_yaw_toward(targetYaw, turnAmount); -} - -static s16 obj_get_pitch_to_home(f32 latDistToHome) { - return atan2s(latDistToHome, o->oPosY - o->oHomeY); -} - -static void obj_compute_vel_from_move_pitch(f32 speed) { - o->oForwardVel = speed * coss(o->oMoveAnglePitch); - o->oVelY = speed * -sins(o->oMoveAnglePitch); -} - -static s32 clamp_s16(s16 *value, s16 minimum, s16 maximum) { - if (*value <= minimum) { - *value = minimum; - } else if (*value >= maximum) { - *value = maximum; - } else { - return FALSE; - } - - return TRUE; -} - -static s32 clamp_f32(f32 *value, f32 minimum, f32 maximum) { - if (*value <= minimum) { - *value = minimum; - } else if (*value >= maximum) { - *value = maximum; - } else { - return FALSE; - } - - return TRUE; -} - -static void cur_obj_init_anim_extend(s32 animIndex) { - cur_obj_init_animation_with_sound(animIndex); - cur_obj_extend_animation_if_at_end(); -} - -static s32 cur_obj_init_anim_and_check_if_end(s32 animIndex) { - cur_obj_init_animation_with_sound(animIndex); - return cur_obj_check_if_near_animation_end(); -} - -static s32 cur_obj_init_anim_check_frame(s32 animIndex, s32 frame) { - cur_obj_init_animation_with_sound(animIndex); - return cur_obj_check_anim_frame(frame); -} - -static s32 cur_obj_set_anim_if_at_end(s32 animIndex) { - if (cur_obj_check_if_at_animation_end()) { - cur_obj_init_animation_with_sound(animIndex); - return TRUE; - } - return FALSE; -} - -static s32 cur_obj_play_sound_at_anim_range(s8 startFrame1, s8 startFrame2, u32 sound) { - s32 rangeLength = o->header.gfx.animInfo.animAccel / 0x10000; - - if (rangeLength <= 0) { - rangeLength = 1; - } - - if (cur_obj_check_anim_frame_in_range(startFrame1, rangeLength) || cur_obj_check_anim_frame_in_range(startFrame2, rangeLength)) { - cur_obj_play_sound_2(sound); - return TRUE; - } - - return FALSE; -} - -static s16 obj_turn_pitch_toward_mario(f32 targetOffsetY, s16 turnAmount) { - s16 targetPitch; - - o->oPosY -= targetOffsetY; - targetPitch = obj_turn_toward_object(o, gMarioObject, O_MOVE_ANGLE_PITCH_INDEX, turnAmount); - o->oPosY += targetOffsetY; - - return targetPitch; -} - -static s32 approach_f32_ptr(f32 *px, f32 target, f32 delta) { - if (*px > target) { - delta = -delta; - } - - *px += delta; - - if ((*px - target) * delta >= 0) { - *px = target; - return TRUE; - } - return FALSE; -} - -static s32 obj_forward_vel_approach(f32 target, f32 delta) { - return approach_f32_ptr(&o->oForwardVel, target, delta); -} - -static s32 obj_y_vel_approach(f32 target, f32 delta) { - return approach_f32_ptr(&o->oVelY, target, delta); -} - -static s32 obj_move_pitch_approach(s16 target, s16 delta) { - o->oMoveAnglePitch = approach_s16_symmetric(o->oMoveAnglePitch, target, delta); - - if ((s16) o->oMoveAnglePitch == target) { - return TRUE; - } - - return FALSE; -} - -static s32 obj_face_pitch_approach(s16 targetPitch, s16 deltaPitch) { - o->oFaceAnglePitch = approach_s16_symmetric(o->oFaceAnglePitch, targetPitch, deltaPitch); - - if ((s16) o->oFaceAnglePitch == targetPitch) { - return TRUE; - } - - return FALSE; -} - -static s32 obj_face_yaw_approach(s16 targetYaw, s16 deltaYaw) { - o->oFaceAngleYaw = approach_s16_symmetric(o->oFaceAngleYaw, targetYaw, deltaYaw); - - if ((s16) o->oFaceAngleYaw == targetYaw) { - return TRUE; - } - - return FALSE; -} - -static s32 obj_face_roll_approach(s16 targetRoll, s16 deltaRoll) { - o->oFaceAngleRoll = approach_s16_symmetric(o->oFaceAngleRoll, targetRoll, deltaRoll); - - if ((s16) o->oFaceAngleRoll == targetRoll) { - return TRUE; - } - - return FALSE; -} - -static s32 obj_smooth_turn(s16 *angleVel, s32 *angle, s16 targetAngle, f32 targetSpeedProportion, - s16 accel, s16 minSpeed, s16 maxSpeed) { - s16 currentSpeed; - s16 currentAngle = (s16)(*angle); - - *angleVel = approach_s16_symmetric(*angleVel, (targetAngle - currentAngle) * targetSpeedProportion, accel); - - currentSpeed = abss(*angleVel); - clamp_s16(¤tSpeed, minSpeed, maxSpeed); - - *angle = approach_angle(*angle, targetAngle, currentSpeed); - return (s16)(*angle) == targetAngle; -} - -static void obj_roll_to_match_yaw_turn(s16 targetYaw, s16 maxRoll, s16 rollSpeed) { - s16 targetRoll = o->oMoveAngleYaw - targetYaw; - clamp_s16(&targetRoll, -maxRoll, maxRoll); - obj_face_roll_approach(targetRoll, rollSpeed); -} - -static s16 random_linear_offset(s16 base, s16 range) { - return base + (s16)(range * random_float()); -} - -static s16 random_mod_offset(s16 base, s16 step, s16 mod) { - return base + step * (random_u16() % mod); -} - -static s16 obj_random_fixed_turn(s16 delta) { - return o->oMoveAngleYaw + (s16) random_sign() * delta; -} - -/** - * Begin by increasing the object's scale by *scaleVel, and slowly decreasing - * scaleVel. Once the object starts to shrink, wait a bit, and then begin to - * scale the object toward endScale. The first time it reaches below - * shootFireScale during this time, return 1. - * Return -1 once it's reached endScale. - */ -static s32 obj_grow_then_shrink(f32 *scaleVel, f32 shootFireScale, f32 endScale) { - if (o->oTimer < 2) { - o->header.gfx.scale[0] += *scaleVel; - - if ((*scaleVel -= 0.01f) > -0.03f) { - o->oTimer = 0; - } - } else if (o->oTimer > 10) { - if (approach_f32_ptr(&o->header.gfx.scale[0], endScale, 0.05f)) { - return -1; - } else if (*scaleVel != 0.0f && o->header.gfx.scale[0] < shootFireScale) { - *scaleVel = 0.0f; - return 1; - } - } - - return 0; -} - -static s32 oscillate_toward(s32 *value, f32 *vel, s32 target, f32 velCloseToZero, f32 accel, f32 slowdown) { - s32 startValue = *value; - *value += (s32) *vel; - - if (*value == target - || ((*value - target) * (startValue - target) < 0 && *vel > -velCloseToZero - && *vel < velCloseToZero)) { - *value = target; - *vel = 0.0f; - return TRUE; - } else { - if (*value >= target) { - accel = -accel; - } - if (*vel * accel < 0.0f) { - accel *= slowdown; - } - - *vel += accel; - } - - return FALSE; -} - -static void obj_update_blinking(s32 *blinkTimer, s16 baseCycleLength, s16 cycleLengthRange, - s16 blinkLength) { - if (*blinkTimer != 0) { - (*blinkTimer)--; - } else { - *blinkTimer = random_linear_offset(baseCycleLength, cycleLengthRange); - } - - if (*blinkTimer > blinkLength) { - o->oAnimState = OBJ_BLINKING_ANIM_STATE_EYES_OPEN; - } else { - o->oAnimState = OBJ_BLINKING_ANIM_STATE_EYES_CLOSED; - } -} - -static s32 obj_resolve_object_collisions(s32 *targetYaw) { - struct Object *otherObject; - f32 dx, dz; - s16 angle; - f32 radius, otherRadius, relativeRadius; - - if (o->numCollidedObjs != 0) { - s32 i; - for (i = 0; i < o->numCollidedObjs; i++) { - otherObject = o->collidedObjs[i]; - if (otherObject == gMarioObject) continue; - if (otherObject->oInteractType & INTERACT_MASK_NO_OBJ_COLLISIONS) continue; - - dx = o->oPosX - otherObject->oPosX; - dz = o->oPosZ - otherObject->oPosZ; - - radius = o->hurtboxRadius > 0 ? o->hurtboxRadius : o->hitboxRadius; - otherRadius = otherObject->hurtboxRadius > 0 ? otherObject->hurtboxRadius : otherObject->hitboxRadius; - relativeRadius = radius + otherRadius; - - if ((sqr(dx) + sqr(dz)) > sqr(relativeRadius)) continue; - angle = atan2s(dz, dx); - o->oPosX = otherObject->oPosX + (relativeRadius * sins(angle)); - o->oPosZ = otherObject->oPosZ + (relativeRadius * coss(angle)); - - if (targetYaw != NULL && abs_angle_diff(o->oMoveAngleYaw, angle) < 0x4000) { - *targetYaw = (s16)(angle - o->oMoveAngleYaw + angle + 0x8000); - return TRUE; - } - } - } - - return FALSE; -} - -static s32 obj_bounce_off_walls_edges_objects(s32 *targetYaw) { - if (o->oMoveFlags & OBJ_MOVE_HIT_WALL) { - *targetYaw = cur_obj_reflect_move_angle_off_wall(); - } else if (o->oMoveFlags & OBJ_MOVE_HIT_EDGE) { - *targetYaw = (s16)(o->oMoveAngleYaw + 0x8000); - } else if (!obj_resolve_object_collisions(targetYaw)) { - return FALSE; - } - - return TRUE; -} - -static s32 obj_resolve_collisions_and_turn(s16 targetYaw, s16 turnSpeed) { - obj_resolve_object_collisions(NULL); - - if (cur_obj_rotate_yaw_toward(targetYaw, turnSpeed)) { - return FALSE; - } else { - return TRUE; - } -} - -static void obj_die_if_health_non_positive(void) { - if (o->oHealth <= 0) { - if (o->oDeathSound == 0) { - spawn_mist_particles_with_sound(SOUND_OBJ_DEFAULT_DEATH); - } else if (o->oDeathSound > 0) { - spawn_mist_particles_with_sound(o->oDeathSound); - } else { - spawn_mist_particles(); - } - - if ((s32)o->oNumLootCoins < 0) { - spawn_object(o, MODEL_BLUE_COIN, bhvMrIBlueCoin); - } else { - obj_spawn_loot_yellow_coins(o, o->oNumLootCoins, 20.0f); - } - // This doesn't do anything - obj_spawn_loot_yellow_coins(o, o->oNumLootCoins, 20.0f); - - if (o->oHealth < 0) { - cur_obj_hide(); - cur_obj_become_intangible(); - } else { - obj_mark_for_deletion(o); - } - } -} - -UNUSED static void obj_unused_die(void) { - o->oHealth = 0; - obj_die_if_health_non_positive(); -} - -static void obj_set_knockback_action(s32 attackType) { - switch (attackType) { - case ATTACK_KICK_OR_TRIP: - case ATTACK_FAST_ATTACK: - o->oAction = OBJ_ACT_VERTICAL_KNOCKBACK; - o->oForwardVel = 20.0f; - o->oVelY = 50.0f; - break; - - default: - o->oAction = OBJ_ACT_HORIZONTAL_KNOCKBACK; - o->oForwardVel = 50.0f; - o->oVelY = 30.0f; - break; - } - - o->oFlags &= ~OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW; - o->oMoveAngleYaw = obj_angle_to_object(gMarioObject, o); -} - -static void obj_set_squished_action(void) { - cur_obj_play_sound_2(SOUND_OBJ_STOMPED); - o->oAction = OBJ_ACT_SQUISHED; -} - -static s32 obj_die_if_above_lava_and_health_non_positive(void) { - if (o->oMoveFlags & OBJ_MOVE_MASK_IN_WATER) { - if (o->oGravity + o->oBuoyancy > 0.0f - || find_water_level(o->oPosX, o->oPosZ) - o->oPosY < 10.0f) { - return FALSE; - } - obj_die_if_health_non_positive(); - return TRUE; - - } else if (o->oMoveFlags & OBJ_MOVE_ABOVE_LAVA) { - if (o->oMoveFlags & (OBJ_MOVE_ON_GROUND | OBJ_MOVE_LANDED)) { - obj_die_if_health_non_positive(); - return TRUE; - } - } - - if (o->oMoveFlags & OBJ_MOVE_ENTERED_WATER) { - if (o->oWallHitboxRadius < 200.0f) { - cur_obj_play_sound_2(SOUND_OBJ_DIVING_INTO_WATER); - } else { - cur_obj_play_sound_2(SOUND_OBJ_DIVING_IN_WATER); - } - } - - return FALSE; -} - -static s32 obj_handle_attacks(struct ObjectHitbox *hitbox, s32 attackedMarioAction, - u8 *attackHandlers) { - s32 attackType; - - obj_set_hitbox(o, hitbox); - - //! Die immediately if above lava - if (obj_die_if_above_lava_and_health_non_positive()) { - return ATTACK_HANDLER_DIE_IF_HEALTH_NON_POSITIVE; - } else if (o->oInteractStatus & INT_STATUS_INTERACTED) { - if (o->oInteractStatus & INT_STATUS_ATTACKED_MARIO) { - if (o->oAction != attackedMarioAction) { - o->oAction = attackedMarioAction; - o->oTimer = 0; - } - } else { - attackType = o->oInteractStatus & INT_STATUS_ATTACK_MASK; - - switch (attackHandlers[attackType - 1]) { - case ATTACK_HANDLER_NOP: - break; - - case ATTACK_HANDLER_DIE_IF_HEALTH_NON_POSITIVE: - obj_die_if_health_non_positive(); - break; - - case ATTACK_HANDLER_KNOCKBACK: - obj_set_knockback_action(attackType); - break; - - case ATTACK_HANDLER_SQUISHED: - obj_set_squished_action(); - break; - - case ATTACK_HANDLER_SPECIAL_KOOPA_LOSE_SHELL: - shelled_koopa_attack_handler(attackType); - break; - - case ATTACK_HANDLER_SET_SPEED_TO_ZERO: - obj_set_speed_to_zero(); - break; - - case ATTACK_HANDLER_SPECIAL_WIGGLER_JUMPED_ON: - wiggler_jumped_on_attack_handler(); - break; - - case ATTACK_HANDLER_SPECIAL_HUGE_GOOMBA_WEAKLY_ATTACKED: - huge_goomba_weakly_attacked(); - break; - - case ATTACK_HANDLER_SQUISHED_WITH_BLUE_COIN: - o->oNumLootCoins = -1; - obj_set_squished_action(); - break; - } - - o->oInteractStatus = INT_STATUS_NONE; - return attackType; - } - } - - o->oInteractStatus = INT_STATUS_NONE; - return ATTACK_HANDLER_NOP; -} - -static void obj_act_knockback(UNUSED f32 baseScale) { - cur_obj_update_floor_and_walls(); - - if (o->header.gfx.animInfo.curAnim != NULL) { - cur_obj_extend_animation_if_at_end(); - } - - //! Dies immediately if above lava - if ((o->oMoveFlags - & (OBJ_MOVE_MASK_ON_GROUND | OBJ_MOVE_MASK_IN_WATER | OBJ_MOVE_HIT_WALL | OBJ_MOVE_ABOVE_LAVA)) - || (o->oAction == OBJ_ACT_VERTICAL_KNOCKBACK && o->oTimer >= 9)) { - obj_die_if_health_non_positive(); - } - - cur_obj_move_standard(-78); -} - -static void obj_act_squished(f32 baseScale) { - f32 targetScaleY = baseScale * 0.3f; - - cur_obj_update_floor_and_walls(); - - if (o->header.gfx.animInfo.curAnim != NULL) { - cur_obj_extend_animation_if_at_end(); - } - - if (approach_f32_ptr(&o->header.gfx.scale[1], targetScaleY, baseScale * 0.14f)) { - o->header.gfx.scale[0] = o->header.gfx.scale[2] = baseScale * 2.0f - o->header.gfx.scale[1]; - - if (o->oTimer >= 16) { - obj_die_if_health_non_positive(); - } - } - - o->oForwardVel = 0.0f; - cur_obj_move_standard(-78); -} - -static s32 obj_update_standard_actions(f32 scale) { - if (o->oAction < 100) { - return TRUE; - } else { - cur_obj_become_intangible(); - - switch (o->oAction) { - case OBJ_ACT_HORIZONTAL_KNOCKBACK: - case OBJ_ACT_VERTICAL_KNOCKBACK: - obj_act_knockback(scale); - break; - - case OBJ_ACT_SQUISHED: - obj_act_squished(scale); - break; - } - - return FALSE; - } -} - -static s32 obj_check_attacks(struct ObjectHitbox *hitbox, s32 attackedMarioAction) { - s32 attackType; - - obj_set_hitbox(o, hitbox); - - //! Dies immediately if above lava - if (obj_die_if_above_lava_and_health_non_positive()) { - return ATTACK_HANDLER_DIE_IF_HEALTH_NON_POSITIVE; - } else if (o->oInteractStatus & INT_STATUS_INTERACTED) { - if (o->oInteractStatus & INT_STATUS_ATTACKED_MARIO) { - if (o->oAction != attackedMarioAction) { - o->oAction = attackedMarioAction; - o->oTimer = 0; - } - } else { - attackType = o->oInteractStatus & INT_STATUS_ATTACK_MASK; - obj_die_if_health_non_positive(); - o->oInteractStatus = INT_STATUS_NONE; - return attackType; - } - } - - o->oInteractStatus = INT_STATUS_NONE; - return ATTACK_HANDLER_NOP; -} - -static s32 obj_move_for_one_second(s32 endAction) { - cur_obj_update_floor_and_walls(); - cur_obj_extend_animation_if_at_end(); - - if (o->oTimer > 30) { - o->oAction = endAction; - return TRUE; - } - - cur_obj_move_standard(-78); - return FALSE; -} - -/** - * If we are far from home (> threshold away), then set oAngleToMario to the - * angle to home and oDistanceToMario to 25000. - * If we are close to home, but Mario is far from us (> threshold away), then - * keep oAngleToMario the same and set oDistanceToMario to 20000. - * If we are close to both home and Mario, then keep both oAngleToMario and - * oDistanceToMario the same. - * - * The point of this function is to avoid having to write extra code to get - * the object to return to home. When Mario is far away and the object is far - * from home, it could theoretically re-use the "approach Mario" logic to approach - * its home instead. - * However, most objects that use this function handle the far-from-home case - * separately anyway. - * This function causes seemingly erroneous behavior in some objects that try to - * attack Mario (e.g. fly guy shooting fire or lunging), especially when combined - * with partial updates. - */ -static void treat_far_home_as_mario(f32 threshold) { - Vec3f d; - vec3f_diff(d, &o->oHomeVec, &o->oPosVec); - - if (vec3_sumsq(d) > sqr(threshold)) { - o->oAngleToMario = atan2s(d[2], d[0]); - o->oDistanceToMario = 25000.0f; - } else { - if (!gMarioObject) { - o->oDistanceToMario = 20000.0f; - return; - } - - vec3f_diff(d, &o->oHomeVec, &gMarioObject->oPosVec); - if (vec3_sumsq(d) > sqr(threshold)) { - o->oDistanceToMario = 20000.0f; - } - } -} - -#include "behaviors/koopa.inc.c" // TODO: Text arg field name -#include "behaviors/pokey.inc.c" -#include "behaviors/swoop.inc.c" -#include "behaviors/fly_guy.inc.c" -#include "behaviors/goomba.inc.c" -#include "behaviors/chain_chomp.inc.c" // TODO: chain_chomp_sub_act_lunge documentation -#include "behaviors/wiggler.inc.c" // TODO -#include "behaviors/spiny.inc.c" -#include "behaviors/enemy_lakitu.inc.c" // TODO -#include "behaviors/cloud.inc.c" -#include "behaviors/camera_lakitu.inc.c" // TODO: 104 label, follow cam documentation -#include "behaviors/monty_mole.inc.c" // TODO -#include "behaviors/platform_on_track.inc.c" -#include "behaviors/seesaw_platform.inc.c" -#include "behaviors/ferris_wheel.inc.c" -#include "behaviors/water_bomb.inc.c" // TODO: Shadow position -#include "behaviors/ttc_rotating_solid.inc.c" -#include "behaviors/ttc_pendulum.inc.c" -#include "behaviors/ttc_treadmill.inc.c" // TODO -#include "behaviors/ttc_moving_bar.inc.c" -#include "behaviors/ttc_cog.inc.c" -#include "behaviors/ttc_pit_block.inc.c" -#include "behaviors/ttc_elevator.inc.c" -#include "behaviors/ttc_2d_rotator.inc.c" -#include "behaviors/ttc_spinner.inc.c" -#include "behaviors/mr_blizzard.inc.c" -#include "behaviors/sliding_platform_2.inc.c" -#include "behaviors/rotating_octagonal_plat.inc.c" -#include "behaviors/animated_floor_switch.inc.c" -#include "behaviors/activated_bf_plat.inc.c" -#include "behaviors/recovery_heart.inc.c" -#include "behaviors/water_bomb_cannon.inc.c" -#include "behaviors/unagi.inc.c" -#include "behaviors/dorrie.inc.c" -#include "behaviors/haunted_chair.inc.c" -#include "behaviors/mad_piano.inc.c" -#include "behaviors/flying_bookend_switch.inc.c" - -/** - * Used by bowser, fly guy, piranha plant, and fire spitters. - */ -void obj_spit_fire(s16 relativePosX, s16 relativePosY, s16 relativePosZ, f32 scale, ModelID32 model, - f32 startSpeed, f32 endSpeed, s16 movePitch) { - struct Object *obj = spawn_object_relative_with_scale(MOVING_FLAME_BP_MOVE, relativePosX, relativePosY, relativePosZ, - scale, o, model, bhvMovingFlame); - - if (obj != NULL) { - obj->oSmallPiranhaFlameStartSpeed = startSpeed; - obj->oSmallPiranhaFlameEndSpeed = endSpeed; - obj->oSmallPiranhaFlameModel = model; - obj->oMoveAnglePitch = movePitch; - } -} - -#include "behaviors/fire_piranha_plant.inc.c" -#include "behaviors/fire_spitter.inc.c" -#include "behaviors/flame.inc.c" -#include "behaviors/snufit.inc.c" -#include "behaviors/horizontal_grindel.inc.c" -#include "behaviors/eyerok.inc.c" -#include "behaviors/klepto.inc.c" -#include "behaviors/bird.inc.c" -#include "behaviors/racing_penguin.inc.c" -#include "behaviors/coffin.inc.c" -#include "behaviors/clam.inc.c" -#include "behaviors/skeeter.inc.c" -#include "behaviors/swing_platform.inc.c" -#include "behaviors/donut_platform.inc.c" -#include "behaviors/ddd_pole.inc.c" -#include "behaviors/reds_star_marker.inc.c" -#include "behaviors/triplet_butterfly.inc.c" -#include "behaviors/bubba.inc.c" diff --git a/src/game/obj_behaviors_2.h b/src/game/obj_behaviors_2.h deleted file mode 100644 index b136a4820d..0000000000 --- a/src/game/obj_behaviors_2.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef OBJ_BEHAVIORS_2_H -#define OBJ_BEHAVIORS_2_H - -#include - -#include "types.h" - -enum AttackHandler { - ATTACK_HANDLER_NOP, - ATTACK_HANDLER_DIE_IF_HEALTH_NON_POSITIVE, - ATTACK_HANDLER_KNOCKBACK, - ATTACK_HANDLER_SQUISHED, - ATTACK_HANDLER_SPECIAL_KOOPA_LOSE_SHELL, - ATTACK_HANDLER_SET_SPEED_TO_ZERO, - ATTACK_HANDLER_SPECIAL_WIGGLER_JUMPED_ON, - ATTACK_HANDLER_SPECIAL_HUGE_GOOMBA_WEAKLY_ATTACKED, - ATTACK_HANDLER_SQUISHED_WITH_BLUE_COIN -}; - -void shelled_koopa_attack_handler(s32 attackType); -void obj_spit_fire(s16 relativePosX, s16 relativePosY, s16 relativePosZ, f32 scale, ModelID32 model, - f32 startSpeed, f32 endSpeed, s16 movePitch); -void obj_set_speed_to_zero(void); - -#endif // OBJ_BEHAVIORS_2_H diff --git a/src/game/object_helpers.c b/src/game/object_helpers.c index 82435a4f63..ea35bfb512 100644 --- a/src/game/object_helpers.c +++ b/src/game/object_helpers.c @@ -1767,29 +1767,6 @@ void bhv_dust_smoke_loop(void) { o->oSmokeTimer++; } -s32 cur_obj_set_direction_table(s8 *pattern) { - o->oToxBoxMovementPattern = pattern; - o->oToxBoxMovementStep = 0; - - return *(s8 *) o->oToxBoxMovementPattern; -} - -s32 cur_obj_progress_direction_table(void) { - s8 action; - s8 *pattern = o->oToxBoxMovementPattern; - s32 nextStep = o->oToxBoxMovementStep + 1; - - if (pattern[nextStep] != -1) { - action = pattern[nextStep]; - o->oToxBoxMovementStep++; - } else { - action = pattern[0]; - o->oToxBoxMovementStep = 0; - } - - return action; -} - void cur_obj_scale_over_time(s32 axis, s32 times, f32 start, f32 end) { f32 scale = ((end - start) * ((f32) o->oTimer / times)) + start; diff --git a/src/game/object_helpers.h b/src/game/object_helpers.h index f6858b8ab9..0efaeb3fa8 100644 --- a/src/game/object_helpers.h +++ b/src/game/object_helpers.h @@ -5,6 +5,27 @@ #include "macros.h" #include "types.h" +#include "object_list_processor.h" +#include "obj_behaviors.h" +#include "behavior_actions.h" + +extern struct Surface *sObjFloor; + +// enums for obj_perform_position_op +enum ObjPositionOperation { + POS_OP_SAVE_POSITION, + POS_OP_COMPUTE_VELOCITY, + POS_OP_RESTORE_POSITION +}; + +enum ObjCollisionFlags { + OBJ_COL_FLAGS_NONE = (0 << 0), + OBJ_COL_FLAG_GROUNDED = (1 << 0), + OBJ_COL_FLAG_HIT_WALL = (1 << 1), + OBJ_COL_FLAG_UNDERWATER = (1 << 2), + OBJ_COL_FLAG_NO_Y_VEL = (1 << 3), + OBJ_COL_FLAGS_LANDED = (OBJ_COL_FLAG_GROUNDED | OBJ_COL_FLAG_NO_Y_VEL) +}; // used for chain chomp and wiggler struct ChainSegment { @@ -52,6 +73,18 @@ struct SpawnParticlesInfo { /*0x10*/ f32 sizeRange; }; +enum AttackHandler { + ATTACK_HANDLER_NOP, + ATTACK_HANDLER_DIE_IF_HEALTH_NON_POSITIVE, + ATTACK_HANDLER_KNOCKBACK, + ATTACK_HANDLER_SQUISHED, + ATTACK_HANDLER_SPECIAL_KOOPA_LOSE_SHELL, + ATTACK_HANDLER_SET_SPEED_TO_ZERO, + ATTACK_HANDLER_SPECIAL_WIGGLER_JUMPED_ON, + ATTACK_HANDLER_SPECIAL_HUGE_GOOMBA_WEAKLY_ATTACKED, + ATTACK_HANDLER_SQUISHED_WITH_BLUE_COIN +}; + enum GeoUpdateLayerTransparencyModes { GEO_TRANSPARENCY_MODE_NORMAL = 0, GEO_TRANSPARENCY_MODE_NO_DITHER = 10, @@ -200,6 +233,10 @@ void obj_translate_xz_random(struct Object *obj, f32 rangeLength); void cur_obj_set_pos_via_transform(void); void cur_obj_spawn_particles(struct SpawnParticlesInfo *info); s32 cur_obj_reflect_move_angle_off_wall(void); +void shelled_koopa_attack_handler(s32 attackType); +void obj_spit_fire(s16 relativePosX, s16 relativePosY, s16 relativePosZ, f32 scale, ModelID32 model, + f32 startSpeed, f32 endSpeed, s16 movePitch); +void obj_set_speed_to_zero(void); #define WAYPOINT_FLAGS_END -1 #define WAYPOINT_FLAGS_NONE 0 @@ -278,4 +315,63 @@ void cur_obj_spawn_loot_blue_coin(void); void cur_obj_spawn_star_at_y_offset(f32 targetX, f32 targetY, f32 targetZ, f32 offsetY); +// exposed functions from obj_behaviors +s16 object_step(void); +s16 object_step_without_floor_orient(void); + +// migrated from obj_behaviors_2.h +s32 obj_is_rendering_enabled(void); +s16 obj_get_pitch_from_vel(void); +s32 obj_update_race_proposition_dialog(s16 dialogID); +void obj_set_dist_from_home(f32 distFromHome); +s32 obj_is_near_to_and_facing_mario(f32 maxDist, s16 maxAngleDiff); +void obj_perform_position_op(s32 op); +void cur_obj_spin_all_dimensions(f32 pitchSpeed, f32 rollSpeed); +void obj_rotate_yaw_and_bounce_off_walls(s16 targetYaw, s16 turnAmount); +s16 obj_get_pitch_to_home(f32 latDistToHome); +void obj_compute_vel_from_move_pitch(f32 speed); +s32 clamp_s16(s16 *value, s16 minimum, s16 maximum); +s32 clamp_f32(f32 *value, f32 minimum, f32 maximum); +void cur_obj_init_anim_extend(s32 animIndex); +s32 cur_obj_init_anim_and_check_if_end(s32 animIndex); +s32 cur_obj_init_anim_check_frame(s32 animIndex, s32 frame); +s32 cur_obj_set_anim_if_at_end(s32 animIndex); +s32 cur_obj_play_sound_at_anim_range(s8 startFrame1, s8 startFrame2, u32 sound); +s16 obj_turn_pitch_toward_mario(f32 targetOffsetY, s16 turnAmount); +s32 approach_f32_ptr(f32 *px, f32 target, f32 delta); +s32 obj_forward_vel_approach(f32 target, f32 delta); +s32 obj_y_vel_approach(f32 target, f32 delta); +s32 obj_move_pitch_approach(s16 target, s16 delta); +s32 obj_face_pitch_approach(s16 targetPitch, s16 deltaPitch); +s32 obj_face_yaw_approach(s16 targetYaw, s16 deltaYaw); +s32 obj_face_roll_approach(s16 targetRoll, s16 deltaRoll); +s32 obj_smooth_turn(s16 *angleVel, s32 *angle, s16 targetAngle, f32 targetSpeedProportion, + s16 accel, s16 minSpeed, s16 maxSpeed); +void obj_roll_to_match_yaw_turn(s16 targetYaw, s16 maxRoll, s16 rollSpeed); +s16 random_linear_offset(s16 base, s16 range); +s16 random_mod_offset(s16 base, s16 step, s16 mod); +s16 obj_random_fixed_turn(s16 delta); +s32 obj_grow_then_shrink(f32 *scaleVel, f32 shootFireScale, f32 endScale); +s32 oscillate_toward(s32 *value, f32 *vel, s32 target, f32 velCloseToZero, f32 accel, f32 slowdown); +void obj_update_blinking(s32 *blinkTimer, s16 baseCycleLength, s16 cycleLengthRange, s16 blinkLength); +s32 obj_resolve_object_collisions(s32 *targetYaw); +s32 obj_bounce_off_walls_edges_objects(s32 *targetYaw); +s32 obj_resolve_collisions_and_turn(s16 targetYaw, s16 turnSpeed); +void obj_die_if_health_non_positive(void); +void obj_unused_die(void); +void obj_set_knockback_action(s32 attackType); +void obj_set_squished_action(void); +s32 obj_die_if_above_lava_and_health_non_positive(void); +s32 obj_handle_attacks(struct ObjectHitbox *hitbox, s32 attackedMarioAction, u8 *attackHandlers); +void obj_act_knockback(UNUSED f32 baseScale); +void obj_act_squished(f32 baseScale); +s32 obj_update_standard_actions(f32 scale); +s32 obj_check_attacks(struct ObjectHitbox *hitbox, s32 attackedMarioAction); +s32 obj_move_for_one_second(s32 endAction); +void treat_far_home_as_mario(f32 threshold); + + +// migrated from obj_behaviors.h +void spawn_default_star(f32 x, f32 y, f32 z); + #endif // OBJECT_HELPERS_H diff --git a/src/game/particles.c b/src/game/particles.c new file mode 100644 index 0000000000..e258e78312 --- /dev/null +++ b/src/game/particles.c @@ -0,0 +1,53 @@ +#include +#include "types.h" + +#include "behavior_data.h" +#include "object_helpers.h" +#include "spawn_object.h" + +// not in behavior file +static struct SpawnParticlesInfo sMistParticles = { + /* behParam: */ 2, + /* count: */ 20, + /* model: */ MODEL_MIST, + /* offsetY: */ 0, + /* forwardVelBase: */ 40, + /* forwardVelRange: */ 5, + /* velYBase: */ 30, + /* velYRange: */ 20, + /* gravity: */ 252, + /* dragStrength: */ 30, + /* sizeBase: */ 330.0f, + /* sizeRange: */ 10.0f, +}; + +// generate_wind_puffs/dust (something like that) +void spawn_mist_particles_variable(s32 count, s32 offsetY, f32 size) { + sMistParticles.sizeBase = size; + sMistParticles.sizeRange = size / 20.0f; + sMistParticles.offsetY = offsetY; + + if (count == 0) { + sMistParticles.count = 20; + } else if (count > 20) { + sMistParticles.count = count; + } else { + sMistParticles.count = 4; + } + + cur_obj_spawn_particles(&sMistParticles); +} + +// n is the number of objects to spawn, r if the rate of change of phase (frequency?) +void spawn_sparkle_particles(s32 n, s32 radius, s32 height, s32 r) { + static s16 spawnSparkleParticleAngle = 0x0; + s32 i; + s16 separation = 0x10000 / n; // Evenly spread around a circle + + for (i = 0; i < n; i++) { + spawn_object_relative(OBJ_BP_NONE, sins(spawnSparkleParticleAngle + i * separation) * radius, (i + 1) * height, + coss(spawnSparkleParticleAngle + i * separation) * radius, o, MODEL_NONE, bhvSparkleSpawn); + } + + spawnSparkleParticleAngle += r * 0x100; +} diff --git a/src/game/platform_displacement.c b/src/game/platform_displacement.c index 9ec266ef91..f6b1052d49 100644 --- a/src/game/platform_displacement.c +++ b/src/game/platform_displacement.c @@ -3,7 +3,7 @@ #include "engine/math_util.h" #include "engine/surface_collision.h" #include "level_update.h" -#include "object_fields.h" +#include "global_object_fields.h" #include "object_helpers.h" #include "object_list_processor.h" #include "platform_displacement.h" diff --git a/src/game/spawn_object.c b/src/game/spawn_object.c index 7962459feb..d113991641 100644 --- a/src/game/spawn_object.c +++ b/src/game/spawn_object.c @@ -7,7 +7,7 @@ #include "engine/surface_collision.h" #include "level_table.h" #include "object_constants.h" -#include "object_fields.h" +#include "global_object_fields.h" #include "object_helpers.h" #include "object_list_processor.h" #include "spawn_object.h" diff --git a/src/menu/file_select.c b/src/menu/file_select.c index 18e36dd507..637f0bbd4e 100644 --- a/src/menu/file_select.c +++ b/src/menu/file_select.c @@ -28,6 +28,20 @@ * special menu messages and phases, button states and button clicked checks. */ +/* Main Menu Button */ +#define /*0x0F4*/ oMenuButtonState OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oMenuButtonTimer OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ O_MENU_BUTTON_ORIG_POS_INDEX 0x1D +#define /*0x0FC*/ O_MENU_BUTTON_ORIG_POS_X_INDEX (O_MENU_BUTTON_ORIG_POS_INDEX + 0) // 0x1D +#define /*0x100*/ O_MENU_BUTTON_ORIG_POS_Y_INDEX (O_MENU_BUTTON_ORIG_POS_INDEX + 1) // 0x1E +#define /*0x104*/ O_MENU_BUTTON_ORIG_POS_Z_INDEX (O_MENU_BUTTON_ORIG_POS_INDEX + 2) // 0x1F +#define /*0x0FC*/ oMenuButtonOrigPosVec OBJECT_FIELD_F32(O_MENU_BUTTON_ORIG_POS_INDEX) +#define /*0x0FC*/ oMenuButtonOrigPosX OBJECT_FIELD_F32(O_MENU_BUTTON_ORIG_POS_X_INDEX) +#define /*0x100*/ oMenuButtonOrigPosY OBJECT_FIELD_F32(O_MENU_BUTTON_ORIG_POS_Y_INDEX) +#define /*0x104*/ oMenuButtonOrigPosZ OBJECT_FIELD_F32(O_MENU_BUTTON_ORIG_POS_Z_INDEX) +#define /*0x108*/ oMenuButtonScale OBJECT_FIELD_F32(0x20) +#define /*0x10C*/ oMenuButtonActionPhase OBJECT_FIELD_S32(0x21) + // Amount of main menu buttons defined in the code called by spawn_object_rel_with_rot. // See file_select.h for the names in MenuButtonTypes. static struct Object *sMainMenuButtons[MENU_BUTTON_OPTION_MAX]; diff --git a/src/menu/star_select.c b/src/menu/star_select.c index 07dd9af4e4..37b4bb68ec 100644 --- a/src/menu/star_select.c +++ b/src/menu/star_select.c @@ -26,6 +26,11 @@ * strings, act values, and star selector model rendering if a star is collected or not. */ +/* Star Selector Object Fields */ +#define /*0x0F4*/ oStarSelectorType OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oStarSelectorTimer OBJECT_FIELD_S32(0x1C) +#define /*0x108*/ oStarSelectorSize OBJECT_FIELD_F32(0x20) + // Star Selector count models printed in the act selector menu. static struct Object *sStarSelectorModels[8];