diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index b5595d180e0..5e178520989 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -4,7 +4,7 @@ on: jobs: cpp_lint: - name: Format and lint + name: C format and lint runs-on: ubuntu-latest steps: - name: Checkout diff --git a/.github/workflows/python.yaml b/.github/workflows/python.yaml new file mode 100644 index 00000000000..f312dedc497 --- /dev/null +++ b/.github/workflows/python.yaml @@ -0,0 +1,24 @@ +name: Python Formatting & Linting +on: + pull_request: + +jobs: + py_format: + name: black formatting + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install black + - name: Run black + run: | + black . --check diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index a321648bfef..a29e1c2fdbc 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -12,9 +12,9 @@ }, "includePath": [ "${workspaceFolder}/include", - "${workspaceFolder}/ver/us/build/include", + "${workspaceFolder}/ver/pal/build/include", "${workspaceFolder}/src", - "${workspaceFolder}/assets/us" + "${workspaceFolder}/assets/pal" ], "defines": [ "F3DEX_GBI_2", diff --git a/.vscode/settings.json b/.vscode/settings.json index f141d82e68f..8ed6ebd1023 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -25,7 +25,9 @@ "docs/doxygen": true, "expected": true, "ver/jp/expected": true, - "ver/us/expected": true + "ver/us/expected": true, + "ver/pal/expected": true, + "ver/ique/expected": true }, "python.autoComplete.extraPaths": [ "./tools" @@ -47,6 +49,7 @@ "*.h": "c", }, "C_Cpp.autoAddFileAssociations": false, + "C_Cpp.default.cStandard": "c89", "files.exclude": { "**/.git": true, "**/.splat_cache": true, @@ -56,7 +59,14 @@ "**/*.i": true, "docs/doxygen": true }, - "C_Cpp.default.cStandard": "c89", - "python.linting.mypyEnabled": true, - "python.linting.enabled": true, + "[python]": { + "editor.formatOnType": true, + "editor.wordBasedSuggestions": false, + "editor.formatOnSave": true, + "editor.formatOnSaveMode": "modifications", + "editor.defaultFormatter": "ms-python.black-formatter", + }, + "black-formatter.args": [ + "-l 120" + ], } diff --git a/coverage.py b/coverage.py index 8ae0f8336e1..9fd41f1a41a 100755 --- a/coverage.py +++ b/coverage.py @@ -5,33 +5,36 @@ import sys from pathlib import Path + def strip_c_comments(text): def replacer(match): s = match.group(0) - if s.startswith('/'): + if s.startswith("/"): return " " else: return s + pattern = re.compile( r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"', - re.DOTALL | re.MULTILINE + re.DOTALL | re.MULTILINE, ) return re.sub(pattern, replacer, text) -c_func_pattern = re.compile( - r"^(static\s+)?[^\s]+\s+([^\s(]+)\(([^;)]*)\)[^;]+{", - re.MULTILINE -) + +c_func_pattern = re.compile(r"^(static\s+)?[^\s]+\s+([^\s(]+)\(([^;)]*)\)[^;]+{", re.MULTILINE) + + def funcs_in_c(text): return (match.group(2) for match in c_func_pattern.finditer(text)) -asm_func_pattern = re.compile( - r"INCLUDE_ASM\([^,]+, [^,]+, ([^,)]+)", - re.MULTILINE -) + +asm_func_pattern = re.compile(r"INCLUDE_ASM\([^,]+, [^,]+, ([^,)]+)", re.MULTILINE) + + def include_asms_in_c(text): return (match.group(1) for match in asm_func_pattern.finditer(text)) + def stuff(version): DIR = os.path.dirname(__file__) NONMATCHINGS_DIR = Path(os.path.join(DIR, "ver", version, "asm", "nonmatchings")) @@ -76,6 +79,7 @@ def stuff(version): if not os.listdir(folder[0]): os.removedirs(folder[0]) + stuff("jp") stuff("us") stuff("pal") diff --git a/diff_evt.py b/diff_evt.py index 5cfc78d9aba..6a2abff44f9 100755 --- a/diff_evt.py +++ b/diff_evt.py @@ -13,9 +13,7 @@ from old.update_evts import parse_symbol_addrs from tools.disasm_script import ScriptDisassembler, get_constants -parser = argparse.ArgumentParser( - description="Diff EVT macros." -) +parser = argparse.ArgumentParser(description="Diff EVT macros.") parser.add_argument( "start", @@ -26,21 +24,13 @@ "-w", "--watch", action="store_true", - help="Watch for file changes and update the diff automatically." + help="Watch for file changes and update the diff automatically.", ) -parser.add_argument( - "-m", - "--make", - action="store_true", - help="Run ninja automatically." -) +parser.add_argument("-m", "--make", action="store_true", help="Run ninja automatically.") + +parser.add_argument("-o", action="store_true", help="Ignored for compatibility with diff.py.") -parser.add_argument( - "-o", - action="store_true", - help="Ignored for compatibility with diff.py." -) class EvtDisplay(Display): def __init__(self, start): @@ -106,11 +96,13 @@ def run_diff(self): refresh_key = (current, target) return (output, refresh_key) -class FakeConfig(): + +class FakeConfig: def __init__(self, args): self.make = args.make self.source_extensions = ["c", "h"] + def run_ninja(): return subprocess.run( ["ninja", "ver/current/build/papermario.z64"], @@ -118,6 +110,7 @@ def run_ninja(): stdout=subprocess.PIPE, ) + def main(): args = parser.parse_args() get_constants() @@ -153,8 +146,7 @@ def main(): ret = run_ninja() if ret.returncode != 0: display.update( - ret.stderr.decode("utf-8-sig", "replace") - or ret.stdout.decode("utf-8-sig", "replace"), + ret.stderr.decode("utf-8-sig", "replace") or ret.stdout.decode("utf-8-sig", "replace"), error=True, ) continue @@ -164,5 +156,6 @@ def main(): else: display.run_sync() + if __name__ == "__main__": main() diff --git a/first_diff.py b/first_diff.py index 5f891a0b689..e2c77289690 100755 --- a/first_diff.py +++ b/first_diff.py @@ -22,7 +22,7 @@ action="store", default=False, const="prompt", - help="run diff.py on the result with the provided arguments" + help="run diff.py on the result with the provided arguments", ) parser.add_argument( "-m", "--make", help="run ninja before finding difference(s)", action="store_true" @@ -101,7 +101,9 @@ def search_rom_address(target_addr): continue if rom > target_addr: - return f"{prev_sym} (RAM 0x{prev_ram:X}, ROM 0x{prev_rom:X}, {prev_file})" + return ( + f"{prev_sym} (RAM 0x{prev_ram:X}, ROM 0x{prev_rom:X}, {prev_file})" + ) prev_ram = ram prev_rom = rom @@ -214,9 +216,7 @@ def hexbytes(bs): if len(found_instr_diff) > 0: for i in found_instr_diff: print(f"Instruction difference at ROM addr 0x{i:X}, {search_rom_address(i)}") - print( - f"Bytes: {hexbytes(mybin[i : i + 4])} vs {hexbytes(basebin[i : i + 4])}" - ) + print(f"Bytes: {hexbytes(mybin[i : i + 4])} vs {hexbytes(basebin[i : i + 4])}") print() definite_shift = diffs > shift_cap diff --git a/include/common_structs.h b/include/common_structs.h index e8dba3950e9..09868bda652 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -219,7 +219,7 @@ typedef struct Npc { /* 0x010 */ f32 planarFlyDist; /* also used for speech, temp0? */ /* 0x014 */ f32 jumpScale; /* also used for speech, temp1? */ /* 0x018 */ f32 moveSpeed; - /* 0x01C */ f32 jumpVelocity; + /* 0x01C */ f32 jumpVel; /* 0x020 */ union { void* any; NpcMotionBlur* motion; ///< Null unless flag 0x100000 is set. @@ -230,21 +230,21 @@ typedef struct Npc { s32* keepAwayStarted; } blur; /* 0x024 */ s32 spriteInstanceID; - /* 0x028 */ AnimID currentAnim; + /* 0x028 */ AnimID curAnim; /* 0x02C */ s32 animNotifyValue; /* 0x030 */ f32 animationSpeed; /* 0x034 */ f32 renderYaw; /* 0x038 */ Vec3f pos; - /* 0x044 */ Vec3f rotation; - /* 0x050 */ f32 rotationPivotOffsetY; + /* 0x044 */ Vec3f rot; + /* 0x050 */ f32 rotPivotOffsetY; /* 0x054 */ Vec3f scale; /* 0x060 */ Vec3f moveToPos; /* 0x06C */ Vec3f colliderPos; /* used during collision with player */ /* 0x078 */ s32 shadowIndex; /* 0x07C */ f32 shadowScale; /* 0x080 */ s32 collisionChannel; /* flags used with collision tracing */ - /* 0x084 */ s16 currentFloor; /* colliderID */ - /* 0x086 */ s16 currentWall; /* colliderID */ + /* 0x084 */ s16 curFloor; /* colliderID */ + /* 0x086 */ s16 curWall; /* colliderID */ /* 0x088 */ s16 isFacingAway; /* 0x08A */ s16 yawCamOffset; /* 0x08C */ s16 turnAroundYawAdjustment; @@ -318,7 +318,7 @@ typedef struct PlayerData { /* 0x00F */ u8 starPieces; /* 0x010 */ s8 starPoints; /* 0x011 */ char unk_11; - /* 0x012 */ s8 currentPartner; + /* 0x012 */ s8 curPartner; /* 0x013 */ char unk_13; /* 0x014 */ struct PartnerData partners[12]; /* 0x074 */ s16 keyItems[32]; @@ -326,7 +326,7 @@ typedef struct PlayerData { /* 0x1B4 */ s16 invItems[10]; /* 0x1C8 */ s16 storedItems[32]; /* 0x208 */ s16 equippedBadges[64]; - /* 0x288 */ char unk_288; + /* 0x288 */ s8 unk_288; /* 0x289 */ s8 merleeSpellType; /* 0x28A */ s8 merleeCastsLeft; /* 0x28B */ char unk_28B; @@ -418,15 +418,10 @@ typedef struct TriggerBlueprint { /* 0x1C */ s32* itemList; } TriggerBlueprint; // size = 0x20 -typedef union X32 { - s32 s; - f32 f; -} X32; - typedef struct Evt { /* 0x000 */ u8 stateFlags; - /* 0x001 */ u8 currentArgc; - /* 0x002 */ u8 currentOpcode; + /* 0x001 */ u8 curArgc; + /* 0x002 */ u8 curOpcode; /* 0x003 */ u8 priority; /* 0x004 */ u8 groupFlags; /* 0x005 */ s8 blocked; /* 1 = blocking */ @@ -477,7 +472,7 @@ typedef struct Evt { /* 0x158 */ s32 unk_158; /* 0x15C */ Bytecode* ptrFirstLine; /* 0x160 */ Bytecode* ptrSavedPos; - /* 0x164 */ Bytecode* ptrCurrentLine; + /* 0x164 */ Bytecode* ptrCurLine; } Evt; // size = 0x168 typedef Evt* ScriptList[MAX_SCRIPTS]; @@ -581,9 +576,9 @@ typedef struct Entity { /* 0x3C */ void (*renderSetupFunc)(s32); /* 0x40 */ EntityData dataBuf; /* 0x44 */ void* gfxBaseAddr; - /* 0x48 */ Vec3f position; + /* 0x48 */ Vec3f pos; /* 0x54 */ Vec3f scale; - /* 0x60 */ Vec3f rotation; + /* 0x60 */ Vec3f rot; /* 0x6C */ f32 shadowPosY; /* 0x70 */ Matrix4f inverseTransformMatrix; /* world-to-local */ /* 0xB0 */ f32 effectiveSize; @@ -618,9 +613,9 @@ typedef struct Shadow { /* 0x08 */ s16 entityModelID; /* 0x0A */ s16 vertexSegment; /* 0x0C */ Vec3s* vertexArray; - /* 0x10 */ Vec3f position; + /* 0x10 */ Vec3f pos; /* 0x1C */ Vec3f scale; - /* 0x28 */ Vec3f rotation; + /* 0x28 */ Vec3f rot; /* 0x34 */ char unk_34[0x4]; /* 0x38 */ Mtx transformMatrix; } Shadow; // size = 0x78 @@ -790,15 +785,15 @@ typedef struct Camera { /* 0x048 */ Vec3f lookAt_obj; /* 0x054 */ Vec3f lookAt_obj_target; /* 0x060 */ Vec3f targetPos; - /* 0x06C */ f32 currentYaw; + /* 0x06C */ f32 curYaw; /* 0x070 */ f32 unk_70; - /* 0x074 */ f32 currentBoomYaw; - /* 0x078 */ f32 currentBoomLength; - /* 0x07C */ f32 currentYOffset; + /* 0x074 */ f32 curBoomYaw; + /* 0x078 */ f32 curBoomLength; + /* 0x07C */ f32 curYOffset; /* 0x080 */ char unk_80[4]; - /* 0x084 */ Vec3f trueRotation; - /* 0x090 */ f32 currentBlendedYawNegated; - /* 0x094 */ f32 currentPitch; + /* 0x084 */ Vec3f trueRot; + /* 0x090 */ f32 curBlendedYawNegated; + /* 0x094 */ f32 curPitch; /* 0x098 */ f32 unk_98; /* 0x09C */ f32 unk_9C; /* 0x0A0 */ Vp vp; @@ -820,7 +815,7 @@ typedef struct Camera { /* 0x212 */ s16 unk_212; /* 0x214 */ CameraUnk unk_214[4]; /* 0x444 */ CameraControlSettings* prevController; - /* 0x448 */ CameraControlSettings* currentController; + /* 0x448 */ CameraControlSettings* curController; /* 0x44C */ CamConfiguration prevConfiguration; /* 0x468 */ CamConfiguration goalConfiguration; /* 0x484 */ f32 interpAlpha; @@ -866,7 +861,7 @@ typedef struct BattleStatus { /* */ f32 varTableF[16]; /* */ void* varTablePtr[16]; /* */ }; - /* 0x048 */ s8 currentSubmenu; + /* 0x048 */ s8 curSubmenu; /* 0x049 */ s8 unk_49; /* 0x04A */ s8 unk_4A; /* 0x04B */ s8 unk_4B; @@ -938,31 +933,31 @@ typedef struct BattleStatus { /* 0x170 */ s8 nextEnemyIndex; /* (during enemy turn) who should go next */ /* 0x171 */ s8 numEnemyActors; /* 0x172 */ s16 activeEnemyActorID; /* (during enemy turn) enemy currently using their move */ - /* 0x174 */ struct Actor* currentTurnEnemy; + /* 0x174 */ struct Actor* curTurnEnemy; /* 0x178 */ s8 moveCategory; ///< 0 = jump, 1 = hammer, 5 = partner, ... /* 0x179 */ char unk_179; /* 0x17A */ s16 moveArgument; // argument provided for move; can be hammer/boots level, itemID, etc /* 0x17C */ s16 selectedMoveID; - /* 0x17E */ s16 currentAttackDamage; + /* 0x17E */ s16 curAttackDamage; /* 0x180 */ s16 lastAttackDamage; /* 0x182 */ char unk_182[2]; - /* 0x184 */ s32 currentTargetListFlags; /* set when creating a target list, also obtain from the flags field of moves */ - /* 0x188 */ s32 currentAttackElement; - /* 0x18C */ s32 currentAttackEventSuppression; - /* 0x190 */ s32 currentAttackStatus; + /* 0x184 */ s32 curTargetListFlags; /* set when creating a target list, also obtain from the flags field of moves */ + /* 0x188 */ s32 curAttackElement; + /* 0x18C */ s32 curAttackEventSuppression; + /* 0x190 */ s32 curAttackStatus; /* 0x194 */ u8 statusChance; /* 0x195 */ s8 statusDuration; /* 0x196 */ char unk_196; /* 0x197 */ s8 targetHomeIndex; /* some sort of home index used for target list construction */ /* 0x198 */ s8 powerBounceCounter; /* 0x199 */ s8 wasStatusInflicted; /* during last attack */ - /* 0x19A */ u8 currentDamageSource; + /* 0x19A */ u8 curDamageSource; /* 0x19B */ char unk_19B[5]; - /* 0x1A0 */ s16 currentTargetID; /* selected? */ - /* 0x1A2 */ s8 currentTargetPart; /* selected? */ + /* 0x1A0 */ s16 curTargetID; /* selected? */ + /* 0x1A2 */ s8 curTargetPart; /* selected? */ /* 0x1A3 */ char unk_1A3; - /* 0x1A4 */ s16 currentTargetID2; - /* 0x1A6 */ s8 currentTargetPart2; + /* 0x1A4 */ s16 curTargetID2; + /* 0x1A6 */ s8 curTargetPart2; /* 0x1A7 */ s8 battlePhase; /* 0x1A8 */ s16 attackerActorID; /* 0x1AA */ s16 unk_1AA; @@ -973,9 +968,9 @@ typedef struct BattleStatus { /* 0x1F6 */ s8 submenuStatus[24]; ///< @see enum BattleSubmenuStatus /* 0x20E */ u8 submenuMoveCount; /* 0x20F */ char unk_20F; - /* 0x210 */ s32 currentButtonsDown; - /* 0x214 */ s32 currentButtonsPressed; - /* 0x218 */ s32 currentButtonsHeld; + /* 0x210 */ s32 curButtonsDown; + /* 0x214 */ s32 curButtonsPressed; + /* 0x218 */ s32 curButtonsHeld; /* 0x21C */ s32 stickX; /* 0x220 */ s32 stickY; /* 0x224 */ s32 inputBitmask; @@ -988,7 +983,7 @@ typedef struct BattleStatus { /* 0x432 */ s8 darknessMode; /* 0x433 */ u8 unk_433; /* 0x434 */ s32* actionCmdDifficultyTable; - /* 0x438 */ struct Stage* currentStage; + /* 0x438 */ struct Stage* curStage; /* 0x43C */ struct EffectInstance* buffEffect; /* 0x440 */ u8 tattleFlags[28]; /* 0x45C */ char unk_45C[4]; @@ -1071,7 +1066,7 @@ typedef struct AnimatorNode { /* 0x04 */ struct AnimatorNode* children[32]; /* 0x84 */ Vec3f basePos; // ? /* 0x90 */ Vec3f pos; - /* 0x9C */ Vec3f rotation; + /* 0x9C */ Vec3f rot; /* 0xA8 */ Vec3f scale; /* 0xB4 */ Matrix4f mtx; /* 0xF4 */ s16 flags; @@ -1087,7 +1082,7 @@ typedef struct AnimatorNode { typedef struct AnimatorNodeBlueprint { /* 0x00 */ void* displayList; /* 0x04 */ Vec3f basePos; - /* 0x10 */ Vec3f rotation; + /* 0x10 */ Vec3f rot; /* 0x1C */ char unk_1C[0x4]; } AnimatorNodeBlueprint; // size = 0x20 @@ -1157,7 +1152,7 @@ typedef struct ItemEntity { /* 0x00 */ s32 flags; /* 0x04 */ s16 boundVar; /* 0x06 */ s16 pickupMsgFlags; - /* 0x08 */ Vec3f position; + /* 0x08 */ Vec3f pos; /* 0x14 */ struct ItemEntityPhysicsData* physicsData; /* 0x18 */ s16 itemID; /* 0x1A */ s8 state; @@ -1192,7 +1187,7 @@ typedef struct MessagePrintState { /* 0x006 */ char unk_06[2]; /* 0x008 */ s32 msgID; /* 0x00C */ u16 srcBufferPos; - /* 0x00E */ u16 currentPrintDelay; + /* 0x00E */ u16 curPrintDelay; /* 0x010 */ u8 printBuffer[1088]; // slightly larger than source buffer /* 0x450 */ s16 printBufferSize; /* 0x452 */ u16 effectFrameCounter; @@ -1209,14 +1204,14 @@ typedef struct MessagePrintState { /* 0x468 */ u8 lineCount; /* 0x469 */ char unk_469[0x3]; /* 0x46C */ s32 unk_46C; - /* 0x470 */ u8 currentAnimFrame[4]; + /* 0x470 */ u8 curAnimFrame[4]; /* 0x474 */ s16 animTimers[4]; /* 0x47C */ u8 rewindArrowAnimState; /* 0x47D */ char unk_47D[0x1]; /* 0x47E */ s16 rewindArrowCounter; /* 0x480 */ s16 rewindArrowSwingPhase; /* 0x482 */ Vec2su rewindArrowPos; - /* 0x486 */ u8 currentLine; + /* 0x486 */ u8 curLine; /* 0x487 */ u8 unkArraySize; /* 0x488 */ u16 lineEndPos[4]; /* 0x490 */ char unk_490[0x38]; @@ -1227,7 +1222,7 @@ typedef struct MessagePrintState { /* 0x4CF */ char unk_4CF[0x1]; /* 0x4D0 */ u16 cursorPosX[6]; /* 0x4DC */ u16 cursorPosY[6]; - /* 0x4E8 */ u8 currentOption; + /* 0x4E8 */ u8 curOption; /* 0x4E9 */ s8 madeChoice; /* 0x4EA */ u8 cancelOption; /* 0x4EB */ char unk_4EB[0x1]; @@ -1258,7 +1253,7 @@ typedef struct MessagePrintState { /* 0x524 */ s32 speedSoundIDB; /* 0x528 */ u16 varBufferReadPos; /* 0x52A */ s8 unk_52A; - /* 0x52B */ u8 currentImageIndex; + /* 0x52B */ u8 curImageIndex; /* 0x52C */ Vec2su varImageScreenPos; // in addition, posX=0 is taken as 'dont draw' /* 0x530 */ u8 varImgHasBorder; /* 0x531 */ u8 varImgFinalAlpha; @@ -1300,7 +1295,7 @@ typedef struct MessageDrawState { /* 0x38 */ u32 effectFlags; /* 0x3C */ u16 font; // 0 or 1 /* 0x3E */ u16 fontVariant; - /* 0x40 */ u8 currentPosX; + /* 0x40 */ u8 curPosX; /* 0x41 */ char unk_41; /* 0x42 */ u16 nextPos[2]; /* 0x46 */ s16 textStartPos[2]; // relative to textbox @@ -1387,7 +1382,7 @@ typedef struct ShopSellPriceData { } ShopSellPriceData; // size = 0xC typedef struct GameStatus { - /* 0x000 */ u32 currentButtons[4]; + /* 0x000 */ u32 curButtons[4]; /* 0x010 */ u32 pressedButtons[4]; /* bits = 1 for frame of button press */ /* 0x020 */ u32 heldButtons[4]; /* bits = 1 every 4th frame during hold */ /* 0x030 */ u32 prevButtons[4]; /* from previous frame */ @@ -1503,12 +1498,12 @@ typedef struct PushBlockGrid { } PushBlockGrid; // size = 0x1C typedef struct ItemEntityPhysicsData { - /* 0x00 */ f32 verticalVelocity; + /* 0x00 */ f32 verticalVel; /* 0x04 */ f32 gravity; /* 2 = normal, 1 = low gravity, higher values never 'settle' */ /* 0x08 */ f32 collisionRadius; - /* 0x0C */ f32 constVelocity; - /* 0x10 */ f32 velx; - /* 0x14 */ f32 velz; + /* 0x0C */ f32 constVel; + /* 0x10 */ f32 velX; + /* 0x14 */ f32 velZ; /* 0x18 */ f32 moveAngle; /* 0x1C */ s32 timeLeft; /* 0x20 */ b32 useSimplePhysics; @@ -1516,7 +1511,7 @@ typedef struct ItemEntityPhysicsData { typedef struct RenderTask { /* 0x00 */ s32 renderMode; - /* 0x04 */ s32 distance; /* value between 0 and -10k */ + /* 0x04 */ s32 dist; /* value between 0 and -10k */ /* 0x08 */ void* appendGfxArg; /* 0x0C */ void (*appendGfx)(void*); } RenderTask; // size = 0x10 @@ -1533,14 +1528,14 @@ typedef struct SelectableTarget { } SelectableTarget; // size = 0x14 typedef struct ActorPartMovement { - /* 0x00 */ Vec3f absolutePosition; + /* 0x00 */ Vec3f absolutePos; /* 0x0C */ Vec3f goalPos; /* 0x18 */ Vec3f unk_18; /* 0x24 */ f32 jumpScale; /* 0x28 */ f32 moveSpeed; /* 0x2C */ f32 unk_2C; /* 0x30 */ f32 angle; - /* 0x34 */ f32 distance; + /* 0x34 */ f32 dist; /* 0x38 */ s16 moveTime; /* 0x3A */ s16 unk_3A; /* 0x3C */ s32 unk_3C; @@ -1577,12 +1572,12 @@ typedef struct ActorPart { /* 0x14 */ Vec3s partOffset; /* 0x1A */ Vec3s visualOffset; /* 0x20 */ Vec3f partOffsetFloat; - /* 0x2C */ Vec3f absolutePosition; - /* 0x38 */ Vec3f rotation; - /* 0x44 */ Vec3s rotationPivotOffset; + /* 0x2C */ Vec3f absolutePos; + /* 0x38 */ Vec3f rot; + /* 0x44 */ Vec3s rotPivotOffset; /* 0x4A */ char unk_4A[2]; /* 0x4C */ Vec3f scale; - /* 0x58 */ Vec3f currentPos; + /* 0x58 */ Vec3f curPos; /* 0x64 */ f32 yaw; /* 0x68 */ s16 palAnimPosOffset[2]; // used by some palette animations to slightly adjust the screen position /* 0x6C */ Vec2s targetOffset; @@ -1595,7 +1590,7 @@ typedef struct ActorPart { /* 0x7C */ s32 eventFlags; /* 0x80 */ s32 elementalImmunities; // bits from Elements, i.e., ELEMENT_FIRE | ELEMENT_QUAKE /* 0x84 */ s32 spriteInstanceID; - /* 0x88 */ u32 currentAnimation; + /* 0x88 */ u32 curAnimation; /* 0x8C */ s32 animNotifyValue; /* 0x90 */ f32 animationRate; /* 0x94 */ u32* idleAnimations; @@ -1628,15 +1623,15 @@ typedef struct FontRasterSet { typedef struct CollisionStatus { /* 0x00 */ s16 pushingAgainstWall; /* FFFF = none for all below VVV */ - /* 0x02 */ s16 currentFloor; /* valid on touch */ + /* 0x02 */ s16 curFloor; /* valid on touch */ /* 0x04 */ s16 lastTouchedFloor; /* valid after jump */ /* 0x06 */ s16 floorBelow; - /* 0x08 */ s16 currentCeiling; /* valid on touching with head */ - /* 0x0A */ s16 currentInspect; /* associated with TRIGGER_WALL_PRESS_A */ + /* 0x08 */ s16 curCeiling; /* valid on touching with head */ + /* 0x0A */ s16 curInspect; /* associated with TRIGGER_WALL_PRESS_A */ /* 0x0C */ s16 unk_0C; /* associated with TRIGGER_FLAG_2000 */ /* 0x0E */ s16 unk_0E; /* associated with TRIGGER_FLAG_4000 */ /* 0x10 */ s16 unk_10; /* associated with TRIGGER_FLAG_8000 */ - /* 0x12 */ s16 currentWall; + /* 0x12 */ s16 curWall; /* 0x14 */ s16 lastWallHammered; /* valid when smashing */ /* 0x16 */ s16 touchingWallTrigger; /* 0/1 */ /* 0x18 */ s16 bombetteExploded; /* 0 = yes, FFFF = no */ @@ -1703,8 +1698,8 @@ typedef struct DecorationTable { /* 0x7FC */ s16 posX[16]; /* 0x81C */ s16 posY[16]; /* 0x83C */ s16 posZ[16]; - /* 0x85C */ s8 rotationPivotOffsetX[16]; - /* 0x86C */ s8 rotationPivotOffsetY[16]; + /* 0x85C */ s8 rotPivotOffsetX[16]; + /* 0x86C */ s8 rotPivotOffsetY[16]; /* 0x87C */ u8 rotX[16]; /* 0x88C */ u8 rotY[16]; /* 0x89C */ u8 rotZ[16]; @@ -1748,7 +1743,7 @@ typedef struct AnimatedModel { /* 0x10 */ Vec3f rot; /* 0x1C */ Vec3f scale; /* 0x28 */ Mtx mtx; - /* 0x68 */ s16* currentAnimData; + /* 0x68 */ s16* curAnimData; /* 0x6C */ char unk_6C[4]; } AnimatedModel; // size = 0x70 @@ -1768,15 +1763,15 @@ typedef struct CollisionHeader { } CollisionHeader; // size = 0x20 typedef struct ActorMovement { - /* 0x00 */ Vec3f currentPos; + /* 0x00 */ Vec3f curPos; /* 0x0C */ Vec3f goalPos; /* 0x18 */ Vec3f unk_18; /* 0x24 */ char unk_24[0x18]; /* 0x3C */ f32 acceleration; /* 0x40 */ f32 speed; - /* 0x44 */ f32 velocity; + /* 0x44 */ f32 vel; /* 0x48 */ f32 angle; - /* 0x4C */ f32 distance; + /* 0x4C */ f32 dist; /* 0x50 */ f32 flyElapsed; /* 0x54 */ char unk_11C[4]; /* 0x58 */ s16 flyTime; @@ -1785,7 +1780,7 @@ typedef struct ActorMovement { // a single link of a chain chomp's chain typedef struct ChompChain { - /* 0x00 */ Vec3f currentPos; + /* 0x00 */ Vec3f curPos; /* 0x0C */ f32 unk_0C; /* 0x10 */ f32 unk_10; /* 0x14 */ f32 gravAccel; @@ -1798,7 +1793,7 @@ typedef struct ChompChain { } ChompChain; // size = 0x30 typedef struct ActorState { // TODO: Make the first field of this an ActorMovement - /* 0x00 */ Vec3f currentPos; + /* 0x00 */ Vec3f curPos; /* 0x0C */ Vec3f goalPos; /* 0x18 */ Vec3f unk_18; /* 0x24 */ f32 unk_24; @@ -1807,9 +1802,9 @@ typedef struct ActorState { // TODO: Make the first field of this an ActorMoveme /* 0x30 */ Vec3f unk_30; /* 0x3C */ f32 acceleration; /* 0x40 */ f32 speed; - /* 0x44 */ f32 velocity; + /* 0x44 */ f32 vel; /* 0x48 */ f32 angle; - /* 0x4C */ f32 distance; + /* 0x4C */ f32 dist; /* 0x50 */ f32 bounceDivisor; /* 0x54 */ char unk_54[0x4]; /* 0x58 */ s32 animJumpRise; @@ -1843,11 +1838,11 @@ typedef struct Actor { /* 0x136 */ u8 actorType; /* 0x137 */ char unk_137; /* 0x138 */ Vec3f homePos; - /* 0x144 */ Vec3f currentPos; + /* 0x144 */ Vec3f curPos; /* 0x150 */ Vec3s headOffset; /* 0x156 */ Vec3s healthBarPos; - /* 0x15C */ Vec3f rotation; - /* 0x168 */ Vec3s rotationPivotOffset; + /* 0x15C */ Vec3f rot; + /* 0x168 */ Vec3s rotPivotOffset; /* 0x16E */ char unk_16E[2]; /* 0x170 */ Vec3f scale; /* 0x17C */ Vec3f scaleModifier; /* multiplies normal scale factors componentwise */ @@ -1862,7 +1857,7 @@ typedef struct Actor { /* 0x19B */ char unk_19B[1]; /* 0x19C */ s32 actorTypeData1[6]; /* 4 = jump sound, 5 = attack sound */ // TODO: struct /* 0x1B4 */ s16 actorTypeData1b[2]; - /* 0x1B8 */ s8 currentHP; + /* 0x1B8 */ s8 curHP; /* 0x1B9 */ s8 maxHP; /* 0x1BA */ char unk_1BA[2]; /* 0x1BC */ s8 healthFraction; /* used to render HP bar */ @@ -1950,17 +1945,17 @@ typedef struct FontData { } FontData; // size = 0x18 typedef struct SlideParams { - f32 heading; - f32 maxDescendAccel; - f32 launchVelocity; - f32 maxDescendVelocity; - f32 integrator[4]; -} SlideParams; + /* 0x00 */ f32 heading; + /* 0x04 */ f32 maxDescendAccel; + /* 0x08 */ f32 launchVel; + /* 0x0C */ f32 maxDescendVel; + /* 0x10 */ f32 integrator[4]; +} SlideParams; // size = 0x14 typedef struct PlayerStatus { /* 0x000 */ s32 flags; // PlayerStatusFlags /* 0x004 */ u32 animFlags; - /* 0x008 */ s16 currentStateTime; + /* 0x008 */ s16 curStateTime; /* 0x00A */ s8 shiverTime; /* 0x00B */ char unk_0B; /* 0x00C */ s8 peachDisguise; @@ -1971,15 +1966,15 @@ typedef struct PlayerStatus { /* 0x012 */ s16 moveFrames; /* 0x014 */ s8 enableCollisionOverlapsCheck; /* 0x015 */ s8 inputDisabledCount; /* whether the C-up menu can appear */ - /* 0x016 */ Vec3s lastGoodPosition; - /* 0x01C */ Vec3f pushVelocity; - /* 0x028 */ Vec3f position; + /* 0x016 */ Vec3s lastGoodPos; + /* 0x01C */ Vec3f pushVel; + /* 0x028 */ Vec3f pos; /* 0x034 */ Vec2f groundAnglesXZ; /* angles along X/Z axes of ground beneath player */ /* 0x03C */ VecXZf jumpFromPos; /* 0x044 */ VecXZf landPos; /* 0x04C */ f32 jumpFromHeight; /* 0x050 */ f32 jumpApexHeight; - /* 0x054 */ f32 currentSpeed; + /* 0x054 */ f32 curSpeed; /* 0x058 */ f32 walkSpeed; /* 0x05C */ f32 runSpeed; /* 0x060 */ s32 unk_60; @@ -1988,7 +1983,7 @@ typedef struct PlayerStatus { /* 0x06C */ f32 maxJumpSpeed; /* 0x070 */ f32 gravityIntegrator[4]; /* 0x080 */ f32 targetYaw; - /* 0x084 */ f32 currentYaw; + /* 0x084 */ f32 curYaw; /* 0x088 */ f32 overlapPushYaw; /* 0x08C */ f32 pitch; /* 0x090 */ f32 flipYaw[4]; @@ -2016,11 +2011,11 @@ typedef struct PlayerStatus { /* 0x0D0 */ SlideParams* slideParams; /* 0x0D4 */ f32 spinRate; /* 0x0D8 */ struct EffectInstance* specialDecorationEffect; - /* 0x0DC */ s32 currentButtons; + /* 0x0DC */ s32 curButtons; /* 0x0E0 */ s32 pressedButtons; /* 0x0E4 */ s32 heldButtons; /* 0x0E8 */ s32 stickAxis[2]; - /* 0x0F0 */ s32 currentButtonsBuffer[10]; + /* 0x0F0 */ s32 curButtonsBuffer[10]; /* 0x118 */ s32 pressedButtonsBuffer[10]; /* 0x140 */ s32 heldButtonsBuffer[10]; /* 0x168 */ s32 stickXBuffer[10]; @@ -2244,8 +2239,8 @@ typedef struct TweesterPhysics { /* 0x08 */ s32 prevFlags; ///< Partner npc flags before contact with Tweester /* 0x0C */ f32 radius; /* 0x10 */ f32 angle; - /* 0x14 */ f32 angularVelocity; - /* 0x18 */ f32 liftoffVelocityPhase; + /* 0x14 */ f32 angularVel; + /* 0x18 */ f32 liftoffVelPhase; } TweesterPhysics; // size = 0x1C typedef struct PartnerStatus { @@ -2255,7 +2250,7 @@ typedef struct PartnerStatus { /* 0x003 */ s8 actingPartner; /* 0x004 */ s16 stickX; /* 0x006 */ s16 stickY; - /* 0x008 */ s32 currentButtons; + /* 0x008 */ s32 curButtons; /* 0x00C */ s32 pressedButtons; /* 0x010 */ s32 heldButtons; /* 0x014 */ s8 inputDisabledCount; @@ -2294,7 +2289,7 @@ typedef struct VirtualEntity { /* 0x38 */ f32 moveAngle; /* 0x3C */ f32 moveSpeed; /* 0x40 */ f32 jumpGravity; - /* 0x44 */ f32 jumpVelocity; + /* 0x44 */ f32 jumpVel; /* 0x48 */ f32 moveTime; } VirtualEntity; // size = 0x4C diff --git a/include/effects.h b/include/effects.h index dd08a0a952c..d018b3b54b7 100644 --- a/include/effects.h +++ b/include/effects.h @@ -70,12 +70,12 @@ typedef struct FlowerFXData { /* 0x18 */ Vec3f scale; /* 0x24 */ Vec3f rot; /* 0x30 */ Mtx transformMtx; - /* 0x70 */ f32 velocityScaleA; - /* 0x74 */ f32 velocityScaleB; + /* 0x70 */ f32 velScaleA; + /* 0x74 */ f32 velScaleB; /* 0x78 */ f32 visibilityAmt; // when this is zero, the flower can vanish. may have once controlled alpha. /* 0x7C */ f32 unk_7C; /* 0x80 */ f32 integrator[4]; - /* 0x90 */ VecXZf velocity; + /* 0x90 */ VecXZf vel; } FlowerFXData; // size = 0x98 typedef struct CloudPuffFXData { @@ -833,7 +833,7 @@ typedef struct LightRaysFXData { /* 0x50 */ f32 unk_50; /* 0x54 */ f32 unk_54; /* 0x58 */ f32 unk_58; - /* 0x5C */ Vec3f rotation; + /* 0x5C */ Vec3f rot; /* 0x68 */ f32 unk_68; /* 0x6C */ f32 unk_6C; /* 0x70 */ Vec3f initialRot; @@ -1746,7 +1746,7 @@ typedef struct ThrowSpinyFXData { /* 0x48 */ f32 gravity; /* 0x4C */ f32 unk_4C; /* 0x50 */ f32 yaw; - /* 0x54 */ f32 rotationSpeed; + /* 0x54 */ f32 rotSpeed; /* 0x58 */ f32 xScale; /* 0x5C */ f32 yScale; /* 0x60 */ u32 state; @@ -2065,7 +2065,7 @@ typedef struct StaticStatusFXData { /* 0x18 */ f32 unk_18; /* 0x1C */ f32 unk_1C; /* 0x20 */ s32 frame; // not visible when negative - /* 0x24 */ f32 rotation; + /* 0x24 */ f32 rot; /* 0x28 */ s32 timeLeft; /* 0x2C */ s32 lifetime; /* 0x30 */ s32 alpha; @@ -2125,7 +2125,7 @@ typedef struct Effect75FXData { typedef struct FireworkRocketFXData { /* 0x00 */ s32 variation; /* 0x04 */ Vec3f pos; - /* 0x10 */ Vec3f velocity; + /* 0x10 */ Vec3f vel; /* 0x1C */ s32 timeLeft; /* 0x20 */ s32 lifeTime; /* 0x24 */ s32 r; @@ -2142,9 +2142,9 @@ typedef struct FireworkRocketFXData { /* 0x50 */ f32 rocketX[4]; /* 0x60 */ f32 rocketY[4]; /* 0x70 */ f32 rocketZ[4]; - /* 0x80 */ f32 rocketVelocityX[4]; - /* 0x90 */ f32 rocketVelocityY[4]; - /* 0xA0 */ f32 rocketVelocityZ[4]; + /* 0x80 */ f32 rocketVelX[4]; + /* 0x90 */ f32 rocketVelY[4]; + /* 0xA0 */ f32 rocketVelZ[4]; } FireworkRocketFXData; // size = 0xB0 typedef struct PeachStarBeamSpirit { @@ -2168,8 +2168,8 @@ typedef struct PeachStarBeamFXData { /* 0x34 */ s32 envA; /* 0x38 */ f32 beamScale; /* 0x3C */ s32 unk_3C; - /* 0x40 */ f32 rotationSpeed; - /* 0x44 */ f32 rotationAngle; + /* 0x40 */ f32 rotSpeed; + /* 0x44 */ f32 rotAngle; /* 0x48 */ f32 circleRadius; /* 0x4C */ Vec3f circleCenter; /* 0x58 */ f32 twinkYOffset; @@ -2207,7 +2207,7 @@ typedef struct IceShardFXData { /* 0x18 */ Color4i primCol; /* 0x28 */ Color4i envCol; /* 0x38 */ f32 scale; - /* 0x3C */ f32 rotation; + /* 0x3C */ f32 rot; /* 0x40 */ f32 angularVel; /* 0x44 */ f32 animFrame; /* 0x48 */ f32 animRate; @@ -2332,7 +2332,7 @@ typedef struct PartnerBuffFXData { typedef struct QuizmoAssistantFXData { /* 0x00 */ s32 unk_00; - /* 0x04 */ Vec3f position; + /* 0x04 */ Vec3f pos; /* 0x10 */ s32 vanishTimer; /* 0x14 */ s32 lifetime; /* 0x18 */ s32 fadeInAmt; // 0 = all-black, FF = fully-visible diff --git a/include/entity.h b/include/entity.h index c6643dab630..7d372a0fd55 100644 --- a/include/entity.h +++ b/include/entity.h @@ -74,7 +74,7 @@ typedef struct SaveBlockData { } SaveBlockData; // size = 0x20 typedef struct SwitchData { - /* 0x000 */ f32 fallVelocity; + /* 0x000 */ f32 fallVel; /* 0x004 */ f32 deltaScaleX; /* 0x008 */ f32 deltaScaleY; /* 0x00C */ char unk_0C[4]; @@ -155,7 +155,7 @@ typedef struct HeartBlockContentData { /* 0x00B */ char unk_0B; // padding? /* 0x00C */ s32 unk_0C; /* 0x010 */ s32 unk_10; - /* 0x014 */ f32 riseVelocity; + /* 0x014 */ f32 riseVel; /* 0x018 */ f32 sparkleTrailAngle; /* 0x01C */ f32 sparkleTrailRadius; /* 0x020 */ f32 bouncePhase; @@ -163,7 +163,7 @@ typedef struct HeartBlockContentData { /* 0x026 */ s16 unk_26; /* 0x028 */ f32 yawBuffer[10]; /* 0x050 */ f32 unk_50; - /* 0x054 */ f32 rotationRate; + /* 0x054 */ f32 rotRate; /* 0x058 */ Mtx unk_58; /* 0x098 */ Mtx unk_98; } HeartBlockContentData; // size = 0xD8 @@ -171,7 +171,7 @@ typedef struct HeartBlockContentData { typedef struct WoodenCrateData { /* 0x000 */ s32 itemID; /* 0x004 */ u16 globalFlagIndex; - /* 0x006 */ u8 unk_06[2]; + /* 0x006 */ u8 unk_06[2]; /* 0x008 */ Gfx** fragmentsGfx; /* 0x00C */ f32 basePosY; /* 0x010 */ s8 fragmentRebounds[36]; @@ -179,7 +179,7 @@ typedef struct WoodenCrateData { /* 0x058 */ u8 fragmentRotX[36]; // scaled to map [0,255] -> [0,360] /* 0x07C */ u8 fragmentRotY[36]; // scaled to map [0,255] -> [0,360] /* 0x0A0 */ u8 fragmentLateralSpeed[36]; // scaled to map [0,255] -> [0,25.5] - /* 0x0C4 */ f32 fragmentRotationSpeed[36]; + /* 0x0C4 */ f32 fragmentRotSpeed[36]; /* 0x154 */ f32 fragmentPosX[36]; /* 0x1E4 */ f32 fragmentPosY[36]; /* 0x274 */ f32 fragmentPosZ[36]; @@ -218,7 +218,7 @@ typedef struct BlueWarpPipeData { } BlueWarpPipeData; // size = 0x1C typedef struct SimpleSpringData { - /* 0x00 */ s32 launchVelocity; + /* 0x00 */ s32 launchVel; } SimpleSpringData; // size = 0x04 typedef struct HiddenPanelData { @@ -235,9 +235,9 @@ typedef struct HiddenPanelData { /* 0x14 */ s32 spawnedItemIndex; /* 0x18 */ Vec3i spawnedItemPos; /* 0x24 */ f32 initialY; - /* 0x28 */ f32 riseVelocity; + /* 0x28 */ f32 riseVel; /* 0x2C */ f32 riseInterpPhase; - /* 0x30 */ f32 rotationSpeed; + /* 0x30 */ f32 rotSpeed; /* 0x34 */ Matrix4f entityMatrix; /* 0x74 */ u16 modelID; /* 0x76 */ char unk_76[0x2]; @@ -252,7 +252,7 @@ typedef struct PadlockData { /* 0x00 */ f32 pushSpeed; /* 0x04 */ f32 shacklePos; /* 0x08 */ f32 fallSpeed; - /* 0x0C */ f32 rotationSpeed; + /* 0x0C */ f32 rotSpeed; /* 0x10 */ u8 blinkCounter; /* 0x11 */ s8 timer; /* 0x12 */ s8 state; @@ -269,7 +269,7 @@ typedef struct BoardedFloorData { /* 0x022 */ u8 fragmentRotX[13]; /* 0x02F */ u8 fragmentRotY[13]; /* 0x03C */ u8 fragmentLateralSpeed[13]; - /* 0x04C */ f32 fragmentRotationSpeed[13]; + /* 0x04C */ f32 fragmentRotSpeed[13]; /* 0x080 */ f32 fragmentPosX[13]; /* 0x0B4 */ f32 fragmentPosY[13]; /* 0x0E8 */ f32 fragmentPosZ[13]; @@ -284,7 +284,7 @@ typedef struct BombableRockData { /* 0x14 */ u8 fragmentRotX[6]; /* 0x1A */ u8 fragmentRotY[6]; /* 0x20 */ u8 fragmentLateralSpeed[6]; - /* 0x28 */ f32 fragmentRotationSpeed[6]; + /* 0x28 */ f32 fragmentRotSpeed[6]; /* 0x40 */ f32 fragmentPosX[6]; /* 0x58 */ f32 fragmentPosY[6]; /* 0x70 */ f32 fragmentPosZ[6]; @@ -298,7 +298,7 @@ typedef struct TweesterData { /* 0x01 */ s8 faceAnimState; /* 0x02 */ s8 faceAnimTimer; /* 0x03 */ s8 faceAnimTexOffset; - /* 0x04 */ f32 rotationSpeed; + /* 0x04 */ f32 rotSpeed; /* 0x08 */ f32 innerWhirlRotY; /* 0x0C */ f32 outerWhirlRotY; /* 0x10 */ Mtx mtxInnerWhirl; @@ -308,7 +308,7 @@ typedef struct TweesterData { /* 0x94 */ s16 outerWhirlTexOffsetX; /* 0x96 */ s16 outerWhirlTexOffsetY; /* 0x98 */ s16 frameCounter; - /* 0x9C */ s32* currentPath; + /* 0x9C */ s32* curPath; /* 0xA0 */ s32** paths; /* 0xA4 */ s16 targetX; /* 0xA6 */ s16 targetY; @@ -330,9 +330,9 @@ typedef struct StarBoxLauncherData { /* 0x0C */ f32 basePosZ; /* 0x10 */ f32 basePosY; /* 0x14 */ f32 riseSpeedPhase; - /* 0x18 */ f32 riseVelocity; - /* 0x1C */ f32 rotationZPhase; - /* 0x20 */ f32 maxRotationZ; + /* 0x18 */ f32 riseVel; + /* 0x1C */ f32 rotZPhase; + /* 0x20 */ f32 maxRotZ; } StarBoxLauncherData; // size = 0x24 typedef struct CymbalPlantData { @@ -353,7 +353,7 @@ typedef struct PinkFlowerData { typedef struct SpinningFlowerData { /* 0x00 */ s16 unk_00; /* 0x02 */ s8 state; - /* 0x04 */ Vec3f rotation; + /* 0x04 */ Vec3f rot; /* 0x10 */ s32 unk_10; /* 0x14 */ f32 spinSpeed; /* 0x18 */ s32 unk_18; diff --git a/include/npc.h b/include/npc.h index 635d50de9c1..85bd68034c3 100644 --- a/include/npc.h +++ b/include/npc.h @@ -117,7 +117,7 @@ typedef void (*FireBarCallback)(struct FireBarData*, s32); typedef struct FireBarAISettings { /* 0x00 */ Vec3i centerPos; - /* 0x0C */ s32 rotationRate; + /* 0x0C */ s32 rotRate; /* 0x10 */ s32 firstNpc; /* 0x14 */ s32 npcCount; /* 0x18 */ FireBarCallback callback; @@ -126,7 +126,7 @@ typedef struct FireBarAISettings { typedef struct FireBarData { /* 0x00 */ s32 flags; /* 0x04 */ Vec3f centerPos; - /* 0x10 */ f32 rotationRate; + /* 0x10 */ f32 rotRate; /* 0x14 */ s32 firstNpc; /* 0x18 */ s32 npcCount; /* 0x1C */ FireBarCallback callback; @@ -391,16 +391,16 @@ typedef struct EncounterStatus { /* 0x014 */ s32 songID; /* 0x018 */ s32 unk_18; /* 0x01C */ s8 numEncounters; /* number of encounters for current map (in list) */ - /* 0x01D */ s8 currentAreaIndex; - /* 0x01E */ u8 currentMapIndex; - /* 0x01F */ u8 currentEntryIndex; + /* 0x01D */ s8 curAreaIndex; + /* 0x01E */ u8 curMapIndex; + /* 0x01F */ u8 curEntryIndex; /* 0x020 */ s8 mapID; /* 0x021 */ s8 resetMapEncounterFlags; /* 0x021 */ char unk_22[2]; /* 0x024 */ s32* npcGroupList; /* 0x028 */ Encounter* encounterList[24]; - /* 0x088 */ Encounter* currentEncounter; - /* 0x08C */ Enemy* currentEnemy; + /* 0x088 */ Encounter* curEncounter; + /* 0x08C */ Enemy* curEnemy; /* 0x090 */ s32 fadeOutAmount; /* 0x094 */ s32 unk_94; /* 0x098 */ s32 fadeOutAccel; diff --git a/progress.py b/progress.py index 442c10ccd5f..33bc896cbbd 100755 --- a/progress.py +++ b/progress.py @@ -25,11 +25,7 @@ def load_latest_progress(version): version = Path("ver/current").resolve().parts[-1] - csv = ( - urlopen(f"https://papermar.io/reports/progress_{version}.csv") - .read() - .decode("utf-8") - ) + csv = urlopen(f"https://papermar.io/reports/progress_{version}.csv").read().decode("utf-8") latest = csv.split("\n")[-2] ( @@ -56,14 +52,10 @@ def load_latest_progress(version): def get_func_info(): try: - result = subprocess.run( - ["mips-linux-gnu-objdump", "-x", elf_path], stdout=subprocess.PIPE - ) + result = subprocess.run(["mips-linux-gnu-objdump", "-x", elf_path], stdout=subprocess.PIPE) nm_lines = result.stdout.decode().split("\n") except: - print( - f"Error: Could not run objdump on {elf_path} - make sure that the project is built" - ) + print(f"Error: Could not run objdump on {elf_path} - make sure that the project is built") sys.exit(1) sizes = {} @@ -135,19 +127,13 @@ def do_section_progress( section_vram_end, ): funcs = get_funcs_in_vram_range(vrams, section_vram_start, section_vram_end) - matching_size, nonmatching_size = get_funcs_sizes( - sizes, matchings, nonmatchings, restrict_to=funcs - ) + matching_size, nonmatching_size = get_funcs_sizes(sizes, matchings, nonmatchings, restrict_to=funcs) section_total_size = matching_size + nonmatching_size progress_ratio = (matching_size / section_total_size) * 100 matching_ratio = (matching_size / total_size) * 100 total_ratio = (section_total_size / total_size) * 100 - print( - f"\t{section_name}: {matching_size} matching bytes / {section_total_size} total ({progress_ratio:.2f}%)" - ) - print( - f"\t\t(matched {matching_ratio:.2f}% of {total_ratio:.2f}% total rom for {section_name})" - ) + print(f"\t{section_name}: {matching_size} matching bytes / {section_total_size} total ({progress_ratio:.2f}%)") + print(f"\t\t(matched {matching_ratio:.2f}% of {total_ratio:.2f}% total rom for {section_name})") def main(args): @@ -163,9 +149,7 @@ def main(args): nonmatching_funcs = get_nonmatching_funcs() matching_funcs = all_funcs - nonmatching_funcs - matching_size, nonmatching_size = get_funcs_sizes( - sizes, matching_funcs, nonmatching_funcs - ) + matching_size, nonmatching_size = get_funcs_sizes(sizes, matching_funcs, nonmatching_funcs) if len(all_funcs) == 0: funcs_matching_ratio = 0.0 @@ -238,19 +222,9 @@ def main(args): print(f"Warning: category/total size mismatch on version {args.version}!\n") print("Matching size: " + str(matching_size)) print("Nonmatching size: " + str(nonmatching_size)) - print( - "Sum: " - + str(matching_size + nonmatching_size) - + " (should be " - + str(total_size) - + ")" - ) - print( - f"{len(matching_funcs)} matched functions / {len(all_funcs)} total ({funcs_matching_ratio:.2f}%)" - ) - print( - f"{matching_size} matching bytes / {total_size} total ({matching_ratio:.2f}%)" - ) + print("Sum: " + str(matching_size + nonmatching_size) + " (should be " + str(total_size) + ")") + print(f"{len(matching_funcs)} matched functions / {len(all_funcs)} total ({funcs_matching_ratio:.2f}%)") + print(f"{matching_size} matching bytes / {total_size} total ({matching_ratio:.2f}%)") do_section_progress( "effects", diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000000..27b0c1b0f18 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,4 @@ +[tool.black] +line-length = 120 +exclude = 'tools/splat/' +extend-exclude = 'diff.py' diff --git a/src/16F740.c b/src/16F740.c index d438ba26b02..563f0f2db5e 100644 --- a/src/16F740.c +++ b/src/16F740.c @@ -45,8 +45,8 @@ void btl_merlee_on_start_turn(void) { if (playerData->merleeTurnCount <= 0) { s32 temp = rand_int(100); - if (currentEncounter->currentEnemy != NULL) { - if (currentEncounter->currentEnemy->flags & ACTOR_FLAG_NO_HEALTH_BAR) { + if (currentEncounter->curEnemy != NULL) { + if (currentEncounter->curEnemy->flags & ACTOR_FLAG_NO_HEALTH_BAR) { // 46/101 ≈ 45.5% if (temp <= 45) { playerData->merleeSpellType = MERLEE_SPELL_1; @@ -103,8 +103,8 @@ void btl_merlee_on_first_strike(void) { if (playerData->merleeTurnCount <= 0) { s32 temp = rand_int(100); - if (currentEncounter->currentEnemy != NULL) { - if (currentEncounter->currentEnemy->flags & ACTOR_FLAG_NO_HEALTH_BAR) { + if (currentEncounter->curEnemy != NULL) { + if (currentEncounter->curEnemy->flags & ACTOR_FLAG_NO_HEALTH_BAR) { // 46/101 ≈ 45.5% if (temp <= 45) { playerData->merleeSpellType = MERLEE_SPELL_1; @@ -215,7 +215,7 @@ void btl_state_update_normal_start(void) { stage = gCurrentStagePtr->stage; } - battleStatus->currentStage = stage; + battleStatus->curStage = stage; switch (gBattleSubState) { case BTL_SUBSTATE_NORMAL_START_INIT: BattleEnemiesCreated = battle->formationSize; @@ -247,7 +247,7 @@ void btl_state_update_normal_start(void) { battleStatus->unk_90 = 0; battleStatus->preUpdateCallback = NULL; battleStatus->initBattleCallback = NULL; - battleStatus->currentSubmenu = 0; + battleStatus->curSubmenu = 0; battleStatus->unk_49 = 0; battleStatus->unk_4A = 0; battleStatus->unk_4B = 0; @@ -458,8 +458,8 @@ void btl_state_update_normal_start(void) { script->owner1.actorID = ACTOR_PLAYER; } - if (currentEncounter->currentEnemy != NULL - && currentEncounter->currentEnemy->encountered == ENCOUNTER_TRIGGER_SPIN + if (currentEncounter->curEnemy != NULL + && currentEncounter->curEnemy->encountered == ENCOUNTER_TRIGGER_SPIN && is_ability_active(ABILITY_DIZZY_ATTACK) ) { actor = battleStatus->enemyActors[0]; @@ -766,10 +766,10 @@ void btl_state_update_begin_player_turn(void) { battleStatus->buffEffect->data.partnerBuff->unk_0C[FX_BUFF_DATA_WATER_BLOCK].turnsLeft = battleStatus->waterBlockTurnsLeft; if (battleStatus->waterBlockTurnsLeft <= 0) { battleStatus->waterBlockEffect->flags |= FX_INSTANCE_FLAG_DISMISS; - fx_water_block(1, player->currentPos.x, player->currentPos.y + 18.0f, player->currentPos.z + 5.0f, 1.5f, 10); - fx_water_splash(0, player->currentPos.x - 10.0f, player->currentPos.y + 5.0f, player->currentPos.z + 5.0f, 1.0f, 24); - fx_water_splash(0, player->currentPos.x - 15.0f, player->currentPos.y + 32.0f, player->currentPos.z + 5.0f, 1.0f, 24); - fx_water_splash(1, player->currentPos.x + 15.0f, player->currentPos.y + 22.0f, player->currentPos.z + 5.0f, 1.0f, 24); + fx_water_block(1, player->curPos.x, player->curPos.y + 18.0f, player->curPos.z + 5.0f, 1.5f, 10); + fx_water_splash(0, player->curPos.x - 10.0f, player->curPos.y + 5.0f, player->curPos.z + 5.0f, 1.0f, 24); + fx_water_splash(0, player->curPos.x - 15.0f, player->curPos.y + 32.0f, player->curPos.z + 5.0f, 1.0f, 24); + fx_water_splash(1, player->curPos.x + 15.0f, player->curPos.y + 22.0f, player->curPos.z + 5.0f, 1.0f, 24); battleStatus->waterBlockEffect = NULL; sfx_play_sound(SOUND_299); btl_show_battle_message(BTL_MSG_WATER_BLOCK_END, 60); @@ -1400,13 +1400,13 @@ void btl_state_update_9(void) { partner->flags |= ACTOR_FLAG_4000000; state = &partner->state; if (!battleStatus->outtaSightActive) { - partner->state.currentPos.x = partner->homePos.x; - partner->state.currentPos.z = partner->homePos.z; + partner->state.curPos.x = partner->homePos.x; + partner->state.curPos.z = partner->homePos.z; partner->state.goalPos.x = player->homePos.x; partner->state.goalPos.z = player->homePos.z; } else { - partner->state.currentPos.x = partner->homePos.x; - partner->state.currentPos.z = partner->homePos.z; + partner->state.curPos.x = partner->homePos.x; + partner->state.curPos.z = partner->homePos.z; partner->state.goalPos.x = partner->homePos.x; partner->state.goalPos.z = partner->homePos.z + 5.0f; partner->homePos.x = player->homePos.x; @@ -1423,32 +1423,32 @@ void btl_state_update_9(void) { if (gBattleSubState == BTL_SUBSTATE_9_3) { if (partner->state.moveTime != 0) { - partner->currentPos.x += (partner->state.goalPos.x - partner->currentPos.x) / partner->state.moveTime; - partner->currentPos.z += (partner->state.goalPos.z - partner->currentPos.z) / partner->state.moveTime; - player->currentPos.x += (partner->state.currentPos.x - player->currentPos.x) / partner->state.moveTime; - player->currentPos.z += (partner->state.currentPos.z - player->currentPos.z) / partner->state.moveTime; + partner->curPos.x += (partner->state.goalPos.x - partner->curPos.x) / partner->state.moveTime; + partner->curPos.z += (partner->state.goalPos.z - partner->curPos.z) / partner->state.moveTime; + player->curPos.x += (partner->state.curPos.x - player->curPos.x) / partner->state.moveTime; + player->curPos.z += (partner->state.curPos.z - player->curPos.z) / partner->state.moveTime; } - partner->currentPos.z -= sin_rad(DEG_TO_RAD(partner->state.angle)) * 16.0f; + partner->curPos.z -= sin_rad(DEG_TO_RAD(partner->state.angle)) * 16.0f; partner->yaw = clamp_angle(partner->state.angle); - player->currentPos.z += sin_rad(DEG_TO_RAD(partner->state.angle)) * 16.0f; + player->curPos.z += sin_rad(DEG_TO_RAD(partner->state.angle)) * 16.0f; player->yaw = clamp_angle(partner->state.angle); partner->state.angle += 90.0f; if (partner->state.moveTime != 0) { partner->state.moveTime--; } else { - partner->currentPos.x = partner->state.goalPos.x; - partner->currentPos.z = partner->state.goalPos.z; - player->currentPos.x = partner->state.currentPos.x; - player->currentPos.z = partner->state.currentPos.z; + partner->curPos.x = partner->state.goalPos.x; + partner->curPos.z = partner->state.goalPos.z; + player->curPos.x = partner->state.curPos.x; + player->curPos.z = partner->state.curPos.z; if (!battleStatus->outtaSightActive) { - partner->homePos.x = partner->currentPos.x; - partner->homePos.z = partner->currentPos.z; - player->homePos.x = player->currentPos.x; - player->homePos.z = player->currentPos.z; + partner->homePos.x = partner->curPos.x; + partner->homePos.z = partner->curPos.z; + player->homePos.x = player->curPos.x; + player->homePos.z = player->curPos.z; } else { - player->homePos.x = player->currentPos.x; - player->homePos.z = player->currentPos.z; + player->homePos.x = player->curPos.x; + player->homePos.z = player->curPos.z; } gBattleSubState = BTL_SUBSTATE_9_4; gBattleStatus.flags1 &= ~ACTOR_FLAG_100000; @@ -1605,8 +1605,8 @@ void btl_state_update_end_turn(void) { partner->flags &= ~ACTOR_FLAG_8000000; player->flags |= ACTOR_FLAG_4000000; partner->flags |= ACTOR_FLAG_4000000; - partner->state.currentPos.x = partner->homePos.x; - partner->state.currentPos.z = partner->homePos.z; + partner->state.curPos.x = partner->homePos.x; + partner->state.curPos.z = partner->homePos.z; partner->state.goalPos.x = player->homePos.x; partner->state.goalPos.z = player->homePos.z; partner->state.moveTime = 4; @@ -1617,27 +1617,27 @@ void btl_state_update_end_turn(void) { if (gBattleSubState == BTL_SUBSTATE_END_TURN_PERFORM_SWAP) { if (partner->state.moveTime != 0) { - partner->currentPos.x += (partner->state.goalPos.x - partner->currentPos.x) / partner->state.moveTime; - partner->currentPos.z += (partner->state.goalPos.z - partner->currentPos.z) / partner->state.moveTime; - player->currentPos.x += (partner->state.currentPos.x - player->currentPos.x) / partner->state.moveTime; - player->currentPos.z += (partner->state.currentPos.z - player->currentPos.z) / partner->state.moveTime; + partner->curPos.x += (partner->state.goalPos.x - partner->curPos.x) / partner->state.moveTime; + partner->curPos.z += (partner->state.goalPos.z - partner->curPos.z) / partner->state.moveTime; + player->curPos.x += (partner->state.curPos.x - player->curPos.x) / partner->state.moveTime; + player->curPos.z += (partner->state.curPos.z - player->curPos.z) / partner->state.moveTime; } - partner->currentPos.z -= sin_rad(DEG_TO_RAD(partner->state.angle)) * 16.0f; + partner->curPos.z -= sin_rad(DEG_TO_RAD(partner->state.angle)) * 16.0f; partner->yaw = clamp_angle(partner->state.angle); - player->currentPos.z += sin_rad(DEG_TO_RAD(partner->state.angle)) * 16.0f; + player->curPos.z += sin_rad(DEG_TO_RAD(partner->state.angle)) * 16.0f; player->yaw = clamp_angle(partner->state.angle); partner->state.angle += 90.0f; if (partner->state.moveTime != 0) { partner->state.moveTime--; } else { - partner->currentPos.x = partner->state.goalPos.x; - partner->currentPos.z = partner->state.goalPos.z; - player->currentPos.x = partner->state.currentPos.x; - player->currentPos.z = partner->state.currentPos.z; - partner->homePos.x = partner->currentPos.x; - partner->homePos.z = partner->currentPos.z; - player->homePos.x = player->currentPos.x; - player->homePos.z = player->currentPos.z; + partner->curPos.x = partner->state.goalPos.x; + partner->curPos.z = partner->state.goalPos.z; + player->curPos.x = partner->state.curPos.x; + player->curPos.z = partner->state.curPos.z; + partner->homePos.x = partner->curPos.x; + partner->homePos.z = partner->curPos.z; + player->homePos.x = player->curPos.x; + player->homePos.z = player->curPos.z; player->flags |= ACTOR_FLAG_8000000; partner->flags |= ACTOR_FLAG_8000000; if (gBattleStatus.flags2 & BS_FLAGS2_PEACH_BATTLE) { @@ -1825,10 +1825,10 @@ void btl_state_update_victory(void) { if (partner == NULL || !(gBattleStatus.flags1 & BS_FLAGS1_PLAYER_IN_BACK)) { gBattleSubState = BTL_SUBSTATE_VICTORY_CHECK_MERLEE; } else { - partner->state.currentPos.x = partner->currentPos.x; - partner->state.currentPos.z = partner->currentPos.z; - partner->state.goalPos.x = player->currentPos.x; - partner->state.goalPos.z = player->currentPos.z; + partner->state.curPos.x = partner->curPos.x; + partner->state.curPos.z = partner->curPos.z; + partner->state.goalPos.x = player->curPos.x; + partner->state.goalPos.z = player->curPos.z; partner->state.moveTime = 4; partner->state.angle = 0.0f; gBattleSubState = BTL_SUBSTATE_VICTORY_AWAIT_SWAP; @@ -1837,28 +1837,28 @@ void btl_state_update_victory(void) { if (gBattleSubState == BTL_SUBSTATE_VICTORY_AWAIT_SWAP) { if (partner->state.moveTime != 0) { - partner->currentPos.x += (partner->state.goalPos.x - partner->currentPos.x) / partner->state.moveTime; - partner->currentPos.z += (partner->state.goalPos.z - partner->currentPos.z) / partner->state.moveTime; - player->currentPos.x += (partner->state.currentPos.x - player->currentPos.x) / partner->state.moveTime; - player->currentPos.z += (partner->state.currentPos.z - player->currentPos.z) / partner->state.moveTime; + partner->curPos.x += (partner->state.goalPos.x - partner->curPos.x) / partner->state.moveTime; + partner->curPos.z += (partner->state.goalPos.z - partner->curPos.z) / partner->state.moveTime; + player->curPos.x += (partner->state.curPos.x - player->curPos.x) / partner->state.moveTime; + player->curPos.z += (partner->state.curPos.z - player->curPos.z) / partner->state.moveTime; } - partner->currentPos.z += sin_rad(DEG_TO_RAD(partner->state.angle)) * 16.0f; + partner->curPos.z += sin_rad(DEG_TO_RAD(partner->state.angle)) * 16.0f; partner->yaw = clamp_angle(-partner->state.angle); - player->currentPos.z -= sin_rad(DEG_TO_RAD(partner->state.angle)) * 16.0f; + player->curPos.z -= sin_rad(DEG_TO_RAD(partner->state.angle)) * 16.0f; player->yaw = clamp_angle(-partner->state.angle); partner->state.angle += 90.0f; if (partner->state.moveTime != 0) { partner->state.moveTime--; } else { - partner->currentPos.x = partner->state.goalPos.x; - partner->currentPos.z = partner->state.goalPos.z; - player->currentPos.x = partner->state.currentPos.x; - player->currentPos.z = partner->state.currentPos.z; - partner->homePos.x = partner->currentPos.x; - partner->homePos.z = partner->currentPos.z; - player->homePos.x = player->currentPos.x; - player->homePos.z = player->currentPos.z; + partner->curPos.x = partner->state.goalPos.x; + partner->curPos.z = partner->state.goalPos.z; + player->curPos.x = partner->state.curPos.x; + player->curPos.z = partner->state.curPos.z; + partner->homePos.x = partner->curPos.x; + partner->homePos.z = partner->curPos.z; + player->homePos.x = player->curPos.x; + player->homePos.z = player->curPos.z; gBattleSubState = BTL_SUBSTATE_VICTORY_CHECK_MERLEE; gBattleStatus.flags1 &= ~BS_FLAGS1_PLAYER_IN_BACK; } @@ -2494,9 +2494,9 @@ void btl_state_update_change_partner(void) { battleStatus->controlScript = script; battleStatus->controlScriptID = script->id; script->owner1.actorID = ACTOR_PARTNER; - state->unk_18.x = partner->currentPos.x; + state->unk_18.x = partner->curPos.x; state->unk_18.y = 0.0f; - state->unk_18.z = partner->currentPos.z; + state->unk_18.z = partner->curPos.z; gBattleSubState = BTL_SUBSTATE_CHANGE_PARTNER_LOAD_NEW_PARTNER; break; case BTL_SUBSTATE_CHANGE_PARTNER_LOAD_NEW_PARTNER: @@ -2504,18 +2504,18 @@ void btl_state_update_change_partner(void) { break; } btl_delete_actor(partner); - playerData->currentPartner = battleStatus->unk_1AC; + playerData->curPartner = battleStatus->unk_1AC; load_partner_actor(); partner = battleStatus->partnerActor; partner->scale.x = 0.1f; partner->scale.y = 0.1f; partner->scale.z = 0.1f; partner->state.goalPos.x = state->unk_18.x; - partner->state.goalPos.y = partner->currentPos.y; + partner->state.goalPos.y = partner->curPos.y; partner->state.goalPos.z = state->unk_18.z; - partner->currentPos.x = player->currentPos.x; - partner->currentPos.y = player->currentPos.y + 25.0f; - partner->currentPos.z = player->currentPos.z; + partner->curPos.x = player->curPos.x; + partner->curPos.y = player->curPos.y + 25.0f; + partner->curPos.z = player->curPos.z; gBattleSubState = BTL_SUBSTATE_CHANGE_PARTNER_EXEC_BRING_OUT; break; case BTL_SUBSTATE_CHANGE_PARTNER_EXEC_BRING_OUT: @@ -2600,7 +2600,7 @@ void btl_state_update_player_move(void) { battleStatus->unk_86 = 127; battleStatus->blockResult = 127; battleStatus->lastAttackDamage = 0; - battleStatus->currentDamageSource = DMG_SRC_DEFAULT; + battleStatus->curDamageSource = DMG_SRC_DEFAULT; gBattleStatus.flags1 &= ~BS_FLAGS1_AUTO_SUCCEED_ACTION; gBattleStatus.flags1 &= ~BS_FLAGS1_MENU_OPEN; reset_actor_turn_info(); @@ -3029,8 +3029,8 @@ void btl_state_update_end_player_turn(void) { if (!(gBattleStatus.flags2 & BS_FLAGS2_PEACH_BATTLE) || (gBattleStatus.flags1 & BS_FLAGS1_PLAYER_IN_BACK)) { gBattleSubState = BTL_SUBSTATE_END_PLAYER_TURN_DONE; } else { - player->state.currentPos.x = player->homePos.x; - player->state.currentPos.z = player->homePos.z; + player->state.curPos.x = player->homePos.x; + player->state.curPos.z = player->homePos.z; player->state.goalPos.x = partner->homePos.x; player->state.goalPos.z = partner->homePos.z; player->state.moveTime = 4; @@ -3042,28 +3042,28 @@ void btl_state_update_end_player_turn(void) { if (gBattleSubState == BTL_SUBSTATE_END_PLAYER_TURN_AWAIT_SWAP) { if (player->state.moveTime != 0) { - player->currentPos.x += (player->state.goalPos.x - player->currentPos.x) / player->state.moveTime; - player->currentPos.z += (player->state.goalPos.z - player->currentPos.z) / player->state.moveTime; - partner->currentPos.x += (player->state.currentPos.x - partner->currentPos.x) / player->state.moveTime; - partner->currentPos.z += (player->state.currentPos.z - partner->currentPos.z) / player->state.moveTime; + player->curPos.x += (player->state.goalPos.x - player->curPos.x) / player->state.moveTime; + player->curPos.z += (player->state.goalPos.z - player->curPos.z) / player->state.moveTime; + partner->curPos.x += (player->state.curPos.x - partner->curPos.x) / player->state.moveTime; + partner->curPos.z += (player->state.curPos.z - partner->curPos.z) / player->state.moveTime; } - player->currentPos.z += sin_rad(DEG_TO_RAD(player->state.angle)) * 16.0f; + player->curPos.z += sin_rad(DEG_TO_RAD(player->state.angle)) * 16.0f; player->yaw = clamp_angle(-player->state.angle); - partner->currentPos.z -= sin_rad(DEG_TO_RAD(player->state.angle)) * 16.0f; + partner->curPos.z -= sin_rad(DEG_TO_RAD(player->state.angle)) * 16.0f; partner->yaw = clamp_angle(-player->state.angle); player->state.angle += 90.0f; if (player->state.moveTime != 0) { player->state.moveTime--; } else { - player->currentPos.x = player->state.goalPos.x; - player->currentPos.z = player->state.goalPos.z; - partner->currentPos.x = player->state.currentPos.x; - partner->currentPos.z = player->state.currentPos.z; - player->homePos.x = player->currentPos.x; - player->homePos.z = player->currentPos.z; - partner->homePos.x = partner->currentPos.x; - partner->homePos.z = partner->currentPos.z; + player->curPos.x = player->state.goalPos.x; + player->curPos.z = player->state.goalPos.z; + partner->curPos.x = player->state.curPos.x; + partner->curPos.z = player->state.curPos.z; + player->homePos.x = player->curPos.x; + player->homePos.z = player->curPos.z; + partner->homePos.x = partner->curPos.x; + partner->homePos.z = partner->curPos.z; gBattleStatus.flags1 |= BS_FLAGS1_PLAYER_IN_BACK; gBattleSubState = BTL_SUBSTATE_END_PLAYER_TURN_DONE; } @@ -3157,7 +3157,7 @@ void btl_state_update_partner_move(void) { battleStatus->stateFreezeCount = 0; battleStatus->unk_86 = 127; battleStatus->blockResult = 127; - battleStatus->currentDamageSource = DMG_SRC_DEFAULT; + battleStatus->curDamageSource = DMG_SRC_DEFAULT; gBattleStatus.flags1 &= ~BS_FLAGS1_AUTO_SUCCEED_ACTION; gBattleStatus.flags1 &= ~BS_FLAGS1_MENU_OPEN; reset_actor_turn_info(); @@ -3263,7 +3263,7 @@ void btl_state_update_partner_move(void) { break; } decrement_status_bar_disabled(); - if (playerData->currentPartner == PARTNER_GOOMBARIO + if (playerData->curPartner == PARTNER_GOOMBARIO && battleStatus->moveCategory == BTL_MENU_TYPE_CHANGE_PARTNER && battleStatus->selectedMoveID != MOVE_CHARGE) { partner->isGlowing = 0; @@ -3469,7 +3469,7 @@ void btl_state_update_next_enemy(void) { } battleStatus->activeEnemyActorID = battleStatus->enemyIDs[i++]; - battleStatus->currentTurnEnemy = enemy; + battleStatus->curTurnEnemy = enemy; battleStatus->nextEnemyIndex = i; skipEnemy = FALSE; @@ -3584,7 +3584,7 @@ void btl_state_update_enemy_move(void) { battleStatus->actionSuccess = 0; battleStatus->unk_86 = 127; battleStatus->blockResult = 127; - battleStatus->currentDamageSource = DMG_SRC_DEFAULT; + battleStatus->curDamageSource = DMG_SRC_DEFAULT; reset_actor_turn_info(); gBattleStatus.flags1 |= BS_FLAGS1_100; player->statusAfflicted = 0; @@ -3609,7 +3609,7 @@ void btl_state_update_enemy_move(void) { } } - enemy = battleStatus->currentTurnEnemy; + enemy = battleStatus->curTurnEnemy; if (!(enemy->flags & ACTOR_FLAG_NO_ATTACK)) { reset_all_actor_sounds(enemy); battleStatus->battlePhase = PHASE_EXECUTE_ACTION; @@ -3827,13 +3827,13 @@ void btl_state_update_first_strike(void) { battleStatus->moveCategory = BTL_MENU_TYPE_JUMP; battleStatus->selectedMoveID = MOVE_UNUSED_JUMP4; battleStatus->moveArgument = encounterStatus->hitTier; - battleStatus->currentTargetListFlags = gMoveTable[MOVE_UNUSED_JUMP4].flags; + battleStatus->curTargetListFlags = gMoveTable[MOVE_UNUSED_JUMP4].flags; break; case ENCOUNTER_TRIGGER_HAMMER: battleStatus->moveCategory = BTL_MENU_TYPE_SMASH; battleStatus->selectedMoveID = MOVE_UNUSED_HAMMER4; battleStatus->moveArgument = encounterStatus->hitTier; - battleStatus->currentTargetListFlags = gMoveTable[MOVE_UNUSED_HAMMER4].flags; + battleStatus->curTargetListFlags = gMoveTable[MOVE_UNUSED_HAMMER4].flags; break; case ENCOUNTER_TRIGGER_PARTNER: btl_set_state(BATTLE_STATE_PARTNER_FIRST_STRIKE); @@ -3863,7 +3863,7 @@ void btl_state_update_first_strike(void) { func_80263230(player, enemy); battleStatus->stateFreezeCount = 0; battleStatus->lastAttackDamage = 0; - battleStatus->currentDamageSource = DMG_SRC_DEFAULT; + battleStatus->curDamageSource = DMG_SRC_DEFAULT; gBattleStatus.flags1 &= ~BS_FLAGS1_MENU_OPEN; gBattleStatus.flags2 |= BS_FLAGS2_1000000; gBattleStatus.flags1 &= ~BS_FLAGS1_PARTNER_ACTING; @@ -4034,18 +4034,18 @@ void btl_state_update_partner_striking_first(void) { D_8029F254 = 0; // setup dummy 'menu selection' for partner move level = partner->actorBlueprint->level; - switch (playerData->currentPartner) { + switch (playerData->curPartner) { case PARTNER_KOOPER: battleStatus->moveCategory = BTL_MENU_TYPE_CHANGE_PARTNER; battleStatus->moveArgument = 0; battleStatus->selectedMoveID = level + MOVE_SHELL_TOSS1; - battleStatus->currentTargetListFlags = gMoveTable[battleStatus->selectedMoveID].flags; + battleStatus->curTargetListFlags = gMoveTable[battleStatus->selectedMoveID].flags; break; case PARTNER_BOMBETTE: battleStatus->moveCategory = BTL_MENU_TYPE_CHANGE_PARTNER; battleStatus->moveArgument = 0; battleStatus->selectedMoveID = level + MOVE_BODY_SLAM1; - battleStatus->currentTargetListFlags = gMoveTable[battleStatus->selectedMoveID].flags; + battleStatus->curTargetListFlags = gMoveTable[battleStatus->selectedMoveID].flags; break; } // let the enemy know a first strike is coming @@ -4066,7 +4066,7 @@ void btl_state_update_partner_striking_first(void) { partner->targetPartIndex = target->partID; battleStatus->stateFreezeCount = 0; battleStatus->lastAttackDamage = 0; - battleStatus->currentDamageSource = DMG_SRC_DEFAULT; + battleStatus->curDamageSource = DMG_SRC_DEFAULT; gBattleStatus.flags1 &= ~BS_FLAGS1_MENU_OPEN; gBattleStatus.flags2 |= BS_FLAGS2_1000000; gBattleStatus.flags1 |= BS_FLAGS1_PARTNER_ACTING; @@ -4217,7 +4217,7 @@ void btl_state_update_enemy_striking_first(void) { case BTL_SUBSTATE_ENEMY_FIRST_STRIKE_INIT: battleStatus->stateFreezeCount = 0; battleStatus->lastAttackDamage = 0; - battleStatus->currentDamageSource = DMG_SRC_DEFAULT; + battleStatus->curDamageSource = DMG_SRC_DEFAULT; playerData->enemyFirstStrikes++; battleStatus->flags1 &= ~BS_FLAGS1_MENU_OPEN; D_8029F254 = 0; @@ -4272,14 +4272,14 @@ void btl_state_update_enemy_striking_first(void) { activeEnemyActorID = battleStatus->enemyIDs[nextEnemyIdx]; nextEnemyIdx++; - battleStatus->currentTurnEnemy = actor; + battleStatus->curTurnEnemy = actor; battleStatus->activeEnemyActorID = activeEnemyActorID; if (nextEnemyIdx >= battleStatus->numEnemyActors) { nextEnemyIdx = 0; } battleStatus->nextEnemyIndex = nextEnemyIdx; btl_cam_target_actor(battleStatus->activeEnemyActorID); - actor = battleStatus->currentTurnEnemy; + actor = battleStatus->curTurnEnemy; reset_actor_turn_info(); battleStatus->battlePhase = PHASE_FIRST_STRIKE; script = start_script(actor->takeTurnSource, EVT_PRIORITY_A, 0); @@ -4296,7 +4296,7 @@ void btl_state_update_enemy_striking_first(void) { D_8029F254 = 1; } - actor = battleStatus->currentTurnEnemy; + actor = battleStatus->curTurnEnemy; if (actor->takeTurnScript == NULL || !does_script_exist(actor->takeTurnScriptID)) { actor->takeTurnScript = NULL; diff --git a/src/16c8e0.c b/src/16c8e0.c index 7e701d8400e..bcfabab2394 100644 --- a/src/16c8e0.c +++ b/src/16c8e0.c @@ -112,7 +112,7 @@ void get_dpad_input_radial(f32* angle, f32* magnitude) { f32 maxMagnitude = 60.0f; f32 stickX = battleStatus->stickX; f32 stickY = battleStatus->stickY; - u16 currentButtonsDown = battleStatus->currentButtonsDown; + u16 currentButtonsDown = battleStatus->curButtonsDown; f32 mag; if (currentButtonsDown & (BUTTON_D_UP | BUTTON_D_DOWN | BUTTON_D_LEFT | BUTTON_D_RIGHT)) { @@ -229,9 +229,9 @@ void initialize_battle(void) { playerData->battlesCount++; } - bSavedPartner = playerData->currentPartner; + bSavedPartner = playerData->curPartner; if (gBattleStatus.flags2 & BS_FLAGS2_PEACH_BATTLE) { - playerData->currentPartner = PARTNER_TWINK; + playerData->curPartner = PARTNER_TWINK; } } @@ -257,17 +257,17 @@ void btl_update(void) { if ((battleStatus->flags1 & BS_FLAGS1_PARTNER_ACTING) && gGameStatusPtr->multiplayerEnabled != 0) { s32 inputBitmask = battleStatus->inputBitmask; - battleStatus->currentButtonsDown = gGameStatusPtr->currentButtons[1] & inputBitmask; - battleStatus->currentButtonsPressed = gGameStatusPtr->pressedButtons[1] & inputBitmask; - battleStatus->currentButtonsHeld = gGameStatusPtr->heldButtons[1] & inputBitmask; + battleStatus->curButtonsDown = gGameStatusPtr->curButtons[1] & inputBitmask; + battleStatus->curButtonsPressed = gGameStatusPtr->pressedButtons[1] & inputBitmask; + battleStatus->curButtonsHeld = gGameStatusPtr->heldButtons[1] & inputBitmask; battleStatus->stickX = gGameStatusPtr->stickX[1]; battleStatus->stickY = gGameStatusPtr->stickY[1]; } else { s32 inputBitmask2 = battleStatus->inputBitmask; - battleStatus->currentButtonsDown = gGameStatusPtr->currentButtons[0] & inputBitmask2; - battleStatus->currentButtonsPressed = gGameStatusPtr->pressedButtons[0] & inputBitmask2; - battleStatus->currentButtonsHeld = gGameStatusPtr->heldButtons[0] & inputBitmask2; + battleStatus->curButtonsDown = gGameStatusPtr->curButtons[0] & inputBitmask2; + battleStatus->curButtonsPressed = gGameStatusPtr->pressedButtons[0] & inputBitmask2; + battleStatus->curButtonsHeld = gGameStatusPtr->heldButtons[0] & inputBitmask2; battleStatus->stickX = gGameStatusPtr->stickX[0]; battleStatus->stickY = gGameStatusPtr->stickY[0]; } @@ -276,8 +276,8 @@ void btl_update(void) { get_dpad_input_radial(&dpadAngle, &dpadMagnitude); battleStatus->dpadX = dpadAngle; battleStatus->dpadY = dpadMagnitude; - battleStatus->pushInputBuffer[battleStatus->inputBufferPos] = battleStatus->currentButtonsPressed; - battleStatus->holdInputBuffer[battleStatus->inputBufferPos] = battleStatus->currentButtonsDown; + battleStatus->pushInputBuffer[battleStatus->inputBufferPos] = battleStatus->curButtonsPressed; + battleStatus->holdInputBuffer[battleStatus->inputBufferPos] = battleStatus->curButtonsDown; battleStatus->inputBufferPos++; if (battleStatus->inputBufferPos >= ARRAY_COUNT(battleStatus->pushInputBuffer)) { @@ -422,7 +422,7 @@ void btl_update(void) { set_screen_overlay_color(SCREEN_LAYER_BACK, 0, 0, 0); if (partner == NULL) { set_screen_overlay_params_back(OVERLAY_SCREEN_COLOR, 215.0f); - } else if (playerData->currentPartner == PARTNER_WATT) { + } else if (playerData->curPartner == PARTNER_WATT) { paramAmount -= 10.0f; if (paramAmount < 0.0f) { paramAmount = 0.0f; @@ -636,14 +636,14 @@ void btl_render_actors(void) { if (actor != NULL && !(actor->flags & ACTOR_FLAG_DISABLED)) { renderTaskPtr->appendGfxArg = (void*)i; renderTaskPtr->appendGfx = appendGfx_enemy_actor; - renderTaskPtr->distance = actor->currentPos.z; + renderTaskPtr->dist = actor->curPos.z; renderTaskPtr->renderMode = actor->renderMode; queue_render_task(renderTaskPtr); if (actor->flags & ACTOR_FLAG_BLUR_ENABLED) { renderTaskPtr->appendGfxArg = actor; renderTaskPtr->appendGfx = appendGfx_enemy_actor_blur; - renderTaskPtr->distance = actor->currentPos.z; + renderTaskPtr->dist = actor->curPos.z; renderTaskPtr->renderMode = RENDER_MODE_SURFACE_XLU_LAYER3; queue_render_task(renderTaskPtr); } @@ -651,7 +651,7 @@ void btl_render_actors(void) { if (battleStatus->reflectFlags & BS_REFLECT_FLOOR) { renderTaskPtr->appendGfxArg = actor; renderTaskPtr->appendGfx = appendGfx_enemy_actor_reflection; - renderTaskPtr->distance = actor->currentPos.z; + renderTaskPtr->dist = actor->curPos.z; renderTaskPtr->renderMode = actor->renderMode; queue_render_task(renderTaskPtr); } @@ -662,14 +662,14 @@ void btl_render_actors(void) { if (actor != NULL && !(actor->flags & ACTOR_FLAG_DISABLED)) { renderTaskPtr->appendGfxArg = NULL; renderTaskPtr->appendGfx = appendGfx_partner_actor; - renderTaskPtr->distance = actor->currentPos.z; + renderTaskPtr->dist = actor->curPos.z; renderTaskPtr->renderMode = actor->renderMode; queue_render_task(renderTaskPtr); if (actor->flags & ACTOR_FLAG_BLUR_ENABLED) { renderTaskPtr->appendGfxArg = actor; renderTaskPtr->appendGfx = appendGfx_partner_actor_blur; - renderTaskPtr->distance = actor->currentPos.z; + renderTaskPtr->dist = actor->curPos.z; renderTaskPtr->renderMode = RENDER_MODE_SURFACE_XLU_LAYER3; queue_render_task(renderTaskPtr); } @@ -677,7 +677,7 @@ void btl_render_actors(void) { if (battleStatus->reflectFlags & BS_REFLECT_FLOOR) { renderTaskPtr->appendGfxArg = NULL; renderTaskPtr->appendGfx = appendGfx_partner_actor_reflection; - renderTaskPtr->distance = actor->currentPos.z; + renderTaskPtr->dist = actor->curPos.z; renderTaskPtr->renderMode = actor->renderMode; queue_render_task(renderTaskPtr); } @@ -687,14 +687,14 @@ void btl_render_actors(void) { if (actor != NULL && !(actor->flags & ACTOR_FLAG_DISABLED)) { renderTaskPtr->appendGfxArg = NULL; renderTaskPtr->appendGfx = appendGfx_player_actor; - renderTaskPtr->distance = actor->currentPos.z; + renderTaskPtr->dist = actor->curPos.z; renderTaskPtr->renderMode = actor->renderMode; queue_render_task(renderTaskPtr); if (actor->flags & ACTOR_FLAG_BLUR_ENABLED) { renderTaskPtr->appendGfxArg = actor; renderTaskPtr->appendGfx = (void (*) (void*)) appendGfx_player_actor_blur; - renderTaskPtr->distance = actor->currentPos.z; + renderTaskPtr->dist = actor->curPos.z; renderTaskPtr->renderMode = RENDER_MODE_SURFACE_XLU_LAYER3; queue_render_task(renderTaskPtr); } @@ -702,7 +702,7 @@ void btl_render_actors(void) { if (battleStatus->reflectFlags & BS_REFLECT_FLOOR) { renderTaskPtr->appendGfxArg = NULL; renderTaskPtr->appendGfx = appendGfx_player_actor_reflection; - renderTaskPtr->distance = actor->currentPos.z; + renderTaskPtr->dist = actor->curPos.z; renderTaskPtr->renderMode = actor->renderMode; queue_render_task(renderTaskPtr); } @@ -868,7 +868,7 @@ void btl_draw_enemy_health_bars(void) { s32 temp; s32 ones; - currentHP = enemy->currentHP; + currentHP = enemy->curHP; temp = (currentHP * 25) / enemy->maxHP; if (temp < enemy->healthFraction) { @@ -1070,12 +1070,12 @@ void btl_save_world_cameras(void) { D_8029DA50[i] = gCameras[i]; } - D_8029EFB0 = playerStatus->position.x; - D_8029EFB4 = playerStatus->position.y; - D_8029EFB8 = playerStatus->position.z; - playerStatus->position.x = NPC_DISPOSE_POS_X; - playerStatus->position.y = NPC_DISPOSE_POS_Y; - playerStatus->position.z = NPC_DISPOSE_POS_Z; + D_8029EFB0 = playerStatus->pos.x; + D_8029EFB4 = playerStatus->pos.y; + D_8029EFB8 = playerStatus->pos.z; + playerStatus->pos.x = NPC_DISPOSE_POS_X; + playerStatus->pos.y = NPC_DISPOSE_POS_Y; + playerStatus->pos.z = NPC_DISPOSE_POS_Z; } void btl_restore_world_cameras(void) { @@ -1088,9 +1088,9 @@ void btl_restore_world_cameras(void) { } gCurrentCameraID = CAM_DEFAULT; - playerStatus->position.x = D_8029EFB0; - playerStatus->position.y = D_8029EFB4; - playerStatus->position.z = D_8029EFB8; + playerStatus->pos.x = D_8029EFB0; + playerStatus->pos.y = D_8029EFB4; + playerStatus->pos.z = D_8029EFB8; if (bSavedOverrideFlags & GLOBAL_OVERRIDES_ENABLE_FLOOR_REFLECTION) { gOverrideFlags |= GLOBAL_OVERRIDES_ENABLE_FLOOR_REFLECTION; @@ -1099,7 +1099,7 @@ void btl_restore_world_cameras(void) { } if (gBattleStatus.flags2 & BS_FLAGS2_PEACH_BATTLE) { - playerData->currentPartner = bSavedPartner; + playerData->curPartner = bSavedPartner; } } diff --git a/src/17D6A0.c b/src/17D6A0.c index 99648dce06b..d4063b1d5e3 100644 --- a/src/17D6A0.c +++ b/src/17D6A0.c @@ -2872,7 +2872,7 @@ void show_immune_bonk(f32 x, f32 y, f32 z, s32 numStars, s32 arg4, s32 arg5) { message->scale = D_80283690[iMod8].x * baseScale; message->rotZ = 0; message->rotVelZ = sign * 107; - message->rotY = clamp_angle(180.0f - gCameras[CAM_BATTLE].currentYaw); + message->rotY = clamp_angle(180.0f - gCameras[CAM_BATTLE].curYaw); message->appearTime = 14; message->unk_24 = arg4; message->deleteTime = 240; @@ -2910,7 +2910,7 @@ void btl_bonk_update(void* data) { message->pos.y += message->vel.y; message->pos.z += message->vel.z; } - message->rotY = clamp_angle(180.0f - gCameras[CAM_BATTLE].currentYaw); + message->rotY = clamp_angle(180.0f - gCameras[CAM_BATTLE].curYaw); message->rotZ += message->rotVelZ; message->rotZ = clamp_angle(message->rotZ); message->rotVelZ *= 0.8; @@ -3170,7 +3170,7 @@ void btl_update_message_popup(void* data) { popup->showMsgState = 2; break; case 2: - if (battleStatus->currentButtonsPressed & (BUTTON_A | BUTTON_B)) { + if (battleStatus->curButtonsPressed & (BUTTON_A | BUTTON_B)) { popup->duration = 0; } @@ -3523,7 +3523,7 @@ void btl_update_message_popup(void* data) { popup->showMsgState = 2; break; case 2: - if (battleStatus->currentButtonsPressed & (BUTTON_A | BUTTON_B)) { + if (battleStatus->curButtonsPressed & (BUTTON_A | BUTTON_B)) { popup->duration = 0; } @@ -4105,9 +4105,9 @@ void apply_shock_effect(Actor* actor) { && part->idleAnimations != NULL && !(part->flags & ACTOR_PART_FLAG_40000000) ) { - f32 x = part->currentPos.x; - f32 y = part->currentPos.y + (actor->size.y / 10); - f32 z = part->currentPos.z; + f32 x = part->curPos.x; + f32 y = part->curPos.y + (actor->size.y / 10); + f32 z = part->curPos.z; s32 f1 = (part->size.x + (part->size.x / 4)) * actor->scalingFactor; s32 f2 = (part->size.y - 2) * actor->scalingFactor; diff --git a/src/17FEB0.c b/src/17FEB0.c index 426a47cdd66..308083976b7 100644 --- a/src/17FEB0.c +++ b/src/17FEB0.c @@ -5,15 +5,15 @@ HitResult calc_item_check_hit(void) { BattleStatus* battleStatus = &gBattleStatus; ActorState* state = &battleStatus->playerActor->state; - s32 actorID = battleStatus->currentTargetID; + s32 actorID = battleStatus->curTargetID; s8 currentTargetPartS8; u32 currentTargetPart; Actor* actor; ActorPart* actorPart; - battleStatus->currentTargetID2 = battleStatus->currentTargetID; - currentTargetPart = currentTargetPartS8 = battleStatus->currentTargetPart; - battleStatus->currentTargetPart2 = currentTargetPartS8; + battleStatus->curTargetID2 = battleStatus->curTargetID; + currentTargetPart = currentTargetPartS8 = battleStatus->curTargetPart; + battleStatus->curTargetPart2 = currentTargetPartS8; actor = get_actor(actorID); if (actor == NULL) { @@ -36,7 +36,7 @@ HitResult calc_item_check_hit(void) { return HIT_RESULT_IMMUNE; } - if ((battleStatus->currentAttackElement & DAMAGE_TYPE_JUMP) + if ((battleStatus->curAttackElement & DAMAGE_TYPE_JUMP) && (actorPart->eventFlags & ACTOR_EVENT_FLAG_SPIKY_TOP)) { sfx_play_sound_at_position(SOUND_HIT_NORMAL, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); @@ -49,9 +49,9 @@ HitResult calc_item_check_hit(void) { HitResult calc_item_damage_enemy(void) { BattleStatus* battleStatus = &gBattleStatus; Actor* player = battleStatus->playerActor; - s32 currentTargetID = battleStatus->currentTargetID; + s32 currentTargetID = battleStatus->curTargetID; Actor* partner = battleStatus->partnerActor; - s32 currentTargetPartID = battleStatus->currentTargetPart; + s32 currentTargetPartID = battleStatus->curTargetPart; s32 partImmuneToElement; s32 sp1C = FALSE; s32 actorClass; @@ -73,8 +73,8 @@ HitResult calc_item_damage_enemy(void) { battleStatus->wasStatusInflicted = FALSE; battleStatus->lastAttackDamage = 0; battleStatus->attackerActorID = player->actorID; - battleStatus->currentTargetID2 = battleStatus->currentTargetID; - battleStatus->currentTargetPart2 = battleStatus->currentTargetPart; + battleStatus->curTargetID2 = battleStatus->curTargetID; + battleStatus->curTargetPart2 = battleStatus->curTargetPart; target = get_actor(currentTargetID); wasStatusInflicted = FALSE; @@ -95,28 +95,28 @@ HitResult calc_item_damage_enemy(void) { state = &partner->state; } - if (battleStatus->currentAttackElement & DAMAGE_TYPE_FIRE) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_FIRE) { fx_ring_blast(0, state->goalPos.x, state->goalPos.y, state->goalPos.z + 5.0f, 1.0f, 24); isFireDamage = TRUE; } - if (battleStatus->currentAttackElement & DAMAGE_TYPE_SHOCK) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_SHOCK) { apply_shock_effect(target); isShockDamage = TRUE; } - if (battleStatus->currentAttackElement & DAMAGE_TYPE_WATER) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_WATER) { fx_water_splash(0, state->goalPos.x, state->goalPos.y, state->goalPos.z + 5.0f, 1.0f, 24); isWaterDamage = TRUE; } - if (battleStatus->currentAttackElement & DAMAGE_TYPE_ICE) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_ICE) { fx_big_snowflakes(0, state->goalPos.x, state->goalPos.y, state->goalPos.z + 5.0f); isIceDamage = TRUE; } - if (!(battleStatus->currentAttackElement & DAMAGE_TYPE_REMOVE_BUFFS)) { + if (!(battleStatus->curAttackElement & DAMAGE_TYPE_REMOVE_BUFFS)) { if ((targetPart->eventFlags & ACTOR_EVENT_FLAG_ILLUSORY) || (target->transparentStatus == STATUS_KEY_TRANSPARENT) || (targetPart->eventFlags & ACTOR_EVENT_FLAG_800) - && !(battleStatus->currentAttackElement & DAMAGE_TYPE_QUAKE) + && !(battleStatus->curAttackElement & DAMAGE_TYPE_QUAKE) ) { return HIT_RESULT_MISS; } @@ -132,22 +132,22 @@ HitResult calc_item_damage_enemy(void) { return HIT_RESULT_HIT; } - if (targetPart->elementalImmunities & battleStatus->currentAttackElement) { + if (targetPart->elementalImmunities & battleStatus->curAttackElement) { partImmuneToElement = TRUE; } else { partImmuneToElement = FALSE; } if (targetPart->eventFlags & (ACTOR_EVENT_FLAG_ENCHANTED | ACTOR_EVENT_FLAG_STAR_ROD_ENCHANTED)) { - battleStatus->currentAttackElement &= ~DAMAGE_TYPE_IGNORE_DEFENSE; + battleStatus->curAttackElement &= ~DAMAGE_TYPE_IGNORE_DEFENSE; } - temp = get_defense(target, targetPart->defenseTable, battleStatus->currentAttackElement); - if (!(battleStatus->currentAttackElement & DAMAGE_TYPE_IGNORE_DEFENSE)) { + temp = get_defense(target, targetPart->defenseTable, battleStatus->curAttackElement); + if (!(battleStatus->curAttackElement & DAMAGE_TYPE_IGNORE_DEFENSE)) { temp += target->defenseBoost; } - attackDamage = battleStatus->currentAttackDamage; + attackDamage = battleStatus->curAttackDamage; if (attackDamage > 99) { attackDamage = 99; } @@ -162,7 +162,7 @@ HitResult calc_item_damage_enemy(void) { target->hpChangeCounter = 0; hitResult = HIT_RESULT_NO_DAMAGE; - if (!(battleStatus->currentAttackElement & DAMAGE_TYPE_STATUS_ALWAYS_HITS)) { + if (!(battleStatus->curAttackElement & DAMAGE_TYPE_STATUS_ALWAYS_HITS)) { dispatchEvent = EVENT_ZERO_DAMAGE; sfx_play_sound_at_position(SOUND_IMMUNE, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); battleStatus->lastAttackDamage = 0; @@ -181,9 +181,9 @@ HitResult calc_item_damage_enemy(void) { && !partImmuneToElement && !(targetPart->targetFlags & ACTOR_PART_TARGET_FLAG_4) ) { - target->currentHP -= attackDamage; - if (target->currentHP <= 0) { - target->currentHP = 0; + target->curHP -= attackDamage; + if (target->curHP <= 0) { + target->curHP = 0; dispatchEvent = EVENT_DEATH; } } @@ -199,7 +199,7 @@ HitResult calc_item_damage_enemy(void) { return HIT_RESULT_NO_DAMAGE; } - if (battleStatus->currentAttackElement & DAMAGE_TYPE_DEATH) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_DEATH) { battleStatus->lastAttackDamage = 0; dispatchEvent = EVENT_DEATH; hitResult = HIT_RESULT_HIT; @@ -212,7 +212,7 @@ HitResult calc_item_damage_enemy(void) { if (dispatchEvent == EVENT_ZERO_DAMAGE) { dispatchEvent = EVENT_IMMUNE; } - if (target->currentHP <= 0 && dispatchEvent == EVENT_IMMUNE) { + if (target->curHP <= 0 && dispatchEvent == EVENT_IMMUNE) { dispatchEvent = EVENT_DEATH; } } else if (dispatchEvent == EVENT_DEATH) { @@ -220,7 +220,7 @@ HitResult calc_item_damage_enemy(void) { } if (gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE) { - if (battleStatus->currentAttackElement & DAMAGE_TYPE_REMOVE_BUFFS) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_REMOVE_BUFFS) { dispatchEvent = EVENT_IMMUNE; if (targetPart->eventFlags & ACTOR_EVENT_FLAG_ENCHANTED) { dispatchEvent = EVENT_STAR_BEAM; @@ -237,7 +237,7 @@ HitResult calc_item_damage_enemy(void) { } } - if (battleStatus->currentAttackElement & DAMAGE_TYPE_REMOVE_BUFFS) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_REMOVE_BUFFS) { if (gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE) { if ((target->attackBoost > 0 || target->defenseBoost > 0) || ((target->staticStatus == 0 && target->transparentStatus != 0) || target->staticStatus != 0)) @@ -263,7 +263,7 @@ HitResult calc_item_damage_enemy(void) { } if (gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE) { - if (battleStatus->currentAttackElement & DAMAGE_TYPE_PEACH_BEAM) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_PEACH_BEAM) { dispatchEvent = EVENT_IMMUNE; if (targetPart->eventFlags & ACTOR_EVENT_FLAG_ENCHANTED) { dispatchEvent = EVENT_PEACH_BEAM; @@ -277,7 +277,7 @@ HitResult calc_item_damage_enemy(void) { } if (gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE) { - if (battleStatus->currentAttackElement & DAMAGE_TYPE_SPIN_SMASH) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_SPIN_SMASH) { if (dispatchEvent == EVENT_HIT) { dispatchEvent = EVENT_SPIN_SMASH_HIT; } @@ -288,7 +288,7 @@ HitResult calc_item_damage_enemy(void) { } if ((gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE) - && (battleStatus->currentAttackElement & (DAMAGE_TYPE_JUMP | DAMAGE_TYPE_POW)) + && (battleStatus->curAttackElement & (DAMAGE_TYPE_JUMP | DAMAGE_TYPE_POW)) && (targetPart->eventFlags & ACTOR_EVENT_FLAG_GROUNDABLE) ) { if (dispatchEvent == EVENT_HIT) { @@ -300,7 +300,7 @@ HitResult calc_item_damage_enemy(void) { } if ((gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE) - && (battleStatus->currentAttackElement & DAMAGE_TYPE_POW) + && (battleStatus->curAttackElement & DAMAGE_TYPE_POW) && (targetPart->eventFlags & ACTOR_EVENT_FLAG_RIDING_BROOMSTICK) ) { if (dispatchEvent == EVENT_HIT) { @@ -312,7 +312,7 @@ HitResult calc_item_damage_enemy(void) { } if ((gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE) - && (battleStatus->currentAttackElement & (DAMAGE_TYPE_JUMP | DAMAGE_TYPE_POW | DAMAGE_TYPE_QUAKE)) + && (battleStatus->curAttackElement & (DAMAGE_TYPE_JUMP | DAMAGE_TYPE_POW | DAMAGE_TYPE_QUAKE)) && (targetPart->eventFlags & ACTOR_EVENT_FLAG_FLIPABLE) ) { if (dispatchEvent == EVENT_HIT) { @@ -324,7 +324,7 @@ HitResult calc_item_damage_enemy(void) { } if (gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE) { - if (battleStatus->currentAttackElement & DAMAGE_TYPE_FIRE) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_FIRE) { if (dispatchEvent == EVENT_HIT) { dispatchEvent = EVENT_BURN_HIT; } @@ -345,7 +345,7 @@ HitResult calc_item_damage_enemy(void) { // do-while-0 OR to wrap each one individually. It's more likely that it's a macro instead, and much cleaner #define INFLICT_STATUS(STATUS_TYPE) \ do { \ - if ((battleStatus->currentAttackStatus & STATUS_FLAG_##STATUS_TYPE) && \ + if ((battleStatus->curAttackStatus & STATUS_FLAG_##STATUS_TYPE) && \ try_inflict_status(target, STATUS_KEY_##STATUS_TYPE, STATUS_TURN_MOD_##STATUS_TYPE)) { \ wasStatusInflicted = TRUE; \ } \ @@ -377,7 +377,7 @@ HitResult calc_item_damage_enemy(void) { temp = target->actorBlueprint->spookChance; temp = (battleStatus->statusChance * temp) / 100; - if ((gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE) && (battleStatus->currentAttackElement & DAMAGE_TYPE_FEAR)) { + if ((gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE) && (battleStatus->curAttackElement & DAMAGE_TYPE_FEAR)) { if (rand_int(99) < temp && (target->debuff != STATUS_KEY_FEAR && target->debuff != STATUS_KEY_DIZZY @@ -410,7 +410,7 @@ HitResult calc_item_damage_enemy(void) { sfx_play_sound_at_position(SOUND_231, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if (battleStatus->lastAttackDamage > 0 || (battleStatus->currentAttackElement & DAMAGE_TYPE_STATUS_ALWAYS_HITS) && sp1C) { + if (battleStatus->lastAttackDamage > 0 || (battleStatus->curAttackElement & DAMAGE_TYPE_STATUS_ALWAYS_HITS) && sp1C) { if (gBattleStatus.flags1 & BS_FLAGS1_40) { show_action_rating(ACTION_RATING_NICE, target, state->goalPos.x, state->goalPos.y, state->goalPos.z); } else { @@ -437,7 +437,7 @@ HitResult calc_item_damage_enemy(void) { show_immune_bonk(state->goalPos.x, state->goalPos.y, state->goalPos.z, 0, 1, 3); } } else if (!partImmuneToElement) { - if (battleStatus->currentAttackElement & (DAMAGE_TYPE_MULTIPLE_POPUPS | DAMAGE_TYPE_SMASH)) { + if (battleStatus->curAttackElement & (DAMAGE_TYPE_MULTIPLE_POPUPS | DAMAGE_TYPE_SMASH)) { show_next_damage_popup(state->goalPos.x, state->goalPos.y, state->goalPos.z, battleStatus->lastAttackDamage, 0); } else { show_primary_damage_popup(state->goalPos.x, state->goalPos.y, state->goalPos.z, battleStatus->lastAttackDamage, 0); @@ -465,42 +465,42 @@ HitResult calc_item_damage_enemy(void) { sfx_play_sound_at_position(SOUND_IMMUNE, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if ((battleStatus->currentAttackStatus & STATUS_FLAG_SLEEP) && wasStatusInflicted) { + if ((battleStatus->curAttackStatus & STATUS_FLAG_SLEEP) && wasStatusInflicted) { script = start_script(&EVS_PlaySleepHitFX, EVT_PRIORITY_A, 0); script->varTable[0] = state->goalPos.x; script->varTable[1] = state->goalPos.y; script->varTable[2] = state->goalPos.z; sfx_play_sound_at_position(SOUND_INFLICT_SLEEP, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if ((battleStatus->currentAttackStatus & STATUS_FLAG_DIZZY) && wasStatusInflicted) { + if ((battleStatus->curAttackStatus & STATUS_FLAG_DIZZY) && wasStatusInflicted) { script = start_script(&EVS_PlayDizzyHitFX, EVT_PRIORITY_A, 0); script->varTable[0] = state->goalPos.x; script->varTable[1] = state->goalPos.y; script->varTable[2] = state->goalPos.z; sfx_play_sound_at_position(SOUND_INFLICT_STATUS, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if ((battleStatus->currentAttackStatus & STATUS_FLAG_PARALYZE) && wasStatusInflicted) { + if ((battleStatus->curAttackStatus & STATUS_FLAG_PARALYZE) && wasStatusInflicted) { script = start_script(&EVS_PlayParalyzeHitFX, EVT_PRIORITY_A, 0); script->varTable[0] = state->goalPos.x; script->varTable[1] = state->goalPos.y; script->varTable[2] = state->goalPos.z; sfx_play_sound_at_position(SOUND_INFLICT_STATUS, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if ((battleStatus->currentAttackStatus & STATUS_FLAG_POISON) && wasStatusInflicted) { + if ((battleStatus->curAttackStatus & STATUS_FLAG_POISON) && wasStatusInflicted) { script = start_script(&EVS_PlayPoisonHitFX, EVT_PRIORITY_A, 0); script->varTable[0] = state->goalPos.x; script->varTable[1] = state->goalPos.y; script->varTable[2] = state->goalPos.z; sfx_play_sound_at_position(SOUND_INFLICT_STATUS, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if ((battleStatus->currentAttackStatus & STATUS_FLAG_STOP) && wasStatusInflicted) { + if ((battleStatus->curAttackStatus & STATUS_FLAG_STOP) && wasStatusInflicted) { script = start_script(&EVS_PlayStopHitFX, EVT_PRIORITY_A, 0); script->varTable[0] = state->goalPos.x; script->varTable[1] = state->goalPos.y; script->varTable[2] = state->goalPos.z; sfx_play_sound_at_position(SOUND_INFLICT_STATUS, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if ((battleStatus->currentAttackStatus & STATUS_FLAG_FROZEN) && wasStatusInflicted) { + if ((battleStatus->curAttackStatus & STATUS_FLAG_FROZEN) && wasStatusInflicted) { script = start_script(&EVS_PlayFreezeHitFX, EVT_PRIORITY_A, 0); script->varTable[0] = state->goalPos.x; script->varTable[1] = state->goalPos.y; @@ -508,7 +508,7 @@ HitResult calc_item_damage_enemy(void) { script->varTablePtr[3] = target; sfx_play_sound_at_position(SOUND_INFLICT_STATUS, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if ((battleStatus->currentAttackStatus & STATUS_FLAG_SHRINK) && wasStatusInflicted) { + if ((battleStatus->curAttackStatus & STATUS_FLAG_SHRINK) && wasStatusInflicted) { script = start_script(&EVS_PlayShrinkHitFX, EVT_PRIORITY_A, 0); script->varTable[0] = state->goalPos.x; script->varTable[1] = state->goalPos.y; @@ -516,7 +516,7 @@ HitResult calc_item_damage_enemy(void) { script->varTablePtr[3] = target; sfx_play_sound_at_position(SOUND_INFLICT_STATUS, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if ((battleStatus->currentAttackElement & DAMAGE_TYPE_SMASH) && (target->actorType == ACTOR_TYPE_GOOMNUT_TREE)) { + if ((battleStatus->curAttackElement & DAMAGE_TYPE_SMASH) && (target->actorType == ACTOR_TYPE_GOOMNUT_TREE)) { sfx_play_sound_at_position(SOUND_SMASH_GOOMNUT_TREE, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } @@ -542,10 +542,10 @@ ApiStatus ItemDamageEnemy(Evt* script, s32 isInitialCall) { Actor* actor; HitResult hitResult; - battleStatus->currentAttackElement = *args++; - battleStatus->currentAttackEventSuppression = 0; - battleStatus->currentAttackStatus = *args++; - battleStatus->currentAttackDamage = evt_get_variable(script, *args++); + battleStatus->curAttackElement = *args++; + battleStatus->curAttackEventSuppression = 0; + battleStatus->curAttackStatus = *args++; + battleStatus->curAttackDamage = evt_get_variable(script, *args++); flags = *args++; if ((flags & (BS_FLAGS1_10 | BS_FLAGS1_SP_EVT_ACTIVE)) == (BS_FLAGS1_10 | BS_FLAGS1_SP_EVT_ACTIVE)) { @@ -581,15 +581,15 @@ ApiStatus ItemDamageEnemy(Evt* script, s32 isInitialCall) { } actor = get_actor(script->owner1.actorID); - battleStatus->currentTargetID = actor->targetActorID; - battleStatus->currentTargetPart = actor->targetPartIndex; - battleStatus->statusChance = battleStatus->currentAttackStatus; + battleStatus->curTargetID = actor->targetActorID; + battleStatus->curTargetPart = actor->targetPartIndex; + battleStatus->statusChance = battleStatus->curAttackStatus; if (battleStatus->statusChance == STATUS_KEY_NEVER) { battleStatus->statusChance = 0; } - battleStatus->statusDuration = (battleStatus->currentAttackStatus & 0xF00) >> 8; + battleStatus->statusDuration = (battleStatus->curAttackStatus & 0xF00) >> 8; hitResult = calc_item_damage_enemy(); if (hitResult < 0) { @@ -612,11 +612,11 @@ ApiStatus ItemSpookEnemy(Evt* script, s32 isInitialCall) { HitResult hitResult; s32 flags; - battleStatus->currentAttackElement = *args++; - battleStatus->currentAttackEventSuppression = 0; - battleStatus->currentAttackStatus = *args++; - battleStatus->currentAttackStatus |= evt_get_variable(script, *args++); - battleStatus->currentAttackDamage = evt_get_variable(script, *args++); + battleStatus->curAttackElement = *args++; + battleStatus->curAttackEventSuppression = 0; + battleStatus->curAttackStatus = *args++; + battleStatus->curAttackStatus |= evt_get_variable(script, *args++); + battleStatus->curAttackDamage = evt_get_variable(script, *args++); flags = *args++; if ((flags & (BS_FLAGS1_10 | BS_FLAGS1_SP_EVT_ACTIVE)) == (BS_FLAGS1_10 | BS_FLAGS1_SP_EVT_ACTIVE)) { @@ -651,15 +651,15 @@ ApiStatus ItemSpookEnemy(Evt* script, s32 isInitialCall) { } actor = get_actor(script->owner1.actorID); - battleStatus->currentTargetID = actor->targetActorID; - battleStatus->currentTargetPart = actor->targetPartIndex; - battleStatus->statusChance = battleStatus->currentAttackStatus; + battleStatus->curTargetID = actor->targetActorID; + battleStatus->curTargetPart = actor->targetPartIndex; + battleStatus->statusChance = battleStatus->curAttackStatus; if (battleStatus->statusChance == STATUS_KEY_NEVER) { battleStatus->statusChance = 0; } - battleStatus->statusDuration = (battleStatus->currentAttackStatus & 0xF00) >> 8; + battleStatus->statusDuration = (battleStatus->curAttackStatus & 0xF00) >> 8; hitResult = calc_item_damage_enemy(); if (hitResult < 0) { @@ -682,10 +682,10 @@ ApiStatus ItemAfflictEnemy(Evt* script, s32 isInitialCall) { Actor* actor; HitResult hitResult; - battleStatus->currentAttackElement = *args++; - battleStatus->currentAttackEventSuppression = 0; - battleStatus->currentAttackStatus = evt_get_variable(script, *args++); - battleStatus->currentAttackDamage = evt_get_variable(script, *args++); + battleStatus->curAttackElement = *args++; + battleStatus->curAttackEventSuppression = 0; + battleStatus->curAttackStatus = evt_get_variable(script, *args++); + battleStatus->curAttackDamage = evt_get_variable(script, *args++); flags = *args++; if ((flags & (BS_FLAGS1_10 | BS_FLAGS1_SP_EVT_ACTIVE)) == (BS_FLAGS1_10 | BS_FLAGS1_SP_EVT_ACTIVE)) { @@ -720,15 +720,15 @@ ApiStatus ItemAfflictEnemy(Evt* script, s32 isInitialCall) { } actor = get_actor(script->owner1.actorID); - battleStatus->currentTargetID = actor->targetActorID; - battleStatus->currentTargetPart = actor->targetPartIndex; - battleStatus->statusChance = battleStatus->currentAttackStatus; + battleStatus->curTargetID = actor->targetActorID; + battleStatus->curTargetPart = actor->targetPartIndex; + battleStatus->statusChance = battleStatus->curAttackStatus; if (battleStatus->statusChance == STATUS_KEY_NEVER) { battleStatus->statusChance = 0; } - battleStatus->statusDuration = (battleStatus->currentAttackStatus & 0xF00) >> 8; + battleStatus->statusDuration = (battleStatus->curAttackStatus & 0xF00) >> 8; hitResult = calc_item_damage_enemy(); if (hitResult < 0) { @@ -751,10 +751,10 @@ ApiStatus ItemCheckHit(Evt* script, s32 isInitialCall) { Actor* actor; HitResult hitResult; - battleStatus->currentAttackElement = *args++; - battleStatus->currentAttackEventSuppression = 0; - battleStatus->currentAttackStatus = *args++; - battleStatus->currentAttackDamage = evt_get_variable(script, *args++); + battleStatus->curAttackElement = *args++; + battleStatus->curAttackEventSuppression = 0; + battleStatus->curAttackStatus = *args++; + battleStatus->curAttackDamage = evt_get_variable(script, *args++); flags = *args++; if ((flags & (BS_FLAGS1_10 | BS_FLAGS1_SP_EVT_ACTIVE)) == (BS_FLAGS1_10 | BS_FLAGS1_SP_EVT_ACTIVE)) { @@ -789,15 +789,15 @@ ApiStatus ItemCheckHit(Evt* script, s32 isInitialCall) { } actor = get_actor(script->owner1.actorID); - battleStatus->currentTargetID = actor->targetActorID; - battleStatus->currentTargetPart = actor->targetPartIndex; - battleStatus->statusChance = battleStatus->currentAttackStatus; + battleStatus->curTargetID = actor->targetActorID; + battleStatus->curTargetPart = actor->targetPartIndex; + battleStatus->statusChance = battleStatus->curAttackStatus; if (battleStatus->statusChance == STATUS_KEY_NEVER) { battleStatus->statusChance = 0; } - battleStatus->statusDuration = (battleStatus->currentAttackStatus & 0xF00) >> 8; + battleStatus->statusDuration = (battleStatus->curAttackStatus & 0xF00) >> 8; hitResult = calc_item_check_hit(); if (hitResult < 0) { diff --git a/src/181810.c b/src/181810.c index 974183067f3..b8dfd7015a0 100644 --- a/src/181810.c +++ b/src/181810.c @@ -141,14 +141,14 @@ ApiStatus ActorSpeak(Evt* script, s32 isInitialCall) { gSpeakingActor = actor; gSpeakingActorPart = part; - headX = actor->currentPos.x + actor->headOffset.x; + headX = actor->curPos.x + actor->headOffset.x; if (!(actor->flags & ACTOR_FLAG_8000)) { - headY = actor->size.y + (actor->currentPos.y + actor->headOffset.y); + headY = actor->size.y + (actor->curPos.y + actor->headOffset.y); } else { - headY = actor->currentPos.y + actor->headOffset.y + (actor->size.y / 2); + headY = actor->curPos.y + actor->headOffset.y + (actor->size.y / 2); } - headZ = actor->currentPos.z + actor->headOffset.z; + headZ = actor->curPos.z + actor->headOffset.z; get_screen_coords(CAM_BATTLE, headX, headY, headZ, &screenX, &screenY, &screenZ); gSpeakingActorPrintIsDone = FALSE; @@ -167,15 +167,15 @@ ApiStatus ActorSpeak(Evt* script, s32 isInitialCall) { actor = gSpeakingActor; part = gSpeakingActorPart; - headX = actor->currentPos.x + actor->headOffset.x; + headX = actor->curPos.x + actor->headOffset.x; if (!(actor->flags & ACTOR_FLAG_8000)) { - headY = actor->size.y + (actor->currentPos.y + actor->headOffset.y); + headY = actor->size.y + (actor->curPos.y + actor->headOffset.y); } else { headY = actor->headOffset.y; - headY = actor->currentPos.y + actor->headOffset.y + (actor->size.y / 2); + headY = actor->curPos.y + actor->headOffset.y + (actor->size.y / 2); } - headZ = actor->currentPos.z + actor->headOffset.z; + headZ = actor->curPos.z + actor->headOffset.z; get_screen_coords(CAM_BATTLE, headX, headY, headZ, &screenX, &screenY, &screenZ); msg_printer_set_origin_pos(gSpeakingActorPrintCtx, screenX, screenY); @@ -235,13 +235,13 @@ ApiStatus EndActorSpeech(Evt* script, s32 isInitialCall) { Actor* actor = gSpeakingActor; ActorPart* actorPart = gSpeakingActorPart; - x = actor->currentPos.x + actor->headOffset.x; + x = actor->curPos.x + actor->headOffset.x; if (!(gSpeakingActor->flags & ACTOR_FLAG_8000)) { - y = actor->currentPos.y + actor->headOffset.y + actor->size.y ; + y = actor->curPos.y + actor->headOffset.y + actor->size.y ; } else { - y = actor->currentPos.y + actor->headOffset.y + actor->size.y / 2; + y = actor->curPos.y + actor->headOffset.y + actor->size.y / 2; } - z = actor->currentPos.z + actor->headOffset.z; + z = actor->curPos.z + actor->headOffset.z; get_screen_coords(CAM_BATTLE, x, y, z, &screenX, &screenY, &screenZ); msg_printer_set_origin_pos(gSpeakingActorPrintCtx, screenX, screenY); @@ -282,9 +282,9 @@ ApiStatus ShowBattleChoice(Evt* script, s32 isInitialCall) { } if (script->functionTemp[1] == 1) { - u8 currentOption = D_8029FA64->currentOption; + u8 currentOption = D_8029FA64->curOption; - gSpeakingActorPrintCtx->currentOption = D_8029FA64->currentOption; + gSpeakingActorPrintCtx->curOption = D_8029FA64->curOption; script->varTable[0] = currentOption; return ApiStatus_DONE1; @@ -401,7 +401,7 @@ ApiStatus PlaySoundAtActor(Evt* script, s32 isInitialCall) { } actor = get_actor(actorID); - sfx_play_sound_at_position(soundID, SOUND_SPACE_MODE_0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z); + sfx_play_sound_at_position(soundID, SOUND_SPACE_MODE_0, actor->curPos.x, actor->curPos.y, actor->curPos.z); return ApiStatus_DONE2; } @@ -418,7 +418,7 @@ ApiStatus PlaySoundAtPart(Evt* script, s32 isInitialCall) { } part = get_actor_part(get_actor(actorID), partID); - sfx_play_sound_at_position(soundID, SOUND_SPACE_MODE_0, part->currentPos.x, part->currentPos.y, part->currentPos.z); + sfx_play_sound_at_position(soundID, SOUND_SPACE_MODE_0, part->curPos.x, part->curPos.y, part->curPos.z); return ApiStatus_DONE2; } @@ -436,7 +436,7 @@ ApiStatus PlayLoopingSoundAtActor(Evt* script, s32 isInitialCall) { actor = get_actor(actorID); actor->loopingSoundID[idx] = soundID; - sfx_play_sound_at_position(soundID, SOUND_SPACE_MODE_0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z); + sfx_play_sound_at_position(soundID, SOUND_SPACE_MODE_0, actor->curPos.x, actor->curPos.y, actor->curPos.z); return ApiStatus_DONE2; } diff --git a/src/182B30.c b/src/182B30.c index 88366dc5869..cc0a87b8e9d 100644 --- a/src/182B30.c +++ b/src/182B30.c @@ -210,16 +210,16 @@ void enable_actor_blur(Actor* actor) { decorationTable->unk_7D8 = 0; decorationTable->unk_7D9 = 0; for (j = 0; j < ARRAY_COUNT(decorationTable->posX); j++) { - decorationTable->posX[j] = partsTable->currentPos.x; - decorationTable->posY[j] = partsTable->currentPos.y; - decorationTable->posZ[j] = partsTable->currentPos.z; + decorationTable->posX[j] = partsTable->curPos.x; + decorationTable->posY[j] = partsTable->curPos.y; + decorationTable->posZ[j] = partsTable->curPos.z; decorationTable->yaw[j] = actor->yaw; - decorationTable->rotationPivotOffsetX[j] = (s32)(actor->rotationPivotOffset.x * actor->scalingFactor); - decorationTable->rotationPivotOffsetY[j] = (s32)(actor->rotationPivotOffset.y * actor->scalingFactor); + decorationTable->rotPivotOffsetX[j] = (s32)(actor->rotPivotOffset.x * actor->scalingFactor); + decorationTable->rotPivotOffsetY[j] = (s32)(actor->rotPivotOffset.y * actor->scalingFactor); - decorationTable->rotX[j] = clamp_angle(actor->rotation.x) * 0.5f; - decorationTable->rotY[j] = clamp_angle(actor->rotation.y) * 0.5f; - decorationTable->rotZ[j] = clamp_angle(actor->rotation.z) * 0.5f; + decorationTable->rotX[j] = clamp_angle(actor->rot.x) * 0.5f; + decorationTable->rotY[j] = clamp_angle(actor->rot.y) * 0.5f; + decorationTable->rotZ[j] = clamp_angle(actor->rot.z) * 0.5f; } } partsTable = partsTable->nextPart; @@ -297,16 +297,16 @@ void enable_player_blur(void) { decorationTable->unk_7D9 = 0; for (i = 0; i < ARRAY_COUNT(decorationTable->posX); i++) { - decorationTable->posX[i] = partsTable->currentPos.x; - decorationTable->posY[i] = partsTable->currentPos.y; - decorationTable->posZ[i] = partsTable->currentPos.z; + decorationTable->posX[i] = partsTable->curPos.x; + decorationTable->posY[i] = partsTable->curPos.y; + decorationTable->posZ[i] = partsTable->curPos.z; decorationTable->yaw[i] = playerActor->yaw; - decorationTable->rotationPivotOffsetX[i] = playerActor->rotationPivotOffset.x * playerActor->scalingFactor; - decorationTable->rotationPivotOffsetY[i] = playerActor->rotationPivotOffset.y * playerActor->scalingFactor; + decorationTable->rotPivotOffsetX[i] = playerActor->rotPivotOffset.x * playerActor->scalingFactor; + decorationTable->rotPivotOffsetY[i] = playerActor->rotPivotOffset.y * playerActor->scalingFactor; - decorationTable->rotX[i] = clamp_angle(playerActor->rotation.x) * 0.5f; - decorationTable->rotY[i] = clamp_angle(playerActor->rotation.y) * 0.5f; - decorationTable->rotZ[i] = clamp_angle(playerActor->rotation.z) * 0.5f; + decorationTable->rotX[i] = clamp_angle(playerActor->rot.x) * 0.5f; + decorationTable->rotY[i] = clamp_angle(playerActor->rot.y) * 0.5f; + decorationTable->rotZ[i] = clamp_angle(playerActor->rot.z) * 0.5f; } } @@ -357,17 +357,17 @@ void func_802549F4(Actor* actor) { if (!(partsTable->flags & ACTOR_PART_FLAG_INVISIBLE) && partsTable->idleAnimations != NULL) { s32 i = decorationTable->unk_7D9; - decorationTable->posX[i] = partsTable->currentPos.x; - decorationTable->posY[i] = partsTable->currentPos.y; - decorationTable->posZ[i] = partsTable->currentPos.z; + decorationTable->posX[i] = partsTable->curPos.x; + decorationTable->posY[i] = partsTable->curPos.y; + decorationTable->posZ[i] = partsTable->curPos.z; decorationTable->yaw[i] = actor->yaw; - decorationTable->rotationPivotOffsetX[i] = actor->rotationPivotOffset.x * actor->scalingFactor; - decorationTable->rotationPivotOffsetY[i] = actor->rotationPivotOffset.y * actor->scalingFactor; + decorationTable->rotPivotOffsetX[i] = actor->rotPivotOffset.x * actor->scalingFactor; + decorationTable->rotPivotOffsetY[i] = actor->rotPivotOffset.y * actor->scalingFactor; - decorationTable->rotX[i] = clamp_angle(actor->rotation.x) * 0.5f; - decorationTable->rotY[i] = clamp_angle(actor->rotation.y) * 0.5f; - decorationTable->rotZ[i] = clamp_angle(actor->rotation.z) * 0.5f; + decorationTable->rotX[i] = clamp_angle(actor->rot.x) * 0.5f; + decorationTable->rotY[i] = clamp_angle(actor->rot.y) * 0.5f; + decorationTable->rotZ[i] = clamp_angle(actor->rot.z) * 0.5f; i++; if (i >= ARRAY_COUNT(decorationTable->posX)) { @@ -436,8 +436,8 @@ void appendGfx_player_actor_blur(Actor* actor) { yaw = decorationTable->yaw[bufPos]; - pivotOffsetX = decorationTable->rotationPivotOffsetX[bufPos]; - pivotOffsetY = decorationTable->rotationPivotOffsetY[bufPos]; + pivotOffsetX = decorationTable->rotPivotOffsetX[bufPos]; + pivotOffsetY = decorationTable->rotPivotOffsetY[bufPos]; rotX = decorationTable->rotX[bufPos] * 2; rotY = decorationTable->rotY[bufPos] * 2; @@ -493,17 +493,17 @@ void func_802550BC(s32 arg0, Actor* actor) { decorationTable = partsTable->decorationTable; j = decorationTable->unk_7D9; - decorationTable->posX[j] = partsTable->currentPos.x; - decorationTable->posY[j] = partsTable->currentPos.y; - decorationTable->posZ[j] = partsTable->currentPos.z; + decorationTable->posX[j] = partsTable->curPos.x; + decorationTable->posY[j] = partsTable->curPos.y; + decorationTable->posZ[j] = partsTable->curPos.z; decorationTable->yaw[j] = actor->yaw; - decorationTable->rotationPivotOffsetX[j] = actor->rotationPivotOffset.x; - decorationTable->rotationPivotOffsetY[j] = actor->rotationPivotOffset.y; + decorationTable->rotPivotOffsetX[j] = actor->rotPivotOffset.x; + decorationTable->rotPivotOffsetY[j] = actor->rotPivotOffset.y; - decorationTable->rotX[j] = clamp_angle(actor->rotation.x) * 0.5f; - decorationTable->rotY[j] = clamp_angle(actor->rotation.y) * 0.5f; - decorationTable->rotZ[j] = clamp_angle(actor->rotation.z) * 0.5f; + decorationTable->rotX[j] = clamp_angle(actor->rot.x) * 0.5f; + decorationTable->rotY[j] = clamp_angle(actor->rot.y) * 0.5f; + decorationTable->rotZ[j] = clamp_angle(actor->rot.z) * 0.5f; j++; if (j >= ARRAY_COUNT(decorationTable->posX)) { @@ -535,9 +535,9 @@ void func_802552EC(s32 arg0, Actor* actor) { s32 temp; s32 flags; - guRotateF(mtxRotX, actor->rotation.x, 1.0f, 0.0f, 0.0f); - guRotateF(mtxRotY, actor->rotation.y, 0.0f, 1.0f, 0.0f); - guRotateF(mtxRotZ, actor->rotation.z, 0.0f, 0.0f, 1.0f); + guRotateF(mtxRotX, actor->rot.x, 1.0f, 0.0f, 0.0f); + guRotateF(mtxRotY, actor->rot.y, 0.0f, 1.0f, 0.0f); + guRotateF(mtxRotZ, actor->rot.z, 0.0f, 0.0f, 1.0f); guMtxCatF(mtxRotX, mtxRotY, mtxTemp); guMtxCatF(mtxTemp, mtxRotZ, mtxRotation); guScaleF(mtxScale, actor->scale.x * SPRITE_WORLD_SCALE_D * actor->scalingFactor, @@ -607,8 +607,8 @@ void func_802552EC(s32 arg0, Actor* actor) { yaw = decorationTable->yaw[j]; - pivotX = decorationTable->rotationPivotOffsetX[j]; - pivotY = decorationTable->rotationPivotOffsetY[j]; + pivotX = decorationTable->rotPivotOffsetX[j]; + pivotY = decorationTable->rotPivotOffsetY[j]; rotX = decorationTable->rotX[j] * 2; rotY = decorationTable->rotY[j] * 2; @@ -709,13 +709,13 @@ void update_actor_shadow(s32 arg0, Actor* actor) { } actor->renderMode = RENDER_MODE_ALPHATEST; - x1 = actor->currentPos.x + actor->headOffset.x; + x1 = actor->curPos.x + actor->headOffset.x; if (!(actor->flags & ACTOR_FLAG_UPSIDE_DOWN)) { - y1 = actor->currentPos.y + actor->headOffset.y; + y1 = actor->curPos.y + actor->headOffset.y; } else { - y1 = actor->currentPos.y - actor->headOffset.y; + y1 = actor->curPos.y - actor->headOffset.y; } - z1 = actor->currentPos.z + actor->headOffset.z; + z1 = actor->curPos.z + actor->headOffset.z; numParts = actor->numParts; actorPart = actor->partsTable; @@ -723,7 +723,7 @@ void update_actor_shadow(s32 arg0, Actor* actor) { if (!(actorPart->flags & ACTOR_PART_FLAG_INVISIBLE) && actorPart->idleAnimations != NULL) { spriteID = actorPart->spriteInstanceID; if (spriteID >= 0) { - spr_update_sprite(spriteID, actorPart->currentAnimation, actorPart->animationRate); + spr_update_sprite(spriteID, actorPart->curAnimation, actorPart->animationRate); actorPart->animNotifyValue = spr_get_notify_value(actorPart->spriteInstanceID); } @@ -737,25 +737,25 @@ void update_actor_shadow(s32 arg0, Actor* actor) { z2 = z1 + actorPart->partOffset.z + actorPart->visualOffset.z; yaw = actorPart->yaw = actor->yaw; } else { - x2 = actorPart->absolutePosition.x + actorPart->visualOffset.x; - y2 = actorPart->absolutePosition.y + actorPart->visualOffset.y; - z2 = actorPart->absolutePosition.z + actorPart->visualOffset.z; + x2 = actorPart->absolutePos.x + actorPart->visualOffset.x; + y2 = actorPart->absolutePos.y + actorPart->visualOffset.y; + z2 = actorPart->absolutePos.z + actorPart->visualOffset.z; yaw = actorPart->yaw; } - actorPart->currentPos.x = x2; - actorPart->currentPos.y = y2; - actorPart->currentPos.z = z2; + actorPart->curPos.x = x2; + actorPart->curPos.y = y2; + actorPart->curPos.z = z2; if (!(actorPart->flags & ACTOR_PART_FLAG_4)) { shadow = get_shadow_by_index(actorPart->shadowIndex); shadow->flags &= ~ENTITY_FLAG_HIDDEN; - x1 = actorPart->currentPos.x; + x1 = actorPart->curPos.x; if (!(actor->flags & ACTOR_FLAG_UPSIDE_DOWN)) { - y1 = actorPart->currentPos.y + 12.0; + y1 = actorPart->curPos.y + 12.0; } else { - y1 = actorPart->currentPos.y - 12.0; + y1 = actorPart->curPos.y - 12.0; } - z1 = actorPart->currentPos.z; + z1 = actorPart->curPos.z; dist = 32767.0f; npc_raycast_down_sides(0, &x1, &y1, &z1, &dist); @@ -763,10 +763,10 @@ void update_actor_shadow(s32 arg0, Actor* actor) { if (200.0f < dist) { shadow->flags |= ENTITY_FLAG_HIDDEN; } - shadow->position.x = x1; - shadow->position.y = y1; - shadow->position.z = z1; - shadow->rotation.y = clamp_angle(yaw - camera->currentYaw); + shadow->pos.x = x1; + shadow->pos.y = y1; + shadow->pos.z = z1; + shadow->rot.y = clamp_angle(yaw - camera->curYaw); set_standard_shadow_scale(shadow, dist); shadow->scale.x *= actorPart->shadowScale; } @@ -782,13 +782,13 @@ void update_actor_shadow(s32 arg0, Actor* actor) { shadow->flags &= ~ENTITY_FLAG_HIDDEN; } - x1 = actor->currentPos.x + actor->headOffset.x; + x1 = actor->curPos.x + actor->headOffset.x; if (!(actor->flags & ACTOR_FLAG_UPSIDE_DOWN)) { - y1 = actor->currentPos.y + actor->headOffset.y + 12.0; + y1 = actor->curPos.y + actor->headOffset.y + 12.0; } else { - y1 = actor->currentPos.y - actor->headOffset.y + 12.0; + y1 = actor->curPos.y - actor->headOffset.y + 12.0; } - z1 = actor->currentPos.z + actor->headOffset.z; + z1 = actor->curPos.z + actor->headOffset.z; dist = 32767.0f; npc_raycast_down_sides(0, &x1, &y1, &z1, &dist); @@ -796,10 +796,10 @@ void update_actor_shadow(s32 arg0, Actor* actor) { if (200.0f < dist) { shadow->flags |= ENTITY_FLAG_HIDDEN; } - shadow->position.x = x1; - shadow->position.y = y1; - shadow->position.z = z1 + bActorOffsets[actor->actorType].shadow; - shadow->rotation.y = clamp_angle(actor->yaw - camera->currentYaw); + shadow->pos.x = x1; + shadow->pos.y = y1; + shadow->pos.z = z1 + bActorOffsets[actor->actorType].shadow; + shadow->rot.y = clamp_angle(actor->yaw - camera->curYaw); set_standard_shadow_scale(shadow, dist); shadow->scale.x *= actor->shadowScale * actor->scalingFactor; } @@ -846,13 +846,13 @@ void appendGfx_npc_actor(s32 isPartner, s32 actorIndex) { } else { actor = battleStatus->partnerActor; } - actorPosX = actor->currentPos.x + actor->headOffset.x; + actorPosX = actor->curPos.x + actor->headOffset.x; if (!(actor->flags & ACTOR_FLAG_UPSIDE_DOWN)) { - actorPosY = actor->currentPos.y + actor->headOffset.y + actor->verticalRenderOffset; + actorPosY = actor->curPos.y + actor->headOffset.y + actor->verticalRenderOffset; } else { - actorPosY = actor->currentPos.y - actor->headOffset.y + actor->verticalRenderOffset; + actorPosY = actor->curPos.y - actor->headOffset.y + actor->verticalRenderOffset; } - actorPosZ = actor->currentPos.z + actor->headOffset.z; + actorPosZ = actor->curPos.z + actor->headOffset.z; actor->disableEffect->data.disableX->pos.x = actorPosX + (actor->actorBlueprint->statusIconOffset.x + actor->statusIconOffset.x) * actor->scalingFactor; @@ -920,26 +920,26 @@ void appendGfx_npc_actor(s32 isPartner, s32 actorIndex) { if (!(actor->flags & ACTOR_FLAG_UPSIDE_DOWN)) { guTranslateF(mtxPivotOn, - -actor->rotationPivotOffset.x * actor->scalingFactor, - -actor->rotationPivotOffset.y * actor->scalingFactor, - -actor->rotationPivotOffset.z * actor->scalingFactor); + -actor->rotPivotOffset.x * actor->scalingFactor, + -actor->rotPivotOffset.y * actor->scalingFactor, + -actor->rotPivotOffset.z * actor->scalingFactor); guTranslateF(mtxPivotOff, - actor->rotationPivotOffset.x * actor->scalingFactor, - actor->rotationPivotOffset.y * actor->scalingFactor, - actor->rotationPivotOffset.z * actor->scalingFactor); + actor->rotPivotOffset.x * actor->scalingFactor, + actor->rotPivotOffset.y * actor->scalingFactor, + actor->rotPivotOffset.z * actor->scalingFactor); } else { guTranslateF(mtxPivotOn, - -actor->rotationPivotOffset.x * actor->scalingFactor, - actor->rotationPivotOffset.y * actor->scalingFactor, - -actor->rotationPivotOffset.z * actor->scalingFactor); + -actor->rotPivotOffset.x * actor->scalingFactor, + actor->rotPivotOffset.y * actor->scalingFactor, + -actor->rotPivotOffset.z * actor->scalingFactor); guTranslateF(mtxPivotOff, - actor->rotationPivotOffset.x * actor->scalingFactor, - -actor->rotationPivotOffset.y * actor->scalingFactor, - actor->rotationPivotOffset.z * actor->scalingFactor); + actor->rotPivotOffset.x * actor->scalingFactor, + -actor->rotPivotOffset.y * actor->scalingFactor, + actor->rotPivotOffset.z * actor->scalingFactor); } - guRotateF(mtxRotX, actor->rotation.x, 1.0f, 0.0f, 0.0f); - guRotateF(mtxRotY, actor->rotation.y, 0.0f, 1.0f, 0.0f); - guRotateF(mtxRotZ, actor->rotation.z, 0.0f, 0.0f, 1.0f); + guRotateF(mtxRotX, actor->rot.x, 1.0f, 0.0f, 0.0f); + guRotateF(mtxRotY, actor->rot.y, 0.0f, 1.0f, 0.0f); + guRotateF(mtxRotZ, actor->rot.z, 0.0f, 0.0f, 1.0f); guMtxCatF(mtxRotY, mtxRotX, mtxTemp); guMtxCatF(mtxTemp, mtxRotZ, mtxRotation); guScaleF(mtxScale, @@ -965,18 +965,18 @@ void appendGfx_npc_actor(s32 isPartner, s32 actorIndex) { partPosZ = actorPosZ + part->partOffset.z + part->visualOffset.z; partYaw = part->yaw = actor->yaw; } else { - partPosX = part->absolutePosition.x + part->visualOffset.x; - partPosY = part->absolutePosition.y + part->visualOffset.y; - partPosZ = part->absolutePosition.z + part->visualOffset.z; + partPosX = part->absolutePos.x + part->visualOffset.x; + partPosY = part->absolutePos.y + part->visualOffset.y; + partPosZ = part->absolutePos.z + part->visualOffset.z; guScaleF(mtxPartScale, actor->scale.x * SPRITE_WORLD_SCALE_D, actor->scale.y * SPRITE_WORLD_SCALE_D, actor->scale.z * SPRITE_WORLD_SCALE_D); partYaw = part->yaw; } - part->currentPos.x = partPosX; - part->currentPos.y = partPosY; - part->currentPos.z = partPosZ; + part->curPos.x = partPosX; + part->curPos.y = partPosY; + part->curPos.z = partPosZ; if (part->flags & ACTOR_PART_FLAG_INVISIBLE) { part = part->nextPart; @@ -994,7 +994,7 @@ void appendGfx_npc_actor(s32 isPartner, s32 actorIndex) { } do { - lastAnim = part->currentAnimation; + lastAnim = part->curAnimation; animChanged = FALSE; palChanged = FALSE; decorChanged = FALSE; @@ -1004,8 +1004,8 @@ void appendGfx_npc_actor(s32 isPartner, s32 actorIndex) { if ((gBattleStatus.flags2 & (BS_FLAGS2_10 | BS_FLAGS2_4)) == BS_FLAGS2_4) { do { if (actor->koStatus == 0) { - part->currentAnimation = get_npc_anim_for_status(part->idleAnimations, STATUS_KEY_INACTIVE); - spr_update_sprite(part->spriteInstanceID, part->currentAnimation, part->animationRate); + part->curAnimation = get_npc_anim_for_status(part->idleAnimations, STATUS_KEY_INACTIVE); + spr_update_sprite(part->spriteInstanceID, part->curAnimation, part->animationRate); animChanged = TRUE; } } while (0); // required to match @@ -1014,7 +1014,7 @@ void appendGfx_npc_actor(s32 isPartner, s32 actorIndex) { func_80266EE8(actor, UNK_PAL_EFFECT_0); decorChanged = TRUE; } - if (isPartner && (gPlayerData.currentPartner == PARTNER_WATT)) { + if (isPartner && (gPlayerData.curPartner == PARTNER_WATT)) { if (!palChanged) { set_actor_pal_adjustment(actor, PAL_ADJUST_WATT_IDLE); } @@ -1061,33 +1061,33 @@ void appendGfx_npc_actor(s32 isPartner, s32 actorIndex) { if (!(part->flags & ACTOR_PART_FLAG_20000000)) { if (actor->debuff == STATUS_KEY_FROZEN) { if (!animChanged) { - part->currentAnimation = get_npc_anim_for_status(part->idleAnimations, STATUS_KEY_FROZEN); + part->curAnimation = get_npc_anim_for_status(part->idleAnimations, STATUS_KEY_FROZEN); animChanged = TRUE; } } else if (actor->debuff != STATUS_KEY_SHRINK) { if (actor->debuff == STATUS_KEY_POISON) { if (!animChanged) { - part->currentAnimation = get_npc_anim_for_status(part->idleAnimations, STATUS_KEY_POISON); + part->curAnimation = get_npc_anim_for_status(part->idleAnimations, STATUS_KEY_POISON); animChanged = TRUE; } } else if (actor->debuff == STATUS_KEY_DIZZY) { if (!animChanged) { - part->currentAnimation = get_npc_anim_for_status(part->idleAnimations, STATUS_KEY_DIZZY); + part->curAnimation = get_npc_anim_for_status(part->idleAnimations, STATUS_KEY_DIZZY); animChanged = TRUE; } } else if (actor->debuff == STATUS_KEY_FEAR) { if (!animChanged) { - part->currentAnimation = get_npc_anim_for_status(part->idleAnimations, STATUS_KEY_FEAR); + part->curAnimation = get_npc_anim_for_status(part->idleAnimations, STATUS_KEY_FEAR); animChanged = TRUE; } } else if (actor->debuff == STATUS_KEY_SLEEP) { if (!animChanged) { - part->currentAnimation = get_npc_anim_for_status(part->idleAnimations, STATUS_KEY_SLEEP); + part->curAnimation = get_npc_anim_for_status(part->idleAnimations, STATUS_KEY_SLEEP); animChanged = TRUE; } } else if (actor->debuff == STATUS_KEY_PARALYZE) { if (!animChanged) { - part->currentAnimation = get_npc_anim_for_status(part->idleAnimations, STATUS_KEY_PARALYZE); + part->curAnimation = get_npc_anim_for_status(part->idleAnimations, STATUS_KEY_PARALYZE); animChanged = TRUE; } } @@ -1095,37 +1095,37 @@ void appendGfx_npc_actor(s32 isPartner, s32 actorIndex) { if (actor->staticStatus == STATUS_KEY_STATIC) { if (!animChanged) { - part->currentAnimation = get_npc_anim_for_status(part->idleAnimations, STATUS_KEY_STATIC); + part->curAnimation = get_npc_anim_for_status(part->idleAnimations, STATUS_KEY_STATIC); animChanged = TRUE; } do {} while (0); // required to match } if (!animChanged) { - part->currentAnimation = get_npc_anim_for_status(part->idleAnimations, 1); + part->curAnimation = get_npc_anim_for_status(part->idleAnimations, 1); } if (isPartner) { if (actor->koStatus == STATUS_KEY_DAZE) { - part->currentAnimation = get_npc_anim_for_status(part->idleAnimations, STATUS_KEY_DAZE); + part->curAnimation = get_npc_anim_for_status(part->idleAnimations, STATUS_KEY_DAZE); animChanged = TRUE; } else { s32 temp = get_npc_anim_for_status(part->idleAnimations, STATUS_KEY_NORMAL); do { if (temp == get_npc_anim_for_status(part->idleAnimations, STATUS_KEY_DAZE)) { - part->currentAnimation = get_npc_anim_for_status(part->idleAnimations, STATUS_KEY_NORMAL); + part->curAnimation = get_npc_anim_for_status(part->idleAnimations, STATUS_KEY_NORMAL); } } while (0); // required to match } } if (actor->debuff == STATUS_KEY_STOP) { - part->currentAnimation = get_npc_anim_for_status(part->idleAnimations, STATUS_KEY_STOP); + part->curAnimation = get_npc_anim_for_status(part->idleAnimations, STATUS_KEY_STOP); create_status_debuff(actor->hudElementDataIndex, STATUS_KEY_STOP); } else if (!animChanged) { s32 temp = get_npc_anim_for_status(part->idleAnimations, STATUS_KEY_NORMAL); do { if (temp == get_npc_anim_for_status(part->idleAnimations, STATUS_KEY_STOP)) { - part->currentAnimation = get_npc_anim_for_status(part->idleAnimations, STATUS_KEY_NORMAL); + part->curAnimation = get_npc_anim_for_status(part->idleAnimations, STATUS_KEY_NORMAL); } } while (0); // required to match } @@ -1165,37 +1165,37 @@ void appendGfx_npc_actor(s32 isPartner, s32 actorIndex) { enable_status_chill_out(actor->hudElementDataIndex); } if (part->spriteInstanceID >= 0) { - if (lastAnim != part->currentAnimation) { - spr_update_sprite(part->spriteInstanceID, part->currentAnimation, part->animationRate); + if (lastAnim != part->curAnimation) { + spr_update_sprite(part->spriteInstanceID, part->curAnimation, part->animationRate); part->animNotifyValue = spr_get_notify_value(part->spriteInstanceID); } } if (!(actor->flags & ACTOR_FLAG_UPSIDE_DOWN)) { guTranslateF(mtxPivotOn, - -part->rotationPivotOffset.x * actor->scalingFactor, - -part->rotationPivotOffset.y * actor->scalingFactor, - -part->rotationPivotOffset.z * actor->scalingFactor); + -part->rotPivotOffset.x * actor->scalingFactor, + -part->rotPivotOffset.y * actor->scalingFactor, + -part->rotPivotOffset.z * actor->scalingFactor); guTranslateF(mtxPivotOff, - part->rotationPivotOffset.x * actor->scalingFactor, - part->rotationPivotOffset.y * actor->scalingFactor, - part->rotationPivotOffset.z * actor->scalingFactor); + part->rotPivotOffset.x * actor->scalingFactor, + part->rotPivotOffset.y * actor->scalingFactor, + part->rotPivotOffset.z * actor->scalingFactor); } else { guTranslateF(mtxPivotOn, - -part->rotationPivotOffset.x * actor->scalingFactor, - part->rotationPivotOffset.y * actor->scalingFactor, - -part->rotationPivotOffset.z * actor->scalingFactor); + -part->rotPivotOffset.x * actor->scalingFactor, + part->rotPivotOffset.y * actor->scalingFactor, + -part->rotPivotOffset.z * actor->scalingFactor); guTranslateF(mtxPivotOff, - part->rotationPivotOffset.x * actor->scalingFactor, - -part->rotationPivotOffset.y * actor->scalingFactor, - part->rotationPivotOffset.z * actor->scalingFactor); + part->rotPivotOffset.x * actor->scalingFactor, + -part->rotPivotOffset.y * actor->scalingFactor, + part->rotPivotOffset.z * actor->scalingFactor); } guTranslateF(mtxTranslate, partPosX + part->palAnimPosOffset[0], partPosY + part->palAnimPosOffset[1], partPosZ); - guRotateF(mtxRotX, part->rotation.x, 1.0f, 0.0f, 0.0f); - guRotateF(mtxRotY, part->rotation.y, 0.0f, 1.0f, 0.0f); - guRotateF(mtxRotZ, part->rotation.z, 0.0f, 0.0f, 1.0f); + guRotateF(mtxRotX, part->rot.x, 1.0f, 0.0f, 0.0f); + guRotateF(mtxRotY, part->rot.y, 0.0f, 1.0f, 0.0f); + guRotateF(mtxRotZ, part->rot.z, 0.0f, 0.0f, 1.0f); guMtxCatF(mtxRotY, mtxRotX, mtxTemp); guMtxCatF(mtxTemp, mtxRotZ, mtxRotation); guScaleF(mtxScale, part->scale.x, part->scale.y * part->verticalStretch, part->scale.z); @@ -1210,9 +1210,9 @@ void appendGfx_npc_actor(s32 isPartner, s32 actorIndex) { } guMtxCatF(mtxTemp, mtxTranslate, mtxTransform); - part->currentPos.x = partPosX + part->palAnimPosOffset[0]; - part->currentPos.y = partPosY + part->palAnimPosOffset[1]; - part->currentPos.z = partPosZ; + part->curPos.x = partPosX + part->palAnimPosOffset[0]; + part->curPos.y = partPosY + part->palAnimPosOffset[1]; + part->curPos.z = partPosZ; if (part->spriteInstanceID >= 0) { if (!isPartner) { @@ -1244,37 +1244,37 @@ void appendGfx_npc_actor_reflection(s32 flipYaw, Actor* actor) { s32 numParts; s32 i; - actorPosX = actor->currentPos.x + actor->headOffset.x; + actorPosX = actor->curPos.x + actor->headOffset.x; if (!(actor->flags & ACTOR_FLAG_UPSIDE_DOWN)) { - actorPosY = actor->currentPos.y + actor->headOffset.y; + actorPosY = actor->curPos.y + actor->headOffset.y; } else { - actorPosY = actor->currentPos.y - actor->headOffset.y; + actorPosY = actor->curPos.y - actor->headOffset.y; } - actorPosZ = actor->currentPos.z + actor->headOffset.z - 5.0f; + actorPosZ = actor->curPos.z + actor->headOffset.z - 5.0f; if (!(actor->flags & ACTOR_FLAG_UPSIDE_DOWN)) { guTranslateF(mtxPivotOn, - -actor->rotationPivotOffset.x * actor->scalingFactor, - -actor->rotationPivotOffset.y * actor->scalingFactor, - -actor->rotationPivotOffset.z * actor->scalingFactor); + -actor->rotPivotOffset.x * actor->scalingFactor, + -actor->rotPivotOffset.y * actor->scalingFactor, + -actor->rotPivotOffset.z * actor->scalingFactor); guTranslateF(mtxPivotOff, - actor->rotationPivotOffset.x * actor->scalingFactor, - actor->rotationPivotOffset.y * actor->scalingFactor, - actor->rotationPivotOffset.z * actor->scalingFactor); + actor->rotPivotOffset.x * actor->scalingFactor, + actor->rotPivotOffset.y * actor->scalingFactor, + actor->rotPivotOffset.z * actor->scalingFactor); } else { guTranslateF(mtxPivotOn, - -actor->rotationPivotOffset.x * actor->scalingFactor, - actor->rotationPivotOffset.y * actor->scalingFactor, - -actor->rotationPivotOffset.z * actor->scalingFactor); + -actor->rotPivotOffset.x * actor->scalingFactor, + actor->rotPivotOffset.y * actor->scalingFactor, + -actor->rotPivotOffset.z * actor->scalingFactor); guTranslateF(mtxPivotOff, - actor->rotationPivotOffset.x * actor->scalingFactor, - -actor->rotationPivotOffset.y * actor->scalingFactor, - actor->rotationPivotOffset.z * actor->scalingFactor); + actor->rotPivotOffset.x * actor->scalingFactor, + -actor->rotPivotOffset.y * actor->scalingFactor, + actor->rotPivotOffset.z * actor->scalingFactor); } - guRotateF(mtxRotX, actor->rotation.x, 1.0f, 0.0f, 0.0f); - guRotateF(mtxRotY, actor->rotation.y, 0.0f, 1.0f, 0.0f); - guRotateF(mtxRotZ, actor->rotation.z, 0.0f, 0.0f, 1.0f); + guRotateF(mtxRotX, actor->rot.x, 1.0f, 0.0f, 0.0f); + guRotateF(mtxRotY, actor->rot.y, 0.0f, 1.0f, 0.0f); + guRotateF(mtxRotZ, actor->rot.z, 0.0f, 0.0f, 1.0f); guMtxCatF(mtxRotY, mtxRotX, mtxTemp); guMtxCatF(mtxTemp, mtxRotZ, mtxRotation); @@ -1301,9 +1301,9 @@ void appendGfx_npc_actor_reflection(s32 flipYaw, Actor* actor) { partPosZ = actorPosZ + part->partOffset.z + part->visualOffset.z; partYaw = part->yaw = actor->yaw; } else { - partPosX = part->absolutePosition.x + part->visualOffset.x; - partPosY = part->absolutePosition.y + part->visualOffset.y; - partPosZ = part->absolutePosition.z + part->visualOffset.z; + partPosX = part->absolutePos.x + part->visualOffset.x; + partPosY = part->absolutePos.y + part->visualOffset.y; + partPosZ = part->absolutePos.z + part->visualOffset.z; guScaleF(mtxPartScale, actor->scale.x * SPRITE_WORLD_SCALE_D, actor->scale.y * SPRITE_WORLD_SCALE_D, @@ -1322,31 +1322,31 @@ void appendGfx_npc_actor_reflection(s32 flipYaw, Actor* actor) { if (!(actor->flags & ACTOR_FLAG_UPSIDE_DOWN)) { guTranslateF(mtxPivotOn, - -part->rotationPivotOffset.x * actor->scalingFactor, - -part->rotationPivotOffset.y * actor->scalingFactor, - -part->rotationPivotOffset.z * actor->scalingFactor); + -part->rotPivotOffset.x * actor->scalingFactor, + -part->rotPivotOffset.y * actor->scalingFactor, + -part->rotPivotOffset.z * actor->scalingFactor); guTranslateF(mtxPivotOff, - part->rotationPivotOffset.x * actor->scalingFactor, - part->rotationPivotOffset.y * actor->scalingFactor, - part->rotationPivotOffset.z * actor->scalingFactor); + part->rotPivotOffset.x * actor->scalingFactor, + part->rotPivotOffset.y * actor->scalingFactor, + part->rotPivotOffset.z * actor->scalingFactor); } else { guTranslateF(mtxPivotOn, - -part->rotationPivotOffset.x * actor->scalingFactor, - part->rotationPivotOffset.y * actor->scalingFactor, - -part->rotationPivotOffset.z * actor->scalingFactor); + -part->rotPivotOffset.x * actor->scalingFactor, + part->rotPivotOffset.y * actor->scalingFactor, + -part->rotPivotOffset.z * actor->scalingFactor); guTranslateF(mtxPivotOff, - part->rotationPivotOffset.x * actor->scalingFactor, - -part->rotationPivotOffset.y * actor->scalingFactor, - part->rotationPivotOffset.z * actor->scalingFactor); + part->rotPivotOffset.x * actor->scalingFactor, + -part->rotPivotOffset.y * actor->scalingFactor, + part->rotPivotOffset.z * actor->scalingFactor); } guTranslateF(mtxTranslate, partPosX + part->palAnimPosOffset[0], partPosY + part->palAnimPosOffset[1], partPosZ - 1.0f); - guRotateF(mtxRotX, part->rotation.x, 1.0f, 0.0f, 0.0f); - guRotateF(mtxRotY, part->rotation.y, 0.0f, 1.0f, 0.0f); - guRotateF(mtxRotZ, part->rotation.z, 0.0f, 0.0f, 1.0f); + guRotateF(mtxRotX, part->rot.x, 1.0f, 0.0f, 0.0f); + guRotateF(mtxRotY, part->rot.y, 0.0f, 1.0f, 0.0f); + guRotateF(mtxRotZ, part->rot.z, 0.0f, 0.0f, 1.0f); guMtxCatF(mtxRotY, mtxRotX, mtxTemp); guMtxCatF(mtxTemp, mtxRotZ, mtxRotation); @@ -1403,7 +1403,7 @@ void update_player_actor_shadow(void) { Shadow* shadow; f32 x, y, z, distance; - parts->animNotifyValue = spr_update_player_sprite(PLAYER_SPRITE_MAIN, parts->currentAnimation, parts->animationRate); + parts->animNotifyValue = spr_update_player_sprite(PLAYER_SPRITE_MAIN, parts->curAnimation, parts->animationRate); if (player->flags & ACTOR_FLAG_BLUR_ENABLED) { func_802549F4(player); @@ -1419,18 +1419,18 @@ void update_player_actor_shadow(void) { } distance = 32767.0f; - x = player->currentPos.x + player->headOffset.x; - z = player->currentPos.z + player->headOffset.z; - y = player->currentPos.y + player->headOffset.y + 12.0; + x = player->curPos.x + player->headOffset.x; + z = player->curPos.z + player->headOffset.z; + y = player->curPos.y + player->headOffset.y + 12.0; npc_raycast_down_sides(0, &x, &y, &z, &distance); if (distance > 200.0f) { shadow->flags |= ENTITY_FLAG_HIDDEN; } - shadow->position.x = x; - shadow->position.y = y; - shadow->position.z = z; - shadow->rotation.y = clamp_angle(player->yaw - camera->currentYaw); + shadow->pos.x = x; + shadow->pos.y = y; + shadow->pos.z = z; + shadow->rot.y = clamp_angle(player->yaw - camera->curYaw); set_standard_shadow_scale(shadow, distance); shadow->scale.x *= player->shadowScale * player->scalingFactor; @@ -1461,9 +1461,9 @@ void appendGfx_player_actor(void* arg0) { partner = battleStatus->partnerActor; playerParts = player->partsTable; - playerPosX = player->currentPos.x + player->headOffset.x; - playerPosY = player->currentPos.y + player->headOffset.y + player->verticalRenderOffset; - playerPosZ = player->currentPos.z + player->headOffset.z; + playerPosX = player->curPos.x + player->headOffset.x; + playerPosY = player->curPos.y + player->headOffset.y + player->verticalRenderOffset; + playerPosZ = player->curPos.z + player->headOffset.z; playerYaw = playerParts->yaw = player->yaw; @@ -1601,7 +1601,7 @@ void appendGfx_player_actor(void* arg0) { if (FALSE) { // TODO required to match - also whyyyyyy compiler, whyyyyy back: - playerParts->currentAnimation = get_player_anim_for_status(STATUS_KEY_STOP); + playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_STOP); create_status_debuff(player->hudElementDataIndex, STATUS_KEY_STOP); goto end; } @@ -1614,7 +1614,7 @@ void appendGfx_player_actor(void* arg0) { palChanged = FALSE; cond3 = FALSE; cond4 = FALSE; - lastAnim = playerParts->currentAnimation; + lastAnim = playerParts->curAnimation; } while (0); // required to match if (((((gBattleStatus.flags2 & (BS_FLAGS2_8 | BS_FLAGS2_2)) == BS_FLAGS2_2) && (partner != NULL)) || (battleStatus->outtaSightActive > 0)) @@ -1632,15 +1632,15 @@ void appendGfx_player_actor(void* arg0) { ((battleStatus->outtaSightActive > 0) || (gBattleStatus.flags2 & BS_FLAGS2_2))) { if (is_ability_active(ABILITY_BERSERKER)) { - playerParts->currentAnimation = get_player_anim_for_status(STATUS_KEY_INACTIVE_BERSERK); + playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_INACTIVE_BERSERK); } else if (player->debuff == STATUS_KEY_SLEEP) { - playerParts->currentAnimation = get_player_anim_for_status(STATUS_KEY_INACTIVE_SLEEP); + playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_INACTIVE_SLEEP); } else if (player->debuff == STATUS_KEY_DIZZY) { - playerParts->currentAnimation = get_player_anim_for_status(STATUS_KEY_INACTIVE_DIZZY); + playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_INACTIVE_DIZZY); } else { - playerParts->currentAnimation = get_player_anim_for_status(STATUS_KEY_INACTIVE); + playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_INACTIVE); } - spr_update_player_sprite(PLAYER_SPRITE_MAIN, playerParts->currentAnimation, playerParts->animationRate); + spr_update_player_sprite(PLAYER_SPRITE_MAIN, playerParts->curAnimation, playerParts->animationRate); animChanged = TRUE; } } @@ -1658,8 +1658,8 @@ void appendGfx_player_actor(void* arg0) { } if (player->stoneStatus == STATUS_KEY_STONE) { - playerParts->currentAnimation = get_player_anim_for_status(STATUS_KEY_STONE); - spr_update_player_sprite(PLAYER_SPRITE_MAIN, playerParts->currentAnimation, playerParts->animationRate); + playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_STONE); + spr_update_player_sprite(PLAYER_SPRITE_MAIN, playerParts->curAnimation, playerParts->animationRate); animChanged = TRUE; if (!palChanged) { @@ -1677,9 +1677,9 @@ void appendGfx_player_actor(void* arg0) { } if ((player->flags & ACTOR_FLAG_4000000) && !animChanged) { - s32 temp = playerParts->currentAnimation; + s32 temp = playerParts->curAnimation; if (temp == get_player_anim_for_status(STATUS_KEY_STONE)) { - playerParts->currentAnimation = get_player_anim_for_status(STATUS_KEY_NORMAL); + playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_NORMAL); } } @@ -1727,13 +1727,13 @@ void appendGfx_player_actor(void* arg0) { } if (player->flags & ACTOR_FLAG_4000000) { if (battleStatus->hustleTurns != 0) { - playerParts->currentAnimation = get_player_anim_for_status(STATUS_KEY_HUSTLE); + playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_HUSTLE); animChanged = TRUE; } else if (!animChanged) { s32 temp = get_player_anim_for_status(STATUS_KEY_NORMAL); do { if (temp == get_player_anim_for_status(STATUS_KEY_HUSTLE)) { - playerParts->currentAnimation = get_player_anim_for_status(STATUS_KEY_NORMAL); + playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_NORMAL); } } while (0); // required to match } @@ -1741,34 +1741,34 @@ void appendGfx_player_actor(void* arg0) { do { if (player->debuff == STATUS_KEY_FROZEN) { if (!animChanged) { - playerParts->currentAnimation = get_player_anim_for_status(STATUS_KEY_FROZEN); + playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_FROZEN); animChanged = TRUE; } } else if (player->debuff != STATUS_KEY_SHRINK) { if (player->debuff == STATUS_KEY_POISON) { if (!animChanged) { - playerParts->currentAnimation = get_player_anim_for_status(STATUS_KEY_POISON); + playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_POISON); animChanged = TRUE; } } else if (player->debuff == STATUS_KEY_DIZZY) { if (!animChanged) { - playerParts->currentAnimation = get_player_anim_for_status(STATUS_KEY_DIZZY); + playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_DIZZY); animChanged = TRUE; } } else if (player->debuff == STATUS_KEY_SLEEP) { if (!animChanged) { - playerParts->currentAnimation = get_player_anim_for_status(STATUS_KEY_SLEEP); + playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_SLEEP); animChanged = TRUE; } } else if (player->debuff == STATUS_KEY_PARALYZE) { if (!animChanged) { - playerParts->currentAnimation = get_player_anim_for_status(STATUS_KEY_PARALYZE); + playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_PARALYZE); animChanged = TRUE; } } else { if (player_team_is_ability_active(player, ABILITY_BERSERKER)) { if (!animChanged) { - playerParts->currentAnimation = get_player_anim_for_status(STATUS_KEY_BERSERK); + playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_BERSERK); animChanged = TRUE; } } @@ -1776,24 +1776,24 @@ void appendGfx_player_actor(void* arg0) { } if (is_ability_active(ABILITY_ZAP_TAP)) { if (!animChanged) { - playerParts->currentAnimation = get_player_anim_for_status(STATUS_KEY_STATIC); + playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_STATIC); animChanged = TRUE; } player->staticStatus = STATUS_KEY_STATIC; player->staticDuration = 127; } else if ((player->staticStatus == STATUS_KEY_STATIC) && !animChanged) { - playerParts->currentAnimation = get_player_anim_for_status(STATUS_KEY_STATIC); + playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_STATIC); animChanged = TRUE; } if ((player->transparentStatus == STATUS_KEY_TRANSPARENT) || (playerParts->flags & ACTOR_PART_FLAG_100)) { if (!animChanged) { - playerParts->currentAnimation = get_player_anim_for_status(STATUS_KEY_TRANSPARENT); + playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_TRANSPARENT); animChanged = TRUE; } create_status_transparent(player->hudElementDataIndex, STATUS_KEY_TRANSPARENT); } if (!animChanged) { - playerParts->currentAnimation = get_player_anim_for_status(STATUS_KEY_NORMAL); + playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_NORMAL); } } while (0); // needed to match } @@ -1831,9 +1831,9 @@ void appendGfx_player_actor(void* arg0) { if (player->debuff != STATUS_KEY_STOP) { if (!animChanged) { - s32 temp = playerParts->currentAnimation; + s32 temp = playerParts->curAnimation; if (temp == get_player_anim_for_status(STATUS_KEY_STOP)) { - playerParts->currentAnimation = get_player_anim_for_status(STATUS_KEY_NORMAL); + playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_NORMAL); } } } else { @@ -1854,23 +1854,23 @@ void appendGfx_player_actor(void* arg0) { playerPosX += playerParts->palAnimPosOffset[0]; playerPosY += playerParts->palAnimPosOffset[1]; - playerParts->currentPos.x = playerPosX; - playerParts->currentPos.y = playerPosY; - playerParts->currentPos.z = playerPosZ; + playerParts->curPos.x = playerPosX; + playerParts->curPos.y = playerPosY; + playerParts->curPos.z = playerPosZ; guTranslateF(mtxTranslate, playerPosX, playerPosY, playerPosZ); guTranslateF(mtxPivotOn, - -player->rotationPivotOffset.x * player->scalingFactor, - -player->rotationPivotOffset.y * player->scalingFactor, - -player->rotationPivotOffset.z * player->scalingFactor); + -player->rotPivotOffset.x * player->scalingFactor, + -player->rotPivotOffset.y * player->scalingFactor, + -player->rotPivotOffset.z * player->scalingFactor); guTranslateF(mtxPivotOff, - player->rotationPivotOffset.x * player->scalingFactor, - player->rotationPivotOffset.y * player->scalingFactor, - player->rotationPivotOffset.z * player->scalingFactor); + player->rotPivotOffset.x * player->scalingFactor, + player->rotPivotOffset.y * player->scalingFactor, + player->rotPivotOffset.z * player->scalingFactor); - guRotateF(mtxRotX, player->rotation.x, 1.0f, 0.0f, 0.0f); - guRotateF(mtxRotY, player->rotation.y, 0.0f, 1.0f, 0.0f); - guRotateF(mtxRotZ, player->rotation.z, 0.0f, 0.0f, 1.0f); + guRotateF(mtxRotX, player->rot.x, 1.0f, 0.0f, 0.0f); + guRotateF(mtxRotY, player->rot.y, 0.0f, 1.0f, 0.0f); + guRotateF(mtxRotZ, player->rot.z, 0.0f, 0.0f, 1.0f); guMtxCatF(mtxRotY, mtxRotX, mtxTemp); guMtxCatF(mtxTemp, mtxRotZ, mtxRotation); @@ -1884,8 +1884,8 @@ void appendGfx_player_actor(void* arg0) { guMtxCatF(mtxTransform, mtxPivotOff, mtxTemp); guMtxCatF(mtxTemp, mtxTranslate, mtxTransform); - if (lastAnim != playerParts->currentAnimation) { - spr_update_player_sprite(PLAYER_SPRITE_MAIN, playerParts->currentAnimation, playerParts->animationRate); + if (lastAnim != playerParts->curAnimation) { + spr_update_player_sprite(PLAYER_SPRITE_MAIN, playerParts->curAnimation, playerParts->animationRate); } func_8025C840(0, playerParts, clamp_angle(playerYaw + 180.0f), 0); func_8025CCC8(0, playerParts, clamp_angle(playerYaw + 180.0f), 0); @@ -1902,27 +1902,27 @@ void appendGfx_player_actor_reflection(void* arg0) { f32 playerYaw = player->yaw; f32 dx, dy, dz; - dx = player->currentPos.x + player->headOffset.x; + dx = player->curPos.x + player->headOffset.x; dx += part->palAnimPosOffset[0]; - dy = player->currentPos.y + player->headOffset.y; + dy = player->curPos.y + player->headOffset.y; dy += part->palAnimPosOffset[1]; - dz = player->currentPos.z + player->headOffset.z - 5.0f; + dz = player->curPos.z + player->headOffset.z - 5.0f; part->yaw = playerYaw; guTranslateF(mtxTranslate, dx, dy, dz - 1.0f); guTranslateF(mtxPivotOn, - -player->rotationPivotOffset.x * player->scalingFactor, - -player->rotationPivotOffset.y * player->scalingFactor, - -player->rotationPivotOffset.z * player->scalingFactor); + -player->rotPivotOffset.x * player->scalingFactor, + -player->rotPivotOffset.y * player->scalingFactor, + -player->rotPivotOffset.z * player->scalingFactor); guTranslateF(mtxPivotOff, - player->rotationPivotOffset.x * player->scalingFactor, - player->rotationPivotOffset.y * player->scalingFactor, - player->rotationPivotOffset.z * player->scalingFactor); + player->rotPivotOffset.x * player->scalingFactor, + player->rotPivotOffset.y * player->scalingFactor, + player->rotPivotOffset.z * player->scalingFactor); - guRotateF(mtxRotX, player->rotation.x, 1.0f, 0.0f, 0.0f); - guRotateF(mtxRotY, player->rotation.y, 0.0f, 1.0f, 0.0f); - guRotateF(mtxRotZ, player->rotation.z, 0.0f, 0.0f, 1.0f); + guRotateF(mtxRotX, player->rot.x, 1.0f, 0.0f, 0.0f); + guRotateF(mtxRotY, player->rot.y, 0.0f, 1.0f, 0.0f); + guRotateF(mtxRotZ, player->rot.z, 0.0f, 0.0f, 1.0f); guMtxCatF(mtxRotY, mtxRotX, mtxTemp); guMtxCatF(mtxTemp, mtxRotZ, mtxRotation); guScaleF(mtxScale, @@ -2062,7 +2062,7 @@ void func_8025950C(ActorPart* part, s32 yaw, Matrix4f mtx) { } if (decor->unk_768 != 0) { - decor->originalPalettesList = spr_get_npc_palettes(part->currentAnimation >> 0x10); + decor->originalPalettesList = spr_get_npc_palettes(part->curAnimation >> 0x10); decor->originalPalettesCount = 0; while (decor->originalPalettesList[decor->originalPalettesCount] != (PAL_PTR) -1) { decor->originalPalettesCount++; @@ -2131,7 +2131,7 @@ void func_802597B0(ActorPart* part, s32 yaw, Matrix4f mtx) { } if (decor->unk_768 != 0) { - decor->originalPalettesList = spr_get_player_palettes(part->currentAnimation >> 16); + decor->originalPalettesList = spr_get_player_palettes(part->curAnimation >> 16); decor->originalPalettesCount = 0; while (decor->originalPalettesList[decor->originalPalettesCount] != (PAL_PTR) -1) { @@ -2204,13 +2204,13 @@ void render_with_sleep_palettes(b32 isNpcSprite, ActorPart* part, s32 yaw, Matri if (decorationTable->resetPalAdjust) { if (isNpcSprite == SPRITE_MODE_PLAYER) { - decorationTable->originalPalettesList = spr_get_player_palettes(part->currentAnimation >> 16); + decorationTable->originalPalettesList = spr_get_player_palettes(part->curAnimation >> 16); decorationTable->originalPalettesCount = 0; while ((s32)decorationTable->originalPalettesList[decorationTable->originalPalettesCount] != -1) { decorationTable->originalPalettesCount++; } } else { - decorationTable->originalPalettesList = spr_get_npc_palettes(part->currentAnimation >> 16); + decorationTable->originalPalettesList = spr_get_npc_palettes(part->curAnimation >> 16); decorationTable->originalPalettesCount = 0; while ((s32)decorationTable->originalPalettesList[decorationTable->originalPalettesCount] != -1) { decorationTable->originalPalettesCount++; @@ -2263,19 +2263,19 @@ void render_with_static_palettes(b32 isNpcSprite, ActorPart* part, s32 yaw, Matr if (decorationTable->resetPalAdjust) { if (isNpcSprite == SPRITE_MODE_PLAYER) { - decorationTable->originalPalettesList = spr_get_player_palettes(part->currentAnimation >> 16); + decorationTable->originalPalettesList = spr_get_player_palettes(part->curAnimation >> 16); decorationTable->originalPalettesCount = 0; while ((s32)decorationTable->originalPalettesList[decorationTable->originalPalettesCount] != -1) { decorationTable->originalPalettesCount++; } decorationTable->spriteColorVariations = SPR_PLAYER_COLOR_VARIATIONS; } else { - decorationTable->originalPalettesList = spr_get_npc_palettes(part->currentAnimation >> 16); + decorationTable->originalPalettesList = spr_get_npc_palettes(part->curAnimation >> 16); decorationTable->originalPalettesCount = 0; while ((s32)decorationTable->originalPalettesList[decorationTable->originalPalettesCount] != -1) { decorationTable->originalPalettesCount++; } - decorationTable->spriteColorVariations = spr_get_npc_color_variations(part->currentAnimation >> 16); + decorationTable->spriteColorVariations = spr_get_npc_color_variations(part->curAnimation >> 16); } for (i = 0; i < decorationTable->originalPalettesCount; i++) { @@ -2379,13 +2379,13 @@ void render_with_fear_palettes(b32 isNpcSprite, ActorPart* part, s32 yaw, Matrix if (decorationTable->resetPalAdjust) { if (isNpcSprite == SPRITE_MODE_PLAYER) { - decorationTable->originalPalettesList = spr_get_player_palettes(part->currentAnimation >> 16); + decorationTable->originalPalettesList = spr_get_player_palettes(part->curAnimation >> 16); decorationTable->originalPalettesCount = 2; while ((s32)decorationTable->originalPalettesList[decorationTable->originalPalettesCount] != -1) { decorationTable->originalPalettesCount++; } } else { - decorationTable->originalPalettesList = spr_get_npc_palettes(part->currentAnimation >> 16); + decorationTable->originalPalettesList = spr_get_npc_palettes(part->curAnimation >> 16); decorationTable->originalPalettesCount = 0; while ((s32)decorationTable->originalPalettesList[decorationTable->originalPalettesCount] != -1) { decorationTable->originalPalettesCount++; @@ -2448,19 +2448,19 @@ void render_with_poison_palettes(b32 isNpcSprite, ActorPart* part, s32 yaw, Matr if (decorationTable->resetPalAdjust) { if (isNpcSprite == SPRITE_MODE_PLAYER) { - decorationTable->originalPalettesList = spr_get_player_palettes(part->currentAnimation >> 16); + decorationTable->originalPalettesList = spr_get_player_palettes(part->curAnimation >> 16); decorationTable->originalPalettesCount = 0; while ((s32)decorationTable->originalPalettesList[decorationTable->originalPalettesCount] != -1) { decorationTable->originalPalettesCount++; } decorationTable->spriteColorVariations = SPR_PLAYER_COLOR_VARIATIONS; } else { - decorationTable->originalPalettesList = spr_get_npc_palettes(part->currentAnimation >> 16); + decorationTable->originalPalettesList = spr_get_npc_palettes(part->curAnimation >> 16); decorationTable->originalPalettesCount = 0; while ((s32)decorationTable->originalPalettesList[decorationTable->originalPalettesCount] != -1) { decorationTable->originalPalettesCount++; } - decorationTable->spriteColorVariations = spr_get_npc_color_variations(part->currentAnimation >> 16); + decorationTable->spriteColorVariations = spr_get_npc_color_variations(part->curAnimation >> 16); } decorationTable->palAnimState = 0; @@ -2506,13 +2506,13 @@ void render_with_paralyze_palettes(b32 isNpcSprite, ActorPart* part, s32 yaw, Ma if (decorationTable->resetPalAdjust) { if (isNpcSprite == SPRITE_MODE_PLAYER) { - decorationTable->originalPalettesList = spr_get_player_palettes(part->currentAnimation >> 16); + decorationTable->originalPalettesList = spr_get_player_palettes(part->curAnimation >> 16); decorationTable->originalPalettesCount = 0; while ((s32)decorationTable->originalPalettesList[decorationTable->originalPalettesCount] != -1) { decorationTable->originalPalettesCount++; } } else { - decorationTable->originalPalettesList = spr_get_npc_palettes(part->currentAnimation >> 16); + decorationTable->originalPalettesList = spr_get_npc_palettes(part->curAnimation >> 16); decorationTable->originalPalettesCount = 0; while ((s32)decorationTable->originalPalettesList[decorationTable->originalPalettesCount] != -1) { decorationTable->originalPalettesCount++; @@ -2607,14 +2607,14 @@ void render_with_berserk_palettes(b32 isNpcSprite, ActorPart* part, s32 yaw, Mat if (decorationTable->resetPalAdjust) { if (isNpcSprite == SPRITE_MODE_PLAYER) { - decorationTable->originalPalettesList = spr_get_player_palettes(part->currentAnimation >> 16); + decorationTable->originalPalettesList = spr_get_player_palettes(part->curAnimation >> 16); decorationTable->originalPalettesCount = 0; while ((s32)decorationTable->originalPalettesList[decorationTable->originalPalettesCount] != -1) { decorationTable->originalPalettesCount++; } decorationTable->palAnimState = 0; } else { - decorationTable->originalPalettesList = spr_get_npc_palettes(part->currentAnimation >> 16); + decorationTable->originalPalettesList = spr_get_npc_palettes(part->curAnimation >> 16); decorationTable->originalPalettesCount = 0; while ((s32)decorationTable->originalPalettesList[decorationTable->originalPalettesCount] != -1) { decorationTable->originalPalettesCount++; @@ -2669,19 +2669,19 @@ void render_with_watt_idle_palettes(b32 isNpcSprite, ActorPart* part, s32 yaw, M if (decorationTable->resetPalAdjust) { if (isNpcSprite == SPRITE_MODE_PLAYER) { - decorationTable->originalPalettesList = spr_get_player_palettes(part->currentAnimation >> 16); + decorationTable->originalPalettesList = spr_get_player_palettes(part->curAnimation >> 16); decorationTable->originalPalettesCount = 0; while ((s32)decorationTable->originalPalettesList[decorationTable->originalPalettesCount] != -1) { decorationTable->originalPalettesCount++; } decorationTable->spriteColorVariations = SPR_PLAYER_COLOR_VARIATIONS; } else { - decorationTable->originalPalettesList = spr_get_npc_palettes(part->currentAnimation >> 16); + decorationTable->originalPalettesList = spr_get_npc_palettes(part->curAnimation >> 16); decorationTable->originalPalettesCount = 0; while ((s32)decorationTable->originalPalettesList[decorationTable->originalPalettesCount] != -1) { decorationTable->originalPalettesCount++; } - decorationTable->spriteColorVariations = spr_get_npc_color_variations(part->currentAnimation >> 16); + decorationTable->spriteColorVariations = spr_get_npc_color_variations(part->curAnimation >> 16); } for (i = 0; i < decorationTable->originalPalettesCount; i++) { @@ -2781,19 +2781,19 @@ void render_with_watt_attack_palettes(b32 isNpcSprite, ActorPart* part, s32 yaw, if (decorationTable->resetPalAdjust) { if (isNpcSprite == SPRITE_MODE_PLAYER) { - decorationTable->originalPalettesList = spr_get_player_palettes(part->currentAnimation >> 16); + decorationTable->originalPalettesList = spr_get_player_palettes(part->curAnimation >> 16); decorationTable->originalPalettesCount = 0; while ((s32)decorationTable->originalPalettesList[decorationTable->originalPalettesCount] != -1) { decorationTable->originalPalettesCount++; } decorationTable->spriteColorVariations = SPR_PLAYER_COLOR_VARIATIONS; } else { - decorationTable->originalPalettesList = spr_get_npc_palettes(part->currentAnimation >> 16); + decorationTable->originalPalettesList = spr_get_npc_palettes(part->curAnimation >> 16); decorationTable->originalPalettesCount = 0; while ((s32)decorationTable->originalPalettesList[decorationTable->originalPalettesCount] != -1) { decorationTable->originalPalettesCount++; } - decorationTable->spriteColorVariations = spr_get_npc_color_variations(part->currentAnimation >> 16); + decorationTable->spriteColorVariations = spr_get_npc_color_variations(part->curAnimation >> 16); } for (i = 0; i < decorationTable->originalPalettesCount; i++) { @@ -2892,7 +2892,7 @@ void render_with_player_debuff_palettes(b32 isNpcSprite, ActorPart* part, s32 ya if (decorationTable->resetPalAdjust) { if (isNpcSprite == SPRITE_MODE_PLAYER) { - decorationTable->originalPalettesList = spr_get_player_palettes(part->currentAnimation >> 16); + decorationTable->originalPalettesList = spr_get_player_palettes(part->curAnimation >> 16); decorationTable->originalPalettesCount = 0; while ((s32)decorationTable->originalPalettesList[decorationTable->originalPalettesCount] != -1) { decorationTable->originalPalettesCount++; @@ -2904,12 +2904,12 @@ void render_with_player_debuff_palettes(b32 isNpcSprite, ActorPart* part, s32 ya decorationTable->spriteColorVariations = SPR_PLAYER_COLOR_VARIATIONS; } } else { - decorationTable->originalPalettesList = spr_get_npc_palettes(part->currentAnimation >> 16); + decorationTable->originalPalettesList = spr_get_npc_palettes(part->curAnimation >> 16); decorationTable->originalPalettesCount = 0; while ((s32)decorationTable->originalPalettesList[decorationTable->originalPalettesCount] != -1) { decorationTable->originalPalettesCount++; } - decorationTable->spriteColorVariations = spr_get_npc_color_variations(part->currentAnimation >> 16); + decorationTable->spriteColorVariations = spr_get_npc_color_variations(part->curAnimation >> 16); } if (decorationTable->resetPalAdjust == TRUE) { @@ -3019,13 +3019,13 @@ void render_with_pal_blending(b32 isNpcSprite, ActorPart* part, s32 yaw, b32 has if (decor->resetPalAdjust != 0) { if (isNpcSprite == SPRITE_MODE_PLAYER) { - decor->originalPalettesList = spr_get_player_palettes(part->currentAnimation >> 16); + decor->originalPalettesList = spr_get_player_palettes(part->curAnimation >> 16); decor->originalPalettesCount = 0; while ((s32)decor->originalPalettesList[decor->originalPalettesCount] != -1) { decor->originalPalettesCount++; } } else { - decor->originalPalettesList = spr_get_npc_palettes(part->currentAnimation >> 16); + decor->originalPalettesList = spr_get_npc_palettes(part->curAnimation >> 16); decor->originalPalettesCount = 0; while ((s32)decor->originalPalettesList[decor->originalPalettesCount] != -1) { decor->originalPalettesCount++; @@ -3191,18 +3191,18 @@ void render_with_palset_blending(b32 isNpcSprite, ActorPart* part, s32 yaw, Matr if (decor->resetPalAdjust != 0) { if (isNpcSprite == SPRITE_MODE_PLAYER) { - decor->originalPalettesList = spr_get_player_palettes(part->currentAnimation >> 16); + decor->originalPalettesList = spr_get_player_palettes(part->curAnimation >> 16); decor->originalPalettesCount = 0; while (decor->originalPalettesList[decor->originalPalettesCount] != (PAL_PTR) -1) { decor->originalPalettesCount++; } } else { - decor->originalPalettesList = spr_get_npc_palettes(part->currentAnimation >> 16); + decor->originalPalettesList = spr_get_npc_palettes(part->curAnimation >> 16); decor->originalPalettesCount = 0; while (decor->originalPalettesList[decor->originalPalettesCount] != (PAL_PTR) -1) { decor->originalPalettesCount++; } - decor->spriteColorVariations = spr_get_npc_color_variations(part->currentAnimation >> 16); + decor->spriteColorVariations = spr_get_npc_color_variations(part->curAnimation >> 16); } if (decor->resetPalAdjust == 1) { @@ -3658,7 +3658,7 @@ void func_8025D160(ActorPart* arg0, s32 index) { switch (table->state[index]) { case 0: - fx_aura(3, arg0->currentPos.x, arg0->currentPos.y, arg0->currentPos.z, 0.4f, &table->effect[index]); + fx_aura(3, arg0->curPos.x, arg0->curPos.y, arg0->curPos.z, 0.4f, &table->effect[index]); table->state[index] = 1; table->unk_8C6[index].unk00 = 40; table->unk_8C6[index].unk02 = 40; @@ -3667,9 +3667,9 @@ void func_8025D160(ActorPart* arg0, s32 index) { case 1: effect = table->effect[index]; data = effect->data.aura; - data->posA.x = arg0->currentPos.x + table->unk_8C6[index].unk04; - data->posA.y = arg0->currentPos.y; - data->posA.z = arg0->currentPos.z; + data->posA.x = arg0->curPos.x + table->unk_8C6[index].unk04; + data->posA.y = arg0->curPos.y; + data->posA.z = arg0->curPos.z; scale = table->unk_8C6[index].unk00; scale /= 100.0f; effect->data.aura->scale.x = scale; @@ -3690,9 +3690,9 @@ void func_8025D2B0(ActorPart* part, s32 decorationIndex) { switch (decor->state[decorationIndex]) { case 0: if (part->yaw > 90.0f) { - fx_sweat(0, part->currentPos.x, part->currentPos.y + part->size.y, part->currentPos.z, 5.0f, 45.0f, 20); + fx_sweat(0, part->curPos.x, part->curPos.y + part->size.y, part->curPos.z, 5.0f, 45.0f, 20); } else { - fx_sweat(0, part->currentPos.x, part->currentPos.y + part->size.y, part->currentPos.z, 5.0f, -45.0f, 20); + fx_sweat(0, part->curPos.x, part->curPos.y + part->size.y, part->curPos.z, 5.0f, -45.0f, 20); } decor->stateResetTimer[decorationIndex] = 10; decor->state[decorationIndex] = TRUE; @@ -3718,15 +3718,15 @@ void func_8025D3CC(ActorPart* part, s32 decorationIndex) { decor = part->decorationTable; switch (decor->state[decorationIndex]) { case 0: - fx_stars_orbiting(0, part->currentPos.x, part->currentPos.y + part->size.y, part->currentPos.z, + fx_stars_orbiting(0, part->curPos.x, part->curPos.y + part->size.y, part->curPos.z, 20.0f, 3, &decor->effect[decorationIndex]); decor->state[decorationIndex] = 1; break; case 1: data = decor->effect[decorationIndex]->data.starsOrbiting; - data->pos.x = part->currentPos.x; - data->pos.y = part->currentPos.y + part->size.y; - data->pos.z = part->currentPos.z; + data->pos.x = part->curPos.x; + data->pos.y = part->curPos.y + part->size.y; + data->pos.z = part->curPos.z; break; } } @@ -3743,7 +3743,7 @@ void func_8025D4C8(ActorPart* part, s32 decorationIndex) { switch (decor->state[decorationIndex]) { case 0: - fx_aura(1, part->currentPos.x, part->currentPos.y, part->currentPos.z, 0.4f, &decor->effect[decorationIndex]); + fx_aura(1, part->curPos.x, part->curPos.y, part->curPos.z, 0.4f, &decor->effect[decorationIndex]); decor->state[decorationIndex] = 1; decor->unk_8C6[decorationIndex].unk00 = 40; decor->unk_8C6[decorationIndex].unk02 = 40; @@ -3756,9 +3756,9 @@ void func_8025D4C8(ActorPart* part, s32 decorationIndex) { case 1: effect = decor->effect[decorationIndex]; data = effect->data.aura; - data->posA.x = part->currentPos.x; - data->posA.y = part->currentPos.y; - data->posA.z = part->currentPos.z + decor->unk_8C6[decorationIndex].unk06; + data->posA.x = part->curPos.x; + data->posA.y = part->curPos.y; + data->posA.z = part->curPos.z + decor->unk_8C6[decorationIndex].unk06; scale = decor->unk_8C6[decorationIndex].unk00; scale /= 100.0f; @@ -3781,14 +3781,14 @@ void func_8025D640(ActorPart* part, s32 decorationIndex) { switch (decor->state[decorationIndex]) { case 0: - decor->effect[decorationIndex] = fx_effect_65(1, part->currentPos.x, part->currentPos.y, part->currentPos.z, 1.0f, 0); + decor->effect[decorationIndex] = fx_effect_65(1, part->curPos.x, part->curPos.y, part->curPos.z, 1.0f, 0); decor->state[decorationIndex] = 1; break; case 1: effect = decor->effect[decorationIndex]; - effect->data.unk_65->pos.x = part->currentPos.x; - effect->data.unk_65->pos.y = part->currentPos.y; - effect->data.unk_65->pos.z = part->currentPos.z; + effect->data.unk_65->pos.x = part->curPos.x; + effect->data.unk_65->pos.y = part->curPos.y; + effect->data.unk_65->pos.z = part->curPos.z; break; } } @@ -3803,15 +3803,15 @@ void func_8025D71C(ActorPart* part, s32 decorationIndex) { switch (decor->state[decorationIndex]) { case 0: - decor->effect[decorationIndex] = fx_effect_65(2, part->currentPos.x, part->currentPos.y, part->currentPos.z, 1.0f, 0); + decor->effect[decorationIndex] = fx_effect_65(2, part->curPos.x, part->curPos.y, part->curPos.z, 1.0f, 0); decor->unk_8C6[decorationIndex].unk00 = 1; decor->state[decorationIndex] = 1; break; case 1: effect = decor->effect[decorationIndex]; - effect->data.unk_65->pos.x = part->currentPos.x; - effect->data.unk_65->pos.y = part->currentPos.y; - effect->data.unk_65->pos.z = part->currentPos.z; + effect->data.unk_65->pos.x = part->curPos.x; + effect->data.unk_65->pos.y = part->curPos.y; + effect->data.unk_65->pos.z = part->curPos.z; effect->data.unk_65->scale = decor->unk_8C6[decorationIndex].unk00 / 100.0f; break; } @@ -3827,14 +3827,14 @@ void func_8025D830(ActorPart* part, s32 decorationIndex) { switch (decor->state[decorationIndex]) { case 0: - decor->effect[decorationIndex] = fx_whirlwind(2, part->currentPos.x, part->currentPos.y, part->currentPos.z, 1.0f, 0); + decor->effect[decorationIndex] = fx_whirlwind(2, part->curPos.x, part->curPos.y, part->curPos.z, 1.0f, 0); decor->state[decorationIndex] = 1; break; case 1: effect = decor->effect[decorationIndex]; - effect->data.whirlwind->pos.x = part->currentPos.x; - effect->data.whirlwind->pos.y = part->currentPos.y; - effect->data.whirlwind->pos.z = part->currentPos.z; + effect->data.whirlwind->pos.x = part->curPos.x; + effect->data.whirlwind->pos.y = part->curPos.y; + effect->data.whirlwind->pos.z = part->curPos.z; break; } } @@ -3860,9 +3860,9 @@ void func_8025D90C(ActorPart* part, s32 decorationIndex) { sinA = sin_rad(angle); cosA = cos_rad(angle); fx_walking_dust(0, - part->currentPos.x + (part->size.x * sinA * 0.2f), - part->currentPos.y + 1.5f, - part->currentPos.z + (part->size.x * cosA * 0.2f), + part->curPos.x + (part->size.x * sinA * 0.2f), + part->curPos.y + 1.5f, + part->curPos.z + (part->size.x * cosA * 0.2f), sinA, cosA); } break; @@ -3883,9 +3883,9 @@ void func_8025DA68(ActorPart* part, s32 decorationIndex) { decor->state[decorationIndex] = 1; // fallthrough case 1: - x = part->currentPos.x; - y = part->currentPos.y + (part->size.y / 2); - z = part->currentPos.z - 5.0f; + x = part->curPos.x; + y = part->curPos.y + (part->size.y / 2); + z = part->curPos.z - 5.0f; // @bug? perhaps this should be % 4? if ((gGameStatusPtr->frameCounter / 4) == 0) { fx_sparkles(FX_SPARKLES_1, x, y, z, 10.0f); @@ -3911,7 +3911,7 @@ void func_8025DBD0(ActorPart* part, s32 decorationIndex) { switch (decor->state[decorationIndex]) { case 0: - fx_aura(2, part->currentPos.x, part->currentPos.y, part->currentPos.z, 1.2f, &decor->effect[decorationIndex]); + fx_aura(2, part->curPos.x, part->curPos.y, part->curPos.z, 1.2f, &decor->effect[decorationIndex]); decor->state[decorationIndex] = 1; decor->unk_8C6[decorationIndex].unk00 = 150; decor->unk_8C6[decorationIndex].unk02 = 150; @@ -3921,9 +3921,9 @@ void func_8025DBD0(ActorPart* part, s32 decorationIndex) { case 1: effect = decor->effect[decorationIndex]; data = effect->data.aura; - data->posA.x = part->currentPos.x; - data->posA.y = part->currentPos.y; - data->posA.z = part->currentPos.z + decor->unk_8C6[decorationIndex].unk06; + data->posA.x = part->curPos.x; + data->posA.y = part->curPos.y; + data->posA.z = part->curPos.z + decor->unk_8C6[decorationIndex].unk06; scale = decor->unk_8C6[decorationIndex].unk00; scale /= 100.0f; @@ -3948,7 +3948,7 @@ void func_8025DD60(ActorPart* part, s32 decorationIndex) { switch (decor->state[decorationIndex]) { case 0: - decor->effect[decorationIndex] = fx_energy_in_out(4, part->currentPos.x, part->currentPos.y, part->currentPos.z, 1.2f, 0); + decor->effect[decorationIndex] = fx_energy_in_out(4, part->curPos.x, part->curPos.y, part->curPos.z, 1.2f, 0); decor->state[decorationIndex] = 1; decor->unk_8C6[decorationIndex].unk00 = 120; decor->unk_8C6[decorationIndex].unk02 = 0; @@ -3958,9 +3958,9 @@ void func_8025DD60(ActorPart* part, s32 decorationIndex) { scale = decor->unk_8C6[decorationIndex].unk00; scale /= 100.0f; data->unk_44 = scale; - data->pos.x = part->currentPos.x; - data->pos.y = (part->currentPos.y + (scale * 41.0f)); - data->pos.z = (part->currentPos.z + decor->unk_8C6[decorationIndex].unk02); + data->pos.x = part->curPos.x; + data->pos.y = (part->curPos.y + (scale * 41.0f)); + data->pos.z = (part->curPos.z + decor->unk_8C6[decorationIndex].unk02); break; } } diff --git a/src/18C790.c b/src/18C790.c index c719c5e6ef6..877b0e78959 100644 --- a/src/18C790.c +++ b/src/18C790.c @@ -633,13 +633,13 @@ void btl_state_update_celebration(void) { if (CelebrateSubstateTime == 18) { playerData->curHP = playerData->curMaxHP; playerData->curFP = playerData->curMaxFP; - x = player->currentPos.x + 0.0f; - y = player->currentPos.y + 35.0f; - z = player->currentPos.z; + x = player->curPos.x + 0.0f; + y = player->curPos.y + 35.0f; + z = player->curPos.z; fx_recover(0, x, y, z, playerData->curHP); - x = player->currentPos.x + 20.0f; - y = player->currentPos.y + 25.0f; - z = player->currentPos.z; + x = player->curPos.x + 20.0f; + y = player->curPos.y + 25.0f; + z = player->curPos.z; fx_recover(1, x, y, z, playerData->curFP); playerData->specialBarsFilled = playerData->maxStarPower * 256; } @@ -919,7 +919,7 @@ void btl_state_update_celebration(void) { id = LevelUpSelectTextID = hud_element_create(&HES_level_up_select_one_to_upgrade); hud_element_set_render_pos(id, 0, 0); hud_element_set_flags(id, HUD_ELEMENT_FLAG_80); - battleStatus->currentSubmenu = 1; + battleStatus->curSubmenu = 1; CelebrateSubstateTime = 10; gBattleSubState = BTL_SUBSTATE_CELEBRATE_LEVEL_UP_SHOW_HUD; @@ -978,8 +978,8 @@ void btl_state_update_celebration(void) { } break; case BTL_SUBSTATE_CELEBRATE_LEVEL_UP_CHOOSE: - if (battleStatus->currentButtonsPressed & BUTTON_A) { - if (!CantLevelUpStat[battleStatus->currentSubmenu]) { + if (battleStatus->curButtonsPressed & BUTTON_A) { + if (!CantLevelUpStat[battleStatus->curSubmenu]) { sfx_play_sound(SOUND_MENU_NEXT); sfx_play_sound(SOUND_349 | SOUND_ID_TRIGGER_CHANGE_SOUND); gBattleSubState = BTL_SUBSTATE_CELEBRATE_LEVEL_UP_UPGRADE; @@ -990,11 +990,11 @@ void btl_state_update_celebration(void) { break; } - newSubmenu = currentSubmenu = battleStatus->currentSubmenu; - if (battleStatus->currentButtonsHeld & BUTTON_STICK_LEFT) { + newSubmenu = currentSubmenu = battleStatus->curSubmenu; + if (battleStatus->curButtonsHeld & BUTTON_STICK_LEFT) { newSubmenu--; } - if (battleStatus->currentButtonsHeld & BUTTON_STICK_RIGHT) { + if (battleStatus->curButtonsHeld & BUTTON_STICK_RIGHT) { newSubmenu++; } if (newSubmenu < 0) { @@ -1005,7 +1005,7 @@ void btl_state_update_celebration(void) { } if (newSubmenu != currentSubmenu) { sfx_play_sound(SOUND_MENU_CHANGE_SELECTION); - battleStatus->currentSubmenu = newSubmenu; + battleStatus->curSubmenu = newSubmenu; } CelebrateStateTime++; @@ -1018,7 +1018,7 @@ void btl_state_update_celebration(void) { hud_element_free(LevelUpSpotlightID); set_window_update(WINDOW_ID_8, WINDOW_UPDATE_HIDE); - switch (battleStatus->currentSubmenu) { + switch (battleStatus->curSubmenu) { case 0: playerData->hardMaxHP += 5; playerData->curMaxHP += 5; @@ -1030,7 +1030,7 @@ void btl_state_update_celebration(void) { playerData->curHP = playerData->curMaxHP; } player->maxHP = playerData->curMaxHP; - player->currentHP = playerData->curHP; + player->curHP = playerData->curHP; break; case 1: playerData->hardMaxFP += 5; @@ -1067,7 +1067,7 @@ void btl_state_update_celebration(void) { break; case BTL_SUBSTATE_CELEBRATE_LEVEL_UP_FADE_OUT: if ((gGameStatusPtr->frameCounter % 2) != 0) { - switch (battleStatus->currentSubmenu) { + switch (battleStatus->curSubmenu) { case 0: hud_element_set_flags(LevelUpStatEmblemIDs[0], HUD_ELEMENT_FLAG_DISABLED); break; @@ -1080,7 +1080,7 @@ void btl_state_update_celebration(void) { break; } } else { - switch (battleStatus->currentSubmenu) { + switch (battleStatus->curSubmenu) { case 0: hud_element_clear_flags(LevelUpStatEmblemIDs[0], HUD_ELEMENT_FLAG_DISABLED); break; @@ -1140,7 +1140,7 @@ void btl_state_update_celebration(void) { gBattleSubState = BTL_SUBSTATE_CELEBRATE_LEVEL_UP_CHOOSE; break; case BTL_SUBSTATE_CELEBRATE_SKIPPABLE_END_DELAY: - if (battleStatus->currentButtonsPressed & (BUTTON_A | BUTTON_B)) { + if (battleStatus->curButtonsPressed & (BUTTON_A | BUTTON_B)) { CelebrateStateTime = 99; } if (CelebrateStateTime >= 99) { @@ -1151,7 +1151,7 @@ void btl_state_update_celebration(void) { btl_cam_set_params(1, 270, 100, 8, 0, 0x2400, 0, 100); set_animation(0, 0, ANIM_MarioB1_AdjustCap); if (partner != NULL) { - set_animation(ACTOR_PARTNER, 0, D_80284154[playerData->currentPartner]); + set_animation(ACTOR_PARTNER, 0, D_80284154[playerData->curPartner]); } CelebrateSubstateTime = 6; gBattleSubState = BTL_SUBSTATE_CELEBRATE_WALK_AWAY; @@ -1170,9 +1170,9 @@ void btl_state_update_celebration(void) { partner->yaw = 0.0f; } - player->currentPos.x += 4.0f; + player->curPos.x += 4.0f; if (partner != NULL) { - partner->currentPos.x += 4.0f; + partner->curPos.x += 4.0f; } } if (bFadeToBlackAmt == 255) { @@ -1213,7 +1213,7 @@ void btl_draw_upgrade_windows(s32 phase) { d3 = 100; break; case 1: // choosing - switch (battleStatus->currentSubmenu) { + switch (battleStatus->curSubmenu) { case MENU_HP: d1 = 0; d2 = 100; @@ -1284,7 +1284,7 @@ void btl_state_draw_celebration(void) { case BTL_SUBSTATE_CELEBRATE_LEVEL_UP_CHOOSE: case BTL_SUBSTATE_CELEBRATE_LEVEL_UP_INVALID: case BTL_SUBSTATE_CELEBRATE_LEVEL_UP_INVALID_DELAY: - switch (battleStatus->currentSubmenu) { + switch (battleStatus->curSubmenu) { case 0: rotZ = 152; hud_element_set_tint(LevelUpStatEmblemIDs[0], 255, 255, 255); @@ -1459,7 +1459,7 @@ void draw_content_level_up_textbox(void* data, s32 posX, s32 posY) { case BTL_SUBSTATE_CELEBRATE_LEVEL_UP_CHOOSE: case BTL_SUBSTATE_CELEBRATE_LEVEL_UP_INVALID: case BTL_SUBSTATE_CELEBRATE_LEVEL_UP_INVALID_DELAY: - switch (battleStatus->currentSubmenu) { + switch (battleStatus->curSubmenu) { case MENU_HP: if (!CantLevelUpStat[MENU_HP]) { msgID = MSG_Menus_LevelUp_HP; diff --git a/src/18F340.c b/src/18F340.c index 85199d64feb..07120dabfc4 100644 --- a/src/18F340.c +++ b/src/18F340.c @@ -74,7 +74,7 @@ API_CALLABLE(ActivateDefend) { API_CALLABLE(DoesMarioStatusPreventHappyAnimation) { Actor* player = gBattleStatus.playerActor; - show_action_rating(ACTION_RATING_LUCKY, player, player->currentPos.x, player->currentPos.y + 20.0f, player->currentPos.z); + show_action_rating(ACTION_RATING_LUCKY, player, player->curPos.x, player->curPos.y + 20.0f, player->curPos.z); sfx_play_sound(SOUND_3FC); script->varTable[0] = FALSE; if (player->debuff == STATUS_KEY_FEAR || player->debuff == STATUS_KEY_DIZZY || player->debuff == STATUS_KEY_PARALYZE || @@ -176,7 +176,7 @@ API_CALLABLE(GiveRefund) { f32 angle = 0.0f; s32 delayTime = 0; f32 posX, posY, posZ; - posY = player->currentPos.y + player->size.y; + posY = player->curPos.y + player->size.y; if (player_team_is_ability_active(player, ABILITY_REFUND) && sellValue > 0) { s32 i; @@ -186,8 +186,8 @@ API_CALLABLE(GiveRefund) { sellValue = (sellValue * 75 + 99) / 100; for (i = 0; i < sellValue; i++) { - posX = player->currentPos.x; - posZ = player->currentPos.z; + posX = player->curPos.x; + posZ = player->curPos.z; make_item_entity(ITEM_COIN, posX, posY, posZ, ITEM_SPAWN_MODE_TOSS_FADE1, (i * 3) + 1, angle, 0); add_coins(1); @@ -196,9 +196,9 @@ API_CALLABLE(GiveRefund) { delayTime = (i * 3) + 30; - posX = player->currentPos.x; - posY = player->currentPos.y; - posZ = player->currentPos.z; + posX = player->curPos.x; + posY = player->curPos.y; + posZ = player->curPos.z; get_screen_coords(gCurrentCameraID, posX, posY, posZ, &iconPosX, &iconPosY, &iconPosZ); RefundHudElem = hud_element_create(&HES_Refund); hud_element_set_render_pos(RefundHudElem, iconPosX + 36, iconPosY - 63); @@ -568,29 +568,29 @@ API_CALLABLE(func_80261DF4) { switch (script->functionTemp[1]) { case 0: script->functionTemp[0]--; - item->position.y += script->functionTemp[0]; - if (item->position.y < 0.0f) { - item->position.y = 0.0f; + item->pos.y += script->functionTemp[0]; + if (item->pos.y < 0.0f) { + item->pos.y = 0.0f; script->functionTemp[0] = 8; script->functionTemp[1] = 1; } break; case 1: script->functionTemp[0]--; - item->position.y += script->functionTemp[0]; - item->position.x += 1.5; - if (item->position.y < 0.0f) { - item->position.y = 0.0f; + item->pos.y += script->functionTemp[0]; + item->pos.x += 1.5; + if (item->pos.y < 0.0f) { + item->pos.y = 0.0f; script->functionTemp[0] = 4; script->functionTemp[1] = 2; } break; case 2: script->functionTemp[0]--; - item->position.y += script->functionTemp[0]; - item->position.x += 1.2; - if (item->position.y < 0.0f) { - item->position.y = 0.0f; + item->pos.y += script->functionTemp[0]; + item->pos.x += 1.2; + if (item->pos.y < 0.0f) { + item->pos.y = 0.0f; script->functionTemp[1] = 3; } break; @@ -619,16 +619,16 @@ API_CALLABLE(func_80261FB4) { switch (script->functionTemp[0]) { case 0: ft1 = script->functionTemp[1]; - deltaX = player->currentPos.x - item->position.x; - deltaY = player->currentPos.y + 12.0f - item->position.y; - deltaZ = player->currentPos.z - 5.0f - item->position.z; + deltaX = player->curPos.x - item->pos.x; + deltaY = player->curPos.y + 12.0f - item->pos.y; + deltaZ = player->curPos.z - 5.0f - item->pos.z; - item->position.x += deltaX / ft1; - item->position.y += deltaY / ft1; - item->position.z += deltaZ / ft1; + item->pos.x += deltaX / ft1; + item->pos.y += deltaY / ft1; + item->pos.z += deltaZ / ft1; - item->position.y += dist2D(item->position.x, item->position.y, player->currentPos.x, - player->currentPos.y + 12.0f) / 5.0f; + item->pos.y += dist2D(item->pos.x, item->pos.y, player->curPos.x, + player->curPos.y + 12.0f) / 5.0f; if (script->functionTemp[1] == 1) { script->functionTemp[0] = script->functionTemp[1]; diff --git a/src/190B20.c b/src/190B20.c index f54ef3b25a5..bdd9861fb8e 100644 --- a/src/190B20.c +++ b/src/190B20.c @@ -88,18 +88,18 @@ void create_target_list(Actor* actor, s32 arg1) { s32 row; s32 skip; - if (battleStatus->currentTargetListFlags & TARGET_FLAG_80000000) { + if (battleStatus->curTargetListFlags & TARGET_FLAG_80000000) { actor->targetListLength = -1; return; } - if (battleStatus->currentTargetListFlags & TARGET_FLAG_PLAYER) { + if (battleStatus->curTargetListFlags & TARGET_FLAG_PLAYER) { targetDataList->actorID = ACTOR_PLAYER; targetDataList->partID = 1; if (!arg1) { - targetDataList->posA.x = playerActor->currentPos.x + playerActor->size.x * 0.3 * playerActor->scalingFactor; - targetDataList->posA.y = playerActor->currentPos.y + playerActor->size.y * 0.9 * playerActor->scalingFactor; - targetDataList->posA.z = playerActor->currentPos.z; + targetDataList->posA.x = playerActor->curPos.x + playerActor->size.x * 0.3 * playerActor->scalingFactor; + targetDataList->posA.y = playerActor->curPos.y + playerActor->size.y * 0.9 * playerActor->scalingFactor; + targetDataList->posA.z = playerActor->curPos.z; } else { targetDataList->posA.x = playerActor->homePos.x + playerActor->size.x * 0.3 * playerActor->scalingFactor; targetDataList->posA.y = playerActor->homePos.y + playerActor->size.y * 0.9 * playerActor->scalingFactor; @@ -110,13 +110,13 @@ void create_target_list(Actor* actor, s32 arg1) { targetDataList++; } - if ((battleStatus->currentTargetListFlags & TARGET_FLAG_100) && partnerActor != NULL) { + if ((battleStatus->curTargetListFlags & TARGET_FLAG_100) && partnerActor != NULL) { targetDataList->actorID = ACTOR_PARTNER; targetDataList->partID = 1; if (!arg1) { - targetDataList->posA.x = partnerActor->currentPos.x + partnerActor->size.x * 0.1 * partnerActor->scalingFactor; - targetDataList->posA.y = partnerActor->currentPos.y + partnerActor->size.y * 0.8 * partnerActor->scalingFactor; - targetDataList->posA.z = partnerActor->currentPos.z; + targetDataList->posA.x = partnerActor->curPos.x + partnerActor->size.x * 0.1 * partnerActor->scalingFactor; + targetDataList->posA.y = partnerActor->curPos.y + partnerActor->size.y * 0.8 * partnerActor->scalingFactor; + targetDataList->posA.z = partnerActor->curPos.z; } else { targetDataList->posA.x = partnerActor->homePos.x + partnerActor->size.x * 0.1 * partnerActor->scalingFactor; targetDataList->posA.y = partnerActor->homePos.y + partnerActor->size.y * 0.8 * partnerActor->scalingFactor; @@ -132,7 +132,7 @@ void create_target_list(Actor* actor, s32 arg1) { if (targetActor == NULL) { continue; } - if ((battleStatus->currentTargetListFlags & TARGET_FLAG_100) || (battleStatus->currentTargetListFlags & TARGET_FLAG_PLAYER)) { + if ((battleStatus->curTargetListFlags & TARGET_FLAG_100) || (battleStatus->curTargetListFlags & TARGET_FLAG_PLAYER)) { break; } targetPart = targetActor->partsTable; @@ -144,9 +144,9 @@ void create_target_list(Actor* actor, s32 arg1) { if (!(targetPart->flags & ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION)) { row = !arg1; // required to match if (row) { - targetX = targetActor->currentPos.x; - targetY = targetActor->currentPos.y; - targetZ = targetActor->currentPos.z; + targetX = targetActor->curPos.x; + targetY = targetActor->curPos.y; + targetZ = targetActor->curPos.z; } else { targetX = targetActor->homePos.x; targetY = targetActor->homePos.y; @@ -166,9 +166,9 @@ void create_target_list(Actor* actor, s32 arg1) { targetY = f2 + targetPart->targetOffset.y * targetActor->scalingFactor; } } else { - targetY = targetPart->absolutePosition.y; - targetZ = targetPart->absolutePosition.z; - f12 = targetPart->absolutePosition.x; + targetY = targetPart->absolutePos.y; + targetZ = targetPart->absolutePos.z; + f12 = targetPart->absolutePos.x; f2 = targetY; f14 = targetZ + 5.0f; targetX = f12 + targetPart->targetOffset.x; @@ -248,7 +248,7 @@ void create_target_list(Actor* actor, s32 arg1) { if (targetData->actorID == ACTOR_PLAYER || targetData->actorID == ACTOR_PARTNER) { continue; } - if (battleStatus->currentTargetListFlags & TARGET_FLAG_80000000) { + if (battleStatus->curTargetListFlags & TARGET_FLAG_80000000) { skip = TRUE; goto END2; } @@ -260,7 +260,7 @@ void create_target_list(Actor* actor, s32 arg1) { goto END2; } } - if (battleStatus->currentTargetListFlags & TARGET_FLAG_8000) { + if (battleStatus->curTargetListFlags & TARGET_FLAG_8000) { if (!(targetPart->flags & ACTOR_PART_FLAG_MULTI_TARGET) || (targetActor->flags & ACTOR_FLAG_40) || (targetPart->flags & ACTOR_PART_FLAG_40)) @@ -288,48 +288,48 @@ void create_target_list(Actor* actor, s32 arg1) { continue; } do { - if ((battleStatus->currentTargetListFlags & TARGET_FLAG_800) && (targetPart->targetFlags & ACTOR_PART_TARGET_FLAG_1)) { + if ((battleStatus->curTargetListFlags & TARGET_FLAG_800) && (targetPart->targetFlags & ACTOR_PART_TARGET_FLAG_1)) { skip = TRUE; goto END; } } while (0); do { - if ((battleStatus->currentTargetListFlags & TARGET_FLAG_1000) && (targetPart->targetFlags & ACTOR_PART_TARGET_FLAG_2)) { + if ((battleStatus->curTargetListFlags & TARGET_FLAG_1000) && (targetPart->targetFlags & ACTOR_PART_TARGET_FLAG_2)) { skip = TRUE; goto END; } } while (0); do { - if ((battleStatus->currentTargetListFlags & TARGET_FLAG_20000) && ((targetActor->flags & ACTOR_FLAG_80) || (targetPart->flags & ACTOR_PART_FLAG_80))) { + if ((battleStatus->curTargetListFlags & TARGET_FLAG_20000) && ((targetActor->flags & ACTOR_FLAG_80) || (targetPart->flags & ACTOR_PART_FLAG_80))) { skip = TRUE; goto END; } } while (0); - if ((battleStatus->currentTargetListFlags & TARGET_FLAG_400) && (targetActor->flags & ACTOR_FLAG_UPSIDE_DOWN)) { + if ((battleStatus->curTargetListFlags & TARGET_FLAG_400) && (targetActor->flags & ACTOR_FLAG_UPSIDE_DOWN)) { skip = TRUE; goto END; } - if (!(battleStatus->currentTargetListFlags & TARGET_FLAG_10000) && (targetActor->flags & ACTOR_FLAG_TARGET_ONLY)) { + if (!(battleStatus->curTargetListFlags & TARGET_FLAG_10000) && (targetActor->flags & ACTOR_FLAG_TARGET_ONLY)) { skip = TRUE; goto END; } - if ((battleStatus->currentTargetListFlags & TARGET_FLAG_40000) && (targetActor->flags & ACTOR_FLAG_UPSIDE_DOWN)) { + if ((battleStatus->curTargetListFlags & TARGET_FLAG_40000) && (targetActor->flags & ACTOR_FLAG_UPSIDE_DOWN)) { skip = TRUE; goto END; } - if ((battleStatus->currentTargetListFlags & TARGET_FLAG_4) && targetData->homeRow != 0) { + if ((battleStatus->curTargetListFlags & TARGET_FLAG_4) && targetData->homeRow != 0) { skip = TRUE; goto END; } - if ((battleStatus->currentTargetListFlags & TARGET_FLAG_10) && targetData->homeRow >= 2) { + if ((battleStatus->curTargetListFlags & TARGET_FLAG_10) && targetData->homeRow >= 2) { skip = TRUE; goto END; } - if ((battleStatus->currentTargetListFlags & TARGET_FLAG_40) && targetData->homeRow <= 0) { + if ((battleStatus->curTargetListFlags & TARGET_FLAG_40) && targetData->homeRow <= 0) { skip = TRUE; goto END; } - if ((battleStatus->currentTargetListFlags & TARGET_FLAG_4000) && !(targetPart->flags & ACTOR_PART_FLAG_20)) { + if ((battleStatus->curTargetListFlags & TARGET_FLAG_4000) && !(targetPart->flags & ACTOR_PART_FLAG_20)) { s32 cond = FALSE; do { for (j = 0; j < numTargets; j++) { @@ -349,7 +349,7 @@ void create_target_list(Actor* actor, s32 arg1) { goto END; } } - if (battleStatus->currentTargetListFlags & TARGET_FLAG_2000) { + if (battleStatus->curTargetListFlags & TARGET_FLAG_2000) { s32 cond = FALSE; for (j = 0; j < numTargets; j++) { @@ -370,55 +370,55 @@ void create_target_list(Actor* actor, s32 arg1) { } } do { - if ((battleStatus->currentTargetListFlags & TARGET_FLAG_20) && (targetActor->flags & ACTOR_FLAG_FLYING)) { + if ((battleStatus->curTargetListFlags & TARGET_FLAG_20) && (targetActor->flags & ACTOR_FLAG_FLYING)) { skip = TRUE; goto END; } } while (0); do { - if ((battleStatus->currentTargetListFlags & TARGET_FLAG_100000) && targetData->homeRow == row + 1) { + if ((battleStatus->curTargetListFlags & TARGET_FLAG_100000) && targetData->homeRow == row + 1) { skip = TRUE; goto END; } } while (0); do { - if ((battleStatus->currentTargetListFlags & TARGET_FLAG_200000) && targetData->homeRow == row - 1) { + if ((battleStatus->curTargetListFlags & TARGET_FLAG_200000) && targetData->homeRow == row - 1) { skip = TRUE; goto END; } } while (0); do { - if ((battleStatus->currentTargetListFlags & TARGET_FLAG_400000) && targetData->homeCol == col - 1) { + if ((battleStatus->curTargetListFlags & TARGET_FLAG_400000) && targetData->homeCol == col - 1) { skip = TRUE; goto END; } } while (0); do { - if ((battleStatus->currentTargetListFlags & TARGET_FLAG_800000) && targetData->homeCol == col + 1) { + if ((battleStatus->curTargetListFlags & TARGET_FLAG_800000) && targetData->homeCol == col + 1) { skip = TRUE; goto END; } } while (0); do { - if ((battleStatus->currentTargetListFlags & TARGET_FLAG_100000) && targetData->homeRow < row) { + if ((battleStatus->curTargetListFlags & TARGET_FLAG_100000) && targetData->homeRow < row) { skip = TRUE; goto END; } } while (0); do { - if ((battleStatus->currentTargetListFlags & TARGET_FLAG_200000) && targetData->homeRow > row) { + if ((battleStatus->curTargetListFlags & TARGET_FLAG_200000) && targetData->homeRow > row) { skip = TRUE; goto END; } } while (0); do { - if ((battleStatus->currentTargetListFlags & TARGET_FLAG_400000) && targetData->homeCol > col) { + if ((battleStatus->curTargetListFlags & TARGET_FLAG_400000) && targetData->homeCol > col) { skip = TRUE; goto END; } } while (0); do { - if ((battleStatus->currentTargetListFlags & TARGET_FLAG_800000) && targetData->homeCol < col) { + if ((battleStatus->curTargetListFlags & TARGET_FLAG_800000) && targetData->homeCol < col) { skip = TRUE; goto END; } @@ -495,9 +495,9 @@ s32 func_80263064(Actor* actor0, Actor* actor1, s32 unused) { f32 x, y, z; if (!(part->flags & ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION)) { - x = actor1->currentPos.x; - y = actor1->currentPos.y; - z = actor1->currentPos.z; + x = actor1->curPos.x; + y = actor1->curPos.y; + z = actor1->curPos.z; x += part->partOffset.x; if (!(actor1->flags & ACTOR_FLAG_UPSIDE_DOWN)) { @@ -514,9 +514,9 @@ s32 func_80263064(Actor* actor0, Actor* actor1, s32 unused) { y -= part->targetOffset.y; } } else { - x = part->absolutePosition.x; - y = part->absolutePosition.y; - z = part->absolutePosition.z; + x = part->absolutePos.x; + y = part->absolutePos.y; + z = part->absolutePos.z; x += part->targetOffset.x; if (!(actor1->flags & ACTOR_FLAG_UPSIDE_DOWN)) { @@ -574,7 +574,7 @@ void func_80263268(void) { battleStatus->changePartnerAllowed = 0; } else if (partner->debuff == STATUS_KEY_FROZEN) { battleStatus->changePartnerAllowed = 0; - } else if (playerData->currentPartner == PARTNER_GOOMPA) { + } else if (playerData->curPartner == PARTNER_GOOMPA) { battleStatus->changePartnerAllowed = -1; } } else { @@ -604,7 +604,7 @@ void func_80263300(void) { if (itemData->typeFlags & ITEM_TYPE_FLAG_BATTLE_USABLE) { battleStatus->moveCategory = BTL_MENU_TYPE_ITEMS; battleStatus->moveArgument = playerData->invItems[i]; - battleStatus->currentTargetListFlags = itemData->targetFlags; + battleStatus->curTargetListFlags = itemData->targetFlags; player_create_target_list(player); if (player->targetListLength != 0) { @@ -718,7 +718,7 @@ void btl_init_menu_boots(void) { // See if there are any targets for this move battleStatus->moveCategory = BTL_MENU_TYPE_JUMP; battleStatus->moveArgument = playerData->bootsLevel; - battleStatus->currentTargetListFlags = move->flags; // Controls target filters + battleStatus->curTargetListFlags = move->flags; // Controls target filters player_create_target_list(player); // If there are targets, enable the move @@ -812,7 +812,7 @@ void btl_init_menu_hammer(void) { // See if there are any targets for this move battleStatus->moveCategory = BTL_MENU_TYPE_SMASH; battleStatus->moveArgument = playerData->hammerLevel; - battleStatus->currentTargetListFlags = move->flags; + battleStatus->curTargetListFlags = move->flags; player_create_target_list(player); // If there are targets, enable the move @@ -873,14 +873,14 @@ void btl_init_menu_partner(void) { // Offsets 0,1,2 battleStatus->submenuMoves[0] = - playerData->currentPartner * 6 + playerData->curPartner * 6 + (MOVE_HEADBONK1 - 6) + partner->actorBlueprint->level; // Offsets 3,4,5 for (i = 1; i < battleStatus->submenuMoveCount; i++) { battleStatus->submenuMoves[i] = - playerData->currentPartner * 6 + playerData->curPartner * 6 + (MOVE_TATTLE - 6) + (i - 1); } @@ -900,7 +900,7 @@ void btl_init_menu_partner(void) { battleStatus->moveCategory = BTL_MENU_TYPE_CHANGE_PARTNER; battleStatus->moveArgument = partner->actorBlueprint->level; - battleStatus->currentTargetListFlags = move->flags; + battleStatus->curTargetListFlags = move->flags; player_create_target_list(partner); if (partner->targetListLength != 0){ @@ -1005,8 +1005,8 @@ void set_animation(s32 actorID, s32 partID, AnimID animID) { switch (actorID & ACTOR_CLASS_MASK) { case ACTOR_CLASS_PLAYER: part = &actor->partsTable[0]; - if (part->currentAnimation != animID) { - part->currentAnimation = animID; + if (part->curAnimation != animID) { + part->curAnimation = animID; spr_update_player_sprite(PLAYER_SPRITE_MAIN, animID, part->animationRate); } break; @@ -1021,16 +1021,16 @@ void set_animation(s32 actorID, s32 partID, AnimID animID) { part = &actor->partsTable[0]; } - if (part->currentAnimation != animID) { - part->currentAnimation = animID; + if (part->curAnimation != animID) { + part->curAnimation = animID; spr_update_sprite(part->spriteInstanceID, animID, part->animationRate); part->animNotifyValue = spr_get_notify_value(part->spriteInstanceID); } break; case ACTOR_CLASS_ENEMY: part = get_actor_part(actor, partID); - if (part->currentAnimation != animID) { - part->currentAnimation = animID; + if (part->curAnimation != animID) { + part->curAnimation = animID; spr_update_sprite(part->spriteInstanceID, animID, part->animationRate); part->animNotifyValue = spr_get_notify_value(part->spriteInstanceID); } @@ -1043,15 +1043,15 @@ void func_80263E08(Actor* actor, ActorPart* part, AnimID anim) { if ((s32) anim >= 0) { switch (actor->actorID & ACTOR_CLASS_MASK) { case ACTOR_CLASS_PLAYER: - if (part->currentAnimation != anim) { - part->currentAnimation = anim; + if (part->curAnimation != anim) { + part->curAnimation = anim; spr_update_player_sprite(PLAYER_SPRITE_MAIN, anim, part->animationRate); } break; case ACTOR_CLASS_PARTNER: case ACTOR_CLASS_ENEMY: - if (part->currentAnimation != anim) { - part->currentAnimation = anim; + if (part->curAnimation != anim) { + part->curAnimation = anim; spr_update_sprite(part->spriteInstanceID, anim, part->animationRate); part->animNotifyValue = spr_get_notify_value(part->spriteInstanceID); } @@ -1220,24 +1220,24 @@ void load_player_actor(void) { player->actorType = bPlayerActorBlueprint.type; if ((gBattleStatus.flags2 & BS_FLAGS2_PEACH_BATTLE) || (gGameStatusPtr->demoFlags & 2)) { - player->homePos.x = player->currentPos.x = -130.0f; - player->homePos.y = player->currentPos.y = 0.0f; - player->homePos.z = player->currentPos.z = -10.0f; + player->homePos.x = player->curPos.x = -130.0f; + player->homePos.y = player->curPos.y = 0.0f; + player->homePos.z = player->curPos.z = -10.0f; } else { - player->homePos.x = player->currentPos.x = -95.0f; - player->homePos.y = player->currentPos.y = 0.0f; - player->homePos.z = player->currentPos.z = 0.0f; + player->homePos.x = player->curPos.x = -95.0f; + player->homePos.y = player->curPos.y = 0.0f; + player->homePos.z = player->curPos.z = 0.0f; } player->headOffset.x = 0; player->headOffset.y = 0; player->headOffset.z = 0; - player->rotation.x = 0.0f; - player->rotation.y = 0.0f; - player->rotation.z = 0.0f; - player->rotationPivotOffset.x = 0; - player->rotationPivotOffset.y = 0; - player->rotationPivotOffset.z = 0; + player->rot.x = 0.0f; + player->rot.y = 0.0f; + player->rot.z = 0.0f; + player->rotPivotOffset.x = 0; + player->rotPivotOffset.y = 0; + player->rotPivotOffset.z = 0; player->verticalRenderOffset = 0; player->yaw = 0.0f; player->renderMode = RENDER_MODE_ALPHATEST; @@ -1250,9 +1250,9 @@ void load_player_actor(void) { player->size.x = player->actorBlueprint->size.x; player->size.y = player->actorBlueprint->size.y; player->actorID = 0; - player->healthBarPos.x = player->currentPos.x; - player->healthBarPos.y = player->currentPos.y; - player->healthBarPos.z = player->currentPos.z; + player->healthBarPos.x = player->curPos.x; + player->healthBarPos.y = player->curPos.y; + player->healthBarPos.z = player->curPos.z; player->scalingFactor = 1.0f; player->attackResultEffect = NULL; player->actionRatingCombo = 0; @@ -1321,15 +1321,15 @@ void load_player_actor(void) { part->partOffsetFloat.x = 0.0f; part->partOffsetFloat.y = 0.0f; part->partOffsetFloat.z = 0.0f; - part->rotationPivotOffset.x = 0; - part->rotationPivotOffset.y = 0; - part->rotationPivotOffset.z = 0; + part->rotPivotOffset.x = 0; + part->rotPivotOffset.y = 0; + part->rotPivotOffset.z = 0; part->visualOffset.x = 0; part->visualOffset.y = 0; part->visualOffset.z = 0; - part->absolutePosition.x = 0.0f; - part->absolutePosition.y = 0.0f; - part->absolutePosition.z = 0.0f; + part->absolutePos.x = 0.0f; + part->absolutePos.y = 0.0f; + part->absolutePos.z = 0.0f; part->defenseTable = bMarioDefenseTable; if (gBattleStatus.flags2 & BS_FLAGS2_PEACH_BATTLE) { @@ -1347,9 +1347,9 @@ void load_player_actor(void) { part->targetOffset.x = 0; part->targetOffset.y = 0; part->unk_70 = 0; - part->rotation.x = 0.0f; - part->rotation.y = 0.0f; - part->rotation.z = 0.0f; + part->rot.x = 0.0f; + part->rot.y = 0.0f; + part->rot.z = 0.0f; part->scale.x = 1.0f; part->scale.y = 1.0f; part->scale.z = 1.0f; @@ -1357,7 +1357,7 @@ void load_player_actor(void) { part->palAnimPosOffset[0] = 0; part->palAnimPosOffset[1] = 0; part->animationRate = 1.0f; - part->currentAnimation = get_npc_anim_for_status(part->idleAnimations, 1U); + part->curAnimation = get_npc_anim_for_status(part->idleAnimations, 1U); part->nextPart = NULL; part->partTypeData[0] = bActorSoundTable[player->actorType].walk[0]; part->partTypeData[1] = bActorSoundTable[player->actorType].walk[1]; @@ -1384,9 +1384,9 @@ void load_player_actor(void) { decorationTable->unk_7D9 = 0; for (j = 0; j < ARRAY_COUNT(decorationTable->posX); j++) { - decorationTable->posX[j] = player->currentPos.x; - decorationTable->posY[j] = player->currentPos.y; - decorationTable->posZ[j] = player->currentPos.z; + decorationTable->posX[j] = player->curPos.x; + decorationTable->posY[j] = player->curPos.y; + decorationTable->posZ[j] = player->curPos.z; } decorationTable->unk_7DA = 3; @@ -1402,7 +1402,7 @@ void load_player_actor(void) { partMovement = part->movement = heap_malloc(sizeof(*partMovement)); ASSERT(partMovement != NULL); - player->shadow.id = create_shadow_type(0, player->currentPos.x, player->currentPos.y, player->currentPos.z); + player->shadow.id = create_shadow_type(0, player->curPos.x, player->curPos.y, player->curPos.z); player->shadowScale = player->size.x / 24.0; player->hudElementDataIndex = create_status_icon_set(); player->disableEffect = fx_disable_x(0, -142.0f, 34.0f, 1.0f, 0); @@ -1430,7 +1430,7 @@ void load_partner_actor(void) { s32 i; s32 i2; - currentPartner = playerData->currentPartner; + currentPartner = playerData->curPartner; battleStatus->partnerActor = NULL; if (currentPartner != PARTNER_NONE) { @@ -1456,19 +1456,19 @@ void load_partner_actor(void) { ASSERT(partnerActor != NULL); - actorBP->level = playerData->partners[playerData->currentPartner].level; + actorBP->level = playerData->partners[playerData->curPartner].level; partnerActor->unk_134 = battleStatus->unk_93++; partnerActor->footStepCounter = 0; partnerActor->actorBlueprint = actorBP; partnerActor->actorType = actorBP->type; partnerActor->flags = actorBP->flags; - partnerActor->homePos.x = partnerActor->currentPos.x = x; - partnerActor->homePos.y = partnerActor->currentPos.y = y; - partnerActor->homePos.z = partnerActor->currentPos.z = z; + partnerActor->homePos.x = partnerActor->curPos.x = x; + partnerActor->homePos.y = partnerActor->curPos.y = y; + partnerActor->homePos.z = partnerActor->curPos.z = z; partnerActor->headOffset.x = 0; partnerActor->headOffset.y = 0; partnerActor->headOffset.z = 0; - partnerActor->currentHP = actorBP->maxHP; + partnerActor->curHP = actorBP->maxHP; partnerActor->numParts = partCount; partnerActor->idleSource = NULL; partnerActor->takeTurnSource = actorBP->initScript; @@ -1481,12 +1481,12 @@ void load_partner_actor(void) { partnerActor->turnPriority = 0; partnerActor->enemyIndex = 0; partnerActor->yaw = 0.0f; - partnerActor->rotation.x = 0.0f; - partnerActor->rotation.y = 0.0f; - partnerActor->rotation.z = 0.0f; - partnerActor->rotationPivotOffset.x = 0; - partnerActor->rotationPivotOffset.y = 0; - partnerActor->rotationPivotOffset.z = 0; + partnerActor->rot.x = 0.0f; + partnerActor->rot.y = 0.0f; + partnerActor->rot.z = 0.0f; + partnerActor->rotPivotOffset.x = 0; + partnerActor->rotPivotOffset.y = 0; + partnerActor->rotPivotOffset.z = 0; partnerActor->scale.x = 1.0f; partnerActor->scale.y = 1.0f; partnerActor->scale.z = 1.0f; @@ -1561,9 +1561,9 @@ void load_partner_actor(void) { part->visualOffset.x = 0; part->visualOffset.y = 0; part->visualOffset.z = 0; - part->absolutePosition.x = 0.0f; - part->absolutePosition.y = 0.0f; - part->absolutePosition.z = 0.0f; + part->absolutePos.x = 0.0f; + part->absolutePos.y = 0.0f; + part->absolutePos.z = 0.0f; part->defenseTable = ActorPartBlueprint->defenseTable; part->idleAnimations = ActorPartBlueprint->idleAnimations; part->eventFlags = ActorPartBlueprint->eventFlags; @@ -1575,12 +1575,12 @@ void load_partner_actor(void) { part->targetOffset.x = ActorPartBlueprint->targetOffset.x; part->targetOffset.y = ActorPartBlueprint->targetOffset.y; part->unk_70 = 0; - part->rotationPivotOffset.x = 0; - part->rotationPivotOffset.y = 0; - part->rotationPivotOffset.z = 0; - part->rotation.x = 0.0f; - part->rotation.y = 0.0f; - part->rotation.z = 0.0f; + part->rotPivotOffset.x = 0; + part->rotPivotOffset.y = 0; + part->rotPivotOffset.z = 0; + part->rot.x = 0.0f; + part->rot.y = 0.0f; + part->rot.z = 0.0f; part->scale.x = 1.0f; part->scale.y = 1.0f; part->scale.z = 1.0f; @@ -1613,9 +1613,9 @@ void load_partner_actor(void) { decorationTable->unk_7D9 = 0; for (j = 0; j < ARRAY_COUNT(decorationTable->posX); j++) { - decorationTable->posX[j] = partnerActor->currentPos.x; - decorationTable->posY[j] = partnerActor->currentPos.y; - decorationTable->posZ[j] = partnerActor->currentPos.z; + decorationTable->posX[j] = partnerActor->curPos.x; + decorationTable->posY[j] = partnerActor->curPos.y; + decorationTable->posZ[j] = partnerActor->curPos.z; } decorationTable->unk_7DA = 3; @@ -1634,12 +1634,12 @@ void load_partner_actor(void) { } part->animationRate = 1.0f; - part->currentAnimation = 0; + part->curAnimation = 0; part->spriteInstanceID = -1; if (part->idleAnimations != NULL) { - part->currentAnimation = get_npc_anim_for_status(part->idleAnimations, 1); - part->spriteInstanceID = spr_load_npc_sprite(part->currentAnimation | SPRITE_ID_TAIL_ALLOCATE, NULL); + part->curAnimation = get_npc_anim_for_status(part->idleAnimations, 1); + part->spriteInstanceID = spr_load_npc_sprite(part->curAnimation | SPRITE_ID_TAIL_ALLOCATE, NULL); } if (i + 1 >= partCount) { @@ -1656,7 +1656,7 @@ void load_partner_actor(void) { part->nextPart = NULL; } - partnerActor->shadow.id = create_shadow_type(0, partnerActor->currentPos.x, partnerActor->currentPos.y, partnerActor->currentPos.z); + partnerActor->shadow.id = create_shadow_type(0, partnerActor->curPos.x, partnerActor->curPos.y, partnerActor->curPos.z); partnerActor->shadowScale = partnerActor->size.x / 24.0; partnerActor->hudElementDataIndex = create_status_icon_set(); partnerActor->disableEffect = fx_disable_x(0, -142.0f, 34.0f, 1.0f, 0); @@ -1708,13 +1708,13 @@ Actor* create_actor(Formation formation) { actor->actorBlueprint = formationActor; actor->actorType = formationActor->type; actor->flags = formationActor->flags; - actor->homePos.x = actor->currentPos.x = x; - actor->homePos.y = actor->currentPos.y = y; - actor->homePos.z = actor->currentPos.z = z; + actor->homePos.x = actor->curPos.x = x; + actor->homePos.y = actor->curPos.y = y; + actor->homePos.z = actor->curPos.z = z; actor->headOffset.x = 0; actor->headOffset.y = 0; actor->headOffset.z = 0; - actor->maxHP = actor->currentHP = formationActor->maxHP; + actor->maxHP = actor->curHP = formationActor->maxHP; actor->numParts = partCount; actor->idleSource = NULL; actor->takeTurnSource = formationActor->initScript; @@ -1726,12 +1726,12 @@ Actor* create_actor(Formation formation) { actor->turnPriority = formation->priority; actor->enemyIndex = i; actor->yaw = 0.0f; - actor->rotation.x = 0.0f; - actor->rotation.y = 0.0f; - actor->rotation.z = 0.0f; - actor->rotationPivotOffset.x = 0; - actor->rotationPivotOffset.y = 0; - actor->rotationPivotOffset.z = 0; + actor->rot.x = 0.0f; + actor->rot.y = 0.0f; + actor->rot.z = 0.0f; + actor->rotPivotOffset.x = 0; + actor->rotPivotOffset.y = 0; + actor->rotPivotOffset.z = 0; actor->scale.x = 1.0f; actor->scale.y = 1.0f; actor->scale.z = 1.0f; @@ -1754,11 +1754,11 @@ Actor* create_actor(Formation formation) { actor->actionRatingCombo = 0; actor->actionRatingTime = 0; - actor->healthBarPos.x = actor->currentPos.x + formationActor->healthBarOffset.x; - actor->healthBarPos.y = actor->currentPos.y + formationActor->healthBarOffset.y; - actor->healthBarPos.z = actor->currentPos.z; + actor->healthBarPos.x = actor->curPos.x + formationActor->healthBarOffset.x; + actor->healthBarPos.y = actor->curPos.y + formationActor->healthBarOffset.y; + actor->healthBarPos.z = actor->curPos.z; if (actor->flags & ACTOR_FLAG_UPSIDE_DOWN) { - actor->healthBarPos.y = actor->currentPos.y - actor->size.y - formationActor->healthBarOffset.y; + actor->healthBarPos.y = actor->curPos.y - actor->size.y - formationActor->healthBarOffset.y; } actor->statusTable = formationActor->statusTable; @@ -1819,12 +1819,12 @@ Actor* create_actor(Formation formation) { part->visualOffset.y = 0; part->visualOffset.z = 0; - part->absolutePosition.x = actor->currentPos.x; - part->absolutePosition.y = actor->currentPos.y; - part->absolutePosition.z = actor->currentPos.z; - part->currentPos.x = actor->currentPos.x; - part->currentPos.y = actor->currentPos.y; - part->currentPos.z = actor->currentPos.z; + part->absolutePos.x = actor->curPos.x; + part->absolutePos.y = actor->curPos.y; + part->absolutePos.z = actor->curPos.z; + part->curPos.x = actor->curPos.x; + part->curPos.y = actor->curPos.y; + part->curPos.z = actor->curPos.z; part->defenseTable = actorPartBP->defenseTable; part->idleAnimations = actorPartBP->idleAnimations; part->eventFlags = actorPartBP->eventFlags; @@ -1841,12 +1841,12 @@ Actor* create_actor(Formation formation) { part->unk_70 = 0; part->projectileTargetOffset.x = actorPartBP->projectileTargetOffset.x; part->projectileTargetOffset.y = actorPartBP->projectileTargetOffset.y; - part->rotation.x = 0.0f; - part->rotation.y = 0.0f; - part->rotation.z = 0.0f; - part->rotationPivotOffset.x = 0; - part->rotationPivotOffset.y = 0; - part->rotationPivotOffset.z = 0; + part->rot.x = 0.0f; + part->rot.y = 0.0f; + part->rot.z = 0.0f; + part->rotPivotOffset.x = 0; + part->rotPivotOffset.y = 0; + part->rotPivotOffset.z = 0; part->scale.x = 1.0f; part->scale.y = 1.0f; part->scale.z = 1.0f; @@ -1875,9 +1875,9 @@ Actor* create_actor(Formation formation) { decorationTable->unk_7D9 = 0; for (k = 0; k < ARRAY_COUNT(decorationTable->posX); k++) { - decorationTable->posX[k] = actor->currentPos.x; - decorationTable->posY[k] = actor->currentPos.y; - decorationTable->posZ[k] = actor->currentPos.z; + decorationTable->posX[k] = actor->curPos.x; + decorationTable->posY[k] = actor->curPos.y; + decorationTable->posZ[k] = actor->curPos.z; } decorationTable->unk_7DA = 3; @@ -1901,12 +1901,12 @@ Actor* create_actor(Formation formation) { } part->animationRate = 1.0f; - part->currentAnimation = 0; + part->curAnimation = 0; part->spriteInstanceID = -1; if (part->idleAnimations != NULL) { - part->currentAnimation = get_npc_anim_for_status(part->idleAnimations, 1) & ~SPRITE_ID_TAIL_ALLOCATE; - part->spriteInstanceID = spr_load_npc_sprite(part->currentAnimation, NULL); + part->curAnimation = get_npc_anim_for_status(part->idleAnimations, 1) & ~SPRITE_ID_TAIL_ALLOCATE; + part->spriteInstanceID = spr_load_npc_sprite(part->curAnimation, NULL); } if (j + 1 >= partCount) { @@ -1928,7 +1928,7 @@ Actor* create_actor(Formation formation) { takeTurnScript = start_script(actor->takeTurnSource, EVT_PRIORITY_A, 0); actor->takeTurnScriptID = takeTurnScript->id; takeTurnScript->owner1.enemyID = actor->enemyIndex | ACTOR_CLASS_ENEMY; - actor->shadow.id = create_shadow_type(0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z); + actor->shadow.id = create_shadow_type(0, actor->curPos.x, actor->curPos.y, actor->curPos.z); actor->shadowScale = actor->size.x / 24.0; actor->disableEffect = fx_disable_x(0, -142.0f, 34.0f, 1.0f, 0); actor->icePillarEffect = NULL; @@ -2110,8 +2110,8 @@ s32 inflict_status(Actor* target, s32 statusTypeKey, s32 duration) { if (effect != NULL) { effect->flags |= FX_INSTANCE_FLAG_DISMISS; } - target->icePillarEffect = fx_ice_pillar(0, target->currentPos.x, target->currentPos.y, - target->currentPos.z, 1.0f, 0); + target->icePillarEffect = fx_ice_pillar(0, target->curPos.x, target->curPos.y, + target->curPos.z, 1.0f, 0); create_status_debuff(target->hudElementDataIndex, STATUS_KEY_FROZEN); } return TRUE; @@ -2341,11 +2341,11 @@ void show_damage_fx(Actor* actor, f32 x, f32 y, f32 z, s32 damage) { } do { - if (battleStatus->currentAttackElement & DAMAGE_TYPE_FIRE) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_FIRE) { fx_ring_blast(0, x, y, z, 1.0f, 24); - } else if (battleStatus->currentAttackElement & DAMAGE_TYPE_SHOCK) { + } else if (battleStatus->curAttackElement & DAMAGE_TYPE_SHOCK) { apply_shock_effect(actor); - } else if (battleStatus->currentAttackElement & DAMAGE_TYPE_WATER) { + } else if (battleStatus->curAttackElement & DAMAGE_TYPE_WATER) { fx_water_splash(0, x, y, z, 1.0f, 24); } else { fx_firework(0, x, y, z, 1.0, intensity); @@ -2541,7 +2541,7 @@ s32 try_inflict_status(Actor* actor, s32 statusTypeKey, s32 statusKey) { duration = 0; if (actor->statusTable != NULL) { - if (!(battleStatus->currentAttackStatus & STATUS_FLAG_RIGHT_ON)) { + if (!(battleStatus->curAttackStatus & STATUS_FLAG_RIGHT_ON)) { chance = lookup_status_chance(actor->statusTable, statusTypeKey); } else { if (lookup_status_chance(actor->statusTable, statusTypeKey) != 0) { @@ -2564,7 +2564,7 @@ s32 try_inflict_status(Actor* actor, s32 statusTypeKey, s32 statusKey) { meow: if (duration > 0) { - if (battleStatus->currentAttackStatus < 0) { + if (battleStatus->curAttackStatus < 0) { duration = battleStatus->statusDuration; duration += lookup_status_duration_mod(actor->statusTable, statusKey); inflict_status(actor, statusTypeKey, duration); @@ -2814,7 +2814,7 @@ void create_part_shadow(s32 actorID, s32 partID) { ActorPart* part = get_actor_part(get_actor(actorID), partID); part->flags &= ~ACTOR_PART_FLAG_4; - part->shadowIndex = create_shadow_type(0, part->currentPos.x, part->currentPos.y, part->currentPos.z); + part->shadowIndex = create_shadow_type(0, part->curPos.x, part->curPos.y, part->curPos.z); part->shadowScale = part->size.x / 24.0; } @@ -2827,7 +2827,7 @@ void remove_part_shadow(s32 actorID, s32 partID) { void create_part_shadow_by_ref(UNK_TYPE arg0, ActorPart* part) { part->flags &= ~ACTOR_PART_FLAG_4; - part->shadowIndex = create_shadow_type(0, part->currentPos.x, part->currentPos.y, part->currentPos.z); + part->shadowIndex = create_shadow_type(0, part->curPos.x, part->curPos.y, part->curPos.z); part->shadowScale = part->size.x / 24.0; } @@ -2869,10 +2869,10 @@ void remove_player_buffs(s32 buffs) { battleStatus->buffEffect->data.partnerBuff->unk_0C[FX_BUFF_DATA_WATER_BLOCK].turnsLeft = 0; battleStatus->waterBlockEffect->flags |= FX_INSTANCE_FLAG_DISMISS; - fx_water_block(1, player->currentPos.x, player->currentPos.y + 18.0f, player->currentPos.z + 5.0f, 1.5f, 0xA); - fx_water_splash(0, player->currentPos.x - 10.0f, player->currentPos.y + 5.0f, player->currentPos.z + 5.0f, 1.0f, 0x18); - fx_water_splash(0, player->currentPos.x - 15.0f, player->currentPos.y + 32.0f, player->currentPos.z + 5.0f, 1.0f, 0x18); - fx_water_splash(1, player->currentPos.x + 15.0f, player->currentPos.y + 22.0f, player->currentPos.z + 5.0f, 1.0f, 0x18); + fx_water_block(1, player->curPos.x, player->curPos.y + 18.0f, player->curPos.z + 5.0f, 1.5f, 0xA); + fx_water_splash(0, player->curPos.x - 10.0f, player->curPos.y + 5.0f, player->curPos.z + 5.0f, 1.0f, 0x18); + fx_water_splash(0, player->curPos.x - 15.0f, player->curPos.y + 32.0f, player->curPos.z + 5.0f, 1.0f, 0x18); + fx_water_splash(1, player->curPos.x + 15.0f, player->curPos.y + 22.0f, player->curPos.z + 5.0f, 1.0f, 0x18); battleStatus->waterBlockEffect = NULL; sfx_play_sound(SOUND_299); @@ -2989,7 +2989,7 @@ void reset_all_actor_sounds(Actor* actor) { } void hide_foreground_models_unchecked(void) { - Stage* stage = gBattleStatus.currentStage; + Stage* stage = gBattleStatus.curStage; if (stage != NULL && stage->foregroundModelList != NULL) { s32* idList = stage->foregroundModelList; @@ -3004,7 +3004,7 @@ void hide_foreground_models_unchecked(void) { } void show_foreground_models_unchecked(void) { - Stage* stage = gBattleStatus.currentStage; + Stage* stage = gBattleStatus.curStage; if (stage != NULL && stage->foregroundModelList != NULL) { s32* idList = stage->foregroundModelList; @@ -3019,7 +3019,7 @@ void show_foreground_models_unchecked(void) { } void hide_foreground_models(void) { - Stage* stage = gBattleStatus.currentStage; + Stage* stage = gBattleStatus.curStage; if (stage != NULL && stage->foregroundModelList != NULL) { s32* idList = stage->foregroundModelList; @@ -3037,7 +3037,7 @@ void hide_foreground_models(void) { } void show_foreground_models(void) { - Stage* stage = gBattleStatus.currentStage; + Stage* stage = gBattleStatus.curStage; if (stage != NULL && stage->foregroundModelList != NULL) { s32* idList = stage->foregroundModelList; diff --git a/src/19FAF0.c b/src/19FAF0.c index dfee802ad6f..9e089054e20 100644 --- a/src/19FAF0.c +++ b/src/19FAF0.c @@ -180,13 +180,13 @@ HitResult calc_player_test_enemy(void) { BattleStatus* battleStatus = &gBattleStatus; Actor* player = battleStatus->playerActor; ActorState* state = &player->state; - s32 targetActorID = battleStatus->currentTargetID; - s32 targetPartIdx = battleStatus->currentTargetPart; + s32 targetActorID = battleStatus->curTargetID; + s32 targetPartIdx = battleStatus->curTargetPart; Actor* target; ActorPart* targetPart; - battleStatus->currentTargetID2 = battleStatus->currentTargetID; - battleStatus->currentTargetPart2 = battleStatus->currentTargetPart; + battleStatus->curTargetID2 = battleStatus->curTargetID; + battleStatus->curTargetPart2 = battleStatus->curTargetPart; target = get_actor(targetActorID); if (target == NULL) { @@ -202,7 +202,7 @@ HitResult calc_player_test_enemy(void) { if (target->transparentStatus == STATUS_KEY_TRANSPARENT || (targetPart->eventFlags & ACTOR_EVENT_FLAG_800) - && !(battleStatus->currentAttackElement & DAMAGE_TYPE_QUAKE)) + && !(battleStatus->curAttackElement & DAMAGE_TYPE_QUAKE)) { return HIT_RESULT_MISS; } @@ -212,7 +212,7 @@ HitResult calc_player_test_enemy(void) { return HIT_RESULT_IMMUNE; } - if ((battleStatus->currentAttackElement & DAMAGE_TYPE_JUMP) + if ((battleStatus->curAttackElement & DAMAGE_TYPE_JUMP) && (targetPart->eventFlags & ACTOR_EVENT_FLAG_SPIKY_TOP) && !player_team_is_ability_active(player, ABILITY_SPIKE_SHIELD)) { @@ -220,9 +220,9 @@ HitResult calc_player_test_enemy(void) { return HIT_RESULT_LANDED_ON_SPIKE; } - if (!(battleStatus->currentAttackElement & (DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_JUMP)) + if (!(battleStatus->curAttackElement & (DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_JUMP)) && (targetPart->eventFlags & ACTOR_EVENT_FLAG_SPIKY_FRONT) - && (!(battleStatus->currentAttackEventSuppression & SUPPRESS_EVENT_SPIKY_FRONT) + && (!(battleStatus->curAttackEventSuppression & SUPPRESS_EVENT_SPIKY_FRONT) && !player_team_is_ability_active(player, ABILITY_SPIKE_SHIELD))) { sfx_play_sound_at_position(SOUND_108, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); @@ -241,8 +241,8 @@ HitResult calc_player_test_enemy(void) { HitResult calc_player_damage_enemy(void) { BattleStatus* battleStatus = &gBattleStatus; Actor* player = battleStatus->playerActor; - s32 currentTargetID = battleStatus->currentTargetID; - s32 currentTargetPartID = battleStatus->currentTargetPart; + s32 currentTargetID = battleStatus->curTargetID; + s32 currentTargetPartID = battleStatus->curTargetPart; ActorState* state; Evt* evt; Actor* target; @@ -275,8 +275,8 @@ HitResult calc_player_damage_enemy(void) { battleStatus->wasStatusInflicted = FALSE; battleStatus->lastAttackDamage = 0; battleStatus->attackerActorID = player->actorID; - battleStatus->currentTargetID2 = battleStatus->currentTargetID; - battleStatus->currentTargetPart2 = battleStatus->currentTargetPart; + battleStatus->curTargetID2 = battleStatus->curTargetID; + battleStatus->curTargetPart2 = battleStatus->curTargetPart; target = get_actor(currentTargetID); state = &player->state; @@ -295,15 +295,15 @@ HitResult calc_player_damage_enemy(void) { dispatchEvent = EVENT_ZERO_DAMAGE; } else { if (player_team_is_ability_active(player, ABILITY_ICE_POWER)) { - if (!(battleStatus->currentAttackElement & DAMAGE_TYPE_NO_CONTACT)) { - battleStatus->currentAttackElement |= DAMAGE_TYPE_ICE; + if (!(battleStatus->curAttackElement & DAMAGE_TYPE_NO_CONTACT)) { + battleStatus->curAttackElement |= DAMAGE_TYPE_ICE; } } if (targetPart->eventFlags & ACTOR_EVENT_FLAG_ILLUSORY || (target->transparentStatus == STATUS_KEY_TRANSPARENT || targetPart->eventFlags & ACTOR_EVENT_FLAG_800 - && !(battleStatus->currentAttackElement & DAMAGE_TYPE_QUAKE)) + && !(battleStatus->curAttackElement & DAMAGE_TYPE_QUAKE)) ) { return HIT_RESULT_MISS; } @@ -318,11 +318,11 @@ HitResult calc_player_damage_enemy(void) { return HIT_RESULT_HIT; } - if (targetPart->elementalImmunities & battleStatus->currentAttackElement) { + if (targetPart->elementalImmunities & battleStatus->curAttackElement) { partImmuneToElement = TRUE; } - if ((battleStatus->currentAttackElement & DAMAGE_TYPE_JUMP) + if ((battleStatus->curAttackElement & DAMAGE_TYPE_JUMP) && (targetPart->eventFlags & ACTOR_EVENT_FLAG_SPIKY_TOP) && !player_team_is_ability_active(player, ABILITY_SPIKE_SHIELD)) { @@ -332,7 +332,7 @@ HitResult calc_player_damage_enemy(void) { return HIT_RESULT_BACKFIRE; } - if (!(battleStatus->currentAttackElement & (DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_SMASH))) { + if (!(battleStatus->curAttackElement & (DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_SMASH))) { if (targetPart->eventFlags & ACTOR_EVENT_FLAG_EXPLODE_ON_CONTACT) { sfx_play_sound_at_position(SOUND_HIT_PLAYER_FIRE, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); dispatch_damage_event_player_1(1, EVENT_BURN_CONTACT); @@ -341,7 +341,7 @@ HitResult calc_player_damage_enemy(void) { } if (targetPart->eventFlags & ACTOR_EVENT_FLAG_FIREY - && !(battleStatus->currentAttackEventSuppression & SUPPRESS_EVENT_BURN_CONTACT) + && !(battleStatus->curAttackEventSuppression & SUPPRESS_EVENT_BURN_CONTACT) && !(player_team_is_ability_active(player, ABILITY_FIRE_SHIELD)) && !(player_team_is_ability_active(player, ABILITY_ICE_POWER)) ) { @@ -353,7 +353,7 @@ HitResult calc_player_damage_enemy(void) { } if (gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE - && battleStatus->currentAttackElement & DAMAGE_TYPE_FIRE + && battleStatus->curAttackElement & DAMAGE_TYPE_FIRE && targetPart->eventFlags & (ACTOR_EVENT_FLAG_FIRE_EXPLODE | ACTOR_EVENT_FLAG_EXPLODE_ON_IGNITION) ) { sfx_play_sound_at_position(SOUND_HIT_PLAYER_FIRE, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); @@ -364,9 +364,9 @@ HitResult calc_player_damage_enemy(void) { return HIT_RESULT_HIT; } - if (!(battleStatus->currentAttackElement & (DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_SMASH)) + if (!(battleStatus->curAttackElement & (DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_SMASH)) && targetPart->eventFlags & ACTOR_EVENT_FLAG_200000 - && !(battleStatus->currentAttackEventSuppression & SUPPRESS_EVENT_FLAG_80) + && !(battleStatus->curAttackEventSuppression & SUPPRESS_EVENT_FLAG_80) && !player_team_is_ability_active(player, ABILITY_SPIKE_SHIELD) ) { sfx_play_sound_at_position(SOUND_108, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); @@ -375,22 +375,22 @@ HitResult calc_player_damage_enemy(void) { return HIT_RESULT_BACKFIRE; } - if (battleStatus->currentAttackElement & DAMAGE_TYPE_FIRE) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_FIRE) { fx_ring_blast(0, state->goalPos.x, state->goalPos.y, state->goalPos.z * 5.0f, 1.0f, 24); isFireDamage = TRUE; } - if (battleStatus->currentAttackElement & DAMAGE_TYPE_SHOCK) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_SHOCK) { apply_shock_effect(target); isShockDamage = TRUE; } - if (battleStatus->currentAttackElement & DAMAGE_TYPE_WATER) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_WATER) { fx_water_splash(0, state->goalPos.x, state->goalPos.y, state->goalPos.z + 5.0f, 1.0f, 24); isWaterDamage = TRUE; } - if (battleStatus->currentAttackElement & DAMAGE_TYPE_ICE) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_ICE) { fx_big_snowflakes(0, state->goalPos.x, state->goalPos.y, state->goalPos.z + 5.0f); isIceDamage = TRUE; } @@ -425,20 +425,20 @@ HitResult calc_player_damage_enemy(void) { if (!is_ability_active(ABILITY_ZAP_TAP) && player->staticStatus != STATUS_KEY_STATIC && (target->staticStatus == STATUS_KEY_STATIC || targetPart->eventFlags & ACTOR_EVENT_FLAG_ELECTRIFIED) - && !(battleStatus->currentAttackElement & (DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_SHOCK)) - && !(battleStatus->currentAttackEventSuppression & SUPPRESS_EVENT_SHOCK_CONTACT) + && !(battleStatus->curAttackElement & (DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_SHOCK)) + && !(battleStatus->curAttackEventSuppression & SUPPRESS_EVENT_SHOCK_CONTACT) ) { gBattleStatus.flags1 |= BS_FLAGS1_SP_EVT_ACTIVE; sp20 = TRUE; } if (targetPart->eventFlags & (ACTOR_EVENT_FLAG_STAR_ROD_ENCHANTED | ACTOR_EVENT_FLAG_ENCHANTED)) { - battleStatus->currentAttackElement &= ~DAMAGE_TYPE_IGNORE_DEFENSE; + battleStatus->curAttackElement &= ~DAMAGE_TYPE_IGNORE_DEFENSE; } - targetDefense = get_defense(target, targetPart->defenseTable, battleStatus->currentAttackElement); + targetDefense = get_defense(target, targetPart->defenseTable, battleStatus->curAttackElement); - if (!(battleStatus->currentAttackElement & DAMAGE_TYPE_IGNORE_DEFENSE)) { + if (!(battleStatus->curAttackElement & DAMAGE_TYPE_IGNORE_DEFENSE)) { targetDefense += target->defenseBoost; } @@ -446,19 +446,19 @@ HitResult calc_player_damage_enemy(void) { targetDefense += 127; } - currentAttackDamage = battleStatus->currentAttackDamage; - currentAttackDamage += count_power_plus(battleStatus->currentAttackElement); + currentAttackDamage = battleStatus->curAttackDamage; + currentAttackDamage += count_power_plus(battleStatus->curAttackElement); - if (battleStatus->merleeAttackBoost > 0 && (gBattleStatus.flags1 & BS_FLAGS1_10 || battleStatus->currentAttackElement & DAMAGE_TYPE_JUMP)) { + if (battleStatus->merleeAttackBoost > 0 && (gBattleStatus.flags1 & BS_FLAGS1_10 || battleStatus->curAttackElement & DAMAGE_TYPE_JUMP)) { currentAttackDamage += battleStatus->merleeAttackBoost; } - if (battleStatus->jumpCharge && battleStatus->currentAttackElement & DAMAGE_TYPE_JUMP) { + if (battleStatus->jumpCharge && battleStatus->curAttackElement & DAMAGE_TYPE_JUMP) { currentAttackDamage += battleStatus->jumpCharge; gBattleStatus.flags1 &= ~BS_FLAGS1_JUMP_CHARGED; } - if (battleStatus->hammerCharge && battleStatus->currentAttackElement & (DAMAGE_TYPE_QUAKE_HAMMER | DAMAGE_TYPE_THROW | DAMAGE_TYPE_SMASH)) { + if (battleStatus->hammerCharge && battleStatus->curAttackElement & (DAMAGE_TYPE_QUAKE_HAMMER | DAMAGE_TYPE_THROW | DAMAGE_TYPE_SMASH)) { currentAttackDamage += battleStatus->hammerCharge; gBattleStatus.flags1 &= ~BS_FLAGS1_HAMMER_CHARGED; } @@ -516,7 +516,7 @@ HitResult calc_player_damage_enemy(void) { } if (gBattleStatus.flags2 & BS_FLAGS2_HAS_RUSH && (gBattleStatus.flags1 & BS_FLAGS1_10 || - battleStatus->currentAttackElement & DAMAGE_TYPE_JUMP)) { + battleStatus->curAttackElement & DAMAGE_TYPE_JUMP)) { if (battleStatus->rushFlags & RUSH_FLAG_POWER) { currentAttackDamage += 2; } @@ -552,14 +552,14 @@ HitResult calc_player_damage_enemy(void) { } if (gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE - && battleStatus->currentAttackElement & DAMAGE_TYPE_BLAST + && battleStatus->curAttackElement & DAMAGE_TYPE_BLAST && targetPart->eventFlags & ACTOR_EVENT_FLAG_EXPLODE_ON_IGNITION ) { targetDefense = 0; - currentAttackDamage = target->currentHP; + currentAttackDamage = target->curHP; } - if (battleStatus->currentAttackElement & DAMAGE_TYPE_STATUS_ALWAYS_HITS) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_STATUS_ALWAYS_HITS) { targetDefense = 0; currentAttackDamage = 0; } @@ -579,7 +579,7 @@ HitResult calc_player_damage_enemy(void) { currentAttackDamage = 0; } - if (battleStatus->currentAttackElement & DAMAGE_TYPE_POWER_BOUNCE && currentAttackDamage > 0) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_POWER_BOUNCE && currentAttackDamage > 0) { currentAttackDamage += battleStatus->powerBounceCounter; if (currentAttackDamage < 1) { @@ -593,11 +593,11 @@ HitResult calc_player_damage_enemy(void) { target->hpChangeCounter = 0; hitResult = HIT_RESULT_NO_DAMAGE; - if (!(battleStatus->currentAttackElement & DAMAGE_TYPE_STATUS_ALWAYS_HITS)) { + if (!(battleStatus->curAttackElement & DAMAGE_TYPE_STATUS_ALWAYS_HITS)) { dispatchEvent = EVENT_ZERO_DAMAGE; sfx_play_sound_at_position(SOUND_IMMUNE, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } else { - if (target->currentHP < 1) { + if (target->curHP < 1) { dispatchEvent = EVENT_DEATH; } else { dispatchEvent = EVENT_ZERO_DAMAGE; @@ -616,10 +616,10 @@ HitResult calc_player_damage_enemy(void) { && !partImmuneToElement && !(targetPart->targetFlags & ACTOR_PART_TARGET_FLAG_4) ) { - target->currentHP -= currentAttackDamage; + target->curHP -= currentAttackDamage; - if (target->currentHP < 1) { - target->currentHP = 0; + if (target->curHP < 1) { + target->curHP = 0; dispatchEvent = EVENT_DEATH; } } @@ -633,9 +633,9 @@ HitResult calc_player_damage_enemy(void) { if (!is_ability_active(ABILITY_ZAP_TAP) && player->staticStatus != STATUS_KEY_STATIC && (target->staticStatus == STATUS_KEY_STATIC || (targetPart->eventFlags & ACTOR_EVENT_FLAG_ELECTRIFIED)) - && !(battleStatus->currentAttackElement & DAMAGE_TYPE_NO_CONTACT) - && !(battleStatus->currentAttackEventSuppression & SUPPRESS_EVENT_SHOCK_CONTACT) - && !(battleStatus->currentAttackElement & DAMAGE_TYPE_SHOCK) + && !(battleStatus->curAttackElement & DAMAGE_TYPE_NO_CONTACT) + && !(battleStatus->curAttackEventSuppression & SUPPRESS_EVENT_SHOCK_CONTACT) + && !(battleStatus->curAttackElement & DAMAGE_TYPE_SHOCK) ) { sfx_play_sound_at_position(SOUND_HIT_PLAYER_SHOCK, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); apply_shock_effect(player); @@ -654,7 +654,7 @@ HitResult calc_player_damage_enemy(void) { } if (gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE) { - if (battleStatus->currentAttackElement & DAMAGE_TYPE_FEAR + if (battleStatus->curAttackElement & DAMAGE_TYPE_FEAR && rand_int(99) < (target->actorBlueprint->escapeChance * battleStatus->statusChance) / 100 && (target->debuff != STATUS_KEY_FEAR && target->debuff != STATUS_KEY_DIZZY @@ -682,7 +682,7 @@ HitResult calc_player_damage_enemy(void) { dispatchEvent = EVENT_IMMUNE; } - if (target->currentHP < 1) { + if (target->curHP < 1) { if (dispatchEvent == EVENT_IMMUNE) { dispatchEvent = EVENT_DEATH; } @@ -696,7 +696,7 @@ HitResult calc_player_damage_enemy(void) { } if (gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE) { - if (battleStatus->currentAttackElement & DAMAGE_TYPE_SPIN_SMASH) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_SPIN_SMASH) { PlayerData* playerData = &gPlayerData; if (target->actorBlueprint->spinSmashReq != 255 @@ -727,7 +727,7 @@ HitResult calc_player_damage_enemy(void) { } if ((gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE) - && !(battleStatus->currentAttackElement & DAMAGE_TYPE_NO_CONTACT) + && !(battleStatus->curAttackElement & DAMAGE_TYPE_NO_CONTACT) && targetPart->eventFlags & ACTOR_EVENT_FLAG_POWER_BOUNCE ) { if (dispatchEvent == EVENT_HIT_COMBO) { @@ -752,7 +752,7 @@ HitResult calc_player_damage_enemy(void) { } if ((gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE) - && (battleStatus->currentAttackElement & (DAMAGE_TYPE_POW | DAMAGE_TYPE_JUMP)) + && (battleStatus->curAttackElement & (DAMAGE_TYPE_POW | DAMAGE_TYPE_JUMP)) && targetPart->eventFlags & ACTOR_EVENT_FLAG_GROUNDABLE ) { if (dispatchEvent == EVENT_HIT) { @@ -767,7 +767,7 @@ HitResult calc_player_damage_enemy(void) { } if ((gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE) - && (battleStatus->currentAttackElement & (DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_POW | DAMAGE_TYPE_JUMP)) + && (battleStatus->curAttackElement & (DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_POW | DAMAGE_TYPE_JUMP)) && targetPart->eventFlags & ACTOR_EVENT_FLAG_FLIPABLE ) { if (dispatchEvent == EVENT_HIT) { @@ -785,7 +785,7 @@ HitResult calc_player_damage_enemy(void) { } if (!(gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE) - && battleStatus->currentAttackElement & (DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_POW | DAMAGE_TYPE_JUMP) + && battleStatus->curAttackElement & (DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_POW | DAMAGE_TYPE_JUMP) && targetPart->eventFlags & ACTOR_EVENT_FLAG_FLIPABLE ) { if (dispatchEvent == EVENT_HIT_COMBO) { @@ -802,7 +802,7 @@ HitResult calc_player_damage_enemy(void) { } if (gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE - && battleStatus->currentAttackElement & DAMAGE_TYPE_SHELL_CRACK + && battleStatus->curAttackElement & DAMAGE_TYPE_SHELL_CRACK && targetPart->eventFlags & ACTOR_EVENT_FLAG_FLIPABLE ) { if (dispatchEvent == EVENT_HIT) { @@ -816,7 +816,7 @@ HitResult calc_player_damage_enemy(void) { } if (gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE - && (battleStatus->currentAttackElement & (DAMAGE_TYPE_BLAST | DAMAGE_TYPE_FIRE)) + && (battleStatus->curAttackElement & (DAMAGE_TYPE_BLAST | DAMAGE_TYPE_FIRE)) ) { if (dispatchEvent == EVENT_HIT) { dispatchEvent = EVENT_BURN_HIT; @@ -838,7 +838,7 @@ HitResult calc_player_damage_enemy(void) { && !(targetPart->targetFlags & ACTOR_PART_TARGET_FLAG_4) ) { #define INFLICT_STATUS(STATUS_TYPE) \ - if ((battleStatus->currentAttackStatus & STATUS_FLAG_##STATUS_TYPE) && \ + if ((battleStatus->curAttackStatus & STATUS_FLAG_##STATUS_TYPE) && \ try_inflict_status(target, STATUS_KEY_##STATUS_TYPE, STATUS_TURN_MOD_##STATUS_TYPE)) { \ tempBinary = TRUE; \ wasStatusInflicted = TRUE; \ @@ -879,7 +879,7 @@ HitResult calc_player_damage_enemy(void) { } } } else if (!partImmuneToElement) { - if (battleStatus->currentAttackElement & (DAMAGE_TYPE_MULTIPLE_POPUPS | DAMAGE_TYPE_SMASH)) { + if (battleStatus->curAttackElement & (DAMAGE_TYPE_MULTIPLE_POPUPS | DAMAGE_TYPE_SMASH)) { show_next_damage_popup(state->goalPos.x, state->goalPos.y, state->goalPos.z, battleStatus->lastAttackDamage, 0); } else { show_primary_damage_popup(state->goalPos.x, state->goalPos.y, state->goalPos.z, battleStatus->lastAttackDamage, 0); @@ -901,8 +901,8 @@ HitResult calc_player_damage_enemy(void) { sfx_play_sound(SOUND_231); } - if (battleStatus->lastAttackDamage > 0 || battleStatus->currentAttackElement & DAMAGE_TYPE_STATUS_ALWAYS_HITS && tempBinary) { - if (!(battleStatus->currentAttackElement & DAMAGE_TYPE_MULTI_BOUNCE)) { + if (battleStatus->lastAttackDamage > 0 || battleStatus->curAttackElement & DAMAGE_TYPE_STATUS_ALWAYS_HITS && tempBinary) { + if (!(battleStatus->curAttackElement & DAMAGE_TYPE_MULTI_BOUNCE)) { show_action_rating(ACTION_RATING_NICE, target, state->goalPos.x, state->goalPos.y, state->goalPos.z); } else { show_action_rating(ACTION_RATING_NICE_SUPER_COMBO, target, state->goalPos.x, state->goalPos.y, state->goalPos.z); @@ -937,7 +937,7 @@ HitResult calc_player_damage_enemy(void) { sfx_play_sound_at_position(SOUND_IMMUNE, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if (battleStatus->currentAttackStatus & STATUS_FLAG_SLEEP && wasStatusInflicted) { + if (battleStatus->curAttackStatus & STATUS_FLAG_SLEEP && wasStatusInflicted) { evt = start_script(&EVS_PlaySleepHitFX, EVT_PRIORITY_A, 0); evt->varTable[0] = state->goalPos.x; evt->varTable[1] = state->goalPos.y; @@ -945,7 +945,7 @@ HitResult calc_player_damage_enemy(void) { sfx_play_sound_at_position(SOUND_INFLICT_SLEEP, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if (battleStatus->currentAttackStatus & STATUS_FLAG_DIZZY && wasStatusInflicted) { + if (battleStatus->curAttackStatus & STATUS_FLAG_DIZZY && wasStatusInflicted) { evt = start_script(&EVS_PlayDizzyHitFX, EVT_PRIORITY_A, 0); evt->varTable[0] = state->goalPos.x; evt->varTable[1] = state->goalPos.y; @@ -953,7 +953,7 @@ HitResult calc_player_damage_enemy(void) { sfx_play_sound_at_position(SOUND_INFLICT_STATUS, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if (battleStatus->currentAttackStatus & STATUS_FLAG_PARALYZE && wasStatusInflicted) { + if (battleStatus->curAttackStatus & STATUS_FLAG_PARALYZE && wasStatusInflicted) { evt = start_script(&EVS_PlayParalyzeHitFX, EVT_PRIORITY_A, 0); evt->varTable[0] = state->goalPos.x; evt->varTable[1] = state->goalPos.y; @@ -961,7 +961,7 @@ HitResult calc_player_damage_enemy(void) { sfx_play_sound_at_position(SOUND_INFLICT_STATUS, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if (battleStatus->currentAttackStatus & STATUS_FLAG_POISON && wasStatusInflicted) { + if (battleStatus->curAttackStatus & STATUS_FLAG_POISON && wasStatusInflicted) { evt = start_script(&EVS_PlayPoisonHitFX, EVT_PRIORITY_A, 0); evt->varTable[0] = state->goalPos.x; evt->varTable[1] = state->goalPos.y; @@ -969,7 +969,7 @@ HitResult calc_player_damage_enemy(void) { sfx_play_sound_at_position(SOUND_INFLICT_STATUS, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if (battleStatus->currentAttackStatus & STATUS_FLAG_STOP && wasStatusInflicted) { + if (battleStatus->curAttackStatus & STATUS_FLAG_STOP && wasStatusInflicted) { evt = start_script(&EVS_PlayStopHitFX, EVT_PRIORITY_A, 0); evt->varTable[0] = state->goalPos.x; evt->varTable[1] = state->goalPos.y; @@ -977,7 +977,7 @@ HitResult calc_player_damage_enemy(void) { sfx_play_sound_at_position(SOUND_INFLICT_STATUS, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if (battleStatus->currentAttackStatus & STATUS_FLAG_FROZEN && wasStatusInflicted) { + if (battleStatus->curAttackStatus & STATUS_FLAG_FROZEN && wasStatusInflicted) { evt = start_script(&EVS_PlayFreezeHitFX, EVT_PRIORITY_A, 0); evt->varTable[0] = state->goalPos.x; evt->varTable[1] = state->goalPos.y; @@ -986,7 +986,7 @@ HitResult calc_player_damage_enemy(void) { sfx_play_sound_at_position(SOUND_HIT_PLAYER_ICE, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if (battleStatus->currentAttackStatus & STATUS_FLAG_SHRINK && wasStatusInflicted) { + if (battleStatus->curAttackStatus & STATUS_FLAG_SHRINK && wasStatusInflicted) { evt = start_script(&EVS_PlayShrinkHitFX, EVT_PRIORITY_A, 0); evt->varTable[0] = state->goalPos.x; evt->varTable[1] = state->goalPos.y; @@ -995,7 +995,7 @@ HitResult calc_player_damage_enemy(void) { sfx_play_sound_at_position(SOUND_INFLICT_STATUS, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if (battleStatus->currentAttackElement & DAMAGE_TYPE_SMASH && target->actorType == ACTOR_TYPE_GOOMNUT_TREE) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_SMASH && target->actorType == ACTOR_TYPE_GOOMNUT_TREE) { sfx_play_sound_at_position(SOUND_SMASH_GOOMNUT_TREE, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } @@ -1013,8 +1013,8 @@ HitResult calc_player_damage_enemy(void) { if (!is_ability_active(ABILITY_ZAP_TAP) && (player->staticStatus != STATUS_KEY_STATIC) && (target->staticStatus == STATUS_KEY_STATIC || targetPart->eventFlags & ACTOR_EVENT_FLAG_ELECTRIFIED) - && !(battleStatus->currentAttackElement & (DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_SHOCK)) - && !(battleStatus->currentAttackEventSuppression & SUPPRESS_EVENT_SHOCK_CONTACT) + && !(battleStatus->curAttackElement & (DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_SHOCK)) + && !(battleStatus->curAttackEventSuppression & SUPPRESS_EVENT_SHOCK_CONTACT) ) { sfx_play_sound_at_position(SOUND_HIT_PLAYER_SHOCK, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); apply_shock_effect(player); @@ -1036,29 +1036,29 @@ s32 dispatch_damage_event_player(s32 damageAmount, s32 event, s32 arg2) { s32 oldPlayerHP; s32 temp; - battleStatus->currentAttackDamage = damageAmount; + battleStatus->curAttackDamage = damageAmount; temp = (s16)damageAmount; //TODO usage of temp here required to match player->hpChangeCounter += temp; temp = player->hpChangeCounter; - player->currentHP = playerData->curHP; + player->curHP = playerData->curHP; player->damageCounter += temp; player->hpChangeCounter -= temp; battleStatus->lastAttackDamage = 0; - player->currentHP -= temp; + player->curHP -= temp; battleStatus->damageTaken += temp; - oldPlayerHP = player->currentHP; + oldPlayerHP = player->curHP; dispatchEvent = event; - if (player->currentHP < 1) { + if (player->curHP < 1) { battleStatus->lastAttackDamage += oldPlayerHP; - player->currentHP = 0; + player->curHP = 0; dispatchEvent = EVENT_DEATH; } battleStatus->lastAttackDamage += temp; - playerData->curHP = player->currentHP; + playerData->curHP = player->curHP; if (dispatchEvent == EVENT_HIT_COMBO) { dispatchEvent = EVENT_HIT; @@ -1099,8 +1099,8 @@ s32 dispatch_damage_event_player(s32 damageAmount, s32 event, s32 arg2) { s32 dispatch_damage_event_player_0(s32 damageAmount, s32 event) { BattleStatus* battleStatus = &gBattleStatus; - battleStatus->currentAttackElement = ELEMENT_END; - battleStatus->currentDamageSource = DMG_SRC_DEFAULT; + battleStatus->curAttackElement = ELEMENT_END; + battleStatus->curDamageSource = DMG_SRC_DEFAULT; return dispatch_damage_event_player(damageAmount, event, FALSE); } @@ -1142,83 +1142,83 @@ ApiStatus func_80273444(Evt* script, s32 isInitialCall) { player->state.moveArcAmplitude = evt_get_variable(script, *args++); script->functionTemp[1] = evt_get_variable(script, *args++); - player->state.currentPos.x = player->currentPos.x; - player->state.currentPos.y = player->currentPos.y; - player->state.currentPos.z = player->currentPos.z; + player->state.curPos.x = player->curPos.x; + player->state.curPos.y = player->curPos.y; + player->state.curPos.z = player->curPos.z; - x = player->state.currentPos.x; - y = player->state.currentPos.y; - z = player->state.currentPos.z; + x = player->state.curPos.x; + y = player->state.curPos.y; + z = player->state.curPos.z; goalX = player->state.goalPos.x; goalY = player->state.goalPos.y; goalZ = player->state.goalPos.z; player->state.angle = atan2(x, z, goalX, goalZ); - player->state.distance = dist2D(x, z, goalX, goalZ); + player->state.dist = dist2D(x, z, goalX, goalZ); y = goalY - y; if (player->state.moveTime == 0) { - player->state.moveTime = player->state.distance / player->state.speed; - var_f8 = player->state.distance - (player->state.moveTime * player->state.speed); + player->state.moveTime = player->state.dist / player->state.speed; + var_f8 = player->state.dist - (player->state.moveTime * player->state.speed); } else { - player->state.speed = player->state.distance / player->state.moveTime; - var_f8 = player->state.distance - (player->state.moveTime * player->state.speed); + player->state.speed = player->state.dist / player->state.moveTime; + var_f8 = player->state.dist - (player->state.moveTime * player->state.speed); } playerState->speed += var_f8 / playerState->moveTime; - playerState->velocity = (playerState->acceleration * playerState->moveTime * 0.5f) + (y / playerState->moveTime); + playerState->vel = (playerState->acceleration * playerState->moveTime * 0.5f) + (y / playerState->moveTime); set_animation(0, 0, playerState->animJumpRise); playerState->unk_24 = 90.0f; playerState->unk_28 = 180 / playerState->moveTime; playerState->unk_2C = playerState->goalPos.y; if (script->functionTemp[1] != 2) { - sfx_play_sound_at_position(SOUND_160, SOUND_SPACE_MODE_0, player->currentPos.x, player->currentPos.y, player->currentPos.z); + sfx_play_sound_at_position(SOUND_160, SOUND_SPACE_MODE_0, player->curPos.x, player->curPos.y, player->curPos.z); } script->functionTemp[0] = TRUE; } - if (playerState->velocity < 0.0f) { + if (playerState->vel < 0.0f) { set_animation(0, 0, playerState->animJumpFall); } - playerVel = playerState->velocity; + playerVel = playerState->vel; switch (playerState->moveArcAmplitude) { case 0: break; case 1: - if (playerState->currentPos.y - playerState->unk_2C > 45.0f) { + if (playerState->curPos.y - playerState->unk_2C > 45.0f) { playerVel *= 0.25f; } break; case 2: - if (playerState->currentPos.y - playerState->unk_2C > 54.9) { + if (playerState->curPos.y - playerState->unk_2C > 54.9) { playerVel *= 0.25f; } break; } - playerState->currentPos.y += playerVel; - playerState->velocity -= playerState->acceleration; + playerState->curPos.y += playerVel; + playerState->vel -= playerState->acceleration; playerSpeed = playerState->speed; - add_xz_vec3f(&playerState->currentPos, playerSpeed + sin_rad(DEG_TO_RAD(playerState->unk_24)), playerState->angle); + add_xz_vec3f(&playerState->curPos, playerSpeed + sin_rad(DEG_TO_RAD(playerState->unk_24)), playerState->angle); playerState->unk_24 += playerState->unk_28; playerState->unk_24 = clamp_angle(playerState->unk_24); - player->currentPos.x = playerState->currentPos.x; - player->currentPos.y = playerState->currentPos.y; - player->currentPos.z = playerState->currentPos.z; + player->curPos.x = playerState->curPos.x; + player->curPos.y = playerState->curPos.y; + player->curPos.z = playerState->curPos.z; playerState->moveTime--; if (playerState->moveTime >= 0) { return ApiStatus_BLOCK; } - player->currentPos.y = playerState->goalPos.y; + player->curPos.y = playerState->goalPos.y; if (script->functionTemp[1] != 1) { - play_movement_dust_effects(2, player->currentPos.x, player->currentPos.y, player->currentPos.z, player->yaw); + play_movement_dust_effects(2, player->curPos.x, player->curPos.y, player->curPos.z, player->yaw); } if (script->functionTemp[1] != 2) { - sfx_play_sound_at_position(SOUND_SOFT_LAND, SOUND_SPACE_MODE_0, player->currentPos.x, player->currentPos.y, player->currentPos.z); + sfx_play_sound_at_position(SOUND_SOFT_LAND, SOUND_SPACE_MODE_0, player->curPos.x, player->curPos.y, player->curPos.z); } return ApiStatus_DONE1; @@ -1238,13 +1238,13 @@ ApiStatus PlayerFallToGoal(Evt* script, s32 isInitialCall) { if (!script->functionTemp[0]) { s32 moveTime = evt_get_variable(script, *args++); - player->state.currentPos.x = player->currentPos.x; - player->state.currentPos.y = player->currentPos.y; - player->state.currentPos.z = player->currentPos.z; + player->state.curPos.x = player->curPos.x; + player->state.curPos.y = player->curPos.y; + player->state.curPos.z = player->curPos.z; - x = player->state.currentPos.x; - y = player->state.currentPos.y; - z = player->state.currentPos.z; + x = player->state.curPos.x; + y = player->state.curPos.y; + z = player->state.curPos.z; goalX = player->state.goalPos.x; goalY = player->state.goalPos.y; goalZ = player->state.goalPos.z; @@ -1252,41 +1252,41 @@ ApiStatus PlayerFallToGoal(Evt* script, s32 isInitialCall) { state->moveTime = moveTime; player->state.angle = atan2(x, z, goalX, goalZ); - player->state.distance = dist2D(x, z, goalX, goalZ); + player->state.dist = dist2D(x, z, goalX, goalZ); y = goalY - y; if (state->moveTime == 0) { - state->moveTime = state->distance / state->speed; + state->moveTime = state->dist / state->speed; } else { - state->speed = state->distance / state->moveTime; + state->speed = state->dist / state->moveTime; } - state->velocity = 0.0f; - state->acceleration = ((y / state->moveTime) - state->velocity) / (-state->moveTime * 0.5); + state->vel = 0.0f; + state->acceleration = ((y / state->moveTime) - state->vel) / (-state->moveTime * 0.5); set_animation(ACTOR_PLAYER, 0, state->animJumpRise); script->functionTemp[0] = TRUE; } - if (state->velocity < 0.0f) { + if (state->vel < 0.0f) { set_animation(ACTOR_PLAYER, 0, state->animJumpFall); } - state->currentPos.y += state->velocity; - state->velocity -= state->acceleration; - add_xz_vec3f(&state->currentPos, state->speed, state->angle); + state->curPos.y += state->vel; + state->vel -= state->acceleration; + add_xz_vec3f(&state->curPos, state->speed, state->angle); - player->currentPos.x = state->currentPos.x; - player->currentPos.y = state->currentPos.y; - player->currentPos.z = state->currentPos.z; + player->curPos.x = state->curPos.x; + player->curPos.y = state->curPos.y; + player->curPos.z = state->curPos.z; state->moveTime--; if (state->moveTime < 0) { - player->currentPos.x = state->goalPos.x; - player->currentPos.y = state->goalPos.y; - player->currentPos.z = state->goalPos.z; - play_movement_dust_effects(2, player->currentPos.x, player->currentPos.y, player->currentPos.z, player->yaw); - sfx_play_sound_at_position(SOUND_SOFT_LAND, SOUND_SPACE_MODE_0, player->currentPos.x, player->currentPos.y, player->currentPos.z); + player->curPos.x = state->goalPos.x; + player->curPos.y = state->goalPos.y; + player->curPos.z = state->goalPos.z; + play_movement_dust_effects(2, player->curPos.x, player->curPos.y, player->curPos.z, player->yaw); + sfx_play_sound_at_position(SOUND_SOFT_LAND, SOUND_SPACE_MODE_0, player->curPos.x, player->curPos.y, player->curPos.z); return ApiStatus_DONE1; } return ApiStatus_BLOCK; @@ -1301,38 +1301,38 @@ ApiStatus PlayerLandJump(Evt* script, s32 isInitialCall) { } if (script->functionTemp[0] == 0) { - walkMovement->currentPos.x = player->currentPos.x; - walkMovement->currentPos.y = player->currentPos.y; - walkMovement->currentPos.z = player->currentPos.z; + walkMovement->curPos.x = player->curPos.x; + walkMovement->curPos.y = player->curPos.y; + walkMovement->curPos.z = player->curPos.z; script->functionTemp[0] = 1; } - if (walkMovement->velocity > 0.0f) { + if (walkMovement->vel > 0.0f) { if (walkMovement->animJumpRise != 0) { set_animation(0, 0, walkMovement->animJumpRise); } } - if (walkMovement->velocity < 0.0f) { + if (walkMovement->vel < 0.0f) { if (walkMovement->animJumpFall != 0) { set_animation(0, 0, walkMovement->animJumpFall); } } - walkMovement->currentPos.y += walkMovement->velocity; - walkMovement->velocity -= walkMovement->acceleration; + walkMovement->curPos.y += walkMovement->vel; + walkMovement->vel -= walkMovement->acceleration; - add_xz_vec3f(&walkMovement->currentPos, walkMovement->speed, walkMovement->angle); + add_xz_vec3f(&walkMovement->curPos, walkMovement->speed, walkMovement->angle); - player->currentPos.x = walkMovement->currentPos.x; - player->currentPos.y = walkMovement->currentPos.y; - player->currentPos.z = walkMovement->currentPos.z; + player->curPos.x = walkMovement->curPos.x; + player->curPos.y = walkMovement->curPos.y; + player->curPos.z = walkMovement->curPos.z; - if (player->currentPos.y < 0.0f) { - player->currentPos.y = 0.0f; + if (player->curPos.y < 0.0f) { + player->curPos.y = 0.0f; - play_movement_dust_effects(2, player->currentPos.x, player->currentPos.y, player->currentPos.z, player->yaw); - sfx_play_sound_at_position(SOUND_SOFT_LAND, SOUND_SPACE_MODE_0, player->currentPos.x, player->currentPos.y, player->currentPos.z); + play_movement_dust_effects(2, player->curPos.x, player->curPos.y, player->curPos.z, player->yaw); + sfx_play_sound_at_position(SOUND_SOFT_LAND, SOUND_SPACE_MODE_0, player->curPos.x, player->curPos.y, player->curPos.z); return ApiStatus_DONE1; } @@ -1353,58 +1353,58 @@ ApiStatus PlayerRunToGoal(Evt* script, s32 isInitialCall) { if (!script->functionTemp[0]) { player->state.moveTime = evt_get_variable(script, *args++); - player->state.currentPos.x = player->currentPos.x; - player->state.currentPos.y = player->currentPos.y; - player->state.currentPos.z = player->currentPos.z; + player->state.curPos.x = player->curPos.x; + player->state.curPos.y = player->curPos.y; + player->state.curPos.z = player->curPos.z; goalX = player->state.goalPos.x; goalZ = player->state.goalPos.z; - currentX = player->state.currentPos.x; - currentZ = player->state.currentPos.z; + currentX = player->state.curPos.x; + currentZ = player->state.curPos.z; player->state.angle = atan2(currentX, currentZ, goalX, goalZ); - player->state.distance = dist2D(currentX, currentZ, goalX, goalZ); + player->state.dist = dist2D(currentX, currentZ, goalX, goalZ); if (player->state.moveTime == 0) { - player->state.moveTime = player->state.distance / player->state.speed; + player->state.moveTime = player->state.dist / player->state.speed; if (player->state.moveTime == 0) { player->state.moveTime = 1; } - player->state.speed += (player->state.distance - (player->state.moveTime * player->state.speed)) / player->state.moveTime; + player->state.speed += (player->state.dist - (player->state.moveTime * player->state.speed)) / player->state.moveTime; } else { - player->state.speed = player->state.distance / player->state.moveTime; + player->state.speed = player->state.dist / player->state.moveTime; } - playerState->distance = player->actorTypeData1b[0] + 1; + playerState->dist = player->actorTypeData1b[0] + 1; script->functionTemp[0] = TRUE; } - add_xz_vec3f(&playerState->currentPos, playerState->speed, playerState->angle); + add_xz_vec3f(&playerState->curPos, playerState->speed, playerState->angle); - player->currentPos.x = playerState->currentPos.x; - player->currentPos.y = playerState->currentPos.y; - player->currentPos.z = playerState->currentPos.z; + player->curPos.x = playerState->curPos.x; + player->curPos.y = playerState->curPos.y; + player->curPos.z = playerState->curPos.z; if (playerState->speed < 4.0f) { - play_movement_dust_effects(0, player->currentPos.x, player->currentPos.y, player->currentPos.z, player->yaw); + play_movement_dust_effects(0, player->curPos.x, player->curPos.y, player->curPos.z, player->yaw); } else { - play_movement_dust_effects(1, player->currentPos.x, player->currentPos.y, player->currentPos.z, player->yaw); + play_movement_dust_effects(1, player->curPos.x, player->curPos.y, player->curPos.z, player->yaw); } - playerState->distance += playerState->speed; - if (playerState->distance > player->actorTypeData1b[0]) { + playerState->dist += playerState->speed; + if (playerState->dist > player->actorTypeData1b[0]) { player->footStepCounter++; - playerState->distance = 0.0f; + playerState->dist = 0.0f; if ((player->footStepCounter % 2) != 0) { - sfx_play_sound_at_position(SOUND_STEP_NORMAL1, SOUND_SPACE_MODE_0, player->currentPos.x, player->currentPos.y, player->currentPos.z); + sfx_play_sound_at_position(SOUND_STEP_NORMAL1, SOUND_SPACE_MODE_0, player->curPos.x, player->curPos.y, player->curPos.z); } else { - sfx_play_sound_at_position(SOUND_STEP_NORMAL2, SOUND_SPACE_MODE_0, player->currentPos.x, player->currentPos.y, player->currentPos.z); + sfx_play_sound_at_position(SOUND_STEP_NORMAL2, SOUND_SPACE_MODE_0, player->curPos.x, player->curPos.y, player->curPos.z); } } playerState->moveTime--; if (playerState->moveTime <= 0) { - player->currentPos.x = playerState->goalPos.x; - player->currentPos.z = playerState->goalPos.z; + player->curPos.x = playerState->goalPos.x; + player->curPos.z = playerState->goalPos.z; return ApiStatus_DONE2; } return ApiStatus_BLOCK; @@ -1424,24 +1424,24 @@ ApiStatus CancelablePlayerRunToGoal(Evt* script, s32 isInitialCall) { if (!script->functionTemp[0]) { player->state.moveTime = evt_get_variable(script, *args++); script->functionTemp[1] = *args++; - player->state.currentPos.x = player->currentPos.x; - player->state.currentPos.y = player->currentPos.y; - player->state.currentPos.z = player->currentPos.z; + player->state.curPos.x = player->curPos.x; + player->state.curPos.y = player->curPos.y; + player->state.curPos.z = player->curPos.z; goalX = player->state.goalPos.x; goalZ = player->state.goalPos.z; - currentX = player->state.currentPos.x; - currentZ = player->state.currentPos.z; + currentX = player->state.curPos.x; + currentZ = player->state.curPos.z; player->state.angle = atan2(currentX, currentZ, goalX, goalZ); - player->state.distance = dist2D(currentX, currentZ, goalX, goalZ); + player->state.dist = dist2D(currentX, currentZ, goalX, goalZ); if (player->state.moveTime == 0) { - player->state.moveTime = player->state.distance / player->state.speed; - player->state.speed += (player->state.distance - (player->state.moveTime * player->state.speed)) / player->state.moveTime; + player->state.moveTime = player->state.dist / player->state.speed; + player->state.speed += (player->state.dist - (player->state.moveTime * player->state.speed)) / player->state.moveTime; } else { - player->state.speed = player->state.distance / player->state.moveTime; + player->state.speed = player->state.dist / player->state.moveTime; } - playerState->distance = player->actorTypeData1b[0] + 1; + playerState->dist = player->actorTypeData1b[0] + 1; if (playerState->moveTime == 0) { return ApiStatus_DONE2; @@ -1452,38 +1452,38 @@ ApiStatus CancelablePlayerRunToGoal(Evt* script, s32 isInitialCall) { script->functionTemp[0] = TRUE; } - add_xz_vec3f(&playerState->currentPos, playerState->speed, playerState->angle); + add_xz_vec3f(&playerState->curPos, playerState->speed, playerState->angle); - player->currentPos.x = playerState->currentPos.x; - player->currentPos.y = playerState->currentPos.y; - player->currentPos.z = playerState->currentPos.z; + player->curPos.x = playerState->curPos.x; + player->curPos.y = playerState->curPos.y; + player->curPos.z = playerState->curPos.z; if (playerState->speed < 4.0f) { - play_movement_dust_effects(0, player->currentPos.x, player->currentPos.y, player->currentPos.z, player->yaw); + play_movement_dust_effects(0, player->curPos.x, player->curPos.y, player->curPos.z, player->yaw); } else { - play_movement_dust_effects(1, player->currentPos.x, player->currentPos.y, player->currentPos.z, player->yaw); + play_movement_dust_effects(1, player->curPos.x, player->curPos.y, player->curPos.z, player->yaw); } - playerState->distance += playerState->speed; - if (playerState->distance > player->actorTypeData1b[0]) { + playerState->dist += playerState->speed; + if (playerState->dist > player->actorTypeData1b[0]) { player->footStepCounter++; - playerState->distance = 0.0f; + playerState->dist = 0.0f; if ((player->footStepCounter % 2) != 0) { - sfx_play_sound_at_position(SOUND_STEP_NORMAL1, SOUND_SPACE_MODE_0, player->currentPos.x, player->currentPos.y, player->currentPos.z); + sfx_play_sound_at_position(SOUND_STEP_NORMAL1, SOUND_SPACE_MODE_0, player->curPos.x, player->curPos.y, player->curPos.z); } else { - sfx_play_sound_at_position(SOUND_STEP_NORMAL2, SOUND_SPACE_MODE_0, player->currentPos.x, player->currentPos.y, player->currentPos.z); + sfx_play_sound_at_position(SOUND_STEP_NORMAL2, SOUND_SPACE_MODE_0, player->curPos.x, player->curPos.y, player->curPos.z); } } if (script->functionTemp[3] > 12) { if (!script->functionTemp[2]) { - if (!(battleStatus->currentButtonsDown & BUTTON_A)) { + if (!(battleStatus->curButtonsDown & BUTTON_A)) { script->functionTemp[2] = TRUE; } } if (script->functionTemp[2]) { - if (battleStatus->currentButtonsPressed & BUTTON_A) { + if (battleStatus->curButtonsPressed & BUTTON_A) { evt_set_variable(script, script->functionTemp[1], 1); return ApiStatus_DONE2; } @@ -1497,8 +1497,8 @@ ApiStatus CancelablePlayerRunToGoal(Evt* script, s32 isInitialCall) { return ApiStatus_BLOCK; } - player->currentPos.x = playerState->goalPos.x; - player->currentPos.z = playerState->goalPos.z; + player->curPos.x = playerState->goalPos.x; + player->curPos.z = playerState->goalPos.z; evt_set_variable(script, script->functionTemp[1], 0); return ApiStatus_DONE2; } @@ -1516,10 +1516,10 @@ ApiStatus PlayerDamageEnemy(Evt* script, s32 isInitialCall) { Actor* target; HitResult hitResult; - battleStatus->currentAttackElement = *args++; - battleStatus->currentAttackEventSuppression = *args++; - battleStatus->currentAttackStatus = *args++; - battleStatus->currentAttackDamage = evt_get_variable(script, *args++); + battleStatus->curAttackElement = *args++; + battleStatus->curAttackEventSuppression = *args++; + battleStatus->curAttackStatus = *args++; + battleStatus->curAttackDamage = evt_get_variable(script, *args++); battleStatus->powerBounceCounter = 0; flags = *args++; @@ -1559,13 +1559,13 @@ ApiStatus PlayerDamageEnemy(Evt* script, s32 isInitialCall) { } target = get_actor(script->owner1.actorID); - battleStatus->currentTargetID = target->targetActorID; - battleStatus->currentTargetPart = target->targetPartIndex; - battleStatus->statusChance = battleStatus->currentAttackStatus; + battleStatus->curTargetID = target->targetActorID; + battleStatus->curTargetPart = target->targetPartIndex; + battleStatus->statusChance = battleStatus->curAttackStatus; if (battleStatus->statusChance == STATUS_KEY_NEVER) { battleStatus->statusChance = 0; } - battleStatus->statusDuration = (battleStatus->currentAttackStatus & 0xF00) >> 8; + battleStatus->statusDuration = (battleStatus->curAttackStatus & 0xF00) >> 8; hitResult = calc_player_damage_enemy(); if (hitResult < 0) { @@ -1588,10 +1588,10 @@ ApiStatus PlayerPowerBounceEnemy(Evt* script, s32 isInitialCall) { Actor* target; HitResult hitResult; - battleStatus->currentAttackElement = *args++; - battleStatus->currentAttackEventSuppression = *args++; - battleStatus->currentAttackStatus = *args++; - battleStatus->currentAttackDamage = evt_get_variable(script, *args++); + battleStatus->curAttackElement = *args++; + battleStatus->curAttackEventSuppression = *args++; + battleStatus->curAttackStatus = *args++; + battleStatus->curAttackDamage = evt_get_variable(script, *args++); battleStatus->powerBounceCounter = evt_get_variable(script, *args++); flags = *args++; @@ -1630,13 +1630,13 @@ ApiStatus PlayerPowerBounceEnemy(Evt* script, s32 isInitialCall) { } target = get_actor(script->owner1.actorID); - battleStatus->currentTargetID = target->targetActorID; - battleStatus->currentTargetPart = target->targetPartIndex; - battleStatus->statusChance = battleStatus->currentAttackStatus; + battleStatus->curTargetID = target->targetActorID; + battleStatus->curTargetPart = target->targetPartIndex; + battleStatus->statusChance = battleStatus->curAttackStatus; if (battleStatus->statusChance == STATUS_KEY_NEVER) { battleStatus->statusChance = 0; } - battleStatus->statusDuration = (battleStatus->currentAttackStatus & 0xF00) >> 8; + battleStatus->statusDuration = (battleStatus->curAttackStatus & 0xF00) >> 8; hitResult = calc_player_damage_enemy(); if (hitResult < 0) { @@ -1659,10 +1659,10 @@ ApiStatus PlayerTestEnemy(Evt* script, s32 isInitialCall) { Actor* target; HitResult hitResult; - battleStatus->currentAttackElement = *args++; - battleStatus->currentAttackEventSuppression = *args++; - battleStatus->currentAttackStatus = *args++; - battleStatus->currentAttackDamage = evt_get_variable(script, *args++); + battleStatus->curAttackElement = *args++; + battleStatus->curAttackEventSuppression = *args++; + battleStatus->curAttackStatus = *args++; + battleStatus->curAttackDamage = evt_get_variable(script, *args++); battleStatus->powerBounceCounter = 0; flags = *args++; @@ -1701,13 +1701,13 @@ ApiStatus PlayerTestEnemy(Evt* script, s32 isInitialCall) { } target = get_actor(script->owner1.actorID); - battleStatus->currentTargetID = target->targetActorID; - battleStatus->currentTargetPart = target->targetPartIndex; - battleStatus->statusChance = battleStatus->currentAttackStatus; + battleStatus->curTargetID = target->targetActorID; + battleStatus->curTargetPart = target->targetPartIndex; + battleStatus->statusChance = battleStatus->curAttackStatus; if (battleStatus->statusChance == STATUS_KEY_NEVER) { battleStatus->statusChance = 0; } - battleStatus->statusDuration = (battleStatus->currentAttackStatus & 0xF00) >> 8; + battleStatus->statusDuration = (battleStatus->curAttackStatus & 0xF00) >> 8; hitResult = calc_player_test_enemy(); if (hitResult < 0) { @@ -1781,36 +1781,36 @@ ApiStatus func_80274A18(Evt* script, s32 isInitialCall) { } if (script->functionTemp[0] == 0) { - playerState->currentPos.x = player->currentPos.x; - playerState->currentPos.y = player->currentPos.y; - playerState->currentPos.z = player->currentPos.z; + playerState->curPos.x = player->curPos.x; + playerState->curPos.y = player->curPos.y; + playerState->curPos.z = player->curPos.z; goalX = playerState->goalPos.x; goalZ = playerState->goalPos.z; - posX = playerState->currentPos.x; - posY = playerState->currentPos.y; - posZ = playerState->currentPos.z; + posX = playerState->curPos.x; + posY = playerState->curPos.y; + posZ = playerState->curPos.z; playerState->angle = atan2(posX, posZ, goalX, goalZ); - playerState->distance = dist2D(posX, posZ, goalX, goalZ); + playerState->dist = dist2D(posX, posZ, goalX, goalZ); if (playerState->moveTime == 0) { - playerState->moveTime = playerState->distance / playerState->speed; - temp = playerState->distance - (playerState->moveTime * playerState->speed); + playerState->moveTime = playerState->dist / playerState->speed; + temp = playerState->dist - (playerState->moveTime * playerState->speed); } else { - playerState->speed = playerState->distance / playerState->moveTime; - temp = playerState->distance - (playerState->moveTime * playerState->speed); + playerState->speed = playerState->dist / playerState->moveTime; + temp = playerState->dist - (playerState->moveTime * playerState->speed); } if (playerState->moveTime == 0) { return ApiStatus_DONE2; } - playerState->unk_30.x = (playerState->goalPos.x - playerState->currentPos.x) / playerState->moveTime; - playerState->unk_30.y = (playerState->goalPos.y - playerState->currentPos.y) / playerState->moveTime; - playerState->unk_30.z = (playerState->goalPos.z - playerState->currentPos.z) / playerState->moveTime; + playerState->unk_30.x = (playerState->goalPos.x - playerState->curPos.x) / playerState->moveTime; + playerState->unk_30.y = (playerState->goalPos.y - playerState->curPos.y) / playerState->moveTime; + playerState->unk_30.z = (playerState->goalPos.z - playerState->curPos.z) / playerState->moveTime; playerState->acceleration = PI_S / playerState->moveTime; - playerState->velocity = 0.0f; + playerState->vel = 0.0f; playerState->speed += temp / playerState->moveTime; if (playerState->moveArcAmplitude < 3) { - temp = playerState->distance; + temp = playerState->dist; temp -= 20.0; temp /= 6.0; temp += 47.0; @@ -1822,11 +1822,11 @@ ApiStatus func_80274A18(Evt* script, s32 isInitialCall) { } playerState->unk_18.x = 0.0f; playerState->unk_18.y = 0.0f; - vel1 = playerState->velocity; + vel1 = playerState->vel; acc1 = playerState->acceleration; - playerState->velocity = vel1 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.53 * acc1) + acc1); + playerState->vel = vel1 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.53 * acc1) + acc1); } else { - temp = playerState->distance; + temp = playerState->dist; temp -= 20.0; temp /= 6.0; temp += 47.0; @@ -1838,47 +1838,47 @@ ApiStatus func_80274A18(Evt* script, s32 isInitialCall) { } playerState->unk_18.x = 0.0f; playerState->unk_18.y = 0.0f; - vel2 = playerState->velocity; + vel2 = playerState->vel; acc2 = playerState->acceleration; - playerState->velocity = vel2 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.8 * acc2) + acc2); + playerState->vel = vel2 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.8 * acc2) + acc2); } set_animation(0, 0, playerState->animJumpRise); - sfx_play_sound_at_position(SOUND_160, SOUND_SPACE_MODE_0, player->currentPos.x, player->currentPos.y, player->currentPos.z); + sfx_play_sound_at_position(SOUND_160, SOUND_SPACE_MODE_0, player->curPos.x, player->curPos.y, player->curPos.z); script->functionTemp[0] = 1; } switch (script->functionTemp[0]) { case 1: - if (playerState->velocity > PI_S / 2) { + if (playerState->vel > PI_S / 2) { set_animation(ACTOR_PLAYER, 0, playerState->animJumpFall); } - playerState->currentPos.x += playerState->unk_30.x; - playerState->currentPos.y += playerState->unk_30.y; - playerState->currentPos.z += playerState->unk_30.z; - playerState->unk_18.x = player->currentPos.y; - player->currentPos.x = playerState->currentPos.x; - player->currentPos.y = playerState->currentPos.y + (playerState->bounceDivisor * sin_rad(playerState->velocity)); - player->currentPos.z = playerState->currentPos.z; - if (playerState->goalPos.y > player->currentPos.y && playerState->moveTime < 3) { - player->currentPos.y = playerState->goalPos.y; - } - playerState->unk_18.y = player->currentPos.y; + playerState->curPos.x += playerState->unk_30.x; + playerState->curPos.y += playerState->unk_30.y; + playerState->curPos.z += playerState->unk_30.z; + playerState->unk_18.x = player->curPos.y; + player->curPos.x = playerState->curPos.x; + player->curPos.y = playerState->curPos.y + (playerState->bounceDivisor * sin_rad(playerState->vel)); + player->curPos.z = playerState->curPos.z; + if (playerState->goalPos.y > player->curPos.y && playerState->moveTime < 3) { + player->curPos.y = playerState->goalPos.y; + } + playerState->unk_18.y = player->curPos.y; if (playerState->moveArcAmplitude < 3) { - vel3 = playerState->velocity; + vel3 = playerState->vel; acc3 = playerState->acceleration; - playerState->velocity = vel3 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.53 * acc3) + acc3); + playerState->vel = vel3 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.53 * acc3) + acc3); } else { - vel4 = playerState->velocity; + vel4 = playerState->vel; acc4 = playerState->acceleration; - playerState->velocity = vel4 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.8 * acc4) + acc4); + playerState->vel = vel4 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.8 * acc4) + acc4); } playerState->unk_24 += playerState->unk_28; playerState->unk_24 = clamp_angle(playerState->unk_24); playerState->moveTime--; if (playerState->moveTime == 0) { - player->currentPos.y = playerState->goalPos.y; + player->curPos.y = playerState->goalPos.y; playerState->acceleration = 1.8f; - playerState->velocity = -(playerState->unk_18.x - playerState->unk_18.y); + playerState->vel = -(playerState->unk_18.x - playerState->unk_18.y); set_animation(ACTOR_PLAYER, 0, playerState->animJumpLand); return ApiStatus_DONE1; } @@ -1890,23 +1890,23 @@ ApiStatus func_80274A18(Evt* script, s32 isInitialCall) { playerState->moveTime = 1; playerState->acceleration = 1.8f; playerState->unk_24 = 90.0f; - playerState->velocity = -(playerState->unk_18.x - playerState->unk_18.y); + playerState->vel = -(playerState->unk_18.x - playerState->unk_18.y); playerState->bounceDivisor = fabsf(playerState->unk_18.x - playerState->unk_18.y) / 16.5; playerState->unk_28 = 360 / playerState->moveTime; - playerState->currentPos.x = player->currentPos.x; - playerState->currentPos.y = player->currentPos.y; - playerState->currentPos.z = player->currentPos.z; + playerState->curPos.x = player->curPos.x; + playerState->curPos.y = player->curPos.y; + playerState->curPos.z = player->curPos.z; script->functionTemp[0] = 3; // fallthrough case 3: - temp_f20_2 = playerState->currentPos.x; - playerState->currentPos.x = temp_f20_2 + ((playerState->bounceDivisor * sin_rad(DEG_TO_RAD(playerState->unk_24))) / 33.0); - playerState->currentPos.y -= (playerState->bounceDivisor * sin_rad(DEG_TO_RAD(playerState->unk_24))); + temp_f20_2 = playerState->curPos.x; + playerState->curPos.x = temp_f20_2 + ((playerState->bounceDivisor * sin_rad(DEG_TO_RAD(playerState->unk_24))) / 33.0); + playerState->curPos.y -= (playerState->bounceDivisor * sin_rad(DEG_TO_RAD(playerState->unk_24))); playerState->unk_24 += playerState->unk_28; playerState->unk_24 = clamp_angle(playerState->unk_24); - player->currentPos.x = playerState->currentPos.x; - player->currentPos.y = playerState->currentPos.y; - player->currentPos.z = playerState->currentPos.z; + player->curPos.x = playerState->curPos.x; + player->curPos.y = playerState->curPos.y; + player->curPos.z = playerState->curPos.z; if (gBattleStatus.flags1 & BS_FLAGS1_2000) { return ApiStatus_DONE2; } @@ -1954,37 +1954,37 @@ ApiStatus func_802752AC(Evt* script, s32 isInitialCall) { switch (script->functionTemp[0]) { case 0: - playerState->currentPos.x = player->currentPos.x; - playerState->currentPos.y = player->currentPos.y; - playerState->currentPos.z = player->currentPos.z; + playerState->curPos.x = player->curPos.x; + playerState->curPos.y = player->curPos.y; + playerState->curPos.z = player->curPos.z; goalX = playerState->goalPos.x; goalZ = playerState->goalPos.z; - posX = playerState->currentPos.x; - posY = playerState->currentPos.y; - posZ = playerState->currentPos.z; + posX = playerState->curPos.x; + posY = playerState->curPos.y; + posZ = playerState->curPos.z; playerState->angle = atan2(posX, posZ, goalX, goalZ); - playerState->distance = dist2D(posX, posZ, goalX, goalZ); + playerState->dist = dist2D(posX, posZ, goalX, goalZ); if (playerState->moveTime == 0) { - playerState->moveTime = playerState->distance / playerState->speed; - temp = playerState->distance - (playerState->moveTime * playerState->speed); + playerState->moveTime = playerState->dist / playerState->speed; + temp = playerState->dist - (playerState->moveTime * playerState->speed); } else { - playerState->speed = playerState->distance / playerState->moveTime; - temp = playerState->distance - (playerState->moveTime * playerState->speed); + playerState->speed = playerState->dist / playerState->moveTime; + temp = playerState->dist - (playerState->moveTime * playerState->speed); } if (playerState->moveTime == 0) { return ApiStatus_DONE2; } - playerState->unk_30.x = (playerState->goalPos.x - playerState->currentPos.x) / playerState->moveTime; - playerState->unk_30.y = (playerState->goalPos.y - playerState->currentPos.y) / playerState->moveTime; - playerState->unk_30.z = (playerState->goalPos.z - playerState->currentPos.z) / playerState->moveTime; + playerState->unk_30.x = (playerState->goalPos.x - playerState->curPos.x) / playerState->moveTime; + playerState->unk_30.y = (playerState->goalPos.y - playerState->curPos.y) / playerState->moveTime; + playerState->unk_30.z = (playerState->goalPos.z - playerState->curPos.z) / playerState->moveTime; playerState->acceleration = (PI_S / 2) / playerState->moveTime; - playerState->velocity = 0.0f; + playerState->vel = 0.0f; playerState->speed += temp / playerState->moveTime; set_animation(ACTOR_PLAYER, 0, playerState->animJumpRise); - sfx_play_sound_at_position(SOUND_160, SOUND_SPACE_MODE_0, player->currentPos.x, player->currentPos.y, player->currentPos.z); + sfx_play_sound_at_position(SOUND_160, SOUND_SPACE_MODE_0, player->curPos.x, player->curPos.y, player->curPos.z); playerState->unk_24 = 90.0f; playerState->bounceDivisor = 45.0f; playerState->unk_28 = 360 / playerState->moveTime; @@ -1994,42 +1994,42 @@ ApiStatus func_802752AC(Evt* script, s32 isInitialCall) { playerState->unk_18.x = 0.0f; playerState->unk_18.y = 0.0f; if (playerState->moveArcAmplitude == 0) { - vel1 = playerState->velocity; + vel1 = playerState->vel; acc1 = playerState->acceleration; - playerState->velocity = (vel1 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.53 * acc1) + acc1)); + playerState->vel = (vel1 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.53 * acc1) + acc1)); } else { - vel2 = playerState->velocity; + vel2 = playerState->vel; acc2 = playerState->acceleration; - playerState->velocity = (vel2 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.01 * acc2) + acc2)); + playerState->vel = (vel2 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.01 * acc2) + acc2)); } script->functionTemp[0] = 1; break; case 10: - playerState->currentPos.x = player->currentPos.x; - playerState->currentPos.y = player->currentPos.y; - playerState->currentPos.z = player->currentPos.z; + playerState->curPos.x = player->curPos.x; + playerState->curPos.y = player->curPos.y; + playerState->curPos.z = player->curPos.z; goalX = playerState->goalPos.x; goalZ = playerState->goalPos.z; - posX = playerState->currentPos.x; - posY = playerState->currentPos.y; - posZ = playerState->currentPos.z; + posX = playerState->curPos.x; + posY = playerState->curPos.y; + posZ = playerState->curPos.z; playerState->angle = atan2(posX, posZ, goalX, goalZ); - playerState->distance = dist2D(posX, posZ, goalX, goalZ); + playerState->dist = dist2D(posX, posZ, goalX, goalZ); if (playerState->moveTime == 0) { - playerState->moveTime = playerState->distance / playerState->speed; - temp = playerState->distance - (playerState->moveTime * playerState->speed); + playerState->moveTime = playerState->dist / playerState->speed; + temp = playerState->dist - (playerState->moveTime * playerState->speed); } else { - playerState->speed = playerState->distance / playerState->moveTime; - temp = playerState->distance - (playerState->moveTime * playerState->speed); + playerState->speed = playerState->dist / playerState->moveTime; + temp = playerState->dist - (playerState->moveTime * playerState->speed); } if (playerState->moveTime == 0) { return ApiStatus_DONE2; } - playerState->unk_30.x = (playerState->goalPos.x - playerState->currentPos.x) / playerState->moveTime; - playerState->unk_30.y = (playerState->goalPos.y - playerState->currentPos.y) / playerState->moveTime; - playerState->unk_30.z = (playerState->goalPos.z - playerState->currentPos.z) / playerState->moveTime; - playerState->velocity = (PI_S / 2); + playerState->unk_30.x = (playerState->goalPos.x - playerState->curPos.x) / playerState->moveTime; + playerState->unk_30.y = (playerState->goalPos.y - playerState->curPos.y) / playerState->moveTime; + playerState->unk_30.z = (playerState->goalPos.z - playerState->curPos.z) / playerState->moveTime; + playerState->vel = (PI_S / 2); playerState->acceleration = (PI_S / 4) / (playerState->moveTime + 1); playerState->speed += temp / playerState->moveTime; set_animation(ACTOR_PLAYER, 0, playerState->animJumpLand); @@ -2042,15 +2042,15 @@ ApiStatus func_802752AC(Evt* script, s32 isInitialCall) { playerState->unk_18.x = 0.0f; playerState->unk_18.y = 0.0f; if (playerState->moveArcAmplitude == 1) { - vel3 = playerState->velocity; + vel3 = playerState->vel; acc3 = playerState->acceleration; - playerState->velocity = (vel3 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.53 * acc3) + acc3)); + playerState->vel = (vel3 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.53 * acc3) + acc3)); } else { - vel4 = playerState->velocity; + vel4 = playerState->vel; acc4 = playerState->acceleration; - playerState->velocity = (vel4 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.01 * acc4) + acc4)); + playerState->vel = (vel4 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.01 * acc4) + acc4)); } - playerState->currentPos.y = player->currentPos.y - playerState->bounceDivisor; + playerState->curPos.y = player->curPos.y - playerState->bounceDivisor; script->functionTemp[0] = 11; break; case 20: @@ -2058,9 +2058,9 @@ ApiStatus func_802752AC(Evt* script, s32 isInitialCall) { playerState->unk_24 = 90.0f; playerState->bounceDivisor = (fabsf(playerState->unk_18.x - playerState->unk_18.y) / 16.5); playerState->unk_28 = (360 / playerState->moveTime); - playerState->currentPos.x = player->currentPos.x; - playerState->currentPos.y = player->currentPos.y; - playerState->currentPos.z = player->currentPos.z; + playerState->curPos.x = player->curPos.x; + playerState->curPos.y = player->curPos.y; + playerState->curPos.z = player->curPos.z; script->functionTemp[0] = 21; break; } @@ -2068,87 +2068,87 @@ ApiStatus func_802752AC(Evt* script, s32 isInitialCall) { switch (script->functionTemp[0]) { case 1: if (playerState->moveArcAmplitude == 0) { - vel5 = playerState->velocity; + vel5 = playerState->vel; acc5 = playerState->acceleration; - playerState->velocity = (vel5 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.53 * acc5) + acc5)); + playerState->vel = (vel5 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.53 * acc5) + acc5)); } else { - vel6 = playerState->velocity; + vel6 = playerState->vel; acc6 = playerState->acceleration; - playerState->velocity = (vel6 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.01 * acc6) + acc6)); - } - playerState->currentPos.x += playerState->unk_30.x; - playerState->currentPos.y += playerState->unk_30.y; - playerState->currentPos.z += playerState->unk_30.z; - playerState->unk_18.x = player->currentPos.y; - player->currentPos.x = playerState->currentPos.x; - player->currentPos.y = playerState->currentPos.y + (playerState->bounceDivisor * sin_rad(sin_rad(sin_rad(playerState->velocity) * (PI_S / 2)) * (PI_S / 2))); - player->currentPos.z = playerState->currentPos.z; - playerState->unk_18.y = player->currentPos.y; + playerState->vel = (vel6 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.01 * acc6) + acc6)); + } + playerState->curPos.x += playerState->unk_30.x; + playerState->curPos.y += playerState->unk_30.y; + playerState->curPos.z += playerState->unk_30.z; + playerState->unk_18.x = player->curPos.y; + player->curPos.x = playerState->curPos.x; + player->curPos.y = playerState->curPos.y + (playerState->bounceDivisor * sin_rad(sin_rad(sin_rad(playerState->vel) * (PI_S / 2)) * (PI_S / 2))); + player->curPos.z = playerState->curPos.z; + playerState->unk_18.y = player->curPos.y; playerState->unk_24 += playerState->unk_28; playerState->unk_24 = clamp_angle(playerState->unk_24); playerState->moveTime--; if (playerState->moveTime == 0) { - sfx_play_sound_at_position(SOUND_160, SOUND_SPACE_MODE_0, player->currentPos.x, player->currentPos.y, player->currentPos.z); + sfx_play_sound_at_position(SOUND_160, SOUND_SPACE_MODE_0, player->curPos.x, player->curPos.y, player->curPos.z); set_animation(ACTOR_PLAYER, 0, playerState->animJumpFall); - player->rotationPivotOffset.y = 14; - player->rotation.z -= 66.0f; + player->rotPivotOffset.y = 14; + player->rot.z -= 66.0f; playerState->moveTime = 7; script->functionTemp[0] = 2; } break; case 2: - player->rotationPivotOffset.y = 14; - player->rotation.z -= 66.0f; + player->rotPivotOffset.y = 14; + player->rot.z -= 66.0f; playerState->moveTime--; if (playerState->moveTime == 0) { - player->rotation.z = 0.0f; - player->rotationPivotOffset.y = 0; + player->rot.z = 0.0f; + player->rotPivotOffset.y = 0; set_animation(ACTOR_PLAYER, 0, playerState->animJumpLand); return ApiStatus_DONE1; } break; case 11: - playerState->currentPos.x += playerState->unk_30.x; - playerState->currentPos.y += playerState->unk_30.y; - playerState->currentPos.z += playerState->unk_30.z; - playerState->unk_18.x = player->currentPos.y; - player->currentPos.x = playerState->currentPos.x; - player->currentPos.y = playerState->currentPos.y + (playerState->bounceDivisor * sin_rad(playerState->velocity)); - player->currentPos.z = playerState->currentPos.z; - if (playerState->goalPos.y > player->currentPos.y) { - player->currentPos.y = playerState->goalPos.y; - } - playerState->unk_18.y = player->currentPos.y; + playerState->curPos.x += playerState->unk_30.x; + playerState->curPos.y += playerState->unk_30.y; + playerState->curPos.z += playerState->unk_30.z; + playerState->unk_18.x = player->curPos.y; + player->curPos.x = playerState->curPos.x; + player->curPos.y = playerState->curPos.y + (playerState->bounceDivisor * sin_rad(playerState->vel)); + player->curPos.z = playerState->curPos.z; + if (playerState->goalPos.y > player->curPos.y) { + player->curPos.y = playerState->goalPos.y; + } + playerState->unk_18.y = player->curPos.y; if (playerState->moveArcAmplitude == 1) { - vel7 = playerState->velocity; + vel7 = playerState->vel; acc7 = playerState->acceleration; - playerState->velocity = (vel7 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.53 * acc7) + acc7)); + playerState->vel = (vel7 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.53 * acc7) + acc7)); } else { - vel8 = playerState->velocity; + vel8 = playerState->vel; acc8 = playerState->acceleration; - playerState->velocity = (vel8 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.01 * acc8) + acc8)); + playerState->vel = (vel8 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.01 * acc8) + acc8)); } playerState->unk_24 += playerState->unk_28; playerState->unk_24 = clamp_angle(playerState->unk_24); playerState->moveTime--; if (playerState->moveTime == 0) { - player->currentPos.y = playerState->goalPos.y; + player->curPos.y = playerState->goalPos.y; set_animation(ACTOR_PLAYER, 0, 0x1000C); return ApiStatus_DONE1; } break; case 21: - temp_f20 = playerState->currentPos.x; + temp_f20 = playerState->curPos.x; temp_f20 += (playerState->bounceDivisor * sin_rad(DEG_TO_RAD(playerState->unk_24))) / 33.0; - playerState->currentPos.x = temp_f20; - playerState->currentPos.y -= playerState->bounceDivisor * sin_rad(DEG_TO_RAD(playerState->unk_24)); + playerState->curPos.x = temp_f20; + playerState->curPos.y -= playerState->bounceDivisor * sin_rad(DEG_TO_RAD(playerState->unk_24)); playerState->unk_24 += playerState->unk_28; playerState->unk_24 = clamp_angle(playerState->unk_24); - player->currentPos.x = playerState->currentPos.x; - player->currentPos.y = playerState->currentPos.y; - player->currentPos.z = playerState->currentPos.z; + player->curPos.x = playerState->curPos.x; + player->curPos.y = playerState->curPos.y; + player->curPos.z = playerState->curPos.z; if (gBattleStatus.flags1 & BS_FLAGS1_2000) { return ApiStatus_DONE2; } @@ -2204,130 +2204,130 @@ ApiStatus func_80275F00(Evt* script, s32 isInitialCall) { switch (script->functionTemp[0]) { case 0: - playerState->currentPos.x = player->currentPos.x; - playerState->currentPos.y = player->currentPos.y; - playerState->currentPos.z = player->currentPos.z; + playerState->curPos.x = player->curPos.x; + playerState->curPos.y = player->curPos.y; + playerState->curPos.z = player->curPos.z; goalX = playerState->goalPos.x; goalZ = playerState->goalPos.z; - posX = playerState->currentPos.x; - posY = playerState->currentPos.y; - posZ = playerState->currentPos.z; + posX = playerState->curPos.x; + posY = playerState->curPos.y; + posZ = playerState->curPos.z; playerState->angle = atan2(posX, posZ, goalX, goalZ); - playerState->distance = dist2D(posX, posZ, goalX, goalZ); + playerState->dist = dist2D(posX, posZ, goalX, goalZ); if (playerState->moveTime == 0) { - playerState->moveTime = playerState->distance / playerState->speed; - temp = playerState->distance - (playerState->moveTime * playerState->speed); + playerState->moveTime = playerState->dist / playerState->speed; + temp = playerState->dist - (playerState->moveTime * playerState->speed); } else { - playerState->speed = playerState->distance / playerState->moveTime; - temp = playerState->distance - (playerState->moveTime * playerState->speed); + playerState->speed = playerState->dist / playerState->moveTime; + temp = playerState->dist - (playerState->moveTime * playerState->speed); } playerState->acceleration = PI_S / playerState->moveTime; - playerState->velocity = 0.0f; - playerState->unk_30.x = (playerState->goalPos.x - playerState->currentPos.x) / playerState->moveTime; - playerState->unk_30.y = (playerState->goalPos.y - playerState->currentPos.y) / playerState->moveTime; - playerState->unk_30.z = (playerState->goalPos.z - playerState->currentPos.z) / playerState->moveTime; + playerState->vel = 0.0f; + playerState->unk_30.x = (playerState->goalPos.x - playerState->curPos.x) / playerState->moveTime; + playerState->unk_30.y = (playerState->goalPos.y - playerState->curPos.y) / playerState->moveTime; + playerState->unk_30.z = (playerState->goalPos.z - playerState->curPos.z) / playerState->moveTime; playerState->speed += temp / playerState->moveTime; set_animation(ACTOR_PLAYER, 0, playerState->animJumpFall); - sfx_play_sound_at_position(SOUND_160, SOUND_SPACE_MODE_0, player->currentPos.x, player->currentPos.y, player->currentPos.z); - sfx_play_sound_at_position(SOUND_TORNADO_JUMP, SOUND_SPACE_MODE_0, player->currentPos.x, player->currentPos.y, player->currentPos.z); + sfx_play_sound_at_position(SOUND_160, SOUND_SPACE_MODE_0, player->curPos.x, player->curPos.y, player->curPos.z); + sfx_play_sound_at_position(SOUND_TORNADO_JUMP, SOUND_SPACE_MODE_0, player->curPos.x, player->curPos.y, player->curPos.z); playerState->unk_18.x = 0.0f; playerState->unk_18.y = 0.0f; playerState->unk_24 = 90.0f; - temp = playerState->distance; + temp = playerState->dist; temp -= 20.0; temp /= 6.0; temp += 47.0; playerState->bounceDivisor = temp; - temp_f20 = playerState->velocity; + temp_f20 = playerState->vel; temp_f22 = playerState->acceleration; playerState->unk_28 = 360 / playerState->moveTime; - playerState->velocity = temp_f20 + (((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.53) * temp_f22) + temp_f22); + playerState->vel = temp_f20 + (((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.53) * temp_f22) + temp_f22); script->functionTemp[0] = 1; break; case 10: - playerState->currentPos.x = player->currentPos.x; - playerState->currentPos.y = player->currentPos.y; - playerState->currentPos.z = player->currentPos.z; + playerState->curPos.x = player->curPos.x; + playerState->curPos.y = player->curPos.y; + playerState->curPos.z = player->curPos.z; goalX = playerState->goalPos.x; goalZ = playerState->goalPos.z; - posX = playerState->currentPos.x; - posY = playerState->currentPos.y; - posZ = playerState->currentPos.z; + posX = playerState->curPos.x; + posY = playerState->curPos.y; + posZ = playerState->curPos.z; playerState->angle = atan2(posX, posZ, goalX, goalZ); - playerState->distance = dist2D(posX, posZ, goalX, goalZ); + playerState->dist = dist2D(posX, posZ, goalX, goalZ); if (playerState->moveTime == 0) { - playerState->moveTime = playerState->distance / playerState->speed; - temp = playerState->distance - (playerState->moveTime * playerState->speed); + playerState->moveTime = playerState->dist / playerState->speed; + temp = playerState->dist - (playerState->moveTime * playerState->speed); } else { - speed = playerState->distance / playerState->moveTime; + speed = playerState->dist / playerState->moveTime; playerState->speed = speed; - temp = playerState->distance - (playerState->moveTime * speed); + temp = playerState->dist - (playerState->moveTime * speed); } playerState->acceleration = PI_S / playerState->moveTime; - playerState->velocity = 0.0f; - playerState->unk_30.x = (playerState->goalPos.x - playerState->currentPos.x) / playerState->moveTime; - playerState->unk_30.y = (playerState->goalPos.y - playerState->currentPos.y) / playerState->moveTime; - playerState->unk_30.z = (playerState->goalPos.z - playerState->currentPos.z) / playerState->moveTime; + playerState->vel = 0.0f; + playerState->unk_30.x = (playerState->goalPos.x - playerState->curPos.x) / playerState->moveTime; + playerState->unk_30.y = (playerState->goalPos.y - playerState->curPos.y) / playerState->moveTime; + playerState->unk_30.z = (playerState->goalPos.z - playerState->curPos.z) / playerState->moveTime; playerState->speed += temp / playerState->moveTime; set_animation(ACTOR_PLAYER, 0, playerState->animJumpRise); - sfx_play_sound_at_position(SOUND_160, SOUND_SPACE_MODE_0, player->currentPos.x, player->currentPos.y, player->currentPos.z); - sfx_play_sound_at_position(SOUND_TORNADO_JUMP, SOUND_SPACE_MODE_0, player->currentPos.x, player->currentPos.y, player->currentPos.z); + sfx_play_sound_at_position(SOUND_160, SOUND_SPACE_MODE_0, player->curPos.x, player->curPos.y, player->curPos.z); + sfx_play_sound_at_position(SOUND_TORNADO_JUMP, SOUND_SPACE_MODE_0, player->curPos.x, player->curPos.y, player->curPos.z); playerState->unk_18.x = 0.0f; playerState->unk_18.y = 0.0f; playerState->unk_24 = 90.0f; - temp_f20_2 = playerState->velocity; + temp_f20_2 = playerState->vel; temp_f22_2 = playerState->acceleration; - temp = playerState->distance; + temp = playerState->dist; temp -= 20.0; temp /= 6.0; temp += 47.0; playerState->bounceDivisor = temp; playerState->unk_28 = 360 / playerState->moveTime; - playerState->velocity = temp_f20_2 + (((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.53) * temp_f22_2) + temp_f22_2); + playerState->vel = temp_f20_2 + (((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.53) * temp_f22_2) + temp_f22_2); script->functionTemp[0] = 11; break; case 20: playerState->moveTime = 1; set_animation(ACTOR_PLAYER, 1, 0x1000C); - player->rotation.y = 0.0f; + player->rot.y = 0.0f; playerState->unk_24 = 90.0f; playerState->bounceDivisor = fabsf(playerState->unk_18.x - playerState->unk_18.y) / 16.5; playerState->unk_28 = 360 / playerState->moveTime; - playerState->currentPos.x = player->currentPos.x; - playerState->currentPos.y = player->currentPos.y; - playerState->currentPos.z = player->currentPos.z; + playerState->curPos.x = player->curPos.x; + playerState->curPos.y = player->curPos.y; + playerState->curPos.z = player->curPos.z; script->functionTemp[0] = 21; break; case 30: - playerState->currentPos.x = player->currentPos.x; - playerState->currentPos.y = player->currentPos.y; - playerState->currentPos.z = player->currentPos.z; + playerState->curPos.x = player->curPos.x; + playerState->curPos.y = player->curPos.y; + playerState->curPos.z = player->curPos.z; goalX = playerState->goalPos.x; goalZ = playerState->goalPos.z; - posX = playerState->currentPos.x; - posY = playerState->currentPos.y; - posZ = playerState->currentPos.z; + posX = playerState->curPos.x; + posY = playerState->curPos.y; + posZ = playerState->curPos.z; playerState->angle = atan2(posX, posZ, goalX, goalZ); - playerState->distance = dist2D(posX, posZ, goalX, goalZ); + playerState->dist = dist2D(posX, posZ, goalX, goalZ); if (playerState->moveTime == 0) { - playerState->moveTime = playerState->distance / playerState->speed; - temp = playerState->distance - (playerState->moveTime * playerState->speed); + playerState->moveTime = playerState->dist / playerState->speed; + temp = playerState->dist - (playerState->moveTime * playerState->speed); } else { - playerState->speed = playerState->distance / playerState->moveTime; - temp = playerState->distance - (playerState->moveTime * playerState->speed); + playerState->speed = playerState->dist / playerState->moveTime; + temp = playerState->dist - (playerState->moveTime * playerState->speed); } playerState->acceleration = PI_S / (playerState->moveTime + 1); - playerState->velocity = 0.0f; - playerState->unk_30.x = (playerState->goalPos.x - playerState->currentPos.x) / playerState->moveTime; - playerState->unk_30.y = (playerState->goalPos.y - playerState->currentPos.y) / playerState->moveTime; - playerState->unk_30.z = (playerState->goalPos.z - playerState->currentPos.z) / playerState->moveTime; + playerState->vel = 0.0f; + playerState->unk_30.x = (playerState->goalPos.x - playerState->curPos.x) / playerState->moveTime; + playerState->unk_30.y = (playerState->goalPos.y - playerState->curPos.y) / playerState->moveTime; + playerState->unk_30.z = (playerState->goalPos.z - playerState->curPos.z) / playerState->moveTime; playerState->speed += temp / playerState->moveTime; set_animation(ACTOR_PLAYER, 0, playerState->animJumpRise); - sfx_play_sound_at_position(SOUND_160, SOUND_SPACE_MODE_0, player->currentPos.x, player->currentPos.y, player->currentPos.z); + sfx_play_sound_at_position(SOUND_160, SOUND_SPACE_MODE_0, player->curPos.x, player->curPos.y, player->curPos.z); playerState->unk_24 = 90.0f; playerState->bounceDivisor = 45.0f; playerState->unk_28 = 360 / playerState->moveTime; @@ -2337,30 +2337,30 @@ ApiStatus func_80275F00(Evt* script, s32 isInitialCall) { playerState->unk_18.x = 0.0f; playerState->unk_18.y = 0.0f; temp_f22_3 = playerState->acceleration; - temp_f22_7 = playerState->velocity; + temp_f22_7 = playerState->vel; temp_f22_7 = temp_f22_7 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.53 * temp_f22_3) + temp_f22_3); - playerState->velocity = temp_f22_7; + playerState->vel = temp_f22_7; script->functionTemp[0] = 31; break; } switch (script->functionTemp[0]) { case 1: - temp_f22_4 = playerState->velocity; + temp_f22_4 = playerState->vel; temp_f20_4 = playerState->acceleration; - playerState->velocity = temp_f22_4 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.53 * temp_f20_4) + temp_f20_4); - playerState->currentPos.x += playerState->unk_30.x; - playerState->currentPos.y += playerState->unk_30.y; - playerState->currentPos.z += playerState->unk_30.z; - playerState->unk_18.x = player->currentPos.y; - player->currentPos.x = playerState->currentPos.x; - player->currentPos.y = playerState->currentPos.y + (playerState->bounceDivisor * sin_rad(playerState->velocity)); - player->currentPos.z = playerState->currentPos.z; - playerState->unk_18.y = player->currentPos.y; + playerState->vel = temp_f22_4 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.53 * temp_f20_4) + temp_f20_4); + playerState->curPos.x += playerState->unk_30.x; + playerState->curPos.y += playerState->unk_30.y; + playerState->curPos.z += playerState->unk_30.z; + playerState->unk_18.x = player->curPos.y; + player->curPos.x = playerState->curPos.x; + player->curPos.y = playerState->curPos.y + (playerState->bounceDivisor * sin_rad(playerState->vel)); + player->curPos.z = playerState->curPos.z; + playerState->unk_18.y = player->curPos.y; playerState->unk_24 += playerState->unk_28; playerState->unk_24 = clamp_angle(playerState->unk_24); - player->rotation.y += 133.0f; - player->rotation.y = clamp_angle(player->rotation.y); + player->rot.y += 133.0f; + player->rot.y = clamp_angle(player->rot.y); if (gBattleStatus.flags1 & BS_FLAGS1_2000) { return ApiStatus_DONE2; } @@ -2370,46 +2370,46 @@ ApiStatus func_80275F00(Evt* script, s32 isInitialCall) { } break; case 11: - temp_f22_6 = playerState->velocity; + temp_f22_6 = playerState->vel; temp_f20_7 = playerState->acceleration; - playerState->velocity = temp_f22_6 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.53 * temp_f20_7) + temp_f20_7); - playerState->currentPos.x += playerState->unk_30.x; - playerState->currentPos.y += playerState->unk_30.y; - playerState->currentPos.z += playerState->unk_30.z; - playerState->unk_18.x = player->currentPos.y; - player->currentPos.x = playerState->currentPos.x; - player->currentPos.y = playerState->currentPos.y + (playerState->bounceDivisor * sin_rad(playerState->velocity)); - player->currentPos.z = playerState->currentPos.z; - if (playerState->goalPos.y > player->currentPos.y && playerState->moveTime < 3) { - player->currentPos.y = playerState->goalPos.y; - } - playerState->unk_18.y = player->currentPos.y; + playerState->vel = temp_f22_6 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.53 * temp_f20_7) + temp_f20_7); + playerState->curPos.x += playerState->unk_30.x; + playerState->curPos.y += playerState->unk_30.y; + playerState->curPos.z += playerState->unk_30.z; + playerState->unk_18.x = player->curPos.y; + player->curPos.x = playerState->curPos.x; + player->curPos.y = playerState->curPos.y + (playerState->bounceDivisor * sin_rad(playerState->vel)); + player->curPos.z = playerState->curPos.z; + if (playerState->goalPos.y > player->curPos.y && playerState->moveTime < 3) { + player->curPos.y = playerState->goalPos.y; + } + playerState->unk_18.y = player->curPos.y; playerState->unk_24 += playerState->unk_28; playerState->unk_24 = clamp_angle(playerState->unk_24); set_animation(ACTOR_PLAYER, 0, playerState->animJumpFall); - player->rotation.y += 133.0f; - player->rotation.y = clamp_angle(player->rotation.y); + player->rot.y += 133.0f; + player->rot.y = clamp_angle(player->rot.y); playerState->moveTime--; if (playerState->moveTime == 0) { playerState->acceleration = 1.8f; - playerState->velocity = -(playerState->unk_18.x - playerState->unk_18.y); - player->currentPos.y = playerState->goalPos.y; - player->rotation.y = 0.0f; + playerState->vel = -(playerState->unk_18.x - playerState->unk_18.y); + player->curPos.y = playerState->goalPos.y; + player->rot.y = 0.0f; set_animation(ACTOR_PLAYER, 0, playerState->animJumpLand); - play_movement_dust_effects(2, player->currentPos.x, player->currentPos.y, player->currentPos.z, player->yaw); + play_movement_dust_effects(2, player->curPos.x, player->curPos.y, player->curPos.z, player->yaw); return ApiStatus_DONE1; } break; case 21: - temp_f20_5 = playerState->currentPos.x; + temp_f20_5 = playerState->curPos.x; temp_f20_5 += (playerState->bounceDivisor * sin_rad(DEG_TO_RAD(playerState->unk_24))) / 33.0; - playerState->currentPos.x = temp_f20_5; - playerState->currentPos.y -= playerState->bounceDivisor * sin_rad(DEG_TO_RAD(playerState->unk_24)); + playerState->curPos.x = temp_f20_5; + playerState->curPos.y -= playerState->bounceDivisor * sin_rad(DEG_TO_RAD(playerState->unk_24)); playerState->unk_24 += playerState->unk_28; playerState->unk_24 = clamp_angle(playerState->unk_24); - player->currentPos.x = playerState->currentPos.x; - player->currentPos.y = playerState->currentPos.y; - player->currentPos.z = playerState->currentPos.z; + player->curPos.x = playerState->curPos.x; + player->curPos.y = playerState->curPos.y; + player->curPos.z = playerState->curPos.z; if (gBattleStatus.flags1 & BS_FLAGS1_2000) { return ApiStatus_DONE2; } @@ -2419,32 +2419,32 @@ ApiStatus func_80275F00(Evt* script, s32 isInitialCall) { } break; case 31: - temp_f22_5 = playerState->velocity; + temp_f22_5 = playerState->vel; temp_f20_6 = playerState->acceleration; - playerState->velocity = temp_f22_5 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.53 * temp_f20_6) + temp_f20_6); - playerState->currentPos.x += playerState->unk_30.x; - playerState->currentPos.y += playerState->unk_30.y; - playerState->currentPos.z += playerState->unk_30.z; - playerState->unk_18.x = player->currentPos.y; - player->currentPos.x = playerState->currentPos.x; - player->currentPos.y = playerState->currentPos.y + (playerState->bounceDivisor * sin_rad(playerState->velocity)); - player->currentPos.z = playerState->currentPos.z; - if (playerState->goalPos.y > player->currentPos.y && playerState->moveTime < 3) { - player->currentPos.y = playerState->goalPos.y; - } - playerState->unk_18.y = player->currentPos.y; + playerState->vel = temp_f22_5 + ((sin_rad(DEG_TO_RAD(playerState->unk_24)) * 0.53 * temp_f20_6) + temp_f20_6); + playerState->curPos.x += playerState->unk_30.x; + playerState->curPos.y += playerState->unk_30.y; + playerState->curPos.z += playerState->unk_30.z; + playerState->unk_18.x = player->curPos.y; + player->curPos.x = playerState->curPos.x; + player->curPos.y = playerState->curPos.y + (playerState->bounceDivisor * sin_rad(playerState->vel)); + player->curPos.z = playerState->curPos.z; + if (playerState->goalPos.y > player->curPos.y && playerState->moveTime < 3) { + player->curPos.y = playerState->goalPos.y; + } + playerState->unk_18.y = player->curPos.y; playerState->unk_24 += playerState->unk_28; playerState->unk_24 = clamp_angle(playerState->unk_24); set_animation(ACTOR_PLAYER, 0, playerState->animJumpFall); - player->rotation.y += 133.0f; - player->rotation.y = clamp_angle(player->rotation.y); + player->rot.y += 133.0f; + player->rot.y = clamp_angle(player->rot.y); playerState->moveTime--; if (playerState->moveTime == 0) { - player->currentPos.y = playerState->goalPos.y; - player->rotation.y = 0.0f; + player->curPos.y = playerState->goalPos.y; + player->rot.y = 0.0f; set_animation(ACTOR_PLAYER, 0, playerState->animJumpLand); playerState->acceleration = 1.8f; - playerState->velocity = -(playerState->unk_18.x - playerState->unk_18.y); + playerState->vel = -(playerState->unk_18.x - playerState->unk_18.y); return ApiStatus_DONE1; } break; diff --git a/src/1A5830.c b/src/1A5830.c index bd34f1f5477..1ace4fc994b 100644 --- a/src/1A5830.c +++ b/src/1A5830.c @@ -129,16 +129,16 @@ void dispatch_event_actor(Actor* actor, s32 event) { HitResult calc_enemy_test_target(Actor* actor) { PlayerData* playerData = &gPlayerData; BattleStatus* battleStatus = &gBattleStatus; - s32 targetID = battleStatus->currentTargetID; - s32 targetPartIdx = battleStatus->currentTargetPart; + s32 targetID = battleStatus->curTargetID; + s32 targetPartIdx = battleStatus->curTargetPart; Actor* target; Actor* target2; ActorPart* targetPart; s32 actorClass; s32 hitResult; - battleStatus->currentTargetID2 = battleStatus->currentTargetID; - battleStatus->currentTargetPart2 = battleStatus->currentTargetPart; + battleStatus->curTargetID2 = battleStatus->curTargetID; + battleStatus->curTargetPart2 = battleStatus->curTargetPart; target = get_actor(targetID); if (target == NULL) { @@ -151,16 +151,16 @@ HitResult calc_enemy_test_target(Actor* actor) { actorClass = targetID & ACTOR_CLASS_MASK; switch (actorClass) { case ACTOR_CLASS_PLAYER: - target->currentHP = playerData->curHP; + target->curHP = playerData->curHP; break; case ACTOR_CLASS_PARTNER: - target->currentHP = 127; + target->curHP = 127; break; case ACTOR_CLASS_ENEMY: break; } - if (battleStatus->currentAttackElement & DAMAGE_TYPE_TRIGGER_LUCKY) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_TRIGGER_LUCKY) { dispatch_event_general(target, EVENT_LUCKY); return HIT_RESULT_HIT; } @@ -168,7 +168,7 @@ HitResult calc_enemy_test_target(Actor* actor) { hitResult = HIT_RESULT_HIT; target2 = target; if (targetPart->eventFlags & ACTOR_EVENT_FLAG_ILLUSORY || battleStatus->outtaSightActive || target2->transparentStatus == STATUS_KEY_TRANSPARENT) { - if (!(battleStatus->currentAttackElement & DAMAGE_TYPE_MAGIC)) { + if (!(battleStatus->curAttackElement & DAMAGE_TYPE_MAGIC)) { hitResult = HIT_RESULT_MISS; } } @@ -191,7 +191,7 @@ HitResult calc_enemy_test_target(Actor* actor) { break; } } - if (player_team_is_ability_active(target2, ABILITY_CLOSE_CALL) && (target2->currentHP < 6)) { + if (player_team_is_ability_active(target2, ABILITY_CLOSE_CALL) && (target2->curHP < 6)) { if (rand_int(100) < 30) { hitResult = HIT_RESULT_LUCKY; break; @@ -233,8 +233,8 @@ HitResult calc_enemy_test_target(Actor* actor) { HitResult calc_enemy_damage_target(Actor* attacker) { BattleStatus* battleStatus = &gBattleStatus; ActorState* state = &attacker->state; - s32 targetID = battleStatus->currentTargetID; - s32 targetPartIdx = battleStatus->currentTargetPart; + s32 targetID = battleStatus->curTargetID; + s32 targetPartIdx = battleStatus->curTargetPart; s32 actorClass; Actor* target; ActorPart* targetPart; @@ -257,8 +257,8 @@ HitResult calc_enemy_damage_target(Actor* attacker) { battleStatus->lastAttackDamage = 0; battleStatus->attackerActorID = attacker->actorID; - battleStatus->currentTargetID2 = targetID; - battleStatus->currentTargetPart2 = targetPartIdx; + battleStatus->curTargetID2 = targetID; + battleStatus->curTargetPart2 = targetPartIdx; target = get_actor(targetID); if (target == NULL) { @@ -273,10 +273,10 @@ HitResult calc_enemy_damage_target(Actor* attacker) { switch (actorClass) { case ACTOR_CLASS_PLAYER: - target->currentHP = gPlayerData.curHP; + target->curHP = gPlayerData.curHP; break; case ACTOR_CLASS_PARTNER: - target->currentHP = 127; + target->curHP = 127; break; case ACTOR_CLASS_ENEMY: break; @@ -290,7 +290,7 @@ HitResult calc_enemy_damage_target(Actor* attacker) { if (target->transparentStatus == STATUS_KEY_TRANSPARENT || targetPart->eventFlags & ACTOR_EVENT_FLAG_800 - && !(battleStatus->currentAttackElement & DAMAGE_TYPE_QUAKE) + && !(battleStatus->curAttackElement & DAMAGE_TYPE_QUAKE) ) { return HIT_RESULT_MISS; } @@ -305,8 +305,8 @@ HitResult calc_enemy_damage_target(Actor* attacker) { // handle attack element - if (battleStatus->currentAttackElement & DAMAGE_TYPE_BLAST) { - if (!(battleStatus->currentAttackElement & DAMAGE_TYPE_NO_CONTACT) + if (battleStatus->curAttackElement & DAMAGE_TYPE_BLAST) { + if (!(battleStatus->curAttackElement & DAMAGE_TYPE_NO_CONTACT) && (targetPart->eventFlags & ACTOR_EVENT_FLAG_EXPLODE_ON_IGNITION) ) { do { @@ -316,31 +316,31 @@ HitResult calc_enemy_damage_target(Actor* attacker) { return HIT_RESULT_BACKFIRE; } } - if ((battleStatus->currentAttackElement & DAMAGE_TYPE_QUAKE) && (target->flags & ACTOR_FLAG_FLYING)) { + if ((battleStatus->curAttackElement & DAMAGE_TYPE_QUAKE) && (target->flags & ACTOR_FLAG_FLYING)) { play_hit_sound(attacker, state->goalPos.x, state->goalPos.y, state->goalPos.z, 1); return HIT_RESULT_NO_DAMAGE; } - if (battleStatus->currentAttackElement & DAMAGE_TYPE_FIRE) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_FIRE) { fx_ring_blast(0, state->goalPos.x, state->goalPos.y, state->goalPos.z + 5.0f, 1.0f, 24); isFire = TRUE; } - if (battleStatus->currentAttackElement & DAMAGE_TYPE_SHOCK) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_SHOCK) { apply_shock_effect(target); isElectric = TRUE; } - if (battleStatus->currentAttackElement & DAMAGE_TYPE_WATER) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_WATER) { fx_water_splash(0, state->goalPos.x, state->goalPos.y, state->goalPos.z + 5.0f, 1.0f, 24); isWater = TRUE; } - if (battleStatus->currentAttackElement & DAMAGE_TYPE_ICE) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_ICE) { fx_big_snowflakes(0, state->goalPos.x, state->goalPos.y, state->goalPos.z + 5.0f); isIce = TRUE; } if (!(attacker->staticStatus == STATUS_KEY_STATIC) && ((target->staticStatus == STATUS_KEY_STATIC) || (targetPart->eventFlags & ACTOR_EVENT_FLAG_ELECTRIFIED)) - && !(battleStatus->currentAttackElement & (DAMAGE_TYPE_SHOCK | DAMAGE_TYPE_NO_CONTACT)) - && !(battleStatus->currentAttackEventSuppression & SUPPRESS_EVENT_SHOCK_CONTACT) + && !(battleStatus->curAttackElement & (DAMAGE_TYPE_SHOCK | DAMAGE_TYPE_NO_CONTACT)) + && !(battleStatus->curAttackEventSuppression & SUPPRESS_EVENT_SHOCK_CONTACT) && !has_enchanted_part(attacker)) // enchanted attacks ignore electrified defenders { madeElectricContact = TRUE; @@ -351,14 +351,14 @@ HitResult calc_enemy_damage_target(Actor* attacker) { gBattleStatus.flags1 &= ~BS_FLAGS1_ATK_BLOCKED; - defense = get_defense(target, targetPart->defenseTable, battleStatus->currentAttackElement); + defense = get_defense(target, targetPart->defenseTable, battleStatus->curAttackElement); - if (!(battleStatus->currentAttackElement & DAMAGE_TYPE_IGNORE_DEFENSE)) { + if (!(battleStatus->curAttackElement & DAMAGE_TYPE_IGNORE_DEFENSE)) { defense += target->defenseBoost; if (actorClass == ACTOR_CLASS_PLAYER) { if (battleStatus->waterBlockTurnsLeft > 0) { - if ((battleStatus->currentAttackElement & (DAMAGE_TYPE_BLAST | DAMAGE_TYPE_FIRE))) { + if ((battleStatus->curAttackElement & (DAMAGE_TYPE_BLAST | DAMAGE_TYPE_FIRE))) { defense += 2; } else { defense += 1; @@ -371,7 +371,7 @@ HitResult calc_enemy_damage_target(Actor* attacker) { } } - damage = battleStatus->currentAttackDamage; + damage = battleStatus->curAttackDamage; switch (actorClass) { case ACTOR_CLASS_PLAYER: @@ -407,7 +407,7 @@ HitResult calc_enemy_damage_target(Actor* attacker) { isPlayer = actorClass == ACTOR_CLASS_PLAYER; if (isPlayer) { if (player_team_is_ability_active(target, ABILITY_FIRE_SHIELD)) { - if (battleStatus->currentAttackElement & DAMAGE_TYPE_FIRE) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_FIRE) { damage--; } } @@ -416,7 +416,7 @@ HitResult calc_enemy_damage_target(Actor* attacker) { damage -= player_team_is_ability_active(target, ABILITY_P_DOWN_D_UP); damage += player_team_is_ability_active(target, ABILITY_P_UP_D_DOWN); - if (target->currentHP <= 5) { + if (target->curHP <= 5) { if (player_team_is_ability_active(target, ABILITY_LAST_STAND)) { damage /= 2; } @@ -426,7 +426,7 @@ HitResult calc_enemy_damage_target(Actor* attacker) { switch (actorClass) { case ACTOR_CLASS_PLAYER: // TODO figure out how to better write target->debuff >= STATUS_KEY_POISON - if ((target->debuff == 0 || target->debuff >= STATUS_KEY_POISON) && (target->stoneStatus == 0) && !(battleStatus->currentAttackElement & DAMAGE_TYPE_UNBLOCKABLE)) { + if ((target->debuff == 0 || target->debuff >= STATUS_KEY_POISON) && (target->stoneStatus == 0) && !(battleStatus->curAttackElement & DAMAGE_TYPE_UNBLOCKABLE)) { s32 blocked; if (player_team_is_ability_active(target, ABILITY_BERSERKER)) { @@ -448,7 +448,7 @@ HitResult calc_enemy_damage_target(Actor* attacker) { break; case ACTOR_CLASS_PARTNER: if (target->stoneStatus == 0) { - if (target->koStatus == 0 && !(battleStatus->currentAttackElement & DAMAGE_TYPE_UNBLOCKABLE)) { + if (target->koStatus == 0 && !(battleStatus->curAttackElement & DAMAGE_TYPE_UNBLOCKABLE)) { if (check_block_input(BUTTON_A)) { damage = 0; sfx_play_sound_at_position(SOUND_231, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); @@ -471,13 +471,13 @@ HitResult calc_enemy_damage_target(Actor* attacker) { event = EVENT_HIT_COMBO; if (damage < 1) { target->hpChangeCounter = 0; - if (!(battleStatus->currentAttackElement & DAMAGE_TYPE_STATUS_ALWAYS_HITS)) { + if (!(battleStatus->curAttackElement & DAMAGE_TYPE_STATUS_ALWAYS_HITS)) { hitResult = HIT_RESULT_NO_DAMAGE; event = EVENT_ZERO_DAMAGE; } else { hitResult = HIT_RESULT_NO_DAMAGE; event = EVENT_ZERO_DAMAGE; - if (target->currentHP < 1) { + if (target->curHP < 1) { event = EVENT_DEATH; } } @@ -491,11 +491,11 @@ HitResult calc_enemy_damage_target(Actor* attacker) { && !(gBattleStatus.flags1 & BS_FLAGS1_TUTORIAL_BATTLE) ) { if (!(target->flags & ACTOR_FLAG_NO_DMG_APPLY)) { - target->currentHP -= damage; + target->curHP -= damage; } - if (target->currentHP < 1) { - target->currentHP = 0; + if (target->curHP < 1) { + target->curHP = 0; event = EVENT_DEATH; } } @@ -505,7 +505,7 @@ HitResult calc_enemy_damage_target(Actor* attacker) { if (actorClass == ACTOR_CLASS_PLAYER) { battleStatus->damageTaken += damage; - gPlayerData.curHP = target->currentHP; + gPlayerData.curHP = target->curHP; } } @@ -516,7 +516,7 @@ HitResult calc_enemy_damage_target(Actor* attacker) { if (event == EVENT_ZERO_DAMAGE) { event = EVENT_IMMUNE; } - if (target->currentHP < 1 && event == EVENT_IMMUNE) { + if (target->curHP < 1 && event == EVENT_IMMUNE) { event = EVENT_DEATH; } } else if (event == EVENT_DEATH) { @@ -528,7 +528,7 @@ HitResult calc_enemy_damage_target(Actor* attacker) { } if ((gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE) - && (battleStatus->currentAttackElement & (DAMAGE_TYPE_POW | DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_JUMP)) + && (battleStatus->curAttackElement & (DAMAGE_TYPE_POW | DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_JUMP)) && (targetPart->eventFlags & ACTOR_EVENT_FLAG_FLIPABLE) ) { if (event == EVENT_HIT) { @@ -540,7 +540,7 @@ HitResult calc_enemy_damage_target(Actor* attacker) { } if (!(gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE) - && (battleStatus->currentAttackElement & (DAMAGE_TYPE_POW | DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_JUMP)) + && (battleStatus->curAttackElement & (DAMAGE_TYPE_POW | DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_JUMP)) && (targetPart->eventFlags & ACTOR_EVENT_FLAG_FLIPABLE) ) { if (event == EVENT_HIT_COMBO) { @@ -552,7 +552,7 @@ HitResult calc_enemy_damage_target(Actor* attacker) { } if ((gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE) - && (battleStatus->currentAttackElement & (DAMAGE_TYPE_FIRE | DAMAGE_TYPE_BLAST | DAMAGE_TYPE_4000)) + && (battleStatus->curAttackElement & (DAMAGE_TYPE_FIRE | DAMAGE_TYPE_BLAST | DAMAGE_TYPE_4000)) ) { if (event == EVENT_HIT) { event = EVENT_BURN_HIT; @@ -592,54 +592,54 @@ HitResult calc_enemy_damage_target(Actor* attacker) { && !(gBattleStatus.flags2 & BS_FLAGS2_1000000) && !(actorClass == ACTOR_PLAYER && is_ability_active(ABILITY_HEALTHY_HEALTHY) && (rand_int(100) < 50))) { - if (battleStatus->currentAttackStatus & STATUS_FLAG_SHRINK && try_inflict_status(target, STATUS_KEY_SHRINK, STATUS_TURN_MOD_SHRINK)) { + if (battleStatus->curAttackStatus & STATUS_FLAG_SHRINK && try_inflict_status(target, STATUS_KEY_SHRINK, STATUS_TURN_MOD_SHRINK)) { statusInflicted = one; statusInflicted2 = one; } - if (battleStatus->currentAttackStatus & STATUS_FLAG_POISON && try_inflict_status(target, STATUS_KEY_POISON, STATUS_TURN_MOD_POISON)) { + if (battleStatus->curAttackStatus & STATUS_FLAG_POISON && try_inflict_status(target, STATUS_KEY_POISON, STATUS_TURN_MOD_POISON)) { statusInflicted = one; statusInflicted2 = one; } - if (battleStatus->currentAttackStatus & STATUS_FLAG_STONE && try_inflict_status(target, STATUS_KEY_STONE, STATUS_TURN_MOD_STONE)) { + if (battleStatus->curAttackStatus & STATUS_FLAG_STONE && try_inflict_status(target, STATUS_KEY_STONE, STATUS_TURN_MOD_STONE)) { statusInflicted = one; statusInflicted2 = one; } - if (battleStatus->currentAttackStatus & STATUS_FLAG_SLEEP && try_inflict_status(target, STATUS_KEY_SLEEP, STATUS_TURN_MOD_SLEEP)) { + if (battleStatus->curAttackStatus & STATUS_FLAG_SLEEP && try_inflict_status(target, STATUS_KEY_SLEEP, STATUS_TURN_MOD_SLEEP)) { statusInflicted = one; statusInflicted2 = one; } - if (battleStatus->currentAttackStatus & STATUS_FLAG_DIZZY && try_inflict_status(target, STATUS_KEY_DIZZY, STATUS_TURN_MOD_DIZZY)) { + if (battleStatus->curAttackStatus & STATUS_FLAG_DIZZY && try_inflict_status(target, STATUS_KEY_DIZZY, STATUS_TURN_MOD_DIZZY)) { statusInflicted = one; statusInflicted2 = one; } - if (battleStatus->currentAttackStatus & STATUS_FLAG_STOP && try_inflict_status(target, STATUS_KEY_STOP, STATUS_TURN_MOD_STOP)) { + if (battleStatus->curAttackStatus & STATUS_FLAG_STOP && try_inflict_status(target, STATUS_KEY_STOP, STATUS_TURN_MOD_STOP)) { statusInflicted = one; statusInflicted2 = one; } - if (battleStatus->currentAttackStatus & STATUS_FLAG_STATIC && try_inflict_status(target, STATUS_KEY_STATIC, STATUS_TURN_MOD_STATIC)) { + if (battleStatus->curAttackStatus & STATUS_FLAG_STATIC && try_inflict_status(target, STATUS_KEY_STATIC, STATUS_TURN_MOD_STATIC)) { statusInflicted = one; statusInflicted2 = one; } - if (battleStatus->currentAttackStatus & STATUS_FLAG_PARALYZE && try_inflict_status(target, STATUS_KEY_PARALYZE, STATUS_TURN_MOD_PARALYZE)) { + if (battleStatus->curAttackStatus & STATUS_FLAG_PARALYZE && try_inflict_status(target, STATUS_KEY_PARALYZE, STATUS_TURN_MOD_PARALYZE)) { statusInflicted = one; statusInflicted2 = one; } - if (battleStatus->currentAttackStatus & STATUS_FLAG_FEAR && try_inflict_status(target, STATUS_KEY_FEAR, STATUS_TURN_MOD_FEAR)) { + if (battleStatus->curAttackStatus & STATUS_FLAG_FEAR && try_inflict_status(target, STATUS_KEY_FEAR, STATUS_TURN_MOD_FEAR)) { statusInflicted = one; statusInflicted2 = one; } // @bug? repeated paralyze and dizzy infliction - if (battleStatus->currentAttackStatus & STATUS_FLAG_PARALYZE && try_inflict_status(target, STATUS_KEY_PARALYZE, STATUS_TURN_MOD_PARALYZE)) { + if (battleStatus->curAttackStatus & STATUS_FLAG_PARALYZE && try_inflict_status(target, STATUS_KEY_PARALYZE, STATUS_TURN_MOD_PARALYZE)) { statusInflicted = one; statusInflicted2 = one; } - if (battleStatus->currentAttackStatus & STATUS_FLAG_DIZZY && try_inflict_status(target, STATUS_KEY_DIZZY, STATUS_TURN_MOD_DIZZY)) { + if (battleStatus->curAttackStatus & STATUS_FLAG_DIZZY && try_inflict_status(target, STATUS_KEY_DIZZY, STATUS_TURN_MOD_DIZZY)) { statusInflicted = one; statusInflicted2 = one; } - if (battleStatus->currentAttackStatus & STATUS_FLAG_FROZEN && target->debuff != STATUS_KEY_FROZEN && try_inflict_status(target, STATUS_KEY_FROZEN, STATUS_TURN_MOD_FROZEN)) { + if (battleStatus->curAttackStatus & STATUS_FLAG_FROZEN && target->debuff != STATUS_KEY_FROZEN && try_inflict_status(target, STATUS_KEY_FROZEN, STATUS_TURN_MOD_FROZEN)) { statusInflicted = one; statusInflicted2 = one; } @@ -687,7 +687,7 @@ HitResult calc_enemy_damage_target(Actor* attacker) { // immune star fx? show_immune_bonk(state->goalPos.x, state->goalPos.y, state->goalPos.z, 0, 1, -3); } - } else if (battleStatus->currentAttackElement & (DAMAGE_TYPE_MULTIPLE_POPUPS | DAMAGE_TYPE_SMASH)) { + } else if (battleStatus->curAttackElement & (DAMAGE_TYPE_MULTIPLE_POPUPS | DAMAGE_TYPE_SMASH)) { show_next_damage_popup(state->goalPos.x, state->goalPos.y, state->goalPos.z, battleStatus->lastAttackDamage, 1); show_damage_fx(target, state->goalPos.x, state->goalPos.y, state->goalPos.z, battleStatus->lastAttackDamage); } else { @@ -701,7 +701,7 @@ HitResult calc_enemy_damage_target(Actor* attacker) { if (!statusInflicted2 && !statusInflicted) { show_immune_bonk(state->goalPos.x, state->goalPos.y, state->goalPos.z, 0, 1, 3); } - } else if (battleStatus->currentAttackElement & (DAMAGE_TYPE_MULTIPLE_POPUPS | DAMAGE_TYPE_SMASH)) { + } else if (battleStatus->curAttackElement & (DAMAGE_TYPE_MULTIPLE_POPUPS | DAMAGE_TYPE_SMASH)) { show_next_damage_popup(state->goalPos.x, state->goalPos.y, state->goalPos.z, battleStatus->lastAttackDamage, 0); show_damage_fx(target, state->goalPos.x, state->goalPos.y, state->goalPos.z, battleStatus->lastAttackDamage); } else { @@ -736,42 +736,42 @@ HitResult calc_enemy_damage_target(Actor* attacker) { sfx_play_sound_at_position(SOUND_IMMUNE, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if ((battleStatus->currentAttackStatus & STATUS_FLAG_SLEEP) && statusInflicted) { + if ((battleStatus->curAttackStatus & STATUS_FLAG_SLEEP) && statusInflicted) { script = start_script(&EVS_PlaySleepHitFX, EVT_PRIORITY_A, 0); script->varTable[0] = state->goalPos.x; script->varTable[1] = state->goalPos.y; script->varTable[2] = state->goalPos.z; sfx_play_sound_at_position(SOUND_INFLICT_SLEEP, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if ((battleStatus->currentAttackStatus & STATUS_FLAG_DIZZY) && statusInflicted) { + if ((battleStatus->curAttackStatus & STATUS_FLAG_DIZZY) && statusInflicted) { script = start_script(&EVS_PlayDizzyHitFX, EVT_PRIORITY_A, 0); script->varTable[0] = state->goalPos.x; script->varTable[1] = state->goalPos.y; script->varTable[2] = state->goalPos.z; sfx_play_sound_at_position(SOUND_INFLICT_STATUS, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if ((battleStatus->currentAttackStatus & STATUS_FLAG_PARALYZE) && statusInflicted) { + if ((battleStatus->curAttackStatus & STATUS_FLAG_PARALYZE) && statusInflicted) { script = start_script(&EVS_PlayParalyzeHitFX, EVT_PRIORITY_A, 0); script->varTable[0] = state->goalPos.x; script->varTable[1] = state->goalPos.y; script->varTable[2] = state->goalPos.z; sfx_play_sound_at_position(SOUND_INFLICT_STATUS, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if ((battleStatus->currentAttackStatus & STATUS_FLAG_POISON) && statusInflicted) { + if ((battleStatus->curAttackStatus & STATUS_FLAG_POISON) && statusInflicted) { script = start_script(&EVS_PlayPoisonHitFX, EVT_PRIORITY_A, 0); script->varTable[0] = state->goalPos.x; script->varTable[1] = state->goalPos.y; script->varTable[2] = state->goalPos.z; sfx_play_sound_at_position(SOUND_INFLICT_STATUS, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if ((battleStatus->currentAttackStatus & STATUS_FLAG_STOP) && statusInflicted) { + if ((battleStatus->curAttackStatus & STATUS_FLAG_STOP) && statusInflicted) { script = start_script(&EVS_PlayStopHitFX, EVT_PRIORITY_A, 0); script->varTable[0] = state->goalPos.x; script->varTable[1] = state->goalPos.y; script->varTable[2] = state->goalPos.z; sfx_play_sound_at_position(SOUND_INFLICT_STATUS, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if ((battleStatus->currentAttackStatus & STATUS_FLAG_FROZEN) && statusInflicted) { + if ((battleStatus->curAttackStatus & STATUS_FLAG_FROZEN) && statusInflicted) { script = start_script(&EVS_PlayFreezeHitFX, EVT_PRIORITY_A, 0); script->varTable[0] = state->goalPos.x; script->varTable[1] = state->goalPos.y; @@ -779,7 +779,7 @@ HitResult calc_enemy_damage_target(Actor* attacker) { script->varTablePtr[3] = target; sfx_play_sound_at_position(SOUND_HIT_ICE, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if ((battleStatus->currentAttackStatus & STATUS_FLAG_SHRINK) && statusInflicted) { + if ((battleStatus->curAttackStatus & STATUS_FLAG_SHRINK) && statusInflicted) { script = start_script(&EVS_PlayShrinkHitFX, EVT_PRIORITY_A, 0); script->varTable[0] = state->goalPos.x; script->varTable[1] = state->goalPos.y; @@ -788,7 +788,7 @@ HitResult calc_enemy_damage_target(Actor* attacker) { sfx_play_sound_at_position(SOUND_INFLICT_STATUS, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if ((battleStatus->currentAttackElement & DAMAGE_TYPE_SMASH) && target->actorType == ACTOR_TYPE_GOOMNUT_TREE) { + if ((battleStatus->curAttackElement & DAMAGE_TYPE_SMASH) && target->actorType == ACTOR_TYPE_GOOMNUT_TREE) { sfx_play_sound_at_position(SOUND_SMASH_GOOMNUT_TREE, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } @@ -796,8 +796,8 @@ HitResult calc_enemy_damage_target(Actor* attacker) { if (attacker->staticStatus != STATUS_KEY_STATIC && (target->staticStatus == STATUS_KEY_STATIC || targetPart->eventFlags & ACTOR_EVENT_FLAG_ELECTRIFIED) - && !(battleStatus->currentAttackElement & DAMAGE_TYPE_NO_CONTACT) - && !(battleStatus->currentAttackEventSuppression & SUPPRESS_EVENT_SHOCK_CONTACT) + && !(battleStatus->curAttackElement & DAMAGE_TYPE_NO_CONTACT) + && !(battleStatus->curAttackEventSuppression & SUPPRESS_EVENT_SHOCK_CONTACT) && (attacker->transparentStatus != STATUS_KEY_TRANSPARENT) && !has_enchanted_part(attacker)) { @@ -820,7 +820,7 @@ s32 dispatch_damage_event_actor(Actor* actor, s32 damageAmount, s32 originalEven s32 flagCheck; s32 new_var; - battleStatus->currentAttackDamage = damageAmount; + battleStatus->curAttackDamage = damageAmount; hpChange = (s16) damageAmount; actor->hpChangeCounter += hpChange; new_var = actor->hpChangeCounter; @@ -828,17 +828,17 @@ s32 dispatch_damage_event_actor(Actor* actor, s32 damageAmount, s32 originalEven actor->damageCounter += hpChange; actor->hpChangeCounter -= hpChange; battleStatus->lastAttackDamage = 0; - actor->currentHP -= hpChange; + actor->curHP -= hpChange; - if (actor->currentHP <= 0) { + if (actor->curHP <= 0) { dispatchEvent = EVENT_DEATH; - battleStatus->lastAttackDamage += actor->currentHP; - actor->currentHP = 0; + battleStatus->lastAttackDamage += actor->curHP; + actor->curHP = 0; } battleStatus->lastAttackDamage += hpChange; actor->lastDamageTaken = battleStatus->lastAttackDamage; - battleStatus->currentDamageSource = DMG_SRC_DEFAULT; + battleStatus->curDamageSource = DMG_SRC_DEFAULT; if (battleStatus->flags1 & BS_FLAGS1_SP_EVT_ACTIVE) { if (dispatchEvent == EVENT_HIT_COMBO) { dispatchEvent = EVENT_HIT; @@ -1043,18 +1043,18 @@ ApiStatus JumpToGoal(Evt* script, s32 isInitialCall) { script->functionTemp[3] |= 2; } - actorState->currentPos.x = actor->currentPos.x; - actorState->currentPos.y = actor->currentPos.y; - actorState->currentPos.z = actor->currentPos.z; + actorState->curPos.x = actor->curPos.x; + actorState->curPos.y = actor->curPos.y; + actorState->curPos.z = actor->curPos.z; - posX = actorState->currentPos.x; - posY = actorState->currentPos.y; - posZ = actorState->currentPos.z; + posX = actorState->curPos.x; + posY = actorState->curPos.y; + posZ = actorState->curPos.z; goalX = actorState->goalPos.x; goalY = actorState->goalPos.y; goalZ = actorState->goalPos.z; actorState->angle = atan2(posX, posZ, goalX, goalZ); - actorState->distance = dist2D(posX, posZ, goalX, goalZ); + actorState->dist = dist2D(posX, posZ, goalX, goalZ); // make relative posX = (goalX - posX); @@ -1062,25 +1062,25 @@ ApiStatus JumpToGoal(Evt* script, s32 isInitialCall) { posZ = (goalZ - posZ); if (actorState->moveTime == 0) { - actorState->moveTime = actorState->distance / actorState->speed; - moveDist = actorState->distance - (actorState->moveTime * actorState->speed); + actorState->moveTime = actorState->dist / actorState->speed; + moveDist = actorState->dist - (actorState->moveTime * actorState->speed); } else { - actorState->speed = actorState->distance / actorState->moveTime; - moveDist = actorState->distance - (actorState->moveTime * actorState->speed); + actorState->speed = actorState->dist / actorState->moveTime; + moveDist = actorState->dist - (actorState->moveTime * actorState->speed); } if (actorState->moveTime == 0) { return ApiStatus_DONE2; } - actorState->velocity = (actorState->acceleration * actorState->moveTime * 0.5f) + (posY / actorState->moveTime); + actorState->vel = (actorState->acceleration * actorState->moveTime * 0.5f) + (posY / actorState->moveTime); actorState->speed += (moveDist / actorState->moveTime); if (script->functionTemp[2] != 0) { set_animation(actor->actorID, (s8) actor->state.jumpPartIndex, actor->state.animJumpRise); } if (!(script->functionTemp[3] & 2) && (actor->actorTypeData1[4] != 0)) { - sfx_play_sound_at_position(actor->actorTypeData1[4], SOUND_SPACE_MODE_0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z); + sfx_play_sound_at_position(actor->actorTypeData1[4], SOUND_SPACE_MODE_0, actor->curPos.x, actor->curPos.y, actor->curPos.z); } script->functionTemp[0] = 1; } @@ -1088,22 +1088,22 @@ ApiStatus JumpToGoal(Evt* script, s32 isInitialCall) { actor = script->functionTempPtr[1]; actorState = &actor->state; - actorState->currentPos.y += actorState->velocity; - actorState->velocity -= actorState->acceleration; + actorState->curPos.y += actorState->vel; + actorState->vel -= actorState->acceleration; - if ((script->functionTemp[2] != 0) && (actorState->velocity < 0.0f)) { + if ((script->functionTemp[2] != 0) && (actorState->vel < 0.0f)) { set_animation(actor->actorID, (s8) actorState->jumpPartIndex, actorState->animJumpFall); } - if (actorState->velocity < 0.0f) { - if (actorState->currentPos.y < actorState->goalPos.y) { - actorState->currentPos.y = actorState->goalPos.y; + if (actorState->vel < 0.0f) { + if (actorState->curPos.y < actorState->goalPos.y) { + actorState->curPos.y = actorState->goalPos.y; } } - add_xz_vec3f(&actorState->currentPos, actorState->speed, actorState->angle); - actor->currentPos.x = actorState->currentPos.x; - actor->currentPos.y = actorState->currentPos.y; - actor->currentPos.z = actorState->currentPos.z; + add_xz_vec3f(&actorState->curPos, actorState->speed, actorState->angle); + actor->curPos.x = actorState->curPos.x; + actor->curPos.y = actorState->curPos.y; + actor->curPos.z = actorState->curPos.z; actorState->moveTime--; if (actorState->moveTime > 0) { @@ -1113,9 +1113,9 @@ ApiStatus JumpToGoal(Evt* script, s32 isInitialCall) { if (script->functionTemp[3] & 1) { play_movement_dust_effects(2, actorState->goalPos.x, actorState->goalPos.y, actorState->goalPos.z, actorState->angle); } - actor->currentPos.x = actorState->goalPos.x; - actor->currentPos.y = actorState->goalPos.y; - actor->currentPos.z = actorState->goalPos.z; + actor->curPos.x = actorState->goalPos.x; + actor->curPos.y = actorState->goalPos.y; + actor->curPos.z = actorState->goalPos.z; if (script->functionTemp[2] != 0) { set_animation(actor->actorID, (s8) actorState->jumpPartIndex, actorState->animJumpLand); } @@ -1148,18 +1148,18 @@ ApiStatus IdleJumpToGoal(Evt* script, s32 isInitialCall) { script->functionTemp[2] = evt_get_variable(script, *args++); script->functionTemp[3] = evt_get_variable(script, *args++); - movement->currentPos.x = actor->currentPos.x; - movement->currentPos.y = actor->currentPos.y; - movement->currentPos.z = actor->currentPos.z; + movement->curPos.x = actor->curPos.x; + movement->curPos.y = actor->curPos.y; + movement->curPos.z = actor->curPos.z; - posX = movement->currentPos.x; - posY = movement->currentPos.y; - posZ = movement->currentPos.z; + posX = movement->curPos.x; + posY = movement->curPos.y; + posZ = movement->curPos.z; goalX = movement->goalPos.x; goalY = movement->goalPos.y; goalZ = movement->goalPos.z; movement->angle = atan2(posX, posZ, goalX, goalZ); - movement->distance = dist2D(posX, posZ, goalX, goalZ); + movement->dist = dist2D(posX, posZ, goalX, goalZ); // make relative posX = (goalX - posX); @@ -1167,18 +1167,18 @@ ApiStatus IdleJumpToGoal(Evt* script, s32 isInitialCall) { posZ = (goalZ - posZ); if (movement->flyTime == 0) { - movement->flyTime = movement->distance / movement->speed; - moveDist = movement->distance - (movement->flyTime * movement->speed); + movement->flyTime = movement->dist / movement->speed; + moveDist = movement->dist - (movement->flyTime * movement->speed); } else { - movement->speed = movement->distance / movement->flyTime; - moveDist = movement->distance - (movement->flyTime * movement->speed); + movement->speed = movement->dist / movement->flyTime; + moveDist = movement->dist - (movement->flyTime * movement->speed); } if (movement->flyTime == 0) { return ApiStatus_DONE2; } - movement->velocity = (movement->acceleration * movement->flyTime * 0.5f) + (posY / movement->flyTime); + movement->vel = (movement->acceleration * movement->flyTime * 0.5f) + (posY / movement->flyTime); movement->speed += moveDist / movement->flyTime; script->functionTemp[0] = TRUE; } @@ -1186,24 +1186,24 @@ ApiStatus IdleJumpToGoal(Evt* script, s32 isInitialCall) { actor = script->functionTempPtr[1]; movement = &actor->fly; - movement->currentPos.y += movement->velocity; - movement->velocity -= movement->acceleration; - if (movement->velocity < 0.0f && movement->goalPos.y > movement->currentPos.y) { - movement->currentPos.y = movement->goalPos.y; + movement->curPos.y += movement->vel; + movement->vel -= movement->acceleration; + if (movement->vel < 0.0f && movement->goalPos.y > movement->curPos.y) { + movement->curPos.y = movement->goalPos.y; } - add_xz_vec3f_copy2(&movement->currentPos, movement->speed, movement->angle); - actor->currentPos.x = movement->currentPos.x; - actor->currentPos.y = movement->currentPos.y; - actor->currentPos.z = movement->currentPos.z; + add_xz_vec3f_copy2(&movement->curPos, movement->speed, movement->angle); + actor->curPos.x = movement->curPos.x; + actor->curPos.y = movement->curPos.y; + actor->curPos.z = movement->curPos.z; movement->flyTime--; if (movement->flyTime <= 0) { if (script->functionTemp[3] != 0) { play_movement_dust_effects(2, movement->goalPos.x, movement->goalPos.y, movement->goalPos.z, movement->angle); } - actor->currentPos.x = movement->goalPos.x; - actor->currentPos.y = movement->goalPos.y; - actor->currentPos.z = movement->goalPos.z; + actor->curPos.x = movement->goalPos.x; + actor->curPos.y = movement->goalPos.y; + actor->curPos.z = movement->goalPos.z; return ApiStatus_DONE1; } @@ -1233,18 +1233,18 @@ ApiStatus JumpToGoalSimple2(Evt* script, s32 isInitialCall) { state = &actor->state; state->moveTime = evt_get_variable(script, *args++); - state->currentPos.x = actor->currentPos.x; - state->currentPos.y = actor->currentPos.y; - state->currentPos.z = actor->currentPos.z; + state->curPos.x = actor->curPos.x; + state->curPos.y = actor->curPos.y; + state->curPos.z = actor->curPos.z; - posX = state->currentPos.x; - posY = state->currentPos.y; - posZ = state->currentPos.z; + posX = state->curPos.x; + posY = state->curPos.y; + posZ = state->curPos.z; goalX = state->goalPos.x; goalY = state->goalPos.y; goalZ = state->goalPos.z; state->angle = atan2(posX, posZ, goalX, goalZ); - state->distance = dist2D(posX, posZ, goalX, goalZ); + state->dist = dist2D(posX, posZ, goalX, goalZ); // make relative (note: negated) posX = (posX - goalX); @@ -1252,21 +1252,21 @@ ApiStatus JumpToGoalSimple2(Evt* script, s32 isInitialCall) { posZ = (posZ - goalZ); if (state->moveTime == 0) { - state->moveTime = state->distance / state->speed; - moveDist = state->distance - (state->moveTime * state->speed); + state->moveTime = state->dist / state->speed; + moveDist = state->dist - (state->moveTime * state->speed); } else { - state->speed = state->distance / state->moveTime; - moveDist = state->distance - (state->moveTime * state->speed); + state->speed = state->dist / state->moveTime; + moveDist = state->dist - (state->moveTime * state->speed); } if (state->moveTime == 0) { return ApiStatus_DONE2; } - state->velocity = ((state->acceleration * state->moveTime) * 0.5f) + (posY / state->moveTime); + state->vel = ((state->acceleration * state->moveTime) * 0.5f) + (posY / state->moveTime); state->speed += moveDist / state->moveTime; if (actor->actorTypeData1[4] != 0) { - sfx_play_sound_at_position(actor->actorTypeData1[4], SOUND_SPACE_MODE_0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z); + sfx_play_sound_at_position(actor->actorTypeData1[4], SOUND_SPACE_MODE_0, actor->curPos.x, actor->curPos.y, actor->curPos.z); } script->functionTemp[0] = TRUE; } @@ -1274,22 +1274,22 @@ ApiStatus JumpToGoalSimple2(Evt* script, s32 isInitialCall) { actor = script->functionTempPtr[1]; state = &actor->state; - state->currentPos.y -= state->velocity; - state->velocity -= state->acceleration; - if (state->velocity > 0.0f && state->goalPos.y < state->currentPos.y) { - state->currentPos.y = state->goalPos.y; + state->curPos.y -= state->vel; + state->vel -= state->acceleration; + if (state->vel > 0.0f && state->goalPos.y < state->curPos.y) { + state->curPos.y = state->goalPos.y; } - add_xz_vec3f(&state->currentPos, state->speed, state->angle); - actor->currentPos.x = state->currentPos.x; - actor->currentPos.y = state->currentPos.y; - actor->currentPos.z = state->currentPos.z; + add_xz_vec3f(&state->curPos, state->speed, state->angle); + actor->curPos.x = state->curPos.x; + actor->curPos.y = state->curPos.y; + actor->curPos.z = state->curPos.z; state->moveTime--; if (state->moveTime <= 0) { play_movement_dust_effects(2, state->goalPos.x, state->goalPos.y, state->goalPos.z, state->angle); - actor->currentPos.x = state->goalPos.x; - actor->currentPos.y = state->goalPos.y; - actor->currentPos.z = state->goalPos.z; + actor->curPos.x = state->goalPos.x; + actor->curPos.y = state->goalPos.y; + actor->curPos.z = state->goalPos.z; return ApiStatus_DONE1; } @@ -1320,18 +1320,18 @@ ApiStatus JumpWithBounce(Evt* script, s32 isInitialCall) { actorState->moveTime = evt_get_variable(script, *args++); actorState->bounceDivisor = evt_get_float_variable(script, *args++); - actorState->currentPos.x = actor->currentPos.x; - actorState->currentPos.y = actor->currentPos.y; - actorState->currentPos.z = actor->currentPos.z; + actorState->curPos.x = actor->curPos.x; + actorState->curPos.y = actor->curPos.y; + actorState->curPos.z = actor->curPos.z; - posX = actorState->currentPos.x; - posY = actorState->currentPos.y; - posZ = actorState->currentPos.z; + posX = actorState->curPos.x; + posY = actorState->curPos.y; + posZ = actorState->curPos.z; goalX = actorState->goalPos.x; goalZ = actorState->goalPos.z; goalY = actorState->goalPos.y; actorState->angle = atan2(posX, posZ, goalX, goalZ); - actorState->distance = dist2D(posX, posZ, goalX, goalZ); + actorState->dist = dist2D(posX, posZ, goalX, goalZ); // make relative posX = (goalX - posX); @@ -1339,22 +1339,22 @@ ApiStatus JumpWithBounce(Evt* script, s32 isInitialCall) { posZ = (goalZ - posZ); if (actorState->moveTime == 0) { - actorState->moveTime = (s32) (actorState->distance / actorState->speed); - moveDist = actorState->distance - (actorState->moveTime * actorState->speed); + actorState->moveTime = (s32) (actorState->dist / actorState->speed); + moveDist = actorState->dist - (actorState->moveTime * actorState->speed); } else { - actorState->speed = actorState->distance / actorState->moveTime; - moveDist = actorState->distance - (actorState->moveTime * actorState->speed); + actorState->speed = actorState->dist / actorState->moveTime; + moveDist = actorState->dist - (actorState->moveTime * actorState->speed); } if (actorState->moveTime == 0) { return ApiStatus_DONE2; } - actorState->velocity = (actorState->acceleration * actorState->moveTime * 0.5f) + (posY / actorState->moveTime); + actorState->vel = (actorState->acceleration * actorState->moveTime * 0.5f) + (posY / actorState->moveTime); actorState->speed += moveDist / actorState->moveTime; if (actor->actorTypeData1[4] != 0) { - sfx_play_sound_at_position(actor->actorTypeData1[4], SOUND_SPACE_MODE_0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z); + sfx_play_sound_at_position(actor->actorTypeData1[4], SOUND_SPACE_MODE_0, actor->curPos.x, actor->curPos.y, actor->curPos.z); } script->functionTemp[0] = TRUE; } @@ -1364,37 +1364,37 @@ ApiStatus JumpWithBounce(Evt* script, s32 isInitialCall) { switch (script->functionTemp[0]) { case 1: - actorState->currentPos.y += actorState->velocity; - actorState->velocity -= actorState->acceleration; - if ((actorState->velocity < 0.0f) && (actorState->currentPos.y < actorState->goalPos.y)) { + actorState->curPos.y += actorState->vel; + actorState->vel -= actorState->acceleration; + if ((actorState->vel < 0.0f) && (actorState->curPos.y < actorState->goalPos.y)) { actorState->acceleration = -actorState->acceleration; - actorState->velocity /= actorState->bounceDivisor; + actorState->vel /= actorState->bounceDivisor; script->functionTemp[0] = 2; } - add_xz_vec3f(&actorState->currentPos, actorState->speed, actorState->angle); + add_xz_vec3f(&actorState->curPos, actorState->speed, actorState->angle); break; case 2: - actorState->currentPos.y += actorState->velocity; - actorState->velocity -= actorState->acceleration; - if (actorState->velocity > 0.0f) { - if (actorState->goalPos.y < actorState->currentPos.y) { - actorState->currentPos.y = actorState->goalPos.y; + actorState->curPos.y += actorState->vel; + actorState->vel -= actorState->acceleration; + if (actorState->vel > 0.0f) { + if (actorState->goalPos.y < actorState->curPos.y) { + actorState->curPos.y = actorState->goalPos.y; script->functionTemp[0] = 3; } } - add_xz_vec3f(&actorState->currentPos, actorState->speed, actorState->angle); - actor->currentPos.x = actorState->currentPos.x; - actor->currentPos.y = actorState->currentPos.y; - actor->currentPos.z = actorState->currentPos.z; + add_xz_vec3f(&actorState->curPos, actorState->speed, actorState->angle); + actor->curPos.x = actorState->curPos.x; + actor->curPos.y = actorState->curPos.y; + actor->curPos.z = actorState->curPos.z; break; case 3: return ApiStatus_DONE2; } - actor->currentPos.x = actorState->currentPos.x; - actor->currentPos.y = actorState->currentPos.y; - actor->currentPos.z = actorState->currentPos.z; + actor->curPos.x = actorState->curPos.x; + actor->curPos.y = actorState->curPos.y; + actor->curPos.z = actorState->curPos.z; return ApiStatus_BLOCK; } @@ -1415,24 +1415,24 @@ ApiStatus LandJump(Evt* script, s32 isInitialCall) { actor = get_actor(actorID); script->functionTempPtr[1] = actor; - actor->state.currentPos.x = actor->currentPos.x; - actor->state.currentPos.y = actor->currentPos.y; - actor->state.currentPos.z = actor->currentPos.z; + actor->state.curPos.x = actor->curPos.x; + actor->state.curPos.y = actor->curPos.y; + actor->state.curPos.z = actor->curPos.z; script->functionTemp[0] = TRUE; } actor = script->functionTempPtr[1]; - actor->state.currentPos.y += actor->state.velocity; - actor->state.velocity -= actor->state.acceleration; + actor->state.curPos.y += actor->state.vel; + actor->state.vel -= actor->state.acceleration; - add_xz_vec3f(&actor->state.currentPos, actor->state.speed, actor->state.angle); - actor->currentPos.x = actor->state.currentPos.x; - actor->currentPos.y = actor->state.currentPos.y; - actor->currentPos.z = actor->state.currentPos.z; + add_xz_vec3f(&actor->state.curPos, actor->state.speed, actor->state.angle); + actor->curPos.x = actor->state.curPos.x; + actor->curPos.y = actor->state.curPos.y; + actor->curPos.z = actor->state.curPos.z; - if (actor->currentPos.y < 0.0f) { - actor->currentPos.y = 0.0f; - play_movement_dust_effects(2, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z, actor->yaw); + if (actor->curPos.y < 0.0f) { + actor->curPos.y = 0.0f; + play_movement_dust_effects(2, actor->curPos.x, actor->curPos.y, actor->curPos.z, actor->yaw); return ApiStatus_DONE1; } @@ -1462,19 +1462,19 @@ ApiStatus FallToGoal(Evt* script, s32 isInitialCall) { actor->state.moveTime = evt_get_variable(script, *args++); - actor->state.currentPos.x = actor->currentPos.x; - actor->state.currentPos.y = actor->currentPos.y; - actor->state.currentPos.z = actor->currentPos.z; + actor->state.curPos.x = actor->curPos.x; + actor->state.curPos.y = actor->curPos.y; + actor->state.curPos.z = actor->curPos.z; - posX = actor->state.currentPos.x; - posY = actor->state.currentPos.y; - posZ = actor->state.currentPos.z; + posX = actor->state.curPos.x; + posY = actor->state.curPos.y; + posZ = actor->state.curPos.z; goalX = actor->state.goalPos.x; goalY = actor->state.goalPos.y; goalZ = actor->state.goalPos.z; actor->state.angle = atan2(posX, posZ, goalX, goalZ); - actor->state.distance = dist2D(posX, posZ, goalX, goalZ); + actor->state.dist = dist2D(posX, posZ, goalX, goalZ); // make relative posX = (goalX - posX); @@ -1482,34 +1482,34 @@ ApiStatus FallToGoal(Evt* script, s32 isInitialCall) { posZ = (goalZ - posZ); if (actor->state.moveTime == 0) { - actor->state.moveTime = actor->state.distance / actor->state.speed; + actor->state.moveTime = actor->state.dist / actor->state.speed; } else { - actor->state.speed = actor->state.distance / actor->state.moveTime; + actor->state.speed = actor->state.dist / actor->state.moveTime; } - state->velocity = 0.0f; - state->acceleration = (posY / state->moveTime - state->velocity) / (-state->moveTime * 0.5); + state->vel = 0.0f; + state->acceleration = (posY / state->moveTime - state->vel) / (-state->moveTime * 0.5); if (actor->actorTypeData1[4] != 0) { - sfx_play_sound_at_position(actor->actorTypeData1[4], SOUND_SPACE_MODE_0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z); + sfx_play_sound_at_position(actor->actorTypeData1[4], SOUND_SPACE_MODE_0, actor->curPos.x, actor->curPos.y, actor->curPos.z); } script->functionTemp[0] = 1; } actor = script->functionTempPtr[1]; - actor->state.currentPos.y += actor->state.velocity; - actor->state.velocity -= actor->state.acceleration; - add_xz_vec3f(&actor->state.currentPos, actor->state.speed, actor->state.angle); - actor->currentPos.x = actor->state.currentPos.x; - actor->currentPos.y = actor->state.currentPos.y; - actor->currentPos.z = actor->state.currentPos.z; + actor->state.curPos.y += actor->state.vel; + actor->state.vel -= actor->state.acceleration; + add_xz_vec3f(&actor->state.curPos, actor->state.speed, actor->state.angle); + actor->curPos.x = actor->state.curPos.x; + actor->curPos.y = actor->state.curPos.y; + actor->curPos.z = actor->state.curPos.z; actor->state.moveTime--; if (actor->state.moveTime <= 0) { play_movement_dust_effects(2, actor->state.goalPos.x, actor->state.goalPos.y, actor->state.goalPos.z, actor->state.angle); - actor->currentPos.x = actor->state.goalPos.x; - actor->currentPos.y = actor->state.goalPos.y; - actor->currentPos.z = actor->state.goalPos.z; + actor->curPos.x = actor->state.goalPos.x; + actor->curPos.y = actor->state.goalPos.y; + actor->curPos.z = actor->state.goalPos.z; return ApiStatus_DONE1; } else { return ApiStatus_BLOCK; @@ -1539,41 +1539,41 @@ ApiStatus RunToGoal(Evt* script, s32 isInitialCall) { actorState->moveTime = evt_get_variable(script, *args++); script->functionTemp[2] = evt_get_variable(script, *args++); - actorState->currentPos.x = actor->currentPos.x; - actorState->currentPos.y = actor->currentPos.y; - actorState->currentPos.z = actor->currentPos.z; + actorState->curPos.x = actor->curPos.x; + actorState->curPos.y = actor->curPos.y; + actorState->curPos.z = actor->curPos.z; goalX = actorState->goalPos.x; goalY = actorState->goalPos.y; goalZ = actorState->goalPos.z; - posX = actorState->currentPos.x; - posY = actorState->currentPos.y; - posZ = actorState->currentPos.z; + posX = actorState->curPos.x; + posY = actorState->curPos.y; + posZ = actorState->curPos.z; actorState->unk_18.x = goalX; actorState->unk_18.y = goalY; actorState->unk_18.z = goalZ; actorState->angle = atan2(posX, posZ, goalX, goalZ); - actorState->distance = dist2D(posX, posZ, goalX, goalZ); + actorState->dist = dist2D(posX, posZ, goalX, goalZ); if (actorState->moveTime == 0) { - actorState->moveTime = actorState->distance / actorState->speed; + actorState->moveTime = actorState->dist / actorState->speed; if (actorState->moveTime == 0) { actorState->moveTime = 1; } - actorState->speed += (actorState->distance - (actorState->moveTime * actorState->speed)) / actorState->moveTime; + actorState->speed += (actorState->dist - (actorState->moveTime * actorState->speed)) / actorState->moveTime; } else { - actorState->speed = actorState->distance / actorState->moveTime; + actorState->speed = actorState->dist / actorState->moveTime; } if (actor->actorTypeData1b[0] >= 0) { - actorState->distance = actor->actorTypeData1b[0] + 1; + actorState->dist = actor->actorTypeData1b[0] + 1; } else { - actorState->distance = ~actor->actorTypeData1b[0]; //TODO optimization? + actorState->dist = ~actor->actorTypeData1b[0]; //TODO optimization? } if ((actor->actorTypeData1[0] != 0) && (actor->actorTypeData1[1] == 0)) { - sfx_play_sound_at_position(actor->actorTypeData1[0], SOUND_SPACE_MODE_0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z); + sfx_play_sound_at_position(actor->actorTypeData1[0], SOUND_SPACE_MODE_0, actor->curPos.x, actor->curPos.y, actor->curPos.z); } script->functionTemp[0] = TRUE; } @@ -1581,45 +1581,45 @@ ApiStatus RunToGoal(Evt* script, s32 isInitialCall) { actor = script->functionTempPtr[1]; actorState = &actor->state; - add_xz_vec3f(&actorState->currentPos, actorState->speed, actorState->angle); + add_xz_vec3f(&actorState->curPos, actorState->speed, actorState->angle); if (script->functionTemp[2] == 0) { if (actorState->speed < 4.0f) { - play_movement_dust_effects(0, actorState->currentPos.x, actorState->currentPos.y, actorState->currentPos.z, actorState->angle); + play_movement_dust_effects(0, actorState->curPos.x, actorState->curPos.y, actorState->curPos.z, actorState->angle); } else { - play_movement_dust_effects(1, actorState->currentPos.x, actorState->currentPos.y, actorState->currentPos.z, actorState->angle); + play_movement_dust_effects(1, actorState->curPos.x, actorState->curPos.y, actorState->curPos.z, actorState->angle); } } - actor->currentPos.x = actorState->currentPos.x; - actor->currentPos.z = actorState->currentPos.z; + actor->curPos.x = actorState->curPos.x; + actor->curPos.z = actorState->curPos.z; if ((actor->actorTypeData1[0] != 0) && (actor->actorTypeData1[1] != 0)) { if (actor->actorTypeData1b[0] >= 0) { - actorState->distance += actorState->speed; - if (actor->actorTypeData1b[0] < actorState->distance) { + actorState->dist += actorState->speed; + if (actor->actorTypeData1b[0] < actorState->dist) { actor->footStepCounter++; - actorState->distance = 0.0f; + actorState->dist = 0.0f; if (actor->footStepCounter & 1) { if (actor->actorTypeData1[0] != 0) { - sfx_play_sound_at_position(actor->actorTypeData1[0], SOUND_SPACE_MODE_0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z); + sfx_play_sound_at_position(actor->actorTypeData1[0], SOUND_SPACE_MODE_0, actor->curPos.x, actor->curPos.y, actor->curPos.z); } } else { if (actor->actorTypeData1[1] != 0) { - sfx_play_sound_at_position(actor->actorTypeData1[1], SOUND_SPACE_MODE_0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z); + sfx_play_sound_at_position(actor->actorTypeData1[1], SOUND_SPACE_MODE_0, actor->curPos.x, actor->curPos.y, actor->curPos.z); } } } } else { - actorState->distance += 1.0f; - if (-actor->actorTypeData1b[0] <= actorState->distance) { + actorState->dist += 1.0f; + if (-actor->actorTypeData1b[0] <= actorState->dist) { actor->footStepCounter++; - actorState->distance = 0.0f; + actorState->dist = 0.0f; if (actor->footStepCounter & 1) { if (actor->actorTypeData1[0] != 0) { - sfx_play_sound_at_position(actor->actorTypeData1[0], SOUND_SPACE_MODE_0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z); + sfx_play_sound_at_position(actor->actorTypeData1[0], SOUND_SPACE_MODE_0, actor->curPos.x, actor->curPos.y, actor->curPos.z); } } else { if (actor->actorTypeData1[1] != 0) { - sfx_play_sound_at_position(actor->actorTypeData1[1], SOUND_SPACE_MODE_0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z); + sfx_play_sound_at_position(actor->actorTypeData1[1], SOUND_SPACE_MODE_0, actor->curPos.x, actor->curPos.y, actor->curPos.z); } } } @@ -1631,8 +1631,8 @@ ApiStatus RunToGoal(Evt* script, s32 isInitialCall) { return ApiStatus_BLOCK; } - actor->currentPos.x = actorState->unk_18.x; - actor->currentPos.z = actorState->unk_18.z; + actor->curPos.x = actorState->unk_18.x; + actor->curPos.z = actorState->unk_18.z; if (actor->actorTypeData1[0] != 0) { if (actor->actorTypeData1[1] == 0) { snd_stop_sound(actor->actorTypeData1[0]); @@ -1663,40 +1663,40 @@ ApiStatus IdleRunToGoal(Evt* script, s32 isInitialCall) { movement->flyTime = evt_get_variable(script, *args++); - movement->currentPos.x = actor->currentPos.x; - movement->currentPos.y = actor->currentPos.y; - movement->currentPos.z = actor->currentPos.z; + movement->curPos.x = actor->curPos.x; + movement->curPos.y = actor->curPos.y; + movement->curPos.z = actor->curPos.z; goalX = movement->goalPos.x; goalY = movement->goalPos.y; goalZ = movement->goalPos.z; - posX = movement->currentPos.x; - posY = movement->currentPos.y; - posZ = movement->currentPos.z; + posX = movement->curPos.x; + posY = movement->curPos.y; + posZ = movement->curPos.z; movement->unk_18.x = goalX; movement->unk_18.y = goalY; movement->unk_18.z = goalZ; movement->angle = atan2(posX, posZ, goalX, goalZ); - movement->distance = dist2D(posX, posZ, goalX, goalZ); + movement->dist = dist2D(posX, posZ, goalX, goalZ); if (movement->flyTime == 0) { - movement->flyTime = movement->distance / movement->speed; + movement->flyTime = movement->dist / movement->speed; if (movement->flyTime == 0) { movement->flyTime = 1; } // this simplifies to: flyMotion->speed = flyMotion->distance / flyMotion->flyTime - movement->speed += (movement->distance - movement->flyTime * movement->speed) / movement->flyTime; + movement->speed += (movement->dist - movement->flyTime * movement->speed) / movement->flyTime; } else { - movement->speed = movement->distance / movement->flyTime; + movement->speed = movement->dist / movement->flyTime; } if (actor->actorTypeData1b[0] >= 0) { - movement->distance = actor->actorTypeData1b[0] + 1; + movement->dist = actor->actorTypeData1b[0] + 1; } else { - movement->distance = ~actor->actorTypeData1b[0]; + movement->dist = ~actor->actorTypeData1b[0]; } script->functionTemp[0] = TRUE; } @@ -1704,22 +1704,22 @@ ApiStatus IdleRunToGoal(Evt* script, s32 isInitialCall) { actor = script->functionTempPtr[1]; movement = &actor->fly; - add_xz_vec3f_copy2(&movement->currentPos, movement->speed, movement->angle); + add_xz_vec3f_copy2(&movement->curPos, movement->speed, movement->angle); if (movement->speed < 4.0f) { - play_movement_dust_effects(0, movement->currentPos.x, movement->currentPos.y, movement->currentPos.z, movement->angle); + play_movement_dust_effects(0, movement->curPos.x, movement->curPos.y, movement->curPos.z, movement->angle); } else { - play_movement_dust_effects(1, movement->currentPos.x, movement->currentPos.y, movement->currentPos.z, movement->angle); + play_movement_dust_effects(1, movement->curPos.x, movement->curPos.y, movement->curPos.z, movement->angle); } - actor->currentPos.x = movement->currentPos.x; - actor->currentPos.z = movement->currentPos.z; + actor->curPos.x = movement->curPos.x; + actor->curPos.z = movement->curPos.z; movement->flyTime--; if (movement->flyTime > 0) { return ApiStatus_BLOCK; } - actor->currentPos.x = movement->unk_18.x; - actor->currentPos.z = movement->unk_18.z; + actor->curPos.x = movement->unk_18.x; + actor->curPos.z = movement->unk_18.z; if (actor->actorTypeData1[0] != 0 && actor->actorTypeData1[1] == 0) { snd_stop_sound(actor->actorTypeData1[0]); } @@ -1766,16 +1766,16 @@ ApiStatus JumpPartTo(Evt* script, s32 isInitialCall) { goalY = movement->goalPos.y; goalZ = movement->goalPos.z; - movement->absolutePosition.x = part->absolutePosition.x; - movement->absolutePosition.y = part->absolutePosition.y; - movement->absolutePosition.z = part->absolutePosition.z; + movement->absolutePos.x = part->absolutePos.x; + movement->absolutePos.y = part->absolutePos.y; + movement->absolutePos.z = part->absolutePos.z; - posX = movement->absolutePosition.x; - posY = movement->absolutePosition.y; - posZ = movement->absolutePosition.z; + posX = movement->absolutePos.x; + posY = movement->absolutePos.y; + posZ = movement->absolutePos.z; movement->angle = atan2(posX, posZ, goalX, goalZ); - movement->distance = dist2D(posX, posZ, goalX, goalZ); + movement->dist = dist2D(posX, posZ, goalX, goalZ); // make relative posX = (goalX - posX); @@ -1783,37 +1783,37 @@ ApiStatus JumpPartTo(Evt* script, s32 isInitialCall) { posZ = (goalZ - posZ); if (movement->moveTime == 0) { - movement->moveTime = movement->distance / movement->moveSpeed; - deltaDist = movement->distance - movement->moveTime * movement->moveSpeed; + movement->moveTime = movement->dist / movement->moveSpeed; + deltaDist = movement->dist - movement->moveTime * movement->moveSpeed; } else { - movement->moveSpeed = movement->distance / movement->moveTime; - deltaDist = movement->distance - movement->moveTime * movement->moveSpeed; + movement->moveSpeed = movement->dist / movement->moveTime; + deltaDist = movement->dist - movement->moveTime * movement->moveSpeed; } movement->moveSpeed += deltaDist / movement->moveTime; movement->unk_2C = movement->jumpScale * movement->moveTime * 0.5f + posY / movement->moveTime; if (part->partTypeData[4] != 0) { - sfx_play_sound_at_position(part->partTypeData[4], SOUND_SPACE_MODE_0, part->absolutePosition.x, part->absolutePosition.y, part->absolutePosition.z); + sfx_play_sound_at_position(part->partTypeData[4], SOUND_SPACE_MODE_0, part->absolutePos.x, part->absolutePos.y, part->absolutePos.z); } script->functionTemp[0] = 1; } part = script->functionTempPtr[2]; movement = part->movement; - movement->absolutePosition.y += movement->unk_2C; + movement->absolutePos.y += movement->unk_2C; movement->unk_2C -= movement->jumpScale; - add_xz_vec3f_copy1(&movement->absolutePosition, movement->moveSpeed, movement->angle); - part->absolutePosition.x = movement->absolutePosition.x; - part->absolutePosition.y = movement->absolutePosition.y; - part->absolutePosition.z = movement->absolutePosition.z; + add_xz_vec3f_copy1(&movement->absolutePos, movement->moveSpeed, movement->angle); + part->absolutePos.x = movement->absolutePos.x; + part->absolutePos.y = movement->absolutePos.y; + part->absolutePos.z = movement->absolutePos.z; movement->moveTime--; if (movement->moveTime <= 0) { if (script->functionTemp[3] != 0) { play_movement_dust_effects(2, movement->goalPos.x, movement->goalPos.y, movement->goalPos.z, movement->angle); } - part->absolutePosition.x = movement->goalPos.x; - part->absolutePosition.y = movement->goalPos.y; - part->absolutePosition.z = movement->goalPos.z; + part->absolutePos.x = movement->goalPos.x; + part->absolutePos.y = movement->goalPos.y; + part->absolutePos.z = movement->goalPos.z; return ApiStatus_DONE1; } else { return ApiStatus_BLOCK; @@ -1858,16 +1858,16 @@ ApiStatus FallPartTo(Evt* script, s32 isInitialCall) { goalY = movement->goalPos.y; goalZ = movement->goalPos.z; - movement->absolutePosition.x = part->absolutePosition.x; - movement->absolutePosition.y = part->absolutePosition.y; - movement->absolutePosition.z = part->absolutePosition.z; + movement->absolutePos.x = part->absolutePos.x; + movement->absolutePos.y = part->absolutePos.y; + movement->absolutePos.z = part->absolutePos.z; - posX = movement->absolutePosition.x; - posY = movement->absolutePosition.y; - posZ = movement->absolutePosition.z; + posX = movement->absolutePos.x; + posY = movement->absolutePos.y; + posZ = movement->absolutePos.z; movement->angle = atan2(posX, posZ, goalX, goalZ); - movement->distance = dist2D(posX, posZ, goalX, goalZ); + movement->dist = dist2D(posX, posZ, goalX, goalZ); // make relative posX = (goalX - posX); @@ -1875,34 +1875,34 @@ ApiStatus FallPartTo(Evt* script, s32 isInitialCall) { posZ = (goalZ - posZ); if (movement->moveTime == 0) { - movement->moveTime = movement->distance / movement->moveSpeed; + movement->moveTime = movement->dist / movement->moveSpeed; } else { - movement->moveSpeed = movement->distance / movement->moveTime; + movement->moveSpeed = movement->dist / movement->moveTime; } movement->unk_2C = 0.0f; movement->jumpScale = (posY / movement->moveTime - movement->unk_2C) / (-movement->moveTime * 0.5); if (part->partTypeData[4] != 0) { - sfx_play_sound_at_position(part->partTypeData[4], SOUND_SPACE_MODE_0, part->absolutePosition.x, part->absolutePosition.y, part->absolutePosition.z); + sfx_play_sound_at_position(part->partTypeData[4], SOUND_SPACE_MODE_0, part->absolutePos.x, part->absolutePos.y, part->absolutePos.z); } script->functionTemp[0] = 1; } part = script->functionTempPtr[2]; movement = part->movement; - movement->absolutePosition.y += movement->unk_2C; + movement->absolutePos.y += movement->unk_2C; movement->unk_2C -= movement->jumpScale; - add_xz_vec3f_copy1(&movement->absolutePosition, movement->moveSpeed, movement->angle); - part->absolutePosition.x = movement->absolutePosition.x; - part->absolutePosition.y = movement->absolutePosition.y; - part->absolutePosition.z = movement->absolutePosition.z; + add_xz_vec3f_copy1(&movement->absolutePos, movement->moveSpeed, movement->angle); + part->absolutePos.x = movement->absolutePos.x; + part->absolutePos.y = movement->absolutePos.y; + part->absolutePos.z = movement->absolutePos.z; movement->moveTime--; if (movement->moveTime <= 0) { play_movement_dust_effects(2, movement->goalPos.x, movement->goalPos.y, movement->goalPos.z, movement->angle); - part->absolutePosition.x = movement->goalPos.x; - part->absolutePosition.y = movement->goalPos.y; - part->absolutePosition.z = movement->goalPos.z; + part->absolutePos.x = movement->goalPos.x; + part->absolutePos.y = movement->goalPos.y; + part->absolutePos.z = movement->goalPos.z; return ApiStatus_DONE1; } else { return ApiStatus_BLOCK; @@ -1932,24 +1932,24 @@ ApiStatus LandJumpPart(Evt* script, s32 isInitialCall) { script->functionTempPtr[1] = actor; script->functionTempPtr[2] = part; movement = part->movement; - movement->absolutePosition.x = part->absolutePosition.x; - movement->absolutePosition.y = part->absolutePosition.y; - movement->absolutePosition.z = part->absolutePosition.z; + movement->absolutePos.x = part->absolutePos.x; + movement->absolutePos.y = part->absolutePos.y; + movement->absolutePos.z = part->absolutePos.z; script->functionTemp[0] = 1; } part = script->functionTempPtr[2]; movement = part->movement; - movement->absolutePosition.y += movement->unk_2C; + movement->absolutePos.y += movement->unk_2C; movement->unk_2C -= movement->jumpScale; - add_xz_vec3f_copy1(&movement->absolutePosition, movement->moveSpeed, movement->angle); - part->absolutePosition.x = movement->absolutePosition.x; - part->absolutePosition.y = movement->absolutePosition.y; - part->absolutePosition.z = movement->absolutePosition.z; - - if (part->absolutePosition.y < 0.0f) { - part->absolutePosition.y = 0.0f; - play_movement_dust_effects(2, part->absolutePosition.x, part->absolutePosition.y, part->absolutePosition.z, part->yaw); + add_xz_vec3f_copy1(&movement->absolutePos, movement->moveSpeed, movement->angle); + part->absolutePos.x = movement->absolutePos.x; + part->absolutePos.y = movement->absolutePos.y; + part->absolutePos.z = movement->absolutePos.z; + + if (part->absolutePos.y < 0.0f) { + part->absolutePos.y = 0.0f; + play_movement_dust_effects(2, part->absolutePos.x, part->absolutePos.y, part->absolutePos.z, part->yaw); return ApiStatus_DONE1; } @@ -1995,29 +1995,29 @@ ApiStatus RunPartTo(Evt* script, s32 isInitialCall) { goalY = movement->goalPos.y; goalZ = movement->goalPos.z; - movement->absolutePosition.x = part->absolutePosition.x; - movement->absolutePosition.y = part->absolutePosition.y; - movement->absolutePosition.z = part->absolutePosition.z; + movement->absolutePos.x = part->absolutePos.x; + movement->absolutePos.y = part->absolutePos.y; + movement->absolutePos.z = part->absolutePos.z; - posX = movement->absolutePosition.x; - posY = movement->absolutePosition.y; - posZ = movement->absolutePosition.z; + posX = movement->absolutePos.x; + posY = movement->absolutePos.y; + posZ = movement->absolutePos.z; movement->angle = atan2(posX, posZ, goalX, goalZ); - movement->distance = dist2D(posX, posZ, goalX, goalZ); + movement->dist = dist2D(posX, posZ, goalX, goalZ); if (movement->moveTime == 0) { - movement->moveTime = movement->distance / movement->moveSpeed; + movement->moveTime = movement->dist / movement->moveSpeed; } else { - movement->moveSpeed = movement->distance / movement->moveTime; + movement->moveSpeed = movement->dist / movement->moveTime; } if (part->actorTypeData2b[0] >= 0) { - movement->distance = part->actorTypeData2b[0] + 1; + movement->dist = part->actorTypeData2b[0] + 1; } else { - movement->distance = ~part->actorTypeData2b[0]; + movement->dist = ~part->actorTypeData2b[0]; } if (part->partTypeData[0] != 0 && part->partTypeData[1] == 0) { - sfx_play_sound_at_position(part->partTypeData[0], SOUND_SPACE_MODE_0, part->absolutePosition.x, part->absolutePosition.y, part->absolutePosition.z); + sfx_play_sound_at_position(part->partTypeData[0], SOUND_SPACE_MODE_0, part->absolutePos.x, part->absolutePos.y, part->absolutePos.z); } script->functionTemp[0] = 1; } @@ -2026,44 +2026,44 @@ ApiStatus RunPartTo(Evt* script, s32 isInitialCall) { movement = part->movement; actor = script->functionTempPtr[1]; - add_xz_vec3f_copy1(&movement->absolutePosition, movement->moveSpeed, movement->angle); + add_xz_vec3f_copy1(&movement->absolutePos, movement->moveSpeed, movement->angle); if (movement->moveSpeed < 4.0f) { - play_movement_dust_effects(0, movement->absolutePosition.x, movement->absolutePosition.y, movement->absolutePosition.z, movement->angle); + play_movement_dust_effects(0, movement->absolutePos.x, movement->absolutePos.y, movement->absolutePos.z, movement->angle); } else { - play_movement_dust_effects(1, movement->absolutePosition.x, movement->absolutePosition.y, movement->absolutePosition.z, movement->angle); + play_movement_dust_effects(1, movement->absolutePos.x, movement->absolutePos.y, movement->absolutePos.z, movement->angle); } - part->absolutePosition.x = movement->absolutePosition.x; - part->absolutePosition.y = movement->absolutePosition.y; - part->absolutePosition.z = movement->absolutePosition.z; + part->absolutePos.x = movement->absolutePos.x; + part->absolutePos.y = movement->absolutePos.y; + part->absolutePos.z = movement->absolutePos.z; if (part->partTypeData[0] != 0 && part->partTypeData[1] != 0) { if (part->actorTypeData2b[0] >= 0) { - movement->distance += movement->moveSpeed; - if (part->actorTypeData2b[0] < movement->distance) { + movement->dist += movement->moveSpeed; + if (part->actorTypeData2b[0] < movement->dist) { actor->footStepCounter++; - movement->distance = 0; + movement->dist = 0; if (actor->footStepCounter % 2 != 0) { if (part->partTypeData[0] != 0) { - sfx_play_sound_at_position(part->partTypeData[0], SOUND_SPACE_MODE_0, part->absolutePosition.x, part->absolutePosition.y, part->absolutePosition.z); + sfx_play_sound_at_position(part->partTypeData[0], SOUND_SPACE_MODE_0, part->absolutePos.x, part->absolutePos.y, part->absolutePos.z); } } else { if (part->partTypeData[1] != 0) { - sfx_play_sound_at_position(part->partTypeData[1], SOUND_SPACE_MODE_0, part->absolutePosition.x, part->absolutePosition.y, part->absolutePosition.z); + sfx_play_sound_at_position(part->partTypeData[1], SOUND_SPACE_MODE_0, part->absolutePos.x, part->absolutePos.y, part->absolutePos.z); } } } } else { - movement->distance += 1.0f; - if (-part->actorTypeData2b[0] <= movement->distance) { + movement->dist += 1.0f; + if (-part->actorTypeData2b[0] <= movement->dist) { actor->footStepCounter++; - movement->distance = 0; + movement->dist = 0; if (actor->footStepCounter % 2 != 0) { if (part->partTypeData[0] != 0) { - sfx_play_sound_at_position(part->partTypeData[0], SOUND_SPACE_MODE_0, part->absolutePosition.x, part->absolutePosition.y, part->absolutePosition.z); + sfx_play_sound_at_position(part->partTypeData[0], SOUND_SPACE_MODE_0, part->absolutePos.x, part->absolutePos.y, part->absolutePos.z); } } else { if (part->partTypeData[1] != 0) { - sfx_play_sound_at_position(part->partTypeData[1], SOUND_SPACE_MODE_0, part->absolutePosition.x, part->absolutePosition.y, part->absolutePosition.z); + sfx_play_sound_at_position(part->partTypeData[1], SOUND_SPACE_MODE_0, part->absolutePos.x, part->absolutePos.y, part->absolutePos.z); } } } @@ -2074,8 +2074,8 @@ ApiStatus RunPartTo(Evt* script, s32 isInitialCall) { if (movement->moveTime > 0) { return ApiStatus_BLOCK; } else { - part->absolutePosition.x = movement->goalPos.x; - part->absolutePosition.z = movement->goalPos.z; + part->absolutePos.x = movement->goalPos.x; + part->absolutePos.z = movement->goalPos.z; if (part->partTypeData[0] != 0 && part->partTypeData[1] == 0) { snd_stop_sound(part->partTypeData[0]); } @@ -2180,27 +2180,27 @@ ApiStatus FlyToGoal(Evt* script, s32 isInitialCall) { goalY = actorState->goalPos.y; goalZ = actorState->goalPos.z; - posX = actor->currentPos.x; - posY = actor->currentPos.y; - posZ = actor->currentPos.z; + posX = actor->curPos.x; + posY = actor->curPos.y; + posZ = actor->curPos.z; deltaX = posX - goalX; deltaY = posY - goalY; deltaZ = posZ - goalZ; - actorState->currentPos.x = posX; + actorState->curPos.x = posX; actorState->unk_18.x = posX; - actorState->currentPos.y = posY; + actorState->curPos.y = posY; actorState->unk_18.y = posY; - actorState->currentPos.z = posZ; + actorState->curPos.z = posZ; actorState->unk_18.z = posZ; - actorState->distance = sqrtf(SQ(deltaX) + SQ(deltaY) + SQ(deltaZ)); + actorState->dist = sqrtf(SQ(deltaX) + SQ(deltaY) + SQ(deltaZ)); if (actorState->moveTime == 0) { - actorState->moveTime = actorState->distance / actorState->speed; + actorState->moveTime = actorState->dist / actorState->speed; } else { - actorState->speed = actorState->distance / actorState->moveTime; + actorState->speed = actorState->dist / actorState->moveTime; } if (actorState->moveTime == 0) { return ApiStatus_DONE2; @@ -2209,32 +2209,32 @@ ApiStatus FlyToGoal(Evt* script, s32 isInitialCall) { actorState->bounceDivisor = 0.0f; actorState->angle = 0.0f; if (actor->actorTypeData1b[1] >= 0) { - actorState->velocity = actor->actorTypeData1b[1] + 1; + actorState->vel = actor->actorTypeData1b[1] + 1; } else { - actorState->velocity = ~actor->actorTypeData1b[1]; + actorState->vel = ~actor->actorTypeData1b[1]; } if ((actor->actorTypeData1[2] != 0) && (actor->actorTypeData1[3] == 0)) { - sfx_play_sound_at_position(actor->actorTypeData1[2], SOUND_SPACE_MODE_0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z); + sfx_play_sound_at_position(actor->actorTypeData1[2], SOUND_SPACE_MODE_0, actor->curPos.x, actor->curPos.y, actor->curPos.z); } } actor = script->functionTempPtr[1]; actorState = &actor->state; - actorState->currentPos.x = update_lerp_battle(script->functionTemp[3], actorState->unk_18.x, actorState->goalPos.x, actorState->bounceDivisor, actorState->moveTime); - actorState->currentPos.y = update_lerp_battle(script->functionTemp[3], actorState->unk_18.y, actorState->goalPos.y, actorState->bounceDivisor, actorState->moveTime); - actorState->currentPos.z = update_lerp_battle(script->functionTemp[3], actorState->unk_18.z, actorState->goalPos.z, actorState->bounceDivisor, actorState->moveTime); - if ((actorState->functionTemp[0]) && (actorState->currentPos.y < 0.0f)) { + actorState->curPos.x = update_lerp_battle(script->functionTemp[3], actorState->unk_18.x, actorState->goalPos.x, actorState->bounceDivisor, actorState->moveTime); + actorState->curPos.y = update_lerp_battle(script->functionTemp[3], actorState->unk_18.y, actorState->goalPos.y, actorState->bounceDivisor, actorState->moveTime); + actorState->curPos.z = update_lerp_battle(script->functionTemp[3], actorState->unk_18.z, actorState->goalPos.z, actorState->bounceDivisor, actorState->moveTime); + if ((actorState->functionTemp[0]) && (actorState->curPos.y < 0.0f)) { actorState->bounceDivisor = actorState->moveTime; - actorState->goalPos.x = actorState->currentPos.x; + actorState->goalPos.x = actorState->curPos.x; actorState->goalPos.y = 0.0f; - actorState->goalPos.z = actorState->currentPos.z; + actorState->goalPos.z = actorState->curPos.z; } actorState->bounceDivisor += 1.0f; if (actorState->moveTime < actorState->bounceDivisor) { - actor->currentPos.x = actorState->goalPos.x; - actor->currentPos.y = actorState->goalPos.y; - actor->currentPos.z = actorState->goalPos.z; + actor->curPos.x = actorState->goalPos.x; + actor->curPos.y = actorState->goalPos.y; + actor->curPos.z = actorState->goalPos.z; if (actor->actorTypeData1[2] != 0) { if (actor->actorTypeData1[3] == 0) { snd_stop_sound(actor->actorTypeData1[2]); @@ -2244,49 +2244,49 @@ ApiStatus FlyToGoal(Evt* script, s32 isInitialCall) { } if ((actor->actorTypeData1[2] != 0) && (actor->actorTypeData1[3] != 0)) { if (actor->actorTypeData1b[1] >= 0) { - actorState->velocity += actorState->speed; - if (actor->actorTypeData1b[1] < actorState->velocity) { + actorState->vel += actorState->speed; + if (actor->actorTypeData1b[1] < actorState->vel) { actor->footStepCounter++; - actorState->velocity = 0.0f; + actorState->vel = 0.0f; if (actor->footStepCounter & 1) { if (actor->actorTypeData1[2] != 0) { - sfx_play_sound_at_position(actor->actorTypeData1[2], SOUND_SPACE_MODE_0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z); + sfx_play_sound_at_position(actor->actorTypeData1[2], SOUND_SPACE_MODE_0, actor->curPos.x, actor->curPos.y, actor->curPos.z); } } else { if (actor->actorTypeData1[3] != 0) { - sfx_play_sound_at_position(actor->actorTypeData1[3], SOUND_SPACE_MODE_0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z); + sfx_play_sound_at_position(actor->actorTypeData1[3], SOUND_SPACE_MODE_0, actor->curPos.x, actor->curPos.y, actor->curPos.z); } } } } else { - actorState->velocity += 1.0f; - if (-actor->actorTypeData1b[1] <= actorState->velocity) { + actorState->vel += 1.0f; + if (-actor->actorTypeData1b[1] <= actorState->vel) { actor->footStepCounter++; - actorState->velocity = 0.0f; + actorState->vel = 0.0f; if (actor->footStepCounter & 1) { if (actor->actorTypeData1[2] != 0) { - sfx_play_sound_at_position(actor->actorTypeData1[2], SOUND_SPACE_MODE_0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z); + sfx_play_sound_at_position(actor->actorTypeData1[2], SOUND_SPACE_MODE_0, actor->curPos.x, actor->curPos.y, actor->curPos.z); } } else { if (actor->actorTypeData1[3] != 0) { - sfx_play_sound_at_position(actor->actorTypeData1[3], SOUND_SPACE_MODE_0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z); + sfx_play_sound_at_position(actor->actorTypeData1[3], SOUND_SPACE_MODE_0, actor->curPos.x, actor->curPos.y, actor->curPos.z); } } } } } - deltaX = actorState->goalPos.x - actorState->currentPos.x; - deltaY = actorState->goalPos.y - actorState->currentPos.y; - deltaZ = actorState->goalPos.z - actorState->currentPos.z; + deltaX = actorState->goalPos.x - actorState->curPos.x; + deltaY = actorState->goalPos.y - actorState->curPos.y; + deltaZ = actorState->goalPos.z - actorState->curPos.z; dist3D = sqrtf(SQ(deltaX) + SQ(deltaY) + SQ(deltaZ)); if (dist3D == 0.0f) { dist3D = 1.0f; } - if (actorState->distance == 0.0f) { - actorState->distance = 1.0f; + if (actorState->dist == 0.0f) { + actorState->dist = 1.0f; } - offsetY = sin_deg((1.0 - (dist3D / actorState->distance)) * 180.0); + offsetY = sin_deg((1.0 - (dist3D / actorState->dist)) * 180.0); if (actorState->moveArcAmplitude == 0) { offsetY = 0.0f; } @@ -2296,9 +2296,9 @@ ApiStatus FlyToGoal(Evt* script, s32 isInitialCall) { if (actorState->moveArcAmplitude > 0) { offsetY = offsetY * actorState->moveArcAmplitude; } - actor->currentPos.x = actorState->currentPos.x; - actor->currentPos.y = actorState->currentPos.y + offsetY; - actor->currentPos.z = actorState->currentPos.z; + actor->curPos.x = actorState->curPos.x; + actor->curPos.y = actorState->curPos.y + offsetY; + actor->curPos.z = actorState->curPos.z; return ApiStatus_BLOCK; } @@ -2329,27 +2329,27 @@ ApiStatus IdleFlyToGoal(Evt* script, s32 isInitialCall) { goalY = movement->goalPos.y; goalZ = movement->goalPos.z; - posX = actor->currentPos.x; - posY = actor->currentPos.y; - posZ = actor->currentPos.z; + posX = actor->curPos.x; + posY = actor->curPos.y; + posZ = actor->curPos.z; deltaX = posX - goalX; deltaY = posY - goalY; deltaZ = posZ - goalZ; - movement->currentPos.x = posX; + movement->curPos.x = posX; movement->unk_18.x = posX; - movement->currentPos.y = posY; + movement->curPos.y = posY; movement->unk_18.y = posY; - movement->currentPos.z = posZ; + movement->curPos.z = posZ; movement->unk_18.z = posZ; - movement->distance = sqrtf(SQ(deltaX) + SQ(deltaY) + SQ(deltaZ)); + movement->dist = sqrtf(SQ(deltaX) + SQ(deltaY) + SQ(deltaZ)); if (movement->flyTime == 0) { - movement->flyTime = movement->distance / movement->speed; + movement->flyTime = movement->dist / movement->speed; } else { - movement->speed = movement->distance / movement->flyTime; + movement->speed = movement->dist / movement->flyTime; } if (movement->flyTime == 0) { return ApiStatus_DONE2; @@ -2357,36 +2357,36 @@ ApiStatus IdleFlyToGoal(Evt* script, s32 isInitialCall) { movement->flyElapsed = 0.0f; movement->angle = 0.0f; - movement->velocity = 0.0f; + movement->vel = 0.0f; } actor = script->functionTempPtr[1]; movement = &actor->fly; - movement->currentPos.x = update_lerp_battle(script->functionTemp[3], movement->unk_18.x, movement->goalPos.x, movement->flyElapsed, movement->flyTime); - movement->currentPos.y = update_lerp_battle(script->functionTemp[3], movement->unk_18.y, movement->goalPos.y, movement->flyElapsed, movement->flyTime); - movement->currentPos.z = update_lerp_battle(script->functionTemp[3], movement->unk_18.z, movement->goalPos.z, movement->flyElapsed, movement->flyTime); + movement->curPos.x = update_lerp_battle(script->functionTemp[3], movement->unk_18.x, movement->goalPos.x, movement->flyElapsed, movement->flyTime); + movement->curPos.y = update_lerp_battle(script->functionTemp[3], movement->unk_18.y, movement->goalPos.y, movement->flyElapsed, movement->flyTime); + movement->curPos.z = update_lerp_battle(script->functionTemp[3], movement->unk_18.z, movement->goalPos.z, movement->flyElapsed, movement->flyTime); movement->flyElapsed += 1.0f; if (movement->flyTime < movement->flyElapsed) { - actor->currentPos.x = movement->goalPos.x; - actor->currentPos.y = movement->goalPos.y; - actor->currentPos.z = movement->goalPos.z; + actor->curPos.x = movement->goalPos.x; + actor->curPos.y = movement->goalPos.y; + actor->curPos.z = movement->goalPos.z; return ApiStatus_DONE2; } - deltaX = movement->goalPos.x - movement->currentPos.x; - deltaY = movement->goalPos.y - movement->currentPos.y; - deltaZ = movement->goalPos.z - movement->currentPos.z; + deltaX = movement->goalPos.x - movement->curPos.x; + deltaY = movement->goalPos.y - movement->curPos.y; + deltaZ = movement->goalPos.z - movement->curPos.z; dist3D = sqrtf(SQ(deltaX) + SQ(deltaY) + SQ(deltaZ)); if (dist3D == 0.0f) { dist3D = 1.0f; } - if (movement->distance == 0.0f) { - movement->distance = 1.0f; + if (movement->dist == 0.0f) { + movement->dist = 1.0f; } - offsetY = sin_deg((1.0 - (dist3D / movement->distance)) * 180.0); + offsetY = sin_deg((1.0 - (dist3D / movement->dist)) * 180.0); if (movement->flyArcAmplitude == 0) { offsetY = 0.0f; } @@ -2397,9 +2397,9 @@ ApiStatus IdleFlyToGoal(Evt* script, s32 isInitialCall) { offsetY = offsetY * movement->flyArcAmplitude; } - actor->currentPos.x = movement->currentPos.x; - actor->currentPos.y = movement->currentPos.y + offsetY; - actor->currentPos.z = movement->currentPos.z; + actor->curPos.x = movement->curPos.x; + actor->curPos.y = movement->curPos.y + offsetY; + actor->curPos.z = movement->curPos.z; return ApiStatus_BLOCK; } @@ -2438,29 +2438,29 @@ ApiStatus FlyPartTo(Evt* script, s32 isInitialCall) { script->functionTemp[3] = evt_get_variable(script, *args++); goalX = partMovement->goalPos.x; - posX = part->absolutePosition.x; + posX = part->absolutePos.x; deltaX = posX - goalX; - partMovement->absolutePosition.x = posX; + partMovement->absolutePos.x = posX; partMovement->unk_18.x = posX; goalY = partMovement->goalPos.y; - posY = part->absolutePosition.y; + posY = part->absolutePos.y; deltaY = posY - goalY; - partMovement->absolutePosition.y = posY; + partMovement->absolutePos.y = posY; partMovement->unk_18.y = posY; goalZ = partMovement->goalPos.z; - posZ = part->absolutePosition.z; + posZ = part->absolutePos.z; deltaZ = posZ - goalZ; - partMovement->absolutePosition.z = posZ; + partMovement->absolutePos.z = posZ; partMovement->unk_18.z = posZ; - partMovement->distance = sqrtf(SQ(deltaX) + SQ(deltaY) + SQ(deltaZ)); + partMovement->dist = sqrtf(SQ(deltaX) + SQ(deltaY) + SQ(deltaZ)); if (partMovement->moveTime == 0) { - partMovement->moveTime = partMovement->distance / partMovement->moveSpeed; + partMovement->moveTime = partMovement->dist / partMovement->moveSpeed; } else { - partMovement->moveSpeed = partMovement->distance / partMovement->moveTime; + partMovement->moveSpeed = partMovement->dist / partMovement->moveTime; } if (partMovement->moveTime == 0) { @@ -2468,7 +2468,7 @@ ApiStatus FlyPartTo(Evt* script, s32 isInitialCall) { } if (part->partTypeData[2] != 0 && part->partTypeData[3] == 0) { - sfx_play_sound_at_position(part->partTypeData[2], SOUND_SPACE_MODE_0, part->absolutePosition.x, part->absolutePosition.y, part->absolutePosition.z); + sfx_play_sound_at_position(part->partTypeData[2], SOUND_SPACE_MODE_0, part->absolutePos.x, part->absolutePos.y, part->absolutePos.z); } partMovement->unk_3C = 0; partMovement->angle = 0.0f; @@ -2483,15 +2483,15 @@ ApiStatus FlyPartTo(Evt* script, s32 isInitialCall) { part = script->functionTempPtr[2]; actor = script->functionTempPtr[1]; partMovement = part->movement; - partMovement->absolutePosition.x = update_lerp_battle(script->functionTemp[3], partMovement->unk_18.x, partMovement->goalPos.x, partMovement->unk_3C, partMovement->moveTime); - partMovement->absolutePosition.y = update_lerp_battle(script->functionTemp[3], partMovement->unk_18.y, partMovement->goalPos.y, partMovement->unk_3C, partMovement->moveTime); - partMovement->absolutePosition.z = update_lerp_battle(script->functionTemp[3], partMovement->unk_18.z, partMovement->goalPos.z, partMovement->unk_3C, partMovement->moveTime); + partMovement->absolutePos.x = update_lerp_battle(script->functionTemp[3], partMovement->unk_18.x, partMovement->goalPos.x, partMovement->unk_3C, partMovement->moveTime); + partMovement->absolutePos.y = update_lerp_battle(script->functionTemp[3], partMovement->unk_18.y, partMovement->goalPos.y, partMovement->unk_3C, partMovement->moveTime); + partMovement->absolutePos.z = update_lerp_battle(script->functionTemp[3], partMovement->unk_18.z, partMovement->goalPos.z, partMovement->unk_3C, partMovement->moveTime); partMovement->unk_3C++; if (partMovement->moveTime < partMovement->unk_3C) { - part->absolutePosition.x = partMovement->goalPos.x; - part->absolutePosition.y = partMovement->goalPos.y; - part->absolutePosition.z = partMovement->goalPos.z; + part->absolutePos.x = partMovement->goalPos.x; + part->absolutePos.y = partMovement->goalPos.y; + part->absolutePos.z = partMovement->goalPos.z; if (part->partTypeData[2] != 0 && part->partTypeData[3] == 0) { snd_stop_sound(part->partTypeData[2]); } @@ -2506,11 +2506,11 @@ ApiStatus FlyPartTo(Evt* script, s32 isInitialCall) { partMovement->unk_2C = 0; if (actor->footStepCounter % 2 != 0) { if (part->partTypeData[2] != 0) { - sfx_play_sound_at_position(part->partTypeData[2], SOUND_SPACE_MODE_0, part->absolutePosition.x, part->absolutePosition.y, part->absolutePosition.z); + sfx_play_sound_at_position(part->partTypeData[2], SOUND_SPACE_MODE_0, part->absolutePos.x, part->absolutePos.y, part->absolutePos.z); } } else { if (part->partTypeData[3] != 0) { - sfx_play_sound_at_position(part->partTypeData[3], SOUND_SPACE_MODE_0, part->absolutePosition.x, part->absolutePosition.y, part->absolutePosition.z); + sfx_play_sound_at_position(part->partTypeData[3], SOUND_SPACE_MODE_0, part->absolutePos.x, part->absolutePos.y, part->absolutePos.z); } } } @@ -2521,29 +2521,29 @@ ApiStatus FlyPartTo(Evt* script, s32 isInitialCall) { partMovement->unk_2C = 0; if (actor->footStepCounter % 2 != 0) { if (part->partTypeData[2] != 0) { - sfx_play_sound_at_position(part->partTypeData[2], SOUND_SPACE_MODE_0, part->absolutePosition.x, part->absolutePosition.y, part->absolutePosition.z); + sfx_play_sound_at_position(part->partTypeData[2], SOUND_SPACE_MODE_0, part->absolutePos.x, part->absolutePos.y, part->absolutePos.z); } } else { if (part->partTypeData[3] != 0) { - sfx_play_sound_at_position(part->partTypeData[3], SOUND_SPACE_MODE_0, part->absolutePosition.x, part->absolutePosition.y, part->absolutePosition.z); + sfx_play_sound_at_position(part->partTypeData[3], SOUND_SPACE_MODE_0, part->absolutePos.x, part->absolutePos.y, part->absolutePos.z); } } } } } - deltaX = partMovement->goalPos.x - partMovement->absolutePosition.x; - deltaY = partMovement->goalPos.y - partMovement->absolutePosition.y; - deltaZ = partMovement->goalPos.z - partMovement->absolutePosition.z; + deltaX = partMovement->goalPos.x - partMovement->absolutePos.x; + deltaY = partMovement->goalPos.y - partMovement->absolutePos.y; + deltaZ = partMovement->goalPos.z - partMovement->absolutePos.z; dist3D = sqrtf(SQ(deltaX) + SQ(deltaY) + SQ(deltaZ)); if (dist3D == 0.0f) { dist3D = 1.0f; } - if (partMovement->distance == 0.0f) { - partMovement->distance = 1.0f; + if (partMovement->dist == 0.0f) { + partMovement->dist = 1.0f; } - offsetY = sin_deg((1.0 - dist3D / partMovement->distance) * 180.0); + offsetY = sin_deg((1.0 - dist3D / partMovement->dist) * 180.0); if (partMovement->unk_3A == 0) { offsetY = 0.0f; } @@ -2554,9 +2554,9 @@ ApiStatus FlyPartTo(Evt* script, s32 isInitialCall) { offsetY = offsetY * partMovement->unk_3A; } - part->absolutePosition.x = partMovement->absolutePosition.x; - part->absolutePosition.y = partMovement->absolutePosition.y + offsetY; - part->absolutePosition.z = partMovement->absolutePosition.z; + part->absolutePos.x = partMovement->absolutePos.x; + part->absolutePos.y = partMovement->absolutePos.y + offsetY; + part->absolutePos.z = partMovement->absolutePos.z; return ApiStatus_BLOCK; } @@ -2604,12 +2604,12 @@ ApiStatus SetEnemyHP(Evt* script, s32 isInitialCall) { newHP = evt_get_variable(script, *args++); actor = get_actor(actorID); - actor->currentHP = newHP; + actor->curHP = newHP; if (newHP > actor->maxHP) { - actor->currentHP = actor->maxHP; + actor->curHP = actor->maxHP; } - actor->healthFraction = (actor->currentHP * 25) / actor->maxHP; + actor->healthFraction = (actor->curHP * 25) / actor->maxHP; return ApiStatus_DONE2; } @@ -2637,7 +2637,7 @@ ApiStatus GetActorHP(Evt* script, s32 isInitialCall) { outVal = 99; break; default: - outVal = actor->currentHP; + outVal = actor->curHP; break; } @@ -2737,7 +2737,7 @@ ApiStatus DropStarPoints(Evt* script, s32 isInitialCall) { for (i = 0; i < numToDrop; i++) { make_item_entity_delayed(ITEM_STAR_POINT, - dropper->currentPos.x, dropper->currentPos.y, dropper->currentPos.z, spawnMode, i, 0); + dropper->curPos.x, dropper->curPos.y, dropper->curPos.z, spawnMode, i, 0); } battleStatus->incrementStarPointDelay = 40; @@ -2829,10 +2829,10 @@ ApiStatus EnemyDamageTarget(Evt* script, s32 isInitialCall) { actor = get_actor(actorID); outVar = *args++; - battleStatus->currentAttackElement = *args++; - battleStatus->currentAttackEventSuppression = *args++; - battleStatus->currentAttackStatus = *args++; - battleStatus->currentAttackDamage = evt_get_variable(script, *args++); + battleStatus->curAttackElement = *args++; + battleStatus->curAttackEventSuppression = *args++; + battleStatus->curAttackStatus = *args++; + battleStatus->curAttackDamage = evt_get_variable(script, *args++); battleFlagsModifier = *args++; if (battleFlagsModifier & BS_FLAGS1_10) { @@ -2862,14 +2862,14 @@ ApiStatus EnemyDamageTarget(Evt* script, s32 isInitialCall) { gBattleStatus.flags1 &= ~BS_FLAGS1_80; } - battleStatus->currentTargetID = actor->targetActorID; - battleStatus->currentTargetPart = actor->targetPartIndex; + battleStatus->curTargetID = actor->targetActorID; + battleStatus->curTargetPart = actor->targetPartIndex; - battleStatus->statusChance = battleStatus->currentAttackStatus & 0xFF; + battleStatus->statusChance = battleStatus->curAttackStatus & 0xFF; if (battleStatus->statusChance == STATUS_KEY_NEVER) { battleStatus->statusChance = 0; } - battleStatus->statusDuration = (battleStatus->currentAttackStatus & 0xF00) >> 8; + battleStatus->statusDuration = (battleStatus->curAttackStatus & 0xF00) >> 8; hitResult = calc_enemy_damage_target(actor); if (hitResult < 0) { @@ -2900,15 +2900,15 @@ ApiStatus EnemyFollowupAfflictTarget(Evt* script, s32 isInitialCall) { actor = get_actor(actorID); outVar = *args++; - battleStatus->currentTargetID = actor->targetActorID; - battleStatus->currentTargetPart = actor->targetPartIndex; - battleStatus->statusChance = battleStatus->currentAttackStatus; + battleStatus->curTargetID = actor->targetActorID; + battleStatus->curTargetPart = actor->targetPartIndex; + battleStatus->statusChance = battleStatus->curAttackStatus; if (battleStatus->statusChance == STATUS_KEY_NEVER) { battleStatus->statusChance = 0; } - anotherBattleStatus->statusDuration = (anotherBattleStatus->currentAttackStatus & 0xF00) >> 8; + anotherBattleStatus->statusDuration = (anotherBattleStatus->curAttackStatus & 0xF00) >> 8; hitResults = calc_enemy_damage_target(actor); if (hitResults < 0) { @@ -2939,10 +2939,10 @@ ApiStatus EnemyTestTarget(Evt* script, s32 isInitialCall) { actor = get_actor(actorID); outVar = *args++; - battleStatus->currentAttackElement = *args++; - battleStatus->currentAttackEventSuppression = 0; - battleStatus->currentAttackStatus = *args++; - battleStatus->currentAttackDamage = evt_get_variable(script, *args++); + battleStatus->curAttackElement = *args++; + battleStatus->curAttackEventSuppression = 0; + battleStatus->curAttackStatus = *args++; + battleStatus->curAttackDamage = evt_get_variable(script, *args++); battleFlagsModifier = *args++; if (battleFlagsModifier & BS_FLAGS1_10) { @@ -2972,17 +2972,17 @@ ApiStatus EnemyTestTarget(Evt* script, s32 isInitialCall) { gBattleStatus.flags1 &= ~BS_FLAGS1_80; } - attackStatus = battleStatus->currentAttackStatus; - battleStatus->currentTargetID = actor->targetActorID; + attackStatus = battleStatus->curAttackStatus; + battleStatus->curTargetID = actor->targetActorID; - battleStatus->currentTargetPart = actor->targetPartIndex; + battleStatus->curTargetPart = actor->targetPartIndex; battleStatus->statusChance = attackStatus; if ((attackStatus & 0xFF) == 0xFF) { battleStatus->statusChance = 0; } - battleStatus->statusDuration = (battleStatus->currentAttackStatus & 0xF00) >> 8; + battleStatus->statusDuration = (battleStatus->curAttackStatus & 0xF00) >> 8; hitResult = calc_enemy_test_target(actor); if (hitResult < 0) { diff --git a/src/1AC760.c b/src/1AC760.c index 35f23c61af5..3728cdc043d 100644 --- a/src/1AC760.c +++ b/src/1AC760.c @@ -48,14 +48,14 @@ void dispatch_event_partner_continue_turn(s8 lastEventType) { HitResult calc_partner_test_enemy(void) { BattleStatus* battleStatus = &gBattleStatus; Actor* partner = battleStatus->partnerActor; - s32 currentTargetID = battleStatus->currentTargetID; - s32 currentTargetPart = battleStatus->currentTargetPart; + s32 currentTargetID = battleStatus->curTargetID; + s32 currentTargetPart = battleStatus->curTargetPart; Actor* target; ActorState* state; ActorPart* part; - battleStatus->currentTargetID2 = battleStatus->currentTargetID; - battleStatus->currentTargetPart2 = battleStatus->currentTargetPart; + battleStatus->curTargetID2 = battleStatus->curTargetID; + battleStatus->curTargetPart2 = battleStatus->curTargetPart; target = get_actor(currentTargetID); state = &partner->state; @@ -75,7 +75,7 @@ HitResult calc_partner_test_enemy(void) { } // check partner jumping on top-spiky enemy (cannot be suppressed) - if ((battleStatus->currentAttackElement & DAMAGE_TYPE_JUMP) + if ((battleStatus->curAttackElement & DAMAGE_TYPE_JUMP) && (part->eventFlags & ACTOR_EVENT_FLAG_SPIKY_TOP) && !(target->flags2 & ACTOR_FLAG_UPSIDE_DOWN) ) { @@ -84,9 +84,9 @@ HitResult calc_partner_test_enemy(void) { } // check partner contacting front-spiky enemy - if (!(battleStatus->currentAttackElement & (DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_JUMP)) + if (!(battleStatus->curAttackElement & (DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_JUMP)) && (part->eventFlags & ACTOR_EVENT_FLAG_SPIKY_FRONT) - && !(battleStatus->currentAttackEventSuppression & SUPPRESS_EVENT_SPIKY_FRONT) + && !(battleStatus->curAttackEventSuppression & SUPPRESS_EVENT_SPIKY_FRONT) && !player_team_is_ability_active(partner, ABILITY_SPIKE_SHIELD) ) { sfx_play_sound_at_position(SOUND_108, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); @@ -96,9 +96,9 @@ HitResult calc_partner_test_enemy(void) { } // check partner contacting fiery enemy - if (!(battleStatus->currentAttackElement & (DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_SMASH)) + if (!(battleStatus->curAttackElement & (DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_SMASH)) && (part->eventFlags & ACTOR_EVENT_FLAG_FIREY) - && !(battleStatus->currentAttackEventSuppression & SUPPRESS_EVENT_BURN_CONTACT) + && !(battleStatus->curAttackEventSuppression & SUPPRESS_EVENT_BURN_CONTACT) ) { sfx_play_sound_at_position(SOUND_HIT_FIRE, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); dispatch_damage_event_partner_1(1, EVENT_BURN_CONTACT); @@ -107,12 +107,12 @@ HitResult calc_partner_test_enemy(void) { } // specifal handling for air lift - if (battleStatus->currentAttackElement & DAMAGE_TYPE_AIR_LIFT) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_AIR_LIFT) { // check partner airlifting top-spiky enemy - if (!(battleStatus->currentAttackElement & DAMAGE_TYPE_NO_CONTACT)) { + if (!(battleStatus->curAttackElement & DAMAGE_TYPE_NO_CONTACT)) { if ((part->eventFlags & ACTOR_EVENT_FLAG_SPIKY_TOP) && !(target->flags & ACTOR_FLAG_UPSIDE_DOWN) - && !(battleStatus->currentAttackEventSuppression & SUPPRESS_EVENT_SPIKY_TOP) + && !(battleStatus->curAttackEventSuppression & SUPPRESS_EVENT_SPIKY_TOP) ) { sfx_play_sound_at_position(SOUND_108, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); dispatch_damage_event_partner_1(1, EVENT_SPIKE_CONTACT); @@ -120,10 +120,10 @@ HitResult calc_partner_test_enemy(void) { return HIT_RESULT_BACKFIRE; } - if (!(battleStatus->currentAttackElement & DAMAGE_TYPE_NO_CONTACT) + if (!(battleStatus->curAttackElement & DAMAGE_TYPE_NO_CONTACT) && (part->eventFlags & ACTOR_EVENT_FLAG_200000) && !(target->flags & ACTOR_FLAG_UPSIDE_DOWN) - && !(battleStatus->currentAttackEventSuppression & SUPPRESS_EVENT_FLAG_80) + && !(battleStatus->curAttackEventSuppression & SUPPRESS_EVENT_FLAG_80) ) { sfx_play_sound_at_position(SOUND_108, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); dispatch_damage_event_partner_1(1, EVENT_SPIKE_CONTACT); @@ -135,8 +135,8 @@ HitResult calc_partner_test_enemy(void) { // check partner airlifting electrified enemy if (partner->staticStatus != STATUS_KEY_STATIC && (target->staticStatus == STATUS_KEY_STATIC || (part->eventFlags & ACTOR_EVENT_FLAG_ELECTRIFIED)) - && !(battleStatus->currentAttackElement & DAMAGE_TYPE_NO_CONTACT) - && !(battleStatus->currentAttackEventSuppression & SUPPRESS_EVENT_SHOCK_CONTACT)) + && !(battleStatus->curAttackElement & DAMAGE_TYPE_NO_CONTACT) + && !(battleStatus->curAttackEventSuppression & SUPPRESS_EVENT_SHOCK_CONTACT)) { sfx_play_sound_at_position(SOUND_HIT_SHOCK, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); apply_shock_effect(partner); @@ -145,9 +145,9 @@ HitResult calc_partner_test_enemy(void) { } // check partner airlifting fiery enemy - if (!(battleStatus->currentAttackElement & (DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_SMASH)) + if (!(battleStatus->curAttackElement & (DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_SMASH)) && (part->eventFlags & ACTOR_EVENT_FLAG_FIREY) - && !(battleStatus->currentAttackEventSuppression & SUPPRESS_EVENT_BURN_CONTACT)) + && !(battleStatus->curAttackEventSuppression & SUPPRESS_EVENT_BURN_CONTACT)) { sfx_play_sound_at_position(SOUND_HIT_FIRE, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); dispatch_damage_event_partner_1(1, EVENT_BURN_CONTACT); @@ -162,8 +162,8 @@ HitResult calc_partner_test_enemy(void) { HitResult calc_partner_damage_enemy(void) { BattleStatus* battleStatus = &gBattleStatus; Actor* partner = battleStatus->partnerActor; - s32 currentTargetID = battleStatus->currentTargetID; - s32 currentTargetPartID = battleStatus->currentTargetPart; + s32 currentTargetID = battleStatus->curTargetID; + s32 currentTargetPartID = battleStatus->curTargetPart; s32 retVal; s32 partImmuneToElement = FALSE; s32 isFireDamage = FALSE; @@ -183,8 +183,8 @@ HitResult calc_partner_damage_enemy(void) { battleStatus->wasStatusInflicted = FALSE; battleStatus->lastAttackDamage = 0; battleStatus->attackerActorID = partner->actorID; - battleStatus->currentTargetID2 = battleStatus->currentTargetID; - battleStatus->currentTargetPart2 = battleStatus->currentTargetPart; + battleStatus->curTargetID2 = battleStatus->curTargetID; + battleStatus->curTargetPart2 = battleStatus->curTargetPart; target = get_actor(currentTargetID); state = &partner->state; @@ -205,7 +205,7 @@ HitResult calc_partner_damage_enemy(void) { } else { if (targetPart->eventFlags & ACTOR_EVENT_FLAG_ILLUSORY || target->transparentStatus == STATUS_KEY_TRANSPARENT - || (targetPart->eventFlags & ACTOR_EVENT_FLAG_800 && !(battleStatus->currentAttackElement & DAMAGE_TYPE_QUAKE)) + || (targetPart->eventFlags & ACTOR_EVENT_FLAG_800 && !(battleStatus->curAttackElement & DAMAGE_TYPE_QUAKE)) ) { return HIT_RESULT_MISS; } @@ -220,12 +220,12 @@ HitResult calc_partner_damage_enemy(void) { return HIT_RESULT_HIT; } - if (targetPart->elementalImmunities & battleStatus->currentAttackElement) { + if (targetPart->elementalImmunities & battleStatus->curAttackElement) { partImmuneToElement = TRUE; } // check jumping on spiky enemy - if (battleStatus->currentAttackElement & DAMAGE_TYPE_JUMP + if (battleStatus->curAttackElement & DAMAGE_TYPE_JUMP && targetPart->eventFlags & ACTOR_EVENT_FLAG_SPIKY_TOP ) { sfx_play_sound_at_position(SOUND_108, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); @@ -235,12 +235,12 @@ HitResult calc_partner_damage_enemy(void) { } // check explode on contact - if (!(battleStatus->currentAttackElement & DAMAGE_TYPE_NO_CONTACT) + if (!(battleStatus->curAttackElement & DAMAGE_TYPE_NO_CONTACT) && targetPart->eventFlags & ACTOR_EVENT_FLAG_EXPLODE_ON_CONTACT ) { dispatch_event_actor(target, EVENT_EXPLODE_TRIGGER); - if (!(battleStatus->currentAttackEventSuppression & SUPPRESS_EVENT_EXPLODE_CONTACT)) { + if (!(battleStatus->curAttackEventSuppression & SUPPRESS_EVENT_EXPLODE_CONTACT)) { sfx_play_sound_at_position(SOUND_HIT_FIRE, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); dispatch_damage_event_partner_1(1, EVENT_BURN_CONTACT); return HIT_RESULT_BACKFIRE; @@ -254,9 +254,9 @@ HitResult calc_partner_damage_enemy(void) { } // check touching fiery enemy - if (!(battleStatus->currentAttackElement & (DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_SMASH)) + if (!(battleStatus->curAttackElement & (DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_SMASH)) && targetPart->eventFlags & ACTOR_EVENT_FLAG_FIREY - && !(battleStatus->currentAttackEventSuppression & SUPPRESS_EVENT_BURN_CONTACT) + && !(battleStatus->curAttackEventSuppression & SUPPRESS_EVENT_BURN_CONTACT) ) { sfx_play_sound_at_position(SOUND_HIT_FIRE, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); dispatch_damage_event_partner_1(1, EVENT_BURN_CONTACT); @@ -265,9 +265,9 @@ HitResult calc_partner_damage_enemy(void) { } // check touching spiky-front enemy - if (!(battleStatus->currentAttackElement & (DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_JUMP)) + if (!(battleStatus->curAttackElement & (DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_JUMP)) && targetPart->eventFlags & ACTOR_EVENT_FLAG_SPIKY_FRONT - && !(battleStatus->currentAttackEventSuppression & SUPPRESS_EVENT_SPIKY_FRONT) + && !(battleStatus->curAttackEventSuppression & SUPPRESS_EVENT_SPIKY_FRONT) ) { sfx_play_sound_at_position(SOUND_108, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); dispatch_damage_event_partner_1(1, EVENT_SPIKE_CONTACT); @@ -277,7 +277,7 @@ HitResult calc_partner_damage_enemy(void) { // check explode on ignition if (gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE - && battleStatus->currentAttackElement & DAMAGE_TYPE_FIRE + && battleStatus->curAttackElement & DAMAGE_TYPE_FIRE && targetPart->eventFlags & (ACTOR_EVENT_FLAG_FIRE_EXPLODE | ACTOR_EVENT_FLAG_EXPLODE_ON_IGNITION) ) { sfx_play_sound_at_position(SOUND_HIT_FIRE, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); @@ -289,10 +289,10 @@ HitResult calc_partner_damage_enemy(void) { } // unknown alternate spiky #1 - if (!(battleStatus->currentAttackElement & DAMAGE_TYPE_NO_CONTACT) + if (!(battleStatus->curAttackElement & DAMAGE_TYPE_NO_CONTACT) && targetPart->eventFlags & ACTOR_EVENT_FLAG_200000 && !(target->flags & ACTOR_FLAG_UPSIDE_DOWN) - && !(battleStatus->currentAttackEventSuppression & SUPPRESS_EVENT_FLAG_80) + && !(battleStatus->curAttackEventSuppression & SUPPRESS_EVENT_FLAG_80) ) { sfx_play_sound_at_position(SOUND_108, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); dispatch_damage_event_partner_1(1, EVENT_SPIKE_CONTACT); @@ -301,10 +301,10 @@ HitResult calc_partner_damage_enemy(void) { } // unknown alternate spiky top - if (!(battleStatus->currentAttackElement & DAMAGE_TYPE_NO_CONTACT) + if (!(battleStatus->curAttackElement & DAMAGE_TYPE_NO_CONTACT) && targetPart->eventFlags & ACTOR_EVENT_FLAG_SPIKY_TOP && !(target->flags & ACTOR_FLAG_UPSIDE_DOWN) - && !(battleStatus->currentAttackEventSuppression & SUPPRESS_EVENT_SPIKY_TOP) + && !(battleStatus->curAttackEventSuppression & SUPPRESS_EVENT_SPIKY_TOP) ) { sfx_play_sound_at_position(SOUND_108, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); dispatch_damage_event_partner_1(1, EVENT_SPIKE_CONTACT); @@ -314,7 +314,7 @@ HitResult calc_partner_damage_enemy(void) { // check explode on ignition (duplicate of previous check) if (gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE - && battleStatus->currentAttackElement & DAMAGE_TYPE_FIRE + && battleStatus->curAttackElement & DAMAGE_TYPE_FIRE && targetPart->eventFlags & (ACTOR_EVENT_FLAG_FIRE_EXPLODE | ACTOR_EVENT_FLAG_EXPLODE_ON_IGNITION) ) { sfx_play_sound_at_position(SOUND_HIT_FIRE, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); @@ -326,11 +326,11 @@ HitResult calc_partner_damage_enemy(void) { } // check shock contact for airlift - if (battleStatus->currentAttackElement & DAMAGE_TYPE_AIR_LIFT) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_AIR_LIFT) { if (partner->staticStatus != STATUS_KEY_STATIC && (target->staticStatus == STATUS_KEY_STATIC || targetPart->eventFlags & ACTOR_EVENT_FLAG_ELECTRIFIED) - && !(battleStatus->currentAttackElement & DAMAGE_TYPE_NO_CONTACT) - && !(battleStatus->currentAttackEventSuppression & SUPPRESS_EVENT_SHOCK_CONTACT) + && !(battleStatus->curAttackElement & DAMAGE_TYPE_NO_CONTACT) + && !(battleStatus->curAttackEventSuppression & SUPPRESS_EVENT_SHOCK_CONTACT) ) { sfx_play_sound_at_position(SOUND_HIT_SHOCK, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); apply_shock_effect(partner); @@ -340,56 +340,56 @@ HitResult calc_partner_damage_enemy(void) { return HIT_RESULT_HIT; } - if (battleStatus->currentAttackElement & DAMAGE_TYPE_FIRE) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_FIRE) { fx_ring_blast(0, state->goalPos.x, state->goalPos.y, state->goalPos.z + 5.0f, 1.0f, 24); isFireDamage = TRUE; } - if (battleStatus->currentAttackElement & DAMAGE_TYPE_SHOCK) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_SHOCK) { apply_shock_effect(target); isShockDamage = TRUE; } - if (battleStatus->currentAttackElement & DAMAGE_TYPE_WATER) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_WATER) { fx_water_splash(0, state->goalPos.x, state->goalPos.y, state->goalPos.z + 5.0f, 1.0f, 24); isWaterDamage = TRUE; } - if (battleStatus->currentAttackElement & DAMAGE_TYPE_ICE) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_ICE) { fx_big_snowflakes(0, state->goalPos.x, state->goalPos.y, state->goalPos.z + 5.0f); isIceDamage = TRUE; } if (partner->staticStatus != STATUS_KEY_STATIC && (target->staticStatus == STATUS_KEY_STATIC || targetPart->eventFlags & ACTOR_EVENT_FLAG_ELECTRIFIED) - && !(battleStatus->currentAttackElement & (DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_SHOCK)) - && !(battleStatus->currentAttackEventSuppression & SUPPRESS_EVENT_SHOCK_CONTACT) + && !(battleStatus->curAttackElement & (DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_SHOCK)) + && !(battleStatus->curAttackEventSuppression & SUPPRESS_EVENT_SHOCK_CONTACT) ) { gBattleStatus.flags1 |= BS_FLAGS1_SP_EVT_ACTIVE; } if (targetPart->eventFlags & (ACTOR_EVENT_FLAG_STAR_ROD_ENCHANTED | ACTOR_EVENT_FLAG_ENCHANTED)) { - battleStatus->currentAttackElement &= ~DAMAGE_TYPE_IGNORE_DEFENSE; + battleStatus->curAttackElement &= ~DAMAGE_TYPE_IGNORE_DEFENSE; } - statusChanceOrDefense = get_defense(target, targetPart->defenseTable, battleStatus->currentAttackElement); + statusChanceOrDefense = get_defense(target, targetPart->defenseTable, battleStatus->curAttackElement); - if (!(battleStatus->currentAttackElement & DAMAGE_TYPE_IGNORE_DEFENSE)) { + if (!(battleStatus->curAttackElement & DAMAGE_TYPE_IGNORE_DEFENSE)) { statusChanceOrDefense += target->defenseBoost; } - damageDealt = battleStatus->currentAttackDamage + partner->attackBoost; + damageDealt = battleStatus->curAttackDamage + partner->attackBoost; if (gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE) { - if (battleStatus->currentAttackElement & DAMAGE_TYPE_BLAST + if (battleStatus->curAttackElement & DAMAGE_TYPE_BLAST && targetPart->eventFlags & ACTOR_EVENT_FLAG_EXPLODE_ON_IGNITION ) { statusChanceOrDefense = 0; - damageDealt = target->currentHP; + damageDealt = target->curHP; } } - if (battleStatus->currentAttackElement & DAMAGE_TYPE_STATUS_ALWAYS_HITS) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_STATUS_ALWAYS_HITS) { statusChanceOrDefense = 0; damageDealt = 0; } @@ -419,7 +419,7 @@ HitResult calc_partner_damage_enemy(void) { damageDealt = 0; } - if (battleStatus->currentAttackElement & DAMAGE_TYPE_POWER_BOUNCE && damageDealt > 0) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_POWER_BOUNCE && damageDealt > 0) { damageDealt += battleStatus->powerBounceCounter; if (damageDealt < 1) { @@ -432,13 +432,13 @@ HitResult calc_partner_damage_enemy(void) { if (damageDealt < 1) { target->hpChangeCounter = 0; - if (!(battleStatus->currentAttackElement & DAMAGE_TYPE_STATUS_ALWAYS_HITS)) { + if (!(battleStatus->curAttackElement & DAMAGE_TYPE_STATUS_ALWAYS_HITS)) { retVal = 2; dispatchEvent = EVENT_ZERO_DAMAGE; sfx_play_sound_at_position(SOUND_IMMUNE, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } else { retVal = 2; - if (target->currentHP < 1) { + if (target->curHP < 1) { dispatchEvent = EVENT_DEATH; } else { dispatchEvent = EVENT_ZERO_DAMAGE; @@ -458,10 +458,10 @@ HitResult calc_partner_damage_enemy(void) { && !partImmuneToElement && !(targetPart->targetFlags & ACTOR_PART_TARGET_FLAG_4) ) { - target->currentHP -= damageDealt; + target->curHP -= damageDealt; - if (target->currentHP < 1) { - target->currentHP = 0; + if (target->curHP < 1) { + target->curHP = 0; dispatchEvent = EVENT_DEATH; } } @@ -474,8 +474,8 @@ HitResult calc_partner_damage_enemy(void) { if (targetPart->flags & ACTOR_PART_FLAG_2000) { if (partner->staticStatus == STATUS_KEY_STATIC || !(target->staticStatus == STATUS_KEY_STATIC || (targetPart->eventFlags & ACTOR_EVENT_FLAG_ELECTRIFIED)) - || battleStatus->currentAttackElement & DAMAGE_TYPE_NO_CONTACT - || battleStatus->currentAttackEventSuppression & SUPPRESS_EVENT_SHOCK_CONTACT + || battleStatus->curAttackElement & DAMAGE_TYPE_NO_CONTACT + || battleStatus->curAttackEventSuppression & SUPPRESS_EVENT_SHOCK_CONTACT ) { dispatchEvent = (!(gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE)) ? EVENT_ZERO_DAMAGE : EVENT_IMMUNE; sfx_play_sound_at_position(SOUND_IMMUNE, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); @@ -503,7 +503,7 @@ HitResult calc_partner_damage_enemy(void) { dispatchEvent = EVENT_IMMUNE; } - if (target->currentHP < 1) { + if (target->curHP < 1) { if (dispatchEvent == EVENT_IMMUNE) { dispatchEvent = EVENT_DEATH; } @@ -517,7 +517,7 @@ HitResult calc_partner_damage_enemy(void) { } if (gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE) { - if (battleStatus->currentAttackElement & DAMAGE_TYPE_SPIN_SMASH) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_SPIN_SMASH) { if (dispatchEvent == EVENT_HIT) { dispatchEvent = EVENT_SPIN_SMASH_HIT; } @@ -530,7 +530,7 @@ HitResult calc_partner_damage_enemy(void) { } if (gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE) { - if (!(battleStatus->currentAttackElement & DAMAGE_TYPE_NO_CONTACT) && targetPart->eventFlags & ACTOR_EVENT_FLAG_POWER_BOUNCE) { + if (!(battleStatus->curAttackElement & DAMAGE_TYPE_NO_CONTACT) && targetPart->eventFlags & ACTOR_EVENT_FLAG_POWER_BOUNCE) { if (dispatchEvent == EVENT_HIT_COMBO) { dispatchEvent = EVENT_POWER_BOUNCE_HIT; } @@ -553,7 +553,7 @@ HitResult calc_partner_damage_enemy(void) { } if (gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE) { - if (battleStatus->currentAttackElement & DAMAGE_TYPE_JUMP && targetPart->eventFlags & ACTOR_EVENT_FLAG_GROUNDABLE) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_JUMP && targetPart->eventFlags & ACTOR_EVENT_FLAG_GROUNDABLE) { if (dispatchEvent == EVENT_HIT) { dispatchEvent = EVENT_FALL_TRIGGER; } @@ -566,7 +566,7 @@ HitResult calc_partner_damage_enemy(void) { } if (gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE) { - if (battleStatus->currentAttackElement & DAMAGE_TYPE_JUMP && targetPart->eventFlags & ACTOR_EVENT_FLAG_FLIPABLE) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_JUMP && targetPart->eventFlags & ACTOR_EVENT_FLAG_FLIPABLE) { if (dispatchEvent == EVENT_HIT) { dispatchEvent = EVENT_FLIP_TRIGGER; } @@ -585,7 +585,7 @@ HitResult calc_partner_damage_enemy(void) { } if (!(gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE) - && battleStatus->currentAttackElement & DAMAGE_TYPE_JUMP + && battleStatus->curAttackElement & DAMAGE_TYPE_JUMP && targetPart->eventFlags & ACTOR_EVENT_FLAG_FLIPABLE ) { if (dispatchEvent == EVENT_HIT_COMBO) { @@ -602,7 +602,7 @@ HitResult calc_partner_damage_enemy(void) { } if (gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE - && battleStatus->currentAttackElement & DAMAGE_TYPE_BLAST + && battleStatus->curAttackElement & DAMAGE_TYPE_BLAST && targetPart->eventFlags & ACTOR_EVENT_FLAG_EXPLODE_ON_IGNITION ) { if (dispatchEvent == EVENT_DEATH) { @@ -622,7 +622,7 @@ HitResult calc_partner_damage_enemy(void) { } if (gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE) { - if (battleStatus->currentAttackElement & (DAMAGE_TYPE_BLAST | DAMAGE_TYPE_FIRE)) { + if (battleStatus->curAttackElement & (DAMAGE_TYPE_BLAST | DAMAGE_TYPE_FIRE)) { if (dispatchEvent == EVENT_HIT) { dispatchEvent = EVENT_BURN_HIT; } @@ -643,7 +643,7 @@ HitResult calc_partner_damage_enemy(void) { && !(targetPart->targetFlags & ACTOR_PART_TARGET_FLAG_4) ) { #define INFLICT_STATUS(STATUS_TYPE) \ - if ((battleStatus->currentAttackStatus & STATUS_FLAG_##STATUS_TYPE) && \ + if ((battleStatus->curAttackStatus & STATUS_FLAG_##STATUS_TYPE) && \ try_inflict_status(target, STATUS_KEY_##STATUS_TYPE, STATUS_TURN_MOD_##STATUS_TYPE)) { \ tempBinary = TRUE; \ wasStatusInflicted = TRUE; \ @@ -669,7 +669,7 @@ HitResult calc_partner_damage_enemy(void) { statusChanceOrDefense = (battleStatus->statusChance * statusChanceOrDefense) / 100; - if (battleStatus->currentAttackStatus & STATUS_FLAG_400000) { + if (battleStatus->curAttackStatus & STATUS_FLAG_400000) { if (rand_int(99) < statusChanceOrDefense) { if (!(target->debuff == STATUS_KEY_FEAR || target->debuff == STATUS_KEY_DIZZY @@ -712,7 +712,7 @@ HitResult calc_partner_damage_enemy(void) { statusChanceOrDefense = (battleStatus->statusChance * statusChanceOrDefense) / 100; if (gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE) { - if (battleStatus->currentAttackElement & DAMAGE_TYPE_FEAR) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_FEAR) { if (rand_int(99) < statusChanceOrDefense) { if (!(target->debuff == STATUS_KEY_FEAR || target->debuff == STATUS_KEY_DIZZY || @@ -746,7 +746,7 @@ HitResult calc_partner_damage_enemy(void) { show_immune_bonk(state->goalPos.x, state->goalPos.y, state->goalPos.z, 0, 1, 3); } } else if (!partImmuneToElement) { - if (battleStatus->currentAttackElement & (DAMAGE_TYPE_MULTIPLE_POPUPS | DAMAGE_TYPE_SMASH)) { + if (battleStatus->curAttackElement & (DAMAGE_TYPE_MULTIPLE_POPUPS | DAMAGE_TYPE_SMASH)) { show_next_damage_popup(state->goalPos.x, state->goalPos.y, state->goalPos.z, battleStatus->lastAttackDamage, 0); } else { show_primary_damage_popup(state->goalPos.x, state->goalPos.y, state->goalPos.z, battleStatus->lastAttackDamage, 0); @@ -767,7 +767,7 @@ HitResult calc_partner_damage_enemy(void) { sfx_play_sound_at_position(SOUND_231, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if (battleStatus->lastAttackDamage > 0 || (battleStatus->currentAttackElement & DAMAGE_TYPE_STATUS_ALWAYS_HITS && tempBinary)) { + if (battleStatus->lastAttackDamage > 0 || (battleStatus->curAttackElement & DAMAGE_TYPE_STATUS_ALWAYS_HITS && tempBinary)) { if (gBattleStatus.flags1 & BS_FLAGS1_40) { show_action_rating(ACTION_RATING_NICE, target, state->goalPos.x, state->goalPos.y, state->goalPos.z); } else { @@ -807,7 +807,7 @@ HitResult calc_partner_damage_enemy(void) { sfx_play_sound_at_position(SOUND_IMMUNE, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if (battleStatus->currentAttackStatus & STATUS_FLAG_SLEEP && wasStatusInflicted) { + if (battleStatus->curAttackStatus & STATUS_FLAG_SLEEP && wasStatusInflicted) { evt = start_script((EvtScript*) EVS_PlaySleepHitFX, EVT_PRIORITY_A, 0); evt->varTable[0] = state->goalPos.x; evt->varTable[1] = state->goalPos.y; @@ -815,7 +815,7 @@ HitResult calc_partner_damage_enemy(void) { sfx_play_sound_at_position(SOUND_INFLICT_SLEEP, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if (battleStatus->currentAttackStatus & STATUS_FLAG_DIZZY && wasStatusInflicted) { + if (battleStatus->curAttackStatus & STATUS_FLAG_DIZZY && wasStatusInflicted) { evt = start_script((EvtScript*) EVS_PlayDizzyHitFX, EVT_PRIORITY_A, 0); evt->varTable[0] = state->goalPos.x; evt->varTable[1] = state->goalPos.y; @@ -823,7 +823,7 @@ HitResult calc_partner_damage_enemy(void) { sfx_play_sound_at_position(SOUND_INFLICT_STATUS, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if (battleStatus->currentAttackStatus & STATUS_FLAG_PARALYZE && wasStatusInflicted) { + if (battleStatus->curAttackStatus & STATUS_FLAG_PARALYZE && wasStatusInflicted) { evt = start_script((EvtScript*) EVS_PlayParalyzeHitFX, EVT_PRIORITY_A, 0); evt->varTable[0] = state->goalPos.x; evt->varTable[1] = state->goalPos.y; @@ -831,7 +831,7 @@ HitResult calc_partner_damage_enemy(void) { sfx_play_sound_at_position(SOUND_INFLICT_STATUS, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if (battleStatus->currentAttackStatus & STATUS_FLAG_POISON && wasStatusInflicted) { + if (battleStatus->curAttackStatus & STATUS_FLAG_POISON && wasStatusInflicted) { evt = start_script((EvtScript*) EVS_PlayPoisonHitFX, EVT_PRIORITY_A, 0); evt->varTable[0] = state->goalPos.x; evt->varTable[1] = state->goalPos.y; @@ -839,7 +839,7 @@ HitResult calc_partner_damage_enemy(void) { sfx_play_sound_at_position(SOUND_INFLICT_STATUS, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if (battleStatus->currentAttackStatus & STATUS_FLAG_STOP && wasStatusInflicted) { + if (battleStatus->curAttackStatus & STATUS_FLAG_STOP && wasStatusInflicted) { evt = start_script((EvtScript*) EVS_PlayStopHitFX, EVT_PRIORITY_A, 0); evt->varTable[0] = state->goalPos.x; evt->varTable[1] = state->goalPos.y; @@ -847,7 +847,7 @@ HitResult calc_partner_damage_enemy(void) { sfx_play_sound_at_position(SOUND_INFLICT_STATUS, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if (battleStatus->currentAttackStatus & STATUS_FLAG_FROZEN && wasStatusInflicted) { + if (battleStatus->curAttackStatus & STATUS_FLAG_FROZEN && wasStatusInflicted) { evt = start_script((EvtScript*) EVS_PlayFreezeHitFX, EVT_PRIORITY_A, 0); evt->varTable[0] = state->goalPos.x; evt->varTable[1] = state->goalPos.y; @@ -856,7 +856,7 @@ HitResult calc_partner_damage_enemy(void) { sfx_play_sound_at_position(SOUND_HIT_ICE, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if (battleStatus->currentAttackStatus & STATUS_FLAG_SHRINK && wasStatusInflicted) { + if (battleStatus->curAttackStatus & STATUS_FLAG_SHRINK && wasStatusInflicted) { evt = start_script((EvtScript*) EVS_PlayShrinkHitFX, EVT_PRIORITY_A, 0); evt->varTable[0] = state->goalPos.x; evt->varTable[1] = state->goalPos.y; @@ -865,7 +865,7 @@ HitResult calc_partner_damage_enemy(void) { sfx_play_sound_at_position(SOUND_INFLICT_STATUS, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } - if (battleStatus->currentAttackElement & DAMAGE_TYPE_SMASH && target->actorType == ACTOR_TYPE_GOOMNUT_TREE) { + if (battleStatus->curAttackElement & DAMAGE_TYPE_SMASH && target->actorType == ACTOR_TYPE_GOOMNUT_TREE) { sfx_play_sound_at_position(SOUND_SMASH_GOOMNUT_TREE, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); } @@ -882,8 +882,8 @@ HitResult calc_partner_damage_enemy(void) { } if (partner->staticStatus != STATUS_KEY_STATIC && (target->staticStatus == STATUS_KEY_STATIC || - targetPart->eventFlags & ACTOR_EVENT_FLAG_ELECTRIFIED) && !(battleStatus->currentAttackElement & DAMAGE_TYPE_NO_CONTACT) && - !(battleStatus->currentAttackEventSuppression & SUPPRESS_EVENT_SHOCK_CONTACT)) { + targetPart->eventFlags & ACTOR_EVENT_FLAG_ELECTRIFIED) && !(battleStatus->curAttackElement & DAMAGE_TYPE_NO_CONTACT) && + !(battleStatus->curAttackEventSuppression & SUPPRESS_EVENT_SHOCK_CONTACT)) { sfx_play_sound_at_position(SOUND_HIT_SHOCK, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z); apply_shock_effect(partner); dispatch_damage_event_partner_1(1, EVENT_SHOCK_HIT); @@ -900,27 +900,27 @@ s32 dispatch_damage_event_partner(s32 damageAmount, s32 event, s32 stopMotion) { s32 hpChange; s32 flagCheck; - battleStatus->currentAttackDamage = damageAmount; + battleStatus->curAttackDamage = damageAmount; hpChange = (s16)damageAmount; partner->hpChangeCounter += hpChange; hpChange = partner->hpChangeCounter; - partner->currentHP = 127; + partner->curHP = 127; partner->damageCounter += hpChange; partner->hpChangeCounter -= hpChange; battleStatus->lastAttackDamage = 0; - partner->currentHP -= hpChange; + partner->curHP -= hpChange; - if (partner->currentHP <= 0) { + if (partner->curHP <= 0) { event = EVENT_DEATH; - battleStatus->lastAttackDamage += partner->currentHP; - partner->currentHP = 0; + battleStatus->lastAttackDamage += partner->curHP; + partner->curHP = 0; } battleStatus->lastAttackDamage += hpChange; partner->lastDamageTaken = battleStatus->lastAttackDamage; - battleStatus->currentDamageSource = DMG_SRC_DEFAULT; + battleStatus->curDamageSource = DMG_SRC_DEFAULT; if (gBattleStatus.flags1 & BS_FLAGS1_SP_EVT_ACTIVE) { if (event == EVENT_HIT_COMBO) { event = EVENT_HIT; @@ -1043,10 +1043,10 @@ ApiStatus PartnerDamageEnemy(Evt* script, s32 isInitialCall) { s32 damageResult; u8 statusChance; - gBattleStatus.currentAttackElement = *args++; - gBattleStatus.currentAttackEventSuppression = *args++; - gBattleStatus.currentAttackStatus = *args++; - gBattleStatus.currentAttackDamage = evt_get_variable(script, *args++); + gBattleStatus.curAttackElement = *args++; + gBattleStatus.curAttackEventSuppression = *args++; + gBattleStatus.curAttackStatus = *args++; + gBattleStatus.curAttackDamage = evt_get_variable(script, *args++); gBattleStatus.powerBounceCounter = 0; flags = *args++; @@ -1088,16 +1088,16 @@ ApiStatus PartnerDamageEnemy(Evt* script, s32 isInitialCall) { gBattleStatus.flags1 &= ~BS_FLAGS1_FORCE_HIT_IMMUNE; } - statusChance = battleStatus->currentAttackStatus; - battleStatus->currentTargetID = enemy->targetActorID; - battleStatus->currentTargetPart = enemy->targetPartIndex; + statusChance = battleStatus->curAttackStatus; + battleStatus->curTargetID = enemy->targetActorID; + battleStatus->curTargetPart = enemy->targetPartIndex; battleStatus->statusChance = statusChance; if (statusChance == STATUS_KEY_NEVER) { battleStatus->statusChance = 0; } - battleStatus->statusDuration = (battleStatus->currentAttackStatus & 0xF00) >> 8; + battleStatus->statusDuration = (battleStatus->curAttackStatus & 0xF00) >> 8; damageResult = calc_partner_damage_enemy(); if (damageResult < 0) { @@ -1122,11 +1122,11 @@ ApiStatus PartnerAfflictEnemy(Evt* script, s32 isInitialCall) { u8 statusChance; s32 damageResult; - battleStatus->currentAttackElement = *args++; - battleStatus->currentAttackEventSuppression = *args++; - battleStatus->currentAttackStatus = *args++; - battleStatus->currentAttackStatus |= evt_get_variable(script, *args++); - battleStatus->currentAttackDamage = evt_get_variable(script, *args++); + battleStatus->curAttackElement = *args++; + battleStatus->curAttackEventSuppression = *args++; + battleStatus->curAttackStatus = *args++; + battleStatus->curAttackStatus |= evt_get_variable(script, *args++); + battleStatus->curAttackDamage = evt_get_variable(script, *args++); battleStatus->powerBounceCounter = 0; flags = *args++; @@ -1165,16 +1165,16 @@ ApiStatus PartnerAfflictEnemy(Evt* script, s32 isInitialCall) { gBattleStatus.flags1 &= ~BS_FLAGS1_FORCE_HIT_IMMUNE; } - statusChance = battleStatus->currentAttackStatus; - battleStatus->currentTargetID = actor->targetActorID; - battleStatus->currentTargetPart = actor->targetPartIndex; + statusChance = battleStatus->curAttackStatus; + battleStatus->curTargetID = actor->targetActorID; + battleStatus->curTargetPart = actor->targetPartIndex; battleStatus->statusChance = statusChance; if (statusChance == STATUS_KEY_NEVER) { battleStatus->statusChance = 0; } - battleStatus->statusDuration = (battleStatus->currentAttackStatus & 0xF00) >> 8; + battleStatus->statusDuration = (battleStatus->curAttackStatus & 0xF00) >> 8; damageResult = calc_partner_damage_enemy(); if (damageResult < 0) { @@ -1199,10 +1199,10 @@ ApiStatus PartnerPowerBounceEnemy(Evt* script, s32 isInitialCall) { u8 statusChance; s32 damageResult; - battleStatus->currentAttackElement = *args++; - battleStatus->currentAttackEventSuppression = *args++; - battleStatus->currentAttackStatus = *args++; - battleStatus->currentAttackDamage = evt_get_variable(script, *args++); + battleStatus->curAttackElement = *args++; + battleStatus->curAttackEventSuppression = *args++; + battleStatus->curAttackStatus = *args++; + battleStatus->curAttackDamage = evt_get_variable(script, *args++); battleStatus->powerBounceCounter = evt_get_variable(script, *args++); flags = *args++; @@ -1241,16 +1241,16 @@ ApiStatus PartnerPowerBounceEnemy(Evt* script, s32 isInitialCall) { gBattleStatus.flags1 &= ~BS_FLAGS1_FORCE_HIT_IMMUNE; } - statusChance = battleStatus->currentAttackStatus; - battleStatus->currentTargetID = actor->targetActorID; - battleStatus->currentTargetPart = actor->targetPartIndex; + statusChance = battleStatus->curAttackStatus; + battleStatus->curTargetID = actor->targetActorID; + battleStatus->curTargetPart = actor->targetPartIndex; battleStatus->statusChance = statusChance; if (statusChance == STATUS_KEY_NEVER) { battleStatus->statusChance = 0; } - battleStatus->statusDuration = (battleStatus->currentAttackStatus & 0xF00) >> 8; + battleStatus->statusDuration = (battleStatus->curAttackStatus & 0xF00) >> 8; damageResult = calc_partner_damage_enemy(); if (damageResult < 0) { @@ -1277,10 +1277,10 @@ ApiStatus PartnerTestEnemy(Evt* script, s32 isInitialCall) { u8 statusChance; temp_s4 = *args++; - gBattleStatus.currentAttackElement = *args++; - gBattleStatus.currentAttackEventSuppression = *args++; - gBattleStatus.currentAttackStatus = *args++; - gBattleStatus.currentAttackDamage = evt_get_variable(script, *args++); + gBattleStatus.curAttackElement = *args++; + gBattleStatus.curAttackEventSuppression = *args++; + gBattleStatus.curAttackStatus = *args++; + gBattleStatus.curAttackDamage = evt_get_variable(script, *args++); gBattleStatus.powerBounceCounter = 0; flags = *args++; @@ -1322,16 +1322,16 @@ ApiStatus PartnerTestEnemy(Evt* script, s32 isInitialCall) { gBattleStatus.flags1 &= ~BS_FLAGS1_FORCE_HIT_IMMUNE; } - statusChance = battleStatus->currentAttackStatus; - battleStatus->currentTargetID = enemy->targetActorID; - battleStatus->currentTargetPart = enemy->targetPartIndex; + statusChance = battleStatus->curAttackStatus; + battleStatus->curTargetID = enemy->targetActorID; + battleStatus->curTargetPart = enemy->targetPartIndex; battleStatus->statusChance = statusChance; if (statusChance == STATUS_KEY_NEVER) { battleStatus->statusChance = 0; } - battleStatus->statusDuration = (battleStatus->currentAttackStatus & 0xF00) >> 8; + battleStatus->statusDuration = (battleStatus->curAttackStatus & 0xF00) >> 8; damageResult = calc_partner_test_enemy(); if (damageResult < 0) { @@ -1350,8 +1350,8 @@ ApiStatus func_8028070C(Evt* script, s32 isInitialCall) { s32 damageAmount = evt_get_variable(script, *args++); s32 event = evt_get_variable(script, *args++); - battleStatus->currentTargetID = actor->targetActorID; - battleStatus->currentTargetPart = actor->targetPartIndex; + battleStatus->curTargetID = actor->targetActorID; + battleStatus->curTargetPart = actor->targetPartIndex; if (dispatch_damage_event_partner_0(damageAmount, event, (s32) battleStatus) >= 0) { return does_script_exist_by_ref(script) ? ApiStatus_DONE2 : ApiStatus_BLOCK; diff --git a/src/23680.c b/src/23680.c index 6f4e81969fa..604dc11b7ff 100644 --- a/src/23680.c +++ b/src/23680.c @@ -39,7 +39,7 @@ void spawn_drops(Enemy* enemy) { spawnCounter = 0; availableRenderTasks = 256 - 10 - gLastRenderTaskCount; - angle = clamp_angle(camera->currentYaw + 90.0f); + angle = clamp_angle(camera->curYaw + 90.0f); x = npc->pos.x; y = npc->pos.y + (npc->collisionHeight / 2); z = npc->pos.z; @@ -436,14 +436,14 @@ s32 basic_ai_check_player_dist(EnemyDetectVolume* territory, Enemy* enemy, f32 r return FALSE; } - if (territory->halfHeight <= fabsf(npc->pos.y - playerStatus->position.y) + if (territory->halfHeight <= fabsf(npc->pos.y - playerStatus->pos.y) && !(territory->detectFlags & AI_TERRITORY_IGNORE_ELEVATION)) { return FALSE; } if (territory->sizeX | territory->sizeZ && is_point_within_region(territory->shape, territory->pointX, territory->pointZ, - playerStatus->position.x, playerStatus->position.z, + playerStatus->pos.x, playerStatus->pos.z, territory->sizeX, territory->sizeZ)) { return FALSE; } @@ -457,10 +457,10 @@ s32 basic_ai_check_player_dist(EnemyDetectVolume* territory, Enemy* enemy, f32 r x = npc->pos.x; y = npc->pos.y + npc->collisionHeight * 0.5; z = npc->pos.z; - dist = dist2D(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z); + dist = dist2D(npc->pos.x, npc->pos.z, playerStatus->pos.x, playerStatus->pos.z); if (npc_test_move_simple_with_slipping(COLLISION_CHANNEL_10000 | COLLISION_IGNORE_ENTITIES, &x, &y, &z, - dist, atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z), + dist, atan2(npc->pos.x, npc->pos.z, playerStatus->pos.x, playerStatus->pos.z), 0.1f, 0.1f)) { return FALSE; } @@ -487,7 +487,7 @@ s32 basic_ai_check_player_dist(EnemyDetectVolume* territory, Enemy* enemy, f32 r } else { add_vec2D_polar(&x, &z, fwdPosOffset, 270.0f - npc->renderYaw); } - if (dist2D(x, z, playerStatus->position.x, playerStatus->position.z) <= radius) { + if (dist2D(x, z, playerStatus->pos.x, playerStatus->pos.z) <= radius) { return TRUE; } } @@ -514,7 +514,7 @@ s32 ai_check_player_dist(Enemy* enemy, s32 chance, f32 radius, f32 moveSpeed) { posZ = npc->pos.z; add_vec2D_polar(&posX, &posZ, moveSpeed, 270.0f - npc->renderYaw); - if (dist2D(posX, posZ, playerStatus->position.x, playerStatus->position.z) <= radius) { + if (dist2D(posX, posZ, playerStatus->pos.x, playerStatus->pos.z) <= radius) { return TRUE; } } @@ -554,7 +554,7 @@ void basic_ai_wander_init(Evt* script, MobileAISettings* npcAISettings, EnemyDet // chose a random direction and move time npc->duration = (npcAISettings->moveTime / 2) + rand_int((npcAISettings->moveTime / 2) + 1); npc->yaw = clamp_angle(npc->yaw + rand_int(60) - 30.0f); - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_WALK]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_WALK]; script->functionTemp[1] = 0; if (enemy->territory->wander.moveSpeedOverride < 0) { @@ -583,7 +583,7 @@ void basic_ai_wander(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolum x = npc->pos.x; y = npc->pos.y; z = npc->pos.z; - yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); if (!npc_test_move_simple_with_slipping(npc->collisionChannel, &x, &y, &z, aiSettings->chaseSpeed, yaw, npc->collisionHeight, npc->collisionDiameter)) { npc->yaw = yaw; ai_enemy_play_sound(npc, SOUND_2F4, SOUND_PARAM_MORE_QUIET); @@ -664,7 +664,7 @@ void basic_ai_loiter_init(Evt* script, MobileAISettings* aiSettings, EnemyDetect npc->duration = (aiSettings->waitTime / 2) + rand_int((aiSettings->waitTime / 2) + 1); npc->yaw = clamp_angle(npc->yaw + rand_int(180) - 90.0f); - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; script->AI_TEMP_STATE = AI_STATE_LOITER; } @@ -680,7 +680,7 @@ void basic_ai_loiter(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolum x = npc->pos.x; y = npc->pos.y; z = npc->pos.z; - yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); if (!npc_test_move_simple_with_slipping(npc->collisionChannel, &x, &y, &z, aiSettings->chaseSpeed, yaw, npc->collisionHeight, npc->collisionDiameter)) { npc->yaw = yaw; ai_enemy_play_sound(npc, SOUND_2F4, SOUND_PARAM_MORE_QUIET); @@ -717,8 +717,8 @@ void basic_ai_found_player_jump_init(Evt* script, MobileAISettings* npcAISetting Npc* npc = get_npc_unsafe(enemy->npcID); ai_enemy_play_sound(npc, SOUND_3E1, 0); - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_JUMP]; - npc->jumpVelocity = 10.0f; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_JUMP]; + npc->jumpVel = 10.0f; npc->jumpScale = 2.5f; npc->moveToPos.y = npc->pos.y; npc->flags |= NPC_FLAG_JUMPING; @@ -729,7 +729,7 @@ void basic_ai_found_player_jump(Evt* script, MobileAISettings* npcAISettings, En Npc* npc = get_npc_unsafe(script->owner1.enemy->npcID); s32 done = FALSE; - if (npc->jumpVelocity <= 0.0) { + if (npc->jumpVel <= 0.0) { if (npc->pos.y <= npc->moveToPos.y) { npc->pos.y = npc->moveToPos.y; done = TRUE; @@ -737,10 +737,10 @@ void basic_ai_found_player_jump(Evt* script, MobileAISettings* npcAISettings, En } if (!done) { - npc->pos.y += npc->jumpVelocity; - npc->jumpVelocity -= npc->jumpScale; + npc->pos.y += npc->jumpVel; + npc->jumpVel -= npc->jumpScale; } else { - npc->jumpVelocity = 0.0f; + npc->jumpVel = 0.0f; npc->flags &= ~NPC_FLAG_JUMPING; script->AI_TEMP_STATE = AI_STATE_CHASE_INIT; } @@ -753,13 +753,13 @@ void basic_ai_chase_init(Evt* script, MobileAISettings* npcAISettings, EnemyDete if ((gPlayerStatusPtr->actionState == ACTION_STATE_JUMP || gPlayerStatusPtr->actionState == ACTION_STATE_BOUNCE || gPlayerStatusPtr->actionState == ACTION_STATE_HOP || gPlayerStatusPtr->actionState == ACTION_STATE_FALLING) && - (f64)dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z) < npc->collisionDiameter) + (f64)dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z) < npc->collisionDiameter) { skipTurnAround = TRUE; } if (!skipTurnAround) { - f32 angle = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + f32 angle = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); f32 deltaAngleToPlayer = get_clamped_angle_diff(npc->yaw, angle); if (npcAISettings->chaseTurnRate < fabsf(deltaAngleToPlayer)) { @@ -776,7 +776,7 @@ void basic_ai_chase_init(Evt* script, MobileAISettings* npcAISettings, EnemyDete npc->duration = 0; } - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_CHASE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_CHASE]; npc->moveSpeed = npcAISettings->chaseSpeed; script->AI_TEMP_STATE = AI_STATE_CHASE; } @@ -789,20 +789,20 @@ void basic_ai_chase(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolume if (!basic_ai_check_player_dist(territory, enemy, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, 1)) { fx_emote(EMOTE_QUESTION, npc, 0, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &sp28); - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; npc->duration = 20; script->AI_TEMP_STATE = AI_STATE_LOSE_PLAYER; return; } if (enemy->npcSettings->actionFlags & AI_ACTION_04) { - if (dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z) > (npc->moveSpeed * 5.0)) { + if (dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z) > (npc->moveSpeed * 5.0)) { x = npc->pos.x; y = npc->pos.y; z = npc->pos.z; if (npc_test_move_simple_with_slipping(npc->collisionChannel, &x, &y, &z, 1.0f, npc->yaw, npc->collisionHeight, npc->collisionDiameter)) { fx_emote(EMOTE_QUESTION, npc, 0, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 0xC, &sp28); - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; npc->duration = 15; script->AI_TEMP_STATE = AI_STATE_LOSE_PLAYER; return; @@ -857,7 +857,7 @@ ApiStatus BasicAI_Main(Evt* script, s32 isInitialCall) { script->AI_TEMP_STATE = AI_STATE_WANDER_INIT; npc->duration = 0; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; npc->flags &= ~NPC_FLAG_JUMPING; if (!enemy->territory->wander.isFlying) { diff --git a/src/38F00.c b/src/38F00.c index 34e12bf80ad..f79791713b0 100644 --- a/src/38F00.c +++ b/src/38F00.c @@ -105,7 +105,7 @@ ApiStatus func_8005DB00(Evt* script, s32 isInitialCall) { npc->duration = evt_get_variable(script, LVar1); script->functionTemp[1] = evt_get_variable(script, LVar2); script->functionTemp[2] = evt_get_variable(script, LVar3) / 2; - npc->currentAnim = script->varTable[10]; + npc->curAnim = script->varTable[10]; script->functionTemp[0] = 1; break; case 1: @@ -115,10 +115,10 @@ ApiStatus func_8005DB00(Evt* script, s32 isInitialCall) { } if (npc->duration == 0) { - if (sqrtf(SQ((playerStatus->position.x - npc->pos.x)) + - SQ((playerStatus->position.y - npc->pos.y)) + - SQ((playerStatus->position.z - npc->pos.z))) <= npc->planarFlyDist) { - targetDir = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z); + if (sqrtf(SQ((playerStatus->pos.x - npc->pos.x)) + + SQ((playerStatus->pos.y - npc->pos.y)) + + SQ((playerStatus->pos.z - npc->pos.z))) <= npc->planarFlyDist) { + targetDir = atan2(npc->pos.x, npc->pos.z, playerStatus->pos.x, playerStatus->pos.z); npcYaw = script->functionTemp[1] == -1 ? npc->yaw : script->functionTemp[1]; if (fabsf(get_clamped_angle_diff(npcYaw, targetDir)) < script->functionTemp[2]) { @@ -127,8 +127,8 @@ ApiStatus func_8005DB00(Evt* script, s32 isInitialCall) { } } } else { - if (dist2D(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z) <= npc->planarFlyDist) { - targetDir = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z); + if (dist2D(npc->pos.x, npc->pos.z, playerStatus->pos.x, playerStatus->pos.z) <= npc->planarFlyDist) { + targetDir = atan2(npc->pos.x, npc->pos.z, playerStatus->pos.x, playerStatus->pos.z); npcYaw = script->functionTemp[1] == -1 ? npc->yaw : script->functionTemp[1]; if (fabsf(get_clamped_angle_diff(npcYaw, targetDir)) < script->functionTemp[2]) { diff --git a/src/39210_len_aa0.c b/src/39210_len_aa0.c index d266e7aacfa..7556eaaa740 100644 --- a/src/39210_len_aa0.c +++ b/src/39210_len_aa0.c @@ -17,9 +17,9 @@ void get_npc_pos(s32 npcID, f32* outX, f32* outY, f32* outZ, s32* outAirborne) { *outAirborne = FALSE; if (npcID == NPC_SELF) { - *outX = playerStatus->position.x; - *outY = playerStatus->position.y; - *outZ = playerStatus->position.z; + *outX = playerStatus->pos.x; + *outY = playerStatus->pos.y; + *outZ = playerStatus->pos.z; if (playerStatus->flags & (PS_FLAG_FALLING | PS_FLAG_JUMPING)) { *outAirborne = TRUE; } @@ -44,9 +44,9 @@ void npc_follow_init(Npc* npc, s32 targetNpcID, FollowAnims* anims, f32 walkSpee ASSERT(followData != NULL); for (i = 0; i < ARRAY_COUNT(followData->moveHistory); i++) { - followData->moveHistory[i].pos.x = playerStatus->position.x; - followData->moveHistory[i].pos.y = playerStatus->position.y; - followData->moveHistory[i].pos.z = playerStatus->position.z; + followData->moveHistory[i].pos.x = playerStatus->pos.x; + followData->moveHistory[i].pos.y = playerStatus->pos.y; + followData->moveHistory[i].pos.z = playerStatus->pos.z; followData->moveHistory[i].isAirborne = FALSE; } followData->lastPointIdx = 0; @@ -58,8 +58,8 @@ void npc_follow_init(Npc* npc, s32 targetNpcID, FollowAnims* anims, f32 walkSpee followData->runSpeed = runSpeed; followData->idleRadius = idleRadius; followData->walkRadius = walkRadius; - npc->currentAnim = followData->anims->idle; - npc->jumpVelocity = 0.0f; + npc->curAnim = followData->anims->idle; + npc->jumpVel = 0.0f; npc->flags |= NPC_FLAG_GRAVITY; npc->flags &= ~NPC_FLAG_IGNORE_PLAYER_COLLISION; npc->collisionChannel = COLLISION_CHANNEL_10000; @@ -129,9 +129,9 @@ void npc_follow_npc(Npc* npc) { npc->moveSpeed = followData->runSpeed; } - npc->currentAnim = followData->anims->run; + npc->curAnim = followData->anims->run; if (!(npc->flags & NPC_FLAG_GROUNDED)) { - npc->currentAnim = followData->anims->fall; + npc->curAnim = followData->anims->fall; } while (TRUE) { @@ -157,7 +157,7 @@ void npc_follow_npc(Npc* npc) { if (followData->targetPointIdx == followData->lastPointIdx) { npc->moveSpeed = 0.0f; yaw = npc->yaw; - npc->currentAnim = followData->anims->idle; + npc->curAnim = followData->anims->idle; break; } @@ -165,7 +165,7 @@ void npc_follow_npc(Npc* npc) { if (dist <= followData->idleRadius) { npc->moveSpeed = 0.0f; yaw = npc->yaw; - npc->currentAnim = followData->anims->idle; + npc->curAnim = followData->anims->idle; followData->followState = NPC_FOLLOW_STATE_IDLE; break; } @@ -218,7 +218,7 @@ void npc_follow_npc(Npc* npc) { dist = currentY; } if (dist < followData->idleRadius) { - npc->jumpVelocity = 0.0f; + npc->jumpVel = 0.0f; npc->flags |= NPC_FLAG_GRAVITY; npc->yaw = atan2(npc->pos.x, npc->pos.z, x, z); followData->followState = NPC_FOLLOW_STATE_RUN; @@ -229,29 +229,29 @@ void npc_follow_npc(Npc* npc) { npc->duration = 10; } npc->moveSpeed = npc->planarFlyDist / npc->duration; - npc->jumpVelocity = (currentY + (npc->jumpScale * npc->duration * npc->duration * 0.5f)) / npc->duration; - npc->currentAnim = followData->anims->jump; + npc->jumpVel = (currentY + (npc->jumpScale * npc->duration * npc->duration * 0.5f)) / npc->duration; + npc->curAnim = followData->anims->jump; npc->flags &= ~NPC_FLAG_GRAVITY; followData->followState = NPC_FOLLOW_STATE_FALL; } break; case NPC_FOLLOW_STATE_FALL: - npc->jumpVelocity -= npc->jumpScale; - npc->pos.y += npc->jumpVelocity; - if (npc->jumpVelocity <= 0.0f) { - npc->currentAnim = followData->anims->fall; + npc->jumpVel -= npc->jumpScale; + npc->pos.y += npc->jumpVel; + if (npc->jumpVel <= 0.0f) { + npc->curAnim = followData->anims->fall; } npc_move_heading(npc, npc->moveSpeed, npc->yaw); - if (npc->jumpVelocity <= 0.0f) { + if (npc->jumpVel <= 0.0f) { currentX = npc->pos.x; - dist = fabsf(npc->jumpVelocity) + 8.0; + dist = fabsf(npc->jumpVel) + 8.0; currentY = npc->pos.y + dist; currentZ = npc->pos.z; if (npc_raycast_down_sides(npc->collisionChannel, ¤tX, ¤tY, ¤tZ, &dist) != 0 && - dist <= fabsf(npc->jumpVelocity) + 8.0) + dist <= fabsf(npc->jumpVel) + 8.0) { - npc->currentAnim = followData->anims->land; - npc->jumpVelocity = 0.0f; + npc->curAnim = followData->anims->land; + npc->jumpVel = 0.0f; npc->pos.y = currentY; npc->flags |= NPC_FLAG_GRAVITY; npc->yaw = atan2(currentX, currentZ, x, z); diff --git a/src/415D90.c b/src/415D90.c index e2e9abad23b..76d92a0d8f4 100644 --- a/src/415D90.c +++ b/src/415D90.c @@ -646,7 +646,7 @@ s32 btl_main_menu_update(void) { } break; case BTL_MENU_STATE_ACCEPT_INPUT: - if (battleStatus->currentButtonsPressed & BUTTON_A) { + if (battleStatus->curButtonsPressed & BUTTON_A) { if (BattleMenu_OptionEnabled[BattleMenu_CurPos + BattleMenu_HomePos] == TRUE) { sfx_play_sound(SOUND_MENU_NEXT); BattleMenuState = BTL_MENU_STATE_OPENED_SUBMENU; @@ -658,12 +658,12 @@ s32 btl_main_menu_update(void) { } else { BattleMenu_PrevPos = BattleMenu_CurPos; if (D_802AD004 == 0) { - if ((battleStatus->currentButtonsHeld & (BUTTON_STICK_LEFT | BUTTON_STICK_UP)) && + if ((battleStatus->curButtonsHeld & (BUTTON_STICK_LEFT | BUTTON_STICK_UP)) && BattleMenu_MinIdx < BattleMenu_CurPos) { BattleMenu_CurPos--; } - if ((battleStatus->currentButtonsHeld & (BUTTON_STICK_RIGHT | BUTTON_STICK_DOWN)) && + if ((battleStatus->curButtonsHeld & (BUTTON_STICK_RIGHT | BUTTON_STICK_DOWN)) && BattleMenu_CurPos < BattleMenu_MaxIdx) { BattleMenu_CurPos++; @@ -1213,18 +1213,18 @@ s32 btl_submenu_moves_update(void) { break; case BTL_SUBMENU_MOVES_STATE_UNK_1: D_802AD10A = battle_menu_moveCursorPos; - if (battleStatus->currentButtonsHeld & (BUTTON_STICK_UP | BUTTON_Z)) { + if (battleStatus->curButtonsHeld & (BUTTON_STICK_UP | BUTTON_Z)) { if (battle_menu_moveCursorPos > 0) { battle_menu_moveCursorPos--; - } else if (battleStatus->currentButtonsPressed & (BUTTON_STICK_UP | BUTTON_Z)) { + } else if (battleStatus->curButtonsPressed & (BUTTON_STICK_UP | BUTTON_Z)) { battle_menu_moveCursorPos--; } } - if (battleStatus->currentButtonsHeld & (BUTTON_STICK_DOWN | BUTTON_R)) { + if (battleStatus->curButtonsHeld & (BUTTON_STICK_DOWN | BUTTON_R)) { if (battle_menu_moveCursorPos < BattleMenu_Moves_OptionCount - 1) { battle_menu_moveCursorPos++; - } else if (battleStatus->currentButtonsPressed & (BUTTON_STICK_DOWN | BUTTON_R)) { + } else if (battleStatus->curButtonsPressed & (BUTTON_STICK_DOWN | BUTTON_R)) { battle_menu_moveCursorPos++; } } @@ -1260,7 +1260,7 @@ s32 btl_submenu_moves_update(void) { } D_802AD10D = battle_menu_moveScrollLine + 6; - if (battleStatus->currentButtonsPressed & BUTTON_A) { + if (battleStatus->curButtonsPressed & BUTTON_A) { if (BattleMenu_Moves_OptionEnabled[BattleMenu_Moves_OptionIndexMap[battle_menu_moveCursorPos]] == 1) { sfx_play_sound(SOUND_MENU_NEXT); battle_menu_moveState = BTL_SUBMENU_MOVES_STATE_UNK_NEGATIVE_ONE; @@ -1276,7 +1276,7 @@ s32 btl_submenu_moves_update(void) { break; } - if (battleStatus->currentButtonsPressed & BUTTON_B) { + if (battleStatus->curButtonsPressed & BUTTON_B) { sfx_play_sound(SOUND_MENU_BACK); func_802A27E4(); battle_menu_moveState = BTL_SUBMENU_MOVES_STATE_UNK_NEGATIVE_TWO; @@ -1851,18 +1851,18 @@ s32 func_802A4A54(void) { case 1: if (D_802AD607 == 0) { D_802AD606 = D_802AD605; - if (battleStatus->currentButtonsHeld & BUTTON_STICK_UP) { + if (battleStatus->curButtonsHeld & BUTTON_STICK_UP) { if (D_802AD605 > 0) { D_802AD605--; - } else if (battleStatus->currentButtonsPressed & BUTTON_STICK_UP) { + } else if (battleStatus->curButtonsPressed & BUTTON_STICK_UP) { D_802AD605--; } } - if (battleStatus->currentButtonsHeld & BUTTON_STICK_DOWN) { + if (battleStatus->curButtonsHeld & BUTTON_STICK_DOWN) { if (D_802AD605 < D_802AD66C - 1) { D_802AD605++; - } else if (battleStatus->currentButtonsPressed & BUTTON_STICK_DOWN) { + } else if (battleStatus->curButtonsPressed & BUTTON_STICK_DOWN) { D_802AD605++; } } @@ -1890,7 +1890,7 @@ s32 func_802A4A54(void) { D_802AD609 = D_802AD66C; } - if (battleStatus->currentButtonsPressed & BUTTON_A) { + if (battleStatus->curButtonsPressed & BUTTON_A) { if (D_802AD690[D_802AD605] == 1) { sfx_play_sound(SOUND_MENU_NEXT); BattleSubmenuStratsState = -1; @@ -1902,7 +1902,7 @@ s32 func_802A4A54(void) { break; } - if (battleStatus->currentButtonsPressed & BUTTON_B) { + if (battleStatus->curButtonsPressed & BUTTON_B) { sfx_play_sound(SOUND_MENU_BACK); func_802A472C(); BattleSubmenuStratsState = -2; @@ -2233,7 +2233,7 @@ void btl_state_update_player_menu(void) { case BTL_SUBSTATE_PLAYER_MENU_INIT: battleStatus->moveCategory = BTL_MENU_TYPE_INVALID; battleStatus->selectedMoveID = 0; - battleStatus->currentAttackElement = 0; + battleStatus->curAttackElement = 0; if (!can_btl_state_update_switch_to_player()) { btl_set_state(BATTLE_STATE_END_PLAYER_TURN); return; @@ -2244,8 +2244,8 @@ void btl_state_update_player_menu(void) { gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_CREATE_MAIN_MENU; } else { gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_PERFORM_SWAP; - partnerActor->state.currentPos.x = partnerActor->homePos.x; - partnerActor->state.currentPos.z = partnerActor->homePos.z; + partnerActor->state.curPos.x = partnerActor->homePos.x; + partnerActor->state.curPos.z = partnerActor->homePos.z; partnerActor->state.goalPos.x = playerActor->homePos.x; partnerActor->state.goalPos.z = playerActor->homePos.z; partnerActor->state.moveTime = 4; @@ -2254,27 +2254,27 @@ void btl_state_update_player_menu(void) { break; case BTL_SUBSTATE_PLAYER_MENU_PERFORM_SWAP: if (partnerActor->state.moveTime != 0) { - partnerActor->currentPos.x += (partnerActor->state.goalPos.x - partnerActor->currentPos.x) / partnerActor->state.moveTime; - partnerActor->currentPos.z += (partnerActor->state.goalPos.z - partnerActor->currentPos.z) / partnerActor->state.moveTime; - playerActor->currentPos.x += (partnerActor->state.currentPos.x - playerActor->currentPos.x) / partnerActor->state.moveTime; - playerActor->currentPos.z += (partnerActor->state.currentPos.z - playerActor->currentPos.z) / partnerActor->state.moveTime; + partnerActor->curPos.x += (partnerActor->state.goalPos.x - partnerActor->curPos.x) / partnerActor->state.moveTime; + partnerActor->curPos.z += (partnerActor->state.goalPos.z - partnerActor->curPos.z) / partnerActor->state.moveTime; + playerActor->curPos.x += (partnerActor->state.curPos.x - playerActor->curPos.x) / partnerActor->state.moveTime; + playerActor->curPos.z += (partnerActor->state.curPos.z - playerActor->curPos.z) / partnerActor->state.moveTime; } - partnerActor->currentPos.z -= sin_rad(DEG_TO_RAD(partnerActor->state.angle)) * 16.0f; + partnerActor->curPos.z -= sin_rad(DEG_TO_RAD(partnerActor->state.angle)) * 16.0f; partnerActor->yaw = clamp_angle(-partnerActor->state.angle); - playerActor->currentPos.z += sin_rad(DEG_TO_RAD(partnerActor->state.angle)) * 16.0f; + playerActor->curPos.z += sin_rad(DEG_TO_RAD(partnerActor->state.angle)) * 16.0f; playerActor->yaw = clamp_angle(-partnerActor->state.angle); partnerActor->state.angle += 90.0f; if (partnerActor->state.moveTime != 0) { partnerActor->state.moveTime--; } else { - partnerActor->currentPos.x = partnerActor->state.goalPos.x; - partnerActor->currentPos.z = partnerActor->state.goalPos.z; - playerActor->currentPos.x = partnerActor->state.currentPos.x; - playerActor->currentPos.z = partnerActor->state.currentPos.z; - partnerActor->homePos.x = partnerActor->currentPos.x; - partnerActor->homePos.z = partnerActor->currentPos.z; - playerActor->homePos.x = playerActor->currentPos.x; - playerActor->homePos.z = playerActor->currentPos.z; + partnerActor->curPos.x = partnerActor->state.goalPos.x; + partnerActor->curPos.z = partnerActor->state.goalPos.z; + playerActor->curPos.x = partnerActor->state.curPos.x; + playerActor->curPos.z = partnerActor->state.curPos.z; + partnerActor->homePos.x = partnerActor->curPos.x; + partnerActor->homePos.z = partnerActor->curPos.z; + playerActor->homePos.x = playerActor->curPos.x; + playerActor->homePos.z = playerActor->curPos.z; gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_CREATE_MAIN_MENU; battleStatus->flags1 &= ~BS_FLAGS1_PLAYER_IN_BACK; } @@ -2467,14 +2467,14 @@ void btl_state_update_player_menu(void) { D_802ACC60--; } else if (submenuResult != 0) { set_animation(ACTOR_PLAYER, 0, ANIM_Mario1_Walk); - battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_MAIN] = battleStatus->currentSubmenu = battle_menu_submenuIDs[submenuResult - 1]; + battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_MAIN] = battleStatus->curSubmenu = battle_menu_submenuIDs[submenuResult - 1]; for (i = 0; i < ARRAY_COUNT(battleStatus->submenuMoves); i++) { battleStatus->submenuMoves[i] = 0; battleStatus->submenuIcons[0] = 0; ///< @bug ? battleStatus->submenuStatus[i] = 0; } - switch (battleStatus->currentSubmenu) { + switch (battleStatus->curSubmenu) { case BTL_MENU_TYPE_ITEMS: battleStatus->submenuMoves[0] = D_802AB4F0[8]; battleStatus->submenuIcons[0] = ITEM_PARTNER_ATTACK; @@ -2487,7 +2487,7 @@ void btl_state_update_player_menu(void) { battleStatus->moveCategory = BTL_MENU_TYPE_ITEMS; battleStatus->moveArgument = playerData->invItems[i]; - battleStatus->currentTargetListFlags = itemData->targetFlags; + battleStatus->curTargetListFlags = itemData->targetFlags; player_create_target_list(playerActor); } entryIdx = 1; @@ -2495,7 +2495,7 @@ void btl_state_update_player_menu(void) { if (playerData->equippedBadges[i] != 0) { s32 moveID = gItemTable[playerData->equippedBadges[i]].moveID; moveData = &gMoveTable[moveID]; - if (moveData->category == D_802AB4F0[battleStatus->currentSubmenu]) { + if (moveData->category == D_802AB4F0[battleStatus->curSubmenu]) { battleStatus->submenuMoves[entryIdx] = moveID; battleStatus->submenuIcons[entryIdx] = playerData->equippedBadges[i]; battleStatus->submenuStatus[entryIdx] = 1; @@ -2542,7 +2542,7 @@ void btl_state_update_player_menu(void) { battleStatus->submenuIcons[entryIdx] = 0; battleStatus->moveCategory = BTL_MENU_TYPE_STAR_POWERS; battleStatus->moveArgument = MOVE_REFRESH + i; - battleStatus->currentTargetListFlags = moveData->flags; + battleStatus->curTargetListFlags = moveData->flags; player_create_target_list(playerActor); battleStatus->submenuStatus[entryIdx] = 1; if (playerActor->targetListLength == 0) { @@ -2564,7 +2564,7 @@ void btl_state_update_player_menu(void) { battleStatus->submenuIcons[entryIdx] = 0; battleStatus->moveCategory = BTL_MENU_TYPE_STAR_POWERS; battleStatus->moveArgument = MOVE_REFRESH + i; - battleStatus->currentTargetListFlags = moveData->flags; + battleStatus->curTargetListFlags = moveData->flags; player_create_target_list(playerActor); battleStatus->submenuStatus[entryIdx] = starBeamLevel; if (playerActor->targetListLength == 0) { @@ -2587,7 +2587,7 @@ void btl_state_update_player_menu(void) { battleStatus->submenuIcons[entryIdx] = 0; battleStatus->moveCategory = BTL_MENU_TYPE_STAR_POWERS; battleStatus->moveArgument = MOVE_REFRESH + i; - battleStatus->currentTargetListFlags = moveData->flags; + battleStatus->curTargetListFlags = moveData->flags; player_create_target_list(playerActor); battleStatus->submenuStatus[entryIdx] = 1; if (playerActor->targetListLength == 0) { @@ -2608,7 +2608,7 @@ void btl_state_update_player_menu(void) { } while (0); // TODO required to match } - currentSubmenu = battleStatus->currentSubmenu; + currentSubmenu = battleStatus->curSubmenu; if (currentSubmenu == BTL_MENU_TYPE_STAR_POWERS) { gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_STAR_SPIRITS_1; btl_state_update_player_menu(); @@ -2648,13 +2648,13 @@ void btl_state_update_player_menu(void) { } initialPos = battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_JUMP]; } - if (battleStatus->currentSubmenu == BTL_MENU_TYPE_SMASH) { + if (battleStatus->curSubmenu == BTL_MENU_TYPE_SMASH) { if (battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_SMASH] < 0) { battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_SMASH] = 0; } initialPos = battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_SMASH]; } - if (battleStatus->currentSubmenu == BTL_MENU_TYPE_ITEMS) { + if (battleStatus->curSubmenu == BTL_MENU_TYPE_ITEMS) { if (battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_ITEMS] < 0) { battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_ITEMS] = 0; } @@ -2732,16 +2732,16 @@ void btl_state_update_player_menu(void) { } else { battleStatus->unk_49 = BattleMenu_Moves_OptionIndices[submenuResult - 1]; battleStatus->selectedMoveID = battleStatus->submenuMoves[battleStatus->unk_49]; - if (battleStatus->currentSubmenu == BTL_MENU_TYPE_JUMP) { + if (battleStatus->curSubmenu == BTL_MENU_TYPE_JUMP) { battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_JUMP] = battle_menu_moveOptionActive; } - if (battleStatus->currentSubmenu == BTL_MENU_TYPE_SMASH) { + if (battleStatus->curSubmenu == BTL_MENU_TYPE_SMASH) { battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_SMASH] = battle_menu_moveOptionActive; } - currentSubmenu2 = battleStatus->currentSubmenu; - if (battleStatus->currentSubmenu == BTL_MENU_TYPE_ITEMS) { + currentSubmenu2 = battleStatus->curSubmenu; + if (battleStatus->curSubmenu == BTL_MENU_TYPE_ITEMS) { battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_ITEMS] = battle_menu_moveOptionActive; - if (battleStatus->currentSubmenu == currentSubmenu2) { + if (battleStatus->curSubmenu == currentSubmenu2) { gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_UNKNOWN_1; btl_state_update_player_menu(); btl_state_update_player_menu(); @@ -2755,7 +2755,7 @@ void btl_state_update_player_menu(void) { break; case BTL_SUBSTATE_PLAYER_MENU_MOVE_CHOOSE_TARGET: submenuResult = btl_submenu_moves_update(); - if ((battleStatus->currentButtonsPressed & BUTTON_B) && submenuResult == 0) { + if ((battleStatus->curButtonsPressed & BUTTON_B) && submenuResult == 0) { func_802A2AB8(); func_802A1098(); gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_MAIN_MENU_4; @@ -2767,8 +2767,8 @@ void btl_state_update_player_menu(void) { battleStatus->cancelTargetMenuSubstate = BTL_SUBSTATE_PLAYER_MENU_MOVE_TARGET_CANCEL; battleStatus->acceptTargetMenuSubstate = BTL_SUBSTATE_PLAYER_MENU_MOVE_TARGET_CHOSEN; battleStatus->selectedMoveID = battleStatus->submenuMoves[battleStatus->unk_49]; - battleStatus->currentTargetListFlags = gMoveTable[battleStatus->submenuMoves[battleStatus->unk_49]].flags; - currentSubmenu = battleStatus->currentSubmenu; + battleStatus->curTargetListFlags = gMoveTable[battleStatus->submenuMoves[battleStatus->unk_49]].flags; + currentSubmenu = battleStatus->curSubmenu; switch (currentSubmenu) { case BTL_MENU_TYPE_JUMP: battleStatus->moveCategory = BTL_MENU_TYPE_JUMP; @@ -2813,7 +2813,7 @@ void btl_state_update_player_menu(void) { if (gBattleStatus.flags2 & BS_FLAGS2_4) { btl_show_variable_battle_message(BTL_MSG_CANT_SWITCH, 60, 0); } else { - btl_show_variable_battle_message(BTL_MSG_CANT_MOVE, 60, playerData->currentPartner); + btl_show_variable_battle_message(BTL_MSG_CANT_MOVE, 60, playerData->curPartner); } D_802AD607 = 1; gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_MAIN_AWAIT_CANT_SWAP; @@ -2833,25 +2833,25 @@ void btl_state_update_player_menu(void) { break; case BTL_SUBSTATE_PLAYER_MENU_MAIN_MENU_11: submenuResult = btl_main_menu_update(); - if ((battleStatus->currentButtonsPressed & BUTTON_B) && submenuResult == 0) { + if ((battleStatus->curButtonsPressed & BUTTON_B) && submenuResult == 0) { func_802A1078(); gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_MAIN_MENU_12; } else if (submenuResult != 0) { battleStatus->cancelTargetMenuSubstate = BTL_SUBSTATE_PLAYER_MENU_MAIN_MENU_13; battleStatus->acceptTargetMenuSubstate = BTL_SUBSTATE_PLAYER_MENU_MAIN_MENU_14; - switch (battleStatus->currentSubmenu) { + switch (battleStatus->curSubmenu) { case BTL_MENU_TYPE_JUMP: battleStatus->moveCategory = BTL_MENU_TYPE_JUMP; battleStatus->moveArgument = playerData->bootsLevel; battleStatus->selectedMoveID = playerData->bootsLevel + MOVE_JUMP1; - battleStatus->currentTargetListFlags = gMoveTable[battleStatus->selectedMoveID].flags; + battleStatus->curTargetListFlags = gMoveTable[battleStatus->selectedMoveID].flags; btl_set_state(BATTLE_STATE_SELECT_TARGET); break; case BTL_MENU_TYPE_SMASH: battleStatus->moveCategory = BTL_MENU_TYPE_SMASH; battleStatus->moveArgument = playerData->hammerLevel; battleStatus->selectedMoveID = playerData->hammerLevel + MOVE_HAMMER1; - battleStatus->currentTargetListFlags = gMoveTable[battleStatus->selectedMoveID].flags; + battleStatus->curTargetListFlags = gMoveTable[battleStatus->selectedMoveID].flags; btl_set_state(BATTLE_STATE_SELECT_TARGET); break; default: @@ -2894,7 +2894,7 @@ void btl_state_update_player_menu(void) { } battleStatus->moveCategory = BTL_MENU_TYPE_ITEMS; battleStatus->moveArgument = playerData->invItems[i]; - battleStatus->currentTargetListFlags = itemData->targetFlags; + battleStatus->curTargetListFlags = itemData->targetFlags; player_create_target_list(playerActor); popup->ptrIcon[entryIdx] = hudScriptPair->enabled; popup->userIndex[entryIdx] = playerData->invItems[i]; @@ -2943,8 +2943,8 @@ void btl_state_update_player_menu(void) { battleStatus->unk_1AA = popup->userIndex[popup->result - 1]; battleStatus->moveCategory = BTL_MENU_TYPE_ITEMS; battleStatus->moveArgument = battleStatus->unk_1AA; - battleStatus->currentTargetListFlags = gItemTable[battleStatus->moveArgument].targetFlags | TARGET_FLAG_8000; - battleStatus->currentAttackElement = 0; + battleStatus->curTargetListFlags = gItemTable[battleStatus->moveArgument].targetFlags | TARGET_FLAG_8000; + battleStatus->curAttackElement = 0; battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_DIP] = popup->result - 1; hide_popup_menu(); func_802A27D0(); @@ -2954,7 +2954,7 @@ void btl_state_update_player_menu(void) { } break; case BTL_SUBSTATE_PLAYER_MENU_UNKNOWN_3: - if ((battleStatus->currentButtonsPressed & BUTTON_B) && popup->result == POPUP_RESULT_CHOOSING) { + if ((battleStatus->curButtonsPressed & BUTTON_B) && popup->result == POPUP_RESULT_CHOOSING) { func_800F16CC(); func_802A2C58(); func_802A1098(); @@ -2998,7 +2998,7 @@ void btl_state_update_player_menu(void) { } battleStatus->moveCategory = BTL_MENU_TYPE_ITEMS; battleStatus->moveArgument = playerData->invItems[i]; - battleStatus->currentTargetListFlags = itemData->targetFlags; + battleStatus->curTargetListFlags = itemData->targetFlags; player_create_target_list(playerActor); popup->ptrIcon[entryIdx] = hudScriptPair->enabled; @@ -3041,8 +3041,8 @@ void btl_state_update_player_menu(void) { battleStatus->moveCategory = BTL_MENU_TYPE_ITEMS; battleStatus->moveArgument = battleStatus->unk_1AA; battleStatus->selectedMoveID = MOVE_ITEMS; - battleStatus->currentTargetListFlags = gItemTable[battleStatus->moveArgument].targetFlags | TARGET_FLAG_8000; - battleStatus->currentAttackElement = 0; + battleStatus->curTargetListFlags = gItemTable[battleStatus->moveArgument].targetFlags | TARGET_FLAG_8000; + battleStatus->curAttackElement = 0; battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_DIP] = popup->result - 1; hide_popup_menu(); func_802A1030(); @@ -3051,7 +3051,7 @@ void btl_state_update_player_menu(void) { } break; case BTL_SUBSTATE_PLAYER_MENU_ITEMS_3: - if ((battleStatus->currentButtonsPressed & BUTTON_B) && popup->result == POPUP_RESULT_CHOOSING) { + if ((battleStatus->curButtonsPressed & BUTTON_B) && popup->result == POPUP_RESULT_CHOOSING) { func_800F16CC(); func_802A1098(); gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_ITEMS_4; @@ -3143,7 +3143,7 @@ void btl_state_update_player_menu(void) { break; case BTL_SUBSTATE_PLAYER_MENU_STAR_SPIRITS_3: submenuResult = btl_submenu_moves_update(); - if ((battleStatus->currentButtonsPressed & BUTTON_B) && submenuResult == 0) { + if ((battleStatus->curButtonsPressed & BUTTON_B) && submenuResult == 0) { func_802A2AB8(); func_802A1098(); gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_STAR_SPIRITS_4; @@ -3152,7 +3152,7 @@ void btl_state_update_player_menu(void) { battleStatus->acceptTargetMenuSubstate = BTL_SUBSTATE_PLAYER_MENU_STAR_SPIRITS_6; battleStatus->moveCategory = BTL_MENU_TYPE_STAR_POWERS; battleStatus->selectedMoveID = battleStatus->submenuMoves[battleStatus->unk_49]; - battleStatus->currentTargetListFlags = gMoveTable[battleStatus->submenuMoves[battleStatus->unk_49]].flags; + battleStatus->curTargetListFlags = gMoveTable[battleStatus->submenuMoves[battleStatus->unk_49]].flags; battleStatus->moveArgument = battleStatus->unk_49; if (playerData->starBeamLevel == 2 && battleStatus->moveArgument == 8) { battleStatus->moveArgument++; @@ -3198,7 +3198,7 @@ void btl_state_update_player_menu(void) { battleStatus->moveCategory = BTL_MENU_TYPE_ITEMS; battleStatus->moveArgument = playerData->invItems[i]; - battleStatus->currentTargetListFlags = itemData->targetFlags; + battleStatus->curTargetListFlags = itemData->targetFlags; player_create_target_list(playerActor); popup->ptrIcon[entryIdx] = hudScriptPair->enabled; popup->userIndex[entryIdx] = playerData->invItems[i]; @@ -3249,8 +3249,8 @@ void btl_state_update_player_menu(void) { battleStatus->unk_1AA = popup->userIndex[popup->result - 1]; battleStatus->moveCategory = BTL_MENU_TYPE_ITEMS; battleStatus->moveArgument = battleStatus->unk_1AA; - battleStatus->currentTargetListFlags = gItemTable[battleStatus->moveArgument].targetFlags | TARGET_FLAG_8000; - battleStatus->currentAttackElement = 0; + battleStatus->curTargetListFlags = gItemTable[battleStatus->moveArgument].targetFlags | TARGET_FLAG_8000; + battleStatus->curAttackElement = 0; battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_DIP] = popup->result - 1; hide_popup_menu(); D_802ACC60 = 5; @@ -3282,7 +3282,7 @@ void btl_state_update_player_menu(void) { break; case BTL_SUBSTATE_PLAYER_MENU_BERSERKER_1: if (playerData->bootsLevel >= 0) { - battleStatus->currentTargetListFlags = gMoveTable[MOVE_UNUSED_JUMP5].flags; + battleStatus->curTargetListFlags = gMoveTable[MOVE_UNUSED_JUMP5].flags; player_create_target_list(playerActor); jumpTargetCount = playerActor->targetListLength; } else { @@ -3290,7 +3290,7 @@ void btl_state_update_player_menu(void) { } if (playerData->hammerLevel >= 0) { - battleStatus->currentTargetListFlags = gMoveTable[MOVE_UNUSED_HAMMER5].flags; + battleStatus->curTargetListFlags = gMoveTable[MOVE_UNUSED_HAMMER5].flags; player_create_target_list(playerActor); hammerTargetCount = playerActor->targetListLength; } else { @@ -3312,13 +3312,13 @@ void btl_state_update_player_menu(void) { if (rand_int(100) < jumpChance) { battleStatus->selectedMoveID = MOVE_UNUSED_JUMP5; battleStatus->moveCategory = BTL_MENU_TYPE_JUMP; - battleStatus->currentTargetListFlags = gMoveTable[MOVE_UNUSED_JUMP5].flags; + battleStatus->curTargetListFlags = gMoveTable[MOVE_UNUSED_JUMP5].flags; battleStatus->moveArgument = playerData->bootsLevel; player_create_target_list(playerActor); } else { battleStatus->selectedMoveID = MOVE_UNUSED_HAMMER5; battleStatus->moveCategory = BTL_MENU_TYPE_SMASH; - battleStatus->currentTargetListFlags = gMoveTable[MOVE_UNUSED_HAMMER5].flags; + battleStatus->curTargetListFlags = gMoveTable[MOVE_UNUSED_HAMMER5].flags; battleStatus->moveArgument = playerData->hammerLevel; player_create_target_list(playerActor); } @@ -3331,11 +3331,11 @@ void btl_state_update_player_menu(void) { if (battleStatus->changePartnerAllowed >= 0) { D_802AD678[0] = BTL_MENU_TYPE_CHANGE_PARTNER; D_802AD658[0] = BattleMenu_LeftJustMessages[BTL_MENU_TYPE_CHANGE_PARTNER]; - D_802AD640[0] = battle_menu_PartnerHudScripts[playerData->currentPartner]; + D_802AD640[0] = battle_menu_PartnerHudScripts[playerData->curPartner]; D_802AD690[0] = 1; D_802AD6C0[0] = MSG_Menus_Action_ChangePartner; if (battleStatus->changePartnerAllowed <= 0) { - D_802AD640[0] = battle_menu_DisabledPartnerHudScripts[playerData->currentPartner]; + D_802AD640[0] = battle_menu_DisabledPartnerHudScripts[playerData->curPartner]; D_802AD690[0] = 0; D_802AD6A8[0] = 0; } @@ -3383,9 +3383,9 @@ void btl_state_update_player_menu(void) { btl_state_update_player_menu(); btl_state_update_player_menu(); } else { - battleStatus->currentSubmenu = D_802AD678[submenuResult - 1]; + battleStatus->curSubmenu = D_802AD678[submenuResult - 1]; battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_STRATEGY] = submenuResult - 1; - if (battleStatus->currentSubmenu == 5) { + if (battleStatus->curSubmenu == 5) { gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_CHANGE_MEMBER_1; btl_state_update_player_menu(); btl_state_update_player_menu(); @@ -3398,14 +3398,14 @@ void btl_state_update_player_menu(void) { break; case BTL_SUBSTATE_PLAYER_MENU_STRATEGIES_3: submenuResult = func_802A4A54(); - if ((battleStatus->currentButtonsPressed & BUTTON_B) && submenuResult == 0) { + if ((battleStatus->curButtonsPressed & BUTTON_B) && submenuResult == 0) { func_802A48FC(); func_802A1098(); gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_STRATEGIES_4; } else if (btl_main_menu_update() != 0) { battleStatus->cancelTargetMenuSubstate = BTL_SUBSTATE_PLAYER_MENU_STRATEGIES_5; battleStatus->acceptTargetMenuSubstate = BTL_SUBSTATE_PLAYER_MENU_STRATEGIES_6; - switch (battleStatus->currentSubmenu) { + switch (battleStatus->curSubmenu) { case 3: gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_STRATEGIES_6; btl_state_update_player_menu(); @@ -3469,7 +3469,7 @@ void btl_state_update_player_menu(void) { popup->nameMsg[entryIdx] = prop->nameMsg; popup->descMsg[entryIdx] = prop->battleDescMsg; popup->value[entryIdx] = playerData->partners[partnerId].level; - if (playerData->currentPartner == partnerId) { + if (playerData->curPartner == partnerId) { popup->enabled[entryIdx] = 0; popup->ptrIcon[entryIdx] = battle_menu_DisabledPartnerHudScripts[partnerId]; } @@ -3481,7 +3481,7 @@ void btl_state_update_player_menu(void) { } popup->popupType = POPUP_MENU_SWITCH_PARTNER; popup->numEntries = entryIdx; - popup->initialPos = MenuIndexFromPartnerID[playerData->currentPartner] - 1; + popup->initialPos = MenuIndexFromPartnerID[playerData->curPartner] - 1; popup->dipMode = 0; popup->titleNumber = 0; create_battle_popup_menu(popup); @@ -3503,7 +3503,7 @@ void btl_state_update_player_menu(void) { battleStatus->unk_1AC = popup->userIndex[popup->result - 1]; battleStatus->moveCategory = BTL_MENU_TYPE_CHANGE_PARTNER; battleStatus->selectedMoveID = MOVE_UNUSED_37; - battleStatus->currentTargetListFlags = TARGET_FLAG_2; + battleStatus->curTargetListFlags = TARGET_FLAG_2; battleStatus->moveArgument = battleStatus->unk_1AC; battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_PARTNER] = popup->result - 1; hide_popup_menu(); @@ -3514,7 +3514,7 @@ void btl_state_update_player_menu(void) { } break; case BTL_SUBSTATE_PLAYER_MENU_CHANGE_MEMBER_3: - if ((battleStatus->currentButtonsPressed & BUTTON_B) && popup->result == POPUP_RESULT_CHOOSING) { + if ((battleStatus->curButtonsPressed & BUTTON_B) && popup->result == POPUP_RESULT_CHOOSING) { func_800F16CC(); func_802A4A10(); func_802A1098(); @@ -3629,7 +3629,7 @@ void btl_state_update_partner_menu(void) { if (gBattleSubState == BTL_SUBSTATE_PARTNER_MENU_NONE) { battleStatus->moveCategory = BTL_MENU_TYPE_INVALID; battleStatus->selectedMoveID = MOVE_NONE; - battleStatus->currentAttackElement = 0; + battleStatus->curAttackElement = 0; if (!func_802A58D0()) { btl_set_state(BATTLE_STATE_9); } else { @@ -3641,8 +3641,8 @@ void btl_state_update_partner_menu(void) { gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_INIT_MENU; } else { gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_12D; - partnerActor->state.currentPos.x = partnerActor->homePos.x; - partnerActor->state.currentPos.z = partnerActor->homePos.z; + partnerActor->state.curPos.x = partnerActor->homePos.x; + partnerActor->state.curPos.z = partnerActor->homePos.z; partnerActor->state.goalPos.x = playerActor->homePos.x; partnerActor->state.goalPos.z = playerActor->homePos.z; partnerActor->state.moveTime = 4; @@ -3652,28 +3652,28 @@ void btl_state_update_partner_menu(void) { } if (gBattleSubState == BTL_SUBSTATE_PARTNER_MENU_12D) { if (partnerActor->state.moveTime != 0) { - partnerActor->currentPos.x += (partnerActor->state.goalPos.x - partnerActor->currentPos.x) / partnerActor->state.moveTime; - partnerActor->currentPos.z += (partnerActor->state.goalPos.z - partnerActor->currentPos.z) / partnerActor->state.moveTime; - playerActor->currentPos.x += (partnerActor->state.currentPos.x - playerActor->currentPos.x) / partnerActor->state.moveTime; - playerActor->currentPos.z += (partnerActor->state.currentPos.z - playerActor->currentPos.z) / partnerActor->state.moveTime; + partnerActor->curPos.x += (partnerActor->state.goalPos.x - partnerActor->curPos.x) / partnerActor->state.moveTime; + partnerActor->curPos.z += (partnerActor->state.goalPos.z - partnerActor->curPos.z) / partnerActor->state.moveTime; + playerActor->curPos.x += (partnerActor->state.curPos.x - playerActor->curPos.x) / partnerActor->state.moveTime; + playerActor->curPos.z += (partnerActor->state.curPos.z - playerActor->curPos.z) / partnerActor->state.moveTime; } - partnerActor->currentPos.z += sin_rad(DEG_TO_RAD(partnerActor->state.angle)) * 16.0f; + partnerActor->curPos.z += sin_rad(DEG_TO_RAD(partnerActor->state.angle)) * 16.0f; partnerActor->yaw = clamp_angle(-partnerActor->state.angle); - playerActor->currentPos.z -= sin_rad(DEG_TO_RAD(partnerActor->state.angle)) * 16.0f; + playerActor->curPos.z -= sin_rad(DEG_TO_RAD(partnerActor->state.angle)) * 16.0f; playerActor->yaw = clamp_angle(-partnerActor->state.angle); partnerActor->state.angle += 90.0f; if (partnerActor->state.moveTime != 0) { partnerActor->state.moveTime--; } else { gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_INIT_MENU; - partnerActor->currentPos.x = partnerActor->state.goalPos.x; - partnerActor->currentPos.z = partnerActor->state.goalPos.z; - playerActor->currentPos.x = partnerActor->state.currentPos.x; - playerActor->currentPos.z = partnerActor->state.currentPos.z; - partnerActor->homePos.x = partnerActor->currentPos.x; - partnerActor->homePos.z = partnerActor->currentPos.z; - playerActor->homePos.x = playerActor->currentPos.x; - playerActor->homePos.z = playerActor->currentPos.z; + partnerActor->curPos.x = partnerActor->state.goalPos.x; + partnerActor->curPos.z = partnerActor->state.goalPos.z; + playerActor->curPos.x = partnerActor->state.curPos.x; + playerActor->curPos.z = partnerActor->state.curPos.z; + partnerActor->homePos.x = partnerActor->curPos.x; + partnerActor->homePos.z = partnerActor->curPos.z; + playerActor->homePos.x = playerActor->curPos.x; + playerActor->homePos.z = playerActor->curPos.z; gBattleStatus.flags1 |= BS_FLAGS1_PLAYER_IN_BACK; } } @@ -3710,17 +3710,17 @@ void btl_state_update_partner_menu(void) { entryIdx++; // abilities menu category - BattleMenu_HudScripts[entryIdx] = battle_menu_PartnerMoveHudScripts[playerData->currentPartner][0]; + BattleMenu_HudScripts[entryIdx] = battle_menu_PartnerMoveHudScripts[playerData->curPartner][0]; battle_menu_submenuIDs[entryIdx] = BTL_MENU_TYPE_ABILITY; BattleMenu_OptionEnabled[entryIdx] = TRUE; BattleMenu_TitleMessages[entryIdx] = BattleMenu_CenteredMessages[BTL_MENU_TYPE_ABILITY]; if (battleStatus->menuStatus[3] <= 0) { - BattleMenu_HudScripts[entryIdx] = battle_menu_PartnerMoveHudScripts[playerData->currentPartner][1]; + BattleMenu_HudScripts[entryIdx] = battle_menu_PartnerMoveHudScripts[playerData->curPartner][1]; BattleMenu_OptionEnabled[entryIdx] = FALSE; battle_menu_isMessageDisabled[entryIdx] = BTL_MSG_CANT_SELECT_NOW; } if (!(battleStatus->enabledMenusFlags & BTL_MENU_ENABLED_ABILITIES)) { - BattleMenu_HudScripts[entryIdx] = battle_menu_PartnerMoveHudScripts[playerData->currentPartner][1]; + BattleMenu_HudScripts[entryIdx] = battle_menu_PartnerMoveHudScripts[playerData->curPartner][1]; BattleMenu_OptionEnabled[entryIdx] = FALSE; battle_menu_isMessageDisabled[entryIdx] = BTL_MSG_CANT_SELECT_NOW; } @@ -3762,7 +3762,7 @@ void btl_state_update_partner_menu(void) { gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_1; return; case BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_1: - set_animation(ACTOR_PARTNER, 0, BattleMenu_PartnerThinkAnims[playerData->currentPartner]); + set_animation(ACTOR_PARTNER, 0, BattleMenu_PartnerThinkAnims[playerData->curPartner]); gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_2; case BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_2: entryIdx = btl_main_menu_update(); @@ -3785,7 +3785,7 @@ void btl_state_update_partner_menu(void) { if (D_802ACC60 != 0) { D_802ACC60--; } else if (entryIdx != 0) { - set_animation(ACTOR_PARTNER, 0, BattleMenu_PartnerIdleAnims[playerData->currentPartner]); + set_animation(ACTOR_PARTNER, 0, BattleMenu_PartnerIdleAnims[playerData->curPartner]); battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_MAIN] = battleStatus->unk_4A = battle_menu_submenuIDs[entryIdx - 1]; if (battleStatus->unk_4A == 7) { gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_STRATEGIES_1; @@ -3817,7 +3817,7 @@ void btl_state_update_partner_menu(void) { break; case BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_3: entryIdx = btl_main_menu_update(); - if ((battleStatus->currentButtonsPressed & BUTTON_B) && entryIdx == 0) { + if ((battleStatus->curButtonsPressed & BUTTON_B) && entryIdx == 0) { func_802A1078(); gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_4; return; @@ -3826,7 +3826,7 @@ void btl_state_update_partner_menu(void) { battleStatus->moveCategory = BTL_MENU_TYPE_STAR_POWERS; battleStatus->selectedMoveID = MOVE_FOCUS; battleStatus->moveArgument = 0; - battleStatus->currentTargetListFlags = gMoveTable[MOVE_FOCUS].flags; + battleStatus->curTargetListFlags = gMoveTable[MOVE_FOCUS].flags; btl_set_state(BATTLE_STATE_SELECT_TARGET); return; } @@ -3878,9 +3878,9 @@ void btl_state_update_partner_menu(void) { battleStatus->submenuStatus[i] = 0; BattleMenu_Moves_OptionCantUseMessages[i] = BTL_MSG_CANT_SELECT_NOW; } - battle_menu_moveOptionIconScripts[i] = battle_menu_PartnerMoveHudScripts[playerData->currentPartner][2 * i + 2]; + battle_menu_moveOptionIconScripts[i] = battle_menu_PartnerMoveHudScripts[playerData->curPartner][2 * i + 2]; if (battleStatus->submenuStatus[i] == 0) { - battle_menu_moveOptionIconScripts[i] = battle_menu_PartnerMoveHudScripts[playerData->currentPartner][2 * i + 3]; + battle_menu_moveOptionIconScripts[i] = battle_menu_PartnerMoveHudScripts[playerData->curPartner][2 * i + 3]; } BattleMenu_Moves_OptionIndices[i] = battleStatus->submenuMoves[i]; BattleMenu_Moves_OptionEnabled[i] = battleStatus->submenuStatus[i]; @@ -3933,14 +3933,14 @@ void btl_state_update_partner_menu(void) { break; case BTL_SUBSTATE_PARTNER_MENU_ABILITIES_3: entryIdx = btl_submenu_moves_update(); - if ((battleStatus->currentButtonsPressed & BUTTON_B) && entryIdx == 0) { + if ((battleStatus->curButtonsPressed & BUTTON_B) && entryIdx == 0) { func_802A2AB8(); func_802A1098(); gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_ABILITIES_4; } else if (btl_main_menu_update() != 0) { battleStatus->moveCategory = BTL_MENU_TYPE_ABILITY; battleStatus->selectedMoveID = BattleMenu_Moves_OptionIndices[battleStatus->unk_4B]; - battleStatus->currentTargetListFlags = gMoveTable[battleStatus->selectedMoveID].flags; + battleStatus->curTargetListFlags = gMoveTable[battleStatus->selectedMoveID].flags; battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_ABILITY] = battle_menu_moveOptionActive; battleStatus->cancelTargetMenuSubstate = BTL_SUBSTATE_PARTNER_MENU_ABILITIES_5; battleStatus->acceptTargetMenuSubstate = BTL_SUBSTATE_PARTNER_MENU_ABILITIES_6; @@ -4016,8 +4016,8 @@ void btl_state_update_partner_menu(void) { battleStatus->unk_1AA = popupMenu->userIndex[popupMenu->result - 1]; battleStatus->moveCategory = BTL_MENU_TYPE_ITEMS; battleStatus->moveArgument = battleStatus->unk_1AA; - battleStatus->currentTargetListFlags = gItemTable[battleStatus->moveArgument].targetFlags | TARGET_FLAG_8000; - battleStatus->currentAttackElement = 0; + battleStatus->curTargetListFlags = gItemTable[battleStatus->moveArgument].targetFlags | TARGET_FLAG_8000; + battleStatus->curAttackElement = 0; battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_PARTNER_ITEM] = popupMenu->result - 1; hide_popup_menu(); func_802A1030(); @@ -4026,7 +4026,7 @@ void btl_state_update_partner_menu(void) { } break; case BTL_SUBSTATE_PARTNER_MENU_ITEMS_3: - if ((battleStatus->currentButtonsPressed & BUTTON_B) && popupMenu->result == POPUP_RESULT_CHOOSING) { + if ((battleStatus->curButtonsPressed & BUTTON_B) && popupMenu->result == POPUP_RESULT_CHOOSING) { func_800F16CC(); func_802A1098(); gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_ITEMS_4; @@ -4060,7 +4060,7 @@ void btl_state_update_partner_menu(void) { popupMenu->nameMsg[popupIndex] = popupProps->nameMsg; popupMenu->descMsg[popupIndex] = popupProps->battleDescMsg; popupMenu->value[popupIndex] = playerData->partners[partnerId].level; - if (playerData->currentPartner == partnerId) { + if (playerData->curPartner == partnerId) { popupMenu->enabled[popupIndex] = 0; popupMenu->ptrIcon[popupIndex] = battle_menu_DisabledPartnerHudScripts[partnerId]; } @@ -4072,7 +4072,7 @@ void btl_state_update_partner_menu(void) { } popupMenu->popupType = POPUP_MENU_SWITCH_PARTNER; popupMenu->numEntries = popupIndex; - popupMenu->initialPos = MenuIndexFromPartnerID[playerData->currentPartner] - 1; + popupMenu->initialPos = MenuIndexFromPartnerID[playerData->curPartner] - 1; popupMenu->dipMode = 0; popupMenu->titleNumber = 0; create_battle_popup_menu(popupMenu); @@ -4096,7 +4096,7 @@ void btl_state_update_partner_menu(void) { battleStatus->unk_1AC = popupMenu->userIndex[popupMenu->result - 1]; battleStatus->moveCategory = BTL_MENU_TYPE_CHANGE_PARTNER; battleStatus->selectedMoveID = MOVE_UNUSED_37; - battleStatus->currentTargetListFlags = TARGET_FLAG_2; + battleStatus->curTargetListFlags = TARGET_FLAG_2; battleStatus->moveArgument = battleStatus->unk_1AC; battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_PARTNER] = popupMenu->result - 1; hide_popup_menu(); @@ -4106,7 +4106,7 @@ void btl_state_update_partner_menu(void) { } break; case BTL_SUBSTATE_PARTNER_MENU_UNUSED_CHANGE_PARTNER_3: - if ((battleStatus->currentButtonsPressed & BUTTON_B) && (popupMenu->result == POPUP_RESULT_CHOOSING)) { + if ((battleStatus->curButtonsPressed & BUTTON_B) && (popupMenu->result == POPUP_RESULT_CHOOSING)) { func_800F16CC(); func_802A1098(); gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_UNUSED_CHANGE_PARTNER_4; @@ -4187,7 +4187,7 @@ void btl_state_update_partner_menu(void) { break; case BTL_SUBSTATE_PARTNER_MENU_FOCUS_3: entryIdx = btl_submenu_moves_update(); - if ((battleStatus->currentButtonsPressed & BUTTON_B) && (entryIdx == 0)) { + if ((battleStatus->curButtonsPressed & BUTTON_B) && (entryIdx == 0)) { func_802A2AB8(); func_802A1098(); gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_FOCUS_4; @@ -4196,7 +4196,7 @@ void btl_state_update_partner_menu(void) { battleStatus->acceptTargetMenuSubstate = BTL_SUBSTATE_PARTNER_MENU_FOCUS_6; battleStatus->moveCategory = BTL_MENU_TYPE_STAR_POWERS; battleStatus->selectedMoveID = battleStatus->submenuMoves[battleStatus->unk_4B]; - battleStatus->currentTargetListFlags = gMoveTable[battleStatus->submenuMoves[battleStatus->unk_4B]].flags; + battleStatus->curTargetListFlags = gMoveTable[battleStatus->submenuMoves[battleStatus->unk_4B]].flags; battleStatus->moveArgument = battleStatus->unk_4B; battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_STAR_POWER] = battle_menu_moveOptionActive; btl_set_state(BATTLE_STATE_SELECT_TARGET); @@ -4223,11 +4223,11 @@ void btl_state_update_partner_menu(void) { if (battleStatus->changePartnerAllowed >= 0) { D_802AD678[popupIndex] = BTL_MENU_TYPE_CHANGE_PARTNER; D_802AD658[popupIndex] = BattleMenu_LeftJustMessages[BTL_MENU_TYPE_CHANGE_PARTNER]; - D_802AD640[popupIndex] = battle_menu_PartnerHudScripts[playerData->currentPartner]; + D_802AD640[popupIndex] = battle_menu_PartnerHudScripts[playerData->curPartner]; D_802AD690[popupIndex] = 1; D_802AD6C0[popupIndex] = MSG_Menus_Action_ChangePartner; if (battleStatus->changePartnerAllowed <= 0) { - D_802AD640[popupIndex] = battle_menu_DisabledPartnerHudScripts[playerData->currentPartner]; + D_802AD640[popupIndex] = battle_menu_DisabledPartnerHudScripts[playerData->curPartner]; D_802AD690[popupIndex] = 0; D_802AD6A8[popupIndex] = 0; } @@ -4276,7 +4276,7 @@ void btl_state_update_partner_menu(void) { break; case BTL_SUBSTATE_PARTNER_MENU_STRATEGIES_3: entryIdx = func_802A4A54(); - if ((battleStatus->currentButtonsPressed & BUTTON_B) && entryIdx == 0) { + if ((battleStatus->curButtonsPressed & BUTTON_B) && entryIdx == 0) { func_802A48FC(); func_802A1098(); gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_STRATEGIES_4; @@ -4334,7 +4334,7 @@ void btl_state_update_partner_menu(void) { popupMenu->nameMsg[popupIndex] = popupProps->nameMsg; popupMenu->descMsg[popupIndex] = popupProps->battleDescMsg; popupMenu->value[popupIndex] = playerData->partners[partnerId].level; - if (playerData->currentPartner == partnerId) { + if (playerData->curPartner == partnerId) { popupMenu->enabled[popupIndex] = 0; popupMenu->ptrIcon[popupIndex] = battle_menu_DisabledPartnerHudScripts[partnerId]; } @@ -4346,7 +4346,7 @@ void btl_state_update_partner_menu(void) { } popupMenu->popupType = POPUP_MENU_SWITCH_PARTNER; popupMenu->numEntries = popupIndex; - popupMenu->initialPos = MenuIndexFromPartnerID[playerData->currentPartner] - 1; + popupMenu->initialPos = MenuIndexFromPartnerID[playerData->curPartner] - 1; popupMenu->dipMode = 0; popupMenu->titleNumber = 0; create_battle_popup_menu(popupMenu); @@ -4368,7 +4368,7 @@ void btl_state_update_partner_menu(void) { battleStatus->unk_1AC = popupMenu->userIndex[popupMenu->result - 1]; battleStatus->moveCategory = BTL_MENU_TYPE_CHANGE_PARTNER; battleStatus->selectedMoveID = MOVE_UNUSED_37; - battleStatus->currentTargetListFlags = TARGET_FLAG_2; + battleStatus->curTargetListFlags = TARGET_FLAG_2; battleStatus->moveArgument = battleStatus->unk_1AC; battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_PARTNER] = popupMenu->result - 1; hide_popup_menu(); @@ -4379,7 +4379,7 @@ void btl_state_update_partner_menu(void) { } break; case BTL_SUBSTATE_PARTNER_MENU_CHANGE_PARTNER_3: - if ((battleStatus->currentButtonsPressed & BUTTON_B) && popupMenu->result == POPUP_RESULT_CHOOSING) { + if ((battleStatus->curButtonsPressed & BUTTON_B) && popupMenu->result == POPUP_RESULT_CHOOSING) { func_800F16CC(); func_802A4A10(); func_802A1098(); @@ -4502,8 +4502,8 @@ void btl_state_update_peach_menu(void) { gBattleSubState = BTL_SUBSTATE_PEACH_CREATE_MAIN_MENU; break; } - player->state.currentPos.x = player->homePos.x; - player->state.currentPos.z = player->homePos.z; + player->state.curPos.x = player->homePos.x; + player->state.curPos.z = player->homePos.z; gBattleSubState = BTL_SUBSTATE_PEACH_MENU_PERFORM_SWAP; player->state.goalPos.x = partner->homePos.x; player->state.goalPos.z = partner->homePos.z; @@ -4512,15 +4512,15 @@ void btl_state_update_peach_menu(void) { break; case BTL_SUBSTATE_PEACH_MENU_PERFORM_SWAP: if (player->state.moveTime != 0) { - player->currentPos.x += (player->state.goalPos.x - player->currentPos.x) / player->state.moveTime; - player->currentPos.z += (player->state.goalPos.z - player->currentPos.z) / player->state.moveTime; - partner->currentPos.x += (player->state.currentPos.x - partner->currentPos.x) / player->state.moveTime; - partner->currentPos.z += (player->state.currentPos.z - partner->currentPos.z) / player->state.moveTime; + player->curPos.x += (player->state.goalPos.x - player->curPos.x) / player->state.moveTime; + player->curPos.z += (player->state.goalPos.z - player->curPos.z) / player->state.moveTime; + partner->curPos.x += (player->state.curPos.x - partner->curPos.x) / player->state.moveTime; + partner->curPos.z += (player->state.curPos.z - partner->curPos.z) / player->state.moveTime; } - player->currentPos.z -= sin_rad(DEG_TO_RAD(player->state.angle)) * 16.0f; + player->curPos.z -= sin_rad(DEG_TO_RAD(player->state.angle)) * 16.0f; player->yaw = clamp_angle(-player->state.angle); - partner->currentPos.z += sin_rad(DEG_TO_RAD(player->state.angle)) * 16.0f; + partner->curPos.z += sin_rad(DEG_TO_RAD(player->state.angle)) * 16.0f; partner->yaw = clamp_angle(-player->state.angle); player->state.angle += 90.0f; @@ -4529,14 +4529,14 @@ void btl_state_update_peach_menu(void) { break; } - player->currentPos.x = player->state.goalPos.x; - player->currentPos.z = player->state.goalPos.z; - partner->currentPos.x = player->state.currentPos.x; - partner->currentPos.z = player->state.currentPos.z; - player->homePos.x = player->currentPos.x; - player->homePos.z = player->currentPos.z; - partner->homePos.x = partner->currentPos.x; - partner->homePos.z = partner->currentPos.z; + player->curPos.x = player->state.goalPos.x; + player->curPos.z = player->state.goalPos.z; + partner->curPos.x = player->state.curPos.x; + partner->curPos.z = player->state.curPos.z; + player->homePos.x = player->curPos.x; + player->homePos.z = player->curPos.z; + partner->homePos.x = partner->curPos.x; + partner->homePos.z = partner->curPos.z; gBattleStatus.flags1 &= ~BS_FLAGS1_PLAYER_IN_BACK; case BTL_SUBSTATE_PEACH_CREATE_MAIN_MENU: gBattleStatus.flags1 |= BS_FLAGS1_MENU_OPEN; @@ -4586,7 +4586,7 @@ void btl_state_update_peach_menu(void) { } if (selectedOption != 0) { set_animation(ACTOR_PLAYER, 0, ANIM_Peach1_Walk); - battleStatus->currentSubmenu = battle_menu_submenuIDs[selectedOption - 1]; + battleStatus->curSubmenu = battle_menu_submenuIDs[selectedOption - 1]; func_802A1030(); D_802ACC60 = 8; D_802ACC6C = 4; @@ -4597,7 +4597,7 @@ void btl_state_update_peach_menu(void) { if (btl_main_menu_update() != 0) { battleStatus->cancelTargetMenuSubstate = BTL_SUBSTATE_PEACH_MENU_TARGET_CANCEL; battleStatus->acceptTargetMenuSubstate = BTL_SUBSTATE_PEACH_MENU_TARGET_CHOSEN; - battleStatus->currentTargetListFlags = gMoveTable[MOVE_PEACH_FOCUS].flags; + battleStatus->curTargetListFlags = gMoveTable[MOVE_PEACH_FOCUS].flags; battleStatus->moveCategory = BTL_MENU_TYPE_STAR_POWERS; battleStatus->selectedMoveID = MOVE_PEACH_FOCUS; battleStatus->moveArgument = STAR_POWER_INDEX(MOVE_PEACH_FOCUS); @@ -4709,8 +4709,8 @@ void btl_state_update_twink_menu(void) { btl_cam_use_preset(BTL_CAM_DEFAULT); btl_cam_move(10); if (!(gBattleStatus.flags1 & BS_FLAGS1_PLAYER_IN_BACK)) { - player->state.currentPos.x = player->homePos.x; - player->state.currentPos.z = player->homePos.z; + player->state.curPos.x = player->homePos.x; + player->state.curPos.z = player->homePos.z; player->state.goalPos.x = partner->homePos.x; player->state.goalPos.z = partner->homePos.z; gBattleSubState = BTL_SUBSTATE_TWINK_MENU_PERFORM_SWAP; @@ -4722,28 +4722,28 @@ void btl_state_update_twink_menu(void) { break; case BTL_SUBSTATE_TWINK_MENU_PERFORM_SWAP: if (player->state.moveTime != 0) { - player->currentPos.x += (player->state.goalPos.x - player->currentPos.x) / player->state.moveTime; - player->currentPos.z += (player->state.goalPos.z - player->currentPos.z) / player->state.moveTime; - partner->currentPos.x += (player->state.currentPos.x - partner->currentPos.x) / player->state.moveTime; - partner->currentPos.z += (player->state.currentPos.z - partner->currentPos.z) / player->state.moveTime; + player->curPos.x += (player->state.goalPos.x - player->curPos.x) / player->state.moveTime; + player->curPos.z += (player->state.goalPos.z - player->curPos.z) / player->state.moveTime; + partner->curPos.x += (player->state.curPos.x - partner->curPos.x) / player->state.moveTime; + partner->curPos.z += (player->state.curPos.z - partner->curPos.z) / player->state.moveTime; } - player->currentPos.z += sin_rad(DEG_TO_RAD(player->state.angle)) * 16.0f; + player->curPos.z += sin_rad(DEG_TO_RAD(player->state.angle)) * 16.0f; player->yaw = clamp_angle(-player->state.angle); - partner->currentPos.z -= sin_rad(DEG_TO_RAD(player->state.angle)) * 16.0f; + partner->curPos.z -= sin_rad(DEG_TO_RAD(player->state.angle)) * 16.0f; partner->yaw = clamp_angle(-player->state.angle); player->state.angle += 90.0f; if (player->state.moveTime != 0) { player->state.moveTime--; break; } - player->currentPos.x = player->state.goalPos.x; - player->currentPos.z = player->state.goalPos.z; - partner->currentPos.x = player->state.currentPos.x; - partner->currentPos.z = player->state.currentPos.z; - player->homePos.x = player->currentPos.x; - player->homePos.z = player->currentPos.z; - partner->homePos.x = partner->currentPos.x; - partner->homePos.z = partner->currentPos.z; + player->curPos.x = player->state.goalPos.x; + player->curPos.z = player->state.goalPos.z; + partner->curPos.x = player->state.curPos.x; + partner->curPos.z = player->state.curPos.z; + player->homePos.x = player->curPos.x; + player->homePos.z = player->curPos.z; + partner->homePos.x = partner->curPos.x; + partner->homePos.z = partner->curPos.z; gBattleStatus.flags1 |= BS_FLAGS1_PLAYER_IN_BACK; case BTL_SUBSTATE_TWINK_MENU_CREATE_MAIN_MENU: gBattleStatus.flags1 |= BS_FLAGS1_MENU_OPEN; @@ -4793,7 +4793,7 @@ void btl_state_update_twink_menu(void) { } if (selection != 0) { set_animation(ACTOR_PARTNER, 0, ANIM_Twink_Angry); - battleStatus->currentSubmenu = battle_menu_submenuIDs[selection - 1]; + battleStatus->curSubmenu = battle_menu_submenuIDs[selection - 1]; func_802A1030(); D_802ACC60 = 8; D_802ACC6C = 4; @@ -4807,7 +4807,7 @@ void btl_state_update_twink_menu(void) { battleStatus->moveCategory = BTL_MENU_TYPE_STAR_POWERS; battleStatus->selectedMoveID = MOVE_TWINK_DASH; battleStatus->moveArgument = 0; - battleStatus->currentTargetListFlags = gMoveTable[MOVE_TWINK_DASH].flags; + battleStatus->curTargetListFlags = gMoveTable[MOVE_TWINK_DASH].flags; btl_set_state(BATTLE_STATE_SELECT_TARGET); } break; @@ -4896,7 +4896,7 @@ void btl_state_update_select_target(void) { } player_create_target_list(actor); targetListLength = actor->targetListLength; - if (battleStatus->currentTargetListFlags & TARGET_FLAG_ENEMY) { + if (battleStatus->curTargetListFlags & TARGET_FLAG_ENEMY) { targetIndexList = actor->targetIndexList; for (i = 0; i < targetListLength; i++) { target = &actor->targetData[targetIndexList[i]]; @@ -4907,7 +4907,7 @@ void btl_state_update_select_target(void) { } } - if (battleStatus->currentTargetListFlags & TARGET_FLAG_80000000) { + if (battleStatus->curTargetListFlags & TARGET_FLAG_80000000) { if (!(gBattleStatus.flags1 & BS_FLAGS1_PARTNER_ACTING)) { gBattleSubState = battleStatus->acceptTargetMenuSubstate; if (gBattleStatus.flags2 & BS_FLAGS2_PEACH_BATTLE) { @@ -4965,13 +4965,13 @@ void btl_state_update_select_target(void) { } } - if (battleStatus->currentButtonsPressed & BUTTON_B) { + if (battleStatus->curButtonsPressed & BUTTON_B) { sfx_play_sound(SOUND_MENU_BACK); gBattleSubState = BTL_SUBSTATE_SELECT_TARGET_CANCEL; break; } - if (battleStatus->currentButtonsPressed & BUTTON_A) { + if (battleStatus->curButtonsPressed & BUTTON_A) { sfx_play_sound(SOUND_MENU_NEXT); D_802ACC60 = 8; D_802ACC6C = 4; @@ -4980,18 +4980,18 @@ void btl_state_update_select_target(void) { } gBattleStatus.flags1 |= BS_FLAGS1_MENU_OPEN; - if (battleStatus->currentButtonsDown & (BUTTON_Z | BUTTON_R)) { + if (battleStatus->curButtonsDown & (BUTTON_Z | BUTTON_R)) { gBattleStatus.flags1 &= ~BS_FLAGS1_MENU_OPEN; break; } - if (battleStatus->currentTargetListFlags & TARGET_FLAG_ENEMY) { + if (battleStatus->curTargetListFlags & TARGET_FLAG_ENEMY) { s32 oldSelectedTargetIndex = selectedTargetIndex; - if (battleStatus->currentButtonsHeld & BUTTON_STICK_LEFT) { + if (battleStatus->curButtonsHeld & BUTTON_STICK_LEFT) { selectedTargetIndex--; } - if (battleStatus->currentButtonsHeld & BUTTON_STICK_RIGHT) { + if (battleStatus->curButtonsHeld & BUTTON_STICK_RIGHT) { selectedTargetIndex++; } if (selectedTargetIndex < 0) { @@ -5115,7 +5115,7 @@ void btl_state_draw_select_target(void) { tmpPtr = &D_802ACC68; if (targetListLength != 0) { - if (battleStatus->currentTargetListFlags & TARGET_FLAG_ENEMY) { + if (battleStatus->curTargetListFlags & TARGET_FLAG_ENEMY) { target = &actor->targetData[targetIndexList[selectedTargetIndex]]; anotherActor = get_actor(target->actorID); id = D_802ACC70[0]; @@ -5169,14 +5169,14 @@ void btl_state_draw_select_target(void) { } } - currentPartner = playerData->currentPartner; + currentPartner = playerData->curPartner; screenX = 52; screenY = 64; if (gBattleStatus.flags2 & BS_FLAGS2_PEACH_BATTLE) { currentPartner = PARTNER_TWINK; } - if ((battleStatus->currentTargetListFlags & TARGET_FLAG_ENEMY) || targetListLength == 1) { + if ((battleStatus->curTargetListFlags & TARGET_FLAG_ENEMY) || targetListLength == 1) { actorID = target->actorID; if (actorID == ACTOR_PLAYER) { msgWidth = get_msg_width(MSG_Menus_Battle_TargetMario, 0) + 10; @@ -5208,7 +5208,7 @@ void btl_state_draw_select_target(void) { screenX += 4; screenY += 2; - if ((battleStatus->currentTargetListFlags & TARGET_FLAG_ENEMY) || targetListLength == 1) { + if ((battleStatus->curTargetListFlags & TARGET_FLAG_ENEMY) || targetListLength == 1) { actorID = target->actorID; if (actorID == ACTOR_PLAYER) { draw_msg(MSG_Menus_Battle_TargetMario, screenX + D_802ACC68, screenY, 255, MSG_PAL_36, 0); diff --git a/src/77480.c b/src/77480.c index 1b05f3a69a0..3bfdfbd6a63 100644 --- a/src/77480.c +++ b/src/77480.c @@ -182,7 +182,7 @@ s32 player_raycast_below_cam_relative(PlayerStatus* playerStatus, f32* outX, f32 yaw = 180.0f; } - return player_raycast_below(yaw - 90.0f + gCameras[gCurrentCameraID].currentYaw, playerStatus->colliderDiameter, + return player_raycast_below(yaw - 90.0f + gCameras[gCurrentCameraID].curYaw, playerStatus->colliderDiameter, outX, outY, outZ, outLength, hitRx, hitRz, hitDirX, hitDirZ); } @@ -607,31 +607,31 @@ void update_player(void) { update_partner_timers(); - if ((playerStatus->timeInAir > 100) || (playerStatus->position.y < -2000.0f)) { + if ((playerStatus->timeInAir > 100) || (playerStatus->pos.y < -2000.0f)) { if (!(playerStatus->animFlags & PA_FLAG_NO_OOB_RESPAWN)) { playerStatus->timeInAir = 0; - playerStatus->position.x = playerStatus->lastGoodPosition.x; - playerStatus->position.y = playerStatus->lastGoodPosition.y; - playerStatus->position.z = playerStatus->lastGoodPosition.z; + playerStatus->pos.x = playerStatus->lastGoodPos.x; + playerStatus->pos.y = playerStatus->lastGoodPos.y; + playerStatus->pos.z = playerStatus->lastGoodPos.z; if (playerStatus->animFlags & PA_FLAG_RIDING_PARTNER) { Npc* partner; playerStatus->animFlags |= PA_FLAG_DISMOUNTING_ALLOWED | PA_FLAG_INTERRUPT_USE_PARTNER; partner = get_npc_unsafe(NPC_PARTNER); - partner->pos.x = playerStatus->lastGoodPosition.x; - partner->pos.y = playerStatus->lastGoodPosition.y + playerStatus->colliderHeight; - partner->pos.z = playerStatus->lastGoodPosition.z; - partner->moveToPos.y = playerStatus->lastGoodPosition.y; + partner->pos.x = playerStatus->lastGoodPos.x; + partner->pos.y = playerStatus->lastGoodPos.y + playerStatus->colliderHeight; + partner->pos.z = playerStatus->lastGoodPos.z; + partner->moveToPos.y = playerStatus->lastGoodPos.y; } else { playerStatus->timeInAir = 10; } } } - collisionStatus->currentWall = NO_COLLIDER; + collisionStatus->curWall = NO_COLLIDER; collisionStatus->lastWallHammered = NO_COLLIDER; - collisionStatus->currentInspect = NO_COLLIDER; + collisionStatus->curInspect = NO_COLLIDER; collisionStatus->floorBelow = TRUE; update_player_input(); @@ -664,10 +664,10 @@ void update_player(void) { player_update_sprite(); gameStatus = gGameStatusPtr; - gameStatus->playerPos.x = playerStatus->position.x; - gameStatus->playerPos.y = playerStatus->position.y; - gameStatus->playerPos.z = playerStatus->position.z; - gameStatus->playerYaw = playerStatus->currentYaw; + gameStatus->playerPos.x = playerStatus->pos.x; + gameStatus->playerPos.y = playerStatus->pos.y; + gameStatus->playerPos.z = playerStatus->pos.z; + gameStatus->playerYaw = playerStatus->curYaw; check_input_open_menus(); if (!(playerStatus->animFlags & PA_FLAG_USING_PEACH_PHYSICS)) { @@ -680,9 +680,9 @@ void update_player(void) { check_for_pulse_stone(); check_for_ispy(); - playerStatus->pushVelocity.x = 0.0f; - playerStatus->pushVelocity.y = 0.0f; - playerStatus->pushVelocity.z = 0.0f; + playerStatus->pushVel.x = 0.0f; + playerStatus->pushVel.y = 0.0f; + playerStatus->pushVel.z = 0.0f; playerStatus->flags &= ~PS_FLAG_SLIDING; playerStatus->animFlags &= ~PA_FLAG_FORCE_USE_PARTNER; } @@ -699,7 +699,7 @@ void check_input_use_partner(void) { && !(playerStatus->animFlags & PA_FLAG_USING_PEACH_PHYSICS) && actionState <= ACTION_STATE_RUN ) { - if (playerData->currentPartner == PARTNER_GOOMBARIO) { + if (playerData->curPartner == PARTNER_GOOMBARIO) { WorldTattleInteractionID = playerStatus->interactingWithID; } partner_use_ability(); @@ -747,9 +747,9 @@ void phys_update_standard(void) { } if (!(playerStatus->flags & PS_FLAG_CAMERA_DOESNT_FOLLOW)) { - gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; - gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y; - gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; + gCameras[CAM_DEFAULT].targetPos.x = playerStatus->pos.x; + gCameras[CAM_DEFAULT].targetPos.y = playerStatus->pos.y; + gCameras[CAM_DEFAULT].targetPos.z = playerStatus->pos.z; } } @@ -761,9 +761,9 @@ void phys_update_lava_reset(void) { if (!(gPlayerStatusPtr->flags & PS_FLAG_CAMERA_DOESNT_FOLLOW)) { Camera* camera = &gCameras[CAM_DEFAULT]; - camera->targetPos.x = gPlayerStatusPtr->position.x; - camera->targetPos.y = gPlayerStatusPtr->position.y; - camera->targetPos.z = gPlayerStatusPtr->position.z; + camera->targetPos.x = gPlayerStatusPtr->pos.x; + camera->targetPos.y = gPlayerStatusPtr->pos.y; + camera->targetPos.z = gPlayerStatusPtr->pos.z; } } @@ -777,8 +777,8 @@ void player_reset_data(void) { mem_clear(playerStatus, sizeof(PlayerStatus)); playerStatus->flags = PS_FLAG_HAS_REFLECTION; reset_player_status(); - playerStatus->shadowID = create_shadow_type(0, playerStatus->position.x, playerStatus->position.y, - playerStatus->position.z); + playerStatus->shadowID = create_shadow_type(0, playerStatus->pos.x, playerStatus->pos.y, + playerStatus->pos.z); func_800E6B68(); func_800E0B14(); clear_conversation_prompt(); @@ -925,7 +925,7 @@ void update_player_blink(void) { f32 get_xz_dist_to_player(f32 x, f32 z) { PlayerStatus* playerStatus = &gPlayerStatus; - return dist2D(x, z, playerStatus->position.x, playerStatus->position.z); + return dist2D(x, z, playerStatus->pos.x, playerStatus->pos.z); } void enable_player_shadow(void) { @@ -983,7 +983,7 @@ void func_800E01DC(void) { s32 game_scripts_disabled(void) { s32 ret = FALSE; - if (gGameStatusPtr->disableScripts && (gGameStatusPtr->currentButtons[0] & BUTTON_R)) { + if (gGameStatusPtr->disableScripts && (gGameStatusPtr->curButtons[0] & BUTTON_R)) { if (gPartnerStatus.partnerActionState == PARTNER_ACTION_NONE) { set_action_state(ACTION_STATE_IDLE); } @@ -1137,7 +1137,7 @@ s32 func_800E06D8(void) { if (playerStatus->timeInAir != 0 || playerStatus->inputDisabledCount != 0) { return FALSE; } - if (gCollisionStatus.currentWall == NO_COLLIDER) { + if (gCollisionStatus.curWall == NO_COLLIDER) { return FALSE; } if (playerStatus->flags & PS_FLAG_HAS_CONVERSATION_NPC @@ -1149,7 +1149,7 @@ s32 func_800E06D8(void) { return TRUE; } - currentWall = gCollisionStatus.currentWall; + currentWall = gCollisionStatus.curWall; if (!(currentWall & COLLISION_WITH_ENTITY_BIT)) { if (!should_collider_allow_interact(currentWall)) { return FALSE; @@ -1185,7 +1185,7 @@ void check_for_interactables(void) { } if (InteractNotificationCallback == NULL) { - s32 curInteraction = gCollisionStatus.currentWall; + s32 curInteraction = gCollisionStatus.curWall; if (playerStatus->inputDisabledCount != 0) { if (gPlayerStatus.interactingWithID != curInteraction) { @@ -1199,7 +1199,7 @@ void check_for_interactables(void) { } if (curInteraction == NO_COLLIDER) { - s32 floor = gCollisionStatus.currentFloor; + s32 floor = gCollisionStatus.curFloor; if ((floor >= 0) && (floor & COLLISION_WITH_ENTITY_BIT)) { phi_s2 = 1; @@ -1313,8 +1313,8 @@ void update_partner_timers(void) { void player_update_sprite(void) { PlayerStatus* playerStatus = &gPlayerStatus; - f32 cameraYaw = gCameras[gCurrentCameraID].currentYaw; - f32 camRelativeYaw = get_clamped_angle_diff(cameraYaw, playerStatus->currentYaw); + f32 cameraYaw = gCameras[gCurrentCameraID].curYaw; + f32 camRelativeYaw = get_clamped_angle_diff(cameraYaw, playerStatus->curYaw); s32 trueAnim; s32 sprIndex; f32 angle; @@ -1338,7 +1338,7 @@ void player_update_sprite(void) { PrevPlayerDirection = direction; playerStatus->flipYaw[gCurrentCameraID] = (direction != 0) ? 180.0f : -180.0f; - if (fabsf(get_clamped_angle_diff(cameraYaw, playerStatus->currentYaw)) >= 90.0f) { + if (fabsf(get_clamped_angle_diff(cameraYaw, playerStatus->curYaw)) >= 90.0f) { playerStatus->flipYaw[gCurrentCameraID] = -playerStatus->flipYaw[gCurrentCameraID]; } } @@ -1367,7 +1367,7 @@ void player_update_sprite(void) { PrevPlayerCamRelativeYaw = angle = clamp_angle(camRelativeYaw); angle = clamp_angle(playerStatus->flipYaw[gCurrentCameraID] + angle); - if (playerStatus->currentSpeed == 0.0f) { + if (playerStatus->curSpeed == 0.0f) { D_800F7B48 = 0.0f; } @@ -1382,12 +1382,12 @@ void player_update_sprite(void) { trueAnim = playerStatus->anim; if (!(playerStatus->flags & PS_FLAG_FACE_FORWARDS) && (sprIndex == SPR_Mario1 || sprIndex == SPR_MarioW1 || sprIndex == SPR_Peach1) - && fabsf(get_clamped_angle_diff(cameraYaw, playerStatus->currentYaw)) < 60.0f + && fabsf(get_clamped_angle_diff(cameraYaw, playerStatus->curYaw)) < 60.0f ) { trueAnim = get_player_back_anim(trueAnim); } playerStatus->trueAnimation = trueAnim; - playerStatus->currentYaw = playerStatus->targetYaw; + playerStatus->curYaw = playerStatus->targetYaw; } else { trueAnim = playerStatus->anim; if (!(playerStatus->flags & PS_FLAG_FACE_FORWARDS) @@ -1474,8 +1474,8 @@ void render_player_model(void) { if (playerStatus->flags & PS_FLAG_SPRITE_REDRAW) { playerStatus->flags &= ~PS_FLAG_SPRITE_REDRAW; - get_screen_coords(gCurrentCamID, playerStatus->position.x, playerStatus->position.y, - playerStatus->position.z, &x, &y, &z); + get_screen_coords(gCurrentCamID, playerStatus->pos.x, playerStatus->pos.y, + playerStatus->pos.z, &x, &y, &z); if (!(playerStatus->flags & PS_FLAG_SPINNING)) { if (playerStatus->alpha1 != playerStatus->alpha2) { if (playerStatus->alpha1 < 254) { @@ -1503,7 +1503,7 @@ void render_player_model(void) { if (!(playerStatus->animFlags & PA_FLAG_INVISIBLE)) { rtPtr->appendGfxArg = playerStatus; - rtPtr->distance = -z; + rtPtr->dist = -z; rtPtr->renderMode = playerStatus->renderMode; @@ -1524,7 +1524,7 @@ void render_player_model(void) { void appendGfx_player(void* data) { PlayerStatus* playerStatus = &gPlayerStatus; Matrix4f sp20, sp60, spA0, spE0; - f32 temp_f0 = -gCameras[gCurrentCamID].currentYaw; + f32 temp_f0 = -gCameras[gCurrentCamID].curYaw; s32 spriteIdx; if (playerStatus->actionState == ACTION_STATE_SLIDING) { @@ -1533,7 +1533,7 @@ void appendGfx_player(void* data) { guMtxCatF(spE0, sp20, sp20); guRotateF(spA0, playerStatus->spriteFacingAngle, 0.0f, 1.0f, 0.0f); guMtxCatF(sp20, spA0, sp20); - guTranslateF(sp60, playerStatus->position.x, playerStatus->position.y - 1.0f, playerStatus->position.z); + guTranslateF(sp60, playerStatus->pos.x, playerStatus->pos.y - 1.0f, playerStatus->pos.z); guMtxCatF(sp20, sp60, sp20); spr_draw_player_sprite(PLAYER_SPRITE_MAIN, 0, 0, 0, sp20); } else { @@ -1550,7 +1550,7 @@ void appendGfx_player(void* data) { guMtxCatF(sp20, sp60, sp20); guScaleF(spE0, SPRITE_WORLD_SCALE_D, SPRITE_WORLD_SCALE_D, SPRITE_WORLD_SCALE_D); guMtxCatF(sp20, spE0, sp20); - guTranslateF(sp60, playerStatus->position.x, playerStatus->position.y, playerStatus->position.z); + guTranslateF(sp60, playerStatus->pos.x, playerStatus->pos.y, playerStatus->pos.z); guMtxCatF(sp20, sp60, sp20); if (playerStatus->animFlags & PA_FLAG_SHIVERING) { @@ -1599,7 +1599,7 @@ void appendGfx_player_spin(void* data) { s32 spriteIdx; for (i = 0; i < 2; i++) { - yaw = -gCameras[gCurrentCamID].currentYaw; + yaw = -gCameras[gCurrentCamID].curYaw; if (i == 0) { if (playerStatus->spriteFacingAngle > 90.0f && playerStatus->spriteFacingAngle <= 180.0f) { @@ -1625,20 +1625,20 @@ void appendGfx_player_spin(void* data) { guRotateF(rotation, yaw, 0.0f, -1.0f, 0.0f); guRotateF(mtx, clamp_angle(playerStatus->pitch), 0.0f, 0.0f, 1.0f); guMtxCatF(rotation, mtx, mtx); - px = playerStatus->position.x; - py = playerStatus->position.y; - pz = playerStatus->position.z; + px = playerStatus->pos.x; + py = playerStatus->pos.y; + pz = playerStatus->pos.z; } else { blurAngle = phys_get_spin_history(i, &x, &y, &z); if (y == 0x80000000) { - py = playerStatus->position.y; + py = playerStatus->pos.y; } else { py = y; } - px = playerStatus->position.x; - pz = playerStatus->position.z; + px = playerStatus->pos.x; + pz = playerStatus->pos.z; set_player_imgfx_comp(PLAYER_SPRITE_MAIN, -1, IMGFX_SET_ALPHA, 0, 0, 0, 64, 0); guRotateF(mtx, yaw, 0.0f, -1.0f, 0.0f); guRotateF(rotation, yaw, 0.0f, -1.0f, 0.0f); @@ -1686,24 +1686,24 @@ void update_player_shadow(void) { yawTemp = 180.0f; } - raycastYaw = (yawTemp - 90.0f) + gCameras[gCurrentCameraID].currentYaw; - shadow->position.x = playerX = playerStatus->position.x; - shadow->position.z = playerZ = playerStatus->position.z; + raycastYaw = (yawTemp - 90.0f) + gCameras[gCurrentCameraID].curYaw; + shadow->pos.x = playerX = playerStatus->pos.x; + shadow->pos.z = playerZ = playerStatus->pos.z; x = playerX; - y = playerStatus->position.y + (playerStatus->colliderHeight / 3.5f); + y = playerStatus->pos.y + (playerStatus->colliderHeight / 3.5f); z = playerZ; shadowScale = 1024.0f; gCollisionStatus.floorBelow = player_raycast_below(raycastYaw, playerStatus->colliderDiameter, &x, &y, &z, &shadowScale, &hitRx, &hitRz, &hitDirX, &hitDirZ); - shadow->rotation.x = hitRx; - shadow->rotation.z = hitRz; - shadow->rotation.y = clamp_angle(-camera->currentYaw); + shadow->rot.x = hitRx; + shadow->rot.z = hitRz; + shadow->rot.y = clamp_angle(-camera->curYaw); hitRx += 180.0f; hitRz += 180.0f; if (hitRx != 0.0f || hitRz != 0.0f) { - s32 dist = dist2D(x, z, playerStatus->position.x, playerStatus->position.z); - f32 tan = atan2(playerStatus->position.x, playerStatus->position.z, x, z); + s32 dist = dist2D(x, z, playerStatus->pos.x, playerStatus->pos.z); + f32 tan = atan2(playerStatus->pos.x, playerStatus->pos.z, x, z); s32 angleTemp = clamp_angle((-90.0f - tan) + get_player_normal_yaw()); if (gGameStatusPtr->playerGroundTraceNormal.y != 0.0f) { @@ -1712,7 +1712,7 @@ void update_player_shadow(void) { } } - shadow->position.y = y; + shadow->pos.y = y; shadow->alpha = (f64)playerStatus->alpha1 / 2; if (!(gGameStatusPtr->peachFlags & PEACH_STATUS_FLAG_IS_PEACH)) { diff --git a/src/7B440.c b/src/7B440.c index 70947792ed8..96d3f71636d 100644 --- a/src/7B440.c +++ b/src/7B440.c @@ -16,7 +16,7 @@ void update_player_input(void) { playerStatus->stickAxis[0] = gGameStatusPtr->stickX[0]; playerStatus->stickAxis[1] = gGameStatusPtr->stickY[0]; - playerStatus->currentButtons = gGameStatusPtr->currentButtons[0]; + playerStatus->curButtons = gGameStatusPtr->curButtons[0]; playerStatus->pressedButtons = gGameStatusPtr->pressedButtons[0]; playerStatus->heldButtons = gGameStatusPtr->heldButtons[0]; @@ -27,7 +27,7 @@ void update_player_input(void) { playerStatus->stickXBuffer[inputBufPos] = playerStatus->stickAxis[0]; playerStatus->stickYBuffer[inputBufPos] = playerStatus->stickAxis[1]; - playerStatus->currentButtonsBuffer[inputBufPos] = playerStatus->currentButtons; + playerStatus->curButtonsBuffer[inputBufPos] = playerStatus->curButtons; playerStatus->pressedButtonsBuffer[inputBufPos] = playerStatus->pressedButtons; playerStatus->heldButtonsBuffer[inputBufPos] = playerStatus->heldButtons; playerStatus->inputBufPos = inputBufPos; @@ -35,7 +35,7 @@ void update_player_input(void) { if (playerStatus->flags & (PS_FLAG_INPUT_DISABLED | PS_FLAG_NO_STATIC_COLLISION)) { playerStatus->stickAxis[0] = 0; playerStatus->stickAxis[1] = 0; - playerStatus->currentButtons = 0; + playerStatus->curButtons = 0; playerStatus->pressedButtons = 0; playerStatus->heldButtons = 0; } @@ -97,16 +97,16 @@ void reset_player_status(void) { set_action_state(ACTION_STATE_IDLE); - playerStatus->currentSpeed = 0.0f; + playerStatus->curSpeed = 0.0f; playerStatus->targetYaw = 0.0f; playerStatus->overlapPushAmount = 0.0f; playerStatus->overlapPushYaw = 0.0f; playerStatus->anim = 0; playerStatus->timeInAir = 0; - playerStatus->position.x = 0.0f; - playerStatus->position.y = 0.0f; - playerStatus->position.z = 0.0f; - playerStatus->currentYaw = 0.0f; + playerStatus->pos.x = 0.0f; + playerStatus->pos.y = 0.0f; + playerStatus->pos.z = 0.0f; + playerStatus->curYaw = 0.0f; playerStatus->flipYaw[CAM_DEFAULT] = 0.0f; playerStatus->flipYaw[CAM_BATTLE] = 0.0f; playerStatus->flipYaw[CAM_TATTLE] = 0.0f; @@ -116,16 +116,16 @@ void reset_player_status(void) { if (mapSettings->entryList != NULL) { if (gGameStatusPtr->entryID < mapSettings->entryCount) { - playerStatus->position.x = (*mapSettings->entryList)[gGameStatusPtr->entryID].x; - playerStatus->position.y = (*mapSettings->entryList)[gGameStatusPtr->entryID].y; - playerStatus->position.z = (*mapSettings->entryList)[gGameStatusPtr->entryID].z; - playerStatus->currentYaw = (*mapSettings->entryList)[gGameStatusPtr->entryID].yaw; + playerStatus->pos.x = (*mapSettings->entryList)[gGameStatusPtr->entryID].x; + playerStatus->pos.y = (*mapSettings->entryList)[gGameStatusPtr->entryID].y; + playerStatus->pos.z = (*mapSettings->entryList)[gGameStatusPtr->entryID].z; + playerStatus->curYaw = (*mapSettings->entryList)[gGameStatusPtr->entryID].yaw; } } - gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; - gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y; - gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; + gCameras[CAM_DEFAULT].targetPos.x = playerStatus->pos.x; + gCameras[CAM_DEFAULT].targetPos.y = playerStatus->pos.y; + gCameras[CAM_DEFAULT].targetPos.z = playerStatus->pos.z; phys_reset_spin_history(); mem_clear(&gPlayerSpinState, sizeof(gPlayerSpinState)); @@ -134,7 +134,7 @@ void reset_player_status(void) { void get_packed_buttons(s32* arg0) { PlayerStatus* playerStatus = &gPlayerStatus; - *arg0 = (u16)playerStatus->currentButtons | (playerStatus->pressedButtons << 16); + *arg0 = (u16)playerStatus->curButtons | (playerStatus->pressedButtons << 16); } void player_input_to_move_vector(f32* angle, f32* magnitude) { @@ -153,7 +153,7 @@ void player_input_to_move_vector(f32* angle, f32* magnitude) { mag = magMax; } - ang = clamp_angle(atan2(0.0f, 0.0f, stickAxisX, stickAxisY) + gCameras[CAM_DEFAULT].currentYaw); + ang = clamp_angle(atan2(0.0f, 0.0f, stickAxisX, stickAxisY) + gCameras[CAM_DEFAULT].curYaw); if (mag == 0.0f) { ang = playerStatus->targetYaw; } @@ -175,7 +175,7 @@ void game_input_to_move_vector(f32* outAngle, f32* outMagnitude) { magnitude = maxRadius; } - angle = clamp_angle(atan2(0.0f, 0.0f, stickX, stickY) + gCameras[CAM_DEFAULT].currentYaw); + angle = clamp_angle(atan2(0.0f, 0.0f, stickX, stickY) + gCameras[CAM_DEFAULT].curYaw); if (magnitude == 0.0f) { angle = playerStatus->targetYaw; } @@ -186,8 +186,8 @@ void game_input_to_move_vector(f32* outAngle, f32* outMagnitude) { void func_800E24F8(void) { Shadow* shadow = get_shadow_by_index(gPlayerStatus.shadowID); - f32 x = shadow->rotation.x + 180.0; - f32 z = shadow->rotation.z + 180.0; + f32 x = shadow->rot.x + 180.0; + f32 z = shadow->rot.z + 180.0; Camera* camera = &gCameras[CAM_DEFAULT]; f32 temp; diff --git a/src/7E9D0.c b/src/7E9D0.c index 51c47143f86..69435daa6f0 100644 --- a/src/7E9D0.c +++ b/src/7E9D0.c @@ -45,42 +45,42 @@ s32 phys_adjust_cam_on_landing(void) { break; case 1: if (D_8010C9B0 == 0) { - if (playerStatus->position.y <= 0.0f) { + if (playerStatus->pos.y <= 0.0f) { D_8010C9B0 = 1; } ret = 2; - } else if (playerStatus->position.y > 0.0f) { + } else if (playerStatus->pos.y > 0.0f) { ret = 0; } break; case 3: - if (playerStatus->position.y > 25.0f) { + if (playerStatus->pos.y > 25.0f) { ret = 0; } break; case 4: - if (playerStatus->position.y > 50.0f) { + if (playerStatus->pos.y > 50.0f) { ret = 0; } break; case 7: - if (playerStatus->position.y > -390.0f) { + if (playerStatus->pos.y > -390.0f) { ret = 0; - } else if (playerStatus->position.y < -495.0f) { + } else if (playerStatus->pos.y < -495.0f) { ret = 0; } break; case 8: - if (playerStatus->position.y > -90.0f) { + if (playerStatus->pos.y > -90.0f) { ret = 0; - } else if (playerStatus->position.y < -370.0f) { + } else if (playerStatus->pos.y < -370.0f) { ret = 0; } break; case 2: if (gGameStatusPtr->entryID == 0) { if (D_8010C9B0 == 0) { - if (!(playerStatus->position.y > 0.0f)) { + if (!(playerStatus->pos.y > 0.0f)) { D_8010C9B0 = 1; } else { ret = 2; @@ -88,7 +88,7 @@ s32 phys_adjust_cam_on_landing(void) { } } - if (playerStatus->position.y > 0.0f) { + if (playerStatus->pos.y > 0.0f) { ret = 0; } } else { @@ -98,7 +98,7 @@ s32 phys_adjust_cam_on_landing(void) { case 5: if (gGameStatusPtr->entryID == 0) { if (D_8010C9B0 == 0) { - if (!(playerStatus->position.y > -130.0f)) { + if (!(playerStatus->pos.y > -130.0f)) { D_8010C9B0 = 1; } else { ret = 2; @@ -107,7 +107,7 @@ s32 phys_adjust_cam_on_landing(void) { } - if (playerStatus->position.y > -130.0f) { + if (playerStatus->pos.y > -130.0f) { ret = 0; } } else { @@ -116,7 +116,7 @@ s32 phys_adjust_cam_on_landing(void) { break; case 10: if (D_8010C9B0 == 0) { - if (!(playerStatus->position.y > -520.0f)) { + if (!(playerStatus->pos.y > -520.0f)) { D_8010C9B0 = 1; } else { ret = 2; @@ -124,14 +124,14 @@ s32 phys_adjust_cam_on_landing(void) { } } - if (playerStatus->position.y > -520.0f) { + if (playerStatus->pos.y > -520.0f) { ret = 0; } break; case 11: if (gGameStatusPtr->entryID == 0) { if (D_8010C9B0 == 0) { - if (!(playerStatus->position.y > -520.0f)) { + if (!(playerStatus->pos.y > -520.0f)) { D_8010C9B0 = 1; } else { ret = 2; @@ -140,7 +140,7 @@ s32 phys_adjust_cam_on_landing(void) { } - if (playerStatus->position.y > -520.0f) { + if (playerStatus->pos.y > -520.0f) { ret = 0; } } @@ -154,7 +154,7 @@ s32 phys_adjust_cam_on_landing(void) { } if (ret == 1) { - s32 surfaceType = get_collider_flags(gCollisionStatus.currentFloor) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; + s32 surfaceType = get_collider_flags(gCollisionStatus.curFloor) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; if (surfaceType == SURFACE_TYPE_LAVA) { gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_IGNORE_PLAYER_Y; @@ -363,7 +363,7 @@ void set_action_state(s32 actionState) { } // Whilst Sushie, Lakilester, or Parakarry's ability is active, hazards have no effect. - partner = playerData->currentPartner; + partner = playerData->curPartner; if (partner == PARTNER_SUSHIE || partner == PARTNER_LAKILESTER || partner == PARTNER_PARAKARRY) { if (gPartnerStatus.partnerActionState != PARTNER_ACTION_NONE) { @@ -457,7 +457,7 @@ s32 check_input_hammer(void) { return FALSE; } - if (gPartnerStatus.partnerActionState == PARTNER_ACTION_USE && playerData->currentPartner == PARTNER_WATT) { + if (gPartnerStatus.partnerActionState == PARTNER_ACTION_USE && playerData->curPartner == PARTNER_WATT) { return FALSE; } @@ -481,7 +481,7 @@ s32 check_input_jump(void) { } // @bug? collider flags not properly masked with COLLIDER_FLAG_SURFACE_TYPE - surfaceType = get_collider_flags((u16)gCollisionStatus.currentFloor); + surfaceType = get_collider_flags((u16)gCollisionStatus.curFloor); if ((surfaceType == SURFACE_TYPE_SLIDE) && phys_should_player_be_sliding()) { return FALSE; } @@ -493,8 +493,8 @@ s32 check_input_jump(void) { return FALSE; } - if ((collisionStatus->currentInspect != -1) && (collisionStatus->currentInspect & COLLISION_WITH_ENTITY_BIT)) { - Entity* entity = get_entity_by_index(collisionStatus->currentInspect); + if ((collisionStatus->curInspect != -1) && (collisionStatus->curInspect & COLLISION_WITH_ENTITY_BIT)) { + Entity* entity = get_entity_by_index(collisionStatus->curInspect); if (entity->flags & ENTITY_FLAG_SHOWS_INSPECT_PROMPT) { if ((entity->boundScriptBytecode == 0) || (entity->flags & ENTITY_FLAG_4000)) { @@ -521,7 +521,7 @@ void check_input_spin(void) { if (!((playerStatus->flags & (PS_FLAG_NO_STATIC_COLLISION | PS_FLAG_CUTSCENE_MOVEMENT)) || (playerStatus->animFlags & PA_FLAG_USING_WATT) || - (playerStatus->currentButtons & BUTTON_C_DOWN) || + (playerStatus->curButtons & BUTTON_C_DOWN) || is_ability_active(ABILITY_SLOW_GO))) { s32 actionState = playerStatus->actionState; @@ -553,7 +553,7 @@ void peach_set_disguise_anim(AnimID anim) { s32 listIndex = PeachDisguiseNpcIndex; if (listIndex >= 0) { - get_npc_by_index(listIndex)->currentAnim = anim; + get_npc_by_index(listIndex)->curAnim = anim; } } @@ -610,9 +610,9 @@ void peach_sync_disguise_npc(void) { npc->yaw = playerStatus->targetYaw; } - npc->pos.x = playerStatus->position.x; - npc->pos.y = playerStatus->position.y; - npc->pos.z = playerStatus->position.z; + npc->pos.x = playerStatus->pos.x; + npc->pos.y = playerStatus->pos.y; + npc->pos.z = playerStatus->pos.z; } } @@ -650,9 +650,9 @@ Npc* peach_make_disguise_npc(s32 peachDisguise) { set_npc_yaw(npc, yaw); - npc->pos.x = playerStatus->position.x; - npc->pos.y = playerStatus->position.y; - npc->pos.z = playerStatus->position.z; + npc->pos.x = playerStatus->pos.x; + npc->pos.y = playerStatus->pos.y; + npc->pos.z = playerStatus->pos.z; return npc; } @@ -666,16 +666,16 @@ s32 peach_disguise_check_overlaps(void) { s32 i; if (playerStatus->spriteFacingAngle >= 90.0f && playerStatus->spriteFacingAngle < 270.0f) { - yaw = camera->currentYaw - 270.0f; + yaw = camera->curYaw - 270.0f; } else { - yaw = camera->currentYaw - 90.0f; + yaw = camera->curYaw - 90.0f; } sin_cos_rad(DEG_TO_RAD(clamp_angle(yaw)), &dx, &dy); for (radius = 2, i = 2; i > 0; radius += 18, i--) { - f32 x = playerStatus->position.x + (dx * radius); - f32 y = playerStatus->position.y + 4.0f; - f32 z = playerStatus->position.z - (dy * radius); + f32 x = playerStatus->pos.x + (dx * radius); + f32 y = playerStatus->pos.y + 4.0f; + f32 z = playerStatus->pos.z - (dy * radius); hitID = player_test_lateral_overlap(3, playerStatus, &x, &y, &z, 4.0f, yaw); if (hitID >= 0) { break; diff --git a/src/7bb60_len_41b0.c b/src/7bb60_len_41b0.c index a92b1c4a913..1186ddb095c 100644 --- a/src/7bb60_len_41b0.c +++ b/src/7bb60_len_41b0.c @@ -15,7 +15,7 @@ s32 phys_check_interactable_collision(void); void phys_save_ground_pos(void); void record_jump_apex(void) { - gPlayerStatus.jumpApexHeight = gPlayerStatus.position.y; + gPlayerStatus.jumpApexHeight = gPlayerStatus.pos.y; } s32 can_trigger_loading_zone(void) { @@ -33,7 +33,7 @@ s32 can_trigger_loading_zone(void) { } if (actionState == ACTION_STATE_RIDE) { - if (playerData->currentPartner == PARTNER_LAKILESTER || playerData->currentPartner == PARTNER_BOW) { + if (playerData->curPartner == PARTNER_LAKILESTER || playerData->curPartner == PARTNER_BOW) { if (partnerStatus->partnerActionState != PARTNER_ACTION_NONE) { return TRUE; } else { @@ -57,7 +57,7 @@ void move_player(s32 duration, f32 heading, f32 speed) { gPlayerStatus.flags |= PS_FLAG_CUTSCENE_MOVEMENT; gPlayerStatus.heading = heading; gPlayerStatus.moveFrames = duration; - gPlayerStatus.currentSpeed = speed; + gPlayerStatus.curSpeed = speed; if (!(gPlayerStatus.animFlags & PA_FLAG_RIDING_PARTNER)) { set_action_state(speed > gPlayerStatus.walkSpeed ? ACTION_STATE_RUN : ACTION_STATE_WALK); @@ -76,26 +76,26 @@ s32 collision_main_above(void) { f32 phi_f2; new_var = sp2C = playerStatus->colliderHeight * 0.5f; - x = playerStatus->position.x; - y = playerStatus->position.y + new_var; - z = playerStatus->position.z; + x = playerStatus->pos.x; + y = playerStatus->pos.y + new_var; + z = playerStatus->pos.z; player_input_to_move_vector(&moveAngle, &moveMagnitude); if (moveMagnitude != 0.0f) { phi_f2 = playerStatus->targetYaw; } else { - phi_f2 = playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].currentYaw; + phi_f2 = playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].curYaw; } moveAngle = phi_f2; hitResult = player_raycast_up_corners(playerStatus, &x, &y, &z, &sp2C, moveAngle); - collisionStatus->currentCeiling = hitResult; + collisionStatus->curCeiling = hitResult; if (hitResult >= 0) { if (playerStatus->actionState != ACTION_STATE_FALLING && playerStatus->actionState != ACTION_STATE_STEP_DOWN - && collisionStatus->currentFloor <= NO_COLLIDER + && collisionStatus->curFloor <= NO_COLLIDER ) { if (sp2C <= fabsf(new_var + playerStatus->gravityIntegrator[0])) { do { @@ -104,7 +104,7 @@ s32 collision_main_above(void) { } } while (0); - playerStatus->position.y = y - ((playerStatus->colliderHeight / 5.0f) * 3.0f); + playerStatus->pos.y = y - ((playerStatus->colliderHeight / 5.0f) * 3.0f); if (playerStatus->actionState != ACTION_STATE_TORNADO_JUMP && playerStatus->actionState != ACTION_STATE_SPIN_JUMP ) { @@ -132,8 +132,8 @@ void handle_switch_hit(void) { } if (playerStatus->actionSubstate == LANDING_ON_SWITCH_SUBSTATE_0) { - if (dist2D(JumpedOnSwitchX, JumpedOnSwitchZ, playerStatus->position.x, playerStatus->position.z) <= 22.0f) { - add_vec2D_polar(&playerStatus->position.x, &playerStatus->position.z, 5.0f, playerStatus->targetYaw); + if (dist2D(JumpedOnSwitchX, JumpedOnSwitchZ, playerStatus->pos.x, playerStatus->pos.z) <= 22.0f) { + add_vec2D_polar(&playerStatus->pos.x, &playerStatus->pos.z, 5.0f, playerStatus->targetYaw); } integrate_gravity(); if (playerStatus->gravityIntegrator[0] <= 0.0f) { @@ -145,14 +145,14 @@ void handle_switch_hit(void) { if (playerStatus->gravityIntegrator[0] > playerStatus->maxJumpSpeed) { playerStatus->gravityIntegrator[0] = playerStatus->maxJumpSpeed; } - playerStatus->position.y += playerStatus->gravityIntegrator[0]; + playerStatus->pos.y += playerStatus->gravityIntegrator[0]; } else if (playerStatus->actionSubstate == LANDING_ON_SWITCH_SUBSTATE_2) { - if (dist2D(JumpedOnSwitchX, JumpedOnSwitchZ, playerStatus->position.x, playerStatus->position.z) <= 22.0f) { - add_vec2D_polar(&playerStatus->position.x, &playerStatus->position.z, 5.0f, playerStatus->targetYaw); + if (dist2D(JumpedOnSwitchX, JumpedOnSwitchZ, playerStatus->pos.x, playerStatus->pos.z) <= 22.0f) { + add_vec2D_polar(&playerStatus->pos.x, &playerStatus->pos.z, 5.0f, playerStatus->targetYaw); } groundPosY = player_check_collision_below(player_fall_distance(), &colliderID); player_handle_floor_collider_type(colliderID); - playerStatus->position.y = groundPosY; + playerStatus->pos.y = groundPosY; if (colliderID >= 0) { if (!(playerStatus->animFlags & PA_FLAG_USING_WATT)) { anim = ANIM_Mario1_Land; @@ -170,8 +170,8 @@ void func_800E2BB0(void) { PlayerStatus* playerStatus = &gPlayerStatus; s32 cond = FALSE; - if (playerStatus->position.y < playerStatus->gravityIntegrator[3] + playerStatus->gravityIntegrator[2]) { - f32 phi_f6 = (playerStatus->gravityIntegrator[3] - playerStatus->position.y) / 777.0f; + if (playerStatus->pos.y < playerStatus->gravityIntegrator[3] + playerStatus->gravityIntegrator[2]) { + f32 phi_f6 = (playerStatus->gravityIntegrator[3] - playerStatus->pos.y) / 777.0f; if (phi_f6 < -0.47) { phi_f6 = -0.47f; @@ -180,7 +180,7 @@ void func_800E2BB0(void) { phi_f6 = 0.001f; } playerStatus->gravityIntegrator[0] += phi_f6; - playerStatus->position.y += playerStatus->gravityIntegrator[0]; + playerStatus->pos.y += playerStatus->gravityIntegrator[0]; if (playerStatus->gravityIntegrator[0] <= 0.0f) { cond = TRUE; } @@ -189,7 +189,7 @@ void func_800E2BB0(void) { if (playerStatus->gravityIntegrator[0] <= 0.0f) { cond = TRUE; } - playerStatus->position.y += playerStatus->gravityIntegrator[0]; + playerStatus->pos.y += playerStatus->gravityIntegrator[0]; } if (cond) { @@ -212,7 +212,7 @@ void phys_update_jump(void) { return; case ACTION_STATE_BOUNCE: integrate_gravity(); - playerStatus->position.y += playerStatus->gravityIntegrator[0]; + playerStatus->pos.y += playerStatus->gravityIntegrator[0]; if (playerStatus->gravityIntegrator[0] <= 0.0f) { record_jump_apex(); if (is_starting_conversation()) { @@ -229,7 +229,7 @@ void phys_update_jump(void) { return; case ACTION_STATE_HOP: playerStatus->gravityIntegrator[0] -= 4.5; - playerStatus->position.y += playerStatus->gravityIntegrator[0]; + playerStatus->pos.y += playerStatus->gravityIntegrator[0]; if (playerStatus->gravityIntegrator[0] <= 0.0f) { record_jump_apex(); gravity_use_fall_parms(); @@ -241,7 +241,7 @@ void phys_update_jump(void) { case ACTION_STATE_HIT_LAVA: return; default: - if (!(playerStatus->currentButtons & BUTTON_A)) { + if (!(playerStatus->curButtons & BUTTON_A)) { record_jump_apex(); set_action_state(ACTION_STATE_HOP); integrate_gravity(); @@ -266,7 +266,7 @@ void phys_update_jump(void) { if (playerStatus->gravityIntegrator[0] > playerStatus->maxJumpSpeed) { playerStatus->gravityIntegrator[0] = playerStatus->maxJumpSpeed; } - playerStatus->position.y += playerStatus->gravityIntegrator[0]; + playerStatus->pos.y += playerStatus->gravityIntegrator[0]; } void phys_init_integrator_for_current_state(void) { @@ -330,7 +330,7 @@ void phys_update_falling(void) { && gPlayerStatus.actionState != ACTION_STATE_BOUNCE ) { s32 colliderID; - gPlayerStatus.position.y = player_check_collision_below(player_fall_distance(), &colliderID); + gPlayerStatus.pos.y = player_check_collision_below(player_fall_distance(), &colliderID); player_handle_floor_collider_type(colliderID); } } @@ -387,21 +387,21 @@ void phys_player_land(void) { playerStatus->timeInAir = 0; playerStatus->peakJumpTime = 0; playerStatus->flags &= ~PS_FLAG_SCRIPTED_FALL; - playerStatus->landPos.x = playerStatus->position.x; - playerStatus->landPos.z = playerStatus->position.z; + playerStatus->landPos.x = playerStatus->pos.x; + playerStatus->landPos.z = playerStatus->pos.z; playerStatus->flags &= ~PS_FLAG_AIRBORNE; sfx_play_sound_at_player(SOUND_SOFT_LAND, SOUND_SPACE_MODE_0); - if (!(collisionStatus->currentFloor & COLLISION_WITH_ENTITY_BIT)) { + if (!(collisionStatus->curFloor & COLLISION_WITH_ENTITY_BIT)) { phys_adjust_cam_on_landing(); } collisionStatus->lastTouchedFloor = -1; - if (collisionStatus->currentFloor & COLLISION_WITH_ENTITY_BIT) { - s32 entityType = get_entity_type(collisionStatus->currentFloor); + if (collisionStatus->curFloor & COLLISION_WITH_ENTITY_BIT) { + s32 entityType = get_entity_type(collisionStatus->curFloor); if (entityType <= ACTION_STATE_FALLING) { if (entityType >= ACTION_STATE_LANDING_ON_SWITCH) { - Entity* entity = get_entity_by_index(collisionStatus->currentFloor); + Entity* entity = get_entity_by_index(collisionStatus->curFloor); entity->collisionFlags |= ENTITY_COLLISION_PLAYER_TOUCH_FLOOR; if (playerStatus->actionState != ACTION_STATE_TORNADO_JUMP @@ -474,20 +474,20 @@ f32 player_check_collision_below(f32 offset, s32* colliderID) { CollisionStatus* collisionStatus = &gCollisionStatus; f32 temp_f4 = playerStatus->colliderHeight * 0.5f; f32 outLength = fabsf(offset) + temp_f4; - f32 x = playerStatus->position.x; - f32 y = playerStatus->position.y + temp_f4; - f32 z = playerStatus->position.z; + f32 x = playerStatus->pos.x; + f32 y = playerStatus->pos.y + temp_f4; + f32 z = playerStatus->pos.z; f32 sp38, sp3C, sp40, sp44; s32 hit = *colliderID = player_raycast_below_cam_relative(&gPlayerStatus, &x, &y, &z, &outLength, &sp38, &sp3C, &sp40, &sp44); if (hit < 0) { - if (offset >= 0.0f && collisionStatus->currentCeiling >= 0) { - return playerStatus->position.y; + if (offset >= 0.0f && collisionStatus->curCeiling >= 0) { + return playerStatus->pos.y; } - y = playerStatus->position.y + offset; + y = playerStatus->pos.y + offset; } else { - collisionStatus->currentFloor = hit; + collisionStatus->curFloor = hit; collisionStatus->lastTouchedFloor = -1; } return y; @@ -512,91 +512,91 @@ void collision_main_lateral(void) { gCollisionStatus.pushingAgainstWall = NO_COLLIDER; if (playerStatus->flags & PS_FLAG_CUTSCENE_MOVEMENT) { - speed = playerStatus->currentSpeed; + speed = playerStatus->curSpeed; if (playerStatus->flags & PS_FLAG_ENTERING_BATTLE) { speed *= 0.5f; } - add_vec2D_polar(&playerStatus->position.x, &playerStatus->position.z, speed, playerStatus->heading); + add_vec2D_polar(&playerStatus->pos.x, &playerStatus->pos.z, speed, playerStatus->heading); return; } switch (playerStatus->actionState) { case ACTION_STATE_STEP_UP: collision_check_player_intersecting_world(0, 0, - playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].currentYaw); + playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].curYaw); break; case ACTION_STATE_RIDE: if (get_current_partner_id() == PARTNER_BOW) { - playerStatus->position.x += playerStatus->pushVelocity.x; - playerStatus->position.y += playerStatus->pushVelocity.y; - playerStatus->position.z += playerStatus->pushVelocity.z; + playerStatus->pos.x += playerStatus->pushVel.x; + playerStatus->pos.y += playerStatus->pushVel.y; + playerStatus->pos.z += playerStatus->pushVel.z; - if (playerStatus->pushVelocity.x != 0.0f || - playerStatus->pushVelocity.y != 0.0f || - playerStatus->pushVelocity.z != 0.0f) + if (playerStatus->pushVel.x != 0.0f || + playerStatus->pushVel.y != 0.0f || + playerStatus->pushVel.z != 0.0f) { - gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; - gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y; - gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; + gCameras[CAM_DEFAULT].targetPos.x = playerStatus->pos.x; + gCameras[CAM_DEFAULT].targetPos.y = playerStatus->pos.y; + gCameras[CAM_DEFAULT].targetPos.z = playerStatus->pos.z; if (playerStatus->alpha1 != 128) { collision_check_player_intersecting_world(0, 0, - atan2(0.0f, 0.0f, playerStatus->pushVelocity.x, playerStatus->pushVelocity.z)); + atan2(0.0f, 0.0f, playerStatus->pushVel.x, playerStatus->pushVel.z)); } } } break; case ACTION_STATE_SPIN_POUND: case ACTION_STATE_TORNADO_POUND: - playerStatus->position.x += playerStatus->pushVelocity.x; - playerStatus->position.y += playerStatus->pushVelocity.y; - playerStatus->position.z += playerStatus->pushVelocity.z; - if (playerStatus->pushVelocity.x != 0.0f || - playerStatus->pushVelocity.y != 0.0f || - playerStatus->pushVelocity.z != 0.0f) + playerStatus->pos.x += playerStatus->pushVel.x; + playerStatus->pos.y += playerStatus->pushVel.y; + playerStatus->pos.z += playerStatus->pushVel.z; + if (playerStatus->pushVel.x != 0.0f || + playerStatus->pushVel.y != 0.0f || + playerStatus->pushVel.z != 0.0f) { - gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; - gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y; - gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; + gCameras[CAM_DEFAULT].targetPos.x = playerStatus->pos.x; + gCameras[CAM_DEFAULT].targetPos.y = playerStatus->pos.y; + gCameras[CAM_DEFAULT].targetPos.z = playerStatus->pos.z; } - if (playerStatus->pushVelocity.x != 0.0f || - playerStatus->pushVelocity.y != 0.0f || - playerStatus->pushVelocity.z != 0.0f) + if (playerStatus->pushVel.x != 0.0f || + playerStatus->pushVel.y != 0.0f || + playerStatus->pushVel.z != 0.0f) { collision_check_player_intersecting_world(0, 0, - playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].currentYaw); + playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].curYaw); } break; case ACTION_STATE_HAMMER: - playerStatus->position.x += playerStatus->pushVelocity.x; - playerStatus->position.y += playerStatus->pushVelocity.y; - playerStatus->position.z += playerStatus->pushVelocity.z; - if (playerStatus->pushVelocity.x != 0.0f || - playerStatus->pushVelocity.y != 0.0f || - playerStatus->pushVelocity.z != 0.0f) + playerStatus->pos.x += playerStatus->pushVel.x; + playerStatus->pos.y += playerStatus->pushVel.y; + playerStatus->pos.z += playerStatus->pushVel.z; + if (playerStatus->pushVel.x != 0.0f || + playerStatus->pushVel.y != 0.0f || + playerStatus->pushVel.z != 0.0f) { - gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; - gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y; - gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; + gCameras[CAM_DEFAULT].targetPos.x = playerStatus->pos.x; + gCameras[CAM_DEFAULT].targetPos.y = playerStatus->pos.y; + gCameras[CAM_DEFAULT].targetPos.z = playerStatus->pos.z; } - playerX = playerStatus->position.x; - playerY = playerStatus->position.y; - playerZ = playerStatus->position.z; - if (playerStatus->currentSpeed != 0.0f) { + playerX = playerStatus->pos.x; + playerY = playerStatus->pos.y; + playerZ = playerStatus->pos.z; + if (playerStatus->curSpeed != 0.0f) { yaw = playerStatus->targetYaw; } else { - yaw = playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].currentYaw; + yaw = playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].curYaw; } - collisionStatus->currentWall = + collisionStatus->curWall = player_test_move_with_slipping(playerStatus, &playerX, &playerY, &playerZ, playerStatus->colliderDiameter * 0.5f, yaw); - if (playerStatus->pushVelocity.x != 0.0f || - playerStatus->pushVelocity.y != 0.0f || - playerStatus->pushVelocity.z != 0.0f) + if (playerStatus->pushVel.x != 0.0f || + playerStatus->pushVel.y != 0.0f || + playerStatus->pushVel.z != 0.0f) { collision_check_player_intersecting_world(0, 0, - playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].currentYaw); + playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].curYaw); } break; default: @@ -637,7 +637,7 @@ void collision_main_lateral(void) { } sin_cos_rad(DEG_TO_RAD(playerStatus->targetYaw), &sinTheta, &cosTheta); - speed = playerStatus->currentSpeed; + speed = playerStatus->curSpeed; if (playerStatus->flags & PS_FLAG_ENTERING_BATTLE) { speed *= 0.5f; } @@ -652,47 +652,47 @@ void collision_main_lateral(void) { } } - playerStatus->position.x += playerStatus->pushVelocity.x; - playerStatus->position.z += playerStatus->pushVelocity.z; + playerStatus->pos.x += playerStatus->pushVel.x; + playerStatus->pos.z += playerStatus->pushVel.z; if (playerStatus->timeInAir == 0) { - playerStatus->position.y += playerStatus->pushVelocity.y; + playerStatus->pos.y += playerStatus->pushVel.y; } if ( - playerStatus->pushVelocity.x != 0.0f || - playerStatus->pushVelocity.y != 0.0f || - playerStatus->pushVelocity.z != 0.0f) + playerStatus->pushVel.x != 0.0f || + playerStatus->pushVel.y != 0.0f || + playerStatus->pushVel.z != 0.0f) { - gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; - gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y; - gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; + gCameras[CAM_DEFAULT].targetPos.x = playerStatus->pos.x; + gCameras[CAM_DEFAULT].targetPos.y = playerStatus->pos.y; + gCameras[CAM_DEFAULT].targetPos.z = playerStatus->pos.z; } - playerX = playerStatus->position.x; - playerY = playerStatus->position.y; - playerZ = playerStatus->position.z; + playerX = playerStatus->pos.x; + playerY = playerStatus->pos.y; + playerZ = playerStatus->pos.z; result = player_test_move_with_slipping(playerStatus, &playerX, &playerY, &playerZ, playerStatus->colliderDiameter * 0.5f, playerStatus->targetYaw); if (speed == 0.0f && result < 0) { - yaw2 = playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].currentYaw; + yaw2 = playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].curYaw; sin_cos_rad(DEG_TO_RAD(yaw2 + 180.0f), &sinTheta, &cosTheta); - playerX = playerStatus->position.x + (sinTheta * playerStatus->colliderDiameter * 0.5f); - playerY = playerStatus->position.y; - playerZ = playerStatus->position.z - (cosTheta * playerStatus->colliderDiameter * 0.5f); + playerX = playerStatus->pos.x + (sinTheta * playerStatus->colliderDiameter * 0.5f); + playerY = playerStatus->pos.y; + playerZ = playerStatus->pos.z - (cosTheta * playerStatus->colliderDiameter * 0.5f); result = player_test_move_with_slipping(playerStatus, &playerX, &playerY, &playerZ, playerStatus->colliderDiameter, yaw2); } - collisionStatus->currentWall = result; + collisionStatus->curWall = result; if (!(playerStatus->flags & PS_FLAG_MOVEMENT_LOCKED) && playerStatus->actionState != ACTION_STATE_HAMMER) { if (speed == 0.0f) { collision_check_player_intersecting_world(0, 0, - playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].currentYaw); + playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].curYaw); break; } - playerX = playerStatus->position.x; - playerZ = playerStatus->position.z; - playerY = playerStatus->position.y; + playerX = playerStatus->pos.x; + playerZ = playerStatus->pos.z; + playerY = playerStatus->pos.y; yaw2 = yaw; if (speed > 4.0f) { @@ -719,22 +719,22 @@ void collision_main_lateral(void) { if (test1 < 0) { if (test2 < 0) { - playerStatus->position.x = playerX; - playerStatus->position.z = playerZ; + playerStatus->pos.x = playerX; + playerStatus->pos.z = playerZ; } else { - playerStatus->position.x = test1X; - playerStatus->position.z = test1Z; + playerStatus->pos.x = test1X; + playerStatus->pos.z = test1Z; } } else if (test2 < 0) { - playerStatus->position.x = test2X; - playerStatus->position.z = test2Y; + playerStatus->pos.x = test2X; + playerStatus->pos.z = test2Y; } if (playerStatus->enableCollisionOverlapsCheck == 0) { if (playerStatus->animFlags & PA_FLAG_SPINNING) { yaw2 = playerStatus->targetYaw; } else { - yaw2 = playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].currentYaw; + yaw2 = playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].curYaw; } if (collision_check_player_intersecting_world(0, 0, yaw2) < 0) { collision_check_player_intersecting_world(1, playerStatus->colliderHeight * 0.75f, yaw2); @@ -762,9 +762,9 @@ s32 collision_check_player_intersecting_world(s32 mode, s32 arg1, f32 yaw) { s32 i; for (i = 0; i < 4; i++) { - f32 x = gPlayerStatusPtr->position.x; - f32 y = gPlayerStatusPtr->position.y + arg1; - f32 z = gPlayerStatusPtr->position.z; + f32 x = gPlayerStatusPtr->pos.x; + f32 y = gPlayerStatusPtr->pos.y + arg1; + f32 z = gPlayerStatusPtr->pos.z; s32 hitID, hitID2; hitID = player_test_lateral_overlap(mode, gPlayerStatusPtr, &x, &y, &z, 0.0f, angle); @@ -783,8 +783,8 @@ s32 collision_check_player_intersecting_world(s32 mode, s32 arg1, f32 yaw) { } gPlayerStatusPtr = gPlayerStatusPtr; - gPlayerStatusPtr->position.x = x; - gPlayerStatusPtr->position.z = z; + gPlayerStatusPtr->pos.x = x; + gPlayerStatusPtr->pos.z = z; angle += 90.0f; } @@ -819,16 +819,16 @@ void collision_check_player_overlaps(void) { f32 overlapPush = playerStatus->overlapPushAmount; if (overlapPush != 0.0f) { - f32 x = playerStatus->position.x; - f32 y = playerStatus->position.y; - f32 z = playerStatus->position.z; + f32 x = playerStatus->pos.x; + f32 y = playerStatus->pos.y; + f32 z = playerStatus->pos.z; player_test_lateral_overlap(0, &gPlayerStatus, &x, &y, &z, overlapPush, playerStatus->overlapPushYaw); overlapPush -= playerStatus->runSpeed / 10.0f; - playerStatus->position.x = x; - playerStatus->position.y = y; - playerStatus->position.z = z; + playerStatus->pos.x = x; + playerStatus->pos.y = y; + playerStatus->pos.z = z; if (overlapPush < 0.0f) { overlapPush = 0.0f; @@ -844,7 +844,7 @@ s32 phys_should_player_be_sliding(void) { s32 ret = FALSE; if (gGameStatusPtr->areaID == AREA_IWA) { - f32 temp_f0 = shadow->rotation.z + 180.0; + f32 temp_f0 = shadow->rot.z + 180.0; if (temp_f0 != 0.0f) { ret = TRUE; @@ -855,7 +855,7 @@ s32 phys_should_player_be_sliding(void) { } break; case 1: - if (playerStatus->position.x >= -300.0f && playerStatus->position.x <= -140.0f) { + if (playerStatus->pos.x >= -300.0f && playerStatus->pos.x <= -140.0f) { ret = FALSE; } break; @@ -867,8 +867,8 @@ s32 phys_should_player_be_sliding(void) { s32 phys_is_on_sloped_ground(void) { Shadow* playerShadow = get_shadow_by_index(gPlayerStatus.shadowID); - f32 rotZ = playerShadow->rotation.z + 180.0; - f32 rotX = playerShadow->rotation.x + 180.0; + f32 rotZ = playerShadow->rot.z + 180.0; + f32 rotX = playerShadow->rot.x + 180.0; s32 ret = TRUE; if (fabsf(rotZ) < 20.0f && fabsf(rotX) < 20.0f) { @@ -883,9 +883,9 @@ void phys_main_collision_below(void) { PartnerStatus* partnerStatus = &gPartnerStatus; CollisionStatus* collisionStatus = &gCollisionStatus; f32 collHeightHalf = playerStatus->colliderHeight * 0.5f; - f32 playerX = playerStatus->position.x; - f32 playerY = playerStatus->position.y + collHeightHalf; - f32 playerZ = playerStatus->position.z; + f32 playerX = playerStatus->pos.x; + f32 playerY = playerStatus->pos.y + collHeightHalf; + f32 playerZ = playerStatus->pos.z; f32 outLength = playerStatus->colliderHeight; f32 temp_f24 = (2.0f * playerStatus->colliderHeight) / 7.0f; f32 hitRx, hitRz; @@ -901,7 +901,7 @@ void phys_main_collision_below(void) { colliderID = NO_COLLIDER; } if (playerStatus->timeInAir == 0) { - collisionStatus->currentFloor = colliderID; + collisionStatus->curFloor = colliderID; } if (colliderID >= 0) { playerStatus->groundAnglesXZ.x = hitDirX; @@ -953,21 +953,21 @@ void phys_main_collision_below(void) { break; default: cond = FALSE; - if (collisionStatus->currentFloor & COLLISION_WITH_ENTITY_BIT) { - cond = get_entity_type(collisionStatus->currentFloor) == ENTITY_TYPE_HIDDEN_PANEL; + if (collisionStatus->curFloor & COLLISION_WITH_ENTITY_BIT) { + cond = get_entity_type(collisionStatus->curFloor) == ENTITY_TYPE_HIDDEN_PANEL; } if (playerStatus->actionState != ACTION_STATE_STEP_UP && !cond) { if (!(playerStatus->animFlags & PA_FLAG_USING_PEACH_PHYSICS)) { - if (playerY - playerStatus->position.y < 6.0f) { - playerStatus->position.y = playerY; + if (playerY - playerStatus->pos.y < 6.0f) { + playerStatus->pos.y = playerY; } else { set_action_state(ACTION_STATE_STEP_UP); D_8010C928 = playerY; D_8010C984 = playerStatus->targetYaw; } } else { - playerStatus->position.y = playerY; + playerStatus->pos.y = playerY; } phys_save_ground_pos(); } @@ -989,13 +989,13 @@ void phys_main_collision_below(void) { void func_800E4AD8(s32 mode) { Camera* currentCamera = &gCameras[gCurrentCameraID]; - collision_check_player_intersecting_world(mode, 0, gPlayerStatus.spriteFacingAngle - 90.0f + currentCamera->currentYaw); + collision_check_player_intersecting_world(mode, 0, gPlayerStatus.spriteFacingAngle - 90.0f + currentCamera->curYaw); } void func_800E4B40(s32 mode, f32* arg1, f32* arg2, f32* arg3) { Camera* currentCamera = &gCameras[gCurrentCameraID]; - func_800E4404(mode, 0, gPlayerStatus.spriteFacingAngle - 90.0f + currentCamera->currentYaw, arg1, arg2, arg3); + func_800E4404(mode, 0, gPlayerStatus.spriteFacingAngle - 90.0f + currentCamera->curYaw, arg1, arg2, arg3); } void collision_lava_reset_check_additional_overlaps(void) { @@ -1009,79 +1009,79 @@ void collision_lava_reset_check_additional_overlaps(void) { } temp_f0 = clamp_angle(playerStatus->targetYaw - 30.0); - y = playerStatus->position.y + (playerStatus->colliderHeight * 0.75f); - x = playerStatus->position.x; - z = playerStatus->position.z; + y = playerStatus->pos.y + (playerStatus->colliderHeight * 0.75f); + x = playerStatus->pos.x; + z = playerStatus->pos.z; player_test_lateral_overlap(0, &gPlayerStatus, &x, &y, &z, 0.0f, temp_f0); - playerStatus->position.x = x; - playerStatus->position.z = z; + playerStatus->pos.x = x; + playerStatus->pos.z = z; temp_f0 = clamp_angle(playerStatus->targetYaw + 30.0); - y = playerStatus->position.y + (playerStatus->colliderHeight * 0.75f); - x = playerStatus->position.x; - z = playerStatus->position.z; + y = playerStatus->pos.y + (playerStatus->colliderHeight * 0.75f); + x = playerStatus->pos.x; + z = playerStatus->pos.z; player_test_lateral_overlap(0, &gPlayerStatus, &x, &y, &z, 0.0f, temp_f0); - playerStatus->position.x = x; - playerStatus->position.z = z; + playerStatus->pos.x = x; + playerStatus->pos.z = z; temp_f0 = clamp_angle(playerStatus->targetYaw - 30.0); - x = playerStatus->position.x; - y = playerStatus->position.y; - z = playerStatus->position.z; + x = playerStatus->pos.x; + y = playerStatus->pos.y; + z = playerStatus->pos.z; player_test_lateral_overlap(0, &gPlayerStatus, &x, &y, &z, 0.0f, temp_f0); - playerStatus->position.x = x; - playerStatus->position.z = z; + playerStatus->pos.x = x; + playerStatus->pos.z = z; temp_f0 = clamp_angle(playerStatus->targetYaw + 30.0); - x = playerStatus->position.x; - y = playerStatus->position.y; - z = playerStatus->position.z; + x = playerStatus->pos.x; + y = playerStatus->pos.y; + z = playerStatus->pos.z; player_test_lateral_overlap(0, &gPlayerStatus, &x, &y, &z, 0.0f, temp_f0); - playerStatus->position.x = x; - playerStatus->position.z = z; + playerStatus->pos.x = x; + playerStatus->pos.z = z; temp_f0 = clamp_angle(playerStatus->targetYaw + 90.0); - x = playerStatus->position.x; - y = playerStatus->position.y; - z = playerStatus->position.z; + x = playerStatus->pos.x; + y = playerStatus->pos.y; + z = playerStatus->pos.z; player_test_lateral_overlap(0, &gPlayerStatus, &x, &y, &z, 0.0f, temp_f0); - playerStatus->position.x = x; - playerStatus->position.z = z; + playerStatus->pos.x = x; + playerStatus->pos.z = z; temp_f0 = clamp_angle(playerStatus->targetYaw - 90.0); - x = playerStatus->position.x; - y = playerStatus->position.y; - z = playerStatus->position.z; + x = playerStatus->pos.x; + y = playerStatus->pos.y; + z = playerStatus->pos.z; player_test_lateral_overlap(0, &gPlayerStatus, &x, &y, &z, 0.0f, temp_f0); - playerStatus->position.x = x; - playerStatus->position.z = z; + playerStatus->pos.x = x; + playerStatus->pos.z = z; temp_f0 = clamp_angle(playerStatus->targetYaw + 180.0); - x = playerStatus->position.x; - y = playerStatus->position.y; - z = playerStatus->position.z; + x = playerStatus->pos.x; + y = playerStatus->pos.y; + z = playerStatus->pos.z; player_test_lateral_overlap(0, &gPlayerStatus, &x, &y, &z, 0.0f, temp_f0); - playerStatus->position.x = x; - playerStatus->position.z = z; + playerStatus->pos.x = x; + playerStatus->pos.z = z; } void collision_lateral_peach(void) { PlayerStatus* playerStatus = &gPlayerStatus; s32 climbableStep = FALSE; f32 yaw = playerStatus->targetYaw; - f32 x = playerStatus->position.x; - f32 y = playerStatus->position.y; - f32 z = playerStatus->position.z; + f32 x = playerStatus->pos.x; + f32 y = playerStatus->pos.y; + f32 z = playerStatus->pos.z; s32 wall = player_test_move_without_slipping(&gPlayerStatus, &x, &y, &z, 0, yaw, &climbableStep); - playerStatus->position.x = x; - playerStatus->position.z = z; + playerStatus->pos.x = x; + playerStatus->pos.z = z; // If there was a climbable step in this direction, but no wall, we can climb up it if (climbableStep && wall < 0 && playerStatus->actionState != ACTION_STATE_STEP_UP_PEACH - && playerStatus->currentSpeed != 0.0f + && playerStatus->curSpeed != 0.0f ) { set_action_state(ACTION_STATE_STEP_UP_PEACH); } @@ -1110,12 +1110,12 @@ void check_input_midair_jump(void) { } s8 get_current_partner_id(void) { - return gPlayerData.currentPartner; + return gPlayerData.curPartner; } void try_player_footstep_sounds(s32 interval) { if (gGameStatusPtr->frameCounter % interval == 0) { - s32 surfaceType = get_collider_flags(gCollisionStatus.currentFloor) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; + s32 surfaceType = get_collider_flags(gCollisionStatus.curFloor) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; s32 soundID, altSoundID; if (surfaceType == SURFACE_TYPE_FLOWERS || surfaceType == SURFACE_TYPE_HEDGES) { @@ -1136,7 +1136,7 @@ void try_player_footstep_sounds(s32 interval) { } void phys_update_interact_collider(void) { - gCollisionStatus.currentInspect = phys_check_interactable_collision(); + gCollisionStatus.curInspect = phys_check_interactable_collision(); } s32 phys_check_interactable_collision(void) { @@ -1150,16 +1150,16 @@ s32 phys_check_interactable_collision(void) { if (playerStatus->pressedButtons & BUTTON_A) { yaw = playerStatus->targetYaw; - x = playerStatus->position.x; - y = playerStatus->position.y; - z = playerStatus->position.z; + x = playerStatus->pos.x; + y = playerStatus->pos.y; + z = playerStatus->pos.z; ret = player_test_move_with_slipping(playerStatus, &x, &y, &z, playerStatus->colliderDiameter * 0.5f, yaw); - if (ret < 0 && playerStatus->currentSpeed == 0.0f) { - yaw = playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].currentYaw; - x = playerStatus->position.x; - y = playerStatus->position.y; - z = playerStatus->position.z; + if (ret < 0 && playerStatus->curSpeed == 0.0f) { + yaw = playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].curYaw; + x = playerStatus->pos.x; + y = playerStatus->pos.y; + z = playerStatus->pos.z; ret = player_test_move_with_slipping(playerStatus, &x, &y, &z, playerStatus->colliderDiameter * 0.5f, yaw); } } @@ -1189,7 +1189,7 @@ s32 phys_can_player_interact(void) { } f32 func_800E5348(void) { - f32 deltaYaw = get_clamped_angle_diff(gCameras[gCurrentCameraID].currentYaw, gPlayerStatus.currentYaw); + f32 deltaYaw = get_clamped_angle_diff(gCameras[gCurrentCameraID].curYaw, gPlayerStatus.curYaw); if (deltaYaw < -5.0f && deltaYaw > -175.0f) { deltaYaw = 0.0f; @@ -1198,7 +1198,7 @@ f32 func_800E5348(void) { } else { deltaYaw = PrevPlayerCamRelativeYaw; } - return clamp_angle(deltaYaw - 90.0f + gCameras[gCurrentCameraID].currentYaw); + return clamp_angle(deltaYaw - 90.0f + gCameras[gCurrentCameraID].curYaw); } f32 player_get_camera_facing_angle(void) { @@ -1208,7 +1208,7 @@ f32 player_get_camera_facing_angle(void) { angle = 180.0f; } - angle = angle + gCameras[CAM_DEFAULT].currentYaw + 90.0f; + angle = angle + gCameras[CAM_DEFAULT].curYaw + 90.0f; return clamp_angle(angle); } @@ -1216,7 +1216,7 @@ f32 player_get_camera_facing_angle(void) { void phys_save_ground_pos(void) { PlayerStatus* playerStatus = &gPlayerStatus; - playerStatus->lastGoodPosition.x = playerStatus->position.x; - playerStatus->lastGoodPosition.y = playerStatus->position.y; - playerStatus->lastGoodPosition.z = playerStatus->position.z; + playerStatus->lastGoodPos.x = playerStatus->pos.x; + playerStatus->lastGoodPos.y = playerStatus->pos.y; + playerStatus->lastGoodPos.z = playerStatus->pos.z; } diff --git a/src/7fd10_len_b40.c b/src/7fd10_len_b40.c index e6ca5b2a489..24da5b19cbe 100644 --- a/src/7fd10_len_b40.c +++ b/src/7fd10_len_b40.c @@ -134,7 +134,7 @@ s32 setup_partner_popup(PopupMenu* menu) { menu->nameMsg[optionCount] = properties->nameMsg; menu->descMsg[optionCount] = properties->worldDescMsg; menu->value[optionCount] = playerData->partners[partnerID].level; - if (playerData->currentPartner == partnerID) { + if (playerData->curPartner == partnerID) { menu->enabled[optionCount] = FALSE; menu->ptrIcon[optionCount] = wDisabledPartnerHudScripts[partnerID]; } @@ -203,10 +203,10 @@ void check_input_open_menus(void) { partnerStatus->actingPartner == PARTNER_LAKILESTER || partnerStatus->actingPartner == PARTNER_BOW)) { - currentButtons = partnerStatus->currentButtons; + currentButtons = partnerStatus->curButtons; pressedButtons = partnerStatus->pressedButtons; } else { - currentButtons = playerStatus->currentButtons; + currentButtons = playerStatus->curButtons; pressedButtons = playerStatus->pressedButtons; } partnerActionState = &partnerStatus->partnerActionState; @@ -245,7 +245,7 @@ void check_input_open_menus(void) { } popup->numEntries = numEntries; popup->popupType = POPUP_MENU_SWITCH_PARTNER; - popup->initialPos = MenuIndexFromPartnerID[playerData->currentPartner] - 1; + popup->initialPos = MenuIndexFromPartnerID[playerData->curPartner] - 1; break; } return; @@ -382,14 +382,14 @@ void check_input_status_bar(void) { } if (!is_status_bar_visible()) { - if (!(playerStatus->currentButtons & (Z_TRIG | R_TRIG)) && (pressedButtons & BUTTON_C_UP) && func_800E9860()) { + if (!(playerStatus->curButtons & (Z_TRIG | R_TRIG)) && (pressedButtons & BUTTON_C_UP) && func_800E9860()) { open_status_bar_long(); if (!is_picking_up_item()) { sfx_play_sound(SOUND_3); } } - } else if (!(playerStatus->currentButtons & (Z_TRIG | R_TRIG)) && (pressedButtons & BUTTON_C_UP) && func_800E9860()) { + } else if (!(playerStatus->curButtons & (Z_TRIG | R_TRIG)) && (pressedButtons & BUTTON_C_UP) && func_800E9860()) { close_status_bar(); if (!is_picking_up_item()) { diff --git a/src/80850_len_3060.c b/src/80850_len_3060.c index ceecc0ba577..389febfacb5 100644 --- a/src/80850_len_3060.c +++ b/src/80850_len_3060.c @@ -69,7 +69,7 @@ void clear_player_data(void) { playerData->maxStarPower = 0; playerData->specialBarsFilled = 0; playerData->starBeamLevel = 0; - playerData->currentPartner = 0; + playerData->curPartner = 0; for (i = 0; i < ARRAY_COUNT(playerData->partners); i++) { playerData->partners[i].enabled = FALSE; diff --git a/src/8800.c b/src/8800.c index f28e751b0cd..0da40064f3c 100644 --- a/src/8800.c +++ b/src/8800.c @@ -191,7 +191,7 @@ void render_frame(s32 isSecondPass) { camera->unkMatrix = &gDisplayContext->matrixStack[gMatrixListPos]; matrixListPos = gMatrixListPos++; - guRotate(&gDisplayContext->matrixStack[matrixListPos], -camera->trueRotation.x, 0.0f, 1.0f, 0.0f); + guRotate(&gDisplayContext->matrixStack[matrixListPos], -camera->trueRot.x, 0.0f, 1.0f, 0.0f); camera->vpAlt.vp.vtrans[0] = camera->vp.vp.vtrans[0] + gGameStatusPtr->unk_82; camera->vpAlt.vp.vtrans[1] = camera->vp.vp.vtrans[1] + gGameStatusPtr->unk_83; @@ -366,12 +366,12 @@ Camera* initialize_next_camera(CameraInitData* initData) { camera->lookAt_obj.x = 0; camera->lookAt_obj.y = 0; camera->lookAt_obj.z = -100.0f; - camera->currentYaw = 0; - camera->currentBoomLength = 0; - camera->currentYOffset = 0; - camera->trueRotation.x = 0.0f; - camera->trueRotation.y = 0.0f; - camera->trueRotation.z = 0.0f; + camera->curYaw = 0; + camera->curBoomLength = 0; + camera->curYOffset = 0; + camera->trueRot.x = 0.0f; + camera->trueRot.y = 0.0f; + camera->trueRot.z = 0.0f; camera->updateMode = initData->updateMode; camera->needsInit = TRUE; camera->nearClip = initData->nearClip; diff --git a/src/891b0_len_fb0.c b/src/891b0_len_fb0.c index fabee788dfb..e69cc7f4eb8 100644 --- a/src/891b0_len_fb0.c +++ b/src/891b0_len_fb0.c @@ -41,7 +41,7 @@ void handle_floor_behavior(void) { colliderType = D_80109480; } - D_80109480 = get_collider_flags((u16)gCollisionStatus.currentFloor) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; + D_80109480 = get_collider_flags((u16)gCollisionStatus.curFloor) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; if (playerStatus->actionState != ACTION_STATE_JUMP) { colliderType = D_80109480; @@ -90,9 +90,9 @@ void surface_standard_behavior(void) { (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) && D_8010CFF4 >= 10) { - x = playerStatus->position.x; - y = playerStatus->position.y + 0.0f; - z = playerStatus->position.z; + x = playerStatus->pos.x; + y = playerStatus->pos.y + 0.0f; + z = playerStatus->pos.z; if (!cond) { fx_landing_dust(0, x, y, z, D_80109484); } else { @@ -102,33 +102,33 @@ void surface_standard_behavior(void) { } else if ( (playerStatus->actionState == ACTION_STATE_SPIN_POUND || playerStatus->actionState == ACTION_STATE_TORNADO_POUND) && (playerStatus->flags & PS_FLAG_SPECIAL_LAND)) { - x = playerStatus->position.x; - y = playerStatus->position.y + 0.0f; - z = playerStatus->position.z; + x = playerStatus->pos.x; + y = playerStatus->pos.y + 0.0f; + z = playerStatus->pos.z; if (!cond) { fx_landing_dust(0, x, y, z, D_80109484); } else { fx_misc_particles(3, x, y, z, playerStatus->colliderDiameter, 10.0f, 1.0f, 5, 40); } - } else if (playerStatus->actionState == ACTION_STATE_SPIN && playerStatus->currentSpeed != 0.0f) { + } else if (playerStatus->actionState == ACTION_STATE_SPIN && playerStatus->curSpeed != 0.0f) { if (D_80109488++ >= 4) { D_80109488 = 2; if (cond) { sin_cos_rad(DEG_TO_RAD(clamp_angle(playerStatus->targetYaw)), &sinTheta, &cosTheta); fx_misc_particles( 3, - playerStatus->position.x + (playerStatus->colliderDiameter * sinTheta), - playerStatus->position.y + 1.5f, - playerStatus->position.z + (playerStatus->colliderDiameter * cosTheta), + playerStatus->pos.x + (playerStatus->colliderDiameter * sinTheta), + playerStatus->pos.y + 1.5f, + playerStatus->pos.z + (playerStatus->colliderDiameter * cosTheta), 13.0f, 10.0f, 1.0f, 5, 30 ); } else { - sin_cos_rad(DEG_TO_RAD(clamp_angle(-playerStatus->currentYaw)), &sinTheta, &cosTheta); + sin_cos_rad(DEG_TO_RAD(clamp_angle(-playerStatus->curYaw)), &sinTheta, &cosTheta); fx_walking_dust( 0, - playerStatus->position.x + (playerStatus->colliderDiameter * sinTheta * 0.2f), - playerStatus->position.y + 1.5f, - playerStatus->position.z + (playerStatus->colliderDiameter * cosTheta * 0.2f), + playerStatus->pos.x + (playerStatus->colliderDiameter * sinTheta * 0.2f), + playerStatus->pos.y + 1.5f, + playerStatus->pos.z + (playerStatus->colliderDiameter * cosTheta * 0.2f), sinTheta, cosTheta ); } @@ -144,21 +144,21 @@ void surface_standard_behavior(void) { if (D_80109488++ >= 4) { D_80109488 = 0; if (!cond) { - sin_cos_rad(DEG_TO_RAD(clamp_angle(-playerStatus->currentYaw)), &sinTheta, &cosTheta); + sin_cos_rad(DEG_TO_RAD(clamp_angle(-playerStatus->curYaw)), &sinTheta, &cosTheta); fx_walking_dust( 0, - playerStatus->position.x + (playerStatus->colliderDiameter * sinTheta * 0.2f), - playerStatus->position.y + 1.5f, - playerStatus->position.z + (playerStatus->colliderDiameter * cosTheta * 0.2f), + playerStatus->pos.x + (playerStatus->colliderDiameter * sinTheta * 0.2f), + playerStatus->pos.y + 1.5f, + playerStatus->pos.z + (playerStatus->colliderDiameter * cosTheta * 0.2f), sinTheta, cosTheta ); } else { sin_cos_rad(DEG_TO_RAD(clamp_angle(playerStatus->targetYaw)), &sinTheta, &cosTheta); fx_misc_particles( 3, - playerStatus->position.x + (playerStatus->currentSpeed * sinTheta), - playerStatus->position.y + 1.5f, - playerStatus->position.z + (playerStatus->currentSpeed * cosTheta), + playerStatus->pos.x + (playerStatus->curSpeed * sinTheta), + playerStatus->pos.y + 1.5f, + playerStatus->pos.z + (playerStatus->curSpeed * cosTheta), 13.0f, 10.0f, 1.0f, 5, 30 ); } @@ -172,10 +172,10 @@ void surface_flowers_behavior(void) { f32 t1; if (playerStatus->actionState == ACTION_STATE_JUMP && playerStatus->timeInAir == 1 && D_80109492 == 5) { - z = playerStatus->position.z; // TODO weird use of temps required to match - x = playerStatus->position.y + 14.0f; + z = playerStatus->pos.z; // TODO weird use of temps required to match + x = playerStatus->pos.y + 14.0f; y = D_8010948C; - fx_flower_splash(playerStatus->position.x, x, z, y); + fx_flower_splash(playerStatus->pos.x, x, z, y); D_8010948C = clamp_angle(D_8010948C + 35.0f); D_80109492 = 0; return; @@ -197,15 +197,15 @@ void surface_flowers_behavior(void) { if (D_80109490++ > 0) { f32 colliderDiameter; D_80109490 = 0; - sin_cos_rad(DEG_TO_RAD(clamp_angle(-playerStatus->currentYaw)), &sin, &cos); + sin_cos_rad(DEG_TO_RAD(clamp_angle(-playerStatus->curYaw)), &sin, &cos); colliderDiameter = playerStatus->colliderDiameter; - x = playerStatus->position.x + (colliderDiameter * sin * -0.4f); - z = playerStatus->position.z + (colliderDiameter * cos * -0.4f); - y = playerStatus->position.y + 15.5f; + x = playerStatus->pos.x + (colliderDiameter * sin * -0.4f); + z = playerStatus->pos.z + (colliderDiameter * cos * -0.4f); + y = playerStatus->pos.y + 15.5f; - fx_flower_trail(0, x, y, z, -playerStatus->currentYaw + rand_int(10) - 5.0f, D_80109494); + fx_flower_trail(0, x, y, z, -playerStatus->curYaw + rand_int(10) - 5.0f, D_80109494); D_80109494 = !D_80109494; } } @@ -225,9 +225,9 @@ void surface_cloud_behavior(void) { D_8010CFF4 >= 10) { fx_cloud_puff( - playerStatus->position.x, - (playerStatus->position.y + 14.0f) - 5.0f, - playerStatus->position.z, D_80109498 + playerStatus->pos.x, + (playerStatus->pos.y + 14.0f) - 5.0f, + playerStatus->pos.z, D_80109498 ); D_80109498 = clamp_angle(D_80109498 + 35.0f); @@ -236,12 +236,12 @@ void surface_cloud_behavior(void) { zTemp = rand_int(10) - 5; yTemp = -2.0f - ((SQ(xTemp) + SQ(zTemp)) / 5.0f); D_8010949C = 0; - sin_cos_rad(DEG_TO_RAD(clamp_angle(-playerStatus->currentYaw + (i * 90))), &sinTheta, &cosTheta); + sin_cos_rad(DEG_TO_RAD(clamp_angle(-playerStatus->curYaw + (i * 90))), &sinTheta, &cosTheta); fx_cloud_trail( 0, - playerStatus->position.x + (playerStatus->colliderDiameter * sinTheta * -0.3f) + xTemp, - playerStatus->position.y + 15.5f + yTemp, - playerStatus->position.z + (playerStatus->colliderDiameter * cosTheta * -0.3f) + zTemp + playerStatus->pos.x + (playerStatus->colliderDiameter * sinTheta * -0.3f) + xTemp, + playerStatus->pos.y + 15.5f + yTemp, + playerStatus->pos.z + (playerStatus->colliderDiameter * cosTheta * -0.3f) + zTemp ); } } else { @@ -255,12 +255,12 @@ void surface_cloud_behavior(void) { zTemp2 = rand_int(10) - 5; yTemp2 = -2.0f - ((SQ(xTemp2) + SQ(zTemp2)) / 5.0f); D_8010949C = 0; - sin_cos_rad(DEG_TO_RAD(clamp_angle(-playerStatus->currentYaw)), &sinTheta, &cosTheta); + sin_cos_rad(DEG_TO_RAD(clamp_angle(-playerStatus->curYaw)), &sinTheta, &cosTheta); fx_cloud_trail( 1, - playerStatus->position.x + (playerStatus->colliderDiameter * sinTheta * -0.3f) + xTemp2, - playerStatus->position.y + 15.5f + yTemp2, - playerStatus->position.z + (playerStatus->colliderDiameter * cosTheta * -0.3f) + zTemp2 + playerStatus->pos.x + (playerStatus->colliderDiameter * sinTheta * -0.3f) + xTemp2, + playerStatus->pos.y + 15.5f + yTemp2, + playerStatus->pos.z + (playerStatus->colliderDiameter * cosTheta * -0.3f) + zTemp2 ); } } @@ -281,12 +281,12 @@ void surface_snow_behavior(void) { if (D_801094A4++ >= 4) { D_801094A4 = 0; - sin_cos_rad(DEG_TO_RAD(clamp_angle(-playerStatus->currentYaw)), &sin, &cos); + sin_cos_rad(DEG_TO_RAD(clamp_angle(-playerStatus->curYaw)), &sin, &cos); fx_footprint( - playerStatus->position.x + (playerStatus->colliderDiameter * sin * 0.2f), - playerStatus->position.y + 1.5f, - playerStatus->position.z + (playerStatus->colliderDiameter * cos * 0.2f), - -playerStatus->currentYaw, + playerStatus->pos.x + (playerStatus->colliderDiameter * sin * 0.2f), + playerStatus->pos.y + 1.5f, + playerStatus->pos.z + (playerStatus->colliderDiameter * cos * 0.2f), + -playerStatus->curYaw, D_801094A8 ); D_801094A8 = !D_801094A8; @@ -309,12 +309,12 @@ void surface_hedges_behavior(void) { if (D_801094AC++ >= 4) { D_801094AC = 0; - sin_cos_rad(DEG_TO_RAD(clamp_angle(-playerStatus->currentYaw)), &sin, &cos); + sin_cos_rad(DEG_TO_RAD(clamp_angle(-playerStatus->curYaw)), &sin, &cos); fx_falling_leaves( 0, - playerStatus->position.x + (playerStatus->colliderDiameter * sin * 0.2f), + playerStatus->pos.x + (playerStatus->colliderDiameter * sin * 0.2f), 40.0f, - playerStatus->position.z + (playerStatus->colliderDiameter * cos * 0.2f) + playerStatus->pos.z + (playerStatus->colliderDiameter * cos * 0.2f) ); } } @@ -335,12 +335,12 @@ void surface_water_behavior(void) { if (D_801094AE++ >= 4) { D_801094AE = 0; - sin_cos_rad(DEG_TO_RAD(clamp_angle(-playerStatus->currentYaw)), &sin, &cos); + sin_cos_rad(DEG_TO_RAD(clamp_angle(-playerStatus->curYaw)), &sin, &cos); fx_rising_bubble( 0, - playerStatus->position.x + (playerStatus->colliderDiameter * sin * 0.2f), - playerStatus->position.y + 0.0f, - playerStatus->position.z + (playerStatus->colliderDiameter * cos * 0.2f), + playerStatus->pos.x + (playerStatus->colliderDiameter * sin * 0.2f), + playerStatus->pos.y + 0.0f, + playerStatus->pos.z + (playerStatus->colliderDiameter * cos * 0.2f), 0.0f ); } diff --git a/src/8a860_len_3f30.c b/src/8a860_len_3f30.c index a4d2772a41d..e7904d2c033 100644 --- a/src/8a860_len_3f30.c +++ b/src/8a860_len_3f30.c @@ -1140,7 +1140,7 @@ s32 popup_menu_update(void) { case POPUP_STATE_CANCEL_DIP_AWAIT_CHOICE: if (D_8010D6A4 == 1) { set_window_update(WINDOW_ID_21, WINDOW_UPDATE_HIDE); - switch (D_8010D6A0->currentOption) { + switch (D_8010D6A0->curOption) { case 0: gPopupState = POPUP_STATE_CANCEL_DIP_ACCEPT; break; diff --git a/src/9d10_len_1080.c b/src/9d10_len_1080.c index 5b0047f0114..5f2a66c3507 100644 --- a/src/9d10_len_1080.c +++ b/src/9d10_len_1080.c @@ -35,23 +35,23 @@ void update_camera_mode_4(Camera* camera) { } camera->lookAt_obj_target.z = f4; camera->unk_70 = 0.0f; - camera->currentBoomYaw = 0.0f; - camera->trueRotation.x = camera->unk_70; - camera->currentBoomLength = camera->lookAt_dist * D_8009A5EC; - camera->currentYOffset = camera->auxBoomPitch * D_8009A5EC; + camera->curBoomYaw = 0.0f; + camera->trueRot.x = camera->unk_70; + camera->curBoomLength = camera->lookAt_dist * D_8009A5EC; + camera->curYOffset = camera->auxBoomPitch * D_8009A5EC; if (camera->needsInit) { camera->needsInit = FALSE; camera->unk_98 = 0.0f; camera->unk_9C = 0.0f; camera->lookAt_obj.x = camera->lookAt_obj_target.x; - camera->lookAt_obj.y = camera->lookAt_obj_target.y + camera->currentYOffset; + camera->lookAt_obj.y = camera->lookAt_obj_target.y + camera->curYOffset; camera->lookAt_obj.z = camera->lookAt_obj_target.z; - boomYaw = DEG_TO_RAD(camera->currentBoomYaw); + boomYaw = DEG_TO_RAD(camera->curBoomYaw); sinBoom = sin_rad(boomYaw); cosBoom = cos_rad(boomYaw); deltaX = 0.0f; deltaY = 0.0f; - deltaZ = camera->currentBoomLength; + deltaZ = camera->curBoomLength; deltaX2 = deltaX; deltaY2 = deltaY; boomYaw = deltaX = -deltaY2; @@ -71,14 +71,14 @@ void update_camera_mode_4(Camera* camera) { camera->lookAt_eye.z = camera->lookAt_obj.z + deltaZ2; } camera->lookAt_obj.x = camera->lookAt_obj_target.x; - camera->lookAt_obj.y = camera->lookAt_obj_target.y + camera->currentYOffset; + camera->lookAt_obj.y = camera->lookAt_obj_target.y + camera->curYOffset; camera->lookAt_obj.z = camera->lookAt_obj_target.z; - boomYaw = DEG_TO_RAD(camera->currentBoomYaw); + boomYaw = DEG_TO_RAD(camera->curBoomYaw); sinBoom = sin_rad(boomYaw); cosBoom = cos_rad(boomYaw); deltaX = 0.0f; deltaY = 0.0f; - deltaZ = camera->currentBoomLength; + deltaZ = camera->curBoomLength; deltaX2 = deltaX; deltaY2 = deltaY; boomYaw = deltaX = -deltaY2; @@ -96,12 +96,12 @@ void update_camera_mode_4(Camera* camera) { camera->lookAt_eye.x = camera->lookAt_obj.x + deltaX2; camera->lookAt_eye.y = camera->lookAt_obj.y + deltaY2; camera->lookAt_eye.z = camera->lookAt_obj.z + deltaZ2; - camera->currentYaw = atan2(camera->lookAt_eye.x, camera->lookAt_eye.z, camera->lookAt_obj.x, camera->lookAt_obj.z); + camera->curYaw = atan2(camera->lookAt_eye.x, camera->lookAt_eye.z, camera->lookAt_obj.x, camera->lookAt_obj.z); deltaX = camera->lookAt_obj.x - camera->lookAt_eye.x; deltaY = camera->lookAt_obj.y - camera->lookAt_eye.y; deltaZ = camera->lookAt_obj.z - camera->lookAt_eye.z; - camera->currentBlendedYawNegated = -atan2(0.0f, 0.0f, deltaX, deltaZ); - camera->currentPitch = atan2(0.0f, 0.0f, deltaY, -sqrtf(SQ(deltaX) + SQ(deltaZ))); + camera->curBlendedYawNegated = -atan2(0.0f, 0.0f, deltaX, deltaZ); + camera->curPitch = atan2(0.0f, 0.0f, deltaY, -sqrtf(SQ(deltaX) + SQ(deltaZ))); } void update_camera_mode_2(Camera *camera) { @@ -120,26 +120,26 @@ void update_camera_mode_2(Camera *camera) { f32 tmp; camera->unk_70 = camera->auxBoomLength; - camera->currentBoomLength = camera->lookAt_dist * D_8009A5EC; - camera->currentYOffset = camera->auxBoomPitch * D_8009A5EC; - camera->currentBoomYaw = camera->auxPitch; - camera->trueRotation.x = camera->unk_70; + camera->curBoomLength = camera->lookAt_dist * D_8009A5EC; + camera->curYOffset = camera->auxBoomPitch * D_8009A5EC; + camera->curBoomYaw = camera->auxPitch; + camera->trueRot.x = camera->unk_70; if (camera->needsInit) { camera->needsInit = FALSE; camera->unk_98 = 0.0f; camera->unk_9C = 0.0f; camera->lookAt_obj.x = camera->lookAt_obj_target.x; - camera->lookAt_obj.y = camera->lookAt_obj_target.y + camera->currentYOffset; + camera->lookAt_obj.y = camera->lookAt_obj_target.y + camera->curYOffset; camera->lookAt_obj.z = camera->lookAt_obj_target.z; - boomYaw = DEG_TO_RAD(camera->currentBoomYaw); + boomYaw = DEG_TO_RAD(camera->curBoomYaw); sinBoom = sin_rad(boomYaw); cosBoom = cos_rad(boomYaw); deltaX = 0.0f; deltaY = 0.0f; - deltaZ = camera->currentBoomLength; + deltaZ = camera->curBoomLength; deltaX3 = deltaX; deltaY3 = -deltaY; @@ -168,7 +168,7 @@ void update_camera_mode_2(Camera *camera) { } deltaX2 = camera->lookAt_obj_target.x - camera->lookAt_obj.x; - deltaY2 = (camera->lookAt_obj_target.y + camera->currentYOffset) - camera->lookAt_obj.y; + deltaY2 = (camera->lookAt_obj_target.y + camera->curYOffset) - camera->lookAt_obj.y; deltaZ2 = camera->lookAt_obj_target.z - camera->lookAt_obj.z; if (fabsf(deltaX2) > 16.0f) { @@ -197,13 +197,13 @@ void update_camera_mode_2(Camera *camera) { camera->lookAt_obj.y += deltaY2 * 0.5f; camera->lookAt_obj.z += deltaZ2 * 0.5f; - boomYaw = DEG_TO_RAD(camera->currentBoomYaw); + boomYaw = DEG_TO_RAD(camera->curBoomYaw); sinBoom = sin_rad(boomYaw); cosBoom = cos_rad(boomYaw); deltaX = 0.0f; deltaY = 0.0f; - deltaZ = camera->currentBoomLength; + deltaZ = camera->curBoomLength; deltaX3 = deltaX; deltaY3 = -deltaY; @@ -257,14 +257,14 @@ void update_camera_mode_2(Camera *camera) { camera->lookAt_eye.y += deltaY2; camera->lookAt_eye.z += deltaZ2; - camera->currentYaw = atan2(camera->lookAt_eye.x, camera->lookAt_eye.z, camera->lookAt_obj.x, camera->lookAt_obj.z); + camera->curYaw = atan2(camera->lookAt_eye.x, camera->lookAt_eye.z, camera->lookAt_obj.x, camera->lookAt_obj.z); deltaX = camera->lookAt_obj.x - camera->lookAt_eye.x; deltaY = camera->lookAt_obj.y - camera->lookAt_eye.y; deltaZ = camera->lookAt_obj.z - camera->lookAt_eye.z; - camera->currentBlendedYawNegated = -atan2(0.0f, 0.0f, deltaX, deltaZ); - camera->currentPitch = atan2(0.0f, 0.0f, deltaY, -sqrtf(SQ(deltaX) + SQ(deltaZ))); + camera->curBlendedYawNegated = -atan2(0.0f, 0.0f, deltaX, deltaZ); + camera->curPitch = atan2(0.0f, 0.0f, deltaY, -sqrtf(SQ(deltaX) + SQ(deltaZ))); } void update_camera_mode_1(Camera* camera) { @@ -287,24 +287,24 @@ void update_camera_mode_1(Camera* camera) { deltaX2 = camera->targetPos.x; deltaZ = camera->targetPos.z; - camera->currentBoomYaw = camera->auxPitch; - camera->currentBoomLength = camera->lookAt_dist * 100 / D_8009A5EC; - camera->currentYOffset = camera->auxBoomPitch * 20 / D_8009A5EC; + camera->curBoomYaw = camera->auxPitch; + camera->curBoomLength = camera->lookAt_dist * 100 / D_8009A5EC; + camera->curYOffset = camera->auxBoomPitch * 20 / D_8009A5EC; f20 = atan2(deltaX, deltaZ2, deltaX2, deltaZ); if ((dist2D(deltaX, deltaZ2, deltaX2, deltaZ) < camera->auxBoomLength * 100 / D_8009A5EC)) { - f20 = camera->trueRotation.x; - camera->trueRotation.x = f20; + f20 = camera->trueRot.x; + camera->trueRot.x = f20; } else { - camera->trueRotation.x = f20; + camera->trueRot.x = f20; } - camera->trueRotation.y = f20; + camera->trueRot.y = f20; camera->lookAt_obj.x = camera->lookAt_obj_target.x; - camera->lookAt_obj.y = camera->lookAt_obj_target.y + camera->currentYOffset; + camera->lookAt_obj.y = camera->lookAt_obj_target.y + camera->curYOffset; camera->lookAt_obj.z = camera->lookAt_obj_target.z; - boomYaw = DEG_TO_RAD(camera->currentBoomYaw); + boomYaw = DEG_TO_RAD(camera->curBoomYaw); sinBoom = sin_rad(boomYaw); deltaX = 0.0f; @@ -312,7 +312,7 @@ void update_camera_mode_1(Camera* camera) { new_var2 = -deltaY; cosBoom = cos_rad(boomYaw); boomYaw = new_var2; - deltaZ = camera->currentBoomLength; + deltaZ = camera->curBoomLength; deltaX2 = deltaX; deltaY2 = new_var2; @@ -341,11 +341,11 @@ void update_camera_mode_1(Camera* camera) { y3 = tmp1; z3 = camera->lookAt_obj_target.z; - camera->currentBoomYaw = camera->auxPitch; - camera->currentBoomLength = camera->lookAt_dist * 100 / D_8009A5EC; - camera->currentYOffset = camera->auxBoomPitch * 20 / D_8009A5EC; + camera->curBoomYaw = camera->auxPitch; + camera->curBoomLength = camera->lookAt_dist * 100 / D_8009A5EC; + camera->curYOffset = camera->auxBoomPitch * 20 / D_8009A5EC; - y3 += camera->currentYOffset; + y3 += camera->curYOffset; x3 -= camera->lookAt_obj.x; y3 -= camera->lookAt_obj.y; @@ -365,20 +365,20 @@ void update_camera_mode_1(Camera* camera) { f20 = atan2(deltaX, deltaZ2, deltaX2, deltaZ); if ((dist2D(deltaX, deltaZ2, deltaX2, deltaZ) < camera->auxBoomLength * 100 / D_8009A5EC)) { - f20 = camera->trueRotation.x; + f20 = camera->trueRot.x; } else { - camera->trueRotation.x = f20; + camera->trueRot.x = f20; } - camera->trueRotation.y -= get_clamped_angle_diff(f20, camera->trueRotation.y) / 10.0f; - f20 = camera->trueRotation.y; + camera->trueRot.y -= get_clamped_angle_diff(f20, camera->trueRot.y) / 10.0f; + f20 = camera->trueRot.y; - boomYaw = DEG_TO_RAD(camera->currentBoomYaw); + boomYaw = DEG_TO_RAD(camera->curBoomYaw); sinBoom = sin_rad(boomYaw); cosBoom = cos_rad(boomYaw); deltaX = 0.0f; deltaY = 0.0f; - deltaZ = camera->currentBoomLength; + deltaZ = camera->curBoomLength; deltaX2 = deltaX; deltaY2 = -deltaY; @@ -402,14 +402,14 @@ void update_camera_mode_1(Camera* camera) { camera->lookAt_eye.y = camera->lookAt_obj.y + deltaY2; camera->lookAt_eye.z = camera->lookAt_obj.z + deltaZ; - camera->currentYaw = atan2(camera->lookAt_eye.x, camera->lookAt_eye.z, camera->lookAt_obj.x, camera->lookAt_obj.z); + camera->curYaw = atan2(camera->lookAt_eye.x, camera->lookAt_eye.z, camera->lookAt_obj.x, camera->lookAt_obj.z); deltaX = camera->lookAt_obj.x - camera->lookAt_eye.x; deltaY = camera->lookAt_obj.y - camera->lookAt_eye.y; deltaZ2 = camera->lookAt_obj.z - camera->lookAt_eye.z; - camera->currentBlendedYawNegated = -atan2(0.0f, 0.0f, deltaX, deltaZ2); - camera->currentPitch = atan2(0.0f, 0.0f, deltaY, -sqrtf((deltaX * deltaX) + (deltaZ2 * deltaZ2))); + camera->curBlendedYawNegated = -atan2(0.0f, 0.0f, deltaX, deltaZ2); + camera->curPitch = atan2(0.0f, 0.0f, deltaY, -sqrtf((deltaX * deltaX) + (deltaZ2 * deltaZ2))); } void update_camera_mode_0(Camera* camera) { @@ -427,11 +427,11 @@ void update_camera_mode_0(Camera* camera) { camera->lookAt_eye.z = camera->lookAt_obj.z - (1000.0f / D_8009A5EC); } - camera->currentYaw = atan2(camera->lookAt_eye.x, camera->lookAt_eye.z, camera->lookAt_obj.x, camera->lookAt_obj.z); + camera->curYaw = atan2(camera->lookAt_eye.x, camera->lookAt_eye.z, camera->lookAt_obj.x, camera->lookAt_obj.z); dx = camera->lookAt_obj.x - camera->lookAt_eye.x; dy = camera->lookAt_obj.y - camera->lookAt_eye.y; dz = camera->lookAt_obj.z - camera->lookAt_eye.z; - camera->currentBlendedYawNegated = -atan2(0.0f, 0.0f, dx, dz); + camera->curBlendedYawNegated = -atan2(0.0f, 0.0f, dx, dz); dx = -sqrtf(SQ(dx) + SQ(dz)); - camera->currentPitch = atan2(0.0f, 0.0f, dy, dx); + camera->curPitch = atan2(0.0f, 0.0f, dy, dx); } diff --git a/src/B0E0.c b/src/B0E0.c index 10c2dbbdd60..abee907d629 100644 --- a/src/B0E0.c +++ b/src/B0E0.c @@ -36,25 +36,25 @@ void update_camera_mode_unused(Camera* camera) { } if (!(playerStatus->flags & (PS_FLAG_FALLING | PS_FLAG_JUMPING))) { - camera->lookAt_obj_target.y = playerStatus->position.y + 60.0f; + camera->lookAt_obj_target.y = playerStatus->pos.y + 60.0f; } - camera->lookAt_obj_target.x = playerStatus->position.x; - camera->lookAt_obj_target.z = playerStatus->position.z + 400.0f; + camera->lookAt_obj_target.x = playerStatus->pos.x; + camera->lookAt_obj_target.z = playerStatus->pos.z + 400.0f; if (camera->auxPitch == 0) { camera->lookAt_obj.x = camera->lookAt_obj_target.x; camera->lookAt_obj.y = camera->lookAt_obj_target.y; camera->lookAt_obj.z = camera->lookAt_obj_target.z; - camera->trueRotation.x = camera->auxBoomYaw; - camera->currentBoomYaw = camera->auxBoomPitch; - camera->currentBoomLength = camera->auxBoomLength; + camera->trueRot.x = camera->auxBoomYaw; + camera->curBoomYaw = camera->auxBoomPitch; + camera->curBoomLength = camera->auxBoomLength; camera->vfov = (10000 / camera->lookAt_dist) / 4; - boomYaw = DEG_TO_RAD(camera->currentBoomYaw); + boomYaw = DEG_TO_RAD(camera->curBoomYaw); sinBoom = sin_rad(boomYaw); cosBoom = cos_rad(boomYaw); deltaX = 0.0f; deltaY = 0.0f; - deltaZ = camera->currentBoomLength; + deltaZ = camera->curBoomLength; deltaX2 = deltaX; deltaY2 = deltaY; boomYaw = deltaX = -deltaY2; @@ -62,7 +62,7 @@ void update_camera_mode_unused(Camera* camera) { deltaX = deltaX2; deltaY = cosBoom * deltaY2 + deltaZ2 * sinBoom; deltaZ = sinBoom * boomYaw + deltaZ2 * cosBoom; - boomYaw = DEG_TO_RAD(camera->trueRotation.x); + boomYaw = DEG_TO_RAD(camera->trueRot.x); sinBoom = sin_rad(boomYaw); cosBoom = cos_rad(boomYaw); deltaZ2 = cosBoom * deltaX - deltaZ * sinBoom; @@ -73,12 +73,12 @@ void update_camera_mode_unused(Camera* camera) { camera->lookAt_eye.y = camera->lookAt_obj.y + deltaY2; camera->lookAt_eye.z = camera->lookAt_obj.z + deltaZ2; } - camera->currentYaw = atan2(camera->lookAt_eye.x, camera->lookAt_eye.z, camera->lookAt_obj.x, camera->lookAt_obj.z); + camera->curYaw = atan2(camera->lookAt_eye.x, camera->lookAt_eye.z, camera->lookAt_obj.x, camera->lookAt_obj.z); deltaX = camera->lookAt_obj.x - camera->lookAt_eye.x; deltaY = camera->lookAt_obj.y - camera->lookAt_eye.y; deltaZ = camera->lookAt_obj.z - camera->lookAt_eye.z; - camera->currentBlendedYawNegated = -atan2(0.0f, 0.0f, deltaX, deltaZ); - camera->currentPitch = atan2(0.0f, 0.0f, deltaY, -sqrtf(SQ(deltaX) + SQ(deltaZ))); + camera->curBlendedYawNegated = -atan2(0.0f, 0.0f, deltaX, deltaZ); + camera->curPitch = atan2(0.0f, 0.0f, deltaY, -sqrtf(SQ(deltaX) + SQ(deltaZ))); } //TODO CODE SPLIT? @@ -87,26 +87,26 @@ void update_camera_mode_5(Camera* camera) { PlayerStatus* playerStatus = &gPlayerStatus; f32 lookXDelta, lookYDelta, lookZDelta; - camera->currentBoomYaw = 18.0f; - camera->currentBoomLength = 690.0f; - camera->currentYOffset = 47.0f; + camera->curBoomYaw = 18.0f; + camera->curBoomLength = 690.0f; + camera->curYOffset = 47.0f; if (camera->needsInit) { camera->unk_550 = 0.0f; camera->unk_70 = 0.0f; - camera->trueRotation.x = 0.0f; + camera->trueRot.x = 0.0f; camera->needsInit = FALSE; camera->unk_554 = 0; camera->lookAt_obj.x = camera->targetPos.x; - camera->lookAt_obj.y = camera->targetPos.y + camera->currentYOffset; + camera->lookAt_obj.y = camera->targetPos.y + camera->curYOffset; camera->lookAt_obj.z = camera->targetPos.z; cam_interp_lookat_pos(camera, 0.0f, 0.0f, FALSE); } else { - f32 maxInterpSpeed = (playerStatus->currentSpeed * 1.5f) + 1.0f; - f32 interpRate = (playerStatus->currentSpeed * 0.05f) + 0.05f; + f32 maxInterpSpeed = (playerStatus->curSpeed * 1.5f) + 1.0f; + f32 interpRate = (playerStatus->curSpeed * 0.05f) + 0.05f; camera->lookAt_obj_target.x = camera->targetPos.x + camera->unk_550; - camera->lookAt_obj_target.y = camera->targetPos.y + camera->currentYOffset; + camera->lookAt_obj_target.y = camera->targetPos.y + camera->curYOffset; camera->lookAt_obj_target.z = camera->targetPos.z; func_8003034C(camera); if (!(camera->moveFlags & CAMERA_MOVE_IGNORE_PLAYER_Y)) { @@ -118,12 +118,12 @@ void update_camera_mode_5(Camera* camera) { } } - camera->currentYaw = atan2(camera->lookAt_eye.x, camera->lookAt_eye.z, camera->lookAt_obj.x, camera->lookAt_obj.z); + camera->curYaw = atan2(camera->lookAt_eye.x, camera->lookAt_eye.z, camera->lookAt_obj.x, camera->lookAt_obj.z); lookXDelta = camera->lookAt_obj.x - camera->lookAt_eye.x; lookYDelta = camera->lookAt_obj.y - camera->lookAt_eye.y; lookZDelta = camera->lookAt_obj.z - camera->lookAt_eye.z; - camera->currentBlendedYawNegated = -atan2(0.0f, 0.0f, lookXDelta, lookZDelta); - camera->currentPitch = atan2(0.0f, 0.0f, lookYDelta, -sqrtf(SQ(lookXDelta) + SQ(lookZDelta))); + camera->curBlendedYawNegated = -atan2(0.0f, 0.0f, lookXDelta, lookZDelta); + camera->curPitch = atan2(0.0f, 0.0f, lookYDelta, -sqrtf(SQ(lookXDelta) + SQ(lookZDelta))); } void cam_interp_lookat_pos(Camera* camera, f32 interpAmtXZ, f32 maxDeltaXZ, s16 lockPosY) { @@ -141,22 +141,22 @@ void cam_interp_lookat_pos(Camera* camera, f32 interpAmtXZ, f32 maxDeltaXZ, s16 camera->lookAt_obj.x = camera->lookAt_eye.x = camera->lookAt_obj.x + xDelta; - theta = DEG_TO_RAD(camera->currentBoomYaw); - cosTheta = cos_rad(DEG_TO_RAD(camera->currentBoomYaw)); + theta = DEG_TO_RAD(camera->curBoomYaw); + cosTheta = cos_rad(DEG_TO_RAD(camera->curBoomYaw)); camera->lookAt_obj.z += (camera->lookAt_obj_target.z - camera->lookAt_obj.z) * interpAmtXZ; - camera->lookAt_eye.z = camera->lookAt_obj.z + (camera->currentBoomLength * cosTheta); + camera->lookAt_eye.z = camera->lookAt_obj.z + (camera->curBoomLength * cosTheta); if (!lockPosY) { sinTheta = sin_rad(theta); camera->lookAt_obj.y += (camera->lookAt_obj_target.y - camera->lookAt_obj.y) * 0.125f; - camera->lookAt_eye.y = camera->lookAt_obj.y + (camera->currentBoomLength * sinTheta); + camera->lookAt_eye.y = camera->lookAt_obj.y + (camera->curBoomLength * sinTheta); } } void func_8003034C(Camera* camera) { PlayerStatus* playerStatus = &gPlayerStatus; - if (fabsf(get_clamped_angle_diff(playerStatus->currentYaw, 90.0f)) < 45.0f) { + if (fabsf(get_clamped_angle_diff(playerStatus->curYaw, 90.0f)) < 45.0f) { if (camera->unk_556 == 0) { if (camera->unk_554 <= 0) { camera->unk_550 = 35.0f; @@ -167,7 +167,7 @@ void func_8003034C(Camera* camera) { camera->unk_554 = 15; camera->unk_556 = 0; } - } else if (fabsf(get_clamped_angle_diff(playerStatus->currentYaw, 270.0f)) < 45.0f) { + } else if (fabsf(get_clamped_angle_diff(playerStatus->curYaw, 270.0f)) < 45.0f) { if (camera->unk_556 == 1) { if (camera->unk_554 <= 0) { camera->unk_550 = -35.0f; @@ -789,7 +789,7 @@ void update_camera_zone_interp(Camera* camera) { changingZone = FALSE; if (camera->isChangingMap) { - camera->currentController = NULL; + camera->curController = NULL; camera->prevController = NULL; camera->linearInterp = 0.0f; camera->unk_494 = 0.0f; @@ -854,7 +854,7 @@ void update_camera_zone_interp(Camera* camera) { cond2 = FALSE; cs2 = cs; - currentController = camera->currentController; + currentController = camera->curController; if (cs != NULL && currentController != NULL && cs->type == currentController->type @@ -909,13 +909,13 @@ void update_camera_zone_interp(Camera* camera) { if (camera->panActive || (!cond2 && cs2 != currentController)) { if (camera->interpAlpha == 1.0f) { - camera->prevController = camera->currentController; + camera->prevController = camera->curController; } else { camera->prevController = (CameraControlSettings*) CAMERA_SETTINGS_PTR_MINUS_1; } changingZone = TRUE; camera->prevConfiguration = gCurrentCamConfiguration; - camera->currentController = cs; + camera->curController = cs; camera->interpAlpha = 0.0f; camera->linearInterp = 0.0f; camera->panActive = FALSE; @@ -953,7 +953,7 @@ void update_camera_zone_interp(Camera* camera) { } update_camera_from_controller(camera, &camera->prevConfiguration, &camera->prevController, - &camera->goalConfiguration, &camera->currentController, posX, posY, posZ, tX, tY, tZ, + &camera->goalConfiguration, &camera->curController, posX, posY, posZ, tX, tY, tZ, camera->isChangingMap, &camera->interpAlpha, changingZone); if (camera->isChangingMap) { @@ -1098,13 +1098,13 @@ void update_camera_zone_interp(Camera* camera) { temp_f4_4 = (dist * cosAngle) - (temp_f8_2 * sinAngle); camera->lookAt_obj.x = camera->lookAt_eye.x + (temp_f26 * temp_f4_4); camera->lookAt_obj.z = camera->lookAt_eye.z + (temp_f24_2 * temp_f4_4); - camera->currentYaw = gCurrentCamConfiguration.boomYaw + D_800A08E0; - camera->trueRotation.x = camera->currentYaw; - camera->currentBoomLength = gCurrentCamConfiguration.boomLength; - camera->currentBlendedYawNegated = -gCurrentCamConfiguration.boomYaw; - camera->currentPitch = -gCurrentCamConfiguration.boomPitch - gCurrentCamConfiguration.viewPitch; + camera->curYaw = gCurrentCamConfiguration.boomYaw + D_800A08E0; + camera->trueRot.x = camera->curYaw; + camera->curBoomLength = gCurrentCamConfiguration.boomLength; + camera->curBlendedYawNegated = -gCurrentCamConfiguration.boomYaw; + camera->curPitch = -gCurrentCamConfiguration.boomPitch - gCurrentCamConfiguration.viewPitch; camera->lookAt_obj_target.x = camera->lookAt_obj.x; camera->lookAt_obj_target.y = camera->lookAt_obj.y; camera->lookAt_obj_target.z = camera->lookAt_obj.z; - camera->currentYOffset = 0.0f; + camera->curYOffset = 0.0f; } diff --git a/src/B4580.c b/src/B4580.c index fdfaad65b90..fa30682ae46 100644 --- a/src/B4580.c +++ b/src/B4580.c @@ -373,9 +373,9 @@ AnimatorNode* add_anim_node(ModelAnimator* animator, s32 parentNodeID, AnimatorN ret->pos.x = 0.0f; ret->pos.y = 0.0f; ret->pos.z = 0.0f; - ret->rotation.x = nodeBP->rotation.x; - ret->rotation.y = nodeBP->rotation.y; - ret->rotation.z = nodeBP->rotation.z; + ret->rot.x = nodeBP->rot.x; + ret->rot.y = nodeBP->rot.y; + ret->rot.z = nodeBP->rot.z; ret->scale.x = 1.0f; ret->scale.y = 1.0f; ret->scale.z = 1.0f; @@ -595,9 +595,9 @@ s32 step_model_animator(ModelAnimator* animator) { node = get_animator_child_with_id(animator->rootNode, nodeId); ASSERT(node != NULL); - node->rotation.x = x; - node->rotation.y = y; - node->rotation.z = z; + node->rot.x = x; + node->rot.y = y; + node->rot.z = z; return 1; case AS_ADD_ROTATION: nodeId = animator->staticNodeIDs[*args++ - 1]; @@ -608,9 +608,9 @@ s32 step_model_animator(ModelAnimator* animator) { node = get_animator_child_with_id(animator->rootNode, nodeId); ASSERT(node != NULL); - node->rotation.x += x; - node->rotation.y += y; - node->rotation.z += z; + node->rot.x += x; + node->rot.y += y; + node->rot.z += z; return 1; case AS_SET_POS: nodeId = animator->staticNodeIDs[*args++ - 1]; @@ -668,7 +668,7 @@ void animator_node_update_model_transform(ModelAnimator* animator, f32 (*flipMtx Matrix4f sp10; s32 i; - guRotateRPYF(gAnimRotMtx, clamp_angle(node->rotation.x), clamp_angle(node->rotation.y), clamp_angle(node->rotation.z)); + guRotateRPYF(gAnimRotMtx, clamp_angle(node->rot.x), clamp_angle(node->rot.y), clamp_angle(node->rot.z)); guScaleF(gAnimScaleMtx, node->scale.x, node->scale.y, node->scale.z); guTranslateF(gAnimTranslateMtx, node->basePos.x + node->pos.x, node->basePos.y + node->pos.y, node->basePos.z + node->pos.z); guMtxCatF(gAnimScaleMtx, gAnimRotMtx, gAnimRotScaleMtx); @@ -712,7 +712,7 @@ void render_animated_model(s32 animatorID, Mtx* rootTransform) { animator->baseAddr = NULL; rtPtr->appendGfxArg = animator; rtPtr->appendGfx = (void (*)(void*))appendGfx_animator; - rtPtr->distance = 0; + rtPtr->dist = 0; rtPtr->renderMode = animator->renderMode; queue_render_task(rtPtr); } @@ -736,7 +736,7 @@ void render_animated_model_with_vertices(s32 animatorID, Mtx* rootTransform, s32 animator->baseAddr = baseAddr; rtPtr->appendGfxArg = animator; rtPtr->appendGfx = (void (*)(void*))appendGfx_animator; - rtPtr->distance = 0; + rtPtr->dist = 0; rtPtr->renderMode = animator->renderMode; queue_render_task(rtPtr); } @@ -1060,9 +1060,9 @@ void load_model_animator_node(StaticAnimatorNode* node, ModelAnimator* animator, bpPtr->basePos.x = 0.0f; bpPtr->basePos.y = 0.0f; bpPtr->basePos.z = 0.0f; - bpPtr->rotation.x = ((f32) node->rot.x * 180.0) / 32767.0; - bpPtr->rotation.y = ((f32) node->rot.y * 180.0) / 32767.0; - bpPtr->rotation.z = ((f32) node->rot.z * 180.0) / 32767.0; + bpPtr->rot.x = ((f32) node->rot.x * 180.0) / 32767.0; + bpPtr->rot.y = ((f32) node->rot.y * 180.0) / 32767.0; + bpPtr->rot.z = ((f32) node->rot.z * 180.0) / 32767.0; newNode = add_anim_node(animator, parentNodeID, bpPtr); @@ -1150,9 +1150,9 @@ void reload_mesh_animator_node(StaticAnimatorNode* node, ModelAnimator* animator bpPtr->basePos.x = 0.0f; bpPtr->basePos.y = 0.0f; bpPtr->basePos.z = 0.0f; - bpPtr->rotation.x = ((f32) node->rot.x * 180.0) / 32767.0; - bpPtr->rotation.y = ((f32) node->rot.y * 180.0) / 32767.0; - bpPtr->rotation.z = ((f32) node->rot.z * 180.0) / 32767.0; + bpPtr->rot.x = ((f32) node->rot.x * 180.0) / 32767.0; + bpPtr->rot.y = ((f32) node->rot.y * 180.0) / 32767.0; + bpPtr->rot.z = ((f32) node->rot.z * 180.0) / 32767.0; newNode = add_anim_node(animator, parentNodeID, bpPtr); newNode->vertexStartOffset = node->vertexStartOffset; @@ -1249,9 +1249,9 @@ s32 step_mesh_animator(ModelAnimator* animator) { if (nodeId != 0xFF) { node = get_animator_child_with_id(animator->rootNode, nodeId); if (node != NULL) { - node->rotation.x = x; - node->rotation.y = y; - node->rotation.z = z; + node->rot.x = x; + node->rot.y = y; + node->rot.z = z; return 1; } else { animator->animReadPos = oldPos; @@ -1269,9 +1269,9 @@ s32 step_mesh_animator(ModelAnimator* animator) { if (nodeId != 0xFF) { node = get_animator_child_with_id(animator->rootNode, nodeId); if (node != NULL) { - node->rotation.x += x; - node->rotation.y += y; - node->rotation.z += z; + node->rot.x += x; + node->rot.y += y; + node->rot.z += z; return 1; } else { animator->animReadPos = oldPos; diff --git a/src/C50A0.c b/src/C50A0.c index 727fc512456..537e71e09ac 100644 --- a/src/C50A0.c +++ b/src/C50A0.c @@ -664,10 +664,10 @@ void draw_coin_sparkles(ItemEntity* item) { x = D_80155D8C; y = D_80155D8E; z = D_80155D90; - angle = clamp_angle(180.0f - gCameras[gCurrentCamID].currentYaw); + angle = clamp_angle(180.0f - gCameras[gCurrentCamID].curYaw); guTranslateF(sp18, x, y, z); - guTranslateF(sp58, item->position.x, item->position.y + 12.0f, item->position.z); + guTranslateF(sp58, item->pos.x, item->pos.y + 12.0f, item->pos.z); guRotateF(sp98, angle, 0.0f, 1.0f, 0.0f); guMtxCatF(sp18, sp98, sp98); guMtxCatF(sp98, sp58, spD8); @@ -922,9 +922,9 @@ s32 make_item_entity(s32 itemID, f32 x, f32 y, f32 z, s32 itemSpawnMode, s32 pic item->spawnType = itemSpawnMode; item->state = ITEM_PHYSICS_STATE_INIT; - item->position.x = x; - item->position.y = y; - item->position.z = z; + item->pos.x = x; + item->pos.y = y; + item->pos.z = z; itemID &= 0xFFFF; @@ -1119,24 +1119,24 @@ s32 make_item_entity(s32 itemID, f32 x, f32 y, f32 z, s32 itemSpawnMode, s32 pic case ITEM_SPAWN_MODE_FALL_SPAWN_ALWAYS: case ITEM_SPAWN_MODE_FIXED_SPAWN_ALWAYS: case ITEM_SPAWN_MODE_ITEM_BLOCK_SPAWN_ALWAYS: - item->shadowIndex = create_shadow_type(0, item->position.x, item->position.y, item->position.z); + item->shadowIndex = create_shadow_type(0, item->pos.x, item->pos.y, item->pos.z); shadow = get_shadow_by_index(item->shadowIndex); if (item->spawnType == ITEM_SPAWN_MODE_ITEM_BLOCK_SPAWN_ALWAYS) { shadow->flags |= ENTITY_FLAG_HIDDEN; } - x = item->position.x; - y = item->position.y + 12.0f; - z = item->position.z; + x = item->pos.x; + y = item->pos.y + 12.0f; + z = item->pos.z; hitDepth = 1000.0f; npc_raycast_down_sides(COLLISION_CHANNEL_20000, &x, &y, &z, &hitDepth); - shadow->position.x = x; - shadow->position.y = y; - shadow->position.z = z; - shadow->rotation.x = gGameStatusPtr->playerGroundTraceAngles.x; - shadow->rotation.y = 0.0f; - shadow->rotation.z = gGameStatusPtr->playerGroundTraceAngles.z; + shadow->pos.x = x; + shadow->pos.y = y; + shadow->pos.z = z; + shadow->rot.x = gGameStatusPtr->playerGroundTraceAngles.x; + shadow->rot.y = 0.0f; + shadow->rot.z = gGameStatusPtr->playerGroundTraceAngles.z; set_standard_shadow_scale(shadow, hitDepth * 0.5f); break; } @@ -1200,9 +1200,9 @@ s32 make_item_entity_at_player(s32 itemID, s32 category, s32 pickupMsgFlags) { item->spawnType = ITEM_SPAWN_AT_PLAYER; item->state = ITEM_PICKUP_STATE_INIT; item->boundVar = 0; - item->position.x = playerStatus->position.x; - item->position.y = playerStatus->position.y; - item->position.z = playerStatus->position.z; + item->pos.x = playerStatus->pos.x; + item->pos.y = playerStatus->pos.y; + item->pos.z = playerStatus->pos.z; item->shadowIndex = -1; item->nextUpdate = 1; @@ -1224,22 +1224,22 @@ s32 make_item_entity_at_player(s32 itemID, s32 category, s32 pickupMsgFlags) { } ItemEntityAlternatingSpawn = 1 - ItemEntityAlternatingSpawn; - item->shadowIndex = create_shadow_type(0, item->position.x, item->position.y, item->position.z); + item->shadowIndex = create_shadow_type(0, item->pos.x, item->pos.y, item->pos.z); shadow = get_shadow_by_index(item->shadowIndex); shadow->flags |= ENTITY_FLAG_HIDDEN; - posX = item->position.x; - posY = item->position.y + 12.0f; - posZ = item->position.z; + posX = item->pos.x; + posY = item->pos.y + 12.0f; + posZ = item->pos.z; depth = 1000.0f; npc_raycast_down_sides(COLLISION_CHANNEL_20000, &posX, &posY, &posZ, &depth); - shadow->position.x = posX; - shadow->position.y = posY; - shadow->position.z = posZ; + shadow->pos.x = posX; + shadow->pos.y = posY; + shadow->pos.z = posZ; - shadow->rotation.x = gGameStatusPtr->playerGroundTraceAngles.x; - shadow->rotation.y = 0.0f; - shadow->rotation.z = gGameStatusPtr->playerGroundTraceAngles.z; + shadow->rot.x = gGameStatusPtr->playerGroundTraceAngles.x; + shadow->rot.y = 0.0f; + shadow->rot.z = gGameStatusPtr->playerGroundTraceAngles.z; set_standard_shadow_scale(shadow, depth * 0.5f); item_entity_load(item); @@ -1350,32 +1350,32 @@ void update_item_entities(void) { case ITEM_SPAWN_MODE_FALL_SPAWN_ALWAYS: case ITEM_SPAWN_MODE_FIXED_SPAWN_ALWAYS: case ITEM_SPAWN_AT_PLAYER: - xs = item->position.x; - ys = item->position.y; - zs = item->position.z; + xs = item->pos.x; + ys = item->pos.y; + zs = item->pos.z; if (xs != item->lastPos.x || ys != item->lastPos.y || zs != item->lastPos.z) { Shadow* shadow = get_shadow_by_index(item->shadowIndex); - x = item->position.x; - y = item->position.y + 12.0f; - z = item->position.z; + x = item->pos.x; + y = item->pos.y + 12.0f; + z = item->pos.z; hitDepth = 1000.0f; npc_raycast_down_sides(COLLISION_CHANNEL_20000, &x, &y, &z, &hitDepth); - shadow->position.x = x; - shadow->position.y = y; - shadow->position.z = z; - shadow->rotation.x = gGameStatusPtr->playerGroundTraceAngles.x; - shadow->rotation.y = 0.0f; - shadow->rotation.z = gGameStatusPtr->playerGroundTraceAngles.z; + shadow->pos.x = x; + shadow->pos.y = y; + shadow->pos.z = z; + shadow->rot.x = gGameStatusPtr->playerGroundTraceAngles.x; + shadow->rot.y = 0.0f; + shadow->rot.z = gGameStatusPtr->playerGroundTraceAngles.z; set_standard_shadow_scale(shadow, hitDepth * 0.5f); } break; } - item->lastPos.x = item->position.x; - item->lastPos.y = item->position.y; - item->lastPos.z = item->position.z; + item->lastPos.x = item->pos.x; + item->lastPos.y = item->pos.y; + item->lastPos.z = item->pos.z; } } do {} while (0); // required to match @@ -1414,8 +1414,8 @@ void appendGfx_item_entity(void* data) { item->scale = 1.0f; } - rot = clamp_angle(180.0f - gCameras[gCurrentCamID].currentYaw); - guTranslateF(mtxTranslate, item->position.x, item->position.y + yOffset, item->position.z); + rot = clamp_angle(180.0f - gCameras[gCurrentCamID].curYaw); + guTranslateF(mtxTranslate, item->pos.x, item->pos.y + yOffset, item->pos.z); guRotateF(mtxRotY, rot, 0.0f, 1.0f, 0.0f); if (item->flags & ITEM_ENTITY_RESIZABLE) { guScaleF(mtxScale, item->scale, item->scale, item->scale); @@ -1554,7 +1554,7 @@ void draw_item_entities(void) { rtPtr->appendGfxArg = item; rtPtr->appendGfx = appendGfx_item_entity; - rtPtr->distance = 0; + rtPtr->dist = 0; retTask = queue_render_task(rtPtr); retTask->renderMode |= RENDER_TASK_FLAG_REFLECT_FLOOR; @@ -1624,8 +1624,8 @@ void render_item_entities(void) { item->scale = 1.0f; } - rotX = clamp_angle(180.0f - gCameras[gCurrentCamID].currentYaw); - guTranslateF(sp58, item->position.x, -item->position.y - offsetY, item->position.z); + rotX = clamp_angle(180.0f - gCameras[gCurrentCamID].curYaw); + guTranslateF(sp58, item->pos.x, -item->pos.y - offsetY, item->pos.z); guRotateF(sp98, rotX, 0.0f, 1.0f, 0.0f); if (item->flags & ITEM_ENTITY_RESIZABLE) { guScaleF(spD8, item->scale, item->scale, item->scale); @@ -1879,28 +1879,28 @@ b32 test_item_player_collision(ItemEntity* item) { cond = FALSE; colliderHeightHalf = playerStatus->colliderHeight / 2; - playerX = playerStatus->position.x; - playerY = playerStatus->position.y; - playerZ = playerStatus->position.z; + playerX = playerStatus->pos.x; + playerY = playerStatus->pos.y; + playerZ = playerStatus->pos.z; colliderDiameterQuart = playerStatus->colliderDiameter / 4; spriteFacingAngle = playerStatus->spriteFacingAngle; if (spriteFacingAngle < 180.0f) { - spriteFacingAngle = clamp_angle(camera->currentYaw - 90.0f); + spriteFacingAngle = clamp_angle(camera->curYaw - 90.0f); } else { - spriteFacingAngle = clamp_angle(camera->currentYaw + 90.0f); + spriteFacingAngle = clamp_angle(camera->curYaw + 90.0f); } tmpX = playerX; playerY2 = playerY; tmpZ = playerZ; - if (get_clamped_angle_diff(camera->currentYaw, spriteFacingAngle) < 0.0f) { - angle = clamp_angle(camera->currentYaw - 90.0f); + if (get_clamped_angle_diff(camera->curYaw, spriteFacingAngle) < 0.0f) { + angle = clamp_angle(camera->curYaw - 90.0f); if (playerStatus->trueAnimation & 0x01000000) { angle = clamp_angle(angle + 30.0f); } } else { - angle = clamp_angle(camera->currentYaw + 90.0f); + angle = clamp_angle(camera->curYaw + 90.0f); if (playerStatus->trueAnimation & 0x01000000) { angle = clamp_angle(angle - 30.0f); } @@ -1908,9 +1908,9 @@ b32 test_item_player_collision(ItemEntity* item) { add_vec2D_polar(&tmpX, &tmpZ, 24.0f, angle); - itemX = item->position.x; - itemY = item->position.y; - itemZ = item->position.z; + itemX = item->pos.x; + itemY = item->pos.y; + itemZ = item->pos.z; do { do { @@ -1997,9 +1997,9 @@ s32 test_item_entity_position(f32 x, f32 y, f32 z, f32 dist) { continue; } - dx = item->position.x - x; - dz = item->position.y - y; - dy = item->position.z - z; + dx = item->pos.x - x; + dz = item->pos.y - y; + dy = item->pos.z - z; if (sqrtf(SQ(dx) + SQ(dz) + SQ(dy)) < dist) { return i; } @@ -2041,9 +2041,9 @@ b32 is_picking_up_item(void) { void set_item_entity_position(s32 itemEntityIndex, f32 x, f32 y, f32 z) { ItemEntity* item = gCurrentItemEntities[itemEntityIndex]; - item->position.x = x; - item->position.y = y; - item->position.z = z; + item->pos.x = x; + item->pos.y = y; + item->pos.z = z; } void set_current_item_entity_render_group(s32 group) { @@ -2087,71 +2087,71 @@ void update_item_entity_collectable(ItemEntity* item) { ASSERT(physData != NULL); if (item->flags & ITEM_ENTITY_FLAG_TOSS_HIGHER) { - physData->verticalVelocity = 16.0f; + physData->verticalVel = 16.0f; physData->gravity = 2.0f; } else if (!(item->flags & ITEM_ENTITY_FLAG_TOSS_LOWER)) { - physData->verticalVelocity = 12.0f; + physData->verticalVel = 12.0f; physData->gravity = 2.0f; } else { - physData->verticalVelocity = 14.0f; + physData->verticalVel = 14.0f; physData->gravity = 2.0f; } physData->collisionRadius = 24.0f; - physData->constVelocity = 24.0f; + physData->constVel = 24.0f; if (item->spawnAngle < 0) { if (IS_ITEM(item->itemID)) { if (rand_int(10000) < 5000) { - physData->moveAngle = clamp_angle(gCameras[camID].currentYaw + 105.0f + rand_int(30) - 15.0f); + physData->moveAngle = clamp_angle(gCameras[camID].curYaw + 105.0f + rand_int(30) - 15.0f); } else { - physData->moveAngle = clamp_angle(gCameras[camID].currentYaw - 105.0f + rand_int(30) - 15.0f); + physData->moveAngle = clamp_angle(gCameras[camID].curYaw - 105.0f + rand_int(30) - 15.0f); } - physData->verticalVelocity += 4.0f; + physData->verticalVel += 4.0f; } else { switch (item->itemID) { case ITEM_HEART: - physData->moveAngle = clamp_angle(gCameras[camID].currentYaw + 90.0f + rand_int(120) - 60.0f); + physData->moveAngle = clamp_angle(gCameras[camID].curYaw + 90.0f + rand_int(120) - 60.0f); break; case ITEM_FLOWER_POINT: - physData->moveAngle = clamp_angle(gCameras[camID].currentYaw - 90.0f + rand_int(120) + 60.0f); + physData->moveAngle = clamp_angle(gCameras[camID].curYaw - 90.0f + rand_int(120) + 60.0f); break; case ITEM_COIN: if (rand_int(10000) < 5000) { - physData->moveAngle = clamp_angle(gCameras[camID].currentYaw + 90.0f + rand_int(120) - 60.0f); + physData->moveAngle = clamp_angle(gCameras[camID].curYaw + 90.0f + rand_int(120) - 60.0f); } else { - physData->moveAngle = clamp_angle(gCameras[camID].currentYaw - 90.0f + rand_int(120) - 60.0f); + physData->moveAngle = clamp_angle(gCameras[camID].curYaw - 90.0f + rand_int(120) - 60.0f); } break; case ITEM_KOOPA_FORTRESS_KEY: if (rand_int(10000) >= 5000) { - physData->moveAngle = clamp_angle(gCameras[camID].currentYaw - 90.0f + rand_int(120) - 60.0f); + physData->moveAngle = clamp_angle(gCameras[camID].curYaw - 90.0f + rand_int(120) - 60.0f); } else { - physData->moveAngle = clamp_angle(gCameras[camID].currentYaw + 90.0f + rand_int(120) - 60.0f); + physData->moveAngle = clamp_angle(gCameras[camID].curYaw + 90.0f + rand_int(120) - 60.0f); } break; case ITEM_STAR_POINT: if (item->spawnType != ITEM_SPAWN_MODE_TOSS_FADE1) { - physData->moveAngle = clamp_angle(gCameras[camID].currentYaw - 90.0f + rand_int(120) - 60.0f); + physData->moveAngle = clamp_angle(gCameras[camID].curYaw - 90.0f + rand_int(120) - 60.0f); break; } if (rand_int(10000) < 5000) { - physData->moveAngle = clamp_angle(gCameras[camID].currentYaw + 90.0f + rand_int(60) - 30.0f); + physData->moveAngle = clamp_angle(gCameras[camID].curYaw + 90.0f + rand_int(60) - 30.0f); } else { - physData->moveAngle = clamp_angle(gCameras[camID].currentYaw - 90.0f + rand_int(60) - 30.0f); + physData->moveAngle = clamp_angle(gCameras[camID].curYaw - 90.0f + rand_int(60) - 30.0f); } break; case ITEM_HEART_POINT: - physData->moveAngle = clamp_angle(gCameras[camID].currentYaw + 90.0f + rand_int(120) - 60.0f); + physData->moveAngle = clamp_angle(gCameras[camID].curYaw + 90.0f + rand_int(120) - 60.0f); break; case ITEM_STAR_PIECE: if (rand_int(10000) < 5000) { - physData->moveAngle = clamp_angle(gCameras[camID].currentYaw + 90.0f + rand_int(60) - 30.0f); + physData->moveAngle = clamp_angle(gCameras[camID].curYaw + 90.0f + rand_int(60) - 30.0f); } else { - physData->moveAngle = clamp_angle(gCameras[camID].currentYaw - 90.0f + rand_int(60) - 30.0f); + physData->moveAngle = clamp_angle(gCameras[camID].curYaw - 90.0f + rand_int(60) - 30.0f); } break; case ITEM_HEART_PIECE: - physData->moveAngle = clamp_angle(gCameras[camID].currentYaw + 90.0f + rand_int(120) - 60.0f); + physData->moveAngle = clamp_angle(gCameras[camID].curYaw + 90.0f + rand_int(120) - 60.0f); break; default: physData->moveAngle = 0.0f; @@ -2165,16 +2165,16 @@ void update_item_entity_collectable(ItemEntity* item) { theta = DEG_TO_RAD(physData->moveAngle); sinAngle = sin_rad(theta); cosAngle = cos_rad(theta); - physData->velx = temp * sinAngle; - physData->velz = -temp * cosAngle; + physData->velX = temp * sinAngle; + physData->velZ = -temp * cosAngle; } else { temp = rand_int(2000); temp = (temp / 1000.0f) + 2.0; theta = DEG_TO_RAD(physData->moveAngle); sinAngle = sin_rad(theta); cosAngle = cos_rad(theta); - physData->velx = temp * sinAngle; - physData->velz = -temp * cosAngle; + physData->velX = temp * sinAngle; + physData->velZ = -temp * cosAngle; } } else { physData->moveAngle = clamp_angle(item->spawnAngle); @@ -2186,8 +2186,8 @@ void update_item_entity_collectable(ItemEntity* item) { theta = DEG_TO_RAD(physData->moveAngle); sinAngle = sin_rad(theta); cosAngle = cos_rad(theta); - physData->velx = temp * sinAngle; - physData->velz = -temp * cosAngle; + physData->velX = temp * sinAngle; + physData->velZ = -temp * cosAngle; } if (item->spawnType != ITEM_SPAWN_MODE_TOSS_FADE1) { @@ -2200,28 +2200,28 @@ void update_item_entity_collectable(ItemEntity* item) { physData->timeLeft = 20; } physData->useSimplePhysics = FALSE; - physData->verticalVelocity = 15.0f; + physData->verticalVel = 15.0f; physData->gravity = 1.6f; } if (item->spawnType == ITEM_SPAWN_MODE_ITEM_BLOCK_SPAWN_ALWAYS) { physData->timeLeft = 60; physData->useSimplePhysics = FALSE; - physData->velx = 0.0f; - physData->velz = 0.0f; + physData->velX = 0.0f; + physData->velZ = 0.0f; } if (item->spawnType == ITEM_SPAWN_MODE_FALL_SPAWN_ALWAYS) { - physData->verticalVelocity = 0.0f; - physData->velx = 0.0f; - physData->velz = 0.0f; + physData->verticalVel = 0.0f; + physData->velX = 0.0f; + physData->velZ = 0.0f; physData->useSimplePhysics = TRUE; } if (item->spawnType == ITEM_SPAWN_MODE_FIXED_SPAWN_ALWAYS) { - physData->verticalVelocity = 0.0f; - physData->velx = 0.0f; - physData->velz = 0.0f; + physData->verticalVel = 0.0f; + physData->velX = 0.0f; + physData->velZ = 0.0f; physData->useSimplePhysics = TRUE; } @@ -2259,19 +2259,19 @@ void update_item_entity_collectable(ItemEntity* item) { // apply gravity if (!(item->flags & ITEM_ENTITY_FLAG_NO_GRAVITY)) { if (!(item->flags & ITEM_ENTITY_FLAG_CANT_COLLECT)) { - physData->verticalVelocity -= physData->gravity; - if (physData->verticalVelocity < -16.0) { - physData->verticalVelocity = -16.0f; + physData->verticalVel -= physData->gravity; + if (physData->verticalVel < -16.0) { + physData->verticalVel = -16.0f; } - item->position.y += physData->verticalVelocity; - item->position.x += physData->velx; - item->position.z += physData->velz; + item->pos.y += physData->verticalVel; + item->pos.x += physData->velX; + item->pos.z += physData->velZ; } } // handle auto-collection from multi-coin bricks if (item->spawnType == ITEM_SPAWN_MODE_ITEM_BLOCK_SPAWN_ALWAYS - && physData->verticalVelocity <= 0.0f + && physData->verticalVel <= 0.0f ) { item->state = ITEM_PHYSICS_STATE_TOUCH; break; @@ -2281,13 +2281,13 @@ void update_item_entity_collectable(ItemEntity* item) { if (!(item->flags & (ITEM_ENTITY_FLAG_DONE_FALLING | ITEM_ENTITY_FLAG_NO_MOTION)) && item->spawnType != ITEM_SPAWN_MODE_ITEM_BLOCK_SPAWN_ALWAYS && item->spawnType != ITEM_SPAWN_MODE_TOSS_FADE1 - && physData->verticalVelocity > 0.0f + && physData->verticalVel > 0.0f ) { - temp = physData->constVelocity; - outX = item->position.x; - outY = item->position.y; - outZ = item->position.z; - outDepth = temp + physData->verticalVelocity; + temp = physData->constVel; + outX = item->pos.x; + outY = item->pos.y; + outZ = item->pos.z; + outDepth = temp + physData->verticalVel; if (!physData->useSimplePhysics) { hit = npc_raycast_up(COLLISION_CHANNEL_20000, &outX, &outY, &outZ, &outDepth); @@ -2296,8 +2296,8 @@ void update_item_entity_collectable(ItemEntity* item) { } if (hit && outDepth < temp) { - item->position.y = outY - temp; - physData->verticalVelocity = 0.0f; + item->pos.y = outY - temp; + physData->verticalVel = 0.0f; } } @@ -2305,53 +2305,53 @@ void update_item_entity_collectable(ItemEntity* item) { if (!(item->flags & (ITEM_ENTITY_FLAG_DONE_FALLING | ITEM_ENTITY_FLAG_NO_MOTION)) && item->spawnType != ITEM_SPAWN_MODE_ITEM_BLOCK_SPAWN_ALWAYS && item->spawnType != ITEM_SPAWN_MODE_TOSS_FADE1 - && (physData->velx != 0.0f || physData->velz != 0.0f) + && (physData->velX != 0.0f || physData->velZ != 0.0f) ) { - outX = item->position.x; - outY = item->position.y; - outZ = item->position.z; + outX = item->pos.x; + outY = item->pos.y; + outZ = item->pos.z; if (!physData->useSimplePhysics) { - hit = npc_test_move_complex_with_slipping(COLLISION_CHANNEL_20000, &outX, &outY, &outZ, 0.0f, physData->moveAngle, physData->constVelocity, physData->collisionRadius); + hit = npc_test_move_complex_with_slipping(COLLISION_CHANNEL_20000, &outX, &outY, &outZ, 0.0f, physData->moveAngle, physData->constVel, physData->collisionRadius); } else { - hit = npc_test_move_simple_with_slipping(COLLISION_CHANNEL_20000, &outX, &outY, &outZ, 0.0f, physData->moveAngle, physData->constVelocity, physData->collisionRadius); + hit = npc_test_move_simple_with_slipping(COLLISION_CHANNEL_20000, &outX, &outY, &outZ, 0.0f, physData->moveAngle, physData->constVel, physData->collisionRadius); } if (hit) { // if a wall is hit, bounce back - item->position.x = outX; - item->position.y = outY; - item->position.z = outZ; + item->pos.x = outX; + item->pos.y = outY; + item->pos.z = outZ; physData->moveAngle = clamp_angle(physData->moveAngle + 180.0f); theta = DEG_TO_RAD(physData->moveAngle); sinAngle = sin_rad(theta); cosAngle = cos_rad(theta); - physData->velx = sinAngle * 2.0; - physData->velz = cosAngle * -2.0; + physData->velX = sinAngle * 2.0; + physData->velZ = cosAngle * -2.0; } } // if the item has downward velocity, try moving it down if (!(item->flags & ITEM_ENTITY_FLAG_NO_MOTION) && item->spawnType != ITEM_SPAWN_MODE_ITEM_BLOCK_SPAWN_ALWAYS - && physData->verticalVelocity <= 0.0 + && physData->verticalVel <= 0.0 ) { physData->useSimplePhysics = TRUE; if (item->spawnType != ITEM_SPAWN_MODE_TOSS_FADE1) { - outX = item->position.x; - outY = (item->position.y - physData->verticalVelocity) + 12.0f; - outZ = item->position.z; - outDepth = -physData->verticalVelocity + 12.0f; + outX = item->pos.x; + outY = (item->pos.y - physData->verticalVel) + 12.0f; + outZ = item->pos.z; + outDepth = -physData->verticalVel + 12.0f; if (!physData->useSimplePhysics) { hit = npc_raycast_down_sides(COLLISION_CHANNEL_20000, &outX, &outY, &outZ, &outDepth); } else { hit = npc_raycast_down_around(COLLISION_CHANNEL_20000, &outX, &outY, &outZ, &outDepth, 180.0f, 20.0f); } } else { - outX = item->position.x; - outY = (item->position.y - physData->verticalVelocity) + 12.0f; - outZ = item->position.z; - outDepth = -physData->verticalVelocity + 12.0f; + outX = item->pos.x; + outY = (item->pos.y - physData->verticalVel) + 12.0f; + outZ = item->pos.z; + outDepth = -physData->verticalVel + 12.0f; if (outY < outDepth + 0.0f) { outY = 0.0f; hit = TRUE; @@ -2362,43 +2362,43 @@ void update_item_entity_collectable(ItemEntity* item) { // handle bounce if (hit) { - item->position.y = outY; - physData->verticalVelocity = -physData->verticalVelocity / 1.25; - if (physData->verticalVelocity < 3.0) { - physData->verticalVelocity = 0.0f; - physData->velx = 0.0f; - physData->velz = 0.0f; + item->pos.y = outY; + physData->verticalVel = -physData->verticalVel / 1.25; + if (physData->verticalVel < 3.0) { + physData->verticalVel = 0.0f; + physData->velX = 0.0f; + physData->velZ = 0.0f; item->flags |= ITEM_ENTITY_FLAG_DONE_FALLING; } else { if (IS_BADGE(item->itemID)) { - sfx_play_sound_at_position(SOUND_21B, SOUND_SPACE_MODE_0, item->position.x, item->position.y, item->position.z); + sfx_play_sound_at_position(SOUND_21B, SOUND_SPACE_MODE_0, item->pos.x, item->pos.y, item->pos.z); } else if (IS_ITEM(item->itemID)) { - sfx_play_sound_at_position(SOUND_21A, SOUND_SPACE_MODE_0, item->position.x, item->position.y, item->position.z); + sfx_play_sound_at_position(SOUND_21A, SOUND_SPACE_MODE_0, item->pos.x, item->pos.y, item->pos.z); } else { switch (item->itemID) { case ITEM_HEART: - sfx_play_sound_at_position(SOUND_214, SOUND_SPACE_MODE_0, item->position.x, item->position.y, item->position.z); + sfx_play_sound_at_position(SOUND_214, SOUND_SPACE_MODE_0, item->pos.x, item->pos.y, item->pos.z); break; case ITEM_COIN: - sfx_play_sound_at_position(SOUND_212, SOUND_SPACE_MODE_0, item->position.x, item->position.y, item->position.z); + sfx_play_sound_at_position(SOUND_212, SOUND_SPACE_MODE_0, item->pos.x, item->pos.y, item->pos.z); break; case ITEM_KOOPA_FORTRESS_KEY: - sfx_play_sound_at_position(SOUND_212, SOUND_SPACE_MODE_0, item->position.x, item->position.y, item->position.z); + sfx_play_sound_at_position(SOUND_212, SOUND_SPACE_MODE_0, item->pos.x, item->pos.y, item->pos.z); break; case ITEM_HEART_PIECE: - sfx_play_sound_at_position(SOUND_214, SOUND_SPACE_MODE_0, item->position.x, item->position.y, item->position.z); + sfx_play_sound_at_position(SOUND_214, SOUND_SPACE_MODE_0, item->pos.x, item->pos.y, item->pos.z); break; case ITEM_STAR_POINT: - sfx_play_sound_at_position(SOUND_212, SOUND_SPACE_MODE_0, item->position.x, item->position.y, item->position.z); + sfx_play_sound_at_position(SOUND_212, SOUND_SPACE_MODE_0, item->pos.x, item->pos.y, item->pos.z); break; case ITEM_HEART_POINT: - sfx_play_sound_at_position(SOUND_214, SOUND_SPACE_MODE_0, item->position.x, item->position.y, item->position.z); + sfx_play_sound_at_position(SOUND_214, SOUND_SPACE_MODE_0, item->pos.x, item->pos.y, item->pos.z); break; case ITEM_STAR_PIECE: - sfx_play_sound_at_position(SOUND_219, SOUND_SPACE_MODE_0, item->position.x, item->position.y, item->position.z); + sfx_play_sound_at_position(SOUND_219, SOUND_SPACE_MODE_0, item->pos.x, item->pos.y, item->pos.z); break; case ITEM_FLOWER_POINT: - sfx_play_sound_at_position(SOUND_218, SOUND_SPACE_MODE_0, item->position.x, item->position.y, item->position.z); + sfx_play_sound_at_position(SOUND_218, SOUND_SPACE_MODE_0, item->pos.x, item->pos.y, item->pos.z); break; } } @@ -2406,7 +2406,7 @@ void update_item_entity_collectable(ItemEntity* item) { } } - if (item->position.y < -2000.0f) { + if (item->pos.y < -2000.0f) { item->state = ITEM_PHYSICS_STATE_DEAD; } break; @@ -2421,7 +2421,7 @@ void update_item_entity_collectable(ItemEntity* item) { set_global_flag(item->boundVar); } - fx_small_gold_sparkle(0, item->position.x, item->position.y + 16.0f, item->position.z, 1.0f, 0); + fx_small_gold_sparkle(0, item->pos.x, item->pos.y + 16.0f, item->pos.z, 1.0f, 0); if (IS_ITEM(item->itemID)) { item->state = ITEM_PHYSICS_STATE_PICKUP; @@ -2438,34 +2438,34 @@ void update_item_entity_collectable(ItemEntity* item) { switch (item->itemID) { case ITEM_HEART: if (playerData->curHP < playerData->curMaxHP) { - fx_recover(0, playerStatus->position.x, playerStatus->position.y + playerStatus->colliderHeight, playerStatus->position.z, 1); - sfx_play_sound_at_position(SOUND_2056, SOUND_SPACE_MODE_0, item->position.x, item->position.y, item->position.z); + fx_recover(0, playerStatus->pos.x, playerStatus->pos.y + playerStatus->colliderHeight, playerStatus->pos.z, 1); + sfx_play_sound_at_position(SOUND_2056, SOUND_SPACE_MODE_0, item->pos.x, item->pos.y, item->pos.z); } playerData->curHP++; if (playerData->curHP > playerData->curMaxHP) { playerData->curHP = playerData->curMaxHP; } - sfx_play_sound_at_position(SOUND_213, SOUND_SPACE_MODE_0, item->position.x, item->position.y, item->position.z); - fx_sparkles(4, playerStatus->position.x, playerStatus->position.y + playerStatus->colliderHeight, playerStatus->position.z, 30.0f); + sfx_play_sound_at_position(SOUND_213, SOUND_SPACE_MODE_0, item->pos.x, item->pos.y, item->pos.z); + fx_sparkles(4, playerStatus->pos.x, playerStatus->pos.y + playerStatus->colliderHeight, playerStatus->pos.z, 30.0f); break; case ITEM_FLOWER_POINT: if (playerData->curFP < playerData->curMaxFP) { - fx_recover(1, playerStatus->position.x, playerStatus->position.y + playerStatus->colliderHeight, playerStatus->position.z, 1); - sfx_play_sound_at_position(SOUND_2056, SOUND_SPACE_MODE_0, item->position.x, item->position.y, item->position.z); + fx_recover(1, playerStatus->pos.x, playerStatus->pos.y + playerStatus->colliderHeight, playerStatus->pos.z, 1); + sfx_play_sound_at_position(SOUND_2056, SOUND_SPACE_MODE_0, item->pos.x, item->pos.y, item->pos.z); } playerData->curFP++; if (playerData->curFP > playerData->curMaxFP) { playerData->curFP = playerData->curMaxFP; } - sfx_play_sound_at_position(SOUND_217, SOUND_SPACE_MODE_0, item->position.x, item->position.y, item->position.z); - fx_sparkles(4, playerStatus->position.x, playerStatus->position.y + playerStatus->colliderHeight, playerStatus->position.z, 30.0f); + sfx_play_sound_at_position(SOUND_217, SOUND_SPACE_MODE_0, item->pos.x, item->pos.y, item->pos.z); + fx_sparkles(4, playerStatus->pos.x, playerStatus->pos.y + playerStatus->colliderHeight, playerStatus->pos.z, 30.0f); break; case ITEM_COIN: playerData->coins++; if (playerData->coins > 999) { playerData->coins = 999; } - sfx_play_sound_at_position(SOUND_211, SOUND_SPACE_MODE_0, item->position.x, item->position.y, item->position.z); + sfx_play_sound_at_position(SOUND_211, SOUND_SPACE_MODE_0, item->pos.x, item->pos.y, item->pos.z); playerData->totalCoinsEarned++; if (playerData->totalCoinsEarned > 99999) { playerData->totalCoinsEarned = 99999; @@ -2473,19 +2473,19 @@ void update_item_entity_collectable(ItemEntity* item) { break; case ITEM_KOOPA_FORTRESS_KEY: playerData->fortressKeyCount = playerData->fortressKeyCount + 1; - sfx_play_sound_at_position(SOUND_211, SOUND_SPACE_MODE_0, item->position.x, item->position.y, item->position.z); + sfx_play_sound_at_position(SOUND_211, SOUND_SPACE_MODE_0, item->pos.x, item->pos.y, item->pos.z); break; case ITEM_STAR_POINT: playerData->starPoints++; if (playerData->starPoints > 100) { playerData->starPoints = 100; } - sfx_play_sound_at_position(SOUND_211, SOUND_SPACE_MODE_0, item->position.x, item->position.y, item->position.z); + sfx_play_sound_at_position(SOUND_211, SOUND_SPACE_MODE_0, item->pos.x, item->pos.y, item->pos.z); break; case ITEM_HEART_POINT: playerData->curHP = playerData->curMaxHP; playerData->curFP = playerData->curMaxFP; - sfx_play_sound_at_position(SOUND_213, SOUND_SPACE_MODE_0, item->position.x, item->position.y, item->position.z); + sfx_play_sound_at_position(SOUND_213, SOUND_SPACE_MODE_0, item->pos.x, item->pos.y, item->pos.z); break; } D_801565A8 = FALSE; @@ -2606,7 +2606,7 @@ void update_item_entity_pickup(ItemEntity* item) { } else if (gItemTable[item->itemID].typeFlags & ITEM_TYPE_FLAG_KEY) { sfx_play_sound(SOUND_D2); } else if (item->itemID == ITEM_COIN) { - sfx_play_sound_at_position(SOUND_211, 0, item->position.x, item->position.y, item->position.z); + sfx_play_sound_at_position(SOUND_211, 0, item->pos.x, item->pos.y, item->pos.z); } else { sfx_play_sound(SOUND_D1); } @@ -2706,18 +2706,18 @@ void update_item_entity_pickup(ItemEntity* item) { || (item->flags & ITEM_ENTITY_FLAG_4000000) || (item->pickupMsgFlags & ITEM_PICKUP_FLAG_NO_ANIMS) ) { - item->position.x = playerStatus->position.x; - item->position.y = playerStatus->position.y + playerStatus->colliderHeight; - item->position.z = playerStatus->position.z; + item->pos.x = playerStatus->pos.x; + item->pos.y = playerStatus->pos.y + playerStatus->colliderHeight; + item->pos.z = playerStatus->pos.z; suggest_player_anim_always_forward(ANIM_MarioW1_Lift); } if (gItemTable[item->itemID].typeFlags & ITEM_TYPE_FLAG_GEAR) { fx_got_item_outline( 1, - item->position.x, - item->position.y + 8.0f, - item->position.z, + item->pos.x, + item->pos.y + 8.0f, + item->pos.z, 1.0f, &ItemPickupGotOutline ); @@ -2896,9 +2896,9 @@ void update_item_entity_pickup(ItemEntity* item) { get_item_entity( make_item_entity_delayed( D_801568EC, - playerStatus->position.x, - playerStatus->position.y + playerStatus->colliderHeight, - playerStatus->position.z, 3, 0, 0 + playerStatus->pos.x, + playerStatus->pos.y + playerStatus->colliderHeight, + playerStatus->pos.z, 3, 0, 0 ) )->renderGroup = -1; diff --git a/src/actor_api.c b/src/actor_api.c index f97ef4caffe..a5865778661 100644 --- a/src/actor_api.c +++ b/src/actor_api.c @@ -9,7 +9,7 @@ s32 count_targets(Actor* actor, s32 targetHomeIndex, s32 targetSelectionFlags) { BattleStatus* battleStatus = &gBattleStatus; battleStatus->targetHomeIndex = targetHomeIndex; - battleStatus->currentTargetListFlags = targetSelectionFlags; + battleStatus->curTargetListFlags = targetSelectionFlags; player_create_target_list(actor); return actor->targetListLength; } @@ -49,9 +49,9 @@ void set_goal_pos_to_part(ActorState* state, s32 actorID, s32 partID) { switch (actorClass) { case ACTOR_CLASS_PLAYER: part = get_actor_part(actor, 0); - state->goalPos.x = actor->currentPos.x + part->partOffset.x * actor->scalingFactor; - state->goalPos.y = actor->currentPos.y + part->partOffset.y * actor->scalingFactor; - state->goalPos.z = actor->currentPos.z + 10.0f; + state->goalPos.x = actor->curPos.x + part->partOffset.x * actor->scalingFactor; + state->goalPos.y = actor->curPos.y + part->partOffset.y * actor->scalingFactor; + state->goalPos.z = actor->curPos.z + 10.0f; if (actor->stoneStatus == STATUS_KEY_STONE) { state->goalPos.y -= actor->scalingFactor * 5.0f; } @@ -60,21 +60,21 @@ void set_goal_pos_to_part(ActorState* state, s32 actorID, s32 partID) { case ACTOR_CLASS_ENEMY: part = get_actor_part(actor, partID); if (!(part->flags & ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION)) { - state->goalPos.x = actor->currentPos.x + (part->partOffset.x + part->targetOffset.x) * actor->scalingFactor; + state->goalPos.x = actor->curPos.x + (part->partOffset.x + part->targetOffset.x) * actor->scalingFactor; if (!(actor->flags & ACTOR_PART_FLAG_800)) { - state->goalPos.y = actor->currentPos.y + (part->partOffset.y + part->targetOffset.y) * actor->scalingFactor; + state->goalPos.y = actor->curPos.y + (part->partOffset.y + part->targetOffset.y) * actor->scalingFactor; } else { - state->goalPos.y = actor->currentPos.y + (-part->partOffset.y - part->targetOffset.y) * actor->scalingFactor; + state->goalPos.y = actor->curPos.y + (-part->partOffset.y - part->targetOffset.y) * actor->scalingFactor; } - state->goalPos.z = actor->currentPos.z + part->partOffset.z + 10.0f; + state->goalPos.z = actor->curPos.z + part->partOffset.z + 10.0f; } else { - state->goalPos.x = part->absolutePosition.x + part->targetOffset.x; + state->goalPos.x = part->absolutePos.x + part->targetOffset.x; if (!(actor->flags & ACTOR_PART_FLAG_800)) { - state->goalPos.y = part->absolutePosition.y + part->targetOffset.y * actor->scalingFactor; + state->goalPos.y = part->absolutePos.y + part->targetOffset.y * actor->scalingFactor; } else { - state->goalPos.y = part->absolutePosition.y - part->targetOffset.y * actor->scalingFactor; + state->goalPos.y = part->absolutePos.y - part->targetOffset.y * actor->scalingFactor; } - state->goalPos.z = part->absolutePosition.z + 10.0f; + state->goalPos.z = part->absolutePos.z + 10.0f; } break; } @@ -88,29 +88,29 @@ void set_part_goal_to_actor_part(ActorPartMovement* movement, s32 actorID, s32 p switch (actorClass) { case ACTOR_CLASS_PLAYER: part = get_actor_part(actor, 0); - part->movement->goalPos.x = actor->currentPos.x + part->partOffset.x * actor->scalingFactor; - part->movement->goalPos.y = actor->currentPos.y + part->partOffset.y * actor->scalingFactor; - part->movement->goalPos.z = actor->currentPos.z; + part->movement->goalPos.x = actor->curPos.x + part->partOffset.x * actor->scalingFactor; + part->movement->goalPos.y = actor->curPos.y + part->partOffset.y * actor->scalingFactor; + part->movement->goalPos.z = actor->curPos.z; break; case ACTOR_CLASS_PARTNER: case ACTOR_CLASS_ENEMY: part = get_actor_part(actor, partID); if (!(part->flags & ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION)) { - part->movement->goalPos.x = actor->currentPos.x + (part->partOffset.x + part->targetOffset.x) * actor->scalingFactor; + part->movement->goalPos.x = actor->curPos.x + (part->partOffset.x + part->targetOffset.x) * actor->scalingFactor; if (!(actor->flags & ACTOR_PART_FLAG_800)) { - part->movement->goalPos.y = actor->currentPos.y + (part->partOffset.y + part->targetOffset.y) * actor->scalingFactor; + part->movement->goalPos.y = actor->curPos.y + (part->partOffset.y + part->targetOffset.y) * actor->scalingFactor; } else { - part->movement->goalPos.y = actor->currentPos.y + (-part->partOffset.y - part->targetOffset.y) * actor->scalingFactor; + part->movement->goalPos.y = actor->curPos.y + (-part->partOffset.y - part->targetOffset.y) * actor->scalingFactor; } - part->movement->goalPos.z = actor->currentPos.z + part->partOffset.z; + part->movement->goalPos.z = actor->curPos.z + part->partOffset.z; } else { - part->movement->goalPos.x = part->absolutePosition.x + part->targetOffset.x; + part->movement->goalPos.x = part->absolutePos.x + part->targetOffset.x; if (!(actor->flags & ACTOR_PART_FLAG_800)) { - part->movement->goalPos.y = part->absolutePosition.y + part->targetOffset.y * actor->scalingFactor; + part->movement->goalPos.y = part->absolutePos.y + part->targetOffset.y * actor->scalingFactor; } else { - part->movement->goalPos.y = part->absolutePosition.y - part->targetOffset.y * actor->scalingFactor; + part->movement->goalPos.y = part->absolutePos.y - part->targetOffset.y * actor->scalingFactor; } - part->movement->goalPos.z = part->absolutePosition.z; + part->movement->goalPos.z = part->absolutePos.z; } break; } @@ -119,9 +119,9 @@ void set_part_goal_to_actor_part(ActorPartMovement* movement, s32 actorID, s32 p void set_actor_current_position(s32 actorID, f32 x, f32 y, f32 z) { Actor* actor = get_actor(actorID); - actor->currentPos.x = x; - actor->currentPos.y = y; - actor->currentPos.z = z; + actor->curPos.x = x; + actor->curPos.y = y; + actor->curPos.z = z; } void set_part_absolute_position(s32 actorID, s32 partID, f32 x, f32 y, f32 z) { @@ -130,16 +130,16 @@ void set_part_absolute_position(s32 actorID, s32 partID, f32 x, f32 y, f32 z) { switch (actorID & ACTOR_CLASS_MASK) { case ACTOR_CLASS_PLAYER: - actor->currentPos.x = x; - actor->currentPos.y = y; - actor->currentPos.z = z; + actor->curPos.x = x; + actor->curPos.y = y; + actor->curPos.z = z; break; case ACTOR_CLASS_PARTNER: case ACTOR_CLASS_ENEMY: actorPart = get_actor_part(actor, partID); - actorPart->absolutePosition.x = x; - actorPart->absolutePosition.y = y; - actorPart->absolutePosition.z = z; + actorPart->absolutePos.x = x; + actorPart->absolutePos.y = y; + actorPart->absolutePos.z = z; break; } } @@ -186,19 +186,19 @@ ApiStatus GetBattlePhase(Evt* script, s32 isInitialCall) { } ApiStatus GetLastElement(Evt* script, s32 isInitialCall) { - evt_set_variable(script, *script->ptrReadPos, gBattleStatus.currentAttackElement); + evt_set_variable(script, *script->ptrReadPos, gBattleStatus.curAttackElement); return ApiStatus_DONE2; } ApiStatus GetDamageSource(Evt* script, s32 isInitialCall) { - evt_set_variable(script, *script->ptrReadPos, gBattleStatus.currentDamageSource); + evt_set_variable(script, *script->ptrReadPos, gBattleStatus.curDamageSource); return ApiStatus_DONE2; } ApiStatus SetDamageSource(Evt* script, s32 isInitialCall) { s32 damageSource = *script->ptrReadPos; - gBattleStatus.currentDamageSource = damageSource; + gBattleStatus.curDamageSource = damageSource; return ApiStatus_DONE2; } @@ -263,7 +263,7 @@ ApiStatus GetIndexFromPos(Evt* script, s32 isInitialCall) { } actor = get_actor(actorID); - evt_set_variable(script, a1, get_nearest_home_index(actor->currentPos.x, actor->currentPos.y, actor->currentPos.z)); + evt_set_variable(script, a1, get_nearest_home_index(actor->curPos.x, actor->curPos.y, actor->curPos.z)); return ApiStatus_DONE2; } @@ -296,8 +296,8 @@ ApiStatus CountPlayerTargets(Evt* script, s32 isInitialCall) { } actor = get_actor(actorID); - evt_set_variable(script, outVar, count_targets(actor, get_nearest_home_index(actor->currentPos.x, actor->currentPos.y, - actor->currentPos.z), targetSelectionFlags)); + evt_set_variable(script, outVar, count_targets(actor, get_nearest_home_index(actor->curPos.x, actor->curPos.y, + actor->curPos.z), targetSelectionFlags)); return ApiStatus_DONE2; } @@ -318,11 +318,11 @@ ApiStatus ForceHomePos(Evt* script, s32 isInitialCall) { actor = get_actor(actorID); actor->homePos.x = x; - actor->currentPos.x = x; + actor->curPos.x = x; actor->homePos.y = y; - actor->currentPos.y = y; + actor->curPos.y = y; actor->homePos.z = z; - actor->currentPos.z = z; + actor->curPos.z = z; return ApiStatus_DONE2; } @@ -603,9 +603,9 @@ ApiStatus GetActorPos(Evt* script, s32 isInitialCall) { outY = *args++; outZ = *args++; - x = actor->currentPos.x; - y = actor->currentPos.y; - z = actor->currentPos.z; + x = actor->curPos.x; + y = actor->curPos.y; + z = actor->curPos.z; evt_set_variable(script, outX, x); evt_set_variable(script, outY, y); @@ -638,9 +638,9 @@ ApiStatus GetPartOffset(Evt* script, s32 isInitialCall) { y = actorPart->partOffset.y; z = actorPart->partOffset.z; } else { - x = actorPart->absolutePosition.x; - y = actorPart->absolutePosition.y; - z = actorPart->absolutePosition.z; + x = actorPart->absolutePos.x; + y = actorPart->absolutePos.y; + z = actorPart->absolutePos.z; } evt_set_variable(script, outX, x); @@ -669,9 +669,9 @@ ApiStatus GetPartPos(Evt* script, s32 isInitialCall) { outY = *args++; outZ = *args++; - x = actorPart->currentPos.x; - y = actorPart->currentPos.y; - z = actorPart->currentPos.z; + x = actorPart->curPos.x; + y = actorPart->curPos.y; + z = actorPart->curPos.z; evt_set_variable(script, outX, x); evt_set_variable(script, outY, y); @@ -723,9 +723,9 @@ ApiStatus SetActorPos(Evt* script, s32 isInitialCall) { z = evt_get_variable(script, *args++); actor = get_actor(actorID); - actor->currentPos.x = x; - actor->currentPos.y = y; - actor->currentPos.z = z; + actor->curPos.x = x; + actor->curPos.y = y; + actor->curPos.z = z; return ApiStatus_DONE2; } @@ -751,9 +751,9 @@ ApiStatus SetPartPos(Evt* script, s32 isInitialCall) { switch (actorID & ACTOR_CLASS_MASK) { case ACTOR_CLASS_PLAYER: - actor->currentPos.x = x; - actor->currentPos.y = y; - actor->currentPos.z = z; + actor->curPos.x = x; + actor->curPos.y = y; + actor->curPos.z = z; break; case ACTOR_CLASS_PARTNER: case ACTOR_CLASS_ENEMY: @@ -764,9 +764,9 @@ ApiStatus SetPartPos(Evt* script, s32 isInitialCall) { actorPart->partOffset.y = y; actorPart->partOffset.z = z; } else { - actorPart->absolutePosition.x = x; - actorPart->absolutePosition.y = y; - actorPart->absolutePosition.z = z; + actorPart->absolutePos.x = x; + actorPart->absolutePos.y = y; + actorPart->absolutePos.z = z; } break; } @@ -841,7 +841,7 @@ ApiStatus GetAnimation(Evt* script, s32 isInitialCall) { actorPart = get_actor_part(get_actor(actorID), partID); if (actorPart != NULL) { - evt_set_variable(script, outVar, actorPart->currentAnimation); + evt_set_variable(script, outVar, actorPart->curAnimation); } return ApiStatus_DONE2; } @@ -1059,9 +1059,9 @@ ApiStatus AddActorPos(Evt* script, s32 isInitialCall) { z = evt_get_float_variable(script, *args++); actor = get_actor(actorID); - actor->currentPos.x += x; - actor->currentPos.y += y; - actor->currentPos.z += z; + actor->curPos.x += x; + actor->curPos.y += y; + actor->curPos.z += z; return ApiStatus_DONE2; } @@ -1334,15 +1334,15 @@ ApiStatus SetActorRotation(Evt* script, s32 isInitialCall) { actor = get_actor(actorID); if (x != EVT_IGNORE_ARG) { - actor->rotation.x = x; + actor->rot.x = x; } if (y != EVT_IGNORE_ARG) { - actor->rotation.y = y; + actor->rot.y = y; } if (z != EVT_IGNORE_ARG) { - actor->rotation.z = z; + actor->rot.z = z; } return ApiStatus_DONE2; @@ -1364,9 +1364,9 @@ ApiStatus SetActorRotationOffset(Evt* script, s32 isInitialCall) { actor = get_actor(actorID); - actor->rotationPivotOffset.x = x; - actor->rotationPivotOffset.y = y; - actor->rotationPivotOffset.z = z; + actor->rotPivotOffset.x = x; + actor->rotPivotOffset.y = y; + actor->rotPivotOffset.z = z; return ApiStatus_DONE2; } @@ -1387,9 +1387,9 @@ ApiStatus GetActorRotation(Evt* script, s32 isInitialCall) { actor = get_actor(actorID); - evt_set_variable(script, x, actor->rotation.x); - evt_set_variable(script, y, actor->rotation.y); - evt_set_variable(script, z, actor->rotation.z); + evt_set_variable(script, x, actor->rot.x); + evt_set_variable(script, y, actor->rot.y); + evt_set_variable(script, z, actor->rot.z); return ApiStatus_DONE2; } @@ -1411,9 +1411,9 @@ ApiStatus SetPartRotation(Evt* script, s32 isInitialCall) { actorPart = get_actor_part(get_actor(actorID), partID); - actorPart->rotation.x = x; - actorPart->rotation.y = y; - actorPart->rotation.z = z; + actorPart->rot.x = x; + actorPart->rot.y = y; + actorPart->rot.z = z; return ApiStatus_DONE2; } @@ -1435,9 +1435,9 @@ ApiStatus SetPartRotationOffset(Evt* script, s32 isInitialCall) { actorPart = get_actor_part(get_actor(actorID), partID); - actorPart->rotationPivotOffset.x = x; - actorPart->rotationPivotOffset.y = y; - actorPart->rotationPivotOffset.z = z; + actorPart->rotPivotOffset.x = x; + actorPart->rotPivotOffset.y = y; + actorPart->rotPivotOffset.z = z; return ApiStatus_DONE2; } @@ -1459,9 +1459,9 @@ ApiStatus GetPartRotation(Evt* script, s32 isInitialCall) { actorPart = get_actor_part(get_actor(actorID), partID); - evt_set_float_variable(script, x, actorPart->rotation.x); - evt_set_float_variable(script, y, actorPart->rotation.y); - evt_set_float_variable(script, z, actorPart->rotation.z); + evt_set_float_variable(script, x, actorPart->rot.x); + evt_set_float_variable(script, y, actorPart->rot.y); + evt_set_float_variable(script, z, actorPart->rot.z); return ApiStatus_DONE2; } @@ -1941,7 +1941,7 @@ ApiStatus HPBarToHome(Evt* script, s32 isInitialCall) { actor->healthBarPos.y = actor->homePos.y - actor->size.y - actor->actorBlueprint->healthBarOffset.y; } - actor->healthFraction = (actor->currentHP * 25) / actor->maxHP; + actor->healthFraction = (actor->curHP * 25) / actor->maxHP; return ApiStatus_DONE2; } @@ -1956,15 +1956,15 @@ ApiStatus HPBarToCurrent(Evt* script, s32 isInitialCall) { } actor = get_actor(actorID); - actor->healthBarPos.x = actor->currentPos.x + actor->actorBlueprint->healthBarOffset.x; - actor->healthBarPos.y = actor->currentPos.y + actor->actorBlueprint->healthBarOffset.y; - actor->healthBarPos.z = actor->currentPos.z; + actor->healthBarPos.x = actor->curPos.x + actor->actorBlueprint->healthBarOffset.x; + actor->healthBarPos.y = actor->curPos.y + actor->actorBlueprint->healthBarOffset.y; + actor->healthBarPos.z = actor->curPos.z; if (actor->flags & ACTOR_FLAG_UPSIDE_DOWN) { - actor->healthBarPos.y = actor->currentPos.y - actor->size.y - actor->actorBlueprint->healthBarOffset.y; + actor->healthBarPos.y = actor->curPos.y - actor->size.y - actor->actorBlueprint->healthBarOffset.y; } - actor->healthFraction = (actor->currentHP * 25) / actor->maxHP; + actor->healthFraction = (actor->curHP * 25) / actor->maxHP; return ApiStatus_DONE2; } @@ -2205,9 +2205,9 @@ ApiStatus SetBattleInputButtons(Evt* script, s32 isInitialCall) { s32 currentButtonsPressed = *args++; s32 currentButtonsHeld = *args; - battleStatus->currentButtonsDown = currentButtonsDown; - battleStatus->currentButtonsPressed = currentButtonsPressed; - battleStatus->currentButtonsHeld = currentButtonsHeld; + battleStatus->curButtonsDown = currentButtonsDown; + battleStatus->curButtonsPressed = currentButtonsPressed; + battleStatus->curButtonsHeld = currentButtonsHeld; return ApiStatus_DONE2; } @@ -2216,7 +2216,7 @@ ApiStatus CheckButtonPress(Evt* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; Bytecode buttons = *args++; Bytecode out = *args; - s32 buttonsPressed = gBattleStatus.currentButtonsPressed; + s32 buttonsPressed = gBattleStatus.curButtonsPressed; evt_set_variable(script, out, (buttonsPressed & buttons) != 0); return ApiStatus_DONE2; @@ -2226,7 +2226,7 @@ ApiStatus CheckButtonHeld(Evt* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; Bytecode buttons = *args++; Bytecode out = *args; - s32 buttonsHeld = gBattleStatus.currentButtonsHeld; + s32 buttonsHeld = gBattleStatus.curButtonsHeld; evt_set_variable(script, out, (buttonsHeld & buttons) != 0); return ApiStatus_DONE2; @@ -2236,7 +2236,7 @@ ApiStatus CheckButtonDown(Evt* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; Bytecode buttons = *args++; Bytecode out = *args; - s32 buttonsDown = gBattleStatus.currentButtonsDown; + s32 buttonsDown = gBattleStatus.curButtonsDown; evt_set_variable(script, out, (buttonsDown & buttons) != 0); return ApiStatus_DONE2; @@ -2308,7 +2308,7 @@ ApiStatus PlayerCreateTargetList(Evt* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; Actor* actor = get_actor(script->owner1.actorID); - gBattleStatus.currentTargetListFlags = *args; + gBattleStatus.curTargetListFlags = *args; player_create_target_list(actor); return ApiStatus_DONE2; @@ -2318,7 +2318,7 @@ ApiStatus EnemyCreateTargetList(Evt* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; Actor* actor = get_actor(script->owner1.actorID); - gBattleStatus.currentTargetListFlags = *args; + gBattleStatus.curTargetListFlags = *args; enemy_create_target_list(actor); return ApiStatus_DONE2; @@ -2423,9 +2423,9 @@ s32 func_8026E558(Evt* script, s32 isInitialCall) { } actor = get_actor(i); - x = actor->currentPos.x; - y = actor->currentPos.y; - z = actor->currentPos.z; + x = actor->curPos.x; + y = actor->curPos.y; + z = actor->curPos.z; outVal = -1; @@ -2518,8 +2518,8 @@ ApiStatus func_8026E914(Evt* script, s32 isInitialCall) { s32 temp_v0 = *args++; s32 temp_s1 = *args++; - evt_set_variable(script, temp_v0, gBattleStatus.currentTargetID2); - evt_set_variable(script, temp_s1, gBattleStatus.currentTargetPart2); + evt_set_variable(script, temp_v0, gBattleStatus.curTargetID2); + evt_set_variable(script, temp_s1, gBattleStatus.curTargetPart2); return ApiStatus_DONE2; } @@ -2537,8 +2537,8 @@ ApiStatus func_8026E9A0(Evt* script, s32 isInitialCall) { actorID = evt_get_variable(script, *args++); partID = evt_get_variable(script, *args++); - gBattleStatus.currentTargetPart2 = partID; - gBattleStatus.currentTargetID2 = actorID; + gBattleStatus.curTargetPart2 = partID; + gBattleStatus.curTargetID2 = actorID; return ApiStatus_DONE2; } @@ -2555,7 +2555,7 @@ ApiStatus GetDistanceToGoal(Evt* script, s32 isInitialCall) { } actor = get_actor(actorID); - dist = dist2D(actor->currentPos.x, actor->currentPos.z, actor->state.goalPos.x, actor->state.goalPos.z); + dist = dist2D(actor->curPos.x, actor->curPos.z, actor->state.goalPos.x, actor->state.goalPos.z); evt_set_variable(script, outVar, dist); return ApiStatus_DONE2; } @@ -3213,26 +3213,26 @@ ApiStatus BoostAttack(Evt* script, s32 isInitialCall) { attackBoost = script->functionTemp[2]; flags = actor->flags; - x1 = actor->currentPos.x + actor->headOffset.x; + x1 = actor->curPos.x + actor->headOffset.x; if (flags & ACTOR_FLAG_UPSIDE_DOWN) { - y1 = actor->currentPos.y + actor->headOffset.y - actor->size.y / 2; + y1 = actor->curPos.y + actor->headOffset.y - actor->size.y / 2; } else if (!(flags & ACTOR_FLAG_8000)) { - y1 = actor->currentPos.y + actor->headOffset.y + actor->size.y / 2; + y1 = actor->curPos.y + actor->headOffset.y + actor->size.y / 2; } else { - y1 = actor->currentPos.y + actor->headOffset.y + actor->size.y; + y1 = actor->curPos.y + actor->headOffset.y + actor->size.y; } - z1 = actor->currentPos.z + actor->headOffset.z + 10.0f; + z1 = actor->curPos.z + actor->headOffset.z + 10.0f; flags2 = actor->flags; - x2 = actor->currentPos.x + actor->headOffset.x + actor->size.x / 2; + x2 = actor->curPos.x + actor->headOffset.x + actor->size.x / 2; if (flags2 & ACTOR_FLAG_UPSIDE_DOWN) { - y2 = actor->currentPos.y + actor->headOffset.y - actor->size.y; + y2 = actor->curPos.y + actor->headOffset.y - actor->size.y; } else if (!(flags2 & ACTOR_FLAG_8000)) { - y2 = actor->currentPos.y + actor->headOffset.y + actor->size.y; + y2 = actor->curPos.y + actor->headOffset.y + actor->size.y; } else { - y2 = actor->currentPos.y + actor->headOffset.y + actor->size.y * 2; + y2 = actor->curPos.y + actor->headOffset.y + actor->size.y * 2; } - z2 = actor->currentPos.z + actor->headOffset.z + 10.0f; + z2 = actor->curPos.z + actor->headOffset.z + 10.0f; switch (script->functionTemp[0]) { case 1: @@ -3337,26 +3337,26 @@ ApiStatus BoostDefense(Evt* script, s32 isInitialCall) { defenseBoost = script->functionTemp[2]; flags = actor->flags; - x1 = actor->currentPos.x + actor->headOffset.x; + x1 = actor->curPos.x + actor->headOffset.x; if (flags & ACTOR_FLAG_UPSIDE_DOWN) { - y1 = actor->currentPos.y + actor->headOffset.y - actor->size.y / 2; + y1 = actor->curPos.y + actor->headOffset.y - actor->size.y / 2; } else if (!(flags & ACTOR_FLAG_8000)) { - y1 = actor->currentPos.y + actor->headOffset.y + actor->size.y / 2; + y1 = actor->curPos.y + actor->headOffset.y + actor->size.y / 2; } else { - y1 = actor->currentPos.y + actor->headOffset.y + actor->size.y; + y1 = actor->curPos.y + actor->headOffset.y + actor->size.y; } - z1 = actor->currentPos.z + actor->headOffset.z + 10.0f; + z1 = actor->curPos.z + actor->headOffset.z + 10.0f; flags2 = actor->flags; - x2 = actor->currentPos.x + actor->headOffset.x + actor->size.x / 2; + x2 = actor->curPos.x + actor->headOffset.x + actor->size.x / 2; if (flags2 & ACTOR_FLAG_UPSIDE_DOWN) { - y2 = actor->currentPos.y + actor->headOffset.y - actor->size.y; + y2 = actor->curPos.y + actor->headOffset.y - actor->size.y; } else if (!(flags2 & ACTOR_FLAG_8000)) { - y2 = actor->currentPos.y + actor->headOffset.y + actor->size.y; + y2 = actor->curPos.y + actor->headOffset.y + actor->size.y; } else { - y2 = actor->currentPos.y + actor->headOffset.y + actor->size.y * 2; + y2 = actor->curPos.y + actor->headOffset.y + actor->size.y * 2; } - z2 = actor->currentPos.z + actor->headOffset.z + 10.0f; + z2 = actor->curPos.z + actor->headOffset.z + 10.0f; switch (script->functionTemp[0]) { case 1: @@ -3459,15 +3459,15 @@ ApiStatus VanishActor(Evt* script, s32 isInitialCall) { vanished = script->functionTemp[2]; flags = actor->flags; - x = actor->currentPos.x + actor->headOffset.x; + x = actor->curPos.x + actor->headOffset.x; if (flags & ACTOR_FLAG_UPSIDE_DOWN) { - y = actor->currentPos.y + actor->headOffset.y - actor->size.y / 2; + y = actor->curPos.y + actor->headOffset.y - actor->size.y / 2; } else if (!(flags & ACTOR_FLAG_8000)) { - y = actor->currentPos.y + actor->headOffset.y + actor->size.y / 2; + y = actor->curPos.y + actor->headOffset.y + actor->size.y / 2; } else { - y = actor->currentPos.y + actor->headOffset.y + actor->size.y; + y = actor->curPos.y + actor->headOffset.y + actor->size.y; } - z = actor->currentPos.z + actor->headOffset.z + 10.0f; + z = actor->curPos.z + actor->headOffset.z + 10.0f; switch (script->functionTemp[0]) { case 1: @@ -3565,15 +3565,15 @@ ApiStatus ElectrifyActor(Evt* script, s32 isInitialCall) { electrified = script->functionTemp[2]; flags = actor->flags; - x = actor->currentPos.x + actor->headOffset.x; + x = actor->curPos.x + actor->headOffset.x; if (flags & ACTOR_FLAG_UPSIDE_DOWN) { - y = actor->currentPos.y + actor->headOffset.y - actor->size.y / 2; + y = actor->curPos.y + actor->headOffset.y - actor->size.y / 2; } else if (!(flags & ACTOR_FLAG_8000)) { - y = actor->currentPos.y + actor->headOffset.y + actor->size.y / 2; + y = actor->curPos.y + actor->headOffset.y + actor->size.y / 2; } else { - y = actor->currentPos.y + actor->headOffset.y + actor->size.y; + y = actor->curPos.y + actor->headOffset.y + actor->size.y; } - z = actor->currentPos.z + actor->headOffset.z + 10.0f; + z = actor->curPos.z + actor->headOffset.z + 10.0f; switch (script->functionTemp[0]) { case 1: @@ -3671,26 +3671,26 @@ ApiStatus HealActor(Evt* script, s32 isInitialCall) { hpBoost = script->functionTemp[2]; flags = actor->flags; - x1 = actor->currentPos.x + actor->headOffset.x; + x1 = actor->curPos.x + actor->headOffset.x; if (flags & ACTOR_FLAG_UPSIDE_DOWN) { - y1 = actor->currentPos.y + actor->headOffset.y - actor->size.y / 2; + y1 = actor->curPos.y + actor->headOffset.y - actor->size.y / 2; } else if (!(flags & ACTOR_FLAG_8000)) { - y1 = actor->currentPos.y + actor->headOffset.y + actor->size.y / 2; + y1 = actor->curPos.y + actor->headOffset.y + actor->size.y / 2; } else { - y1 = actor->currentPos.y + actor->headOffset.y + actor->size.y; + y1 = actor->curPos.y + actor->headOffset.y + actor->size.y; } - z1 = actor->currentPos.z + actor->headOffset.z + 10.0f; + z1 = actor->curPos.z + actor->headOffset.z + 10.0f; flags2 = actor->flags; - x2 = actor->currentPos.x + actor->headOffset.x + actor->size.x / 2; + x2 = actor->curPos.x + actor->headOffset.x + actor->size.x / 2; if (flags2 & ACTOR_FLAG_UPSIDE_DOWN) { - y2 = actor->currentPos.y + actor->headOffset.y - actor->size.y; + y2 = actor->curPos.y + actor->headOffset.y - actor->size.y; } else if (!(flags2 & ACTOR_FLAG_8000)) { - y2 = actor->currentPos.y + actor->headOffset.y + actor->size.y; + y2 = actor->curPos.y + actor->headOffset.y + actor->size.y; } else { - y2 = actor->currentPos.y + actor->headOffset.y + actor->size.y * 2; + y2 = actor->curPos.y + actor->headOffset.y + actor->size.y * 2; } - z2 = actor->currentPos.z + actor->headOffset.z + 10.0f; + z2 = actor->curPos.z + actor->headOffset.z + 10.0f; switch (script->functionTemp[0]) { case 1: @@ -3709,9 +3709,9 @@ ApiStatus HealActor(Evt* script, s32 isInitialCall) { if (script->functionTemp[3] == 0) { btl_cam_use_preset(BTL_CAM_DEFAULT); btl_cam_move(15); - actor->currentHP += hpBoost; - if (actor->maxHP < actor->currentHP) { - actor->currentHP = actor->maxHP; + actor->curHP += hpBoost; + if (actor->maxHP < actor->curHP) { + actor->curHP = actor->maxHP; } show_recovery_shimmer(x1, y1, z1, hpBoost); script->functionTemp[3] = 15; diff --git a/src/ad90_len_2880.c b/src/ad90_len_2880.c index 391f9e13414..fbb59d93769 100644 --- a/src/ad90_len_2880.c +++ b/src/ad90_len_2880.c @@ -33,25 +33,25 @@ void update_camera_mode_6(Camera* camera) { camera->lookAt_obj.x = camera->lookAt_obj_target.x + camera->targetPos.x; camera->lookAt_obj.y = camera->lookAt_obj_target.y + camera->targetPos.y + camera->auxBoomZOffset / 256.0; camera->lookAt_obj.z = camera->lookAt_obj_target.z + camera->targetPos.z; - camera->trueRotation.x = camera->auxBoomYaw; - camera->currentBoomYaw = camera->auxBoomPitch; - camera->currentBoomLength = camera->auxBoomLength; + camera->trueRot.x = camera->auxBoomYaw; + camera->curBoomYaw = camera->auxBoomPitch; + camera->curBoomLength = camera->auxBoomLength; camera->vfov = (10000 / camera->lookAt_dist) / 4; - boomYaw = DEG_TO_RAD(camera->currentBoomYaw); + boomYaw = DEG_TO_RAD(camera->curBoomYaw); sinBoom = sin_rad(boomYaw); cosBoom = cos_rad(boomYaw); deltaX = 0.0f; deltaY = 0.0f; - deltaZ = camera->currentBoomLength; + deltaZ = camera->curBoomLength; deltaX2 = 0.0f; deltaY2 = 0.0f; boomYaw = deltaX = -deltaY2; - deltaZ2 = camera->currentBoomLength; + deltaZ2 = camera->curBoomLength; new_var = boomYaw; deltaX = deltaX2; deltaY = cosBoom * deltaY2 + deltaZ2 * sinBoom; deltaZ = sinBoom * new_var + deltaZ2 * cosBoom; - boomYaw = DEG_TO_RAD(camera->trueRotation.x); + boomYaw = DEG_TO_RAD(camera->trueRot.x); sinBoom = sin_rad(boomYaw); cosBoom = cos_rad(boomYaw); deltaZ2 = cosBoom * deltaX - deltaZ * sinBoom; @@ -62,13 +62,13 @@ void update_camera_mode_6(Camera* camera) { camera->lookAt_eye.y = camera->lookAt_obj.y + deltaY2; camera->lookAt_eye.z = camera->lookAt_obj.z + deltaZ2; } - camera->currentYaw = atan2(camera->lookAt_eye.x, camera->lookAt_eye.z, camera->lookAt_obj.x, camera->lookAt_obj.z); + camera->curYaw = atan2(camera->lookAt_eye.x, camera->lookAt_eye.z, camera->lookAt_obj.x, camera->lookAt_obj.z); deltaX = camera->lookAt_obj.x - camera->lookAt_eye.x; deltaY = camera->lookAt_obj.y - camera->lookAt_eye.y; deltaZ = camera->lookAt_obj.z - camera->lookAt_eye.z; - camera->currentBlendedYawNegated = -atan2(0.0f, 0.0f, deltaX, deltaZ); + camera->curBlendedYawNegated = -atan2(0.0f, 0.0f, deltaX, deltaZ); planarDist = sqrtf(SQ(deltaX) + SQ(deltaZ)); - camera->currentPitch = atan2(0.0f, 0.0f, deltaY, -planarDist); + camera->curPitch = atan2(0.0f, 0.0f, deltaY, -planarDist); gBattleStatus.camLookatObjPos.x = camera->lookAt_obj.x; gBattleStatus.camLookatObjPos.y = camera->lookAt_obj.y; gBattleStatus.camLookatObjPos.z = camera->lookAt_obj.z; diff --git a/src/audio.h b/src/audio.h index 24d19761283..d32b02f514b 100644 --- a/src/audio.h +++ b/src/audio.h @@ -364,7 +364,7 @@ typedef union VolumeField { // envelope related? typedef struct Fade { - /* 0x0 */ VolumeField currentVolume; + /* 0x0 */ VolumeField curVolume; /* 0x4 */ s32 fadeStep; /* 0x8 */ s16 targetVolume; /* 0xA */ s16 fadeTime; @@ -439,7 +439,7 @@ typedef struct AuFxBus { /* 0x02 */ char unk_02[0x2]; /* 0x04 */ AuFX* fxL; /* 0x08 */ AuFX* fxR; - /* 0x0C */ u8 currentEffectType; + /* 0x0C */ u8 curEffectType; /* 0x0D */ char unk_0D[0x3]; /* 0x10 */ struct AuPVoice* head; /* 0x14 */ struct AuPVoice* tail; @@ -620,7 +620,7 @@ typedef struct SoundPlayer { /* 0x92 */ s16 coarseTune; /* 0x94 */ s8 fineTune; /* 0x95 */ char unk_05; - /* 0x96 */ u16 currentSoundID; + /* 0x96 */ u16 curSoundID; /* 0x98 */ u8 priority; /* 0x99 */ u8 exclusiveID; /* 0x9A */ u8 sfxParamsFlags; @@ -658,7 +658,7 @@ typedef struct SoundManagerCustomCmdList { typedef struct SoundManager { /* 0x000 */ struct AuGlobals* globals; - /* 0x004 */ struct AuVoice* currentVoice; + /* 0x004 */ struct AuVoice* curVoice; /* 0x008 */ u8* sefData; /* 0x00C */ s32* normalSounds[8]; /* 0x02C */ s32* extraSounds; @@ -681,7 +681,7 @@ typedef struct SoundManager { /* 0x0BC */ u8 priority; /* 0x0BD */ u8 sfxPlayerSelector; /* 0x0BE */ u8 busId; - /* 0x0BF */ u8 currentVoiceIndex; + /* 0x0BF */ u8 curVoiceIndex; /* 0x0C0 */ u8 state; /* 0x0C1 */ char unk_C1[0x1]; /* 0x0C2 */ SoundSFXEntry soundQueue[16]; @@ -701,13 +701,13 @@ typedef struct SoundInstance { /* 0x0C */ u8 volume; /* 0x0D */ u8 pan; /* 0x0E */ s16 pitchShift; - /* 0x10 */ Vec3f position; + /* 0x10 */ Vec3f pos; } SoundInstance; // size = 0x1C typedef struct AlternatingSoundSet { /* 0x00 */ s32* sounds; /* 0x04 */ s16 soundCount; - /* 0x06 */ s16 currentIndex; + /* 0x06 */ s16 curIndex; } AlternatingSoundSet; // size = 0x08 typedef struct AuVoice { diff --git a/src/audio/28910_len_5090.c b/src/audio/28910_len_5090.c index fc5b0070cee..b56c8ca37b3 100644 --- a/src/audio/28910_len_5090.c +++ b/src/audio/28910_len_5090.c @@ -295,7 +295,7 @@ AuResult func_8004DB4C(SongUpdateEvent* s) { if (player->unk_220 == 0) { player->fadeInfo.targetVolume = volume; player->fadeInfo.fadeTime = (duration * 1000) / AU_5750; - player->fadeInfo.fadeStep = ((volume << 0x10) - player->fadeInfo.currentVolume.s32) / player->fadeInfo.fadeTime; + player->fadeInfo.fadeStep = ((volume << 0x10) - player->fadeInfo.curVolume.s32) / player->fadeInfo.fadeTime; player->fadeInfo.variation = s->variation; if (s->unk14 == 1) { player->fadeSongName = songName; @@ -616,9 +616,9 @@ void au_bgm_update_fade(BGMPlayer* player) { player->fadeInfo.fadeTime--; if (player->fadeInfo.fadeTime != 0) { - player->fadeInfo.currentVolume.s32 += player->fadeInfo.fadeStep; + player->fadeInfo.curVolume.s32 += player->fadeInfo.fadeStep; } else { - player->fadeInfo.currentVolume.s32 = player->fadeInfo.targetVolume << 16; + player->fadeInfo.curVolume.s32 = player->fadeInfo.targetVolume << 16; if (player->fadeInfo.onCompleteCallback != NULL) { player->fadeInfo.onCompleteCallback(); @@ -626,7 +626,7 @@ void au_bgm_update_fade(BGMPlayer* player) { if (player->fadeSongName != 0) { func_8004DC80(player->fadeSongName); - } else if (player->fadeInfo.currentVolume.s32 == 0) { + } else if (player->fadeInfo.curVolume.s32 == 0) { au_bgm_stop_player(player); } } @@ -634,7 +634,7 @@ void au_bgm_update_fade(BGMPlayer* player) { } void func_8004E444(BGMPlayer* arg0) { - u16 mult = (arg0->fadeInfo.currentVolume.u16 * arg0->fadeInfo.volScale.u16) >> 15; + u16 mult = (arg0->fadeInfo.curVolume.u16 * arg0->fadeInfo.volScale.u16) >> 15; s32 i; for (i = 0; i < ARRAY_COUNT(arg0->effectIndices); i++) { @@ -1788,7 +1788,7 @@ void au_BGMCmd_FF(BGMPlayer* player, BGMPlayerTrack* track) { for (i = 0; i < ARRAY_COUNT(player->soundManager->bgmSounds); i++) { if ((player->soundManager->bgmSounds[i].unk_0) == 0) { player->soundManager->bgmSounds[i].unk_0 = arg1; - player->soundManager->bgmSounds[i].volume = ((player->fadeInfo.currentVolume.u16 * player->fadeInfo.volScale.u16) + 0x7FFF) >> 0x17; + player->soundManager->bgmSounds[i].volume = ((player->fadeInfo.curVolume.u16 * player->fadeInfo.volScale.u16) + 0x7FFF) >> 0x17; break; } } diff --git a/src/audio/2e230_len_2190.c b/src/audio/2e230_len_2190.c index 48bf51b5e8c..73c051f5c83 100644 --- a/src/audio/2e230_len_2190.c +++ b/src/audio/2e230_len_2190.c @@ -212,7 +212,7 @@ void au_update_clients_2(void) { if (sfxManager->fadeInfo.fadeTime != 0) { au_fade_update(&sfxManager->fadeInfo); - au_fade_set_volume(sfxManager->busId, sfxManager->fadeInfo.currentVolume.u16, sfxManager->busVolume); + au_fade_set_volume(sfxManager->busId, sfxManager->fadeInfo.curVolume.u16, sfxManager->busVolume); } sfxManager->nextUpdateCounter -= sfxManager->nextUpdateStep; @@ -398,12 +398,12 @@ f32 au_compute_pitch_ratio(s32 pitch) { } void au_fade_init(Fade* fade, s32 time, s32 startValue, s32 endValue) { - fade->currentVolume.s32 = startValue * 0x10000; + fade->curVolume.s32 = startValue * 0x10000; fade->targetVolume = endValue; if (time != 0) { fade->fadeTime = (time * 1000) / AU_5750; - fade->fadeStep = (endValue * 0x10000 - fade->currentVolume.s32) / fade->fadeTime; + fade->fadeStep = (endValue * 0x10000 - fade->curVolume.s32) / fade->fadeTime; } else { fade->fadeTime = 1; fade->fadeStep = 0; @@ -422,9 +422,9 @@ void au_fade_update(Fade* fade) { fade->fadeTime--; if ((fade->fadeTime << 0x10) != 0) { - fade->currentVolume.s32 += fade->fadeStep; + fade->curVolume.s32 += fade->fadeStep; } else { - fade->currentVolume.s32 = fade->targetVolume << 0x10; + fade->curVolume.s32 = fade->targetVolume << 0x10; if (fade->onCompleteCallback != NULL) { fade->onCompleteCallback(); fade->fadeStep = 0; @@ -441,7 +441,7 @@ void func_80053AC8(Fade* fade) { if (fade->fadeTime == 0) { fade->fadeTime = 1; fade->fadeStep = 0; - fade->targetVolume = fade->currentVolume.u16; + fade->targetVolume = fade->curVolume.u16; } } diff --git a/src/audio/31650.c b/src/audio/31650.c index 660eb91850e..6dfaadc2ecb 100644 --- a/src/audio/31650.c +++ b/src/audio/31650.c @@ -88,11 +88,11 @@ void au_driver_init(AuSynDriver* driver, ALConfig* config) { fxBus->head = NULL; fxBus->tail = NULL; fxBus->gain = 0x7FFF; - fxBus->currentEffectType = AU_FX_NONE; + fxBus->curEffectType = AU_FX_NONE; fxBus->fxL = alHeapAlloc(heap, 1, sizeof(*fxBus->fxL)); fxBus->fxR = alHeapAlloc(heap, 1, sizeof(*fxBus->fxR)); - func_80058E84(fxBus->fxL, fxBus->currentEffectType, heap); - func_80058E84(fxBus->fxR, fxBus->currentEffectType, heap); + func_80058E84(fxBus->fxL, fxBus->curEffectType, heap); + func_80058E84(fxBus->fxR, fxBus->curEffectType, heap); } gSynDriverPtr->savedMainOut = alHeapAlloc(heap, 2 * AUDIO_SAMPLES, 2); @@ -174,7 +174,7 @@ Acmd* alAudioFrame(Acmd* cmdList, s32* cmdLen, s16* outBuf, s32 outLen) { } while (next != NULL); fxBus->tail = NULL; } - if (fxBus->currentEffectType != AU_FX_NONE) { + if (fxBus->curEffectType != AU_FX_NONE) { cmdListPos = au_pull_fx(fxBus->fxL, cmdListPos, N_AL_AUX_L_OUT, 0); cmdListPos = au_pull_fx(fxBus->fxR, cmdListPos, N_AL_AUX_R_OUT, 0); } @@ -279,7 +279,7 @@ u16 au_bus_get_volume(u8 index, u16 arg1) { void au_bus_set_effect(u8 index, u8 effectType) { AuFxBus* fxBus = &gSynDriverPtr->fxBus[index]; - fxBus->currentEffectType = effectType; + fxBus->curEffectType = effectType; func_8005904C(fxBus->fxL, effectType); func_8005904C(fxBus->fxR, effectType); } diff --git a/src/audio/sfx.c b/src/audio/sfx.c index c341f1fe72e..97f23a97bcb 100644 --- a/src/audio/sfx.c +++ b/src/audio/sfx.c @@ -339,7 +339,7 @@ void sfx_update_env_sound_params(void) { for (i = 0; i < MAX_SOUND_INSTANCES; i++, sound++) { if (sound->flags & SOUND_INSTANCE_FLAG_ACTIVE) { if (sound->flags & SOUND_INSTANCE_FLAG_POSITION_CHANGED) { - sfx_get_spatialized_sound_params(sound->position.x, sound->position.y, sound->position.z, &volume, &pan, sound->sourceFlags); + sfx_get_spatialized_sound_params(sound->pos.x, sound->pos.y, sound->pos.z, &volume, &pan, sound->sourceFlags); sound->volume = volume; sound->pan = pan; } @@ -418,9 +418,9 @@ void sfx_register_looping_sound_at_position(s32 soundID, s32 flags, f32 x, f32 y } sound->sourceFlags = flags; - sound->position.x = x; - sound->position.y = y; - sound->position.z = z; + sound->pos.x = x; + sound->pos.y = y; + sound->pos.z = z; sound->soundID = soundID; sound->flags |= SOUND_INSTANCE_FLAG_ACTIVE | SOUND_INSTANCE_FLAG_POSITION_CHANGED; @@ -435,9 +435,9 @@ s32 sfx_adjust_env_sound_pos(s32 soundID, s32 sourceFlags, f32 x, f32 y, f32 z) } sound->sourceFlags = sourceFlags; - sound->position.x = x; - sound->position.y = y; - sound->position.z = z; + sound->pos.x = x; + sound->pos.y = y; + sound->pos.z = z; sound->soundID = soundID; sound->flags |= SOUND_INSTANCE_FLAG_ACTIVE | SOUND_INSTANCE_FLAG_POSITION_CHANGED; return TRUE; @@ -478,10 +478,10 @@ void sfx_play_sound_with_params(s32 soundID, u8 volume, u8 pan, s16 pitchShift) case SOUND_TYPE_ALTERNATING: // 0xBxxxxxxx alternatingSet = &AlternatingSounds[soundIndex]; - if (alternatingSet->currentIndex >= alternatingSet->soundCount) { - alternatingSet->currentIndex = 0; + if (alternatingSet->curIndex >= alternatingSet->soundCount) { + alternatingSet->curIndex = 0; } - soundID = alternatingSet->sounds[alternatingSet->currentIndex++]; + soundID = alternatingSet->sounds[alternatingSet->curIndex++]; break; } } @@ -520,7 +520,7 @@ void sfx_play_sound(s32 soundID) { void sfx_play_sound_at_player(s32 soundID, s32 flags) { PlayerStatus* playerStatus = &gPlayerStatus; - sfx_play_sound_at_position(soundID, flags, playerStatus->position.x, playerStatus->position.y, playerStatus->position.z); + sfx_play_sound_at_position(soundID, flags, playerStatus->pos.x, playerStatus->pos.y, playerStatus->pos.z); } void sfx_play_sound_at_npc(s32 soundID, s32 flags, s32 npcID) { diff --git a/src/audio/sfx_player.c b/src/audio/sfx_player.c index da3f5fa05e0..9a6fb2855e7 100644 --- a/src/audio/sfx_player.c +++ b/src/audio/sfx_player.c @@ -480,7 +480,7 @@ void au_sfx_init(SoundManager* manager, u8 priority, u8 busId, AuGlobals* global au_sfx_set_state(manager, SND_MANAGER_STATE_ENABLED); au_sfx_clear_queue(manager); au_fade_init(&manager->fadeInfo, 0, 0x7FFF, 0x7FFF); - au_fade_set_volume(manager->busId, manager->fadeInfo.currentVolume.u16, manager->busVolume); + au_fade_set_volume(manager->busId, manager->fadeInfo.curVolume.u16, manager->busVolume); manager->lastCustomEffectIdx = 0xFF; manager->customReverbParams[0] = CUSTOM_SMALL_ROOM_PARAMS; @@ -589,7 +589,7 @@ void au_sfx_update_main(SoundManager* manager) { u16 sound2 = unkData->sound2; if (sound2 != 0) { for (j = 0; j < ARRAY_COUNT(manager->players); j++) { - if (manager->players[j].currentSoundID == sound2) { + if (manager->players[j].curSoundID == sound2) { newEntry.soundID = unkData->sound1; newEntry.upperSoundID = 0; newEntry.pitchShift = 0; @@ -718,7 +718,7 @@ void au_sfx_load_sound(SoundManager* manager, SoundSFXEntry* entry, SoundManager // check if any player is playing this sound for (playerIndex = 7; playerIndex >= 0; playerIndex--) { player = &manager->players[playerIndex]; - if (player->currentSoundID == soundIDLower) { + if (player->curSoundID == soundIDLower) { cond = TRUE; break; } @@ -755,7 +755,7 @@ void au_sfx_load_sound(SoundManager* manager, SoundSFXEntry* entry, SoundManager // check if any player is playing this sound for (playerIndex = 7; playerIndex >= 0; playerIndex--) { player = &manager->players[playerIndex]; - if (player->currentSoundID == soundIDLower) { + if (player->curSoundID == soundIDLower) { cond = TRUE; break; } @@ -796,7 +796,7 @@ void au_sfx_load_sound(SoundManager* manager, SoundSFXEntry* entry, SoundManager if (entry->upperSoundID != 0) { for (playerIndex = 0; playerIndex < 8; playerIndex++) { player = &manager->players[playerIndex]; - if (player->currentSoundID == entry->upperSoundID) { + if (player->curSoundID == entry->upperSoundID) { cond = TRUE; break; } @@ -819,7 +819,7 @@ void au_sfx_load_sound(SoundManager* manager, SoundSFXEntry* entry, SoundManager // check if any player is playing this sound for (playerIndex = soundInfo & 0x7; playerIndex >= 0; playerIndex--) { player = &manager->players[playerIndex]; - if (player->currentSoundID == soundIDLower) { + if (player->curSoundID == soundIDLower) { cond = TRUE; break; } @@ -955,7 +955,7 @@ static void au_sfx_play_sound(SoundManager* manager, SoundPlayer* player, s8* re player->loopIterCount = 0; player->delay = 1; player->playLength = 0; - player->currentSoundID = sfxEntry->soundID & SOUND_ID_LOWER; + player->curSoundID = sfxEntry->soundID & SOUND_ID_LOWER; player->priority = priority; player->exclusiveID = exclusiveID; player->envelopCustomPressProfile = NULL; @@ -1004,7 +1004,7 @@ static void au_sfx_set_triggers(SoundManager* manager, u32 soundID) { for (i = 0; i < ARRAY_COUNT(manager->players); i++) { SoundPlayer* player = &manager->players[i]; - if (player->currentSoundID == (soundID & SOUND_ID_LOWER)) { + if (player->curSoundID == (soundID & SOUND_ID_LOWER)) { player->triggers = triggers; } } @@ -1015,7 +1015,7 @@ static void au_sfx_stop_by_id(SoundManager* manager, u32 soundID) { for (i = 0; i < ARRAY_COUNT(manager->players); i++) { SoundPlayer* player = &manager->players[i]; - if (player->currentSoundID == (soundID & SOUND_ID_LOWER)) { + if (player->curSoundID == (soundID & SOUND_ID_LOWER)) { player->sefDataReadPos = BlankSEFData; player->alternativeDataPos = NULL; player->sfxParamsFlags = SFX_PARAM_MODE_SEQUENCE; @@ -1050,7 +1050,7 @@ static void au_sfx_set_modifiers(SoundManager* manager, SoundSFXEntry* sfxEntry) for (i = 0; i < ARRAY_COUNT(manager->players); i++) { SoundPlayer* player = &manager->players[i]; - if (player->currentSoundID == soundID) { + if (player->curSoundID == soundID) { au_sfx_set_player_modifiers(player, sfxEntry); } } @@ -1092,9 +1092,9 @@ s16 au_sfx_manager_update(SoundManager* manager) { player = &manager->players[i - manager->sfxPlayerSelector]; if (player->sefDataReadPos != NULL) { voice = &manager->globals->voices[i]; - manager->currentVoice = voice; + manager->curVoice = voice; if (voice->priority <= manager->priority) { - manager->currentVoiceIndex = i; + manager->curVoiceIndex = i; switch (player->sfxParamsFlags & SFX_PARAM_FLAG_MODE) { case SFX_PARAM_MODE_ADVANCED: au_sfx_update_basic(manager, player, voice, i); @@ -1107,7 +1107,7 @@ s16 au_sfx_manager_update(SoundManager* manager) { } } else { player->sefDataReadPos = NULL; - player->currentSoundID = 0; + player->curSoundID = 0; player->priority = 0; } } @@ -1126,7 +1126,7 @@ static void au_sfx_update_basic(SoundManager* manager, SoundPlayer* player, AuVo case SND_PLAYER_STATE_CONTINUE: if (voice->priority != manager->priority) { player->sefDataReadPos = NULL; - player->currentSoundID = 0; + player->curSoundID = 0; player->priority = 0; } else { if (!(player->sfxParamsFlags & SFX_PARAM_FLAG_PITCH)) { @@ -1198,7 +1198,7 @@ static void au_sfx_update_basic(SoundManager* manager, SoundPlayer* player, AuVo break; default: player->sefDataReadPos = NULL; - player->currentSoundID = 0; + player->curSoundID = 0; player->priority = 0; break; } @@ -1253,7 +1253,7 @@ static void au_sfx_update_sequence(SoundManager* manager, SoundPlayer* player, A au_reset_voice(voice, voiceIdx); } player->sefDataReadPos = NULL; - player->currentSoundID = 0; + player->curSoundID = 0; player->priority = 0; player->exclusiveID = 0; return; @@ -1513,7 +1513,7 @@ static void au_SEFCmd_06_FineTune(SoundManager* manager, SoundPlayer* player) { } static void au_SEFCmd_07_WaitForEnd(SoundManager* manager, SoundPlayer* player) { - if (manager->currentVoice->priority == manager->priority) { + if (manager->curVoice->priority == manager->priority) { player->delay = 2; player->sefDataReadPos--; } @@ -1614,9 +1614,9 @@ static void au_SEFCmd_0E_SetAlternativeSound(SoundManager* manager, SoundPlayer* } static void au_SEFCmd_0F_Stop(SoundManager* manager, SoundPlayer* player) { - AuVoice* voice = manager->currentVoice; + AuVoice* voice = manager->curVoice; if (voice->priority == manager->priority) { - au_reset_voice(voice, manager->currentVoiceIndex); + au_reset_voice(voice, manager->curVoiceIndex); } } diff --git a/src/background.c b/src/background.c index 417315ee2e2..385df379ab3 100644 --- a/src/background.c +++ b/src/background.c @@ -175,7 +175,7 @@ void appendGfx_background_texture(void) { } } - theta = clamp_angle(-cam->trueRotation.x); + theta = clamp_angle(-cam->trueRot.x); sinTheta = sin_deg(theta); cosTheta = cos_deg(theta); f5 = cosTheta * cam->lookAt_obj.x - sinTheta * cam->lookAt_obj.z + cam->leadAmount; diff --git a/src/battle/action_cmd/07.c b/src/battle/action_cmd/07.c index a31bcb3a830..fe80c8ccfab 100644 --- a/src/battle/action_cmd/07.c +++ b/src/battle/action_cmd/07.c @@ -139,7 +139,7 @@ void N(update)(void) { case 11: btl_set_popup_duration(99); - if (battleStatus->currentButtonsPressed & BUTTON_A) { + if (battleStatus->curButtonsPressed & BUTTON_A) { s32 fillAmt = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 6; if (actionCommandStatus->unk_5D == 0) { diff --git a/src/battle/action_cmd/0A.c b/src/battle/action_cmd/0A.c index b90b1ad4b8e..f8c296fb8c5 100644 --- a/src/battle/action_cmd/0A.c +++ b/src/battle/action_cmd/0A.c @@ -106,7 +106,7 @@ void N(update)(void) { case 11: btl_set_popup_duration(99); - if (battleStatus->currentButtonsPressed & BUTTON_A) { + if (battleStatus->curButtonsPressed & BUTTON_A) { actionCommandStatus->barFillLevel += battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 15; } diff --git a/src/battle/action_cmd/air_lift.c b/src/battle/action_cmd/air_lift.c index 532461665ce..914e6edefa2 100644 --- a/src/battle/action_cmd/air_lift.c +++ b/src/battle/action_cmd/air_lift.c @@ -157,7 +157,7 @@ void N(update)(void) { } } - if (battleStatus->actionCommandMode != ACTION_COMMAND_MODE_NOT_LEARNED && (battleStatus->currentButtonsPressed & BUTTON_A)) { + if (battleStatus->actionCommandMode != ACTION_COMMAND_MODE_NOT_LEARNED && (battleStatus->curButtonsPressed & BUTTON_A)) { if (actionCommandStatus->unk_5A != 0) { s32 a = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty]; s32 b = actionCommandStatus->unk_5A * 820; diff --git a/src/battle/action_cmd/air_raid.c b/src/battle/action_cmd/air_raid.c index fff5c36f40e..1dc158781c5 100644 --- a/src/battle/action_cmd/air_raid.c +++ b/src/battle/action_cmd/air_raid.c @@ -129,18 +129,18 @@ void N(update)(void) { } if (!actionCommandStatus->isBarFilled) { - if (battleStatus->currentButtonsDown & BUTTON_STICK_LEFT) { + if (battleStatus->curButtonsDown & BUTTON_STICK_LEFT) { actionCommandStatus->unk_5C = 1; } - if (!(battleStatus->currentButtonsDown & BUTTON_STICK_LEFT)) { + if (!(battleStatus->curButtonsDown & BUTTON_STICK_LEFT)) { if (actionCommandStatus->unk_5C != 0) { actionCommandStatus->barFillLevel += (battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 850) / 100; actionCommandStatus->unk_5C = 0; } } - if (battleStatus->currentButtonsPressed & BUTTON_STICK_RIGHT) { + if (battleStatus->curButtonsPressed & BUTTON_STICK_RIGHT) { actionCommandStatus->barFillLevel -= (battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 850) / 100; } } diff --git a/src/battle/action_cmd/body_slam.c b/src/battle/action_cmd/body_slam.c index da57bdfe819..9aeb3e2e4ca 100644 --- a/src/battle/action_cmd/body_slam.c +++ b/src/battle/action_cmd/body_slam.c @@ -120,7 +120,7 @@ void N(update)(void) { case 11: btl_set_popup_duration(99); - if (battleStatus->currentButtonsDown & BUTTON_A) { + if (battleStatus->curButtonsDown & BUTTON_A) { actionCommandStatus->barFillLevel += 154; actionCommandStatus->thresholdLevel += 154; } else { diff --git a/src/battle/action_cmd/bomb.c b/src/battle/action_cmd/bomb.c index 5602720899c..d9b9454eaf2 100644 --- a/src/battle/action_cmd/bomb.c +++ b/src/battle/action_cmd/bomb.c @@ -120,7 +120,7 @@ void N(update)(void) { } } - if (battleStatus->currentButtonsPressed & BUTTON_A) { + if (battleStatus->curButtonsPressed & BUTTON_A) { switch (actionCommandStatus->targetWeakness) { case 0: { s32 fillOffset = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 235 * 4; diff --git a/src/battle/action_cmd/dizzy_shell.c b/src/battle/action_cmd/dizzy_shell.c index 97c83159b8c..ba69d789b8b 100644 --- a/src/battle/action_cmd/dizzy_shell.c +++ b/src/battle/action_cmd/dizzy_shell.c @@ -120,7 +120,7 @@ void N(update)(void) { } } - if (battleStatus->currentButtonsPressed & BUTTON_A) { + if (battleStatus->curButtonsPressed & BUTTON_A) { s32 a = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty]; s32 b = actionCommandStatus->targetWeakness * 850; s32 temp_v1_2 = (a * b) / 10000; diff --git a/src/battle/action_cmd/fire_shell.c b/src/battle/action_cmd/fire_shell.c index 768ded9a5e3..a2bc4054de8 100644 --- a/src/battle/action_cmd/fire_shell.c +++ b/src/battle/action_cmd/fire_shell.c @@ -118,16 +118,16 @@ void N(update)(void) { actionCommandStatus->barFillLevel = 0; } if (!actionCommandStatus->isBarFilled) { - if (battleStatus->currentButtonsDown & BUTTON_STICK_LEFT) { + if (battleStatus->curButtonsDown & BUTTON_STICK_LEFT) { actionCommandStatus->unk_5C = 1; } - if (!(battleStatus->currentButtonsDown & BUTTON_STICK_LEFT) && (actionCommandStatus->unk_5C != 0)) { + if (!(battleStatus->curButtonsDown & BUTTON_STICK_LEFT) && (actionCommandStatus->unk_5C != 0)) { actionCommandStatus->barFillLevel += (battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 950) / 100; actionCommandStatus->unk_5C = 0; } - if (battleStatus->currentButtonsPressed & BUTTON_STICK_RIGHT) { + if (battleStatus->curButtonsPressed & BUTTON_STICK_RIGHT) { actionCommandStatus->barFillLevel -= (battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 950) / 100; } } diff --git a/src/battle/action_cmd/flee.c b/src/battle/action_cmd/flee.c index 4fdee1b0871..d9a804c965f 100644 --- a/src/battle/action_cmd/flee.c +++ b/src/battle/action_cmd/flee.c @@ -142,7 +142,7 @@ void N(update)(void) { actionCommandStatus->state = 11; actionCommandStatus->frameCounter = actionCommandStatus->duration; case 11: - if (battleStatus->actionCommandMode != ACTION_COMMAND_MODE_NOT_LEARNED && (battleStatus->currentButtonsPressed & BUTTON_A)) { + if (battleStatus->actionCommandMode != ACTION_COMMAND_MODE_NOT_LEARNED && (battleStatus->curButtonsPressed & BUTTON_A)) { actionCommandStatus->barFillLevel += (battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 180 / 100); } if (actionCommandStatus->barFillLevel >= 10000) { diff --git a/src/battle/action_cmd/hammer.c b/src/battle/action_cmd/hammer.c index cb0378cf8f0..a486b5c8ffe 100644 --- a/src/battle/action_cmd/hammer.c +++ b/src/battle/action_cmd/hammer.c @@ -196,7 +196,7 @@ void N(update)(void) { } actionCommandStatus->frameCounter = 0; - if (!(battleStatus->currentButtonsDown & BUTTON_STICK_LEFT) && battleStatus->actionCommandMode < ACTION_COMMAND_MODE_TUTORIAL) { + if (!(battleStatus->curButtonsDown & BUTTON_STICK_LEFT) && battleStatus->actionCommandMode < ACTION_COMMAND_MODE_TUTORIAL) { actionCommandStatus->hammerMissedStart = TRUE; } actionCommandStatus->state = 11; @@ -254,7 +254,7 @@ void N(update)(void) { phi_s0 = 0; } - if (!(battleStatus->currentButtonsDown & BUTTON_STICK_LEFT) && + if (!(battleStatus->curButtonsDown & BUTTON_STICK_LEFT) && phi_s0 == 0 && actionCommandStatus->autoSucceed == 0 && battleStatus->actionCommandMode < ACTION_COMMAND_MODE_TUTORIAL) diff --git a/src/battle/action_cmd/jump.c b/src/battle/action_cmd/jump.c index 823d30f2185..74da9797597 100644 --- a/src/battle/action_cmd/jump.c +++ b/src/battle/action_cmd/jump.c @@ -123,7 +123,7 @@ void N(update)(void) { if (((actionCommandStatus->prepareTime - temp_s0_3) - 2) <= 0) { hud_element_set_script(actionCommandStatus->hudElements[0], &HES_AButtonDown); } - if ((battleStatus->currentButtonsPressed & BUTTON_A) && (actionCommandStatus->autoSucceed == 0)) { + if ((battleStatus->curButtonsPressed & BUTTON_A) && (actionCommandStatus->autoSucceed == 0)) { actionCommandStatus->wrongButtonPressed = TRUE; battleStatus->unk_86 = -1; } @@ -153,7 +153,7 @@ void N(update)(void) { } if (battleStatus->actionSuccess < 0) { - if (((battleStatus->currentButtonsPressed & BUTTON_A)&& + if (((battleStatus->curButtonsPressed & BUTTON_A)&& !actionCommandStatus->wrongButtonPressed) || (actionCommandStatus->autoSucceed != 0)) { battleStatus->actionSuccess = 1; diff --git a/src/battle/action_cmd/power_shock.c b/src/battle/action_cmd/power_shock.c index 4182a117357..799da1d7f8f 100644 --- a/src/battle/action_cmd/power_shock.c +++ b/src/battle/action_cmd/power_shock.c @@ -181,7 +181,7 @@ void N(update)(void) { } } - if (battleStatus->currentButtonsPressed & BUTTON_A) { + if (battleStatus->curButtonsPressed & BUTTON_A) { phi_a1 = actionCommandStatus->targetWeakness; if (phi_a1 != 0) { s32 a = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty]; diff --git a/src/battle/action_cmd/smack.c b/src/battle/action_cmd/smack.c index 123658b4f36..0e42b480579 100644 --- a/src/battle/action_cmd/smack.c +++ b/src/battle/action_cmd/smack.c @@ -151,11 +151,11 @@ void N(update)(void) { } if (!actionCommandStatus->isBarFilled) { - if (battleStatus->currentButtonsDown & BUTTON_STICK_LEFT) { + if (battleStatus->curButtonsDown & BUTTON_STICK_LEFT) { actionCommandStatus->unk_5C = TRUE; } - if (!(battleStatus->currentButtonsDown & BUTTON_STICK_LEFT) && actionCommandStatus->unk_5C) { + if (!(battleStatus->curButtonsDown & BUTTON_STICK_LEFT) && actionCommandStatus->unk_5C) { if (actionCommandStatus->targetWeakness == 0) { actionCommandStatus->barFillLevel += battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 13; } else { @@ -165,7 +165,7 @@ void N(update)(void) { actionCommandStatus->unk_5C = 0; } - if (battleStatus->currentButtonsPressed & BUTTON_STICK_RIGHT) { + if (battleStatus->curButtonsPressed & BUTTON_STICK_RIGHT) { actionCommandStatus->barFillLevel -= battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 11; } } diff --git a/src/battle/action_cmd/spiny_surge.c b/src/battle/action_cmd/spiny_surge.c index 0f2123587d1..722871c3f1f 100644 --- a/src/battle/action_cmd/spiny_surge.c +++ b/src/battle/action_cmd/spiny_surge.c @@ -156,10 +156,10 @@ void N(update)(void) { } if (!actionCommandStatus->isBarFilled) { - if (battleStatus->currentButtonsPressed & BUTTON_STICK_LEFT) { + if (battleStatus->curButtonsPressed & BUTTON_STICK_LEFT) { actionCommandStatus->barFillLevel += (battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 1250) / 100; } - if (battleStatus->currentButtonsPressed & BUTTON_STICK_RIGHT) { + if (battleStatus->curButtonsPressed & BUTTON_STICK_RIGHT) { actionCommandStatus->barFillLevel -= (battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 1250) / 100; } } @@ -185,13 +185,13 @@ void N(update)(void) { } if (!(D_802A98C0 & BUTTON_STICK_LEFT) && - !(battleStatus->currentButtonsDown & BUTTON_STICK_RIGHT) && + !(battleStatus->curButtonsDown & BUTTON_STICK_RIGHT) && actionCommandStatus->unk_5C == 1) { actionCommandStatus->unk_5C = 2; } battleStatus->actionSuccess = actionCommandStatus->barFillLevel / 100; - D_802A98C0 = battleStatus->currentButtonsDown; + D_802A98C0 = battleStatus->curButtonsDown; battleStatus->actionResult = actionCommandStatus->unk_5C; sfx_adjust_env_sound_params(SOUND_80000041, 0, 0, battleStatus->actionSuccess * 12); diff --git a/src/battle/action_cmd/spook.c b/src/battle/action_cmd/spook.c index 30c703e3d82..a05a75b81ac 100644 --- a/src/battle/action_cmd/spook.c +++ b/src/battle/action_cmd/spook.c @@ -124,11 +124,11 @@ void N(update)(void) { if (!actionCommandStatus->isBarFilled) { if (actionCommandStatus->targetWeakness != 0) { - if (battleStatus->currentButtonsDown & BUTTON_STICK_LEFT) { + if (battleStatus->curButtonsDown & BUTTON_STICK_LEFT) { actionCommandStatus->unk_5C = TRUE; } - if (!(battleStatus->currentButtonsDown & BUTTON_STICK_LEFT) && actionCommandStatus->unk_5C) { + if (!(battleStatus->curButtonsDown & BUTTON_STICK_LEFT) && actionCommandStatus->unk_5C) { s32 a = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty]; s32 b = actionCommandStatus->targetWeakness * 850; @@ -136,18 +136,18 @@ void N(update)(void) { actionCommandStatus->unk_5C = 0; } - if (battleStatus->currentButtonsPressed & BUTTON_STICK_RIGHT) { + if (battleStatus->curButtonsPressed & BUTTON_STICK_RIGHT) { s32 a = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty]; s32 b = actionCommandStatus->targetWeakness * 850; actionCommandStatus->barFillLevel -= (a * b) / 10000; } } else { - if (battleStatus->currentButtonsDown & BUTTON_STICK_LEFT) { + if (battleStatus->curButtonsDown & BUTTON_STICK_LEFT) { actionCommandStatus->unk_5C = TRUE; } - if (!(battleStatus->currentButtonsDown & BUTTON_STICK_LEFT) && actionCommandStatus->unk_5C) { + if (!(battleStatus->curButtonsDown & BUTTON_STICK_LEFT) && actionCommandStatus->unk_5C) { actionCommandStatus->barFillLevel += 100; if (actionCommandStatus->barFillLevel >= 500) { actionCommandStatus->barFillLevel = 500; @@ -155,7 +155,7 @@ void N(update)(void) { actionCommandStatus->unk_5C = 0; } - if (battleStatus->currentButtonsPressed & BUTTON_STICK_RIGHT) { + if (battleStatus->curButtonsPressed & BUTTON_STICK_RIGHT) { actionCommandStatus->barFillLevel -= 100; } } diff --git a/src/battle/action_cmd/squirt.c b/src/battle/action_cmd/squirt.c index c5b0a6e605e..f831f2d8326 100644 --- a/src/battle/action_cmd/squirt.c +++ b/src/battle/action_cmd/squirt.c @@ -131,7 +131,7 @@ void N(update)(void) { cutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals]; temp = actionCommandStatus->barFillLevel / cutoff; if (actionCommandStatus->unk_5C == 0) { - if (!(battleStatus->currentButtonsDown & BUTTON_A)) { + if (!(battleStatus->curButtonsDown & BUTTON_A)) { actionCommandStatus->barFillLevel -= D_802A9760_42A480[temp / 20]; if (actionCommandStatus->barFillLevel < 0) { actionCommandStatus->barFillLevel = 0; diff --git a/src/battle/action_cmd/stop_leech.c b/src/battle/action_cmd/stop_leech.c index abf09f3b68e..be1402bd460 100644 --- a/src/battle/action_cmd/stop_leech.c +++ b/src/battle/action_cmd/stop_leech.c @@ -110,7 +110,7 @@ void N(update)(void) { case 11: btl_set_popup_duration(99); if (!actionCommandStatus->berserkerEnabled) { - if (battleStatus->currentButtonsPressed & BUTTON_A) { + if (battleStatus->curButtonsPressed & BUTTON_A) { actionCommandStatus->barFillLevel += battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty]; } } else { diff --git a/src/battle/action_cmd/whirlwind.c b/src/battle/action_cmd/whirlwind.c index 7f4e70c95d0..0433dc676c4 100644 --- a/src/battle/action_cmd/whirlwind.c +++ b/src/battle/action_cmd/whirlwind.c @@ -222,7 +222,7 @@ void N(update)(void) { } if (!actionCommandStatus->berserkerEnabled) { - if (battleStatus->currentButtonsPressed & BUTTON_A) { + if (battleStatus->curButtonsPressed & BUTTON_A) { s32 amt; if (actionCommandStatus->targetWeakness == 0) { diff --git a/src/battle/area/dig/script/dig_01.c b/src/battle/area/dig/script/dig_01.c index 226a08e0ce4..dfde3ff4d61 100644 --- a/src/battle/area/dig/script/dig_01.c +++ b/src/battle/area/dig/script/dig_01.c @@ -12,7 +12,7 @@ API_CALLABLE(N(SetupDemoPlayerMove)) { battleStatus->moveCategory = BTL_MENU_TYPE_SMASH; battleStatus->selectedMoveID = MOVE_HAMMER1; battleStatus->moveArgument = gCurrentEncounter.hitTier; - battleStatus->currentTargetListFlags = gMoveTable[MOVE_HAMMER1].flags; + battleStatus->curTargetListFlags = gMoveTable[MOVE_HAMMER1].flags; player_create_target_list(player); player->selectedTargetIndex = 0; diff --git a/src/battle/area/dig/script/dig_02.c b/src/battle/area/dig/script/dig_02.c index 778a07cb781..b8635718438 100644 --- a/src/battle/area/dig/script/dig_02.c +++ b/src/battle/area/dig/script/dig_02.c @@ -10,7 +10,7 @@ API_CALLABLE(N(SetupDemoPlayerMove)) { battleStatus->moveCategory = BTL_MENU_TYPE_JUMP; battleStatus->selectedMoveID = MOVE_POWER_BOUNCE; battleStatus->moveArgument = gCurrentEncounter.hitTier; - battleStatus->currentTargetListFlags = gMoveTable[MOVE_POWER_BOUNCE].flags; + battleStatus->curTargetListFlags = gMoveTable[MOVE_POWER_BOUNCE].flags; player_create_target_list(player); player->selectedTargetIndex = 1; diff --git a/src/battle/area/dig/script/dig_03.c b/src/battle/area/dig/script/dig_03.c index 647a48a7f71..1a319996479 100644 --- a/src/battle/area/dig/script/dig_03.c +++ b/src/battle/area/dig/script/dig_03.c @@ -10,7 +10,7 @@ API_CALLABLE(N(SetupDemoPlayerMove)) { battleStatus->moveCategory = BTL_MENU_TYPE_ABILITY; battleStatus->moveArgument = 0; battleStatus->selectedMoveID = MOVE_SHELL_SHOT; - battleStatus->currentTargetListFlags = gMoveTable[MOVE_SHELL_SHOT].flags; + battleStatus->curTargetListFlags = gMoveTable[MOVE_SHELL_SHOT].flags; player_create_target_list(partner); partner->selectedTargetIndex = 0; diff --git a/src/battle/area/dig/script/dig_04.c b/src/battle/area/dig/script/dig_04.c index 3a67d2e79d3..f2d4af2aa56 100644 --- a/src/battle/area/dig/script/dig_04.c +++ b/src/battle/area/dig/script/dig_04.c @@ -13,9 +13,9 @@ API_CALLABLE(N(SetupDemoPlayerMove)) { battleStatus->moveArgument = ITEM_THUNDER_RAGE; selectedItemID = battleStatus->moveArgument; battleStatus->selectedMoveID = 0; - battleStatus->currentAttackElement = 0; + battleStatus->curAttackElement = 0; playerData->invItems[0] = selectedItemID; - battleStatus->currentTargetListFlags = gItemTable[playerData->invItems[0]].targetFlags | TARGET_FLAG_8000; + battleStatus->curTargetListFlags = gItemTable[playerData->invItems[0]].targetFlags | TARGET_FLAG_8000; player_create_target_list(player); player->selectedTargetIndex = 0; diff --git a/src/battle/area/hos/actor/goombario_tutor.c b/src/battle/area/hos/actor/goombario_tutor.c index 1789274b5b9..aa110975de1 100644 --- a/src/battle/area/hos/actor/goombario_tutor.c +++ b/src/battle/area/hos/actor/goombario_tutor.c @@ -281,7 +281,7 @@ EvtScript N(takeTurn_80219444) = { API_CALLABLE(func_80218000_47F0B0) { PlayerData* playerData = &gPlayerData; - playerData->currentPartner = PARTNER_GOOMBARIO; + playerData->curPartner = PARTNER_GOOMBARIO; return ApiStatus_DONE2; } diff --git a/src/battle/area/kkj/actor/kammy_koopa.c b/src/battle/area/kkj/actor/kammy_koopa.c index 6f9e3bbdc52..3f80b5ae3c5 100644 --- a/src/battle/area/kkj/actor/kammy_koopa.c +++ b/src/battle/area/kkj/actor/kammy_koopa.c @@ -190,7 +190,7 @@ API_CALLABLE(N(BlockAppear)) { entity->scale.x = (60 - script->functionTemp[1]) / 60.0f; entity->scale.y = (60 - script->functionTemp[1]) / 60.0f; entity->scale.z = (60 - script->functionTemp[1]) / 60.0f; - entity->rotation.y = (1.0f - cos_rad(entity->scale.y * PI)) * 1080.0f * 0.5f; + entity->rot.y = (1.0f - cos_rad(entity->scale.y * PI)) * 1080.0f * 0.5f; script->functionTemp[1]--; if (script->functionTemp[1] == -1) { diff --git a/src/battle/area/kzn2/actor/lava_piranha.c b/src/battle/area/kzn2/actor/lava_piranha.c index 200bd51c24b..b929a05d4c0 100644 --- a/src/battle/area/kzn2/actor/lava_piranha.c +++ b/src/battle/area/kzn2/actor/lava_piranha.c @@ -521,7 +521,7 @@ void N(worker_render_piranha_vines)(void) { renderTask.appendGfx = &func_8021835C_59EA3C; renderTask.appendGfxArg = 0; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_SURFACE_OPA; queue_render_task(&renderTask); diff --git a/src/battle/area/mac/actor/lee.c b/src/battle/area/mac/actor/lee.c index eae8c6ebdf2..39b36db4520 100644 --- a/src/battle/area/mac/actor/lee.c +++ b/src/battle/area/mac/actor/lee.c @@ -2892,8 +2892,8 @@ API_CALLABLE(func_80219188_465618) { wattEffectData->angle = 0; wattEffectData->unk_0C = TRUE; wattEffectData->unk_10 = 0; - wattEffectData->effect1 = fx_static_status(0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z, (actor->debuff != STATUS_KEY_SHRINK) ? 1.0f : 0.4f, 5, 0); - wattEffectData->effect2 = fx_static_status(1, actor->currentPos.x, NPC_DISPOSE_POS_Y, actor->currentPos.z, (actor->debuff != STATUS_KEY_SHRINK) ? 1.0f : 0.4f, 5, 0); + wattEffectData->effect1 = fx_static_status(0, actor->curPos.x, actor->curPos.y, actor->curPos.z, (actor->debuff != STATUS_KEY_SHRINK) ? 1.0f : 0.4f, 5, 0); + wattEffectData->effect2 = fx_static_status(1, actor->curPos.x, NPC_DISPOSE_POS_Y, actor->curPos.z, (actor->debuff != STATUS_KEY_SHRINK) ? 1.0f : 0.4f, 5, 0); wattEffectData->flags = TRUE; wattEffectData->debuff = actor->debuff; } @@ -2906,9 +2906,9 @@ API_CALLABLE(func_80219188_465618) { } actor->verticalRenderOffset = sin_rad(DEG_TO_RAD(wattEffectData->angle)) * 3.0f; - x = actor->currentPos.x + actor->headOffset.x; - y = actor->currentPos.y + actor->headOffset.y + actor->verticalRenderOffset + (actor->debuff != STATUS_KEY_SHRINK ? 12.0 : 4.800000000000001); // 4.8 doesn't match - z = actor->currentPos.z + actor->headOffset.z; + x = actor->curPos.x + actor->headOffset.x; + y = actor->curPos.y + actor->headOffset.y + actor->verticalRenderOffset + (actor->debuff != STATUS_KEY_SHRINK ? 12.0 : 4.800000000000001); // 4.8 doesn't match + z = actor->curPos.z + actor->headOffset.z; if (wattEffectData->unk_0C) { switch (wattEffectData->unk_10) { case 0: @@ -4119,8 +4119,8 @@ Formation N(formation_lakilester) = { API_CALLABLE(func_802197B8_465C48) { Bytecode* args = script->ptrReadPos; - evt_set_variable(script, *args++, gPlayerData.currentPartner); - evt_set_variable(script, *args++, gPlayerData.partners[gPlayerData.currentPartner].level); + evt_set_variable(script, *args++, gPlayerData.curPartner); + evt_set_variable(script, *args++, gPlayerData.partners[gPlayerData.curPartner].level); return ApiStatus_DONE2; } diff --git a/src/battle/area/omo3/actor/big_lantern_ghost.c b/src/battle/area/omo3/actor/big_lantern_ghost.c index 3e8aef13f91..c146b5360fd 100644 --- a/src/battle/area/omo3/actor/big_lantern_ghost.c +++ b/src/battle/area/omo3/actor/big_lantern_ghost.c @@ -191,16 +191,16 @@ API_CALLABLE(N(update_effect)) { effectData = effect->data.bulbGlow; } - posX = actor->currentPos.x; - posY = actor->currentPos.y; - posZ = actor->currentPos.z; + posX = actor->curPos.x; + posY = actor->curPos.y; + posZ = actor->curPos.z; - rotX = actor->rotation.x; - rotY = actor->rotation.y + actor->yaw; - rotZ = actor->rotation.z; + rotX = actor->rot.x; + rotY = actor->rot.y + actor->yaw; + rotZ = actor->rot.z; actorPart = get_actor_part(actor, 1); - if (actorPart->currentAnimation == ANIM_BigLanternGhost_Anim0C) { + if (actorPart->curAnimation == ANIM_BigLanternGhost_Anim0C) { spr_get_comp_position(actor->partsTable->spriteInstanceID, 0, &partX, &partY, &partZ); } else { spr_get_comp_position(actor->partsTable->spriteInstanceID, 1, &partX, &partY, &partZ); diff --git a/src/battle/area/pra2/actor/crystal_bit.c b/src/battle/area/pra2/actor/crystal_bit.c index 2f1881026ba..025551ed99d 100644 --- a/src/battle/area/pra2/actor/crystal_bit.c +++ b/src/battle/area/pra2/actor/crystal_bit.c @@ -229,13 +229,13 @@ API_CALLABLE(UpdateCrystalBitEffect) { effect->data.miscParticles->scaleX = actorPart->scale.x * 24.0f; effect->data.miscParticles->scaleY = actorPart->scale.y * 24.0f; if (actorPart->flags & ACTOR_PART_FLAG_INVISIBLE) { - effect->data.miscParticles->pos.x = actor->currentPos.x; + effect->data.miscParticles->pos.x = actor->curPos.x; effect->data.miscParticles->pos.y = NPC_DISPOSE_POS_Y; - effect->data.miscParticles->pos.z = actor->currentPos.z; + effect->data.miscParticles->pos.z = actor->curPos.z; } else { - effect->data.miscParticles->pos.x = actor->currentPos.x; - effect->data.miscParticles->pos.y = actor->currentPos.y; - effect->data.miscParticles->pos.z = actor->currentPos.z; + effect->data.miscParticles->pos.x = actor->curPos.x; + effect->data.miscParticles->pos.y = actor->curPos.y; + effect->data.miscParticles->pos.z = actor->curPos.z; } return ApiStatus_BLOCK; diff --git a/src/battle/area/trd_part_2/actor/common_koopa_bros.inc.c b/src/battle/area/trd_part_2/actor/common_koopa_bros.inc.c index 6ce17336964..e2f530b95b2 100644 --- a/src/battle/area/trd_part_2/actor/common_koopa_bros.inc.c +++ b/src/battle/area/trd_part_2/actor/common_koopa_bros.inc.c @@ -156,9 +156,9 @@ API_CALLABLE(N(SpawnSpinEffect)) { s32 posZ = evt_get_variable(script, *args++); s32 duration = evt_get_variable(script, *args++); - N(DummyPlayerStatus).position.x = posX; - N(DummyPlayerStatus).position.y = posY - 10.0f; - N(DummyPlayerStatus).position.z = posZ; + N(DummyPlayerStatus).pos.x = posX; + N(DummyPlayerStatus).pos.y = posY - 10.0f; + N(DummyPlayerStatus).pos.z = posZ; fx_effect_46(6, &N(DummyPlayerStatus), 1.0f, duration); return ApiStatus_DONE2; diff --git a/src/battle/battle.c b/src/battle/battle.c index 35f0cb4459d..a5d12a755ed 100644 --- a/src/battle/battle.c +++ b/src/battle/battle.c @@ -188,7 +188,7 @@ void setup_demo_player(void) { playerData->partners[i].level = 2; } - playerData->currentPartner = PARTNER_GOOMBARIO; + playerData->curPartner = PARTNER_GOOMBARIO; for (i = 0; i < ARRAY_COUNT(playerData->badges); i++) { playerData->badges[i] = 0; @@ -257,25 +257,25 @@ void load_demo_battle(u32 index) { case 1: setup_demo_player(); mode = 0; - playerData->currentPartner = PARTNER_BOW; + playerData->curPartner = PARTNER_BOW; battleID = BTL_DIG_FORMATION_01; break; case 2: setup_demo_player(); mode = 0; - playerData->currentPartner = PARTNER_PARAKARRY; + playerData->curPartner = PARTNER_PARAKARRY; gGameStatusPtr->demoFlags |= 2; battleID = BTL_DIG_FORMATION_02; break; case 3: setup_demo_player(); mode = 0; - playerData->currentPartner = PARTNER_WATT; + playerData->curPartner = PARTNER_WATT; battleID = BTL_DIG_FORMATION_03; break; case 4: setup_demo_player(); - playerData->currentPartner = PARTNER_KOOPER; + playerData->curPartner = PARTNER_KOOPER; gGameStatusPtr->demoFlags |= 4; mode = 0; battleID = BTL_DIG_FORMATION_04; diff --git a/src/battle/common/actor/duplighost.inc.c b/src/battle/common/actor/duplighost.inc.c index d90ec37cbca..5efb933c9ab 100644 --- a/src/battle/common/actor/duplighost.inc.c +++ b/src/battle/common/actor/duplighost.inc.c @@ -566,8 +566,8 @@ Formation N(formation_lakilester) = { API_CALLABLE(N(GetPartnerAndLevel)) { Bytecode* args = script->ptrReadPos; - evt_set_variable(script, *args++, gPlayerData.currentPartner); - evt_set_variable(script, *args++, gPlayerData.partners[gPlayerData.currentPartner].level); + evt_set_variable(script, *args++, gPlayerData.curPartner); + evt_set_variable(script, *args++, gPlayerData.partners[gPlayerData.curPartner].level); return ApiStatus_DONE2; } diff --git a/src/battle/common/actor/duplighost/ghost_kooper.inc.c b/src/battle/common/actor/duplighost/ghost_kooper.inc.c index 74cd029df26..c86e5cd9315 100644 --- a/src/battle/common/actor/duplighost/ghost_kooper.inc.c +++ b/src/battle/common/actor/duplighost/ghost_kooper.inc.c @@ -126,22 +126,22 @@ API_CALLABLE(N(kooper_UnkActorPosFunc)) { ActorState* actorState = &actor->state; if (isInitialCall) { - actor->state.currentPos.x = actor->currentPos.x; - actor->state.currentPos.y = actor->currentPos.y; - actor->state.currentPos.z = actor->currentPos.z; + actor->state.curPos.x = actor->curPos.x; + actor->state.curPos.y = actor->curPos.y; + actor->state.curPos.z = actor->curPos.z; } - add_xz_vec3f(&actorState->currentPos, actor->state.speed, actor->state.angle); + add_xz_vec3f(&actorState->curPos, actor->state.speed, actor->state.angle); if (actor->state.speed < 4.0f) { - play_movement_dust_effects(0, actor->state.currentPos.x, actor->state.currentPos.y, actor->state.currentPos.z, actor->state.angle); + play_movement_dust_effects(0, actor->state.curPos.x, actor->state.curPos.y, actor->state.curPos.z, actor->state.angle); } else { - play_movement_dust_effects(1, actor->state.currentPos.x, actor->state.currentPos.y, actor->state.currentPos.z, actor->state.angle); + play_movement_dust_effects(1, actor->state.curPos.x, actor->state.curPos.y, actor->state.curPos.z, actor->state.angle); } actorState->speed /= 1.5; - actor->currentPos.x = actorState->currentPos.x; - actor->currentPos.y = actorState->currentPos.y; - actor->currentPos.z = actorState->currentPos.z; + actor->curPos.x = actorState->curPos.x; + actor->curPos.y = actorState->curPos.y; + actor->curPos.z = actorState->curPos.z; if (actorState->speed < 1.0) { return ApiStatus_DONE2; diff --git a/src/battle/common/actor/duplighost/ghost_watt.inc.c b/src/battle/common/actor/duplighost/ghost_watt.inc.c index e67f6f4bf9d..19785c7e32d 100644 --- a/src/battle/common/actor/duplighost/ghost_watt.inc.c +++ b/src/battle/common/actor/duplighost/ghost_watt.inc.c @@ -25,8 +25,8 @@ API_CALLABLE(N(UnkWattEffectFunc1)) { wattEffectData->angle = 0; wattEffectData->unk_0C = TRUE; wattEffectData->unk_10 = 0; - wattEffectData->effect1 = fx_static_status(0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z, (actor->debuff != STATUS_KEY_SHRINK) ? 1.0f : 0.4f, 5, 0); - wattEffectData->effect2 = fx_static_status(1, actor->currentPos.x, -1000.0f, actor->currentPos.z, (actor->debuff != STATUS_KEY_SHRINK) ? 1.0f : 0.4f, 5, 0); + wattEffectData->effect1 = fx_static_status(0, actor->curPos.x, actor->curPos.y, actor->curPos.z, (actor->debuff != STATUS_KEY_SHRINK) ? 1.0f : 0.4f, 5, 0); + wattEffectData->effect2 = fx_static_status(1, actor->curPos.x, -1000.0f, actor->curPos.z, (actor->debuff != STATUS_KEY_SHRINK) ? 1.0f : 0.4f, 5, 0); wattEffectData->flags = TRUE; wattEffectData->debuff = actor->debuff; } @@ -39,9 +39,9 @@ API_CALLABLE(N(UnkWattEffectFunc1)) { } actor->verticalRenderOffset = sin_rad(DEG_TO_RAD(wattEffectData->angle)) * 3.0f; - x = actor->currentPos.x + actor->headOffset.x; - y = actor->currentPos.y + actor->headOffset.y + actor->verticalRenderOffset + (actor->debuff != STATUS_KEY_SHRINK ? 12.0 : 4.800000000000001); // 4.8 doesn't match - z = actor->currentPos.z + actor->headOffset.z; + x = actor->curPos.x + actor->headOffset.x; + y = actor->curPos.y + actor->headOffset.y + actor->verticalRenderOffset + (actor->debuff != STATUS_KEY_SHRINK ? 12.0 : 4.800000000000001); // 4.8 doesn't match + z = actor->curPos.z + actor->headOffset.z; if (wattEffectData->unk_0C) { switch (wattEffectData->unk_10) { case 0: diff --git a/src/battle/common/actor/groove_guy.inc.c b/src/battle/common/actor/groove_guy.inc.c index 5e2c7748cbc..d8810d93cd5 100644 --- a/src/battle/common/actor/groove_guy.inc.c +++ b/src/battle/common/actor/groove_guy.inc.c @@ -612,9 +612,9 @@ s32 func_8021878C_512D5C(Evt* script, s32 isInitialCall) { temp_f20 = evt_get_float_variable(script, *args++); temp_v0 = evt_get_variable(script, *args++); - D_802310D0.position.x = x; - D_802310D0.position.y = y; - D_802310D0.position.z = z; + D_802310D0.pos.x = x; + D_802310D0.pos.y = y; + D_802310D0.pos.z = z; fx_effect_46(6, &D_802310D0, temp_f20, temp_v0); return ApiStatus_DONE2; diff --git a/src/battle/common/move/ItemRefund.inc.c b/src/battle/common/move/ItemRefund.inc.c index 3d67700b271..c4a7e2ada3b 100644 --- a/src/battle/common/move/ItemRefund.inc.c +++ b/src/battle/common/move/ItemRefund.inc.c @@ -9,7 +9,7 @@ API_CALLABLE(N(GiveRefund)) { Actor* player = gBattleStatus.playerActor; s32 sellValue = gItemTable[battleStatus->moveArgument].sellValue; f32 posX; - f32 posY = player->currentPos.y + player->size.y; + f32 posY = player->curPos.y + player->size.y; f32 posZ; f32 angle = 0.0f; s32 delayTime = 0; @@ -25,8 +25,8 @@ API_CALLABLE(N(GiveRefund)) { sellValue = (sellValue * 75 + 99) / 100; for (i = 0; i < sellValue; i++) { - posX = player->currentPos.x; - posZ = player->currentPos.z; + posX = player->curPos.x; + posZ = player->curPos.z; make_item_entity(ITEM_COIN, posX, posY, posZ, ITEM_SPAWN_MODE_TOSS_FADE1, 1 + 3 * i, angle, 0); add_coins(1); @@ -36,9 +36,9 @@ API_CALLABLE(N(GiveRefund)) { delayTime = (i * 3) + 30; - posX = player->currentPos.x; - posY = player->currentPos.y; - posZ = player->currentPos.z; + posX = player->curPos.x; + posY = player->curPos.y; + posZ = player->curPos.z; get_screen_coords(gCurrentCameraID, posX, posY, posZ, &iconX, &iconY, &iconZ); diff --git a/src/battle/common/move/StarBeamSupport.inc.c b/src/battle/common/move/StarBeamSupport.inc.c index baa9c443768..0a3baa6a4ca 100644 --- a/src/battle/common/move/StarBeamSupport.inc.c +++ b/src/battle/common/move/StarBeamSupport.inc.c @@ -323,15 +323,15 @@ API_CALLABLE(N(ProcessPeachStarBeam)) { return ApiStatus_DONE2; } get_actor_part(target, player->targetPartIndex); - targetPosX = target->currentPos.x + target->headOffset.x; + targetPosX = target->curPos.x + target->headOffset.x; if (target->flags & ACTOR_FLAG_UPSIDE_DOWN) { - targetPosY = target->currentPos.y + target->headOffset.y - target->size.y; + targetPosY = target->curPos.y + target->headOffset.y - target->size.y; } else if (!(target->flags & ACTOR_FLAG_8000)) { - targetPosY = target->currentPos.y + target->headOffset.y + target->size.y; + targetPosY = target->curPos.y + target->headOffset.y + target->size.y; } else { - targetPosY = target->currentPos.y + target->headOffset.y + target->size.y * 2; + targetPosY = target->curPos.y + target->headOffset.y + target->size.y * 2; } - targetPosZ = target->currentPos.z + target->headOffset.z; + targetPosZ = target->curPos.z + target->headOffset.z; } else { targetPosX = 64.0f; targetPosY = 80.0f; @@ -387,13 +387,13 @@ API_CALLABLE(N(ProcessPeachStarBeam)) { switch (script->functionTemp[0]) { case PEACH_STAR_BEAM_CREATE_EFFECT: - currentPosX = player->currentPos.x; - currentPosY = player->currentPos.y + player->size.y + 30.0f; - currentPosZ = player->currentPos.z; + currentPosX = player->curPos.x; + currentPosY = player->curPos.y + player->size.y + 30.0f; + currentPosZ = player->curPos.z; - playerState->currentPos.x = currentPosX; - playerState->currentPos.y = currentPosY + 150.0f; - playerState->currentPos.z = currentPosZ; + playerState->curPos.x = currentPosX; + playerState->curPos.y = currentPosY + 150.0f; + playerState->curPos.z = currentPosZ; playerState->goalPos.x = currentPosX; playerState->goalPos.y = currentPosY; @@ -404,12 +404,12 @@ API_CALLABLE(N(ProcessPeachStarBeam)) { } else { N(effect) = fx_peach_star_beam(1, currentPosX, currentPosY, currentPosZ, 1.0f, 0); } - playerState->distance = 48.0f; + playerState->dist = 48.0f; N(effect)->data.peachStarBeam->unk_3C = 0; - N(effect)->data.peachStarBeam->circleRadius = playerState->distance; + N(effect)->data.peachStarBeam->circleRadius = playerState->dist; N(effect)->data.peachStarBeam->beamAlpha = 0; N(effect)->data.peachStarBeam->twinkYOffset = 30.0f; - N(effect)->data.peachStarBeam->rotationSpeed = 5.0f; + N(effect)->data.peachStarBeam->rotSpeed = 5.0f; for (i = 0; i < ARRAY_COUNT(N(miscParticlesTimeLeft)); i++) { N(miscParticlesTimeLeft)[i] = rand_int(20); } @@ -423,12 +423,12 @@ API_CALLABLE(N(ProcessPeachStarBeam)) { script->functionTemp[0] = PEACH_STAR_BEAM_SPIRITS_APPEAR; break; case PEACH_STAR_BEAM_SPIRITS_APPEAR: - playerState->currentPos.y += (playerState->goalPos.y - playerState->currentPos.y) / 10.0f; - N(effect)->data.peachStarBeam->circleCenter.x = playerState->currentPos.x; - N(effect)->data.peachStarBeam->circleCenter.y = playerState->currentPos.y; - N(effect)->data.peachStarBeam->circleCenter.z = playerState->currentPos.z; + playerState->curPos.y += (playerState->goalPos.y - playerState->curPos.y) / 10.0f; + N(effect)->data.peachStarBeam->circleCenter.x = playerState->curPos.x; + N(effect)->data.peachStarBeam->circleCenter.y = playerState->curPos.y; + N(effect)->data.peachStarBeam->circleCenter.z = playerState->curPos.z; N(effect)->data.peachStarBeam->unk_3C = 0; - N(effect)->data.peachStarBeam->circleRadius = playerState->distance; + N(effect)->data.peachStarBeam->circleRadius = playerState->dist; N(effect)->data.peachStarBeam->beamAlpha = 0; if (script->functionTemp[1] == 0) { script->functionTemp[1] = 20; @@ -448,8 +448,8 @@ API_CALLABLE(N(ProcessPeachStarBeam)) { } break; case PEACH_STAR_BEAM_SHRINK_CIRCLE: - playerState->distance += (24.0f - playerState->distance) * 0.125f; - N(effect)->data.peachStarBeam->circleRadius = playerState->distance; + playerState->dist += (24.0f - playerState->dist) * 0.125f; + N(effect)->data.peachStarBeam->circleRadius = playerState->dist; if (script->functionTemp[1] == 0) { playerState->goalPos.x = targetPosX; playerState->goalPos.y = targetPosY; @@ -470,45 +470,45 @@ API_CALLABLE(N(ProcessPeachStarBeam)) { break; case PEACH_STAR_BEAM_FLY_TO_TARGET: cond = FALSE; - playerState->distance += (48.0f - playerState->distance) * 0.25f; - N(effect)->data.peachStarBeam->circleRadius = playerState->distance; + playerState->dist += (48.0f - playerState->dist) * 0.25f; + N(effect)->data.peachStarBeam->circleRadius = playerState->dist; for (i = 0; i < 2; i++) { if (i != 0) { spirit = &effectData->spirits[i]; if (N(spiritsFlyDelay)[i] < 0) { - currentPosX = playerState->currentPos.x; - currentPosY = playerState->currentPos.y; - currentPosZ = playerState->currentPos.z; + currentPosX = playerState->curPos.x; + currentPosY = playerState->curPos.y; + currentPosZ = playerState->curPos.z; goalPosX = playerState->goalPos.x; goalPosY = playerState->goalPos.y; goalPosZ = playerState->goalPos.z; - playerState->currentPos.x += goalPosX - currentPosX; - playerState->currentPos.y += goalPosY - currentPosY; - playerState->currentPos.z += goalPosZ - currentPosZ; + playerState->curPos.x += goalPosX - currentPosX; + playerState->curPos.y += goalPosY - currentPosY; + playerState->curPos.z += goalPosZ - currentPosZ; } else { cond = TRUE; if (N(spiritsFlyDelay)[i] != 0) { N(spiritsFlyDelay)[i]--; } else { - currentPosX = playerState->currentPos.x; - currentPosY = playerState->currentPos.y; - currentPosZ = playerState->currentPos.z; + currentPosX = playerState->curPos.x; + currentPosY = playerState->curPos.y; + currentPosZ = playerState->curPos.z; goalPosX = playerState->goalPos.x; goalPosY = playerState->goalPos.y; goalPosZ = playerState->goalPos.z; dist = dist2D(currentPosX, currentPosZ, goalPosX, goalPosZ); - playerState->currentPos.x += (goalPosX - currentPosX) / N(spiritsMoveTime)[i]; - playerState->currentPos.y += (goalPosY - currentPosY) / N(spiritsMoveTime)[i]; - playerState->currentPos.z += (goalPosZ - currentPosZ) / N(spiritsMoveTime)[i]; + playerState->curPos.x += (goalPosX - currentPosX) / N(spiritsMoveTime)[i]; + playerState->curPos.y += (goalPosY - currentPosY) / N(spiritsMoveTime)[i]; + playerState->curPos.z += (goalPosZ - currentPosZ) / N(spiritsMoveTime)[i]; if (N(spiritsMoveTime)[i] == 1) { N(spiritsFlyDelay)[i] = -1; - playerState->currentPos.x = goalPosX; - playerState->currentPos.y = goalPosY; - playerState->currentPos.z = goalPosZ; + playerState->curPos.x = goalPosX; + playerState->curPos.y = goalPosY; + playerState->curPos.z = goalPosZ; } else { - playerState->currentPos.y += dist / 60.0f; + playerState->curPos.y += dist / 60.0f; } N(spiritsMoveTime)[i]--; } @@ -516,22 +516,22 @@ API_CALLABLE(N(ProcessPeachStarBeam)) { } } - N(effect)->data.peachStarBeam->circleCenter.x = playerState->currentPos.x; - N(effect)->data.peachStarBeam->circleCenter.y = playerState->currentPos.y; - N(effect)->data.peachStarBeam->circleCenter.z = playerState->currentPos.z; - N(effect)->data.peachStarBeam->pos.x = playerState->currentPos.x; + N(effect)->data.peachStarBeam->circleCenter.x = playerState->curPos.x; + N(effect)->data.peachStarBeam->circleCenter.y = playerState->curPos.y; + N(effect)->data.peachStarBeam->circleCenter.z = playerState->curPos.z; + N(effect)->data.peachStarBeam->pos.x = playerState->curPos.x; N(effect)->data.peachStarBeam->pos.y = 0.0f; - N(effect)->data.peachStarBeam->pos.z = playerState->currentPos.z; + N(effect)->data.peachStarBeam->pos.z = playerState->curPos.z; if (!cond) { - playerState->currentPos.x = playerState->goalPos.x; - playerState->currentPos.y = playerState->goalPos.y; - playerState->currentPos.z = playerState->goalPos.z; - N(effect)->data.peachStarBeam->circleCenter.x = playerState->currentPos.x; - N(effect)->data.peachStarBeam->circleCenter.y = playerState->currentPos.y; - N(effect)->data.peachStarBeam->circleCenter.z = playerState->currentPos.z; - N(effect)->data.peachStarBeam->pos.x = playerState->currentPos.x; + playerState->curPos.x = playerState->goalPos.x; + playerState->curPos.y = playerState->goalPos.y; + playerState->curPos.z = playerState->goalPos.z; + N(effect)->data.peachStarBeam->circleCenter.x = playerState->curPos.x; + N(effect)->data.peachStarBeam->circleCenter.y = playerState->curPos.y; + N(effect)->data.peachStarBeam->circleCenter.z = playerState->curPos.z; + N(effect)->data.peachStarBeam->pos.x = playerState->curPos.x; N(effect)->data.peachStarBeam->pos.y = 0.0f; - N(effect)->data.peachStarBeam->pos.z = playerState->currentPos.z; + N(effect)->data.peachStarBeam->pos.z = playerState->curPos.z; effectData = N(effect)->data.peachStarBeam; for (i = 0; i < ARRAY_COUNT(effectData->spirits); i++) { if (script->functionTemp[2] != 0 || i != 0) { @@ -562,9 +562,9 @@ API_CALLABLE(N(ProcessPeachStarBeam)) { } newScript = start_script(&N(802A33A8), EVT_PRIORITY_A, 0); - newScript->varTable[0] = playerState->currentPos.x; - newScript->varTable[1] = playerState->currentPos.y * 0.5f; - newScript->varTable[2] = playerState->currentPos.z; + newScript->varTable[0] = playerState->curPos.x; + newScript->varTable[1] = playerState->curPos.y * 0.5f; + newScript->varTable[2] = playerState->curPos.z; newScript->varTable[10] = script->functionTemp[2]; do {} while (0); // required to match diff --git a/src/battle/common/stage/lib/DripVolumes.inc.c b/src/battle/common/stage/lib/DripVolumes.inc.c index e4dd3737e7c..2bf1a74c723 100644 --- a/src/battle/common/stage/lib/DripVolumes.inc.c +++ b/src/battle/common/stage/lib/DripVolumes.inc.c @@ -18,9 +18,9 @@ API_CALLABLE(N(CheckDripCollisionWithActors)) { actor = battleStatus->playerActor; if (actor != NULL) { - xDiff = actor->currentPos.x - model->center.x; - yDiff = actor->currentPos.y + actor->size.y - 1.5f - model->center.y; - zDiff = actor->currentPos.z - model->center.z; + xDiff = actor->curPos.x - model->center.x; + yDiff = actor->curPos.y + actor->size.y - 1.5f - model->center.y; + zDiff = actor->curPos.z - model->center.z; temp = sqrtf(SQ(xDiff) + SQ(zDiff)); if (yDiff > 0.0f && yDiff < actor->size.y && temp < actor->size.x * 0.5f) { @@ -31,9 +31,9 @@ API_CALLABLE(N(CheckDripCollisionWithActors)) { actor = battleStatus->partnerActor; if (actor != NULL) { - xDiff = actor->currentPos.x - model->center.x; - yDiff = actor->currentPos.y + actor->size.y - 1.5f - model->center.y; - zDiff = actor->currentPos.z - model->center.z; + xDiff = actor->curPos.x - model->center.x; + yDiff = actor->curPos.y + actor->size.y - 1.5f - model->center.y; + zDiff = actor->curPos.z - model->center.z; temp = sqrtf(SQ(xDiff) + SQ(zDiff)); if (yDiff > 0.0f && yDiff < actor->size.y && temp < actor->size.x * 0.5f) { @@ -48,9 +48,9 @@ API_CALLABLE(N(CheckDripCollisionWithActors)) { actor = battleStatus->enemyActors[i]; if (actor != NULL && !(actor->flags & ACTOR_FLAG_DISABLED)) { - xDiff = actor->currentPos.x - model->center.x; - yDiff = actor->currentPos.y + actor->size.y - 1.5f - model->center.y; - zDiff = actor->currentPos.z - model->center.z; + xDiff = actor->curPos.x - model->center.x; + yDiff = actor->curPos.y + actor->size.y - 1.5f - model->center.y; + zDiff = actor->curPos.z - model->center.z; temp = sqrtf(SQ(xDiff) + SQ(zDiff)); if (yDiff > 0.0f && yDiff < actor->size.y && temp < actor->size.x * 0.5f) { @@ -61,9 +61,9 @@ API_CALLABLE(N(CheckDripCollisionWithActors)) { for (part = actor->partsTable; part != NULL; part = part->nextPart) { if (!(part->flags & ACTOR_PART_FLAG_INVISIBLE)) { if (part->flags & ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION) { - xDiff = part->currentPos.x - model->center.x; - yDiff = part->currentPos.y + part->size.y - 1.5f - model->center.y; - zDiff = part->currentPos.z - model->center.z; + xDiff = part->curPos.x - model->center.x; + yDiff = part->curPos.y + part->size.y - 1.5f - model->center.y; + zDiff = part->curPos.z - model->center.z; temp = sqrtf(SQ(xDiff) + SQ(zDiff)); if (yDiff > 0.0f && yDiff < part->size.y && temp < part->size.x * 0.5f) { diff --git a/src/battle/move/hammer/spin_smash.c b/src/battle/move/hammer/spin_smash.c index 0eff0756d14..bed85034d5a 100644 --- a/src/battle/move/hammer/spin_smash.c +++ b/src/battle/move/hammer/spin_smash.c @@ -7,9 +7,9 @@ API_CALLABLE(func_802A1000_737890) { BattleStatus* battleStatus = &gBattleStatus; Actor* playerActor = battleStatus->playerActor; - f32 xPos = playerActor->currentPos.x + 20.0f; - f32 yPos = playerActor->currentPos.y + 15.0f; - f32 zPos = playerActor->currentPos.z + 5.0f; + f32 xPos = playerActor->curPos.x + 20.0f; + f32 yPos = playerActor->curPos.y + 15.0f; + f32 zPos = playerActor->curPos.z + 5.0f; fx_stars_spread(0, xPos, yPos, zPos, 6, 20); @@ -19,9 +19,9 @@ API_CALLABLE(func_802A1000_737890) { API_CALLABLE(func_802A1074_737904) { BattleStatus* battleStatus = &gBattleStatus; Actor* playerActor = battleStatus->playerActor; - f32 xPos = playerActor->currentPos.x + 20.0f; - f32 yPos = playerActor->currentPos.y + 15.0f; - f32 zPos = playerActor->currentPos.z + 5.0f; + f32 xPos = playerActor->curPos.x + 20.0f; + f32 yPos = playerActor->curPos.y + 15.0f; + f32 zPos = playerActor->curPos.z + 5.0f; fx_steam_burst(0, xPos, yPos, zPos, 1.0f, 20); diff --git a/src/battle/move/item/food.c b/src/battle/move/item/food.c index 365f47887f3..c5e2d94da95 100644 --- a/src/battle/move/item/food.c +++ b/src/battle/move/item/food.c @@ -17,9 +17,9 @@ API_CALLABLE(N(func_802A123C_73330C)) { s32 c = evt_get_variable(script, *args++); ItemEntity* item = get_item_entity(script->varTable[14]); - item->position.x = a; - item->position.y = b; - item->position.z = c; + item->pos.x = a; + item->pos.y = b; + item->pos.z = c; return ApiStatus_DONE2; } diff --git a/src/battle/move/item/life_shroom.c b/src/battle/move/item/life_shroom.c index 6a1fe52b38b..560476c08ad 100644 --- a/src/battle/move/item/life_shroom.c +++ b/src/battle/move/item/life_shroom.c @@ -17,9 +17,9 @@ API_CALLABLE(N(func_802A123C_72E76C)) { s32 c = evt_get_variable(script, *args++); ItemEntity* item = get_item_entity(script->varTable[14]); - item->position.x = a; - item->position.y = b; - item->position.z = c; + item->pos.x = a; + item->pos.y = b; + item->pos.z = c; return ApiStatus_DONE2; } diff --git a/src/battle/move/item/mushroom.c b/src/battle/move/item/mushroom.c index b96ea4604b2..8472f4f4727 100644 --- a/src/battle/move/item/mushroom.c +++ b/src/battle/move/item/mushroom.c @@ -17,9 +17,9 @@ API_CALLABLE(N(func_802A123C_715A8C)) { s32 c = evt_get_variable(script, *args++); ItemEntity* item = get_item_entity(script->varTable[14]); - item->position.x = a; - item->position.y = b; - item->position.z = c; + item->pos.x = a; + item->pos.y = b; + item->pos.z = c; return ApiStatus_DONE2; } diff --git a/src/battle/move/item/pow_block.c b/src/battle/move/item/pow_block.c index 284a7c5511f..8cede60fe7f 100644 --- a/src/battle/move/item/pow_block.c +++ b/src/battle/move/item/pow_block.c @@ -17,10 +17,10 @@ API_CALLABLE(N(func_802A123C_718A8C)) { if (player->scalingFactor == 1.0) { s32 var = script->varTable[10]; get_entity_by_index(var); - collisionStatus->currentCeiling = var | COLLISION_WITH_ENTITY_BIT; + collisionStatus->curCeiling = var | COLLISION_WITH_ENTITY_BIT; playerStatus->flags |= PS_FLAG_JUMPING; update_entities(); - collisionStatus->currentCeiling = -1; + collisionStatus->curCeiling = -1; playerStatus->flags &= ~PS_FLAG_JUMPING; return ApiStatus_DONE2; } @@ -45,7 +45,7 @@ API_CALLABLE(N(func_802A1318_718B68)) { entity->scale.y = player->scalingFactor; entity->scale.z = player->scalingFactor; if (player->scalingFactor != 1.0) { - entity->position.y -= 10.0f; + entity->pos.y -= 10.0f; } return ApiStatus_DONE2; diff --git a/src/battle/move/item/stone_cap.c b/src/battle/move/item/stone_cap.c index 37986c4dc81..b65b5f6b2fe 100644 --- a/src/battle/move/item/stone_cap.c +++ b/src/battle/move/item/stone_cap.c @@ -26,9 +26,9 @@ API_CALLABLE(N(func_802A123C_7217DC)) { case 1: for (i = 0; i < 10; i++) { - f32 x = player->currentPos.x + ((rand_int(20) - 10) * player->scalingFactor); - f32 y = player->currentPos.y + ((rand_int(20) + 10) * player->scalingFactor); - f32 z = player->currentPos.z + 5.0f; + f32 x = player->curPos.x + ((rand_int(20) - 10) * player->scalingFactor); + f32 y = player->curPos.y + ((rand_int(20) + 10) * player->scalingFactor); + f32 z = player->curPos.z + 5.0f; fx_floating_cloud_puff(0, x, y, z, 1.0f, 25); } diff --git a/src/battle/move/item/super_soda.c b/src/battle/move/item/super_soda.c index 00979dc2799..024931bc757 100644 --- a/src/battle/move/item/super_soda.c +++ b/src/battle/move/item/super_soda.c @@ -17,9 +17,9 @@ API_CALLABLE(N(func_802A123C_724F1C)) { s32 c = evt_get_variable(script, *args++); ItemEntity* item = get_item_entity(script->varTable[14]); - item->position.x = a; - item->position.y = b; - item->position.z = c; + item->pos.x = a; + item->pos.y = b; + item->pos.z = c; return ApiStatus_DONE2; } diff --git a/src/battle/move/item/thunder_bolt.c b/src/battle/move/item/thunder_bolt.c index 46b394c6fd7..d4d605d8eb8 100644 --- a/src/battle/move/item/thunder_bolt.c +++ b/src/battle/move/item/thunder_bolt.c @@ -17,9 +17,9 @@ API_CALLABLE(N(func_802A123C_722D7C)) { if (actor != NULL) { sfx_play_sound(SOUND_366); - posX = actor->currentPos.x; - posY = actor->currentPos.y + (actor->size.y / 10); - posZ = actor->currentPos.z; + posX = actor->curPos.x; + posY = actor->curPos.y + (actor->size.y / 10); + posZ = actor->curPos.z; scaleX = (actor->size.x + (actor->size.x >> 2)) * actor->scalingFactor; scaleY = (actor->size.y - 2) * actor->scalingFactor; diff --git a/src/battle/move/item/thunder_rage.c b/src/battle/move/item/thunder_rage.c index 4d978543b69..1ab24f9433f 100644 --- a/src/battle/move/item/thunder_rage.c +++ b/src/battle/move/item/thunder_rage.c @@ -34,9 +34,9 @@ API_CALLABLE(N(func_802A1354_71B4F4)) { if (actor != NULL) { sfx_play_sound(SOUND_366); - posX = actor->currentPos.x; - posY = actor->currentPos.y + (actor->size.y / 10); - posZ = actor->currentPos.z; + posX = actor->curPos.x; + posY = actor->curPos.y + (actor->size.y / 10); + posZ = actor->curPos.z; scaleX = (actor->size.x + (actor->size.x >> 2)) * actor->scalingFactor; scaleY = (actor->size.y - 2) * actor->scalingFactor; diff --git a/src/battle/move/star_power/chill_out.c b/src/battle/move/star_power/chill_out.c index c67d80b4f4b..36ef18c6545 100644 --- a/src/battle/move/star_power/chill_out.c +++ b/src/battle/move/star_power/chill_out.c @@ -87,15 +87,15 @@ API_CALLABLE(func_802A16F4_7907C4) { dispatch_damage_event_actor_0(target, 0, 10); - x = target->currentPos.x + target->headOffset.x + (target->size.x / 2); + x = target->curPos.x + target->headOffset.x + (target->size.x / 2); if (target->flags & ACTOR_FLAG_UPSIDE_DOWN) { - y = target->currentPos.y + target->headOffset.y - target->size.y; + y = target->curPos.y + target->headOffset.y - target->size.y; } else if (!(target->flags & ACTOR_FLAG_8000)) { - y = target->currentPos.y + target->headOffset.y + target->size.y; + y = target->curPos.y + target->headOffset.y + target->size.y; } else { - y = target->currentPos.y + target->headOffset.y + target->size.y * 2; + y = target->curPos.y + target->headOffset.y + target->size.y * 2; } - z = target->currentPos.z + target->headOffset.z + 5.0f; + z = target->curPos.z + target->headOffset.z + 5.0f; fx_stat_change(5, x, y, z, 1.0f, 60); sfx_play_sound(SOUND_2106); diff --git a/src/battle/move/star_power/refresh.c b/src/battle/move/star_power/refresh.c index e4d0ea1ec36..401e4932293 100644 --- a/src/battle/move/star_power/refresh.c +++ b/src/battle/move/star_power/refresh.c @@ -24,7 +24,7 @@ API_CALLABLE(func_802A1518_78BB18) { npc->planarFlyDist = 0; npc->yaw = 0; npc->duration = 0; - npc->jumpVelocity = -1.5f; + npc->jumpVel = -1.5f; npc->jumpScale = 0.02f; npc->moveSpeed = 1.0f; npc->moveToPos.x = npc->pos.x; @@ -33,7 +33,7 @@ API_CALLABLE(func_802A1518_78BB18) { script->functionTemp[0] = 1; break; case 1: - if (npc->jumpVelocity < 0.0f) { + if (npc->jumpVel < 0.0f) { npc->planarFlyDist += 3.0; if (npc->planarFlyDist > 40.0f) { npc->planarFlyDist = 40.0f; @@ -46,8 +46,8 @@ API_CALLABLE(func_802A1518_78BB18) { } npc->moveSpeed += 0.75; - npc->jumpVelocity += npc->jumpScale; - npc->pos.y += npc->jumpVelocity; + npc->jumpVel += npc->jumpScale; + npc->pos.y += npc->jumpVel; if (npc->moveSpeed > 33.0f) { npc->moveSpeed = 33.0f; } diff --git a/src/battle/partner/bombette.c b/src/battle/partner/bombette.c index 6a8eca326f3..651ec31002c 100644 --- a/src/battle/partner/bombette.c +++ b/src/battle/partner/bombette.c @@ -83,26 +83,26 @@ API_CALLABLE(N(SlowDown)) { ActorState* partnerActorMovement = &partnerActor->state; if (isInitialCall) { - partnerActor->state.currentPos.x = partnerActor->currentPos.x; - partnerActor->state.currentPos.y = partnerActor->currentPos.y; - partnerActor->state.currentPos.z = partnerActor->currentPos.z; + partnerActor->state.curPos.x = partnerActor->curPos.x; + partnerActor->state.curPos.y = partnerActor->curPos.y; + partnerActor->state.curPos.z = partnerActor->curPos.z; } - add_xz_vec3f(&partnerActorMovement->currentPos, partnerActor->state.speed, partnerActor->state.angle); + add_xz_vec3f(&partnerActorMovement->curPos, partnerActor->state.speed, partnerActor->state.angle); if (partnerActor->state.speed < 4.0f) { - play_movement_dust_effects(0, partnerActor->state.currentPos.x, partnerActor->state.currentPos.y, - partnerActor->state.currentPos.z, partnerActor->state.angle); + play_movement_dust_effects(0, partnerActor->state.curPos.x, partnerActor->state.curPos.y, + partnerActor->state.curPos.z, partnerActor->state.angle); } else { - play_movement_dust_effects(1, partnerActor->state.currentPos.x, partnerActor->state.currentPos.y, - partnerActor->state.currentPos.z, partnerActor->state.angle); + play_movement_dust_effects(1, partnerActor->state.curPos.x, partnerActor->state.curPos.y, + partnerActor->state.curPos.z, partnerActor->state.angle); } partnerActorMovement->speed /= 1.5; - partnerActor->currentPos.x = partnerActorMovement->currentPos.x; - partnerActor->currentPos.y = partnerActorMovement->currentPos.y; - partnerActor->currentPos.z = partnerActorMovement->currentPos.z; + partnerActor->curPos.x = partnerActorMovement->curPos.x; + partnerActor->curPos.y = partnerActorMovement->curPos.y; + partnerActor->curPos.z = partnerActorMovement->curPos.z; if (partnerActorMovement->speed < 1.0) { return ApiStatus_DONE2; diff --git a/src/battle/partner/goombario.c b/src/battle/partner/goombario.c index 6cecb505205..153eb0d0bf9 100644 --- a/src/battle/partner/goombario.c +++ b/src/battle/partner/goombario.c @@ -37,9 +37,9 @@ enum N(ActorPartIDs) { API_CALLABLE(N(GetReturnMoveTime)) { BattleStatus* battleStatus = &gBattleStatus; Actor* partner = battleStatus->partnerActor; - f32 posX = partner->currentPos.x; - f32 posY = partner->currentPos.y; - f32 posZ = partner->currentPos.z; + f32 posX = partner->curPos.x; + f32 posY = partner->curPos.y; + f32 posZ = partner->curPos.z; f32 goalX = partner->state.goalPos.x; f32 goalY = partner->state.goalPos.y; f32 goalZ = partner->state.goalPos.z; @@ -103,38 +103,38 @@ API_CALLABLE(N(JumpOnTarget)) { } if (script->functionTemp[0] == 0) { - state->currentPos.x = actor->currentPos.x; - state->currentPos.y = actor->currentPos.y; + state->curPos.x = actor->curPos.x; + state->curPos.y = actor->curPos.y; stateGoalX = state->goalPos.x; stateGoalZ = state->goalPos.z; - stateCurrentX = state->currentPos.x; - stateCurrentZ = actor->currentPos.z; - state->currentPos.z = stateCurrentZ; + stateCurrentX = state->curPos.x; + stateCurrentZ = actor->curPos.z; + state->curPos.z = stateCurrentZ; state->angle = atan2(stateCurrentX, stateCurrentZ, stateGoalX, stateGoalZ); - state->distance = dist2D(stateCurrentX, stateCurrentZ, stateGoalX, stateGoalZ); + state->dist = dist2D(stateCurrentX, stateCurrentZ, stateGoalX, stateGoalZ); if (state->moveTime == 0) { - state->moveTime = state->distance / state->speed; - temp = state->distance - (state->moveTime * state->speed); + state->moveTime = state->dist / state->speed; + temp = state->dist - (state->moveTime * state->speed); } else { - state->speed = state->distance / state->moveTime; - temp = state->distance - (state->moveTime * state->speed); + state->speed = state->dist / state->moveTime; + temp = state->dist - (state->moveTime * state->speed); } if (state->moveTime == 0) { return ApiStatus_DONE2; } - state->unk_30.x = (state->goalPos.x - state->currentPos.x) / state->moveTime; - state->unk_30.y = (state->goalPos.y - state->currentPos.y) / state->moveTime; - state->unk_30.z = (state->goalPos.z - state->currentPos.z) / state->moveTime; + state->unk_30.x = (state->goalPos.x - state->curPos.x) / state->moveTime; + state->unk_30.y = (state->goalPos.y - state->curPos.y) / state->moveTime; + state->unk_30.z = (state->goalPos.z - state->curPos.z) / state->moveTime; state->acceleration = PI_S / state->moveTime; - state->velocity = 0.0f; + state->vel = 0.0f; state->speed += temp / state->moveTime; if (state->moveArcAmplitude < 3) { state->unk_24 = 90.0f; state->unk_28 = 360 / state->moveTime; - temp = state->distance; + temp = state->dist; temp -= 20.0; temp /= 6.0; temp += 47.0; @@ -144,13 +144,13 @@ API_CALLABLE(N(JumpOnTarget)) { } state->unk_18.x = 0.0f; state->unk_18.y = 0.0f; - vel3 = state->velocity; + vel3 = state->vel; acc3 = state->acceleration; - state->velocity = vel3 + ((sin_rad(DEG_TO_RAD(state->unk_24)) * 0.53 * acc3) + acc3); + state->vel = vel3 + ((sin_rad(DEG_TO_RAD(state->unk_24)) * 0.53 * acc3) + acc3); } else { state->unk_24 = 90.0f; state->unk_28 = 360 / state->moveTime; - temp = state->distance; + temp = state->dist; temp -= 20.0; temp /= 6.0; temp += 47.0; @@ -160,9 +160,9 @@ API_CALLABLE(N(JumpOnTarget)) { } state->unk_18.x = 0.0f; state->unk_18.y = 0.0f; - vel4 = state->velocity; + vel4 = state->vel; acc4 = state->acceleration; - state->velocity = vel4 + ((sin_rad(DEG_TO_RAD(state->unk_24)) * 0.8 * acc4) + acc4); + state->vel = vel4 + ((sin_rad(DEG_TO_RAD(state->unk_24)) * 0.8 * acc4) + acc4); } set_animation(ACTOR_PARTNER, 1, state->animJumpRise); script->functionTemp[0] = 1; @@ -170,41 +170,41 @@ API_CALLABLE(N(JumpOnTarget)) { switch (script->functionTemp[0]) { case 1: - if (state->velocity > PI_S / 2) { + if (state->vel > PI_S / 2) { set_animation(ACTOR_PARTNER, 1, state->animJumpFall); } - oldActorX = actor->currentPos.x; - oldActorY = actor->currentPos.y; - state->currentPos.x += state->unk_30.x; - state->currentPos.y = state->currentPos.y + state->unk_30.y; - state->currentPos.z = state->currentPos.z + state->unk_30.z; - state->unk_18.x = actor->currentPos.y; - actor->currentPos.x = state->currentPos.x; - actor->currentPos.y = state->currentPos.y + (state->bounceDivisor * sin_rad(state->velocity)); - actor->currentPos.z = state->currentPos.z; - if (state->goalPos.y > actor->currentPos.y && state->moveTime < 3) { - actor->currentPos.y = state->goalPos.y; + oldActorX = actor->curPos.x; + oldActorY = actor->curPos.y; + state->curPos.x += state->unk_30.x; + state->curPos.y = state->curPos.y + state->unk_30.y; + state->curPos.z = state->curPos.z + state->unk_30.z; + state->unk_18.x = actor->curPos.y; + actor->curPos.x = state->curPos.x; + actor->curPos.y = state->curPos.y + (state->bounceDivisor * sin_rad(state->vel)); + actor->curPos.z = state->curPos.z; + if (state->goalPos.y > actor->curPos.y && state->moveTime < 3) { + actor->curPos.y = state->goalPos.y; } - actor->rotation.z = -atan2(oldActorX, -oldActorY, actor->currentPos.x, -actor->currentPos.y); - state->unk_18.y = actor->currentPos.y; + actor->rot.z = -atan2(oldActorX, -oldActorY, actor->curPos.x, -actor->curPos.y); + state->unk_18.y = actor->curPos.y; if (state->moveArcAmplitude < 3) { - vel1 = state->velocity; + vel1 = state->vel; acc1 = state->acceleration; - state->velocity = vel1 + ((sin_rad(DEG_TO_RAD(state->unk_24)) * 0.53 * acc1) + acc1); + state->vel = vel1 + ((sin_rad(DEG_TO_RAD(state->unk_24)) * 0.53 * acc1) + acc1); } else { - vel2 = state->velocity; + vel2 = state->vel; acc2 = state->acceleration; - state->velocity = vel2 + ((sin_rad(DEG_TO_RAD(state->unk_24)) * 0.8 * acc2) + acc2); + state->vel = vel2 + ((sin_rad(DEG_TO_RAD(state->unk_24)) * 0.8 * acc2) + acc2); } state->unk_24 += state->unk_28; state->unk_24 = clamp_angle(state->unk_24); state->moveTime--; if (state->moveTime == 0) { - actor->currentPos.y = state->goalPos.y; + actor->curPos.y = state->goalPos.y; state->acceleration = 1.8f; - state->velocity = -(state->unk_18.x - state->unk_18.y); + state->vel = -(state->unk_18.x - state->unk_18.y); set_animation(ACTOR_PARTNER, 1, state->animJumpLand); return ApiStatus_DONE1; } @@ -216,23 +216,23 @@ API_CALLABLE(N(JumpOnTarget)) { state->moveTime = 1; state->acceleration = 1.8f; state->unk_24 = 90.0f; - state->velocity = -(state->unk_18.x - state->unk_18.y); + state->vel = -(state->unk_18.x - state->unk_18.y); state->bounceDivisor = fabsf(state->unk_18.x - state->unk_18.y) / 16.5; state->unk_28 = 360 / state->moveTime; - state->currentPos.x = actor->currentPos.x; - state->currentPos.y = actor->currentPos.y; - state->currentPos.z = actor->currentPos.z; + state->curPos.x = actor->curPos.x; + state->curPos.y = actor->curPos.y; + state->curPos.z = actor->curPos.z; script->functionTemp[0] = 3; // fallthrough case 3: - currentPosX64 = state->currentPos.x; // required to match - state->currentPos.x = currentPosX64 + state->bounceDivisor * sin_rad(DEG_TO_RAD(state->unk_24)) / 33.0; - state->currentPos.y -= state->bounceDivisor * sin_rad(DEG_TO_RAD(state->unk_24)); + currentPosX64 = state->curPos.x; // required to match + state->curPos.x = currentPosX64 + state->bounceDivisor * sin_rad(DEG_TO_RAD(state->unk_24)) / 33.0; + state->curPos.y -= state->bounceDivisor * sin_rad(DEG_TO_RAD(state->unk_24)); state->unk_24 += state->unk_28; state->unk_24 = clamp_angle(state->unk_24); - actor->currentPos.x = state->currentPos.x; - actor->currentPos.y = state->currentPos.y; - actor->currentPos.z = state->currentPos.z; + actor->curPos.x = state->curPos.x; + actor->curPos.y = state->curPos.y; + actor->curPos.z = state->curPos.z; if (gBattleStatus.flags1 & BS_FLAGS1_2000) { return ApiStatus_DONE2; @@ -251,38 +251,38 @@ API_CALLABLE(N(JumpOnTarget)) { API_CALLABLE(N(OnMissHeadbonk)) { BattleStatus* battleStatus = &gBattleStatus; Actor* partner = gBattleStatus.partnerActor; - Vec3f* pos = &partner->state.currentPos; + Vec3f* pos = &partner->state.curPos; if (isInitialCall) { script->functionTemp[0] = 0; } if (script->functionTemp[0] == 0) { - partner->state.currentPos.x = partner->currentPos.x; - partner->state.currentPos.y = partner->currentPos.y; - partner->state.currentPos.z = partner->currentPos.z; + partner->state.curPos.x = partner->curPos.x; + partner->state.curPos.y = partner->curPos.y; + partner->state.curPos.z = partner->curPos.z; script->functionTemp[0] = 1; } - if (partner->state.velocity > 0.0f) { + if (partner->state.vel > 0.0f) { set_animation(ACTOR_PARTNER, 0, partner->state.animJumpRise); } - if (partner->state.velocity < 0.0f) { + if (partner->state.vel < 0.0f) { set_animation(ACTOR_PARTNER, 0, partner->state.animJumpFall); } - partner->state.currentPos.y = (partner->state.currentPos.y + partner->state.velocity); - partner->state.velocity = (partner->state.velocity - partner->state.acceleration); + partner->state.curPos.y = (partner->state.curPos.y + partner->state.vel); + partner->state.vel = (partner->state.vel - partner->state.acceleration); add_xz_vec3f(pos, partner->state.speed, partner->state.angle); - partner->currentPos.x = partner->state.currentPos.x; - partner->currentPos.y = partner->state.currentPos.y; - partner->currentPos.z = partner->state.currentPos.z; + partner->curPos.x = partner->state.curPos.x; + partner->curPos.y = partner->state.curPos.y; + partner->curPos.z = partner->state.curPos.z; - if (partner->currentPos.y < 10.0f) { - partner->currentPos.y = 10.0f; + if (partner->curPos.y < 10.0f) { + partner->curPos.y = 10.0f; - play_movement_dust_effects(2, partner->currentPos.x, partner->currentPos.y, partner->currentPos.z, + play_movement_dust_effects(2, partner->curPos.x, partner->curPos.y, partner->curPos.z, partner->yaw); sfx_play_sound(SOUND_SOFT_LAND); diff --git a/src/battle/partner/kooper.c b/src/battle/partner/kooper.c index 796b03c6341..0fd9c7fd853 100644 --- a/src/battle/partner/kooper.c +++ b/src/battle/partner/kooper.c @@ -36,26 +36,26 @@ API_CALLABLE(N(SlowDown)) { ActorState* partnerActorMovement = &partnerActor->state; if (isInitialCall) { - partnerActor->state.currentPos.x = partnerActor->currentPos.x; - partnerActor->state.currentPos.y = partnerActor->currentPos.y; - partnerActor->state.currentPos.z = partnerActor->currentPos.z; + partnerActor->state.curPos.x = partnerActor->curPos.x; + partnerActor->state.curPos.y = partnerActor->curPos.y; + partnerActor->state.curPos.z = partnerActor->curPos.z; } - add_xz_vec3f(&partnerActorMovement->currentPos, partnerActor->state.speed, partnerActor->state.angle); + add_xz_vec3f(&partnerActorMovement->curPos, partnerActor->state.speed, partnerActor->state.angle); if (partnerActor->state.speed < 4.0f) { - play_movement_dust_effects(0, partnerActor->state.currentPos.x, partnerActor->state.currentPos.y, - partnerActor->state.currentPos.z, partnerActor->state.angle); + play_movement_dust_effects(0, partnerActor->state.curPos.x, partnerActor->state.curPos.y, + partnerActor->state.curPos.z, partnerActor->state.angle); } else { - play_movement_dust_effects(1, partnerActor->state.currentPos.x, partnerActor->state.currentPos.y, - partnerActor->state.currentPos.z, partnerActor->state.angle); + play_movement_dust_effects(1, partnerActor->state.curPos.x, partnerActor->state.curPos.y, + partnerActor->state.curPos.z, partnerActor->state.angle); } partnerActorMovement->speed = partnerActorMovement->speed / 1.5; - partnerActor->currentPos.x = partnerActorMovement->currentPos.x; - partnerActor->currentPos.y = partnerActorMovement->currentPos.y; - partnerActor->currentPos.z = partnerActorMovement->currentPos.z; + partnerActor->curPos.x = partnerActorMovement->curPos.x; + partnerActor->curPos.y = partnerActorMovement->curPos.y; + partnerActor->curPos.z = partnerActorMovement->curPos.z; if (partnerActorMovement->speed < 1.0) { return ApiStatus_DONE2; @@ -80,7 +80,7 @@ API_CALLABLE(N(SetTargetsYaw)) { if (script->functionTemp[0] == 0) { for (i = 0; i < actor->targetListLength; i++) { - x = actor->currentPos.x; + x = actor->curPos.x; target = &actor->targetData[actor->targetIndexList[i]]; targetX = target->posA.x; targetActor = get_actor(target->actorID); diff --git a/src/battle/partner/lakilester.c b/src/battle/partner/lakilester.c index 3ce8a7e3d82..41aba0d1ae7 100644 --- a/src/battle/partner/lakilester.c +++ b/src/battle/partner/lakilester.c @@ -424,20 +424,20 @@ API_CALLABLE(N(SpinyFlipActionCommand)) { hudAim[i] = idAim = hud_element_create(N(aimHudScripts)[i]); hud_element_set_render_depth(idAim, 10); } - partnerState->currentPos.x = partner->currentPos.x + 33.0f; - partnerState->currentPos.y = partner->currentPos.y + 34.0f; - partnerState->currentPos.z = partner->currentPos.z + 15.0f; - partnerState->unk_18.x = partner->currentPos.x + 33.0f; - partnerState->unk_18.y = partner->currentPos.y + 34.0f; - partnerState->unk_18.z = partner->currentPos.z + 15.0f; + partnerState->curPos.x = partner->curPos.x + 33.0f; + partnerState->curPos.y = partner->curPos.y + 34.0f; + partnerState->curPos.z = partner->curPos.z + 15.0f; + partnerState->unk_18.x = partner->curPos.x + 33.0f; + partnerState->unk_18.y = partner->curPos.y + 34.0f; + partnerState->unk_18.z = partner->curPos.z + 15.0f; set_goal_pos_to_part(partnerState, partner->targetActorID, partner->targetPartIndex); target = get_actor(partner->targetActorID); part = get_actor_part(target, partner->targetPartIndex); partnerState->goalPos.x += part->projectileTargetOffset.x; partnerState->goalPos.y += part->projectileTargetOffset.y; partnerState->goalPos.z = partnerState->goalPos.z; // required to match - partnerState->distance = dist2D(partnerState->currentPos.x, - partnerState->currentPos.y, + partnerState->dist = dist2D(partnerState->curPos.x, + partnerState->curPos.y, partnerState->goalPos.x, partnerState->goalPos.y); partnerState->speed = 0.0f; @@ -514,22 +514,22 @@ API_CALLABLE(N(SpinyFlipActionCommand)) { sinTheta = sin_rad(theta); cosTheta = cos_rad(theta); speed = partnerState->speed; - partnerState->currentPos.x += speed * sinTheta; - partnerState->currentPos.y += speed * cosTheta; + partnerState->curPos.x += speed * sinTheta; + partnerState->curPos.y += speed * cosTheta; } - if (partnerState->currentPos.x < -30.0f) { - partnerState->currentPos.x = -30.0f; + if (partnerState->curPos.x < -30.0f) { + partnerState->curPos.x = -30.0f; } - if (partnerState->currentPos.x > 170.0f) { - partnerState->currentPos.x = 170.0f; + if (partnerState->curPos.x > 170.0f) { + partnerState->curPos.x = 170.0f; } - if (partnerState->currentPos.y > 130.0f) { - partnerState->currentPos.y = 130.0f; + if (partnerState->curPos.y > 130.0f) { + partnerState->curPos.y = 130.0f; } - if (partnerState->currentPos.y < 0.0f) { - partnerState->currentPos.y = 0.0f; + if (partnerState->curPos.y < 0.0f) { + partnerState->curPos.y = 0.0f; } - if (battleStatus->currentButtonsPressed & BUTTON_A) { + if (battleStatus->curButtonsPressed & BUTTON_A) { sAimingTimer = 0; } if (sAimingTimer == 60) { @@ -544,11 +544,11 @@ API_CALLABLE(N(SpinyFlipActionCommand)) { } script->varTable[14] = 0; script->varTable[15] = 0; - script->varTable[7] = partnerState->currentPos.x; - script->varTable[8] = partnerState->currentPos.y; - script->varTable[9] = partnerState->currentPos.z; - partnerState->distance = dist2D(partnerState->currentPos.x, partnerState->currentPos.y, partnerState->goalPos.x, partnerState->goalPos.y) / partnerState->unk_24; - if (partnerState->distance <= 12.0) { + script->varTable[7] = partnerState->curPos.x; + script->varTable[8] = partnerState->curPos.y; + script->varTable[9] = partnerState->curPos.z; + partnerState->dist = dist2D(partnerState->curPos.x, partnerState->curPos.y, partnerState->goalPos.x, partnerState->goalPos.y) / partnerState->unk_24; + if (partnerState->dist <= 12.0) { script->varTable[15] = 1; } hud_element_free(hudAimTarget); @@ -572,7 +572,7 @@ API_CALLABLE(N(SpinyFlipActionCommand)) { sTargetMarkRotation -= 10; sTargetMarkRotation = clamp_angle(sTargetMarkRotation); get_screen_coords(gCurrentCameraID, - partnerState->currentPos.x, partnerState->currentPos.y, partnerState->currentPos.z, + partnerState->curPos.x, partnerState->curPos.y, partnerState->curPos.z, &screenX, &screenY, &screenZ); hud_element_set_render_pos(hudAimReticle, screenX, screenY); @@ -590,11 +590,11 @@ API_CALLABLE(N(SpinyFlipActionCommand)) { switch (script->functionTemp[0]) { case 1: case 2: - playerState->currentPos.x = partnerState->currentPos.x; - playerState->currentPos.y = partnerState->currentPos.y; - playerState->currentPos.z = partnerState->currentPos.z; + playerState->curPos.x = partnerState->curPos.x; + playerState->curPos.y = partnerState->curPos.y; + playerState->curPos.z = partnerState->curPos.z; for (i = 0; i < ARRAY_COUNT(N(aimHudScripts)); i++) { - get_screen_coords(gCurrentCameraID, playerState->currentPos.x, playerState->currentPos.y, playerState->currentPos.z, &screenX, &screenY, &screenZ); + get_screen_coords(gCurrentCameraID, playerState->curPos.x, playerState->curPos.y, playerState->curPos.z, &screenX, &screenY, &screenZ); id = hudAim[i]; hud_element_set_render_pos(id, screenX, screenY); } @@ -608,9 +608,9 @@ API_CALLABLE(N(SpinyFlipActionCommand)) { API_CALLABLE(N(ThrowSpinyFX)) { BattleStatus* battleStatus = &gBattleStatus; Actor* partnerActor = battleStatus->partnerActor; - f32 xPos = partnerActor->currentPos.x + 5; - f32 yPos = partnerActor->currentPos.y + partnerActor->size.y + 20; - f32 zPos = partnerActor->currentPos.z; + f32 xPos = partnerActor->curPos.x + 5; + f32 yPos = partnerActor->curPos.y + partnerActor->size.y + 20; + f32 zPos = partnerActor->curPos.z; f32 var = rand_int(140) + 10; f32 var2 = rand_int(80) + 10; @@ -690,7 +690,7 @@ API_CALLABLE(N(CloudNineFX)) { switch (script->functionTemp[0]) { case 0: sCounter = 0.1f; - fx_ending_decals(0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z, 0.1f, &battleStatus->cloudNineEffect); + fx_ending_decals(0, actor->curPos.x, actor->curPos.y, actor->curPos.z, 0.1f, &battleStatus->cloudNineEffect); script->functionTemp[0] = 1; break; case 1: @@ -742,7 +742,7 @@ API_CALLABLE(N(InitHurricane)) { target = &partner->targetData[targetIdx]; actor = get_actor(target->actorID); part = get_actor_part(actor, target->partID); - hpMissingPercent = 100 - ((actor->currentHP * 100) / actor->maxHP); + hpMissingPercent = 100 - ((actor->curHP * 100) / actor->maxHP); hurricaneChance = actor->actorBlueprint->hurricaneChance; if (hurricaneChance > 0) { hurricaneChance += hurricaneChance * hpMissingPercent / 100; @@ -1455,15 +1455,15 @@ API_CALLABLE(N(ProcessHurricane)) { } sHuffPuffBreathEffect->data.huffPuffBreath->scale = sBreathSizeIncrease / 50.0 + 1.0; - x = partner->currentPos.x; - y = partner->currentPos.y; + x = partner->curPos.x; + y = partner->curPos.y; rand_int(1000); tempF1 = 5.0f; switch (sHuffPuffBreathState) { case STATE_INHALE: - x = partner->currentPos.x; - y = partner->currentPos.y + 15.0f; - z = partner->currentPos.z + tempF1; + x = partner->curPos.x; + y = partner->curPos.y + 15.0f; + z = partner->curPos.z + tempF1; add_vec2D_polar(&x, &y, 12.0f, 90.0f); sHuffPuffBreathEffect->data.huffPuffBreath->pos.x = x; sHuffPuffBreathEffect->data.huffPuffBreath->pos.y = y; @@ -1476,7 +1476,7 @@ API_CALLABLE(N(ProcessHurricane)) { sHuffPuffBreathEffect->data.huffPuffBreath->pos.z = NPC_DISPOSE_POS_Z; if (script->functionTemp[2] != 0) { - sfx_play_sound_at_position(SOUND_201E, SOUND_SPACE_MODE_0, partner->currentPos.x, partner->currentPos.y, partner->currentPos.z); + sfx_play_sound_at_position(SOUND_201E, SOUND_SPACE_MODE_0, partner->curPos.x, partner->curPos.y, partner->curPos.z); } script->functionTemp[2] = 0; @@ -1489,9 +1489,9 @@ API_CALLABLE(N(ProcessHurricane)) { sHuffPuffBreathEffect->data.huffPuffBreath->pos.z = NPC_DISPOSE_POS_Z; break; case STATE_EXHALE: - x = partner->currentPos.x; - y = partner->currentPos.y + 15.0f; - z = partner->currentPos.z + tempF1; + x = partner->curPos.x; + y = partner->curPos.y + 15.0f; + z = partner->curPos.z + tempF1; add_vec2D_polar(&x, &y, 12.0f, 90.0f); sHuffPuffBreathEffect->data.huffPuffBreath->pos.x = x; sHuffPuffBreathEffect->data.huffPuffBreath->pos.y = y; @@ -1499,7 +1499,7 @@ API_CALLABLE(N(ProcessHurricane)) { sHuffPuffBreathEffect->data.huffPuffBreath->speedX = 2.0f; if (script->functionTemp[2] == 0) { - sfx_play_sound_at_position(SOUND_201F, SOUND_SPACE_MODE_0, partner->currentPos.x, partner->currentPos.y, partner->currentPos.z); + sfx_play_sound_at_position(SOUND_201F, SOUND_SPACE_MODE_0, partner->curPos.x, partner->curPos.y, partner->curPos.z); } script->functionTemp[2] = 1; @@ -1653,33 +1653,33 @@ API_CALLABLE(N(BlowTargetAway)) { switch (script->functionTemp[0]) { case 0: target->state.moveTime = 0; - target->state.currentPos.x = target->currentPos.x; - target->state.currentPos.y = target->currentPos.y; - target->state.currentPos.z = target->currentPos.z; + target->state.curPos.x = target->curPos.x; + target->state.curPos.y = target->curPos.y; + target->state.curPos.z = target->curPos.z; target->state.speed = 5.5f; sNumEnemiesBeingBlown += 1; - battleStatus->currentAttackElement = 0; + battleStatus->curAttackElement = 0; dispatch_event_actor(target, EVENT_BLOW_AWAY); script->functionTemp[0] = 1; break; case 1: - target->state.currentPos.x += target->state.speed; - temp_f20 = target->state.currentPos.y; - target->state.currentPos.y = + target->state.curPos.x += target->state.speed; + temp_f20 = target->state.curPos.y; + target->state.curPos.y = temp_f20 + ((sin_rad(2.0f * sin_rad(DEG_TO_RAD(target->state.moveTime)) * PI_S) * 1.4) + 0.5); target->state.moveTime += 6; target->state.moveTime = clamp_angle(target->state.moveTime); target->yaw += 33.0f; target->yaw = clamp_angle(target->yaw); - if (target->state.currentPos.x > 240.0f) { + if (target->state.curPos.x > 240.0f) { sNumEnemiesBeingBlown -= 1; return ApiStatus_DONE2; } break; } - target->currentPos.x = state->currentPos.x; - target->currentPos.y = state->currentPos.y; - target->currentPos.z = state->currentPos.z; + target->curPos.x = state->curPos.x; + target->curPos.y = state->curPos.y; + target->curPos.z = state->curPos.z; return ApiStatus_BLOCK; } diff --git a/src/battle/partner/parakarry.c b/src/battle/partner/parakarry.c index 7c70470650b..bcfa03b41e8 100644 --- a/src/battle/partner/parakarry.c +++ b/src/battle/partner/parakarry.c @@ -148,22 +148,22 @@ API_CALLABLE(N(ShellShotActionCommand)) { state->goalPos.z = state->goalPos.z; state->unk_24 = (targetActorPart->size.y + targetActorPart->size.x) / 2 / 24.0; hud_element_set_scale(hudTarget, state->unk_24 * targetActor->scalingFactor); - state->currentPos.x = parakarry->currentPos.x + 8.0f; - state->currentPos.y = parakarry->currentPos.y + 16.0f; - state->currentPos.z = parakarry->currentPos.z; - state->angle = atan2(state->currentPos.x, state->currentPos.y, state->goalPos.x, state->goalPos.y); + state->curPos.x = parakarry->curPos.x + 8.0f; + state->curPos.y = parakarry->curPos.y + 16.0f; + state->curPos.z = parakarry->curPos.z; + state->angle = atan2(state->curPos.x, state->curPos.y, state->goalPos.x, state->goalPos.y); state->bounceDivisor = state->angle; - state->distance = 116.0f; + state->dist = 116.0f; state->unk_18.x = state->angle; i = 0; for (i = 0; i < 30; i++) { state->unk_18.x -= 1.0f; aimAngle = clamp_angle(state->unk_18.x); - x = state->currentPos.x; - y = state->currentPos.y; - z = state->currentPos.z; - clampedAngleDiff = state->distance; + x = state->curPos.x; + y = state->curPos.y; + z = state->curPos.z; + clampedAngleDiff = state->dist; add_vec2D_polar(&x, &y, clampedAngleDiff, aimAngle); get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ); if (screenY > 180) { @@ -177,10 +177,10 @@ API_CALLABLE(N(ShellShotActionCommand)) { for (i = 0; i < 30; i++) { state->unk_18.y += 1.0f; aimAngle = clamp_angle(state->unk_18.y); - x = state->currentPos.x; - y = state->currentPos.y; - z = state->currentPos.z; - add_vec2D_polar(&x, &y, state->distance, aimAngle); + x = state->curPos.x; + y = state->curPos.y; + z = state->curPos.z; + add_vec2D_polar(&x, &y, state->dist, aimAngle); get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ); if (screenY < 30) { break; @@ -192,9 +192,9 @@ API_CALLABLE(N(ShellShotActionCommand)) { hudTargetRotation = 0; shellShotTimer = 90; #if VERSION_PAL - state->velocity = 4.0f; + state->vel = 4.0f; #else - state->velocity = 3.0f; + state->vel = 3.0f; #endif battleStatus->unk_86 = 0; action_command_init_status(); @@ -202,7 +202,7 @@ API_CALLABLE(N(ShellShotActionCommand)) { script->functionTemp[0] = 1; break; case 1: - if (gActionCommandStatus.autoSucceed || battleStatus->currentButtonsDown & BUTTON_STICK_LEFT) { + if (gActionCommandStatus.autoSucceed || battleStatus->curButtonsDown & BUTTON_STICK_LEFT) { shellShotTimer = 0; } @@ -225,7 +225,7 @@ API_CALLABLE(N(ShellShotActionCommand)) { break; case 2: if (!(gActionCommandStatus.autoSucceed)) { - if (!(battleStatus->currentButtonsDown & BUTTON_STICK_LEFT)) { + if (!(battleStatus->curButtonsDown & BUTTON_STICK_LEFT)) { script->functionTemp[0] = 3; break; } @@ -243,16 +243,16 @@ API_CALLABLE(N(ShellShotActionCommand)) { } } - state->angle += state->velocity; + state->angle += state->vel; if (state->angle <= state->unk_18.x) { state->angle = state->unk_18.x; - state->velocity = 0.0f - state->velocity; + state->vel = 0.0f - state->vel; } if (state->angle >= state->unk_18.y) { state->angle = state->unk_18.y; - state->velocity = 0.0f - state->velocity; + state->vel = 0.0f - state->vel; } break; case 3: @@ -260,7 +260,7 @@ API_CALLABLE(N(ShellShotActionCommand)) { clampedAngleDiff = get_clamped_angle_diff(state->angle, state->bounceDivisor); aimAngle = fabsf(clampedAngleDiff) / state->unk_24 * targetActor->scalingFactor; - if (state->velocity >= 0.0f) { + if (state->vel >= 0.0f) { if (clampedAngleDiff < 0.0f) { battleStatus->unk_86 = 0; } else { @@ -326,18 +326,18 @@ API_CALLABLE(N(ShellShotActionCommand)) { if (script->functionTemp[0] >= 2) { if (script->functionTemp[0] < 3) { aimAngle = clamp_angle(state->angle); - aimX = state->currentPos.x; - aimY = state->currentPos.y; - aimZ = state->currentPos.z; - add_vec2D_polar(&aimX, &aimY, state->distance, aimAngle); - z = state->currentPos.z; - x = state->currentPos.x; - y = state->currentPos.y; + aimX = state->curPos.x; + aimY = state->curPos.y; + aimZ = state->curPos.z; + add_vec2D_polar(&aimX, &aimY, state->dist, aimAngle); + z = state->curPos.z; + x = state->curPos.x; + y = state->curPos.y; for (i = 0; i < ARRAY_COUNT(hudShimmers); i++) { - x += (aimX - state->currentPos.x) / 6.0f; - y += (aimY - state->currentPos.y) / 6.0f; - z += (aimZ - state->currentPos.z) / 6.0f; + x += (aimX - state->curPos.x) / 6.0f; + y += (aimY - state->curPos.y) / 6.0f; + z += (aimZ - state->curPos.z) / 6.0f; get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ); hud_element_set_render_pos(hudMarkers[i], screenX, screenY); hudID = hudShimmers[i]; @@ -378,7 +378,7 @@ API_CALLABLE(N(AirLiftChance)) { Actor* targetActor = get_actor(partnerActor->targetActorID); ActorPart* targetActorPart = get_actor_part(targetActor, partnerActor->targetPartIndex); s32 airLiftChance = targetActor->actorBlueprint->airLiftChance; - s32 hpPercentLost = 100 - targetActor->currentHP * 100 / targetActor->maxHP; + s32 hpPercentLost = 100 - targetActor->curHP * 100 / targetActor->maxHP; if (targetActor->transparentStatus == STATUS_KEY_TRANSPARENT) { airLiftChance = 0; @@ -428,39 +428,39 @@ API_CALLABLE(N(CarryAway)) { switch (script->functionTemp[0]) { case 0: - parakarry->state.goalPos.x = targetActor->currentPos.x - parakarry->currentPos.x; - parakarry->state.goalPos.y = targetActor->currentPos.y - parakarry->currentPos.y; - parakarry->state.goalPos.z = targetActor->currentPos.z - parakarry->currentPos.z; + parakarry->state.goalPos.x = targetActor->curPos.x - parakarry->curPos.x; + parakarry->state.goalPos.y = targetActor->curPos.y - parakarry->curPos.y; + parakarry->state.goalPos.z = targetActor->curPos.z - parakarry->curPos.z; parakarry->state.speed = 2.0f; parakarry->state.moveTime = 0; script->functionTemp[0] = 1; break; case 1: - parakarry->state.currentPos.x += parakarry->state.speed; + parakarry->state.curPos.x += parakarry->state.speed; *animationRatePtr = 1.0f; - y = parakarry->state.currentPos.y; - parakarry->state.currentPos.y = y + (sin_rad(2.0f * sin_rad(DEG_TO_RAD(parakarry->state.moveTime)) * PI_S) * 1.4 + 0.5); + y = parakarry->state.curPos.y; + parakarry->state.curPos.y = y + (sin_rad(2.0f * sin_rad(DEG_TO_RAD(parakarry->state.moveTime)) * PI_S) * 1.4 + 0.5); parakarry->state.moveTime += 6; parakarry->state.moveTime = clamp_angle(parakarry->state.moveTime); if (gGameStatusPtr->frameCounter % 10 == 0) { - sfx_play_sound_at_position(SOUND_2009, SOUND_SPACE_MODE_0, parakarry->state.currentPos.x, parakarry->state.currentPos.y, parakarry->state.currentPos.z); + sfx_play_sound_at_position(SOUND_2009, SOUND_SPACE_MODE_0, parakarry->state.curPos.x, parakarry->state.curPos.y, parakarry->state.curPos.z); } - if (parakarry->state.currentPos.x > 240.0f) { + if (parakarry->state.curPos.x > 240.0f) { battleStatus->actionResult = temp_s4; return ApiStatus_DONE2; } break; } - parakarry->currentPos.x = actorState->currentPos.x; - parakarry->currentPos.y = actorState->currentPos.y; - parakarry->currentPos.z = actorState->currentPos.z; + parakarry->curPos.x = actorState->curPos.x; + parakarry->curPos.y = actorState->curPos.y; + parakarry->curPos.z = actorState->curPos.z; - targetActor->currentPos.x = actorState->currentPos.x + actorState->goalPos.x; - targetActor->currentPos.y = actorState->currentPos.y + actorState->goalPos.y; - targetActor->currentPos.z = actorState->currentPos.z + actorState->goalPos.z; + targetActor->curPos.x = actorState->curPos.x + actorState->goalPos.x; + targetActor->curPos.y = actorState->curPos.y + actorState->goalPos.y; + targetActor->curPos.z = actorState->curPos.z + actorState->goalPos.z; return ApiStatus_BLOCK; } @@ -474,9 +474,9 @@ API_CALLABLE(N(FlyAround)) { switch (script->functionTemp[0]) { case 0: - state->currentPos.x = partner->currentPos.x; - state->currentPos.y = partner->currentPos.y; - state->currentPos.z = partner->currentPos.z; + state->curPos.x = partner->curPos.x; + state->curPos.y = partner->curPos.y; + state->curPos.z = partner->curPos.z; state->angle = 60 - rand_int(10); state->bounceDivisor = 0.0f; state->moveTime = 90; @@ -484,15 +484,15 @@ API_CALLABLE(N(FlyAround)) { script->functionTemp[1] = 0; script->functionTemp[2] = 0; script->functionTemp[3] = 0; - airRaidEffect = fx_effect_65(0, state->currentPos.x, state->currentPos.y, state->currentPos.z, 1.0f, 0); + airRaidEffect = fx_effect_65(0, state->curPos.x, state->curPos.y, state->curPos.z, 1.0f, 0); script->functionTemp[0] = 1; break; case 1: - add_vec2D_polar(&state->currentPos.x, &state->currentPos.y, state->speed, state->angle); - airRaidEffect->data.unk_65->pos.x = state->currentPos.x; - airRaidEffect->data.unk_65->pos.y = state->currentPos.y; - airRaidEffect->data.unk_65->pos.z = state->currentPos.z; - if (state->currentPos.x < -190.0f) { + add_vec2D_polar(&state->curPos.x, &state->curPos.y, state->speed, state->angle); + airRaidEffect->data.unk_65->pos.x = state->curPos.x; + airRaidEffect->data.unk_65->pos.y = state->curPos.y; + airRaidEffect->data.unk_65->pos.z = state->curPos.z; + if (state->curPos.x < -190.0f) { if (script->functionTemp[1] != 0) { script->functionTemp[0] = 2; break; @@ -507,14 +507,14 @@ API_CALLABLE(N(FlyAround)) { } if (script->functionTemp[3] != 0) { - sfx_play_sound_at_position(SOUND_200A, SOUND_SPACE_MODE_0, state->currentPos.x, state->currentPos.y, state->currentPos.z); + sfx_play_sound_at_position(SOUND_200A, SOUND_SPACE_MODE_0, state->curPos.x, state->curPos.y, state->curPos.z); } else { - sfx_play_sound_at_position(SOUND_200B, SOUND_SPACE_MODE_0, state->currentPos.x, state->currentPos.y, state->currentPos.z); + sfx_play_sound_at_position(SOUND_200B, SOUND_SPACE_MODE_0, state->curPos.x, state->curPos.y, state->curPos.z); } script->functionTemp[3] = 1 - script->functionTemp[3]; } - if (state->currentPos.x > 190.0f) { + if (state->curPos.x > 190.0f) { if (script->functionTemp[1] != 0) { script->functionTemp[0] = 2; break; @@ -529,14 +529,14 @@ API_CALLABLE(N(FlyAround)) { } while (0); if (script->functionTemp[3] != 0) { - sfx_play_sound_at_position(SOUND_200A, SOUND_SPACE_MODE_0, state->currentPos.x, state->currentPos.y, state->currentPos.z); + sfx_play_sound_at_position(SOUND_200A, SOUND_SPACE_MODE_0, state->curPos.x, state->curPos.y, state->curPos.z); } else { - sfx_play_sound_at_position(SOUND_200B, SOUND_SPACE_MODE_0, state->currentPos.x, state->currentPos.y, state->currentPos.z); + sfx_play_sound_at_position(SOUND_200B, SOUND_SPACE_MODE_0, state->curPos.x, state->curPos.y, state->curPos.z); } script->functionTemp[3] = 1 - script->functionTemp[3]; } - if (state->currentPos.y < -30.0f) { + if (state->curPos.y < -30.0f) { if (script->functionTemp[1] != 0) { script->functionTemp[0] = 2; break; @@ -551,14 +551,14 @@ API_CALLABLE(N(FlyAround)) { } while (0); // TODO macro? if (script->functionTemp[3] != 0) { - sfx_play_sound_at_position(SOUND_200A, SOUND_SPACE_MODE_0, state->currentPos.x, state->currentPos.y, state->currentPos.z); + sfx_play_sound_at_position(SOUND_200A, SOUND_SPACE_MODE_0, state->curPos.x, state->curPos.y, state->curPos.z); } else { - sfx_play_sound_at_position(SOUND_200B, SOUND_SPACE_MODE_0, state->currentPos.x, state->currentPos.y, state->currentPos.z); + sfx_play_sound_at_position(SOUND_200B, SOUND_SPACE_MODE_0, state->curPos.x, state->curPos.y, state->curPos.z); } script->functionTemp[3] = 1 - script->functionTemp[3]; } - if (state->currentPos.y > 160.0f) { + if (state->curPos.y > 160.0f) { if (script->functionTemp[1] != 0) { script->functionTemp[0] = 2; break; @@ -573,9 +573,9 @@ API_CALLABLE(N(FlyAround)) { } while (0); // TODO macro? if (script->functionTemp[3] != 0) { - sfx_play_sound_at_position(SOUND_200A, SOUND_SPACE_MODE_0, state->currentPos.x, state->currentPos.y, state->currentPos.z); + sfx_play_sound_at_position(SOUND_200A, SOUND_SPACE_MODE_0, state->curPos.x, state->curPos.y, state->curPos.z); } else { - sfx_play_sound_at_position(SOUND_200B, SOUND_SPACE_MODE_0, state->currentPos.x, state->currentPos.y, state->currentPos.z); + sfx_play_sound_at_position(SOUND_200B, SOUND_SPACE_MODE_0, state->curPos.x, state->curPos.y, state->curPos.z); } script->functionTemp[3] = 1 - script->functionTemp[3]; } @@ -596,17 +596,17 @@ API_CALLABLE(N(FlyAround)) { airRaidEffect->flags |= FX_INSTANCE_FLAG_DISMISS; // fallthrough case 3: - add_vec2D_polar(&state->currentPos.x, &state->currentPos.y, state->speed, state->angle); + add_vec2D_polar(&state->curPos.x, &state->curPos.y, state->speed, state->angle); if (state->moveTime == 0) { - partner->rotation.z = 0.0f; + partner->rot.z = 0.0f; return ApiStatus_DONE2; } state->moveTime--; // fallthrough default: - partner->currentPos.x = state->currentPos.x; - partner->currentPos.y = state->currentPos.y; - partner->currentPos.z = state->currentPos.z; + partner->curPos.x = state->curPos.x; + partner->curPos.y = state->curPos.y; + partner->curPos.z = state->curPos.z; return ApiStatus_BLOCK; } } diff --git a/src/battle/partner/sushie.c b/src/battle/partner/sushie.c index 466497a00e6..d5b2539a4cf 100644 --- a/src/battle/partner/sushie.c +++ b/src/battle/partner/sushie.c @@ -41,19 +41,19 @@ API_CALLABLE(N(SetSquirtAngle)) { partner->state.goalPos.y += targetPart->projectileTargetOffset.y; partner->state.goalPos.z = partner->state.goalPos.z; // required to match - partner->state.currentPos.x = partner->currentPos.x + 8.0f; - partner->state.currentPos.y = partner->currentPos.y + 16.0f; - partner->state.currentPos.z = partner->currentPos.z; + partner->state.curPos.x = partner->curPos.x + 8.0f; + partner->state.curPos.y = partner->curPos.y + 16.0f; + partner->state.curPos.z = partner->curPos.z; partner->state.angle = atan2( - partner->state.currentPos.x, partner->state.currentPos.y, + partner->state.curPos.x, partner->state.curPos.y, partner->state.goalPos.x, partner->state.goalPos.y ); - partner->rotation.z = (partner->state.angle - 90.0f) * 0.25f; + partner->rot.z = (partner->state.angle - 90.0f) * 0.25f; - if (partner->rotation.z < 0.0f) { - partner->rotation.z = 0.0f; + if (partner->rot.z < 0.0f) { + partner->rot.z = 0.0f; } return ApiStatus_DONE2; @@ -177,7 +177,7 @@ API_CALLABLE(N(PlaySquirtFX)) { Actor* partnerActor = battleStatus->partnerActor; Actor* playerActor = battleStatus->playerActor; - sEffect = fx_squirt(1, partnerActor->currentPos.x - 5.5, partnerActor->currentPos.y + 15.5, partnerActor->currentPos.z + 5, playerActor->currentPos.x, playerActor->currentPos.y, playerActor->currentPos.z, (rand_int(10) * 0.1) + 1, 30); + sEffect = fx_squirt(1, partnerActor->curPos.x - 5.5, partnerActor->curPos.y + 15.5, partnerActor->curPos.z + 5, playerActor->curPos.x, playerActor->curPos.y, playerActor->curPos.z, (rand_int(10) * 0.1) + 1, 30); return ApiStatus_DONE2; } @@ -210,24 +210,24 @@ API_CALLABLE(N(ProcessTidalWave)) { switch (script->functionTemp[0]) { case 0: - state->currentPos.x = partner->currentPos.x; - state->currentPos.y = partner->currentPos.y; - state->currentPos.z = partner->currentPos.z; + state->curPos.x = partner->curPos.x; + state->curPos.y = partner->curPos.y; + state->curPos.z = partner->curPos.z; state->angle = 315.0f; state->bounceDivisor = 0.0f; state->moveTime = 90; state->speed = 32.0f; script->functionTemp[1] = 0; script->functionTemp[2] = 0; - sEffect = fx_water_fountain(1, state->currentPos.x, state->currentPos.y, state->currentPos.z, 1.0f, 0); + sEffect = fx_water_fountain(1, state->curPos.x, state->curPos.y, state->curPos.z, 1.0f, 0); sEffect->data.waterFountain->unk_38 = state->angle; sEffect->data.waterFountain->unk_3C = partner->scale.x; sEffect->data.waterFountain->unk_40 = partner->scale.x; script->functionTemp[0] = 1; break; case 1: - add_vec2D_polar(&state->currentPos.x, &state->currentPos.y, state->speed, state->angle); - if (state->currentPos.x < -160.0f) { + add_vec2D_polar(&state->curPos.x, &state->curPos.y, state->speed, state->angle); + if (state->curPos.x < -160.0f) { if (script->functionTemp[1] != 0) { script->functionTemp[0] = 2; break; @@ -242,7 +242,7 @@ API_CALLABLE(N(ProcessTidalWave)) { } } - if (state->currentPos.x > 160.0f) { + if (state->curPos.x > 160.0f) { if (script->functionTemp[1] != 0) { script->functionTemp[0] = 2; break; @@ -259,14 +259,14 @@ API_CALLABLE(N(ProcessTidalWave)) { } while (0); if (script->functionTemp[2] != 0) { - sfx_play_sound_at_position(SOUND_29B, SOUND_SPACE_MODE_0, state->currentPos.x, state->currentPos.y, state->currentPos.z); + sfx_play_sound_at_position(SOUND_29B, SOUND_SPACE_MODE_0, state->curPos.x, state->curPos.y, state->curPos.z); } else { - sfx_play_sound_at_position(SOUND_29C, SOUND_SPACE_MODE_0, state->currentPos.x, state->currentPos.y, state->currentPos.z); + sfx_play_sound_at_position(SOUND_29C, SOUND_SPACE_MODE_0, state->curPos.x, state->curPos.y, state->curPos.z); } script->functionTemp[2] = 1 - script->functionTemp[2]; } - if (state->currentPos.y < 0.0f) { + if (state->curPos.y < 0.0f) { if (script->functionTemp[1] != 0) { script->functionTemp[0] = 2; break; @@ -283,14 +283,14 @@ API_CALLABLE(N(ProcessTidalWave)) { } while (0); // TODO macro? if (script->functionTemp[2] != 0) { - sfx_play_sound_at_position(SOUND_29B, SOUND_SPACE_MODE_0, state->currentPos.x, state->currentPos.y, state->currentPos.z); + sfx_play_sound_at_position(SOUND_29B, SOUND_SPACE_MODE_0, state->curPos.x, state->curPos.y, state->curPos.z); } else { - sfx_play_sound_at_position(SOUND_29C, SOUND_SPACE_MODE_0, state->currentPos.x, state->currentPos.y, state->currentPos.z); + sfx_play_sound_at_position(SOUND_29C, SOUND_SPACE_MODE_0, state->curPos.x, state->curPos.y, state->curPos.z); } script->functionTemp[2] = 1 - script->functionTemp[2]; } - if (state->currentPos.y > 130.0f) { + if (state->curPos.y > 130.0f) { if (script->functionTemp[1] != 0) { script->functionTemp[0] = 2; break; @@ -307,15 +307,15 @@ API_CALLABLE(N(ProcessTidalWave)) { } while (0); // TODO macro? if (script->functionTemp[2] != 0) { - sfx_play_sound_at_position(SOUND_29B, SOUND_SPACE_MODE_0, state->currentPos.x, state->currentPos.y, state->currentPos.z); + sfx_play_sound_at_position(SOUND_29B, SOUND_SPACE_MODE_0, state->curPos.x, state->curPos.y, state->curPos.z); } else { - sfx_play_sound_at_position(SOUND_29C, SOUND_SPACE_MODE_0, state->currentPos.x, state->currentPos.y, state->currentPos.z); + sfx_play_sound_at_position(SOUND_29C, SOUND_SPACE_MODE_0, state->curPos.x, state->curPos.y, state->curPos.z); } script->functionTemp[2] = 1 - script->functionTemp[2]; } state->angle = clamp_angle(state->angle + (state->bounceDivisor * 0.5)); - partner->rotation.z = clamp_angle(state->angle - 315.0f); + partner->rot.z = clamp_angle(state->angle - 315.0f); partner->scale.z = partner->scale.y = partner->scale.x = partner->scale.x - 0.06; if (partner->scale.x < 1.0) { partner->scale.x = 1.0f; @@ -325,9 +325,9 @@ API_CALLABLE(N(ProcessTidalWave)) { x = 0.0f; y = 0.0f; add_vec2D_polar(&x, &y, partner->scale.x * -15.0f, state->angle); - sEffect->data.waterFountain->pos.x = state->currentPos.x + x; - sEffect->data.waterFountain->pos.y = state->currentPos.y + y; - sEffect->data.waterFountain->pos.z = state->currentPos.z + 5.0f; + sEffect->data.waterFountain->pos.x = state->curPos.x + x; + sEffect->data.waterFountain->pos.y = state->curPos.y + y; + sEffect->data.waterFountain->pos.z = state->curPos.z + 5.0f; sEffect->data.waterFountain->unk_38 = state->angle; sEffect->data.waterFountain->unk_3C = partner->scale.x; sEffect->data.waterFountain->unk_40 = partner->scale.x; @@ -349,24 +349,24 @@ API_CALLABLE(N(ProcessTidalWave)) { state->moveTime = 5; script->functionTemp[0] = 3; case 3: - add_vec2D_polar(&state->currentPos.x, &state->currentPos.y, state->speed, state->angle); - sEffect->data.waterFountain->pos.x = state->currentPos.x; - sEffect->data.waterFountain->pos.y = state->currentPos.y; - sEffect->data.waterFountain->pos.z = state->currentPos.z; + add_vec2D_polar(&state->curPos.x, &state->curPos.y, state->speed, state->angle); + sEffect->data.waterFountain->pos.x = state->curPos.x; + sEffect->data.waterFountain->pos.y = state->curPos.y; + sEffect->data.waterFountain->pos.z = state->curPos.z; sEffect->data.waterFountain->unk_38 = state->angle; sEffect->data.waterFountain->unk_3C = partner->scale.x; sEffect->data.waterFountain->unk_40 = partner->scale.x; if (state->moveTime == 0) { - partner->rotation.z = 0.0f; + partner->rot.z = 0.0f; sEffect->flags |= FX_INSTANCE_FLAG_DISMISS; return ApiStatus_DONE2; } state->moveTime--; default: - partner->currentPos.x = state->currentPos.x; - partner->currentPos.y = state->currentPos.y; - partner->currentPos.z = state->currentPos.z; - fx_water_splash(3, partner->currentPos.x, partner->currentPos.y, partner->currentPos.z, 1.0f, 10); + partner->curPos.x = state->curPos.x; + partner->curPos.y = state->curPos.y; + partner->curPos.z = state->curPos.z; + fx_water_splash(3, partner->curPos.x, partner->curPos.y, partner->curPos.z, 1.0f, 10); break; } return ApiStatus_BLOCK; diff --git a/src/battle/partner/watt.c b/src/battle/partner/watt.c index e50f10b1d29..8e3b8c5f9de 100644 --- a/src/battle/partner/watt.c +++ b/src/battle/partner/watt.c @@ -54,8 +54,8 @@ API_CALLABLE(N(WattFXUpdate)) { sWattEffectData_bouncePhase = 0; sWattEffectData_isActive = TRUE; sWattEffectData_currentEffectIndex = 0; - sWattEffectData_effect1 = fx_static_status(0, partner->currentPos.x, partner->currentPos.y, partner->currentPos.z, 1.0f, 5, 0); - sWattEffectData_effect2 = fx_static_status(1, partner->currentPos.x, NPC_DISPOSE_POS_Y, partner->currentPos.z, 1.0f, 5, 0); + sWattEffectData_effect1 = fx_static_status(0, partner->curPos.x, partner->curPos.y, partner->curPos.z, 1.0f, 5, 0); + sWattEffectData_effect2 = fx_static_status(1, partner->curPos.x, NPC_DISPOSE_POS_Y, partner->curPos.z, 1.0f, 5, 0); sWattEffectData_initialized = TRUE; } @@ -69,9 +69,9 @@ API_CALLABLE(N(WattFXUpdate)) { } partner->verticalRenderOffset = sin_rad(DEG_TO_RAD(sWattEffectData_bouncePhase)) * 3.0f; - x = partner->currentPos.x + partner->headOffset.x; - y = partner->currentPos.y + partner->headOffset.y + partner->verticalRenderOffset + 12.0f; - z = partner->currentPos.z + partner->headOffset.z; + x = partner->curPos.x + partner->headOffset.x; + y = partner->curPos.y + partner->headOffset.y + partner->verticalRenderOffset + 12.0f; + z = partner->curPos.z + partner->headOffset.z; if ((gBattleStatus.flags2 & (BS_FLAGS2_10 | BS_FLAGS2_4)) == BS_FLAGS2_4) { y = NPC_DISPOSE_POS_Y; } @@ -197,9 +197,9 @@ API_CALLABLE(N(PowerShockFX)) { API_CALLABLE(N(PowerShockDischargeFX)) { Bytecode* args = script->ptrReadPos; Actor* partner = gBattleStatus.partnerActor; - f32 x = partner->currentPos.x + partner->headOffset.x; - f32 y = partner->currentPos.y + partner->headOffset.y + partner->verticalRenderOffset + 12.0f; - f32 z = partner->currentPos.z + partner->headOffset.z; + f32 x = partner->curPos.x + partner->headOffset.x; + f32 y = partner->curPos.y + partner->headOffset.y + partner->verticalRenderOffset + 12.0f; + f32 z = partner->curPos.z + partner->headOffset.z; if (isInitialCall) { script->functionTemp[0] = evt_get_variable(script, *args++); @@ -254,18 +254,18 @@ API_CALLABLE(N(TurboChargeUnwindWatt)) { switch (script->functionTemp[0]) { case 0: script->functionTemp[2] = evt_get_variable(script, *args++); - partner->state.distance = dist2D(player->currentPos.x, player->currentPos.y, partner->currentPos.x, partner->currentPos.y); + partner->state.dist = dist2D(player->curPos.x, player->curPos.y, partner->curPos.x, partner->curPos.y); - partner->state.goalPos.x = player->currentPos.x; - partner->state.goalPos.y = player->currentPos.y + 36.0f; - partner->state.goalPos.z = player->currentPos.z; + partner->state.goalPos.x = player->curPos.x; + partner->state.goalPos.y = player->curPos.y + 36.0f; + partner->state.goalPos.z = player->curPos.z; - partner->state.currentPos.x = partner->currentPos.x; - partner->state.currentPos.y = partner->currentPos.y; - partner->state.currentPos.z = partner->currentPos.z; + partner->state.curPos.x = partner->curPos.x; + partner->state.curPos.y = partner->curPos.y; + partner->state.curPos.z = partner->curPos.z; partner->state.angle = 90.0f; - partner->state.velocity = 5.0f; + partner->state.vel = 5.0f; partner->state.acceleration = 0.5f; partner->state.moveTime = 90; script->functionTemp[1] = 10; @@ -275,13 +275,13 @@ API_CALLABLE(N(TurboChargeUnwindWatt)) { theta = DEG_TO_RAD(partner->state.angle); sinTheta = sin_rad(theta); cosTheta = cos_rad(theta); - partner->state.velocity += partner->state.acceleration; + partner->state.vel += partner->state.acceleration; angle = partner->state.angle; - angle += partner->state.velocity; - deltaX = partner->state.distance * sinTheta; - deltaY = -partner->state.distance * cosTheta; - partner->state.currentPos.x = partner->state.goalPos.x + deltaX; - partner->state.currentPos.y = partner->state.goalPos.y + deltaY; + angle += partner->state.vel; + deltaX = partner->state.dist * sinTheta; + deltaY = -partner->state.dist * cosTheta; + partner->state.curPos.x = partner->state.goalPos.x + deltaX; + partner->state.curPos.y = partner->state.goalPos.y + deltaY; partner->state.angle = angle; partner->state.angle = clamp_angle(angle); @@ -294,13 +294,13 @@ API_CALLABLE(N(TurboChargeUnwindWatt)) { theta = DEG_TO_RAD(partner->state.angle); sinTheta = sin_rad(theta); cosTheta = cos_rad(theta); - distance = partner->state.distance; + distance = partner->state.dist; angle = partner->state.angle; - angle += partner->state.velocity; - deltaX = partner->state.distance * sinTheta; - deltaY = -partner->state.distance * cosTheta; - partner->state.currentPos.x = partner->state.goalPos.x + deltaX; - partner->state.currentPos.y = partner->state.goalPos.y + deltaY; + angle += partner->state.vel; + deltaX = partner->state.dist * sinTheta; + deltaY = -partner->state.dist * cosTheta; + partner->state.curPos.x = partner->state.goalPos.x + deltaX; + partner->state.curPos.y = partner->state.goalPos.y + deltaY; partner->state.angle = angle; partner->state.angle = clamp_angle(angle); if (partner->state.angle < 45.0f) { @@ -319,9 +319,9 @@ API_CALLABLE(N(TurboChargeUnwindWatt)) { partner->yaw = 180.0f; } - partner->currentPos.x = partnerState->currentPos.x; - partner->currentPos.y = partnerState->currentPos.y; - partner->currentPos.z = partnerState->currentPos.z; + partner->curPos.x = partnerState->curPos.x; + partner->curPos.y = partnerState->curPos.y; + partner->curPos.z = partnerState->curPos.z; if (script->functionTemp[2] == 0) { player->yaw += script->functionTemp[1]; script->functionTemp[1]++; diff --git a/src/battle/use_items.c b/src/battle/use_items.c index ddbffe42892..b4e95f8c721 100644 --- a/src/battle/use_items.c +++ b/src/battle/use_items.c @@ -170,14 +170,14 @@ API_CALLABLE(LoadMysteryItemScript) { s32* itemPtr; s32 i; - battleStatus->currentTargetListFlags = item->targetFlags | TARGET_FLAG_8000; - battleStatus->currentAttackElement = 0; + battleStatus->curTargetListFlags = item->targetFlags | TARGET_FLAG_8000; + battleStatus->curAttackElement = 0; player_create_target_list(actor); target = &actor->targetData[actor->targetIndexList[0]]; - battleStatus->currentTargetID = target->actorID; - battleStatus->currentTargetPart = target->partID; + battleStatus->curTargetID = target->actorID; + battleStatus->curTargetPart = target->partID; itemPtr = &ItemKeys[0]; for (i = 0; *itemPtr != ITEM_NONE; i++, itemPtr++) { diff --git a/src/battle_cam.c b/src/battle_cam.c index 6a84579b2b7..1da14074d31 100644 --- a/src/battle_cam.c +++ b/src/battle_cam.c @@ -167,9 +167,9 @@ s32 CamPresetUpdate_F(Evt* script, s32 isInitialCall) { if (actor == NULL) { return ApiStatus_BLOCK; } - x = actor->currentPos.x; - y = actor->currentPos.y + actor->size.y / 2 + actor->size.y / 4; - z = actor->currentPos.z; + x = actor->curPos.x; + y = actor->curPos.y + actor->size.y / 2 + actor->size.y / 4; + z = actor->curPos.z; sizeY = actor->size.y; sizeX = actor->size.x; @@ -180,9 +180,9 @@ s32 CamPresetUpdate_F(Evt* script, s32 isInitialCall) { return ApiStatus_BLOCK; } - targetX = targetActor->currentPos.x; - targetY = targetActor->currentPos.y + targetActor->size.y / 2 + targetActor->size.y / 4; - targetZ = targetActor->currentPos.z; + targetX = targetActor->curPos.x; + targetY = targetActor->curPos.y + targetActor->size.y / 2 + targetActor->size.y / 4; + targetZ = targetActor->curPos.z; targetAverageSize = (targetActor->size.y + targetActor->size.x) / 2; middlePosX = x + (targetX - x) / 2; @@ -206,9 +206,9 @@ s32 CamPresetUpdate_F(Evt* script, s32 isInitialCall) { if (actor == NULL) { return ApiStatus_BLOCK; } - x = actor->currentPos.x; - y = actor->currentPos.y + actor->size.y / 2 + actor->size.y / 4; - z = actor->currentPos.z; + x = actor->curPos.x; + y = actor->curPos.y + actor->size.y / 2 + actor->size.y / 4; + z = actor->curPos.z; sizeY = actor->size.y; sizeX = actor->size.x; @@ -219,9 +219,9 @@ s32 CamPresetUpdate_F(Evt* script, s32 isInitialCall) { return ApiStatus_BLOCK; } - targetX = targetActor->currentPos.x; - targetY = targetActor->currentPos.y + targetActor->size.y / 2 + targetActor->size.y / 4; - targetZ = targetActor->currentPos.z; + targetX = targetActor->curPos.x; + targetY = targetActor->curPos.y + targetActor->size.y / 2 + targetActor->size.y / 4; + targetZ = targetActor->curPos.z; targetAverageSize = (targetActor->size.y + targetActor->size.x) /2; middlePosX = x + (targetX - x) / 2; @@ -241,9 +241,9 @@ s32 CamPresetUpdate_F(Evt* script, s32 isInitialCall) { if (actor == NULL) { return ApiStatus_BLOCK; } - x = actor->currentPos.x; - y = actor->currentPos.y + actor->size.y / 2 + actor->size.y / 4; - z = actor->currentPos.z; + x = actor->curPos.x; + y = actor->curPos.y + actor->size.y / 2 + actor->size.y / 4; + z = actor->curPos.z; sizeY = actor->size.y; sizeX = actor->size.x; @@ -254,9 +254,9 @@ s32 CamPresetUpdate_F(Evt* script, s32 isInitialCall) { return ApiStatus_BLOCK; } - targetX = targetActor->currentPos.x; - targetY = targetActor->currentPos.y + targetActor->size.y / 2 + targetActor->size.y / 4; - targetZ = targetActor->currentPos.z; + targetX = targetActor->curPos.x; + targetY = targetActor->curPos.y + targetActor->size.y / 2 + targetActor->size.y / 4; + targetZ = targetActor->curPos.z; targetAverageSize = (targetActor->size.y + targetActor->size.x) / 2; middlePosX = x + (targetX - x) / 2; @@ -381,9 +381,9 @@ s32 CamPresetUpdate_M(Evt* script, s32 isInitialCall) { if (actor == NULL) { return ApiStatus_BLOCK; } - x = actor->currentPos.x; - y = actor->currentPos.y + actor->size.y / 2 + actor->size.y / 4; - z = actor->currentPos.z; + x = actor->curPos.x; + y = actor->curPos.y + actor->size.y / 2 + actor->size.y / 4; + z = actor->curPos.z; sizeY = actor->size.y; sizeX = actor->size.x; @@ -394,9 +394,9 @@ s32 CamPresetUpdate_M(Evt* script, s32 isInitialCall) { return ApiStatus_BLOCK; } - targetX = targetActor->currentPos.x; - targetY = targetActor->currentPos.y + targetActor->size.y / 2 + targetActor->size.y / 4; - targetZ = targetActor->currentPos.z; + targetX = targetActor->curPos.x; + targetY = targetActor->curPos.y + targetActor->size.y / 2 + targetActor->size.y / 4; + targetZ = targetActor->curPos.z; targetAverageSize = (targetActor->size.y + targetActor->size.x) / 2; middlePosX = x + (targetX - x) / 2; @@ -420,9 +420,9 @@ s32 CamPresetUpdate_M(Evt* script, s32 isInitialCall) { if (actor == NULL) { return ApiStatus_BLOCK; } - x = actor->currentPos.x; - y = actor->currentPos.y + actor->size.y / 2 + actor->size.y / 4; - z = actor->currentPos.z; + x = actor->curPos.x; + y = actor->curPos.y + actor->size.y / 2 + actor->size.y / 4; + z = actor->curPos.z; sizeY = actor->size.y; sizeX = actor->size.x; @@ -433,9 +433,9 @@ s32 CamPresetUpdate_M(Evt* script, s32 isInitialCall) { return ApiStatus_BLOCK; } - targetX = targetActor->currentPos.x; - targetY = targetActor->currentPos.y + targetActor->size.y / 2 + targetActor->size.y / 4; - targetZ = targetActor->currentPos.z; + targetX = targetActor->curPos.x; + targetY = targetActor->curPos.y + targetActor->size.y / 2 + targetActor->size.y / 4; + targetZ = targetActor->curPos.z; targetAverageSize = (targetActor->size.y + targetActor->size.x) /2; middlePosX = x + (targetX - x) / 2; @@ -455,9 +455,9 @@ s32 CamPresetUpdate_M(Evt* script, s32 isInitialCall) { if (actor == NULL) { return ApiStatus_BLOCK; } - x = actor->currentPos.x; - y = actor->currentPos.y + actor->size.y / 2 + actor->size.y / 4; - z = actor->currentPos.z; + x = actor->curPos.x; + y = actor->curPos.y + actor->size.y / 2 + actor->size.y / 4; + z = actor->curPos.z; sizeY = actor->size.y; sizeX = actor->size.x; @@ -468,9 +468,9 @@ s32 CamPresetUpdate_M(Evt* script, s32 isInitialCall) { return ApiStatus_BLOCK; } - targetX = targetActor->currentPos.x; - targetY = targetActor->currentPos.y + targetActor->size.y / 2 + targetActor->size.y / 4; - targetZ = targetActor->currentPos.z; + targetX = targetActor->curPos.x; + targetY = targetActor->curPos.y + targetActor->size.y / 2 + targetActor->size.y / 4; + targetZ = targetActor->curPos.z; targetAverageSize = (targetActor->size.y + targetActor->size.x) / 2; middlePosX = x + (targetX - x) / 2; @@ -592,9 +592,9 @@ s32 CamPresetUpdate_G(Evt* script, s32 isInitialCall) { if (actor == NULL) { return ApiStatus_BLOCK; } - x = actor->currentPos.x; - y = actor->currentPos.y + actor->size.y / 2 + actor->size.y / 4; - z = actor->currentPos.z; + x = actor->curPos.x; + y = actor->curPos.y + actor->size.y / 2 + actor->size.y / 4; + z = actor->curPos.z; sizeY = actor->size.y; sizeX = actor->size.x; @@ -604,9 +604,9 @@ s32 CamPresetUpdate_G(Evt* script, s32 isInitialCall) { return ApiStatus_BLOCK; } - targetX = targetActor->currentPos.x; - targetY = targetActor->currentPos.y + targetActor->size.y / 2 + targetActor->size.y / 4; - targetZ = targetActor->currentPos.z; + targetX = targetActor->curPos.x; + targetY = targetActor->curPos.y + targetActor->size.y / 2 + targetActor->size.y / 4; + targetZ = targetActor->curPos.z; targetAverageSize = (targetActor->size.y + targetActor->size.x) / 2; middlePosX = x + (targetX - x) / 2; @@ -626,9 +626,9 @@ s32 CamPresetUpdate_G(Evt* script, s32 isInitialCall) { if (actor == NULL) { return ApiStatus_BLOCK; } - x = actor->currentPos.x; - y = actor->currentPos.y + actor->size.y / 2 + actor->size.y / 4; - z = actor->currentPos.z; + x = actor->curPos.x; + y = actor->curPos.y + actor->size.y / 2 + actor->size.y / 4; + z = actor->curPos.z; sizeY = actor->size.y; sizeX = actor->size.x; @@ -638,9 +638,9 @@ s32 CamPresetUpdate_G(Evt* script, s32 isInitialCall) { return ApiStatus_BLOCK; } - targetX = targetActor->currentPos.x; - targetY = targetActor->currentPos.y + targetActor->size.y / 2 + targetActor->size.y / 4; - targetZ = targetActor->currentPos.z; + targetX = targetActor->curPos.x; + targetY = targetActor->curPos.y + targetActor->size.y / 2 + targetActor->size.y / 4; + targetZ = targetActor->curPos.z; targetAverageSize = (targetActor->size.y + targetActor->size.x) / 2; middlePosX = x + (targetX - x) / 2; @@ -661,9 +661,9 @@ s32 CamPresetUpdate_G(Evt* script, s32 isInitialCall) { return ApiStatus_BLOCK; } actorPart = get_actor_part(targetActor, BattleCam_TargetActorPart); - x = actorPart->absolutePosition.x; - y = actorPart->absolutePosition.y + actorPart->size.y / 2 + actorPart->size.y / 4; - z = actorPart->absolutePosition.z; + x = actorPart->absolutePos.x; + y = actorPart->absolutePos.y + actorPart->size.y / 2 + actorPart->size.y / 4; + z = actorPart->absolutePos.z; sizeY = actorPart->size.y; sizeX = actorPart->size.x; @@ -673,9 +673,9 @@ s32 CamPresetUpdate_G(Evt* script, s32 isInitialCall) { return ApiStatus_BLOCK; } - targetX = targetActor->currentPos.x; - targetY = targetActor->currentPos.y + targetActor->size.y / 2 + targetActor->size.y / 4; - targetZ = targetActor->currentPos.z; + targetX = targetActor->curPos.x; + targetY = targetActor->curPos.y + targetActor->size.y / 2 + targetActor->size.y / 4; + targetZ = targetActor->curPos.z; targetAverageSize = (targetActor->size.y + targetActor->size.x) / 2; middlePosX = x + (targetX - x) / 2; @@ -786,9 +786,9 @@ s32 CamPresetUpdate_I(Evt* script, s32 isInitialCall) { btl_cam_use_preset(BTL_CAM_DEFAULT); return ApiStatus_BLOCK; } - x = actor->currentPos.x; - y = actor->currentPos.y + playerStatus->colliderHeight / 2; - z = actor->currentPos.z; + x = actor->curPos.x; + y = actor->curPos.y + playerStatus->colliderHeight / 2; + z = actor->curPos.z; sizeY = actor->size.y; sizeX = actor->size.x; @@ -800,9 +800,9 @@ s32 CamPresetUpdate_I(Evt* script, s32 isInitialCall) { btl_cam_use_preset(BTL_CAM_DEFAULT); return ApiStatus_BLOCK; } - x = actor->currentPos.x; - y = actor->currentPos.y + actor->size.y / 2; - z = actor->currentPos.z; + x = actor->curPos.x; + y = actor->curPos.y + actor->size.y / 2; + z = actor->curPos.z; sizeY = actor->size.y; sizeX = actor->size.x; @@ -814,9 +814,9 @@ s32 CamPresetUpdate_I(Evt* script, s32 isInitialCall) { btl_cam_use_preset(BTL_CAM_DEFAULT); return ApiStatus_BLOCK; } - x = actor->currentPos.x; - y = actor->currentPos.y + actor->size.y / 2; - z = actor->currentPos.z; + x = actor->curPos.x; + y = actor->curPos.y + actor->size.y / 2; + z = actor->curPos.z; sizeY = actor->size.y; sizeX = actor->size.x; @@ -908,36 +908,36 @@ s32 CamPresetUpdate_H(Evt* script, s32 isInitialCall) { if (actor == NULL) { return ApiStatus_BLOCK; } - currentX = actor->currentPos.x; + currentX = actor->curPos.x; x = actor->state.goalPos.x; y = actor->state.goalPos.y; z = actor->state.goalPos.z; averageSize = (actor->size.y + actor->size.x) / 2; - currentY = actor->currentPos.y + playerStatus->colliderHeight / 2; + currentY = actor->curPos.y + playerStatus->colliderHeight / 2; break; case ACTOR_CLASS_PARTNER: actor = battleStatus->partnerActor; if (actor == NULL) { return ApiStatus_BLOCK; } - currentX = actor->currentPos.x; + currentX = actor->curPos.x; x = actor->state.goalPos.x; y = actor->state.goalPos.y; z = actor->state.goalPos.z; averageSize = (actor->size.y + actor->size.x) / 2; - currentY = actor->currentPos.y + actor->size.y / 2; + currentY = actor->curPos.y + actor->size.y / 2; break; case ACTOR_CLASS_ENEMY: actor = battleStatus->enemyActors[actorID]; if (actor == NULL) { return ApiStatus_BLOCK; } - currentX = actor->currentPos.x; + currentX = actor->curPos.x; x = actor->state.goalPos.x; y = actor->state.goalPos.y; z = actor->state.goalPos.z; averageSize = (actor->size.y + actor->size.x) / 2; - currentY = actor->currentPos.y + actor->size.y / 2; + currentY = actor->curPos.y + actor->size.y / 2; break; default: return ApiStatus_DONE2; @@ -1297,19 +1297,19 @@ ApiStatus CamPresetUpdate_K(Evt* script, s32 isInitialCall) { if (battleStatus->playerActor == NULL) { return ApiStatus_BLOCK; } - y = battleStatus->playerActor->currentPos.y + (playerStatus->colliderHeight / 2); + y = battleStatus->playerActor->curPos.y + (playerStatus->colliderHeight / 2); break; case ACTOR_CLASS_PARTNER: if (battleStatus->partnerActor == NULL) { return ApiStatus_BLOCK; } - y = battleStatus->partnerActor->currentPos.y; + y = battleStatus->partnerActor->curPos.y; break; case ACTOR_CLASS_ENEMY: if (battleStatus->enemyActors[actorID] == NULL) { return ApiStatus_BLOCK; } - y = battleStatus->enemyActors[actorID]->currentPos.y; + y = battleStatus->enemyActors[actorID]->curPos.y; break; } @@ -1350,26 +1350,26 @@ ApiStatus CamPresetUpdate_L(Evt* script, s32 isInitialCall) { if (battleStatus->playerActor == NULL) { return ApiStatus_BLOCK; } - x = battleStatus->playerActor->currentPos.x; - y = battleStatus->playerActor->currentPos.y + (playerStatus->colliderHeight / 2); - z = battleStatus->playerActor->currentPos.z; + x = battleStatus->playerActor->curPos.x; + y = battleStatus->playerActor->curPos.y + (playerStatus->colliderHeight / 2); + z = battleStatus->playerActor->curPos.z; break; case ACTOR_CLASS_PARTNER: if (battleStatus->partnerActor == NULL) { return ApiStatus_BLOCK; } - x = battleStatus->partnerActor->currentPos.x; - y = battleStatus->partnerActor->currentPos.y; - z = battleStatus->partnerActor->currentPos.z; + x = battleStatus->partnerActor->curPos.x; + y = battleStatus->partnerActor->curPos.y; + z = battleStatus->partnerActor->curPos.z; break; case ACTOR_CLASS_ENEMY: default: if (battleStatus->enemyActors[actorID] == NULL) { return ApiStatus_BLOCK; } - x = battleStatus->enemyActors[actorID]->currentPos.x; - y = battleStatus->enemyActors[actorID]->currentPos.y; - z = battleStatus->enemyActors[actorID]->currentPos.z; + x = battleStatus->enemyActors[actorID]->curPos.x; + y = battleStatus->enemyActors[actorID]->curPos.y; + z = battleStatus->enemyActors[actorID]->curPos.z; break; } diff --git a/src/camera.c b/src/camera.c index 6aa73993489..89cf3b16d29 100644 --- a/src/camera.c +++ b/src/camera.c @@ -259,7 +259,7 @@ void func_80032970(Camera* camera, f32 arg1) { s32 flags = camera->flags & CAMERA_FLAG_1000; s32 a2 = flags != 0; - if (camera->currentController != NULL && camera->currentController->type == CAM_CONTROL_FIXED_POS_AND_ORIENTATION) { + if (camera->curController != NULL && camera->curController->type == CAM_CONTROL_FIXED_POS_AND_ORIENTATION) { a2 = TRUE; } @@ -368,7 +368,7 @@ void func_80032C64(Camera* camera) { f32 deltaPosX, deltaPosZ; f32 f24, f22, cosYaw, sinYaw; - rotationRad = camera->trueRotation.x / 180.0f * PI; + rotationRad = camera->trueRot.x / 180.0f * PI; leadAmount = camera->leadAmount; s2 = 0; cos_rad(rotationRad); @@ -399,8 +399,8 @@ void func_80032C64(Camera* camera) { } else { f24 = cosYaw = camera->targetPos.x - camera->unk_524; f22 = camera->targetPos.z - camera->unk_528; - cosYaw = -cos_deg(camera->currentYaw); - sinYaw = -sin_deg(camera->currentYaw); + cosYaw = -cos_deg(camera->curYaw); + sinYaw = -sin_deg(camera->curYaw); product = f24 * cosYaw + f22 * sinYaw; camera->unk_52C = (product > 0) ? -1 : (product < 0) ? 1 : 0; } diff --git a/src/collision.c b/src/collision.c index 05186cc83f5..bc4e86b88bc 100644 --- a/src/collision.c +++ b/src/collision.c @@ -973,25 +973,25 @@ s32 test_ray_entities(f32 startX, f32 startY, f32 startZ, f32 dirX, f32 dirY, f3 } dist = hitDepthHoriz + entity->effectiveSize; - if (startX > entity->position.x + dist || startX < entity->position.x - dist) { + if (startX > entity->pos.x + dist || startX < entity->pos.x - dist) { continue; } - if (startZ > entity->position.z + dist || startZ < entity->position.z - dist) { + if (startZ > entity->pos.z + dist || startZ < entity->pos.z - dist) { continue; } switch (type) { case ENTITY_TEST_ANY: case ENTITY_TEST_DOWN: - dist = entity->position.y; + dist = entity->pos.y; dist2 = hitDepthDown + entity->effectiveSize * 2; if (dist + dist2 < startY || startY < dist - dist2) { continue; } break; case ENTITY_TEST_LATERAL: - dist = entity->position.y; + dist = entity->pos.y; dist2 = entity->effectiveSize * 2; if (dist + dist2 < startY || startY < dist - dist2) { continue; @@ -1010,8 +1010,8 @@ s32 test_ray_entities(f32 startX, f32 startY, f32 startZ, f32 dirX, f32 dirY, f3 boxVertices[2].z = boxVertices[3].z = boxVertices[6].z = boxVertices[7].z = -aabbZ; guMtxXFMF(entity->inverseTransformMatrix, dirX, dirY, dirZ, &gCollisionRayDirX, &gCollisionRayDirY, &gCollisionRayDirZ); - guMtxXFMF(entity->inverseTransformMatrix, startX - entity->position.x, startY - entity->position.y, - startZ - entity->position.z, &gCollisionRayStartX, &gCollisionRayStartY, &gCollisionRayStartZ); + guMtxXFMF(entity->inverseTransformMatrix, startX - entity->pos.x, startY - entity->pos.y, + startZ - entity->pos.z, &gCollisionRayStartX, &gCollisionRayStartY, &gCollisionRayStartZ); for (j = 0; j < 12; j++) { Vec3f* v1 = triangle->v1 = &boxVertices[gEntityColliderFaces[j].x]; @@ -1052,12 +1052,12 @@ s32 test_ray_entities(f32 startX, f32 startY, f32 startZ, f32 dirX, f32 dirY, f3 break; } - guRotateF(tempMatrix1, entity->rotation.x, 1.0f, 0.0f, 0.0f); - guRotateF(tempMatrix2, entity->rotation.z, 0.0f, 0.0f, 1.0f); + guRotateF(tempMatrix1, entity->rot.x, 1.0f, 0.0f, 0.0f); + guRotateF(tempMatrix2, entity->rot.z, 0.0f, 0.0f, 1.0f); guMtxCatF(tempMatrix1, tempMatrix2, tempMatrix1); - guRotateF(tempMatrix2, entity->rotation.y, 0.0f, 1.0f, 0.0f); + guRotateF(tempMatrix2, entity->rot.y, 0.0f, 1.0f, 0.0f); guMtxCatF(tempMatrix1, tempMatrix2, tempMatrix1); - guTranslateF(tempMatrix2, entity->position.x, entity->position.y, entity->position.z); + guTranslateF(tempMatrix2, entity->pos.x, entity->pos.y, entity->pos.z); guMtxCatF(tempMatrix1, tempMatrix2, tempMatrix1); guMtxXFMF(tempMatrix1, gCollisionPointX, gCollisionPointY, gCollisionPointZ, hitX, hitY, hitZ); diff --git a/src/common/ActorJumpToPos.inc.c b/src/common/ActorJumpToPos.inc.c index 9f6088ed65b..c9e985b24d5 100644 --- a/src/common/ActorJumpToPos.inc.c +++ b/src/common/ActorJumpToPos.inc.c @@ -2,35 +2,35 @@ API_CALLABLE(N(ActorJumpToPos)) { Actor* actor = get_actor(script->owner1.actorID); - Vec3f* temp_f0 = &actor->state.currentPos; + Vec3f* temp_f0 = &actor->state.curPos; if (isInitialCall) { script->functionTemp[0] = 0; } if (script->functionTemp[0] == 0) { - actor->state.currentPos.x = actor->currentPos.x; - actor->state.currentPos.y = actor->currentPos.y; - actor->state.currentPos.z = actor->currentPos.z; + actor->state.curPos.x = actor->curPos.x; + actor->state.curPos.y = actor->curPos.y; + actor->state.curPos.z = actor->curPos.z; script->functionTemp[0] = 1; } - if (actor->state.velocity > 0.0f) { + if (actor->state.vel > 0.0f) { set_animation(ACTOR_SELF, 1, actor->state.animJumpRise); } - if (actor->state.velocity < 0.0f) { + if (actor->state.vel < 0.0f) { set_animation(ACTOR_SELF, 1, actor->state.animJumpFall); } - actor->state.currentPos.y += actor->state.velocity; - actor->state.velocity = actor->state.velocity - actor->state.acceleration; + actor->state.curPos.y += actor->state.vel; + actor->state.vel = actor->state.vel - actor->state.acceleration; add_xz_vec3f(temp_f0, actor->state.speed, actor->state.angle); - actor->currentPos.x = actor->state.currentPos.x; - actor->currentPos.y = actor->state.currentPos.y; - actor->currentPos.z = actor->state.currentPos.z; + actor->curPos.x = actor->state.curPos.x; + actor->curPos.y = actor->state.curPos.y; + actor->curPos.z = actor->state.curPos.z; - if (actor->currentPos.y < 0.0f) { - actor->currentPos.y = 0.0f; - play_movement_dust_effects(2, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z, actor->yaw); + if (actor->curPos.y < 0.0f) { + actor->curPos.y = 0.0f; + play_movement_dust_effects(2, actor->curPos.x, actor->curPos.y, actor->curPos.z, actor->yaw); sfx_play_sound(SOUND_SOFT_LAND); return ApiStatus_DONE1; } diff --git a/src/common/GetItemEntityPosition.inc.c b/src/common/GetItemEntityPosition.inc.c index ddecfe1f245..9ce3b84d3a5 100644 --- a/src/common/GetItemEntityPosition.inc.c +++ b/src/common/GetItemEntityPosition.inc.c @@ -5,8 +5,8 @@ API_CALLABLE(N(GetItemEntityPosition)) { Bytecode* args = script->ptrReadPos; ItemEntity* entity = get_item_entity(evt_get_variable(script, *args++)); - evt_set_variable(script, *args++, entity->position.x); - evt_set_variable(script, *args++, entity->position.y); - evt_set_variable(script, *args++, entity->position.z); + evt_set_variable(script, *args++, entity->pos.x); + evt_set_variable(script, *args++, entity->pos.y); + evt_set_variable(script, *args++, entity->pos.z); return ApiStatus_DONE2; } diff --git a/src/common/ItemEntityJumpToPos.inc.c b/src/common/ItemEntityJumpToPos.inc.c index 6323ceda9a2..87011377e03 100644 --- a/src/common/ItemEntityJumpToPos.inc.c +++ b/src/common/ItemEntityJumpToPos.inc.c @@ -6,7 +6,7 @@ API_CALLABLE(N(ItemEntityJumpToPos)) { /* 0x0C */ f32 moveAngle; /* 0x10 */ f32 jumpAccel; /* 0x14 */ f32 moveSpeed; - /* 0x18 */ f32 jumpVelocity; + /* 0x18 */ f32 jumpVel; /* 0x1C */ s32 moveTime; /* 0x20 */ s32 itemEntityIndex; }* jumpState; @@ -25,11 +25,11 @@ API_CALLABLE(N(ItemEntityJumpToPos)) { jumpState->moveTime = evt_get_variable(script, *args++); jumpState->jumpAccel = evt_get_float_variable(script, *args++); item = get_item_entity(jumpState->itemEntityIndex); - moveDist = dist2D(item->position.x, item->position.z, jumpState->pos.x, jumpState->pos.z); - jumpState->moveAngle = atan2(item->position.x, item->position.z, jumpState->pos.x, jumpState->pos.z); + moveDist = dist2D(item->pos.x, item->pos.z, jumpState->pos.x, jumpState->pos.z); + jumpState->moveAngle = atan2(item->pos.x, item->pos.z, jumpState->pos.x, jumpState->pos.z); - temp_f2 = item->position.y; - jumpState->jumpVelocity = (jumpState->jumpAccel * jumpState->moveTime * 0.5f) + temp_f2 = item->pos.y; + jumpState->jumpVel = (jumpState->jumpAccel * jumpState->moveTime * 0.5f) + ((jumpState->pos.y - temp_f2) / jumpState->moveTime); temp_f2 = jumpState->moveTime; @@ -43,16 +43,16 @@ API_CALLABLE(N(ItemEntityJumpToPos)) { return ApiStatus_DONE2; } - item->position.x += (jumpState->moveSpeed * sin_deg(jumpState->moveAngle)); - item->position.z -= (jumpState->moveSpeed * cos_deg(jumpState->moveAngle)); - item->position.y += jumpState->jumpVelocity; + item->pos.x += (jumpState->moveSpeed * sin_deg(jumpState->moveAngle)); + item->pos.z -= (jumpState->moveSpeed * cos_deg(jumpState->moveAngle)); + item->pos.y += jumpState->jumpVel; jumpState->moveTime--; - jumpState->jumpVelocity = (jumpState->jumpVelocity - jumpState->jumpAccel); + jumpState->jumpVel = (jumpState->jumpVel - jumpState->jumpAccel); if (jumpState->moveTime < 0) { - item->position.x = jumpState->pos.x; - item->position.y = jumpState->pos.y; - item->position.z = jumpState->pos.z; - jumpState->jumpVelocity = 0.0f; + item->pos.x = jumpState->pos.x; + item->pos.y = jumpState->pos.y; + item->pos.z = jumpState->pos.z; + jumpState->jumpVel = 0.0f; heap_free((void*) script->functionTemp[0]); return ApiStatus_DONE1; } diff --git a/src/common/SetPlayerStatusPosYaw.inc.c b/src/common/SetPlayerStatusPosYaw.inc.c index 78b45f020bd..1e9974ed874 100644 --- a/src/common/SetPlayerStatusPosYaw.inc.c +++ b/src/common/SetPlayerStatusPosYaw.inc.c @@ -7,9 +7,9 @@ API_CALLABLE(N(SetPlayerStatusPosYaw)) { f32 z = evt_get_float_variable(script, *args++); f32 yaw = evt_get_float_variable(script, *args++); - gPlayerStatus.position.x = x; - gPlayerStatus.position.y = y; - gPlayerStatus.position.z = z; + gPlayerStatus.pos.x = x; + gPlayerStatus.pos.y = y; + gPlayerStatus.pos.z = z; gPlayerStatus.targetYaw = yaw; return ApiStatus_DONE2; } diff --git a/src/common/UnkActorPosFunc.inc.c b/src/common/UnkActorPosFunc.inc.c index 7c9a771a463..9c4ae898323 100644 --- a/src/common/UnkActorPosFunc.inc.c +++ b/src/common/UnkActorPosFunc.inc.c @@ -5,22 +5,22 @@ API_CALLABLE(N(UnkActorPosFunc)) { ActorState* actorState = &actor->state; if (isInitialCall) { - actor->state.currentPos.x = actor->currentPos.x; - actor->state.currentPos.y = actor->currentPos.y; - actor->state.currentPos.z = actor->currentPos.z; + actor->state.curPos.x = actor->curPos.x; + actor->state.curPos.y = actor->curPos.y; + actor->state.curPos.z = actor->curPos.z; } - add_xz_vec3f(&actorState->currentPos, actor->state.speed, actor->state.angle); + add_xz_vec3f(&actorState->curPos, actor->state.speed, actor->state.angle); if (actor->state.speed < 4.0f) { - play_movement_dust_effects(0, actor->state.currentPos.x, actor->state.currentPos.y, actor->state.currentPos.z, actor->state.angle); + play_movement_dust_effects(0, actor->state.curPos.x, actor->state.curPos.y, actor->state.curPos.z, actor->state.angle); } else { - play_movement_dust_effects(1, actor->state.currentPos.x, actor->state.currentPos.y, actor->state.currentPos.z, actor->state.angle); + play_movement_dust_effects(1, actor->state.curPos.x, actor->state.curPos.y, actor->state.curPos.z, actor->state.angle); } actorState->speed /= 1.5; - actor->currentPos.x = actorState->currentPos.x; - actor->currentPos.y = actorState->currentPos.y; - actor->currentPos.z = actorState->currentPos.z; + actor->curPos.x = actorState->curPos.x; + actor->curPos.y = actorState->curPos.y; + actor->curPos.z = actorState->curPos.z; if (actorState->speed < 1.0) { return ApiStatus_DONE2; diff --git a/src/common/UnkSfxFunc.inc.c b/src/common/UnkSfxFunc.inc.c index fe64116623f..290b252452d 100644 --- a/src/common/UnkSfxFunc.inc.c +++ b/src/common/UnkSfxFunc.inc.c @@ -7,17 +7,17 @@ API_CALLABLE(N(UnkSfxFunc)) { f32 distZ; if (isInitialCall) { - distX = actor->state.goalPos.x - actor->currentPos.x; - distY = actor->state.goalPos.y - actor->currentPos.y; - distZ = actor->state.goalPos.z - actor->currentPos.z; + distX = actor->state.goalPos.x - actor->curPos.x; + distY = actor->state.goalPos.y - actor->curPos.y; + distZ = actor->state.goalPos.z - actor->curPos.z; script->functionTemp[0] = ((sqrtf(SQ(distX) + SQ(distY) + SQ(distZ)) / actor->state.speed) * 0.5f) + 1.0f; - sfx_play_sound_at_position(SOUND_359, SOUND_SPACE_MODE_0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z); + sfx_play_sound_at_position(SOUND_359, SOUND_SPACE_MODE_0, actor->curPos.x, actor->curPos.y, actor->curPos.z); } if (script->functionTemp[0]-- > 0) { return ApiStatus_BLOCK; } - sfx_play_sound_at_position(SOUND_359 | SOUND_ID_TRIGGER_CHANGE_SOUND, SOUND_SPACE_MODE_0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z); + sfx_play_sound_at_position(SOUND_359 | SOUND_ID_TRIGGER_CHANGE_SOUND, SOUND_SPACE_MODE_0, actor->curPos.x, actor->curPos.y, actor->curPos.z); return ApiStatus_DONE2; } diff --git a/src/common/UnkStarFunc.inc.c b/src/common/UnkStarFunc.inc.c index 6d1c11085ad..421cdc41594 100644 --- a/src/common/UnkStarFunc.inc.c +++ b/src/common/UnkStarFunc.inc.c @@ -4,7 +4,7 @@ API_CALLABLE(N(UnkStarFunc)) { PlayerData* playerData = &gPlayerData; Bytecode* args = script->ptrReadPos; - set_animation(ACTOR_PARTNER, 0, D_8029C890[playerData->currentPartner][evt_get_variable(script, *args++)]); + set_animation(ACTOR_PARTNER, 0, D_8029C890[playerData->curPartner][evt_get_variable(script, *args++)]); return ApiStatus_DONE2; } diff --git a/src/common/battle/ChompChainSupport.inc.c b/src/common/battle/ChompChainSupport.inc.c index b1559a55ad3..5ef259c1ba2 100644 --- a/src/common/battle/ChompChainSupport.inc.c +++ b/src/common/battle/ChompChainSupport.inc.c @@ -39,25 +39,25 @@ API_CALLABLE(N(ChompChainInit)) { chainParts = heap_malloc(NUM_CHAIN_LINKS * sizeof(*chainParts)); actor->state.functionTempPtr[0] = chainParts; - x = actor->currentPos.x + 12.0; - y = actor->currentPos.y + 5.0; - z = actor->currentPos.z; + x = actor->curPos.x + 12.0; + y = actor->curPos.y + 5.0; + z = actor->curPos.z; for (i = 0; i < NUM_CHAIN_LINKS; i++, chainParts++) { chainParts->outerLinkLen = 7.0f; chainParts->linkLengthZ = 7.0f; chainParts->innerLinkLen = 7.0f; - chainParts->currentPos.x = x; - chainParts->currentPos.y = y; - chainParts->currentPos.z = z; + chainParts->curPos.x = x; + chainParts->curPos.y = y; + chainParts->curPos.z = z; chainParts->settleAmt = 0; chainParts->settleRate = 0.6f; chainParts->gravAccel = 3.0f; chainParts->velY = 0; actorPart = get_actor_part(actor, baseChainPart + i); - actorPart->absolutePosition.x = chainParts->currentPos.x; - actorPart->absolutePosition.y = chainParts->currentPos.y; - actorPart->absolutePosition.z = chainParts->currentPos.z; + actorPart->absolutePos.x = chainParts->curPos.x; + actorPart->absolutePos.y = chainParts->curPos.y; + actorPart->absolutePos.z = chainParts->curPos.z; } return ApiStatus_DONE2; } @@ -67,8 +67,8 @@ void N(ChompChainAddPolarPos)(ChompChain* script, f32 magnitude, f32 angleDeg) { f32 dirX = sin_rad(angle); f32 dirY = cos_rad(angle); - script->currentPos.x += -magnitude * dirX; - script->currentPos.y += magnitude * dirY; + script->curPos.x += -magnitude * dirX; + script->curPos.y += magnitude * dirY; } void N(ChompChainGetPolarX)(f32* x, f32 magnitude, f32 angleDeg) { @@ -106,11 +106,11 @@ API_CALLABLE(N(ChompChainUpdate)) { // initialize prev positions to the rear of the actor's body chain = actor->state.functionTempPtr[0]; if (actor->debuff == STATUS_KEY_SHRINK) { - prevX = actor->currentPos.x + 6.0; - prevY = actor->currentPos.y + 2.5; + prevX = actor->curPos.x + 6.0; + prevY = actor->curPos.y + 2.5; } else { - prevX = actor->currentPos.x + 12.0; - prevY = actor->currentPos.y + 5.0; + prevX = actor->curPos.x + 12.0; + prevY = actor->curPos.y + 5.0; } // update each link in the chain @@ -130,27 +130,27 @@ API_CALLABLE(N(ChompChainUpdate)) { if (chain->velY < 2.0f * -chain->gravAccel) { chain->velY = 2.0f * -chain->gravAccel; if (actor->state.varTable[CHOMP_CHAIN_AVAR_SOUNDS] && i == 0) { - sfx_play_sound_at_position(SOUND_2063, SOUND_SPACE_MODE_0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z); + sfx_play_sound_at_position(SOUND_2063, SOUND_SPACE_MODE_0, actor->curPos.x, actor->curPos.y, actor->curPos.z); } } // add velocity and clamp position to roughly the radius of the chain (assuming ground at y = 0) - chain->currentPos.y += chain->velY; + chain->curPos.y += chain->velY; if (actor->debuff == STATUS_KEY_SHRINK) { - if (chain->currentPos.y < 2.5) { - chain->currentPos.y = 2.5f; + if (chain->curPos.y < 2.5) { + chain->curPos.y = 2.5f; chain->velY = 0.0f; } } else { - if (chain->currentPos.y < 5.0) { - chain->currentPos.y = 5.0f; + if (chain->curPos.y < 5.0) { + chain->curPos.y = 5.0f; chain->velY = 0.0f; } } // get distance from previous part of the chain - dist = dist2D(prevX, prevY, chain->currentPos.x, chain->currentPos.y); - angle = atan2(prevX, prevY, chain->currentPos.x, chain->currentPos.y); + dist = dist2D(prevX, prevY, chain->curPos.x, chain->curPos.y); + angle = atan2(prevX, prevY, chain->curPos.x, chain->curPos.y); if (dist >= chain->linkLengthZ) { N(ChompChainGetPolarX)(&sp18, dist - chain->linkLengthZ, angle); @@ -181,13 +181,13 @@ API_CALLABLE(N(ChompChainUpdate)) { } #if CHOMP_CHAIN_UPDATE_Z == TRUE - chain->currentPos.z = posZ; + chain->curPos.z = posZ; #endif part = get_actor_part(actor, baseChainPart + i); - part->absolutePosition.x = chain->currentPos.x; - part->absolutePosition.y = chain->currentPos.y; - part->absolutePosition.z = chain->currentPos.z; + part->absolutePos.x = chain->curPos.x; + part->absolutePos.y = chain->curPos.y; + part->absolutePos.z = chain->curPos.z; if (actor->debuff == STATUS_KEY_SHRINK) { part->scale.x = 0.5f; @@ -198,8 +198,8 @@ API_CALLABLE(N(ChompChainUpdate)) { part->scale.y = 1.0f; part->scale.z = 1.0f; } - prevX = chain->currentPos.x; - prevY = chain->currentPos.y; + prevX = chain->curPos.x; + prevY = chain->curPos.y; } return ApiStatus_DONE2; diff --git a/src/effects/attack_result_text.c b/src/effects/attack_result_text.c index 54193f57dff..afe7af4d0bd 100644 --- a/src/effects/attack_result_text.c +++ b/src/effects/attack_result_text.c @@ -193,7 +193,7 @@ void func_E0090444(EffectInstance* effect) { if (type < 5) { guTranslateF(mtxA, data->pos.x, data->pos.y, data->pos.z); - guRotateF(mtxB, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(mtxB, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(mtxB, mtxA, mtxA); guScaleF(mtxB, scale, scale, 1.0f); guMtxCatF(mtxB, mtxA, mtxA); diff --git a/src/effects/aura.c b/src/effects/aura.c index a961f933868..4a06975e319 100644 --- a/src/effects/aura.c +++ b/src/effects/aura.c @@ -250,7 +250,7 @@ void aura_render(EffectInstance* effect) { renderTask.appendGfx = aura_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -278,7 +278,7 @@ void aura_appendGfx(void* argEffect) { if (type == 2) { guRotateF(tempMtx, data->renderYaw, 0.0f, 1.0f, 0.0f); } else { - guRotateF(tempMtx, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(tempMtx, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); } guMtxCatF(tempMtx, translateMtx, transformMtx); guScaleF(tempMtx, data->scale.x, data->scale.y, 1.0f); @@ -297,7 +297,7 @@ void aura_appendGfx(void* argEffect) { if (type == 2) { guRotateF(tempMtx, data->renderYaw, 0.0f, 1.0f, 0.0f); } else { - guRotateF(tempMtx, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(tempMtx, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); } guMtxCatF(tempMtx, translateMtx, transformMtx); guScaleF(tempMtx, data->scale.x, data->scale.y, 1.0f); diff --git a/src/effects/balloon.c b/src/effects/balloon.c index 6409abc5e3a..4c8fd93a4b6 100644 --- a/src/effects/balloon.c +++ b/src/effects/balloon.c @@ -76,7 +76,7 @@ void balloon_render(EffectInstance* effect) { renderTask.appendGfx = balloon_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_SURFACE_OPA; retTask = queue_render_task(&renderTask); @@ -93,7 +93,7 @@ void balloon_appendGfx(void* effect) { gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); guTranslateF(sp18, data->unk_04, data->unk_08, data->unk_0C); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp18); guScaleF(sp58, data->unk_18, data->unk_18, 1.0f); guMtxCatF(sp58, sp18, sp18); diff --git a/src/effects/big_smoke_puff.c b/src/effects/big_smoke_puff.c index 8706f8cca82..9cc3383f3bf 100644 --- a/src/effects/big_smoke_puff.c +++ b/src/effects/big_smoke_puff.c @@ -112,7 +112,7 @@ void big_smoke_puff_render(EffectInstance* effect) { renderTask.appendGfx = big_smoke_puff_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -128,7 +128,7 @@ void big_smoke_puff_appendGfx(void* effect) { gDPPipeSync(gMainGfxPos++); gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); - guPositionF(mtx, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, data->x, data->y, data->z); + guPositionF(mtx, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, data->x, data->y, data->z); guMtxF2L(mtx, &gDisplayContext->matrixStack[gMatrixListPos]); gSPMatrix(gMainGfxPos++, diff --git a/src/effects/big_snowflakes.c b/src/effects/big_snowflakes.c index ef6219a512f..12d8b33400e 100644 --- a/src/effects/big_snowflakes.c +++ b/src/effects/big_snowflakes.c @@ -100,7 +100,7 @@ void big_snowflakes_render(EffectInstance* effect) { renderTask.appendGfx = big_snowflakes_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -120,7 +120,7 @@ void big_snowflakes_appendGfx(void* effect) { gDPSetPrimColor(gMainGfxPos++, 0, 0, 20, 100, 20, data->unk_24); guTranslateF(sp18, data->unk_04, data->unk_08, data->unk_0C); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp98); data++; diff --git a/src/effects/blast.c b/src/effects/blast.c index e7a0ac71b18..0234038a721 100644 --- a/src/effects/blast.c +++ b/src/effects/blast.c @@ -85,7 +85,7 @@ void blast_render(EffectInstance* effect) { renderTask.appendGfx = blast_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_28; retTask = queue_render_task(&renderTask); @@ -108,7 +108,7 @@ void blast_appendGfx(void *effect) { gSPDisplayList(gMainGfxPos++, D_E007C510[unk_20]); guTranslateF(sp18, data->pos.x, data->pos.y, data->pos.z); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp98); guScaleF(sp18, data->unk_10, data->unk_10, 1.0f); guMtxCatF(sp18, sp98, sp98); diff --git a/src/effects/bombette_breaking.c b/src/effects/bombette_breaking.c index f3d1bb3ba0f..bafd182a644 100644 --- a/src/effects/bombette_breaking.c +++ b/src/effects/bombette_breaking.c @@ -195,7 +195,7 @@ void bombette_breaking_render(EffectInstance* effect) { renderTask.appendGfx = bombette_breaking_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_28; retTask = queue_render_task(&renderTask); @@ -241,7 +241,7 @@ void bombette_breaking_appendGfx(void* effect) { data++; for (i = 1; i < ((EffectInstance*)effect)->numParts; i++, data++) { gDPSetPrimColor(gMainGfxPos++, 0, 0, 255, 255, 255, (data->alpha * mainAlpha) / 255); - guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, unk_38, + guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, unk_38, data->center.x, data->center.y, data->center.z); guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], diff --git a/src/effects/breaking_junk.c b/src/effects/breaking_junk.c index 111b4d24601..9a53c13f8cd 100644 --- a/src/effects/breaking_junk.c +++ b/src/effects/breaking_junk.c @@ -124,7 +124,7 @@ void breaking_junk_render(EffectInstance* effect) { renderTask.appendGfx = breaking_junk_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -142,7 +142,7 @@ void breaking_junk_appendGfx(void* effect) { gSPDisplayList(gMainGfxPos++, D_E01187C0[0]); for (i = 0; i < ((EffectInstance*)effect)->numParts; i++, data++) { - guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, data->scale * 0.5, data->pos.x, data->pos.y, data->pos.z); + guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, data->scale * 0.5, data->pos.x, data->pos.y, data->pos.z); guRotateF(sp60, data->rot, 0.0f, 0.0f, 1.0f); guMtxCatF(sp60, sp20, sp20); guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/bulb_glow.c b/src/effects/bulb_glow.c index f047e12115b..424a4e19b98 100644 --- a/src/effects/bulb_glow.c +++ b/src/effects/bulb_glow.c @@ -137,10 +137,10 @@ void bulb_glow_render(EffectInstance* effect) { renderTask.appendGfxArg = effect; renderTask.appendGfx = bulb_glow_appendGfx; if (data->unk_00 == 5) { - renderTask.distance = 0; + renderTask.dist = 0; renderTaskPtr->renderMode = RENDER_MODE_SURFACE_OPA; } else { - renderTask.distance = -100; + renderTask.dist = -100; renderTaskPtr->renderMode = RENDER_MODE_2D; } diff --git a/src/effects/butterflies.c b/src/effects/butterflies.c index 394ddea2811..c36516215e4 100644 --- a/src/effects/butterflies.c +++ b/src/effects/butterflies.c @@ -153,7 +153,7 @@ void butterflies_render(EffectInstance* effect) { renderTask.appendGfx = butterflies_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/chapter_change.c b/src/effects/chapter_change.c index a99c5b2133b..28bdfffe493 100644 --- a/src/effects/chapter_change.c +++ b/src/effects/chapter_change.c @@ -219,7 +219,7 @@ void chapter_change_render(EffectInstance* effect) { renderTask.appendGfx = chapter_change_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/chomp_drop.c b/src/effects/chomp_drop.c index ac235af4b16..21e503b3e1a 100644 --- a/src/effects/chomp_drop.c +++ b/src/effects/chomp_drop.c @@ -126,7 +126,7 @@ void chomp_drop_render(EffectInstance* effect) { renderTask.appendGfx = chomp_drop_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = -10; + renderTask.dist = -10; renderTask.renderMode = RENDER_MODE_SURFACE_XLU_LAYER1; retTask = queue_render_task(&renderTask); diff --git a/src/effects/cloud_puff.c b/src/effects/cloud_puff.c index 5c4b6817824..f73489b6066 100644 --- a/src/effects/cloud_puff.c +++ b/src/effects/cloud_puff.c @@ -105,7 +105,7 @@ void cloud_puff_render(EffectInstance* effect) { renderTask.appendGfx = cloud_puff_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_28; retTask = queue_render_task(&renderTask); @@ -125,7 +125,7 @@ void cloud_puff_appendGfx(void* effect) { for (i = 0; i < effectTemp->numParts; i++, part++) { if (part->alive) { - guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, + guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, part->unk_0C, part->unk_10, part->unk_14); guScaleF(sp60, part->unk_18, part->unk_1C, part->unk_20); guMtxCatF(sp60, sp20, sp20); diff --git a/src/effects/cloud_trail.c b/src/effects/cloud_trail.c index ab349343e3e..3882efd5131 100644 --- a/src/effects/cloud_trail.c +++ b/src/effects/cloud_trail.c @@ -106,7 +106,7 @@ void cloud_trail_render(EffectInstance* effect) { renderTask.appendGfx = cloud_trail_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_28; retTask = queue_render_task(&renderTask); @@ -126,7 +126,7 @@ void cloud_trail_appendGfx(void* effect) { for (i = 0; i < effectTemp->numParts; i++, part++) { if (part->alive) { - guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, + guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, part->unk_0C, part->unk_10, part->unk_14); guScaleF(sp60, part->unk_1C, part->unk_20, part->unk_24); guMtxCatF(sp60, sp20, sp20); diff --git a/src/effects/cold_breath.c b/src/effects/cold_breath.c index 5b9ae7632b3..1fc44331783 100644 --- a/src/effects/cold_breath.c +++ b/src/effects/cold_breath.c @@ -169,7 +169,7 @@ void cold_breath_render(EffectInstance* effect) { renderTask.appendGfx = cold_breath_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 6; + renderTask.dist = 6; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/confetti.c b/src/effects/confetti.c index 50da8aaaa54..b65c1bb95ee 100644 --- a/src/effects/confetti.c +++ b/src/effects/confetti.c @@ -238,7 +238,7 @@ void confetti_render(EffectInstance* effect) { renderTask.appendGfx = confetti_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -271,7 +271,7 @@ void confetti_appendGfx(void* effect) { gSPDisplayList(gMainGfxPos++, D_09000940_38C4E0); guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp18); guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/damage_indicator.c b/src/effects/damage_indicator.c index b4f19d74ff7..94a43666d50 100644 --- a/src/effects/damage_indicator.c +++ b/src/effects/damage_indicator.c @@ -205,7 +205,7 @@ void damage_indicator_render_impl(EffectInstance* effect) { gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effect->graphics->data)); guTranslateF(mtxTransform, part->basePos.x, part->basePos.y, part->basePos.z); - guRotateF(mtxTemp, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(mtxTemp, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(mtxTemp, mtxTransform, mtxTransform); guMtxF2L(mtxTransform, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/damage_stars.c b/src/effects/damage_stars.c index 9269412e1e9..3d0a3bec31b 100644 --- a/src/effects/damage_stars.c +++ b/src/effects/damage_stars.c @@ -115,8 +115,8 @@ void damage_stars_main( part->unk_18 = arg6 + sp30[0][2] * var_f30 + sp30[1][2] * sp70 + sp30[2][2] * var_f28; break; case 3: - rotateX = sin_deg(gCameras[gCurrentCameraID].currentYaw); - rotateZ = -cos_deg(gCameras[gCurrentCameraID].currentYaw); + rotateX = sin_deg(gCameras[gCurrentCameraID].curYaw); + rotateZ = -cos_deg(gCameras[gCurrentCameraID].curYaw); guRotateF(sp30, (arg7 != 1) ? (i * 100) / (arg7 - 1) - 50 : 0.0f, rotateX, 0.0f, rotateZ); @@ -125,8 +125,8 @@ void damage_stars_main( part->unk_18 = sp30[0][2] * arg4 + sp30[1][2] * arg5 + sp30[2][2] * arg6; break; case 4: - rotateX = sin_deg(gCameras[gCurrentCameraID].currentYaw); - rotateZ = -cos_deg(gCameras[gCurrentCameraID].currentYaw); + rotateX = sin_deg(gCameras[gCurrentCameraID].curYaw); + rotateZ = -cos_deg(gCameras[gCurrentCameraID].curYaw); guRotateF(sp30, (i * 360.0f) / (arg7 - 1), rotateX, 0.0f, rotateZ); part->unk_10 = sp30[0][0] * arg4 + sp30[1][0] * arg5 + sp30[2][0] * arg6; part->unk_14 = sp30[0][1] * arg4 + sp30[1][1] * arg5 + sp30[2][1] * arg6; @@ -232,7 +232,7 @@ void damage_stars_render(EffectInstance* effect) { renderTask.appendGfx = damage_stars_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -260,7 +260,7 @@ void damage_stars_appendGfx(void* effect) { gDPSetPrimColor(gMainGfxPos++, 0, 0, D_E0030E90[rIdx % 36], D_E0030E90[gIdx % 36], D_E0030E90[bIdx % 36], part->unk_24); guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp18); guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/debuff.c b/src/effects/debuff.c index 35341bca66c..d52501775dd 100644 --- a/src/effects/debuff.c +++ b/src/effects/debuff.c @@ -123,7 +123,7 @@ void debuff_render(EffectInstance* effect) { renderTask.appendGfx = debuff_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_28; retTask = queue_render_task(&renderTask); @@ -145,7 +145,7 @@ void debuff_appendGfx(void* effect) { gSPDisplayList(gMainGfxPos++, dlist2); guTranslateF(mtxTranslate, data->pos.x, data->pos.y, data->pos.z); - guRotateF(mtxRotate, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(mtxRotate, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(mtxRotate, mtxTranslate, mtxTransform); guMtxF2L(mtxTransform, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/disable_x.c b/src/effects/disable_x.c index b92c9332f08..fd1d751a03f 100644 --- a/src/effects/disable_x.c +++ b/src/effects/disable_x.c @@ -217,7 +217,7 @@ void func_E0082580(DisableXFXData* data) { guTranslateF(sp18, data->pos.x, data->pos.y, data->pos.z); guScaleF(sp58, data->scale, data->scale, 1.0f); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp18); guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]); gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], diff --git a/src/effects/drop_leaves.c b/src/effects/drop_leaves.c index 9ee19e6859b..87f0ade8669 100644 --- a/src/effects/drop_leaves.c +++ b/src/effects/drop_leaves.c @@ -119,7 +119,7 @@ void drop_leaves_render(EffectInstance* effect) { renderTask.appendGfx = drop_leaves_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -138,7 +138,7 @@ void drop_leaves_appendGfx(void* effect) { gDPSetPrimColor(gMainGfxPos++, 0, 0, 20, 100, 20, part->unk_24); guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp98); part++; diff --git a/src/effects/dust.c b/src/effects/dust.c index 451d951c255..41716c6bd5a 100644 --- a/src/effects/dust.c +++ b/src/effects/dust.c @@ -118,7 +118,7 @@ void dust_render(EffectInstance* effect) { renderTask.appendGfx = dust_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_SURFACE_XLU_LAYER1; retTask = queue_render_task(&renderTask); @@ -140,7 +140,7 @@ void dust_appendGfx(void* effect) { gDPSetEnvColor(gMainGfxPos++, part->unk_3C, part->unk_40, part->unk_44, 0); guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp98); unk_00 = part->unk_00; diff --git a/src/effects/effect_3D.c b/src/effects/effect_3D.c index 1191c6c2944..81e9539097a 100644 --- a/src/effects/effect_3D.c +++ b/src/effects/effect_3D.c @@ -204,7 +204,7 @@ void effect_3D_render(EffectInstance* effect) { renderTask.appendGfx = effect_3D_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -234,7 +234,7 @@ void effect_3D_appendGfx(void* effect) { gDPSetPrimColor(gMainGfxPos++, 0, 0, 200, 255, 255, part->unk_58); guTranslateF(sp18, part->pos.x, part->pos.y, part->pos.z); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp18); guScaleF(sp58, part->unk_44, part->unk_48, part->unk_44); guMtxCatF(sp58, sp18, sp18); diff --git a/src/effects/effect_46.c b/src/effects/effect_46.c index c468996bb47..2ce46c9bc51 100644 --- a/src/effects/effect_46.c +++ b/src/effects/effect_46.c @@ -163,9 +163,9 @@ void effect_46_update(EffectInstance* effect) { } } - part->pos.x = part->player->position.x; - part->pos.y = part->player->position.y; - part->pos.z = part->player->position.z; + part->pos.x = part->player->pos.x; + part->pos.y = part->player->pos.y; + part->pos.z = part->player->pos.z; part++; for (i = 1; i < effect->numParts; i++, part++) { @@ -192,7 +192,7 @@ void effect_46_render(EffectInstance* effect) { renderTask.appendGfx = effect_46_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -216,7 +216,7 @@ void effect_46_appendGfx(void* effect) { gSPDisplayList(gMainGfxPos++, D_09000420_38EDB0); guTranslateF(mtxTransform, part->pos.x, part->pos.y, part->pos.z); - guRotateF(mtxTemp, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(mtxTemp, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(mtxTemp, mtxTransform, mtxTransform); guMtxF2L(mtxTransform, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/effect_63.c b/src/effects/effect_63.c index 4d09fdd1183..97ff9c53acd 100644 --- a/src/effects/effect_63.c +++ b/src/effects/effect_63.c @@ -200,7 +200,7 @@ void effect_63_render(EffectInstance* effect) { renderTask.appendGfx = effect_63_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/effect_65.c b/src/effects/effect_65.c index d4ef3699242..8b3bf49423c 100644 --- a/src/effects/effect_65.c +++ b/src/effects/effect_65.c @@ -199,7 +199,7 @@ void effect_65_render(EffectInstance* effect) { renderTask.appendGfx = effect_65_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/effect_75.c b/src/effects/effect_75.c index 58911f3b102..730477d5a45 100644 --- a/src/effects/effect_75.c +++ b/src/effects/effect_75.c @@ -178,7 +178,7 @@ void effect_75_render(EffectInstance* effect) { } renderTaskPtr->appendGfx = effect_75_appendGfx; - renderTaskPtr->distance = -outDist; + renderTaskPtr->dist = -outDist; renderTaskPtr->appendGfxArg = effect; renderTaskPtr->renderMode = RENDER_MODE_SURFACE_XLU_LAYER1; diff --git a/src/effects/effect_86.c b/src/effects/effect_86.c index e7a9d8a278d..d908c81fc53 100644 --- a/src/effects/effect_86.c +++ b/src/effects/effect_86.c @@ -100,7 +100,7 @@ void effect_86_render(EffectInstance* effect) { renderTask.appendGfx = effect_86_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/embers.c b/src/effects/embers.c index d371f29c4aa..d5c90fbff5f 100644 --- a/src/effects/embers.c +++ b/src/effects/embers.c @@ -175,7 +175,7 @@ void embers_render(EffectInstance* effect) { renderTask.appendGfx = embers_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/emote.c b/src/effects/emote.c index c7db3b7d145..74b1ab2916a 100644 --- a/src/effects/emote.c +++ b/src/effects/emote.c @@ -63,14 +63,14 @@ void func_E0020000(EmoteFXData* part, s32 arg1) { f32 sin; f32 cos; - sin = sin_deg(gCameras[gCurrentCameraID].currentYaw); - cos = cos_deg(gCameras[gCurrentCameraID].currentYaw); + sin = sin_deg(gCameras[gCurrentCameraID].curYaw); + cos = cos_deg(gCameras[gCurrentCameraID].curYaw); guRotateF(sp18, -(unk_1C - 20.0f + arg1 * 20), sin, 0.0f, -cos); if (npc == PTR_LIST_END) { - part->unk_04 = gPlayerStatus.position.x + part->unk_10 + sp18[1][0] * (unk_20 + 16.0f); - part->unk_08 = gPlayerStatus.position.y + part->unk_14 + sp18[1][1] * (unk_20 + 16.0f); - part->unk_0C = gPlayerStatus.position.z + part->unk_18 + sp18[1][2] * (unk_20 + 16.0f); + part->unk_04 = gPlayerStatus.pos.x + part->unk_10 + sp18[1][0] * (unk_20 + 16.0f); + part->unk_08 = gPlayerStatus.pos.y + part->unk_14 + sp18[1][1] * (unk_20 + 16.0f); + part->unk_0C = gPlayerStatus.pos.z + part->unk_18 + sp18[1][2] * (unk_20 + 16.0f); } else if (npc != NULL) { part->unk_04 = npc->pos.x + part->unk_10 + sp18[1][0] * (unk_20 + 16.0f); part->unk_08 = npc->pos.y + part->unk_14 + sp18[1][1] * (unk_20 + 16.0f); @@ -194,7 +194,7 @@ void emote_render(EffectInstance* effect) { renderTask.appendGfx = emote_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -222,7 +222,7 @@ void emote_appendGfx(void* effect) { if (type != 1) { guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp18); matrix = &gDisplayContext->matrixStack[gMatrixListPos]; @@ -241,7 +241,7 @@ void emote_appendGfx(void* effect) { if (part->unk_38 == 0) { for (i = 0; i < 3; i++, part++) { guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp18); guRotateF(sp58, part->unk_24, 0.0f, 0.0f, 1.0f); guMtxCatF(sp58, sp18, sp18); diff --git a/src/effects/ending_decals.c b/src/effects/ending_decals.c index e5a5f7bc011..caef475dea2 100644 --- a/src/effects/ending_decals.c +++ b/src/effects/ending_decals.c @@ -118,7 +118,7 @@ void ending_decals_render(EffectInstance* effect) { renderTask.appendGfxArg = effect; renderTask.appendGfx = ending_decals_appendGfx; - renderTask.distance = 10; + renderTask.dist = 10; if (data->type == 0) { renderTaskPtr->renderMode = RENDER_MODE_SURFACE_OPA; } else { @@ -145,7 +145,7 @@ void ending_decals_appendGfx(void* effect) { gDPPipeSync(gMainGfxPos++); gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); - guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, data->scale, data->pos.x, data->pos.y, data->pos.z); + guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, data->scale, data->pos.x, data->pos.y, data->pos.z); guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW); diff --git a/src/effects/energy_in_out.c b/src/effects/energy_in_out.c index a0c2c2bde59..feef352d332 100644 --- a/src/effects/energy_in_out.c +++ b/src/effects/energy_in_out.c @@ -230,7 +230,7 @@ void energy_in_out_render(EffectInstance* effect) { renderTask.appendGfx = energy_in_out_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -255,7 +255,7 @@ void energy_in_out_appendGfx(void* effect) { gDPPipeSync(gMainGfxPos++); gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); - guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, scale, part->pos.x, part->pos.y, part->pos.z); + guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, scale, part->pos.x, part->pos.y, part->pos.z); guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/effects/energy_orb_wave.c b/src/effects/energy_orb_wave.c index 31478761ec8..2f2dedd24a4 100644 --- a/src/effects/energy_orb_wave.c +++ b/src/effects/energy_orb_wave.c @@ -209,7 +209,7 @@ void energy_orb_wave_render(EffectInstance* effect) { RenderTask* renderTaskPointer = &renderTask; renderTask.appendGfx = energy_orb_wave_appendGfx; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.appendGfxArg = effect; renderTask.renderMode = RENDER_MODE_2D; if (effect82->unk_00 >= 3) { diff --git a/src/effects/energy_shockwave.c b/src/effects/energy_shockwave.c index d45430fcd4e..e9fc9cda486 100644 --- a/src/effects/energy_shockwave.c +++ b/src/effects/energy_shockwave.c @@ -130,7 +130,7 @@ void energy_shockwave_render(EffectInstance* effect) { renderTask.appendGfx = energy_shockwave_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_SURFACE_XLU_LAYER3; retTask = queue_render_task(&renderTask); diff --git a/src/effects/explosion.c b/src/effects/explosion.c index dc869796a47..22c050e8d18 100644 --- a/src/effects/explosion.c +++ b/src/effects/explosion.c @@ -157,7 +157,7 @@ void explosion_render(EffectInstance* effect) { renderTask.appendGfx = explosion_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -176,7 +176,7 @@ void explosion_appendGfx(void* effect) { gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); guTranslateF(sp18, part->pos.x, part->pos.y, part->pos.z); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp18); guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/falling_leaves.c b/src/effects/falling_leaves.c index 8654a627bb5..ea10a7f29f4 100644 --- a/src/effects/falling_leaves.c +++ b/src/effects/falling_leaves.c @@ -114,7 +114,7 @@ void falling_leaves_render(EffectInstance* effect) { renderTask.appendGfx = falling_leaves_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -133,7 +133,7 @@ void falling_leaves_appendGfx(void* effect) { gDPSetPrimColor(gMainGfxPos++, 0, 0, 20, 100, 20, part->unk_24); guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp98); part++; diff --git a/src/effects/fire_breath.c b/src/effects/fire_breath.c index d8e3f2e1729..e9427d4d92e 100644 --- a/src/effects/fire_breath.c +++ b/src/effects/fire_breath.c @@ -168,9 +168,9 @@ void fire_breath_render(EffectInstance* effect) { renderTask.appendGfxArg = effect; if (gGameStatusPtr->isBattle == TRUE) { - renderTask.distance = data->pos.z + 1000.0f; + renderTask.dist = data->pos.z + 1000.0f; } else { - renderTask.distance = 0; + renderTask.dist = 0; } renderTaskPointer->renderMode = RENDER_MODE_2D; @@ -193,7 +193,7 @@ void fire_breath_appendGfx(void* effect) { if (type == FIRE_BREATH_SMALL) { guTranslateF(sp18, data->initPos.x, data->initPos.y, data->initPos.z); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp18); guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]); @@ -211,7 +211,7 @@ void fire_breath_appendGfx(void* effect) { gDPSetTileSize(gMainGfxPos++, 1, ((unk_5C * 32) + 32) * 4, 0, ((unk_5C * 32) + 64) * 4, 128); guTranslateF(sp18, data->pos.x, data->pos.y, data->pos.z); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp18); guScaleF(sp58, data->scale, data->scale, 0.0f); guMtxCatF(sp58, sp18, sp18); diff --git a/src/effects/fire_flower.c b/src/effects/fire_flower.c index 303ebad8285..a6d804516cf 100644 --- a/src/effects/fire_flower.c +++ b/src/effects/fire_flower.c @@ -193,7 +193,7 @@ void fire_flower_render(EffectInstance* effect) { renderTask.appendGfx = fire_flower_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -215,7 +215,7 @@ void fire_flower_appendGfx(void* effect) { gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); guTranslateF(sp18, part->pos.x, part->pos.y, part->pos.z); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp18); guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/firework.c b/src/effects/firework.c index d1f85e28743..ac2a93542b5 100644 --- a/src/effects/firework.c +++ b/src/effects/firework.c @@ -198,7 +198,7 @@ void func_E00863B4(EffectInstance* effect) { unk_28 = part->unk_28; - guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, unk_28, part->unk_04, part->unk_08, part->unk_0C); + guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, unk_28, part->unk_04, part->unk_08, part->unk_0C); guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW); diff --git a/src/effects/firework_rocket.c b/src/effects/firework_rocket.c index 38ea02f4f9a..bd9627ab65d 100644 --- a/src/effects/firework_rocket.c +++ b/src/effects/firework_rocket.c @@ -112,9 +112,9 @@ EffectInstance* firework_rocket_main(s32 variation, f32 centerX, f32 centerY, f3 data->pos.y = centerY; data->pos.z = centerZ; data->radius = 0; - data->velocity.x = velX; - data->velocity.y = velY; - data->velocity.z = velZ; + data->vel.x = velX; + data->vel.y = velY; + data->vel.z = velZ; data->maxRadius = radius; data->r = 255; data->g = 255; @@ -128,9 +128,9 @@ EffectInstance* firework_rocket_main(s32 variation, f32 centerX, f32 centerY, f3 data->rocketX[i] = data->pos.x; data->rocketY[i] = data->pos.y - 1000.0f; data->rocketZ[i] = data->pos.z; - data->rocketVelocityX[i] = 0; - data->rocketVelocityY[i] = 0; - data->rocketVelocityZ[i] = 0; + data->rocketVelX[i] = 0; + data->rocketVelY[i] = 0; + data->rocketVelZ[i] = 0; } return effect; @@ -169,31 +169,31 @@ void firework_rocket_update(EffectInstance* effect) { if (data->isExploded == TRUE) { factor = 0.95f; - data->pos.x += data->velocity.x; - data->pos.y += data->velocity.y; - data->pos.z += data->velocity.z; - data->velocity.x *= factor; - data->velocity.y *= factor; - data->velocity.z *= factor; + data->pos.x += data->vel.x; + data->pos.y += data->vel.y; + data->pos.z += data->vel.z; + data->vel.x *= factor; + data->vel.y *= factor; + data->vel.z *= factor; data->radius += (data->maxRadius - data->radius) * 0.11; - data->velocity.y -= 0.15; + data->vel.y -= 0.15; return; } i = lifeTime & 3; - data->rocketX[i] = data->pos.x - data->velocity.x * (32 - lifeTime); - data->rocketY[i] = data->pos.y - data->velocity.y * (32 - lifeTime) + data->rocketX[i] = data->pos.x - data->vel.x * (32 - lifeTime); + data->rocketY[i] = data->pos.y - data->vel.y * (32 - lifeTime) - (80.0f - sin_deg((s32)(lifeTime * 90) >> 5) * 80.0f); - data->rocketZ[i] = data->pos.z - data->velocity.z * (32 - lifeTime); - data->rocketVelocityX[i] = (rand_int(10) - 5) * 0.1f; - data->rocketVelocityY[i] = (rand_int(10) - 5) * 0.1f; - data->rocketVelocityZ[i] = (rand_int(10) - 5) * 0.1f; + data->rocketZ[i] = data->pos.z - data->vel.z * (32 - lifeTime); + data->rocketVelX[i] = (rand_int(10) - 5) * 0.1f; + data->rocketVelY[i] = (rand_int(10) - 5) * 0.1f; + data->rocketVelZ[i] = (rand_int(10) - 5) * 0.1f; for (i = 0; i < 4; i++) { - data->rocketX[i] += data->rocketVelocityX[i]; - data->rocketY[i] += data->rocketVelocityY[i]; - data->rocketZ[i] += data->rocketVelocityZ[i]; - data->rocketVelocityY[i] -= 0.15; + data->rocketX[i] += data->rocketVelX[i]; + data->rocketY[i] += data->rocketVelY[i]; + data->rocketZ[i] += data->rocketVelZ[i]; + data->rocketVelY[i] -= 0.15; if (lifeTime >= 27) { data->rocketY[i] = NPC_DISPOSE_POS_Y; } @@ -211,7 +211,7 @@ void firework_rocket_render(EffectInstance* effect) { renderTask.appendGfx = firework_rocket_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 700; + renderTask.dist = 700; renderTask.renderMode = RENDER_MODE_SURFACE_OPA; retTask = queue_render_task(&renderTask); @@ -238,7 +238,7 @@ void firework_rocket_appendGfx(void* effect) { Vec3b* sparkDir; s32 i; - negYaw = -camera->currentYaw; + negYaw = -camera->curYaw; sinTheta = sin_deg(negYaw); cosTheta = cos_deg(negYaw); isExploded = data->isExploded; diff --git a/src/effects/flame.c b/src/effects/flame.c index 5f68e61b4a7..4d2c0f3e769 100644 --- a/src/effects/flame.c +++ b/src/effects/flame.c @@ -135,7 +135,7 @@ void flame_render(EffectInstance* effect) { } renderTaskPtr->appendGfx = flame_appendGfx; - renderTaskPtr->distance = -outDist; + renderTaskPtr->dist = -outDist; renderTaskPtr->appendGfxArg = effect; renderTaskPtr->renderMode = RENDER_MODE_SURFACE_XLU_LAYER1; @@ -178,7 +178,7 @@ void flame_appendGfx(void* effect) { gDPSetEnvColor(gMainGfxPos++, unkStruct->unk_04, unkStruct->unk_05, unkStruct->unk_06, 0); guTranslateF(sp18, data->pos.x, data->pos.y, data->pos.z); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp98); guScaleF(sp58, data->unk_10 * data->unk_30, data->unk_10 * data->unk_2C, data->unk_10); guMtxCatF(sp58, sp98, sp98); diff --git a/src/effects/flashing_box_shockwave.c b/src/effects/flashing_box_shockwave.c index ae20db3cb8a..3aa7c372e1d 100644 --- a/src/effects/flashing_box_shockwave.c +++ b/src/effects/flashing_box_shockwave.c @@ -128,7 +128,7 @@ void flashing_box_shockwave_render(EffectInstance* effect) { renderTask.appendGfx = flashing_box_shockwave_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_SURFACE_XLU_LAYER3; retTask = queue_render_task(&renderTask); @@ -142,7 +142,7 @@ void flashing_box_shockwave_appendGfx(void* effect) { Matrix4f sp58; Matrix4f sp98; - guRotateF(sp98, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp98, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); gDPPipeSync(gMainGfxPos++); gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); diff --git a/src/effects/floating_cloud_puff.c b/src/effects/floating_cloud_puff.c index d88a0ca67d6..74f8272cc66 100644 --- a/src/effects/floating_cloud_puff.c +++ b/src/effects/floating_cloud_puff.c @@ -103,7 +103,7 @@ void floating_cloud_puff_render(EffectInstance* effect) { renderTask.appendGfx = floating_cloud_puff_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/floating_flower.c b/src/effects/floating_flower.c index cebd73d9d22..56297d7599d 100644 --- a/src/effects/floating_flower.c +++ b/src/effects/floating_flower.c @@ -133,7 +133,7 @@ void floating_flower_render(EffectInstance* effect) { renderTask.appendGfx = floating_flower_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/floating_rock.c b/src/effects/floating_rock.c index 1cdec17c6ab..d5f17155d78 100644 --- a/src/effects/floating_rock.c +++ b/src/effects/floating_rock.c @@ -102,7 +102,7 @@ void floating_rock_render(EffectInstance *effect) { renderTask.appendGfx = floating_rock_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = effect76->pos.z; + renderTask.dist = effect76->pos.z; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/flower_splash.c b/src/effects/flower_splash.c index 6639c1bd53c..5ef3ac5bda5 100644 --- a/src/effects/flower_splash.c +++ b/src/effects/flower_splash.c @@ -25,13 +25,13 @@ void flower_splash_update_part_transform(FlowerFXData* effect) { } void flower_splash_update_part(FlowerFXData* effect) { - effect->velocityScaleA *= 0.85; - effect->pos.x += effect->velocityScaleA * effect->velocity.x; + effect->velScaleA *= 0.85; + effect->pos.x += effect->velScaleA * effect->vel.x; effect->integrator[2] += effect->integrator[3]; effect->integrator[1] += effect->integrator[2]; effect->integrator[0] += effect->integrator[1]; effect->pos.y += effect->integrator[0]; - effect->pos.z += effect->velocityScaleA * effect->velocity.z; + effect->pos.z += effect->velScaleA * effect->vel.z; if (effect->integrator[0] < 0.0f) { effect->integrator[2] = 0.004f; @@ -69,7 +69,7 @@ void flower_splash_main(f32 posX, f32 posY, f32 posZ, f32 angle) { for (i = 0; i < numParts; i++, part++) { part->alive = TRUE; part->rot.y = angle + (i * 72); - part->velocityScaleB = 0.29999998f; + part->velScaleB = 0.29999998f; part->visibilityAmt = 0.0f; part->unk_7C = 0.0f; @@ -92,10 +92,10 @@ void flower_splash_main(f32 posX, f32 posY, f32 posZ, f32 angle) { part->integrator[2] = 0.0f; part->integrator[3] = 0.0f; - part->velocityScaleA = -3.9f; + part->velScaleA = -3.9f; partAngle = clamp_angle(part->rot.y); - part->velocity.x = sin_deg(partAngle); - part->velocity.z = cos_deg(partAngle); + part->vel.x = sin_deg(partAngle); + part->vel.z = cos_deg(partAngle); } } @@ -131,7 +131,7 @@ void flower_splash_render(EffectInstance* effect) { renderTask.appendGfx = flower_splash_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_28; retTask = queue_render_task(&renderTask); diff --git a/src/effects/flower_trail.c b/src/effects/flower_trail.c index 3da947c51f8..547726abd16 100644 --- a/src/effects/flower_trail.c +++ b/src/effects/flower_trail.c @@ -35,9 +35,9 @@ void flower_trail_update_part(FlowerFXData* effect) { effect->integrator[2] += effect->integrator[3]; effect->integrator[1] += effect->integrator[2]; effect->integrator[0] += effect->integrator[1]; - effect->rot.z += effect->integrator[0] * effect->velocityScaleA; - effect->pos.x -= effect->integrator[0] * effect->velocityScaleB * effect->velocity.x; - effect->pos.z -= effect->integrator[0] * effect->velocityScaleB * effect->velocity.z; + effect->rot.z += effect->integrator[0] * effect->velScaleA; + effect->pos.x -= effect->integrator[0] * effect->velScaleB * effect->vel.x; + effect->pos.z -= effect->integrator[0] * effect->velScaleB * effect->vel.z; if (effect->integrator[0] < 0.0f) { effect->visibilityAmt = 0.0f; @@ -84,11 +84,11 @@ void flower_trail_main(s32 triggeredByNpc, f32 posX, f32 posY, f32 posZ, f32 ang part->primAlpha = 255; part->visibilityAmt = 1.0f; - part->velocityScaleB = 5.4f; + part->velScaleB = 5.4f; if (direction != 0.0f) { - part->velocityScaleA = -10.0f; + part->velScaleA = -10.0f; } else { - part->velocityScaleA = 10.0f; + part->velScaleA = 10.0f; } part->integrator[0] = 0.5f; @@ -110,8 +110,8 @@ void flower_trail_main(s32 triggeredByNpc, f32 posX, f32 posY, f32 posZ, f32 ang partAngle = clamp_angle(angle + angleOffset); } - part->velocity.x = sin_deg(partAngle); - part->velocity.z = cos_deg(partAngle); + part->vel.x = sin_deg(partAngle); + part->vel.z = cos_deg(partAngle); } } @@ -147,7 +147,7 @@ void flower_trail_render(EffectInstance* effect) { renderTask.appendGfx = flower_trail_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_28; queuedTaskPtr = queue_render_task(&renderTask); diff --git a/src/effects/footprint.c b/src/effects/footprint.c index af5ab7de399..a7808089b5d 100644 --- a/src/effects/footprint.c +++ b/src/effects/footprint.c @@ -103,7 +103,7 @@ void footprint_render(EffectInstance* effect) { renderTask.appendGfx = footprint_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_28; retTask = queue_render_task(&renderTask); diff --git a/src/effects/fright_jar.c b/src/effects/fright_jar.c index c447ed686a5..55a54a4e4af 100644 --- a/src/effects/fright_jar.c +++ b/src/effects/fright_jar.c @@ -102,7 +102,7 @@ void fright_jar_render(EffectInstance* effect) { renderTask.appendGfx = fright_jar_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/gather_energy_pink.c b/src/effects/gather_energy_pink.c index b72ac6c337b..662c6945e22 100644 --- a/src/effects/gather_energy_pink.c +++ b/src/effects/gather_energy_pink.c @@ -150,7 +150,7 @@ void gather_energy_pink_render(EffectInstance* effect) { renderTask.appendGfx = gather_energy_pink_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/gather_magic.c b/src/effects/gather_magic.c index 510299ba180..fd9dadc1ce4 100644 --- a/src/effects/gather_magic.c +++ b/src/effects/gather_magic.c @@ -144,7 +144,7 @@ void gather_magic_render(EffectInstance* effect) { renderTask.appendGfx = gather_magic_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_SURFACE_XLU_LAYER3; retTask = queue_render_task(&renderTask); @@ -165,7 +165,7 @@ void gather_magic_appendGfx(void* effect) { gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); guTranslateF(sp18, part->unk_08, part->unk_0C, part->unk_10); - guRotateF(sp98, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp98, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp98, sp18, sp18); guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/got_item_outline.c b/src/effects/got_item_outline.c index 8d055031a10..c96c7a9f3d3 100644 --- a/src/effects/got_item_outline.c +++ b/src/effects/got_item_outline.c @@ -97,7 +97,7 @@ void got_item_outline_render(EffectInstance* effect) { renderTask.appendGfx = got_item_outline_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -129,7 +129,7 @@ void got_item_outline_appendGfx(void* effect) { } guTranslateF(mtxTransform, data->pos.x, data->pos.y, data->pos.z); - guRotateF(mtxTemp, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(mtxTemp, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(mtxTemp, mtxTransform, mtxTransform); guTranslateF(mtxTemp, 0.0f, 0.0f, -2.0f); guMtxCatF(mtxTemp, mtxTransform, mtxTransform); diff --git a/src/effects/green_impact.c b/src/effects/green_impact.c index 0098e7c7e34..2c58df095e9 100644 --- a/src/effects/green_impact.c +++ b/src/effects/green_impact.c @@ -123,7 +123,7 @@ void green_impact_render(EffectInstance* effect) { renderTask.appendGfx = green_impact_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_28; retTask = queue_render_task(&renderTask); @@ -163,7 +163,7 @@ void green_impact_appendGfx(void* effect) { gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); gSPDisplayList(gMainGfxPos++, dlist); - guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, part->unk_04, part->unk_08, part->unk_0C); + guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, part->unk_04, part->unk_08, part->unk_0C); guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW); diff --git a/src/effects/hieroglyphs.c b/src/effects/hieroglyphs.c index 14ff080eec9..2901681a23d 100644 --- a/src/effects/hieroglyphs.c +++ b/src/effects/hieroglyphs.c @@ -102,7 +102,7 @@ void hieroglyphs_render(EffectInstance* effect) { renderTask.appendGfx = hieroglyphs_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/huff_puff_breath.c b/src/effects/huff_puff_breath.c index 25fd9f341fb..3363f45b2e5 100644 --- a/src/effects/huff_puff_breath.c +++ b/src/effects/huff_puff_breath.c @@ -115,7 +115,7 @@ void huff_puff_breath_render(EffectInstance* effect) { renderTask.appendGfx = huff_puff_breath_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/ice_pillar.c b/src/effects/ice_pillar.c index d3b76a6a84f..dd6c73084a9 100644 --- a/src/effects/ice_pillar.c +++ b/src/effects/ice_pillar.c @@ -103,7 +103,7 @@ void ice_pillar_update(EffectInstance* effect) { ); iceShard->data.iceShard->animFrame = rand_int(10) * 0.1; iceShard->data.iceShard->animRate = (rand_int(30) * 0.01) + 0.1; - iceShard->data.iceShard->rotation = rand_int(359); + iceShard->data.iceShard->rot = rand_int(359); iceShard->data.iceShard->angularVel = rand_int(20); iceShard->data.iceShard->vel.x = rand_int(10) - 5; iceShard->data.iceShard->vel.y = rand_int(10) - 5; @@ -144,7 +144,7 @@ void ice_pillar_render(EffectInstance* effect) { renderTask.appendGfx = ice_pillar_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 5; + renderTask.dist = 5; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/ice_shard.c b/src/effects/ice_shard.c index ad6bf8976d9..ae61b7e39aa 100644 --- a/src/effects/ice_shard.c +++ b/src/effects/ice_shard.c @@ -59,7 +59,7 @@ EffectInstance* ice_shard_main( data->envCol.a = 255; data->animFrame = 0; data->animRate = (rand_int(1) * 2 - 1) * 0.25 * (rand_int(4) * 0.1 + 0.1); - data->rotation = rand_int(359); + data->rot = rand_int(359); data->vel.x = rand_int(10) - 5; data->vel.y = rand_int(10) - 5; data->vel.z = rand_int(10) - 5; @@ -109,7 +109,7 @@ void ice_shard_update(EffectInstance* effect) { data->pos.x += data->vel.x; data->pos.y += data->vel.y; data->pos.z += data->vel.z; - data->rotation += data->angularVel; + data->rot += data->angularVel; if (unk_00 >= 2 && data->pos.y < 0.0f && data->vel.y < 0.0f) { data->pos.y = 0.0f; @@ -123,7 +123,7 @@ void ice_shard_render(EffectInstance* effect) { renderTask.appendGfx = ice_shard_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -143,12 +143,12 @@ void ice_shard_appendGfx(void* effect) { gDPPipeSync(gMainGfxPos++); gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); - guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, data->scale, data->pos.x, data->pos.y, data->pos.z); + guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, data->scale, data->pos.x, data->pos.y, data->pos.z); guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - guRotateF(sp20, data->rotation, 0.0f, 0.0f, 1.0f); + guRotateF(sp20, data->rot, 0.0f, 0.0f, 1.0f); guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW); diff --git a/src/effects/landing_dust.c b/src/effects/landing_dust.c index a265602896e..b51f3de479c 100644 --- a/src/effects/landing_dust.c +++ b/src/effects/landing_dust.c @@ -250,7 +250,7 @@ void landing_dust_render(EffectInstance* effect) { renderTask.appendGfx = landing_dust_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_28; retTask = queue_render_task(&renderTask); @@ -287,7 +287,7 @@ void landing_dust_appendGfx(void* effect) { spDC = temp_t0 & 0x40; guTranslateF(mtx1, part->x, part->y, part->z); - guRotateF(mtx2, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(mtx2, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(mtx2, mtx1, mtx3); guMtxF2L(mtx3, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/lens_flare.c b/src/effects/lens_flare.c index 3497010e894..0b49a41f4cb 100644 --- a/src/effects/lens_flare.c +++ b/src/effects/lens_flare.c @@ -99,7 +99,7 @@ void lens_flare_render(EffectInstance* effect) { renderTask.appendGfx = lens_flare_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 20; + renderTask.dist = 20; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -120,7 +120,7 @@ void lens_flare_appendGfx(void* effect) { gSPDisplayList(gMainGfxPos++, D_E0034788[type]); guTranslateF(mtxTransform, data->pos.x, data->pos.y, data->pos.z); - guRotateF(mtxTemp, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(mtxTemp, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(mtxTemp, mtxTransform, mtxShared); alpha = data->smallFlareAlpha; diff --git a/src/effects/light_rays.c b/src/effects/light_rays.c index fb0d0c20948..a168e1ae826 100644 --- a/src/effects/light_rays.c +++ b/src/effects/light_rays.c @@ -49,9 +49,9 @@ void func_E006A000(LightRaysFXData* part, s32 beamIdx) { part->unk_58 = part->unk_68; part->timeLeft = part->unk_7C; part->unk_8C = part->unk_6C; - part->rotation.x = part->initialRot.x; - part->rotation.y = part->initialRot.y; - part->rotation.z = part->initialRot.z; + part->rot.x = part->initialRot.x; + part->rot.y = part->initialRot.y; + part->rot.z = part->initialRot.z; } void func_E006A0BC(LightRaysFXData* part, s32 beamIdx) { @@ -59,9 +59,9 @@ void func_E006A0BC(LightRaysFXData* part, s32 beamIdx) { part->unk_58 = 0; part->timeLeft = beamIdx * 2 + 30; - part->rotation.x = D_E006AE10[idx++]; - part->rotation.y = D_E006AE10[idx++]; - part->rotation.z = D_E006AE10[idx++]; + part->rot.x = D_E006AE10[idx++]; + part->rot.y = D_E006AE10[idx++]; + part->rot.z = D_E006AE10[idx++]; part->alpha = 0; part->lifetime = 0; part->unk_34 = part->unk_38 = 0.0f; @@ -246,9 +246,9 @@ void light_rays_update(EffectInstance* effect) { func_E006A0BC(part, i); } if (part->unk_90 <= 0 || --part->unk_90 <= 0) { - part->rotation.x += part->unk_80; - part->rotation.y += part->unk_84; - part->rotation.z += part->unk_88; + part->rot.x += part->unk_80; + part->rot.y += part->unk_84; + part->rot.z += part->unk_88; } } } @@ -260,7 +260,7 @@ void light_rays_render(EffectInstance* effect) { renderTask.appendGfx = light_rays_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -306,11 +306,11 @@ void light_rays_appendGfx(void* effect) { func_E006A85C(part); } - guRotateF(mtxTemp, part->rotation.x, 1.0f, 0.0f, 0.0f); + guRotateF(mtxTemp, part->rot.x, 1.0f, 0.0f, 0.0f); guMtxCatF(mtxTemp, mtxTranslate, mtxTransform); if (type >= 2) { - unk_64 = part->rotation.z; + unk_64 = part->rot.z; if (type == 3) { angleZ = unk_64 + 45.0f; } else { @@ -319,7 +319,7 @@ void light_rays_appendGfx(void* effect) { guRotateF(mtxTemp, angleZ, 0.0f, 0.0f, 1.0f); guMtxCatF(mtxTemp, mtxTransform, mtxTransform); - guRotateF(mtxTemp, part->rotation.y, 0.0f, 1.0f, 0.0f); + guRotateF(mtxTemp, part->rot.y, 0.0f, 1.0f, 0.0f); guMtxCatF(mtxTemp, mtxTransform, mtxTransform); guTranslateF(mtxTemp, part->unk_58, 0.0f, 0.0f); guMtxCatF(mtxTemp, mtxTransform, mtxTransform); @@ -346,9 +346,9 @@ void light_rays_appendGfx(void* effect) { gDPSetPrimColor(gMainGfxPos++, 0, 0, 255, 255, 240, part->alpha); } else { - guRotateF(mtxTemp, part->rotation.y, 0.0f, 1.0f, 0.0f); + guRotateF(mtxTemp, part->rot.y, 0.0f, 1.0f, 0.0f); guMtxCatF(mtxTemp, mtxTransform, mtxTransform); - guRotateF(mtxTemp, part->rotation.z, 0.0f, 0.0f, 1.0f); + guRotateF(mtxTemp, part->rot.z, 0.0f, 0.0f, 1.0f); guMtxCatF(mtxTemp, mtxTransform, mtxTransform); guTranslateF(mtxTemp, part->unk_58, 0.0f, 0.0f); guMtxCatF(mtxTemp, mtxTransform, mtxTransform); diff --git a/src/effects/lightning.c b/src/effects/lightning.c index fa4ba017af4..74e74bb3a5c 100644 --- a/src/effects/lightning.c +++ b/src/effects/lightning.c @@ -210,7 +210,7 @@ void lightning_render(EffectInstance* effect) { renderTask.appendGfx = lightning_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_SURFACE_XLU_LAYER3; retTask = queue_render_task(&renderTask); @@ -263,7 +263,7 @@ void lightning_appendGfx(void* effect) { break; default: guTranslateF(sp20, data->unk_04, data->unk_08, data->unk_0C); - guRotateF(sp60, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp60, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp60, sp20, sp20); guTranslateF(sp60, 0.0f, 0.0f, 1.0f); guMtxCatF(sp60, sp20, sp20); diff --git a/src/effects/lightning_bolt.c b/src/effects/lightning_bolt.c index 6d623829ce5..46001c5fe14 100644 --- a/src/effects/lightning_bolt.c +++ b/src/effects/lightning_bolt.c @@ -156,9 +156,9 @@ void lightning_bolt_render(EffectInstance *effect) { renderTask.appendGfx = lightning_bolt_appendGfx; renderTask.appendGfxArg = effect; if (gGameStatusPtr->isBattle == TRUE) { - renderTask.distance = data->tipPos.z + 1000.0f; + renderTask.dist = data->tipPos.z + 1000.0f; } else { - renderTask.distance = 10; + renderTask.dist = 10; } renderTaskPointer->renderMode = RENDER_MODE_2D; diff --git a/src/effects/lil_oink.c b/src/effects/lil_oink.c index b385003de07..bc60b88a245 100644 --- a/src/effects/lil_oink.c +++ b/src/effects/lil_oink.c @@ -161,7 +161,7 @@ void lil_oink_render(EffectInstance* effect) { renderTask.appendGfx = lil_oink_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/merlin_house_stars.c b/src/effects/merlin_house_stars.c index 6a96602fc11..4828e853a50 100644 --- a/src/effects/merlin_house_stars.c +++ b/src/effects/merlin_house_stars.c @@ -116,7 +116,7 @@ void merlin_house_stars_render(EffectInstance* effect) { renderTask.appendGfx = merlin_house_stars_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/misc_particles.c b/src/effects/misc_particles.c index 21d39e99b6c..85ecf28415c 100644 --- a/src/effects/misc_particles.c +++ b/src/effects/misc_particles.c @@ -187,8 +187,8 @@ void misc_particles_update(EffectInstance* effect) { posX = particle->pos.x; posY = particle->pos.y; posZ = particle->pos.z; - temp_cos = cos_deg(gCameras[gCurrentCameraID].currentYaw); - temp_sin = sin_deg(gCameras[gCurrentCameraID].currentYaw); + temp_cos = cos_deg(gCameras[gCurrentCameraID].curYaw); + temp_sin = sin_deg(gCameras[gCurrentCameraID].curYaw); innerColorR = particle->innerColor.r; innerColorG = particle->innerColor.g; innerColorB = particle->innerColor.b; @@ -288,7 +288,7 @@ void misc_particles_render(EffectInstance* effect) { renderTask.appendGfx = misc_particles_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 7; + renderTask.dist = 7; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -314,7 +314,7 @@ void misc_particles_appendGfx(void* effect) { particle++; for (i = 1; i < ((EffectInstance*)effect)->numParts; i++, particle++) { if (particle->animTime >= 0) { - guPositionF(mtxTransform, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, particle->scale * alphaScale, particle->pos.x, particle->pos.y, particle->pos.z); + guPositionF(mtxTransform, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, particle->scale * alphaScale, particle->pos.x, particle->pos.y, particle->pos.z); guMtxF2L(mtxTransform, &gDisplayContext->matrixStack[gMatrixListPos]); gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW); diff --git a/src/effects/motion_blur_flame.c b/src/effects/motion_blur_flame.c index 68684a4d16e..3973543fa7a 100644 --- a/src/effects/motion_blur_flame.c +++ b/src/effects/motion_blur_flame.c @@ -113,7 +113,7 @@ void motion_blur_flame_render(EffectInstance* effect) { renderTask.appendGfx = motion_blur_flame_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 100; + renderTask.dist = 100; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/moving_cloud.c b/src/effects/moving_cloud.c index fd20cdce68f..ae03a22a5f9 100644 --- a/src/effects/moving_cloud.c +++ b/src/effects/moving_cloud.c @@ -169,7 +169,7 @@ void moving_cloud_render(EffectInstance* effect) { renderTask.appendGfx = moving_cloud_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/music_note.c b/src/effects/music_note.c index e70390aa3a3..66775f65618 100644 --- a/src/effects/music_note.c +++ b/src/effects/music_note.c @@ -121,7 +121,7 @@ void music_note_render(EffectInstance* effect) { renderTask.appendGfx = music_note_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -147,7 +147,7 @@ void music_note_appendGfx(void* data) { D_E004C67C[rgbOffset], D_E004C67C[rgbOffset + 1], D_E004C67C[rgbOffset + 2], fxData->unk_14 ); guTranslateF(sp18, fxData->pos.x, fxData->pos.y, fxData->pos.z); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp18); guScaleF(sp58, fxData->unk_10, fxData->unk_10, 0.0f); guMtxCatF(sp58, sp18, sp18); diff --git a/src/effects/peach_star_beam.c b/src/effects/peach_star_beam.c index 3e4d5fa879b..66760979ed3 100644 --- a/src/effects/peach_star_beam.c +++ b/src/effects/peach_star_beam.c @@ -75,8 +75,8 @@ EffectInstance* peach_star_beam_main(s32 type, f32 x, f32 y, f32 z, f32 arg4, s3 data->envG = 255; data->envB = 255; data->envA = 255; - data->rotationSpeed = 5.0f; - data->rotationAngle = 0; + data->rotSpeed = 5.0f; + data->rotAngle = 0; data->circleCenter.x = x; data->circleCenter.y = y + 50.0f; data->circleCenter.z = z; @@ -121,8 +121,8 @@ void peach_star_beam_update(EffectInstance* effect) { return; } - data->rotationAngle += data->rotationSpeed; - rotationAngle = data->rotationAngle; + data->rotAngle += data->rotSpeed; + rotationAngle = data->rotAngle; radius = data->circleRadius; centerX = data->circleCenter.x; centerY = data->circleCenter.y; @@ -155,7 +155,7 @@ void peach_star_beam_render(EffectInstance* effect) { renderTask.appendGfx = peach_star_beam_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/pink_sparkles.c b/src/effects/pink_sparkles.c index 288520938b3..8955c403c3a 100644 --- a/src/effects/pink_sparkles.c +++ b/src/effects/pink_sparkles.c @@ -220,7 +220,7 @@ void pink_sparkles_render(EffectInstance* effect) { renderTask.appendGfx = pink_sparkles_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -247,7 +247,7 @@ void pink_sparkles_appendGfx(void* effect) { colorIdx = (part->unk_20 - 1) * 3; guTranslateF(sp98, part->unk_04, part->unk_08, part->unk_0C); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp98, sp98); part++; diff --git a/src/effects/purple_ring.c b/src/effects/purple_ring.c index e837d13a803..559bdccc2c0 100644 --- a/src/effects/purple_ring.c +++ b/src/effects/purple_ring.c @@ -181,7 +181,7 @@ void purple_ring_render(EffectInstance* effect) { renderTask.appendGfx = purple_ring_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/quizmo_assistant.c b/src/effects/quizmo_assistant.c index 9a98e995ad7..3e3daf2a58a 100644 --- a/src/effects/quizmo_assistant.c +++ b/src/effects/quizmo_assistant.c @@ -49,9 +49,9 @@ EffectInstance* quizmo_assistant_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f3 data->vanishTimer = arg5; } data->fadeInAmt = 255; - data->position.x = arg1; - data->position.y = arg2; - data->position.z = arg3; + data->pos.x = arg1; + data->pos.y = arg2; + data->pos.z = arg3; data->anim = 0; return effect; @@ -90,7 +90,7 @@ void quizmo_assistant_render(EffectInstance* effect) { renderTask.appendGfx = quizmo_assistant_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -108,8 +108,8 @@ void quizmo_assistant_appendGfx(void* effect) { gDPPipeSync(gMainGfxPos++); gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); - guTranslateF(sp18, data->position.x, data->position.y, data->position.z); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guTranslateF(sp18, data->pos.x, data->pos.y, data->pos.z); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp18); guTranslateF(sp58, 89.5f, 0.0f, 2.0f); guMtxCatF(sp58, sp18, sp18); diff --git a/src/effects/quizmo_audience.c b/src/effects/quizmo_audience.c index 2e101e82a49..58924d34479 100644 --- a/src/effects/quizmo_audience.c +++ b/src/effects/quizmo_audience.c @@ -170,7 +170,7 @@ void quizmo_audience_render(EffectInstance* effect) { renderTask.appendGfx = quizmo_audience_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -191,7 +191,7 @@ void quizmo_audience_appendGfx(void* effect) { gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); guTranslateF(sp18, data->pos.x, data->pos.y, data->pos.z); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp18); guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/quizmo_stage.c b/src/effects/quizmo_stage.c index ac6869cc16b..5dbc3a336ea 100644 --- a/src/effects/quizmo_stage.c +++ b/src/effects/quizmo_stage.c @@ -98,7 +98,7 @@ void quizmo_stage_render(EffectInstance* effect) { renderTask.appendGfx = quizmo_stage_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_SURFACE_OPA; retTask = queue_render_task(&renderTask); @@ -115,7 +115,7 @@ void quizmo_stage_appendGfx(void* effect) { gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); guTranslateF(sp18, data->origin.x, data->origin.y, data->origin.z); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp18); guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/radial_shimmer.c b/src/effects/radial_shimmer.c index 1f1293cc011..eef0576e066 100644 --- a/src/effects/radial_shimmer.c +++ b/src/effects/radial_shimmer.c @@ -277,7 +277,7 @@ void radial_shimmer_render(EffectInstance* effect) { renderTask.appendGfx = radial_shimmer_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/radiating_energy_orb.c b/src/effects/radiating_energy_orb.c index 4f088a43234..99d7b0191dc 100644 --- a/src/effects/radiating_energy_orb.c +++ b/src/effects/radiating_energy_orb.c @@ -121,7 +121,7 @@ void radiating_energy_orb_render(EffectInstance* effect) { renderTask.appendGfx = radiating_energy_orb_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_SURFACE_XLU_LAYER3; retTask = queue_render_task(&renderTask); diff --git a/src/effects/recover.c b/src/effects/recover.c index 0382a4ef21b..79fc305e8ad 100644 --- a/src/effects/recover.c +++ b/src/effects/recover.c @@ -177,7 +177,7 @@ void func_E0080448(EffectInstance* effect) { gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp98); guMtxF2L(sp98, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/red_impact.c b/src/effects/red_impact.c index 3f466cf7264..e44de357599 100644 --- a/src/effects/red_impact.c +++ b/src/effects/red_impact.c @@ -133,7 +133,7 @@ void red_impact_render(EffectInstance* effect) { renderTask.appendGfx = red_impact_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_28; retTask = queue_render_task(&renderTask); @@ -170,7 +170,7 @@ void red_impact_appendGfx(void* effect) { gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); gSPDisplayList(gMainGfxPos++, dlist); - guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, part->unk_04, part->unk_08, part->unk_0C); + guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, part->unk_04, part->unk_08, part->unk_0C); guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW); diff --git a/src/effects/ring_blast.c b/src/effects/ring_blast.c index 0b7243639ff..202f6a46252 100644 --- a/src/effects/ring_blast.c +++ b/src/effects/ring_blast.c @@ -76,7 +76,7 @@ void ring_blast_render(EffectInstance* effect) { renderTask.appendGfx = ring_blast_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_28; retTask = queue_render_task(&renderTask); @@ -98,7 +98,7 @@ void ring_blast_appendGfx(void* effect) { gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); gSPDisplayList(gMainGfxPos++, dlist2); - guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, data->unk_10, data->pos.x, data->pos.y, data->pos.z); + guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, data->unk_10, data->pos.x, data->pos.y, data->pos.z); guRotateF(sp60, data->unk_24, 0.0f, 0.0f, 1.0f); guMtxCatF(sp60, sp20, sp20); guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/rising_bubble.c b/src/effects/rising_bubble.c index 0e83fa016f8..c2ece900feb 100644 --- a/src/effects/rising_bubble.c +++ b/src/effects/rising_bubble.c @@ -98,7 +98,7 @@ void rising_bubble_render(EffectInstance* effect) { renderTask.appendGfx = rising_bubble_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -136,7 +136,7 @@ void rising_bubble_appendGfx(void* effect) { gDPSetPrimColor(gMainGfxPos++, 0, 0, 255, 255, 255, data->unk_14); gDPSetEnvColor(gMainGfxPos++, 128, 128, 255, data->unk_14); - guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, data->unk_10, data->pos.x, data->pos.y, data->pos.z); + guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, data->unk_10, data->pos.x, data->pos.y, data->pos.z); } guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/shape_spell.c b/src/effects/shape_spell.c index 8e2588aa3c8..d7529986a0e 100644 --- a/src/effects/shape_spell.c +++ b/src/effects/shape_spell.c @@ -126,7 +126,7 @@ void shape_spell_render(EffectInstance* effect) { renderTask.appendGfx = shape_spell_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -183,7 +183,7 @@ void shape_spell_appendGfx(void* effect) { if (isChild == 0) { angle = timeLeft * 35; factor = 9.0f; - var_f30 = -gCameras[gCurrentCameraID].currentYaw; + var_f30 = -gCameras[gCurrentCameraID].curYaw; } else { angle = timeLeft * 25; factor = 6.0f; @@ -260,7 +260,7 @@ void shape_spell_appendGfx(void* effect) { if (!isChild) { var_f30 = 0.0f; } else { - var_f30 = -gCameras[gCurrentCameraID].currentYaw; + var_f30 = -gCameras[gCurrentCameraID].curYaw; } guPositionF(sp20, 0.0f, var_f30, 0.0f, 1.0f, data->pos.x, data->pos.y, data->pos.z); diff --git a/src/effects/shattering_stones.c b/src/effects/shattering_stones.c index 0c3278bd20f..44678957e85 100644 --- a/src/effects/shattering_stones.c +++ b/src/effects/shattering_stones.c @@ -131,7 +131,7 @@ void shattering_stones_render(EffectInstance* effect) { renderTask.appendGfx = shattering_stones_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -153,7 +153,7 @@ void shattering_stones_appendGfx(void* effect) { guTranslateF(sp20, part->unk_00, part->unk_04, part->unk_08); guScaleF(sp60, 1.5f, 1.5f, 1.5f); guMtxCatF(sp60, sp20, spA0); - guRotateF(sp60, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp60, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp60, spA0, spA0); guRotateF(sp60, part->unk_34, 0.0f, 0.0f, 1.0f); guMtxCatF(sp60, spA0, spA0); @@ -173,7 +173,7 @@ void shattering_stones_appendGfx(void* effect) { guTranslateF(sp20, part->unk_00, part->unk_04, part->unk_08); guScaleF(sp60, 1.5f, 1.5f, 1.5f); guMtxCatF(sp60, sp20, spA0); - guRotateF(sp60, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp60, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp60, spA0, spA0); guRotateF(spE0, part->unk_2C, 1.0f, 0.0f, 0.0f); diff --git a/src/effects/shimmer_burst.c b/src/effects/shimmer_burst.c index 4d2caef43bb..328f1552754 100644 --- a/src/effects/shimmer_burst.c +++ b/src/effects/shimmer_burst.c @@ -189,7 +189,7 @@ void shimmer_burst_render(EffectInstance* effect) { renderTask.appendGfx = shimmer_burst_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/shimmer_wave.c b/src/effects/shimmer_wave.c index ba87257ac60..bd262220c08 100644 --- a/src/effects/shimmer_wave.c +++ b/src/effects/shimmer_wave.c @@ -177,7 +177,7 @@ void shimmer_wave_render(EffectInstance* effect) { renderTask.appendGfx = shimmer_wave_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/shiny_flare.c b/src/effects/shiny_flare.c index b1a1dd1476b..51192d333d9 100644 --- a/src/effects/shiny_flare.c +++ b/src/effects/shiny_flare.c @@ -87,7 +87,7 @@ void shiny_flare_render(EffectInstance* effect) { renderTask.appendGfx = shiny_flare_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/shockwave.c b/src/effects/shockwave.c index 6c0cf940955..b282b86e394 100644 --- a/src/effects/shockwave.c +++ b/src/effects/shockwave.c @@ -258,7 +258,7 @@ void shockwave_render(EffectInstance* effect) { renderTask.appendGfx = shockwave_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_28; retTask = queue_render_task(&renderTask); @@ -309,7 +309,7 @@ void shockwave_appendGfx(void* effect) { gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); gSPDisplayList(gMainGfxPos++, dlist2); - guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, + guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, data->pos.x, data->pos.y, data->pos.z); guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/sleep_bubble.c b/src/effects/sleep_bubble.c index da2b8e7a0af..348cfc809f8 100644 --- a/src/effects/sleep_bubble.c +++ b/src/effects/sleep_bubble.c @@ -117,7 +117,7 @@ void sleep_bubble_render(EffectInstance* effect) { renderTask.appendGfx = sleep_bubble_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -153,7 +153,7 @@ void sleep_bubble_appendGfx(void* effect) { guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]); gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); - guRotateF(sp18, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp18, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guTranslateF(sp58, data->unk_C4, data->unk_C8, 0.0f); guMtxCatF(sp58, sp18, sp18); guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/small_gold_sparkle.c b/src/effects/small_gold_sparkle.c index cd7b9d72654..222b909a2af 100644 --- a/src/effects/small_gold_sparkle.c +++ b/src/effects/small_gold_sparkle.c @@ -102,7 +102,7 @@ void small_gold_sparkle_render(EffectInstance* effect) { renderTask.appendGfx = small_gold_sparkle_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -117,7 +117,7 @@ void small_gold_sparkle_appendGfx(void* effect) { Mtx* spD8; s32 i; - guRotateF(sp98, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp98, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxF2L(sp98, &gDisplayContext->matrixStack[gMatrixListPos]); spD8 = &gDisplayContext->matrixStack[gMatrixListPos++]; gDPPipeSync(gMainGfxPos++); diff --git a/src/effects/smoke_burst.c b/src/effects/smoke_burst.c index 6e40cf71897..fb927c239f9 100644 --- a/src/effects/smoke_burst.c +++ b/src/effects/smoke_burst.c @@ -91,7 +91,7 @@ void smoke_burst_render(EffectInstance* effect) { renderTask.appendGfx = smoke_burst_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_28; retTask = queue_render_task(&renderTask); @@ -113,7 +113,7 @@ void smoke_burst_appendGfx(void* effect) { gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); gSPDisplayList(gMainGfxPos++, dlist2); - guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, data->unk_10, data->pos.x, data->pos.y, data->pos.z); + guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, data->unk_10, data->pos.x, data->pos.y, data->pos.z); guRotateF(sp60, 20.0f, 0.0f, 0.0f, 1.0f); guMtxCatF(sp60, sp20, sp20); guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/smoke_impact.c b/src/effects/smoke_impact.c index fc8d969af2e..36a70fc3385 100644 --- a/src/effects/smoke_impact.c +++ b/src/effects/smoke_impact.c @@ -109,7 +109,7 @@ void smoke_impact_render(EffectInstance* effect) { renderTask.appendGfx = smoke_impact_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_28; retTask = queue_render_task(&renderTask); @@ -135,7 +135,7 @@ void smoke_impact_appendGfx(void* effect) { gSPDisplayList(gMainGfxPos++, dlist2); guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp98); guMtxF2L(sp98, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/smoke_ring.c b/src/effects/smoke_ring.c index 522d316452f..09e88d9d670 100644 --- a/src/effects/smoke_ring.c +++ b/src/effects/smoke_ring.c @@ -112,7 +112,7 @@ void smoke_ring_render(EffectInstance* effect) { renderTask.appendGfx = smoke_ring_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_28; retTask = queue_render_task(&renderTask); @@ -141,7 +141,7 @@ void smoke_ring_appendGfx(void* effect) { gSPDisplayList(gMainGfxPos++, D_09002950_32B7F0); guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp98); guMtxF2L(sp98, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/snaking_static.c b/src/effects/snaking_static.c index e259c8b6dc9..79937a04b01 100644 --- a/src/effects/snaking_static.c +++ b/src/effects/snaking_static.c @@ -148,7 +148,7 @@ void snaking_static_render(EffectInstance* effect) { renderTask.appendGfx = snaking_static_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/snowfall.c b/src/effects/snowfall.c index 9561f15be1e..22510d5e755 100644 --- a/src/effects/snowfall.c +++ b/src/effects/snowfall.c @@ -133,7 +133,7 @@ void snowfall_update(EffectInstance* effect) { if (timeLeft < 10) { data->unk_28 = timeLeft * 25; } - boomLength = camera->currentBoomLength; + boomLength = camera->curBoomLength; temp_s6 = (boomLength * 0.3) + 1.0; data++; @@ -153,7 +153,7 @@ void snowfall_render(EffectInstance* effect) { renderTask.appendGfx = snowfall_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -189,7 +189,7 @@ void snowfall_appendGfx(void* effect) { gSPDisplayList(gMainGfxPos++, D_09000C00_38DC70); gDPSetPrimColor(gMainGfxPos++, 0, 0, 255, 255, 255, unk_28); - guRotateF(sp18, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp18, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]); mtx = &gDisplayContext->matrixStack[gMatrixListPos++]; diff --git a/src/effects/snowflake.c b/src/effects/snowflake.c index 8bd75a62d52..82e5c7c90d8 100644 --- a/src/effects/snowflake.c +++ b/src/effects/snowflake.c @@ -88,7 +88,7 @@ void snowflake_render(EffectInstance* effect) { RenderTask* renderTaskPtr = &renderTask; RenderTask* retTask; f32 effectPos = data->pos.x; - f32 playerPos = playerStatus->position.x; + f32 playerPos = playerStatus->pos.x; if (effectPos - playerPos > 200) { data->pos.x = effectPos - 400; @@ -99,7 +99,7 @@ void snowflake_render(EffectInstance* effect) { } effectPos = data->pos.z; - playerPos = playerStatus->position.z; + playerPos = playerStatus->pos.z; if (effectPos - playerPos > 200) { data->pos.z = effectPos - 400; } else { @@ -110,7 +110,7 @@ void snowflake_render(EffectInstance* effect) { renderTaskPtr->appendGfx = &snowflake_appendGfx; renderTaskPtr->appendGfxArg = effect; - renderTaskPtr->distance = 0; + renderTaskPtr->dist = 0; renderTaskPtr->renderMode = RENDER_MODE_2D; retTask = queue_render_task(renderTaskPtr); @@ -127,7 +127,7 @@ void snowflake_appendGfx(void* effect) { gSPDisplayList(gMainGfxPos++, D_09000900_331800); guTranslateF(sp18, data->pos.x, data->pos.y, data->pos.z); - guRotateF(spD8, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(spD8, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(spD8, sp18, sp118); guMtxF2L(sp118, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/snowman_doll.c b/src/effects/snowman_doll.c index 52e6f1405a6..0b522771784 100644 --- a/src/effects/snowman_doll.c +++ b/src/effects/snowman_doll.c @@ -279,7 +279,7 @@ void snowman_doll_render(EffectInstance* effect) { renderTask.appendGfx = snowman_doll_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = -10; + renderTask.dist = -10; renderTask.renderMode = RENDER_MODE_28; retTask = queue_render_task(&renderTask); diff --git a/src/effects/something_rotating.c b/src/effects/something_rotating.c index e67f2d0c9c6..156e6c9fe5b 100644 --- a/src/effects/something_rotating.c +++ b/src/effects/something_rotating.c @@ -245,7 +245,7 @@ void something_rotating_render(EffectInstance* effect) { renderTask.appendGfx = something_rotating_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_SURFACE_XLU_LAYER1; retTask = queue_render_task(&renderTask); @@ -258,7 +258,7 @@ void func_E01166E8(s32 arg0, SomethingRotatingFXData* part) { Matrix4f sp60; if (arg0 == 0) { - temp = gCameras[gCurrentCameraID].currentYaw; + temp = gCameras[gCurrentCameraID].curYaw; } else { temp = 0.0f; } diff --git a/src/effects/sparkles.c b/src/effects/sparkles.c index 2699a1d8cbf..db1a464166c 100644 --- a/src/effects/sparkles.c +++ b/src/effects/sparkles.c @@ -236,7 +236,7 @@ void sparkles_render(EffectInstance* effect) { renderTask.appendGfx = sparkles_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -257,7 +257,7 @@ void sparkles_appendGfx(void* effect) { colorIdx = (part->unk_20 - 1) * 3; guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp98); part++; diff --git a/src/effects/spiky_white_aura.c b/src/effects/spiky_white_aura.c index 6c2d467c5f6..61408ad19d5 100644 --- a/src/effects/spiky_white_aura.c +++ b/src/effects/spiky_white_aura.c @@ -95,8 +95,8 @@ void spiky_white_aura_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, s32 arg4) { part->unk_08 = arg2; part->unk_0C = arg3; - sinYaw = sin_deg(gCameras[gCurrentCameraID].currentYaw); - cosYaw = -cos_deg(gCameras[gCurrentCameraID].currentYaw); + sinYaw = sin_deg(gCameras[gCurrentCameraID].curYaw); + cosYaw = -cos_deg(gCameras[gCurrentCameraID].curYaw); if (numParts != 1) { rotateA = (i * 100) / (numParts - 1) - 50; @@ -168,7 +168,7 @@ void spiky_white_aura_render(EffectInstance* effect) { renderTask.appendGfx = spiky_white_aura_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -187,7 +187,7 @@ void spiky_white_aura_appendGfx(void* effect) { for (i = 0; i < ((EffectInstance*)effect)->numParts; i++, part++) { guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp18); guRotateF(sp58, part->unk_1C, 0.0f, 0.0f, 1.0f); guMtxCatF(sp58, sp18, sp18); diff --git a/src/effects/spirit_card.c b/src/effects/spirit_card.c index 7e8c64e654b..42f000ee54a 100644 --- a/src/effects/spirit_card.c +++ b/src/effects/spirit_card.c @@ -121,7 +121,7 @@ void spirit_card_render(EffectInstance* effect) { renderTask.appendGfx = spirit_card_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_SURFACE_XLU_LAYER1; retTask = queue_render_task(&renderTask); @@ -134,7 +134,7 @@ void func_E0112330(s32 arg0, SpiritCardFXData* data) { Matrix4f sp60; if (arg0 == 0) { - temp = gCameras[gCurrentCameraID].currentYaw; + temp = gCameras[gCurrentCameraID].curYaw; } else { temp = 0.0f; } diff --git a/src/effects/squirt.c b/src/effects/squirt.c index 5a5110ec50b..f2d3a1fe3ae 100644 --- a/src/effects/squirt.c +++ b/src/effects/squirt.c @@ -146,7 +146,7 @@ void squirt_render(EffectInstance* effect) { renderTask.appendGfx = squirt_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/star.c b/src/effects/star.c index fd8ea881e0d..b3ea9feb8f3 100644 --- a/src/effects/star.c +++ b/src/effects/star.c @@ -81,7 +81,7 @@ EffectInstance* star_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 part->unk_14 = temp_f22 * temp_f26; part->unk_18 = temp_f20 * temp_f26; - currentYaw = gCameras[gCurrentCameraID].currentYaw; + currentYaw = gCameras[gCurrentCameraID].curYaw; cosYaw = -cos_deg(currentYaw); sinYaw = -sin_deg(currentYaw); @@ -168,7 +168,7 @@ void star_update(EffectInstance* effect) { } } - if (playerStatus->position.y - data->unk_08 > 300.0f) { + if (playerStatus->pos.y - data->unk_08 > 300.0f) { data->unk_30 = -1; } @@ -190,7 +190,7 @@ void star_render(EffectInstance* effect) { renderTask.appendGfxArg = effect; renderTask.appendGfx = star_appendGfx; - renderTask.distance = 0; + renderTask.dist = 0; if (effect15->unk_38 != 0) { renderModeTemp = RENDER_MODE_2D; } else { @@ -216,7 +216,7 @@ void star_appendGfx(void* effect) { gDPPipeSync(gMainGfxPos++); gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); - guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, unk_240, data->unk_04, data->unk_08, data->unk_0C); + guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, unk_240, data->unk_04, data->unk_08, data->unk_0C); guRotateF(sp60, data->unk_24, 0.0f, 0.0f, 1.0f); guMtxCatF(sp60, sp20, sp20); guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); @@ -243,7 +243,7 @@ void star_appendGfx(void* effect) { if (data->unk_1C <= 1.0f) { s32 baseIdx = (data->unk_3C + 5) % 8; - guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, unk_240, data->unk_04, data->unk_08, data->unk_0C); + guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, unk_240, data->unk_04, data->unk_08, data->unk_0C); guRotateF(sp60, data->unk_20, 0.0f, 0.0f, 1.0f); guMtxCatF(sp60, sp20, sp20); guMtxF2L(sp20, &data->unk_40[data->unk_3C]); diff --git a/src/effects/star_outline.c b/src/effects/star_outline.c index 32054053641..736df7cd179 100644 --- a/src/effects/star_outline.c +++ b/src/effects/star_outline.c @@ -137,7 +137,7 @@ void star_outline_render(EffectInstance* effect) { renderTask.appendGfx = star_outline_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -211,7 +211,7 @@ void star_outline_appendGfx(void* effect) { gSPDisplayList(gMainGfxPos++, D_E0126BC8[0]); if (unk_34 != 0) { - guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, (f32) ((f64) data->unk_54 * 0.4), data->pos.x, data->pos.y, data->pos.z); + guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, (f32) ((f64) data->unk_54 * 0.4), data->pos.x, data->pos.y, data->pos.z); guPositionF(sp60, data->unk_48, data->unk_4C, data->unk_50, 1.0f, 0.0f, 0.0f, 0.0f); guMtxCatF(sp60, sp20, sp20); guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); @@ -230,7 +230,7 @@ void star_outline_appendGfx(void* effect) { gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW); } - guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, data->unk_38 * 0.4, data->pos.x, data->pos.y, data->pos.z); + guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, data->unk_38 * 0.4, data->pos.x, data->pos.y, data->pos.z); guPositionF(sp60, data->unk_3C.x, data->unk_3C.y, data->unk_3C.z, 1.0f, 0.0f, 0.0f, 0.0f); guMtxCatF(sp60, sp20, sp20); guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/star_spirits_energy.c b/src/effects/star_spirits_energy.c index a1c44540b63..39b5da0f936 100644 --- a/src/effects/star_spirits_energy.c +++ b/src/effects/star_spirits_energy.c @@ -328,7 +328,7 @@ void star_spirits_energy_render(EffectInstance* effect) { renderTask.appendGfx = star_spirits_energy_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -345,7 +345,7 @@ void star_spirits_energy_appendGfx(void* effect) { gDPPipeSync(gMainGfxPos++); gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); - guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, + guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, data->unk_3C, data->unk_08, data->unk_0C, data->unk_10); guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/stars_burst.c b/src/effects/stars_burst.c index 63462190648..81538c498a4 100644 --- a/src/effects/stars_burst.c +++ b/src/effects/stars_burst.c @@ -121,7 +121,7 @@ void stars_burst_render(EffectInstance* effect) { renderTask.appendGfx = stars_burst_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -155,7 +155,7 @@ void stars_burst_appendGfx(void* effect) { gDPSetPrimColor(gMainGfxPos++, 0, 0, D_E0042780[rIdx % 36], D_E0042780[gIdx % 36], D_E0042780[bIdx % 36], unk_2C); guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp18); guScaleF(sp58, part->unk_24, part->unk_24, 1.0f); guMtxCatF(sp58, sp18, sp18); diff --git a/src/effects/stars_orbiting.c b/src/effects/stars_orbiting.c index 9fa5a014f7e..448e6b51efe 100644 --- a/src/effects/stars_orbiting.c +++ b/src/effects/stars_orbiting.c @@ -117,7 +117,7 @@ void func_E005E334(EffectInstance* effect) { gSPDisplayList(gMainGfxPos++, dlist2); guTranslateF(sp18, part->pos.x, part->pos.y, part->pos.z); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp98); guMtxF2L(sp98, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/stars_shimmer.c b/src/effects/stars_shimmer.c index 973288bdbf5..0f64f1d485d 100644 --- a/src/effects/stars_shimmer.c +++ b/src/effects/stars_shimmer.c @@ -273,7 +273,7 @@ void stars_shimmer_render(EffectInstance* effect) { renderTask.appendGfx = stars_shimmer_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -297,7 +297,7 @@ void stars_shimmer_appendGfx(void* effect) { temp_s4 = (data->lifeTime - 1) * 3; guTranslateF(sp18, data->pos.x, data->pos.y, data->pos.z); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp98); switch (type) { diff --git a/src/effects/stars_spread.c b/src/effects/stars_spread.c index 98e09dba3b6..10f74886be4 100644 --- a/src/effects/stars_spread.c +++ b/src/effects/stars_spread.c @@ -112,7 +112,7 @@ void stars_spread_render(EffectInstance* effect) { renderTask.appendGfx = stars_spread_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_28; retTask = queue_render_task(&renderTask); @@ -131,7 +131,7 @@ void stars_spread_appendGfx(void* effect) { gSPDisplayList(gMainGfxPos++, D_09000440_360E70); guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp18); guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/stat_change.c b/src/effects/stat_change.c index 901e03d60d3..88eee1a8b5e 100644 --- a/src/effects/stat_change.c +++ b/src/effects/stat_change.c @@ -245,7 +245,7 @@ void func_E00AC2A4(EffectInstance* effect) { gDPPipeSync(gMainGfxPos++); gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); - guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, data->scale, data->pos.x, data->pos.y, data->pos.z); + guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, data->scale, data->pos.x, data->pos.y, data->pos.z); guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW); diff --git a/src/effects/static_status.c b/src/effects/static_status.c index 0d07bf1a36a..5acb44cbaee 100644 --- a/src/effects/static_status.c +++ b/src/effects/static_status.c @@ -147,7 +147,7 @@ void static_status_update(EffectInstance* effect) { part->unk_18 = 0.0f; part->unk_1C = 0.0f; part->scale = 1.0f; - part->rotation = -angle - 45.0f; + part->rot = -angle - 45.0f; } if (type == 0) { @@ -178,7 +178,7 @@ void static_status_render(EffectInstance* effect) { renderTask.appendGfx = static_status_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_SURFACE_OPA; retTask = queue_render_task(&renderTask); @@ -212,7 +212,7 @@ void static_status_appendGfx(void* effect) { part++; for (i = 1; i < ((EffectInstance*)effect)->numParts; i++, part++) { if (part->frame >= 0) { - guPositionF(mtxTransform, 0.0f, 0.0f, part->rotation, part->scale, part->pos.x, part->pos.y, 0.0f); + guPositionF(mtxTransform, 0.0f, 0.0f, part->rot, part->scale, part->pos.x, part->pos.y, 0.0f); guMtxF2L(mtxTransform, &gDisplayContext->matrixStack[gMatrixListPos]); gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW); diff --git a/src/effects/steam_burst.c b/src/effects/steam_burst.c index a2f84df52a5..8d573ac3be9 100644 --- a/src/effects/steam_burst.c +++ b/src/effects/steam_burst.c @@ -100,7 +100,7 @@ void steam_burst_render(EffectInstance* effect) { renderTask.appendGfx = steam_burst_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_28; retTask = queue_render_task(&renderTask); @@ -124,7 +124,7 @@ void steam_burst_appendGfx(void* effect) { gSPDisplayList(gMainGfxPos++, dlist2); guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp98); guMtxF2L(sp98, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/stop_watch.c b/src/effects/stop_watch.c index 51e75f65765..a63ff518399 100644 --- a/src/effects/stop_watch.c +++ b/src/effects/stop_watch.c @@ -168,7 +168,7 @@ void stop_watch_render(EffectInstance* effect) { renderTask.appendGfx = stop_watch_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/sun.c b/src/effects/sun.c index a28167e73e4..45691694050 100644 --- a/src/effects/sun.c +++ b/src/effects/sun.c @@ -138,7 +138,7 @@ void sun_render(EffectInstance* effect) { renderTask.appendGfx = sun_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/sweat.c b/src/effects/sweat.c index 01bf92a8c9e..97f4615aa3d 100644 --- a/src/effects/sweat.c +++ b/src/effects/sweat.c @@ -33,7 +33,7 @@ void sweat_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, s32 ASSERT(data != NULL); data->unk_00 = arg0; - guRotateF(matrix, -arg5, sin_deg(gCameras[gCurrentCameraID].currentYaw), 0.0f, -cos_deg(gCameras[gCurrentCameraID].currentYaw)); + guRotateF(matrix, -arg5, sin_deg(gCameras[gCurrentCameraID].curYaw), 0.0f, -cos_deg(gCameras[gCurrentCameraID].curYaw)); temp_f2 = arg4 + 16.0f; data->pos.x = arg1 + (matrix[1][0] * temp_f2); data->pos.y = arg2 + (matrix[1][1] * temp_f2); @@ -74,7 +74,7 @@ void sweat_render(EffectInstance* effect) { renderTask.appendGfx = sweat_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -90,7 +90,7 @@ void sweat_appendGfx(void* effect) { gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); guTranslateF(sp18, data->pos.x, data->pos.y, data->pos.z); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp18); guRotateF(sp58, data->unk_10, 0.0f, 0.0f, 1.0f); guMtxCatF(sp58, sp18, sp18); diff --git a/src/effects/throw_spiny.c b/src/effects/throw_spiny.c index a9c1b61bfbe..bb5dcadf55c 100644 --- a/src/effects/throw_spiny.c +++ b/src/effects/throw_spiny.c @@ -75,7 +75,7 @@ EffectInstance* throw_spiny_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg spinyObject->unk_34 = 180; spinyObject->unk_38 = 120; spinyObject->yaw = rand_int(360); - spinyObject->rotationSpeed = rand_int(10) + 5; + spinyObject->rotSpeed = rand_int(10) + 5; spinyObject->state = -1; spinyObject->xScale = 1.0f; spinyObject->yScale = 1.0f; @@ -120,14 +120,14 @@ void throw_spiny_update(EffectInstance* effectInstance) { spinyObject->pos.x += spinyObject->unk_44; spinyObject->pos.y += spinyObject->gravity; spinyObject->pos.z += spinyObject->unk_4C; - spinyObject->yaw += spinyObject->rotationSpeed; + spinyObject->yaw += spinyObject->rotSpeed; } if ((lifeDuration - 1) == spinyObject->timeUntilFall) { spinyObject->state = 0; spinyObject->gravity = -spinyObject->gravity; spinyObject->unk_44 = spinyObject->unk_44; - spinyObject->rotationSpeed = -4.0f; + spinyObject->rotSpeed = -4.0f; return; } @@ -135,7 +135,7 @@ void throw_spiny_update(EffectInstance* effectInstance) { if ((gravity < 0.0f) && (spinyObject->pos.y < 100.0 / 7.0)) { spinyObject->pos.y = 100.0f / 7.0f; - spinyObject->rotationSpeed = -20.0f; + spinyObject->rotSpeed = -20.0f; spinyObject->gravity = gravity - gravity; } } @@ -146,7 +146,7 @@ void throw_spiny_render(EffectInstance* effect) { renderTask.appendGfx = throw_spiny_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/thunderbolt_ring.c b/src/effects/thunderbolt_ring.c index ed119902986..e4738177eaf 100644 --- a/src/effects/thunderbolt_ring.c +++ b/src/effects/thunderbolt_ring.c @@ -90,7 +90,7 @@ void thunderbolt_ring_render(EffectInstance* effect) { renderTask.appendGfx = thunderbolt_ring_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -110,7 +110,7 @@ void thunderbolt_ring_appendGfx(void* effect) { gDPPipeSync(gMainGfxPos++); gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); - guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, data->unk_28, data->pos.x, data->pos.y, data->pos.z); + guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, data->unk_28, data->pos.x, data->pos.y, data->pos.z); guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/effects/tubba_heart_attack.c b/src/effects/tubba_heart_attack.c index f2ea275cb26..e80cbac1377 100644 --- a/src/effects/tubba_heart_attack.c +++ b/src/effects/tubba_heart_attack.c @@ -286,7 +286,7 @@ void tubba_heart_attack_render(EffectInstance* effect) { renderTask.appendGfx = tubba_heart_attack_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/underwater.c b/src/effects/underwater.c index 373413f8b6d..66ec12a5ba6 100644 --- a/src/effects/underwater.c +++ b/src/effects/underwater.c @@ -142,7 +142,7 @@ void underwater_render(EffectInstance* effect) { renderTask.appendGfx = underwater_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 100; + renderTask.dist = 100; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/walking_dust.c b/src/effects/walking_dust.c index 0e77be6370a..3a43673b45c 100644 --- a/src/effects/walking_dust.c +++ b/src/effects/walking_dust.c @@ -85,7 +85,7 @@ void walking_dust_render(EffectInstance* effect) { renderTask.appendGfx = walking_dust_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_28; retTask = queue_render_task(&renderTask); @@ -155,7 +155,7 @@ void walking_dust_appendGfx(void* effect) { for (i = 0; i < effectTemp->numParts; i++, data++) { guTranslateF(sp18, data->unk_08, data->unk_0C, data->unk_10); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp18); guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]); gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], diff --git a/src/effects/water_block.c b/src/effects/water_block.c index 6e177e4475e..a1e527e3793 100644 --- a/src/effects/water_block.c +++ b/src/effects/water_block.c @@ -207,7 +207,7 @@ void water_block_render(EffectInstance* effect) { renderTask.appendGfx = water_block_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 20; + renderTask.dist = 20; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/water_fountain.c b/src/effects/water_fountain.c index 62aa740806f..d3004d16cfc 100644 --- a/src/effects/water_fountain.c +++ b/src/effects/water_fountain.c @@ -195,7 +195,7 @@ void water_fountain_render(EffectInstance* effect) { renderTask.appendGfx = water_fountain_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/water_splash.c b/src/effects/water_splash.c index 6ba89ccb9d1..6f7f8156fd9 100644 --- a/src/effects/water_splash.c +++ b/src/effects/water_splash.c @@ -157,7 +157,7 @@ void water_splash_render(EffectInstance* effect) { renderTask.appendGfx = water_splash_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/waterfall.c b/src/effects/waterfall.c index be87eb12f30..7e8fccac6bc 100644 --- a/src/effects/waterfall.c +++ b/src/effects/waterfall.c @@ -107,7 +107,7 @@ void waterfall_render(EffectInstance* effect) { renderTask.appendGfx = waterfall_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); diff --git a/src/effects/whirlwind.c b/src/effects/whirlwind.c index c5b99ca6538..a397b918f6b 100644 --- a/src/effects/whirlwind.c +++ b/src/effects/whirlwind.c @@ -136,7 +136,7 @@ void whirlwind_render(EffectInstance* effect) { renderTask.appendGfx = whirlwind_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_2D; queuedTask = queue_render_task(&renderTask); diff --git a/src/effects/windy_leaves.c b/src/effects/windy_leaves.c index 030076789a7..7f8a2450056 100644 --- a/src/effects/windy_leaves.c +++ b/src/effects/windy_leaves.c @@ -223,7 +223,7 @@ void windy_leaves_render(EffectInstance* effect) { renderTask.appendGfx = windy_leaves_appendGfx; renderTask.appendGfxArg = effect; - renderTask.distance = 0; + renderTask.dist = 0; renderTask.renderMode = RENDER_MODE_2D; retTask = queue_render_task(&renderTask); @@ -245,7 +245,7 @@ void windy_leaves_appendGfx(void* effect) { gSPDisplayList(gMainGfxPos++, D_09001180_33E790); gDPSetPrimColor(gMainGfxPos++, 0, 0, 20, 100, 20, part->alpha); guTranslateF(sp18, part->unk_04.x, part->unk_04.y, part->unk_04.z); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp98); part++; diff --git a/src/encounter.c b/src/encounter.c index 92c126db632..a773d4ce1be 100644 --- a/src/encounter.c +++ b/src/encounter.c @@ -457,8 +457,8 @@ ApiStatus OnFleeBattleDrops(Evt* script, s32 isInitialCall) { if (rand_int(100) < 50) { if (playerData->coins != 0) { playerData->coins--; - make_item_entity_delayed(ITEM_COIN, playerStatus->position.x, - playerStatus->position.y + playerStatus->colliderHeight, playerStatus->position.z, + make_item_entity_delayed(ITEM_COIN, playerStatus->pos.x, + playerStatus->pos.y + playerStatus->colliderHeight, playerStatus->pos.z, ITEM_SPAWN_MODE_TOSS_SPAWN_ALWAYS, 0, 0); } } @@ -519,15 +519,15 @@ void update_encounters_neutral(void) { currentEncounter->flags &= ~ENCOUNTER_STATUS_FLAG_2; currentEncounter->flags &= ~ENCOUNTER_STATUS_FLAG_4; - playerX = playerStatus->position.x; - playerY = playerStatus->position.y; - playerZ = playerStatus->position.z; + playerX = playerStatus->pos.x; + playerY = playerStatus->pos.y; + playerZ = playerStatus->pos.z; playerYaw = playerStatus->spriteFacingAngle; if (playerYaw < 180.0f) { - playerYaw = clamp_angle(camera->currentYaw - 90.0f); + playerYaw = clamp_angle(camera->curYaw - 90.0f); } else { - playerYaw = clamp_angle(camera->currentYaw + 90.0f); + playerYaw = clamp_angle(camera->curYaw + 90.0f); } if (currentEncounter->battleTriggerCooldown != 0) { @@ -632,7 +632,7 @@ void update_encounters_neutral(void) { if (!(enemy->flags & ENEMY_FLAG_400000)) { if (npc == playerStatus->encounteredNPC) { enemy->savedNpcYaw = npc->yaw; - npc->yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z); + npc->yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->pos.x, playerStatus->pos.z); script = get_script_by_id(enemy->aiScriptID); if (script != NULL) { set_script_flags(script, EVT_FLAG_SUSPENDED); @@ -669,8 +669,8 @@ void update_encounters_neutral(void) { if (!(enemy->flags & ENEMY_FLAG_IGNORE_PARTNER) && partner_test_enemy_collision(npc)) { currentEncounter->hitType = ENCOUNTER_TRIGGER_PARTNER; enemy->encountered = ENCOUNTER_TRIGGER_PARTNER; - currentEncounter->currentEncounter = encounter; - currentEncounter->currentEnemy = enemy; + currentEncounter->curEncounter = encounter; + currentEncounter->curEnemy = enemy; currentEncounter->firstStrikeType = FIRST_STRIKE_PLAYER; goto START_BATTLE; } @@ -686,9 +686,9 @@ void update_encounters_neutral(void) { if (enemy->unk_DC != 0) { npcYaw = npc->yawCamOffset; if (npcYaw < 180.0f) { - npcYaw = clamp_angle(camera->currentYaw - 90.0f); + npcYaw = clamp_angle(camera->curYaw - 90.0f); } else { - npcYaw = clamp_angle(camera->currentYaw + 90.0f); + npcYaw = clamp_angle(camera->curYaw + 90.0f); } add_vec2D_polar(&npcX, &npcZ, enemy->unk_DC, npcYaw); @@ -704,12 +704,12 @@ void update_encounters_neutral(void) { y = playerY; z = playerZ; if (clamp_angle(playerStatus->spriteFacingAngle) < 180.0f) { - hammerDir = clamp_angle(camera->currentYaw - 90.0f); + hammerDir = clamp_angle(camera->curYaw - 90.0f); if (playerStatus->trueAnimation & SPRITE_ID_BACK_FACING) { hammerDir = clamp_angle(hammerDir + 30.0f); } } else { - hammerDir = clamp_angle(camera->currentYaw + 90.0f); + hammerDir = clamp_angle(camera->curYaw + 90.0f); if (playerStatus->trueAnimation & SPRITE_ID_BACK_FACING) { hammerDir = clamp_angle(hammerDir - 30.0f); } @@ -762,12 +762,12 @@ void update_encounters_neutral(void) { triggeredBattle = TRUE; } if (triggeredBattle) { - sfx_play_sound_at_position(SOUND_HIT_PLAYER_NORMAL, SOUND_SPACE_MODE_0, playerStatus->position.x, playerStatus->position.y, playerStatus->position.z); + sfx_play_sound_at_position(SOUND_HIT_PLAYER_NORMAL, SOUND_SPACE_MODE_0, playerStatus->pos.x, playerStatus->pos.y, playerStatus->pos.z); currentEncounter->hitType = ENCOUNTER_TRIGGER_HAMMER; currentEncounter->hitTier = gPlayerData.hammerLevel; enemy->encountered = ENCOUNTER_TRIGGER_HAMMER; - currentEncounter->currentEncounter = encounter; - currentEncounter->currentEnemy = enemy; + currentEncounter->curEncounter = encounter; + currentEncounter->curEnemy = enemy; currentEncounter->firstStrikeType = FIRST_STRIKE_PLAYER; goto START_BATTLE; } @@ -823,8 +823,8 @@ void update_encounters_neutral(void) { if (gPlayerData.bootsLevel < 0) { currentEncounter->hitType = ENCOUNTER_TRIGGER_NONE; enemy->encountered = ENCOUNTER_TRIGGER_NONE; - currentEncounter->currentEncounter = encounter; - currentEncounter->currentEnemy = enemy; + currentEncounter->curEncounter = encounter; + currentEncounter->curEnemy = enemy; currentEncounter->firstStrikeType = FIRST_STRIKE_NONE; currentEncounter->hitTier = 0; goto START_BATTLE; @@ -848,10 +848,10 @@ void update_encounters_neutral(void) { currentEncounter->hitTier = 2; break; } - sfx_play_sound_at_position(SOUND_HIT_PLAYER_NORMAL, SOUND_SPACE_MODE_0, playerStatus->position.x, playerStatus->position.y, playerStatus->position.z); + sfx_play_sound_at_position(SOUND_HIT_PLAYER_NORMAL, SOUND_SPACE_MODE_0, playerStatus->pos.x, playerStatus->pos.y, playerStatus->pos.z); enemy->encountered = ENCOUNTER_STATE_NEUTRAL; - currentEncounter->currentEncounter = encounter; - currentEncounter->currentEnemy = enemy; + currentEncounter->curEncounter = encounter; + currentEncounter->curEnemy = enemy; currentEncounter->firstStrikeType = FIRST_STRIKE_PLAYER; goto START_BATTLE; } @@ -896,26 +896,26 @@ void update_encounters_neutral(void) { triggeredBattle = TRUE; } if ((playerStatus->animFlags & PA_FLAG_SPINNING) && !(enemy->flags & ENEMY_FLAG_IGNORE_SPIN) && triggeredBattle) { - sfx_play_sound_at_position(SOUND_HIT_PLAYER_NORMAL, SOUND_SPACE_MODE_0, playerStatus->position.x, playerStatus->position.y, playerStatus->position.z); - testX = playerStatus->position.x + ((npc->pos.x - playerStatus->position.x) * 0.5f); - testY = playerStatus->position.y + (((npc->pos.y + npc->collisionHeight) - (playerStatus->position.y + playerStatus->colliderHeight)) * 0.5f); - testZ = playerStatus->position.z + ((npc->pos.z - playerStatus->position.z) * 0.5f); + sfx_play_sound_at_position(SOUND_HIT_PLAYER_NORMAL, SOUND_SPACE_MODE_0, playerStatus->pos.x, playerStatus->pos.y, playerStatus->pos.z); + testX = playerStatus->pos.x + ((npc->pos.x - playerStatus->pos.x) * 0.5f); + testY = playerStatus->pos.y + (((npc->pos.y + npc->collisionHeight) - (playerStatus->pos.y + playerStatus->colliderHeight)) * 0.5f); + testZ = playerStatus->pos.z + ((npc->pos.z - playerStatus->pos.z) * 0.5f); fx_damage_stars(3, testX, testY, testZ, 0.0f, -1.0f, 0.0f, 3); currentEncounter->hitType = ENCOUNTER_TRIGGER_SPIN; playerStatus->animFlags |= PA_FLAG_DIZZY_ATTACK_ENCOUNTER; enemy->encountered = ENCOUNTER_TRIGGER_SPIN; - currentEncounter->currentEncounter = encounter; - currentEncounter->currentEnemy = enemy; + currentEncounter->curEncounter = encounter; + currentEncounter->curEnemy = enemy; currentEncounter->firstStrikeType = FIRST_STRIKE_NONE; } else { currentEncounter->hitType = ENCOUNTER_TRIGGER_NONE; playerStatus->animFlags &= ~PA_FLAG_DIZZY_ATTACK_ENCOUNTER; enemy->encountered = ENCOUNTER_TRIGGER_NONE; - currentEncounter->currentEncounter = encounter; - currentEncounter->currentEnemy = enemy; - testX = playerStatus->position.x + ((npc->pos.x - playerStatus->position.x) * 0.5f); - testY = playerStatus->position.y + (((npc->pos.y + npc->collisionHeight) - (playerStatus->position.y + playerStatus->colliderHeight)) * 0.5f); - testZ = playerStatus->position.z + ((npc->pos.z - playerStatus->position.z) * 0.5f); + currentEncounter->curEncounter = encounter; + currentEncounter->curEnemy = enemy; + testX = playerStatus->pos.x + ((npc->pos.x - playerStatus->pos.x) * 0.5f); + testY = playerStatus->pos.y + (((npc->pos.y + npc->collisionHeight) - (playerStatus->pos.y + playerStatus->colliderHeight)) * 0.5f); + testZ = playerStatus->pos.z + ((npc->pos.z - playerStatus->pos.z) * 0.5f); fx_damage_stars(3, testX, testY, testZ, 0.0f, -1.0f, 0.0f, 3); // if the hitbox is active, trigger a first strike firstStrikeType = FIRST_STRIKE_NONE; @@ -945,26 +945,26 @@ void update_encounters_neutral(void) { case 0: break; case ENCOUNTER_TRIGGER_NONE: - currentEnemy = enemy = currentEncounter->currentEnemy; + currentEnemy = enemy = currentEncounter->curEnemy; if (enemy->aiScript != NULL) { suspend_all_script(enemy->aiScriptID); } if (enemy->auxScript != NULL) { suspend_all_script(enemy->auxScriptID); } - encounter = currentEncounter->currentEncounter; + encounter = currentEncounter->curEncounter; for (i = 0; i < encounter->count; i++) { enemy = encounter->enemy[i]; if (enemy == NULL) { continue; } - if ((enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) && enemy != currentEncounter->currentEnemy) { + if ((enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) && enemy != currentEncounter->curEnemy) { continue; } if (enemy->flags & ENEMY_FLAG_DISABLE_AI) { continue; } - if ((currentEnemy->flags & ENEMY_FLAG_PROJECTILE) && enemy != currentEncounter->currentEnemy) { + if ((currentEnemy->flags & ENEMY_FLAG_PROJECTILE) && enemy != currentEncounter->curEnemy) { continue; } @@ -999,26 +999,26 @@ void update_encounters_neutral(void) { gEncounterSubState = ENCOUNTER_SUBSTATE_PRE_BATTLE_INIT; break; case ENCOUNTER_TRIGGER_SPIN: - currentEnemy = enemy = currentEncounter->currentEnemy; + currentEnemy = enemy = currentEncounter->curEnemy; if (enemy->aiScript != NULL) { suspend_all_script(enemy->aiScriptID); } if (enemy->auxScript != NULL) { suspend_all_script(enemy->auxScriptID); } - encounter = currentEncounter->currentEncounter; + encounter = currentEncounter->curEncounter; for (i = 0; i < encounter->count; i++) { enemy = encounter->enemy[i]; if (enemy == NULL) { continue; } - if ((enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) && enemy != currentEncounter->currentEnemy) { + if ((enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) && enemy != currentEncounter->curEnemy) { continue; } if (enemy->flags & ENEMY_FLAG_DISABLE_AI) { continue; } - if ((currentEnemy->flags & ENEMY_FLAG_PROJECTILE) && enemy != currentEncounter->currentEnemy) { + if ((currentEnemy->flags & ENEMY_FLAG_PROJECTILE) && enemy != currentEncounter->curEnemy) { continue; } @@ -1043,14 +1043,14 @@ void update_encounters_neutral(void) { playerStatus->flags |= PS_FLAG_ENTERING_BATTLE; break; case ENCOUNTER_TRIGGER_JUMP: - currentEnemy = enemy = currentEncounter->currentEnemy; + currentEnemy = enemy = currentEncounter->curEnemy; if (enemy->aiScript != NULL) { suspend_all_script(enemy->aiScriptID); } if (enemy->auxScript != NULL) { suspend_all_script(enemy->auxScriptID); } - encounter = currentEncounter->currentEncounter; + encounter = currentEncounter->curEncounter; cond2 = FALSE; for (i = 0; i < encounter->count; i++) { @@ -1059,13 +1059,13 @@ void update_encounters_neutral(void) { if (enemy == NULL) { continue; } - if ((enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) && enemy != currentEncounter->currentEnemy) { + if ((enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) && enemy != currentEncounter->curEnemy) { continue; } if (enemy->flags & ENEMY_FLAG_DISABLE_AI) { continue; } - if ((currentEnemy->flags & ENEMY_FLAG_PROJECTILE) && enemy != currentEncounter->currentEnemy) { + if ((currentEnemy->flags & ENEMY_FLAG_PROJECTILE) && enemy != currentEncounter->curEnemy) { continue; } if (enemy->hitBytecode != NULL) { @@ -1078,16 +1078,16 @@ void update_encounters_neutral(void) { script->groupFlags = enemy->scriptGroup; npc = get_npc_unsafe(enemy->npcID); cond2 = TRUE; - testX = playerStatus->position.x + ((npc->pos.x - playerStatus->position.x) * 0.5f); - testY = playerStatus->position.y + (((npc->pos.y + npc->collisionHeight) - (playerStatus->position.y + playerStatus->colliderHeight)) * 0.5f); - testZ = playerStatus->position.z + ((npc->pos.z - playerStatus->position.z) * 0.5f); + testX = playerStatus->pos.x + ((npc->pos.x - playerStatus->pos.x) * 0.5f); + testY = playerStatus->pos.y + (((npc->pos.y + npc->collisionHeight) - (playerStatus->pos.y + playerStatus->colliderHeight)) * 0.5f); + testZ = playerStatus->pos.z + ((npc->pos.z - playerStatus->pos.z) * 0.5f); fx_damage_stars(3, testX, testY, testZ, 0.0f, -1.0f, 0.0f, 3); } else if (!(enemy->flags & ENEMY_FLAG_PASSIVE)) { npc = get_npc_unsafe(enemy->npcID); cond2 = TRUE; - testX = playerStatus->position.x + ((npc->pos.x - playerStatus->position.x) * 0.5f); - testY = playerStatus->position.y + (((npc->pos.y + npc->collisionHeight) - (playerStatus->position.y + playerStatus->colliderHeight)) * 0.5f); - testZ = playerStatus->position.z + ((npc->pos.z - playerStatus->position.z) * 0.5f); + testX = playerStatus->pos.x + ((npc->pos.x - playerStatus->pos.x) * 0.5f); + testY = playerStatus->pos.y + (((npc->pos.y + npc->collisionHeight) - (playerStatus->pos.y + playerStatus->colliderHeight)) * 0.5f); + testZ = playerStatus->pos.z + ((npc->pos.z - playerStatus->pos.z) * 0.5f); fx_damage_stars(3, testX, testY, testZ, 0.0f, -1.0f, 0.0f, 3); } } @@ -1106,26 +1106,26 @@ void update_encounters_neutral(void) { gEncounterSubState = ENCOUNTER_SUBSTATE_PRE_BATTLE_INIT; break; case ENCOUNTER_TRIGGER_HAMMER: - currentEnemy = enemy = currentEncounter->currentEnemy; + currentEnemy = enemy = currentEncounter->curEnemy; if (enemy->aiScript != NULL) { suspend_all_script(enemy->aiScriptID); } if (enemy->auxScript != NULL) { suspend_all_script(enemy->auxScriptID); } - encounter = currentEncounter->currentEncounter; + encounter = currentEncounter->curEncounter; for (i = 0; i < encounter->count; i++) { enemy = encounter->enemy[i]; if (enemy == NULL) { continue; } - if ((enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) && enemy != currentEncounter->currentEnemy) { + if ((enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) && enemy != currentEncounter->curEnemy) { continue; } if (enemy->flags & ENEMY_FLAG_DISABLE_AI) { continue; } - if ((currentEnemy->flags & ENEMY_FLAG_PROJECTILE) && enemy != currentEncounter->currentEnemy) { + if ((currentEnemy->flags & ENEMY_FLAG_PROJECTILE) && enemy != currentEncounter->curEnemy) { continue; } if (enemy->hitBytecode != NULL) { @@ -1137,15 +1137,15 @@ void update_encounters_neutral(void) { script->owner2.npcID = enemy->npcID; script->groupFlags = enemy->scriptGroup; npc = get_npc_unsafe(enemy->npcID); - testX = playerStatus->position.x + ((npc->pos.x - playerStatus->position.x) * 0.5f); - testY = playerStatus->position.y + (((npc->pos.y + npc->collisionHeight) - (playerStatus->position.y + playerStatus->colliderHeight)) * 0.5f); - testZ = playerStatus->position.z + ((npc->pos.z - playerStatus->position.z) * 0.5f); + testX = playerStatus->pos.x + ((npc->pos.x - playerStatus->pos.x) * 0.5f); + testY = playerStatus->pos.y + (((npc->pos.y + npc->collisionHeight) - (playerStatus->pos.y + playerStatus->colliderHeight)) * 0.5f); + testZ = playerStatus->pos.z + ((npc->pos.z - playerStatus->pos.z) * 0.5f); fx_damage_stars(3, testX, testY, testZ, 0.0f, -1.0f, 0.0f, 3); } else if (!(enemy->flags & ENEMY_FLAG_PASSIVE)) { npc = get_npc_unsafe(enemy->npcID); - testX = playerStatus->position.x + ((npc->pos.x - playerStatus->position.x) * 0.5f); - testY = playerStatus->position.y + (((npc->pos.y + npc->collisionHeight) - (playerStatus->position.y + playerStatus->colliderHeight)) * 0.5f); - testZ = playerStatus->position.z + ((npc->pos.z - playerStatus->position.z) * 0.5f); + testX = playerStatus->pos.x + ((npc->pos.x - playerStatus->pos.x) * 0.5f); + testY = playerStatus->pos.y + (((npc->pos.y + npc->collisionHeight) - (playerStatus->pos.y + playerStatus->colliderHeight)) * 0.5f); + testZ = playerStatus->pos.z + ((npc->pos.z - playerStatus->pos.z) * 0.5f); fx_damage_stars(3, npc->pos.x, npc->pos.y + npc->collisionHeight, npc->pos.z, 0.0f, -1.0f, 0.0f, 3); } } @@ -1162,11 +1162,11 @@ void update_encounters_neutral(void) { break; case ENCOUNTER_TRIGGER_CONVERSATION: suspend_all_group(EVT_GROUP_01); - enemy = currentEncounter->currentEnemy; + enemy = currentEncounter->curEnemy; if (enemy != NULL && enemy->aiScript != NULL) { suspend_all_script(enemy->aiScriptID); } - enemy = currentEncounter->currentEnemy; + enemy = currentEncounter->curEnemy; if (enemy->interactBytecode != NULL) { enemy->encountered = ENCOUNTER_TRIGGER_CONVERSATION; script = start_script(enemy->interactBytecode, EVT_PRIORITY_A, 0); @@ -1187,27 +1187,27 @@ void update_encounters_neutral(void) { gEncounterSubState = ENCOUNTER_SUBSTATE_CONVERSATION_INIT; break; case ENCOUNTER_TRIGGER_PARTNER: - currentEnemy = enemy = currentEncounter->currentEnemy; + currentEnemy = enemy = currentEncounter->curEnemy; if (enemy->aiScript != NULL) { suspend_all_script(enemy->aiScriptID); } if (enemy->auxScript != NULL) { suspend_all_script(enemy->auxScriptID); } - encounter = currentEncounter->currentEncounter; + encounter = currentEncounter->curEncounter; for (i = 0; i < encounter->count; i++) { enemy = encounter->enemy[i]; if (enemy == NULL) { continue; } - if ((enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) && enemy != currentEncounter->currentEnemy) { + if ((enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) && enemy != currentEncounter->curEnemy) { continue; } if (enemy->flags & ENEMY_FLAG_DISABLE_AI) { continue; } - if ((currentEnemy->flags & ENEMY_FLAG_PROJECTILE) && enemy != currentEncounter->currentEnemy) { + if ((currentEnemy->flags & ENEMY_FLAG_PROJECTILE) && enemy != currentEncounter->curEnemy) { continue; } if (enemy->hitBytecode != NULL) { @@ -1284,7 +1284,7 @@ void update_encounters_pre_battle(void) { } } - enemy = currentEncounter->currentEnemy; + enemy = currentEncounter->curEnemy; if ((enemy->flags & ENEMY_FLAG_100000) && !currentEncounter->scriptedBattle) { currentEncounter->unk_94 = 0; currentEncounter->battleStartCountdown = 0; @@ -1301,7 +1301,7 @@ void update_encounters_pre_battle(void) { return; } - enemy = currentEncounter->currentEnemy; + enemy = currentEncounter->curEnemy; if (currentEncounter->hitType != ENCOUNTER_TRIGGER_NONE && currentEncounter->hitType != ENCOUNTER_TRIGGER_SPIN && is_ability_active(ABILITY_FIRST_ATTACK) @@ -1316,14 +1316,14 @@ void update_encounters_pre_battle(void) { return; } - enemy = currentEncounter->currentEnemy; + enemy = currentEncounter->curEnemy; if (( (is_ability_active(ABILITY_BUMP_ATTACK)) && (playerData->level >= enemy->npcSettings->level) && (!(enemy->flags & ENEMY_FLAG_PROJECTILE) && !(currentEncounter->scriptedBattle)) ) || ( - (enemy = currentEncounter->currentEnemy, + (enemy = currentEncounter->curEnemy, (currentEncounter->hitType == ENCOUNTER_TRIGGER_SPIN)) && (is_ability_active(ABILITY_SPIN_ATTACK)) && playerData->level >= enemy->npcSettings->level && @@ -1364,11 +1364,11 @@ void update_encounters_pre_battle(void) { break; } - encounter = currentEncounter->currentEncounter; + encounter = currentEncounter->curEncounter; for (i = 0; i < encounter->count; i++) { enemy = encounter->enemy[i]; if (enemy != NULL && - ((!(enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) || enemy == currentEncounter->currentEnemy)) && + ((!(enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) || enemy == currentEncounter->curEnemy)) && !(enemy->flags & ENEMY_FLAG_DISABLE_AI) && enemy->hitScript != NULL) { @@ -1381,7 +1381,7 @@ void update_encounters_pre_battle(void) { currentEncounter->dizzyAttackStatus = 0; currentEncounter->dizzyAttackDuration = 0; - enemy = currentEncounter->currentEnemy; + enemy = currentEncounter->curEnemy; currentEncounter->instigatorValue = enemy->instigatorValue; if (is_ability_active(ABILITY_DIZZY_ATTACK) && currentEncounter->hitType == ENCOUNTER_TRIGGER_SPIN) { @@ -1415,11 +1415,11 @@ void update_encounters_pre_battle(void) { break; } - encounter = currentEncounter->currentEncounter; + encounter = currentEncounter->curEncounter; for (i = 0; i < encounter->count; i++) { enemy = encounter->enemy[i]; if (enemy != NULL && - (!(enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) || enemy == currentEncounter->currentEnemy) && + (!(enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) || enemy == currentEncounter->curEnemy) && !(enemy->flags & ENEMY_FLAG_DISABLE_AI) && (enemy->hitScript != 0)) { @@ -1454,7 +1454,7 @@ void update_encounters_pre_battle(void) { void draw_encounters_pre_battle(void) { EncounterStatus* encounter = &gCurrentEncounter; - Npc* npc = get_npc_unsafe(encounter->currentEnemy->npcID); + Npc* npc = get_npc_unsafe(encounter->curEnemy->npcID); PlayerStatus* playerStatus = &gPlayerStatus; if (encounter->unk_94 != 0) { @@ -1474,9 +1474,9 @@ void draw_encounters_pre_battle(void) { encounter->fadeOutAmount = 255; } - playerX = playerStatus->position.x; - playerY = playerStatus->position.y; - playerZ = playerStatus->position.z; + playerX = playerStatus->pos.x; + playerY = playerStatus->pos.y; + playerZ = playerStatus->pos.z; otherX = npc->pos.x; otherY = npc->pos.y; @@ -1637,7 +1637,7 @@ void update_encounters_post_battle(void) { break; case ENCOUNTER_SUBSTATE_POST_BATTLE_WON_CHECK_MERLEE_BONUS: if (currentEncounter->hasMerleeCoinBonus) { - if (get_coin_drop_amount(currentEncounter->currentEnemy) != 0) { + if (get_coin_drop_amount(currentEncounter->curEnemy) != 0) { D_800A0BB0 = start_script(&EVS_MerleeDropCoins, EVT_PRIORITY_A, 0); D_800A0BB0->groupFlags = 0; D_800A0BB4 = D_800A0BB0->id; @@ -1649,7 +1649,7 @@ void update_encounters_post_battle(void) { gEncounterSubState = ENCOUNTER_SUBSTATE_POST_BATTLE_PLAY_NPC_DEFEAT; break; case ENCOUNTER_SUBSTATE_POST_BATTLE_PLAY_NPC_DEFEAT: - if (currentEncounter->hasMerleeCoinBonus && (get_coin_drop_amount(currentEncounter->currentEnemy) != 0)) { + if (currentEncounter->hasMerleeCoinBonus && (get_coin_drop_amount(currentEncounter->curEnemy) != 0)) { currentEncounter->fadeOutAccel += 4; currentEncounter->fadeOutAmount -= currentEncounter->fadeOutAccel; if (currentEncounter->fadeOutAmount < 0) { @@ -1659,13 +1659,13 @@ void update_encounters_post_battle(void) { break; } } - encounter = currentEncounter->currentEncounter; + encounter = currentEncounter->curEncounter; for (i = 0; i < encounter->count; i++) { enemy = encounter->enemy[i]; if (enemy == NULL) { continue; } - if ((enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) && enemy != currentEncounter->currentEnemy) { + if ((enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) && enemy != currentEncounter->curEnemy) { continue; } if (enemy->flags & ENEMY_FLAG_DISABLE_AI) { @@ -1706,13 +1706,13 @@ void update_encounters_post_battle(void) { break; case ENCOUNTER_SUBSTATE_POST_BATTLE_WON_KILL: hasDefeatScript = FALSE; - encounter = currentEncounter->currentEncounter; + encounter = currentEncounter->curEncounter; for (i = 0; i < encounter->count; i++) { enemy = encounter->enemy[i]; if (enemy == NULL) { continue; } - if ((enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) && enemy != currentEncounter->currentEnemy) { + if ((enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) && enemy != currentEncounter->curEnemy) { continue; } if (enemy->flags & ENEMY_FLAG_DISABLE_AI) { @@ -1728,7 +1728,7 @@ void update_encounters_post_battle(void) { if (!(currentEncounter->flags & ENCOUNTER_STATUS_FLAG_1) && !D_8009A63C && currentEncounter->battleStartCountdown == 1) { suggest_player_anim_allow_backward(ANIM_Mario1_ThumbsUp); } - encounter = currentEncounter->currentEncounter; + encounter = currentEncounter->curEncounter; for (i = 0; i < encounter->count; i++) { enemy = encounter->enemy[i]; enemy = encounter->enemy[i]; @@ -1738,7 +1738,7 @@ void update_encounters_post_battle(void) { if (enemy->flags & ENEMY_FLAG_4) { continue; } - if ((enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) && enemy != currentEncounter->currentEnemy) { + if ((enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) && enemy != currentEncounter->curEnemy) { continue; } if (!(enemy->flags & ENEMY_FLAG_PASSIVE)) { @@ -1797,13 +1797,13 @@ void update_encounters_post_battle(void) { gEncounterSubState = ENCOUNTER_SUBSTATE_NEUTRAL; break; case ENCOUNTER_SUBSTATE_POST_BATTLE_FLED_INIT: - encounter = currentEncounter->currentEncounter; + encounter = currentEncounter->curEncounter; for (i = 0; i < encounter->count; i++) { enemy = encounter->enemy[i]; if (enemy == NULL) { continue; } - if ((enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) && enemy != currentEncounter->currentEnemy) { + if ((enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) && enemy != currentEncounter->curEnemy) { continue; } @@ -1835,7 +1835,7 @@ void update_encounters_post_battle(void) { } break; case ENCOUNTER_SUBSTATE_POST_BATTLE_102: - encounter = currentEncounter->currentEncounter; + encounter = currentEncounter->curEncounter; hasDefeatScript = FALSE; for (i = 0; i < encounter->count; i++) { enemy = encounter->enemy[i]; @@ -1870,8 +1870,8 @@ void update_encounters_post_battle(void) { } } - enemy = currentEncounter->currentEnemy; - encounter = currentEncounter->currentEncounter; + enemy = currentEncounter->curEnemy; + encounter = currentEncounter->curEncounter; if (!(enemy->flags & ENEMY_FLAG_40000)) { enemy->aiSuspendTime = 45; playerStatus->blinkTimer = 45; @@ -1891,7 +1891,7 @@ void update_encounters_post_battle(void) { } } - enemy = currentEncounter->currentEnemy; + enemy = currentEncounter->curEnemy; if (!(currentEncounter->flags & ENCOUNTER_STATUS_FLAG_4)) { script = start_script(&EVS_FleeBattleDrops, EVT_PRIORITY_A, 0); enemy->defeatScript = script; @@ -1917,7 +1917,7 @@ void update_encounters_post_battle(void) { case ENCOUNTER_SUBSTATE_POST_BATTLE_103: if (currentEncounter->unk_94 != 0) { currentEncounter->unk_94--; - if (gGameStatusPtr->currentButtons[0] == 0 && gGameStatusPtr->stickX[0] == 0 && gGameStatusPtr->stickY[0] == 0) { + if (gGameStatusPtr->curButtons[0] == 0 && gGameStatusPtr->stickX[0] == 0 && gGameStatusPtr->stickY[0] == 0) { break; } } @@ -1931,13 +1931,13 @@ void update_encounters_post_battle(void) { break; case ENCOUNTER_SUBSTATE_POST_BATTLE_LOST_INIT: suggest_player_anim_allow_backward(ANIM_MarioW2_LayingDown); - encounter = currentEncounter->currentEncounter; + encounter = currentEncounter->curEncounter; for (i = 0; i < encounter->count; i++) { enemy = encounter->enemy[i]; if (enemy == NULL) { continue; } - if ((enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) && enemy != currentEncounter->currentEnemy) { + if ((enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) && enemy != currentEncounter->curEnemy) { continue; } @@ -1969,7 +1969,7 @@ void update_encounters_post_battle(void) { break; case ENCOUNTER_SUBSTATE_POST_BATTLE_202: hasDefeatScript = FALSE; - encounter = currentEncounter->currentEncounter; + encounter = currentEncounter->curEncounter; for (i = 0; i < encounter->count; i++) { enemy = encounter->enemy[i]; if (enemy == NULL) { @@ -2012,7 +2012,7 @@ void update_encounters_post_battle(void) { case ENCOUNTER_SUBSTATE_POST_BATTLE_LOST_TO_NEUTRAL: if (currentEncounter->unk_94 != 0) { currentEncounter->unk_94--; - if (gGameStatusPtr->currentButtons[0] == 0 && gGameStatusPtr->stickX[0] == 0 && gGameStatusPtr->stickY[0] == 0) { + if (gGameStatusPtr->curButtons[0] == 0 && gGameStatusPtr->stickX[0] == 0 && gGameStatusPtr->stickY[0] == 0) { break; } } @@ -2049,13 +2049,13 @@ void update_encounters_post_battle(void) { gEncounterSubState = ENCOUNTER_SUBSTATE_NEUTRAL; break; case ENCOUNTER_SUBSTATE_POST_BATTLE_ENEMY_FLED_INIT: - encounter = currentEncounter->currentEncounter; + encounter = currentEncounter->curEncounter; for (i = 0; i < encounter->count; i++) { enemy = encounter->enemy[i]; if (enemy == NULL) { continue; } - if ((enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) && enemy != currentEncounter->currentEnemy) { + if ((enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) && enemy != currentEncounter->curEnemy) { continue; } @@ -2087,7 +2087,7 @@ void update_encounters_post_battle(void) { break; case ENCOUNTER_SUBSTATE_POST_BATTLE_ENEMY_FLED_TO_NEUTRAL: hasDefeatScript = FALSE; - encounter = currentEncounter->currentEncounter; + encounter = currentEncounter->curEncounter; for (i = 0; i < encounter->count; i++) { enemy = encounter->enemy[i]; if (enemy == NULL) { @@ -2121,9 +2121,9 @@ void update_encounters_post_battle(void) { } } - enemy = currentEncounter->currentEnemy; + enemy = currentEncounter->curEnemy; if (!(enemy->flags & ENEMY_FLAG_4)) { - encounter = currentEncounter->currentEncounter; + encounter = currentEncounter->curEncounter; enemy->aiSuspendTime = 45; playerStatus->blinkTimer = 45; for (j = 0; j < encounter->count; j++) { @@ -2197,7 +2197,7 @@ void update_encounters_conversation(void) { switch (gEncounterSubState) { case ENCOUNTER_SUBSTATE_CONVERSATION_INIT: - currentEnemy = encounter->currentEnemy; + currentEnemy = encounter->curEnemy; flag = FALSE; if (currentEnemy->interactScript != NULL) { @@ -2223,7 +2223,7 @@ void update_encounters_conversation(void) { case ENCOUNTER_SUBSTATE_CONVERSATION_END: resume_all_group(EVT_GROUP_01); - currentEnemy = encounter->currentEnemy; + currentEnemy = encounter->curEnemy; if (currentEnemy != NULL && currentEnemy->aiScript != NULL) { resume_all_script(currentEnemy->aiScriptID); } @@ -2275,9 +2275,9 @@ s32 check_conversation_trigger(void) { playerStatus->flags &= ~PS_FLAG_HAS_CONVERSATION_NPC; playerColliderHeight = playerStatus->colliderHeight; playerColliderRadius = playerStatus->colliderDiameter / 2; - playerX = playerStatus->position.x; - playerY = playerStatus->position.y; - playerZ = playerStatus->position.z; + playerX = playerStatus->pos.x; + playerY = playerStatus->pos.y; + playerZ = playerStatus->pos.z; if (gPartnerStatus.partnerActionState != PARTNER_ACTION_NONE) { return FALSE; @@ -2332,12 +2332,12 @@ s32 check_conversation_trigger(void) { } if (clamp_angle(playerStatus->spriteFacingAngle) < 180.0f) { - angle = clamp_angle(camera->currentYaw - 120.0f); + angle = clamp_angle(camera->curYaw - 120.0f); if (playerStatus->trueAnimation & SPRITE_ID_BACK_FACING) { angle = clamp_angle(angle + 60.0f); } } else { - angle = clamp_angle(camera->currentYaw + 120.0f); + angle = clamp_angle(camera->curYaw + 120.0f); if (playerStatus->trueAnimation & SPRITE_ID_BACK_FACING) { angle = clamp_angle(angle - 60.0f); } @@ -2376,8 +2376,8 @@ s32 check_conversation_trigger(void) { close_status_bar(); gCurrentEncounter.hitType = ENCOUNTER_TRIGGER_CONVERSATION; enemy->encountered = ENCOUNTER_TRIGGER_CONVERSATION; - encounterStatus->currentEncounter = encounter; - encounterStatus->currentEnemy = enemy; + encounterStatus->curEncounter = encounter; + encounterStatus->curEnemy = enemy; encounterStatus->firstStrikeType = FIRST_STRIKE_PLAYER; return TRUE; } diff --git a/src/encounter_api.c b/src/encounter_api.c index 147662ceb8e..547a898d30d 100644 --- a/src/encounter_api.c +++ b/src/encounter_api.c @@ -182,7 +182,7 @@ ApiStatus DoNpcDefeat(Evt* script, s32 isInitialCall) { Evt* newScript; kill_script(script); - npc->currentAnim = owner->animList[6]; + npc->curAnim = owner->animList[6]; newScript = start_script(&EVS_NpcDefeat, EVT_PRIORITY_A, 0); owner->defeatScript = newScript; owner->defeatScriptID = newScript->id; @@ -203,8 +203,8 @@ void start_battle(Evt* script, s32 songID) { currentEncounter->hitType = ENCOUNTER_TRIGGER_NONE; enemy->encountered = TRUE; - currentEncounter->currentEnemy = enemy; - currentEncounter->currentEncounter = currentEncounter->encounterList[enemy->encounterIndex]; + currentEncounter->curEnemy = enemy; + currentEncounter->curEncounter = currentEncounter->encounterList[enemy->encounterIndex]; currentEncounter->firstStrikeType = FIRST_STRIKE_NONE; currentEncounter->allowFleeing = FALSE; currentEncounter->songID = songID; @@ -221,10 +221,10 @@ void start_battle(Evt* script, s32 songID) { disable_player_input(); partner_disable_input(); - encounter = currentEncounter->currentEncounter; + encounter = currentEncounter->curEncounter; for (i = 0; i < encounter->count; i++) { enemy = encounter->enemy[i]; - if (enemy != NULL && (!(enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) || enemy == currentEncounter->currentEnemy)) { + if (enemy != NULL && (!(enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) || enemy == currentEncounter->curEnemy)) { if (enemy->hitBytecode != NULL) { Evt* hitEvtInstance; enemy->encountered = TRUE; @@ -274,8 +274,8 @@ ApiStatus StartBossBattle(Evt* script, s32 isInitialCall) { currentEncounter->hitType = ENCOUNTER_TRIGGER_NONE; enemy->encountered = TRUE; - currentEncounter->currentEnemy = enemy; - currentEncounter->currentEncounter = currentEncounter->encounterList[enemy->encounterIndex]; + currentEncounter->curEnemy = enemy; + currentEncounter->curEncounter = currentEncounter->encounterList[enemy->encounterIndex]; currentEncounter->firstStrikeType = FIRST_STRIKE_NONE; currentEncounter->allowFleeing = TRUE; currentEncounter->songID = songID; @@ -292,11 +292,11 @@ ApiStatus StartBossBattle(Evt* script, s32 isInitialCall) { disable_player_input(); partner_disable_input(); - encounter = currentEncounter->currentEncounter; + encounter = currentEncounter->curEncounter; for (i = 0; i < encounter->count; i++) { enemy = encounter->enemy[i]; if ((enemy != NULL && ( - !(enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) || enemy == currentEncounter->currentEnemy) + !(enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) || enemy == currentEncounter->curEnemy) ) && enemy->hitBytecode != NULL) { enemy->encountered = TRUE; @@ -698,9 +698,9 @@ ApiStatus SetSelfRotation(Evt* script, s32 isInitialCall) { s32 rotY = evt_get_variable(script, *args++); s32 rotZ = evt_get_variable(script, *args++); - self->rotation.x = rotX; - self->rotation.y = rotY; - self->rotation.z = rotZ; + self->rot.x = rotX; + self->rot.y = rotY; + self->rot.z = rotZ; return ApiStatus_DONE2; } @@ -854,7 +854,7 @@ ApiStatus OnPlayerFled(Evt* script, s32 isInitialCall) { EffectInstance* unk; if (!(enemy->aiFlags & ENEMY_AI_FLAG_10)) { - npc->currentAnim = *enemy->animList; + npc->curAnim = *enemy->animList; } if (!(enemy->aiFlags & ENEMY_AI_FLAG_8)) { diff --git a/src/entity.c b/src/entity.c index 7fd193d2a88..d0494098115 100644 --- a/src/entity.c +++ b/src/entity.c @@ -111,7 +111,7 @@ void update_entities(void) { } if (entity->flags & ENTITY_FLAG_ALWAYS_FACE_CAMERA) { - entity->rotation.y = -gCameras[gCurrentCameraID].currentYaw; + entity->rot.y = -gCameras[gCurrentCameraID].curYaw; } if (!(entity->flags & ENTITY_FLAG_SKIP_UPDATE_TRANSFORM_MATRIX)) { @@ -150,7 +150,7 @@ void update_entities(void) { } if (entity->flags & ENTITY_FLAG_ALWAYS_FACE_CAMERA) { - entity->rotation.y = -gCameras[gCurrentCameraID].currentYaw; + entity->rot.y = -gCameras[gCurrentCameraID].curYaw; } if (!gGameStatusPtr->disableScripts) { @@ -214,7 +214,7 @@ void update_shadows(void) { if (!(shadow->flags & ENTITY_FLAG_SKIP_UPDATE)) { if (shadow->flags & ENTITY_FLAG_ALWAYS_FACE_CAMERA) { - shadow->rotation.y = -gCameras[gCurrentCameraID].currentYaw; + shadow->rot.y = -gCameras[gCurrentCameraID].curYaw; } update_shadow_transform_matrix(shadow); @@ -346,10 +346,10 @@ void render_entities(void) { if (!gGameStatusPtr->isBattle) { if (gEntityHideMode != ENTITY_HIDE_MODE_0 && !(entity->flags & ENTITY_FLAG_IGNORE_DISTANCE_CULLING) && - dist2D(gPlayerStatusPtr->position.x, - gPlayerStatusPtr->position.z, - entity->position.x, - entity->position.z) > 200.0f + dist2D(gPlayerStatusPtr->pos.x, + gPlayerStatusPtr->pos.z, + entity->pos.x, + entity->pos.z) > 200.0f ) { continue; } @@ -482,10 +482,10 @@ void update_entity_transform_matrix(Entity* entity) { return; } - guTranslateF(sp58, entity->position.x, entity->position.y, entity->position.z); - guRotateF(spD8, entity->rotation.x, 1.0f, 0.0f, 0.0f); - guRotateF(sp118, entity->rotation.y, 0.0f, 1.0f, 0.0f); - guRotateF(sp158, entity->rotation.z, 0.0f, 0.0f, 1.0f); + guTranslateF(sp58, entity->pos.x, entity->pos.y, entity->pos.z); + guRotateF(spD8, entity->rot.x, 1.0f, 0.0f, 0.0f); + guRotateF(sp118, entity->rot.y, 0.0f, 1.0f, 0.0f); + guRotateF(sp158, entity->rot.z, 0.0f, 0.0f, 1.0f); guMtxCatF(sp158, spD8, sp18); guMtxCatF(sp18, sp118, sp98); guScaleF(sp198, entity->scale.x, entity->scale.y, entity->scale.z); @@ -503,10 +503,10 @@ void update_shadow_transform_matrix(Shadow* shadow) { Matrix4f sp158; Matrix4f sp198; - guTranslateF(sp58, shadow->position.x, shadow->position.y, shadow->position.z); - guRotateF(sp118, shadow->rotation.x, 1.0f, 0.0f, 0.0f); - guRotateF(spD8, shadow->rotation.y, 0.0f, 1.0f, 0.0f); - guRotateF(sp158, shadow->rotation.z, 0.0f, 0.0f, 1.0f); + guTranslateF(sp58, shadow->pos.x, shadow->pos.y, shadow->pos.z); + guRotateF(sp118, shadow->rot.x, 1.0f, 0.0f, 0.0f); + guRotateF(spD8, shadow->rot.y, 0.0f, 1.0f, 0.0f); + guRotateF(sp158, shadow->rot.z, 0.0f, 0.0f, 1.0f); guMtxCatF(sp158, sp118, sp98); guMtxCatF(spD8, sp98, sp98); guScaleF(sp198, shadow->scale.x, shadow->scale.y, shadow->scale.z); @@ -519,10 +519,10 @@ void update_entity_inverse_rotation_matrix(Entity* entity) { Matrix4f sp18; Matrix4f sp58; - guRotateF(sp18, -entity->rotation.y, 0.0f, 1.0f, 0.0f); - guRotateF(sp58, -entity->rotation.z, 0.0f, 0.0f, 1.0f); + guRotateF(sp18, -entity->rot.y, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -entity->rot.z, 0.0f, 0.0f, 1.0f); guMtxCatF(sp18, sp58, sp18); - guRotateF(sp58, -entity->rotation.x, 1.0f, 0.0f, 0.0f); + guRotateF(sp58, -entity->rot.x, 1.0f, 0.0f, 0.0f); guMtxCatF(sp18, sp58, entity->inverseTransformMatrix); entity->effectiveSize = sqrtf(((SQ(entity->aabb.x) + SQ(entity->aabb.z)) * 0.25f) + SQ(entity->aabb.y)); @@ -642,7 +642,7 @@ s32 entity_get_collision_flags(Entity* entity) { entity->flags &= ~ENTITY_FLAG_PARTNER_COLLISION; } - flag = gCollisionStatus.currentFloor; + flag = gCollisionStatus.curFloor; if (flag != -1 && (flag & COLLISION_WITH_ENTITY_BIT) && listIndex == (u8)flag) { entityFlags |= ENTITY_COLLISION_PLAYER_TOUCH_FLOOR; } @@ -652,7 +652,7 @@ s32 entity_get_collision_flags(Entity* entity) { entityFlags |= ENTITY_COLLISION_PLAYER_LAST_FLOOR; } - flag = gCollisionStatus.currentCeiling; + flag = gCollisionStatus.curCeiling; if (flag != -1 && (flag & COLLISION_WITH_ENTITY_BIT) && listIndex == (u8)flag) { entityFlags |= ENTITY_COLLISION_PLAYER_TOUCH_CEILING; } @@ -667,7 +667,7 @@ s32 entity_get_collision_flags(Entity* entity) { entityFlags |= ENTITY_COLLISION_PLAYER_HAMMER; } - flag = gCollisionStatus.currentWall; + flag = gCollisionStatus.curWall; if (flag != -1 && (flag & COLLISION_WITH_ENTITY_BIT) && listIndex == (u8)flag && gPlayerStatusPtr->pressedButtons & BUTTON_A) { entityFlags |= ENTITY_COLLISION_PLAYER_TOUCH_WALL; } @@ -733,7 +733,7 @@ s32 entity_try_partner_interaction_trigger(s32 entityIdx) { } s32 test_player_entity_aabb(Entity* entity) { - f32 yTemp = entity->position.y - (gPlayerStatus.position.y + gPlayerStatus.colliderHeight); + f32 yTemp = entity->pos.y - (gPlayerStatus.pos.y + gPlayerStatus.colliderHeight); f32 xCollRadius; f32 zCollRadius; f32 xDist; @@ -744,9 +744,9 @@ s32 test_player_entity_aabb(Entity* entity) { } xCollRadius = (gPlayerStatus.colliderDiameter + entity->aabb.x) * 0.5; - xDist = fabsf(gPlayerStatus.position.x - entity->position.x); + xDist = fabsf(gPlayerStatus.pos.x - entity->pos.x); zCollRadius = ((gPlayerStatus.colliderDiameter + entity->aabb.z) * 0.5); - zDist = fabsf(gPlayerStatus.position.z - entity->position.z); + zDist = fabsf(gPlayerStatus.pos.z - entity->pos.z); if (xCollRadius < xDist || zCollRadius < zDist) { return 0; @@ -1261,12 +1261,12 @@ s32 create_entity(EntityBlueprint* bp, ...) { entity->collisionFlags = 0; entity->collisionTimer = 0; entity->renderSetupFunc = NULL; - entity->position.x = x; - entity->position.y = y; - entity->position.z = z; - entity->rotation.x = 0.0f; - entity->rotation.y = rotY; - entity->rotation.z = 0.0f; + entity->pos.x = x; + entity->pos.y = y; + entity->pos.z = z; + entity->rot.x = 0.0f; + entity->rot.y = rotY; + entity->rot.z = 0.0f; entity->scale.x = 1.0f; entity->scale.y = 1.0f; entity->scale.z = 1.0f; @@ -1333,9 +1333,9 @@ s32 create_shadow_from_data(ShadowBlueprint* bp, f32 x, f32 y, f32 z) { shadow->flags = bp->flags | ENTITY_FLAG_CREATED; shadow->alpha = 128; shadow->unk_06 = 0x80; - shadow->position.x = x; - shadow->position.y = y; - shadow->position.z = z; + shadow->pos.x = x; + shadow->pos.y = y; + shadow->pos.z = z; shadow->scale.x = 1.0f; shadow->scale.y = 1.0f; shadow->scale.z = 1.0f; @@ -1607,9 +1607,9 @@ void update_entity_shadow_position(Entity* entity) { } } - rayX = entity->position.x; - rayY = entity->position.y; - rayZ = entity->position.z; + rayX = entity->pos.x; + rayY = entity->pos.y; + rayZ = entity->pos.z; if (!entity_raycast_down(&rayX, &rayY, &rayZ, &hitYaw, &hitPitch, &hitLength) && hitLength == 32767.0f) { hitLength = 0.0f; @@ -1627,17 +1627,17 @@ void update_entity_shadow_position(Entity* entity) { shadow->scale.z = (entity->aabb.z / hitLength) * entity->scale.z; } - shadow->position.x = entity->position.x; - shadow->position.z = entity->position.z; - shadow->position.y = rayY; + shadow->pos.x = entity->pos.x; + shadow->pos.z = entity->pos.z; + shadow->pos.y = rayY; entity->shadowPosY = rayY; - shadow->rotation.x = hitYaw; - shadow->rotation.z = hitPitch; - shadow->rotation.y = entity->rotation.y; + shadow->rot.x = hitYaw; + shadow->rot.z = hitPitch; + shadow->rot.y = entity->rot.y; - if (entity->position.y < rayY) { + if (entity->pos.y < rayY) { shadow->flags |= ENTITY_FLAG_SKIP_UPDATE; - entity->position.y = rayY + 10.0f; + entity->pos.y = rayY + 10.0f; } else { shadow->flags &= ~ENTITY_FLAG_SKIP_UPDATE; } @@ -1753,9 +1753,9 @@ void set_peach_shadow_scale(Shadow* shadow, f32 scale) { } s32 is_block_on_ground(Entity* block) { - f32 x = block->position.x; - f32 y = block->position.y; - f32 z = block->position.z; + f32 x = block->pos.x; + f32 y = block->pos.y; + f32 z = block->pos.z; f32 hitYaw; f32 hitPitch; f32 hitLength; diff --git a/src/entity/Block.c b/src/entity/Block.c index d4d38156c4f..f1b58ac18ba 100644 --- a/src/entity/Block.c +++ b/src/entity/Block.c @@ -49,7 +49,7 @@ void entity_base_block_setupGfx(s32 entityIndex) { } void entity_base_block_play_vanish_effect(Entity* entity) { - fx_cold_breath(0, entity->position.x, entity->position.y, entity->position.z, 1.0f, 0x3C); + fx_cold_breath(0, entity->pos.x, entity->pos.y, entity->pos.z, 1.0f, 0x3C); } f32 entity_block_hit_init_scale(Entity* entity) { @@ -58,12 +58,12 @@ f32 entity_block_hit_init_scale(Entity* entity) { entity->scale.y = 0.23f; entity->scale.x = 1.04f; entity->scale.z = 1.04f; - entity->position.y += 18.0f; + entity->pos.y += 18.0f; } else { entity->scale.y = 0.46f; entity->scale.x = 2.08f; entity->scale.z = 2.08f; - entity->position.y += 18.0f; + entity->pos.y += 18.0f; } } @@ -73,12 +73,12 @@ void entity_block_hit_animate_scale(Entity* entity) { entity->scale.x -= 0.09; entity->scale.z -= 0.09; entity->scale.y += 0.045; - entity->position.y -= 3.0f; + entity->pos.y -= 3.0f; } else { entity->scale.x -= 0.18; entity->scale.z -= 0.18; entity->scale.y += 0.09; - entity->position.y -= 3.0f; + entity->pos.y -= 3.0f; } entity_base_block_idle(entity); } @@ -99,10 +99,10 @@ void entity_base_block_update_slow_sinking(Entity* entity) { return; } - if (entity->position.y < data->initialY - 25.0f) { - deltaY = (entity->position.y - data->initialY + 50.0f) * 0.125f; + if (entity->pos.y < data->initialY - 25.0f) { + deltaY = (entity->pos.y - data->initialY + 50.0f) * 0.125f; } else { - deltaY = (data->initialY - entity->position.y) * 0.125f; + deltaY = (data->initialY - entity->pos.y) * 0.125f; } if (deltaY > 1.2) { @@ -112,10 +112,10 @@ void entity_base_block_update_slow_sinking(Entity* entity) { deltaY = 0.3f; } - entity->position.y += deltaY; + entity->pos.y += deltaY; - if (data->initialY < entity->position.y) { - entity->position.y = data->initialY; + if (data->initialY < entity->pos.y) { + entity->pos.y = data->initialY; data->sinkingTimer = -1; entity->flags &= ~ENTITY_FLAG_200000; } @@ -124,10 +124,10 @@ void entity_base_block_update_slow_sinking(Entity* entity) { if (!(playerStatus->flags & PS_FLAG_JUMPING)) { Shadow* shadow = get_shadow_by_index(entity->shadowIndex); if (shadow != NULL) { - f32 temp2 = entity->position.y - shadow->position.y; + f32 temp2 = entity->pos.y - shadow->pos.y; - if (entity->position.y - temp2 <= playerStatus->colliderHeight + 1) { - entity->position.y = playerStatus->colliderHeight + 1; + if (entity->pos.y - temp2 <= playerStatus->colliderHeight + 1) { + entity->pos.y = playerStatus->colliderHeight + 1; data->sinkingTimer = 1; } } @@ -139,8 +139,8 @@ void entity_base_block_update_slow_sinking(Entity* entity) { } else { Shadow* shadow = get_shadow_by_index(entity->shadowIndex); if (shadow != NULL) { - if (entity->position.y <= shadow->position.y) { - entity->position.y = shadow->position.y; + if (entity->pos.y <= shadow->pos.y) { + entity->pos.y = shadow->pos.y; data->sinkingTimer = 1; } } @@ -151,10 +151,10 @@ void entity_base_block_update_slow_sinking(Entity* entity) { return; } - if (entity->position.y < data->initialY - 25.0f) { - deltaY = (entity->position.y - data->initialY + 50.0f) * 0.125f; + if (entity->pos.y < data->initialY - 25.0f) { + deltaY = (entity->pos.y - data->initialY + 50.0f) * 0.125f; } else { - deltaY = (data->initialY - entity->position.y) * 0.125f; + deltaY = (data->initialY - entity->pos.y) * 0.125f; } if (deltaY > 1.2) { @@ -164,10 +164,10 @@ void entity_base_block_update_slow_sinking(Entity* entity) { deltaY = 0.3f; } - entity->position.y -= deltaY; + entity->pos.y -= deltaY; - if (entity->position.y < data->initialY - 50.0f) { - entity->position.y = data->initialY - 50.0f; + if (entity->pos.y < data->initialY - 50.0f) { + entity->pos.y = data->initialY - 50.0f; data->sinkingTimer = 1; } } @@ -183,7 +183,7 @@ s32 entity_base_block_idle(Entity* entity) { entity_base_block_update_slow_sinking(entity); if (data->item != -1) { ItemEntity* itemEntity = get_item_entity(data->item); - itemEntity->position.y = entity->position.y + 4.0f; + itemEntity->pos.y = entity->pos.y + 4.0f; } } } @@ -195,7 +195,7 @@ void entity_base_block_init(Entity* entity) { BlockData* data = entity->dataBuf.block; data->item = -1; - data->initialY = entity->position.y; + data->initialY = entity->pos.y; data->sinkingTimer = -1; entity->flags &= ~ENTITY_FLAG_200000; } @@ -211,8 +211,8 @@ void entity_inactive_block_hit_anim(Entity* entity) { f64 currentY; entity_MulticoinBlock_update_timer(entity); - currentY = entity->position.y; - entity->position.y = currentY + ((f64)sin_rad(DEG_TO_RAD(data->recoilInterpPhase)) * 2); + currentY = entity->pos.y; + entity->pos.y = currentY + ((f64)sin_rad(DEG_TO_RAD(data->recoilInterpPhase)) * 2); data->recoilInterpPhase += 60.0f; if (data->recoilInterpPhase > 450.0f) { data->recoilInterpPhase = clamp_angle(data->recoilInterpPhase); @@ -225,12 +225,12 @@ void entity_inactive_block_recoil_anim(Entity* entity) { f64 currentY; entity_MulticoinBlock_update_timer(entity); - currentY = entity->position.y; - entity->position.y = currentY + ((f64)sin_rad(DEG_TO_RAD(data->recoilInterpPhase))); + currentY = entity->pos.y; + entity->pos.y = currentY + ((f64)sin_rad(DEG_TO_RAD(data->recoilInterpPhase))); data->recoilInterpPhase += 60.0f; if (data->recoilInterpPhase >= 360.0f) { data->recoilInterpPhase = 0.0f; - entity->position.y = data->initialY; + entity->pos.y = data->initialY; exec_entity_commandlist(entity); } } @@ -258,7 +258,7 @@ void entity_MulticoinBlock_spawn_coin(Entity* entity) { itemSpawnMode = ITEM_SPAWN_MODE_ITEM_BLOCK_SPAWN_ALWAYS; flagIndex = 0; } - make_item_entity_nodelay(ITEM_COIN, entity->position.x, entity->position.y + 28.0, entity->position.z, + make_item_entity_nodelay(ITEM_COIN, entity->pos.x, entity->pos.y + 28.0, entity->pos.z, itemSpawnMode, flagIndex); data->coinsLeft -= 1; } @@ -266,8 +266,8 @@ void entity_MulticoinBlock_spawn_coin(Entity* entity) { if ((data->coinsLeft == 0) || (data->timeLeft == 0)) { data->empty = TRUE; set_entity_commandlist(get_entity_by_index(create_entity(&Entity_InertYellowBlock, - (s32)entity->position.x, (s32)entity->position.y, (s32)entity->position.z, - (s32)entity->rotation.y, MAKE_ENTITY_END)), Entity_CreatedInertBlock_Script); + (s32)entity->pos.x, (s32)entity->pos.y, (s32)entity->pos.z, + (s32)entity->rot.y, MAKE_ENTITY_END)), Entity_CreatedInertBlock_Script); entity->flags |= (ENTITY_FLAG_DISABLE_COLLISION | ENTITY_FLAG_PENDING_INSTANCE_DELETE); } } @@ -296,7 +296,7 @@ void entity_MulticoinBlock_idle(Entity* entity) { entity_MulticoinBlock_update_timer(entity); entity_base_block_idle(entity); if (data->empty) { - create_entity(&Entity_InertYellowBlock, (s32)entity->position.x, (s32)entity->position.y, (s32)entity->position.z, (s32)entity->rotation.y, MAKE_ENTITY_END); + create_entity(&Entity_InertYellowBlock, (s32)entity->pos.x, (s32)entity->pos.y, (s32)entity->pos.z, (s32)entity->rot.y, MAKE_ENTITY_END); entity->flags |= (ENTITY_FLAG_DISABLE_COLLISION | ENTITY_FLAG_PENDING_INSTANCE_DELETE); } } @@ -306,7 +306,7 @@ void entity_MulticoinBlock_check_if_inactive(Entity* entity) { if (data->gameFlagIndex != 0xFFFF) { if (get_global_flag(data->gameFlagIndex) != 0) { - create_entity(&Entity_InertYellowBlock, (s32)entity->position.x, (s32)entity->position.y, (s32)entity->position.z, (s32)entity->rotation.y, MAKE_ENTITY_END); + create_entity(&Entity_InertYellowBlock, (s32)entity->pos.x, (s32)entity->pos.y, (s32)entity->pos.z, (s32)entity->rot.y, MAKE_ENTITY_END); entity->flags |= (ENTITY_FLAG_DISABLE_COLLISION | ENTITY_FLAG_PENDING_INSTANCE_DELETE); } } @@ -388,7 +388,7 @@ s32 entity_block_handle_collision(Entity* entity) { return TRUE; } set_entity_commandlist(entity, Entity_BreakingBlock_Script); - sfx_play_sound_at_position(SOUND_14F, SOUND_SPACE_MODE_0, entity->position.x, entity->position.y, entity->position.z); + sfx_play_sound_at_position(SOUND_14F, SOUND_SPACE_MODE_0, entity->pos.x, entity->pos.y, entity->pos.z); break; case ENTITY_TYPE_HAMMER2_BLOCK: case ENTITY_TYPE_HAMMER2_BLOCK_TINY: @@ -403,7 +403,7 @@ s32 entity_block_handle_collision(Entity* entity) { return TRUE; } set_entity_commandlist(entity, Entity_BreakingBlock_Script); - sfx_play_sound_at_position(SOUND_150, SOUND_SPACE_MODE_0, entity->position.x, entity->position.y, entity->position.z); + sfx_play_sound_at_position(SOUND_150, SOUND_SPACE_MODE_0, entity->pos.x, entity->pos.y, entity->pos.z); break; case ENTITY_TYPE_HAMMER3_BLOCK: case ENTITY_TYPE_HAMMER3_BLOCK_TINY: @@ -411,7 +411,7 @@ s32 entity_block_handle_collision(Entity* entity) { return TRUE; } set_entity_commandlist(entity, Entity_BreakingBlock_Script); - sfx_play_sound_at_position(SOUND_151, SOUND_SPACE_MODE_0, entity->position.x, entity->position.y, entity->position.z); + sfx_play_sound_at_position(SOUND_151, SOUND_SPACE_MODE_0, entity->pos.x, entity->pos.y, entity->pos.z); break; case ENTITY_TYPE_MULTI_TRIGGER_BLOCK: case ENTITY_TYPE_HEALING_BLOCK: @@ -441,7 +441,7 @@ void entity_init_HammerBlock_small(Entity* entity) { BlockData* data = entity->dataBuf.block; data->item = -1; - data->initialY = entity->position.y; + data->initialY = entity->pos.y; data->sinkingTimer = -1; entity->flags &= ~ENTITY_FLAG_200000; entity->scale.x = 0.5f; diff --git a/src/entity/BlueWarpPipe.c b/src/entity/BlueWarpPipe.c index 85fabdd5abd..0fffe2f0886 100644 --- a/src/entity/BlueWarpPipe.c +++ b/src/entity/BlueWarpPipe.c @@ -25,7 +25,7 @@ void entity_BlueWarpPipe_rise_up(Entity* entity) { pipeData->timer--; if ((pipeData->timer != -1) && (pipeData->isRaised == 0)) { - entity->position.y += 2.3125; + entity->pos.y += 2.3125; } else { pipeData->timer = 0; exec_entity_commandlist(entity); @@ -38,12 +38,12 @@ void entity_BlueWarpPipe_wait_for_player_to_get_off(Entity* entity) { if (pipeData->entryID == gGameStatusPtr->entryID) { switch (pipeData->timer) { case 0: - if (gCollisionStatus.currentFloor > 0) { + if (gCollisionStatus.curFloor > 0) { pipeData->timer = 1; } break; case 1: - if (gCollisionStatus.currentFloor <= NO_COLLIDER) { + if (gCollisionStatus.curFloor <= NO_COLLIDER) { pipeData->timer = 2; } break; @@ -94,7 +94,7 @@ void entity_BlueWarpPipe_set_player_move_to_center(Entity* entity) { entryX = (*mapSettings->entryList)[pipeData->entryID].x; entryZ = (*mapSettings->entryList)[pipeData->entryID].z; - angle = atan2(playerStatus->position.x, playerStatus->position.z, entryX, entryZ); + angle = atan2(playerStatus->pos.x, playerStatus->pos.z, entryX, entryZ); disable_player_input(); disable_player_static_collisions(); move_player(pipeData->timer, angle, playerStatus->runSpeed); @@ -112,7 +112,7 @@ void entity_BlueWarpPipe_enter_pipe_init(Entity* bluePipe) { PlayerStatus* playerStatus = &gPlayerStatus; BlueWarpPipeData* pipeData = bluePipe->dataBuf.bluePipe; - playerStatus->targetYaw = gCameras[gCurrentCameraID].currentYaw + 180.0f; + playerStatus->targetYaw = gCameras[gCurrentCameraID].curYaw + 180.0f; pipeData->timer = 25; playerStatus->renderMode = RENDER_MODE_ALPHATEST; @@ -125,12 +125,12 @@ void entity_BlueWarpPipe_enter_pipe_update(Entity* entity) { PlayerStatus* playerStatus = &gPlayerStatus; BlueWarpPipeData* pipeData = entity->dataBuf.bluePipe; - playerStatus->position.y--; + playerStatus->pos.y--; pipeData->timer--; if (pipeData->timer == -1) { playerStatus->renderMode = RENDER_MODE_ALPHATEST; - playerStatus->position.y -= 50.0f; + playerStatus->pos.y -= 50.0f; set_player_imgfx_all(ANIM_Mario1_Idle, IMGFX_CLEAR, 0, 0, 0, 0, 0); exec_entity_commandlist(entity); } @@ -152,7 +152,7 @@ void entity_BlueWarpPipe_setupGfx(s32 entityIndex) { Matrix4f sp50; guScaleF(sp10, entity->scale.x, entity->scale.y, entity->scale.z); - guTranslateF(sp50, entity->position.x, data->finalPosY + 1.0f, entity->position.z); + guTranslateF(sp50, entity->pos.x, data->finalPosY + 1.0f, entity->pos.z); guMtxCatF(sp10, sp50, sp50); guMtxF2L(sp50, &gDisplayContext->matrixStack[gMatrixListPos]); gSPMatrix(gfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -173,10 +173,10 @@ void entity_init_BlueWarpPipe(Entity* entity) { data->entryID = entryID; data->onEnterPipeEvt = enterPipeEvt; data->flagIndex = flagIndex; - data->finalPosY = entity->position.y; + data->finalPosY = entity->pos.y; data->isRaised = get_global_flag(data->flagIndex); - entity->position.y -= (data->isRaised ? 15.0 : 52.0); + entity->pos.y -= (data->isRaised ? 15.0 : 52.0); } EntityScript Entity_BlueWarpPipe_Script = { diff --git a/src/entity/Chest.c b/src/entity/Chest.c index 4ec4e50d8d2..a9efbfdf44f 100644 --- a/src/entity/Chest.c +++ b/src/entity/Chest.c @@ -124,8 +124,8 @@ void entity_Chest_idle(Entity* entity) { ChestData* data; PlayerStatus* playerStatus = &gPlayerStatus; - rotation = clamp_angle(180.0f - entity->rotation.y); - angle = fabsf(rotation - clamp_angle(atan2(entity->position.x, entity->position.z, playerStatus->position.x, playerStatus->position.z))); + rotation = clamp_angle(180.0f - entity->rot.y); + angle = fabsf(rotation - clamp_angle(atan2(entity->pos.x, entity->pos.z, playerStatus->pos.x, playerStatus->pos.z))); if ((!(playerStatus->animFlags & PA_FLAG_USING_WATT)) && (!(entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR)) && ((angle <= 40.0f) || (angle >= 320.0f))) { @@ -302,14 +302,14 @@ void entity_GiantChest_open(Entity* entity) { if (chest->giveItemHeightInterpPhase < 140.0f) { chest->itemEntityPos.y += cos_rad(DEG_TO_RAD(chest->giveItemHeightInterpPhase)) * 3.0f; } else { - dy = (chest->itemEntityPos.y - playerStatus->position.y - 30.0f) * 0.25f; + dy = (chest->itemEntityPos.y - playerStatus->pos.y - 30.0f) * 0.25f; if (dy <= 0.4) { dy = 0.4f; } chest->itemEntityPos.y -= dy; } giveItemLerpAlpha = sin_rad(DEG_TO_RAD(chest->giveItemRadiusInterpPhase)); - theta = intermediateTheta = clamp_angle(atan2(entity->position.x, entity->position.z, playerStatus->position.x, playerStatus->position.z)); + theta = intermediateTheta = clamp_angle(atan2(entity->pos.x, entity->pos.z, playerStatus->pos.x, playerStatus->pos.z)); if (gGameStatusPtr->areaID == AREA_KZN) { radius = 3.0f; @@ -332,8 +332,8 @@ void entity_GiantChest_open(Entity* entity) { chest->state++; if (chest->itemID != 0) { suggest_player_anim_always_forward(ANIM_MarioW1_Lift); - sin_cos_rad(DEG_TO_RAD(90.0f - gCameras[CAM_DEFAULT].currentYaw), &sinRight, &cosRight); - sin_cos_rad(DEG_TO_RAD(180.0f - gCameras[CAM_DEFAULT].currentYaw), &sinFwd, &cosFwd); + sin_cos_rad(DEG_TO_RAD(90.0f - gCameras[CAM_DEFAULT].curYaw), &sinRight, &cosRight); + sin_cos_rad(DEG_TO_RAD(180.0f - gCameras[CAM_DEFAULT].curYaw), &sinFwd, &cosFwd); horizontalOffset = 0.0f; depthOffset = 4.0f; //RadialFlowOut @@ -382,10 +382,10 @@ void entity_GiantChest_give_equipment(Entity* entity) { } if (data->itemID != 0) { - angle = DEG_TO_RAD(entity->rotation.y); - data->itemEntityPos.x = entity->position.x + (sin_rad(angle) * 10.0f); - data->itemEntityPos.y = entity->position.y; - data->itemEntityPos.z = entity->position.z + (cos_rad(angle) * 10.0f); + angle = DEG_TO_RAD(entity->rot.y); + data->itemEntityPos.x = entity->pos.x + (sin_rad(angle) * 10.0f); + data->itemEntityPos.y = entity->pos.y; + data->itemEntityPos.z = entity->pos.z + (cos_rad(angle) * 10.0f); data->itemEntityIndex = make_item_entity_nodelay(data->itemID, data->itemEntityPos.x, data->itemEntityPos.y, data->itemEntityPos.z, ITEM_SPAWN_MODE_DECORATION, -1); diff --git a/src/entity/HeartBlock.c b/src/entity/HeartBlock.c index 68bf8f24fa1..0ef979791d3 100644 --- a/src/entity/HeartBlock.c +++ b/src/entity/HeartBlock.c @@ -81,9 +81,9 @@ void entity_HeartBlockContent_set_initial_pos(Entity* entity) { HeartBlockContentData* temp = entity->dataBuf.heartBlockContent; Entity* entityTemp = get_entity_by_index(temp->parentEntityIndex); - entity->position.x = entityTemp->position.x; - entity->position.y = entityTemp->position.y + 14.0f; - entity->position.z = entityTemp->position.z; + entity->pos.x = entityTemp->pos.x; + entity->pos.y = entityTemp->pos.y + 14.0f; + entity->pos.z = entityTemp->pos.z; } void entity_HeartBlockContent__reset(Entity* entity) { @@ -107,9 +107,9 @@ void entity_HeartBlockContent__reset(Entity* entity) { data->unk_0C = 0; data->unk_10 = 0; - entity->rotation.x = 0.0f; - entity->rotation.y = 0.0f; - entity->rotation.z = 0.0f; + entity->rot.x = 0.0f; + entity->rot.y = 0.0f; + entity->rot.z = 0.0f; entity->scale.y = entity->scale.x; entity->scale.z = entity->scale.x; @@ -148,7 +148,7 @@ void entity_HeartBlockContent_anim_idle(Entity* entity, s32 arg1) { data->sparkleTimer--; if (data->sparkleTimer <= 0) { data->sparkleTimer = 50; - fx_stars_shimmer(data->sparkleEffectType, entity->position.x, entity->position.y, entity->position.z, 22.0f, 8.0f, 4, 20); + fx_stars_shimmer(data->sparkleEffectType, entity->pos.x, entity->pos.y, entity->pos.z, 22.0f, 8.0f, 4, 20); } } break; @@ -157,7 +157,7 @@ void entity_HeartBlockContent_anim_idle(Entity* entity, s32 arg1) { if (entity_can_collide_with_jumping_player(get_entity_by_index(data->parentEntityIndex))) { exec_entity_commandlist(entity); disable_player_input(); - gPlayerStatus.currentSpeed = 0; + gPlayerStatus.curSpeed = 0; gPlayerStatus.animFlags |= PA_FLAG_RAISED_ARMS; set_time_freeze_mode(TIME_FREEZE_PARTIAL); gOverrideFlags |= GLOBAL_OVERRIDES_40; @@ -171,7 +171,7 @@ void entity_HeartBlockContent_reset_data(Entity* entity) { entity->scale.x = 1.0f; entity->scale.y = 1.0f; entity->scale.z = 1.0f; - entity->rotation.z = 0.0f; + entity->rot.z = 0.0f; } void entity_HeartBlockContent__anim_heal(Entity* entity, s32 arg1) { @@ -181,31 +181,31 @@ void entity_HeartBlockContent__anim_heal(Entity* entity, s32 arg1) { switch (data->state) { case 0: - fx_sparkles(FX_SPARKLES_0, entity->position.x, entity->position.y, entity->position.z, 2.0f); + fx_sparkles(FX_SPARKLES_0, entity->pos.x, entity->pos.y, entity->pos.z, 2.0f); data->bouncePhase = 0.0f; data->state++; - data->riseVelocity = 6.0f; + data->riseVel = 6.0f; break; case 1: - entity->position.y = entity->position.y + data->riseVelocity; - data->riseVelocity -= 1.0f; - if (data->riseVelocity <= 2.0f) { + entity->pos.y = entity->pos.y + data->riseVel; + data->riseVel -= 1.0f; + if (data->riseVel <= 2.0f) { data->state++; entity->flags &= ~ENTITY_FLAG_ALWAYS_FACE_CAMERA; - data->rotationRate = -10.0f; + data->rotRate = -10.0f; entity_set_render_script(entity, &Entity_HeartBlockContent_RenderScriptHit); entity->renderSetupFunc = entity_HeartBlockContent_setupGfx; } break; case 2: - entity->position.y += sin_rad(DEG_TO_RAD(data->bouncePhase)) * 0.5f; + entity->pos.y += sin_rad(DEG_TO_RAD(data->bouncePhase)) * 0.5f; data->bouncePhase -= 30.0f; if (data->bouncePhase < 0.0f) { data->bouncePhase += 360.0f; } - entity->rotation.y += data->rotationRate; - data->rotationRate += 2.0f; - if (data->rotationRate >= 0.0f) { + entity->rot.y += data->rotRate; + data->rotRate += 2.0f; + if (data->rotRate >= 0.0f) { data->sparkleTrailAngle = 0.0f; data->sparkleTrailRadius = 0.0f; data->state++; @@ -215,7 +215,7 @@ void entity_HeartBlockContent__anim_heal(Entity* entity, s32 arg1) { recover_fp(-1); sfx_play_sound(SOUND_131); } - data->yawBuffer[data->yawBufferPos] = entity->rotation.y; + data->yawBuffer[data->yawBufferPos] = entity->rot.y; data->yawBufferPos++; if (data->yawBufferPos > ARRAY_COUNT(data->yawBuffer)) { data->yawBufferPos = 0; @@ -237,9 +237,9 @@ void entity_HeartBlockContent__anim_heal(Entity* entity, s32 arg1) { data->sparkleTrailPosY -= 0.7; if ((data->sparkleTrailTimer++ & 1) != 0) { - fx_sparkles(FX_SPARKLES_3, playerStatus->position.x + offsetX, - playerStatus->position.y + offsetY, - playerStatus->position.z - offsetZ, + fx_sparkles(FX_SPARKLES_3, playerStatus->pos.x + offsetX, + playerStatus->pos.y + offsetY, + playerStatus->pos.z - offsetZ, 8.0f ); } @@ -249,18 +249,18 @@ void entity_HeartBlockContent__anim_heal(Entity* entity, s32 arg1) { } // fallthrough case 4: - entity->position.y += sin_rad(DEG_TO_RAD(data->bouncePhase)) * 0.5f; + entity->pos.y += sin_rad(DEG_TO_RAD(data->bouncePhase)) * 0.5f; data->bouncePhase -= 30.0f; if (data->bouncePhase < 0.0f) { data->bouncePhase += 360.0f; } - data->rotationRate += 1.0; - if (data->rotationRate > 30.0f) { - data->rotationRate = 30.0f; + data->rotRate += 1.0; + if (data->rotRate > 30.0f) { + data->rotRate = 30.0f; } - entity->rotation.y += data->rotationRate; - if (entity->rotation.y >= 360.0f) { - entity->rotation.y -= 360.0f; + entity->rot.y += data->rotRate; + if (entity->rot.y >= 360.0f) { + entity->rot.y -= 360.0f; } entity->alpha -= 5; if (entity->alpha < 7) { @@ -269,7 +269,7 @@ void entity_HeartBlockContent__anim_heal(Entity* entity, s32 arg1) { data->state++; } } - data->yawBuffer[data->yawBufferPos] = entity->rotation.y; + data->yawBuffer[data->yawBufferPos] = entity->rot.y; data->yawBufferPos++; if (data->yawBufferPos > ARRAY_COUNT(data->yawBuffer)) { data->yawBufferPos = 0; @@ -385,7 +385,7 @@ s8 entity_HeartBlock_create_child_entity(Entity* entity, EntityBlueprint* bp) { HeartBlockContentData* data; entity_base_block_init(entity); - childEntity = get_entity_by_index(create_entity(bp, (s32)entity->position.x, (s32)entity->position.y, (s32)entity->position.z, 0, MAKE_ENTITY_END)); + childEntity = get_entity_by_index(create_entity(bp, (s32)entity->pos.x, (s32)entity->pos.y, (s32)entity->pos.z, 0, MAKE_ENTITY_END)); data = childEntity->dataBuf.heartBlockContent; data->parentEntityIndex = entity->listIndex; diff --git a/src/entity/HiddenPanel.c b/src/entity/HiddenPanel.c index 4482643e29c..055dce2384d 100644 --- a/src/entity/HiddenPanel.c +++ b/src/entity/HiddenPanel.c @@ -22,9 +22,9 @@ void entity_HiddenPanel_setupGfx(s32 entityIndex) { Matrix4f rotMtx; Matrix4f tempMtx; - if (entity->position.y != data->initialY) { + if (entity->pos.y != data->initialY) { guMtxIdentF(rotMtx); - guTranslateF(tempMtx, entity->position.x, data->initialY + 1.0f, entity->position.z); + guTranslateF(tempMtx, entity->pos.x, data->initialY + 1.0f, entity->pos.z); guMtxCatF(tempMtx, rotMtx, tempMtx); guMtxF2L(tempMtx, &gDisplayContext->matrixStack[gMatrixListPos]); gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -64,35 +64,35 @@ void entity_HiddenPanel_idle(Entity* entity) { data->standingNpcIndex = -1; data->npcFlags = 0; - if (gCurrentHiddenPanels.tryFlipTrigger && fabs(gCurrentHiddenPanels.flipTriggerPosY - entity->position.y) <= 10.0) { + if (gCurrentHiddenPanels.tryFlipTrigger && fabs(gCurrentHiddenPanels.flipTriggerPosY - entity->pos.y) <= 10.0) { data->state = 10; - distToPlayer = get_xz_dist_to_player(entity->position.x, entity->position.z); + distToPlayer = get_xz_dist_to_player(entity->pos.x, entity->pos.z); if (distToPlayer <= 100) { if (entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR) { - data->riseVelocity = 0.5f; + data->riseVel = 0.5f; exec_entity_commandlist(entity); } else if (entity_HiddenPanel_is_item_on_top(entity)) { - data->riseVelocity = 0.5f; + data->riseVel = 0.5f; exec_entity_commandlist(entity); } else { s32 npcIndex = npc_find_standing_on_entity(entity->listIndex); if (npcIndex >= 0) { Npc* npc = get_npc_by_index(npcIndex); - dist2D(entity->position.x, entity->position.z, npc->pos.x, npc->pos.z); + dist2D(entity->pos.x, entity->pos.z, npc->pos.x, npc->pos.z); data->standingNpcIndex = npcIndex; data->npcFlags = npc->flags & (NPC_FLAG_GRAVITY | NPC_FLAG_8); npc->flags &= ~NPC_FLAG_8; npc->flags |= NPC_FLAG_GRAVITY; - data->riseVelocity = 0.5f; + data->riseVel = 0.5f; exec_entity_commandlist(entity); } else { entity->flags |= ENTITY_FLAG_DISABLE_COLLISION; if (distToPlayer > 60) { - data->riseVelocity = 0.5f; + data->riseVel = 0.5f; exec_entity_commandlist(entity); } else { data->state = 0; - data->riseVelocity = 10.0f; + data->riseVel = 10.0f; exec_entity_commandlist(entity); } } @@ -107,12 +107,12 @@ void entity_HiddenPanel_flip_over(Entity* entity) { f32 rotAngle; s32 flipAxis; - yaw = clamp_angle(gCameras[CAM_DEFAULT].currentYaw + 45.0f); + yaw = clamp_angle(gCameras[CAM_DEFAULT].curYaw + 45.0f); if (yaw < 90.0f || yaw >= 180.0f && yaw < 270.0f) { - rotAngle = entity->rotation.z; + rotAngle = entity->rot.z; flipAxis = 1; } else { - rotAngle = entity->rotation.x; + rotAngle = entity->rot.x; flipAxis = 0; } @@ -122,24 +122,24 @@ void entity_HiddenPanel_flip_over(Entity* entity) { data->state = 1; data->unk_02 = TRUE; data->riseInterpPhase = 90.0f; - data->rotationSpeed = 65.0f; + data->rotSpeed = 65.0f; set_time_freeze_mode(TIME_FREEZE_PARTIAL); disable_player_static_collisions(); gPlayerStatusPtr->animFlags |= PA_FLAG_OPENED_HIDDEN_PANEL; if (data->needSpawnItem) { data->needSpawnItem = FALSE; data->spawnedItemIndex = make_item_entity_nodelay(data->itemID, - entity->position.x, entity->position.y + 2.0, entity->position.z, + entity->pos.x, entity->pos.y + 2.0, entity->pos.z, ITEM_SPAWN_MODE_TOSS_NEVER_VANISH, data->pickupVar); } entity->flags &= ~ENTITY_FLAG_HIDDEN; break; case 1: - entity->position.y += data->riseVelocity * sin_rad(DEG_TO_RAD(data->riseInterpPhase)); - if (entity->position.y <= data->initialY) { - entity->position.y = data->initialY; - entity->rotation.x = 0.0f; - entity->rotation.z = 0.0f; + entity->pos.y += data->riseVel * sin_rad(DEG_TO_RAD(data->riseInterpPhase)); + if (entity->pos.y <= data->initialY) { + entity->pos.y = data->initialY; + entity->rot.x = 0.0f; + entity->rot.z = 0.0f; rotAngle = 0.0f; data->timer = 10; } @@ -152,19 +152,19 @@ void entity_HiddenPanel_flip_over(Entity* entity) { } if (data->riseInterpPhase > 110.0f) { - rotAngle += data->rotationSpeed; + rotAngle += data->rotSpeed; if (rotAngle >= 360.0f) { rotAngle -= 360.0f; } } break; case 2: - data->rotationSpeed -= 2.0f; - if (data->rotationSpeed <= 0.0f) { - data->rotationSpeed = 0.0f; + data->rotSpeed -= 2.0f; + if (data->rotSpeed <= 0.0f) { + data->rotSpeed = 0.0f; } - rotAngle += data->rotationSpeed; + rotAngle += data->rotSpeed; if (rotAngle >= 360.0f) { rotAngle -= 360.0f; } @@ -174,28 +174,28 @@ void entity_HiddenPanel_flip_over(Entity* entity) { } break; case 3: - data->rotationSpeed -= 5.0f; - if (data->rotationSpeed <= 0.0f) { - data->rotationSpeed = 0.0f; + data->rotSpeed -= 5.0f; + if (data->rotSpeed <= 0.0f) { + data->rotSpeed = 0.0f; } - rotAngle += data->rotationSpeed; + rotAngle += data->rotSpeed; if (rotAngle >= 360.0f) { rotAngle = 360.0f; } - entity->position.y += data->riseVelocity * sin_rad(DEG_TO_RAD(data->riseInterpPhase)); + entity->pos.y += data->riseVel * sin_rad(DEG_TO_RAD(data->riseInterpPhase)); data->riseInterpPhase += 10.0f; if (data->riseInterpPhase > 270.0f) { data->riseInterpPhase = 270.0f; } - if (entity->position.y <= data->initialY) { + if (entity->pos.y <= data->initialY) { data->state++; - entity->position.y = data->initialY; - entity->rotation.x = 0.0f; - entity->rotation.z = 0.0f; + entity->pos.y = data->initialY; + entity->rot.x = 0.0f; + entity->rot.z = 0.0f; rotAngle = 0.0f; data->timer = 10; exec_ShakeCamX(CAM_DEFAULT, CAM_SHAKE_DECAYING_VERTICAL, 1, 0.2f); @@ -207,18 +207,18 @@ void entity_HiddenPanel_flip_over(Entity* entity) { break; case 5: data->state = 11; - entity->position.y += 2.0f; + entity->pos.y += 2.0f; break; case 10: entity->flags &= ~ENTITY_FLAG_HIDDEN; data->unk_02 = FALSE; data->state++; - entity->position.y += 6.0f; + entity->pos.y += 6.0f; break; case 11: - entity->position.y -= 1.0f; - if (entity->position.y <= data->initialY) { - entity->position.y = data->initialY; + entity->pos.y -= 1.0f; + if (entity->pos.y <= data->initialY) { + entity->pos.y = data->initialY; data->timer = 1; data->state++; entity->flags |= ENTITY_FLAG_HIDDEN | ENTITY_FLAG_DISABLE_COLLISION; @@ -247,18 +247,18 @@ void entity_HiddenPanel_flip_over(Entity* entity) { } if (flipAxis == 0) { - entity->rotation.x = rotAngle; + entity->rot.x = rotAngle; } else { - entity->rotation.z = rotAngle; + entity->rot.z = rotAngle; } if (data->spawnedItemIndex >= 0) { ItemEntity* itemEntity = get_item_entity(data->spawnedItemIndex); if (itemEntity != NULL) { if (itemEntity->flags & ITEM_ENTITY_FLAG_10) { - data->spawnedItemPos.x = itemEntity->position.x; - data->spawnedItemPos.y = itemEntity->position.y; - data->spawnedItemPos.z = itemEntity->position.z; + data->spawnedItemPos.x = itemEntity->pos.x; + data->spawnedItemPos.y = itemEntity->pos.y; + data->spawnedItemPos.z = itemEntity->pos.z; } else { data->spawnedItemPos.x = 0x8000; data->spawnedItemPos.y = 0x8000; @@ -277,8 +277,8 @@ s32 entity_HiddenPanel_is_item_on_top(Entity* entity) { ItemEntity* itemEntity = get_item_entity(data->spawnedItemIndex); if (itemEntity != NULL) { if (itemEntity->flags & ITEM_ENTITY_FLAG_10) { - if (fabs(entity->position.x - data->spawnedItemPos.x) <= 34.0) { - if (fabs(entity->position.z - data->spawnedItemPos.z) <= 34.0) { + if (fabs(entity->pos.x - data->spawnedItemPos.x) <= 34.0) { + if (fabs(entity->pos.z - data->spawnedItemPos.z) <= 34.0) { return TRUE; } } @@ -298,7 +298,7 @@ void entity_HiddenPanel_init(Entity* entity) { mem_clear(&gCurrentHiddenPanels, sizeof(gCurrentHiddenPanels)); entity->renderSetupFunc = entity_HiddenPanel_setupGfx; data->pickupVar = 0xFFFF; - data->initialY = entity->position.y; + data->initialY = entity->pos.y; data->modelID = CreateEntityVarArgBuffer[0]; data->itemID = CreateEntityVarArgBuffer[1]; data->needSpawnItem = TRUE; @@ -309,12 +309,12 @@ void entity_HiddenPanel_init(Entity* entity) { } guMtxIdentF(data->entityMatrix); - guTranslateF(sp18, entity->position.x, entity->position.y, entity->position.z); - guRotateF(sp58, entity->rotation.y, 0.0f, 1.0f, 0.0f); + guTranslateF(sp18, entity->pos.x, entity->pos.y, entity->pos.z); + guRotateF(sp58, entity->rot.y, 0.0f, 1.0f, 0.0f); guMtxCatF(sp58, sp18, sp18); - guRotateF(sp58, entity->rotation.x, 1.0f, 0.0f, 0.0f); + guRotateF(sp58, entity->rot.x, 1.0f, 0.0f, 0.0f); guMtxCatF(sp58, sp18, sp18); - guRotateF(sp58, entity->rotation.z, 0.0f, 0.0f, 1.0f); + guRotateF(sp58, entity->rot.z, 0.0f, 0.0f, 1.0f); guMtxCatF(sp58, sp18, sp18); guScaleF(sp58, entity->scale.x, entity->scale.y, entity->scale.z); guMtxCatF(sp58, sp18, data->entityMatrix); diff --git a/src/entity/ItemBlock.c b/src/entity/ItemBlock.c index 146d94bcbd5..dbcb6797907 100644 --- a/src/entity/ItemBlock.c +++ b/src/entity/ItemBlock.c @@ -68,11 +68,11 @@ void entity_ItemBlock_spawn_item(Entity* entity) { entity->flags |= ENTITY_FLAG_100000; if (data->item == ITEM_COIN) { - make_item_entity(ITEM_COIN, entity->position.x, entity->position.y + 28.0, entity->position.z, + make_item_entity(ITEM_COIN, entity->pos.x, entity->pos.y + 28.0, entity->pos.z, ITEM_SPAWN_MODE_ITEM_BLOCK_COIN, 0, angle, data->gameFlagIndex); } else { angle += 360; - make_item_entity(data->item, entity->position.x, entity->position.y + 20.0, entity->position.z, + make_item_entity(data->item, entity->pos.x, entity->pos.y + 20.0, entity->pos.z, (gItemTable[data->item].typeFlags & ITEM_TYPE_FLAG_BADGE) ? ITEM_SPAWN_MODE_ITEM_BLOCK_BADGE : ITEM_SPAWN_MODE_ITEM_BLOCK_ITEM, 0, angle, data->gameFlagIndex); } @@ -84,7 +84,7 @@ void entity_TriggerBlock_start_bound_script_2(Entity* entity) { } void entity_TriggerBlock_play_vanish_effect(Entity* entity) { - TriggerBlockVanishEffect = fx_cold_breath(0, entity->position.x, entity->position.y, entity->position.z, 1.0f, 0x3C); + TriggerBlockVanishEffect = fx_cold_breath(0, entity->pos.x, entity->pos.y, entity->pos.z, 1.0f, 0x3C); } void entity_HitItemBlock_play_anim(Entity* entity) { @@ -119,7 +119,7 @@ void entity_ItemBlock_check_if_inactive(Entity* entity) { } else { bp = &Entity_InertRedBlock; } - create_entity(bp, (s32)entity->position.x, (s32)entity->position.y, (s32)entity->position.z, (s32)entity->rotation.y, MAKE_ENTITY_END); + create_entity(bp, (s32)entity->pos.x, (s32)entity->pos.y, (s32)entity->pos.z, (s32)entity->rot.y, MAKE_ENTITY_END); set_entity_commandlist(entity, D_802EA310); } else { exec_entity_commandlist(entity); @@ -146,7 +146,7 @@ void entity_ItemBlock_replace_with_inactive(Entity* entity) { } // this child entity is the inert block - childEntityIndex = create_entity(bp, (s32)entity->position.x, (s32)entity->position.y, (s32)entity->position.z, (s32)entity->rotation.y, MAKE_ENTITY_END); + childEntityIndex = create_entity(bp, (s32)entity->pos.x, (s32)entity->pos.y, (s32)entity->pos.z, (s32)entity->rot.y, MAKE_ENTITY_END); childEntity = get_entity_by_index(childEntityIndex); childEntity->flags |= ENTITY_FLAG_HIDDEN; @@ -172,7 +172,7 @@ void entity_ItemBlock_replace_with_inactive(Entity* entity) { } // child entity is now the animated block which appears before it turns inert - childEntity = get_entity_by_index(create_entity(bp, (s32)entity->position.x, (s32)entity->position.y, (s32)entity->position.z, (s32)entity->rotation.y, MAKE_ENTITY_END)); + childEntity = get_entity_by_index(create_entity(bp, (s32)entity->pos.x, (s32)entity->pos.y, (s32)entity->pos.z, (s32)entity->rot.y, MAKE_ENTITY_END)); childEntity->alpha = entity->alpha; if ((entity->flags & ENTITY_FLAG_HIDDEN) || (entity->alpha < 255)) { childEntity->alpha = 32; @@ -212,7 +212,7 @@ s32 entity_TriggerBlock_start_bound_script(Entity* entity) { void entity_TriggerBlock_disable_player_input(void) { disable_player_input(); - gPlayerStatus.currentSpeed = 0.0f; + gPlayerStatus.curSpeed = 0.0f; gPlayerStatus.flags |= PS_FLAG_SCRIPTED_FALL; set_action_state(ACTION_STATE_FALLING); gravity_use_fall_parms(); diff --git a/src/entity/SaveBlock.c b/src/entity/SaveBlock.c index 467751b5bb3..05a22ca418b 100644 --- a/src/entity/SaveBlock.c +++ b/src/entity/SaveBlock.c @@ -82,7 +82,7 @@ void entity_SaveBlock_idle(Entity* entity) { void entity_SaveBlock_pause_game(void) { set_time_freeze_mode(TIME_FREEZE_PARTIAL); disable_player_input(); - gPlayerStatusPtr->currentSpeed = 0.0f; + gPlayerStatusPtr->curSpeed = 0.0f; } void entity_SaveBlock_resume_game(void) { @@ -91,9 +91,9 @@ void entity_SaveBlock_resume_game(void) { } void entity_SaveBlock_save_data(void) { - gGameStatusPtr->savedPos.x = gPlayerStatusPtr->position.x; - gGameStatusPtr->savedPos.y = gPlayerStatusPtr->position.y; - gGameStatusPtr->savedPos.z = gPlayerStatusPtr->position.z; + gGameStatusPtr->savedPos.x = gPlayerStatusPtr->pos.x; + gGameStatusPtr->savedPos.y = gPlayerStatusPtr->pos.y; + gGameStatusPtr->savedPos.z = gPlayerStatusPtr->pos.z; fio_save_game(gGameStatusPtr->saveSlot); } @@ -135,7 +135,7 @@ void entity_SaveBlock_wait_for_close_result(Entity* entity) { void entity_SaveBlock_wait_for_close_choice(Entity* entity) { if (SaveBlockTutorialPrinterClosed) { - if (SaveBlockTutorialPrinter->currentOption == 1) { + if (SaveBlockTutorialPrinter->curOption == 1) { set_entity_commandlist(entity, Entity_SaveBlock_ScriptResume); } else { exec_entity_commandlist(entity); diff --git a/src/entity/ShatteringBlock.c b/src/entity/ShatteringBlock.c index 0e7942dd75e..8cb5c902f45 100644 --- a/src/entity/ShatteringBlock.c +++ b/src/entity/ShatteringBlock.c @@ -115,7 +115,7 @@ void entity_shattering_block_init(Entity* entity) { Mtx* fragmentMatrices = NULL; Gfx** fragmentDisplayLists = NULL; - entity->dataBuf.shatteringBlock->originalPosY = entity->position.y; + entity->dataBuf.shatteringBlock->originalPosY = entity->pos.y; type = get_entity_type(entity->listIndex); if (type == ENTITY_TYPE_HAMMER1_BLOCK_TINY || @@ -144,7 +144,7 @@ void entity_shattering_block_init(Entity* entity) { fragmentMatrices = Entity_ShatteringHammer3Block_FragmentsMatrices; break; case ENTITY_TYPE_BRICK_BLOCK: - sfx_play_sound_at_position(SOUND_158, SOUND_SPACE_MODE_0, entity->position.x, entity->position.y, entity->position.z); + sfx_play_sound_at_position(SOUND_158, SOUND_SPACE_MODE_0, entity->pos.x, entity->pos.y, entity->pos.z); fragmentDisplayLists = Entity_ShatteringBrickBlock_FragmentsRender; fragmentMatrices = Entity_ShatteringBrickBlock_FragmentsMatrices; break; @@ -202,5 +202,5 @@ void entity_breakable_block_create_shattering_entity(Entity* entity) { return; } - create_entity(bp, (s32)entity->position.x, (s32)entity->position.y, (s32)entity->position.z, 0, MAKE_ENTITY_END); + create_entity(bp, (s32)entity->pos.x, (s32)entity->pos.y, (s32)entity->pos.z, 0, MAKE_ENTITY_END); } diff --git a/src/entity/ShatteringBlock_common.c b/src/entity/ShatteringBlock_common.c index c144e670105..5ec4f646f53 100644 --- a/src/entity/ShatteringBlock_common.c +++ b/src/entity/ShatteringBlock_common.c @@ -19,8 +19,8 @@ void entity_shattering_init_pieces(Entity* entity, Gfx** dlists, Mtx* matrices) data->fragmentDisplayLists = ENTITY_ADDR(entity, Gfx**, dlists); entity->renderSetupFunc = entity_shattering_setupGfx; entity->alpha = 255; - entity->position.y = data->originalPosY; - guTranslateF(mtxTrans, entity->position.x, entity->position.y, entity->position.z); + entity->pos.y = data->originalPosY; + guTranslateF(mtxTrans, entity->pos.x, entity->pos.y, entity->pos.z); s7 = 2; if (!is_block_on_ground(entity)) { @@ -166,9 +166,9 @@ void entity_shattering_setupGfx(s32 entityIndex) { Gfx* fragmentDlist; Gfx** gfx = data->fragmentDisplayLists; - x_inv = -entity->position.x; - y_inv = -entity->position.y; - z_inv = -entity->position.z; + x_inv = -entity->pos.x; + y_inv = -entity->pos.y; + z_inv = -entity->pos.z; for (i = 0; i < 24; i++) { if (data->alpha == 255) { diff --git a/src/entity/Signpost.c b/src/entity/Signpost.c index ab74287bee1..c0bdc347479 100644 --- a/src/entity/Signpost.c +++ b/src/entity/Signpost.c @@ -6,8 +6,8 @@ extern Gfx Entity_Signpost_Render[]; void entity_Signpost_idle(Entity* entity) { PlayerStatus* playerStatus = &gPlayerStatus; - f32 val = fabsf(clamp_angle(180.0f - entity->rotation.y) - clamp_angle(atan2(entity->position.x, entity->position.z, - playerStatus->position.x, playerStatus->position.z))); + f32 val = fabsf(clamp_angle(180.0f - entity->rot.y) - clamp_angle(atan2(entity->pos.x, entity->pos.z, + playerStatus->pos.x, playerStatus->pos.z))); if (!(playerStatus->animFlags & PA_FLAG_USING_WATT) && !(entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR) && (val <= 40.0f || val >= 320.0f)) { entity->flags |= ENTITY_FLAG_SHOWS_INSPECT_PROMPT; diff --git a/src/entity/SimpleSpring.c b/src/entity/SimpleSpring.c index 92f58a9d8ef..1073adf664d 100644 --- a/src/entity/SimpleSpring.c +++ b/src/entity/SimpleSpring.c @@ -22,7 +22,7 @@ void entity_ScriptSpring_idle(Entity* entity) { set_action_state(ACTION_STATE_USE_SPRING); } exec_entity_commandlist(entity); - sfx_play_sound_at_position(SOUND_2086, SOUND_SPACE_MODE_0, entity->position.x, entity->position.y, entity->position.z); + sfx_play_sound_at_position(SOUND_2086, SOUND_SPACE_MODE_0, entity->pos.x, entity->pos.y, entity->pos.z); } } @@ -31,15 +31,15 @@ void entity_SimpleSpring_idle(Entity* entity) { PlayerStatus* playerStatus = &gPlayerStatus; if (playerStatus->actionState != ACTION_STATE_RIDE && (entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR)) { - if (data->launchVelocity >= 70) { + if (data->launchVel >= 70) { playerStatus->camResetDelay = 5; } play_model_animation(entity->virtualModelIndex, Entity_SimpleSpring_AnimLaunch); entity_start_script(entity); exec_entity_commandlist(entity); - sfx_play_sound_at_position(SOUND_2086, SOUND_SPACE_MODE_0, entity->position.x, entity->position.y, entity->position.z); + sfx_play_sound_at_position(SOUND_2086, SOUND_SPACE_MODE_0, entity->pos.x, entity->pos.y, entity->pos.z); disable_player_input(); - playerStatus->currentSpeed = 0; + playerStatus->curSpeed = 0; } } @@ -49,8 +49,8 @@ void entity_SimpleSpring_set_jump_params(Entity* entity) { set_action_state(ACTION_STATE_LAUNCH); gPlayerStatus.gravityIntegrator[0] = 15.0f; gPlayerStatus.gravityIntegrator[1] = 0; - gPlayerStatus.gravityIntegrator[2] = data->launchVelocity; - gPlayerStatus.gravityIntegrator[3] = entity->position.y; + gPlayerStatus.gravityIntegrator[2] = data->launchVel; + gPlayerStatus.gravityIntegrator[3] = entity->pos.y; } void entity_SimpleSpring_enable_player_input(Entity* ent) { @@ -61,7 +61,7 @@ void entity_ScriptSpring_init(Entity* entity) { } void entity_SimpleSpring_init(Entity* entity) { - entity->dataBuf.simpleSpring->launchVelocity = CreateEntityVarArgBuffer[0]; + entity->dataBuf.simpleSpring->launchVel = CreateEntityVarArgBuffer[0]; } EntityScript Entity_ScriptSpring_Script = { diff --git a/src/entity/SuperBlock.c b/src/entity/SuperBlock.c index e21c3283c5d..4a53ee18223 100644 --- a/src/entity/SuperBlock.c +++ b/src/entity/SuperBlock.c @@ -47,7 +47,7 @@ void entity_upgrade_block_check_if_inactive(Entity* entity) { Entity* childEntity; SuperBlockContentData* childData; - parentData->childEntityIndex = create_entity(&Entity_SuperBlockContent, (s32)entity->position.x, (s32)entity->position.y, (s32)entity->position.z, 0, MAKE_ENTITY_END); + parentData->childEntityIndex = create_entity(&Entity_SuperBlockContent, (s32)entity->pos.x, (s32)entity->pos.y, (s32)entity->pos.z, 0, MAKE_ENTITY_END); childEntity = get_entity_by_index(parentData->childEntityIndex); childData = childEntity->dataBuf.superBlockContent; childData->parentEntityIndex = entity->listIndex; @@ -58,7 +58,7 @@ void entity_upgrade_block_init(Entity* entity) { BlockData* data = entity->dataBuf.block; entity_base_block_init(entity); - entity->rotation.y += 180.0f; + entity->rot.y += 180.0f; data->gameFlagIndex = 0xFFFF; data->childEntityIndex = -1; } @@ -75,9 +75,9 @@ void entity_SuperBlockContent_attach_to_parent(Entity* entity) { SuperBlockContentData* data = entity->dataBuf.superBlockContent; Entity* parentEntity = get_entity_by_index(data->parentEntityIndex); - entity->position.x = parentEntity->position.x; - entity->position.y = parentEntity->position.y + 14.0f; - entity->position.z = parentEntity->position.z; + entity->pos.x = parentEntity->pos.x; + entity->pos.y = parentEntity->pos.y + 14.0f; + entity->pos.z = parentEntity->pos.z; } EntityScript Entity_SuperBlock_Script = { @@ -190,8 +190,8 @@ void entity_SuperBlockContent_idle(Entity* entity) { entity->renderSetupFunc = NULL; } - entity->rotation.y = clamp_angle(entity->rotation.y + 3.0); - data->yawBuffer[data->yawBufferPos] = entity->rotation.y; + entity->rot.y = clamp_angle(entity->rot.y + 3.0); + data->yawBuffer[data->yawBufferPos] = entity->rot.y; data->yawBufferPos++; if (data->yawBufferPos > ARRAY_COUNT(data->yawBuffer)) { @@ -201,7 +201,7 @@ void entity_SuperBlockContent_idle(Entity* entity) { if (!data->isHidden && gOverrideFlags == 0) { if (--data->effectTimer <= 0) { data->effectTimer = 50; - fx_stars_shimmer(3, entity->position.x, entity->position.y, entity->position.z, 22.0f, 8.0f, 4, 20); + fx_stars_shimmer(3, entity->pos.x, entity->pos.y, entity->pos.z, 22.0f, 8.0f, 4, 20); } } } diff --git a/src/entity/Switch.c b/src/entity/Switch.c index f2eaeb845d9..3404ce40a48 100644 --- a/src/entity/Switch.c +++ b/src/entity/Switch.c @@ -30,7 +30,7 @@ void entity_GreenStompSwitch_retract(Entity* entity) { u16 curTime = data->greenMotionTimer--; if (curTime != 0) { - entity->position.y -= 1.8625; + entity->pos.y -= 1.8625; return; } entity_start_script(entity); @@ -43,7 +43,7 @@ void entity_GreenStompSwitch_extend(Entity* entity) { u16 curTime = data->greenMotionTimer--; if (curTime != 0) { - entity->position.y += 1.8625; + entity->pos.y += 1.8625; return; } exec_entity_commandlist(entity); @@ -53,22 +53,22 @@ void entity_GreenStompSwitch_extend(Entity* entity) { void entity_switch_fall_down(Entity* entity) { SwitchData* data = entity->dataBuf.swtch; f32 hitDepth = 10.0f; - f32 x = entity->position.x; - f32 y = entity->position.y; - f32 z = entity->position.z; + f32 x = entity->pos.x; + f32 y = entity->pos.y; + f32 z = entity->pos.z; f32 hitYaw; f32 hitPitch; entity_raycast_down(&x, &y, &z, &hitYaw, &hitPitch, &hitDepth); - if (entity->position.y != y && entity->position.y > y) { - f32 fallVelocity = data->fallVelocity; + if (entity->pos.y != y && entity->pos.y > y) { + f32 fallVelocity = data->fallVel; fallVelocity += 0.5; - data->fallVelocity = fallVelocity; - entity->position.y -= fallVelocity; - if (entity->position.y < y) { - entity->position.y = y; + data->fallVel = fallVelocity; + entity->pos.y -= fallVelocity; + if (entity->pos.y < y) { + entity->pos.y = y; } } } @@ -139,7 +139,7 @@ void entity_RedSwitch_wait_and_reset(Entity* entity) { void entity_base_switch_anim_init(Entity* entity) { SwitchData* data = entity->dataBuf.swtch; - data->fallVelocity = 1.0f; + data->fallVel = 1.0f; data->deltaScaleX = 0.1f; data->deltaScaleY = -0.1f; data->animStateScaleX = 0; @@ -430,7 +430,7 @@ void entity_base_switch_animate_scale(Entity* entity) { data->scaleAnimTimer++; if (data->scaleAnimTimer == 10 && data->linkedSwitch == NULL) { - fx_cold_breath(0, entity->position.x, entity->position.y, entity->position.z, 1.0f, 60); + fx_cold_breath(0, entity->pos.x, entity->pos.y, entity->pos.z, 1.0f, 60); } } diff --git a/src/entity/WoodenCrate.c b/src/entity/WoodenCrate.c index 2846d1d61fe..5496ec7405b 100644 --- a/src/entity/WoodenCrate.c +++ b/src/entity/WoodenCrate.c @@ -21,8 +21,8 @@ void entity_WoodenCrate_init_fragments(Entity* entity, Gfx** dlists, Mtx* matric data->fragmentsGfx = ENTITY_ADDR(entity, Gfx**, dlists); entity->renderSetupFunc = entity_WoodenCrate_setupGfx; entity->alpha = 255; - entity->position.y = data->basePosY; - guTranslateF(mtxTrans, entity->position.x, entity->position.y, entity->position.z); + entity->pos.y = data->basePosY; + guTranslateF(mtxTrans, entity->pos.x, entity->pos.y, entity->pos.z); for (i = 0; i < 35; i++) { guMtxL2F(mtxFragment, ENTITY_ADDR(entity, Mtx*, matrices++)); @@ -35,9 +35,9 @@ void entity_WoodenCrate_init_fragments(Entity* entity, Gfx** dlists, Mtx* matric rotationSpeed = rand_int(5); if (i % 2 != 0) { - data->fragmentRotationSpeed[i] = rotationSpeed + 10; + data->fragmentRotSpeed[i] = rotationSpeed + 10; } else { - data->fragmentRotationSpeed[i] = -10 - rotationSpeed; + data->fragmentRotSpeed[i] = -10 - rotationSpeed; } data->fragmentFallSpeed[i] = 10.0f; @@ -58,7 +58,7 @@ void entity_WoodenCrate_init(Entity* entity) { void entity_WoodenCrate_reset_fragments(Entity* entity) { WoodenCrateData* data = entity->dataBuf.crate; - data->basePosY = entity->position.y; + data->basePosY = entity->pos.y; entity_WoodenCrate_init_fragments(entity, Entity_WoodenCrate_FragmentsRender, Entity_WoodenCrate_FragmentsMatrices); } @@ -79,26 +79,26 @@ void entity_WoodenCrate_update_fragments(Entity* entity) { switch (data->fragmentRebounds[i]) { case 0: reboundSpeed = 2.0f; - rotSpeed = data->fragmentRotationSpeed[i]; + rotSpeed = data->fragmentRotSpeed[i]; lateralSpeed = data->fragmentLateralSpeed[i] / 10.0f; if (rotSpeed >= 0.0f) { - data->fragmentRotationSpeed[i] = rotSpeed - 0.4; + data->fragmentRotSpeed[i] = rotSpeed - 0.4; } else { - data->fragmentRotationSpeed[i] = rotSpeed + 0.5; + data->fragmentRotSpeed[i] = rotSpeed + 0.5; } break; case 1: lateralSpeed = 1.0f; reboundSpeed = 0.0f; - rotSpeed = data->fragmentRotationSpeed[i] * 0.25f; + rotSpeed = data->fragmentRotSpeed[i] * 0.25f; break; case 2: - data->fragmentRotationSpeed[i] += 1.0f; - if (data->fragmentRotationSpeed[i] > 20.0f) { - data->fragmentRotationSpeed[i] = 20.0f; + data->fragmentRotSpeed[i] += 1.0f; + if (data->fragmentRotSpeed[i] > 20.0f) { + data->fragmentRotSpeed[i] = 20.0f; } - data->fragmentPosY[i] -= data->fragmentRotationSpeed[i] / 70.0f; + data->fragmentPosY[i] -= data->fragmentRotSpeed[i] / 70.0f; data->fragmentMoveAngle[i] -= 5; if (data->fragmentMoveAngle[i] <= 5) { @@ -156,7 +156,7 @@ void entity_WoodenCrate_update_fragments(Entity* entity) { data->fragmentFallSpeed[i] = reboundSpeed; if (data->fragmentRebounds[i] == 2) { data->fragmentMoveAngle[i] = 254; - data->fragmentRotationSpeed[i] = 0.0f; + data->fragmentRotSpeed[i] = 0.0f; } } @@ -185,9 +185,9 @@ void entity_WoodenCrate_setupGfx(s32 entityIndex) { Gfx* fragmentDlist; Gfx** gfx = data->fragmentsGfx; - x_inv = -entity->position.x; - y_inv = -entity->position.y; - z_inv = -entity->position.z; + x_inv = -entity->pos.x; + y_inv = -entity->pos.y; + z_inv = -entity->pos.z; for (i = 0; i < 35; i++) { if (data->fragmentRebounds[i] < 2) { @@ -252,7 +252,7 @@ void entity_WoodenCrate_shatter(Entity* entity, f32 arg1) { } if (flag) { - make_item_entity(data->itemID, entity->position.x, entity->position.y + 33.0, entity->position.z, + make_item_entity(data->itemID, entity->pos.x, entity->pos.y + 33.0, entity->pos.z, ITEM_SPAWN_MODE_ITEM_BLOCK_ITEM, 0, player_get_camera_facing_angle(), data->globalFlagIndex); } } diff --git a/src/entity/default/BoardedFloor.c b/src/entity/default/BoardedFloor.c index 01f38d36eec..bfbf9629c6f 100644 --- a/src/entity/default/BoardedFloor.c +++ b/src/entity/default/BoardedFloor.c @@ -18,8 +18,8 @@ void Entity_BoardedFloor_init_fragments(Entity* entity, Gfx** dlists, Mtx* matri data->fragmentsGfx = ENTITY_ADDR(entity, Gfx**, dlists); entity->renderSetupFunc = Entity_BoardedFloor_setupGfx; entity->alpha = 255; - entity->position.y = data->inititalY; - guTranslateF(mtxTrans, entity->position.x, entity->position.y, entity->position.z); + entity->pos.y = data->inititalY; + guTranslateF(mtxTrans, entity->pos.x, entity->pos.y, entity->pos.z); for (i = 0; i < 12; i++) { guMtxL2F(mtxFragment, ENTITY_ADDR(entity, Mtx*, matrices++)); @@ -32,9 +32,9 @@ void Entity_BoardedFloor_init_fragments(Entity* entity, Gfx** dlists, Mtx* matri rotationSpeed = rand_int(5); if (i % 2 != 0) { - data->fragmentRotationSpeed[i] = rotationSpeed + 10; + data->fragmentRotSpeed[i] = rotationSpeed + 10; } else { - data->fragmentRotationSpeed[i] = -10 - rotationSpeed; + data->fragmentRotSpeed[i] = -10 - rotationSpeed; } data->fragmentFallSpeed[i] = 10.0f; @@ -45,7 +45,7 @@ void Entity_BoardedFloor_init_fragments(Entity* entity, Gfx** dlists, Mtx* matri } void Entity_BoardedFloor_init(Entity* entity) { - entity->dataBuf.boardedFloor->inititalY = entity->position.y; + entity->dataBuf.boardedFloor->inititalY = entity->pos.y; Entity_BoardedFloor_init_fragments(entity, Entity_BoardedFloor_FragmentsRender, Entity_BoardedFloor_FragmentMatrices); } @@ -66,26 +66,26 @@ void Entity_BoardedFloor_update_fragments(Entity* entity) { switch (data->fragmentRebounds[i]) { case 0: reboundSpeed = 2.0f; - rotSpeed = data->fragmentRotationSpeed[i]; + rotSpeed = data->fragmentRotSpeed[i]; lateralSpeed = data->fragmentLateralSpeed[i] / 10.0f; if (rotSpeed >= 0.0f) { - data->fragmentRotationSpeed[i] = rotSpeed - 0.4; + data->fragmentRotSpeed[i] = rotSpeed - 0.4; } else { - data->fragmentRotationSpeed[i] = rotSpeed + 0.5; + data->fragmentRotSpeed[i] = rotSpeed + 0.5; } break; case 1: lateralSpeed = 1.0f; reboundSpeed = 0.0f; - rotSpeed = data->fragmentRotationSpeed[i] * 0.25f; + rotSpeed = data->fragmentRotSpeed[i] * 0.25f; break; case 2: - data->fragmentRotationSpeed[i] += 1.0f; - if (data->fragmentRotationSpeed[i] > 20.0f) { - data->fragmentRotationSpeed[i] = 20.0f; + data->fragmentRotSpeed[i] += 1.0f; + if (data->fragmentRotSpeed[i] > 20.0f) { + data->fragmentRotSpeed[i] = 20.0f; } - data->fragmentPosY[i] -= data->fragmentRotationSpeed[i] / 70.0f; + data->fragmentPosY[i] -= data->fragmentRotSpeed[i] / 70.0f; data->fragmentMoveAngle[i] -= 5; if (data->fragmentMoveAngle[i] <= 5) { @@ -143,7 +143,7 @@ void Entity_BoardedFloor_update_fragments(Entity* entity) { data->fragmentFallSpeed[i] = reboundSpeed; if (data->fragmentRebounds[i] == 2) { data->fragmentMoveAngle[i] = 254; - data->fragmentRotationSpeed[i] = 0.0f; + data->fragmentRotSpeed[i] = 0.0f; } } @@ -172,9 +172,9 @@ void Entity_BoardedFloor_setupGfx(s32 entityIndex) { Gfx* fragmentDlist; Gfx** gfx = data->fragmentsGfx; - x_inv = -entity->position.x; - y_inv = -entity->position.y; - z_inv = -entity->position.z; + x_inv = -entity->pos.x; + y_inv = -entity->pos.y; + z_inv = -entity->pos.z; for (i = 0; i < 12; i++) { if (data->fragmentRebounds[i] < 2) { diff --git a/src/entity/default/BombableRock.c b/src/entity/default/BombableRock.c index 761734e8b53..d36b5f6f768 100644 --- a/src/entity/default/BombableRock.c +++ b/src/entity/default/BombableRock.c @@ -21,8 +21,8 @@ void entity_BombableRock_init_fragments(Entity* entity, Gfx** dlists, Mtx* matri data->fragmentsGfx = ENTITY_ADDR(entity, Gfx**, dlists); entity->renderSetupFunc = entity_BombableRock_setupGfx; entity->alpha = 255; - entity->position.y = data->inititalY; - guTranslateF(mtxTrans, entity->position.x, entity->position.y, entity->position.z); + entity->pos.y = data->inititalY; + guTranslateF(mtxTrans, entity->pos.x, entity->pos.y, entity->pos.z); for (i = 0; i < 5; i++) { guMtxL2F(mtxFragment, ENTITY_ADDR(entity, Mtx*, matrices++)); @@ -57,9 +57,9 @@ void entity_BombableRock_init_fragments(Entity* entity, Gfx** dlists, Mtx* matri rotationSpeed = rand_int(5); if (i % 2 != 0) { - data->fragmentRotationSpeed[i] = rotationSpeed + 10; + data->fragmentRotSpeed[i] = rotationSpeed + 10; } else { - data->fragmentRotationSpeed[i] = -10 - rotationSpeed; + data->fragmentRotSpeed[i] = -10 - rotationSpeed; } data->fragmentFallSpeed[i] = 10.0f; @@ -70,7 +70,7 @@ void entity_BombableRock_init_fragments(Entity* entity, Gfx** dlists, Mtx* matri } void entity_BombableRock_init(Entity* entity) { - entity->dataBuf.bombableRock->inititalY = entity->position.y; + entity->dataBuf.bombableRock->inititalY = entity->pos.y; entity_BombableRock_init_fragments(entity, Entity_BombableRock_FragmentsRender, Entity_BombableRock_FragmentMatrices); } @@ -91,26 +91,26 @@ void entity_BombableRock_update_fragments(Entity* entity) { switch (data->fragmentRebounds[i]) { case 0: reboundSpeed = 2.0f; - rotSpeed = data->fragmentRotationSpeed[i]; + rotSpeed = data->fragmentRotSpeed[i]; lateralSpeed = data->fragmentLateralSpeed[i] / 10.0f; if (rotSpeed >= 0.0f) { - data->fragmentRotationSpeed[i] = rotSpeed - 0.4; + data->fragmentRotSpeed[i] = rotSpeed - 0.4; } else { - data->fragmentRotationSpeed[i] = rotSpeed + 0.5; + data->fragmentRotSpeed[i] = rotSpeed + 0.5; } break; case 1: lateralSpeed = 1.0f; reboundSpeed = 0.0f; - rotSpeed = data->fragmentRotationSpeed[i] * 0.25f; + rotSpeed = data->fragmentRotSpeed[i] * 0.25f; break; case 2: - data->fragmentRotationSpeed[i] += 1.0f; - if (data->fragmentRotationSpeed[i] > 20.0f) { - data->fragmentRotationSpeed[i] = 20.0f; + data->fragmentRotSpeed[i] += 1.0f; + if (data->fragmentRotSpeed[i] > 20.0f) { + data->fragmentRotSpeed[i] = 20.0f; } - data->fragmentPosY[i] -= data->fragmentRotationSpeed[i] / 70.0f; + data->fragmentPosY[i] -= data->fragmentRotSpeed[i] / 70.0f; data->fragmentMoveAngle[i] -= 5; if (data->fragmentMoveAngle[i] <= 5) { @@ -168,7 +168,7 @@ void entity_BombableRock_update_fragments(Entity* entity) { data->fragmentFallSpeed[i] = reboundSpeed; if (data->fragmentRebounds[i] == 2) { data->fragmentMoveAngle[i] = 254; - data->fragmentRotationSpeed[i] = 0.0f; + data->fragmentRotSpeed[i] = 0.0f; } } @@ -197,9 +197,9 @@ void entity_BombableRock_setupGfx(s32 entityIndex) { Gfx* fragmentDlist; Gfx** gfx = data->fragmentsGfx; - x_inv = -entity->position.x; - y_inv = -entity->position.y; - z_inv = -entity->position.z; + x_inv = -entity->pos.x; + y_inv = -entity->pos.y; + z_inv = -entity->pos.z; for (i = 0; i < 5; i++) { if (data->fragmentRebounds[i] < 2) { @@ -232,7 +232,7 @@ void entity_BombableRock_idle(Entity* entity) { if (entity->collisionFlags & ENTITY_COLLISION_PARTNER) { entity_start_script(entity); exec_entity_commandlist(entity); - fx_big_smoke_puff(entity->position.x, entity->position.y + 25.0f, entity->position.z); + fx_big_smoke_puff(entity->pos.x, entity->pos.y + 25.0f, entity->pos.z); } } diff --git a/src/entity/default/Padlock.c b/src/entity/default/Padlock.c index b5ac8f5a6b2..57c25d65499 100644 --- a/src/entity/default/Padlock.c +++ b/src/entity/default/Padlock.c @@ -29,17 +29,17 @@ void entity_Padlock_setupGfx(s32 entityIndex) { guMtxL2F(sp98, data->shackleMtx); guMtxCatF(sp58, sp98, sp98); sp98[3][0] += data->shacklePos; - guRotateF(spD8, entity->rotation.x, -1.0f, 0.0f, 0.0f); + guRotateF(spD8, entity->rot.x, -1.0f, 0.0f, 0.0f); guMtxCatF(spD8, sp98, sp98); - guRotateF(spD8, entity->rotation.z, 0.0f, 0.0f, 1.0f); - guRotateF(sp18, entity->rotation.x, 1.0f, 0.0f, 0.0f); + guRotateF(spD8, entity->rot.z, 0.0f, 0.0f, 1.0f); + guRotateF(sp18, entity->rot.x, 1.0f, 0.0f, 0.0f); guMtxCatF(spD8, sp18, sp18); - guRotateF(spD8, entity->rotation.y, 0.0f, 1.0f, 0.0f); + guRotateF(spD8, entity->rot.y, 0.0f, 1.0f, 0.0f); guMtxCatF(sp18, spD8, spD8); guMtxCatF(sp98, spD8, sp98); guScaleF(sp18, entity->scale.x, entity->scale.y, entity->scale.z); guMtxCatF(sp98, sp18, sp18); - guTranslateF(sp58, entity->position.x, entity->position.y, entity->position.z); + guTranslateF(sp58, entity->pos.x, entity->pos.y, entity->pos.z); guMtxCatF(sp18, sp58, sp58); guMtxF2L(sp58, &gDisplayContext->matrixStack[gMatrixListPos]); @@ -53,7 +53,7 @@ void entity_Padlock_push_player(Entity* entity) { PadlockData* data = entity->dataBuf.padlock; f32 deltaX, deltaZ; - if (playerStatus->colliderHeight < fabs(playerStatus->position.y - entity->position.y)) { + if (playerStatus->colliderHeight < fabs(playerStatus->pos.y - entity->pos.y)) { entity->flags |= ENTITY_FLAG_DISABLE_COLLISION; } else { entity->flags &= ~ENTITY_FLAG_DISABLE_COLLISION; @@ -70,11 +70,11 @@ void entity_Padlock_push_player(Entity* entity) { data->pushSpeed = 2.5f; } - deltaX = data->pushSpeed * sin_rad(DEG_TO_RAD(180.0f - entity->rotation.y)); - deltaZ = data->pushSpeed * cos_rad(DEG_TO_RAD(180.0f - entity->rotation.y)); + deltaX = data->pushSpeed * sin_rad(DEG_TO_RAD(180.0f - entity->rot.y)); + deltaZ = data->pushSpeed * cos_rad(DEG_TO_RAD(180.0f - entity->rot.y)); - playerStatus->position.x += deltaX; - playerStatus->position.z -= deltaZ; + playerStatus->pos.x += deltaX; + playerStatus->pos.z -= deltaZ; } else { data->pushSpeed = 0.0f; } @@ -96,39 +96,39 @@ void entity_Padlock_idle(Entity* entity) { if (data->shacklePos >= 20.0f) { data->shacklePos = 20.0f; data->state++; - entity->rotation.z += 12.0; + entity->rot.z += 12.0; data->fallSpeed = -2.0f; - data->rotationSpeed = 0.2f; + data->rotSpeed = 0.2f; } break; case 2: - data->rotationSpeed += 0.2; - entity->rotation.x += data->rotationSpeed; + data->rotSpeed += 0.2; + entity->rot.x += data->rotSpeed; data->fallSpeed -= 1.0; - entity->position.y += data->fallSpeed; + entity->pos.y += data->fallSpeed; - if (entity->position.y <= entity->shadowPosY) { - entity->position.y = entity->shadowPosY; + if (entity->pos.y <= entity->shadowPosY) { + entity->pos.y = entity->shadowPosY; data->fallSpeed = 5.0f; - data->rotationSpeed = 3.0f; + data->rotSpeed = 3.0f; data->state++; - fx_sparkles(FX_SPARKLES_0, entity->position.x, entity->position.y + 25.0f, entity->position.z, 10.0f); + fx_sparkles(FX_SPARKLES_0, entity->pos.x, entity->pos.y + 25.0f, entity->pos.z, 10.0f); entity->flags |= ENTITY_FLAG_DISABLE_COLLISION; } break; case 3: - data->rotationSpeed += 0.2; - entity->rotation.x += data->rotationSpeed; + data->rotSpeed += 0.2; + entity->rot.x += data->rotSpeed; data->fallSpeed -= 2.0; - entity->position.y += data->fallSpeed; + entity->pos.y += data->fallSpeed; - if (entity->position.y <= entity->shadowPosY) { - entity->position.y = entity->shadowPosY; + if (entity->pos.y <= entity->shadowPosY) { + entity->pos.y = entity->shadowPosY; data->timer = 2; data->fallSpeed = 10.0f; - data->rotationSpeed = 0.2f; + data->rotSpeed = 0.2f; data->state++; sfx_play_sound(SOUND_26A); } @@ -139,26 +139,26 @@ void entity_Padlock_idle(Entity* entity) { } break; case 5: - data->rotationSpeed *= 2.0f; - if (data->rotationSpeed > 30.0f) { - data->rotationSpeed = 30.0f; + data->rotSpeed *= 2.0f; + if (data->rotSpeed > 30.0f) { + data->rotSpeed = 30.0f; } - entity->rotation.x += data->rotationSpeed; - if (entity->rotation.x >= 90.0) { - entity->rotation.x = 90.0f; - data->rotationSpeed = -20.0f; + entity->rot.x += data->rotSpeed; + if (entity->rot.x >= 90.0) { + entity->rot.x = 90.0f; + data->rotSpeed = -20.0f; data->state++; sfx_play_sound(SOUND_26A); } break; case 6: - data->rotationSpeed += 10.0f; - if (data->rotationSpeed > 30.0f) { - data->rotationSpeed = 30.0f; + data->rotSpeed += 10.0f; + if (data->rotSpeed > 30.0f) { + data->rotSpeed = 30.0f; } - entity->rotation.x += data->rotationSpeed; - if (entity->rotation.x >= 90.0) { - entity->rotation.x = 90.0f; + entity->rot.x += data->rotSpeed; + if (entity->rot.x >= 90.0) { + entity->rot.x = 90.0f; data->timer = 5; data->state++; sfx_play_sound(SOUND_26A); diff --git a/src/entity/jan_iwa/Plants1.c b/src/entity/jan_iwa/Plants1.c index c8166c42594..d1914095a4f 100644 --- a/src/entity/jan_iwa/Plants1.c +++ b/src/entity/jan_iwa/Plants1.c @@ -36,10 +36,10 @@ void entity_SpinningFlower_setupGfx(s32 entityIndex) { Gfx* gfx; guMtxL2F(sp18, ENTITY_ADDR(entity, Mtx*, &D_0A000B70_E9D470)); - guRotateF(sp58, data->rotation.x, 1.0f, 0.0f, 0.0f); - guRotateF(sp98, data->rotation.z, 0.0f, 0.0f, 1.0f); + guRotateF(sp58, data->rot.x, 1.0f, 0.0f, 0.0f); + guRotateF(sp98, data->rot.z, 0.0f, 0.0f, 1.0f); guMtxCatF(sp58, sp98, sp98); - guRotateF(sp58, data->rotation.y, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, data->rot.y, 0.0f, 1.0f, 0.0f); guMtxCatF(sp98, sp58, sp58); guMtxCatF(sp58, sp18, sp18); guMtxF2L(sp18, &data->unk_30); @@ -77,8 +77,8 @@ void func_802BB0A0_E2D9D0(Entity* entity) { data->unk_18 = 0; data->unk_00 = 0; data->state = 1; - data->rotation.x = 0.0f; - data->rotation.z = 0.0f; + data->rot.x = 0.0f; + data->rot.z = 0.0f; break; case 1: if (!(entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR)) { @@ -97,11 +97,11 @@ void func_802BB0A0_E2D9D0(Entity* entity) { break; } - data->rotation.y = clamp_angle(data->rotation.y + data->spinSpeed); + data->rot.y = clamp_angle(data->rot.y + data->spinSpeed); if (!(entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR) && (playerStatus->animFlags & PA_FLAG_SPINNING) && - fabs(dist2D(entity->position.x, entity->position.z, playerStatus->position.x, playerStatus->position.z)) < 60.0) + fabs(dist2D(entity->pos.x, entity->pos.z, playerStatus->pos.x, playerStatus->pos.z)) < 60.0) { exec_entity_commandlist(entity); } @@ -115,7 +115,7 @@ void func_802BB228_E2DB58(Entity* entity) { if (data->spinSpeed > 40.0f) { data->spinSpeed = 40.0f; } - data->rotation.y = clamp_angle(data->rotation.y + data->spinSpeed); + data->rot.y = clamp_angle(data->rot.y + data->spinSpeed); } void entity_SpinningFlower_init(Entity* entity) { @@ -126,9 +126,9 @@ void entity_SpinningFlower_init(Entity* entity) { y = CreateEntityVarArgBuffer[1]; z = CreateEntityVarArgBuffer[2]; if (!(x | y | z)) { - x = entity->position.x; - y = entity->position.y + 100.0f; - z = entity->position.z; + x = entity->pos.x; + y = entity->pos.y + 100.0f; + z = entity->pos.z; } data->unk_28 = x; @@ -139,7 +139,7 @@ void entity_SpinningFlower_init(Entity* entity) { } void func_802BB314_E2DC44(Entity* entity) { - sfx_play_sound_at_position(SOUND_8000006A, SOUND_SPACE_MODE_0, entity->position.x, entity->position.y, entity->position.z); + sfx_play_sound_at_position(SOUND_8000006A, SOUND_SPACE_MODE_0, entity->pos.x, entity->pos.y, entity->pos.z); } void func_802BB34C_E2DC7C(void) { @@ -155,19 +155,19 @@ void entity_PinkFlowerLight_setupGfx(s32 entityIndex) { Matrix4f sp58; f32 sinAngle, cosAngle; - guRotateF(sp58, entity->rotation.y, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, entity->rot.y, 0.0f, 1.0f, 0.0f); guScaleF(sp18, entity->scale.x, entity->scale.x, entity->scale.x); guMtxCatF(sp18, sp58, sp58); guMtxL2F(sp18, ENTITY_ADDR(entity, Mtx*, &D_0A001098_E9C598)); - sin_cos_rad(DEG_TO_RAD(gCameras[CAM_DEFAULT].currentYaw + 180.0f), &sinAngle, &cosAngle); + sin_cos_rad(DEG_TO_RAD(gCameras[CAM_DEFAULT].curYaw + 180.0f), &sinAngle, &cosAngle); sp18[3][1] += 10.0f; sp18[3][2] -= 10.0f; guMtxCatF(sp58, sp18, sp18); - guRotateF(sp58, entity->rotation.z, 0.0f, 0.0f, 1.0f); + guRotateF(sp58, entity->rot.z, 0.0f, 0.0f, 1.0f); guMtxCatF(sp18, sp58, sp18); guRotateF(sp58, data->initialRotY, 0.0f, 1.0f, 0.0f); guMtxCatF(sp18, sp58, sp18); - guTranslateF(sp58, entity->position.x + 16.0f * sinAngle, entity->position.y , entity->position.z - 16.0f * cosAngle); + guTranslateF(sp58, entity->pos.x + 16.0f * sinAngle, entity->pos.y , entity->pos.z - 16.0f * cosAngle); guMtxCatF(sp18, sp58, sp18); gDPSetCombineMode(gfxPos++, PM_CC_01, PM_CC_02); gDPSetPrimColor(gfxPos++, 0, 0, 0, 0, 0, entity->alpha); @@ -201,12 +201,12 @@ void entity_PinkFlower_init(Entity* entity) { s32 entityIndex; get_animator_by_index(entity->virtualModelIndex)->renderMode = RENDER_MODE_SURFACE_XLU_LAYER1; - entityIndex = create_entity(&Entity_PinkFlowerLight, (s32)entity->position.x, (s32)entity->position.y, (s32)entity->position.z, 0, MAKE_ENTITY_END); + entityIndex = create_entity(&Entity_PinkFlowerLight, (s32)entity->pos.x, (s32)entity->pos.y, (s32)entity->pos.z, 0, MAKE_ENTITY_END); data->linkedEntityIndex = entityIndex; newEntity = get_entity_by_index(entityIndex); data = newEntity->dataBuf.pinkFlower; data->linkedEntityIndex = entity->listIndex; - data->initialRotY = newEntity->rotation.y; + data->initialRotY = newEntity->rot.y; } void entity_PinkFlowerLight_init(Entity* entity) { @@ -222,15 +222,15 @@ void entity_PinkFlowerLight_idle(Entity* entity) { if (data->state != 0) { data->state = 0; data->timer++; - entity->rotation.z = -25.0f; + entity->rot.z = -25.0f; entity->scale.x = 1.8f; entity->alpha = 255; } break; case 1: - entity->rotation.z += 1.0f; - if (entity->rotation.z >= 8.0f) { - entity->rotation.z = 8.0f; + entity->rot.z += 1.0f; + if (entity->rot.z >= 8.0f) { + entity->rot.z = 8.0f; } entity->alpha -= 6; @@ -248,22 +248,22 @@ void entity_PinkFlowerLight_idle(Entity* entity) { break; } - data->initialRotY = get_entity_by_index(data->linkedEntityIndex)->rotation.y; - entity->rotation.y = gCameras[CAM_DEFAULT].currentYaw; + data->initialRotY = get_entity_by_index(data->linkedEntityIndex)->rot.y; + entity->rot.y = gCameras[CAM_DEFAULT].curYaw; } void func_802BB8D4_E2E204(Entity* entity) { CymbalPlantData* data = entity->dataBuf.cymbalPlant; - data->dist = fabs(dist2D(entity->position.x - 2.0f, entity->position.z - 2.0f, gPlayerStatus.position.x, gPlayerStatus.position.z) * 0.25); - data->angle = atan2(gPlayerStatus.position.x, gPlayerStatus.position.z, entity->position.x - 2.0f, entity->position.z - 2.0f); + data->dist = fabs(dist2D(entity->pos.x - 2.0f, entity->pos.z - 2.0f, gPlayerStatus.pos.x, gPlayerStatus.pos.z) * 0.25); + data->angle = atan2(gPlayerStatus.pos.x, gPlayerStatus.pos.z, entity->pos.x - 2.0f, entity->pos.z - 2.0f); } void func_802BB98C_E2E2BC(Entity* entity) { CymbalPlantData* data = entity->dataBuf.cymbalPlant; - gCameras[CAM_DEFAULT].targetPos.x = gPlayerStatus.position.x; - gCameras[CAM_DEFAULT].targetPos.y = gPlayerStatus.position.y; - gCameras[CAM_DEFAULT].targetPos.z = gPlayerStatus.position.z; - add_vec2D_polar(&gPlayerStatus.position.x, &gPlayerStatus.position.z, data->dist, data->angle); + gCameras[CAM_DEFAULT].targetPos.x = gPlayerStatus.pos.x; + gCameras[CAM_DEFAULT].targetPos.y = gPlayerStatus.pos.y; + gCameras[CAM_DEFAULT].targetPos.z = gPlayerStatus.pos.z; + add_vec2D_polar(&gPlayerStatus.pos.x, &gPlayerStatus.pos.z, data->dist, data->angle); } void entity_CymbalPlant_idle(Entity* entity) { diff --git a/src/entity/jan_iwa/Plants2.c b/src/entity/jan_iwa/Plants2.c index 90bab258f4b..0863b30d4c4 100644 --- a/src/entity/jan_iwa/Plants2.c +++ b/src/entity/jan_iwa/Plants2.c @@ -57,10 +57,10 @@ void entity_TrumpetPlant_idle(Entity* entity) { void entity_TrumpetPlant_create_effect(Entity* entity) { f32 xOffset, zOffset, angle; - angle = DEG_TO_RAD(clamp_angle(entity->rotation.y)); + angle = DEG_TO_RAD(clamp_angle(entity->rot.y)); xOffset = -26.0 * cos_rad(angle); zOffset = 6.0 * sin_rad(angle); - fx_stars_burst(0, entity->position.x + xOffset, entity->position.y + 62.0f, entity->position.z + zOffset, clamp_angle(entity->rotation.y - 90.0), 54.0f, 2); + fx_stars_burst(0, entity->pos.x + xOffset, entity->pos.y + 62.0f, entity->pos.z + zOffset, clamp_angle(entity->rot.y - 90.0), 54.0f, 2); } void entity_TrumpetPlant_spawn_coin(Entity* entity) { @@ -70,17 +70,17 @@ void entity_TrumpetPlant_spawn_coin(Entity* entity) { if (data->numCoins < 3) { f32 xOffset, zOffset, angle; - angle = DEG_TO_RAD(clamp_angle(entity->rotation.y)); + angle = DEG_TO_RAD(clamp_angle(entity->rot.y)); xOffset = -26.0 * cos_rad(angle); zOffset = 6.0 * sin_rad(angle); if (rand_int(32) > 16) { - f32 facingAngle = entity->rotation.y - 110.0f + (data->numCoins % 3) * 30; + f32 facingAngle = entity->rot.y - 110.0f + (data->numCoins % 3) * 30; data->numCoins++; make_item_entity(ITEM_COIN, - entity->position.x + xOffset, - entity->position.y + 62.0f, - entity->position.z + zOffset, + entity->pos.x + xOffset, + entity->pos.y + 62.0f, + entity->pos.z + zOffset, ITEM_SPAWN_MODE_TOSS_SPAWN_ALWAYS, 0, facingAngle, 0); } @@ -88,7 +88,7 @@ void entity_TrumpetPlant_spawn_coin(Entity* entity) { } void entity_Munchlesia_init(Entity* entity) { - make_item_entity_nodelay(ITEM_COIN, entity->position.x, entity->position.y + 30.0f, entity->position.z, + make_item_entity_nodelay(ITEM_COIN, entity->pos.x, entity->pos.y + 30.0f, entity->pos.z, ITEM_SPAWN_MODE_FIXED_SPAWN_ALWAYS_NEVER_VANISH, 0); } @@ -113,21 +113,21 @@ void func_802BC0B8_E2E9E8(Entity* entity) { void func_802BC0F0_E2EA20(Entity* entity) { MunchlesiaData* data = entity->dataBuf.munchlesia; - data->unk_18 = fabs(dist2D(entity->position.x, entity->position.z, gPlayerStatus.position.x, gPlayerStatus.position.z) * 0.25); - data->unk_14 = atan2(gPlayerStatus.position.x, gPlayerStatus.position.z, entity->position.x, entity->position.z); + data->unk_18 = fabs(dist2D(entity->pos.x, entity->pos.z, gPlayerStatus.pos.x, gPlayerStatus.pos.z) * 0.25); + data->unk_14 = atan2(gPlayerStatus.pos.x, gPlayerStatus.pos.z, entity->pos.x, entity->pos.z); } void func_802BC17C_E2EAAC(Entity* entity) { MunchlesiaData* data = entity->dataBuf.munchlesia; - gCameras[CAM_DEFAULT].targetPos.x = gPlayerStatus.position.x; - gCameras[CAM_DEFAULT].targetPos.y = gPlayerStatus.position.y; - gCameras[CAM_DEFAULT].targetPos.z = gPlayerStatus.position.z; - add_vec2D_polar(&gPlayerStatus.position.x, &gPlayerStatus.position.z, data->unk_18, data->unk_14); + gCameras[CAM_DEFAULT].targetPos.x = gPlayerStatus.pos.x; + gCameras[CAM_DEFAULT].targetPos.y = gPlayerStatus.pos.y; + gCameras[CAM_DEFAULT].targetPos.z = gPlayerStatus.pos.z; + add_vec2D_polar(&gPlayerStatus.pos.x, &gPlayerStatus.pos.z, data->unk_18, data->unk_14); } s32 entity_Munchlesia_create_child(Entity* entity, EntityBlueprint* EntityBlueprint) { - return create_entity(EntityBlueprint, (s32)entity->position.x, (s32)entity->position.y, (s32)entity->position.z, (s32)entity->rotation.y); + return create_entity(EntityBlueprint, (s32)entity->pos.x, (s32)entity->pos.y, (s32)entity->pos.z, (s32)entity->rot.y); } void func_802BC220_E2EB50(Entity* entity) { @@ -178,13 +178,13 @@ void func_802BC3A0_E2ECD0(void) { void entity_MunchlesiaChewing_init(Entity* entity) { MunchlesiaData* data = entity->dataBuf.munchlesia; - data->unk_0C = gPlayerStatus.position.y; + data->unk_0C = gPlayerStatus.pos.y; data->unk_10 = 0; } void func_802BC3E4_E2ED14(Entity* entity) { MunchlesiaData* data = entity->dataBuf.munchlesia; - gPlayerStatus.position.y = data->unk_0C + (sin_rad(DEG_TO_RAD(data->unk_10)) * 3.0f); + gPlayerStatus.pos.y = data->unk_0C + (sin_rad(DEG_TO_RAD(data->unk_10)) * 3.0f); data->unk_10 += 24.0f; if (data->unk_10 > 360.0f) { diff --git a/src/entity/sbk_omo/StarBoxLauncher.c b/src/entity/sbk_omo/StarBoxLauncher.c index 41d57725bf0..90393d8b2f7 100644 --- a/src/entity/sbk_omo/StarBoxLauncher.c +++ b/src/entity/sbk_omo/StarBoxLauncher.c @@ -37,7 +37,7 @@ void entity_StarBoxLauncher_setupGfx(s32 entityIndex) { Matrix4f sp50; guMtxIdentF(sp10); - guTranslateF(sp50, entity->position.x, data->basePosY, entity->position.z); + guTranslateF(sp50, entity->pos.x, data->basePosY, entity->pos.z); guMtxCatF(sp50, sp10, sp50); guMtxF2L(sp50, &gDisplayContext->matrixStack[gMatrixListPos]); gSPMatrix(gfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -60,7 +60,7 @@ void entity_StarBoxLauncher_setupGfx(s32 entityIndex) { } void entity_StarBoxLauncher_check_launch(Entity* entity) { - u16 currentFloor = gCollisionStatus.currentFloor; + u16 currentFloor = gCollisionStatus.curFloor; StarBoxLauncherData* data = entity->dataBuf.starBoxLauncher; PlayerStatus* playerStatus = &gPlayerStatus; s32 actionState = playerStatus->actionState; @@ -68,9 +68,9 @@ void entity_StarBoxLauncher_check_launch(Entity* entity) { s32 result = 0; if ((currentFloor & COLLISION_WITH_ENTITY_BIT) && (currentFloor & 0xFF) == entity->listIndex && actionState == ACTION_STATE_HAMMER) { - x = playerStatus->position.x; - y = playerStatus->position.y + 5.0f; - z = playerStatus->position.z; + x = playerStatus->pos.x; + y = playerStatus->pos.y + 5.0f; + z = playerStatus->pos.z; hitDepth = 10.0f; add_vec2D_polar(&x, &z, 10.0f, func_800E5348()); @@ -87,11 +87,11 @@ void entity_StarBoxLauncher_check_launch(Entity* entity) { if (result != 0) { data->flags &= ~1; - fx_damage_stars(3, entity->position.x, entity->position.y + 35.0f, entity->position.z, 0, -1.0f, 0, 3); + fx_damage_stars(3, entity->pos.x, entity->pos.y + 35.0f, entity->pos.z, 0, -1.0f, 0, 3); if (result > 0) { data->flags |= 1; } - entity->position.y -= 2.0f; + entity->pos.y -= 2.0f; exec_entity_commandlist(entity); data->timer = 4; disable_player_static_collisions(); @@ -116,14 +116,14 @@ void entity_StarBoxLauncher_update_face_anim(Entity* entity) { void entity_StarBoxLauncher_shake_box(Entity* entity) { StarBoxLauncherData* data = entity->dataBuf.starBoxLauncher; - entity->position.x = data->basePosX + (data->timer & 1 ? 1.0f : -1.0f); + entity->pos.x = data->basePosX + (data->timer & 1 ? 1.0f : -1.0f); data->timer--; } void entity_StarBoxLauncher_restore_pos(Entity* entity) { StarBoxLauncherData* data = entity->dataBuf.starBoxLauncher; - entity->position.x = data->basePosX; - entity->position.z = data->basePosZ; + entity->pos.x = data->basePosX; + entity->pos.z = data->basePosZ; } void entity_StarBoxLauncher_launch(Entity* entity) { @@ -141,67 +141,67 @@ void entity_StarBoxLauncher_launch(Entity* entity) { sfx_play_sound(SOUND_2085); // fallthrough case 1: - temp = entity->position.y; - entity->position.y = temp + 8.0 * sin_rad(DEG_TO_RAD(data->riseSpeedPhase)); + temp = entity->pos.y; + entity->pos.y = temp + 8.0 * sin_rad(DEG_TO_RAD(data->riseSpeedPhase)); data->riseSpeedPhase += 2.0f; if (data->riseSpeedPhase >= 180.0f) { data->riseSpeedPhase = 180.0f; } - if (entity->position.y > data->basePosY + 50.0f) { - entity->position.y = data->basePosY + 50.0f; - data->maxRotationZ = 2.0f; + if (entity->pos.y > data->basePosY + 50.0f) { + entity->pos.y = data->basePosY + 50.0f; + data->maxRotZ = 2.0f; data->state++; - data->riseVelocity = 3.0f; - data->rotationZPhase = 90.0f; + data->riseVel = 3.0f; + data->rotZPhase = 90.0f; } break; case 2: - entity->rotation.z = data->maxRotationZ * sin_rad(DEG_TO_RAD(data->rotationZPhase)); - clamp_angle(entity->rotation.z); - data->rotationZPhase += 30.0f; - if (data->rotationZPhase >= 360.0f) { - data->rotationZPhase -= 360.0f; + entity->rot.z = data->maxRotZ * sin_rad(DEG_TO_RAD(data->rotZPhase)); + clamp_angle(entity->rot.z); + data->rotZPhase += 30.0f; + if (data->rotZPhase >= 360.0f) { + data->rotZPhase -= 360.0f; } - entity->position.y += data->riseVelocity * cos_rad(DEG_TO_RAD(data->riseSpeedPhase)); + entity->pos.y += data->riseVel * cos_rad(DEG_TO_RAD(data->riseSpeedPhase)); data->riseSpeedPhase += 30.0f; if (data->riseSpeedPhase >= 360.0f) { data->riseSpeedPhase -= 360.0f; } - data->riseVelocity -= 0.08; - if (data->riseVelocity < 2.8) { + data->riseVel -= 0.08; + if (data->riseVel < 2.8) { data->state++; } break; case 3: - data->maxRotationZ -= 0.1; - if (data->maxRotationZ <= 0.0f) { - data->maxRotationZ = 0.0f; + data->maxRotZ -= 0.1; + if (data->maxRotZ <= 0.0f) { + data->maxRotZ = 0.0f; } - entity->rotation.z = data->maxRotationZ * sin_rad(DEG_TO_RAD(data->rotationZPhase)); - clamp_angle(entity->rotation.z); - data->rotationZPhase += 30.0f; - if (data->rotationZPhase >= 360.0f) { - data->rotationZPhase -= 360.0f; + entity->rot.z = data->maxRotZ * sin_rad(DEG_TO_RAD(data->rotZPhase)); + clamp_angle(entity->rot.z); + data->rotZPhase += 30.0f; + if (data->rotZPhase >= 360.0f) { + data->rotZPhase -= 360.0f; } entity_StarBoxLauncher_update_face_anim(entity); - entity->position.y += data->riseVelocity * cos_rad(DEG_TO_RAD(data->riseSpeedPhase)); + entity->pos.y += data->riseVel * cos_rad(DEG_TO_RAD(data->riseSpeedPhase)); data->riseSpeedPhase += 30.0f; if (data->riseSpeedPhase >= 360.0f) { data->riseSpeedPhase -= 360.0f; } - data->riseVelocity -= 0.08; - if (data->riseVelocity <= 0.0f) { - data->riseVelocity = 0.0f; + data->riseVel -= 0.08; + if (data->riseVel <= 0.0f) { + data->riseVel = 0.0f; data->timer = 8; data->state++; - entity->rotation.z = 0.0f; + entity->rot.z = 0.0f; } break; case 4: @@ -210,9 +210,9 @@ void entity_StarBoxLauncher_launch(Entity* entity) { } break; case 5: - entity->position.y -= 8.0f; - if (entity->position.y <= data->basePosY) { - entity->position.y = data->basePosY; + entity->pos.y -= 8.0f; + if (entity->pos.y <= data->basePosY) { + entity->pos.y = data->basePosY; data->state++; } break; @@ -240,9 +240,9 @@ void entity_StarBoxLauncher_start_script(Entity* entity) { void entity_StarBoxLauncher_init(Entity* entity) { StarBoxLauncherData* data = entity->dataBuf.starBoxLauncher; entity->renderSetupFunc = entity_StarBoxLauncher_setupGfx; - data->basePosX = entity->position.x; - data->basePosY = entity->position.y; - data->basePosZ = entity->position.z; + data->basePosX = entity->pos.x; + data->basePosY = entity->pos.y; + data->basePosZ = entity->pos.z; } EntityScript Entity_StarBoxLauncher_Script = { diff --git a/src/entity/sbk_omo/Tweester.c b/src/entity/sbk_omo/Tweester.c index 5b7524ce013..ffac563cdf8 100644 --- a/src/entity/sbk_omo/Tweester.c +++ b/src/entity/sbk_omo/Tweester.c @@ -129,8 +129,8 @@ void entity_Tweester_update_face_anim(Entity* entity) { s32 entity_Tweester_has_reached_target(Entity* entity) { TweesterData* data = entity->dataBuf.tweester; s32 count = 0; - f32 deltaX = fabsf(data->targetX - entity->position.x); - f32 deltaZ = fabsf(data->targetZ - entity->position.z); + f32 deltaX = fabsf(data->targetX - entity->pos.x); + f32 deltaZ = fabsf(data->targetZ - entity->pos.z); if (deltaX <= 10.0f) { count++; @@ -157,14 +157,14 @@ void entity_Tweester_select_target_point(Entity* entity) { } j = rand_int(i * 10 - 1) / 10; paths = data->paths; - data->currentPath = paths[j]; + data->curPath = paths[j]; } - pathPtr = &data->currentPath[pathOffset]; + pathPtr = &data->curPath[pathOffset]; if (*pathPtr != TWEESTER_PATH_STOP) { pathOffset += 3; if (*pathPtr == TWEESTER_PATH_LOOP){ pathOffset = 0; - pathPtr = data->currentPath; + pathPtr = data->curPath; data->targetX = *pathPtr++; data->targetY = *pathPtr++; data->targetZ = *pathPtr++; @@ -181,7 +181,7 @@ void entity_Tweester_move(Entity* entity) { TweesterData* data = entity->dataBuf.tweester; f32 yawRad; - f32 temp_f4 = (atan2(entity->position.x, entity->position.z, data->targetX, data->targetZ) - data->yaw) * 0.03125f; + f32 temp_f4 = (atan2(entity->pos.x, entity->pos.z, data->targetX, data->targetZ) - data->yaw) * 0.03125f; if (temp_f4 >= 0.0f && temp_f4 < 0.01) { temp_f4 = 0.01f; } @@ -191,8 +191,8 @@ void entity_Tweester_move(Entity* entity) { data->yaw = clamp_angle(data->yaw + temp_f4); yawRad = DEG_TO_RAD(data->yaw); - entity->position.x += sin_rad(yawRad); - entity->position.z -= cos_rad(yawRad); + entity->pos.x += sin_rad(yawRad); + entity->pos.z -= cos_rad(yawRad); if (entity_Tweester_has_reached_target(entity)) { entity_Tweester_select_target_point(entity); @@ -210,7 +210,7 @@ void entity_Tweester_idle(Entity* entity) { if (get_time_freeze_mode() == TIME_FREEZE_NORMAL && !is_picking_up_item() && !(playerStatus->flags & PS_FLAG_PAUSED) && - (playerData->currentPartner != PARTNER_GOOMBARIO || + (playerData->curPartner != PARTNER_GOOMBARIO || playerStatus->inputDisabledCount == 0 || playerStatus->actionState == ACTION_STATE_USE_TWEESTER )) { @@ -222,28 +222,28 @@ void entity_Tweester_idle(Entity* entity) { if (data->frameCounter < 100) { targetRotationSpeed = 3.5f; - delta = (targetRotationSpeed - data->rotationSpeed) / 28.0f; + delta = (targetRotationSpeed - data->rotSpeed) / 28.0f; if (delta < 0.02) { delta = 0.02f; } - data->rotationSpeed += delta; - if (data->rotationSpeed >= targetRotationSpeed){ - data->rotationSpeed = targetRotationSpeed; + data->rotSpeed += delta; + if (data->rotSpeed >= targetRotationSpeed){ + data->rotSpeed = targetRotationSpeed; } } else { targetRotationSpeed = 1.3f; - delta = (targetRotationSpeed - data->rotationSpeed) * 0.0625f; + delta = (targetRotationSpeed - data->rotSpeed) * 0.0625f; if (delta > -0.02) { delta = -0.02f; } - data->rotationSpeed += delta; - if (data->rotationSpeed <= targetRotationSpeed){ - data->rotationSpeed = targetRotationSpeed; + data->rotSpeed += delta; + if (data->rotSpeed <= targetRotationSpeed){ + data->rotSpeed = targetRotationSpeed; data->frameCounter = 0; } } - data->innerWhirlRotY += data->rotationSpeed; + data->innerWhirlRotY += data->rotSpeed; if (data->innerWhirlRotY > 360.0f) { data->innerWhirlRotY = 0.0f; } @@ -263,11 +263,11 @@ void entity_Tweester_idle(Entity* entity) { data->outerWhirlTexOffsetX += 4; data->outerWhirlTexOffsetY -= 16; - entity->rotation.y = -gCameras[CAM_DEFAULT].currentYaw; + entity->rot.y = -gCameras[CAM_DEFAULT].curYaw; if (partnerStatus->partnerActionState == PARTNER_ACTION_NONE || partnerStatus->actingPartner != PARTNER_BOW) { if (playerStatus->actionState == ACTION_STATE_USE_TWEESTER) { - Npc* npc = npc_find_closest_simple(entity->position.x, entity->position.y, entity->position.z, 50.0f); + Npc* npc = npc_find_closest_simple(entity->pos.x, entity->pos.y, entity->pos.z, 50.0f); if (npc != NULL && (npc->flags & NPC_FLAG_PARTNER)) { TweesterTouchingPartner = entity; } @@ -277,7 +277,7 @@ void entity_Tweester_idle(Entity* entity) { !(playerStatus->flags & PS_FLAG_PAUSED) && playerStatus->actionState != ACTION_STATE_USE_TWEESTER && playerStatus->blinkTimer == 0 && - fabs(dist2D(entity->position.x, entity->position.z, playerStatus->position.x, playerStatus->position.z)) <= 50.0 + fabs(dist2D(entity->pos.x, entity->pos.z, playerStatus->pos.x, playerStatus->pos.z)) <= 50.0 ) { TweesterTouchingPlayer = entity; playerStatus->animFlags |= PA_FLAG_INTERRUPT_USE_PARTNER; diff --git a/src/entity_model.c b/src/entity_model.c index 08509a28dd6..224c9cc8a2d 100644 --- a/src/entity_model.c +++ b/src/entity_model.c @@ -437,7 +437,7 @@ void draw_entity_model_A(s32 modelIdx, Mtx* transformMtx) { rtPtr->renderMode = model->renderMode; rtPtr->appendGfxArg = model; rtPtr->appendGfx = (void(*)(void*))appendGfx_entity_model; - rtPtr->distance = ((u32)(model->flags & 0xF000) >> 8) + inZ; + rtPtr->dist = ((u32)(model->flags & 0xF000) >> 8) + inZ; queue_render_task(rtPtr); } } @@ -476,7 +476,7 @@ void draw_entity_model_B(s32 modelIdx, Mtx* transformMtx, s32 vertexSegment, Vec rtPtr->renderMode = model->renderMode; rtPtr->appendGfxArg = model; rtPtr->appendGfx = (void(*)(void*))appendGfx_entity_model; - rtPtr->distance = ((u32)(model->flags & 0xF000) >> 8) + inZ; + rtPtr->dist = ((u32)(model->flags & 0xF000) >> 8) + inZ; queue_render_task(rtPtr); } } @@ -506,7 +506,7 @@ void draw_entity_model_C(s32 modelIdx, Mtx* transformMtx) { rtPtr->renderMode = model->renderMode; rtPtr->appendGfxArg = model; rtPtr->appendGfx = (void(*)(void*))appendGfx_entity_model; - rtPtr->distance = (u32)(model->flags & 0xF000) >> 8; + rtPtr->dist = (u32)(model->flags & 0xF000) >> 8; queue_render_task(rtPtr); } } @@ -537,7 +537,7 @@ void draw_entity_model_D(s32 modelIdx, Mtx* transformMtx, s32 arg2, Vec3s* verte rtPtr->renderMode = model->renderMode; rtPtr->appendGfxArg = model; rtPtr->appendGfx = (void(*)(void*))appendGfx_entity_model; - rtPtr->distance = (u32)(model->flags & 0xF000) >> 8; + rtPtr->dist = (u32)(model->flags & 0xF000) >> 8; queue_render_task(rtPtr); } } diff --git a/src/evt/cam_api.c b/src/evt/cam_api.c index e623ba1595e..ae765725426 100644 --- a/src/evt/cam_api.c +++ b/src/evt/cam_api.c @@ -82,8 +82,8 @@ ApiStatus func_802CA988(Evt* script, s32 isInitialCall) { gCameras[id].updateMode = CAM_UPDATE_MODE_2; gCameras[id].needsInit = FALSE; - gCameras[id].auxPitch = -round(gCameras[id].currentPitch); - gCameras[id].auxBoomLength = -gCameras[id].currentBlendedYawNegated; + gCameras[id].auxPitch = -round(gCameras[id].curPitch); + gCameras[id].auxBoomLength = -gCameras[id].curBlendedYawNegated; dx = gCameras[id].lookAt_obj.x - gCameras[id].lookAt_eye.x; dy = gCameras[id].lookAt_obj.y - gCameras[id].lookAt_eye.y; @@ -663,9 +663,9 @@ ApiStatus AdjustCam(Evt* script, s32 isInitialCall) { if (isInitialCall) { hitDepth = 32767.0f; - posX = playerStatus->position.x; - posY = playerStatus->position.y; - posZ = playerStatus->position.z; + posX = playerStatus->pos.x; + posY = playerStatus->pos.y; + posZ = playerStatus->pos.z; zoneID = test_ray_zones(posX, posY + 10.0f, posZ, 0.0f, -1.0f, 0.0f, &hitX, &hitY, &hitZ, &hitDepth, &nX, &nY, &nZ); if (zoneID >= 0) { camera->controlSettings = *gZoneCollisionData.colliderList[zoneID].camSettings; @@ -699,9 +699,9 @@ ApiStatus ResetCam(Evt* script, s32 isInitialCall) { PlayerStatus* playerStatus = &gPlayerStatus; if (isInitialCall) { - f32 x = playerStatus->position.x; - f32 y = playerStatus->position.y; - f32 z = playerStatus->position.z; + f32 x = playerStatus->pos.x; + f32 y = playerStatus->pos.y; + f32 z = playerStatus->pos.z; f32 hitX, hitY, hitZ; f32 hitDepth = 32767.0f; f32 nx, ny, nz; diff --git a/src/evt/evt.c b/src/evt/evt.c index d7041d35975..139a1bfe552 100644 --- a/src/evt/evt.c +++ b/src/evt/evt.c @@ -908,7 +908,7 @@ ApiStatus evt_handle_call(Evt* script) { } else { script->callFunction = (ApiFunc)evt_get_variable(script, *args++); script->ptrReadPos = args; - script->currentArgc--; + script->curArgc--; script->blocked = TRUE; isInitialCall = TRUE; func = script->callFunction; @@ -976,7 +976,7 @@ ApiStatus evt_handle_exec_wait(Evt* script) { Bytecode* args = script->ptrReadPos; start_child_script(script, (EvtScript*) evt_get_variable(script, *args++), 0); - script->currentOpcode = EVT_OP_INTERNAL_FETCH; + script->curOpcode = EVT_OP_INTERNAL_FETCH; return ApiStatus_FINISH; } @@ -1371,15 +1371,15 @@ s32 evt_execute_next_command(Evt* script) { s32* lines; s32 nargs; - switch (script->currentOpcode) { + switch (script->curOpcode) { case EVT_OP_INTERNAL_FETCH: - script->ptrCurrentLine = script->ptrNextLine; + script->ptrCurLine = script->ptrNextLine; lines = script->ptrNextLine; - script->currentOpcode = *lines++; + script->curOpcode = *lines++; nargs = *lines++; script->ptrReadPos = lines; script->blocked = FALSE; - script->currentArgc = nargs; + script->curArgc = nargs; lines = &lines[nargs]; script->ptrNextLine = lines; status = ApiStatus_REPEAT; @@ -1684,10 +1684,10 @@ s32 evt_execute_next_command(Evt* script) { if (status == ApiStatus_BLOCK) { // return 0 } else if (status == ApiStatus_DONE1) { - script->currentOpcode = EVT_OP_INTERNAL_FETCH; + script->curOpcode = EVT_OP_INTERNAL_FETCH; // return 0 } else if (status == ApiStatus_DONE2) { - script->currentOpcode = EVT_OP_INTERNAL_FETCH; + script->curOpcode = EVT_OP_INTERNAL_FETCH; if (gGameStatusPtr->disableScripts != status) { continue; } diff --git a/src/evt/f8f60_len_1560.c b/src/evt/f8f60_len_1560.c index 7476907b067..00ec8ce94fc 100644 --- a/src/evt/f8f60_len_1560.c +++ b/src/evt/f8f60_len_1560.c @@ -65,7 +65,7 @@ ApiStatus GetAngleToNPC(Evt* script, s32 isInitialCall) { Bytecode outVar = *args++; Npc* npc = resolve_npc(script, npcID); - evt_set_variable(script, outVar, atan2(playerStatus->position.x, playerStatus->position.z, npc->pos.x, npc->pos.z)); + evt_set_variable(script, outVar, atan2(playerStatus->pos.x, playerStatus->pos.z, npc->pos.x, npc->pos.z)); return ApiStatus_DONE2; } @@ -78,7 +78,7 @@ ApiStatus GetAngleToPlayer(Evt* script, s32 isInitialCall) { Bytecode outVar = *args++; Npc* npc = resolve_npc(script, npcID); - evt_set_variable(script, outVar, atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z)); + evt_set_variable(script, outVar, atan2(npc->pos.x, npc->pos.z, playerStatus->pos.x, playerStatus->pos.z)); return ApiStatus_DONE2; } @@ -100,7 +100,7 @@ ApiStatus AwaitPlayerApproach(Evt* script, s32 isInitialCall) { } distance = dist2D( - playerStatus->position.x, playerStatus->position.z, + playerStatus->pos.x, playerStatus->pos.z, *targetX, *targetZ ); @@ -130,7 +130,7 @@ ApiStatus IsPlayerWithin(Evt* script, s32 isInitialCall) { } distance = dist2D( - playerStatus->position.x, playerStatus->position.z, + playerStatus->pos.x, playerStatus->pos.z, *targetX, *targetZ ); @@ -159,7 +159,7 @@ ApiStatus AwaitPlayerLeave(Evt* script, s32 isInitialCall) { } distance = dist2D( - playerStatus->position.x, playerStatus->position.z, + playerStatus->pos.x, playerStatus->pos.z, *targetX, *targetZ ); diff --git a/src/evt/fa4c0_len_3bf0.c b/src/evt/fa4c0_len_3bf0.c index c2ff5b1349c..13d05cd0c90 100644 --- a/src/evt/fa4c0_len_3bf0.c +++ b/src/evt/fa4c0_len_3bf0.c @@ -709,9 +709,9 @@ ApiStatus SetItemPos(Evt* script, s32 isInitialCall) { z = evt_get_variable(script, *args++); ptrItemEntity = (ItemEntity*) get_item_entity(itemEntityIndex); - ptrItemEntity->position.x = x; - ptrItemEntity->position.y = y; - ptrItemEntity->position.z = z; + ptrItemEntity->pos.x = x; + ptrItemEntity->pos.y = y; + ptrItemEntity->pos.z = z; return ApiStatus_DONE2; } diff --git a/src/evt/fx_api.c b/src/evt/fx_api.c index 1046ad3f311..ca6a15a4ff7 100644 --- a/src/evt/fx_api.c +++ b/src/evt/fx_api.c @@ -225,9 +225,9 @@ ApiStatus ShowSweat(Evt* script, s32 isInitialCall) { switch (emoterType) { case EMOTER_PLAYER: - x = gPlayerStatus.position.x; - y = gPlayerStatus.position.y + (gPlayerStatus.colliderHeight * 2) / 3; - z = gPlayerStatus.position.z; + x = gPlayerStatus.pos.x; + y = gPlayerStatus.pos.y + (gPlayerStatus.colliderHeight * 2) / 3; + z = gPlayerStatus.pos.z; r = gPlayerStatus.colliderHeight / 3; break; case EMOTER_NPC: @@ -270,9 +270,9 @@ ApiStatus ShowSleepBubble(Evt* script, s32 isInitialCall) { switch (emoterType) { case EMOTER_PLAYER: - x = gPlayerStatus.position.x; - y = gPlayerStatus.position.y + (gPlayerStatus.colliderHeight * 2) / 3; - z = gPlayerStatus.position.z; + x = gPlayerStatus.pos.x; + y = gPlayerStatus.pos.y + (gPlayerStatus.colliderHeight * 2) / 3; + z = gPlayerStatus.pos.z; r = gPlayerStatus.colliderHeight / 3; break; case EMOTER_NPC: diff --git a/src/evt/map_api.c b/src/evt/map_api.c index 4d051af6e14..1d49fc63e4a 100644 --- a/src/evt/map_api.c +++ b/src/evt/map_api.c @@ -590,10 +590,10 @@ ApiStatus ResetFromLava(Evt* script, s32 isInitialCall) { LastSafeFloor = -1; } - if (!(collisionStatus->currentFloor & COLLISION_WITH_ENTITY_BIT)) { - collider = &gCollisionData.colliderList[collisionStatus->currentFloor]; + if (!(collisionStatus->curFloor & COLLISION_WITH_ENTITY_BIT)) { + collider = &gCollisionData.colliderList[collisionStatus->curFloor]; if (collider->flags & COLLIDER_FLAG_SAFE_FLOOR) { - LastSafeFloor = collisionStatus->currentFloor; + LastSafeFloor = collisionStatus->curFloor; return ApiStatus_BLOCK; } } diff --git a/src/evt/model_api.c b/src/evt/model_api.c index bf0d3944d34..ae9052ce300 100644 --- a/src/evt/model_api.c +++ b/src/evt/model_api.c @@ -77,7 +77,7 @@ ApiStatus LoadAnimatedModel(Evt* script, s32 isInitialCall) { animModel->scale.x = 1.0f; animModel->scale.y = 1.0f; animModel->scale.z = 1.0f; - animModel->currentAnimData = NULL; + animModel->curAnimData = NULL; guMtxIdent(&animModel->mtx); return ApiStatus_DONE2; @@ -101,7 +101,7 @@ ApiStatus LoadAnimatedMesh(Evt* script, s32 isInitialCall) { animModel->scale.x = 1.0f; animModel->scale.y = 1.0f; animModel->scale.z = 1.0f; - animModel->currentAnimData = NULL; + animModel->curAnimData = NULL; guMtxIdent(&animModel->mtx); return ApiStatus_DONE2; @@ -113,7 +113,7 @@ ApiStatus PlayModelAnimation(Evt* script, s32 isInitialCall) { s16* var2 = (s16*) evt_get_variable(script, *args++); AnimatedModel* model = (*gCurrentMeshAnimationListPtr)[index]; - model->currentAnimData = var2; + model->curAnimData = var2; play_model_animation(model->animModelID, var2); return ApiStatus_DONE2; @@ -126,7 +126,7 @@ ApiStatus PlayModelAnimationStartingFrom(Evt* script, s32 isInitialCall) { s32 var3 = evt_get_variable(script, *args++); AnimatedModel* model = (*gCurrentMeshAnimationListPtr)[index]; - model->currentAnimData = var2; + model->curAnimData = var2; play_model_animation_starting_from(model->animModelID, var2, var3); return ApiStatus_DONE2; @@ -138,11 +138,11 @@ ApiStatus ChangeModelAnimation(Evt* script, s32 isInitialCall) { s16* var2 = (s16*) evt_get_variable(script, *args++); AnimatedModel* model = (*gCurrentMeshAnimationListPtr)[index]; - if (model->currentAnimData == var2) { + if (model->curAnimData == var2) { return ApiStatus_DONE2; } - model->currentAnimData = var2; + model->curAnimData = var2; play_model_animation(model->animModelID, var2); return ApiStatus_DONE2; } @@ -312,9 +312,9 @@ ApiStatus GetAnimatedNodeRotation(Evt* script, s32 isInitialCall) { AnimatedModel* model = (*gCurrentMeshAnimationListPtr)[listIndex]; AnimatorNode* node = get_animator_node_with_id(get_animator_by_index(model->animModelID), treeIndex); - evt_set_variable(script, outX, node->rotation.x); - evt_set_variable(script, outY, node->rotation.y); - evt_set_variable(script, outZ, node->rotation.z); + evt_set_variable(script, outX, node->rot.x); + evt_set_variable(script, outY, node->rot.y); + evt_set_variable(script, outZ, node->rot.z); return ApiStatus_DONE2; } @@ -348,9 +348,9 @@ ApiStatus GetAnimatedRotationByTreeIndex(Evt* script, s32 isInitialCall) { AnimatedModel* model = (*gCurrentMeshAnimationListPtr)[listIndex]; AnimatorNode* node = get_animator_node_for_tree_index(get_animator_by_index(model->animModelID), treeIndex); - evt_set_variable(script, outX, node->rotation.x); - evt_set_variable(script, outY, node->rotation.y); - evt_set_variable(script, outZ, node->rotation.z); + evt_set_variable(script, outX, node->rot.x); + evt_set_variable(script, outY, node->rot.y); + evt_set_variable(script, outZ, node->rot.z); return ApiStatus_DONE2; } diff --git a/src/evt/msg_api.c b/src/evt/msg_api.c index 4e4c3301b62..0c8b89803ed 100644 --- a/src/evt/msg_api.c +++ b/src/evt/msg_api.c @@ -85,8 +85,8 @@ s32 _show_message(Evt* script, s32 isInitialCall, s32 mode) { } if (speakerNpcID == NPC_PLAYER) { - get_screen_coords(gCurrentCameraID, playerStatus->position.x, - playerStatus->position.y + playerStatus->colliderHeight, playerStatus->position.z, + get_screen_coords(gCurrentCameraID, playerStatus->pos.x, + playerStatus->pos.y + playerStatus->colliderHeight, playerStatus->pos.z, &screenX, &screenY, &screenZ); script->functionTemp[3] = playerStatus->anim; speakerNpc = (Npc*) NPC_PLAYER; @@ -95,7 +95,7 @@ s32 _show_message(Evt* script, s32 isInitialCall, s32 mode) { speakerNpc = resolve_npc(script, speakerNpcID); get_screen_coords(gCurrentCameraID, speakerNpc->pos.x, speakerNpc->pos.y + speakerNpc->collisionHeight, speakerNpc->pos.z, &screenX, &screenY, &screenZ); - script->functionTemp[3] = speakerNpc->currentAnim; + script->functionTemp[3] = speakerNpc->curAnim; script->varTable[15] = speakerNpc->yaw; } @@ -110,7 +110,7 @@ s32 _show_message(Evt* script, s32 isInitialCall, s32 mode) { angle = atan2(speakerNpc->pos.x, speakerNpc->pos.z, targetNpc->pos.x, targetNpc->pos.z); } else { listenerYaw = &playerStatus->targetYaw; - angle = atan2(speakerNpc->pos.x, speakerNpc->pos.z, playerStatus->position.x, playerStatus->position.z); + angle = atan2(speakerNpc->pos.x, speakerNpc->pos.z, playerStatus->pos.x, playerStatus->pos.z); } reverseAngle = clamp_angle(angle + 180.0f); @@ -151,7 +151,7 @@ s32 _show_message(Evt* script, s32 isInitialCall, s32 mode) { set_npc_animation(speakerNpc, animID); } } else { - get_screen_coords(gCurrentCameraID, playerStatus->position.x, playerStatus->position.y + playerStatus->colliderHeight, playerStatus->position.z, &screenX, &screenY, &screenZ); + get_screen_coords(gCurrentCameraID, playerStatus->pos.x, playerStatus->pos.y + playerStatus->colliderHeight, playerStatus->pos.z, &screenX, &screenY, &screenZ); if (script->varTable[13] != -1) { if (gCurrentPrintContext->stateFlags & MSG_STATE_FLAG_80) { playerStatus->anim = script->varTable[13]; @@ -208,7 +208,7 @@ ApiStatus ShowMessageAtScreenPos(Evt* script, s32 isInitialCall) { return ApiStatus_BLOCK; } - script->varTable[0] = gCurrentPrintContext->currentOption; + script->varTable[0] = gCurrentPrintContext->curOption; return ApiStatus_DONE1; } @@ -242,7 +242,7 @@ ApiStatus ShowMessageAtWorldPos(Evt* script, s32 isInitialCall) { return ApiStatus_BLOCK; } - script->varTable[0] = gCurrentPrintContext->currentOption; + script->varTable[0] = gCurrentPrintContext->curOption; return ApiStatus_DONE1; } @@ -256,7 +256,7 @@ ApiStatus CloseMessage(Evt* script, s32 isInitialCall) { } else if (D_802DB264 != 1) { return ApiStatus_BLOCK; } else { - script->varTable[0] = gCurrentPrintContext->currentOption; + script->varTable[0] = gCurrentPrintContext->curOption; return ApiStatus_DONE1; } } @@ -273,7 +273,7 @@ ApiStatus SwitchMessage(Evt* script, s32 isInitialCall) { } else if (D_802DB264 != 1) { return ApiStatus_BLOCK; } else { - script->varTable[0] = gCurrentPrintContext->currentOption; + script->varTable[0] = gCurrentPrintContext->curOption; return ApiStatus_DONE1; } } @@ -290,7 +290,7 @@ ApiStatus ShowChoice(Evt* script, s32 isInitialCall) { } temp802DB268 = &D_802DB268; - script->varTable[0] = gCurrentPrintContext->currentOption = (*temp802DB268)->currentOption; + script->varTable[0] = gCurrentPrintContext->curOption = (*temp802DB268)->curOption; if ((*temp802DB268)->stateFlags & MSG_STATE_FLAG_40) { return ApiStatus_DONE1; diff --git a/src/evt/npc_api.c b/src/evt/npc_api.c index e69d5cb7b7d..da539500969 100644 --- a/src/evt/npc_api.c +++ b/src/evt/npc_api.c @@ -19,11 +19,11 @@ void set_npc_animation(Npc* npc, u32 animID) { PlayerData* playerData = &gPlayerData; if (PARTNER_ANIM_STILL <= animID && animID <= PARTNER_ANIM_HURT) { - npc->currentAnim = gPartnerAnimations[playerData->currentPartner].anims[animID - PARTNER_ANIM_STILL]; + npc->curAnim = gPartnerAnimations[playerData->curPartner].anims[animID - PARTNER_ANIM_STILL]; } else if (ENEMY_ANIM_IDLE <= animID && animID <= ENEMY_ANIM_F) { - npc->currentAnim = get_enemy(npc->npcID)->animList[animID - ENEMY_ANIM_IDLE]; + npc->curAnim = get_enemy(npc->npcID)->animList[animID - ENEMY_ANIM_IDLE]; } else { - npc->currentAnim = animID; + npc->curAnim = animID; } } @@ -101,9 +101,9 @@ ApiStatus SetNpcRotation(Evt* script, s32 isInitialCall) { return ApiStatus_DONE2; } - npc->rotation.x = rotX; - npc->rotation.y = rotY; - npc->rotation.z = rotZ; + npc->rot.x = rotX; + npc->rot.y = rotY; + npc->rot.z = rotZ; return ApiStatus_DONE2; } @@ -118,7 +118,7 @@ ApiStatus SetNpcRotationPivot(Evt* script, s32 isInitialCall) { return ApiStatus_DONE2; } - npc->rotationPivotOffsetY = value; + npc->rotPivotOffsetY = value; return ApiStatus_DONE2; } @@ -208,7 +208,7 @@ ApiStatus GetNpcAnimation(Evt* script, s32 isInitialCall) { return ApiStatus_DONE2; } - evt_set_variable(script, outVar, npc->currentAnim); + evt_set_variable(script, outVar, npc->curAnim); return ApiStatus_DONE2; } @@ -334,19 +334,19 @@ ApiStatus _npc_jump_to(Evt* script, s32 isInitialCall, s32 snapYaw) { } npc->flags |= NPC_FLAG_JUMPING; - npc->jumpVelocity = (npc->jumpScale * npc->duration * 0.5f) + (goalY / npc->duration); + npc->jumpVel = (npc->jumpScale * npc->duration * 0.5f) + (goalY / npc->duration); script->functionTemp[0] =1; } npc = script->functionTempPtr[1]; npc_move_heading(npc, npc->moveSpeed, *yaw); - npc->pos.y += npc->jumpVelocity; - npc->jumpVelocity -= npc->jumpScale; + npc->pos.y += npc->jumpVel; + npc->jumpVel -= npc->jumpScale; npc->duration--; if (npc->duration < 0) { - npc->jumpVelocity = 0.0f; + npc->jumpVel = 0.0f; npc->pos.x = npc->moveToPos.x; npc->pos.y = npc->moveToPos.y; npc->pos.z = npc->moveToPos.z; @@ -529,7 +529,7 @@ ApiStatus NpcFacePlayer(Evt* script, s32 isInitialCall) { } *initialYaw = npc->yaw; - *deltaYaw = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z) - *initialYaw; + *deltaYaw = atan2(npc->pos.x, npc->pos.z, playerStatus->pos.x, playerStatus->pos.z) - *initialYaw; script->functionTempPtr[0] = npc; *turnTime = evt_get_variable(script, *args++); npc->duration = 0; @@ -798,7 +798,7 @@ s32 BringPartnerOut(Evt* script, s32 isInitialCall) { if (isInitialCall) { wExtraPartnerID = evt_get_variable(script, *args++); - if (playerData->currentPartner == wExtraPartnerID) { + if (playerData->curPartner == wExtraPartnerID) { wExtraPartnerID = 0; return ApiStatus_DONE2; } @@ -821,12 +821,12 @@ s32 BringPartnerOut(Evt* script, s32 isInitialCall) { npc->scale.z = 0.0f; npc->moveToPos.x = targetX = partner->pos.x; - playerY = playerStatus->position.y; - npc->moveToPos.y = playerStatus->position.y; + playerY = playerStatus->pos.y; + npc->moveToPos.y = playerStatus->pos.y; npc->moveToPos.z = targetZ = partner->pos.z + 30.0f; - npc->pos.x = playerX = playerStatus->position.x; - npc->pos.y = targetY = playerStatus->position.y + (playerStatus->colliderHeight / 2); - playerZ = playerStatus->position.z; + npc->pos.x = playerX = playerStatus->pos.x; + npc->pos.y = targetY = playerStatus->pos.y + (playerStatus->colliderHeight / 2); + playerZ = playerStatus->pos.z; npc->moveSpeed = 4.0f; npc->jumpScale = 1.6f; npc->pos.z = playerZ; @@ -840,16 +840,16 @@ s32 BringPartnerOut(Evt* script, s32 isInitialCall) { npc->moveSpeed = npc->planarFlyDist / npc->duration; } - npc->jumpVelocity = ((playerY - targetY) + (npc->jumpScale * npc->duration * npc->duration * 0.5f)) / npc->duration; - npc->currentAnim = gPartnerAnimations[wExtraPartnerID].walk; + npc->jumpVel = ((playerY - targetY) + (npc->jumpScale * npc->duration * npc->duration * 0.5f)) / npc->duration; + npc->curAnim = gPartnerAnimations[wExtraPartnerID].walk; return ApiStatus_BLOCK; } npc = get_npc_by_index(wExtraPartnerNpcID); - npc->jumpVelocity -= npc->jumpScale; - npc->pos.y += npc->jumpVelocity; - if (npc->jumpVelocity <= 0.0f) { - npc->currentAnim = gPartnerAnimations[wExtraPartnerID].jump; + npc->jumpVel -= npc->jumpScale; + npc->pos.y += npc->jumpVel; + if (npc->jumpVel <= 0.0f) { + npc->curAnim = gPartnerAnimations[wExtraPartnerID].jump; } npc_move_heading(npc, npc->moveSpeed, npc->yaw); duration = npc->duration; @@ -862,8 +862,8 @@ s32 BringPartnerOut(Evt* script, s32 isInitialCall) { npc->duration--; if (npc->duration < 0) { - npc->currentAnim = gPartnerAnimations[wExtraPartnerID].idle; - npc->jumpVelocity = 0.0f; + npc->curAnim = gPartnerAnimations[wExtraPartnerID].idle; + npc->jumpVel = 0.0f; npc->pos.y = npc->moveToPos.y; npc->scale.x = 1.0f; npc->scale.y = 1.0f; @@ -889,13 +889,13 @@ ApiStatus PutPartnerAway(Evt* script, s32 isInitialCall) { if (wExtraPartnerID != 0) { partner->flags &= ~NPC_FLAG_GRAVITY; partner->flags &= ~NPC_FLAG_8; - targetX = playerStatus->position.x; + targetX = playerStatus->pos.x; partner->moveToPos.x = targetX; partnerX = partner->pos.x; - targetY = playerStatus->position.y + (playerStatus->colliderHeight / 2); + targetY = playerStatus->pos.y + (playerStatus->colliderHeight / 2); partner->moveToPos.y = targetY; partnerY = partner->pos.y; - targetZ = playerStatus->position.z; + targetZ = playerStatus->pos.z; partner->moveToPos.z = targetZ; partnerZ = partner->pos.z; partner->moveSpeed = 4.0f; @@ -910,18 +910,18 @@ ApiStatus PutPartnerAway(Evt* script, s32 isInitialCall) { } partnerY = targetY - partnerY; - partner->jumpVelocity = (partnerY + (partner->jumpScale * partner->duration * partner->duration * 0.5f)) / partner->duration; - partner->currentAnim = gPartnerAnimations[wExtraPartnerID].walk; + partner->jumpVel = (partnerY + (partner->jumpScale * partner->duration * partner->duration * 0.5f)) / partner->duration; + partner->curAnim = gPartnerAnimations[wExtraPartnerID].walk; return ApiStatus_BLOCK; } else { return ApiStatus_DONE2; } } - partner->jumpVelocity -= partner->jumpScale; - partner->pos.y += partner->jumpVelocity; - if (partner->jumpVelocity <= 0.0f) { - partner->currentAnim = gPartnerAnimations[wExtraPartnerID].jump; + partner->jumpVel -= partner->jumpScale; + partner->pos.y += partner->jumpVel; + if (partner->jumpVel <= 0.0f) { + partner->curAnim = gPartnerAnimations[wExtraPartnerID].jump; } npc_move_heading(partner, partner->moveSpeed, partner->yaw); @@ -936,8 +936,8 @@ ApiStatus PutPartnerAway(Evt* script, s32 isInitialCall) { partner->duration--; if (partner->duration < 0) { - partner->currentAnim = gPartnerAnimations[wExtraPartnerID].fall; - partner->jumpVelocity = 0.0f; + partner->curAnim = gPartnerAnimations[wExtraPartnerID].fall; + partner->jumpVel = 0.0f; partner->pos.y = partner->moveToPos.y; free_npc_by_index(wExtraPartnerNpcID); get_npc_unsafe(-5)->npcID = NPC_PARTNER; @@ -947,7 +947,7 @@ ApiStatus PutPartnerAway(Evt* script, s32 isInitialCall) { } ApiStatus GetCurrentPartnerID(Evt* script, s32 isInitialCall) { - evt_set_variable(script, *script->ptrReadPos, gPlayerData.currentPartner); + evt_set_variable(script, *script->ptrReadPos, gPlayerData.curPartner); return ApiStatus_DONE2; } diff --git a/src/evt/player_api.c b/src/evt/player_api.c index 9ca438ada05..aa0a3bae81f 100644 --- a/src/evt/player_api.c +++ b/src/evt/player_api.c @@ -72,9 +72,9 @@ ApiStatus SetPlayerPos(Evt* script, s32 isInitialCall) { playerNpc->pos.y = y; playerNpc->pos.z = z; - playerStatus->position.x = playerNpc->pos.x; - playerStatus->position.y = playerNpc->pos.y; - playerStatus->position.z = playerNpc->pos.z; + playerStatus->pos.x = playerNpc->pos.x; + playerStatus->pos.y = playerNpc->pos.y; + playerStatus->pos.z = playerNpc->pos.z; return ApiStatus_DONE2; } @@ -112,7 +112,7 @@ ApiStatus SetPlayerAnimation(Evt* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; AnimID anim = evt_get_variable(script, *args++); - gPlayerStatus.anim = playerNpc->currentAnim = anim; + gPlayerStatus.anim = playerNpc->curAnim = anim; if (gPlayerStatus.anim == ANIM_MarioW2_Collapse) { exec_ShakeCam1(0, 0, 2); @@ -145,14 +145,14 @@ ApiStatus PlayerMoveTo(Evt* script, s32 isInitialCall) { f32 moveSpeed; script->functionTemp[0] = evt_get_variable(script, *args++); - playerStatus->targetYaw = atan2(playerStatus->position.x, playerStatus->position.z, targetX, targetZ); + playerStatus->targetYaw = atan2(playerStatus->pos.x, playerStatus->pos.z, targetX, targetZ); if (script->functionTemp[0] == 0) { - script->functionTemp[0] = dist2D(playerStatus->position.x, playerStatus->position.z, targetX, + script->functionTemp[0] = dist2D(playerStatus->pos.x, playerStatus->pos.z, targetX, targetZ) / playerNpc->moveSpeed; moveSpeed = playerNpc->moveSpeed; } else { - moveSpeed = dist2D(playerStatus->position.x, playerStatus->position.z, targetX, targetZ) / script->functionTemp[0]; + moveSpeed = dist2D(playerStatus->pos.x, playerStatus->pos.z, targetX, targetZ) / script->functionTemp[0]; } move_player(script->functionTemp[0], playerStatus->targetYaw, moveSpeed); } @@ -173,8 +173,8 @@ ApiStatus func_802D1270(Evt* script, s32 isInitialCall) { f32 dist; f32 moveSpeed; - playerStatus->targetYaw = atan2(playerStatus->position.x, playerStatus->position.z, targetX, targetZ); - dist = dist2D(playerStatus->position.x, playerStatus->position.z, targetX, targetZ); + playerStatus->targetYaw = atan2(playerStatus->pos.x, playerStatus->pos.z, targetX, targetZ); + dist = dist2D(playerStatus->pos.x, playerStatus->pos.z, targetX, targetZ); script->functionTemp[0] = dist / var3; moveSpeed = dist / script->functionTemp[0]; @@ -195,12 +195,12 @@ ApiStatus func_802D1380(Evt* script, s32 isInitialCall) { f32 targetZ = evt_get_variable(script, *args++); playerNpc->duration = evt_get_variable(script, *args++); - playerStatus->targetYaw = atan2(playerStatus->position.x, playerStatus->position.z, targetX, targetZ); + playerStatus->targetYaw = atan2(playerStatus->pos.x, playerStatus->pos.z, targetX, targetZ); if (playerNpc->duration != 0) { - playerNpc->moveSpeed = dist2D(playerStatus->position.x, playerStatus->position.z, targetX, targetZ) / (f32) playerNpc->duration; + playerNpc->moveSpeed = dist2D(playerStatus->pos.x, playerStatus->pos.z, targetX, targetZ) / (f32) playerNpc->duration; } else { - playerNpc->duration = dist2D(playerStatus->position.x, playerStatus->position.z, targetX, targetZ) / playerNpc->moveSpeed; + playerNpc->duration = dist2D(playerStatus->pos.x, playerStatus->pos.z, targetX, targetZ) / playerNpc->moveSpeed; if (playerNpc->duration == 0) { playerNpc->duration = 1; } @@ -218,7 +218,7 @@ s32 player_jump(Evt* script, s32 isInitialCall, s32 mode) { f32 xTemp; f32 yTemp; f32 zTemp; - f32 jumpVelocity; + f32 jumpVel; s32 duration; AnimID anim; f32 dist; @@ -233,9 +233,9 @@ s32 player_jump(Evt* script, s32 isInitialCall, s32 mode) { zTemp = evt_get_variable(script, *args++); duration = evt_get_variable(script, *args++); - playerNpc->pos.x = playerStatus->position.x; - playerNpc->pos.y = playerStatus->position.y; - playerNpc->pos.z = playerStatus->position.z; + playerNpc->pos.x = playerStatus->pos.x; + playerNpc->pos.y = playerStatus->pos.y; + playerNpc->pos.z = playerStatus->pos.z; playerNpc->moveToPos.x = xTemp; playerNpc->moveToPos.y = yTemp; playerNpc->moveToPos.z = zTemp; @@ -255,7 +255,7 @@ s32 player_jump(Evt* script, s32 isInitialCall, s32 mode) { playerNpc->moveSpeed = dist / playerNpc->duration; } - playerNpc->jumpVelocity = (playerNpc->jumpScale * (playerNpc->duration - 1) / 2) + (yTemp / playerNpc->duration); + playerNpc->jumpVel = (playerNpc->jumpScale * (playerNpc->duration - 1) / 2) + (yTemp / playerNpc->duration); playerStatus->flags |= PS_FLAG_FLYING; playerStatus->animFlags |= PA_FLAG_NO_OOB_RESPAWN; @@ -276,11 +276,11 @@ s32 player_jump(Evt* script, s32 isInitialCall, s32 mode) { } npc_move_heading(playerNpc, playerNpc->moveSpeed, playerNpc->yaw); - playerNpc->pos.y += playerNpc->jumpVelocity; - jumpVelocity = playerNpc->jumpVelocity; // TODO: temp needed and used specifically only once below for this to match - playerNpc->jumpVelocity -= playerNpc->jumpScale; + playerNpc->pos.y += playerNpc->jumpVel; + jumpVel = playerNpc->jumpVel; // TODO: temp needed and used specifically only once below for this to match + playerNpc->jumpVel -= playerNpc->jumpScale; - if (mode == 0 && jumpVelocity > 0.0f && playerNpc->jumpVelocity <= 0.0f) { + if (mode == 0 && jumpVel > 0.0f && playerNpc->jumpVel <= 0.0f) { if (!(playerStatus->animFlags & PA_FLAG_8BIT_MARIO)) { if (!(playerStatus->animFlags & PA_FLAG_USING_WATT)) { anim = ANIM_Mario1_Fall; @@ -293,9 +293,9 @@ s32 player_jump(Evt* script, s32 isInitialCall, s32 mode) { suggest_player_anim_allow_backward(anim); } - playerStatus->position.x = playerNpc->pos.x; - playerStatus->position.y = playerNpc->pos.y; - playerStatus->position.z = playerNpc->pos.z; + playerStatus->pos.x = playerNpc->pos.x; + playerStatus->pos.y = playerNpc->pos.y; + playerStatus->pos.z = playerNpc->pos.z; if (mode == 0) { playerStatus->targetYaw = playerNpc->yaw; @@ -323,10 +323,10 @@ s32 player_jump(Evt* script, s32 isInitialCall, s32 mode) { if (mode == 0 || mode == 2) { s32 colliderID; - yTemp = player_check_collision_below(playerNpc->jumpVelocity, &colliderID); + yTemp = player_check_collision_below(playerNpc->jumpVel, &colliderID); if (colliderID >= 0) { - playerStatus->position.y = yTemp; + playerStatus->pos.y = yTemp; player_handle_floor_collider_type(colliderID); handle_floor_behavior(); } @@ -409,7 +409,7 @@ ApiStatus PlayerFaceNpc(Evt* script, s32 isInitialCall) { } *playerTargetYaw = playerNpc->yaw = playerStatus->targetYaw; - *angle = atan2(playerStatus->position.x, playerStatus->position.z, npc->pos.x, npc->pos.z) - *playerTargetYaw; + *angle = atan2(playerStatus->pos.x, playerStatus->pos.z, npc->pos.x, npc->pos.z) - *playerTargetYaw; *ft3 = evt_get_variable(script, *args++); playerNpc->duration = 0; @@ -468,9 +468,9 @@ ApiStatus GetPlayerPos(Evt* script, s32 isInitialCall) { Bytecode outVar2 = *args++; Bytecode outVar3 = *args++; - evt_set_variable(script, outVar1, playerStatus->position.x); - evt_set_variable(script, outVar2, playerStatus->position.y); - evt_set_variable(script, outVar3, playerStatus->position.z); + evt_set_variable(script, outVar1, playerStatus->pos.x); + evt_set_variable(script, outVar2, playerStatus->pos.y); + evt_set_variable(script, outVar3, playerStatus->pos.z); return ApiStatus_DONE2; } @@ -527,10 +527,10 @@ ApiStatus UseEntryHeading(Evt* script, s32 isInitialCall) { sin_cos_deg(clamp_angle((*mapSettings->entryList)[gGameStatusPtr->entryID].yaw + 180.0f), &sinTheta, &cosTheta); exitTangentFrac = gGameStatusPtr->exitTangent * 0.3f; - gPlayerStatus.position.x = (entryX + (var1 * sinTheta)) - (exitTangentFrac * cosTheta); - gPlayerStatus.position.z = (entryZ - (var1 * cosTheta)) - (exitTangentFrac * sinTheta); + gPlayerStatus.pos.x = (entryX + (var1 * sinTheta)) - (exitTangentFrac * cosTheta); + gPlayerStatus.pos.z = (entryZ - (var1 * cosTheta)) - (exitTangentFrac * sinTheta); - script->varTableF[5] = dist2D(gPlayerStatus.position.x, gPlayerStatus.position.z, entryX, entryZ) / var2; + script->varTableF[5] = dist2D(gPlayerStatus.pos.x, gPlayerStatus.pos.z, entryX, entryZ) / var2; gPlayerStatus.flags |= PS_FLAG_CAMERA_DOESNT_FOLLOW; return ApiStatus_DONE2; @@ -553,7 +553,7 @@ ApiStatus UseExitHeading(Evt* script, s32 isInitialCall) { f32 entryX = (*mapSettings->entryList)[entryID].x; f32 entryZ = (*mapSettings->entryList)[entryID].z; f32 temp = (var1 + 10.0f) / 2; - f32 temp_f2 = dist2D(entryX, entryZ, playerStatus->position.x, playerStatus->position.z) - temp; + f32 temp_f2 = dist2D(entryX, entryZ, playerStatus->pos.x, playerStatus->pos.z) - temp; f32 sinTheta; f32 cosTheta; f32 exitTangentFrac; @@ -566,10 +566,10 @@ ApiStatus UseExitHeading(Evt* script, s32 isInitialCall) { } sin_cos_deg(clamp_angle((*mapSettings->entryList)[entryID].yaw + 180.0f), &sinTheta, &cosTheta); - gGameStatusPtr->exitTangent = (cosTheta * (playerStatus->position.x - entryX)) - (sinTheta * (entryZ - playerStatus->position.z)); + gGameStatusPtr->exitTangent = (cosTheta * (playerStatus->pos.x - entryX)) - (sinTheta * (entryZ - playerStatus->pos.z)); exitTangentFrac = gGameStatusPtr->exitTangent * 0.3f; - script->varTable[1] = (playerStatus->position.x + (var1 * sinTheta)) - (exitTangentFrac * cosTheta); - script->varTable[3] = (playerStatus->position.z - (var1 * cosTheta)) - (exitTangentFrac * sinTheta); + script->varTable[1] = (playerStatus->pos.x + (var1 * sinTheta)) - (exitTangentFrac * cosTheta); + script->varTable[3] = (playerStatus->pos.z - (var1 * cosTheta)) - (exitTangentFrac * sinTheta); script->varTable[2] = (*mapSettings->entryList)[entryID].y; *varTableVar5 = var1 / 15; playerStatus->animFlags |= PA_FLAG_CHANGING_MAP; @@ -591,7 +591,7 @@ s32 func_802D23F8(void) { } ApiStatus WaitForPlayerTouchingFloor(Evt* script, s32 isInitialCall) { - if ((gCollisionStatus.currentFloor >= 0) && func_802D23F8()) { + if ((gCollisionStatus.curFloor >= 0) && func_802D23F8()) { return ApiStatus_DONE2; } else { return ApiStatus_BLOCK; @@ -599,7 +599,7 @@ ApiStatus WaitForPlayerTouchingFloor(Evt* script, s32 isInitialCall) { } ApiStatus func_802D2484(Evt* script, s32 isInitialCall) { - if (gCollisionStatus.currentFloor >= 0) { + if (gCollisionStatus.curFloor >= 0) { return ApiStatus_DONE2; } else { return ApiStatus_BLOCK; @@ -610,7 +610,7 @@ ApiStatus IsPlayerOnValidFloor(Evt* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; s32 result = FALSE; - if (gCollisionStatus.currentFloor >= 0) { + if (gCollisionStatus.curFloor >= 0) { result = (func_802D23F8() != 0); } evt_set_variable(script, *args++, result); @@ -723,8 +723,8 @@ ApiStatus FacePlayerTowardPoint(Evt* script, s32 isInitialCall) { *initialYaw = playerNpc->yaw = playerStatus->targetYaw; - if (playerStatus->position.x != targetX || playerStatus->position.z != targetY) { - targetYaw = atan2(playerStatus->position.x, playerStatus->position.z, targetX, targetY); + if (playerStatus->pos.x != targetX || playerStatus->pos.z != targetY) { + targetYaw = atan2(playerStatus->pos.x, playerStatus->pos.z, targetX, targetY); } else { targetYaw = playerStatus->targetYaw; } @@ -777,7 +777,7 @@ ApiStatus GetPartnerInUse(Evt* script, s32 isInitialCall) { s32 currentPartner = PARTNER_NONE; if (gPartnerStatus.partnerActionState != PARTNER_ACTION_NONE) { - currentPartner = playerData->currentPartner; + currentPartner = playerData->curPartner; } evt_set_variable(script, outVar, currentPartner); @@ -830,9 +830,9 @@ ApiStatus SetPlayerPushVelocity(Evt* script, s32 isInitialCall) { f32 y; f32 z; - gPlayerStatus.pushVelocity.x = x; - gPlayerStatus.pushVelocity.y = evt_get_variable(script, *args++); - gPlayerStatus.pushVelocity.z = evt_get_variable(script, *args++); + gPlayerStatus.pushVel.x = x; + gPlayerStatus.pushVel.y = evt_get_variable(script, *args++); + gPlayerStatus.pushVel.z = evt_get_variable(script, *args++); return ApiStatus_DONE2; } diff --git a/src/evt/script_list.c b/src/evt/script_list.c index 72914065af8..4714c1ceae2 100644 --- a/src/evt/script_list.c +++ b/src/evt/script_list.c @@ -255,11 +255,11 @@ Evt* start_script(EvtScript* source, s32 priority, s32 flags) { ASSERT(newScript != NULL); newScript->stateFlags = flags | EVT_FLAG_ACTIVE; - newScript->currentOpcode = EVT_OP_INTERNAL_FETCH; + newScript->curOpcode = EVT_OP_INTERNAL_FETCH; newScript->priority = priority; newScript->ptrNextLine = (Bytecode*)source; newScript->ptrFirstLine = (Bytecode*)source; - newScript->ptrCurrentLine = (Bytecode*)source; + newScript->ptrCurLine = (Bytecode*)source; newScript->userData = NULL; newScript->blockingParent = NULL; newScript->childScript = NULL; @@ -327,12 +327,12 @@ Evt* start_script_in_group(EvtScript* source, u8 priority, u8 flags, u8 groupFla // Some of this function is surely macros. I think we'll learn more as we do others in this file. -Ethan do { newScript->stateFlags = flags | EVT_FLAG_ACTIVE; - newScript->currentOpcode = EVT_OP_INTERNAL_FETCH; + newScript->curOpcode = EVT_OP_INTERNAL_FETCH; newScript->priority = priority; newScript->id = gStaticScriptCounter++; newScript->ptrNextLine = (Bytecode*)source; newScript->ptrFirstLine = (Bytecode*)source; - newScript->ptrCurrentLine = (Bytecode*)source; + newScript->ptrCurLine = (Bytecode*)source; newScript->userData = 0; newScript->blockingParent = 0; newScript->childScript = 0; @@ -396,10 +396,10 @@ Evt* start_child_script(Evt* parentScript, EvtScript* source, s32 flags) { parentScript->childScript = child; parentScript->stateFlags |= EVT_FLAG_BLOCKED_BY_CHILD; child->stateFlags = flags | EVT_FLAG_ACTIVE; - child->ptrCurrentLine = child->ptrFirstLine = child->ptrNextLine = (Bytecode*)source; + child->ptrCurLine = child->ptrFirstLine = child->ptrNextLine = (Bytecode*)source; - child->currentOpcode = EVT_OP_INTERNAL_FETCH; + child->curOpcode = EVT_OP_INTERNAL_FETCH; child->userData = NULL; child->blockingParent = parentScript; child->childScript = NULL; @@ -466,8 +466,8 @@ Evt* func_802C39F8(Evt* parentScript, Bytecode* nextLine, s32 newState) { child->stateFlags = newState | EVT_FLAG_ACTIVE; child->ptrNextLine = nextLine; child->ptrFirstLine = nextLine; - child->ptrCurrentLine = nextLine; - child->currentOpcode = EVT_OP_INTERNAL_FETCH; + child->ptrCurLine = nextLine; + child->curOpcode = EVT_OP_INTERNAL_FETCH; child->userData = NULL; child->blockingParent = NULL; child->parentScript = parentScript; @@ -517,8 +517,8 @@ Evt* func_802C3C10(Evt* script, Bytecode* line, s32 arg2) { script->ptrNextLine = line; script->ptrFirstLine = line; - script->ptrCurrentLine = line; - script->currentOpcode = EVT_OP_INTERNAL_FETCH; + script->ptrCurLine = line; + script->curOpcode = EVT_OP_INTERNAL_FETCH; script->frameCounter = 0; script->stateFlags |= arg2; script->timeScale = 1.0f; @@ -559,10 +559,10 @@ Evt* restart_script(Evt* script) { script->loopDepth = -1; script->switchDepth = -1; script->frameCounter = 0; - script->currentOpcode = EVT_OP_INTERNAL_FETCH; + script->curOpcode = EVT_OP_INTERNAL_FETCH; script->ptrNextLine = ptrFirstLine; - script->ptrCurrentLine = ptrFirstLine; + script->ptrCurLine = ptrFirstLine; script->timeScale = 1.0f; script->frameCounter = 0; script->unk_158 = 0; diff --git a/src/evt/virtual_entity.c b/src/evt/virtual_entity.c index 33b53a28117..069524af6e0 100644 --- a/src/evt/virtual_entity.c +++ b/src/evt/virtual_entity.c @@ -412,14 +412,14 @@ ApiStatus VirtualEntityJumpTo(Evt* script, s32 isInitialCall) { virtualEntity->moveSpeed = virtualEntity->moveDist / virtualEntity->moveTime; } - virtualEntity->jumpVelocity = (virtualEntity->jumpGravity * virtualEntity->moveTime / 2) + + virtualEntity->jumpVel = (virtualEntity->jumpGravity * virtualEntity->moveTime / 2) + (yTemp / virtualEntity->moveTime); script->functionTemp[0] = 1; } virtualEntity = (*gCurrentVirtualEntityListPtr)[script->functionTemp[1]]; - virtualEntity->pos.y += virtualEntity->jumpVelocity; - virtualEntity->jumpVelocity -= virtualEntity->jumpGravity; + virtualEntity->pos.y += virtualEntity->jumpVel; + virtualEntity->jumpVel -= virtualEntity->jumpGravity; virtual_entity_move_polar(virtualEntity, virtualEntity->moveSpeed, virtualEntity->moveAngle); @@ -448,8 +448,8 @@ ApiStatus VirtualEntityLandJump(Evt* script, s32 isInitialCall) { } virtualEntity = (*gCurrentVirtualEntityListPtr)[script->functionTemp[1]]; - virtualEntity->pos.y += virtualEntity->jumpVelocity; - virtualEntity->jumpVelocity -= virtualEntity->jumpGravity; + virtualEntity->pos.y += virtualEntity->jumpVel; + virtualEntity->jumpVel -= virtualEntity->jumpGravity; virtual_entity_move_polar(virtualEntity, virtualEntity->moveSpeed, virtualEntity->moveAngle); diff --git a/src/hud_element.c b/src/hud_element.c index 1c2b04b4c08..4b72fc63878 100644 --- a/src/hud_element.c +++ b/src/hud_element.c @@ -1467,16 +1467,16 @@ void render_hud_element(HudElement* hudElement) { guTranslateF(sp220, -transform->pivot.x, transform->pivot.y, 0.0f); guTranslateF( sp1A0, - hudElement->renderPosX + hudElement->screenPosOffset.x + hudElement->worldPosOffset.x + transform->position.x, - -hudElement->renderPosY - hudElement->screenPosOffset.y + hudElement->worldPosOffset.y + transform->position.y, - - (hudElement->worldPosOffset.z / 10.0) + transform->position.z + hudElement->renderPosX + hudElement->screenPosOffset.x + hudElement->worldPosOffset.x + transform->pos.x, + -hudElement->renderPosY - hudElement->screenPosOffset.y + hudElement->worldPosOffset.y + transform->pos.y, + - (hudElement->worldPosOffset.z / 10.0) + transform->pos.z ); guScaleF(sp260, hudElement->uniformScale * xScaleFactor * transform->scale.x, hudElement->uniformScale * yScaleFactor * transform->scale.y, transform->scale.z); - guRotateF(sp120, transform->rotation.y, 0.0f, 1.0f, 0.0f); - guRotateF(sp160, transform->rotation.z, 0.0f, 0.0f, 1.0f); - guRotateF(spE0, transform->rotation.x, 1.0f, 0.0f, 0.0f); + guRotateF(sp120, transform->rot.y, 0.0f, 1.0f, 0.0f); + guRotateF(sp160, transform->rot.z, 0.0f, 0.0f, 1.0f); + guRotateF(spE0, transform->rot.x, 1.0f, 0.0f, 0.0f); guMtxCatF(sp160, spE0, sp20); guMtxCatF(sp20, sp120, spA0); guMtxCatF(sp260, sp1E0, sp20); @@ -2116,12 +2116,12 @@ void hud_element_create_transform_A(s32 id) { ASSERT(transform != NULL); element->flags |= HUD_ELEMENT_FLAG_TRANSFORM; transform->imgfxIdx = imgfx_get_free_instances(1); - transform->position.x = 0.0f; - transform->position.y = 0.0f; - transform->position.z = 0.0f; - transform->rotation.x = 0.0f; - transform->rotation.y = 0.0f; - transform->rotation.z = 0.0f; + transform->pos.x = 0.0f; + transform->pos.y = 0.0f; + transform->pos.z = 0.0f; + transform->rot.x = 0.0f; + transform->rot.y = 0.0f; + transform->rot.z = 0.0f; transform->scale.x = 1.0f; transform->scale.y = 1.0f; transform->scale.z = 1.0f; @@ -2138,12 +2138,12 @@ void hud_element_create_transform_B(s32 id) { ASSERT(transform != NULL); element->flags |= HUD_ELEMENT_FLAG_TRANSFORM | HUD_ELEMENT_FLAG_NO_FOLD; transform->imgfxIdx = 0; - transform->position.x = 0.0f; - transform->position.y = 0.0f; - transform->position.z = 0.0f; - transform->rotation.x = 0.0f; - transform->rotation.y = 0.0f; - transform->rotation.z = 0.0f; + transform->pos.x = 0.0f; + transform->pos.y = 0.0f; + transform->pos.z = 0.0f; + transform->rot.x = 0.0f; + transform->rot.y = 0.0f; + transform->rot.z = 0.0f; transform->scale.x = 1.0f; transform->scale.y = 1.0f; transform->scale.z = 1.0f; @@ -2158,12 +2158,12 @@ void hud_element_create_transform_C(s32 id) { ASSERT(transform != NULL); element->flags |= HUD_ELEMENT_FLAG_40000000 | HUD_ELEMENT_FLAG_NO_FOLD | HUD_ELEMENT_FLAG_TRANSFORM; transform->imgfxIdx = 0; - transform->position.x = 0.0f; - transform->position.y = 0.0f; - transform->position.z = 0.0f; - transform->rotation.x = 0.0f; - transform->rotation.y = 0.0f; - transform->rotation.z = 0.0f; + transform->pos.x = 0.0f; + transform->pos.y = 0.0f; + transform->pos.z = 0.0f; + transform->rot.x = 0.0f; + transform->rot.y = 0.0f; + transform->rot.z = 0.0f; transform->scale.x = 1.0f; transform->scale.y = 1.0f; transform->scale.z = 1.0f; @@ -2188,9 +2188,9 @@ void hud_element_set_transform_pos(s32 id, f32 x, f32 y, f32 z) { HudTransform* transform = element->hudTransform; if (element->flags & HUD_ELEMENT_FLAG_TRANSFORM) { - transform->position.x = x; - transform->position.y = y; - transform->position.z = z; + transform->pos.x = x; + transform->pos.y = y; + transform->pos.z = z; } } @@ -2210,9 +2210,9 @@ void hud_element_set_transform_rotation(s32 id, f32 x, f32 y, f32 z) { HudTransform* transform = element->hudTransform; if (element->flags & HUD_ELEMENT_FLAG_TRANSFORM) { - transform->rotation.x = x; - transform->rotation.y = y; - transform->rotation.z = z; + transform->rot.x = x; + transform->rot.y = y; + transform->rot.z = z; } } diff --git a/src/hud_element.h b/src/hud_element.h index f959e862346..308223656f5 100644 --- a/src/hud_element.h +++ b/src/hud_element.h @@ -149,7 +149,7 @@ typedef struct Shop { /* 0x002 */ s16 numItems; /* 0x004 */ s16 numSpecialPrices; /* 0x006 */ char unk_06[0x2]; - /* 0x008 */ s32 currentItemSlot; + /* 0x008 */ s32 curItemSlot; /* 0x00C */ s32 selectedStoreItemSlot; /* 0x010 */ ShopOwner* owner; /* 0x014 */ ShopItemLocation* itemDataPositions; @@ -172,8 +172,8 @@ typedef struct VtxRect { typedef struct HudTransform { /* 0x00 */ s32 imgfxIdx; - /* 0x04 */ Vec3f position; - /* 0x10 */ Vec3f rotation; + /* 0x04 */ Vec3f pos; + /* 0x10 */ Vec3f rot; /* 0x1C */ Vec3f scale; /* 0x28 */ Vec2s pivot; /* 0x30 */ VtxRect unk_30[3]; diff --git a/src/i_spy.c b/src/i_spy.c index 8e5adc78424..1bb4393d064 100644 --- a/src/i_spy.c +++ b/src/i_spy.c @@ -38,7 +38,7 @@ void appendGfx_ispy_icon(void) { if (gPlayerStatus.animFlags & PA_FLAG_ISPY_VISIBLE) { guScaleF(matrix1, ISpyPtr->scale, ISpyPtr->scale, ISpyPtr->scale); - guRotateF(matrix2, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(matrix2, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(matrix1, matrix2, matrix1); guTranslateF(matrix2, ISpyPtr->pos.x, ISpyPtr->pos.y, ISpyPtr->pos.z); guMtxCatF(matrix1, matrix2, matrix2); @@ -90,9 +90,9 @@ void appendGfx_ispy_icon(void) { void ispy_notification_setup(void) { mem_clear(ISpyPtr, sizeof(*ISpyPtr)); - ISpyPtr->pos.x = gPlayerStatus.position.x; - ISpyPtr->pos.y = gPlayerStatus.position.y + gPlayerStatus.colliderHeight + 8.0f; - ISpyPtr->pos.z = gPlayerStatus.position.z; + ISpyPtr->pos.x = gPlayerStatus.pos.x; + ISpyPtr->pos.y = gPlayerStatus.pos.y + gPlayerStatus.colliderHeight + 8.0f; + ISpyPtr->pos.z = gPlayerStatus.pos.z; ISpyPtr->alpha = 255; @@ -106,9 +106,9 @@ void ispy_notification_update(void) { s32 cond; ISpyPtr->pos.y += - (playerStatus->position.y + playerStatus->colliderHeight + 10.0f - ISpyPtr->pos.y) / 1.5f; - ISpyPtr->pos.x = playerStatus->position.x; - ISpyPtr->pos.z = playerStatus->position.z; + (playerStatus->pos.y + playerStatus->colliderHeight + 10.0f - ISpyPtr->pos.y) / 1.5f; + ISpyPtr->pos.x = playerStatus->pos.x; + ISpyPtr->pos.z = playerStatus->pos.z; switch (ISpyPtr->state) { case I_SPY_DELAY: diff --git a/src/imgfx.c b/src/imgfx.c index e3426c62fc1..1d0de4b0c8b 100644 --- a/src/imgfx.c +++ b/src/imgfx.c @@ -979,8 +979,8 @@ void imgfx_appendGfx_mesh(ImgFXState* state, Matrix4f mtx) { gDPSetCombineMode(gMainGfxPos++, G_CC_MODULATEIDECALA, G_CC_MODULATEIDECALA); gSPSetGeometryMode(gMainGfxPos++, G_SHADE | G_LIGHTING | G_SHADING_SMOOTH); - angle1 = cosine(currentCam->currentYaw) * 120.0f; - angle2 = cosine(currentCam->currentYaw + 90.0f) * 120.0f; + angle1 = cosine(currentCam->curYaw) * 120.0f; + angle2 = cosine(currentCam->curYaw + 90.0f) * 120.0f; dirX1 = -angle1; dirZ2 = -angle2; ImgFXLights.l[0].l.dir[0] = dirX1; diff --git a/src/input.c b/src/input.c index aaee101fcef..07e53963018 100644 --- a/src/input.c +++ b/src/input.c @@ -8,7 +8,7 @@ SHIFT_BSS s16 D_8009A6A4; SHIFT_BSS s16 D_8009A6A6; void func_800287F0(void) { - gGameStatusPtr->currentButtons[0] = 0; + gGameStatusPtr->curButtons[0] = 0; gGameStatusPtr->pressedButtons[0] = 0; gGameStatusPtr->heldButtons[0] = 0; gGameStatusPtr->stickX[0] = 0; @@ -207,17 +207,17 @@ void update_input(void) { } } - gGameStatusPtr->currentButtons[0] = buttons; - gGameStatusPtr->pressedButtons[0] = gGameStatusPtr->currentButtons[0] ^ gGameStatusPtr->prevButtons[0]; - gGameStatusPtr->pressedButtons[0] &= gGameStatusPtr->currentButtons[0]; + gGameStatusPtr->curButtons[0] = buttons; + gGameStatusPtr->pressedButtons[0] = gGameStatusPtr->curButtons[0] ^ gGameStatusPtr->prevButtons[0]; + gGameStatusPtr->pressedButtons[0] &= gGameStatusPtr->curButtons[0]; do { - if (gGameStatusPtr->currentButtons[0] == 0) { + if (gGameStatusPtr->curButtons[0] == 0) { gGameStatusPtr->heldButtons[0] = 0; - } else if (gGameStatusPtr->prevButtons[0] != gGameStatusPtr->currentButtons[0]) { - gGameStatusPtr->heldButtons[0] = gGameStatusPtr->currentButtons[0]; + } else if (gGameStatusPtr->prevButtons[0] != gGameStatusPtr->curButtons[0]) { + gGameStatusPtr->heldButtons[0] = gGameStatusPtr->curButtons[0]; gGameStatusPtr->unk_60 = -1; - gGameStatusPtr->heldButtons[0] = gGameStatusPtr->currentButtons[0] ^ gGameStatusPtr->prevButtons[0]; - gGameStatusPtr->heldButtons[0] &= gGameStatusPtr->currentButtons[0]; + gGameStatusPtr->heldButtons[0] = gGameStatusPtr->curButtons[0] ^ gGameStatusPtr->prevButtons[0]; + gGameStatusPtr->heldButtons[0] &= gGameStatusPtr->curButtons[0]; gGameStatusPtr->unk_58 = gGameStatusPtr->unk_48[0]; } else { if (gGameStatusPtr->unk_60 >= 0) { @@ -225,7 +225,7 @@ void update_input(void) { if (gGameStatusPtr->unk_60 != 0) { gGameStatusPtr->heldButtons[0] = 0; } else { - gGameStatusPtr->heldButtons[0] = gGameStatusPtr->currentButtons[0]; + gGameStatusPtr->heldButtons[0] = gGameStatusPtr->curButtons[0]; gGameStatusPtr->unk_60 = gGameStatusPtr->unk_50[0]; } } else { @@ -233,12 +233,12 @@ void update_input(void) { if (gGameStatusPtr->unk_58 != 0) { gGameStatusPtr->heldButtons[0] = 0; } else { - gGameStatusPtr->heldButtons[0] = gGameStatusPtr->currentButtons[0]; + gGameStatusPtr->heldButtons[0] = gGameStatusPtr->curButtons[0]; gGameStatusPtr->unk_60 = gGameStatusPtr->unk_50[0]; } } } } while (0); - gGameStatusPtr->prevButtons[0] = gGameStatusPtr->currentButtons[0]; + gGameStatusPtr->prevButtons[0] = gGameStatusPtr->curButtons[0]; } diff --git a/src/inspect_icon.c b/src/inspect_icon.c index ef761f2b67d..f1334e43704 100644 --- a/src/inspect_icon.c +++ b/src/inspect_icon.c @@ -44,13 +44,13 @@ void interact_inspect_setup(void) { if (playerStatus->animFlags & PA_FLAG_INTERACT_PROMPT_AVAILABLE) { mem_clear(InspectIconPtr, sizeof(*InspectIconPtr)); D_8010C950 = -1; - InspectIconPtr->pos.x = playerStatus->position.x; - InspectIconPtr->pos.y = playerStatus->position.y + playerStatus->colliderHeight + + InspectIconPtr->pos.x = playerStatus->pos.x; + InspectIconPtr->pos.y = playerStatus->pos.y + playerStatus->colliderHeight + (!(playerStatus->animFlags & PA_FLAG_USING_PEACH_PHYSICS) ? 8.0f : 2.0f); - InspectIconPtr->pos.z = playerStatus->position.z; + InspectIconPtr->pos.z = playerStatus->pos.z; InspectIconPtr->scale = 0.4f; InspectIconPtr->state = INSPECT_ICON_APPEAR; - InspectIconPtr->yaw = -gCameras[gCurrentCameraID].currentYaw; + InspectIconPtr->yaw = -gCameras[gCurrentCameraID].curYaw; InteractNotificationCallback = interact_inspect_update; InspectIconPtr->brightness = 255; InspectIconPtr->alpha = 255; @@ -63,7 +63,7 @@ void appendGfx_interact_prompt(void) { if (gPlayerStatus.animFlags & PA_FLAG_INTERACT_PROMPT_AVAILABLE) { guScaleF(sp38, InspectIconPtr->scale, InspectIconPtr->scale, InspectIconPtr->scale); - guRotateF(sp78, InspectIconPtr->yaw - gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp78, InspectIconPtr->yaw - gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp38, sp78, sp38); guTranslateF(sp78, InspectIconPtr->pos.x, InspectIconPtr->pos.y, InspectIconPtr->pos.z); guMtxCatF(sp38, sp78, sp78); @@ -94,11 +94,11 @@ void appendGfx_interact_prompt(void) { s32 should_continue_inspect(void) { CollisionStatus* collisionStatus = &gCollisionStatus; PlayerStatus* playerStatus = &gPlayerStatus; - s32 curInteraction = collisionStatus->currentWall; + s32 curInteraction = collisionStatus->curWall; Npc* npc = playerStatus->encounteredNPC; if (curInteraction == NO_COLLIDER) { - s32 floor = gCollisionStatus.currentFloor; + s32 floor = gCollisionStatus.curFloor; if (floor >= 0 && (floor & COLLISION_WITH_ENTITY_BIT)) { curInteraction = floor; @@ -175,12 +175,12 @@ void update_inspect_icon_pos(void) { InspectIconPtr->iconBounceVel = -4; } - delta = (playerStatus->position.x - InspectIconPtr->pos.x) * 0.666f; + delta = (playerStatus->pos.x - InspectIconPtr->pos.x) * 0.666f; InspectIconPtr->pos.x += delta; - delta = (playerStatus->position.z - InspectIconPtr->pos.z) * 0.666f; + delta = (playerStatus->pos.z - InspectIconPtr->pos.z) * 0.666f; InspectIconPtr->pos.z += delta; - playerHeadY = playerStatus->position.y + playerStatus->colliderHeight; + playerHeadY = playerStatus->pos.y + playerStatus->colliderHeight; bounceDeltaY = InspectIconPtr->iconBounceVel; lastPosY = InspectIconPtr->pos.y; if (!(playerStatus->animFlags & PA_FLAG_USING_PEACH_PHYSICS)) { diff --git a/src/main_loop.c b/src/main_loop.c index bc91bde3553..0c87a80bf5a 100644 --- a/src/main_loop.c +++ b/src/main_loop.c @@ -15,7 +15,7 @@ s8 gGameStepDelayAmount = 1; s8 gGameStepDelayCount = 5; GameStatus gGameStatus = { - .currentButtons = {0}, + .curButtons = {0}, .pressedButtons = {0}, .heldButtons = {0}, .prevButtons = {0}, diff --git a/src/model.c b/src/model.c index 7b050b1a84a..b7007fd5325 100644 --- a/src/model.c +++ b/src/model.c @@ -2666,7 +2666,7 @@ void render_models(void) { } else { rtPtr->appendGfx = appendGfx_model; } - rtPtr->distance = -distance; + rtPtr->dist = -distance; rtPtr->renderMode = model->renderMode; queue_render_task(rtPtr); } @@ -2705,7 +2705,7 @@ void render_models(void) { if (!(transformGroup->flags & TRANSFORM_GROUP_FLAG_HIDDEN)) { rtPtr->appendGfx = render_transform_group; rtPtr->appendGfxArg = transformGroup; - rtPtr->distance = -distance; + rtPtr->dist = -distance; rtPtr->renderMode = transformGroup->renderMode; queue_render_task(rtPtr); } @@ -4349,7 +4349,7 @@ RenderTask* queue_render_task(RenderTask* task) { ret->appendGfxArg = task->appendGfxArg; ret->appendGfx = task->appendGfx; - ret->distance = mdl_renderTaskBasePriorities[task->renderMode] - task->distance; + ret->dist = mdl_renderTaskBasePriorities[task->renderMode] - task->dist; return ret; } @@ -4379,7 +4379,7 @@ void execute_render_tasks(void) { s32 t2 = sorted[j]; task = &taskList[t1]; task2 = &taskList[t2]; - if (task->distance > task2->distance) { + if (task->dist > task2->dist) { sorted[i] = t2; sorted[j] = t1; } @@ -4390,13 +4390,13 @@ void execute_render_tasks(void) { taskList = mdl_renderTaskLists[mdl_renderTaskQueueIdx]; for (i = 0; i < taskCount - 1; i++) { task = &taskList[sorted[i]]; - if (task->distance >= 3000000) { + if (task->dist >= 3000000) { for (j = i + 1; j < taskCount; j++) { s32 t1 = sorted[i]; s32 t2 = sorted[j]; task = &taskList[t1]; task2 = &taskList[t2]; - if (task->distance < task2->distance) { + if (task->dist < task2->dist) { sorted[i] = t2; sorted[j] = t1; } @@ -4408,7 +4408,7 @@ void execute_render_tasks(void) { taskList = mdl_renderTaskLists[mdl_renderTaskQueueIdx]; for (i = 0; i < taskCount - 1; i++) { task = &taskList[sorted[i]]; - if (task->distance > 800000) { + if (task->dist > 800000) { break; } for (j = i + 1; j < taskCount; j++) { @@ -4416,10 +4416,10 @@ void execute_render_tasks(void) { s32 t2 = sorted[j]; task = &taskList[t1]; task2 = &taskList[t2]; - if (task2->distance > 800000) { + if (task2->dist > 800000) { break; } - if (task->distance < task2->distance) { + if (task->dist < task2->dist) { sorted[i] = t2; sorted[j] = t1; } diff --git a/src/msg.c b/src/msg.c index 4fc1587bb59..6f61ee2bb9e 100644 --- a/src/msg.c +++ b/src/msg.c @@ -340,9 +340,9 @@ s32 _update_message(MessagePrintState* printer) { if (printer->stateFlags & MSG_STATE_FLAG_80000) { buttons = BUTTON_A | BUTTON_C_DOWN; } - if ((buttons & gGameStatusPtr->pressedButtons[0]) || (gGameStatusPtr->currentButtons[0] & BUTTON_B)) { + if ((buttons & gGameStatusPtr->pressedButtons[0]) || (gGameStatusPtr->curButtons[0] & BUTTON_B)) { printer->windowState = MSG_WINDOW_STATE_PRINTING; - printer->currentPrintDelay = 0; + printer->curPrintDelay = 0; printer->stateFlags |= MSG_STATE_FLAG_4; if (gGameStatusPtr->pressedButtons[0] & (BUTTON_A | BUTTON_C_DOWN)) { cond = TRUE; @@ -362,11 +362,11 @@ s32 _update_message(MessagePrintState* printer) { } } else if ((gGameStatusPtr->pressedButtons[0] & BUTTON_Z) && !(printer->stateFlags & MSG_STATE_FLAG_40000) && - (printer->currentLine != 0)) + (printer->curLine != 0)) { printer->windowState = MSG_WINDOW_STATE_B; printer->unk_4CC = 0; - printer->unkArraySize = printer->currentLine - 1; + printer->unkArraySize = printer->curLine - 1; printer->unk_4C8 = abs(printer->curLinePos - printer->lineEndPos[printer->unkArraySize]); sfx_play_sound_with_params(SOUND_CD, 0, 0, 0); } @@ -375,7 +375,7 @@ s32 _update_message(MessagePrintState* printer) { if (gGameStatusPtr->pressedButtons[0] & BUTTON_B) { printer->windowState = MSG_WINDOW_STATE_B; printer->unk_4CC = 0; - printer->unkArraySize = printer->currentLine; + printer->unkArraySize = printer->curLine; printer->unk_4C8 = abs(printer->curLinePos - printer->lineEndPos[printer->unkArraySize]); sfx_play_sound_with_params(SOUND_CC, 0, 0, 0); } else if (gGameStatusPtr->pressedButtons[0] & BUTTON_Z) { @@ -405,26 +405,26 @@ s32 _update_message(MessagePrintState* printer) { sfx_play_sound_with_params(SOUND_MENU_NEXT, 0, 0, 0); } else if (printer->cancelOption != 0xFF && (gGameStatusPtr->pressedButtons[0] & BUTTON_B)) { if (printer->cancelOption >= printer->maxOption) { - printer->selectedOption = printer->currentOption; + printer->selectedOption = printer->curOption; } else { printer->selectedOption = printer->cancelOption; } printer->madeChoice = 1; printer->windowState = MSG_WINDOW_STATE_PRINTING; printer->scrollingTime = 0; - printer->currentOption = printer->cancelOption; + printer->curOption = printer->cancelOption; printer->stateFlags |= MSG_STATE_FLAG_20000; sfx_play_sound_with_params(SOUND_MENU_BACK, 0, 0, 0); } else if (gGameStatusPtr->heldButtons[0] & BUTTON_STICK_DOWN) { - if (printer->currentOption != printer->maxOption - 1) { - printer->targetOption = printer->currentOption + 1; + if (printer->curOption != printer->maxOption - 1) { + printer->targetOption = printer->curOption + 1; printer->windowState = MSG_WINDOW_STATE_SCROLLING_BACK; printer->scrollingTime = 1; sfx_play_sound_with_params(SOUND_MENU_CHANGE_SELECTION, 0, 0, 0); } } else if (gGameStatusPtr->heldButtons[0] & BUTTON_STICK_UP) { - if (printer->currentOption != 0) { - printer->targetOption = printer->currentOption - 1; + if (printer->curOption != 0) { + printer->targetOption = printer->curOption - 1; printer->windowState = MSG_WINDOW_STATE_SCROLLING_BACK; printer->scrollingTime = 1; sfx_play_sound_with_params(SOUND_MENU_CHANGE_SELECTION, 0, 0, 0); @@ -438,8 +438,8 @@ s32 _update_message(MessagePrintState* printer) { printer->scrollingTime++; if (printer->scrollingTime >= 5) { printer->windowState = MSG_WINDOW_STATE_WAITING_FOR_CHOICE; - printer->currentOption = printer->targetOption; - printer->selectedOption = printer->currentOption; + printer->curOption = printer->targetOption; + printer->selectedOption = printer->curOption; } break; } @@ -448,11 +448,11 @@ s32 _update_message(MessagePrintState* printer) { (gGameStatusPtr->pressedButtons[0] & BUTTON_A)) { printer->windowState = MSG_WINDOW_STATE_PRINTING; - printer->currentPrintDelay = 0; + printer->curPrintDelay = 0; printer->stateFlags |= MSG_STATE_FLAG_4; } - if (printer->stateFlags & MSG_STATE_FLAG_4 && !(gGameStatusPtr->currentButtons[0] & BUTTON_A)) { + if (printer->stateFlags & MSG_STATE_FLAG_4 && !(gGameStatusPtr->curButtons[0] & BUTTON_A)) { printer->stateFlags &= ~MSG_STATE_FLAG_4; } @@ -464,7 +464,7 @@ s32 _update_message(MessagePrintState* printer) { switch (printer->windowState) { case MSG_WINDOW_STATE_PRINTING: - if ((gGameStatusPtr->pressedButtons[0] & BUTTON_A) | (gGameStatusPtr->currentButtons[0] & BUTTON_B)) { + if ((gGameStatusPtr->pressedButtons[0] & BUTTON_A) | (gGameStatusPtr->curButtons[0] & BUTTON_B)) { if (!(printer->stateFlags & (MSG_STATE_FLAG_20 | MSG_STATE_FLAG_10)) && !cond) { printer->stateFlags |= MSG_STATE_FLAG_PRINT_QUICKLY; @@ -475,19 +475,19 @@ s32 _update_message(MessagePrintState* printer) { charsToPrint = printer->charsPerChunk; if (printer->windowState == MSG_WINDOW_STATE_INIT) { printer->windowState = MSG_WINDOW_STATE_PRINTING; - printer->currentPrintDelay = 0; + printer->curPrintDelay = 0; } else if (printer->stateFlags & MSG_STATE_FLAG_PRINT_QUICKLY) { charsToPrint = 12; - printer->currentPrintDelay = 0; + printer->curPrintDelay = 0; } else if (!(printer->stateFlags & MSG_STATE_FLAG_4)) { if (!(printer->stateFlags & (MSG_STATE_FLAG_20 | MSG_STATE_FLAG_10)) && - (gGameStatusPtr->currentButtons[0] & BUTTON_A)) + (gGameStatusPtr->curButtons[0] & BUTTON_A)) { charsToPrint = 6; - printer->currentPrintDelay = 0; + printer->curPrintDelay = 0; } } - if ((printer->currentPrintDelay == 0) || --printer->currentPrintDelay == 0) { + if ((printer->curPrintDelay == 0) || --printer->curPrintDelay == 0) { msg_copy_to_print_buffer(printer, charsToPrint, 0); } break; @@ -500,7 +500,7 @@ s32 _update_message(MessagePrintState* printer) { printer->curLinePos += printer->unk_464; if ((printer->stateFlags & MSG_STATE_FLAG_PRINT_QUICKLY) || (!(printer->stateFlags & (MSG_STATE_FLAG_10 | MSG_STATE_FLAG_4)) && - (gGameStatusPtr->currentButtons[0] & BUTTON_A))) + (gGameStatusPtr->curButtons[0] & BUTTON_A))) { printer->curLinePos += 6; } @@ -514,11 +514,11 @@ s32 _update_message(MessagePrintState* printer) { printer->style == MSG_STYLE_LAMPPOST || printer->srcBuffer[printer->srcBufferPos] == MSG_CHAR_READ_WAIT) { - printer->currentPrintDelay = 0; + printer->curPrintDelay = 0; } else { - printer->currentPrintDelay = 5; + printer->curPrintDelay = 5; } - printer->lineEndPos[printer->currentLine] = printer->curLinePos; + printer->lineEndPos[printer->curLine] = printer->curLinePos; } break; case MSG_WINDOW_STATE_B: @@ -559,7 +559,7 @@ s32 _update_message(MessagePrintState* printer) { if (printer->curLinePos >= printer->lineEndPos[printer->unkArraySize]) { printer->curLinePos = printer->lineEndPos[printer->unkArraySize]; printer->windowState = MSG_WINDOW_STATE_C; - if (printer->unkArraySize == printer->currentLine) { + if (printer->unkArraySize == printer->curLine) { printer->windowState = MSG_WINDOW_STATE_WAITING; printer->rewindArrowAnimState = REWIND_ARROW_STATE_INIT; printer->rewindArrowCounter = 0; @@ -717,7 +717,7 @@ void msg_copy_to_print_buffer(MessagePrintState* printer, s32 arg1, s32 arg2) { } break; case MSG_CHAR_READ_PAUSE: - printer->currentPrintDelay = *srcBuf++; + printer->curPrintDelay = *srcBuf++; printer->delayFlags |= MSG_DELAY_FLAG_1; printer->stateFlags &= ~MSG_STATE_FLAG_80; break; @@ -743,8 +743,8 @@ void msg_copy_to_print_buffer(MessagePrintState* printer, s32 arg1, s32 arg2) { break; case MSG_CHAR_READ_NEXT: if (printer->lineCount != 0) { - printer->lineEndPos[printer->currentLine] = printer->curLinePos; - printer->currentLine++; + printer->lineEndPos[printer->curLine] = printer->curLinePos; + printer->curLine++; *printBuf++ = MSG_CHAR_PRINT_NEXT; printer->nextLinePos = printer->curLinePos + (gMsgCharsets[printer->font]->newLineY + D_802EB644[printer->style]) * printer->lineCount; printer->windowState = MSG_WINDOW_STATE_SCROLLING; @@ -922,8 +922,8 @@ void msg_copy_to_print_buffer(MessagePrintState* printer, s32 arg1, s32 arg2) { printer->delayFlags |= MSG_DELAY_FLAG_1; break; case MSG_READ_FUNC_SCROLL: - printer->lineEndPos[printer->currentLine] = printer->curLinePos; - printer->currentLine++; + printer->lineEndPos[printer->curLine] = printer->curLinePos; + printer->curLine++; *printBuf++ = MSG_CHAR_PRINT_NEXT; arg = *srcBuf++; printer->nextLinePos = printer->curLinePos + (gMsgCharsets[printer->font]->newLineY + D_802EB644[printer->style]) * arg; @@ -978,7 +978,7 @@ void msg_copy_to_print_buffer(MessagePrintState* printer, s32 arg1, s32 arg2) { *printBuf++ = MSG_PRINT_FUNC_INLINE_IMAGE; *printBuf++ = *srcBuf++; arg1--; - printer->currentPrintDelay = printer->printDelayTime; + printer->curPrintDelay = printer->printDelayTime; if (arg1 <= 0) { printer->delayFlags |= MSG_DELAY_FLAG_1; } @@ -992,7 +992,7 @@ void msg_copy_to_print_buffer(MessagePrintState* printer, s32 arg1, s32 arg2) { *printBuf++ = *srcBuf++; *printBuf++ = *srcBuf++; *printBuf++ = *srcBuf++; - printer->currentPrintDelay = printer->printDelayTime; + printer->curPrintDelay = printer->printDelayTime; if (--arg1 <= 0) { printer->delayFlags |= MSG_DELAY_FLAG_1; } @@ -1016,7 +1016,7 @@ void msg_copy_to_print_buffer(MessagePrintState* printer, s32 arg1, s32 arg2) { romEnd = icon_ROM_START + gItemIconPaletteOffsets[offset] + 0x20; dma_copy(icon_ROM_START + gItemIconPaletteOffsets[offset], romEnd, D_8015C7E0); - printer->currentPrintDelay = printer->printDelayTime; + printer->curPrintDelay = printer->printDelayTime; if (--arg1 <= 0) { printer->delayFlags |= MSG_DELAY_FLAG_1; } @@ -1025,7 +1025,7 @@ void msg_copy_to_print_buffer(MessagePrintState* printer, s32 arg1, s32 arg2) { } break; case MSG_READ_FUNC_IMAGE: - printer->currentImageIndex = *srcBuf++; + printer->curImageIndex = *srcBuf++; arg = *srcBuf++; argQ = *srcBuf++; printer->varImageScreenPos.x = arg << 8 | argQ; @@ -1092,7 +1092,7 @@ void msg_copy_to_print_buffer(MessagePrintState* printer, s32 arg1, s32 arg2) { sfx_play_sound_with_params(SOUND_MENU_START_TUTORIAL, 0, 0, 0); printer->maxOption = *srcBuf++; printer->madeChoice = 0; - printer->currentOption = 0; + printer->curOption = 0; printer->selectedOption = 0; printer->windowState = MSG_WINDOW_STATE_WAITING_FOR_CHOICE; printer->delayFlags |= MSG_DELAY_FLAG_1; @@ -1233,7 +1233,7 @@ void msg_copy_to_print_buffer(MessagePrintState* printer, s32 arg1, s32 arg2) { if (!(printer->delayFlags & (MSG_DELAY_FLAG_4 | MSG_DELAY_FLAG_2)) && arg1 <= 0) { printer->delayFlags |= MSG_DELAY_FLAG_1; - printer->currentPrintDelay = printer->printDelayTime; + printer->curPrintDelay = printer->printDelayTime; } msg_play_speech_sound(printer, argQ); if (printer->stateFlags & MSG_STATE_FLAG_800000) { @@ -1295,7 +1295,7 @@ void msg_copy_to_print_buffer(MessagePrintState* printer, s32 arg1, s32 arg2) { if (!(printer->delayFlags & (MSG_DELAY_FLAG_4 | MSG_DELAY_FLAG_2)) && arg1 <= 0) { printer->delayFlags |= MSG_DELAY_FLAG_1; - printer->currentPrintDelay = printer->printDelayTime; + printer->curPrintDelay = printer->printDelayTime; } if (!(printer->delayFlags & MSG_DELAY_FLAG_1)) { continue; @@ -1326,7 +1326,7 @@ void initialize_printer(MessagePrintState* printer, s32 arg1, s32 arg2) { printer->unk_464 = 6; printer->srcBuffer = NULL; printer->msgID = 0; - printer->currentPrintDelay = 0; + printer->curPrintDelay = 0; printer->windowOffsetPos.x = 0; printer->windowOffsetPos.y = 0; printer->windowBasePos.x = 0; @@ -1335,11 +1335,11 @@ void initialize_printer(MessagePrintState* printer, s32 arg1, s32 arg2) { printer->rewindArrowCounter = 0; printer->rewindArrowPos.x = 0; printer->rewindArrowPos.y = 0; - printer->currentLine = 0; + printer->curLine = 0; printer->unkArraySize = 0; printer->maxOption = 0; printer->madeChoice = 0; - printer->currentOption = 0; + printer->curOption = 0; printer->selectedOption = 0; printer->cancelOption = -1; printer->windowState = MSG_WINDOW_STATE_DONE; @@ -1356,7 +1356,7 @@ void initialize_printer(MessagePrintState* printer, s32 arg1, s32 arg2) { printer->lineCount = 0; for (i = 0; i < ARRAY_COUNT(printer->animTimers); i++) { - printer->currentAnimFrame[i] = 0; + printer->curAnimFrame[i] = 0; printer->animTimers[i] = -1; } @@ -1377,7 +1377,7 @@ void initialize_printer(MessagePrintState* printer, s32 arg1, s32 arg2) { printer->speedSoundIDA = 0; printer->speedSoundIDB = 0; printer->varBufferReadPos = 0; - printer->currentImageIndex = 0; + printer->curImageIndex = 0; printer->varImageScreenPos.x = 0; printer->varImageScreenPos.y = 0; printer->varImgHasBorder = 0; @@ -2450,7 +2450,7 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit msg_drawState->visiblePrintedCount = 0; msg_drawState->centerPos = 0; msg_drawState->fontVariant = 0; - msg_drawState->currentPosX = 0; + msg_drawState->curPosX = 0; msg_drawState->nextPos[0] = 0; msg_drawState->nextPos[1] = 0; msg_drawState->font = 0; @@ -2499,7 +2499,7 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit case MSG_CHAR_PRINT_FULL_SPACE: case MSG_CHAR_PRINT_HALF_SPACE: msg_drawState->nextPos[0] += msg_get_draw_char_width(msg_drawState->printBuffer[msg_drawState->drawBufferPos], - msg_drawState->font, msg_drawState->fontVariant, msg_drawState->msgScale.x, msg_drawState->currentPosX, + msg_drawState->font, msg_drawState->fontVariant, msg_drawState->msgScale.x, msg_drawState->curPosX, msg_drawState->printModeFlags); msg_drawState->drawBufferPos++; break; @@ -2983,7 +2983,7 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit msg_drawState->drawBufferPos += 2; break; case MSG_PRINT_FUNC_SPACING: - msg_drawState->currentPosX = msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1]; + msg_drawState->curPosX = msg_drawState->printBuffer[msg_drawState->drawBufferPos + 1]; msg_drawState->drawBufferPos += 2; break; case MSG_PRINT_FUNC_SIZE: @@ -3087,7 +3087,7 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit printer->animTimers[animIdx] = msg_drawState->printBuffer[msg_drawState->drawBufferPos + 3]; } if (printer->animTimers[animIdx] == 0) { - printer->currentAnimFrame[animIdx]++; + printer->curAnimFrame[animIdx]++; } dbPos = msg_drawState->drawBufferPos; @@ -3095,7 +3095,7 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit if ((msg_drawState->printBuffer[dbPos - 1] == MSG_CHAR_PRINT_FUNCTION) && (msg_drawState->printBuffer[dbPos] == MSG_PRINT_FUNC_ANIM_DELAY) && (msg_drawState->printBuffer[dbPos + 1] == animIdx)) { - if (msg_drawState->printBuffer[dbPos + 2] != printer->currentAnimFrame[animIdx]) { + if (msg_drawState->printBuffer[dbPos + 2] != printer->curAnimFrame[animIdx]) { dbPos += 4; } else { break; @@ -3106,7 +3106,7 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit (msg_drawState->printBuffer[dbPos + 2] == animIdx)) { if (printer->animTimers[animIdx] == 0) { - printer->currentAnimFrame[animIdx] = msg_drawState->printBuffer[dbPos + 3]; + printer->curAnimFrame[animIdx] = msg_drawState->printBuffer[dbPos + 3]; dbPos = msg_drawState->drawBufferPos; continue; } else { @@ -3364,7 +3364,7 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit phi_s2_5 = (f32) phi_s2_5 * 0.35; } if ((printer->windowState == MSG_WINDOW_STATE_WAITING_FOR_CHOICE) && (msg_drawState->printModeFlags & MSG_PRINT_FLAG_20)) { - if (msg_drawState->unk_2D == printer->currentOption) { + if (msg_drawState->unk_2D == printer->curOption) { msg_drawState->effectFlags |= MSG_FX_FLAG_DROP_SHADOW | MSG_FX_FLAG_GLOBAL_RAINBOW | MSG_FX_FLAG_GLOBAL_WAVE; } else { msg_drawState->effectFlags &= ~MSG_FX_FLAG_GLOBAL_RAINBOW; @@ -3598,7 +3598,7 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit msg_drawState->nextPos[0] += msg_get_draw_char_width(msg_drawState->printBuffer[msg_drawState->drawBufferPos], msg_drawState->font, msg_drawState->fontVariant, msg_drawState->msgScale.x, - msg_drawState->currentPosX, msg_drawState->printModeFlags); + msg_drawState->curPosX, msg_drawState->printModeFlags); msg_drawState->drawBufferPos++; break; } @@ -3609,7 +3609,7 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit s16 varImgFinalAlpha; varImgFinalAlpha = printer->varImgFinalAlpha; - msgVarImage = &(*gMsgVarImages)[printer->currentImageIndex]; + msgVarImage = &(*gMsgVarImages)[printer->curImageIndex]; switch (printer->varImgHasBorder) { case 0: diff --git a/src/npc.c b/src/npc.c index 6b8b05985eb..84937150cc9 100644 --- a/src/npc.c +++ b/src/npc.c @@ -120,17 +120,17 @@ s32 create_npc_impl(NpcBlueprint* blueprint, AnimID* animList, s32 isPeachNpc) { npc->renderMode = 13; npc->blur.any = NULL; npc->yaw = 0.0f; - npc->jumpVelocity = 0.0f; + npc->jumpVel = 0.0f; npc->pos.x = 0.0f; npc->pos.y = 0.0f; npc->pos.z = 0.0f; npc->colliderPos.x = 0.0f; npc->colliderPos.y = 0.0f; npc->colliderPos.z = 0.0f; - npc->rotationPivotOffsetY = 0.0f; - npc->rotation.x = 0.0f; - npc->rotation.y = 0.0f; - npc->rotation.z = 0.0f; + npc->rotPivotOffsetY = 0.0f; + npc->rot.x = 0.0f; + npc->rot.y = 0.0f; + npc->rot.z = 0.0f; npc->homePos.x = 0.0f; npc->homePos.y = 0.0f; npc->homePos.z = 0.0f; @@ -143,7 +143,7 @@ s32 create_npc_impl(NpcBlueprint* blueprint, AnimID* animList, s32 isPeachNpc) { npc->scale.x = 1.0f; npc->scale.y = 1.0f; npc->scale.z = 1.0f; - npc->currentAnim = blueprint->initialAnim; + npc->curAnim = blueprint->initialAnim; npc->animationSpeed = 1.0f; npc->renderYaw = 0.0f; npc->imgfxType = IMGFX_CLEAR; @@ -152,8 +152,8 @@ s32 create_npc_impl(NpcBlueprint* blueprint, AnimID* animList, s32 isPeachNpc) { npc->isFacingAway = FALSE; npc->yawCamOffset = 0; npc->turnAroundYawAdjustment = 0; - npc->currentFloor = NO_COLLIDER; - npc->currentWall = NO_COLLIDER; + npc->curFloor = NO_COLLIDER; + npc->curWall = NO_COLLIDER; npc->palSwapType = 0; npc->palSwapPrevType = 0; npc->screenSpaceOffset2D[0] = 0.0f; @@ -178,9 +178,9 @@ s32 create_npc_impl(NpcBlueprint* blueprint, AnimID* animList, s32 isPeachNpc) { npc->extraAnimList = animList; if (!(npc->flags & NPC_FLAG_HAS_NO_SPRITE)) { if (!(npc->flags & NPC_FLAG_PARTNER)) { - npc->spriteInstanceID = spr_load_npc_sprite(npc->currentAnim, animList); + npc->spriteInstanceID = spr_load_npc_sprite(npc->curAnim, animList); } else { - npc->spriteInstanceID = spr_load_npc_sprite(npc->currentAnim | SPRITE_ID_TAIL_ALLOCATE, animList); + npc->spriteInstanceID = spr_load_npc_sprite(npc->curAnim | SPRITE_ID_TAIL_ALLOCATE, animList); } } else { npc->flags |= NPC_FLAG_INVISIBLE; @@ -313,7 +313,7 @@ void npc_do_world_collision(Npc* npc) { if (hit) { npc->flags |= (NPC_FLAG_COLLDING_WITH_WORLD | NPC_FLAG_COLLDING_FORWARD_WITH_WORLD); - npc->currentWall = NpcHitQueryColliderID; + npc->curWall = NpcHitQueryColliderID; npc->pos.x = testX; npc->pos.z = testZ; } else { @@ -470,16 +470,16 @@ s32 npc_do_player_collision(Npc* npc) { return FALSE; } - if (playerStatus->position.y + playerStatus->colliderHeight < npc->pos.y) { + if (playerStatus->pos.y + playerStatus->colliderHeight < npc->pos.y) { return FALSE; } - if (npc->pos.y + npc->collisionHeight < playerStatus->position.y) { + if (npc->pos.y + npc->collisionHeight < playerStatus->pos.y) { return FALSE; } - playerX = playerStatus->position.x; - playerZ = playerStatus->position.z; + playerX = playerStatus->pos.x; + playerZ = playerStatus->pos.z; npcColRadius = npc->collisionDiameter / 2; playerColRadius = playerStatus->colliderDiameter / 2; @@ -514,28 +514,28 @@ s32 npc_do_player_collision(Npc* npc) { if (playerStatus->animFlags & PA_FLAG_RIDING_PARTNER) { if (fabsf(get_clamped_angle_diff(yaw, playerYaw)) < 45.0f) { - playerStatus->position.x -= deltaX; - playerStatus->position.z -= deltaZ; + playerStatus->pos.x -= deltaX; + playerStatus->pos.z -= deltaZ; wPartnerNpc->pos.x -= deltaX; wPartnerNpc->pos.z -= deltaZ; } else { - playerStatus->position.x -= deltaX * 0.5f; - playerStatus->position.z -= deltaZ * 0.5f; + playerStatus->pos.x -= deltaX * 0.5f; + playerStatus->pos.z -= deltaZ * 0.5f; wPartnerNpc->pos.x -= deltaX * 0.5f; wPartnerNpc->pos.z -= deltaZ * 0.5f; } } else { if (playerStatus->flags & (PS_FLAG_JUMPING | PS_FLAG_FALLING)) { - playerStatus->position.x -= deltaX * 0.4f; - playerStatus->position.z -= deltaZ * 0.4f; + playerStatus->pos.x -= deltaX * 0.4f; + playerStatus->pos.z -= deltaZ * 0.4f; } else { dist = get_clamped_angle_diff(yaw, playerYaw); // required to match if (fabsf(dist) < 45.0f) { - playerStatus->position.x -= deltaX; - playerStatus->position.z -= deltaZ; + playerStatus->pos.x -= deltaX; + playerStatus->pos.z -= deltaZ; } else { - playerStatus->position.x -= deltaX * 0.5f; - playerStatus->position.z -= deltaZ * 0.5f; + playerStatus->pos.x -= deltaX * 0.5f; + playerStatus->pos.z -= deltaZ * 0.5f; } } } @@ -562,13 +562,13 @@ void npc_try_apply_gravity(Npc* npc) { } npc->jumpScale = 1.0f; - npc->jumpVelocity -= npc->jumpScale; - npc->pos.y += npc->jumpVelocity; + npc->jumpVel -= npc->jumpScale; + npc->pos.y += npc->jumpVel; x = npc->pos.x; y = npc->pos.y + 13; z = npc->pos.z; - testLength = length = fabsf(npc->jumpVelocity) + 16; + testLength = length = fabsf(npc->jumpVel) + 16; if (!(npc->flags & NPC_FLAG_PARTNER)) { hitID = npc_raycast_down_sides(npc->collisionChannel, &x, &y, &z, &length); @@ -577,10 +577,10 @@ void npc_try_apply_gravity(Npc* npc) { } if (hitID && length <= testLength) { - npc->jumpVelocity = 0.0f; + npc->jumpVel = 0.0f; npc->flags |= NPC_FLAG_GROUNDED; npc->pos.y = y; - npc->currentFloor = NpcHitQueryColliderID; + npc->curFloor = NpcHitQueryColliderID; } else { npc->flags &= ~NPC_FLAG_GROUNDED; } @@ -614,7 +614,7 @@ s32 npc_try_snap_to_ground(Npc* npc, f32 velocity) { if (hitID != 0 && length <= testLength) { npc->pos.y = y; - npc->currentFloor = NpcHitQueryColliderID; + npc->curFloor = NpcHitQueryColliderID; npc->flags |= NPC_FLAG_GROUNDED; return TRUE; } @@ -649,8 +649,8 @@ void update_npcs(void) { npc->collisionChannel &= ~COLLISION_IGNORE_ENTITIES; } - npc->currentFloor = NO_COLLIDER; - npc->currentWall = NO_COLLIDER; + npc->curFloor = NO_COLLIDER; + npc->curWall = NO_COLLIDER; npc->flags &= ~(NPC_FLAG_COLLDING_FORWARD_WITH_WORLD | NPC_FLAG_COLLDING_WITH_WORLD); npc_do_world_collision(npc); @@ -664,8 +664,8 @@ void update_npcs(void) { } if ((npc->pos.y < -2000.0f) && !(npc->flags & NPC_FLAG_PARTNER)) { - npc->pos.y = playerStatus->position.y; - npc->jumpVelocity = 0.0f; + npc->pos.y = playerStatus->pos.y; + npc->jumpVel = 0.0f; npc->moveSpeed = 0.0f; npc->jumpScale = 0.0f; npc->flags &= ~NPC_FLAG_JUMPING; @@ -673,14 +673,14 @@ void update_npcs(void) { if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) { if (!(npc->flags & NPC_FLAG_HAS_NO_SPRITE)) { - if (npc->currentAnim != 0) { + if (npc->curAnim != 0) { if (npc->spriteInstanceID >= 0) { - spr_update_sprite(npc->spriteInstanceID, npc->currentAnim, npc->animationSpeed); + spr_update_sprite(npc->spriteInstanceID, npc->curAnim, npc->animationSpeed); } } } } else { - spr_update_player_sprite(PLAYER_SPRITE_AUX1, npc->currentAnim, npc->animationSpeed); + spr_update_player_sprite(PLAYER_SPRITE_AUX1, npc->curAnim, npc->animationSpeed); } if (npc->flags & NPC_FLAG_HAS_SHADOW) { @@ -707,23 +707,23 @@ void update_npcs(void) { hitLength = 1000.0f; entity_raycast_down(&x, &y, &z, &hitYaw, &hitPitch, &hitLength); set_npc_shadow_scale(shadow, hitLength, npc->collisionDiameter); - shadow->position.x = x; - shadow->position.y = y; - shadow->position.z = z; - shadow->rotation.x = hitYaw; - shadow->rotation.y = npc->renderYaw; - shadow->rotation.z = hitPitch; + shadow->pos.x = x; + shadow->pos.y = y; + shadow->pos.z = z; + shadow->rot.x = hitYaw; + shadow->rot.y = npc->renderYaw; + shadow->rot.z = hitPitch; shadow->scale.x *= npc->shadowScale; npc->flags &= ~NPC_FLAG_DIRTY_SHADOW; } } else { if (npc->flags & NPC_FLAG_DONT_UPDATE_SHADOW_Y) { - shadow->position.x = npc->pos.x; - shadow->position.z = npc->pos.z; + shadow->pos.x = npc->pos.x; + shadow->pos.z = npc->pos.z; } else { - shadow->position.x = npc->pos.x; - shadow->position.y = npc->pos.y; - shadow->position.z = npc->pos.z; + shadow->pos.x = npc->pos.x; + shadow->pos.y = npc->pos.y; + shadow->pos.z = npc->pos.z; } } } @@ -738,9 +738,9 @@ void update_npcs(void) { if (npc->spriteInstanceID < 0) { npc->spriteInstanceID++; if (npc->spriteInstanceID == -1) { - npc->spriteInstanceID = spr_load_npc_sprite(npc->currentAnim, npc->extraAnimList); + npc->spriteInstanceID = spr_load_npc_sprite(npc->curAnim, npc->extraAnimList); ASSERT(npc->spriteInstanceID >= 0); - spr_update_sprite(npc->spriteInstanceID, npc->currentAnim, npc->animationSpeed); + spr_update_sprite(npc->spriteInstanceID, npc->curAnim, npc->animationSpeed); } } } @@ -759,7 +759,7 @@ f32 npc_get_render_yaw(Npc* npc) { s32 direction; if (!(gOverrideFlags & (GLOBAL_OVERRIDES_8000 | GLOBAL_OVERRIDES_4000))) { - cameraYaw = camera->currentYaw; + cameraYaw = camera->curYaw; camRelativeYaw = get_clamped_angle_diff(cameraYaw, npc->yaw); if (camRelativeYaw < -5.0f && camRelativeYaw > -175.0f) { @@ -826,28 +826,28 @@ void appendGfx_npc(void* data) { guMtxCatF(mtx2, mtx1, mtx1); } - if (npc->rotationPivotOffsetY != 0.0f) { - guTranslateF(mtx2, 0.0f, npc->rotationPivotOffsetY, 0.0f); + if (npc->rotPivotOffsetY != 0.0f) { + guTranslateF(mtx2, 0.0f, npc->rotPivotOffsetY, 0.0f); guMtxCatF(mtx2, mtx1, mtx1); } - if (npc->rotation.y != 0.0f) { - guRotateF(mtx2, npc->rotation.y, 0.0f, 1.0f, 0.0f); + if (npc->rot.y != 0.0f) { + guRotateF(mtx2, npc->rot.y, 0.0f, 1.0f, 0.0f); guMtxCatF(mtx2, mtx1, mtx1); } - if (npc->rotation.x != 0.0f) { - guRotateF(mtx2, npc->rotation.x, 1.0f, 0.0f, 0.0f); + if (npc->rot.x != 0.0f) { + guRotateF(mtx2, npc->rot.x, 1.0f, 0.0f, 0.0f); guMtxCatF(mtx2, mtx1, mtx1); } - if (npc->rotation.z != 0.0f) { - guRotateF(mtx2, npc->rotation.z, 0.0f, 0.0f, 1.0f); + if (npc->rot.z != 0.0f) { + guRotateF(mtx2, npc->rot.z, 0.0f, 0.0f, 1.0f); guMtxCatF(mtx2, mtx1, mtx1); } - if (npc->rotationPivotOffsetY != 0.0f) { - guTranslateF(mtx2, 0.0f, -npc->rotationPivotOffsetY, 0.0f); + if (npc->rotPivotOffsetY != 0.0f) { + guTranslateF(mtx2, 0.0f, -npc->rotPivotOffsetY, 0.0f); guMtxCatF(mtx2, mtx1, mtx1); } @@ -864,7 +864,7 @@ void appendGfx_npc(void* data) { } if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) { - if (!(npc->flags & NPC_FLAG_HAS_NO_SPRITE) && (npc->currentAnim != 0) && (npc->spriteInstanceID >= 0)) { + if (!(npc->flags & NPC_FLAG_HAS_NO_SPRITE) && (npc->curAnim != 0) && (npc->spriteInstanceID >= 0)) { npc_draw_with_palswap(npc, renderYaw, mtx1); npc->animNotifyValue = spr_get_notify_value(npc->spriteInstanceID); } @@ -879,8 +879,8 @@ void appendGfx_npc(void* data) { mtx_ident_mirror_y(mtx2); guMtxCatF(mtx2, mtx1, mtx1); } - if ((npc->rotation.y != 0.0f) || (npc->rotation.x != 0.0f) || (npc->rotation.z != 0.0f)) { - guRotateRPYF(mtx2, npc->rotation.x, npc->rotation.y, npc->rotation.z); + if ((npc->rot.y != 0.0f) || (npc->rot.x != 0.0f) || (npc->rot.z != 0.0f)) { + guRotateRPYF(mtx2, npc->rot.x, npc->rot.y, npc->rot.z); guMtxCatF(mtx2, mtx1, mtx1); } @@ -898,7 +898,7 @@ void appendGfx_npc(void* data) { } if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) { - if (!(npc->flags & NPC_FLAG_HAS_NO_SPRITE) && (npc->currentAnim != 0)) { + if (!(npc->flags & NPC_FLAG_HAS_NO_SPRITE) && (npc->curAnim != 0)) { spr_draw_npc_sprite(npc->spriteInstanceID, renderYaw, 0, 0, mtx1); } } else { @@ -911,8 +911,8 @@ void appendGfx_npc(void* data) { mtx_ident_mirror_y(mtx2); guMtxCatF(mtx2, mtx1, mtx1); - if (npc->rotation.y != 0.0f || npc->rotation.x != 0.0f || npc->rotation.z != 0.0f) { - guRotateRPYF(mtx2, npc->rotation.x, npc->rotation.y, npc->rotation.z); + if (npc->rot.y != 0.0f || npc->rot.x != 0.0f || npc->rot.z != 0.0f) { + guRotateRPYF(mtx2, npc->rot.x, npc->rot.y, npc->rot.z); guMtxCatF(mtx2, mtx1, mtx1); } @@ -928,7 +928,7 @@ void appendGfx_npc(void* data) { guMtxCatF(mtx2, mtx1, mtx1); } if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) { - if (!(npc->flags & NPC_FLAG_HAS_NO_SPRITE) && (npc->currentAnim != 0)) { + if (!(npc->flags & NPC_FLAG_HAS_NO_SPRITE) && (npc->curAnim != 0)) { spr_draw_npc_sprite(npc->spriteInstanceID, renderYaw, 0, 0, mtx1); } } else { @@ -962,7 +962,7 @@ void render_npcs(void) { renderDist = 10000.0f; } - renderTaskPtr->distance = -renderDist; + renderTaskPtr->dist = -renderDist; renderTaskPtr->appendGfxArg = npc; renderTaskPtr->appendGfx = appendGfx_npc; renderTaskPtr->renderMode = npc->renderMode; @@ -980,7 +980,7 @@ void render_npcs(void) { } if (npc->flags & NPC_FLAG_MOTION_BLUR) { - renderTaskPtr->distance = -renderDist; + renderTaskPtr->dist = -renderDist; renderTaskPtr->appendGfx = appendGfx_npc_blur; renderTaskPtr->appendGfxArg = npc; renderTaskPtr->renderMode = RENDER_MODE_SURFACE_XLU_LAYER1; @@ -1063,7 +1063,7 @@ void set_npc_sprite(Npc* npc, s32 anim, AnimID* extraAnimList) { ASSERT(npc->spriteInstanceID >= 0); } - npc->currentAnim = anim; + npc->curAnim = anim; if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) { if (!(npc->flags & NPC_FLAG_HAS_NO_SPRITE)) { @@ -1157,16 +1157,16 @@ void appendGfx_npc_blur(void* data) { yaw = npc->renderYaw; guTranslateF(sp20, x, y, z); - if (npc->rotation.y != 0.0f) { - guRotateF(sp60, npc->rotation.y, 0.0f, 1.0f, 0.0f); + if (npc->rot.y != 0.0f) { + guRotateF(sp60, npc->rot.y, 0.0f, 1.0f, 0.0f); guMtxCatF(sp60, sp20, sp20); } - if (npc->rotation.x != 0.0f) { - guRotateF(sp60, npc->rotation.y, 0.0f, 1.0f, 0.0f); + if (npc->rot.x != 0.0f) { + guRotateF(sp60, npc->rot.y, 0.0f, 1.0f, 0.0f); guMtxCatF(sp60, sp20, sp20); } - if (npc->rotation.z != 0.0f) { - guRotateF(sp60, npc->rotation.y, 0.0f, 1.0f, 0.0f); + if (npc->rot.z != 0.0f) { + guRotateF(sp60, npc->rot.y, 0.0f, 1.0f, 0.0f); guMtxCatF(sp60, sp20, sp20); } @@ -1217,19 +1217,19 @@ void npc_reload_all(void) { if (npc->flags && !(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) { if (!(npc->flags & NPC_FLAG_HAS_NO_SPRITE)) { if (!(npc->flags & NPC_FLAG_PARTNER)) { - npc->spriteInstanceID = spr_load_npc_sprite(npc->currentAnim, npc->extraAnimList); + npc->spriteInstanceID = spr_load_npc_sprite(npc->curAnim, npc->extraAnimList); } else { - npc->spriteInstanceID = spr_load_npc_sprite(npc->currentAnim | SPRITE_ID_TAIL_ALLOCATE, npc->extraAnimList); + npc->spriteInstanceID = spr_load_npc_sprite(npc->curAnim | SPRITE_ID_TAIL_ALLOCATE, npc->extraAnimList); } } if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) { if (!(npc->flags & NPC_FLAG_HAS_NO_SPRITE) && (npc->palSwapType != 0)) { - npc->spritePaletteList = spr_get_npc_palettes(npc->currentAnim >> 16); + npc->spritePaletteList = spr_get_npc_palettes(npc->curAnim >> 16); npc->paletteCount = 0; while (npc->spritePaletteList[npc->paletteCount] != (PAL_PTR) -1) { npc->paletteCount++; } - npc->unk_C0 = spr_get_npc_color_variations(npc->currentAnim >> 16); + npc->unk_C0 = spr_get_npc_color_variations(npc->curAnim >> 16); } if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) { if (!(npc->flags & NPC_FLAG_HAS_NO_SPRITE)) { @@ -1248,7 +1248,7 @@ void npc_reload_all(void) { void set_npc_yaw(Npc* npc, f32 yaw) { npc->yaw = yaw; - if (get_clamped_angle_diff(gCameras[gCurrentCameraID].currentYaw, yaw) >= 0.0f) { + if (get_clamped_angle_diff(gCameras[gCurrentCameraID].curYaw, yaw) >= 0.0f) { npc->yawCamOffset = 180; npc->isFacingAway = TRUE; } else { @@ -1349,13 +1349,13 @@ s32 npc_draw_palswap_mode_1(Npc* npc, s32 arg1, Matrix4f mtx) { PAL_PTR dst; if (npc->dirtyPalettes != 0) { - npc->spritePaletteList = spr_get_npc_palettes(npc->currentAnim >> 16); + npc->spritePaletteList = spr_get_npc_palettes(npc->curAnim >> 16); npc->paletteCount = 0; while ((s32)npc->spritePaletteList[npc->paletteCount] != -1) { npc->paletteCount++; } - npc->unk_C0 = spr_get_npc_color_variations(npc->currentAnim >> 16); + npc->unk_C0 = spr_get_npc_color_variations(npc->curAnim >> 16); for (i = 0; i < npc->paletteCount; i++) { dst = npc->localPaletteData[i]; src = npc->spritePaletteList[i]; @@ -1455,7 +1455,7 @@ s32 npc_draw_palswap_mode_2(Npc* npc, s32 arg1, s32 arg2, Matrix4f mtx) { if (npc->dirtyPalettes != 0) { if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) { - npc->spritePaletteList = spr_get_npc_palettes(npc->currentAnim >> 16); + npc->spritePaletteList = spr_get_npc_palettes(npc->curAnim >> 16); } npc->paletteCount = 0; @@ -1585,7 +1585,7 @@ s32 npc_draw_palswap_mode_4(Npc* npc, s32 arg1, Matrix4f mtx) { if (npc->dirtyPalettes != 0) { if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) { - npc->spritePaletteList = spr_get_npc_palettes(npc->currentAnim >> 16); + npc->spritePaletteList = spr_get_npc_palettes(npc->curAnim >> 16); } npc->paletteCount = 0; @@ -2015,7 +2015,7 @@ Npc* npc_find_closest_simple(f32 x, f32 y, f32 z, f32 radius) { s32 npc_find_standing_on_entity(s32 entityIndex) { s32 idx = entityIndex | COLLISION_WITH_ENTITY_BIT; - s32 y = get_entity_by_index(idx)->position.y - 10.0f; + s32 y = get_entity_by_index(idx)->pos.y - 10.0f; Npc* npc; s32 i; s32 var_v1; @@ -2048,8 +2048,8 @@ s32 npc_find_standing_on_entity(s32 entityIndex) { } } } else { - var_v1 = npc->currentFloor; - if (npc->currentFloor & COLLISION_WITH_ENTITY_BIT) { // TODO required to match (can't use var_v1) + var_v1 = npc->curFloor; + if (npc->curFloor & COLLISION_WITH_ENTITY_BIT) { // TODO required to match (can't use var_v1) if (idx == var_v1) { npc->pos = npc->pos; // TODO required to match return i; @@ -2068,7 +2068,7 @@ s32 npc_get_collider_below(Npc* npc) { f32 yaw; if (npc->flags & NPC_FLAG_PARTNER) { - y = get_shadow_by_index(npc->shadowIndex)->position.y + 13.0f; + y = get_shadow_by_index(npc->shadowIndex)->pos.y + 13.0f; } else { y = npc->pos.y + 13.0f; } @@ -2171,7 +2171,7 @@ void spawn_surface_effects(Npc* npc, SurfaceInteractMode mode) { if ((npc->flags & (NPC_FLAG_TOUCHES_GROUND | NPC_FLAG_INVISIBLE)) == NPC_FLAG_TOUCHES_GROUND) { if (npc->moveSpeed != 0.0f) { - s32 surfaceType = get_collider_flags((u16)npc->currentFloor) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; + s32 surfaceType = get_collider_flags((u16)npc->curFloor) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; switch (surfaceType) { case SURFACE_TYPE_FLOWERS: spawn_flower_surface_effects(npc, mode); @@ -2455,9 +2455,9 @@ void clear_encounter_status(void) { currentEncounter->firstStrikeType = FIRST_STRIKE_NONE; currentEncounter->hitType = 0; currentEncounter->battleTriggerCooldown = 0; - currentEncounter->currentAreaIndex = gGameStatusPtr->areaID; - currentEncounter->currentMapIndex = gGameStatusPtr->mapID; - currentEncounter->currentEntryIndex = gGameStatusPtr->entryID; + currentEncounter->curAreaIndex = gGameStatusPtr->areaID; + currentEncounter->curMapIndex = gGameStatusPtr->mapID; + currentEncounter->curEntryIndex = gGameStatusPtr->entryID; currentEncounter->npcGroupList = 0; currentEncounter->unk_08 = 0; currentEncounter->scriptedBattle = FALSE; @@ -2630,7 +2630,7 @@ void kill_enemy(Enemy* enemy) { do { if (!(enemy->flags & ENEMY_FLAG_4) - && (!(enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) || (enemy == encounterStatus->currentEnemy)) + && (!(enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) || (enemy == encounterStatus->curEnemy)) && !(enemy->flags & ENEMY_FLAG_PASSIVE) ) { if (!(enemy->flags & ENEMY_FLAG_FLED)) { diff --git a/src/pause/pause_partners.c b/src/pause/pause_partners.c index 55ea327e727..45f2ece65c1 100644 --- a/src/pause/pause_partners.c +++ b/src/pause/pause_partners.c @@ -628,7 +628,7 @@ void pause_partners_init(MenuPanel* panel) { gPausePartnersCurrentPartnerIdx = 0; for (i = 0; i < gPausePartnersNumPartners; i++) { - if (playerData->currentPartner == gPausePartnersPartnerIDs[gPausePartnersPartnerIdx[i]]) { + if (playerData->curPartner == gPausePartnersPartnerIDs[gPausePartnersPartnerIdx[i]]) { gPausePartnersCurrentPartnerIdx = i; break; } diff --git a/src/pulse_stone.c b/src/pulse_stone.c index 2eec47b177c..f7d6733c7f6 100644 --- a/src/pulse_stone.c +++ b/src/pulse_stone.c @@ -70,9 +70,9 @@ void pulse_stone_notification_setup(void) { PlayerStatus* playerStatus = &gPlayerStatus; mem_clear(PulseStonePtr, sizeof(*PulseStonePtr)); - PulseStonePtr->pos.x = playerStatus->position.x; - PulseStonePtr->pos.y = playerStatus->position.y + playerStatus->colliderHeight + 8.0f; - PulseStonePtr->pos.z = playerStatus->position.z; + PulseStonePtr->pos.x = playerStatus->pos.x; + PulseStonePtr->pos.y = playerStatus->pos.y + playerStatus->colliderHeight + 8.0f; + PulseStonePtr->pos.z = playerStatus->pos.z; playerStatus->animFlags |= PA_FLAG_PULSE_STONE_VISIBLE; PulseStoneNotificationCallback = pulse_stone_notification_update; } @@ -86,7 +86,7 @@ void appendGfx_pulse_stone_icon(void) { if (playerStatus->animFlags & PA_FLAG_PULSE_STONE_VISIBLE) { guScaleF(sp18, PulseStonePtr->scale, PulseStonePtr->scale, PulseStonePtr->scale); - guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(sp18, sp58, sp18); guTranslateF(sp58, PulseStonePtr->pos.x, PulseStonePtr->pos.y, PulseStonePtr->pos.z); guMtxCatF(sp18, sp58, sp58); @@ -153,9 +153,9 @@ void pulse_stone_notification_update(void) { PlayerStatus* playerStatus = &gPlayerStatus; PulseStonePtr->pos.y += - ((playerStatus->position.y + playerStatus->colliderHeight + 10.0f) - PulseStonePtr->pos.y) / 1.5f; - PulseStonePtr->pos.x = playerStatus->position.x; - PulseStonePtr->pos.z = playerStatus->position.z; + ((playerStatus->pos.y + playerStatus->colliderHeight + 10.0f) - PulseStonePtr->pos.y) / 1.5f; + PulseStonePtr->pos.x = playerStatus->pos.x; + PulseStonePtr->pos.z = playerStatus->pos.z; if (!should_continue_pulse_stone()) { PulseStoneNotificationCallback = NULL; diff --git a/src/rumble.c b/src/rumble.c index 765fc4f5416..d813af32ab1 100644 --- a/src/rumble.c +++ b/src/rumble.c @@ -32,8 +32,8 @@ void start_rumble(s32 freq, s32 nframes) { } void update_max_rumble_duration(void) { - if (rumbleButtons != gGameStatusPtr->currentButtons[0]) { - rumbleButtons = gGameStatusPtr->currentButtons[0]; + if (rumbleButtons != gGameStatusPtr->curButtons[0]) { + rumbleButtons = gGameStatusPtr->curButtons[0]; reset_max_rumble_duration(); } diff --git a/src/speech_bubble.c b/src/speech_bubble.c index 0def59631e3..a56d7a7c06b 100644 --- a/src/speech_bubble.c +++ b/src/speech_bubble.c @@ -40,7 +40,7 @@ void interact_speech_setup(void) { temp = SpeechBubblePtr; temp->state = 0; temp->scale = 0.4f; - SpeechBubblePtr->yaw = -gCameras[gCurrentCameraID].currentYaw; + SpeechBubblePtr->yaw = -gCameras[gCurrentCameraID].curYaw; SpeechBubblePtr->brightness = 255; } @@ -50,7 +50,7 @@ void appendGfx_speech_bubble(void) { if (gPlayerStatus.animFlags & PA_FLAG_SPEECH_PROMPT_AVAILABLE) { guScaleF(mtxTemp, SpeechBubblePtr->scale, SpeechBubblePtr->scale, SpeechBubblePtr->scale); - guRotateF(mtxTransform, SpeechBubblePtr->yaw - gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(mtxTransform, SpeechBubblePtr->yaw - gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(mtxTemp, mtxTransform, mtxTemp); guTranslateF(mtxTransform, SpeechBubblePtr->pos.x, SpeechBubblePtr->pos.y, SpeechBubblePtr->pos.z); guMtxCatF(mtxTemp, mtxTransform, mtxTransform); diff --git a/src/sprite.c b/src/sprite.c index 242b246eba7..cd425c7f6a2 100644 --- a/src/sprite.c +++ b/src/sprite.c @@ -437,7 +437,7 @@ void spr_draw_component(s32 drawOpts, SpriteComponent* component, SpriteAnimComp f32 rotX, rotY, rotZ; f32 inX, inY, inZ; - if (component->initialized && component->currentRaster != -1) { + if (component->initialized && component->curRaster != -1) { rotX = D_802DFEA0[0]; rotY = D_802DFEA0[1]; rotZ = D_802DFEA0[2]; @@ -446,10 +446,10 @@ void spr_draw_component(s32 drawOpts, SpriteComponent* component, SpriteAnimComp inZ = component->compPos.z + anim->compOffset.z; spr_transform_point(rotX, rotY, rotZ, inX, inY, inZ * zscale, &dx, &dy, &dz); - cacheEntry = cache[component->currentRaster]; - paletteIdx = component->currentPalette; + cacheEntry = cache[component->curRaster]; + paletteIdx = component->curPalette; if (drawOpts & DRAW_SPRITE_USE_PLAYER_RASTERS) { - cacheEntry->image = spr_get_player_raster(component->currentRaster & 0xFFF, D_802DF57C); + cacheEntry->image = spr_get_player_raster(component->curRaster & 0xFFF, D_802DF57C); } D_802DF540 = component->imgfxIdx; pal = palettes[paletteIdx]; @@ -457,9 +457,9 @@ void spr_draw_component(s32 drawOpts, SpriteComponent* component, SpriteAnimComp spr_appendGfx_component( cacheEntry, dx, dy, dz, - rotX + component->rotation.x, - rotY + component->rotation.y, - rotZ + component->rotation.z, + rotX + component->rot.x, + rotY + component->rot.y, + rotZ + component->rot.z, component->scale.x, component->scale.y, component->scale.z, @@ -528,9 +528,9 @@ void spr_component_update_commands(SpriteComponent* comp, SpriteAnimComponent* a comp->posOffset.z = 0.0f; comp->posOffset.y = 0.0f; comp->posOffset.x = 0.0f; - comp->rotation.z = 0; - comp->rotation.y = 0; - comp->rotation.x = 0; + comp->rot.z = 0; + comp->rot.y = 0; + comp->rot.x = 0; comp->scale.z = 1.0f; comp->scale.y = 1.0f; comp->scale.x = 1.0f; @@ -550,20 +550,20 @@ void spr_component_update_commands(SpriteComponent* comp, SpriteAnimComponent* a case 0x1000: cmdValue = *bufPos++ & 0xFFF; if (cmdValue != 0xFFF) { - comp->currentRaster = cmdValue; + comp->curRaster = cmdValue; } else { - comp->currentRaster = -1; + comp->curRaster = -1; } - comp->currentPalette = -1; + comp->curPalette = -1; break; // 6VVV // SetPalette -- FFF to clear case 0x6000: cmdValue = *bufPos++ & 0xFFF; if (cmdValue != 0xFFF) { - comp->currentPalette = cmdValue; + comp->curPalette = cmdValue; } else { - comp->currentPalette = -1; + comp->curPalette = -1; } break; // 8VUU @@ -653,9 +653,9 @@ void spr_component_update_commands(SpriteComponent* comp, SpriteAnimComponent* a comp->posOffset.z = posZ; } if (changedFlags & 2) { - comp->rotation.x = rotX; - comp->rotation.y = rotY; - comp->rotation.z = rotZ; + comp->rot.x = rotX; + comp->rot.y = rotY; + comp->rot.z = rotZ; } if (changedFlags & 4) { comp->scale.x = scaleX; @@ -683,12 +683,12 @@ void spr_component_update_finish(SpriteComponent* comp, SpriteComponent** compLi comp->compPos.z += listComp->compPos.z; } - if (comp->currentRaster != -1) { - cache = rasterCacheEntry[comp->currentRaster]; - if (comp->currentPalette == -1) { - comp->currentPalette = cache->palette; - if (overridePalette != 0 && comp->currentPalette == 0) { - comp->currentPalette = overridePalette; + if (comp->curRaster != -1) { + cache = rasterCacheEntry[comp->curRaster]; + if (comp->curPalette == -1) { + comp->curPalette = cache->palette; + if (overridePalette != 0 && comp->curPalette == 0) { + comp->curPalette = overridePalette; } } } @@ -728,17 +728,17 @@ void spr_init_component_anim_state(SpriteComponent* comp, SpriteAnimComponent* a comp->readPos = anim->cmdList; comp->waitTime = 0; comp->loopCounter = 0; - comp->currentRaster = -1; - comp->currentPalette = -1; + comp->curRaster = -1; + comp->curPalette = -1; comp->posOffset.x = 0.0f; comp->posOffset.y = 0.0f; comp->posOffset.z = 0.0f; comp->compPos.x = 0.0f; comp->compPos.y = 0.0f; comp->compPos.z = 0.0f; - comp->rotation.x = 0.0f; - comp->rotation.y = 0.0f; - comp->rotation.z = 0.0f; + comp->rot.x = 0.0f; + comp->rot.y = 0.0f; + comp->rot.z = 0.0f; comp->scale.x = 1.0f; comp->scale.y = 1.0f; comp->scale.z = 1.0f; @@ -810,7 +810,7 @@ void spr_init_sprites(s32 playerSpriteSet) { SpriteInstances[i].spriteIndex = 0; SpriteInstances[i].componentList = NULL; SpriteInstances[i].spriteData = NULL; - SpriteInstances[i].currentAnimID = -1; + SpriteInstances[i].curAnimID = -1; SpriteInstances[i].notifyValue = 0; } @@ -920,7 +920,7 @@ s32 spr_draw_player_sprite(s32 spriteInstanceID, s32 yaw, s32 alphaIn, PAL_PTR* } if (!(spriteInstanceID & DRAW_SPRITE_OVERRIDE_YAW)) { - yaw += (s32)-gCameras[gCurrentCamID].currentYaw; + yaw += (s32)-gCameras[gCurrentCamID].curYaw; if (yaw > 360) { yaw -= 360; } @@ -1071,7 +1071,7 @@ s32 spr_load_npc_sprite(s32 animID, u32* extraAnimList) { compList++; } SpriteInstances[listIndex].spriteIndex = spriteIndex; - SpriteInstances[listIndex].currentAnimID = -1; + SpriteInstances[listIndex].curAnimID = -1; return listIndex; } @@ -1094,9 +1094,9 @@ s32 spr_update_sprite(s32 spriteInstanceID, s32 animID, f32 timeScale) { palID = (animID >> 8) & 0xFF; spr_set_anim_timescale(timeScale); - if ((spriteInstanceID & DRAW_SPRITE_OVERRIDE_ALPHA) || ((SpriteInstances[i].currentAnimID & 0xFF) != animIndex)) { + if ((spriteInstanceID & DRAW_SPRITE_OVERRIDE_ALPHA) || ((SpriteInstances[i].curAnimID & 0xFF) != animIndex)) { spr_init_anim_state(compList, animList); - SpriteInstances[i].currentAnimID = (palID << 8) | animIndex; + SpriteInstances[i].curAnimID = (palID << 8) | animIndex; SpriteInstances[i].notifyValue = 0; } if (!(spriteInstanceID & DRAW_SPRITE_OVERRIDE_YAW)) { @@ -1108,7 +1108,7 @@ s32 spr_update_sprite(s32 spriteInstanceID, s32 animID, f32 timeScale) { s32 spr_draw_npc_sprite(s32 spriteInstanceID, s32 yaw, s32 arg2, PAL_PTR* paletteList, Matrix4f mtx) { s32 i = spriteInstanceID & 0xFF; - s32 animID = SpriteInstances[i].currentAnimID; + s32 animID = SpriteInstances[i].curAnimID; SpriteRasterCacheEntry** rasters; PAL_PTR* palettes; SpriteAnimComponent** animComponents; @@ -1135,7 +1135,7 @@ s32 spr_draw_npc_sprite(s32 spriteInstanceID, s32 yaw, s32 arg2, PAL_PTR* palett D_802DFEA0[2] = 0; if (!(spriteInstanceID & DRAW_SPRITE_OVERRIDE_YAW)) { - yaw += gCameras[gCurrentCamID].currentYaw; + yaw += gCameras[gCurrentCamID].curYaw; if (yaw > 360) { yaw -= 360; } @@ -1214,7 +1214,7 @@ s32 spr_free_sprite(s32 spriteInstanceID) { SpriteInstances[spriteInstanceID].spriteIndex = 0; SpriteInstances[spriteInstanceID].componentList = NULL; SpriteInstances[spriteInstanceID].spriteData = NULL; - SpriteInstances[spriteInstanceID].currentAnimID = -1; + SpriteInstances[spriteInstanceID].curAnimID = -1; return 0; } @@ -1272,7 +1272,7 @@ s32 spr_get_comp_position(s32 spriteIdx, s32 compListIdx, s32* outX, s32* outY, return; // bug: does not return a value } - animID = sprite->currentAnimID; + animID = sprite->curAnimID; if (animID != 255) { // following 3 lines equivalent to: // animCompList = sprite->spriteData->animListStart[animID]; diff --git a/src/sprite.h b/src/sprite.h index 05b18e3498f..0f66c7c581c 100644 --- a/src/sprite.h +++ b/src/sprite.h @@ -40,11 +40,11 @@ typedef struct SpriteComponent { /* 0x08 */ s16* readPos; /* 0x0C */ f32 waitTime; /* 0x10 */ s32 loopCounter; - /* 0x14 */ s32 currentRaster; - /* 0x18 */ s32 currentPalette; + /* 0x14 */ s32 curRaster; + /* 0x18 */ s32 curPalette; /* 0x1C */ Vec3f posOffset; /* 0x28 */ Vec3f compPos; - /* 0x34 */ Vec3i rotation; + /* 0x34 */ Vec3i rot; /* 0x40 */ Vec3f scale; /* 0x4C */ s32 imgfxIdx; } SpriteComponent; // size = 0x50 @@ -83,7 +83,7 @@ typedef struct SpriteInstance { /* 0x00 */ s32 spriteIndex; /* 0x04 */ SpriteComponent** componentList; /* 0x08 */ SpriteAnimData* spriteData; - /* 0x0C */ s32 currentAnimID; + /* 0x0C */ s32 curAnimID; /* 0x10 */ s32 notifyValue; } SpriteInstance; // size = 0x14 diff --git a/src/state_battle.c b/src/state_battle.c index ef85d159914..ceee4d039e8 100644 --- a/src/state_battle.c +++ b/src/state_battle.c @@ -176,7 +176,7 @@ void state_step_end_battle(void) { void* mapShape; u32 sizeTemp; - partner_init_after_battle(playerData->currentPartner); + partner_init_after_battle(playerData->curPartner); load_map_script_lib(); mapShape = load_asset_by_name(wMapShapeName, &sizeTemp); decode_yay0(mapShape, &gMapShapeData); diff --git a/src/state_demo.c b/src/state_demo.c index 86f7f99f8bf..72ed95d370d 100644 --- a/src/state_demo.c +++ b/src/state_demo.c @@ -229,7 +229,7 @@ void state_step_demo(void) { gGameStatusPtr->mapID = mapID; gGameStatusPtr->entryID = demoSceneData->index; gGameStatusPtr->peachFlags = 0; - playerData->currentPartner = demoSceneData->partnerID; + playerData->curPartner = demoSceneData->partnerID; set_cam_viewport(0, 29, 20, -262, 177); evt_set_variable(NULL, GB_StoryProgress, demoSceneData->storyProgress); @@ -247,7 +247,7 @@ void state_step_demo(void) { gGameStatusPtr->mapID = mapID; gGameStatusPtr->entryID = demoSceneData->index; gGameStatusPtr->peachFlags = PEACH_STATUS_FLAG_IS_PEACH; - playerData->currentPartner = demoSceneData->partnerID; + playerData->curPartner = demoSceneData->partnerID; set_cam_viewport(0, 29, 20, -262, 177); evt_set_variable(NULL, GB_StoryProgress, demoSceneData->storyProgress); diff --git a/src/state_intro.c b/src/state_intro.c index f1ddd1f2fc7..73875a3581f 100644 --- a/src/state_intro.c +++ b/src/state_intro.c @@ -195,7 +195,7 @@ void state_step_intro(void) { playerData->partners[i].enabled = 0; } - playerData->currentPartner = PARTNER_NONE; + playerData->curPartner = PARTNER_NONE; load_map_by_IDs(gGameStatusPtr->areaID, gGameStatusPtr->mapID, 0); gGameStatusPtr->introState = INTRO_STATE_3; disable_player_input(); diff --git a/src/status_icons.c b/src/status_icons.c index 42d324c64b6..4ce4a14c9d2 100644 --- a/src/status_icons.c +++ b/src/status_icons.c @@ -622,7 +622,7 @@ void draw_all_status_icons(void* data) { y = icon->worldPos.y + icon->status1OffsetY; z = icon->worldPos.z; - add_vec2D_polar(&x, &z, icon->status1Radius, clamp_angle(camera->currentYaw + 90)); + add_vec2D_polar(&x, &z, icon->status1Radius, clamp_angle(camera->curYaw + 90)); get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ); elementId = icon->status1.activeElementID; hud_element_set_render_pos(elementId, screenX - 8, screenY - 8); @@ -643,7 +643,7 @@ void draw_all_status_icons(void* data) { y = icon->worldPos.y + icon->status1OffsetY; z = icon->worldPos.z; - add_vec2D_polar(&x, &z, icon->status1Radius, clamp_angle(camera->currentYaw + 90)); + add_vec2D_polar(&x, &z, icon->status1Radius, clamp_angle(camera->curYaw + 90)); get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ); elementId = icon->status1.removingElementID; hud_element_set_render_pos(elementId, screenX - 8, screenY - 8); @@ -666,7 +666,7 @@ void draw_all_status_icons(void* data) { y = icon->worldPos.y + icon->status2OffsetY + offsetY; z = icon->worldPos.z; - add_vec2D_polar(&x, &z, icon->status2Radius, clamp_angle(camera->currentYaw + 90)); + add_vec2D_polar(&x, &z, icon->status2Radius, clamp_angle(camera->curYaw + 90)); get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ); elementId = icon->status2.activeElementID; hud_element_set_render_pos(elementId, screenX - 8, screenY - 8); @@ -692,7 +692,7 @@ void draw_all_status_icons(void* data) { y = icon->worldPos.y + icon->status2OffsetY + offsetY; z = icon->worldPos.z; - add_vec2D_polar(&x, &z, icon->status2Radius, clamp_angle(camera->currentYaw + 90)); + add_vec2D_polar(&x, &z, icon->status2Radius, clamp_angle(camera->curYaw + 90)); get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ); elementId = icon->status2.removingElementID; hud_element_set_render_pos(elementId, screenX - 8, screenY - 8); @@ -717,7 +717,7 @@ void draw_all_status_icons(void* data) { y = icon->worldPos.y + icon->status3OffsetY + offsetY; z = icon->worldPos.z; - add_vec2D_polar(&x, &z, icon->status3Radius, clamp_angle(camera->currentYaw + 90)); + add_vec2D_polar(&x, &z, icon->status3Radius, clamp_angle(camera->curYaw + 90)); get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ); elementId = icon->status3.activeElementID; hud_element_set_render_pos(elementId, screenX - 8, screenY - 8); @@ -745,7 +745,7 @@ void draw_all_status_icons(void* data) { y = icon->worldPos.y + icon->status3OffsetY + offsetY; z = icon->worldPos.z; - add_vec2D_polar(&x, &z, icon->status3Radius, clamp_angle(camera->currentYaw + 90)); + add_vec2D_polar(&x, &z, icon->status3Radius, clamp_angle(camera->curYaw + 90)); get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ); elementId = icon->status3.removingElementID; hud_element_set_render_pos(elementId, screenX - 8, screenY - 8); @@ -774,7 +774,7 @@ void draw_all_status_icons(void* data) { y = icon->worldPos.y + icon->status4OffsetY + offsetY; z = icon->worldPos.z; - add_vec2D_polar(&x, &z, icon->status4Radius, clamp_angle(camera->currentYaw + 90)); + add_vec2D_polar(&x, &z, icon->status4Radius, clamp_angle(camera->curYaw + 90)); get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ); elementId = icon->status4.activeElementID; hud_element_set_render_pos(elementId, screenX - 8, screenY - 8); @@ -805,7 +805,7 @@ void draw_all_status_icons(void* data) { y = icon->worldPos.y + icon->status4OffsetY + offsetY; z = icon->worldPos.z; - add_vec2D_polar(&x, &z, icon->status4Radius, clamp_angle(camera->currentYaw + 90)); + add_vec2D_polar(&x, &z, icon->status4Radius, clamp_angle(camera->curYaw + 90)); get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ); elementId = icon->status4.removingElementID; hud_element_set_render_pos(elementId, screenX - 8, screenY - 8); diff --git a/src/trigger.c b/src/trigger.c index 209965d8bb8..f144480b3ef 100644 --- a/src/trigger.c +++ b/src/trigger.c @@ -25,14 +25,14 @@ void clear_trigger_data(void) { gTriggerCount = 0; collisionStatus->pushingAgainstWall = NO_COLLIDER; - collisionStatus->currentFloor = NO_COLLIDER; + collisionStatus->curFloor = NO_COLLIDER; collisionStatus->lastTouchedFloor = NO_COLLIDER; - collisionStatus->currentCeiling = NO_COLLIDER; - collisionStatus->currentInspect = NO_COLLIDER; + collisionStatus->curCeiling = NO_COLLIDER; + collisionStatus->curInspect = NO_COLLIDER; collisionStatus->unk_0C = -1; collisionStatus->unk_0E = -1; collisionStatus->unk_10 = -1; - collisionStatus->currentWall = NO_COLLIDER; + collisionStatus->curWall = NO_COLLIDER; collisionStatus->lastWallHammered = NO_COLLIDER; collisionStatus->touchingWallTrigger = 0; collisionStatus->bombetteExploded = -1; @@ -109,7 +109,7 @@ void update_triggers(void) { } if (listTrigger->flags.flags & TRIGGER_WALL_PUSH) { - if (listTrigger->location.colliderID == collisionStatus->currentWall) { + if (listTrigger->location.colliderID == collisionStatus->curWall) { func_800E06C0(1); } if (listTrigger->location.colliderID == collisionStatus->pushingAgainstWall) { @@ -120,7 +120,7 @@ void update_triggers(void) { } if (listTrigger->flags.flags & TRIGGER_FLOOR_TOUCH) { - if (listTrigger->location.colliderID != collisionStatus->currentFloor) { + if (listTrigger->location.colliderID != collisionStatus->curFloor) { continue; } } @@ -132,16 +132,16 @@ void update_triggers(void) { } if (listTrigger->flags.flags & TRIGGER_WALL_PRESS_A) { - if (listTrigger->location.colliderID == collisionStatus->currentWall) { + if (listTrigger->location.colliderID == collisionStatus->curWall) { collisionStatus->touchingWallTrigger = 1; } - if ((listTrigger->location.colliderID != collisionStatus->currentInspect) || !phys_can_player_interact()) { + if ((listTrigger->location.colliderID != collisionStatus->curInspect) || !phys_can_player_interact()) { continue; } } if (listTrigger->flags.flags & TRIGGER_WALL_TOUCH) { - if (listTrigger->location.colliderID != collisionStatus->currentWall) { + if (listTrigger->location.colliderID != collisionStatus->curWall) { continue; } } @@ -153,7 +153,7 @@ void update_triggers(void) { } if (listTrigger->flags.flags & TRIGGER_FLOOR_PRESS_A) { - if ((listTrigger->location.colliderID != collisionStatus->currentFloor) || + if ((listTrigger->location.colliderID != collisionStatus->curFloor) || !(gGameStatusPtr->pressedButtons[0] & BUTTON_A) || (gPlayerStatus.flags & PS_FLAG_INPUT_DISABLED)) { continue; } @@ -166,7 +166,7 @@ void update_triggers(void) { } if (listTrigger->flags.flags & TRIGGER_CEILING_TOUCH) { - if (listTrigger->location.colliderID != collisionStatus->currentCeiling) { + if (listTrigger->location.colliderID != collisionStatus->curCeiling) { continue; } } diff --git a/src/world/action/hammer.c b/src/world/action/hammer.c index d17e977fbe5..d79fee68bb4 100644 --- a/src/world/action/hammer.c +++ b/src/world/action/hammer.c @@ -75,9 +75,9 @@ void action_hammer_play_hit_fx(s32 hitID) { if (hitID < 0) { numParticles = 6; - x = playerStatus->position.x + sinTheta; - y = playerStatus->position.y; - z = playerStatus->position.z + cosTheta; + x = playerStatus->pos.x + sinTheta; + y = playerStatus->pos.y; + z = playerStatus->pos.z + cosTheta; } else { numParticles = 3; x = HammerHit->hitPos.x + sinTheta; @@ -128,7 +128,7 @@ s32 func_802B62A4_E25174(void) { // first attempt yaw = func_800E5348(); if (action_hammer_is_swinging_away(playerStatus->trueAnimation)) { - angle = clamp_angle(yaw + 90.0f - gCameras[gCurrentCameraID].currentYaw); + angle = clamp_angle(yaw + 90.0f - gCameras[gCurrentCameraID].curYaw); if (angle >= 90.0f && angle < 270.0f) { yaw += -30.0f; } else { @@ -137,9 +137,9 @@ s32 func_802B62A4_E25174(void) { } sin_cos_rad(DEG_TO_RAD(yaw), &outSinTheta, &outCosTheta); - playerX = playerStatus->position.x; - playerY = playerStatus->position.y; - playerZ = playerStatus->position.z; + playerX = playerStatus->pos.x; + playerY = playerStatus->pos.y; + playerZ = playerStatus->pos.z; for (i = 1; i < 16; i++) { x = playerX + (outSinTheta * i); @@ -158,7 +158,7 @@ s32 func_802B62A4_E25174(void) { if (i >= 16) { yaw = func_800E5348(); if (!action_hammer_is_swinging_away(playerStatus->trueAnimation)) { - angle = clamp_angle(yaw + 90.0f - gCameras[gCurrentCameraID].currentYaw); + angle = clamp_angle(yaw + 90.0f - gCameras[gCurrentCameraID].curYaw); if (angle >= 90.0f && angle < 270.0f) { yaw += 15.0f; } else { @@ -238,7 +238,7 @@ void action_update_hammer(void) { playerStatus->flags |= PS_FLAG_NO_FLIPPING; HammerHit->timer = 0; playerStatus->actionSubstate = SUBSTATE_HAMMER_0; - playerStatus->currentSpeed = 0.0f; + playerStatus->curSpeed = 0.0f; playerStatus->animNotifyValue = 0; HammerHit->hitID = func_802B62A4_E25174(); @@ -305,7 +305,7 @@ void func_802B6820_E256F0(void) { yaw = func_800E5348(); if (action_hammer_is_swinging_away(playerStatus->trueAnimation)) { - angle = clamp_angle(yaw + 90.0f - gCameras[gCurrentCameraID].currentYaw); + angle = clamp_angle(yaw + 90.0f - gCameras[gCurrentCameraID].curYaw); if (angle >= 90.0f && angle < 270.0f) { yaw += -30.0f; } else { @@ -314,9 +314,9 @@ void func_802B6820_E256F0(void) { } sin_cos_rad(DEG_TO_RAD(yaw), &outSinTheta, &outCosTheta); - playerX = playerStatus->position.x; - playerY = playerStatus->position.y; - playerZ = playerStatus->position.z; + playerX = playerStatus->pos.x; + playerY = playerStatus->pos.y; + playerZ = playerStatus->pos.z; // check collision allong 16 points in a line away from the player for (i = 1; i < 16; i++) { @@ -341,7 +341,7 @@ void func_802B6820_E256F0(void) { if (i >= 16) { yaw = func_800E5348(); if (action_hammer_is_swinging_away(playerStatus->trueAnimation) == 0) { - angle = clamp_angle(yaw + 90.0f - gCameras[gCurrentCameraID].currentYaw); + angle = clamp_angle(yaw + 90.0f - gCameras[gCurrentCameraID].curYaw); if (angle >= 90.0f && angle < 270.0f) { yaw += 15.0f; } else { @@ -392,7 +392,7 @@ void func_802B6820_E256F0(void) { if (HammerHit->hitID < 0 && gPlayerData.hammerLevel >= 2) { gCurrentHiddenPanels.tryFlipTrigger = TRUE; - gCurrentHiddenPanels.flipTriggerPosY = playerStatus->position.y; + gCurrentHiddenPanels.flipTriggerPosY = playerStatus->pos.y; } } diff --git a/src/world/action/hit_fire.c b/src/world/action/hit_fire.c index 71c92f8de01..bb0596d3c80 100644 --- a/src/world/action/hit_fire.c +++ b/src/world/action/hit_fire.c @@ -27,26 +27,26 @@ void action_update_hit_fire(void) { playerStatus->gravityIntegrator[2] = 0.8059f; playerStatus->gravityIntegrator[3] = -0.0987f; gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_IGNORE_PLAYER_Y; - ReturnAngle = atan2(playerStatus->position.x, playerStatus->position.z, playerStatus->lastGoodPosition.x, playerStatus->lastGoodPosition.z); - playerStatus->currentSpeed = get_xz_dist_to_player(playerStatus->lastGoodPosition.x, playerStatus->lastGoodPosition.z) / 18.0f; + ReturnAngle = atan2(playerStatus->pos.x, playerStatus->pos.z, playerStatus->lastGoodPos.x, playerStatus->lastGoodPos.z); + playerStatus->curSpeed = get_xz_dist_to_player(playerStatus->lastGoodPos.x, playerStatus->lastGoodPos.z) / 18.0f; subtract_hp(1); open_status_bar_long(); gOverrideFlags |= GLOBAL_OVERRIDES_40; } sin_cos_rad(DEG_TO_RAD(ReturnAngle), &dx, &dy); - speed = playerStatus->currentSpeed; + speed = playerStatus->curSpeed; if (playerStatus->flags & PS_FLAG_ENTERING_BATTLE) { speed *= 0.5; } - playerStatus->position.x += speed * dx; - playerStatus->position.z -= speed * dy; + playerStatus->pos.x += speed * dx; + playerStatus->pos.z -= speed * dy; if (playerStatus->actionSubstate == SUBSTATE_FLYING) { integrate_gravity(); - playerStatus->position.y += playerStatus->gravityIntegrator[0]; + playerStatus->pos.y += playerStatus->gravityIntegrator[0]; if (playerStatus->gravityIntegrator[0] < 0.0f) { playerStatus->actionSubstate = SUBSTATE_FALLING; playerStatus->flags |= PS_FLAG_FALLING; @@ -54,7 +54,7 @@ void action_update_hit_fire(void) { } else { s32 colliderID; - playerStatus->position.y = player_check_collision_below(player_fall_distance(), &colliderID); + playerStatus->pos.y = player_check_collision_below(player_fall_distance(), &colliderID); if (colliderID >= 0) { colliderID = get_collider_flags(colliderID); //TODO surfaceType set_action_state(ACTION_STATE_LAND); diff --git a/src/world/action/hit_lava.c b/src/world/action/hit_lava.c index 3e1d7a903d8..edd3c4cc9c6 100644 --- a/src/world/action/hit_lava.c +++ b/src/world/action/hit_lava.c @@ -36,12 +36,12 @@ void action_update_hit_lava(void) { playerStatus->flags |= PS_FLAG_HIT_FIRE; if (playerStatus->hazardType == HAZARD_TYPE_LAVA) { playerStatus->actionSubstate = SUBSTATE_DELAY_INIT_SINK; - playerStatus->currentStateTime = 2; + playerStatus->curStateTime = 2; } else { playerStatus->actionSubstate = SUBSTATE_INIT; } - InitialPosY = playerStatus->position.y; - playerStatus->currentSpeed = 0.0f; + InitialPosY = playerStatus->pos.y; + playerStatus->curSpeed = 0.0f; LaunchVelocity = 0.0f; gCameras[CAM_DEFAULT].moveFlags |= (CAMERA_MOVE_IGNORE_PLAYER_Y | CAMERA_MOVE_FLAG_2); @@ -54,108 +54,108 @@ void action_update_hit_lava(void) { switch (playerStatus->actionSubstate) { case SUBSTATE_DELAY_INIT: - if (--playerStatus->currentStateTime == -1) { + if (--playerStatus->curStateTime == -1) { playerStatus->actionSubstate = SUBSTATE_INIT; } break; case SUBSTATE_DELAY_INIT_SINK: - if (--playerStatus->currentStateTime == -1) { + if (--playerStatus->curStateTime == -1) { playerStatus->actionSubstate = SUBSTATE_INIT; } - playerStatus->position.y -= 4.0f; + playerStatus->pos.y -= 4.0f; break; case SUBSTATE_INIT: if (playerStatus->hazardType == HAZARD_TYPE_LAVA) { - fx_smoke_burst(0, playerStatus->position.x, playerStatus->position.y, playerStatus->position.z, 1.0f, 40); + fx_smoke_burst(0, playerStatus->pos.x, playerStatus->pos.y, playerStatus->pos.z, 1.0f, 40); } suggest_player_anim_always_forward(ANIM_MarioW2_TouchedLava); playerStatus->gravityIntegrator[1] = 0.0f; playerStatus->timeInAir = 0; playerStatus->peakJumpTime = 0; playerStatus->actionSubstate = SUBSTATE_LAUNCH; - playerStatus->currentStateTime = 1; + playerStatus->curStateTime = 1; playerStatus->gravityIntegrator[0] = 20.0f; playerStatus->gravityIntegrator[2] = 250.0f; playerStatus->gravityIntegrator[3] = InitialPosY; - playerStatus->jumpFromPos.x = playerStatus->position.x; - playerStatus->jumpFromPos.z = playerStatus->position.z; - playerStatus->jumpFromHeight = playerStatus->position.y; + playerStatus->jumpFromPos.x = playerStatus->pos.x; + playerStatus->jumpFromPos.z = playerStatus->pos.z; + playerStatus->jumpFromHeight = playerStatus->pos.y; playerStatus->flags |= PS_FLAG_JUMPING; break; case SUBSTATE_DELAY_LAUNCH: - if (--playerStatus->currentStateTime <= 0) { + if (--playerStatus->curStateTime <= 0) { playerStatus->actionSubstate++; } break; case SUBSTATE_LAUNCH: if (playerStatus->hazardType == HAZARD_TYPE_LAVA && (playerStatus->timeInAir % 2) == 0) { - fx_smoke_burst(0, playerStatus->position.x, playerStatus->position.y, playerStatus->position.z, 0.7f, 18); + fx_smoke_burst(0, playerStatus->pos.x, playerStatus->pos.y, playerStatus->pos.z, 0.7f, 18); } - if (playerStatus->position.y < playerStatus->gravityIntegrator[3] + playerStatus->gravityIntegrator[2]) { + if (playerStatus->pos.y < playerStatus->gravityIntegrator[3] + playerStatus->gravityIntegrator[2]) { sin_cos_rad(DEG_TO_RAD(LaunchInterpPhase), &dx, &dy); LaunchVelocity = sin_rad(DEG_TO_RAD(LaunchInterpPhase)) * 16.0f; if (LaunchVelocity < -1.0f) { LaunchVelocity = -1.0f; } - playerStatus->position.y += LaunchVelocity; + playerStatus->pos.y += LaunchVelocity; LaunchInterpPhase += 3.0f; if (LaunchInterpPhase > 180.0f) { LaunchInterpPhase = 180.0f; playerStatus->actionSubstate++; } } else { - playerStatus->position.y = playerStatus->gravityIntegrator[3] + playerStatus->gravityIntegrator[2]; + playerStatus->pos.y = playerStatus->gravityIntegrator[3] + playerStatus->gravityIntegrator[2]; playerStatus->actionSubstate++; } break; case SUBSTATE_END_LAUNCH: if (playerStatus->hazardType == HAZARD_TYPE_LAVA && (playerStatus->timeInAir % 2) == 0) { - fx_smoke_burst(0, playerStatus->position.x, playerStatus->position.y, playerStatus->position.z, 0.7f, 18); + fx_smoke_burst(0, playerStatus->pos.x, playerStatus->pos.y, playerStatus->pos.z, 0.7f, 18); } if (get_lava_reset_pos(&resetPosX, &resetPosY, &resetPosZ) == 0) { - resetPosX = playerStatus->position.x; - resetPosZ = playerStatus->position.z; + resetPosX = playerStatus->pos.x; + resetPosZ = playerStatus->pos.z; } - playerStatus->lastGoodPosition.x = resetPosX; - playerStatus->lastGoodPosition.z = resetPosZ; - playerStatus->jumpApexHeight = playerStatus->position.y; + playerStatus->lastGoodPos.x = resetPosX; + playerStatus->lastGoodPos.z = resetPosZ; + playerStatus->jumpApexHeight = playerStatus->pos.y; LOAD_INTEGRATOR_FALL(playerStatus->gravityIntegrator); playerStatus->actionSubstate++; break; case SUBSTATE_RETURN_INIT: - ReturnAngle = atan2(playerStatus->position.x, playerStatus->position.z, playerStatus->lastGoodPosition.x, playerStatus->lastGoodPosition.z); - playerStatus->currentSpeed = get_xz_dist_to_player(playerStatus->lastGoodPosition.x, playerStatus->lastGoodPosition.z) / 18.0f; + ReturnAngle = atan2(playerStatus->pos.x, playerStatus->pos.z, playerStatus->lastGoodPos.x, playerStatus->lastGoodPos.z); + playerStatus->curSpeed = get_xz_dist_to_player(playerStatus->lastGoodPos.x, playerStatus->lastGoodPos.z) / 18.0f; playerStatus->actionSubstate++; break; case SUBSTATE_RETURN_MOTION: - ReturnAngle = atan2(playerStatus->position.x, playerStatus->position.z, playerStatus->lastGoodPosition.x, playerStatus->lastGoodPosition.z); + ReturnAngle = atan2(playerStatus->pos.x, playerStatus->pos.z, playerStatus->lastGoodPos.x, playerStatus->lastGoodPos.z); returnRadians = DEG_TO_RAD(ReturnAngle); // update motion along x axis - componentSpeed = playerStatus->currentSpeed * sin_rad(returnRadians); - playerStatus->position.x += componentSpeed; + componentSpeed = playerStatus->curSpeed * sin_rad(returnRadians); + playerStatus->pos.x += componentSpeed; completeAxes = 0; if (componentSpeed >= 0.0f) { - if (playerStatus->lastGoodPosition.x <= playerStatus->position.x) { - playerStatus->position.x = playerStatus->lastGoodPosition.x; + if (playerStatus->lastGoodPos.x <= playerStatus->pos.x) { + playerStatus->pos.x = playerStatus->lastGoodPos.x; completeAxes++; } } else { - if (playerStatus->position.x <= playerStatus->lastGoodPosition.x) { - playerStatus->position.x = playerStatus->lastGoodPosition.x; + if (playerStatus->pos.x <= playerStatus->lastGoodPos.x) { + playerStatus->pos.x = playerStatus->lastGoodPos.x; completeAxes++; } } // update motion along z axis - componentSpeed = playerStatus->currentSpeed * cos_rad(returnRadians); - playerStatus->position.z -= componentSpeed; + componentSpeed = playerStatus->curSpeed * cos_rad(returnRadians); + playerStatus->pos.z -= componentSpeed; if (componentSpeed >= 0.0f) { - if (playerStatus->position.z <= playerStatus->lastGoodPosition.z) { - playerStatus->position.z = playerStatus->lastGoodPosition.z; + if (playerStatus->pos.z <= playerStatus->lastGoodPos.z) { + playerStatus->pos.z = playerStatus->lastGoodPos.z; completeAxes++; } } else { - if (playerStatus->lastGoodPosition.z <= playerStatus->position.z) { - playerStatus->position.z = playerStatus->lastGoodPosition.z; + if (playerStatus->lastGoodPos.z <= playerStatus->pos.z) { + playerStatus->pos.z = playerStatus->lastGoodPos.z; completeAxes++; } } @@ -166,9 +166,9 @@ void action_update_hit_lava(void) { break; case SUBSTATE_HOVER: if (playerStatus->hazardType == HAZARD_TYPE_LAVA && (playerStatus->timeInAir % 2) == 0) { - fx_smoke_burst(0, playerStatus->position.x, playerStatus->position.y, playerStatus->position.z, 0.7f, 18); + fx_smoke_burst(0, playerStatus->pos.x, playerStatus->pos.y, playerStatus->pos.z, 0.7f, 18); } - playerStatus->position.y = player_check_collision_below(player_fall_distance(), &completeAxes); + playerStatus->pos.y = player_check_collision_below(player_fall_distance(), &completeAxes); if (completeAxes >= 0) { exec_ShakeCamX(0, 2, 1, 0.8f); start_rumble(256, 50); @@ -180,20 +180,20 @@ void action_update_hit_lava(void) { playerStatus->flags &= ~PS_FLAG_FLYING; playerStatus->hazardType = HAZARD_TYPE_NONE; playerStatus->gravityIntegrator[0] = 6.0f; - playerStatus->position.y += 6.0f; + playerStatus->pos.y += 6.0f; playerStatus->actionSubstate++; } break; case SUBSTATE_BOUNCE: playerStatus->gravityIntegrator[0] -= 1.0; - playerStatus->position.y = player_check_collision_below(playerStatus->gravityIntegrator[0], &completeAxes); + playerStatus->pos.y = player_check_collision_below(playerStatus->gravityIntegrator[0], &completeAxes); if (completeAxes >= 0) { - playerStatus->currentStateTime = 10; + playerStatus->curStateTime = 10; playerStatus->actionSubstate++; } break; case SUBSTATE_DELAY_DONE: - if (--playerStatus->currentStateTime <= 0) { + if (--playerStatus->curStateTime <= 0) { set_action_state(ACTION_STATE_LAND); playerStatus->flags &= ~PS_FLAG_SCRIPTED_FALL; gOverrideFlags &= ~GLOBAL_OVERRIDES_40; diff --git a/src/world/action/idle.c b/src/world/action/idle.c index 3b0b0cba17b..2c4d4dfcd23 100644 --- a/src/world/action/idle.c +++ b/src/world/action/idle.c @@ -46,16 +46,16 @@ void action_update_idle(void) { return; } - playerStatus->currentStateTime++; + playerStatus->curStateTime++; if (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) { playerStatus->flags &= ~(PS_FLAG_ACTION_STATE_CHANGED | PS_FLAG_ARMS_RAISED | PS_FLAG_AIRBORNE); wasMoving = TRUE; playerStatus->actionSubstate = SUBSTATE_IDLE_DEFAULT; - playerStatus->currentStateTime = 0; + playerStatus->curStateTime = 0; playerStatus->timeInAir = 0; playerStatus->peakJumpTime = 0; - playerStatus->currentSpeed = 0.0f; + playerStatus->curSpeed = 0.0f; playerStatus->pitch = 0.0f; if (playerStatus->animFlags & PA_FLAG_8BIT_MARIO) { @@ -84,7 +84,7 @@ void action_update_idle(void) { if (magnitude == 0.0f) { playerData->idleFrameCounter++; } else { - playerStatus->currentStateTime = 0; + playerStatus->curStateTime = 0; set_action_state(ACTION_STATE_WALK); if (magnitude != 0.0f) { playerStatus->targetYaw = angle; @@ -103,10 +103,10 @@ void action_update_idle_peach(void) { if (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) { playerStatus->flags &= ~PS_FLAG_ACTION_STATE_CHANGED; playerStatus->actionSubstate = SUBSTATE_IDLE_DEFAULT; - playerStatus->currentStateTime = 0; + playerStatus->curStateTime = 0; playerStatus->timeInAir = 0; playerStatus->peakJumpTime = 0; - playerStatus->currentSpeed = 0.0f; + playerStatus->curSpeed = 0.0f; playerStatus->flags &= ~PS_FLAG_AIRBORNE; if (!(playerStatus->animFlags & PA_FLAG_INVISIBLE)) { @@ -125,27 +125,27 @@ void action_update_idle_peach(void) { case SUBSTATE_IDLE_DEFAULT: if (!(playerStatus->flags & (PS_FLAG_NO_STATIC_COLLISION | PS_FLAG_INPUT_DISABLED)) && (playerStatus->peachItemHeld == 0)) { - if (playerStatus->currentStateTime > 1800) { + if (playerStatus->curStateTime > 1800) { // begin first yawm playerStatus->actionSubstate++; suggest_player_anim_allow_backward(ANIM_Peach2_Yawn); return; } - playerStatus->currentStateTime++; + playerStatus->curStateTime++; } break; case SUBSTATE_IDLE_STRETCH: // waiting for yawn to finish if (playerStatus->animNotifyValue != 0) { playerStatus->actionSubstate++; - playerStatus->currentStateTime = 0; + playerStatus->curStateTime = 0; suggest_player_anim_allow_backward(ANIM_Peach1_Idle); } break; case SUBSTATE_DELAY_SLEEP: // delay before next yawn and sleep - playerStatus->currentStateTime++; - if (playerStatus->currentStateTime > 200) { + playerStatus->curStateTime++; + if (playerStatus->curStateTime > 200) { playerStatus->actionSubstate++; suggest_player_anim_allow_backward(ANIM_Peach2_Yawn); } @@ -166,7 +166,7 @@ void action_update_idle_peach(void) { phys_update_interact_collider(); if (magnitude != 0.0f) { - playerStatus->currentStateTime = 0; + playerStatus->curStateTime = 0; playerStatus->targetYaw = angle; set_action_state(ACTION_STATE_WALK); } diff --git a/src/world/action/jump.c b/src/world/action/jump.c index e937e6bfc23..ad8d0929e72 100644 --- a/src/world/action/jump.c +++ b/src/world/action/jump.c @@ -19,9 +19,9 @@ void initialize_jump(void) { playerStatus->peakJumpTime = 0; playerStatus->flags &= ~(PS_FLAG_ACTION_STATE_CHANGED | PS_FLAG_FLYING); playerStatus->flags |= PS_FLAG_JUMPING; - playerStatus->jumpFromPos.x = playerStatus->position.x; - playerStatus->jumpFromPos.z = playerStatus->position.z; - playerStatus->jumpFromHeight = playerStatus->position.y; + playerStatus->jumpFromPos.x = playerStatus->pos.x; + playerStatus->jumpFromPos.z = playerStatus->pos.z; + playerStatus->jumpFromHeight = playerStatus->pos.y; phys_init_integrator_for_current_state(); @@ -34,8 +34,8 @@ void initialize_jump(void) { } suggest_player_anim_allow_backward(anim); - collisionStatus->lastTouchedFloor = collisionStatus->currentFloor; - collisionStatus->currentFloor = NO_COLLIDER; + collisionStatus->lastTouchedFloor = collisionStatus->curFloor; + collisionStatus->curFloor = NO_COLLIDER; } void action_update_jump(void) { @@ -80,10 +80,10 @@ void action_update_landing_on_switch(void) { AnimID anim; if (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) { - Entity* entity = get_entity_by_index(collisionStatus->currentFloor); + Entity* entity = get_entity_by_index(collisionStatus->curFloor); - JumpedOnSwitchX = entity->position.x; - JumpedOnSwitchZ = entity->position.z; + JumpedOnSwitchX = entity->pos.x; + JumpedOnSwitchZ = entity->pos.z; initialize_jump(); playerStatus->flags |= (PS_FLAG_SCRIPTED_FALL | PS_FLAG_ARMS_RAISED); disable_player_input(); @@ -161,9 +161,9 @@ void action_update_step_down(void) { playerStatus->timeInAir++; phys_update_interact_collider(); - posX = playerStatus->position.x; - posY = playerStatus->position.y; - posZ = playerStatus->position.z; + posX = playerStatus->pos.x; + posY = playerStatus->pos.y; + posZ = playerStatus->pos.z; height = playerStatus->colliderHeight; colliderID = player_raycast_below_cam_relative(playerStatus, &posX, &posY, &posZ, &height, &hitRx, &hitRz, &hitDirX, &hitDirZ); diff --git a/src/world/action/knockback.c b/src/world/action/knockback.c index 93f48fa093e..0840700ae91 100644 --- a/src/world/action/knockback.c +++ b/src/world/action/knockback.c @@ -28,26 +28,26 @@ void action_update_knockback(void) { gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_IGNORE_PLAYER_Y; - ReturnAngle = atan2(playerStatus->position.x, playerStatus->position.z, playerStatus->lastGoodPosition.x, - playerStatus->lastGoodPosition.z); - playerStatus->currentSpeed = get_xz_dist_to_player(playerStatus->lastGoodPosition.x, playerStatus->lastGoodPosition.z) / 18.0f; + ReturnAngle = atan2(playerStatus->pos.x, playerStatus->pos.z, playerStatus->lastGoodPos.x, + playerStatus->lastGoodPos.z); + playerStatus->curSpeed = get_xz_dist_to_player(playerStatus->lastGoodPos.x, playerStatus->lastGoodPos.z) / 18.0f; } sin_cos_rad(DEG_TO_RAD(ReturnAngle), &dx, &dy); - speed = playerStatus->currentSpeed; + speed = playerStatus->curSpeed; if (playerStatus->flags & PS_FLAG_ENTERING_BATTLE) { speed *= 0.5f; } - playerStatus->position.x += speed * dx; - playerStatus->position.z -= speed * dy; + playerStatus->pos.x += speed * dx; + playerStatus->pos.z -= speed * dy; if (playerStatus->actionSubstate == SUBSTATE_FLYING) { integrate_gravity(); - playerStatus->position.y += playerStatus->gravityIntegrator[0]; + playerStatus->pos.y += playerStatus->gravityIntegrator[0]; if (playerStatus->gravityIntegrator[0] < 0.0f) { playerStatus->actionSubstate = SUBSTATE_FALLING; @@ -56,7 +56,7 @@ void action_update_knockback(void) { } else { s32 colliderID; - playerStatus->position.y = player_check_collision_below(player_fall_distance(), &colliderID); + playerStatus->pos.y = player_check_collision_below(player_fall_distance(), &colliderID); if (colliderID >= 0) { colliderID = get_collider_flags(colliderID); //TODO surfaceType diff --git a/src/world/action/land.c b/src/world/action/land.c index b75e8477dfb..d8871bfa346 100644 --- a/src/world/action/land.c +++ b/src/world/action/land.c @@ -33,8 +33,8 @@ void action_update_land(void) { playerStatus->actionSubstate = SUBSTATE_INIT; playerStatus->timeInAir = 0; playerStatus->peakJumpTime = 0; - playerStatus->landPos.x = playerStatus->position.x; - playerStatus->landPos.z = playerStatus->position.z; + playerStatus->landPos.x = playerStatus->pos.x; + playerStatus->landPos.z = playerStatus->pos.z; if (playerStatus->animFlags & PA_FLAG_8BIT_MARIO) { anim = ANIM_MarioW3_8bit_Still; @@ -48,7 +48,7 @@ void action_update_land(void) { sfx_play_sound_at_player(SOUND_161 | SOUND_ID_STOP, SOUND_SPACE_MODE_0); sfx_play_sound_at_player(SOUND_SOFT_LAND, SOUND_SPACE_MODE_0); - if (!(collisionStatus->currentFloor & COLLISION_WITH_ENTITY_BIT)) { + if (!(collisionStatus->curFloor & COLLISION_WITH_ENTITY_BIT)) { phys_adjust_cam_on_landing(); } @@ -57,7 +57,7 @@ void action_update_land(void) { camera->moveFlags &= ~CAMERA_MOVE_FLAG_4; } playerStatus->actionSubstate++; // SUBSTATE_DONE - playerStatus->currentSpeed *= 0.6f; + playerStatus->curSpeed *= 0.6f; player_input_to_move_vector(&inputMoveAngle, &inputMoveMagnitude); jumpInputCheck = check_input_jump(); @@ -95,10 +95,10 @@ void action_update_step_down_land(void) { playerStatus->actionSubstate = SUBSTATE_INIT; playerStatus->timeInAir = 0; playerStatus->peakJumpTime = 0; - playerStatus->landPos.x = playerStatus->position.x; - playerStatus->landPos.z = playerStatus->position.z; + playerStatus->landPos.x = playerStatus->pos.x; + playerStatus->landPos.z = playerStatus->pos.z; - if (!(collisionStatus->currentFloor & COLLISION_WITH_ENTITY_BIT)) { + if (!(collisionStatus->curFloor & COLLISION_WITH_ENTITY_BIT)) { phys_adjust_cam_on_landing(); } @@ -106,7 +106,7 @@ void action_update_step_down_land(void) { } playerStatus->actionSubstate++; // SUBSTATE_DONE - playerStatus->currentSpeed *= 0.6f; + playerStatus->curSpeed *= 0.6f; player_input_to_move_vector(&inputMoveAngle, &inputMoveMagnitude); check_input_jump(); @@ -130,12 +130,12 @@ void action_update_peach_land(void) { playerStatus->timeInAir = 0; playerStatus->peakJumpTime = 0; playerStatus->flags &= ~PS_FLAG_AIRBORNE; - playerStatus->landPos.x = playerStatus->position.x; - playerStatus->landPos.z = playerStatus->position.z; + playerStatus->landPos.x = playerStatus->pos.x; + playerStatus->landPos.z = playerStatus->pos.z; sfx_play_sound_at_player(SOUND_SOFT_LAND, SOUND_SPACE_MODE_0); - if (!(collisionStatus->currentFloor & COLLISION_WITH_ENTITY_BIT)) { + if (!(collisionStatus->curFloor & COLLISION_WITH_ENTITY_BIT)) { phys_adjust_cam_on_landing(); } @@ -143,7 +143,7 @@ void action_update_peach_land(void) { } playerStatus->actionSubstate++; // SUBSTATE_DONE - playerStatus->currentSpeed *= 0.6f; + playerStatus->curSpeed *= 0.6f; player_input_to_move_vector(&inputMoveAngle, &inputMoveMagnitude); @@ -174,17 +174,17 @@ void action_update_peach_step_down_land(void) { playerStatus->timeInAir = 0; playerStatus->peakJumpTime = 0; playerStatus->flags &= ~PS_FLAG_AIRBORNE; - playerStatus->landPos.x = playerStatus->position.x; - playerStatus->landPos.z = playerStatus->position.z; + playerStatus->landPos.x = playerStatus->pos.x; + playerStatus->landPos.z = playerStatus->pos.z; - if (!(collisionStatus->currentFloor & COLLISION_WITH_ENTITY_BIT)) { + if (!(collisionStatus->curFloor & COLLISION_WITH_ENTITY_BIT)) { phys_adjust_cam_on_landing(); } collisionStatus->lastTouchedFloor = -1; } playerStatus->actionSubstate++; // SUBSTATE_DONE - playerStatus->currentSpeed *= 0.6f; + playerStatus->curSpeed *= 0.6f; player_input_to_move_vector(&inputMoveAngle, &inputMoveMagnitude); if (inputMoveMagnitude != 0.0f) { diff --git a/src/world/action/misc.c b/src/world/action/misc.c index 84bfb6fba8e..e2d160ee387 100644 --- a/src/world/action/misc.c +++ b/src/world/action/misc.c @@ -13,10 +13,10 @@ void action_update_ride(void) { if (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) { playerStatus->flags &= ~(PS_FLAG_ACTION_STATE_CHANGED | PS_FLAG_ARMS_RAISED | PS_FLAG_AIRBORNE); playerStatus->actionSubstate = 0; - playerStatus->currentStateTime = 0; + playerStatus->curStateTime = 0; playerStatus->timeInAir = 0; playerStatus->peakJumpTime = 0; - playerStatus->currentSpeed = 0.0f; + playerStatus->curSpeed = 0.0f; playerStatus->pitch = 0.0f; } @@ -50,10 +50,10 @@ void action_update_state_23(void) { if (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) { playerStatus->flags &= ~(PS_FLAG_ACTION_STATE_CHANGED | PS_FLAG_ARMS_RAISED | PS_FLAG_AIRBORNE); playerStatus->actionSubstate = 0; - playerStatus->currentStateTime = 0; + playerStatus->curStateTime = 0; playerStatus->timeInAir = 0; playerStatus->peakJumpTime = 0; - playerStatus->currentSpeed = 0.0f; + playerStatus->curSpeed = 0.0f; playerStatus->pitch = 0.0f; D_802B6770_E27C80 = D_8010C938; } @@ -93,14 +93,14 @@ void action_update_state_23(void) { playerZOffset = playerOffsetTempVar; } - playerStatus->position.x += playerXOffset; - playerStatus->position.z -= playerZOffset; - outX = playerStatus->position.x; - outY = playerStatus->position.y; - outZ = playerStatus->position.z; + playerStatus->pos.x += playerXOffset; + playerStatus->pos.z -= playerZOffset; + outX = playerStatus->pos.x; + outY = playerStatus->pos.y; + outZ = playerStatus->pos.z; outLength = 5.0f; if (player_raycast_below_cam_relative(playerStatus, &outX, &outY, &outZ, &outLength, &hitRx, &hitRz, &hitDirX, &hitDirZ) >= 0) { - playerStatus->position.y = outY; + playerStatus->pos.y = outY; } if (gGameStatusPtr->areaID == AREA_SBK) { @@ -121,20 +121,20 @@ void action_update_launch(void) { if (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) { playerStatus->flags &= ~(PS_FLAG_ACTION_STATE_CHANGED | PS_FLAG_ARMS_RAISED | PS_FLAG_AIRBORNE); playerStatus->actionSubstate = 0; - playerStatus->currentStateTime = 0; + playerStatus->curStateTime = 0; playerStatus->timeInAir = 0; playerStatus->peakJumpTime = 0; - playerStatus->currentSpeed = 0.0f; + playerStatus->curSpeed = 0.0f; playerStatus->pitch = 0.0f; if (playerStatus->animFlags & PA_FLAG_USING_PEACH_PHYSICS) { return; } - playerStatus->currentStateTime = 5; + playerStatus->curStateTime = 5; } - playerStatus->currentStateTime--; - if (playerStatus->currentStateTime == 0) { + playerStatus->curStateTime--; + if (playerStatus->curStateTime == 0) { set_action_state(ACTION_STATE_IDLE); } } @@ -147,14 +147,14 @@ void action_update_first_strike(void) { playerStatus->actionSubstate = 0; playerStatus->timeInAir = 0; playerStatus->peakJumpTime = 0; - playerStatus->currentSpeed = 0.0f; + playerStatus->curSpeed = 0.0f; playerStatus->pitch = 0.0f; suggest_player_anim_always_forward(ANIM_Mario1_Hurt); - playerStatus->currentStateTime = 30; + playerStatus->curStateTime = 30; } - if (playerStatus->currentStateTime != 0) { - playerStatus->currentStateTime--; + if (playerStatus->curStateTime != 0) { + playerStatus->curStateTime--; } else if (!gGameStatusPtr->isBattle) { set_action_state(ACTION_STATE_IDLE); } @@ -166,9 +166,9 @@ void action_update_raise_arms(void) { if (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) { playerStatus->flags &= ~PS_FLAG_ACTION_STATE_CHANGED; playerStatus->flags |= PS_FLAG_ARMS_RAISED; - playerStatus->currentStateTime = 0; + playerStatus->curStateTime = 0; playerStatus->actionSubstate = 0; - playerStatus->currentSpeed = 0.0f; + playerStatus->curSpeed = 0.0f; playerStatus->pitch = 0.0f; suggest_player_anim_always_forward(ANIM_Mario1_UsePower); } @@ -187,9 +187,9 @@ void action_update_pushing_block(void) { f32 magnitude; playerStatus->flags &= ~PS_FLAG_ACTION_STATE_CHANGED; - playerStatus->currentSpeed = 0.0f; + playerStatus->curSpeed = 0.0f; playerStatus->unk_60 = 0; - playerStatus->currentStateTime = 5; + playerStatus->curStateTime = 5; player_input_to_move_vector(&angle, &magnitude); if (((angle >= 45.0f) && (angle <= 135.0f)) || ((angle >= 225.0f) && (angle <= 315.0f))) { @@ -202,9 +202,9 @@ void action_update_pushing_block(void) { check_input_jump(); if (playerStatus->animFlags & PA_FLAG_ABORT_PUSHING_BLOCK) { - if (playerStatus->currentStateTime != 0) { - playerStatus->currentStateTime--; - if (playerStatus->currentStateTime == 0) { + if (playerStatus->curStateTime != 0) { + playerStatus->curStateTime--; + if (playerStatus->curStateTime == 0) { set_action_state(ACTION_STATE_IDLE); } } @@ -216,7 +216,7 @@ void action_update_talk(void) { if (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) { playerStatus->flags &= ~PS_FLAG_ACTION_STATE_CHANGED; - playerStatus->currentSpeed = 0.0f; + playerStatus->curSpeed = 0.0f; playerStatus->unk_60 = 0; if (!(playerStatus->animFlags & PA_FLAG_USING_PEACH_PHYSICS)) { @@ -228,12 +228,12 @@ void action_update_talk(void) { peach_set_disguise_anim(BasicPeachDisguiseAnims[playerStatus->peachDisguise].talk); } } - playerStatus->currentStateTime = 30; + playerStatus->curStateTime = 30; } if (playerStatus->animFlags & PA_FLAG_USING_PEACH_PHYSICS) { - if (playerStatus->currentStateTime != 0) { - playerStatus->currentStateTime--; + if (playerStatus->curStateTime != 0) { + playerStatus->curStateTime--; } else if (playerStatus->peachItemHeld == 0) { if (!(playerStatus->animFlags & PA_FLAG_INVISIBLE)) { suggest_player_anim_always_forward(ANIM_Peach1_Idle); diff --git a/src/world/action/slide.c b/src/world/action/slide.c index a1e2b44b7fc..72c91740625 100644 --- a/src/world/action/slide.c +++ b/src/world/action/slide.c @@ -31,8 +31,8 @@ void func_802B6000_E27510(void) { playerStatus->gravityIntegrator[3] = slide->integrator[3]; playerStatus->heading = slide->heading; MaxSlideAccel = slide->maxDescendAccel; - SlideLaunchSpeed = slide->launchVelocity; - MaxSlideVelocity = slide->maxDescendVelocity; + SlideLaunchSpeed = slide->launchVel; + MaxSlideVelocity = slide->maxDescendVel; } void action_update_sliding(void) { @@ -48,7 +48,7 @@ void action_update_sliding(void) { if (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) { playerStatus->flags &= ~PS_FLAG_ACTION_STATE_CHANGED; playerStatus->actionSubstate = SUBSTATE_SLIDING; - playerStatus->currentSpeed = 0.0f; + playerStatus->curSpeed = 0.0f; playerStatus->animFlags |= PA_FLAG_INTERRUPT_USE_PARTNER; func_802B6000_E27510(); SlideAcceleration = 0.0f; @@ -60,14 +60,14 @@ void action_update_sliding(void) { sfx_play_sound_at_player(SOUND_167, SOUND_SPACE_MODE_0); gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_IGNORE_PLAYER_Y; } - speed = playerStatus->currentSpeed; - posX = playerStatus->position.x; - posY = playerStatus->position.y; - posZ = playerStatus->position.z; + speed = playerStatus->curSpeed; + posX = playerStatus->pos.x; + posY = playerStatus->pos.y; + posZ = playerStatus->pos.z; hitID = player_test_move_with_slipping(playerStatus, &posX, &posY, &posZ, speed, playerStatus->heading); - playerStatus->position.x = posX; - playerStatus->position.z = posZ; - playerStatus->position.y = posY; + playerStatus->pos.x = posX; + playerStatus->pos.z = posZ; + playerStatus->pos.y = posY; switch (playerStatus->actionSubstate) { case SUBSTATE_SLIDING: @@ -75,23 +75,23 @@ void action_update_sliding(void) { if (MaxSlideAccel <= SlideAcceleration) { SlideAcceleration = MaxSlideAccel; } - playerStatus->currentSpeed += SlideAcceleration; - if (MaxSlideVelocity <= playerStatus->currentSpeed) { - playerStatus->currentSpeed = MaxSlideVelocity; + playerStatus->curSpeed += SlideAcceleration; + if (MaxSlideVelocity <= playerStatus->curSpeed) { + playerStatus->curSpeed = MaxSlideVelocity; } - posX = playerStatus->position.x; + posX = playerStatus->pos.x; depth = 100.0f; - posZ = playerStatus->position.z; + posZ = playerStatus->pos.z; D_802B6794 = D_802B6798; - posY = playerStatus->position.y + (playerStatus->colliderHeight * 0.5f); + posY = playerStatus->pos.y + (playerStatus->colliderHeight * 0.5f); hitID = player_raycast_below_cam_relative(playerStatus, &posX, &posY, &posZ, &depth, &hitRx, &hitRy, &hitDirX, &hitDirZ); D_802B6798 = hitRy; if (hitID >= 0) { collisionStatus = &gCollisionStatus; surfaceType = get_collider_flags(hitID) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; if (surfaceType == SURFACE_TYPE_SLIDE) { - collisionStatus->currentFloor = hitID; - playerStatus->position.y = posY; + collisionStatus->curFloor = hitID; + playerStatus->pos.y = posY; D_802B6790 = hitRy + 180.0f; break; } @@ -104,49 +104,49 @@ void action_update_sliding(void) { playerStatus->actionSubstate = SUBSTATE_LAUNCH; } sin_cos_rad(DEG_TO_RAD(D_802B6790), &sinA, &cosA); - playerStatus->position.y += fabsf((sinA / cosA) * playerStatus->currentSpeed); + playerStatus->pos.y += fabsf((sinA / cosA) * playerStatus->curSpeed); snd_stop_sound(SOUND_167); break; case SUBSTATE_STOP: - posX = playerStatus->position.x; + posX = playerStatus->pos.x; depth = 50.0f; - posZ = playerStatus->position.z; - posY = playerStatus->position.y + (playerStatus->colliderHeight * 0.5f); + posZ = playerStatus->pos.z; + posY = playerStatus->pos.y + (playerStatus->colliderHeight * 0.5f); hitID = player_raycast_below_cam_relative(playerStatus, &posX, &posY, &posZ, &depth, &hitRx, &hitRy, &hitDirX, &hitDirZ); if (hitID >= 0) { - speed = playerStatus->currentSpeed / 3.0f; + speed = playerStatus->curSpeed / 3.0f; if (speed < 0.01) { - playerStatus->currentSpeed = 0.0f; + playerStatus->curSpeed = 0.0f; } - playerStatus->currentSpeed -= speed; - if (playerStatus->currentSpeed <= 0.0f) { + playerStatus->curSpeed -= speed; + if (playerStatus->curSpeed <= 0.0f) { sfx_play_sound_at_player(SOUND_DUST_OFF, SOUND_SPACE_MODE_0); suggest_player_anim_always_forward(ANIM_Mario1_DustOff); playerStatus->actionSubstate = SUBSTATE_DUST_OFF; - playerStatus->currentStateTime = 15; - playerStatus->currentSpeed = 0.0f; - playerStatus->position.y = posY; + playerStatus->curStateTime = 15; + playerStatus->curSpeed = 0.0f; + playerStatus->pos.y = posY; } break; } case SUBSTATE_LAUNCH: - playerStatus->currentSpeed += SlideLaunchSpeed; - if (playerStatus->currentSpeed <= 0.0f) { - playerStatus->currentSpeed = 0.0f; + playerStatus->curSpeed += SlideLaunchSpeed; + if (playerStatus->curSpeed <= 0.0f) { + playerStatus->curSpeed = 0.0f; } playerStatus->gravityIntegrator[0] += playerStatus->gravityIntegrator[1]; - playerStatus->position.y += playerStatus->gravityIntegrator[0]; + playerStatus->pos.y += playerStatus->gravityIntegrator[0]; if (playerStatus->gravityIntegrator[0] <= 0.0f) { playerStatus->actionSubstate = SUBSTATE_FALL; LOAD_INTEGRATOR_FALL(playerStatus->gravityIntegrator); } break; case SUBSTATE_FALL: - playerStatus->currentSpeed += SlideLaunchSpeed; - if (playerStatus->currentSpeed <= 0.0f) { - playerStatus->currentSpeed = 0.0f; + playerStatus->curSpeed += SlideLaunchSpeed; + if (playerStatus->curSpeed <= 0.0f) { + playerStatus->curSpeed = 0.0f; } - playerStatus->position.y = player_check_collision_below(player_fall_distance(), &hitID); + playerStatus->pos.y = player_check_collision_below(player_fall_distance(), &hitID); if (hitID >= 0) { SlideLaunchSpeed = -1; suggest_player_anim_always_forward(ANIM_MarioW2_Collapse); @@ -155,9 +155,9 @@ void action_update_sliding(void) { } break; case SUBSTATE_CRASH: - playerStatus->currentSpeed += SlideLaunchSpeed; - if (playerStatus->currentSpeed <= 0.0f) { - playerStatus->currentSpeed = 0.0f; + playerStatus->curSpeed += SlideLaunchSpeed; + if (playerStatus->curSpeed <= 0.0f) { + playerStatus->curSpeed = 0.0f; } if (playerStatus->animNotifyValue != 0) { suggest_player_anim_always_forward(ANIM_Mario1_GetUp); @@ -165,34 +165,34 @@ void action_update_sliding(void) { } break; case SUBSTATE_GET_UP: - playerStatus->currentSpeed += SlideLaunchSpeed; - if (playerStatus->currentSpeed <= 0.0f) { - playerStatus->currentSpeed = 0.0f; + playerStatus->curSpeed += SlideLaunchSpeed; + if (playerStatus->curSpeed <= 0.0f) { + playerStatus->curSpeed = 0.0f; } if (playerStatus->animNotifyValue != 0) { suggest_player_anim_always_forward(ANIM_Mario1_DustOff); sfx_play_sound_at_player(SOUND_DUST_OFF, SOUND_SPACE_MODE_0); - playerStatus->currentStateTime = 15; + playerStatus->curStateTime = 15; playerStatus->actionSubstate++; // SUBSTATE_DUST_OFF } break; case SUBSTATE_DUST_OFF: - playerStatus->currentSpeed += SlideLaunchSpeed; - if (playerStatus->currentSpeed <= 0.0f) { - playerStatus->currentSpeed = 0.0f; + playerStatus->curSpeed += SlideLaunchSpeed; + if (playerStatus->curSpeed <= 0.0f) { + playerStatus->curSpeed = 0.0f; } - if (--playerStatus->currentStateTime == 0) { + if (--playerStatus->curStateTime == 0) { playerStatus->actionSubstate++; // SUBSTATE_DONE } break; case SUBSTATE_DONE: - speed = playerStatus->currentSpeed / 3.0f; + speed = playerStatus->curSpeed / 3.0f; if (speed < 0.01) { - playerStatus->currentSpeed = 0.0f; + playerStatus->curSpeed = 0.0f; } - playerStatus->currentSpeed -= speed; - if (playerStatus->currentSpeed <= 0.0f) { - playerStatus->currentSpeed = 0.0f; + playerStatus->curSpeed -= speed; + if (playerStatus->curSpeed <= 0.0f) { + playerStatus->curSpeed = 0.0f; set_action_state(ACTION_STATE_IDLE); } break; diff --git a/src/world/action/sneaky_parasol.c b/src/world/action/sneaky_parasol.c index 9e6805edd1b..39ecc3e791b 100644 --- a/src/world/action/sneaky_parasol.c +++ b/src/world/action/sneaky_parasol.c @@ -11,7 +11,7 @@ typedef struct TransformationData { /* 0x04 */ s32 reverted; /* 0x08 */ s32 disguiseTime; /* 0x0C */ s32 revertTime; - /* 0x10 */ Vec3f position; + /* 0x10 */ Vec3f pos; /* 0x1C */ f32 playerRotationRate; /* 0x20 */ f32 playerYawOffset; } TransformationData; @@ -51,12 +51,12 @@ Npc* parasol_get_npc(void) { if (gGameStatusPtr->peachFlags & PEACH_STATUS_FLAG_8) { gGameStatusPtr->peachFlags &= ~PEACH_STATUS_FLAG_8; } else { - ret = npc_find_closest(playerStatus->position.x, playerStatus->position.y, playerStatus->position.z, 100.0f); + ret = npc_find_closest(playerStatus->pos.x, playerStatus->pos.y, playerStatus->pos.z, 100.0f); if (ret != 0) { - if (fabs(ret->pos.y - playerStatus->position.y) - 1.0 > 0.0) { + if (fabs(ret->pos.y - playerStatus->pos.y) - 1.0 > 0.0) { ret = 0; } else { - angle = clamp_angle(atan2(playerStatus->position.x, playerStatus->position.z, ret->pos.x, ret->pos.z)); + angle = clamp_angle(atan2(playerStatus->pos.x, playerStatus->pos.z, ret->pos.x, ret->pos.z)); if (fabs(angle - func_800E5348()) > 30.0) { ret = 0; } @@ -89,7 +89,7 @@ void action_update_parasol(void) { tempUnk_1C = &transformation->playerRotationRate; playerStatus->timeInAir = 0; playerStatus->peakJumpTime = 0; - playerStatus->currentSpeed = 0; + playerStatus->curSpeed = 0; playerStatus->pitch = 0; if (playerStatus->spriteFacingAngle >= 90 && playerStatus->spriteFacingAngle < 270) { @@ -100,13 +100,13 @@ void action_update_parasol(void) { *tempUnk_1C = phi_f4; if (!(playerStatus->animFlags & PA_FLAG_INVISIBLE)) { - playerStatus->currentStateTime = 20; + playerStatus->curStateTime = 20; playerStatus->actionSubstate = SUBSTATE_DISGUISE_INIT; transformation->disguiseTime = 15; transformation->npc = parasol_get_npc(); } else { playerStatus->actionSubstate = SUBSTATE_REVERT_INIT; - playerStatus->currentStateTime = 40; + playerStatus->curStateTime = 40; transformation->reverted = 1; transformation->revertTime = 12; disguiseNpc = get_npc_by_index(PeachDisguiseNpcIndex); @@ -126,12 +126,12 @@ void action_update_parasol(void) { } else { suggest_player_anim_allow_backward(ANIM_Peach2_CantFitParasol); playerStatus->actionSubstate = SUBSTATE_BLOCKED; - playerStatus->currentStateTime = 10; + playerStatus->curStateTime = 10; transformation->disguiseTime = 0; } } case SUBSTATE_USE_PARASOL: - if (--playerStatus->currentStateTime == 0) { + if (--playerStatus->curStateTime == 0) { suggest_player_anim_allow_backward(ANIM_Peach2_PutAwayParasol); playerStatus->actionSubstate = SUBSTATE_PUT_AWAY; if (transformation->npc == NULL) { @@ -143,15 +143,15 @@ void action_update_parasol(void) { break; case SUBSTATE_PUT_AWAY: if (playerStatus->animNotifyValue != 0) { - playerStatus->currentStateTime = 12; + playerStatus->curStateTime = 12; playerStatus->flags |= PS_FLAG_ROTATION_LOCKED; playerStatus->actionSubstate++; // SUBSTATE_DISGUISE_BEGIN sfx_play_sound_at_player(SOUND_FD, SOUND_SPACE_MODE_0); } break; case SUBSTATE_DISGUISE_BEGIN: - if (--playerStatus->currentStateTime == 0) { - playerStatus->currentStateTime = 10; + if (--playerStatus->curStateTime == 0) { + playerStatus->curStateTime = 10; transformation->revertTime = 10; playerStatus->actionSubstate++; // SUBSTATE_DISGUISE_WAIT_FOR_ANGLE } @@ -160,8 +160,8 @@ void action_update_parasol(void) { case SUBSTATE_DISGUISE_WAIT_FOR_ANGLE: prevFacingAngle = playerStatus->spriteFacingAngle; parasol_update_spin(); - playerStatus->targetYaw = clamp_angle((cam->currentYaw - playerStatus->spriteFacingAngle) - 90); - if (playerStatus->currentStateTime == 0) { + playerStatus->targetYaw = clamp_angle((cam->curYaw - playerStatus->spriteFacingAngle) - 90); + if (playerStatus->curStateTime == 0) { // wait for the sprite to rotate into a position where it's tangent to the camera reachedTangentAngle = FALSE; if (transformation->playerRotationRate > 0) { @@ -176,14 +176,14 @@ void action_update_parasol(void) { } if (reachedTangentAngle) { playerStatus->actionSubstate = SUBSTATE_DISGUISE_SPIN_DOWN; - playerStatus->currentStateTime = 2; + playerStatus->curStateTime = 2; if (peach_make_disguise_npc(playerStatus->availableDisguiseType) != NULL) { playerStatus->actionSubstate = SUBSTATE_DISGUISE_MAKE_NPC; peach_sync_disguise_npc(); } } } else { - playerStatus->currentStateTime--; + playerStatus->curStateTime--; } break; case SUBSTATE_DISGUISE_MAKE_NPC: @@ -192,7 +192,7 @@ void action_update_parasol(void) { gameStatus->peachFlags |= PEACH_STATUS_FLAG_DISGUISED; playerStatus->actionSubstate++; // SUBSTATE_DISGUISE_SPIN_DOWN case SUBSTATE_DISGUISE_SPIN_DOWN: - if (--playerStatus->currentStateTime == 0) { + if (--playerStatus->curStateTime == 0) { playerStatus->actionSubstate++; // SUBSTATE_DISGUISE_FINISH_SPIN } parasol_update_spin(); @@ -202,32 +202,32 @@ void action_update_parasol(void) { transformation->playerYawOffset -= 2.35; if (transformation->playerYawOffset <= 0) { transformation->playerYawOffset = 0; - playerStatus->currentStateTime = 10; + playerStatus->curStateTime = 10; playerStatus->actionSubstate++; // SUBSTATE_DISGUISE_DONE playerStatus->spriteFacingAngle = 180; disguiseNpc = get_npc_by_index(PeachDisguiseNpcIndex); disguiseNpc->isFacingAway = TRUE; - disguiseNpc->yaw = clamp_angle((cam->currentYaw - playerStatus->spriteFacingAngle) - 90); + disguiseNpc->yaw = clamp_angle((cam->curYaw - playerStatus->spriteFacingAngle) - 90); disguiseNpc->yawCamOffset = disguiseNpc->yaw; } } else { transformation->playerYawOffset += 2.35; if (transformation->playerYawOffset >= 0) { transformation->playerYawOffset = 0; - playerStatus->currentStateTime = 10; + playerStatus->curStateTime = 10; playerStatus->spriteFacingAngle = 0; playerStatus->actionSubstate++; // SUBSTATE_DISGUISE_DONE disguiseNpc = get_npc_by_index(PeachDisguiseNpcIndex); disguiseNpc->isFacingAway = FALSE; - disguiseNpc->yaw = clamp_angle((cam->currentYaw - playerStatus->spriteFacingAngle) - 90); + disguiseNpc->yaw = clamp_angle((cam->curYaw - playerStatus->spriteFacingAngle) - 90); disguiseNpc->yawCamOffset = disguiseNpc->yaw; } } playerStatus->spriteFacingAngle = clamp_angle(playerStatus->spriteFacingAngle + transformation->playerYawOffset); - playerStatus->targetYaw = clamp_angle((cam->currentYaw - playerStatus->spriteFacingAngle) - 90); + playerStatus->targetYaw = clamp_angle((cam->curYaw - playerStatus->spriteFacingAngle) - 90); break; case SUBSTATE_DISGUISE_DONE: - if (--playerStatus->currentStateTime == 0) { + if (--playerStatus->curStateTime == 0) { set_time_freeze_mode(TIME_FREEZE_NORMAL); disguiseNpc = get_npc_by_index(PeachDisguiseNpcIndex); disguiseNpc->flags &= ~NPC_FLAG_IGNORE_CAMERA_FOR_YAW; @@ -237,17 +237,17 @@ void action_update_parasol(void) { } break; case SUBSTATE_REVERT_INIT: - if (--playerStatus->currentStateTime == 0) { + if (--playerStatus->curStateTime == 0) { playerStatus->actionSubstate++; // SUBSTATE_REVERT_WAIT_FOR_ANGLE } parasol_update_spin(); - playerStatus->targetYaw = clamp_angle(cam->currentYaw - playerStatus->spriteFacingAngle - 90); + playerStatus->targetYaw = clamp_angle(cam->curYaw - playerStatus->spriteFacingAngle - 90); break; case SUBSTATE_REVERT_WAIT_FOR_ANGLE: prevFacingAngle = playerStatus->spriteFacingAngle; parasol_update_spin(); - playerStatus->targetYaw = clamp_angle((cam->currentYaw - playerStatus->spriteFacingAngle) - 90); - if (playerStatus->currentStateTime == 0) { + playerStatus->targetYaw = clamp_angle((cam->curYaw - playerStatus->spriteFacingAngle) - 90); + if (playerStatus->curStateTime == 0) { // wait for the sprite to rotate into a position where it's tangent to the camera reachedTangentAngle = FALSE; if (transformation->playerRotationRate > 0) { @@ -261,7 +261,7 @@ void action_update_parasol(void) { } } if (reachedTangentAngle) { - playerStatus->currentStateTime = 2; + playerStatus->curStateTime = 2; playerStatus->actionSubstate++; // SUBSTATE_SPIN_DOWN gameStatus2 = gGameStatusPtr; playerStatus->animFlags &= ~PA_FLAG_INVISIBLE; @@ -272,11 +272,11 @@ void action_update_parasol(void) { playerStatus->colliderDiameter = 38; } } else { - playerStatus->currentStateTime--; + playerStatus->curStateTime--; } break; case SUBSTATE_SPIN_DOWN: - if (--playerStatus->currentStateTime == 0) { + if (--playerStatus->curStateTime == 0) { playerStatus->actionSubstate++; // SUBSTATE_FINISH_SPIN } parasol_update_spin(); @@ -286,30 +286,30 @@ void action_update_parasol(void) { transformation->playerYawOffset -= 2.35; if (transformation->playerYawOffset <= 0) { transformation->playerYawOffset = 0; - playerStatus->currentStateTime = 10; + playerStatus->curStateTime = 10; playerStatus->actionSubstate++; // SUBSTATE_REVERT_DONE playerStatus->spriteFacingAngle = 180; PrevPlayerDirection = 1; - playerStatus->currentYaw = clamp_angle((cam->currentYaw - 180) - 90); - PrevPlayerCamRelativeYaw = playerStatus->currentYaw; + playerStatus->curYaw = clamp_angle((cam->curYaw - 180) - 90); + PrevPlayerCamRelativeYaw = playerStatus->curYaw; } } else { transformation->playerYawOffset += 2.35; if (transformation->playerYawOffset >= 0) { transformation->playerYawOffset = 0; - playerStatus->currentStateTime = 10; + playerStatus->curStateTime = 10; playerStatus->spriteFacingAngle = 0; playerStatus->actionSubstate++; // SUBSTATE_REVERT_DONE PrevPlayerDirection = 0; - playerStatus->currentYaw = clamp_angle((cam->currentYaw - 0) - 90); - PrevPlayerCamRelativeYaw = playerStatus->currentYaw; + playerStatus->curYaw = clamp_angle((cam->curYaw - 0) - 90); + PrevPlayerCamRelativeYaw = playerStatus->curYaw; } } playerStatus->spriteFacingAngle = clamp_angle(playerStatus->spriteFacingAngle + transformation->playerYawOffset); - playerStatus->targetYaw = clamp_angle(cam->currentYaw - playerStatus->spriteFacingAngle - 90); + playerStatus->targetYaw = clamp_angle(cam->curYaw - playerStatus->spriteFacingAngle - 90); break; case SUBSTATE_REVERT_DONE: - if (--playerStatus->currentStateTime == 0) { + if (--playerStatus->curStateTime == 0) { set_time_freeze_mode(TIME_FREEZE_NORMAL); playerStatus->flags &= ~PS_FLAG_ROTATION_LOCKED; set_action_state(ACTION_STATE_IDLE); @@ -327,7 +327,7 @@ void action_update_parasol(void) { } break; case SUBSTATE_BLOCKED: - if (--playerStatus->currentStateTime == 0) { + if (--playerStatus->curStateTime == 0) { set_action_state(ACTION_STATE_IDLE); enable_player_static_collisions(); } @@ -337,40 +337,40 @@ void action_update_parasol(void) { if (transformation->disguiseTime > 0) { if (--transformation->disguiseTime == 10) { if (playerStatus->spriteFacingAngle >= 90 && playerStatus->spriteFacingAngle < 270) { - angle = DEG_TO_RAD(cam->currentYaw - 270); + angle = DEG_TO_RAD(cam->curYaw - 270); radius = 46; } else { - angle = DEG_TO_RAD(cam->currentYaw - 90); + angle = DEG_TO_RAD(cam->curYaw - 90); radius = 30; } - transformation->position.x = playerStatus->position.x + (radius * sin_rad(angle)); - transformation->position.z = playerStatus->position.z - (radius * cos_rad(angle)); - transformation->position.y = playerStatus->position.y - 20; + transformation->pos.x = playerStatus->pos.x + (radius * sin_rad(angle)); + transformation->pos.z = playerStatus->pos.z - (radius * cos_rad(angle)); + transformation->pos.y = playerStatus->pos.y - 20; } if (transformation->disguiseTime <= 10 && transformation->disguiseTime & 1) { f64 tempX, tempZ; fx_sparkles(FX_SPARKLES_3, - transformation->position.x - 8, - transformation->position.y + 50, - transformation->position.z, + transformation->pos.x - 8, + transformation->pos.y + 50, + transformation->pos.z, 2); /* TODO something like: - angle = DEG_TO_RAD((cam->currentYaw + playerStatus->spriteFacingAngle) - 90); - transformation->position.x += (10.0 * sin_rad(angle)); - transformation->position.z -= (10.0 * cos_rad(angle)); + angle = DEG_TO_RAD((cam->curYaw + playerStatus->spriteFacingAngle) - 90); + transformation->pos.x += (10.0 * sin_rad(angle)); + transformation->pos.z -= (10.0 * cos_rad(angle)); */ - angle = DEG_TO_RAD((cam->currentYaw + playerStatus->spriteFacingAngle) - 90); + angle = DEG_TO_RAD((cam->curYaw + playerStatus->spriteFacingAngle) - 90); - tempX = transformation->position.x; + tempX = transformation->pos.x; tempX += 10.0 * sin_rad(angle); - transformation->position.x = tempX; + transformation->pos.x = tempX; - tempZ = transformation->position.z; - transformation->position.z = tempZ - (10.0 * cos_rad(angle)); + tempZ = transformation->pos.z; + transformation->pos.z = tempZ - (10.0 * cos_rad(angle)); } } else if (transformation->disguiseTime == 0) { transformation->disguiseTime = -1; @@ -389,9 +389,9 @@ void action_update_parasol(void) { } if ((transformation->revertTime & 3) == 0) { fx_stars_shimmer(4, - playerStatus->position.x, - playerStatus->position.y, - playerStatus->position.z, + playerStatus->pos.x, + playerStatus->pos.y, + playerStatus->pos.z, 50, 50, 40, 30); } } diff --git a/src/world/action/spin.c b/src/world/action/spin.c index d223d47a545..943e8c724b1 100644 --- a/src/world/action/spin.c +++ b/src/world/action/spin.c @@ -40,7 +40,7 @@ void action_update_spin(void) { playerStatus->animFlags &= ~PA_FLAG_INTERRUPT_SPIN; playerStatus->animFlags |= PA_FLAG_SPINNING; playerStatus->flags |= PS_FLAG_SPINNING; - playerStatus->currentStateTime = 0; + playerStatus->curStateTime = 0; playerStatus->actionSubstate = SUBSTATE_SPIN_0; playerSpinState->stopSoundTimer = 0; playerSpinState->hasBufferedSpin = FALSE; @@ -111,7 +111,7 @@ void action_update_spin(void) { sfx_play_sound_at_player(playerSpinState->spinSoundID, SOUND_SPACE_MODE_0); suggest_player_anim_always_forward(anim); - if ((clamp_angle(playerStatus->targetYaw - gCameras[gCurrentCameraID].currentYaw) <= 180.0f)) { + if ((clamp_angle(playerStatus->targetYaw - gCameras[gCurrentCameraID].curYaw) <= 180.0f)) { playerStatus->spinRate = playerSpinState->spinRate; } else { effectType++; @@ -132,9 +132,9 @@ void action_update_spin(void) { if (gSpinHistoryBufferPos > ARRAY_COUNT(gSpinHistoryPosX)) { gSpinHistoryBufferPos = 0; } - gSpinHistoryPosX[gSpinHistoryBufferPos] = playerStatus->position.x; - gSpinHistoryPosY[gSpinHistoryBufferPos] = playerStatus->position.y; - gSpinHistoryPosZ[gSpinHistoryBufferPos] = playerStatus->position.z; + gSpinHistoryPosX[gSpinHistoryBufferPos] = playerStatus->pos.x; + gSpinHistoryPosY[gSpinHistoryBufferPos] = playerStatus->pos.y; + gSpinHistoryPosZ[gSpinHistoryBufferPos] = playerStatus->pos.z; gSpinHistoryPosAngle[gSpinHistoryBufferPos] = playerStatus->spriteFacingAngle; gSpinHistoryBufferPos++; if (gSpinHistoryBufferPos > ARRAY_COUNT(gSpinHistoryPosX)) { @@ -166,18 +166,18 @@ void action_update_spin(void) { playerSpinState->spinDirectionMagnitude = 0.0f; } - angle = clamp_angle(playerStatus->targetYaw - gCameras[gCurrentCameraID].currentYaw); + angle = clamp_angle(playerStatus->targetYaw - gCameras[gCurrentCameraID].curYaw); playerSpinState->spinDirection.x = sin_rad(DEG_TO_RAD(angle)) * playerSpinState->spinDirectionMagnitude; playerSpinState->spinDirection.y = -cos_rad(DEG_TO_RAD(angle)) * playerSpinState->spinDirectionMagnitude; - playerStatus->currentStateTime--; - if (playerStatus->currentStateTime == 0) { + playerStatus->curStateTime--; + if (playerStatus->curStateTime == 0) { playerSpinState->stopSoundTimer = 4; set_action_state(ACTION_STATE_IDLE); playerStatus->flags &= ~PS_FLAG_SPINNING; playerStatus->animFlags &= ~PA_FLAG_SPINNING; sfx_stop_sound(playerSpinState->spinSoundID); } - playerStatus->currentSpeed = 0.0f; + playerStatus->curSpeed = 0.0f; return; } @@ -192,7 +192,7 @@ void action_update_spin(void) { } } - if (!(playerStatus->currentStateTime > playerSpinState->fullSpeedSpinTime)) { + if (!(playerStatus->curStateTime > playerSpinState->fullSpeedSpinTime)) { speedModifier = (playerSpinState->inputMagnitude) ? playerSpinState->speedScale : 0.0f; playerSpinState->spinDirectionMagnitude = playerSpinState->spinDirectionMagnitude + 0.9; @@ -200,11 +200,11 @@ void action_update_spin(void) { playerSpinState->spinDirectionMagnitude = 9.0f; } - angle = clamp_angle(playerStatus->targetYaw - gCameras[gCurrentCameraID].currentYaw); + angle = clamp_angle(playerStatus->targetYaw - gCameras[gCurrentCameraID].curYaw); playerSpinState->spinDirection.x = sin_rad(DEG_TO_RAD(angle)) * playerSpinState->spinDirectionMagnitude; playerSpinState->spinDirection.y = -cos_rad(DEG_TO_RAD(angle)) * playerSpinState->spinDirectionMagnitude; } else { - speedModifier = playerSpinState->speedScale - (playerStatus->currentStateTime - playerSpinState->fullSpeedSpinTime - 1) * playerSpinState->frictionScale; + speedModifier = playerSpinState->speedScale - (playerStatus->curStateTime - playerSpinState->fullSpeedSpinTime - 1) * playerSpinState->frictionScale; if (speedModifier < 0.1) { speedModifier = 0.1f; } @@ -219,7 +219,7 @@ void action_update_spin(void) { } } - playerStatus->currentStateTime++; + playerStatus->curStateTime++; switch (playerStatus->prevActionState) { case ACTION_STATE_IDLE: @@ -230,17 +230,17 @@ void action_update_spin(void) { playerStatus->targetYaw = angle; } } - playerStatus->currentSpeed = (magnitude != 0.0f) ? playerStatus->runSpeed * speedModifier : 0.0f; + playerStatus->curSpeed = (magnitude != 0.0f) ? playerStatus->runSpeed * speedModifier : 0.0f; break; case ACTION_STATE_WALK: case ACTION_STATE_RUN: - playerStatus->currentSpeed = playerStatus->runSpeed * speedModifier; + playerStatus->curSpeed = playerStatus->runSpeed * speedModifier; break; } if (playerStatus->actionSubstate == SUBSTATE_SPIN_0) { playerSpinState->spinCountdown--; if (playerSpinState->spinCountdown > 0) { - if (playerStatus->currentStateTime >= 2) { + if (playerStatus->curStateTime >= 2) { playerStatus->spriteFacingAngle = clamp_angle(playerStatus->spriteFacingAngle + playerStatus->spinRate); } return; @@ -254,21 +254,21 @@ void action_update_spin(void) { playerStatus->spriteFacingAngle = angle + playerStatus->spinRate; if (playerSpinState->hasBufferedSpin) { - playerStatus->currentStateTime = 2; + playerStatus->curStateTime = 2; playerStatus->actionSubstate = SUBSTATE_SPIN_2; playerStatus->flags &= ~PS_FLAG_SPINNING; suggest_player_anim_allow_backward(ANIM_Mario1_Idle); } else if (angle < playerStatus->spriteFacingAngle) { if (playerStatus->spriteFacingAngle >= 180.0f && angle < 180.0f) { playerStatus->spriteFacingAngle = 180.0f; - playerStatus->currentStateTime = 2; + playerStatus->curStateTime = 2; playerStatus->actionSubstate = SUBSTATE_SPIN_2; playerStatus->flags &= ~PS_FLAG_SPINNING; suggest_player_anim_allow_backward(ANIM_Mario1_Idle); } } else if (playerStatus->spriteFacingAngle <= 0.0f && angle < 90.0f) { playerStatus->spriteFacingAngle = 0.0f; - playerStatus->currentStateTime = 2; + playerStatus->curStateTime = 2; playerStatus->actionSubstate = SUBSTATE_SPIN_2; playerStatus->flags &= ~PS_FLAG_SPINNING; suggest_player_anim_allow_backward(ANIM_Mario1_Idle); diff --git a/src/world/action/spin_jump.c b/src/world/action/spin_jump.c index b8c1892d2bf..815f060ef5c 100644 --- a/src/world/action/spin_jump.c +++ b/src/world/action/spin_jump.c @@ -33,7 +33,7 @@ void action_update_spin_jump(void) { playerStatus->flags |= (PS_FLAG_JUMPING | PS_FLAG_FLYING); playerStatus->actionSubstate = SUBSTATE_SPIN; - playerStatus->currentSpeed = 0.0f; + playerStatus->curSpeed = 0.0f; RotationRate = 0.0f; playerStatus->gravityIntegrator[0] = 5.2f; suggest_player_anim_allow_backward(ANIM_Mario1_Sit); @@ -53,37 +53,37 @@ void action_update_spin_jump(void) { } if (playerStatus->gravityIntegrator[0] >= 0.0f) { playerStatus->gravityIntegrator[0] -= 0.54; - if (collisionStatus->currentCeiling < 0) { - playerStatus->position.y += playerStatus->gravityIntegrator[0]; - } else if (collisionStatus->currentCeiling & COLLISION_WITH_ENTITY_BIT) { - entity = get_entity_by_index(collisionStatus->currentCeiling); + if (collisionStatus->curCeiling < 0) { + playerStatus->pos.y += playerStatus->gravityIntegrator[0]; + } else if (collisionStatus->curCeiling & COLLISION_WITH_ENTITY_BIT) { + entity = get_entity_by_index(collisionStatus->curCeiling); if (entity != NULL) { - playerStatus->position.y = entity->position.y - (playerStatus->colliderHeight * 0.5); + playerStatus->pos.y = entity->pos.y - (playerStatus->colliderHeight * 0.5); } } } if (playerStatus->pitch == 360.0f) { if (playerStatus->gravityIntegrator[0] <= 0.0f) { - playerStatus->currentStateTime = 5; + playerStatus->curStateTime = 5; playerStatus->actionSubstate = SUBSTATE_RISE; playerStatus->gravityIntegrator[0] = 2.0f; } } - collisionStatus->currentCeiling = -1; + collisionStatus->curCeiling = -1; break; case SUBSTATE_RISE: if (playerStatus->gravityIntegrator[0] >= 0.0f) { playerStatus->gravityIntegrator[0] -= 1.4; - if (collisionStatus->currentCeiling < 0) { - playerStatus->position.y += playerStatus->gravityIntegrator[0]; + if (collisionStatus->curCeiling < 0) { + playerStatus->pos.y += playerStatus->gravityIntegrator[0]; } } - if (--playerStatus->currentStateTime <= 0) { + if (--playerStatus->curStateTime <= 0) { playerStatus->actionSubstate++; } break; case SUBSTATE_HOVER: - playerStatus->position.y = player_check_collision_below(0.0f, &belowColliderID); + playerStatus->pos.y = player_check_collision_below(0.0f, &belowColliderID); RotationRate = 45.0f; playerStatus->pitch += RotationRate; if (playerStatus->pitch >= 360.0) { @@ -98,7 +98,7 @@ void action_update_spin_jump(void) { break; case SUBSTATE_DESCEND: velocity = player_fall_distance(); - playerStatus->position.y = player_check_collision_below(velocity, &belowColliderID); + playerStatus->pos.y = player_check_collision_below(velocity, &belowColliderID); if (velocity < -100.0f) { playerStatus->gravityIntegrator[3] = 0.0f; playerStatus->gravityIntegrator[2] = 0.0f; @@ -106,9 +106,9 @@ void action_update_spin_jump(void) { playerStatus->gravityIntegrator[0] = -100.0f; } if (belowColliderID >= 0) { - if (collisionStatus->currentFloor & COLLISION_WITH_ENTITY_BIT && (entityType = get_entity_type(collisionStatus->currentFloor), + if (collisionStatus->curFloor & COLLISION_WITH_ENTITY_BIT && (entityType = get_entity_type(collisionStatus->curFloor), entityType == ENTITY_TYPE_RED_SWITCH || entityType == ENTITY_TYPE_BLUE_SWITCH)) { - get_entity_by_index(collisionStatus->currentFloor)->collisionFlags |= ENTITY_COLLISION_PLAYER_TOUCH_FLOOR; + get_entity_by_index(collisionStatus->curFloor)->collisionFlags |= ENTITY_COLLISION_PLAYER_TOUCH_FLOOR; playerStatus->actionSubstate = SUBSTATE_HIT_SWITCH; playerStatus->flags &= ~PS_FLAG_FLYING; break; @@ -140,7 +140,7 @@ void action_update_spin_jump(void) { start_rumble(128, 25); panels = &gCurrentHiddenPanels; panels->tryFlipTrigger = TRUE; - panels->flipTriggerPosY = playerStatus->position.y; + panels->flipTriggerPosY = playerStatus->pos.y; playerStatus->flags |= PS_FLAG_SPECIAL_LAND; } } @@ -152,18 +152,18 @@ void action_update_spin_jump(void) { landed = TRUE; } else { if (playerStatus->gravityIntegrator[0] > 0.0f) { - playerStatus->position.y += velocity; + playerStatus->pos.y += velocity; } else { - playerStatus->position.y = player_check_collision_below(velocity, &belowColliderID); + playerStatus->pos.y = player_check_collision_below(velocity, &belowColliderID); if (playerStatus->gravityIntegrator[0] < 0.0f && belowColliderID >= 0) { playerStatus->actionSubstate++; } } - playerStatus->position.y = player_check_collision_below(0.0f, &belowColliderID); + playerStatus->pos.y = player_check_collision_below(0.0f, &belowColliderID); } break; case SUBSTATE_HOLD: - playerStatus->position.y = player_check_collision_below(0.0f, &belowColliderID); + playerStatus->pos.y = player_check_collision_below(0.0f, &belowColliderID); if (belowColliderID >= 0) { playerStatus->gravityIntegrator[0] = 0.0f; playerStatus->gravityIntegrator[1] = 0.0f; @@ -193,7 +193,7 @@ void action_update_spin_jump(void) { belowColliderID = get_collider_below_spin_jump(); if (belowColliderID >= 0) { collisionStatus->lastTouchedFloor = -1; - collisionStatus->currentFloor = belowColliderID; + collisionStatus->curFloor = belowColliderID; } } } @@ -202,9 +202,9 @@ static s32 get_collider_below_spin_jump(void) { f32 posX, posY, posZ, height; f32 hitRx, hitRz, hitDirX, hitDirZ; - posX = gPlayerStatus.position.x; - posZ = gPlayerStatus.position.z; + posX = gPlayerStatus.pos.x; + posZ = gPlayerStatus.pos.z; height = gPlayerStatus.colliderHeight; - posY = gPlayerStatus.position.y + (height * 0.5f); + posY = gPlayerStatus.pos.y + (height * 0.5f); return player_raycast_below_cam_relative(&gPlayerStatus, &posX, &posY, &posZ, &height, &hitRx, &hitRz, &hitDirX, &hitDirZ); } diff --git a/src/world/action/step_up.c b/src/world/action/step_up.c index 164464b7fcf..4ddd4ff39b6 100644 --- a/src/world/action/step_up.c +++ b/src/world/action/step_up.c @@ -59,13 +59,13 @@ void action_update_step_up(void) { integrate_gravity(); sin_cos_rad(DEG_TO_RAD(playerStatus->targetYaw), &sinTheta, &cosTheta); colliderID = NO_COLLIDER; - playerStatus->position.x += sinTheta * 3.0f; - playerStatus->position.z -= cosTheta * 3.0f; + playerStatus->pos.x += sinTheta * 3.0f; + playerStatus->pos.z -= cosTheta * 3.0f; if (playerStatus->gravityIntegrator[0] < 0.0f) { - playerStatus->position.y = player_check_collision_below(playerStatus->gravityIntegrator[0], &colliderID); + playerStatus->pos.y = player_check_collision_below(playerStatus->gravityIntegrator[0], &colliderID); } else { - playerStatus->position.y += playerStatus->gravityIntegrator[0]; + playerStatus->pos.y += playerStatus->gravityIntegrator[0]; } if (colliderID >= 0) { @@ -95,18 +95,18 @@ void action_update_step_up_peach(void) { if (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) { playerStatus->flags &= ~PS_FLAG_ACTION_STATE_CHANGED; suggest_player_anim_allow_backward(ANIM_Peach1_StepUp); - playerStatus->currentStateTime = 8; + playerStatus->curStateTime = 8; } - if (playerStatus->currentStateTime != 0) { - playerStatus->currentStateTime--; - if (playerStatus->currentStateTime == 4) { + if (playerStatus->curStateTime != 0) { + playerStatus->curStateTime--; + if (playerStatus->curStateTime == 4) { try_player_footstep_sounds(1); } } else { if (!(playerStatus->flags & PS_FLAG_CUTSCENE_MOVEMENT)) { set_action_state(ACTION_STATE_IDLE); - } else if (playerStatus->currentSpeed >= playerStatus->runSpeed) { + } else if (playerStatus->curSpeed >= playerStatus->runSpeed) { set_action_state(ACTION_STATE_RUN); } else { set_action_state(ACTION_STATE_WALK); diff --git a/src/world/action/tornado_jump.c b/src/world/action/tornado_jump.c index 441668e9f9c..9b952df0d5a 100644 --- a/src/world/action/tornado_jump.c +++ b/src/world/action/tornado_jump.c @@ -34,7 +34,7 @@ void action_update_tornado_jump(void) { playerStatus->flags |= (PS_FLAG_SPINNING | PS_FLAG_FLYING | PS_FLAG_JUMPING); phys_clear_spin_history(); playerStatus->actionSubstate = SUBSTATE_ASCEND; - playerStatus->currentSpeed = 0.0f; + playerStatus->curSpeed = 0.0f; playerStatus->gravityIntegrator[0] = 16.0f; playerStatus->gravityIntegrator[1] = -7.38624f; playerStatus->gravityIntegrator[2] = 3.44694f; @@ -43,7 +43,7 @@ void action_update_tornado_jump(void) { disable_player_input(); playerStatus->flags |= PS_FLAG_SPECIAL_JUMP; gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_IGNORE_PLAYER_Y; - cameraRelativeYaw = clamp_angle(playerStatus->targetYaw - gCameras[gCurrentCameraID].currentYaw); + cameraRelativeYaw = clamp_angle(playerStatus->targetYaw - gCameras[gCurrentCameraID].curYaw); if (cameraRelativeYaw <= 180.0f) { spinRate = 60.0f; } else { @@ -65,7 +65,7 @@ void action_update_tornado_jump(void) { } } if (playerStatus->gravityIntegrator[0] <= 0.0f) { - gSpinHistoryPosY[gSpinHistoryBufferPos] = playerStatus->position.y; + gSpinHistoryPosY[gSpinHistoryBufferPos] = playerStatus->pos.y; } gSpinHistoryPosAngle[gSpinHistoryBufferPos++] = playerStatus->spriteFacingAngle; @@ -77,11 +77,11 @@ void action_update_tornado_jump(void) { switch (playerStatus->actionSubstate) { case SUBSTATE_ASCEND: fallVelocity = integrate_gravity(); - playerStatus->position.y = player_check_collision_below(fallVelocity, &colliderBelow); - if (colliderBelow >= 0 && collisionStatus->currentFloor & COLLISION_WITH_ENTITY_BIT ) { - entityType = get_entity_type(collisionStatus->currentFloor); + playerStatus->pos.y = player_check_collision_below(fallVelocity, &colliderBelow); + if (colliderBelow >= 0 && collisionStatus->curFloor & COLLISION_WITH_ENTITY_BIT ) { + entityType = get_entity_type(collisionStatus->curFloor); if (entityType == ENTITY_TYPE_BLUE_SWITCH || entityType == ENTITY_TYPE_RED_SWITCH) { - get_entity_by_index(collisionStatus->currentFloor)->collisionFlags |= ENTITY_COLLISION_PLAYER_TOUCH_FLOOR; + get_entity_by_index(collisionStatus->curFloor)->collisionFlags |= ENTITY_COLLISION_PLAYER_TOUCH_FLOOR; disable_player_input(); playerStatus->actionSubstate = SUBSTATE_HIT_SWITCH; break; @@ -89,7 +89,7 @@ void action_update_tornado_jump(void) { } if (fallVelocity <= 0.0f) { record_jump_apex(); - playerStatus->currentStateTime = 3; + playerStatus->curStateTime = 3; playerStatus->flags |= PS_FLAG_FALLING; playerStatus->actionSubstate++; sfx_play_sound_at_player(SOUND_TORNADO_JUMP, SOUND_SPACE_MODE_0); @@ -100,13 +100,13 @@ void action_update_tornado_jump(void) { } break; case SUBSTATE_HOVER: - if (--playerStatus->currentStateTime <= 0) { + if (--playerStatus->curStateTime <= 0) { playerStatus->actionSubstate++; } break; case SUBSTATE_DESCEND: fallVelocity = integrate_gravity(); - playerStatus->position.y = player_check_collision_below(fallVelocity, &colliderBelow); + playerStatus->pos.y = player_check_collision_below(fallVelocity, &colliderBelow); if (fallVelocity < -100.0f) { playerStatus->gravityIntegrator[3] = 0.0f; playerStatus->gravityIntegrator[2] = 0.0f; @@ -114,8 +114,8 @@ void action_update_tornado_jump(void) { playerStatus->gravityIntegrator[0] = -100.0f; } if (colliderBelow >= 0) { - if (collisionStatus->currentFloor & COLLISION_WITH_ENTITY_BIT) { - entityType = get_entity_type(collisionStatus->currentFloor); + if (collisionStatus->curFloor & COLLISION_WITH_ENTITY_BIT) { + entityType = get_entity_type(collisionStatus->curFloor); if (entityType == ENTITY_TYPE_SIMPLE_SPRING || entityType == ENTITY_TYPE_SCRIPT_SPRING) { playerStatus->flags &= ~(PS_FLAG_SPINNING | PS_FLAG_FLYING); set_action_state(ACTION_STATE_LAND); @@ -128,7 +128,7 @@ void action_update_tornado_jump(void) { start_rumble(256, 50); gCurrentHiddenPanels.tryFlipTrigger = TRUE; - gCurrentHiddenPanels.flipTriggerPosY = playerStatus->position.y; + gCurrentHiddenPanels.flipTriggerPosY = playerStatus->pos.y; playerStatus->flags |= PS_FLAG_SPECIAL_LAND; return; } @@ -146,7 +146,7 @@ void action_update_tornado_jump(void) { playerStatus->flags &= ~(PS_FLAG_SPINNING | PS_FLAG_FLYING); return; } - playerStatus->currentStateTime = 8; + playerStatus->curStateTime = 8; playerStatus->timeInAir = 0; playerStatus->actionState = ACTION_STATE_TORNADO_POUND; playerStatus->actionSubstate++; @@ -155,12 +155,12 @@ void action_update_tornado_jump(void) { start_rumble(256, 50); gCurrentHiddenPanels.tryFlipTrigger = TRUE; - gCurrentHiddenPanels.flipTriggerPosY = playerStatus->position.y; + gCurrentHiddenPanels.flipTriggerPosY = playerStatus->pos.y; playerStatus->flags |= PS_FLAG_SPECIAL_LAND; } break; case SUBSTATE_IMPACT: - if (--playerStatus->currentStateTime == 0) { + if (--playerStatus->curStateTime == 0) { playerStatus->actionSubstate++; playerStatus->flags &= ~(PS_FLAG_SPINNING | PS_FLAG_FLYING); set_action_state(ACTION_STATE_LAND); @@ -179,7 +179,7 @@ void action_update_tornado_jump(void) { colliderBelow = get_collider_below_tornado_jump(); if (colliderBelow >= 0) { collisionStatus->lastTouchedFloor = -1; - collisionStatus->currentFloor = colliderBelow; + collisionStatus->curFloor = colliderBelow; } } } @@ -188,9 +188,9 @@ static s32 get_collider_below_tornado_jump(void) { f32 posX, posY, posZ, height; f32 hitRx, hitRz, hitDirX, hitDirZ; - posX = gPlayerStatus.position.x; - posZ = gPlayerStatus.position.z; + posX = gPlayerStatus.pos.x; + posZ = gPlayerStatus.pos.z; height = gPlayerStatus.colliderHeight; - posY = gPlayerStatus.position.y + (height * 0.5f); + posY = gPlayerStatus.pos.y + (height * 0.5f); return player_raycast_below_cam_relative(&gPlayerStatus, &posX, &posY, &posZ, &height, &hitRx, &hitRz, &hitDirX, &hitDirZ); } diff --git a/src/world/action/use_munchlesia.c b/src/world/action/use_munchlesia.c index d67b5b09e21..f0cbd527b63 100644 --- a/src/world/action/use_munchlesia.c +++ b/src/world/action/use_munchlesia.c @@ -40,28 +40,28 @@ void action_update_use_munchlesia(void) { Munchlesia_LaunchYaw = playerStatus->targetYaw; break; case SUBSTATE_EJECT: - playerStatus->position.y += Munchlesia_LaunchVelocity; + playerStatus->pos.y += Munchlesia_LaunchVelocity; Munchlesia_LaunchVelocity -= Munchlesia_LaunchAccel; - add_vec2D_polar(&playerStatus->position.x, &playerStatus->position.z, Munchlesia_LateralVelocity, Munchlesia_LaunchYaw); - gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; - gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y; - gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; + add_vec2D_polar(&playerStatus->pos.x, &playerStatus->pos.z, Munchlesia_LateralVelocity, Munchlesia_LaunchYaw); + gCameras[CAM_DEFAULT].targetPos.x = playerStatus->pos.x; + gCameras[CAM_DEFAULT].targetPos.y = playerStatus->pos.y; + gCameras[CAM_DEFAULT].targetPos.z = playerStatus->pos.z; if (Munchlesia_LaunchVelocity <= 0.0f) { playerStatus->actionSubstate++; // SUBSTATE_FALL } break; case SUBSTATE_FALL: - playerStatus->position.y += Munchlesia_LaunchVelocity; + playerStatus->pos.y += Munchlesia_LaunchVelocity; Munchlesia_LaunchVelocity -= Munchlesia_LaunchAccel; - add_vec2D_polar(&playerStatus->position.x, &playerStatus->position.z, Munchlesia_LateralVelocity, Munchlesia_LaunchYaw); - gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; - gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y; - gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; + add_vec2D_polar(&playerStatus->pos.x, &playerStatus->pos.z, Munchlesia_LateralVelocity, Munchlesia_LaunchYaw); + gCameras[CAM_DEFAULT].targetPos.x = playerStatus->pos.x; + gCameras[CAM_DEFAULT].targetPos.y = playerStatus->pos.y; + gCameras[CAM_DEFAULT].targetPos.z = playerStatus->pos.z; hitPosY = player_check_collision_below(Munchlesia_LaunchVelocity, &colliderID); if (colliderID >= 0) { sfx_play_sound_at_player(SOUND_162, SOUND_SPACE_MODE_0); suggest_player_anim_always_forward(ANIM_MarioW2_Collapse); - playerStatus->position.y = hitPosY; + playerStatus->pos.y = hitPosY; D_802B62E0 = 10; playerStatus->actionSubstate++; // SUBSTATE_CRASH } @@ -70,13 +70,13 @@ void action_update_use_munchlesia(void) { if (playerStatus->animNotifyValue != 0) { suggest_player_anim_always_forward(ANIM_Mario1_GetUp); playerStatus->actionSubstate = SUBSTATE_GET_UP; - playerStatus->currentStateTime = 15; + playerStatus->curStateTime = 15; break; } break; case SUBSTATE_GET_UP: - if (playerStatus->currentStateTime != 0) { - playerStatus->currentStateTime--; + if (playerStatus->curStateTime != 0) { + playerStatus->curStateTime--; break; } enable_player_static_collisions(); diff --git a/src/world/action/use_spinning_flower.c b/src/world/action/use_spinning_flower.c index 8349f3332fb..0031f079a64 100644 --- a/src/world/action/use_spinning_flower.c +++ b/src/world/action/use_spinning_flower.c @@ -30,10 +30,10 @@ static s32 get_entity_below_spinning_flower(void) { f32 posX, posY, posZ, height; f32 hitRx, hitRz, hitDirX, hitDirZ; - posX = gPlayerStatus.position.x; - posZ = gPlayerStatus.position.z; + posX = gPlayerStatus.pos.x; + posZ = gPlayerStatus.pos.z; height = gPlayerStatus.colliderHeight; - posY = gPlayerStatus.position.y + (height * 0.5); + posY = gPlayerStatus.pos.y + (height * 0.5); return player_raycast_below_cam_relative(&gPlayerStatus, &posX, &posY, &posZ, &height, &hitRx, &hitRz, &hitDirX, &hitDirZ); } @@ -55,15 +55,15 @@ void action_update_use_spinning_flower(void) { gOverrideFlags |= GLOBAL_OVERRIDES_40; func_800EF300(); playerStatus->actionSubstate = SUBSTATE_ATTRACT; - playerStatus->currentStateTime = 0; + playerStatus->curStateTime = 0; D_802B6EE4 = 0.0f; D_802B6EE8 = 0.0f; - D_802B6EF4 = playerStatus->position.y; + D_802B6EF4 = playerStatus->pos.y; D_802B6EDC = 3.0f; disable_player_static_collisions(); disable_player_input(); playerStatus->flags |= PS_FLAG_ROTATION_LOCKED; - entityID = gCollisionStatus.currentFloor; + entityID = gCollisionStatus.curFloor; TempPointer = &SpinningFlower_EntityIndex; if (entityID >= 0){ @@ -88,22 +88,22 @@ void action_update_use_spinning_flower(void) { D_802B6EE4 = 20.0f; } playerStatus->spriteFacingAngle = clamp_angle(playerStatus->spriteFacingAngle + D_802B6EE4); - if (playerStatus->currentStateTime < 10) { - playerStatus->currentStateTime++; + if (playerStatus->curStateTime < 10) { + playerStatus->curStateTime++; D_802B6EF4++; } D_802B6EE8 += 8.0f; - playerStatus->position.y = D_802B6EF4 + sin_rad(DEG_TO_RAD(clamp_angle(D_802B6EE8))) * 4.0f; + playerStatus->pos.y = D_802B6EF4 + sin_rad(DEG_TO_RAD(clamp_angle(D_802B6EE8))) * 4.0f; if (SpinningFlower_EntityIndex >= 0) { entityByIndex = get_entity_by_index(SpinningFlower_EntityIndex); - distToCenter = dist2D(entityByIndex->position.x, entityByIndex->position.z, playerStatus->position.x, playerStatus->position.z); - SpinningFlower_AngleToCenter = atan2(entityByIndex->position.x, entityByIndex->position.z, playerStatus->position.x, playerStatus->position.z); + distToCenter = dist2D(entityByIndex->pos.x, entityByIndex->pos.z, playerStatus->pos.x, playerStatus->pos.z); + SpinningFlower_AngleToCenter = atan2(entityByIndex->pos.x, entityByIndex->pos.z, playerStatus->pos.x, playerStatus->pos.z); if (distToCenter > 4.0f) { distToCenter--; } sin_cos_rad(DEG_TO_RAD(SpinningFlower_AngleToCenter), &dx, &dz); - playerStatus->position.x = entityByIndex->position.x + (dx * distToCenter); - playerStatus->position.z = entityByIndex->position.z - (dz * distToCenter); + playerStatus->pos.x = entityByIndex->pos.x + (dx * distToCenter); + playerStatus->pos.z = entityByIndex->pos.z - (dz * distToCenter); sin_cos_rad(DEG_TO_RAD(SpinningFlower_AngleToCenter - 91.0f), &dx, &dz); D_802B6ED4 = dx * D_802B6EDC; D_802B6ED8 = -dz * D_802B6EDC; @@ -115,17 +115,17 @@ void action_update_use_spinning_flower(void) { if (inputMagnitude < 0.1) { inputMagnitude = 0.1f; } - playerStatus->position.x += dx * inputMagnitude; - playerStatus->position.z -= dz * inputMagnitude; + playerStatus->pos.x += dx * inputMagnitude; + playerStatus->pos.z -= dz * inputMagnitude; } - gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; - gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y; - gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; + gCameras[CAM_DEFAULT].targetPos.x = playerStatus->pos.x; + gCameras[CAM_DEFAULT].targetPos.y = playerStatus->pos.y; + gCameras[CAM_DEFAULT].targetPos.z = playerStatus->pos.z; entityID = get_entity_below_spinning_flower(); if (entityID < 0 || !(entityID & COLLISION_WITH_ENTITY_BIT)) { - playerStatus->currentStateTime = 20; + playerStatus->curStateTime = 20; D_802B6EE8 = 0.0f; - D_802B6EF4 = playerStatus->position.y; + D_802B6EF4 = playerStatus->pos.y; playerStatus->actionSubstate++; D_802B6EF0 = 1.6f; playerStatus->flags |= PS_FLAG_SCRIPTED_FALL; @@ -134,9 +134,9 @@ void action_update_use_spinning_flower(void) { !(playerStatus->animFlags & (PA_FLAG_USING_WATT | PA_FLAG_WATT_IN_HANDS))) { suggest_player_anim_always_forward(ANIM_Mario1_Jump); playerStatus->actionSubstate = SUBSTATE_SPIN_UP; - playerStatus->currentStateTime = 30; + playerStatus->curStateTime = 30; D_802B6EE0 = 0.0f; - gCollisionStatus.currentFloor = NO_COLLIDER; + gCollisionStatus.curFloor = NO_COLLIDER; exec_entity_commandlist(get_entity_by_index(SpinningFlower_EntityIndex)); } break; @@ -152,13 +152,13 @@ void action_update_use_spinning_flower(void) { D_802B6EF0 -= 0.72; D_802B6ED4 = dx * D_802B6EDC; D_802B6ED8 = -dz * D_802B6EDC; - playerStatus->position.x += D_802B6ED4; - playerStatus->position.z += D_802B6ED8; + playerStatus->pos.x += D_802B6ED4; + playerStatus->pos.z += D_802B6ED8; collision_lava_reset_check_additional_overlaps(); - playerStatus->position.y = player_check_collision_below(D_802B6EF0, &entityID); - gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; - gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y; - gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; + playerStatus->pos.y = player_check_collision_below(D_802B6EF0, &entityID); + gCameras[CAM_DEFAULT].targetPos.x = playerStatus->pos.x; + gCameras[CAM_DEFAULT].targetPos.y = playerStatus->pos.y; + gCameras[CAM_DEFAULT].targetPos.z = playerStatus->pos.z; if (entityID >= 0) { playerStatus->flags &= ~PS_FLAG_ROTATION_LOCKED; enable_player_input(); @@ -174,26 +174,26 @@ void action_update_use_spinning_flower(void) { case SUBSTATE_SPIN_UP: if (SpinningFlower_EntityIndex >= 0) { entityByIndex = get_entity_by_index(SpinningFlower_EntityIndex); - distToCenter = dist2D(entityByIndex->position.x, entityByIndex->position.z, playerStatus->position.x, playerStatus->position.z); - SpinningFlower_AngleToCenter = atan2(entityByIndex->position.x, entityByIndex->position.z, playerStatus->position.x, playerStatus->position.z); + distToCenter = dist2D(entityByIndex->pos.x, entityByIndex->pos.z, playerStatus->pos.x, playerStatus->pos.z); + SpinningFlower_AngleToCenter = atan2(entityByIndex->pos.x, entityByIndex->pos.z, playerStatus->pos.x, playerStatus->pos.z); if (distToCenter > 4.0f) { distToCenter -= 1.0f; } sin_cos_rad(DEG_TO_RAD(SpinningFlower_AngleToCenter), &dx, &dz); - playerStatus->position.x = entityByIndex->position.x + (dx * distToCenter); - playerStatus->position.z = entityByIndex->position.z - (dz * distToCenter); + playerStatus->pos.x = entityByIndex->pos.x + (dx * distToCenter); + playerStatus->pos.z = entityByIndex->pos.z - (dz * distToCenter); sin_cos_rad(DEG_TO_RAD(SpinningFlower_AngleToCenter - 91.0f), &dx, &dz); D_802B6ED4 = dx * D_802B6EDC; D_802B6ED8 = -dz * D_802B6EDC; } D_802B6EE8 += 8.0f; - playerStatus->position.y = D_802B6EF4 + sin_rad(DEG_TO_RAD(clamp_angle(D_802B6EE8))) * 4.0f; - gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; - gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; - gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y; - if (playerStatus->currentStateTime != 0) { - playerStatus->currentStateTime--; + playerStatus->pos.y = D_802B6EF4 + sin_rad(DEG_TO_RAD(clamp_angle(D_802B6EE8))) * 4.0f; + gCameras[CAM_DEFAULT].targetPos.z = playerStatus->pos.z; + gCameras[CAM_DEFAULT].targetPos.x = playerStatus->pos.x; + gCameras[CAM_DEFAULT].targetPos.y = playerStatus->pos.y; + if (playerStatus->curStateTime != 0) { + playerStatus->curStateTime--; D_802B6EE4 += 2.0f; if (D_802B6EE4 >= 45.0f) { D_802B6EE4 = 45.0f; @@ -202,7 +202,7 @@ void action_update_use_spinning_flower(void) { break; } playerStatus->actionSubstate++; // SUBSTATE_ASCEND_A - playerStatus->currentStateTime = 30; + playerStatus->curStateTime = 30; phys_adjust_cam_on_landing(); break; case SUBSTATE_ASCEND_A: @@ -217,47 +217,47 @@ void action_update_use_spinning_flower(void) { } ascentVelocity = sin_rad(DEG_TO_RAD(D_802B6EE0)) * 4.0f; - playerStatus->position.y += ascentVelocity; - gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; - gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y; - gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; - distToCenter = fabsf(dist2D(D_802BCE34, D_802BCE32, playerStatus->position.x, playerStatus->position.z)); + playerStatus->pos.y += ascentVelocity; + gCameras[CAM_DEFAULT].targetPos.x = playerStatus->pos.x; + gCameras[CAM_DEFAULT].targetPos.y = playerStatus->pos.y; + gCameras[CAM_DEFAULT].targetPos.z = playerStatus->pos.z; + distToCenter = fabsf(dist2D(D_802BCE34, D_802BCE32, playerStatus->pos.x, playerStatus->pos.z)); if (distToCenter > 40.0f) { - if (D_802BCE30 + 30 < playerStatus->position.y) { + if (D_802BCE30 + 30 < playerStatus->pos.y) { playerStatus->actionSubstate++; // SUBSTATE_ASCEND_B - inputAngle = atan2(playerStatus->position.x, playerStatus->position.z, D_802BCE34, D_802BCE32); + inputAngle = atan2(playerStatus->pos.x, playerStatus->pos.z, D_802BCE34, D_802BCE32); sin_cos_rad(DEG_TO_RAD(inputAngle), &dx, &dz); - playerStatus->currentStateTime = 64; + playerStatus->curStateTime = 64; SpinningFlower_AngleToCenter = inputAngle; D_802B6ED4 = (dx * distToCenter) * 0.015625; D_802B6ED8 = (-dz * distToCenter) * 0.015625; } break; } - if (playerStatus->currentStateTime == 0) { + if (playerStatus->curStateTime == 0) { playerStatus->actionSubstate = SUBSTATE_BOOST; - playerStatus->currentStateTime = 20; + playerStatus->curStateTime = 20; } else { - playerStatus->currentStateTime--; + playerStatus->curStateTime--; } break; case SUBSTATE_ASCEND_B: playerStatus->spriteFacingAngle = clamp_angle(playerStatus->spriteFacingAngle + D_802B6EE4); - if (playerStatus->currentStateTime != 0) { - playerStatus->currentStateTime--; + if (playerStatus->curStateTime != 0) { + playerStatus->curStateTime--; if (D_802B6EE0-- < 0.0f) { D_802B6EE0 = 0.0f; } ascentVelocity = 2.0f * sin_rad(DEG_TO_RAD(D_802B6EE0)); - playerStatus->position.x += D_802B6ED4; - playerStatus->position.y += ascentVelocity; - playerStatus->position.z += D_802B6ED8; + playerStatus->pos.x += D_802B6ED4; + playerStatus->pos.y += ascentVelocity; + playerStatus->pos.z += D_802B6ED8; } else { playerStatus->actionSubstate = SUBSTATE_FINISH; } - gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; - gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y; - gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; + gCameras[CAM_DEFAULT].targetPos.x = playerStatus->pos.x; + gCameras[CAM_DEFAULT].targetPos.y = playerStatus->pos.y; + gCameras[CAM_DEFAULT].targetPos.z = playerStatus->pos.z; break; case SUBSTATE_BOOST: D_802B6EE4 += 1.0f; @@ -270,9 +270,9 @@ void action_update_use_spinning_flower(void) { D_802B6EE0 = 45.0f; } ascentVelocity = sin_rad(DEG_TO_RAD(D_802B6EE0)) * 3.0f; - playerStatus->position.y += ascentVelocity; - if (playerStatus->currentStateTime != 0) { - playerStatus->currentStateTime--; + playerStatus->pos.y += ascentVelocity; + if (playerStatus->curStateTime != 0) { + playerStatus->curStateTime--; break; } case SUBSTATE_FINISH: diff --git a/src/world/action/use_tweester.c b/src/world/action/use_tweester.c index ef059895966..250bc287c3b 100644 --- a/src/world/action/use_tweester.c +++ b/src/world/action/use_tweester.c @@ -25,10 +25,10 @@ void action_update_use_tweester(void) { suggest_player_anim_allow_backward(ANIM_MarioW2_FlailArms); playerStatus->actionSubstate = SUBSTATE_LAUNCH; mem_clear(PlayerTweesterPhysicsPtr, sizeof(*PlayerTweesterPhysicsPtr)); - PlayerTweesterPhysicsPtr->radius = fabsf(dist2D(playerStatus->position.x, playerStatus->position.z, entity->position.x, entity->position.z)); - PlayerTweesterPhysicsPtr->angle = atan2(entity->position.x, entity->position.z, playerStatus->position.x, playerStatus->position.z); - PlayerTweesterPhysicsPtr->angularVelocity = 6.0f; - PlayerTweesterPhysicsPtr->liftoffVelocityPhase = 50.0f; + PlayerTweesterPhysicsPtr->radius = fabsf(dist2D(playerStatus->pos.x, playerStatus->pos.z, entity->pos.x, entity->pos.z)); + PlayerTweesterPhysicsPtr->angle = atan2(entity->pos.x, entity->pos.z, playerStatus->pos.x, playerStatus->pos.z); + PlayerTweesterPhysicsPtr->angularVel = 6.0f; + PlayerTweesterPhysicsPtr->liftoffVelPhase = 50.0f; PlayerTweesterPhysicsPtr->countdown = 120; sfx_play_sound_at_player(SOUND_TWEESTER_LAUNCH, SOUND_SPACE_MODE_0); } @@ -37,10 +37,10 @@ void action_update_use_tweester(void) { case SUBSTATE_LAUNCH: sin_cos_rad(DEG_TO_RAD(PlayerTweesterPhysicsPtr->angle), &sinAngle, &cosAngle); - playerStatus->position.x = entity->position.x + (sinAngle * PlayerTweesterPhysicsPtr->radius); - playerStatus->position.z = entity->position.z - (cosAngle * PlayerTweesterPhysicsPtr->radius); + playerStatus->pos.x = entity->pos.x + (sinAngle * PlayerTweesterPhysicsPtr->radius); + playerStatus->pos.z = entity->pos.z - (cosAngle * PlayerTweesterPhysicsPtr->radius); - PlayerTweesterPhysicsPtr->angle = clamp_angle(PlayerTweesterPhysicsPtr->angle - PlayerTweesterPhysicsPtr->angularVelocity); + PlayerTweesterPhysicsPtr->angle = clamp_angle(PlayerTweesterPhysicsPtr->angle - PlayerTweesterPhysicsPtr->angularVel); if (PlayerTweesterPhysicsPtr->radius > 20.0f) { PlayerTweesterPhysicsPtr->radius--; @@ -48,17 +48,17 @@ void action_update_use_tweester(void) { PlayerTweesterPhysicsPtr->radius++; } - liftoffVelocity = sin_rad(DEG_TO_RAD(PlayerTweesterPhysicsPtr->liftoffVelocityPhase)) * 3.0f; - PlayerTweesterPhysicsPtr->liftoffVelocityPhase += 3.0f; - if (PlayerTweesterPhysicsPtr->liftoffVelocityPhase > 150.0f) { - PlayerTweesterPhysicsPtr->liftoffVelocityPhase = 150.0f; + liftoffVelocity = sin_rad(DEG_TO_RAD(PlayerTweesterPhysicsPtr->liftoffVelPhase)) * 3.0f; + PlayerTweesterPhysicsPtr->liftoffVelPhase += 3.0f; + if (PlayerTweesterPhysicsPtr->liftoffVelPhase > 150.0f) { + PlayerTweesterPhysicsPtr->liftoffVelPhase = 150.0f; } - playerStatus->position.y += liftoffVelocity; + playerStatus->pos.y += liftoffVelocity; playerStatus->spriteFacingAngle = clamp_angle(360.0f - PlayerTweesterPhysicsPtr->angle); - PlayerTweesterPhysicsPtr->angularVelocity += 0.6; - if (PlayerTweesterPhysicsPtr->angularVelocity > 40.0f) { - PlayerTweesterPhysicsPtr->angularVelocity = 40.0f; + PlayerTweesterPhysicsPtr->angularVel += 0.6; + if (PlayerTweesterPhysicsPtr->angularVel > 40.0f) { + PlayerTweesterPhysicsPtr->angularVel = 40.0f; } if (--PlayerTweesterPhysicsPtr->countdown == 0) { playerStatus->actionSubstate++; // SUBSTATE_DONE diff --git a/src/world/action/walk.c b/src/world/action/walk.c index fd7eb47c51c..b3f3e58cee2 100644 --- a/src/world/action/walk.c +++ b/src/world/action/walk.c @@ -49,7 +49,7 @@ void action_update_walk(void) { changedAnim = TRUE; if (!(playerStatus->flags & PS_FLAG_CUTSCENE_MOVEMENT)) { - playerStatus->currentSpeed = playerStatus->walkSpeed; + playerStatus->curSpeed = playerStatus->walkSpeed; } if (playerStatus->animFlags & PA_FLAG_8BIT_MARIO) { @@ -135,7 +135,7 @@ void action_update_run(void) { phi_s3 = 1; if (!(playerStatus->flags & PS_FLAG_CUTSCENE_MOVEMENT)) { - playerStatus->currentSpeed = playerStatus->runSpeed; + playerStatus->curSpeed = playerStatus->runSpeed; } if (playerStatus->animFlags & PA_FLAG_8BIT_MARIO) { anim = ANIM_MarioW3_8bit_Run; @@ -162,7 +162,7 @@ void action_update_run(void) { runSpeedModifier = 1.5f; } - playerStatus->currentSpeed = playerStatus->runSpeed * runSpeedModifier; + playerStatus->curSpeed = playerStatus->runSpeed * runSpeedModifier; player_input_to_move_vector(&moveX, &moveY); phys_update_interact_collider(); if (check_input_jump() == FALSE) { @@ -226,7 +226,7 @@ static void action_update_walk_peach(void) { playerStatus->flags &= ~PS_FLAG_ACTION_STATE_CHANGED; playerStatus->unk_60 = 0; if (!(playerStatus->flags & PS_FLAG_CUTSCENE_MOVEMENT)) { - playerStatus->currentSpeed = playerStatus->walkSpeed; + playerStatus->curSpeed = playerStatus->walkSpeed; } func_802B6550_E23C30(); } @@ -263,7 +263,7 @@ static void action_update_run_peach(void) { playerStatus->flags &= ~PS_FLAG_ACTION_STATE_CHANGED; playerStatus->unk_60 = 0; if (!(playerStatus->flags & PS_FLAG_CUTSCENE_MOVEMENT)) { - playerStatus->currentSpeed = playerStatus->runSpeed; + playerStatus->curSpeed = playerStatus->runSpeed; } if (!(playerStatus->animFlags & PA_FLAG_INVISIBLE)) { @@ -288,7 +288,7 @@ static void action_update_run_peach(void) { return; } - playerStatus->currentSpeed = playerStatus->runSpeed; + playerStatus->curSpeed = playerStatus->runSpeed; player_input_to_move_vector(&moveX, &moveY); phys_update_interact_collider(); if (moveY == 0.0f) { diff --git a/src/world/area_arn/arn_08/arn_08_3_well.c b/src/world/area_arn/arn_08/arn_08_3_well.c index 12b19b270bd..5c35b771dcd 100644 --- a/src/world/area_arn/arn_08/arn_08_3_well.c +++ b/src/world/area_arn/arn_08/arn_08_3_well.c @@ -12,7 +12,7 @@ API_CALLABLE(N(AwaitPlayerFallDist)) { } fallSpeed = player_fall_distance(); - playerStatus->position.y = player_check_collision_below(fallSpeed, &colliderID); + playerStatus->pos.y = player_check_collision_below(fallSpeed, &colliderID); script->functionTemp[0] += fabsf(fallSpeed); if (script->functionTemp[0] > 50) { @@ -23,7 +23,7 @@ API_CALLABLE(N(AwaitPlayerFallDist)) { } API_CALLABLE(N(AwaitPlayerJumpDown)) { - if (gPlayerStatus.position.y < -10.0f) { + if (gPlayerStatus.pos.y < -10.0f) { return ApiStatus_DONE2; } else { return ApiStatus_BLOCK; diff --git a/src/world/area_arn/arn_08/arn_08_5_demo.c b/src/world/area_arn/arn_08/arn_08_5_demo.c index 520ab147da7..268f855e0c4 100644 --- a/src/world/area_arn/arn_08/arn_08_5_demo.c +++ b/src/world/area_arn/arn_08/arn_08_5_demo.c @@ -106,11 +106,11 @@ API_CALLABLE(N(func_802400F4_BF4894)) { script->functionTemp[0] = 0; } - if (!(playerStatus->position.y > -10.0f)) { + if (!(playerStatus->pos.y > -10.0f)) { f32 temp_f20 = player_fall_distance(); s32 colliderID; - playerStatus->position.y = player_check_collision_below(temp_f20, &colliderID); + playerStatus->pos.y = player_check_collision_below(temp_f20, &colliderID); script->functionTemp[0] += fabsf(temp_f20); return (script->functionTemp[0] > 50) * ApiStatus_DONE2; @@ -140,11 +140,11 @@ API_CALLABLE(N(SetupDemoScene)) { break; case 3: { partner_clear_player_tracking(wPartnerNpc); - partner_set_goal_pos(playerStatus->position.x, playerStatus->position.z); + partner_set_goal_pos(playerStatus->pos.x, playerStatus->pos.z); func_800EF3D4(0); set_npc_yaw(wPartnerNpc, 90.0f); playerStatus->targetYaw = 90.0f; - playerStatus->currentYaw = 90.0f; + playerStatus->curYaw = 90.0f; playerStatus->spriteFacingAngle = 0.0f; return ApiStatus_DONE2; } diff --git a/src/world/area_dgb/dgb_05/dgb_05_3_hole.c b/src/world/area_dgb/dgb_05/dgb_05_3_hole.c index 7345cd29290..406005660df 100644 --- a/src/world/area_dgb/dgb_05/dgb_05_3_hole.c +++ b/src/world/area_dgb/dgb_05/dgb_05_3_hole.c @@ -1,14 +1,14 @@ #include "dgb_05.h" API_CALLABLE(N(AwaitFallInHole)) { - if (gPlayerStatus.position.y >= -210.0f) { + if (gPlayerStatus.pos.y >= -210.0f) { return ApiStatus_BLOCK; } return ApiStatus_DONE2; } API_CALLABLE(N(AwaitFallDownHole)) { - if (gPlayerStatus.position.y > -270.0f) { + if (gPlayerStatus.pos.y > -270.0f) { return ApiStatus_BLOCK; } return ApiStatus_DONE2; diff --git a/src/world/area_dgb/dgb_10/dgb_10_3_hole.c b/src/world/area_dgb/dgb_10/dgb_10_3_hole.c index 4f1d04ae070..ae7ad919e4e 100644 --- a/src/world/area_dgb/dgb_10/dgb_10_3_hole.c +++ b/src/world/area_dgb/dgb_10/dgb_10_3_hole.c @@ -7,13 +7,13 @@ API_CALLABLE(N(AwaitFallInHole)) { PlayerStatus* playerStatus = &gPlayerStatus; s32 entry; - if (playerStatus->position.y >= 0.0f) { + if (playerStatus->pos.y >= 0.0f) { return ApiStatus_BLOCK; } - if (playerStatus->position.x < 440.0f) { + if (playerStatus->pos.x < 440.0f) { entry = dgb_11_ENTRY_3; - } else if (playerStatus->position.z < -170.0f) { + } else if (playerStatus->pos.z < -170.0f) { entry = dgb_11_ENTRY_2; } else { entry = dgb_11_ENTRY_1; @@ -24,7 +24,7 @@ API_CALLABLE(N(AwaitFallInHole)) { } API_CALLABLE(N(AwaitFallDownHole)) { - if (gPlayerStatus.position.y > -60.0f) { + if (gPlayerStatus.pos.y > -60.0f) { return ApiStatus_BLOCK; } return ApiStatus_DONE2; diff --git a/src/world/area_dgb/dgb_18/dgb_18_3_npc.c b/src/world/area_dgb/dgb_18/dgb_18_3_npc.c index e9ec422b21c..4bb0acbb3e9 100644 --- a/src/world/area_dgb/dgb_18/dgb_18_3_npc.c +++ b/src/world/area_dgb/dgb_18/dgb_18_3_npc.c @@ -19,14 +19,14 @@ API_CALLABLE(N(UnusedChasePlayer)) { posX = npc->pos.x; posZ = npc->pos.z; npc->moveSpeed = 3.7f; - npc->yaw = atan2(posX, posZ, playerStatus->position.x, playerStatus->position.z); + npc->yaw = atan2(posX, posZ, playerStatus->pos.x, playerStatus->pos.z); script->functionTemp[1] = 0; npc->duration = 15; } if (script->functionTemp[1] == 0) { if (npc->duration == 0) { - npc->yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z); + npc->yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->pos.x, playerStatus->pos.z); npc->duration = 15; } npc->duration--; diff --git a/src/world/area_dro/dro_01/npc_hint_dryite.c b/src/world/area_dro/dro_01/npc_hint_dryite.c index 75976b10783..825ea03d900 100644 --- a/src/world/area_dro/dro_01/npc_hint_dryite.c +++ b/src/world/area_dro/dro_01/npc_hint_dryite.c @@ -13,7 +13,7 @@ API_CALLABLE(N(GetFloorCollider)) { Bytecode* args = script->ptrReadPos; s32 outVar = *args++; - evt_set_variable(script, outVar, gCollisionStatus.currentFloor); + evt_set_variable(script, outVar, gCollisionStatus.curFloor); return ApiStatus_DONE2; } @@ -75,7 +75,7 @@ void N(red_tree_orbit_listener)(PlayerOrbitState* orbit, s32 event) { if (orbit->numRotations >= 6) { // wait to be near NPC with at least 6 full rotations complete f32 angle1 = atan2(125.0f, -42.0f, 152.0f, -61.0f); - f32 angle2 = atan2(125.0f, -42.0f, playerStatus->position.x, playerStatus->position.z); + f32 angle2 = atan2(125.0f, -42.0f, playerStatus->pos.x, playerStatus->pos.z); f32 deltaAngle = get_clamped_angle_diff(angle1, angle2); if (fabsf(deltaAngle) < 30.0f) { start_script(&N(EVS_Scene_TreeOrbitReaction), EVT_PRIORITY_1, 0); diff --git a/src/world/area_dro/dro_01/npc_hint_dryite_companion.c b/src/world/area_dro/dro_01/npc_hint_dryite_companion.c index e754272e275..d8310cecb83 100644 --- a/src/world/area_dro/dro_01/npc_hint_dryite_companion.c +++ b/src/world/area_dro/dro_01/npc_hint_dryite_companion.c @@ -7,7 +7,7 @@ API_CALLABLE(N(GetRunToPos)) { f32 npcAngle; f32 angle; - angle = atan2(183.0f, -75.0f, playerStatus->position.x, playerStatus->position.z); + angle = atan2(183.0f, -75.0f, playerStatus->pos.x, playerStatus->pos.z); npcAngle = atan2(183.0f, -75.0f, npc->pos.x, npc->pos.z); angle = get_clamped_angle_diff(npcAngle, angle); rand = rand_int(10) + 30; diff --git a/src/world/area_dro/dro_01/npc_shop_owner.c b/src/world/area_dro/dro_01/npc_shop_owner.c index c71eaa8da99..d162c6e9738 100644 --- a/src/world/area_dro/dro_01/npc_shop_owner.c +++ b/src/world/area_dro/dro_01/npc_shop_owner.c @@ -9,7 +9,7 @@ API_CALLABLE(N(AwaitPlayerApproachShop)) { f32 var4 = evt_get_variable(script, *args++); f32 temp_f0 = (var4 - var2) / (var3 - var1); - if (playerStatus->position.z < ((temp_f0 * playerStatus->position.x) + (var2 - (temp_f0 * var1)))) { + if (playerStatus->pos.z < ((temp_f0 * playerStatus->pos.x) + (var2 - (temp_f0 * var1)))) { script->varTable[0] = 0; return ApiStatus_DONE2; } diff --git a/src/world/area_dro/dro_02/npc_merlee.c b/src/world/area_dro/dro_02/npc_merlee.c index 95400cfd695..3a627a0e0f6 100644 --- a/src/world/area_dro/dro_02/npc_merlee.c +++ b/src/world/area_dro/dro_02/npc_merlee.c @@ -291,7 +291,7 @@ void N(GetCardOrientation)(s32 index, f32* outX, f32* outY, f32* outZ, f32* outA Matrix4f mtxTemp; Matrix4f mtxParent; - guPositionF(mtxParent, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, SPRITE_WORLD_SCALE_F, + guPositionF(mtxParent, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, SPRITE_WORLD_SCALE_F, evt_get_variable(N(CreatorScript), RITUAL_VAR_POS_X), evt_get_variable(N(CreatorScript), RITUAL_VAR_POS_Y), evt_get_variable(N(CreatorScript), RITUAL_VAR_POS_Z)); @@ -361,7 +361,7 @@ void N(card_worker_update)(void) { N(RitualCards)[1].pos.x += -10.0f; N(RitualCards)[2].pos.y += -10.0f; if (N(RitualStateTime) == 18) { - gPlayerStatus.position.y = NPC_DISPOSE_POS_Y; + gPlayerStatus.pos.y = NPC_DISPOSE_POS_Y; } if (N(RitualStateTime) == 20) { evt_set_variable(N(CreatorScript), RITUAL_VAR_STATE, RITUAL_STATE_2); @@ -567,7 +567,7 @@ void N(card_worker_render)(void) { Matrix4f mtx; u32 temp_s1; - guPositionF(mtx, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, SPRITE_WORLD_SCALE_F, + guPositionF(mtx, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, SPRITE_WORLD_SCALE_F, evt_get_variable(N(CreatorScript), RITUAL_VAR_POS_X), evt_get_variable(N(CreatorScript), RITUAL_VAR_POS_Y), evt_get_variable(N(CreatorScript), RITUAL_VAR_POS_Z)); diff --git a/src/world/area_end/end_01/end_01_4_opera_float.c b/src/world/area_end/end_01/end_01_4_opera_float.c index 54afad1a657..5be398f5ea6 100644 --- a/src/world/area_end/end_01/end_01_4_opera_float.c +++ b/src/world/area_end/end_01/end_01_4_opera_float.c @@ -38,7 +38,7 @@ API_CALLABLE(N(UpdateStarSpiritRotation)) { script->functionTemp[0] = 0; } npc = script->functionTempPtr[2]; - npc->rotation.y = update_lerp(EASING_QUADRATIC_OUT, 810.0f, 0.0f, script->functionTemp[0], 45); + npc->rot.y = update_lerp(EASING_QUADRATIC_OUT, 810.0f, 0.0f, script->functionTemp[0], 45); npc->alpha = update_lerp(EASING_QUADRATIC_OUT, 0.0f, 255.0f, script->functionTemp[0], 45); script->functionTemp[0]++; diff --git a/src/world/area_flo/common/ItemChoice_FlowerGuard.inc.c b/src/world/area_flo/common/ItemChoice_FlowerGuard.inc.c index 4443fc697e6..af966ff89b8 100644 --- a/src/world/area_flo/common/ItemChoice_FlowerGuard.inc.c +++ b/src/world/area_flo/common/ItemChoice_FlowerGuard.inc.c @@ -8,9 +8,9 @@ API_CALLABLE(N(FlowerGuard_SetItemEntityPosition)) { s32 z = evt_get_variable(script, *args++); ItemEntity* item = get_item_entity(itemIdx); - item->position.x = x; - item->position.y = y; - item->position.z = z; + item->pos.x = x; + item->pos.y = y; + item->pos.z = z; return ApiStatus_DONE2; } diff --git a/src/world/area_flo/flo_00/flo_00_5_beanstalk.c b/src/world/area_flo/flo_00/flo_00_5_beanstalk.c index 806d89e43be..ddb04fa53ff 100644 --- a/src/world/area_flo/flo_00/flo_00_5_beanstalk.c +++ b/src/world/area_flo/flo_00/flo_00_5_beanstalk.c @@ -22,10 +22,10 @@ API_CALLABLE(N(PlayerRideBeanstalk)) { f32 clamped = clamp_angle(angle - temp); temp = sin_deg(clamped); - gPlayerStatus.position.x = BEANSTALK_BASE_X + (dist * temp); - gPlayerStatus.position.y = evt_get_variable(NULL, script->varTable[10]) + evt_get_variable(NULL, script->varTable[3]); + gPlayerStatus.pos.x = BEANSTALK_BASE_X + (dist * temp); + gPlayerStatus.pos.y = evt_get_variable(NULL, script->varTable[10]) + evt_get_variable(NULL, script->varTable[3]); temp = cos_deg(clamped); - gPlayerStatus.position.z = BEANSTALK_BASE_Z - (dist * temp); + gPlayerStatus.pos.z = BEANSTALK_BASE_Z - (dist * temp); return ApiStatus_DONE2; } diff --git a/src/world/area_flo/flo_03/flo_03_3_npc.c b/src/world/area_flo/flo_03/flo_03_3_npc.c index 1fda7c2f2b6..f8660ceb38b 100644 --- a/src/world/area_flo/flo_03/flo_03_3_npc.c +++ b/src/world/area_flo/flo_03/flo_03_3_npc.c @@ -70,7 +70,7 @@ API_CALLABLE(N(HideBehindTree)) { f64 dist; // get a point 46 units away from the tree on the side opposite the player - yaw = clamp_angle(atan2(-210.0f, -183.0f, gPlayerStatus.position.x, gPlayerStatus.position.z) + 180.0f); + yaw = clamp_angle(atan2(-210.0f, -183.0f, gPlayerStatus.pos.x, gPlayerStatus.pos.z) + 180.0f); posX = -210.0f; posZ = -183.0f; add_vec2D_polar(&posX, &posZ, 46.0f, yaw); @@ -100,18 +100,18 @@ API_CALLABLE(N(HideBehindTree)) { add_vec2D_polar(&posX, &posZ, 46.0f, yaw); } } - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_RUN]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_RUN]; npc->yaw = atan2(npc->pos.x, npc->pos.z, posX, posZ); npc_move_heading(npc, 2.0f, npc->yaw); } else if (dist > 0.2) { npc->yaw = atan2(npc->pos.x, npc->pos.z, posX, posZ); npc->pos.x = posX; npc->pos.z = posZ; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_WALK]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_WALK]; } else { npc->pos.x = posX; npc->pos.z = posZ; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; } return ApiStatus_BLOCK; } diff --git a/src/world/area_flo/flo_14/flo_14_3_bubbles.c b/src/world/area_flo/flo_14/flo_14_3_bubbles.c index 1ed17d6693a..0da973723bc 100644 --- a/src/world/area_flo/flo_14/flo_14_3_bubbles.c +++ b/src/world/area_flo/flo_14/flo_14_3_bubbles.c @@ -42,7 +42,7 @@ EvtScript N(EVS_TetherParterToPlayer) = { }; API_CALLABLE(N(SavePartnerFlags)) { - if (gPlayerData.currentPartner == PARTNER_NONE) { + if (gPlayerData.curPartner == PARTNER_NONE) { script->varTable[14] = FALSE; return ApiStatus_DONE2; } diff --git a/src/world/area_flo/flo_19/flo_19_5_beanstalk.c b/src/world/area_flo/flo_19/flo_19_5_beanstalk.c index 33153b221f4..836041ae20c 100644 --- a/src/world/area_flo/flo_19/flo_19_5_beanstalk.c +++ b/src/world/area_flo/flo_19/flo_19_5_beanstalk.c @@ -20,10 +20,10 @@ API_CALLABLE(N(PlayerRideBeanstalk)) { f32 clamped = clamp_angle(angle - temp); temp = sin_deg(clamped); - gPlayerStatus.position.x = (dist * temp) + 0.0f; - gPlayerStatus.position.y = evt_get_variable(NULL, script->varTable[10]) + evt_get_variable(NULL, script->varTable[3]); + gPlayerStatus.pos.x = (dist * temp) + 0.0f; + gPlayerStatus.pos.y = evt_get_variable(NULL, script->varTable[10]) + evt_get_variable(NULL, script->varTable[3]); temp = cos_deg(clamped); - gPlayerStatus.position.z = 0.0f - (dist * temp); + gPlayerStatus.pos.z = 0.0f - (dist * temp); return ApiStatus_DONE2; } diff --git a/src/world/area_hos/common/FallingStars.inc.c b/src/world/area_hos/common/FallingStars.inc.c index fb16f3fdafb..e3da7d51fb1 100644 --- a/src/world/area_hos/common/FallingStars.inc.c +++ b/src/world/area_hos/common/FallingStars.inc.c @@ -18,7 +18,7 @@ ApiStatus N(UnkEffect0FFunc2)(Evt* script, s32 isInitialCall) { ApiStatus N(UnkEffect0FFunc)(Evt* script, s32 isInitialCall) { PlayerStatus* playerStatus = &gPlayerStatus; - f32 yaw = gCameras[CAM_DEFAULT].currentYaw / 180.0f * PI; + f32 yaw = gCameras[CAM_DEFAULT].curYaw / 180.0f * PI; f32 yawPlus = yaw + (PI_D / 2); f32 yawMinus = yaw - (PI_D / 2); f32 temp_f30; @@ -32,15 +32,15 @@ ApiStatus N(UnkEffect0FFunc)(Evt* script, s32 isInitialCall) { f32 var5; f32 var6; - temp_f30 = playerStatus->position.x + (rand3 * sin_rad(yaw)); + temp_f30 = playerStatus->pos.x + (rand3 * sin_rad(yaw)); var1 = temp_f30 + (rand1 * sin_rad(yawPlus)); - var2 = playerStatus->position.y + 200.0f; - var3 = playerStatus->position.z - (rand3 * cos_rad(yaw)); + var2 = playerStatus->pos.y + 200.0f; + var3 = playerStatus->pos.z - (rand3 * cos_rad(yaw)); var3 = var3 - (rand1 * cos_rad(yawPlus)); - var4 = playerStatus->position.x + (rand3 * sin_rad(yaw)); + var4 = playerStatus->pos.x + (rand3 * sin_rad(yaw)); var4 = var4 + (rand2 * sin_rad(yawMinus)); - var5 = playerStatus->position.y; - var6 = playerStatus->position.z - (rand3 * cos_rad(yaw)); + var5 = playerStatus->pos.y; + var6 = playerStatus->pos.z - (rand3 * cos_rad(yaw)); var6 = var6 - (rand2 * cos_rad(yawMinus)); fx_star(0, var1, var2, var3, var4, var5, var6, rand_int(10) + 10); return ApiStatus_DONE2; @@ -49,7 +49,7 @@ ApiStatus N(UnkEffect0FFunc)(Evt* script, s32 isInitialCall) { ApiStatus N(UnkEffect0FFunc3)(Evt* script, s32 isInitialCall) { PlayerStatus* playerStatus = &gPlayerStatus; - f32 yaw = gCameras[CAM_DEFAULT].currentYaw / 180.0f * PI; + f32 yaw = gCameras[CAM_DEFAULT].curYaw / 180.0f * PI; f32 yawPlus = yaw + (PI_D / 2); f32 yawMinus = yaw - (PI_D / 2); f32 temp_f30; @@ -63,19 +63,19 @@ ApiStatus N(UnkEffect0FFunc3)(Evt* script, s32 isInitialCall) { f32 var5; f32 var6; - if ((playerStatus->position.y >= 250.0f)) { + if ((playerStatus->pos.y >= 250.0f)) { return ApiStatus_DONE2; } - temp_f30 = playerStatus->position.x - (rand3 * sin_rad(yaw)); + temp_f30 = playerStatus->pos.x - (rand3 * sin_rad(yaw)); var1 = temp_f30 + (rand1 * sin_rad(yawPlus)); - var2 = playerStatus->position.y + 200.0f; - var3 = playerStatus->position.z + (rand3 * cos_rad(yaw)); + var2 = playerStatus->pos.y + 200.0f; + var3 = playerStatus->pos.z + (rand3 * cos_rad(yaw)); var3 = var3 - (rand1 * cos_rad(yawPlus)); - var4 = playerStatus->position.x - (rand3 * sin_rad(yaw)); + var4 = playerStatus->pos.x - (rand3 * sin_rad(yaw)); var4 = var4 + (rand2 * sin_rad(yawMinus)); - var5 = playerStatus->position.y; - var6 = playerStatus->position.z + (rand3 * cos_rad(yaw)); + var5 = playerStatus->pos.y; + var6 = playerStatus->pos.z + (rand3 * cos_rad(yaw)); var6 = var6 - (rand2 * cos_rad(yawMinus)); fx_star(1, var1, var2, var3, var4, var5, var6, rand_int(10) + 10); return ApiStatus_DONE2; @@ -83,7 +83,7 @@ ApiStatus N(UnkEffect0FFunc3)(Evt* script, s32 isInitialCall) { ApiStatus N(UnkEffect0FFunc4)(Evt* script, s32 isInitialCall) { PlayerStatus* playerStatus = &gPlayerStatus; - f32 yaw = gCameras[CAM_DEFAULT].currentYaw / 180.0f * PI; + f32 yaw = gCameras[CAM_DEFAULT].curYaw / 180.0f * PI; f32 yawPlus = yaw + (PI_D / 2); f32 yawMinus = yaw - (PI_D / 2); f32 temp_f30; @@ -97,22 +97,22 @@ ApiStatus N(UnkEffect0FFunc4)(Evt* script, s32 isInitialCall) { f32 var5; f32 var6; - if ((playerStatus->position.z < 200.0f)) { + if ((playerStatus->pos.z < 200.0f)) { return ApiStatus_DONE2; } - temp_f30 = playerStatus->position.x - (rand3 * sin_rad(yaw)); + temp_f30 = playerStatus->pos.x - (rand3 * sin_rad(yaw)); var1 = temp_f30 + (rand1 * sin_rad(yawPlus)); - var2 = playerStatus->position.y + 200.0f; - var3 = playerStatus->position.z + (rand3 * cos_rad(yaw)); + var2 = playerStatus->pos.y + 200.0f; + var3 = playerStatus->pos.z + (rand3 * cos_rad(yaw)); var3 = var3 - (rand1 * cos_rad(yawPlus)); script->varTable[1] = var1; script->varTable[2] = var2; script->varTable[3] = var3; - var4 = playerStatus->position.x - (rand3 * sin_rad(yaw)); + var4 = playerStatus->pos.x - (rand3 * sin_rad(yaw)); var4 = var4 + (rand2 * sin_rad(yawMinus)); - var5 = playerStatus->position.y; - var6 = playerStatus->position.z + (rand3 * cos_rad(yaw)); + var5 = playerStatus->pos.y; + var6 = playerStatus->pos.z + (rand3 * cos_rad(yaw)); var6 = var6 - (rand2 * cos_rad(yawMinus)); fx_star(2, var1, var2, var3, var4, var5, var6, rand_int(4) + 10); return ApiStatus_DONE2; diff --git a/src/world/area_hos/hos_00/hos_00_4_npc.c b/src/world/area_hos/hos_00/hos_00_4_npc.c index 016b344912e..38654fbc4b5 100644 --- a/src/world/area_hos/hos_00/hos_00_4_npc.c +++ b/src/world/area_hos/hos_00/hos_00_4_npc.c @@ -82,7 +82,7 @@ EvtScript N(EVS_NpcInit_FlyingMagikoopa) = { }; API_CALLABLE(N(SetCurrentPartner)) { - gPlayerData.currentPartner = evt_get_variable(script, *script->ptrReadPos); + gPlayerData.curPartner = evt_get_variable(script, *script->ptrReadPos); return ApiStatus_DONE2; } diff --git a/src/world/area_hos/hos_00/hos_00_6_scenes.c b/src/world/area_hos/hos_00/hos_00_6_scenes.c index c326ae443b4..a63625c3862 100644 --- a/src/world/area_hos/hos_00/hos_00_6_scenes.c +++ b/src/world/area_hos/hos_00/hos_00_6_scenes.c @@ -78,7 +78,7 @@ API_CALLABLE(N(HavePartyFaceTwink)) { Npc* npc = get_npc_unsafe(NPC_Twink); partner->yaw = atan2(partner->pos.x, partner->pos.z, npc->pos.x, npc->pos.z); - gPlayerStatus.targetYaw = atan2(gPlayerStatus.position.x, gPlayerStatus.position.z, npc->pos.x, npc->pos.z); + gPlayerStatus.targetYaw = atan2(gPlayerStatus.pos.x, gPlayerStatus.pos.z, npc->pos.x, npc->pos.z); npc->yaw = atan2(N(LastTwinkPosX), N(LastTwinkPosZ), npc->pos.x, npc->pos.z); N(LastTwinkPosX) = npc->pos.x; N(LastTwinkPosZ) = npc->pos.z; diff --git a/src/world/area_hos/hos_00/hos_00_7_shade_gfx.c b/src/world/area_hos/hos_00/hos_00_7_shade_gfx.c index bbbab55cd13..246f6846515 100644 --- a/src/world/area_hos/hos_00/hos_00_7_shade_gfx.c +++ b/src/world/area_hos/hos_00/hos_00_7_shade_gfx.c @@ -1,7 +1,7 @@ #include "hos_00.h" void N(setup_gfx_background_shade)(void) { - s32 alpha = update_lerp(EASING_LINEAR, 0.0f, 216.0f, gPlayerStatus.position.x - 200.0f, 500); + s32 alpha = update_lerp(EASING_LINEAR, 0.0f, 216.0f, gPlayerStatus.pos.x - 200.0f, 500); if (alpha < 0) { alpha = 0; diff --git a/src/world/area_hos/hos_05/hos_05_5_intro.c b/src/world/area_hos/hos_05/hos_05_5_intro.c index dcb67530719..edbe311217b 100644 --- a/src/world/area_hos/hos_05/hos_05_5_intro.c +++ b/src/world/area_hos/hos_05/hos_05_5_intro.c @@ -1818,7 +1818,7 @@ s32 N(D_8024ACBC_A34EFC) = 0x00010019; API_CALLABLE(N(ForceStarRodAlwaysFaceCamera)) { Npc* npc = resolve_npc(script, NPC_StarRod); - npc->yaw = npc->renderYaw = 180.0f - gCameras[gCurrentCameraID].currentYaw; + npc->yaw = npc->renderYaw = 180.0f - gCameras[gCurrentCameraID].curYaw; return ApiStatus_BLOCK; } diff --git a/src/world/area_hos/hos_05/hos_05_8_star_ship.c b/src/world/area_hos/hos_05/hos_05_8_star_ship.c index de48a0344eb..584a15f2702 100644 --- a/src/world/area_hos/hos_05/hos_05_8_star_ship.c +++ b/src/world/area_hos/hos_05/hos_05_8_star_ship.c @@ -9,8 +9,8 @@ API_CALLABLE(N(SwingCameraPitchUpward)) { script->functionTemp[0] = 40; } script->functionTemp[0]--; - if (camera->currentController != NULL) { - camera->currentController->viewPitch -= 1.0 - ((f32) (40 - script->functionTemp[0]) * 0.01); + if (camera->curController != NULL) { + camera->curController->viewPitch -= 1.0 - ((f32) (40 - script->functionTemp[0]) * 0.01); } else if (camera->prevController != NULL) { camera->prevController->viewPitch -= 1.0 - ((f32) (40 - script->functionTemp[0]) * 0.01); } diff --git a/src/world/area_hos/hos_06/hos_06_5_merluvlee.c b/src/world/area_hos/hos_06/hos_06_5_merluvlee.c index 0a27c280193..a2bfa2b5d34 100644 --- a/src/world/area_hos/hos_06/hos_06_5_merluvlee.c +++ b/src/world/area_hos/hos_06/hos_06_5_merluvlee.c @@ -528,7 +528,7 @@ API_CALLABLE(N(func_80241CCC_A3B1AC)) { temp_f24 = script->functionTemp[0] * 10; for (i = 0; i < ARRAY_COUNT(effects); i++) { - guRotateF(sp28, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp28, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guRotateF(sp68, i * 120, 0.0f, 0.0f, 1.0f); guMtxCatF(sp68, sp28, sp28); tx = temp_f30 * sin_deg(temp_f24); diff --git a/src/world/area_hos/hos_10/hos_10_7_ending.c b/src/world/area_hos/hos_10/hos_10_7_ending.c index 4f0d08a7645..cd54e79477f 100644 --- a/src/world/area_hos/hos_10/hos_10_7_ending.c +++ b/src/world/area_hos/hos_10/hos_10_7_ending.c @@ -17,9 +17,9 @@ API_CALLABLE(N(NpcOrbitPlayerPos)) { npc = get_npc_unsafe(script->functionTemp[1]); switch (script->functionTemp[0]) { case 0: - npc->pos.x = playerStatus->position.x; - npc->pos.y = playerStatus->position.y; - npc->pos.z = playerStatus->position.z; + npc->pos.x = playerStatus->pos.x; + npc->pos.y = playerStatus->pos.y; + npc->pos.z = playerStatus->pos.z; npc->moveToPos.x = script->functionTemp[3] * 3; npc->moveToPos.y = 3.0f; add_vec2D_polar(&npc->pos.x, &npc->pos.z, 70.0f, npc->moveToPos.x + (script->functionTemp[2] * 51) + 153.0f); @@ -32,9 +32,9 @@ API_CALLABLE(N(NpcOrbitPlayerPos)) { } break; case 1: - npc->pos.x = playerStatus->position.x; - npc->pos.y = playerStatus->position.y; - npc->pos.z = playerStatus->position.z; + npc->pos.x = playerStatus->pos.x; + npc->pos.y = playerStatus->pos.y; + npc->pos.z = playerStatus->pos.z; npc->moveToPos.x = script->functionTemp[3] * 3; npc->moveToPos.y = 3.0f; add_vec2D_polar( @@ -88,7 +88,7 @@ API_CALLABLE(N(SetHaloAlpha)) { } API_CALLABLE(N(ClearCurrentPartner)) { - gPlayerData.currentPartner = PARTNER_NONE; + gPlayerData.curPartner = PARTNER_NONE; return ApiStatus_DONE2; } diff --git a/src/world/area_isk/isk_02/isk_02_3_ambush.c b/src/world/area_isk/isk_02/isk_02_3_ambush.c index b61705d8de7..0db6580b69a 100644 --- a/src/world/area_isk/isk_02/isk_02_3_ambush.c +++ b/src/world/area_isk/isk_02/isk_02_3_ambush.c @@ -9,7 +9,7 @@ API_CALLABLE(N(AwaitPlayerMummyAmbush)) { f32 x = evt_get_variable(script, *args++); f32 y = evt_get_variable(script, *args++); - if (dist2D(x, y, gPlayerStatus.position.x, gPlayerStatus.position.z) > 250.0f) { + if (dist2D(x, y, gPlayerStatus.pos.x, gPlayerStatus.pos.z) > 250.0f) { script->varTable[0] = FALSE; } else { script->varTable[0] = TRUE; diff --git a/src/world/area_isk/isk_04/isk_04_6_demo.c b/src/world/area_isk/isk_04/isk_04_6_demo.c index ea67a01b287..52bf404bc74 100644 --- a/src/world/area_isk/isk_04/isk_04_6_demo.c +++ b/src/world/area_isk/isk_04/isk_04_6_demo.c @@ -122,14 +122,14 @@ API_CALLABLE(N(SetupDemoScene)) { N(DemoInitState)++; return ApiStatus_BLOCK; case 3: - wPartnerNpc->pos.x = playerStatus->position.x - 30.0f; - wPartnerNpc->pos.z = playerStatus->position.z + 30.0f; + wPartnerNpc->pos.x = playerStatus->pos.x - 30.0f; + wPartnerNpc->pos.z = playerStatus->pos.z + 30.0f; partner_clear_player_tracking(wPartnerNpc); - partner_set_goal_pos(playerStatus->position.x, playerStatus->position.z); + partner_set_goal_pos(playerStatus->pos.x, playerStatus->pos.z); func_800EF3D4(0); set_npc_yaw(wPartnerNpc, 90.0f); playerStatus->targetYaw = 90.0f; - playerStatus->currentYaw = 90.0f; + playerStatus->curYaw = 90.0f; playerStatus->spriteFacingAngle = 0.0f; return ApiStatus_DONE2; } diff --git a/src/world/area_isk/isk_05/isk_05_3_npc.c b/src/world/area_isk/isk_05/isk_05_3_npc.c index 7d3d8df3b6d..568816c3128 100644 --- a/src/world/area_isk/isk_05/isk_05_3_npc.c +++ b/src/world/area_isk/isk_05/isk_05_3_npc.c @@ -50,7 +50,7 @@ void N(func_80241610_97F0E0)(void) { gDPSetAlphaCompare(gMainGfxPos++, G_AC_NONE); guTranslateF(transformMtx, ambush->pos.x, ambush->pos.y, ambush->pos.z); - guRotateF(tempMtx, ambush->rot.y + gCameras[gCurrentCameraID].currentYaw + ambush->renderYaw, 0.0f, 1.0f, 0.0f); + guRotateF(tempMtx, ambush->rot.y + gCameras[gCurrentCameraID].curYaw + ambush->renderYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(tempMtx, transformMtx, transformMtx); guRotateF(tempMtx, ambush->rot.z, 0.0f, 0.0f, 1.0f); guMtxCatF(tempMtx, transformMtx, transformMtx); diff --git a/src/world/area_isk/isk_07/isk_07_6_switch.c b/src/world/area_isk/isk_07/isk_07_6_switch.c index fcf3eb9296f..dc0949ad5c3 100644 --- a/src/world/area_isk/isk_07/isk_07_6_switch.c +++ b/src/world/area_isk/isk_07/isk_07_6_switch.c @@ -3,7 +3,7 @@ extern EvtScript N(EVS_OnTouch_StairSwitch); API_CALLABLE(N(WaitForPlayerTouchingGround)) { - if (gCollisionStatus.currentFloor == COLLIDER_o2022) { + if (gCollisionStatus.curFloor == COLLIDER_o2022) { return ApiStatus_BLOCK; } else { return ApiStatus_DONE2; diff --git a/src/world/area_isk/isk_09/isk_09_5_switch.c b/src/world/area_isk/isk_09/isk_09_5_switch.c index 6a6698c38e0..39c59432a48 100644 --- a/src/world/area_isk/isk_09/isk_09_5_switch.c +++ b/src/world/area_isk/isk_09/isk_09_5_switch.c @@ -8,7 +8,7 @@ extern EvtScript N(EVS_OnTouch_RedSwitch); API_CALLABLE(N(WaitForPlayerTouchingGround)) { Bytecode* args = script->ptrReadPos; s32 colliderID = evt_get_variable(script, *args++); - if (gCollisionStatus.currentFloor != colliderID) { + if (gCollisionStatus.curFloor != colliderID) { return ApiStatus_DONE2; } else { return ApiStatus_BLOCK; diff --git a/src/world/area_isk/isk_10/isk_10_2_entity.c b/src/world/area_isk/isk_10/isk_10_2_entity.c index a62199b734f..2383a7b1398 100644 --- a/src/world/area_isk/isk_10/isk_10_2_entity.c +++ b/src/world/area_isk/isk_10/isk_10_2_entity.c @@ -8,10 +8,10 @@ API_CALLABLE(N(MonitorPlayerLastFloor)) { s32 level = -1; - if (gPlayerStatus.lastGoodPosition.y > -600.0) { + if (gPlayerStatus.lastGoodPos.y > -600.0) { level = 0; } - if (gPlayerStatus.lastGoodPosition.y < -770.0) { + if (gPlayerStatus.lastGoodPos.y < -770.0) { level = 1; } if (level >= 0) { diff --git a/src/world/area_isk/isk_13/isk_13_3_npc.c b/src/world/area_isk/isk_13/isk_13_3_npc.c index 052d4d41017..cc3bad8b3d3 100644 --- a/src/world/area_isk/isk_13/isk_13_3_npc.c +++ b/src/world/area_isk/isk_13/isk_13_3_npc.c @@ -50,7 +50,7 @@ void N(func_80241610_990DF0)(void) { gDPSetAlphaCompare(gMainGfxPos++, G_AC_NONE); guTranslateF(transformMtx, ambush->pos.x, ambush->pos.y, ambush->pos.z); - guRotateF(tempMtx, ambush->rot.y + gCameras[gCurrentCameraID].currentYaw + ambush->renderYaw, 0.0f, 1.0f, 0.0f); + guRotateF(tempMtx, ambush->rot.y + gCameras[gCurrentCameraID].curYaw + ambush->renderYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(tempMtx, transformMtx, transformMtx); guRotateF(tempMtx, ambush->rot.z, 0.0f, 0.0f, 1.0f); guMtxCatF(tempMtx, transformMtx, transformMtx); diff --git a/src/world/area_isk/isk_14/isk_14_3_npc.c b/src/world/area_isk/isk_14/isk_14_3_npc.c index 45aec9c2e6c..1d3c2817da3 100644 --- a/src/world/area_isk/isk_14/isk_14_3_npc.c +++ b/src/world/area_isk/isk_14/isk_14_3_npc.c @@ -50,7 +50,7 @@ void N(func_80241610_993D40)(void) { gDPSetAlphaCompare(gMainGfxPos++, G_AC_NONE); guTranslateF(transformMtx, ambush->pos.x, ambush->pos.y, ambush->pos.z); - guRotateF(tempMtx, ambush->rot.y + gCameras[gCurrentCameraID].currentYaw + ambush->renderYaw, 0.0f, 1.0f, 0.0f); + guRotateF(tempMtx, ambush->rot.y + gCameras[gCurrentCameraID].curYaw + ambush->renderYaw, 0.0f, 1.0f, 0.0f); guMtxCatF(tempMtx, transformMtx, transformMtx); guRotateF(tempMtx, ambush->rot.z, 0.0f, 0.0f, 1.0f); guMtxCatF(tempMtx, transformMtx, transformMtx); diff --git a/src/world/area_iwa/iwa_00/iwa_00_4_slide.c b/src/world/area_iwa/iwa_00/iwa_00_4_slide.c index c7486e9043a..b3d91fe8fda 100644 --- a/src/world/area_iwa/iwa_00/iwa_00_4_slide.c +++ b/src/world/area_iwa/iwa_00/iwa_00_4_slide.c @@ -3,8 +3,8 @@ SlideParams N(SlideData) = { .heading = 270.0f, .maxDescendAccel = 0.4f, - .launchVelocity = -0.05f, - .maxDescendVelocity = 20.0f, + .launchVel = -0.05f, + .maxDescendVel = 20.0f, .integrator = { 0.0, 0.0, 0.0, 0.0 }, }; diff --git a/src/world/area_iwa/iwa_01/iwa_01_5_slide.c b/src/world/area_iwa/iwa_01/iwa_01_5_slide.c index eb031727e74..e1e78358b26 100644 --- a/src/world/area_iwa/iwa_01/iwa_01_5_slide.c +++ b/src/world/area_iwa/iwa_01/iwa_01_5_slide.c @@ -9,16 +9,16 @@ API_CALLABLE(N(SetPlayerSliding)) { SlideParams N(SlideData1) = { .heading = 90.0f, .maxDescendAccel = 0.5f, - .launchVelocity = -0.5f, - .maxDescendVelocity = 16.0f, + .launchVel = -0.5f, + .maxDescendVel = 16.0f, .integrator = { 0.0, 0.0, 0.0, 0.0 }, }; SlideParams N(SlideData2) = { .heading = 270.0f, .maxDescendAccel = 0.5f, - .launchVelocity = -0.18f, - .maxDescendVelocity = 18.0f, + .launchVel = -0.18f, + .maxDescendVel = 18.0f, .integrator = { 10.9716, -0.34, 0.003, -0.012 }, }; diff --git a/src/world/area_iwa/iwa_03/iwa_03_2_entity.c b/src/world/area_iwa/iwa_03/iwa_03_2_entity.c index 3d37d573d41..5f567986ad5 100644 --- a/src/world/area_iwa/iwa_03/iwa_03_2_entity.c +++ b/src/world/area_iwa/iwa_03/iwa_03_2_entity.c @@ -8,10 +8,10 @@ MAP_RODATA_PAD(1,entity); API_CALLABLE(N(MonitorPlayerAltitude)) { s32 result = -1; - if (gPlayerStatus.lastGoodPosition.y > 200.0) { + if (gPlayerStatus.lastGoodPos.y > 200.0) { result = 0; } - if (gPlayerStatus.lastGoodPosition.y < 40.0) { + if (gPlayerStatus.lastGoodPos.y < 40.0) { result = 1; } if (result >= 0) { diff --git a/src/world/area_iwa/iwa_03/iwa_03_4_slide.c b/src/world/area_iwa/iwa_03/iwa_03_4_slide.c index 0a3d6a42cc7..43d9e822422 100644 --- a/src/world/area_iwa/iwa_03/iwa_03_4_slide.c +++ b/src/world/area_iwa/iwa_03/iwa_03_4_slide.c @@ -3,8 +3,8 @@ SlideParams N(SlideData) = { .heading = 89.0f, .maxDescendAccel = 0.41f, - .launchVelocity = -0.25f, - .maxDescendVelocity = 16.0f, + .launchVel = -0.25f, + .maxDescendVel = 16.0f, .integrator = { 9.612, -0.452, 0.003, -0.023 }, }; diff --git a/src/world/area_iwa/iwa_04/iwa_04_3_entity.c b/src/world/area_iwa/iwa_04/iwa_04_3_entity.c index b7870d07a1d..a7eb660e7a9 100644 --- a/src/world/area_iwa/iwa_04/iwa_04_3_entity.c +++ b/src/world/area_iwa/iwa_04/iwa_04_3_entity.c @@ -4,10 +4,10 @@ API_CALLABLE(N(MonitorPlayerAltitude)) { s32 status = -1; - if (gPlayerStatus.lastGoodPosition.y > -100.0) { + if (gPlayerStatus.lastGoodPos.y > -100.0) { status = 0; } - if (gPlayerStatus.lastGoodPosition.y < -240.0) { + if (gPlayerStatus.lastGoodPos.y < -240.0) { status = 1; } if (status >= 0) { diff --git a/src/world/area_jan/jan_00/jan_00_2_npc.c b/src/world/area_jan/jan_00/jan_00_2_npc.c index e6ed85bc119..4d32755c861 100644 --- a/src/world/area_jan/jan_00/jan_00_2_npc.c +++ b/src/world/area_jan/jan_00/jan_00_2_npc.c @@ -115,9 +115,9 @@ API_CALLABLE(N(func_80240CF8_B21238)) { switch (script->functionTemp[0]) { case 0: - gPlayerStatus.position.x = x; - gPlayerStatus.position.y = y; - gPlayerStatus.position.z = z; + gPlayerStatus.pos.x = x; + gPlayerStatus.pos.y = y; + gPlayerStatus.pos.z = z; npc0->colliderPos.x = npc0->pos.x; npc0->colliderPos.y = npc0->pos.y; npc0->colliderPos.z = npc0->pos.z; @@ -176,7 +176,7 @@ API_CALLABLE(N(func_80240F14_B21454)) { switch (script->functionTemp[2]) { case 0: - npc->currentAnim = 0xB60001; + npc->curAnim = 0xB60001; npc->yaw -= 1.0f; npc->pos.x -= 3.0f; script->functionTemp[1]--; diff --git a/src/world/area_jan/jan_02/jan_02_2_main.c b/src/world/area_jan/jan_02/jan_02_2_main.c index 01cdc3c2d98..bbbe16216a2 100644 --- a/src/world/area_jan/jan_02/jan_02_2_main.c +++ b/src/world/area_jan/jan_02/jan_02_2_main.c @@ -11,7 +11,7 @@ API_CALLABLE(N(ClearTrackVols)) { } API_CALLABLE(N(ManageBigPalmTreeVisibility)) { - u16 currentFloor = gCollisionStatus.currentFloor; + u16 currentFloor = gCollisionStatus.curFloor; if (N(PrevPalmTreeVisibility) != 0) { if (currentFloor == COLLIDER_o327 || currentFloor == COLLIDER_o330) { diff --git a/src/world/area_jan/jan_03/jan_03_5_entity.c b/src/world/area_jan/jan_03/jan_03_5_entity.c index 7be0e03e9f9..106e1a9cb9c 100644 --- a/src/world/area_jan/jan_03/jan_03_5_entity.c +++ b/src/world/area_jan/jan_03/jan_03_5_entity.c @@ -11,11 +11,11 @@ EvtScript N(EVS_GotoMap_tik_08_4) = { API_CALLABLE(N(GiveInitialSpringBoost)) { - f32 x = gPlayerStatus.currentSpeed * 5.0f * sin_deg(gPlayerStatus.targetYaw); - f32 z = gPlayerStatus.currentSpeed * 5.0f * -cos_deg(gPlayerStatus.targetYaw); + f32 x = gPlayerStatus.curSpeed * 5.0f * sin_deg(gPlayerStatus.targetYaw); + f32 z = gPlayerStatus.curSpeed * 5.0f * -cos_deg(gPlayerStatus.targetYaw); - script->varTable[0] = gPlayerStatus.position.x + x; - script->varTable[1] = gPlayerStatus.position.z + z; + script->varTable[0] = gPlayerStatus.pos.x + x; + script->varTable[1] = gPlayerStatus.pos.z + z; return ApiStatus_DONE2; } diff --git a/src/world/area_jan/jan_04/jan_04_10_demo.c b/src/world/area_jan/jan_04/jan_04_10_demo.c index 5f427616f33..894ab90e218 100644 --- a/src/world/area_jan/jan_04/jan_04_10_demo.c +++ b/src/world/area_jan/jan_04/jan_04_10_demo.c @@ -111,9 +111,9 @@ API_CALLABLE(N(SetupDemoScene)) { N(DemoInitState)++; newScript = start_script(rideScriptSrc, EVT_PRIORITY_0, EVT_FLAG_RUN_IMMEDIATELY); - newScript->varTable[1] = playerStatus->position.x - 10.0f; - newScript->varTable[2] = playerStatus->position.y; - newScript->varTable[3] = playerStatus->position.z; + newScript->varTable[1] = playerStatus->pos.x - 10.0f; + newScript->varTable[2] = playerStatus->pos.y; + newScript->varTable[3] = playerStatus->pos.z; newScript->varTable[12] = 1; D_8024A290 = newScript; } @@ -125,7 +125,7 @@ API_CALLABLE(N(SetupDemoScene)) { case 3: wPartnerNpc->yaw = 270.0f; playerStatus->targetYaw = 270.0f; - playerStatus->currentYaw = 270.0f; + playerStatus->curYaw = 270.0f; playerStatus->spriteFacingAngle = 180.0f; D_8024A290->functionTemp[1] = 1; return ApiStatus_DONE2; diff --git a/src/world/area_jan/jan_04/jan_04_8_treasure.c b/src/world/area_jan/jan_04/jan_04_8_treasure.c index c976b0c8f05..a4528b456ae 100644 --- a/src/world/area_jan/jan_04/jan_04_8_treasure.c +++ b/src/world/area_jan/jan_04/jan_04_8_treasure.c @@ -16,7 +16,7 @@ API_CALLABLE(N(AnimateFlyingChestRotScale)) { entity->scale.x = (60 - script->functionTemp[1]) / 60.0f; entity->scale.y = (60 - script->functionTemp[1]) / 60.0f; entity->scale.z = (60 - script->functionTemp[1]) / 60.0f; - entity->rotation.y = (1.0f - cos_rad(entity->scale.y * PI)) * 990.0 * 0.25f; + entity->rot.y = (1.0f - cos_rad(entity->scale.y * PI)) * 990.0 * 0.25f; script->functionTemp[1]--; if (script->functionTemp[1] == -1) { @@ -31,8 +31,8 @@ API_CALLABLE(N(AnimateFallingChestRot)) { if (isInitialCall) { script->functionTemp[0] = -30; } - entity->rotation.x = script->functionTemp[0]; - entity->rotation.z = script->functionTemp[0]; + entity->rot.x = script->functionTemp[0]; + entity->rot.z = script->functionTemp[0]; script->functionTemp[0]++; if (script->functionTemp[0] == 1) { diff --git a/src/world/area_jan/jan_22/jan_22_5_zipline.c b/src/world/area_jan/jan_22/jan_22_5_zipline.c index d2daa32ad34..97283af32e5 100644 --- a/src/world/area_jan/jan_22/jan_22_5_zipline.c +++ b/src/world/area_jan/jan_22/jan_22_5_zipline.c @@ -40,13 +40,13 @@ API_CALLABLE(N(Zipline_UpdatePlayerPos)) { if (mode == 0) { Npc* partner = get_npc_safe(NPC_PARTNER); - gPlayerStatus.position.x = (script->varTable[2] + script->varTable[5]); - gPlayerStatus.position.y = (script->varTable[3] + script->varTable[6]); - gPlayerStatus.position.z = (script->varTable[4] + script->varTable[7]); + gPlayerStatus.pos.x = (script->varTable[2] + script->varTable[5]); + gPlayerStatus.pos.y = (script->varTable[3] + script->varTable[6]); + gPlayerStatus.pos.z = (script->varTable[4] + script->varTable[7]); gPlayerStatus.targetYaw = atan2(array[0], array[2], array[3], array[5]); - partner->pos.x = gPlayerStatus.position.x; - partner->pos.y = gPlayerStatus.position.y - 10.0f; - partner->pos.z = gPlayerStatus.position.z - 5.0f; + partner->pos.x = gPlayerStatus.pos.x; + partner->pos.y = gPlayerStatus.pos.y - 10.0f; + partner->pos.z = gPlayerStatus.pos.z - 5.0f; } return ApiStatus_DONE2; } @@ -61,8 +61,8 @@ API_CALLABLE(N(Zipline_CheckInputForJumpOff)) { s32 bx2 = posB + 17; script->varTable[8] = -1; - if (((gPlayerStatus.position.x < ax1) || (ax2 < gPlayerStatus.position.x)) - && ((gPlayerStatus.position.x < bx1) || (bx2 < gPlayerStatus.position.x))) { + if (((gPlayerStatus.pos.x < ax1) || (ax2 < gPlayerStatus.pos.x)) + && ((gPlayerStatus.pos.x < bx1) || (bx2 < gPlayerStatus.pos.x))) { script->varTable[8] = gGameStatusPtr->pressedButtons[0] & BUTTON_A; } return ApiStatus_DONE2; diff --git a/src/world/area_kgr/kgr_01/kgr_01_2_wiggle.c b/src/world/area_kgr/kgr_01/kgr_01_2_wiggle.c index 9e0a870e63d..6c412e1a4a3 100644 --- a/src/world/area_kgr/kgr_01/kgr_01_2_wiggle.c +++ b/src/world/area_kgr/kgr_01/kgr_01_2_wiggle.c @@ -23,8 +23,8 @@ void N(add_tongue_deformation)(Vtx* src, Vtx* dest, s32 numVertices, s32 time) { // base y-offset goes from 0-5 based on radial distance to player, // with 0 at the closest and 5 when distance squared > 1000. // this creates the depression of the tongue where the player is standing. - dx = vd->ob[0] - player->position.x; - dz = vd->ob[2] - player->position.z; + dx = vd->ob[0] - player->pos.x; + dz = vd->ob[2] - player->pos.z; offset = ((dx * dx) + (dz * dz)) / 100; if (offset > 10) { offset = 10; diff --git a/src/world/area_kkj/common/ApproachPlayer100Units.inc.c b/src/world/area_kkj/common/ApproachPlayer100Units.inc.c index 0164d0305b6..5721fb39cf7 100644 --- a/src/world/area_kkj/common/ApproachPlayer100Units.inc.c +++ b/src/world/area_kkj/common/ApproachPlayer100Units.inc.c @@ -18,15 +18,15 @@ ApiStatus N(ApproachPlayer100Units)(Evt* script, s32 isInitialCall) { return ApiStatus_DONE2; } - if (dist2D(playerStatus->position.x, playerStatus->position.z, npc->pos.x, npc->pos.z) < 100.0f) { + if (dist2D(playerStatus->pos.x, playerStatus->pos.z, npc->pos.x, npc->pos.z) < 100.0f) { isCloseToPlayer = FALSE; } else { isCloseToPlayer = TRUE; } - angle = clamp_angle(atan2(playerStatus->position.x, playerStatus->position.z, npc->pos.x, npc->pos.z)); - posX = playerStatus->position.x + (sin_deg(angle) * 100.0f); - posZ = playerStatus->position.z - (cos_deg(angle) * 100.0f); + angle = clamp_angle(atan2(playerStatus->pos.x, playerStatus->pos.z, npc->pos.x, npc->pos.z)); + posX = playerStatus->pos.x + (sin_deg(angle) * 100.0f); + posZ = playerStatus->pos.z - (cos_deg(angle) * 100.0f); evt_set_variable(script, outVar1, isCloseToPlayer); evt_set_variable(script, outVar2, posX); evt_set_variable(script, outVar3, posZ); diff --git a/src/world/area_kkj/common/ApproachPlayer50Units.inc.c b/src/world/area_kkj/common/ApproachPlayer50Units.inc.c index c7efac7fdb4..8f1f79894e6 100644 --- a/src/world/area_kkj/common/ApproachPlayer50Units.inc.c +++ b/src/world/area_kkj/common/ApproachPlayer50Units.inc.c @@ -19,15 +19,15 @@ API_CALLABLE(N(ApproachPlayer50Units)) { return ApiStatus_DONE2; } - if (dist2D(playerStatus->position.x, playerStatus->position.z, npc->pos.x, npc->pos.z) < 50.0f) { + if (dist2D(playerStatus->pos.x, playerStatus->pos.z, npc->pos.x, npc->pos.z) < 50.0f) { phi_s4 = FALSE; } else { phi_s4 = TRUE; } - angle = clamp_angle(atan2(playerStatus->position.x, playerStatus->position.z, npc->pos.x, npc->pos.z)); - x = playerStatus->position.x + (sin_deg(angle) * 50.0f); - z = playerStatus->position.z - (cos_deg(angle) * 50.0f); + angle = clamp_angle(atan2(playerStatus->pos.x, playerStatus->pos.z, npc->pos.x, npc->pos.z)); + x = playerStatus->pos.x + (sin_deg(angle) * 50.0f); + z = playerStatus->pos.z - (cos_deg(angle) * 50.0f); evt_set_variable(script, outVar1, phi_s4); evt_set_variable(script, outVar2, x); evt_set_variable(script, outVar3, z); diff --git a/src/world/area_kkj/common/RestoreFromPeachState.inc.c b/src/world/area_kkj/common/RestoreFromPeachState.inc.c index 41b505c39f4..38a7e58e5eb 100644 --- a/src/world/area_kkj/common/RestoreFromPeachState.inc.c +++ b/src/world/area_kkj/common/RestoreFromPeachState.inc.c @@ -2,6 +2,6 @@ API_CALLABLE(N(RestoreFromPeachState)) { gGameStatusPtr->peachFlags &= ~PEACH_STATUS_FLAG_IS_PEACH; - gPlayerData.currentPartner = script->varTable[0]; + gPlayerData.curPartner = script->varTable[0]; return ApiStatus_DONE2; } diff --git a/src/world/area_kkj/common/Searchlights.inc.c b/src/world/area_kkj/common/Searchlights.inc.c index 35d10b92008..5b09e8ecaa5 100644 --- a/src/world/area_kkj/common/Searchlights.inc.c +++ b/src/world/area_kkj/common/Searchlights.inc.c @@ -19,8 +19,8 @@ API_CALLABLE(N(UnkPhysicsFunc)) { s32 channel; add_vec2D_polar(&x, &z, r, npc->yaw); - xDist = dist2D(x, 0.0f, playerStatus->position.x, 0.0f); - zDist = dist2D(0.0f, z, 0.0f, playerStatus->position.z); + xDist = dist2D(x, 0.0f, playerStatus->pos.x, 0.0f); + zDist = dist2D(0.0f, z, 0.0f, playerStatus->pos.z); if (npc->yaw == 90.0 || npc->yaw == 270.0) { if (xDist <= inDist1 && zDist <= inDist2) { @@ -41,11 +41,11 @@ API_CALLABLE(N(UnkPhysicsFunc)) { y = npc->pos.y; z = npc->pos.z; // required to match, has to be r - r = dist2D(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z); + r = dist2D(npc->pos.x, npc->pos.z, playerStatus->pos.x, playerStatus->pos.z); channel = COLLISION_IGNORE_ENTITIES | COLLISION_CHANNEL_20000 | COLLISION_CHANNEL_10000 | COLLISION_CHANNEL_8000; if (npc_test_move_taller_with_slipping(channel, &x, &y, &z, r, - atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z), + atan2(npc->pos.x, npc->pos.z, playerStatus->pos.x, playerStatus->pos.z), npc->collisionDiameter, npc->collisionHeight)) { outVal = FALSE; @@ -101,7 +101,7 @@ API_CALLABLE(N(UpdateSearchlight)) { z = npc->pos.z; add_vec2D_polar(&x, &z, radius, npc->yaw); - if (dist2D(x, z, playerStatus->position.x, playerStatus->position.z) <= offsetDist) { + if (dist2D(x, z, playerStatus->pos.x, playerStatus->pos.z) <= offsetDist) { outVal |= 1; } @@ -112,7 +112,7 @@ API_CALLABLE(N(UpdateSearchlight)) { z = npc->pos.z; add_vec2D_polar(&x, &z, extraRadius, npc->yaw); - if (dist2D(x, z, playerStatus->position.x, playerStatus->position.z) <= extraOffsetDist) { + if (dist2D(x, z, playerStatus->pos.x, playerStatus->pos.z) <= extraOffsetDist) { outVal |= 0x10; } @@ -122,9 +122,9 @@ API_CALLABLE(N(UpdateSearchlight)) { y = npc->pos.y; z = npc->pos.z; - dist = dist2D(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z); + dist = dist2D(npc->pos.x, npc->pos.z, playerStatus->pos.x, playerStatus->pos.z); if (npc_test_move_taller_with_slipping(0, &x, &y, &z, dist, - atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z), + atan2(npc->pos.x, npc->pos.z, playerStatus->pos.x, playerStatus->pos.z), npc->collisionDiameter, npc->collisionHeight)) { outVal = 0; } diff --git a/src/world/area_kkj/kkj_00/kkj_00_2_main.c b/src/world/area_kkj/kkj_00/kkj_00_2_main.c index 553574f6dad..bb79ab91c69 100644 --- a/src/world/area_kkj/kkj_00/kkj_00_2_main.c +++ b/src/world/area_kkj/kkj_00/kkj_00_2_main.c @@ -103,16 +103,16 @@ EvtScript N(D_80241460_ABC6F0) = { SlideParams N(SlideData1) = { .heading = 358.5f, .maxDescendAccel = 0.5f, - .launchVelocity = 20.0f, - .maxDescendVelocity = 0.0f, + .launchVel = 20.0f, + .maxDescendVel = 0.0f, .integrator = { 0.0, 0.0, 0.0, 0.0 }, }; SlideParams N(SlideData2) = { .heading = 1.5f, .maxDescendAccel = 0.5f, - .launchVelocity = 20.0f, - .maxDescendVelocity = 0.0f, + .launchVel = 20.0f, + .maxDescendVel = 0.0f, .integrator = { 0.0, 0.0, 0.0, 0.0 }, }; diff --git a/src/world/area_kkj/kkj_13/kkj_13_5_intro_scenes.c b/src/world/area_kkj/kkj_13/kkj_13_5_intro_scenes.c index 89ebed653f4..2e595127c90 100644 --- a/src/world/area_kkj/kkj_13/kkj_13_5_intro_scenes.c +++ b/src/world/area_kkj/kkj_13/kkj_13_5_intro_scenes.c @@ -129,7 +129,7 @@ API_CALLABLE(N(ShatterWindow)) { effect = fx_ice_shard(type, posX, posY, -150.0f, ((i & 3) * 0.4) + 1.0, ((i & 3) * 4) + 30); effect->data.iceShard->animFrame = 0; effect->data.iceShard->animRate = (rand_int(10) * 0.2) + 0.1; - effect->data.iceShard->rotation = 35 * i; + effect->data.iceShard->rot = 35 * i; effect->data.iceShard->angularVel = rand_int(10) - 5; effect->data.iceShard->vel.x = x; effect->data.iceShard->vel.y = y; diff --git a/src/world/area_kkj/kkj_15/kkj_15_3_rotating_wall.c b/src/world/area_kkj/kkj_15/kkj_15_3_rotating_wall.c index bed5b092fa4..0938ddb3ebf 100644 --- a/src/world/area_kkj/kkj_15/kkj_15_3_rotating_wall.c +++ b/src/world/area_kkj/kkj_15/kkj_15_3_rotating_wall.c @@ -10,8 +10,8 @@ API_CALLABLE(N(UpdateRotatingPartyPositions)) { mag = dist2D(50.0f, -200.0f, script->varTable[7], script->varTable[8]); angle = atan2(50.0f, -200.0f, script->varTable[7], script->varTable[8]); angle = clamp_angle(angle - var); - gPlayerStatus.position.x = 50.0f + mag * sin_deg(angle); - gPlayerStatus.position.z = -200.0f - mag * cos_deg(angle); + gPlayerStatus.pos.x = 50.0f + mag * sin_deg(angle); + gPlayerStatus.pos.z = -200.0f - mag * cos_deg(angle); mag = dist2D(50.0f, -200.0f, script->varTable[9], script->varTable[10]); angle = atan2(50.0f, -200.0f, script->varTable[9], script->varTable[10]); diff --git a/src/world/area_kkj/kkj_27/kkj_27_3_rotating_wall.c b/src/world/area_kkj/kkj_27/kkj_27_3_rotating_wall.c index 8f895165a2a..77445f26f7e 100644 --- a/src/world/area_kkj/kkj_27/kkj_27_3_rotating_wall.c +++ b/src/world/area_kkj/kkj_27/kkj_27_3_rotating_wall.c @@ -11,8 +11,8 @@ API_CALLABLE(N(UpdateRotatingPlayerPosition)) { mag = dist2D(-250.0f, 0.0f, script->varTable[9], script->varTable[10]); angle = atan2(-250.0f, 0.0f, script->varTable[9], script->varTable[10]); angle = clamp_angle(angle - var); - gPlayerStatus.position.x = -250.0f + mag * sin_deg(angle); - gPlayerStatus.position.z = 0.0f - mag * cos_deg(angle); + gPlayerStatus.pos.x = -250.0f + mag * sin_deg(angle); + gPlayerStatus.pos.z = 0.0f - mag * cos_deg(angle); return ApiStatus_DONE2; } diff --git a/src/world/area_kmr/kmr_02/kmr_02_5_entity.c b/src/world/area_kmr/kmr_02/kmr_02_5_entity.c index 437f7dead03..5f23df81ddd 100644 --- a/src/world/area_kmr/kmr_02/kmr_02_5_entity.c +++ b/src/world/area_kmr/kmr_02/kmr_02_5_entity.c @@ -39,7 +39,7 @@ API_CALLABLE(N(AnimateBlockScale)) { entity->scale.x = (60 - script->functionTemp[1]) / 60.0f; entity->scale.y = (60 - script->functionTemp[1]) / 60.0f; entity->scale.z = (60 - script->functionTemp[1]) / 60.0f; - entity->rotation.y = (1.0f - cos_rad(entity->scale.y * PI)) * 990.0 * 0.5f; + entity->rot.y = (1.0f - cos_rad(entity->scale.y * PI)) * 990.0 * 0.5f; script->functionTemp[1]--; if (script->functionTemp[1] == -1) { diff --git a/src/world/area_kmr/kmr_03/kmr_03_4_entity.c b/src/world/area_kmr/kmr_03/kmr_03_4_entity.c index 6bb96197b28..a4bf8b412f4 100644 --- a/src/world/area_kmr/kmr_03/kmr_03_4_entity.c +++ b/src/world/area_kmr/kmr_03/kmr_03_4_entity.c @@ -21,11 +21,11 @@ EvtScript N(EVS_OnSmashBlock2) = { API_CALLABLE(func_80240358_8C82E8) { PlayerStatus* playerStatus = &gPlayerStatus; - f32 xDelta = playerStatus->currentSpeed * 5.0f * sin_deg(playerStatus->targetYaw); - f32 zDelta = playerStatus->currentSpeed * 5.0f * -cos_deg(playerStatus->targetYaw); + f32 xDelta = playerStatus->curSpeed * 5.0f * sin_deg(playerStatus->targetYaw); + f32 zDelta = playerStatus->curSpeed * 5.0f * -cos_deg(playerStatus->targetYaw); - script->varTable[0] = playerStatus->position.x + xDelta; - script->varTable[1] = playerStatus->position.z + zDelta; + script->varTable[0] = playerStatus->pos.x + xDelta; + script->varTable[1] = playerStatus->pos.z + zDelta; return ApiStatus_DONE2; } diff --git a/src/world/area_kmr/kmr_06/kmr_06_5_sticker_sign.c b/src/world/area_kmr/kmr_06/kmr_06_5_sticker_sign.c index 403cf07dcfd..0528709781f 100644 --- a/src/world/area_kmr/kmr_06/kmr_06_5_sticker_sign.c +++ b/src/world/area_kmr/kmr_06/kmr_06_5_sticker_sign.c @@ -65,7 +65,7 @@ void N(worker_render_sticker)(void) { renderTaskPtr->renderMode = RENDER_MODE_ALPHATEST; renderTaskPtr->appendGfxArg = 0; renderTaskPtr->appendGfx = &N(appendGfx_sticker); - renderTaskPtr->distance = 0; + renderTaskPtr->dist = 0; queue_render_task(renderTaskPtr); } diff --git a/src/world/area_kmr/kmr_10/kmr_10_4_entity.c b/src/world/area_kmr/kmr_10/kmr_10_4_entity.c index 842c1ce6f05..9d02ef9d366 100644 --- a/src/world/area_kmr/kmr_10/kmr_10_4_entity.c +++ b/src/world/area_kmr/kmr_10/kmr_10_4_entity.c @@ -13,9 +13,9 @@ API_CALLABLE(N(SetSpringPosition)) { s32 z = evt_get_variable(script, *args++); Entity* entity = get_entity_by_index(entityIndex); - entity->position.x = x; - entity->position.y = y; - entity->position.z = z; + entity->pos.x = x; + entity->pos.y = y; + entity->pos.z = z; return ApiStatus_DONE2; } diff --git a/src/world/area_kmr/kmr_11/kmr_11_5_entity.c b/src/world/area_kmr/kmr_11/kmr_11_5_entity.c index e869910cc3f..0bf3bbfa642 100644 --- a/src/world/area_kmr/kmr_11/kmr_11_5_entity.c +++ b/src/world/area_kmr/kmr_11/kmr_11_5_entity.c @@ -5,9 +5,9 @@ API_CALLABLE(N(SetBlueSwitchPosition)) { Entity* entity = get_entity_by_index(script->varTable[10]); - entity->position.x = script->varTable[0]; - entity->position.y = script->varTable[1]; - entity->position.z = script->varTable[2]; + entity->pos.x = script->varTable[0]; + entity->pos.y = script->varTable[1]; + entity->pos.z = script->varTable[2]; return ApiStatus_DONE2; } diff --git a/src/world/area_kmr/kmr_20/kmr_20_13_records.c b/src/world/area_kmr/kmr_20/kmr_20_13_records.c index 59f8ceec1de..d7a2a63a9f2 100644 --- a/src/world/area_kmr/kmr_20/kmr_20_13_records.c +++ b/src/world/area_kmr/kmr_20/kmr_20_13_records.c @@ -157,7 +157,7 @@ void N(appendGfx_records)(void* data) { case RECORDS_STATE_IDLE: records->alpha = 255; records->lastAlpha = records->alpha; - if (gGameStatusPtr->currentButtons[0] & (BUTTON_A | BUTTON_B)) { + if (gGameStatusPtr->curButtons[0] & (BUTTON_A | BUTTON_B)) { records->state = RECORDS_STATE_BEGIN_FADE_OUT; } if (records->state != RECORDS_STATE_BEGIN_FADE_OUT) { @@ -185,7 +185,7 @@ void N(worker_draw_game_records)(void) { rt.renderMode = RENDER_MODE_2D; rt.appendGfxArg = NULL; rt.appendGfx = N(appendGfx_records); - rt.distance = 0; + rt.dist = 0; queue_render_task(&rt); } diff --git a/src/world/area_kmr/kmr_23/kmr_23_2_npc.c b/src/world/area_kmr/kmr_23/kmr_23_2_npc.c index 6acbc6377ad..a5bb27125ce 100644 --- a/src/world/area_kmr/kmr_23/kmr_23_2_npc.c +++ b/src/world/area_kmr/kmr_23/kmr_23_2_npc.c @@ -100,13 +100,13 @@ API_CALLABLE(N(CreateEndChapterData)) { npc->pos.x = data->pos.x; npc->pos.y = data->pos.y; npc->pos.z = data->pos.z + 10.0f; - npc->rotation.y = data->yaw; + npc->rot.y = data->yaw; backFacing = FALSE; if (!evt_get_variable(script, MF_Unk_0B)) { if ((data->yaw > 90.0f) && (data->yaw < 270.0f)) { backFacing = TRUE; } - npc->currentAnim = N(StarSpiritAnimations)[data->chapter][backFacing]; + npc->curAnim = N(StarSpiritAnimations)[data->chapter][backFacing]; } if (data->spiritCardEffect != NULL) { diff --git a/src/world/area_kpa/kpa_03/kpa_03_4_entity.c b/src/world/area_kpa/kpa_03/kpa_03_4_entity.c index 2f2c7e5fb3a..d81ac64281b 100644 --- a/src/world/area_kpa/kpa_03/kpa_03_4_entity.c +++ b/src/world/area_kpa/kpa_03/kpa_03_4_entity.c @@ -4,10 +4,10 @@ API_CALLABLE(N(MonitorPlayerAltitude)) { PlayerStatus* playerStatus = &gPlayerStatus; - if (playerStatus->lastGoodPosition.y >= 0) { + if (playerStatus->lastGoodPos.y >= 0) { evt_set_variable(script, MV_PlayerHeightLevel, 0); } - if (playerStatus->lastGoodPosition.y <= -280) { + if (playerStatus->lastGoodPos.y <= -280) { evt_set_variable(script, MV_PlayerHeightLevel, 1); } return ApiStatus_BLOCK; diff --git a/src/world/area_kpa/kpa_08/kpa_08_3_entity.c b/src/world/area_kpa/kpa_08/kpa_08_3_entity.c index da4e066bd7e..dc5e5569f80 100644 --- a/src/world/area_kpa/kpa_08/kpa_08_3_entity.c +++ b/src/world/area_kpa/kpa_08/kpa_08_3_entity.c @@ -9,8 +9,8 @@ API_CALLABLE(N(ElevatePlayer)) { s32 yOffset = evt_get_variable(script, *args++); PlayerStatus* playerStatus = &gPlayerStatus; - if (floor == gCollisionStatus.currentFloor) { - playerStatus->position.y = script->varTable[0] + yOffset; + if (floor == gCollisionStatus.curFloor) { + playerStatus->pos.y = script->varTable[0] + yOffset; } return ApiStatus_DONE2; } diff --git a/src/world/area_kpa/kpa_09/kpa_09_3_entity.c b/src/world/area_kpa/kpa_09/kpa_09_3_entity.c index 0f2b74b6729..fb3483b9793 100644 --- a/src/world/area_kpa/kpa_09/kpa_09_3_entity.c +++ b/src/world/area_kpa/kpa_09/kpa_09_3_entity.c @@ -9,8 +9,8 @@ API_CALLABLE(N(ElevatePlayer)) { s32 yOffset = evt_get_variable(script, *args++); PlayerStatus* playerStatus = &gPlayerStatus; - if (floor == gCollisionStatus.currentFloor) { - playerStatus->position.y = script->varTable[0] + yOffset; + if (floor == gCollisionStatus.curFloor) { + playerStatus->pos.y = script->varTable[0] + yOffset; } return ApiStatus_DONE2; } diff --git a/src/world/area_kpa/kpa_12/kpa_12_3_platforms.c b/src/world/area_kpa/kpa_12/kpa_12_3_platforms.c index 1beb11e1771..0bba5ca39ea 100644 --- a/src/world/area_kpa/kpa_12/kpa_12_3_platforms.c +++ b/src/world/area_kpa/kpa_12/kpa_12_3_platforms.c @@ -14,14 +14,14 @@ API_CALLABLE(N(AddPlatformPushVelocity)) { s32 floor = evt_get_variable(script, *args++); PlayerStatus* playerStatus = &gPlayerStatus; - if (gCollisionStatus.currentFloor == floor || gCollisionStatus.lastTouchedFloor == floor) { - playerStatus->pushVelocity.x = velocity; + if (gCollisionStatus.curFloor == floor || gCollisionStatus.lastTouchedFloor == floor) { + playerStatus->pushVel.x = velocity; } - if (gPlayerData.currentPartner != PARTNER_NONE) { + if (gPlayerData.curPartner != PARTNER_NONE) { Npc* partner = get_npc_unsafe(NPC_PARTNER); - if (partner->currentFloor == floor) { + if (partner->curFloor == floor) { partner->pos.x += velocity; } } diff --git a/src/world/area_kpa/kpa_13/kpa_13_4_platforms.c b/src/world/area_kpa/kpa_13/kpa_13_4_platforms.c index 20aa337b644..faee2857284 100644 --- a/src/world/area_kpa/kpa_13/kpa_13_4_platforms.c +++ b/src/world/area_kpa/kpa_13/kpa_13_4_platforms.c @@ -14,14 +14,14 @@ API_CALLABLE(N(AddPlatformPushVelocity)) { s32 floor = evt_get_variable(script, *args++); PlayerStatus* playerStatus = &gPlayerStatus; - if (gCollisionStatus.currentFloor == floor || gCollisionStatus.lastTouchedFloor == floor) { - playerStatus->pushVelocity.x = velocity; + if (gCollisionStatus.curFloor == floor || gCollisionStatus.lastTouchedFloor == floor) { + playerStatus->pushVel.x = velocity; } - if (gPlayerData.currentPartner != PARTNER_NONE) { + if (gPlayerData.curPartner != PARTNER_NONE) { Npc* partner = get_npc_unsafe(NPC_PARTNER); - if (partner->currentFloor == floor) { + if (partner->curFloor == floor) { partner->pos.x += velocity; } } diff --git a/src/world/area_kpa/kpa_133/kpa_133_3_entity.c b/src/world/area_kpa/kpa_133/kpa_133_3_entity.c index 6132a032103..ebaf166721c 100644 --- a/src/world/area_kpa/kpa_133/kpa_133_3_entity.c +++ b/src/world/area_kpa/kpa_133/kpa_133_3_entity.c @@ -10,9 +10,9 @@ API_CALLABLE(N(SetSpringRotation)) { Bytecode* args = script->ptrReadPos; Entity* entity = get_entity_by_index(evt_get_variable(NULL, MV_SpringEntityID)); - entity->rotation.x = evt_get_variable(script, *args++); - entity->rotation.y = evt_get_variable(script, *args++); - entity->rotation.z = evt_get_variable(script, *args++); + entity->rot.x = evt_get_variable(script, *args++); + entity->rot.y = evt_get_variable(script, *args++); + entity->rot.z = evt_get_variable(script, *args++); return ApiStatus_DONE2; } @@ -20,9 +20,9 @@ API_CALLABLE(N(SetSpringPosition)) { Bytecode* args = script->ptrReadPos; Entity* entity = get_entity_by_index(evt_get_variable(NULL, MV_SpringEntityID)); - entity->position.x = evt_get_variable(script, *args++); - entity->position.y = evt_get_variable(script, *args++); - entity->position.z = evt_get_variable(script, *args++); + entity->pos.x = evt_get_variable(script, *args++); + entity->pos.y = evt_get_variable(script, *args++); + entity->pos.z = evt_get_variable(script, *args++); return ApiStatus_DONE2; } diff --git a/src/world/area_kpa/kpa_134/kpa_134_3_chains.c b/src/world/area_kpa/kpa_134/kpa_134_3_chains.c index 65c9a0c4dda..5f41f7a324a 100644 --- a/src/world/area_kpa/kpa_134/kpa_134_3_chains.c +++ b/src/world/area_kpa/kpa_134/kpa_134_3_chains.c @@ -60,22 +60,22 @@ API_CALLABLE(N(DetectLowerChainGrab)) { return ApiStatus_BLOCK; } - if (fabs(playerStatus->position.x - 50.0f) > 14.0) { + if (fabs(playerStatus->pos.x - 50.0f) > 14.0) { return ApiStatus_BLOCK; } - if (fabs(playerStatus->position.y - 150.0f) > 14.0) { + if (fabs(playerStatus->pos.y - 150.0f) > 14.0) { return ApiStatus_BLOCK; } - if (fabs(playerStatus->position.z - -34.0f) > 14.0) { + if (fabs(playerStatus->pos.z - -34.0f) > 14.0) { return ApiStatus_BLOCK; } - playerStatus->position.x = 50.0f; - playerStatus->position.y = 150.0f; - playerStatus->position.z = -34.0f; - playerStatus->currentSpeed = 0.0f; + playerStatus->pos.x = 50.0f; + playerStatus->pos.y = 150.0f; + playerStatus->pos.z = -34.0f; + playerStatus->curSpeed = 0.0f; return ApiStatus_DONE2; } @@ -307,22 +307,22 @@ API_CALLABLE(N(DetectUpperChainGrab)) { return ApiStatus_BLOCK; } - if (fabs(playerStatus->position.x - 680.0f) > 14.0) { + if (fabs(playerStatus->pos.x - 680.0f) > 14.0) { return ApiStatus_BLOCK; } - if (fabs(playerStatus->position.y - 275.0f) > 14.0) { + if (fabs(playerStatus->pos.y - 275.0f) > 14.0) { return ApiStatus_BLOCK; } - if (fabs(playerStatus->position.z - -35.0f) > 14.0) { + if (fabs(playerStatus->pos.z - -35.0f) > 14.0) { return ApiStatus_BLOCK; } - playerStatus->position.x = 680.0f; - playerStatus->position.y = 275.0f; - playerStatus->position.z = -35.0f; - playerStatus->currentSpeed = 0.0f; + playerStatus->pos.x = 680.0f; + playerStatus->pos.y = 275.0f; + playerStatus->pos.z = -35.0f; + playerStatus->curSpeed = 0.0f; return ApiStatus_DONE2; } diff --git a/src/world/area_kpa/kpa_134/kpa_134_6_entity.c b/src/world/area_kpa/kpa_134/kpa_134_6_entity.c index 275093c3201..1bc6a7c8413 100644 --- a/src/world/area_kpa/kpa_134/kpa_134_6_entity.c +++ b/src/world/area_kpa/kpa_134/kpa_134_6_entity.c @@ -4,9 +4,9 @@ API_CALLABLE(N(UnusedSetEntityPosition)) { Entity* entity = get_entity_by_index(script->varTable[10]); - entity->position.x = script->varTable[0]; - entity->position.y = script->varTable[1]; - entity->position.z = script->varTable[2]; + entity->pos.x = script->varTable[0]; + entity->pos.y = script->varTable[1]; + entity->pos.z = script->varTable[2]; return ApiStatus_DONE2; } diff --git a/src/world/area_kpa/kpa_14/kpa_14_4_platforms.c b/src/world/area_kpa/kpa_14/kpa_14_4_platforms.c index 00e6823da36..57c4e85bc49 100644 --- a/src/world/area_kpa/kpa_14/kpa_14_4_platforms.c +++ b/src/world/area_kpa/kpa_14/kpa_14_4_platforms.c @@ -16,18 +16,18 @@ API_CALLABLE(N(AddPlatformPushVelocity)) { s32 temp_a0 = evt_get_variable(script, *args++); PlayerStatus* playerStatus = &gPlayerStatus; - if (gCollisionStatus.currentFloor == floor || gCollisionStatus.lastTouchedFloor == floor) { + if (gCollisionStatus.curFloor == floor || gCollisionStatus.lastTouchedFloor == floor) { if (playerStatus->actionState != ACTION_STATE_TORNADO_JUMP && playerStatus->actionState != ACTION_STATE_SPIN_JUMP && temp_a0 == 0) { - playerStatus->pushVelocity.x = velX; + playerStatus->pushVel.x = velX; } } - if (gPlayerData.currentPartner != PARTNER_NONE) { + if (gPlayerData.curPartner != PARTNER_NONE) { Npc* partner = get_npc_unsafe(NPC_PARTNER); - if (partner->currentFloor == floor) { + if (partner->curFloor == floor) { partner->pos.x += velX; } } diff --git a/src/world/area_kpa/kpa_53/kpa_53_3_npc.c b/src/world/area_kpa/kpa_53/kpa_53_3_npc.c index 540430f7974..bd3b68b2a0f 100644 --- a/src/world/area_kpa/kpa_53/kpa_53_3_npc.c +++ b/src/world/area_kpa/kpa_53/kpa_53_3_npc.c @@ -14,15 +14,15 @@ API_CALLABLE(N(UpdateFollowerPosition)) { return ApiStatus_DONE2; } - npc->pos.x = (s32)(((s32)playerStatus->position.x - 700) * 0.85) + 765; - if (playerStatus->currentSpeed == 0.0f) { + npc->pos.x = (s32)(((s32)playerStatus->pos.x - 700) * 0.85) + 765; + if (playerStatus->curSpeed == 0.0f) { animID = ANIM_Peach1_Idle; - } else if (playerStatus->currentSpeed < 2.0f) { + } else if (playerStatus->curSpeed < 2.0f) { animID = ANIM_Peach1_Walk; } else { animID = ANIM_Peach1_Run; } - npc->currentAnim = animID; + npc->curAnim = animID; evt_set_variable(script, outVar, playerStatus->targetYaw); return ApiStatus_DONE2; } diff --git a/src/world/area_kpa/kpa_63/kpa_63_4_scenes.c b/src/world/area_kpa/kpa_63/kpa_63_4_scenes.c index 369afd60864..9eb35bc3417 100644 --- a/src/world/area_kpa/kpa_63/kpa_63_4_scenes.c +++ b/src/world/area_kpa/kpa_63/kpa_63_4_scenes.c @@ -28,9 +28,9 @@ API_CALLABLE(N(SetPassengerPos)) { switch (script->functionTemp[0]) { case 0: - gPlayerStatus.position.x = x; - gPlayerStatus.position.y = y; - gPlayerStatus.position.z = z; + gPlayerStatus.pos.x = x; + gPlayerStatus.pos.y = y; + gPlayerStatus.pos.z = z; break; case 1: partner = get_npc_safe(NPC_PARTNER); diff --git a/src/world/area_kzn/common/LavaGlowLighting.inc.c b/src/world/area_kzn/common/LavaGlowLighting.inc.c index d445dafbfd2..d256cbdc439 100644 --- a/src/world/area_kzn/common/LavaGlowLighting.inc.c +++ b/src/world/area_kzn/common/LavaGlowLighting.inc.c @@ -56,7 +56,7 @@ API_CALLABLE(N(ApplyLavaGlowLighting)) { if (evt_get_float_variable(NULL, MV_GlowIntensity) <= 0.0f) { return ApiStatus_DONE2; } - deltaX = -75.0f - playerStatus->position.x; + deltaX = -75.0f - playerStatus->pos.x; if (deltaX < 0.0f) { deltaX = -deltaX; } diff --git a/src/world/area_kzn/kzn_02/kzn_02_2_platforms.c b/src/world/area_kzn/kzn_02/kzn_02_2_platforms.c index ec6c6638072..464ec5c142c 100644 --- a/src/world/area_kzn/kzn_02/kzn_02_2_platforms.c +++ b/src/world/area_kzn/kzn_02/kzn_02_2_platforms.c @@ -20,7 +20,7 @@ API_CALLABLE(N(GetCurrentFloor)) { Bytecode* args = script->ptrReadPos; s32 outVar = *args++; - evt_set_variable(script, outVar, gCollisionStatus.currentFloor); + evt_set_variable(script, outVar, gCollisionStatus.curFloor); return ApiStatus_DONE2; } @@ -41,13 +41,13 @@ API_CALLABLE(N(AddPushVelocity)) { CollisionStatus* collisionStatus= &gCollisionStatus; Npc* partner; - if ((collisionStatus->currentFloor == floorA) || (collisionStatus->lastTouchedFloor == floorA) - || (collisionStatus->currentFloor == floorB) || (collisionStatus->lastTouchedFloor == floorB)) { - playerStatus->pushVelocity.x = velX; + if ((collisionStatus->curFloor == floorA) || (collisionStatus->lastTouchedFloor == floorA) + || (collisionStatus->curFloor == floorB) || (collisionStatus->lastTouchedFloor == floorB)) { + playerStatus->pushVel.x = velX; } - if (gPlayerData.currentPartner != PARTNER_NONE){ + if (gPlayerData.curPartner != PARTNER_NONE){ partner = get_npc_unsafe(NPC_PARTNER); - if ((partner->currentFloor == floorA) || (partner->currentFloor == floorB)) { + if ((partner->curFloor == floorA) || (partner->curFloor == floorB)) { partner->pos.x += velX; } } diff --git a/src/world/area_kzn/kzn_02/kzn_02_4_demo.c b/src/world/area_kzn/kzn_02/kzn_02_4_demo.c index cf9f0949767..32334a375ce 100644 --- a/src/world/area_kzn/kzn_02/kzn_02_4_demo.c +++ b/src/world/area_kzn/kzn_02/kzn_02_4_demo.c @@ -64,11 +64,11 @@ API_CALLABLE(N(SetupDemoScene)) { break; case 3: partner_clear_player_tracking(wPartnerNpc); - partner_set_goal_pos(playerStatus->position.x, playerStatus->position.z); + partner_set_goal_pos(playerStatus->pos.x, playerStatus->pos.z); func_800EF3D4(0); set_npc_yaw(wPartnerNpc, 90.0f); playerStatus->targetYaw = 90.0f; - playerStatus->currentYaw = 90.0f; + playerStatus->curYaw = 90.0f; playerStatus->spriteFacingAngle = 0.0f; return ApiStatus_DONE2; } diff --git a/src/world/area_kzn/kzn_03/kzn_03_3_entity.c b/src/world/area_kzn/kzn_03/kzn_03_3_entity.c index 76740274858..cfcfb0b019e 100644 --- a/src/world/area_kzn/kzn_03/kzn_03_3_entity.c +++ b/src/world/area_kzn/kzn_03/kzn_03_3_entity.c @@ -7,10 +7,10 @@ API_CALLABLE(N(IsPlayerOnFirstCliff)) { s32 result = -1; - if (gPlayerStatus.lastGoodPosition.y > 800.0) { + if (gPlayerStatus.lastGoodPos.y > 800.0) { result = 0; } - if (gPlayerStatus.lastGoodPosition.y < 680.0) { + if (gPlayerStatus.lastGoodPos.y < 680.0) { result = 1; } if (result >= 0) { diff --git a/src/world/area_kzn/kzn_03/kzn_03_4_ziplines.c b/src/world/area_kzn/kzn_03/kzn_03_4_ziplines.c index 28b00047f5e..54f34a570ea 100644 --- a/src/world/area_kzn/kzn_03/kzn_03_4_ziplines.c +++ b/src/world/area_kzn/kzn_03/kzn_03_4_ziplines.c @@ -39,13 +39,13 @@ API_CALLABLE(N(Zipline_UpdatePlayerPos)) { script->varTable[7] = (dz / 1000.0f) * script->varTable[0]; if (temp_v0 == 0) { Npc* partner = get_npc_safe(NPC_PARTNER); - gPlayerStatus.position.x = script->varTable[2] + script->varTable[5]; - gPlayerStatus.position.y = script->varTable[3] + script->varTable[6]; - gPlayerStatus.position.z = script->varTable[4] + script->varTable[7]; + gPlayerStatus.pos.x = script->varTable[2] + script->varTable[5]; + gPlayerStatus.pos.y = script->varTable[3] + script->varTable[6]; + gPlayerStatus.pos.z = script->varTable[4] + script->varTable[7]; gPlayerStatus.targetYaw = atan2(array[0], array[2], array[3], array[5]); - partner->pos.x = gPlayerStatus.position.x; - partner->pos.y = gPlayerStatus.position.y - 10.0f; - partner->pos.z = gPlayerStatus.position.z - 5.0f; + partner->pos.x = gPlayerStatus.pos.x; + partner->pos.y = gPlayerStatus.pos.y - 10.0f; + partner->pos.z = gPlayerStatus.pos.z - 5.0f; } return ApiStatus_DONE2; } diff --git a/src/world/area_kzn/kzn_04/kzn_04_3_npc.c b/src/world/area_kzn/kzn_04/kzn_04_3_npc.c index b3ad169babb..403c06ea998 100644 --- a/src/world/area_kzn/kzn_04/kzn_04_3_npc.c +++ b/src/world/area_kzn/kzn_04/kzn_04_3_npc.c @@ -71,7 +71,7 @@ EvtScript N(EVS_FireBar_Defeated) = { FireBarAISettings N(AISettings_FireBar_01) = { .centerPos = { -280, 500, -30 }, - .rotationRate = 8, + .rotRate = 8, .firstNpc = NPC_FireBar_1A, .npcCount = 4, .callback = N(FireBarAI_Callback), @@ -79,7 +79,7 @@ FireBarAISettings N(AISettings_FireBar_01) = { FireBarAISettings N(AISettings_FireBar_02) = { .centerPos = { 0, 500, 40 }, - .rotationRate = -8, + .rotRate = -8, .firstNpc = NPC_FireBar_2A, .npcCount = 4, .callback = N(FireBarAI_Callback), @@ -87,7 +87,7 @@ FireBarAISettings N(AISettings_FireBar_02) = { FireBarAISettings N(AISettings_FireBar_03) = { .centerPos = { 280, 500, -30 }, - .rotationRate = 8, + .rotRate = 8, .firstNpc = NPC_FireBar_3A, .npcCount = 4, .callback = N(FireBarAI_Callback), diff --git a/src/world/area_kzn/kzn_08/kzn_08_4_extra.c b/src/world/area_kzn/kzn_08/kzn_08_4_extra.c index 19f7f52ea9e..f755dcfb050 100644 --- a/src/world/area_kzn/kzn_08/kzn_08_4_extra.c +++ b/src/world/area_kzn/kzn_08/kzn_08_4_extra.c @@ -15,7 +15,7 @@ API_CALLABLE(N(func_80243EE0_C75360)) { } set_screen_overlay_center_worldpos(SCREEN_LAYER_BACK, 1, - playerStatus->position.x, playerStatus->position.y + 8.0f, playerStatus->position.z); + playerStatus->pos.x, playerStatus->pos.y + 8.0f, playerStatus->pos.z); get_model_fog_color_parameters(&primR, &primG, &primB, &primA, &fogR, &fogG, &fogB, &fogStart, &fogEnd); @@ -33,7 +33,7 @@ API_CALLABLE(N(func_80243EE0_C75360)) { } if (gPartnerStatus.partnerActionState != PARTNER_ACTION_NONE) { - if (playerData->currentPartner == PARTNER_WATT) { + if (playerData->curPartner == PARTNER_WATT) { if (!script->functionTemp[1]) { script->functionTemp[1] = TRUE; sfx_play_sound(SOUND_WATT_REPEL_DARKNESS); @@ -43,7 +43,7 @@ API_CALLABLE(N(func_80243EE0_C75360)) { script->functionTemp[0] = 90; } } - } else if (playerData->currentPartner == PARTNER_WATT) { + } else if (playerData->curPartner == PARTNER_WATT) { if (script->functionTemp[1]) { script->functionTemp[1] = FALSE; if (script->functionTemp[0] < 255) { diff --git a/src/world/area_kzn/kzn_09/kzn_09_3_zipline.c b/src/world/area_kzn/kzn_09/kzn_09_3_zipline.c index 610609b126c..9920cfce246 100644 --- a/src/world/area_kzn/kzn_09/kzn_09_3_zipline.c +++ b/src/world/area_kzn/kzn_09/kzn_09_3_zipline.c @@ -38,13 +38,13 @@ API_CALLABLE(N(Zipline_UpdatePlayerPos)) { script->varTable[7] = (dz / 1000.0f) * script->varTable[0]; if (temp_v0 == 0) { Npc* partner = get_npc_safe(NPC_PARTNER); - gPlayerStatus.position.x = script->varTable[2] + script->varTable[5]; - gPlayerStatus.position.y = script->varTable[3] + script->varTable[6]; - gPlayerStatus.position.z = script->varTable[4] + script->varTable[7]; + gPlayerStatus.pos.x = script->varTable[2] + script->varTable[5]; + gPlayerStatus.pos.y = script->varTable[3] + script->varTable[6]; + gPlayerStatus.pos.z = script->varTable[4] + script->varTable[7]; gPlayerStatus.targetYaw = atan2(array[0], array[2], array[3], array[5]); - partner->pos.x = gPlayerStatus.position.x; - partner->pos.y = gPlayerStatus.position.y - 10.0f; - partner->pos.z = gPlayerStatus.position.z - 5.0f; + partner->pos.x = gPlayerStatus.pos.x; + partner->pos.y = gPlayerStatus.pos.y - 10.0f; + partner->pos.z = gPlayerStatus.pos.z - 5.0f; } return ApiStatus_DONE2; } diff --git a/src/world/area_kzn/kzn_11/kzn_11_2_platforms.c b/src/world/area_kzn/kzn_11/kzn_11_2_platforms.c index 59d9dd93fea..3f0a7ca6509 100644 --- a/src/world/area_kzn/kzn_11/kzn_11_2_platforms.c +++ b/src/world/area_kzn/kzn_11/kzn_11_2_platforms.c @@ -9,13 +9,13 @@ API_CALLABLE(N(AddPushVelocity)) { CollisionStatus* collisionStatus= &gCollisionStatus; Npc* partner; - if ((collisionStatus->currentFloor == floorA) || (collisionStatus->lastTouchedFloor == floorA) - || (collisionStatus->currentFloor == floorB) || (collisionStatus->lastTouchedFloor == floorB)) { - playerStatus->pushVelocity.x = velX; + if ((collisionStatus->curFloor == floorA) || (collisionStatus->lastTouchedFloor == floorA) + || (collisionStatus->curFloor == floorB) || (collisionStatus->lastTouchedFloor == floorB)) { + playerStatus->pushVel.x = velX; } - if (gPlayerData.currentPartner != PARTNER_NONE){ + if (gPlayerData.curPartner != PARTNER_NONE){ partner = get_npc_unsafe(NPC_PARTNER); - if ((partner->currentFloor == floorA) || (partner->currentFloor == floorB)) { + if ((partner->curFloor == floorA) || (partner->curFloor == floorB)) { partner->pos.x += velX; } } @@ -26,7 +26,7 @@ API_CALLABLE(N(GetCurrentFloor)) { Bytecode* args = script->ptrReadPos; s32 outVar = *args++; - evt_set_variable(script, outVar, gCollisionStatus.currentFloor); + evt_set_variable(script, outVar, gCollisionStatus.curFloor); return ApiStatus_DONE2; } diff --git a/src/world/area_kzn/kzn_11/kzn_11_3_npc.c b/src/world/area_kzn/kzn_11/kzn_11_3_npc.c index a383f4b2b4d..89bc69b3cd8 100644 --- a/src/world/area_kzn/kzn_11/kzn_11_3_npc.c +++ b/src/world/area_kzn/kzn_11/kzn_11_3_npc.c @@ -72,7 +72,7 @@ EvtScript N(EVS_FireBar_Defeated) = { FireBarAISettings N(AISettings_FireBar_01) = { .centerPos = { -300, 20, 15 }, - .rotationRate = 8, + .rotRate = 8, .firstNpc = NPC_FireBar_1A, .npcCount = 4, .callback = N(FireBarAI_Callback), @@ -80,7 +80,7 @@ FireBarAISettings N(AISettings_FireBar_01) = { FireBarAISettings N(AISettings_FireBar_02) = { .centerPos = { 0, 20, 15 }, - .rotationRate = -8, + .rotRate = -8, .firstNpc = NPC_FireBar_2A, .npcCount = 4, .callback = N(FireBarAI_Callback), @@ -88,7 +88,7 @@ FireBarAISettings N(AISettings_FireBar_02) = { FireBarAISettings N(AISettings_FireBar_03) = { .centerPos = { 325, 20, 15 }, - .rotationRate = -8, + .rotRate = -8, .firstNpc = NPC_FireBar_3A, .npcCount = 4, .callback = N(FireBarAI_Callback), diff --git a/src/world/area_kzn/kzn_20/kzn_20_3_npc.c b/src/world/area_kzn/kzn_20/kzn_20_3_npc.c index 73ad42efd15..1d56585b056 100644 --- a/src/world/area_kzn/kzn_20/kzn_20_3_npc.c +++ b/src/world/area_kzn/kzn_20/kzn_20_3_npc.c @@ -364,7 +364,7 @@ API_CALLABLE(N(GetFloorCollider)) { Bytecode* args = script->ptrReadPos; s32 outVar = *args++; - evt_set_variable(script, outVar, gCollisionStatus.currentFloor); + evt_set_variable(script, outVar, gCollisionStatus.curFloor); return ApiStatus_DONE2; } diff --git a/src/world/area_kzn/kzn_22/kzn_22_2_main.c b/src/world/area_kzn/kzn_22/kzn_22_2_main.c index 9ad55e09d36..f59f3d839a9 100644 --- a/src/world/area_kzn/kzn_22/kzn_22_2_main.c +++ b/src/world/area_kzn/kzn_22/kzn_22_2_main.c @@ -68,7 +68,7 @@ API_CALLABLE(N(GetFloorCollider1)) { Bytecode* args = script->ptrReadPos; s32 outVar = *args++; - evt_set_variable(script, outVar, gCollisionStatus.currentFloor); + evt_set_variable(script, outVar, gCollisionStatus.curFloor); return ApiStatus_DONE2; } diff --git a/src/world/area_kzn/kzn_22/kzn_22_4_npc.c b/src/world/area_kzn/kzn_22/kzn_22_4_npc.c index fbeaeaf96a1..bc84fa73bca 100644 --- a/src/world/area_kzn/kzn_22/kzn_22_4_npc.c +++ b/src/world/area_kzn/kzn_22/kzn_22_4_npc.c @@ -5,7 +5,7 @@ API_CALLABLE(N(GetFloorCollider2)) { Bytecode* args = script->ptrReadPos; s32 outVar = *args++; - evt_set_variable(script, outVar, gCollisionStatus.currentFloor); + evt_set_variable(script, outVar, gCollisionStatus.curFloor); return ApiStatus_DONE2; } diff --git a/src/world/area_kzn/kzn_23/kzn_23_3_npc.c b/src/world/area_kzn/kzn_23/kzn_23_3_npc.c index 202869500dd..837a4178cb4 100644 --- a/src/world/area_kzn/kzn_23/kzn_23_3_npc.c +++ b/src/world/area_kzn/kzn_23/kzn_23_3_npc.c @@ -11,9 +11,9 @@ API_CALLABLE(N(SetChestPosition)) { f32 z = evt_get_variable(script, *args++); Entity* entity = get_entity_by_index(entityIndex); - entity->position.x = x; - entity->position.y = y; - entity->position.z = z; + entity->pos.x = x; + entity->pos.y = y; + entity->pos.z = z; return ApiStatus_DONE2; } @@ -21,9 +21,9 @@ API_CALLABLE(N(GetChestPosition)) { Bytecode* args = script->ptrReadPos; Entity* entity = get_entity_by_index(evt_get_variable(script, *args++)); - evt_set_variable(script, *args++, entity->position.x); - evt_set_variable(script, *args++, entity->position.y); - evt_set_variable(script, *args++, entity->position.z); + evt_set_variable(script, *args++, entity->pos.x); + evt_set_variable(script, *args++, entity->pos.y); + evt_set_variable(script, *args++, entity->pos.z); return ApiStatus_DONE2; } @@ -59,7 +59,7 @@ API_CALLABLE(N(AnimateChestSize)) { entity->scale.y = script->functionTemp[1] / 60.0f; entity->scale.z = script->functionTemp[1] / 60.0f; - entity->rotation.y = (1.0f - cos_rad(entity->scale.y * PI)) * 990.0 / 2.0; + entity->rot.y = (1.0f - cos_rad(entity->scale.y * PI)) * 990.0 / 2.0; script->functionTemp[1]--; if (~script->functionTemp[1] == 0) { //TODO remove ~ optimization diff --git a/src/world/area_mac/mac_01/npc/post_office.inc.c b/src/world/area_mac/mac_01/npc/post_office.inc.c index be51277c8fe..059803f6df4 100644 --- a/src/world/area_mac/mac_01/npc/post_office.inc.c +++ b/src/world/area_mac/mac_01/npc/post_office.inc.c @@ -213,7 +213,7 @@ API_CALLABLE(N(func_8024522C_805AAC)) { } API_CALLABLE(N(func_80245440_805CC0)) { - if (gPlayerData.currentPartner == script->varTable[10]) { + if (gPlayerData.curPartner == script->varTable[10]) { script->varTable[1] = 0; return ApiStatus_DONE2; } diff --git a/src/world/area_mac/mac_01/npc/read_fortune.inc.c b/src/world/area_mac/mac_01/npc/read_fortune.inc.c index 4738d457453..945a45f77d8 100644 --- a/src/world/area_mac/mac_01/npc/read_fortune.inc.c +++ b/src/world/area_mac/mac_01/npc/read_fortune.inc.c @@ -100,7 +100,7 @@ API_CALLABLE(N(func_802443E0_804C60)) { temp_f24 = script->functionTemp[0] * 10; for (i = 0; i < ARRAY_COUNT(effects); i++) { - guRotateF(sp28, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(sp28, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); guRotateF(sp68, i * 120, 0.0f, 0.0f, 1.0f); guMtxCatF(sp68, sp28, sp28); tx = temp_f30 * sin_deg(temp_f24); diff --git a/src/world/area_mac/mac_01/npc/rowf_and_rhuff.inc.c b/src/world/area_mac/mac_01/npc/rowf_and_rhuff.inc.c index 447c4910de4..62d02920e57 100644 --- a/src/world/area_mac/mac_01/npc/rowf_and_rhuff.inc.c +++ b/src/world/area_mac/mac_01/npc/rowf_and_rhuff.inc.c @@ -27,10 +27,10 @@ API_CALLABLE(N(RhuffUnravelUpdate)) { script->varTable[5] = script->varTable[3] + (s32) ((initialPosX * sinTheta) + (initialPosY * cosTheta)); if (rugRotAngle == 0) { - npc->currentAnim = ANIM_Rowf_Idle; + npc->curAnim = ANIM_Rowf_Idle; enemy->flags &= ~ENEMY_FLAG_CANT_INTERACT; } else { - npc->currentAnim = ANIM_Rowf_Walk; + npc->curAnim = ANIM_Rowf_Walk; enemy->flags |= ENEMY_FLAG_CANT_INTERACT; } @@ -41,7 +41,7 @@ API_CALLABLE(N(RhuffUnravelUpdate)) { } if (rugRippleAmt != 0) { - npc->currentAnim = ANIM_Rowf_Think; + npc->curAnim = ANIM_Rowf_Think; } return ApiStatus_DONE2; } diff --git a/src/world/area_mac/mac_04/mac_04_8_entity.c b/src/world/area_mac/mac_04/mac_04_8_entity.c index 39579f74937..9908e272ddc 100644 --- a/src/world/area_mac/mac_04/mac_04_8_entity.c +++ b/src/world/area_mac/mac_04/mac_04_8_entity.c @@ -27,13 +27,13 @@ void N(render_shrunk_player)(void) { s32 screenX, screenY, screenZ; get_screen_coords(gCurrentCamID, - gPlayerStatus.position.x, gPlayerStatus.position.y, gPlayerStatus.position.z, + gPlayerStatus.pos.x, gPlayerStatus.pos.y, gPlayerStatus.pos.z, &screenX, &screenY, &screenZ); renderTask.appendGfxArg = &gPlayerStatus; renderTask.appendGfx = N(appendGfx_shrunk_player); renderTask.renderMode = gPlayerStatus.renderMode; - renderTask.distance = screenZ; + renderTask.dist = screenZ; queue_render_task(&renderTask); } @@ -47,7 +47,7 @@ void N(appendGfx_shrunk_player)(void* data) { guRotateF(transformMtx, playerStatus->spriteFacingAngle, 0.0f, 1.0f, 0.0f); guScaleF(tempMtx, shrinkScale * SPRITE_WORLD_SCALE_D, shrinkScale * SPRITE_WORLD_SCALE_D, shrinkScale * SPRITE_WORLD_SCALE_D); guMtxCatF(transformMtx, tempMtx, transformMtx); - guTranslateF(tempMtx, playerStatus->position.x, playerStatus->position.y, playerStatus->position.z); + guTranslateF(tempMtx, playerStatus->pos.x, playerStatus->pos.y, playerStatus->pos.z); guMtxCatF(transformMtx, tempMtx, transformMtx); playerStatus->animNotifyValue = spr_update_player_sprite(PLAYER_SPRITE_MAIN, playerStatus->trueAnimation, 1.0f); spr_draw_player_sprite(PLAYER_SPRITE_MAIN, 0, 0, NULL, transformMtx); diff --git a/src/world/area_mac/mac_05/mac_05_4_npc.c b/src/world/area_mac/mac_05/mac_05_4_npc.c index b8c49eb6610..d3969119da8 100644 --- a/src/world/area_mac/mac_05/mac_05_4_npc.c +++ b/src/world/area_mac/mac_05/mac_05_4_npc.c @@ -211,9 +211,9 @@ API_CALLABLE(N(func_80242C78_854DE8)) { switch (script->functionTemp[0]) { case 0: - gPlayerStatus.position.x = x; - gPlayerStatus.position.y = y; - gPlayerStatus.position.z = z; + gPlayerStatus.pos.x = x; + gPlayerStatus.pos.y = y; + gPlayerStatus.pos.z = z; npc0->colliderPos.x = npc0->pos.x; npc0->colliderPos.y = npc0->pos.y; npc0->colliderPos.z = npc0->pos.z; @@ -267,7 +267,7 @@ API_CALLABLE(N(func_80242E84_854FF4)) { switch (script->functionTemp[2]) { case 0: - npc->currentAnim = ANIM_Kolorado_Idle; + npc->curAnim = ANIM_Kolorado_Idle; npc->yaw -= 1.0f; npc->pos.x += 3.0f; script->functionTemp[1]--; @@ -1219,9 +1219,9 @@ API_CALLABLE(N(func_80243254_8553C4)) { return ApiStatus_DONE2; } - theta = clamp_angle(atan2(playerStatus->position.x, playerStatus->position.z, npc->pos.x, npc->pos.z)); - x = playerStatus->position.x + (sin_deg(theta) * 40.0f); - z = playerStatus->position.z - (cos_deg(theta) * 40.0f); + theta = clamp_angle(atan2(playerStatus->pos.x, playerStatus->pos.z, npc->pos.x, npc->pos.z)); + x = playerStatus->pos.x + (sin_deg(theta) * 40.0f); + z = playerStatus->pos.z - (cos_deg(theta) * 40.0f); evt_set_variable(script, outVar0, x); evt_set_variable(script, outVar1, z); return ApiStatus_DONE2; diff --git a/src/world/area_mac/mac_06/mac_06_3_npc.c b/src/world/area_mac/mac_06/mac_06_3_npc.c index 804f5040ad0..262b1fad48e 100644 --- a/src/world/area_mac/mac_06/mac_06_3_npc.c +++ b/src/world/area_mac/mac_06/mac_06_3_npc.c @@ -59,9 +59,9 @@ API_CALLABLE(N(func_80240E80_8659C0)) { switch (script->functionTemp[0]) { case 0: - gPlayerStatus.position.x = x; - gPlayerStatus.position.y = y + D_80243434_867F74; - gPlayerStatus.position.z = z; + gPlayerStatus.pos.x = x; + gPlayerStatus.pos.y = y + D_80243434_867F74; + gPlayerStatus.pos.z = z; whale->colliderPos.x = whale->pos.x; whale->colliderPos.y = whale->pos.y; whale->colliderPos.z = whale->pos.z; @@ -112,7 +112,7 @@ API_CALLABLE(N(func_80241098_865BD8)) { break; case 10: - npc->currentAnim = ANIM_Kolorado_Shout; + npc->curAnim = ANIM_Kolorado_Shout; D_80243434_867F74 = 0.0f; D_80243438_867F78 = 5.0f; D_8024343C_867F7C = 11; @@ -128,7 +128,7 @@ API_CALLABLE(N(func_80241098_865BD8)) { } else { D_80243438_867F78 -= 2.0f; } - if (npc->currentAnim == ANIM_Kolorado_Idle) { + if (npc->curAnim == ANIM_Kolorado_Idle) { D_80243438_867F78 = 4.0f; D_8024343C_867F7C++; } diff --git a/src/world/area_mgm/mgm_00/mgm_00_3_scoreboard.c b/src/world/area_mgm/mgm_00/mgm_00_3_scoreboard.c index 27f28c7a959..399c7a91b78 100644 --- a/src/world/area_mgm/mgm_00/mgm_00_3_scoreboard.c +++ b/src/world/area_mgm/mgm_00/mgm_00_3_scoreboard.c @@ -124,7 +124,7 @@ void N(animate_and_draw_record)(void* renderData) { case RECORD_STATE_VISIBLE: data->alpha = 255; data->curAlpha = 255; - if (gGameStatusPtr->currentButtons[0] & (BUTTON_A | BUTTON_B)) { + if (gGameStatusPtr->curButtons[0] & (BUTTON_A | BUTTON_B)) { data->state = RECORD_START_HIDE; } if (data->state != RECORD_START_HIDE) { @@ -153,7 +153,7 @@ void N(work_draw_record)(void) { task.renderMode = RENDER_MODE_2D; task.appendGfxArg = 0; task.appendGfx = &N(animate_and_draw_record); - task.distance = 0; + task.dist = 0; queue_render_task(&task); } diff --git a/src/world/area_mgm/mgm_01/mgm_01_1_main.c b/src/world/area_mgm/mgm_01/mgm_01_1_main.c index fc165ae60fd..5aa3c1b68a3 100644 --- a/src/world/area_mgm/mgm_01/mgm_01_1_main.c +++ b/src/world/area_mgm/mgm_01/mgm_01_1_main.c @@ -5,14 +5,14 @@ API_CALLABLE(N(GetSpotlightPos)) { f32 spotLightPosX, spotLightPosZ; f32 lightBeamRotX, lightBeamRotZ; - spotLightPosX = gPlayerStatusPtr->position.x; + spotLightPosX = gPlayerStatusPtr->pos.x; if (spotLightPosX < -95.0) { spotLightPosX = -95.0; } if (spotLightPosX > 95.0) { spotLightPosX = 95.0; } - spotLightPosZ = gPlayerStatusPtr->position.z; + spotLightPosZ = gPlayerStatusPtr->pos.z; if (spotLightPosZ < -80.0) { spotLightPosZ = -80.0; } @@ -29,9 +29,9 @@ API_CALLABLE(N(GetSpotlightPos)) { evt_set_float_variable(script, LVar3, lightBeamRotZ); shading = gSpriteShadingProfile; - shading->sources[0].pos.x = gPlayerStatusPtr->position.x * 0.8; + shading->sources[0].pos.x = gPlayerStatusPtr->pos.x * 0.8; shading->sources[0].pos.y = 80.0f; - shading->sources[0].pos.z = gPlayerStatusPtr->position.z + 50.0f; + shading->sources[0].pos.z = gPlayerStatusPtr->pos.z + 50.0f; return ApiStatus_DONE2; } diff --git a/src/world/area_mgm/mgm_01/mgm_01_2_npc.c b/src/world/area_mgm/mgm_01/mgm_01_2_npc.c index 9f70878044f..972c092cc9a 100644 --- a/src/world/area_mgm/mgm_01/mgm_01_2_npc.c +++ b/src/world/area_mgm/mgm_01/mgm_01_2_npc.c @@ -56,7 +56,7 @@ typedef struct JumpGameData { /* 0x000 */ s32 workerID; /* 0x004 */ s32 hudElemID; /* 0x008 */ s32 unk_08; // unused -- likely hudElemID for an unused/removed hud element - /* 0x00C */ s32 currentScore; + /* 0x00C */ s32 curScore; /* 0x010 */ s32 targetScore; /* 0x014 */ s32 scoreWindowPosX; /* 0x018 */ s32 scoreWindowPosY; // unused -- posY is hard-coded while drawing the box @@ -122,31 +122,31 @@ void N(appendGfx_score_display) (void* renderData) { hudElemID = data->hudElemID; hud_element_set_render_pos(hudElemID, data->scoreWindowPosX + 15, 39); hud_element_draw_clipped(hudElemID); - if (data->currentScore > data->targetScore) { - data->currentScore = data->targetScore; - } else if (data->currentScore < data->targetScore) { - diff = data->targetScore - data->currentScore; + if (data->curScore > data->targetScore) { + data->curScore = data->targetScore; + } else if (data->curScore < data->targetScore) { + diff = data->targetScore - data->curScore; if (diff > 100) { - data->currentScore += 40; + data->curScore += 40; } else if (diff > 75) { - data->currentScore += 35; + data->curScore += 35; } else if (diff > 50) { - data->currentScore += 30; + data->curScore += 30; } else if (diff > 30) { - data->currentScore += 20; + data->curScore += 20; } else if (diff > 20) { - data->currentScore += 10; + data->curScore += 10; } else if (diff > 10) { - data->currentScore += 5; + data->curScore += 5; } else if (diff > 5) { - data->currentScore += 2; + data->curScore += 2; } else { - data->currentScore++; + data->curScore++; } sfx_play_sound_with_params(SOUND_211, 0, 0x40, 0x32); } - draw_number(data->currentScore, data->scoreWindowPosX + 63, 32, DRAW_NUMBER_CHARSET_THIN, MSG_PAL_WHITE, 255, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); + draw_number(data->curScore, data->scoreWindowPosX + 63, 32, DRAW_NUMBER_CHARSET_THIN, MSG_PAL_WHITE, 255, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); } } @@ -156,7 +156,7 @@ void N(worker_draw_score)(void) { task.renderMode = RENDER_MODE_2D; task.appendGfxArg = 0; task.appendGfx = &mgm_01_appendGfx_score_display; - task.distance = 0; + task.dist = 0; queue_render_task(&task); } @@ -377,21 +377,21 @@ API_CALLABLE(N(UpdateRecords)) { JumpGameData* data = (JumpGameData*)get_enemy(SCOREKEEPER_ENEMY_IDX)->varTable[JUMP_DATA_VAR_IDX]; PlayerData* player = &gPlayerData; - player->jumpGameTotal += data->currentScore; + player->jumpGameTotal += data->curScore; if (player->jumpGameTotal > 99999) { player->jumpGameTotal = 99999; } - if (player->jumpGameRecord < data->currentScore) { - player->jumpGameRecord = data->currentScore; + if (player->jumpGameRecord < data->curScore) { + player->jumpGameRecord = data->curScore; } - set_message_value(data->currentScore, 0); + set_message_value(data->curScore, 0); return ApiStatus_DONE2; } API_CALLABLE(N(GiveCoinReward)) { JumpGameData* data = (JumpGameData*)get_enemy(SCOREKEEPER_ENEMY_IDX)->varTable[JUMP_DATA_VAR_IDX]; - s32 coinsLeft = data->currentScore; + s32 coinsLeft = data->curScore; s32 increment; if (coinsLeft > 100) { @@ -410,12 +410,12 @@ API_CALLABLE(N(GiveCoinReward)) { increment = 1; } - data->currentScore -= increment; + data->curScore -= increment; add_coins(increment); - data->targetScore = data->currentScore; + data->targetScore = data->curScore; sfx_play_sound(SOUND_211); - if (data->currentScore > 0) { + if (data->curScore > 0) { return ApiStatus_BLOCK; } else { return ApiStatus_DONE2; @@ -424,8 +424,8 @@ API_CALLABLE(N(GiveCoinReward)) { API_CALLABLE(N(DoubleScore)) { JumpGameData* data = (JumpGameData*)get_enemy(SCOREKEEPER_ENEMY_IDX)->varTable[JUMP_DATA_VAR_IDX]; - s32 score = 2 * data->currentScore; - data->currentScore = score; + s32 score = 2 * data->curScore; + data->curScore = score; data->targetScore = score; return ApiStatus_DONE2; @@ -608,7 +608,7 @@ API_CALLABLE(N(InitializePanels)) { JumpGameData* data = get_enemy(SCOREKEEPER_ENEMY_IDX)->varTablePtr[JUMP_DATA_VAR_IDX]; s32 i; - data->currentScore = 0; + data->curScore = 0; data->targetScore = 0; for (i = 0; i < ARRAY_COUNT(data->panels); i++) { diff --git a/src/world/area_mgm/mgm_02/mgm_02_2_npc.c b/src/world/area_mgm/mgm_02/mgm_02_2_npc.c index 793de948890..69065222c10 100644 --- a/src/world/area_mgm/mgm_02/mgm_02_2_npc.c +++ b/src/world/area_mgm/mgm_02/mgm_02_2_npc.c @@ -106,7 +106,7 @@ typedef struct SmashGameData { /* 0x014 */ s32 windowA_posX; /* 0x018 */ s32 windowB_posX; /* 0x01C */ s32 signpostEntity; - /* 0x020 */ s32 currentScore; + /* 0x020 */ s32 curScore; /* 0x024 */ s32 mashProgress; /* 0x028 */ SmashGameStunFlags stunFlags; /* 0x02C */ SmashGameBoxData box[NUM_BOXES]; @@ -197,7 +197,7 @@ void N(worker_draw_score)(void) { task.renderMode = RENDER_MODE_2D; task.appendGfxArg = 0; task.appendGfx = &N(appendGfx_score_display); - task.distance = 0; + task.dist = 0; queue_render_task(&task); } @@ -304,7 +304,7 @@ API_CALLABLE(N(SetBoxContents)) { SmashGameData* data = get_enemy(SCOREKEEPER_ENEMY_IDX)->varTablePtr[SMASH_DATA_VAR_IDX]; data->found = 0; data->timeLeft = PLAY_TIME + 10; - data->currentScore = 0; + data->curScore = 0; data->mashProgress = 0; data->stunFlags = 0; @@ -455,11 +455,11 @@ API_CALLABLE(N(RunMinigame)) { case BOX_STATE_FUZZY_IDLE: data->box[i].stateTimer--; if (data->box[i].stateTimer <= 0) { - npc->currentAnim = ANIM_Fuzzy_Walk; + npc->curAnim = ANIM_Fuzzy_Walk; data->box[i].state = BOX_STATE_FUZZY_POPUP; sfx_play_sound_at_position(enemy->varTable[8], SOUND_SPACE_MODE_0 | SOUND_PARAM_MOST_QUIET, npc->pos.x, npc->pos.y, npc->pos.z); get_model_center_and_size(data->box[i].modelID, ¢erX, ¢erY, ¢erZ, &sizeX, &sizeY, &sizeZ); - npc->jumpVelocity = 10.5f; + npc->jumpVel = 10.5f; npc->pos.x = centerX; npc->jumpScale = 1.5f; npc->pos.y = centerY - 12.5; @@ -470,14 +470,14 @@ API_CALLABLE(N(RunMinigame)) { break; case BOX_STATE_FUZZY_POPUP: data->box[i].stateTimer++; - npc->pos.y += npc->jumpVelocity; - npc->jumpVelocity -= npc->jumpScale; + npc->pos.y += npc->jumpVel; + npc->jumpVel -= npc->jumpScale; if ((npc->moveToPos.y + 20.0f) < npc->pos.y) { enable_npc_shadow(npc); } else { disable_npc_shadow(npc); } - if ((npc->jumpVelocity < 0.0) && (npc->pos.y <= npc->moveToPos.y)) { + if ((npc->jumpVel < 0.0) && (npc->pos.y <= npc->moveToPos.y)) { data->box[i].state = BOX_STATE_FUZZY_IDLE; data->box[i].stateTimer = rand_int(330) + 90; npc->pos.y = NPC_DISPOSE_POS_Y; @@ -501,13 +501,13 @@ API_CALLABLE(N(RunMinigame)) { sfx_play_sound(enemy->varTable[8]); data->box[i].state = BOX_STATE_FUZZY_ATTACH; gPlayerStatusPtr->anim = ANIM_Mario1_TiredStill; - npc->currentAnim = ANIM_Fuzzy_Run; + npc->curAnim = ANIM_Fuzzy_Run; get_model_center_and_size(data->box[i].modelID, ¢erX, ¢erY, ¢erZ, &sizeX, &sizeY, &sizeZ); npc->pos.x = centerX; npc->pos.y = centerY; npc->pos.z = centerZ + 2.0; - npc->moveToPos.y = gPlayerStatusPtr->position.y + 35.0f; - npc->jumpVelocity = 10.5f; + npc->moveToPos.y = gPlayerStatusPtr->pos.y + 35.0f; + npc->jumpVel = 10.5f; npc->jumpScale = 1.5f; data->box[i].stateTimer = 0; @@ -515,9 +515,9 @@ API_CALLABLE(N(RunMinigame)) { enemy->varTable[1] = npc->pos.x * 10.0f; enemy->varTable[2] = npc->pos.y * 10.0f; enemy->varTable[3] = npc->pos.z * 10.0f; - enemy->varTable[4] = gPlayerStatusPtr->position.x * 10.0f; - enemy->varTable[5] = (gPlayerStatusPtr->position.y + 28.0f) * 10.0f; - enemy->varTable[6] = (gPlayerStatusPtr->position.z + 2.0f) * 10.0f; + enemy->varTable[4] = gPlayerStatusPtr->pos.x * 10.0f; + enemy->varTable[5] = (gPlayerStatusPtr->pos.y + 28.0f) * 10.0f; + enemy->varTable[6] = (gPlayerStatusPtr->pos.z + 2.0f) * 10.0f; enemy->varTable[7] = 0; break; case BOX_STATE_FUZZY_ATTACH: @@ -528,12 +528,12 @@ API_CALLABLE(N(RunMinigame)) { gPlayerStatusPtr->anim = ANIM_Mario1_TiredStill; npc->duration--; if (npc->duration <= 0) { - npc->currentAnim = ANIM_Fuzzy_Stunned; + npc->curAnim = ANIM_Fuzzy_Stunned; gPlayerStatusPtr->anim = ANIM_Mario1_PanicRun; data->mashProgress = 0; - npc->pos.x = gPlayerStatusPtr->position.x; - npc->pos.y = gPlayerStatusPtr->position.y + 28.0; - npc->pos.z = gPlayerStatusPtr->position.z + 2.0; + npc->pos.x = gPlayerStatusPtr->pos.x; + npc->pos.y = gPlayerStatusPtr->pos.y + 28.0; + npc->pos.z = gPlayerStatusPtr->pos.z + 2.0; hud_element_set_script(data->hudElemID_AButton, &HES_MashAButton); hud_element_set_alpha(data->hudElemID_AButton, 255); hud_element_set_alpha(data->hudElemID_Meter, 255); @@ -554,7 +554,7 @@ API_CALLABLE(N(RunMinigame)) { hud_element_set_script(data->hudElemID_AButton, &HES_AButton); hud_element_set_alpha(data->hudElemID_AButton, 160); hud_element_set_alpha(data->hudElemID_Meter, 160); - npc->currentAnim = ANIM_Fuzzy_Hurt; + npc->curAnim = ANIM_Fuzzy_Hurt; npc->pos.y += 3.0; } break; @@ -586,7 +586,7 @@ API_CALLABLE(N(RunMinigame)) { data->box[i].state = BOX_STATE_BOMB_POPUP; sfx_play_sound_at_position(enemy->varTable[8], 0x100000, npc->pos.x, npc->pos.y, npc->pos.z); get_model_center_and_size(data->box[i].modelID, ¢erX, ¢erY, ¢erZ, &sizeX, &sizeY, &sizeZ); - npc->jumpVelocity = 10.5f; + npc->jumpVel = 10.5f; npc->pos.x = centerX; npc->jumpScale = 1.5f; npc->pos.y = centerY - 12.5; @@ -597,14 +597,14 @@ API_CALLABLE(N(RunMinigame)) { break; case BOX_STATE_BOMB_POPUP: data->box[i].stateTimer++; - npc->pos.y += npc->jumpVelocity; - npc->jumpVelocity -= npc->jumpScale; + npc->pos.y += npc->jumpVel; + npc->jumpVel -= npc->jumpScale; if ((npc->moveToPos.y + 20.0f) < npc->pos.y) { enable_npc_shadow(npc); } else { disable_npc_shadow(npc); } - if ((npc->jumpVelocity < 0.0) && (npc->pos.y <= npc->moveToPos.y)) { + if ((npc->jumpVel < 0.0) && (npc->pos.y <= npc->moveToPos.y)) { data->box[i].state = BOX_STATE_BOMB_IDLE; data->box[i].stateTimer = rand_int(330) + 90; npc->pos.y = NPC_DISPOSE_POS_Y; @@ -619,7 +619,7 @@ API_CALLABLE(N(RunMinigame)) { case BOX_STATE_BOMB_HIT: enable_npc_shadow(npc); npc->duration = 15; - npc->currentAnim = ANIM_Bobomb_WalkLit; + npc->curAnim = ANIM_Bobomb_WalkLit; data->stunFlags |= (STUN_FLAG_STUNNED | STUN_FLAG_CHANGED); data->box[i].state = BOX_STATE_BOMB_ATTACK; get_model_center_and_size(data->box[i].modelID, ¢erX, ¢erY, ¢erZ, &sizeX, &sizeY, &sizeZ); @@ -627,7 +627,7 @@ API_CALLABLE(N(RunMinigame)) { npc->pos.y = centerY - 10.0f; npc->pos.z = centerZ + 8.0; fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, 0.0f, 10, &writeback); - if (npc->pos.x > gPlayerStatusPtr->position.x) { + if (npc->pos.x > gPlayerStatusPtr->pos.x) { npc->yaw = 270.0f; gPlayerStatusPtr->targetYaw = 95.0f; } else { @@ -690,7 +690,7 @@ API_CALLABLE(N(RunMinigame)) { data->box[i].state = BOX_STATE_PEACH_POPUP; sfx_play_sound_at_position(SOUND_214, SOUND_PARAM_MORE_QUIET | SOUND_SPACE_MODE_0, npc->pos.x, npc->pos.y, npc->pos.z); get_model_center_and_size(data->box[i].modelID, ¢erX, ¢erY, ¢erZ, &sizeX, &sizeY, &sizeZ); - npc->jumpVelocity = 10.0f; + npc->jumpVel = 10.0f; npc->pos.y = npc->moveToPos.y; npc->jumpScale = 1.1f; data->box[i].stateTimer = 0; @@ -708,8 +708,8 @@ API_CALLABLE(N(RunMinigame)) { break; case BOX_STATE_PEACH_POPUP: data->box[i].stateTimer++; - npc->pos.y += npc->jumpVelocity; - npc->jumpVelocity -= npc->jumpScale; + npc->pos.y += npc->jumpVel; + npc->jumpVel -= npc->jumpScale; model = get_model_from_list_index(get_model_list_index_from_tree_index(data->box[i].peachPanelModelID)); if (!(model->flags & MODEL_FLAG_HAS_TRANSFORM)) { guTranslateF(model->userTransformMtx, npc->pos.x, npc->pos.y, npc->pos.z); @@ -723,7 +723,7 @@ API_CALLABLE(N(RunMinigame)) { } else { disable_npc_shadow(npc); } - if ((npc->jumpVelocity < 0.0) && (npc->pos.y <= npc->moveToPos.y)) { + if ((npc->jumpVel < 0.0) && (npc->pos.y <= npc->moveToPos.y)) { data->box[i].state = BOX_STATE_PEACH_IDLE; data->box[i].stateTimer = rand_int(330) + 90; disable_npc_shadow(npc); @@ -855,22 +855,22 @@ API_CALLABLE(N(UpdateRecords)) { seconds = data->timeLeft / FRAME_RATE; deciseconds = ((f32)(data->timeLeft % FRAME_RATE) * 10.0) / FRAME_RATE; - data->currentScore = (seconds * 10) + deciseconds; - playerData->smashGameTotal += data->currentScore; + data->curScore = (seconds * 10) + deciseconds; + playerData->smashGameTotal += data->curScore; if (playerData->smashGameTotal > 99999) { playerData->smashGameTotal = 99999; } - if (playerData->smashGameRecord < data->currentScore) { - playerData->smashGameRecord = data->currentScore; + if (playerData->smashGameRecord < data->curScore) { + playerData->smashGameRecord = data->curScore; } set_message_value(seconds, 0); set_message_value(deciseconds, 1); - set_message_value(data->currentScore, 2); + set_message_value(data->curScore, 2); - outScore = data->currentScore; - if (data->currentScore == 0 && data->found == NUM_PANELS) { + outScore = data->curScore; + if (data->curScore == 0 && data->found == NUM_PANELS) { outScore = -1; } evt_set_variable(script, LVar0, outScore); @@ -880,7 +880,7 @@ API_CALLABLE(N(UpdateRecords)) { API_CALLABLE(N(GiveCoinReward)) { SmashGameData* data = get_enemy(SCOREKEEPER_ENEMY_IDX)->varTablePtr[SMASH_DATA_VAR_IDX]; - s32 coinsLeft = data->currentScore; + s32 coinsLeft = data->curScore; s32 increment; if (coinsLeft > 100) { @@ -899,11 +899,11 @@ API_CALLABLE(N(GiveCoinReward)) { increment = 1; } - data->currentScore -= increment; + data->curScore -= increment; add_coins(increment); sfx_play_sound(SOUND_211); - return (data->currentScore > 0) ? ApiStatus_BLOCK : ApiStatus_DONE2; + return (data->curScore > 0) ? ApiStatus_BLOCK : ApiStatus_DONE2; } API_CALLABLE(N(CleanupGame)) { @@ -951,7 +951,7 @@ API_CALLABLE(N(CleanupGame)) { if (data->box[i].state != BOX_STATE_FUZZY_END) { data->box[i].state = BOX_STATE_FUZZY_END; fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, 0.0f, 30, &writeback); - npc->currentAnim = ANIM_Fuzzy_Sleep; + npc->curAnim = ANIM_Fuzzy_Sleep; enable_npc_shadow(npc); } break; @@ -960,7 +960,7 @@ API_CALLABLE(N(CleanupGame)) { if (data->box[i].state != BOX_STATE_BOMB_END) { data->box[i].state = BOX_STATE_BOMB_END; fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, 0.0f, 30, &writeback); - npc->currentAnim = ANIM_Bobomb_Dizzy; + npc->curAnim = ANIM_Bobomb_Dizzy; enable_npc_shadow(npc); } break; diff --git a/src/world/area_mim/mim_10/mim_10_4_npc.c b/src/world/area_mim/mim_10/mim_10_4_npc.c index bb316ec5da7..6930978372c 100644 --- a/src/world/area_mim/mim_10/mim_10_4_npc.c +++ b/src/world/area_mim/mim_10/mim_10_4_npc.c @@ -2,7 +2,7 @@ #include "sprite/player.h" API_CALLABLE(N(AwaitPlayerApproachForest)) { - if (gPlayerStatus.position.x < 100.0f) { + if (gPlayerStatus.pos.x < 100.0f) { return ApiStatus_BLOCK; } else { return ApiStatus_DONE2; diff --git a/src/world/area_nok/nok_01/nok_01_4_npc.c b/src/world/area_nok/nok_01/nok_01_4_npc.c index 63aba7c35a5..34914ce4ffa 100644 --- a/src/world/area_nok/nok_01/nok_01_4_npc.c +++ b/src/world/area_nok/nok_01/nok_01_4_npc.c @@ -93,7 +93,7 @@ API_CALLABLE(N(IsNpcFacingRight)) { s32 npcID = evt_get_variable(script, *args++); s32 outVar = *args++; Npc* npc = get_npc_safe(npcID); - f32 angle = clamp_angle((npc->yaw + 180.0f) - gCameras[gCurrentCameraID].currentYaw); + f32 angle = clamp_angle((npc->yaw + 180.0f) - gCameras[gCurrentCameraID].curYaw); s32 outVal; outVal = FALSE; diff --git a/src/world/area_nok/nok_02/nok_02_7_demo.c b/src/world/area_nok/nok_02/nok_02_7_demo.c index c2bd404179c..9392639b01a 100644 --- a/src/world/area_nok/nok_02/nok_02_7_demo.c +++ b/src/world/area_nok/nok_02/nok_02_7_demo.c @@ -164,11 +164,11 @@ API_CALLABLE(N(SetupDemoScene)) { break; case 3: partner_clear_player_tracking(wPartnerNpc); - partner_set_goal_pos(playerStatus->position.x, playerStatus->position.z); + partner_set_goal_pos(playerStatus->pos.x, playerStatus->pos.z); func_800EF3D4(0); set_npc_yaw(wPartnerNpc, 90.0f); playerStatus->targetYaw = 90.0f; - playerStatus->currentYaw = 90.0f; + playerStatus->curYaw = 90.0f; playerStatus->spriteFacingAngle = 0.0f; return ApiStatus_DONE2; } diff --git a/src/world/area_nok/nok_02/npcs_crisis.inc.c b/src/world/area_nok/nok_02/npcs_crisis.inc.c index b6d8909a33d..15617a2f8e6 100644 --- a/src/world/area_nok/nok_02/npcs_crisis.inc.c +++ b/src/world/area_nok/nok_02/npcs_crisis.inc.c @@ -21,7 +21,7 @@ API_CALLABLE(N(IsPlayerOrKoopaNearby)) { s32 outVal = FALSE; f32 xDiff, zDiff; - if (playerStatus->currentSpeed >= 4.0f) { + if (playerStatus->curSpeed >= 4.0f) { script->varTable[2]++; if (script->varTable[2] > 2) { script->varTable[2] = 2; @@ -31,8 +31,8 @@ API_CALLABLE(N(IsPlayerOrKoopaNearby)) { } do { - xDiff = fuzzyNpc->pos.x - playerStatus->position.x; - zDiff = fuzzyNpc->pos.z - playerStatus->position.z; + xDiff = fuzzyNpc->pos.x - playerStatus->pos.x; + zDiff = fuzzyNpc->pos.z - playerStatus->pos.z; if ((SQ(xDiff) + SQ(zDiff) < SQ(80.0f)) && (script->varTable[2] >= 2)) { do { outVal = TRUE; @@ -53,7 +53,7 @@ API_CALLABLE(N(IsPlayerOrKoopaNearby)) { API_CALLABLE(N(IsPlayerWalking)) { PlayerStatus* playerStatus = &gPlayerStatus; - if (playerStatus->currentSpeed >= 4.0f) { + if (playerStatus->curSpeed >= 4.0f) { script->varTable[2]++; if (script->varTable[2] > 2) { script->varTable[2] = 2; @@ -66,7 +66,7 @@ API_CALLABLE(N(IsPlayerWalking)) { if (script->varTable[2] >= 2) { script->varTable[0] = FALSE; } - if (playerStatus->currentSpeed == 0.0f) { + if (playerStatus->curSpeed == 0.0f) { script->varTable[0] = FALSE; } @@ -93,8 +93,8 @@ API_CALLABLE(N(ChooseSafeJumpLocation)) { xDiff = x - -150.0f; zDiff = z - 250.0f; if (SQ(xDiff) + SQ(zDiff) < SQ(150.0f)) { - xDiff = x - playerStatus->position.x; - zDiff = z - playerStatus->position.z; + xDiff = x - playerStatus->pos.x; + zDiff = z - playerStatus->pos.z; if (SQ(xDiff) + SQ(zDiff) > SQ(80.0f)) { xDiff = x - koopaNpc->pos.x; zDiff = z - koopaNpc->pos.z; @@ -140,8 +140,8 @@ API_CALLABLE(N(ChooseLocationNotNearPlayer)) { xDiff = x - -150.0f; zDiff = z - 250.0f; if (SQ(xDiff) + SQ(zDiff) < SQ(150.0f)) { - xDiff = x - playerStatus->position.x; - zDiff = z - playerStatus->position.z; + xDiff = x - playerStatus->pos.x; + zDiff = z - playerStatus->pos.z; if (SQ(xDiff) + SQ(zDiff) > SQ(80.0f)) { break; } diff --git a/src/world/area_nok/nok_04/nok_04_4_npc.c b/src/world/area_nok/nok_04/nok_04_4_npc.c index ab0cb73a33d..8ecbcd74212 100644 --- a/src/world/area_nok/nok_04/nok_04_4_npc.c +++ b/src/world/area_nok/nok_04/nok_04_4_npc.c @@ -8,11 +8,11 @@ typedef struct FuzzyThread { /* 0x00 */ Vec3f anchorPos; /* 0x0C */ f32 targetLength; - /* 0x10 */ f32 currentLength; + /* 0x10 */ f32 curLength; /* 0x14 */ f32 overshootVel; /* 0x18 */ f32 targetAngle; /* 0x1C */ f32 overshootAngleVel; - /* 0x20 */ f32 currentAngle; + /* 0x20 */ f32 curAngle; /* 0x24 */ Vec3f endPoint; /* 0x30 */ f32 duration; /* 0x34 */ f32 time; @@ -136,13 +136,13 @@ API_CALLABLE(N(SetThreadTargetLengthAngle)) { N(ThreadData).time = 0.0f; if (0.0f < N(ThreadData).duration) { - N(ThreadData).lengthStep = (N(ThreadData).targetLength - N(ThreadData).currentLength) / N(ThreadData).duration; - N(ThreadData).angleStep = (N(ThreadData).targetAngle - N(ThreadData).currentAngle) / N(ThreadData).duration; + N(ThreadData).lengthStep = (N(ThreadData).targetLength - N(ThreadData).curLength) / N(ThreadData).duration; + N(ThreadData).angleStep = (N(ThreadData).targetAngle - N(ThreadData).curAngle) / N(ThreadData).duration; } if (N(ThreadData).duration < 0.0f) { - N(ThreadData).currentLength = N(ThreadData).targetLength; - N(ThreadData).currentAngle = N(ThreadData).targetAngle; + N(ThreadData).curLength = N(ThreadData).targetLength; + N(ThreadData).curAngle = N(ThreadData).targetAngle; N(ThreadData).duration = 0.0f; } @@ -153,11 +153,11 @@ API_CALLABLE(N(InitThreadData)) { N(ThreadData).anchorPos.x = 0; N(ThreadData).anchorPos.y = 0; N(ThreadData).anchorPos.z = 0; - N(ThreadData).currentLength = 0; + N(ThreadData).curLength = 0; N(ThreadData).targetLength = 0; N(ThreadData).overshootVel = 0; N(ThreadData).targetAngle = 0; - N(ThreadData).currentAngle = 0; + N(ThreadData).curAngle = 0; N(ThreadData).overshootAngleVel = 0; N(ThreadData).frontNpc = NULL; N(ThreadData).backNpc = NULL; @@ -271,24 +271,24 @@ void N(build_gfx_thread)(void) { N(ThreadData).overshootVel += 0.2; if (N(ThreadData).duration != 0.0f) { // thread extension/retraction - N(ThreadData).currentLength += N(ThreadData).lengthStep; - if (N(ThreadData).currentLength > N(ThreadData).targetLength) { - N(ThreadData).overshootVel += (N(ThreadData).targetLength - N(ThreadData).currentLength) * 0.5f; + N(ThreadData).curLength += N(ThreadData).lengthStep; + if (N(ThreadData).curLength > N(ThreadData).targetLength) { + N(ThreadData).overshootVel += (N(ThreadData).targetLength - N(ThreadData).curLength) * 0.5f; } N(ThreadData).time += 1.0f; - N(ThreadData).overshootAngleVel = (N(ThreadData).overshootAngleVel + (N(ThreadData).targetAngle - N(ThreadData).currentAngle) / 10.0f) * 0.92; - N(ThreadData).currentAngle += N(ThreadData).angleStep; + N(ThreadData).overshootAngleVel = (N(ThreadData).overshootAngleVel + (N(ThreadData).targetAngle - N(ThreadData).curAngle) / 10.0f) * 0.92; + N(ThreadData).curAngle += N(ThreadData).angleStep; if (N(ThreadData).duration <= N(ThreadData).time) { N(ThreadData).duration = 0.0f; } } else { // thread overshoot - N(ThreadData).currentLength += N(ThreadData).overshootVel; - if (N(ThreadData).targetLength < N(ThreadData).currentLength) { - N(ThreadData).overshootVel += (N(ThreadData).targetLength - N(ThreadData).currentLength) * 0.5f; + N(ThreadData).curLength += N(ThreadData).overshootVel; + if (N(ThreadData).targetLength < N(ThreadData).curLength) { + N(ThreadData).overshootVel += (N(ThreadData).targetLength - N(ThreadData).curLength) * 0.5f; } - N(ThreadData).overshootAngleVel = (N(ThreadData).overshootAngleVel + (N(ThreadData).targetAngle - N(ThreadData).currentAngle) / 10.0f) * 0.92; - N(ThreadData).currentAngle += N(ThreadData).overshootAngleVel; + N(ThreadData).overshootAngleVel = (N(ThreadData).overshootAngleVel + (N(ThreadData).targetAngle - N(ThreadData).curAngle) / 10.0f) * 0.92; + N(ThreadData).curAngle += N(ThreadData).overshootAngleVel; } N(ThreadData).overshootVel *= 0.5; @@ -296,19 +296,19 @@ void N(build_gfx_thread)(void) { guTranslate(&gDisplayContext->matrixStack[gMatrixListPos], N(ThreadData).anchorPos.x, N(ThreadData).anchorPos.y, N(ThreadData).anchorPos.z); gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - segAngle = N(ThreadData).currentAngle; - segLength = -N(ThreadData).currentLength; - x += -segLength * sin_rad(N(ThreadData).currentAngle * 0 / 180.0f * PI); - y += segLength * cos_rad(N(ThreadData).currentAngle * 0 / 180.0f * PI); + segAngle = N(ThreadData).curAngle; + segLength = -N(ThreadData).curLength; + x += -segLength * sin_rad(N(ThreadData).curAngle * 0 / 180.0f * PI); + y += segLength * cos_rad(N(ThreadData).curAngle * 0 / 180.0f * PI); guPosition(&gDisplayContext->matrixStack[gMatrixListPos], 0.0f, 0.0f, segAngle, 1.0f, 0.0f, segLength, 0.0f); gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); for (i = 1; i < NUM_THREAD_SEGMENTS; i++) { - segAngle = N(ThreadData).currentAngle; - segLength = -N(ThreadData).currentLength; - x += -segLength * sin_rad(N(ThreadData).currentAngle * i / 180.0f * PI); - y += segLength * cos_rad(N(ThreadData).currentAngle * i / 180.0f * PI); + segAngle = N(ThreadData).curAngle; + segLength = -N(ThreadData).curLength; + x += -segLength * sin_rad(N(ThreadData).curAngle * i / 180.0f * PI); + y += segLength * cos_rad(N(ThreadData).curAngle * i / 180.0f * PI); gSPVertex(gMainGfxPos++, N(ThreadSegmentVertices), 2, 0); guPosition(&gDisplayContext->matrixStack[gMatrixListPos], 0.0f, 0.0f, segAngle, 1.0f, 0.0f, segLength, 0.0f); gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); diff --git a/src/world/area_nok/nok_12/nok_12_2_main.c b/src/world/area_nok/nok_12/nok_12_2_main.c index a94bd3a7189..46b5a0bd82f 100644 --- a/src/world/area_nok/nok_12/nok_12_2_main.c +++ b/src/world/area_nok/nok_12/nok_12_2_main.c @@ -13,8 +13,8 @@ API_CALLABLE(N(UpdateEnounterStages)) { s32 stage = stageWithoutBridge; s32 i; - if (xMin <= playerStatus->position.x && playerStatus->position.x <= xMax && - zMin <= playerStatus->position.z && playerStatus->position.z <= zMax) + if (xMin <= playerStatus->pos.x && playerStatus->pos.x <= xMax && + zMin <= playerStatus->pos.z && playerStatus->pos.z <= zMax) { stage = stageWithBridge; } diff --git a/src/world/area_nok/nok_12/nok_12_7_demo.c b/src/world/area_nok/nok_12/nok_12_7_demo.c index be0bc466c65..7139a7cc32d 100644 --- a/src/world/area_nok/nok_12/nok_12_7_demo.c +++ b/src/world/area_nok/nok_12/nok_12_7_demo.c @@ -145,11 +145,11 @@ API_CALLABLE(N(SetupDemoScene1)) { break; case 3: partner_clear_player_tracking(wPartnerNpc); - partner_set_goal_pos(playerStatus->position.x, playerStatus->position.z); + partner_set_goal_pos(playerStatus->pos.x, playerStatus->pos.z); func_800EF3D4(0); set_npc_yaw(wPartnerNpc, 90.0f); playerStatus->targetYaw = 90.0f; - playerStatus->currentYaw = 90.0f; + playerStatus->curYaw = 90.0f; playerStatus->spriteFacingAngle = 0.0f; return ApiStatus_DONE2; } @@ -182,11 +182,11 @@ API_CALLABLE(N(SetupDemoScene2)) { break; case 3: partner_clear_player_tracking(wPartnerNpc); - partner_set_goal_pos(playerStatus->position.x, playerStatus->position.z); + partner_set_goal_pos(playerStatus->pos.x, playerStatus->pos.z); func_800EF3D4(0); set_npc_yaw(wPartnerNpc, 90.0f); playerStatus->targetYaw = 90.0f; - playerStatus->currentYaw = 90.0f; + playerStatus->curYaw = 90.0f; playerStatus->spriteFacingAngle = 0.0f; return ApiStatus_DONE2; } diff --git a/src/world/area_nok/nok_13/nok_13_5.c b/src/world/area_nok/nok_13/nok_13_5.c index 6728c35027f..1e996c3b731 100644 --- a/src/world/area_nok/nok_13/nok_13_5.c +++ b/src/world/area_nok/nok_13/nok_13_5.c @@ -6,7 +6,7 @@ API_CALLABLE(N(GetAngleToPlayer)) { Bytecode* args = script->ptrReadPos; s32 outVar = *args++; - evt_set_variable(script, outVar, atan2(-364.0f, -135.0f, gPlayerStatus.position.x, gPlayerStatus.position.z)); + evt_set_variable(script, outVar, atan2(-364.0f, -135.0f, gPlayerStatus.pos.x, gPlayerStatus.pos.z)); return ApiStatus_DONE2; } diff --git a/src/world/area_nok/nok_14/nok_14_2_main.c b/src/world/area_nok/nok_14/nok_14_2_main.c index b0294c00aec..c04424e0459 100644 --- a/src/world/area_nok/nok_14/nok_14_2_main.c +++ b/src/world/area_nok/nok_14/nok_14_2_main.c @@ -13,8 +13,8 @@ API_CALLABLE(N(UpdateEnounterStages)) { s32 stage = stageWithoutBridge; s32 i; - if (xMin <= playerStatus->position.x && playerStatus->position.x <= xMax && - zMin <= playerStatus->position.z && playerStatus->position.z <= zMax) + if (xMin <= playerStatus->pos.x && playerStatus->pos.x <= xMax && + zMin <= playerStatus->pos.z && playerStatus->pos.z <= zMax) { stage = stageWithBridge; } diff --git a/src/world/area_obk/common/RockingChair.inc.c b/src/world/area_obk/common/RockingChair.inc.c index 6daa6e753b6..b56b972b2e0 100644 --- a/src/world/area_obk/common/RockingChair.inc.c +++ b/src/world/area_obk/common/RockingChair.inc.c @@ -14,7 +14,7 @@ typedef struct RockingChairPhysics { /* 0x00 */ f32 angleDelta; /* 0x04 */ f32 angularAccel; - /* 0x08 */ f32 rotationAngle; + /* 0x08 */ f32 rotAngle; /* 0x0C */ f32 verticalOffset; /* 0x10 */ f32 angleB; /* 0x14 */ f32 angleA; @@ -42,7 +42,7 @@ API_CALLABLE(N(UpdateRockingChair)) { script->functionTempPtr[1] = physics; physics->angleDelta = 0; physics->verticalOffset = 0; - physics->rotationAngle = 0; + physics->rotAngle = 0; physics->angleB = 0; physics->angleA = 0; physics->angularAccel = 0.1f; @@ -55,49 +55,49 @@ API_CALLABLE(N(UpdateRockingChair)) { physics = script->functionTempPtr[1]; switch (script->functionTemp[0]) { case CHAIR_STATE_INITIAL: - if (collisionStatus->currentFloor == COLLIDER_i3) { + if (collisionStatus->curFloor == COLLIDER_i3) { script->functionTemp[0] = CHAIR_STATE_PLAYER_TOUCHING; } - if (collisionStatus->currentFloor == COLLIDER_i2) { + if (collisionStatus->curFloor == COLLIDER_i2) { script->functionTemp[0] = CHAIR_STATE_PLAYER_TOUCHING; } physics->angleDelta = 0.0f; physics->verticalOffset = 0.0f; physics->angleB = 0.0f; physics->angleA = 0.0f; - physics->rotationAngle = 0.0f; + physics->rotAngle = 0.0f; physics->angularAccel = 0.1f; physics->mass = 3.0f; physics->equilibriumAngle = 20.0f; break; case CHAIR_STATE_PLAYER_TOUCHING: //TODO odd match - currentFloor = collisionStatus->currentFloor; - if (currentFloor != COLLIDER_i3 && collisionStatus->currentFloor != COLLIDER_i2) { + currentFloor = collisionStatus->curFloor; + if (currentFloor != COLLIDER_i3 && collisionStatus->curFloor != COLLIDER_i2) { script->functionTemp[3] = 120; // settle time script->functionTemp[0] = CHAIR_STATE_PLAYER_NOT_TOUCHING; } - if (fabsf(physics->rotationAngle) < 5.0f) { - physics->angularAccel = fabsf(ROCKING_CHAIR_CENTER_X - playerStatus->position.x) / 200.0f; + if (fabsf(physics->rotAngle) < 5.0f) { + physics->angularAccel = fabsf(ROCKING_CHAIR_CENTER_X - playerStatus->pos.x) / 200.0f; } else { physics->angularAccel = 0.1f; } - if (playerStatus->position.x <= ROCKING_CHAIR_CENTER_X) { + if (playerStatus->pos.x <= ROCKING_CHAIR_CENTER_X) { physics->angleB += physics->angularAccel; - physics->equilibriumAngle = SQ(fabsf(ROCKING_CHAIR_CENTER_X - playerStatus->position.x)) / 50.0f; + physics->equilibriumAngle = SQ(fabsf(ROCKING_CHAIR_CENTER_X - playerStatus->pos.x)) / 50.0f; if (physics->equilibriumAngle > 15.0f) { physics->equilibriumAngle = 15.0f; } - if (physics->rotationAngle > physics->equilibriumAngle) { + if (physics->rotAngle > physics->equilibriumAngle) { physics->angleA += physics->angularAccel * physics->mass; } } else { physics->angleA += physics->angularAccel; - physics->equilibriumAngle = -SQ(-fabsf(ROCKING_CHAIR_CENTER_X - playerStatus->position.x) * 0.5f) / 50.0f; + physics->equilibriumAngle = -SQ(-fabsf(ROCKING_CHAIR_CENTER_X - playerStatus->pos.x) * 0.5f) / 50.0f; if (physics->equilibriumAngle < -5.0f) { physics->equilibriumAngle = -5.0f; } - if (physics->rotationAngle < physics->equilibriumAngle) { + if (physics->rotAngle < physics->equilibriumAngle) { physics->angleB += physics->angularAccel * physics->mass; } } @@ -114,13 +114,13 @@ API_CALLABLE(N(UpdateRockingChair)) { } } physics->angleDelta = physics->angleB - physics->angleA; - physics->rotationAngle += physics->angleDelta; + physics->rotAngle += physics->angleDelta; break; case CHAIR_STATE_PLAYER_NOT_TOUCHING: - if (collisionStatus->currentFloor == COLLIDER_i3) { + if (collisionStatus->curFloor == COLLIDER_i3) { script->functionTemp[0] = CHAIR_STATE_PLAYER_TOUCHING; } - if (collisionStatus->currentFloor == COLLIDER_i2) { + if (collisionStatus->curFloor == COLLIDER_i2) { script->functionTemp[0] = CHAIR_STATE_PLAYER_TOUCHING; } @@ -128,7 +128,7 @@ API_CALLABLE(N(UpdateRockingChair)) { physics->equilibriumAngle = 0; physics->angleB += physics->angularAccel; - if (physics->rotationAngle > physics->equilibriumAngle) { + if (physics->rotAngle > physics->equilibriumAngle) { physics->angleA += physics->angularAccel * physics->mass; } if ((physics->angleB > 100.0) && ( physics->angleA > 100.0)) { @@ -148,17 +148,17 @@ API_CALLABLE(N(UpdateRockingChair)) { physics->angleA = zero; physics->angleB = zero; physics->angleDelta = zero; - physics->rotationAngle = zero; + physics->rotAngle = zero; } else { script->functionTemp[3]--; } physics->angleDelta = physics->angleB - physics->angleA; - physics->rotationAngle += physics->angleDelta; + physics->rotAngle += physics->angleDelta; break; } // play creak sound once per cycle - if (physics->rotationAngle <= -7.0f) { + if (physics->rotAngle <= -7.0f) { if (script->functionTemp[2] != -1) { get_collider_center(COLLIDER_i3, ¢erX, ¢erY, ¢erZ); sfx_play_sound_at_position(SOUND_CREAKY_ROCKING_CHAIR, SOUND_SPACE_MODE_0, centerX, centerY, centerZ); @@ -168,12 +168,12 @@ API_CALLABLE(N(UpdateRockingChair)) { script->functionTemp[2] = 0; } - physics->verticalOffset = SQ(physics->rotationAngle) / 90.0f; + physics->verticalOffset = SQ(physics->rotAngle) / 90.0f; model = get_model_from_list_index(get_model_list_index_from_tree_index(MODEL_i3)); model->flags |= (MODEL_FLAG_MATRIX_DIRTY | MODEL_FLAG_HAS_TRANSFORM); guTranslateF(model->userTransformMtx, 0.0f, physics->verticalOffset, 0.0f); - guRotateF(tempMtx, physics->rotationAngle, 0.0f, 0.0f, 1.0f); + guRotateF(tempMtx, physics->rotAngle, 0.0f, 0.0f, 1.0f); guMtxCatF(model->userTransformMtx, tempMtx, model->userTransformMtx); update_collider_transform(COLLIDER_i3); update_collider_transform(COLLIDER_i2); @@ -181,13 +181,13 @@ API_CALLABLE(N(UpdateRockingChair)) { model = get_model_from_list_index(get_model_list_index_from_tree_index(MODEL_i2)); model->flags |= (MODEL_FLAG_MATRIX_DIRTY | MODEL_FLAG_HAS_TRANSFORM); guTranslateF(model->userTransformMtx, 0.0f, physics->verticalOffset, 0.0f); - guRotateF(tempMtx, physics->rotationAngle, 0.0f, 0.0f, 1.0f); + guRotateF(tempMtx, physics->rotAngle, 0.0f, 0.0f, 1.0f); guMtxCatF(model->userTransformMtx, tempMtx, model->userTransformMtx); model = get_model_from_list_index(get_model_list_index_from_tree_index(MODEL_i1)); model->flags |= (MODEL_FLAG_MATRIX_DIRTY | MODEL_FLAG_HAS_TRANSFORM); guTranslateF(model->userTransformMtx, 0.0f, physics->verticalOffset, 0.0f); - guRotateF(tempMtx, physics->rotationAngle, 0.0f, 0.0f, 1.0f); + guRotateF(tempMtx, physics->rotAngle, 0.0f, 0.0f, 1.0f); guMtxCatF(model->userTransformMtx, tempMtx, model->userTransformMtx); update_collider_transform(COLLIDER_i1); diff --git a/src/world/area_obk/obk_01/obk_01_3_chandelier.c b/src/world/area_obk/obk_01/obk_01_3_chandelier.c index 7b93fd9f0a9..ebd25150d95 100644 --- a/src/world/area_obk/obk_01/obk_01_3_chandelier.c +++ b/src/world/area_obk/obk_01/obk_01_3_chandelier.c @@ -261,9 +261,9 @@ API_CALLABLE(N(UpdateChandelier)) { } if (chandelier->flags & CHANDELIER_FLAG_TETHER_PLAYER) { - playerStatus->position.x = (-sin_deg(chandelier->swingAngle) * (chandelier->dropDistance - 300.0f)) + 445.0f; - playerStatus->position.y = ((cos_deg(chandelier->swingAngle) * (chandelier->dropDistance - 300.0f)) - 135.0f) + 300.0f; - playerStatus->position.z = 279.0f; + playerStatus->pos.x = (-sin_deg(chandelier->swingAngle) * (chandelier->dropDistance - 300.0f)) + 445.0f; + playerStatus->pos.y = ((cos_deg(chandelier->swingAngle) * (chandelier->dropDistance - 300.0f)) - 135.0f) + 300.0f; + playerStatus->pos.z = 279.0f; } return ApiStatus_BLOCK; } diff --git a/src/world/area_obk/obk_04/obk_04_5_hole.c b/src/world/area_obk/obk_04/obk_04_5_hole.c index f811f422c9f..2ae64f9dbb6 100644 --- a/src/world/area_obk/obk_04/obk_04_5_hole.c +++ b/src/world/area_obk/obk_04/obk_04_5_hole.c @@ -1,7 +1,7 @@ #include "obk_04.h" API_CALLABLE(N(AwaitPlayerEnterHole)) { - if (gPlayerStatus.position.y < -50.0f) { + if (gPlayerStatus.pos.y < -50.0f) { return ApiStatus_DONE2; } return ApiStatus_BLOCK; diff --git a/src/world/area_obk/obk_04/obk_04_6_game.c b/src/world/area_obk/obk_04/obk_04_6_game.c index 356b7952449..e0b4d7f11ee 100644 --- a/src/world/area_obk/obk_04/obk_04_6_game.c +++ b/src/world/area_obk/obk_04/obk_04_6_game.c @@ -96,7 +96,7 @@ API_CALLABLE(N(UpgradeBootsToSuper)) { API_CALLABLE(N(GetPlayerPosOutsideKeepAwayRing)) { PlayerStatus* playerStatus = &gPlayerStatus; Npc npc; - f32 dist = dist2D(playerStatus->position.x, playerStatus->position.z, 0.0f, 0.0f); + f32 dist = dist2D(playerStatus->pos.x, playerStatus->pos.z, 0.0f, 0.0f); f32 yaw; s32 gt, lt; @@ -113,7 +113,7 @@ API_CALLABLE(N(GetPlayerPosOutsideKeepAwayRing)) { } if (gt | lt) { - yaw = atan2(playerStatus->position.x, playerStatus->position.z, 0.0f, 0.0f) + 180.0f; + yaw = atan2(playerStatus->pos.x, playerStatus->pos.z, 0.0f, 0.0f) + 180.0f; npc.pos.x = 0.0f; npc.pos.y = 0.0f; npc.pos.z = 0.0f; @@ -123,9 +123,9 @@ API_CALLABLE(N(GetPlayerPosOutsideKeepAwayRing)) { script->varTable[2] = npc.pos.z; script->varTable[3] = 1; } else { - script->varTable[0] = playerStatus->position.x; - script->varTable[1] = playerStatus->position.y; - script->varTable[2] = playerStatus->position.z; + script->varTable[0] = playerStatus->pos.x; + script->varTable[1] = playerStatus->pos.y; + script->varTable[2] = playerStatus->pos.z; script->varTable[3] = 0; } return ApiStatus_DONE2; diff --git a/src/world/area_obk/obk_05/obk_05_2_main.c b/src/world/area_obk/obk_05/obk_05_2_main.c index 35f54aeb88c..a594a24c4be 100644 --- a/src/world/area_obk/obk_05/obk_05_2_main.c +++ b/src/world/area_obk/obk_05/obk_05_2_main.c @@ -48,7 +48,7 @@ EvtScript N(EVS_TexPan_Fog) = { #include "world/common/todo/SetCamera0MoveFlag1.inc.c" API_CALLABLE(N(RetroJar_AwaitPlayerEntry)) { - if (gCollisionStatus.currentFloor == COLLIDER_o420) { + if (gCollisionStatus.curFloor == COLLIDER_o420) { return ApiStatus_DONE2; } else { return ApiStatus_BLOCK; diff --git a/src/world/area_obk/obk_05/obk_05_4_hole.c b/src/world/area_obk/obk_05/obk_05_4_hole.c index 724f031be07..d7b7da49de7 100644 --- a/src/world/area_obk/obk_05/obk_05_4_hole.c +++ b/src/world/area_obk/obk_05/obk_05_4_hole.c @@ -1,7 +1,7 @@ #include "obk_05.h" API_CALLABLE(N(AwaitPlayerEnterHole)) { - if (gPlayerStatus.position.y < -50.0f) { + if (gPlayerStatus.pos.y < -50.0f) { return ApiStatus_DONE2; } else { return ApiStatus_BLOCK; diff --git a/src/world/area_obk/obk_07/obk_07_6_phonograph.c b/src/world/area_obk/obk_07/obk_07_6_phonograph.c index f5974f4dac4..f11f220672e 100644 --- a/src/world/area_obk/obk_07/obk_07_6_phonograph.c +++ b/src/world/area_obk/obk_07/obk_07_6_phonograph.c @@ -547,7 +547,7 @@ API_CALLABLE(N(UpdateGuardBooPos)) { if (data->state == PHONOGRAPH_HUD_STATE_DESTROYED) { // return to guard position speed = 2.0f; - npc->currentAnim = ANIM_Boo_Run; + npc->curAnim = ANIM_Boo_Run; if (dist2D(x, z, guardPosX, booPosZ) < speed) { npc->pos.x = guardPosX; npc->pos.z = booPosZ; @@ -590,13 +590,13 @@ API_CALLABLE(N(UpdateGuardBooPos)) { } if (data->meterFillAmount > 7000) { - npc->currentAnim = ANIM_Boo_Wave; + npc->curAnim = ANIM_Boo_Wave; } else if (data->meterFillAmount > 5000) { - npc->currentAnim = ANIM_Boo_Run; + npc->curAnim = ANIM_Boo_Run; } else if (data->meterFillAmount > 3000) { - npc->currentAnim = ANIM_Boo_Walk; + npc->curAnim = ANIM_Boo_Walk; } else { - npc->currentAnim = ANIM_Boo_Idle; + npc->curAnim = ANIM_Boo_Idle; } return ApiStatus_DONE2; diff --git a/src/world/area_obk/obk_08/obk_08_6_game.c b/src/world/area_obk/obk_08/obk_08_6_game.c index 33a897ee0fe..11fdc49a46c 100644 --- a/src/world/area_obk/obk_08/obk_08_6_game.c +++ b/src/world/area_obk/obk_08/obk_08_6_game.c @@ -70,7 +70,7 @@ API_CALLABLE(N(func_80241300_BD4B70)) { API_CALLABLE(N(GetPlayerPosOutsideKeepAwayRing)) { PlayerStatus* playerStatus = &gPlayerStatus; Npc npc; - f32 dist = dist2D(playerStatus->position.x, playerStatus->position.z, 0.0f, 0.0f); + f32 dist = dist2D(playerStatus->pos.x, playerStatus->pos.z, 0.0f, 0.0f); f32 yaw; s32 gt; s32 lt; @@ -88,7 +88,7 @@ API_CALLABLE(N(GetPlayerPosOutsideKeepAwayRing)) { } if ((gt | lt) != 0) { - yaw = atan2(playerStatus->position.x, playerStatus->position.z, 0.0f, 0.0f) + 180.0f; + yaw = atan2(playerStatus->pos.x, playerStatus->pos.z, 0.0f, 0.0f) + 180.0f; npc.pos.x = 0.0f; npc.pos.y = 0.0f; npc.pos.z = 0.0f; @@ -98,9 +98,9 @@ API_CALLABLE(N(GetPlayerPosOutsideKeepAwayRing)) { script->varTable[2] = npc.pos.z; script->varTable[3] = 1; } else { - script->varTable[0] = playerStatus->position.x; - script->varTable[1] = playerStatus->position.y; - script->varTable[2] = playerStatus->position.z; + script->varTable[0] = playerStatus->pos.x; + script->varTable[1] = playerStatus->pos.y; + script->varTable[2] = playerStatus->pos.z; script->varTable[3] = 0; } return ApiStatus_DONE2; diff --git a/src/world/area_obk/obk_09/obk_09_4_npc.c b/src/world/area_obk/obk_09/obk_09_4_npc.c index bc04ef19ea2..289c6d0d4a8 100644 --- a/src/world/area_obk/obk_09/obk_09_4_npc.c +++ b/src/world/area_obk/obk_09/obk_09_4_npc.c @@ -42,9 +42,9 @@ API_CALLABLE(N(ImprisonedCardUpdate)) { card->rot.y = clamp_angle(card->rot.y + 6.6f); effect->data.spiritCard->yaw = card->rot.y; - shadow->position.x = card->pos.x; - shadow->position.y = card->pos.y - 40.0f; - shadow->position.z = card->pos.z; + shadow->pos.x = card->pos.x; + shadow->pos.y = card->pos.y - 40.0f; + shadow->pos.z = card->pos.z; return ApiStatus_BLOCK; } diff --git a/src/world/area_omo/omo_02/omo_02_5_barricade.c b/src/world/area_omo/omo_02/omo_02_5_barricade.c index bcd740fc457..7e6a22a7184 100644 --- a/src/world/area_omo/omo_02/omo_02_5_barricade.c +++ b/src/world/area_omo/omo_02/omo_02_5_barricade.c @@ -19,9 +19,9 @@ typedef struct BarricadePart { /* 0x04 */ Vec3f pos; /* 0x10 */ Vec3f origin; /* 0x1C */ Vec3f rot; - /* 0x28 */ Vec3f angularVelocity; - /* 0x34 */ f32 verticalVelocity; - /* 0x38 */ f32 planarVelocity; + /* 0x28 */ Vec3f angularVel; + /* 0x34 */ f32 verticalVel; + /* 0x38 */ f32 planarVel; /* 0x3C */ f32 velocityAngle; /* 0x40 */ s32 modelID; /* 0x44 */ s32 colliderID; @@ -101,11 +101,11 @@ API_CALLABLE(N(AnimateBarricadeParts)) { part->origin.x = part->pos.x; part->origin.y = part->pos.y; part->origin.z = part->pos.z; - part->angularVelocity.x = rand_int(20) - 10; - part->angularVelocity.y = rand_int(20) - 10; - part->angularVelocity.z = rand_int(20) - 10; - part->verticalVelocity = (rand_int(40) + 100.0f) / 10.0f; - part->planarVelocity = (rand_int(30) + 60.0f) / 10.0f; + part->angularVel.x = rand_int(20) - 10; + part->angularVel.y = rand_int(20) - 10; + part->angularVel.z = rand_int(20) - 10; + part->verticalVel = (rand_int(40) + 100.0f) / 10.0f; + part->planarVel = (rand_int(30) + 60.0f) / 10.0f; part->velocityAngle = ((rand_int(100) % 2) * 180.0f) + 90.0f; N(DetermineSphericalSize)(model->modelNode->displayData->displayList, &part->radius); @@ -122,17 +122,17 @@ API_CALLABLE(N(AnimateBarricadeParts)) { model = get_model_from_list_index(get_model_list_index_from_tree_index(part->modelID)); switch (part->state) { case BARRICADE_STATE_FLYING: - add_vec2D_polar(&part->pos.x, &part->pos.z, part->planarVelocity, part->velocityAngle); - part->verticalVelocity -= 0.8f; - part->pos.y += part->verticalVelocity; - if (part->verticalVelocity <= 0.0f && part->pos.y < part->radius) { + add_vec2D_polar(&part->pos.x, &part->pos.z, part->planarVel, part->velocityAngle); + part->verticalVel -= 0.8f; + part->pos.y += part->verticalVel; + if (part->verticalVel <= 0.0f && part->pos.y < part->radius) { part->pos.y = part->radius; - part->verticalVelocity *= -0.7f; - if (part->verticalVelocity < 1.0f) { + part->verticalVel *= -0.7f; + if (part->verticalVel < 1.0f) { part->state = BARRICADE_STATE_CLEANUP; - part->angularVelocity.x = 0.0f; - part->angularVelocity.y = 0.0f; - part->angularVelocity.z = 0.0f; + part->angularVel.x = 0.0f; + part->angularVel.y = 0.0f; + part->angularVel.z = 0.0f; } if (i & 1) { exec_ShakeCam1(0, 0, 1); @@ -156,9 +156,9 @@ API_CALLABLE(N(AnimateBarricadeParts)) { model->flags |= MODEL_FLAG_MATRIX_DIRTY | MODEL_FLAG_HAS_TRANSFORM; guTranslateF(mtxTransform, part->pos.x - part->origin.x, part->pos.y - part->origin.y, part->pos.z - part->origin.z); - part->rot.x += part->angularVelocity.x; - part->rot.y += part->angularVelocity.y; - part->rot.z += part->angularVelocity.z; + part->rot.x += part->angularVel.x; + part->rot.y += part->angularVel.y; + part->rot.z += part->angularVel.z; part->rot.x = clamp_angle(part->rot.x); part->rot.y = clamp_angle(part->rot.y); part->rot.z = clamp_angle(part->rot.z); diff --git a/src/world/area_omo/omo_04/omo_04_4_entity.c b/src/world/area_omo/omo_04/omo_04_4_entity.c index 95d4089f238..090371198a7 100644 --- a/src/world/area_omo/omo_04/omo_04_4_entity.c +++ b/src/world/area_omo/omo_04/omo_04_4_entity.c @@ -113,10 +113,10 @@ EvtScript N(EVS_StarBoxLaunch7) = { }; API_CALLABLE(N(func_802402F4_DAD6F4)) { - f32 playerVx = gPlayerStatus.currentSpeed * 5.0f * sin_deg(gPlayerStatus.targetYaw); - f32 playerVz = gPlayerStatus.currentSpeed * 5.0f * -cos_deg(gPlayerStatus.targetYaw); - script->varTable[0] = (gPlayerStatus.position.x + playerVx); - script->varTable[1] = (gPlayerStatus.position.z + playerVz); + f32 playerVx = gPlayerStatus.curSpeed * 5.0f * sin_deg(gPlayerStatus.targetYaw); + f32 playerVz = gPlayerStatus.curSpeed * 5.0f * -cos_deg(gPlayerStatus.targetYaw); + script->varTable[0] = (gPlayerStatus.pos.x + playerVx); + script->varTable[1] = (gPlayerStatus.pos.z + playerVz); return ApiStatus_DONE2; } diff --git a/src/world/area_omo/omo_09/omo_09_3_conveyors.c b/src/world/area_omo/omo_09/omo_09_3_conveyors.c index 3853d45152d..73d84a0d573 100644 --- a/src/world/area_omo/omo_09/omo_09_3_conveyors.c +++ b/src/world/area_omo/omo_09/omo_09_3_conveyors.c @@ -24,7 +24,7 @@ s32 N(ShouldPauseConveyor)(void) { } if (gPartnerStatus.partnerActionState != PARTNER_ACTION_NONE && - (playerData->currentPartner == PARTNER_GOOMBARIO || playerData->currentPartner == PARTNER_SUSHIE)) + (playerData->curPartner == PARTNER_GOOMBARIO || playerData->curPartner == PARTNER_SUSHIE)) { return TRUE; } @@ -59,9 +59,9 @@ API_CALLABLE(N(AddConveyorPush)) { one = 1; if (partnerStatus->actingPartner == PARTNER_BOW) { if (partnerStatus->partnerActionState != PARTNER_ACTION_NONE && playerStatus->alpha1 == 128) { - x = playerStatus->position.x; - y = playerStatus->position.y; - z = playerStatus->position.z; + x = playerStatus->pos.x; + y = playerStatus->pos.y; + z = playerStatus->pos.z; outLength = 1000.0f; hit = player_raycast_below_cam_relative(playerStatus, &x, &y, &z, &outLength, @@ -70,8 +70,8 @@ API_CALLABLE(N(AddConveyorPush)) { for (i = 0; i < ARRAY_COUNT(N(ConveyorColliders)); i++) { if (hit == N(ConveyorColliders)[i]) { - playerStatus->pushVelocity.x = N(ConveyorPushVels)[i][0]; - playerStatus->pushVelocity.z = N(ConveyorPushVels)[i][one]; // TODO needed to match + playerStatus->pushVel.x = N(ConveyorPushVels)[i][0]; + playerStatus->pushVel.z = N(ConveyorPushVels)[i][one]; // TODO needed to match } } script->varTable[0] = 1; @@ -83,14 +83,14 @@ API_CALLABLE(N(AddConveyorPush)) { partnerStatus->partnerActionState == PARTNER_ACTION_NONE) { for (i = 0; i < ARRAY_COUNT(N(ConveyorColliders)); i++) { - if (gCollisionStatus.currentFloor == N(ConveyorColliders)[i] || + if (gCollisionStatus.curFloor == N(ConveyorColliders)[i] || gCollisionStatus.lastTouchedFloor == N(ConveyorColliders)[i]) { - playerStatus->pushVelocity.x = N(ConveyorPushVels)[i][0]; - playerStatus->pushVelocity.z = N(ConveyorPushVels)[i][one]; // TODO needed to match + playerStatus->pushVel.x = N(ConveyorPushVels)[i][0]; + playerStatus->pushVel.z = N(ConveyorPushVels)[i][one]; // TODO needed to match } - if (partner->currentFloor == N(ConveyorColliders)[i] && + if (partner->curFloor == N(ConveyorColliders)[i] && ((partnerStatus->actingPartner != PARTNER_KOOPER) || (partnerStatus->partnerActionState == PARTNER_ACTION_NONE))) { diff --git a/src/world/area_omo/omo_09/omo_09_4_slot_machine.c b/src/world/area_omo/omo_09/omo_09_4_slot_machine.c index 0738c10a6d9..14e5d933dc5 100644 --- a/src/world/area_omo/omo_09/omo_09_4_slot_machine.c +++ b/src/world/area_omo/omo_09/omo_09_4_slot_machine.c @@ -800,12 +800,12 @@ API_CALLABLE(N(UpdateSlotMachineBlockShadows)) { scale = 1000.0f; entity_raycast_down(&x, &y, &z, &rotX, &rotZ, &scale); set_standard_shadow_scale(shadow, scale); - shadow->position.x = x; - shadow->position.y = y; - shadow->position.z = z; - shadow->rotation.x = rotX; - shadow->rotation.y = 0.0f; - shadow->rotation.z = rotZ; + shadow->pos.x = x; + shadow->pos.y = y; + shadow->pos.z = z; + shadow->rot.x = rotX; + shadow->rot.y = 0.0f; + shadow->rot.z = rotZ; shadow->scale.x *= 1.3f; shadow->scale.z *= 1.3f; } diff --git a/src/world/area_omo/omo_09/omo_09_5_gizmos.c b/src/world/area_omo/omo_09/omo_09_5_gizmos.c index 109e4d0d4c8..490202b0879 100644 --- a/src/world/area_omo/omo_09/omo_09_5_gizmos.c +++ b/src/world/area_omo/omo_09/omo_09_5_gizmos.c @@ -90,7 +90,7 @@ MovingBlock N(MovingBlockPlatforms)[] = { }; API_CALLABLE(N(AwaitPlayerNearPlatforms)) { - if (gPlayerStatus.position.x < 850.0f) { + if (gPlayerStatus.pos.x < 850.0f) { return ApiStatus_BLOCK; } return ApiStatus_DONE2; diff --git a/src/world/area_omo/omo_11/omo_11_3_gizmos.c b/src/world/area_omo/omo_11/omo_11_3_gizmos.c index ea89e20ec17..9f40d8de9ee 100644 --- a/src/world/area_omo/omo_11/omo_11_3_gizmos.c +++ b/src/world/area_omo/omo_11/omo_11_3_gizmos.c @@ -92,12 +92,12 @@ API_CALLABLE(N(UpdatePlatformShadows)) { scale = 1000.0f; entity_raycast_down(&x, &y, &z, &rotX, &rotZ, &scale); set_standard_shadow_scale(shadow, scale); - shadow->rotation.y = 0.0f; - shadow->position.x = x; - shadow->position.y = y; - shadow->position.z = z; - shadow->rotation.x = rotX; - shadow->rotation.z = rotZ; + shadow->rot.y = 0.0f; + shadow->pos.x = x; + shadow->pos.y = y; + shadow->pos.z = z; + shadow->rot.x = rotX; + shadow->rot.z = rotZ; shadow->scale.x *= 3.0f; shadow->scale.z *= 3.0f; } @@ -182,14 +182,14 @@ API_CALLABLE(N(UpdateRotatingPlatforms)) { guMtxCatF(loopModel->userTransformMtx, sp60, loopModel->userTransformMtx); update_collider_transform(N(RotatingPlatformColliders)[i]); guMtxXFMF(loopModel->userTransformMtx, 0.0f, 0.0f, 0.0f, &ox, &oy, &oz); - if (gCollisionStatus.currentFloor == N(RotatingPlatformColliders)[i] || + if (gCollisionStatus.curFloor == N(RotatingPlatformColliders)[i] || gCollisionStatus.lastTouchedFloor == N(RotatingPlatformColliders)[i]) { - playerStatus->pushVelocity.x = ox - it->lastRelativePos.x; - playerStatus->pushVelocity.y = oy - it->lastRelativePos.y; - playerStatus->pushVelocity.z = oz - it->lastRelativePos.z; + playerStatus->pushVel.x = ox - it->lastRelativePos.x; + playerStatus->pushVel.y = oy - it->lastRelativePos.y; + playerStatus->pushVel.z = oz - it->lastRelativePos.z; } - if (partner->currentFloor == N(RotatingPlatformColliders)[i]) { + if (partner->curFloor == N(RotatingPlatformColliders)[i]) { partner->pos.x += ox - it->lastRelativePos.x; partner->pos.y += oy - it->lastRelativePos.y; partner->pos.z += oz - it->lastRelativePos.z; @@ -209,11 +209,11 @@ API_CALLABLE(N(UpdateRotatingPlatforms)) { isPounding = FALSE; for (i = 0; i < ARRAY_COUNT(N(RotatingPlatformColliders)); i++) { - if (gCollisionStatus.currentFloor == N(RotatingPlatformColliders)[i]) { + if (gCollisionStatus.curFloor == N(RotatingPlatformColliders)[i]) { if (playerStatus->flags & PS_FLAG_NO_STATIC_COLLISION) { - gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; - gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y; - gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; + gCameras[CAM_DEFAULT].targetPos.x = playerStatus->pos.x; + gCameras[CAM_DEFAULT].targetPos.y = playerStatus->pos.y; + gCameras[CAM_DEFAULT].targetPos.z = playerStatus->pos.z; } if (playerStatus->actionState == ACTION_STATE_SPIN_POUND || playerStatus->actionState == ACTION_STATE_TORNADO_POUND) diff --git a/src/world/area_omo/omo_13/omo_13_4_npc.c b/src/world/area_omo/omo_13/omo_13_4_npc.c index 762933c9be9..43d61a979ac 100644 --- a/src/world/area_omo/omo_13/omo_13_4_npc.c +++ b/src/world/area_omo/omo_13/omo_13_4_npc.c @@ -100,11 +100,11 @@ API_CALLABLE(N(UpdateAntiGuyPosition)) { f32 theta; f32 x, y, z; - dist2D(110.0f, -45.0f, playerStatus->position.x, playerStatus->position.z); - theta = clamp_angle(atan2(110.0f, -45.0f, playerStatus->position.x, playerStatus->position.z)); + dist2D(110.0f, -45.0f, playerStatus->pos.x, playerStatus->pos.z); + theta = clamp_angle(atan2(110.0f, -45.0f, playerStatus->pos.x, playerStatus->pos.z)); x = 110.0f + (sin_deg(theta) * 30.0f); if (script->varTable[11] != 0) { - y = playerStatus->position.y * 0.7f; + y = playerStatus->pos.y * 0.7f; } else { y = npc->pos.y; } @@ -115,8 +115,8 @@ API_CALLABLE(N(UpdateAntiGuyPosition)) { } if (npc->pos.x != x || npc->pos.y != y || npc->pos.z != z) { - if (npc->currentAnim != ANIM_ShyGuy_Black_Anim02 && script->varTable[10]++ >= 6) { - npc->currentAnim = ANIM_ShyGuy_Black_Anim02; + if (npc->curAnim != ANIM_ShyGuy_Black_Anim02 && script->varTable[10]++ >= 6) { + npc->curAnim = ANIM_ShyGuy_Black_Anim02; script->varTable[10] = 0; } npc->pos.x = x; @@ -125,10 +125,10 @@ API_CALLABLE(N(UpdateAntiGuyPosition)) { npc->colliderPos.y = npc->pos.y; npc->colliderPos.z = npc->pos.z; npc->flags |= NPC_FLAG_DIRTY_SHADOW; - } else if (npc->currentAnim != ANIM_ShyGuy_Black_Anim01) { - npc->currentAnim = ANIM_ShyGuy_Black_Anim01; + } else if (npc->curAnim != ANIM_ShyGuy_Black_Anim01) { + npc->curAnim = ANIM_ShyGuy_Black_Anim01; } - npc->yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z); + npc->yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->pos.x, playerStatus->pos.z); return ApiStatus_DONE2; } diff --git a/src/world/area_omo/omo_14/omo_14_3_npc.c b/src/world/area_omo/omo_14/omo_14_3_npc.c index deb1ed06dcf..6f7716152c8 100644 --- a/src/world/area_omo/omo_14/omo_14_3_npc.c +++ b/src/world/area_omo/omo_14/omo_14_3_npc.c @@ -5,9 +5,9 @@ API_CALLABLE(N(SurroundPlayer)) { PlayerStatus* playerStatus = &gPlayerStatus; Npc* npc = get_npc_unsafe(script->owner1.enemy->npcID); - f32 goalPosX = playerStatus->position.x + + f32 goalPosX = playerStatus->pos.x + ((playerStatus->colliderDiameter + npc->collisionDiameter) * 0.5f * sin_deg((npc->npcID * 360.0f) / 10.0f)); - f32 goalPosZ = playerStatus->position.z - + f32 goalPosZ = playerStatus->pos.z - ((playerStatus->colliderDiameter + npc->collisionDiameter) * 0.5f * cos_deg((npc->npcID * 360.0f) / 10.0f)); f32 dist = dist2D(npc->pos.x, npc->pos.z, goalPosX, goalPosZ); @@ -23,19 +23,19 @@ API_CALLABLE(N(SurroundPlayer)) { } npc_move_heading(npc, npc->moveSpeed, npc->yaw); } else { - npc->yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z); + npc->yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->pos.x, playerStatus->pos.z); } - if (script->varTableF[11] == playerStatus->position.x && script->varTableF[13] == playerStatus->position.z) { + if (script->varTableF[11] == playerStatus->pos.x && script->varTableF[13] == playerStatus->pos.z) { if (dist < 20.0f) { script->varTable[14]++; } else { script->varTable[14] = 0; } } - script->varTableF[11] = playerStatus->position.x; - script->varTableF[12] = playerStatus->position.y; - script->varTableF[13] = playerStatus->position.z; + script->varTableF[11] = playerStatus->pos.x; + script->varTableF[12] = playerStatus->pos.y; + script->varTableF[13] = playerStatus->pos.z; return ApiStatus_DONE2; } diff --git a/src/world/area_osr/osr_03/osr_03_5_interlude.c b/src/world/area_osr/osr_03/osr_03_5_interlude.c index 4fee9410ec4..32bcf0d35b5 100644 --- a/src/world/area_osr/osr_03/osr_03_5_interlude.c +++ b/src/world/area_osr/osr_03/osr_03_5_interlude.c @@ -3,17 +3,17 @@ API_CALLABLE(N(SetPlayerAsPeach)) { gGameStatusPtr->peachFlags |= PEACH_STATUS_FLAG_IS_PEACH; - script->varTable[0] = gPlayerData.currentPartner; - gPlayerData.currentPartner = PARTNER_TWINK; + script->varTable[0] = gPlayerData.curPartner; + gPlayerData.curPartner = PARTNER_TWINK; return ApiStatus_DONE2; } API_CALLABLE(N(GetKammyFlightEmitterPos)) { Npc* npc = get_npc_unsafe(NPC_Kammy); - script->varTable[0] = npc->pos.x + (sin_deg(npc->yaw + gCameras[CAM_DEFAULT].currentYaw + 180.0f) * 20.0f); + script->varTable[0] = npc->pos.x + (sin_deg(npc->yaw + gCameras[CAM_DEFAULT].curYaw + 180.0f) * 20.0f); script->varTable[1] = npc->pos.y + 18.0f; - script->varTable[2] = npc->pos.z - (cos_deg(npc->yaw + gCameras[CAM_DEFAULT].currentYaw + 180.0f) * 20.0f); + script->varTable[2] = npc->pos.z - (cos_deg(npc->yaw + gCameras[CAM_DEFAULT].curYaw + 180.0f) * 20.0f); return ApiStatus_DONE2; } diff --git a/src/world/area_pra/common/Reflection.inc.c b/src/world/area_pra/common/Reflection.inc.c index bb497517b6d..7f792ad3f1a 100644 --- a/src/world/area_pra/common/Reflection.inc.c +++ b/src/world/area_pra/common/Reflection.inc.c @@ -83,7 +83,7 @@ void N(worker_reflect_player_wall)(void) { entityModel = get_entity_model(get_shadow_by_index(playerStatus->shadowID)->entityModelID); entityModel->flags |= ENTITY_MODEL_FLAG_REFLECT; - get_screen_coords(gCurrentCamID, playerStatus->position.x, playerStatus->position.y, -playerStatus->position.z, + get_screen_coords(gCurrentCamID, playerStatus->pos.x, playerStatus->pos.y, -playerStatus->pos.z, &screenX, &screenY, &screenZ); anim = N(reflection_unk_resolve_anim)(playerStatus->trueAnimation); @@ -113,13 +113,13 @@ void N(worker_reflect_player_wall)(void) { renderTaskPtr->renderMode = renderMode; renderTaskPtr->appendGfxArg = playerStatus; renderTaskPtr->appendGfx = (void(*))N(appendGfx_reflect_player_wall); - renderTaskPtr->distance = -screenZ; + renderTaskPtr->dist = -screenZ; queue_render_task(renderTaskPtr); } } void N(appendGfx_reflect_player_wall)(PlayerStatus* playerStatus) { - f32 yaw = -gCameras[gCurrentCamID].currentYaw; + f32 yaw = -gCameras[gCurrentCamID].curYaw; Matrix4f main; Matrix4f translation; Matrix4f rotation; @@ -134,7 +134,7 @@ void N(appendGfx_reflect_player_wall)(PlayerStatus* playerStatus) { guMtxCatF(main, rotation, main); guScaleF(scale, SPRITE_WORLD_SCALE_F, SPRITE_WORLD_SCALE_F, SPRITE_WORLD_SCALE_F); guMtxCatF(main, scale, main); - guTranslateF(translation, playerStatus->position.x, playerStatus->position.y, -playerStatus->position.z - 3.0f); + guTranslateF(translation, playerStatus->pos.x, playerStatus->pos.y, -playerStatus->pos.z - 3.0f); guMtxCatF(main, translation, main); spr_draw_player_sprite(PLAYER_SPRITE_AUX2, 0, 0, NULL, main); } @@ -164,7 +164,7 @@ void N(worker_reflect_player_floor)(void) { if (playerStatus->flags & PS_FLAG_HAS_REFLECTION) { entityModel = get_entity_model(get_shadow_by_index(playerStatus->shadowID)->entityModelID); - get_screen_coords(gCurrentCamID, playerStatus->position.x, -playerStatus->position.y, playerStatus->position.z, + get_screen_coords(gCurrentCamID, playerStatus->pos.x, -playerStatus->pos.y, playerStatus->pos.z, &screenX, &screenY, &screenZ); spr_update_player_sprite(PLAYER_SPRITE_AUX1, playerStatus->trueAnimation, 1.0f); @@ -187,7 +187,7 @@ void N(worker_reflect_player_floor)(void) { renderTaskPtr->renderMode = renderMode; renderTaskPtr->appendGfxArg = playerStatus; - renderTaskPtr->distance = -screenZ; + renderTaskPtr->dist = -screenZ; renderTaskPtr->appendGfx = (void (*)(void*)) ( !(playerStatus->flags & PS_FLAG_SPINNING) ? N(appendGfx_reflect_player_floor_basic) @@ -198,7 +198,7 @@ void N(worker_reflect_player_floor)(void) { } void N(appendGfx_reflect_player_floor_basic)(PlayerStatus* playerStatus) { - f32 yaw = -gCameras[gCurrentCamID].currentYaw; + f32 yaw = -gCameras[gCurrentCamID].curYaw; Matrix4f main; Matrix4f translation; Matrix4f rotation; @@ -214,7 +214,7 @@ void N(appendGfx_reflect_player_floor_basic)(PlayerStatus* playerStatus) { guMtxCatF(main, rotation, main); guScaleF(scale, SPRITE_WORLD_SCALE_F, -SPRITE_WORLD_SCALE_F, SPRITE_WORLD_SCALE_F); guMtxCatF(main, scale, main); - guTranslateF(translation, playerStatus->position.x, -playerStatus->position.y, playerStatus->position.z); + guTranslateF(translation, playerStatus->pos.x, -playerStatus->pos.y, playerStatus->pos.z); guMtxCatF(main, translation, main); if (playerStatus->spriteFacingAngle >= 90.0f && playerStatus->spriteFacingAngle < 270.0f) { @@ -244,7 +244,7 @@ void N(appendGfx_reflect_player_floor_fancy)(PlayerStatus* playerStatus) { s32 spriteIdx; for (i = 0; i < 2; i++) { - yaw = -gCameras[gCurrentCamID].currentYaw; + yaw = -gCameras[gCurrentCamID].curYaw; if (i == 0) { if ((playerStatus->spriteFacingAngle > 90.0f) && (playerStatus->spriteFacingAngle <= 180.0f)) { @@ -270,21 +270,21 @@ void N(appendGfx_reflect_player_floor_fancy)(PlayerStatus* playerStatus) { guRotateF(rotation, yaw, 0.0f, -1.0f, 0.0f); guRotateF(mtx, clamp_angle(playerStatus->pitch), 0.0f, 0.0f, 1.0f); guMtxCatF(rotation, mtx, mtx); - px = playerStatus->position.x; - py = playerStatus->position.y; - pz = playerStatus->position.z; + px = playerStatus->pos.x; + py = playerStatus->pos.y; + pz = playerStatus->pos.z; } else { // Spinning blur animation blurAngle = phys_get_spin_history(i, &x, &y, &z); if (y == 0x80000000) { - py = playerStatus->position.y; + py = playerStatus->pos.y; } else { py = y; } - px = playerStatus->position.x; - pz = playerStatus->position.z; + px = playerStatus->pos.x; + pz = playerStatus->pos.z; set_player_imgfx_comp(PLAYER_SPRITE_AUX1, -1, IMGFX_SET_ALPHA, 0, 0, 0, 64, 0); guRotateF(mtx, yaw, 0.0f, -1.0f, 0.0f); guRotateF(rotation, yaw, 0.0f, -1.0f, 0.0f); diff --git a/src/world/area_pra/pra_02/pra_02_4_entity.c b/src/world/area_pra/pra_02/pra_02_4_entity.c index 2d882b0f7bd..d3db0f2e591 100644 --- a/src/world/area_pra/pra_02/pra_02_4_entity.c +++ b/src/world/area_pra/pra_02/pra_02_4_entity.c @@ -68,9 +68,9 @@ API_CALLABLE(N(UpdatePadlockPosition)) { } entity = get_entity_by_index(entityIdx); - entity->position.x = x; - entity->position.y = y + offset; - entity->position.z = z; + entity->pos.x = x; + entity->pos.y = y + offset; + entity->pos.z = z; return ApiStatus_DONE2; } diff --git a/src/world/area_pra/pra_03/pra_03_3_entity.c b/src/world/area_pra/pra_03/pra_03_3_entity.c index 9ee73d8dee9..b33e0d39bb6 100644 --- a/src/world/area_pra/pra_03/pra_03_3_entity.c +++ b/src/world/area_pra/pra_03/pra_03_3_entity.c @@ -28,10 +28,10 @@ API_CALLABLE(N(GetTargetPosXForSpring_Floor0)) { API_CALLABLE(N(MonitorPlayerFloor)) { PlayerStatus* playerStatus = &gPlayerStatus; - if (playerStatus->lastGoodPosition.y == 0) { + if (playerStatus->lastGoodPos.y == 0) { evt_set_variable(script, MV_PlayerFloor, 0); } - if (playerStatus->lastGoodPosition.y == -200) { + if (playerStatus->lastGoodPos.y == -200) { evt_set_variable(script, MV_PlayerFloor, 1); } return ApiStatus_BLOCK; diff --git a/src/world/area_pra/pra_04/pra_04_3_entity.c b/src/world/area_pra/pra_04/pra_04_3_entity.c index 314cdbc8f5a..28d8d57d742 100644 --- a/src/world/area_pra/pra_04/pra_04_3_entity.c +++ b/src/world/area_pra/pra_04/pra_04_3_entity.c @@ -28,10 +28,10 @@ API_CALLABLE(N(GetTargetPosXForSpring_Floor0)) { API_CALLABLE(N(MonitorPlayerFloor)) { PlayerStatus* playerStatus = &gPlayerStatus; - if (playerStatus->lastGoodPosition.y == 0) { + if (playerStatus->lastGoodPos.y == 0) { evt_set_variable(script, MV_PlayerFloor, 0); } - if (playerStatus->lastGoodPosition.y == -200) { + if (playerStatus->lastGoodPos.y == -200) { evt_set_variable(script, MV_PlayerFloor, 1); } return ApiStatus_BLOCK; diff --git a/src/world/area_pra/pra_09/pra_09_3_npc.c b/src/world/area_pra/pra_09/pra_09_3_npc.c index f16ff51af54..99a472893b5 100644 --- a/src/world/area_pra/pra_09/pra_09_3_npc.c +++ b/src/world/area_pra/pra_09/pra_09_3_npc.c @@ -66,21 +66,21 @@ API_CALLABLE(N(ImposterFallFromCeiling)) { npc->pos.x = script->varTable[1]; npc->pos.y = script->varTable[2]; npc->pos.z = script->varTable[3]; - npc->jumpVelocity = 0.0f; - npc->currentAnim = ANIM_WorldBombette_Aftermath; + npc->jumpVel = 0.0f; + npc->curAnim = ANIM_WorldBombette_Aftermath; npc->jumpScale = 0.8f; } - npc->rotation.z -= 39.0f; - npc->rotation.x -= 33.0f; - npc->pos.y -= npc->jumpVelocity; - npc->jumpVelocity += npc->jumpScale; + npc->rot.z -= 39.0f; + npc->rot.x -= 33.0f; + npc->pos.y -= npc->jumpVel; + npc->jumpVel += npc->jumpScale; if (npc->pos.y <= 0.0f) { npc->pos.y = 0.0f; - npc->rotation.z = 0.0f; - npc->rotation.x = 0.0f; - npc->jumpVelocity = 0.0f; + npc->rot.z = 0.0f; + npc->rot.x = 0.0f; + npc->jumpVel = 0.0f; npc->jumpScale = 0.0f; - npc->currentAnim = ANIM_WorldBombette_Idle; + npc->curAnim = ANIM_WorldBombette_Idle; return ApiStatus_DONE2; } return ApiStatus_BLOCK; diff --git a/src/world/area_pra/pra_13/pra_13_3_npc.c b/src/world/area_pra/pra_13/pra_13_3_npc.c index bf893c622f9..e319227f9b6 100644 --- a/src/world/area_pra/pra_13/pra_13_3_npc.c +++ b/src/world/area_pra/pra_13/pra_13_3_npc.c @@ -43,7 +43,7 @@ void N(worker_draw_fake_player)(void) { get_screen_coords(gCurrentCamID, npc->pos.x, npc->pos.y, -npc->pos.z, &x, &y, &z); rtPtr->renderMode = npc->renderMode; - rtPtr->distance = -z; + rtPtr->dist = -z; rtPtr->appendGfxArg = npc; rtPtr->appendGfx = N(appendGfx_fake_player); queue_render_task(rtPtr); @@ -55,12 +55,12 @@ void N(appendGfx_fake_player)(void* data) { Matrix4f mtxTransform, mtxTranslate, sp98, mtxScale; npc_get_render_yaw(npc); - guRotateF(mtxTransform, npc->renderYaw + gCameras[gCurrentCamID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(mtxTransform, npc->renderYaw + gCameras[gCurrentCamID].curYaw, 0.0f, 1.0f, 0.0f); guScaleF(mtxScale, SPRITE_WORLD_SCALE_F, SPRITE_WORLD_SCALE_F, SPRITE_WORLD_SCALE_F); guMtxCatF(mtxTransform, mtxScale, mtxTransform); guTranslateF(mtxTranslate, npc->pos.x, npc->pos.y, npc->pos.z); guMtxCatF(mtxTransform, mtxTranslate, mtxTransform); - spr_update_player_sprite(PLAYER_SPRITE_AUX2, npc->currentAnim, 1.0f); + spr_update_player_sprite(PLAYER_SPRITE_AUX2, npc->curAnim, 1.0f); spr_draw_player_sprite(PLAYER_SPRITE_AUX2, 0, 0, 0, mtxTransform); } diff --git a/src/world/area_pra/pra_19/pra_19_3_npc.c b/src/world/area_pra/pra_19/pra_19_3_npc.c index 7c82aa539f8..cf5403dfd7a 100644 --- a/src/world/area_pra/pra_19/pra_19_3_npc.c +++ b/src/world/area_pra/pra_19/pra_19_3_npc.c @@ -98,7 +98,7 @@ void N(worker_draw_example_player)(void) { get_screen_coords(gCurrentCamID, npc->pos.x, npc->pos.y, -npc->pos.z, &x, &y, &z); rtPtr->renderMode = npc->renderMode; - rtPtr->distance = -z; + rtPtr->dist = -z; rtPtr->appendGfxArg = npc; rtPtr->appendGfx = N(appendGfx_example_player); queue_render_task(rtPtr); @@ -110,12 +110,12 @@ void N(appendGfx_example_player)(void* data) { Matrix4f mtxTransform, mtxTranslate, mtxScale; npc_get_render_yaw(npc); - guRotateF(mtxTransform, npc->renderYaw + gCameras[gCurrentCamID].currentYaw, 0.0f, 1.0f, 0.0f); + guRotateF(mtxTransform, npc->renderYaw + gCameras[gCurrentCamID].curYaw, 0.0f, 1.0f, 0.0f); guScaleF(mtxScale, SPRITE_WORLD_SCALE_F, SPRITE_WORLD_SCALE_F, SPRITE_WORLD_SCALE_F); guMtxCatF(mtxTransform, mtxScale, mtxTransform); guTranslateF(mtxTranslate, npc->pos.x, npc->pos.y, npc->pos.z); guMtxCatF(mtxTransform, mtxTranslate, mtxTransform); - spr_update_player_sprite(PLAYER_SPRITE_AUX2, npc->currentAnim, 1.0f); + spr_update_player_sprite(PLAYER_SPRITE_AUX2, npc->curAnim, 1.0f); spr_draw_player_sprite(PLAYER_SPRITE_AUX2, 0, 0, 0, mtxTransform); } @@ -140,7 +140,7 @@ API_CALLABLE(N(AwaitImposterHitPlayer)) { Npc* npc2 = get_npc_unsafe(NPC_FakeLuigi); Npc* npc3 = get_npc_unsafe(NPC_FakeKoopaKoot); Npc* npc4 = get_npc_unsafe(NPC_FakeKolorado); - f32 playerX = gPlayerStatus.position.x; + f32 playerX = gPlayerStatus.pos.x; if (npc0->pos.x < playerX) { return ApiStatus_DONE2; diff --git a/src/world/area_pra/pra_21/pra_21_3_entity.c b/src/world/area_pra/pra_21/pra_21_3_entity.c index a1a9e6cec3b..1b5e1084276 100644 --- a/src/world/area_pra/pra_21/pra_21_3_entity.c +++ b/src/world/area_pra/pra_21/pra_21_3_entity.c @@ -16,10 +16,10 @@ API_CALLABLE(N(GetTargetPosXForSpring)) { API_CALLABLE(N(MonitorPlayerFloor)) { PlayerStatus* playerStatus = &gPlayerStatus; - if (playerStatus->lastGoodPosition.y == 0) { + if (playerStatus->lastGoodPos.y == 0) { evt_set_variable(script, MV_PlayerFloor, 0); } - if (playerStatus->lastGoodPosition.y == -200) { + if (playerStatus->lastGoodPos.y == -200) { evt_set_variable(script, MV_PlayerFloor, 1); } return ApiStatus_BLOCK; diff --git a/src/world/area_pra/pra_22/pra_22_2_main.c b/src/world/area_pra/pra_22/pra_22_2_main.c index 10032d91b85..5fae9d306b8 100644 --- a/src/world/area_pra/pra_22/pra_22_2_main.c +++ b/src/world/area_pra/pra_22/pra_22_2_main.c @@ -7,18 +7,18 @@ API_CALLABLE(N(PreventFalling)) { PlayerStatus* playerStatus = &gPlayerStatus; f32 x, y, z, hitDepth; - playerStatus->position.x = script->varTable[0]; - x = playerStatus->position.x; - y = playerStatus->position.y + 10.0f; - z = playerStatus->position.z; + playerStatus->pos.x = script->varTable[0]; + x = playerStatus->pos.x; + y = playerStatus->pos.y + 10.0f; + z = playerStatus->pos.z; hitDepth = 300.0f; npc_raycast_down_around(0, &x, &y, &z, &hitDepth, 270.0f, playerStatus->colliderDiameter); - playerStatus->position.x = x; - playerStatus->position.z = z; + playerStatus->pos.x = x; + playerStatus->pos.z = z; script->varTable[10] = FALSE; - if (playerStatus->position.y != y) { - playerStatus->position.y = 0.0f; + if (playerStatus->pos.y != y) { + playerStatus->pos.y = 0.0f; script->varTable[3]++; if (script->varTable[3] >= 30) { // player may now fall diff --git a/src/world/area_pra/pra_22/pra_22_3_entity.c b/src/world/area_pra/pra_22/pra_22_3_entity.c index 15bf28cf2ad..dc83aaf7728 100644 --- a/src/world/area_pra/pra_22/pra_22_3_entity.c +++ b/src/world/area_pra/pra_22/pra_22_3_entity.c @@ -16,10 +16,10 @@ API_CALLABLE(N(GetTargetPosXForSpring)) { API_CALLABLE(N(MonitorPlayerFloor)) { PlayerStatus* playerStatus = &gPlayerStatus; - if (playerStatus->lastGoodPosition.y == 0) { + if (playerStatus->lastGoodPos.y == 0) { evt_set_variable(script, MV_PlayerFloor, 0); } - if (playerStatus->lastGoodPosition.y == -200) { + if (playerStatus->lastGoodPos.y == -200) { evt_set_variable(script, MV_PlayerFloor, 1); } return ApiStatus_BLOCK; diff --git a/src/world/area_pra/pra_31/pra_31_2_npc.c b/src/world/area_pra/pra_31/pra_31_2_npc.c index 8cd98366d21..5e9f3da355d 100644 --- a/src/world/area_pra/pra_31/pra_31_2_npc.c +++ b/src/world/area_pra/pra_31/pra_31_2_npc.c @@ -9,7 +9,7 @@ MAP_STATIC_PAD(1,key_item); API_CALLABLE(N(GetAngleToPlayer)) { Npc* npc = get_npc_safe(script->owner2.npcID); - script->varTable[0] = clamp_angle(atan2(npc->pos.x, npc->pos.z, gPlayerStatus.position.x, gPlayerStatus.position.z)); + script->varTable[0] = clamp_angle(atan2(npc->pos.x, npc->pos.z, gPlayerStatus.pos.x, gPlayerStatus.pos.z)); return ApiStatus_DONE2; } diff --git a/src/world/area_pra/pra_31/pra_31_4_puzzle.c b/src/world/area_pra/pra_31/pra_31_4_puzzle.c index d6807ed3b55..431c2612c7d 100644 --- a/src/world/area_pra/pra_31/pra_31_4_puzzle.c +++ b/src/world/area_pra/pra_31/pra_31_4_puzzle.c @@ -9,8 +9,8 @@ typedef struct DinoData { /* 0x00 */ s16 ci; // cell i index /* 0x02 */ s16 cj; // cell j index - /* 0x04 */ f32 currentPosX; - /* 0x08 */ f32 currentPosZ; + /* 0x04 */ f32 corPosX; + /* 0x08 */ f32 curPosZ; /* 0x0C */ f32 goalPosX; /* 0x10 */ f32 goalPosZ; /* 0x14 */ f32 angle; @@ -73,8 +73,8 @@ API_CALLABLE(N(EVS_ManagePuzzle)) { dino->cj = N(InitialConfigurationAfter)[j][1]; dino->angle = N(InitialConfigurationAfter)[j][2]; } - dino->currentPosX = dino->goalPosX = (dino->ci * DINO_CELL_SIZE) + DINO_CELL_SIZE; - dino->currentPosZ = dino->goalPosZ = (dino->cj * DINO_CELL_SIZE) + DINO_CELL_SIZE + DINO_CELL_SIZE / 2; + dino->corPosX = dino->goalPosX = (dino->ci * DINO_CELL_SIZE) + DINO_CELL_SIZE; + dino->curPosZ = dino->goalPosZ = (dino->cj * DINO_CELL_SIZE) + DINO_CELL_SIZE + DINO_CELL_SIZE / 2; puzzle->cells[dino->cj][dino->ci] = CELL_DINO; } evt_set_variable(script, MV_DinoYaw_01, 270); @@ -85,17 +85,17 @@ API_CALLABLE(N(EVS_ManagePuzzle)) { puzzle = (DinoPuzzleData*) evt_get_variable(script, MV_PuzzleDataPtr); dino = &puzzle->dinos[0]; for (j = 0; j < DINO_COUNT; j++, dino++) { - if (dino->currentPosX < dino->goalPosX) { - dino->currentPosX += (f32) DINO_CELL_SIZE / PUSH_TIME; + if (dino->corPosX < dino->goalPosX) { + dino->corPosX += (f32) DINO_CELL_SIZE / PUSH_TIME; } - if (dino->currentPosX > dino->goalPosX) { - dino->currentPosX -= (f32) DINO_CELL_SIZE / PUSH_TIME; + if (dino->corPosX > dino->goalPosX) { + dino->corPosX -= (f32) DINO_CELL_SIZE / PUSH_TIME; } - if (dino->currentPosZ < dino->goalPosZ) { - dino->currentPosZ += (f32) DINO_CELL_SIZE / PUSH_TIME; + if (dino->curPosZ < dino->goalPosZ) { + dino->curPosZ += (f32) DINO_CELL_SIZE / PUSH_TIME; } - if (dino->currentPosZ > dino->goalPosZ) { - dino->currentPosZ -= (f32) DINO_CELL_SIZE / PUSH_TIME; + if (dino->curPosZ > dino->goalPosZ) { + dino->curPosZ -= (f32) DINO_CELL_SIZE / PUSH_TIME; } } @@ -248,23 +248,23 @@ API_CALLABLE(N(GetPlayerPushLerpValues)) { switch ((s32)dino->angle) { case 0: - script->varTable[3] = playerStatus->position.z; - script->varTable[4] = playerStatus->position.z + DINO_CELL_SIZE; + script->varTable[3] = playerStatus->pos.z; + script->varTable[4] = playerStatus->pos.z + DINO_CELL_SIZE; script->varTable[5] = 1; break; case 90: - script->varTable[3] = playerStatus->position.x; - script->varTable[4] = playerStatus->position.x + DINO_CELL_SIZE; + script->varTable[3] = playerStatus->pos.x; + script->varTable[4] = playerStatus->pos.x + DINO_CELL_SIZE; script->varTable[5] = 0; break; case 180: - script->varTable[3] = playerStatus->position.z; - script->varTable[4] = playerStatus->position.z - DINO_CELL_SIZE; + script->varTable[3] = playerStatus->pos.z; + script->varTable[4] = playerStatus->pos.z - DINO_CELL_SIZE; script->varTable[5] = 1; break; case 270: - script->varTable[3] = playerStatus->position.x; - script->varTable[4] = playerStatus->position.x - DINO_CELL_SIZE; + script->varTable[3] = playerStatus->pos.x; + script->varTable[4] = playerStatus->pos.x - DINO_CELL_SIZE; script->varTable[5] = 0; break; } @@ -279,8 +279,8 @@ API_CALLABLE(N(GetDinoStatuePosRot)) { DinoPuzzleData* puzzle = (DinoPuzzleData*) evt_get_variable(script, MV_PuzzleDataPtr); DinoData* dino = &puzzle->dinos[idx]; - evt_set_float_variable(script, LVar0, dino->currentPosX); - evt_set_float_variable(script, LVar1, -dino->currentPosZ); + evt_set_float_variable(script, LVar0, dino->corPosX); + evt_set_float_variable(script, LVar1, -dino->curPosZ); evt_set_float_variable(script, LVar2, clamp_angle(dino->angle + 90.0)); return ApiStatus_DONE2; } @@ -291,8 +291,8 @@ API_CALLABLE(N(GetDinoNpcPosRot)) { DinoPuzzleData* puzzle = (DinoPuzzleData*) evt_get_variable(script, MV_PuzzleDataPtr); DinoData* dino = &puzzle->dinos[idx]; - evt_set_float_variable(script, LVar0, dino->currentPosX); - evt_set_float_variable(script, LVar1, dino->currentPosZ); + evt_set_float_variable(script, LVar0, dino->corPosX); + evt_set_float_variable(script, LVar1, dino->curPosZ); evt_set_float_variable(script, LVar2, clamp_angle(dino->angle)); return ApiStatus_DONE2; } diff --git a/src/world/area_pra/pra_33/pra_33_3_entity.c b/src/world/area_pra/pra_33/pra_33_3_entity.c index 3400dd52c72..f253a3b3d32 100644 --- a/src/world/area_pra/pra_33/pra_33_3_entity.c +++ b/src/world/area_pra/pra_33/pra_33_3_entity.c @@ -3,7 +3,7 @@ API_CALLABLE(N(CheckPlayerOnDais)) { script->varTable[10] = 0; - if (gCollisionStatus.currentFloor == COLLIDER_o1045) { + if (gCollisionStatus.curFloor == COLLIDER_o1045) { script->varTable[10] = 1; } if (gCollisionStatus.lastTouchedFloor == COLLIDER_o1045) { @@ -13,8 +13,8 @@ API_CALLABLE(N(CheckPlayerOnDais)) { } API_CALLABLE(N(GetDaisRelativePlayerPos)) { - script->varTable[6] = dist2D(200.0f, 0.0f, gPlayerStatus.position.x, gPlayerStatus.position.z); - script->varTable[7] = atan2(200.0f, 0.0f, gPlayerStatus.position.x, gPlayerStatus.position.z); + script->varTable[6] = dist2D(200.0f, 0.0f, gPlayerStatus.pos.x, gPlayerStatus.pos.z); + script->varTable[7] = atan2(200.0f, 0.0f, gPlayerStatus.pos.x, gPlayerStatus.pos.z); script->varTable[7] = clamp_angle(script->varTable[7]); return ApiStatus_DONE2; } @@ -23,8 +23,8 @@ API_CALLABLE(N(UpdateDaisPlayerPos)) { f32 sinTheta, cosTheta; sin_cos_deg(script->varTable[7], &sinTheta, &cosTheta); - gPlayerStatus.position.x = (script->varTable[6] * sinTheta) + 200.0f; - gPlayerStatus.position.z = (script->varTable[6] * -cosTheta) + 0.0f; + gPlayerStatus.pos.x = (script->varTable[6] * sinTheta) + 200.0f; + gPlayerStatus.pos.z = (script->varTable[6] * -cosTheta) + 0.0f; return ApiStatus_DONE2; } diff --git a/src/world/area_sam/sam_03/sam_03_3_npc1.c b/src/world/area_sam/sam_03/sam_03_3_npc1.c index 552d517e1ae..4ef0e263437 100644 --- a/src/world/area_sam/sam_03/sam_03_3_npc1.c +++ b/src/world/area_sam/sam_03/sam_03_3_npc1.c @@ -5,7 +5,7 @@ API_CALLABLE(N(GetAngleToPlayer)) { Npc* npc = get_npc_unsafe(NPC_JrTroopa); - script->varTable[0] = atan2(npc->pos.x, npc->pos.z, gPlayerStatus.position.x, gPlayerStatus.position.z); + script->varTable[0] = atan2(npc->pos.x, npc->pos.z, gPlayerStatus.pos.x, gPlayerStatus.pos.z); return ApiStatus_DONE2; } diff --git a/src/world/area_sam/sam_07/sam_07_4_frozen_pit.c b/src/world/area_sam/sam_07/sam_07_4_frozen_pit.c index 72e4565d35d..5bf8d55b8a8 100644 --- a/src/world/area_sam/sam_07/sam_07_4_frozen_pit.c +++ b/src/world/area_sam/sam_07/sam_07_4_frozen_pit.c @@ -21,7 +21,7 @@ typedef struct IceShard { /* 0x10 */ Vec3f initialPos; /* 0x1C */ Vec3f rot; /* 0x28 */ Vec3f rotVel; - /* 0x34 */ f32 velocityY; + /* 0x34 */ f32 velY; /* 0x38 */ f32 moveSpeed; /* 0x3C */ f32 moveAngle; /* 0x40 */ Matrix4f transformMatrix; @@ -57,7 +57,7 @@ API_CALLABLE(N(AnimateIceShattering)) { it->rotVel.x = rand_int(20) - 10; it->rotVel.y = rand_int(20) - 10; it->rotVel.z = rand_int(20) - 10; - it->velocityY = rand_int(5) + 5.0f; + it->velY = rand_int(5) + 5.0f; it->moveSpeed = rand_int(3) + 1.0f; it->moveAngle = rand_int(360); @@ -74,10 +74,10 @@ API_CALLABLE(N(AnimateIceShattering)) { model = get_model_from_list_index(get_model_list_index_from_tree_index(N(IceShardModels)[i])); if (it->state == 0) { add_vec2D_polar(&it->pos.x, &it->pos.z, it->moveSpeed, it->moveAngle); - it->velocityY -= 1.0f; - it->pos.y += it->velocityY; - if (it->velocityY < 0.0f) { - if (it->pos.y < playerStatus->position.y - 150.0f) { + it->velY -= 1.0f; + it->pos.y += it->velY; + if (it->velY < 0.0f) { + if (it->pos.y < playerStatus->pos.y - 150.0f) { // this shard is done, stop moving and increment the 'done' counter script->functionTemp[1]++; it->state = 101; @@ -125,7 +125,7 @@ API_CALLABLE(N(AwaitPlayerNotPoundingFloor)) { s32 floor1 = evt_get_variable(script, *args++); s32 floor2 = evt_get_variable(script, *args++); - if (gCollisionStatus.currentFloor == floor1 || gCollisionStatus.currentFloor == floor2) { + if (gCollisionStatus.curFloor == floor1 || gCollisionStatus.curFloor == floor2) { if (playerStatus->actionState == ACTION_STATE_SPIN_POUND || playerStatus->actionState == ACTION_STATE_TORNADO_POUND) { diff --git a/src/world/area_sam/sam_10/sam_10_4_stairs.c b/src/world/area_sam/sam_10/sam_10_4_stairs.c index 623885dd110..e708f7fe3f6 100644 --- a/src/world/area_sam/sam_10/sam_10_4_stairs.c +++ b/src/world/area_sam/sam_10/sam_10_4_stairs.c @@ -35,10 +35,10 @@ Vec2i N(StaircaseStepsData)[] = { }; API_CALLABLE(N(GetCamPointsNearPlayer)) { - script->varTable[0] = gPlayerStatus.position.x + (sin_deg(310.0f) * 100.0f); - script->varTable[1] = gPlayerStatus.position.z - (cos_deg(310.0f) * 100.0f); - script->varTable[2] = gPlayerStatus.position.x + (sin_deg(130.0f) * 100.0f); - script->varTable[3] = gPlayerStatus.position.z - (cos_deg(130.0f) * 100.0f); + script->varTable[0] = gPlayerStatus.pos.x + (sin_deg(310.0f) * 100.0f); + script->varTable[1] = gPlayerStatus.pos.z - (cos_deg(310.0f) * 100.0f); + script->varTable[2] = gPlayerStatus.pos.x + (sin_deg(130.0f) * 100.0f); + script->varTable[3] = gPlayerStatus.pos.z - (cos_deg(130.0f) * 100.0f); return ApiStatus_DONE2; } diff --git a/src/world/area_sam/sam_11/sam_11_4_entity.c b/src/world/area_sam/sam_11/sam_11_4_entity.c index 9e109a9c06c..008db347434 100644 --- a/src/world/area_sam/sam_11/sam_11_4_entity.c +++ b/src/world/area_sam/sam_11/sam_11_4_entity.c @@ -80,16 +80,16 @@ API_CALLABLE(N(MovePlayerAlongRoofSlide)) { script->functionTemp[1] += 4; xComp = (script->functionTemp[1] / 10) * sin_deg(playerStatus->targetYaw); zComp = (script->functionTemp[1] / 10) * -cos_deg(playerStatus->targetYaw); - x = playerStatus->position.x + xComp; - y = playerStatus->position.y + playerStatus->colliderHeight * 0.5f; - z = playerStatus->position.z + zComp; + x = playerStatus->pos.x + xComp; + y = playerStatus->pos.y + playerStatus->colliderHeight * 0.5f; + z = playerStatus->pos.z + zComp; hitDepth = 500.0f; if (npc_raycast_down_sides(0, &x, &y, &z, &hitDepth)) { if (hitDepth < 100.0f) { - playerStatus->position.x = x; - playerStatus->position.y = y; - playerStatus->position.z = z; + playerStatus->pos.x = x; + playerStatus->pos.y = y; + playerStatus->pos.z = z; return ApiStatus_BLOCK; } } @@ -108,10 +108,10 @@ API_CALLABLE(N(IsPlayerInputDisabled)) { API_CALLABLE(N(MonitorCurrenFloor)) { PlayerStatus* playerStatus = &gPlayerStatus; - if (playerStatus->lastGoodPosition.y == 385) { + if (playerStatus->lastGoodPos.y == 385) { evt_set_variable(script, MV_CurrentFloor, 0); } - if (playerStatus->lastGoodPosition.y == 150) { + if (playerStatus->lastGoodPos.y == 150) { evt_set_variable(script, MV_CurrentFloor, 1); } return ApiStatus_BLOCK; diff --git a/src/world/area_sam/sam_11/sam_11_5_npc.c b/src/world/area_sam/sam_11/sam_11_5_npc.c index 9e268433d0f..092a269fcf0 100644 --- a/src/world/area_sam/sam_11/sam_11_5_npc.c +++ b/src/world/area_sam/sam_11/sam_11_5_npc.c @@ -35,23 +35,23 @@ API_CALLABLE(N(UpdateSentryPosition)) { f32 var_f2; if (*posZ == npc->pos.z) { - if(npc->currentAnim != ANIM_Penguin_Idle) { - npc->currentAnim = ANIM_Penguin_Idle; + if(npc->curAnim != ANIM_Penguin_Idle) { + npc->curAnim = ANIM_Penguin_Idle; } } if (*posZ != npc->pos.z) { - if (npc->currentAnim != ANIM_Penguin_Walk) { - npc->currentAnim = ANIM_Penguin_Walk; + if (npc->curAnim != ANIM_Penguin_Walk) { + npc->curAnim = ANIM_Penguin_Walk; } } *posZ = npc->pos.z; - if (!(dist2D(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z) < 30.0f) && - !(dist2D(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z) > 130.0f)) + if (!(dist2D(npc->pos.x, npc->pos.z, playerStatus->pos.x, playerStatus->pos.z) < 30.0f) && + !(dist2D(npc->pos.x, npc->pos.z, playerStatus->pos.x, playerStatus->pos.z) > 130.0f)) { - playerX = var_f2 = playerStatus->position.z; + playerX = var_f2 = playerStatus->pos.z; if (playerX > 50.0f) { var_f2 = 50.0f; } diff --git a/src/world/area_sam/sam_11/sam_11_6_pond.c b/src/world/area_sam/sam_11/sam_11_6_pond.c index 82f212b75a9..cb9506f1663 100644 --- a/src/world/area_sam/sam_11/sam_11_6_pond.c +++ b/src/world/area_sam/sam_11/sam_11_6_pond.c @@ -29,7 +29,7 @@ API_CALLABLE(N(SpawnIceShards)) { a5 = 4.0f; effect->data.iceShard->animFrame = 0.0f; effect->data.iceShard->animRate = (rand_int(10) * 0.2) + 0.1; - effect->data.iceShard->rotation = i * 35; + effect->data.iceShard->rot = i * 35; effect->data.iceShard->angularVel = rand_int(10) - 5; effect->data.iceShard->vel.x = t1; effect->data.iceShard->vel.y = a5; @@ -41,7 +41,7 @@ API_CALLABLE(N(SpawnIceShards)) { API_CALLABLE(N(func_80241FB0_D3C580)) { script->varTable[10] = 0; - if (gCollisionStatus.currentFloor == COLLIDER_suimen) { + if (gCollisionStatus.curFloor == COLLIDER_suimen) { script->varTable[10] = 1; } if (gCollisionStatus.lastTouchedFloor == COLLIDER_suimen) { @@ -52,15 +52,15 @@ API_CALLABLE(N(func_80241FB0_D3C580)) { API_CALLABLE(N(SetDraggingPlayerPosY)) { PlayerStatus* playerStatus = &gPlayerStatus; - f32 x = playerStatus->position.x; - f32 y = playerStatus->position.y + 10.0f; - f32 z = playerStatus->position.z; + f32 x = playerStatus->pos.x; + f32 y = playerStatus->pos.y + 10.0f; + f32 z = playerStatus->pos.z; f32 hitDepth = 40.0f; npc_raycast_down_sides(0, &x, &y, &z, &hitDepth); - playerStatus->position.x = x; - playerStatus->position.y = y; - playerStatus->position.z = z; + playerStatus->pos.x = x; + playerStatus->pos.y = y; + playerStatus->pos.z = z; return ApiStatus_DONE2; } diff --git a/src/world/area_sam/sam_12/sam_12_4_scenes.c b/src/world/area_sam/sam_12/sam_12_4_scenes.c index 95413a8b140..17bb0f13fb6 100644 --- a/src/world/area_sam/sam_12/sam_12_4_scenes.c +++ b/src/world/area_sam/sam_12/sam_12_4_scenes.c @@ -17,9 +17,9 @@ API_CALLABLE(N(SetItemPositionF)) { s32 z = evt_get_float_variable(script, *args++); ItemEntity* item = get_item_entity(idx); - item->position.x = x; - item->position.y = y; - item->position.z = z; + item->pos.x = x; + item->pos.y = y; + item->pos.z = z; return ApiStatus_DONE2; } @@ -37,9 +37,9 @@ API_CALLABLE(N(SpawnSleepBubble)) { fx_sleep_bubble( 0, - gPlayerStatus.position.x + x, - gPlayerStatus.position.y + ((gPlayerStatus.colliderHeight * 2) / 3) + y, - gPlayerStatus.position.z + z, + gPlayerStatus.pos.x + x, + gPlayerStatus.pos.y + ((gPlayerStatus.colliderHeight * 2) / 3) + y, + gPlayerStatus.pos.z + z, (gPlayerStatus.colliderHeight / 3) + t, temp_f26, &effect diff --git a/src/world/area_tik/common/DripVolumes.inc.c b/src/world/area_tik/common/DripVolumes.inc.c index 53ec20bf3d0..b8af0a53ffe 100644 --- a/src/world/area_tik/common/DripVolumes.inc.c +++ b/src/world/area_tik/common/DripVolumes.inc.c @@ -18,9 +18,9 @@ API_CALLABLE(N(CheckDripCollisionWithNPC)) { s32 i; script->varTable[2] = 0; - xDiff = playerStatus->position.x - model->center.x; - zDiff = playerStatus->position.z - model->center.z; - yVal = playerStatus->position.y + playerStatus->colliderHeight - 1.5f - model->center.y; + xDiff = playerStatus->pos.x - model->center.x; + zDiff = playerStatus->pos.z - model->center.z; + yVal = playerStatus->pos.y + playerStatus->colliderHeight - 1.5f - model->center.y; sqrtTemp = sqrtf(SQ(xDiff) + SQ(zDiff)); if (yVal > 0.0f && yVal < playerStatus->colliderHeight && sqrtTemp < playerStatus->colliderDiameter * 0.5f) { diff --git a/src/world/area_tik/tik_03/tik_03_4_platforms.c b/src/world/area_tik/tik_03/tik_03_4_platforms.c index 80f32837460..c597f656fd5 100644 --- a/src/world/area_tik/tik_03/tik_03_4_platforms.c +++ b/src/world/area_tik/tik_03/tik_03_4_platforms.c @@ -12,7 +12,7 @@ API_CALLABLE(N(PausePlatformsDuringPound)) { u32 i; for (i = 0; i < ARRAY_COUNT(N(PlatformColliders)); i++) { - if (gCollisionStatus.currentFloor != N(PlatformColliders)[i]) { + if (gCollisionStatus.curFloor != N(PlatformColliders)[i]) { continue; } if ((player->actionState == ACTION_STATE_SPIN_POUND) || (player->actionState == ACTION_STATE_TORNADO_POUND)) { diff --git a/src/world/area_tik/tik_03/tik_03_6_demo.c b/src/world/area_tik/tik_03/tik_03_6_demo.c index c454b14942b..7bf270895c4 100644 --- a/src/world/area_tik/tik_03/tik_03_6_demo.c +++ b/src/world/area_tik/tik_03/tik_03_6_demo.c @@ -65,11 +65,11 @@ API_CALLABLE(N(SetupDemoScene)) { break; case 3: partner_clear_player_tracking(wPartnerNpc); - partner_set_goal_pos(player->position.x, player->position.z); + partner_set_goal_pos(player->pos.x, player->pos.z); func_800EF3D4(0); wPartnerNpc->yaw = 270.0f; gPlayerStatus.targetYaw = 270.0f; - gPlayerStatus.currentYaw = 270.0f; + gPlayerStatus.curYaw = 270.0f; gPlayerStatus.spriteFacingAngle = 180.0f; return ApiStatus_DONE2; } diff --git a/src/world/area_tik/tik_04/tik_04_4_platforms.c b/src/world/area_tik/tik_04/tik_04_4_platforms.c index f62bdf5ce96..a4f998fe670 100644 --- a/src/world/area_tik/tik_04/tik_04_4_platforms.c +++ b/src/world/area_tik/tik_04/tik_04_4_platforms.c @@ -26,12 +26,12 @@ API_CALLABLE(N(UpdatePlatformShadows)) { hitLength = 1000.0f; entity_raycast_down(&x, &y, &z, &hitYaw, &hitPitch, &hitLength); set_standard_shadow_scale(shadow, hitLength); - shadow->position.x = x; - shadow->position.y = y; - shadow->position.z = z; - shadow->rotation.x = hitYaw; - shadow->rotation.y = 0.0f; - shadow->rotation.z = hitPitch; + shadow->pos.x = x; + shadow->pos.y = y; + shadow->pos.z = z; + shadow->rot.x = hitYaw; + shadow->rot.y = 0.0f; + shadow->rot.z = hitPitch; shadow->scale.x *= 4.5f; shadow->scale.z *= 4.5f; @@ -43,12 +43,12 @@ API_CALLABLE(N(UpdatePlatformShadows)) { hitLength = 1000.0f; entity_raycast_down(&x, &y, &z, &hitYaw, &hitPitch, &hitLength); set_standard_shadow_scale(shadow, hitLength); - shadow->position.x = x; - shadow->position.y = y; - shadow->position.z = z; - shadow->rotation.x = hitYaw; - shadow->rotation.y = 0.0f; - shadow->rotation.z = hitPitch; + shadow->pos.x = x; + shadow->pos.y = y; + shadow->pos.z = z; + shadow->rot.x = hitYaw; + shadow->rot.y = 0.0f; + shadow->rot.z = hitPitch; shadow->scale.x *= 4.5f; shadow->scale.z *= 4.5f; @@ -59,14 +59,14 @@ API_CALLABLE(N(GetFloorCollider)) { Bytecode* args = script->ptrReadPos; s32 outVar = *args++; - evt_set_variable(script, outVar, gCollisionStatus.currentFloor); + evt_set_variable(script, outVar, gCollisionStatus.curFloor); return ApiStatus_DONE2; } API_CALLABLE(N(PausePlatformsDuringPound)) { PlayerStatus* player = &gPlayerStatus; - if (gCollisionStatus.currentFloor == COLLIDER_erb1 || gCollisionStatus.currentFloor == COLLIDER_erb2) { + if (gCollisionStatus.curFloor == COLLIDER_erb1 || gCollisionStatus.curFloor == COLLIDER_erb2) { if (player->actionState == ACTION_STATE_SPIN_POUND || player->actionState == ACTION_STATE_TORNADO_POUND) { return ApiStatus_BLOCK; } diff --git a/src/world/area_tik/tik_07/tik_07_5_platforms.c b/src/world/area_tik/tik_07/tik_07_5_platforms.c index df2b904b4e8..2f700c46daf 100644 --- a/src/world/area_tik/tik_07/tik_07_5_platforms.c +++ b/src/world/area_tik/tik_07/tik_07_5_platforms.c @@ -12,7 +12,7 @@ API_CALLABLE(N(PausePlatformsDuringPound)) { u32 i; for (i = 0; i < ARRAY_COUNT(N(PlatformColliders)); i++) { - if (gCollisionStatus.currentFloor != N(PlatformColliders)[i]) { + if (gCollisionStatus.curFloor != N(PlatformColliders)[i]) { continue; } if ((player->actionState == ACTION_STATE_SPIN_POUND) || (player->actionState == ACTION_STATE_TORNADO_POUND)) { diff --git a/src/world/area_trd/trd_03/trd_03_4_puzzle.c b/src/world/area_trd/trd_03/trd_03_4_puzzle.c index 82ddb40626a..ed18e51bdc6 100644 --- a/src/world/area_trd/trd_03/trd_03_4_puzzle.c +++ b/src/world/area_trd/trd_03/trd_03_4_puzzle.c @@ -9,10 +9,10 @@ API_CALLABLE(N(GetLeftRightPoints)) { s32 switchPosZ = evt_get_variable(script, *args++); f32 dist = evt_get_variable(script, *args++); - script->varTable[0] = switchPosX + (sin_deg(gCameras[CAM_DEFAULT].currentYaw + 270.0f + dist) * 100.0f); - script->varTable[1] = switchPosZ - (cos_deg(gCameras[CAM_DEFAULT].currentYaw + 270.0f + dist) * 100.0f); - script->varTable[2] = switchPosX + (sin_deg(gCameras[CAM_DEFAULT].currentYaw + 90.0f + dist) * 100.0f); - script->varTable[3] = switchPosZ - (cos_deg(gCameras[CAM_DEFAULT].currentYaw + 90.0f + dist) * 100.0f); + script->varTable[0] = switchPosX + (sin_deg(gCameras[CAM_DEFAULT].curYaw + 270.0f + dist) * 100.0f); + script->varTable[1] = switchPosZ - (cos_deg(gCameras[CAM_DEFAULT].curYaw + 270.0f + dist) * 100.0f); + script->varTable[2] = switchPosX + (sin_deg(gCameras[CAM_DEFAULT].curYaw + 90.0f + dist) * 100.0f); + script->varTable[3] = switchPosZ - (cos_deg(gCameras[CAM_DEFAULT].curYaw + 90.0f + dist) * 100.0f); return ApiStatus_DONE2; } diff --git a/src/world/area_trd/trd_05/trd_05_3_trap.c b/src/world/area_trd/trd_05/trd_05_3_trap.c index 56af2fd428f..a4ab8419488 100644 --- a/src/world/area_trd/trd_05/trd_05_3_trap.c +++ b/src/world/area_trd/trd_05/trd_05_3_trap.c @@ -78,9 +78,9 @@ void N(appendGfx_FallingSprite)(void) { API_CALLABLE(N(InitializeFallingSprite)) { FallingSprite* falling = &N(Falling); - falling->pos.x = gPlayerStatus.position.x; - falling->pos.y = gPlayerStatus.position.y + (gPlayerStatus.colliderHeight * SPRITE_WORLD_SCALE_D * 0.5); - falling->pos.z = gPlayerStatus.position.z; + falling->pos.x = gPlayerStatus.pos.x; + falling->pos.y = gPlayerStatus.pos.y + (gPlayerStatus.colliderHeight * SPRITE_WORLD_SCALE_D * 0.5); + falling->pos.z = gPlayerStatus.pos.z; falling->rot.x = 0.0f; falling->rot.y = 0.0f; falling->rot.z = 0.0f; diff --git a/src/world/area_trd/trd_06/trd_06_2_falling.c b/src/world/area_trd/trd_06/trd_06_2_falling.c index 05d1530144b..17ce24fd8dc 100644 --- a/src/world/area_trd/trd_06/trd_06_2_falling.c +++ b/src/world/area_trd/trd_06/trd_06_2_falling.c @@ -85,9 +85,9 @@ API_CALLABLE(N(InitializeFallingSprite)) { falling->playerSpriteID = 1; falling->width = gPlayerStatus.colliderHeight; falling->height = gPlayerStatus.colliderDiameter; - falling->pos.x = gPlayerStatus.position.x; - falling->pos.y = gPlayerStatus.position.y + (falling->height * SPRITE_WORLD_SCALE_D * 0.5); - falling->pos.z = gPlayerStatus.position.z; + falling->pos.x = gPlayerStatus.pos.x; + falling->pos.y = gPlayerStatus.pos.y + (falling->height * SPRITE_WORLD_SCALE_D * 0.5); + falling->pos.z = gPlayerStatus.pos.z; falling->rot.x = 0.0f; falling->rot.y = 0.0f; falling->rot.z = 0.0f; diff --git a/src/world/area_trd/trd_07/trd_07_3_magic_doors.c b/src/world/area_trd/trd_07/trd_07_3_magic_doors.c index 14c9989f8b7..795a4cc2722 100644 --- a/src/world/area_trd/trd_07/trd_07_3_magic_doors.c +++ b/src/world/area_trd/trd_07/trd_07_3_magic_doors.c @@ -7,10 +7,10 @@ API_CALLABLE(N(GetPointsWithCamRelativeOffset)) { f32 posZ = evt_get_float_variable(script, *args++); f32 angle = evt_get_float_variable(script, *args++); - script->varTable[0] = EVT_FLOAT_TO_FIXED(posX + (sin_deg(clamp_angle(gCameras[CAM_DEFAULT].currentYaw + angle + 270.0f)) * 1000.0f)); - script->varTable[1] = EVT_FLOAT_TO_FIXED(posZ - (cos_deg(clamp_angle(gCameras[CAM_DEFAULT].currentYaw + angle + 270.0f)) * 1000.0f)); - script->varTable[2] = EVT_FLOAT_TO_FIXED(posX + (sin_deg(clamp_angle(gCameras[CAM_DEFAULT].currentYaw + angle + 90.0f)) * 1000.0f)); - script->varTable[3] = EVT_FLOAT_TO_FIXED(posZ - (cos_deg(clamp_angle(gCameras[CAM_DEFAULT].currentYaw + angle + 90.0f)) * 1000.0f)); + script->varTable[0] = EVT_FLOAT_TO_FIXED(posX + (sin_deg(clamp_angle(gCameras[CAM_DEFAULT].curYaw + angle + 270.0f)) * 1000.0f)); + script->varTable[1] = EVT_FLOAT_TO_FIXED(posZ - (cos_deg(clamp_angle(gCameras[CAM_DEFAULT].curYaw + angle + 270.0f)) * 1000.0f)); + script->varTable[2] = EVT_FLOAT_TO_FIXED(posX + (sin_deg(clamp_angle(gCameras[CAM_DEFAULT].curYaw + angle + 90.0f)) * 1000.0f)); + script->varTable[3] = EVT_FLOAT_TO_FIXED(posZ - (cos_deg(clamp_angle(gCameras[CAM_DEFAULT].curYaw + angle + 90.0f)) * 1000.0f)); return ApiStatus_DONE2; } diff --git a/src/world/area_trd/trd_08/trd_08_3_npc.c b/src/world/area_trd/trd_08/trd_08_3_npc.c index 53c9b789eab..045dd6b17a7 100644 --- a/src/world/area_trd/trd_08/trd_08_3_npc.c +++ b/src/world/area_trd/trd_08/trd_08_3_npc.c @@ -62,7 +62,7 @@ EvtScript N(EVS_FireBar_Defeated) = { FireBarAISettings N(AISettings_FireBar_01) = { .centerPos = { -100, 0, 40 }, - .rotationRate = 8, + .rotRate = 8, .firstNpc = NPC_FireBar_1A, .npcCount = 4, .callback = N(FireBarAI_Callback), @@ -70,7 +70,7 @@ FireBarAISettings N(AISettings_FireBar_01) = { FireBarAISettings N(AISettings_FireBar_02) = { .centerPos = { 300, 0, -35 }, - .rotationRate = -8, + .rotRate = -8, .firstNpc = NPC_FireBar_2A, .npcCount = 4, .callback = N(FireBarAI_Callback), diff --git a/src/world/area_trd/trd_09/trd_09_4_demo.c b/src/world/area_trd/trd_09/trd_09_4_demo.c index 22600beb54c..342ecd9e819 100644 --- a/src/world/area_trd/trd_09/trd_09_4_demo.c +++ b/src/world/area_trd/trd_09/trd_09_4_demo.c @@ -90,14 +90,14 @@ API_CALLABLE(N(SetupDemoScene)) { N(DemoInitState)++; break; case 3: - wPartnerNpc->pos.x = playerStatus->position.x - 30.0f; - wPartnerNpc->pos.z = playerStatus->position.z + 30.0f; + wPartnerNpc->pos.x = playerStatus->pos.x - 30.0f; + wPartnerNpc->pos.z = playerStatus->pos.z + 30.0f; partner_clear_player_tracking(wPartnerNpc); - partner_set_goal_pos(playerStatus->position.x, playerStatus->position.z); + partner_set_goal_pos(playerStatus->pos.x, playerStatus->pos.z); func_800EF3D4(0); set_npc_yaw(wPartnerNpc, 90.0f); playerStatus->targetYaw = 90.0f; - playerStatus->currentYaw = 90.0f; + playerStatus->curYaw = 90.0f; playerStatus->spriteFacingAngle = 0.0f; return ApiStatus_DONE2; } diff --git a/src/world/area_trd/trd_10/trd_10_2_npc.c b/src/world/area_trd/trd_10/trd_10_2_npc.c index 4cfc35f42a3..f00317a5cb8 100644 --- a/src/world/area_trd/trd_10/trd_10_2_npc.c +++ b/src/world/area_trd/trd_10/trd_10_2_npc.c @@ -3,7 +3,7 @@ extern EvtScript N(EVS_BossDefeated); API_CALLABLE(N(IsPartnerBombette)) { - if (gPlayerData.currentPartner == PARTNER_BOMBETTE) { + if (gPlayerData.curPartner == PARTNER_BOMBETTE) { script->varTable[0] = TRUE; } else { script->varTable[0] = FALSE; diff --git a/src/world/area_tst/tst_04/tst_04_1_main.c b/src/world/area_tst/tst_04/tst_04_1_main.c index 6dc3143ac6d..a2850371f4d 100644 --- a/src/world/area_tst/tst_04/tst_04_1_main.c +++ b/src/world/area_tst/tst_04/tst_04_1_main.c @@ -9,7 +9,7 @@ extern NpcGroupList N(DefaultNPCs); API_CALLABLE(N(PushGoompaTest)) { Npc* npc = get_npc_safe(NPC_Goompa); - if (npc != NULL && npc->currentFloor == COLLIDER_o3) { + if (npc != NULL && npc->curFloor == COLLIDER_o3) { f32 sinTheta; f32 cosTheta; f32 xTemp; diff --git a/src/world/area_tst/tst_04/tst_04_3_reflection.c b/src/world/area_tst/tst_04/tst_04_3_reflection.c index 0c24f095772..693f7bc0b37 100644 --- a/src/world/area_tst/tst_04/tst_04_3_reflection.c +++ b/src/world/area_tst/tst_04/tst_04_3_reflection.c @@ -27,20 +27,20 @@ void N(worker_render_player_reflection)(void) { entityModel = get_entity_model(get_shadow_by_index(playerStatus->shadowID)->entityModelID); entityModel->flags |= ENTITY_MODEL_FLAG_REFLECT; - get_screen_coords(gCurrentCamID, playerStatus->position.x, playerStatus->position.y, -playerStatus->position.z, + get_screen_coords(gCurrentCamID, playerStatus->pos.x, playerStatus->pos.y, -playerStatus->pos.z, &screenX, &screenY, &screenZ); renderTaskPtr->renderMode = playerStatus->renderMode; renderTaskPtr->appendGfxArg = playerStatus; renderTaskPtr->appendGfx = &N(appendGfx_test_player_reflection); - renderTaskPtr->distance = -screenZ; + renderTaskPtr->dist = -screenZ; queue_render_task(renderTaskPtr); } } void N(appendGfx_test_player_reflection)(void* data) { PlayerStatus* playerStatus = data; - f32 yaw = -gCameras[gCurrentCamID].currentYaw; + f32 yaw = -gCameras[gCurrentCamID].curYaw; Matrix4f main; Matrix4f translation; Matrix4f rotation; @@ -55,7 +55,7 @@ void N(appendGfx_test_player_reflection)(void* data) { guMtxCatF(main, rotation, main); guScaleF(scale, SPRITE_WORLD_SCALE_F, SPRITE_WORLD_SCALE_F, SPRITE_WORLD_SCALE_F); guMtxCatF(main, scale, main); - guTranslateF(translation, playerStatus->position.x, playerStatus->position.y, -playerStatus->position.z); + guTranslateF(translation, playerStatus->pos.x, playerStatus->pos.y, -playerStatus->pos.z); guMtxCatF(main, translation, main); spr_update_player_sprite(PLAYER_SPRITE_AUX1, playerStatus->trueAnimation, 1.0f); spr_draw_player_sprite(PLAYER_SPRITE_AUX1, 0, 0, NULL, main); diff --git a/src/world/area_tst/tst_11/tst_11_2_extra.c b/src/world/area_tst/tst_11/tst_11_2_extra.c index 6fc2f63025d..11a4c87c9c1 100644 --- a/src/world/area_tst/tst_11/tst_11_2_extra.c +++ b/src/world/area_tst/tst_11/tst_11_2_extra.c @@ -25,20 +25,20 @@ void N(test_reflection_worker_render_wall)(void) { entityModel = get_entity_model(get_shadow_by_index(playerStatus->shadowID)->entityModelID); entityModel->flags |= ENTITY_MODEL_FLAG_REFLECT; - get_screen_coords(gCurrentCamID, playerStatus->position.x, playerStatus->position.y, -playerStatus->position.z, + get_screen_coords(gCurrentCamID, playerStatus->pos.x, playerStatus->pos.y, -playerStatus->pos.z, &screenX, &screenY, &screenZ); renderTaskPtr->renderMode = playerStatus->renderMode; renderTaskPtr->appendGfxArg = playerStatus; renderTaskPtr->appendGfx = &N(appendGfx_test_reflection_wall); - renderTaskPtr->distance = -screenZ; + renderTaskPtr->dist = -screenZ; queue_render_task(renderTaskPtr); } } void N(appendGfx_test_reflection_wall)(void* data) { PlayerStatus* playerStatus = data; - f32 yaw = -gCameras[gCurrentCamID].currentYaw; + f32 yaw = -gCameras[gCurrentCamID].curYaw; Matrix4f main; Matrix4f translation; Matrix4f rotation; @@ -53,7 +53,7 @@ void N(appendGfx_test_reflection_wall)(void* data) { guMtxCatF(main, rotation, main); guScaleF(scale, SPRITE_WORLD_SCALE_F, SPRITE_WORLD_SCALE_F, SPRITE_WORLD_SCALE_F); guMtxCatF(main, scale, main); - guTranslateF(translation, playerStatus->position.x, playerStatus->position.y, -playerStatus->position.z); + guTranslateF(translation, playerStatus->pos.x, playerStatus->pos.y, -playerStatus->pos.z); guMtxCatF(main, translation, main); // draw sprite is handled differently in final version spr_update_player_sprite(PLAYER_SPRITE_AUX1, playerStatus->trueAnimation ^ SPRITE_ID_BACK_FACING, 1.0f); @@ -76,20 +76,20 @@ void N(test_reflection_worker_render_floor)(void) { entityModel = get_entity_model(get_shadow_by_index(playerStatus->shadowID)->entityModelID); entityModel->flags |= ENTITY_MODEL_FLAG_REFLECT; - get_screen_coords(gCurrentCamID, playerStatus->position.x, -playerStatus->position.y, playerStatus->position.z, + get_screen_coords(gCurrentCamID, playerStatus->pos.x, -playerStatus->pos.y, playerStatus->pos.z, &screenX, &screenY, &screenZ); renderTaskPtr->renderMode = playerStatus->renderMode; renderTaskPtr->appendGfxArg = playerStatus; renderTaskPtr->appendGfx = &N(appendGfx_test_reflection_floor); - renderTaskPtr->distance = -screenZ; + renderTaskPtr->dist = -screenZ; queue_render_task(renderTaskPtr); } } void N(appendGfx_test_reflection_floor)(void* data) { PlayerStatus* playerStatus = data; - f32 yaw = -gCameras[gCurrentCamID].currentYaw; + f32 yaw = -gCameras[gCurrentCamID].curYaw; s32 trueAnimation; Matrix4f sp20; Matrix4f sp60; @@ -105,7 +105,7 @@ void N(appendGfx_test_reflection_floor)(void* data) { guMtxCatF(sp20, spA0, sp20); guScaleF(spE0, SPRITE_WORLD_SCALE_D, -SPRITE_WORLD_SCALE_D, SPRITE_WORLD_SCALE_D); guMtxCatF(sp20, spE0, sp20); - guTranslateF(sp60, playerStatus->position.x, -playerStatus->position.y, playerStatus->position.z); + guTranslateF(sp60, playerStatus->pos.x, -playerStatus->pos.y, playerStatus->pos.z); guMtxCatF(sp20, sp60, sp20); spr_draw_player_sprite(PLAYER_SPRITE_AUX1, 0, 0, 0, sp20); guRotateF(spA0, yaw, 0.0f, -1.0f, 0.0f); @@ -117,7 +117,7 @@ void N(appendGfx_test_reflection_floor)(void* data) { guMtxCatF(sp20, spA0, sp20); guScaleF(spE0, SPRITE_WORLD_SCALE_D, SPRITE_WORLD_SCALE_D, SPRITE_WORLD_SCALE_D); guMtxCatF(sp20, spE0, sp20); - guTranslateF(sp60, playerStatus->position.x, playerStatus->position.y, 0.0f); + guTranslateF(sp60, playerStatus->pos.x, playerStatus->pos.y, 0.0f); guMtxCatF(sp20, sp60, sp20); trueAnimation = playerStatus->trueAnimation; set_player_imgfx_all(trueAnimation, IMGFX_SET_ALPHA, 255, 255, 255, 20, 0); diff --git a/src/world/area_tst/tst_13/tst_13_1_main.c b/src/world/area_tst/tst_13/tst_13_1_main.c index 53d43eada6e..11d839b6c2c 100644 --- a/src/world/area_tst/tst_13/tst_13_1_main.c +++ b/src/world/area_tst/tst_13/tst_13_1_main.c @@ -287,7 +287,7 @@ void N(build_gfx_floor)(void) { f32 x, y, z; N(BuildGfxCallCount)++; - guTranslateF(sp10, gPlayerStatus.position.x, 0.0f, gPlayerStatus.position.z); + guTranslateF(sp10, gPlayerStatus.pos.x, 0.0f, gPlayerStatus.pos.z); x = (sin_rad(N(BuildGfxCallCount) / 50.0f) * 0.5) + 0.5; y = SQ(cos_rad(N(BuildGfxCallCount) / 50.0f)) + 0.1; diff --git a/src/world/common/atomic/BetaFloorPanels.inc.c b/src/world/common/atomic/BetaFloorPanels.inc.c index fb3d785bc4b..63694d3eb15 100644 --- a/src/world/common/atomic/BetaFloorPanels.inc.c +++ b/src/world/common/atomic/BetaFloorPanels.inc.c @@ -11,7 +11,7 @@ extern EvtScript N(EVS_BetaPanel_PoundNearby); API_CALLABLE(N(CheckShouldBreakFloor)) { PlayerStatus* playerStatus = &gPlayerStatus; s32* array = script->array; - f32 distance = dist2D(playerStatus->position.x, playerStatus->position.z, array[2], array[3]); + f32 distance = dist2D(playerStatus->pos.x, playerStatus->pos.z, array[2], array[3]); script->varTable[0] = 1; if ((playerStatus->actionState != ACTION_STATE_SPIN_POUND) @@ -28,7 +28,7 @@ API_CALLABLE(N(CheckShouldBreakFloor)) { API_CALLABLE(N(CheckShouldFlipFloor)) { PlayerStatus* playerStatus = &gPlayerStatus; f32 distance = dist2D( - playerStatus->position.x, playerStatus->position.z, + playerStatus->pos.x, playerStatus->pos.z, script->array[2], script->array[4]); script->varTable[0] = 0; diff --git a/src/world/common/atomic/CreateDarkness.inc.c b/src/world/common/atomic/CreateDarkness.inc.c index 211732bc25a..779da10a831 100644 --- a/src/world/common/atomic/CreateDarkness.inc.c +++ b/src/world/common/atomic/CreateDarkness.inc.c @@ -9,10 +9,10 @@ API_CALLABLE(N(DarkRoomUpdate)) { script->functionTemp[1] = FALSE; } - set_screen_overlay_center_worldpos(SCREEN_LAYER_BACK, 1, playerStatus->position.x, playerStatus->position.y + 8.0f, playerStatus->position.z); + set_screen_overlay_center_worldpos(SCREEN_LAYER_BACK, 1, playerStatus->pos.x, playerStatus->pos.y + 8.0f, playerStatus->pos.z); if (gPartnerStatus.partnerActionState != PARTNER_ACTION_NONE) { - if (playerData->currentPartner == PARTNER_WATT) { + if (playerData->curPartner == PARTNER_WATT) { if (!script->functionTemp[1]) { script->functionTemp[1] = TRUE; sfx_play_sound(SOUND_WATT_REPEL_DARKNESS); @@ -22,7 +22,7 @@ API_CALLABLE(N(DarkRoomUpdate)) { script->functionTemp[0] = 90; } } - } else if (playerData->currentPartner == PARTNER_WATT) { + } else if (playerData->curPartner == PARTNER_WATT) { if (script->functionTemp[1]) { script->functionTemp[1] = FALSE; if (script->functionTemp[0] < 255) { diff --git a/src/world/common/atomic/MonitorMusicProximityTrigger.inc.c b/src/world/common/atomic/MonitorMusicProximityTrigger.inc.c index d11869b090b..83cfbe0065d 100644 --- a/src/world/common/atomic/MonitorMusicProximityTrigger.inc.c +++ b/src/world/common/atomic/MonitorMusicProximityTrigger.inc.c @@ -28,7 +28,7 @@ API_CALLABLE(N(MonitorMusicProximityTrigger)) { cond = TRUE; } } else { - dist = dist2D(gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z, trigger->pos.x, trigger->pos.z); + dist = dist2D(gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z, trigger->pos.x, trigger->pos.z); switch (script->functionTemp[1]) { case MUSIC_PROXIMITY_FAR: diff --git a/src/world/common/atomic/PushBlockGravity.inc.c b/src/world/common/atomic/PushBlockGravity.inc.c index 254ba05d3fc..b2f0288a945 100644 --- a/src/world/common/atomic/PushBlockGravity.inc.c +++ b/src/world/common/atomic/PushBlockGravity.inc.c @@ -10,13 +10,13 @@ f32 N(PushBlockFallCurve)[] = { s32 N(push_block_handle_fall)(Entity* block, Evt* source) { - block->position.y = source->varTable[0] - (N(PushBlockFallCurve)[source->functionTemp[0]] * BLOCK_GRID_SIZE); + block->pos.y = source->varTable[0] - (N(PushBlockFallCurve)[source->functionTemp[0]] * BLOCK_GRID_SIZE); if (source->functionTemp[0] == 0) { - sfx_play_sound_at_position(SOUND_1DA, SOUND_SPACE_MODE_0, block->position.x, block->position.y, block->position.z); + sfx_play_sound_at_position(SOUND_1DA, SOUND_SPACE_MODE_0, block->pos.x, block->pos.y, block->pos.z); } if ((source->functionTemp[0] > 4) && (source->functionTemp[0] & 1)) { - fx_smoke_burst(1, block->position.x, block->position.y, block->position.z, 1.0f, 20); + fx_smoke_burst(1, block->pos.x, block->pos.y, block->pos.z, 1.0f, 20); } do { diff --git a/src/world/common/atomic/ToadHouse.inc.c b/src/world/common/atomic/ToadHouse.inc.c index 8a8ce3a2828..77e4b6ea06f 100644 --- a/src/world/common/atomic/ToadHouse.inc.c +++ b/src/world/common/atomic/ToadHouse.inc.c @@ -43,7 +43,7 @@ API_CALLABLE(N(ToadHouse_AwaitScriptComplete)) { } API_CALLABLE(N(ToadHouse_PartnerSuspendAbilityScript)) { - if (gPlayerData.currentPartner == PARTNER_NONE) { + if (gPlayerData.curPartner == PARTNER_NONE) { return ApiStatus_DONE2; } partner_suspend_ability_script(); @@ -87,7 +87,7 @@ API_CALLABLE(N(ToadHouse_PutPartnerAway)) { Bytecode* args = script->ptrReadPos; Bytecode saveToVar = *args++; - evt_set_variable(script, saveToVar, gPlayerData.currentPartner); + evt_set_variable(script, saveToVar, gPlayerData.curPartner); switch_to_partner(PARTNER_NONE); return ApiStatus_DONE2; } diff --git a/src/world/common/atomic/WhaleAnim.inc.c b/src/world/common/atomic/WhaleAnim.inc.c index 076694b49c3..19d9059978e 100644 --- a/src/world/common/atomic/WhaleAnim.inc.c +++ b/src/world/common/atomic/WhaleAnim.inc.c @@ -30,10 +30,10 @@ API_CALLABLE(N(UnkAngleFunc001)) { } y = npc->pos.y; - if (npc->currentAnim == ANIM_Kolorado_Still || - npc->currentAnim == ANIM_Kolorado_Walk || - npc->currentAnim == ANIM_Kolorado_Talk || - npc->currentAnim == ANIM_Kolorado_HurtStill) + if (npc->curAnim == ANIM_Kolorado_Still || + npc->curAnim == ANIM_Kolorado_Walk || + npc->curAnim == ANIM_Kolorado_Talk || + npc->curAnim == ANIM_Kolorado_HurtStill) { y += 2.0f * sin_deg(N(unkAngle1)); } @@ -54,7 +54,7 @@ void N(unkVtxFunc001)(Vtx* firstVertex, Vtx* copiedVertices, s32 numVertices, s3 s32 offset; wagPhase = *wagPhasePtr; - switch (get_npc_safe(NPC_Whale)->currentAnim) { + switch (get_npc_safe(NPC_Whale)->curAnim) { case ANIM_Kolorado_Still: case ANIM_Kolorado_Yell: case ANIM_Kolorado_IdleSad: diff --git a/src/world/common/complete/KnockDownPlayer.inc.c b/src/world/common/complete/KnockDownPlayer.inc.c index e39f8e72518..9262b724138 100644 --- a/src/world/common/complete/KnockDownPlayer.inc.c +++ b/src/world/common/complete/KnockDownPlayer.inc.c @@ -64,9 +64,9 @@ ApiStatus N(KnockdownCreate)(Evt* script) { data->rasterIndex = rasterIndex; data->width = gPlayerStatus.colliderHeight; data->height = gPlayerStatus.colliderDiameter; - data->pos.x = gPlayerStatus.position.x; - data->pos.y = gPlayerStatus.position.y; - data->pos.z = gPlayerStatus.position.z; + data->pos.x = gPlayerStatus.pos.x; + data->pos.y = gPlayerStatus.pos.y; + data->pos.z = gPlayerStatus.pos.z; data->rot.x = 0.0f; data->rot.y = 0.0f; data->rot.z = 0.0f; diff --git a/src/world/common/complete/LetterDelivery.inc.c b/src/world/common/complete/LetterDelivery.inc.c index 8e0f38776e5..a825c4d8d5c 100644 --- a/src/world/common/complete/LetterDelivery.inc.c +++ b/src/world/common/complete/LetterDelivery.inc.c @@ -37,7 +37,7 @@ API_CALLABLE(N(LetterDelivery_CalcLetterPos)) { s32 varZ = *args++; f32 z = evt_get_variable(script, varZ); Npc* partner = get_npc_unsafe(NPC_PARTNER); - f32 currentCamYaw = clamp_angle(gCameras[gCurrentCameraID].currentYaw + 180.0f); + f32 currentCamYaw = clamp_angle(gCameras[gCurrentCameraID].curYaw + 180.0f); add_vec2D_polar(&x, &z, 15.0f, partner->yaw); add_vec2D_polar(&x, &z, 10.0f, currentCamYaw); @@ -52,15 +52,15 @@ API_CALLABLE(N(LetterDelivery_CalcLetterPos)) { API_CALLABLE(N(LetterDelivery_SaveNpcAnim)) { Npc* npc = get_npc_unsafe(script->varTable[2]); - N(LetterDelivery_SavedNpcAnim) = npc->currentAnim; - npc->currentAnim = script->varTable[4]; + N(LetterDelivery_SavedNpcAnim) = npc->curAnim; + npc->curAnim = script->varTable[4]; return ApiStatus_DONE2; } API_CALLABLE(N(LetterDelivery_RestoreNpcAnim)) { Npc* npc = get_npc_unsafe(script->varTable[2]); - npc->currentAnim = N(LetterDelivery_SavedNpcAnim); + npc->curAnim = N(LetterDelivery_SavedNpcAnim); return ApiStatus_DONE2; } diff --git a/src/world/common/complete/Quizmo.inc.c b/src/world/common/complete/Quizmo.inc.c index dc42c9ae235..4f3613a2f35 100644 --- a/src/world/common/complete/Quizmo.inc.c +++ b/src/world/common/complete/Quizmo.inc.c @@ -225,7 +225,7 @@ void N(Quizmo_NPC_OnRender)(Npc* npc) { Camera* camera = &gCameras[gCurrentCamID]; if (npc->blur.quizmo->flags & 1) { - clamp_angle(-camera->currentYaw); + clamp_angle(-camera->curYaw); } } @@ -467,7 +467,7 @@ API_CALLABLE(N(Quizmo_AddViewRelativeOffset)) { Bytecode ourVarX = *args++; Bytecode outVarZ = *args++; - s32 cameraYaw = gCameras[gCurrentCameraID].currentYaw; + s32 cameraYaw = gCameras[gCurrentCameraID].curYaw; s32 outX = evt_get_variable(script, QUIZ_ARRAY_ORIGIN_X) - (z * cos_deg(cameraYaw)); s32 outZ = evt_get_variable(script, QUIZ_ARRAY_ORIGIN_Z) - (z * sin_deg(cameraYaw)); diff --git a/src/world/common/enemy/ai/AvoidPlayerAI.inc.c b/src/world/common/enemy/ai/AvoidPlayerAI.inc.c index 999be36816b..3fc90e44dec 100644 --- a/src/world/common/enemy/ai/AvoidPlayerAI.inc.c +++ b/src/world/common/enemy/ai/AvoidPlayerAI.inc.c @@ -25,12 +25,12 @@ void N(AvoidPlayerAI_ChaseInit)(Evt* script, MobileAISettings* npcAISettings, En f32 posZCCW; npc->duration = npcAISettings->chaseUpdateInterval / 2 + rand_int(npcAISettings->chaseUpdateInterval / 2 + 1); - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_CHASE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_CHASE]; npc->moveSpeed = npcAISettings->chaseSpeed; detectedPlayer = FALSE; - yawFwd = clamp_angle(atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, - gPlayerStatusPtr->position.z) + 180.0f); + yawFwd = clamp_angle(atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, + gPlayerStatusPtr->pos.z) + 180.0f); deltaYaw = get_clamped_angle_diff(npc->yaw, yawFwd); if (npcAISettings->chaseTurnRate < fabsf(deltaYaw)) { yawFwd = npc->yaw; @@ -47,7 +47,7 @@ void N(AvoidPlayerAI_ChaseInit)(Evt* script, MobileAISettings* npcAISettings, En posYFwd = npc->pos.y; posZFwd = npc->pos.z; - yawFwd = clamp_angle(atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z) + 180.0f); + yawFwd = clamp_angle(atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z) + 180.0f); distFwd = 0.0f; distCW = 0.0f; distCCW = 0.0f; @@ -78,7 +78,7 @@ void N(AvoidPlayerAI_ChaseInit)(Evt* script, MobileAISettings* npcAISettings, En } // unused - distToPlayer = dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + distToPlayer = dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); if ((distFwd < npc->moveSpeed * 1.5) && (distCW < npc->moveSpeed * 1.5) && (distCCW < npc->moveSpeed * 1.5) && (basic_ai_check_player_dist(territory, enemy, npcAISettings->alertRadius, npcAISettings->alertOffsetDist, 0))) { @@ -114,7 +114,7 @@ void N(AvoidPlayerAI_ChaseInit)(Evt* script, MobileAISettings* npcAISettings, En } if (detectedPlayer) { npc->duration = 10; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_PRE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_PRE]; } script->AI_TEMP_STATE = AI_STATE_CHASE; } @@ -126,11 +126,11 @@ void N(AvoidPlayerAI_Chase)(Evt* script, MobileAISettings* npcAISettings, EnemyD if (!basic_ai_check_player_dist(territory, enemy, npcAISettings->chaseRadius, npcAISettings->chaseOffsetDist, 1)) { fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &emoteTemp); - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; npc->duration = 25; script->AI_TEMP_STATE = AI_STATE_LOSE_PLAYER; } else { - if (npc->currentAnim != enemy->animList[ENEMY_ANIM_INDEX_MELEE_PRE]) { + if (npc->curAnim != enemy->animList[ENEMY_ANIM_INDEX_MELEE_PRE]) { if (npc->moveSpeed < 4.0) { spawn_surface_effects(npc, SURFACE_INTERACT_WALK); } else { @@ -184,7 +184,7 @@ API_CALLABLE(N(AvoidPlayerAI_Main)) { if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND)) { script->functionTemp[0] = AI_STATE_WANDER_INIT; npc->duration = 0; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; npc->flags &= ~NPC_FLAG_JUMPING; if (!enemy->territory->wander.isFlying) { npc->flags |= NPC_FLAG_GRAVITY; diff --git a/src/world/common/enemy/ai/BulletBillAI.inc.c b/src/world/common/enemy/ai/BulletBillAI.inc.c index 9a33e409f76..a15c96aa393 100644 --- a/src/world/common/enemy/ai/BulletBillAI.inc.c +++ b/src/world/common/enemy/ai/BulletBillAI.inc.c @@ -68,7 +68,7 @@ API_CALLABLE(N(BulletBillAI_Main)) { npc->pos.x = NPC_DISPOSE_POS_X; npc->pos.y = NPC_DISPOSE_POS_Y; npc->pos.z = NPC_DISPOSE_POS_Z; - npc->rotation.y = 0.0f; + npc->rot.y = 0.0f; npc->duration = 0; npc->flags |= NPC_FLAG_INVISIBLE; npc->flags &= ~NPC_FLAG_DONT_UPDATE_SHADOW_Y; @@ -88,21 +88,21 @@ API_CALLABLE(N(BulletBillAI_Main)) { npc->pos.z = blasterNpc->pos.z + 1.0; npc->yaw = blasterNpc->yaw; npc->moveSpeed = aiSettings->chaseSpeed; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_RUN]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_RUN]; add_vec2D_polar(&npc->pos.x, &npc->pos.z, 25.0f, npc->yaw); if (npc->yaw < 180.0f) { npc->renderYaw = 180.0f; } else { npc->renderYaw = 0.0f; } - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_CHASE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_CHASE]; npc->duration = 300; npc->flags |= (NPC_FLAG_DIRTY_SHADOW | NPC_FLAG_DONT_UPDATE_SHADOW_Y); enable_npc_shadow(npc); script->AI_TEMP_STATE = AI_STATE_BULLET_FIRED; // fallthrough case AI_STATE_BULLET_FIRED: - deltaY = (npc->pos.y - gPlayerStatusPtr->position.y); + deltaY = (npc->pos.y - gPlayerStatusPtr->pos.y); if ((deltaY > 190.0) || (deltaY < -120.0)) { done = TRUE; break; @@ -122,7 +122,7 @@ API_CALLABLE(N(BulletBillAI_Main)) { } if (hitDetected) { - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_HIT]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_HIT]; ai_enemy_play_sound(npc, SOUND_B0000018, 0); fx_ring_blast(0, npc->pos.x, npc->pos.y + 5.0f, npc->pos.z + 1.0f, 0.05f, 20); fx_smoke_burst(0, npc->pos.x, npc->pos.y + 5.0f, npc->pos.z + 0.0f, 1.2f, 25); @@ -162,18 +162,18 @@ API_CALLABLE(N(BillBlasterAI_Main)) { if (isInitialCall) { script->AI_TEMP_STATE = AI_STATE_BLASTER_INIT; npc->duration = 30; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; enemy->flags |= ENEMY_FLAG_ACTIVE_WHILE_OFFSCREEN; disable_npc_shadow(npc); } - deltaY = npc->pos.y - gPlayerStatusPtr->position.y; + deltaY = npc->pos.y - gPlayerStatusPtr->pos.y; if ((deltaY > 190.0) || (deltaY < -80.0)) { return ApiStatus_BLOCK; } if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) { - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; if (enemy->aiSuspendTime != 0) { return ApiStatus_BLOCK; } @@ -195,7 +195,7 @@ API_CALLABLE(N(BillBlasterAI_Main)) { bulletEnemy->VAR_PROJECTILE_HITBOX_STATE = PROJECTILE_HITBOX_STATE_INIT; bulletEnemy->AI_VAR_BULLET_BLASTER = enemy->npcID; bulletEnemy->AI_VAR_BULLET_RANGE = enemy->AI_VAR_BLASTER_RANGE; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_PRE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_PRE]; npc->duration = 10; script->AI_TEMP_STATE = AI_STATE_BLASTER_FIRE; } else { @@ -208,7 +208,7 @@ API_CALLABLE(N(BillBlasterAI_Main)) { if (npc->duration > 0) { break; } - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; bulletEnemy = get_enemy(enemy->AI_VAR_BLASTER_BULLET); bulletEnemy->VAR_PROJECTILE_HITBOX_STATE = PROJECTILE_HITBOX_STATE_PRE; ai_enemy_play_sound(npc, SOUND_328, SOUND_PARAM_MORE_QUIET); diff --git a/src/world/common/enemy/ai/CleftAI.inc.c b/src/world/common/enemy/ai/CleftAI.inc.c index 2869258450a..e48d053e9c1 100644 --- a/src/world/common/enemy/ai/CleftAI.inc.c +++ b/src/world/common/enemy/ai/CleftAI.inc.c @@ -33,18 +33,18 @@ s32 N(CleftAI_CanSeePlayer)(Evt* script, MobileAISettings* aiSettings, EnemyDete if (ai_check_player_dist(enemy, 0, aiSettings->alertRadius, aiSettings->alertOffsetDist)) { seesPlayer = TRUE; } - if (clamp_angle(get_clamped_angle_diff(camera->currentYaw, npc->yaw)) < 180.0) { + if (clamp_angle(get_clamped_angle_diff(camera->curYaw, npc->yaw)) < 180.0) { angle = 90.0f; } else { angle = 270.0f; } - playerX = gPlayerStatusPtr->position.x; - playerZ = gPlayerStatusPtr->position.z; + playerX = gPlayerStatusPtr->pos.x; + playerZ = gPlayerStatusPtr->pos.z; if (fabsf(get_clamped_angle_diff(angle, atan2(npc->pos.x, npc->pos.z, playerX, playerZ))) > 75.0) { seesPlayer = FALSE; } - if (fabsf(npc->pos.y - gPlayerStatusPtr->position.y) >= 40.0f) { + if (fabsf(npc->pos.y - gPlayerStatusPtr->pos.y) >= 40.0f) { seesPlayer = FALSE; } if (gPartnerStatus.actingPartner == PARTNER_BOW) { @@ -62,7 +62,7 @@ void N(CleftAI_HidingInit)(Evt* script, MobileAISettings* aiSettings, EnemyDetec npc->collisionDiameter = 24; script->functionTemp[1] = 0; npc->duration = 0; - npc->currentAnim = enemy->animList[8]; + npc->curAnim = enemy->animList[8]; script->AI_TEMP_STATE = AI_STATE_CLEFT_HIDING; } @@ -74,7 +74,7 @@ void N(CleftAI_Hiding)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVol if (script->functionTemp[1] <= 0) { script->functionTemp[1] = aiSettings->playerSearchInterval; if (basic_ai_check_player_dist(volume, enemy, aiSettings->alertRadius * 0.85, aiSettings->alertOffsetDist, FALSE)) { - npc->currentAnim = enemy->animList[9]; + npc->curAnim = enemy->animList[9]; fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &emoteTemp); ai_enemy_play_sound(npc, SOUND_2F4, SOUND_PARAM_MORE_QUIET); npc->duration = 12; @@ -91,9 +91,9 @@ void N(CleftAI_PreAmbush)(Evt* script, MobileAISettings* aiSettings, EnemyDetect npc->duration--; if (npc->duration <= 0) { - npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); enable_npc_shadow(npc); - npc->currentAnim = enemy->animList[10]; + npc->curAnim = enemy->animList[10]; npc->duration = 8; script->AI_TEMP_STATE = AI_STATE_CLEFT_AMBUSH; } @@ -104,7 +104,7 @@ void N(CleftAI_Ambush)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVol npc->duration--; if (npc->duration <= 0) { - npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); npc->collisionHeight = 26; npc->collisionDiameter = 24; script->AI_TEMP_STATE = AI_STATE_CLEFT_FIND_PLAYER_INIT; @@ -116,7 +116,7 @@ void N(CleftAI_FindPlayerInit)(Evt* script, MobileAISettings* aiSettings, EnemyD Npc* npc = get_npc_unsafe(enemy->npcID); npc->yaw = clamp_angle(npc->yaw + rand_int(180) - 90.0f); - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; script->functionTemp[1] = rand_int(1000) % 2 + 2; script->AI_TEMP_STATE = AI_STATE_CLEFT_FIND_PLAYER; } @@ -127,7 +127,7 @@ void N(CleftAI_FindPlayer)(Evt* script, MobileAISettings* aiSettings, EnemyDetec EffectInstance* var; if (basic_ai_check_player_dist(volume, enemy, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, 0)) { - npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); script->AI_TEMP_STATE = AI_STATE_CLEFT_CHASE_INIT; } else { npc->duration--; @@ -150,7 +150,7 @@ void N(CleftAI_RevUpInit)(Evt* script, MobileAISettings* aiSettings, EnemyDetect Npc* npc = get_npc_unsafe(enemy->npcID); npc->duration = enemy->varTable[10]; - npc->currentAnim = enemy->animList[13]; + npc->curAnim = enemy->animList[13]; script->AI_TEMP_STATE = AI_STATE_CLEFT_REV_UP; } @@ -158,7 +158,7 @@ void N(CleftAI_RevUp)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolu Enemy* enemy = script->owner1.enemy; Npc* npc = get_npc_unsafe(enemy->npcID); - npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); if (npc->duration % 3 == 0) { fx_walking_dust(2, npc->pos.x, npc->pos.y, npc->pos.z + 2.0f, 0, 0); } @@ -170,8 +170,8 @@ void N(CleftAI_RevUp)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolu enemy->unk_10.z = npc->pos.z; enemy->hitboxIsActive = TRUE; npc->moveSpeed = aiSettings->chaseSpeed; - npc->duration = dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, - gPlayerStatusPtr->position.z) / npc->moveSpeed + 0.9; + npc->duration = dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, + gPlayerStatusPtr->pos.z) / npc->moveSpeed + 0.9; if (npc->duration < 15) { npc->duration = 15; } @@ -220,7 +220,7 @@ void N(CleftAI_LosePlayer)(Evt* script, MobileAISettings* aiSettings, EnemyDetec npc->duration--; if (npc->duration <= 0) { - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_WALK]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_WALK]; if (enemy->territory->wander.moveSpeedOverride < 0) { npc->moveSpeed = aiSettings->moveSpeed; } else { @@ -235,7 +235,7 @@ void N(CleftAI_ReturnHome)(Evt* script, MobileAISettings* aiSettings, EnemyDetec Npc* npc = get_npc_unsafe(enemy->npcID); if (basic_ai_check_player_dist(volume, enemy, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, 0)) { - npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); script->AI_TEMP_STATE = AI_STATE_CLEFT_CHASE_INIT; } else if (dist2D(npc->pos.x, npc->pos.z, enemy->territory->wander.centerPos.x, enemy->territory->wander.centerPos.z) <= npc->moveSpeed) { npc->duration = 10; @@ -256,7 +256,7 @@ void N(CleftAI_DisguiseInit)(Evt* script, MobileAISettings* aiSettings, EnemyDet if (npc->turnAroundYawAdjustment == 0 && npc->duration <= 0) { npc->duration = 8; - npc->currentAnim = enemy->animList[11]; + npc->curAnim = enemy->animList[11]; script->AI_TEMP_STATE = AI_STATE_CLEFT_DISGUISE; } } @@ -268,7 +268,7 @@ void N(CleftAI_Disguise)(Evt* script, MobileAISettings* aiSettings, EnemyDetectV npc->duration--; if (npc->duration <= 0) { npc->duration = 8; - npc->currentAnim = enemy->animList[14]; + npc->curAnim = enemy->animList[14]; script->AI_TEMP_STATE = AI_STATE_CLEFT_POST_DISGUISE; } } diff --git a/src/world/common/enemy/ai/ClubbaNappingAI.inc.c b/src/world/common/enemy/ai/ClubbaNappingAI.inc.c index 2202472c270..88ec360ddbd 100644 --- a/src/world/common/enemy/ai/ClubbaNappingAI.inc.c +++ b/src/world/common/enemy/ai/ClubbaNappingAI.inc.c @@ -22,9 +22,9 @@ void N(ClubbaNappingAI_Init)(Evt* script, MobileAISettings* aiSettings, EnemyDet } if (npc->duration == 1) { - npc->currentAnim = enemy->animList[12]; + npc->curAnim = enemy->animList[12]; } else if (npc->duration <= 0) { - npc->currentAnim = enemy->animList[10]; + npc->curAnim = enemy->animList[10]; npc->duration = 0; script->AI_TEMP_STATE = AI_STATE_NAPPING_CLUBBA_SLEEP; } @@ -52,15 +52,15 @@ void N(ClubbaNappingAI_Sleep)(Evt* script, MobileAISettings* aiSettings, EnemyDe shouldWakeUp = TRUE; } - if (playerData->currentPartner == PARTNER_KOOPER) { - if (gPartnerStatus.partnerActionState == playerData->currentPartner) { + if (playerData->curPartner == PARTNER_KOOPER) { + if (gPartnerStatus.partnerActionState == playerData->curPartner) { shouldWakeUp = TRUE; } } } - if (((playerData->currentPartner == PARTNER_GOOMBARIO) && (gPartnerStatus.partnerActionState != PARTNER_ACTION_NONE)) || - ((playerData->currentPartner == PARTNER_BOMBETTE) && (gPartnerStatus.partnerActionState == PARTNER_ACTION_BOMBETTE_2))) { + if (((playerData->curPartner == PARTNER_GOOMBARIO) && (gPartnerStatus.partnerActionState != PARTNER_ACTION_NONE)) || + ((playerData->curPartner == PARTNER_BOMBETTE) && (gPartnerStatus.partnerActionState == PARTNER_ACTION_BOMBETTE_2))) { posX = npc->pos.x; posZ = npc->pos.z; add_vec2D_polar(&posX, &posZ, 0.0f, npc->yaw); @@ -71,7 +71,7 @@ void N(ClubbaNappingAI_Sleep)(Evt* script, MobileAISettings* aiSettings, EnemyDe if (shouldWakeUp) { ai_enemy_play_sound(npc, SOUND_B000000E, 0); - npc->currentAnim = enemy->animList[11]; + npc->curAnim = enemy->animList[11]; npc->duration = 10; fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &emoteTemp); ai_enemy_play_sound(npc, SOUND_2F4, SOUND_PARAM_MORE_QUIET); @@ -84,9 +84,9 @@ void N(ClubbaNappingAI_Sleep)(Evt* script, MobileAISettings* aiSettings, EnemyDe } else if (npc->duration == 57) { ai_enemy_play_sound(npc, SOUND_B000000D, 0); } else if (npc->duration == 59) { - npc->currentAnim = enemy->animList[12]; + npc->curAnim = enemy->animList[12]; } else if (npc->duration == 60) { - npc->currentAnim = enemy->animList[10]; + npc->curAnim = enemy->animList[10]; npc->duration = 0; } } @@ -108,7 +108,7 @@ void N(ClubbaNappingAI_LoiterInit)(Evt* script, MobileAISettings* aiSettings, En Npc* npc = get_npc_unsafe(enemy->npcID); npc->yaw = clamp_angle((npc->yaw + rand_int(180)) - 90.0f); - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; script->functionTemp[1] = (rand_int(1000) % 2) + 2; // chose random number 2-3 script->AI_TEMP_STATE = AI_STATE_NAPPING_CLUBBA_LOITER; } @@ -120,7 +120,7 @@ void N(ClubbaNappingAI_Loiter)(Evt* script, MobileAISettings* aiSettings, EnemyD // try to catch sight of player if (basic_ai_check_player_dist(territory, enemy, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, 0)) { - npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); script->AI_TEMP_STATE = AI_STATE_CHASE_INIT; return; } @@ -153,7 +153,7 @@ void N(ClubbaNappingAI_ReturnHomeInit)(Evt* script, MobileAISettings* aiSettings npc->duration--; if (npc->duration <= 0) { - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_WALK]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_WALK]; if (enemy->territory->wander.moveSpeedOverride < 0) { npc->moveSpeed = aiSettings->moveSpeed; } else { @@ -169,11 +169,11 @@ void N(ClubbaNappingAI_ReturnHome)(Evt* script, MobileAISettings* aiSettings, En f32 currentYaw; if (basic_ai_check_player_dist(territory, enemy, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, 0)) { - npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); script->AI_TEMP_STATE = AI_STATE_CHASE_INIT; } else if (dist2D(npc->pos.x, npc->pos.z, enemy->territory->wander.centerPos.x, enemy->territory->wander.centerPos.z) <= npc->moveSpeed) { - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; npc->duration = 15; enemy->AI_VAR_NEXT_STATE = AI_STATE_NAPPING_CLUBBA_50; script->AI_TEMP_STATE = AI_STATE_NAPPING_CLUBBA_LOITER_INIT; @@ -219,7 +219,7 @@ API_CALLABLE(N(ClubbaNappingAI_Main)) { if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND)) { script->AI_TEMP_STATE = AI_STATE_NAPPING_CLUBBA_INIT; npc->duration = 30; - npc->currentAnim = enemy->animList[10]; + npc->curAnim = enemy->animList[10]; npc->flags &= ~NPC_FLAG_JUMPING; enemy->AI_VAR_ATTACK_STATE = MELEE_HITBOX_STATE_NONE; if (!enemy->territory->wander.isFlying) { @@ -230,7 +230,7 @@ API_CALLABLE(N(ClubbaNappingAI_Main)) { if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) { script->AI_TEMP_STATE = AI_STATE_SUSPEND; script->AI_TEMP_STATE_AFTER_SUSPEND = AI_RETURN_HOME_INIT; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; } enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND; } diff --git a/src/world/common/enemy/ai/ClubbaPatrolAI.inc.c b/src/world/common/enemy/ai/ClubbaPatrolAI.inc.c index 1df9f42c743..a5cdf02dae7 100644 --- a/src/world/common/enemy/ai/ClubbaPatrolAI.inc.c +++ b/src/world/common/enemy/ai/ClubbaPatrolAI.inc.c @@ -25,7 +25,7 @@ API_CALLABLE(N(ClubbaPatrolAI_Main)) { if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND)) { script->AI_TEMP_STATE = AI_STATE_PATROL_INIT; npc->duration = 0; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; npc->flags &= ~NPC_FLAG_JUMPING; if (!enemy->territory->patrol.isFlying) { npc->flags |= NPC_FLAG_GRAVITY; diff --git a/src/world/common/enemy/ai/FireBarAI.inc.c b/src/world/common/enemy/ai/FireBarAI.inc.c index 52914e959e6..e4f9fea6bdc 100644 --- a/src/world/common/enemy/ai/FireBarAI.inc.c +++ b/src/world/common/enemy/ai/FireBarAI.inc.c @@ -41,7 +41,7 @@ API_CALLABLE(N(FireBarAI_Main)) { data->centerPos.x = settings->centerPos.x; data->centerPos.y = settings->centerPos.y; data->centerPos.z = settings->centerPos.z; - data->rotationRate = settings->rotationRate; + data->rotRate = settings->rotRate; data->firstNpc = settings->firstNpc; data->npcCount = settings->npcCount; data->callback = settings->callback; @@ -65,19 +65,19 @@ API_CALLABLE(N(FireBarAI_Main)) { npc->pos.x = data->centerPos.x + dX; npc->pos.y = data->centerPos.y; npc->pos.z = data->centerPos.z + dZ; - npc->yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z); + npc->yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->pos.x, playerStatus->pos.z); } if (!(data->flags & 2) && !(playerStatus->flags & PS_FLAG_HAZARD_INVINCIBILITY)) { - dY = playerStatus->position.y - npc->pos.y; + dY = playerStatus->pos.y - npc->pos.y; if (partnerStatus->partnerActionState == PARTNER_ACTION_USE) { if (partnerStatus->actingPartner == PARTNER_LAKILESTER) { dY = partnerNpc->pos.y - npc->pos.y; } else if (partnerStatus->actingPartner == PARTNER_PARAKARRY) { - dY = (playerStatus->position.y - 10.0f) - npc->pos.y; + dY = (playerStatus->pos.y - 10.0f) - npc->pos.y; } } - dX = playerStatus->position.x - npc->pos.x; - dZ = playerStatus->position.z - npc->pos.z; + dX = playerStatus->pos.x - npc->pos.x; + dZ = playerStatus->pos.z - npc->pos.z; if ((fabsf(dY) < (npc->collisionHeight * 0.8f)) && (sqrtf(SQ(dX) + SQ(dZ)) <= ((npc->collisionDiameter * 0.5f * npc->scale.x * 0.5f) + (playerStatus->colliderDiameter * 0.5f * 0.5f)))) { hitDetected = 1; @@ -87,35 +87,35 @@ API_CALLABLE(N(FireBarAI_Main)) { if (playerStatus->flags & PS_FLAG_HAZARD_INVINCIBILITY) { hitDetected = -1; } - data->yaw += data->rotationRate; + data->yaw += data->rotRate; clampedYaw = clamp_angle(data->yaw); if (clampedYaw != data->yaw) { data->yaw = clampedYaw; sfx_play_sound_at_position(N(FireBar_Sounds)[data->soundIndex], SOUND_SPACE_MODE_0, data->centerPos.x, data->centerPos.y, data->centerPos.z); } - distToPlayer = dist2D(data->centerPos.x, data->centerPos.z, playerStatus->position.x, playerStatus->position.z); + distToPlayer = dist2D(data->centerPos.x, data->centerPos.z, playerStatus->pos.x, playerStatus->pos.z); distToNpc = dist2D(data->centerPos.x, data->centerPos.z, npc->pos.x, npc->pos.z) + (npc->collisionDiameter * 0.5f * npc->scale.x * 0.5f) + (playerStatus->colliderDiameter * 0.5f * 0.5f); tempPlayerDist = distToPlayer; // needed to match - angleToPlayer = atan2(data->centerPos.x, data->centerPos.z, playerStatus->position.x, playerStatus->position.z); + angleToPlayer = atan2(data->centerPos.x, data->centerPos.z, playerStatus->pos.x, playerStatus->pos.z); angleToNpc = atan2(data->centerPos.x, data->centerPos.z, npc->pos.x, npc->pos.z); deltaYaw = get_clamped_angle_diff(angleToPlayer, angleToNpc); if ((hitDetected > 0) && (playerStatus->actionState != ACTION_STATE_HIT_FIRE)) { playerStatus->hazardType = HAZARD_TYPE_FIRE_BAR; set_action_state(ACTION_STATE_HIT_FIRE); - sfx_play_sound_at_position(SOUND_E8, SOUND_SPACE_MODE_0, playerStatus->position.x, playerStatus->position.y, playerStatus->position.z); + sfx_play_sound_at_position(SOUND_E8, SOUND_SPACE_MODE_0, playerStatus->pos.x, playerStatus->pos.y, playerStatus->pos.z); gCurrentEncounter.battleTriggerCooldown = 45; playerStatus->blinkTimer = 45; - playerStatus->lastGoodPosition.x = playerStatus->position.x; - playerStatus->lastGoodPosition.y = playerStatus->position.y; - playerStatus->lastGoodPosition.z = playerStatus->position.z; + playerStatus->lastGoodPos.x = playerStatus->pos.x; + playerStatus->lastGoodPos.y = playerStatus->pos.y; + playerStatus->lastGoodPos.z = playerStatus->pos.z; data->soundIndex = 0; if (data->callback != NULL) { data->callback(data, FIRE_BAR_HIT); } } else if ((tempPlayerDist < distToNpc) && !(data->flags & 2) && (hitDetected == 0) && (playerStatus->actionState != ACTION_STATE_HIT_FIRE)) { - if (data->rotationRate > 0.0f) { + if (data->rotRate > 0.0f) { if (data->lastDeltaYaw < 0.0f) { if (deltaYaw > 0.0f) { data->soundIndex++; @@ -144,11 +144,11 @@ void N(FireBarAI_Callback)(FireBarData* data, s32 mode) { switch (mode) { case FIRE_BAR_SLOW_DOWN: if (data->flags & 2) { - data->rotationRate *= 0.95f; + data->rotRate *= 0.95f; } break; case FIRE_BAR_SPEED_UP: - data->rotationRate *= 1.12f; + data->rotRate *= 1.12f; if (data->soundIndex == 10) { Evt* script = start_script(&N(EVS_FireBar_Defeated), EVT_PRIORITY_1, 0); script->varTable[0] = data->firstNpc; @@ -157,7 +157,7 @@ void N(FireBarAI_Callback)(FireBarData* data, s32 mode) { } break; case FIRE_BAR_HIT: - data->rotationRate = abs(data->settings->rotationRate) * signF(-data->rotationRate); + data->rotRate = abs(data->settings->rotRate) * signF(-data->rotRate); break; } return; diff --git a/src/world/common/enemy/ai/FlyingAI.inc.c b/src/world/common/enemy/ai/FlyingAI.inc.c index 17ef9c66a88..cb1c00b79d3 100644 --- a/src/world/common/enemy/ai/FlyingAI.inc.c +++ b/src/world/common/enemy/ai/FlyingAI.inc.c @@ -28,7 +28,7 @@ void N(FlyingAI_WanderInit)(Evt* script, MobileAISettings* aiSettings, EnemyDete } else { npc->yaw = clamp_angle((npc->yaw + rand_int(60)) - 30.0f); } - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_WALK]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_WALK]; script->functionTemp[1] = 0; if (enemy->territory->wander.moveSpeedOverride < 0) { npc->moveSpeed = aiSettings->moveSpeed; @@ -129,7 +129,7 @@ void N(FlyingAI_Wander)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVo if (aiSettings->playerSearchInterval >= 0) { if (script->functionTemp[1] <= 0) { script->functionTemp[1] = aiSettings->playerSearchInterval; - if (gPlayerStatusPtr->position.y < (npc->pos.y + npc->collisionHeight) + 10.0 && + if (gPlayerStatusPtr->pos.y < (npc->pos.y + npc->collisionHeight) + 10.0 && basic_ai_check_player_dist(territory, enemy, aiSettings->alertRadius, aiSettings->alertOffsetDist, 0) != 0) { EffectInstance* emoteTemp; @@ -188,7 +188,7 @@ void N(FlyingAI_LoiterInit)(Evt* script, MobileAISettings* aiSettings, EnemyDete npc->duration = (aiSettings->waitTime / 2) + rand_int((aiSettings->waitTime / 2) + 1); npc->yaw = clamp_angle(npc->yaw + rand_int(180) - 90.0f); - npc->currentAnim = *enemy->animList; + npc->curAnim = *enemy->animList; script->functionTemp[0] = 3; } @@ -229,7 +229,7 @@ void N(FlyingAI_Loiter)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVo } if (enemy->varTable[9] <= 0) { - if ((gPlayerStatusPtr->position.y < npc->pos.y + npc->collisionHeight + 10.0) + if ((gPlayerStatusPtr->pos.y < npc->pos.y + npc->collisionHeight + 10.0) && basic_ai_check_player_dist(territory, enemy, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, 1)) { fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 12, &var); npc->moveToPos.y = npc->pos.y; @@ -264,8 +264,8 @@ void N(FlyingAI_JumpInit)(Evt* script, MobileAISettings* aiSettings, EnemyDetect PlayerStatus* playerStatus = gPlayerStatusPtr; npc->duration = 0; - npc->yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z); - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_PRE]; + npc->yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->pos.x, playerStatus->pos.z); + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_PRE]; script->functionTemp[0] = AI_STATE_ALERT; } @@ -282,14 +282,14 @@ void N(FlyingAI_Jump)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolu void N(FlyingAI_ChaseInit)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolume* territory) { Enemy* enemy = script->owner1.enemy; Npc* npc = get_npc_unsafe(enemy->npcID); - f32 jumpVelocity = (f32)enemy->varTable[5] / 100.0; + f32 jumpVel = (f32)enemy->varTable[5] / 100.0; f32 jumpScale = (f32)enemy->varTable[6] / 100.0; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_PRE]; - npc->jumpVelocity = jumpVelocity; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_PRE]; + npc->jumpVel = jumpVel; npc->jumpScale = jumpScale; npc->moveSpeed = aiSettings->chaseSpeed; - npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); enemy->varTable[2] = 0; @@ -330,14 +330,14 @@ void N(FlyingAI_LosePlayer)(Evt* script, MobileAISettings* aiSettings, EnemyDete f32 a = enemy->varTable[3]; f32 b = enemy->varTable[7]; - npc->jumpVelocity += npc->jumpScale; + npc->jumpVel += npc->jumpScale; temp_f20 = a / 100.0; temp_f22 = b / 100.0; npc_move_heading(npc, npc->moveSpeed, npc->yaw); - if (npc->jumpVelocity >= 0.0) { - npc->pos.y += npc->jumpVelocity; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_HIT]; + if (npc->jumpVel >= 0.0) { + npc->pos.y += npc->jumpVel; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_HIT]; enemy->hitboxIsActive = FALSE; if (!(npc->flags & NPC_FLAG_8)) { posX = npc->pos.x; @@ -357,11 +357,11 @@ void N(FlyingAI_LosePlayer)(Evt* script, MobileAISettings* aiSettings, EnemyDete } else if (npc->pos.y >= npc->moveToPos.y) { script->functionTemp[0] = 0; } - } else if (npc->jumpVelocity < 0.0) { + } else if (npc->jumpVel < 0.0) { npc->duration++; if (npc->duration >= aiSettings->chaseUpdateInterval) { npc->duration = 0; - angle = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + angle = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); deltaAngle = get_clamped_angle_diff(npc->yaw, angle); if (aiSettings->chaseTurnRate < fabsf(deltaAngle)) { angle = npc->yaw; @@ -375,11 +375,11 @@ void N(FlyingAI_LosePlayer)(Evt* script, MobileAISettings* aiSettings, EnemyDete } if (npc->flags & NPC_FLAG_8) { - if (npc->pos.y + npc->jumpVelocity < temp_f22) { + if (npc->pos.y + npc->jumpVel < temp_f22) { npc->pos.y = temp_f22; - npc->jumpVelocity = 0.0f; + npc->jumpVel = 0.0f; } else { - npc->pos.y += npc->jumpVelocity; + npc->pos.y += npc->jumpVel; } return; } @@ -387,20 +387,20 @@ void N(FlyingAI_LosePlayer)(Evt* script, MobileAISettings* aiSettings, EnemyDete posX = npc->pos.x; posY = npc->pos.y + npc->collisionHeight; posZ = npc->pos.z; - posW = (fabsf(npc->jumpVelocity) + npc->collisionHeight) + 10.0; + posW = (fabsf(npc->jumpVel) + npc->collisionHeight) + 10.0; if (npc_raycast_down_sides(npc->collisionChannel, &posX, &posY, &posZ, &posW)) { - if (posW <= (npc->collisionHeight + fabsf(npc->jumpVelocity))) { - npc->jumpVelocity = 0.0f; + if (posW <= (npc->collisionHeight + fabsf(npc->jumpVel))) { + npc->jumpVel = 0.0f; npc->pos.y = posY; } else { - npc->pos.y += npc->jumpVelocity; + npc->pos.y += npc->jumpVel; } return; - } else if (fabsf(npc->jumpVelocity) < ((npc->pos.y - temp_f22) + npc->collisionHeight)) { - npc->pos.y = npc->pos.y + npc->jumpVelocity; + } else if (fabsf(npc->jumpVel) < ((npc->pos.y - temp_f22) + npc->collisionHeight)) { + npc->pos.y = npc->pos.y + npc->jumpVel; return; } - npc->jumpVelocity = 0.0f; + npc->jumpVel = 0.0f; } } diff --git a/src/world/common/enemy/ai/FlyingMagikoopaAI.inc.c b/src/world/common/enemy/ai/FlyingMagikoopaAI.inc.c index 86d69051638..19140073e2e 100644 --- a/src/world/common/enemy/ai/FlyingMagikoopaAI.inc.c +++ b/src/world/common/enemy/ai/FlyingMagikoopaAI.inc.c @@ -67,7 +67,7 @@ void N(FlyingMagikoopaAI_15)(Evt* arg0, MobileAISettings* arg1, EnemyDetectVolum randomDist = moveDist; } } else { - npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); if (npc->yaw < 180.0) { baseYaw = (rand_int(10) + 90.0) - 5.0; } else { @@ -125,7 +125,7 @@ void N(FlyingMagikoopaAI_15)(Evt* arg0, MobileAISettings* arg1, EnemyDetectVolum enemy->varTable[3] = rand_int(10) + 35; npc->duration = 0; npc->moveSpeed = 3.0f; - npc->jumpVelocity = 1.4f; + npc->jumpVel = 1.4f; npc->jumpScale = 0.2f; arg0->functionTemp[0] = 0x10; } @@ -161,7 +161,7 @@ void N(FlyingMagikoopaAI_17)(Evt* script, MobileAISettings* aiSettings, EnemyDet npc->duration++; if (npc->duration == (enemy->varTable[3] - 8)) { - npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); } if (limitY <= npc->pos.y) { npc->pos.y = limitY; @@ -193,14 +193,14 @@ void N(FlyingMagikoopaAI_21)(Evt* script, MobileAISettings* aiSettings, EnemyDet npc->duration--; if (npc->duration == 0) { - npc->currentAnim = enemy->animList[0]; + npc->curAnim = enemy->animList[0]; fx_emote(2, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 12, &emoteTemp); - npc->currentAnim = enemy->animList[0]; + npc->curAnim = enemy->animList[0]; npc->duration = 15; script->functionTemp[0] = 50; } else if ((N(MagikoopaAI_CanShootSpell)(script, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, territory) == 1) && (npc->turnAroundYawAdjustment == 0)) { ai_enemy_play_sound(npc, 0x20D4, 0); - npc->currentAnim = enemy->animList[8]; + npc->curAnim = enemy->animList[8]; posX = npc->pos.x; posY = npc->pos.y + 29.0f; posZ = npc->pos.z + 1.0f; @@ -217,7 +217,7 @@ void N(FlyingMagikoopaAI_22)(Evt* script, MobileAISettings* aiSettings, EnemyDet npc->duration--; if (npc->duration <= 0) { - npc->currentAnim = enemy->animList[9]; + npc->curAnim = enemy->animList[9]; npc->duration = 7; script->functionTemp[0] = 0x17; } @@ -234,7 +234,7 @@ void N(FlyingMagikoopaAI_23)(Evt* script, MobileAISettings* aiSettings, EnemyDet temp_s1 = N(MagikoopaAI_CanShootSpell)(script, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, territory); if (temp_s1 != 1) { fx_emote(2, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 12, &emoteTemp); - npc->currentAnim = enemy->animList[0]; + npc->curAnim = enemy->animList[0]; npc->duration = 15; script->functionTemp[0] = 50; } else { @@ -256,7 +256,7 @@ void N(FlyingMagikoopaAI_24)(Evt* script, MobileAISettings* aiSettings, EnemyDet npc->duration--; if (npc->duration <= 0) { - npc->currentAnim = enemy->animList[0]; + npc->curAnim = enemy->animList[0]; npc->duration = 3; script->AI_TEMP_STATE = 50; } @@ -361,7 +361,7 @@ API_CALLABLE(N(FlyingMagikoopaAI_Main)) { API_CALLABLE(N(FlyingMagikoopaAI_OnHitInit)) { Enemy* enemy = script->owner1.enemy; - evt_set_variable(script, LVar0, gCurrentEncounter.currentEnemy == enemy); + evt_set_variable(script, LVar0, gCurrentEncounter.curEnemy == enemy); return ApiStatus_DONE2; } @@ -370,7 +370,7 @@ API_CALLABLE(N(FlyingMagikoopaAI_OnHit)) { Npc* npc = get_npc_unsafe(enemy->npcID); if (enemy->varTable[0] == 2) { - npc->jumpVelocity = 0.0f; + npc->jumpVel = 0.0f; npc->moveSpeed = 0.0f; } return ApiStatus_DONE2; diff --git a/src/world/common/enemy/ai/FlyingNoAttackAI.inc.c b/src/world/common/enemy/ai/FlyingNoAttackAI.inc.c index 00426b97a2b..c2908426832 100644 --- a/src/world/common/enemy/ai/FlyingNoAttackAI.inc.c +++ b/src/world/common/enemy/ai/FlyingNoAttackAI.inc.c @@ -14,10 +14,10 @@ void N(FlyingNoAttackAI_12)(Evt* script, MobileAISettings* aiSettings, EnemyDete f32 angleDiff; npc->duration = (aiSettings->chaseUpdateInterval / 2) + rand_int(aiSettings->chaseUpdateInterval / 2 + 1); - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_CHASE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_CHASE]; npc->moveSpeed = aiSettings->chaseSpeed; - tempAngle = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + tempAngle = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); angleDiff = get_clamped_angle_diff(npc->yaw, tempAngle); if (aiSettings->chaseTurnRate < fabsf(angleDiff)) { @@ -44,7 +44,7 @@ void N(FlyingNoAttackAI_13)(Evt* script, MobileAISettings* aiSettings, EnemyDete if (basic_ai_check_player_dist(territory, enemy, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, 1) == 0) { fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 0xF, &var); - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; npc->duration = 30; script->functionTemp[0] = 20; enemy->varTable[9] = 30; @@ -66,7 +66,7 @@ void N(FlyingNoAttackAI_13)(Evt* script, MobileAISettings* aiSettings, EnemyDete if (flag) { npc->pos.y = y + 1.0; } else { - temp_f6 = npc->pos.y - (gPlayerStatusPtr->position.y + 6.0); + temp_f6 = npc->pos.y - (gPlayerStatusPtr->pos.y + 6.0); if ((temp_f6 < 0.0) || (temp_f6 > 4.0)) { temp_f6 = -temp_f6; npc->pos.y += temp_f6 * 0.06; diff --git a/src/world/common/enemy/ai/GrooveGuyAI.inc.c b/src/world/common/enemy/ai/GrooveGuyAI.inc.c index fd79b9409c6..90ee3197750 100644 --- a/src/world/common/enemy/ai/GrooveGuyAI.inc.c +++ b/src/world/common/enemy/ai/GrooveGuyAI.inc.c @@ -21,20 +21,20 @@ void N(GrooveGuyAI_03)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVol case 0: enemy->varTable[0] = 1; enemy->varTable[1] = 0; - npc->currentAnim = ANIM_GrooveGuy_Anim0C; + npc->curAnim = ANIM_GrooveGuy_Anim0C; set_npc_yaw(npc, 270.0f); - npc->rotation.y = 0.0f; + npc->rot.y = 0.0f; // fallthrough case 1: phase = enemy->varTable[1] % 16; if (phase < 4) { - npc->currentAnim = ANIM_GrooveGuy_Anim0C; + npc->curAnim = ANIM_GrooveGuy_Anim0C; } else if (phase < 8) { - npc->currentAnim = ANIM_GrooveGuy_Anim0B; + npc->curAnim = ANIM_GrooveGuy_Anim0B; } else if (phase < 12) { - npc->currentAnim = ANIM_GrooveGuy_Anim0C; + npc->curAnim = ANIM_GrooveGuy_Anim0C; } else if (phase < 16) { - npc->currentAnim = ANIM_GrooveGuy_Anim0D; + npc->curAnim = ANIM_GrooveGuy_Anim0D; } enemy->varTable[1]++; if (enemy->varTable[1] >= 0x41) { @@ -44,13 +44,13 @@ void N(GrooveGuyAI_03)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVol case 2: enemy->varTable[0] = 3; enemy->varTable[1] = 0; - npc->rotation.y = 0.0f; - npc->currentAnim = ANIM_GrooveGuy_Anim0C; + npc->rot.y = 0.0f; + npc->curAnim = ANIM_GrooveGuy_Anim0C; // fallthrough case 3: - npc->rotation.y += 35.0; - if (npc->rotation.y > 360.0) { - npc->rotation.y -= 360.0; + npc->rot.y += 35.0; + if (npc->rot.y > 360.0) { + npc->rot.y -= 360.0; } enemy->varTable[1]++; if (enemy->varTable[1] >= 0x2E) { @@ -59,7 +59,7 @@ void N(GrooveGuyAI_03)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVol break; } if (enemy->varTable[0] == 4) { - npc->rotation.y = 0.0f; + npc->rot.y = 0.0f; set_npc_yaw(npc, 270.0f); script->functionTemp[0] = 0; } @@ -89,7 +89,7 @@ API_CALLABLE(N(GrooveGuyAI_Main)) { if (isInitialCall || enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) { script->functionTemp[0] = 0; npc->duration = 0; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; npc->flags &= ~NPC_FLAG_JUMPING; if (!enemy->territory->wander.isFlying) { diff --git a/src/world/common/enemy/ai/GuardAI.inc.c b/src/world/common/enemy/ai/GuardAI.inc.c index e5b6943cb49..a7ebddd6ffa 100644 --- a/src/world/common/enemy/ai/GuardAI.inc.c +++ b/src/world/common/enemy/ai/GuardAI.inc.c @@ -26,7 +26,7 @@ void N(GuardAI_IdleInit)(Evt* script, GuardAISettings* aiSettings, EnemyDetectVo Enemy* enemy = script->owner1.enemy; Npc* npc = get_npc_unsafe(enemy->npcID); - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; script->AI_TEMP_STATE = AI_STATE_GUARD_IDLE; if (enemy->flags & ENEMY_FLAG_100000) { @@ -48,7 +48,7 @@ void N(GuardAI_Idle)(Evt* script, GuardAISettings* aiSettings, EnemyDetectVolume if (aiSettings->playerSearchInterval >= 0 && basic_ai_check_player_dist(territory, enemy, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, 0)) { fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &emoteTemp); ai_enemy_play_sound(npc, SOUND_2F4, SOUND_PARAM_MORE_QUIET); - npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); if (!(enemy->npcSettings->actionFlags & AI_ACTION_JUMP_WHEN_SEE_PLAYER)) { script->AI_TEMP_STATE = AI_STATE_CHASE_INIT; @@ -61,7 +61,7 @@ void N(GuardAI_Idle)(Evt* script, GuardAISettings* aiSettings, EnemyDetectVolume void N(GuardAI_AlertInit)(Evt* script, GuardAISettings* aiSettings, EnemyDetectVolume* territory) { Npc* npc = get_npc_unsafe(script->owner1.enemy->npcID); - npc->jumpVelocity = 10.0f; + npc->jumpVel = 10.0f; npc->jumpScale = 2.0f; npc->moveToPos.y = npc->pos.y; npc->flags |= NPC_FLAG_JUMPING; @@ -71,12 +71,12 @@ void N(GuardAI_AlertInit)(Evt* script, GuardAISettings* aiSettings, EnemyDetectV void N(GuardAI_Alert)(Evt* script, GuardAISettings* aiSettings, EnemyDetectVolume* territory) { Npc* npc = get_npc_unsafe(script->owner1.enemy->npcID); - npc->pos.y += npc->jumpVelocity; - npc->jumpVelocity -= npc->jumpScale; + npc->pos.y += npc->jumpVel; + npc->jumpVel -= npc->jumpScale; if (!(npc->pos.y > npc->moveToPos.y)) { npc->pos.y = npc->moveToPos.y; - npc->jumpVelocity = 0.0f; + npc->jumpVel = 0.0f; npc->flags &= ~NPC_FLAG_JUMPING; script->AI_TEMP_STATE = AI_STATE_CHASE_INIT; } @@ -89,10 +89,10 @@ void N(GuardAI_ChaseInit)(Evt* script, GuardAISettings* aiSettings, EnemyDetectV f32 angleDiff; npc->duration = (aiSettings->chaseUpdateInterval / 2) + rand_int(aiSettings->chaseUpdateInterval / 2 + 1); - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_CHASE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_CHASE]; npc->moveSpeed = aiSettings->chaseSpeed; - tempAngle = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + tempAngle = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); angleDiff = get_clamped_angle_diff(npc->yaw, tempAngle); if (aiSettings->chaseTurnRate < fabsf(angleDiff)) { @@ -116,7 +116,7 @@ void N(GuardAI_Chase)(Evt* script, GuardAISettings* aiSettings, EnemyDetectVolum if (!basic_ai_check_player_dist(arg2, enemy, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, 1)) { fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &emoteTemp); - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; npc->duration = 25; script->AI_TEMP_STATE = AI_STATE_LOSE_PLAYER; } else { @@ -142,7 +142,7 @@ void N(GuardAI_ReturnHomeInit)(Evt* script, GuardAISettings* aiSettings, EnemyDe Enemy* enemy = script->owner1.enemy; Npc* npc = get_npc_unsafe(enemy->npcID); - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_WALK]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_WALK]; if (enemy->territory->wander.moveSpeedOverride < 0) { npc->moveSpeed = aiSettings->chaseSpeed * 0.3; } else { @@ -163,7 +163,7 @@ void N(GuardAI_ReturnHome)(Evt* script, GuardAISettings* aiSettings, EnemyDetect if (basic_ai_check_player_dist(territory, enemy, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, 0)) { fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, (f32) npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &emoteTemp); ai_enemy_play_sound(npc, SOUND_2F4, SOUND_PARAM_MORE_QUIET); - npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); if (enemy->npcSettings->actionFlags & AI_ACTION_JUMP_WHEN_SEE_PLAYER) { script->AI_TEMP_STATE = AI_STATE_ALERT_INIT; } else { @@ -209,7 +209,7 @@ API_CALLABLE(N(GuardAI_Main)) { script->AI_TEMP_STATE = AI_STATE_GUARD_IDLE_INIT; npc->duration = 0; enemy->varTable[0] = npc->yaw; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; npc->flags &= ~NPC_FLAG_JUMPING; if (!(enemy->territory->wander.isFlying)) { diff --git a/src/world/common/enemy/ai/HoppingAI.inc.c b/src/world/common/enemy/ai/HoppingAI.inc.c index 4347e07bb5d..a8fa2088103 100644 --- a/src/world/common/enemy/ai/HoppingAI.inc.c +++ b/src/world/common/enemy/ai/HoppingAI.inc.c @@ -10,7 +10,7 @@ void N(HoppingAI_HopInit)(Evt* script, MobileAISettings* aiSettings, EnemyDetect basic_ai_wander_init(script, aiSettings, territory); npc->flags |= NPC_FLAG_JUMPING; - npc->jumpVelocity = (rand_int(45) / 10.0) + 8.0; + npc->jumpVel = (rand_int(45) / 10.0) + 8.0; npc->jumpScale = 1.5f; ai_enemy_play_sound(npc, SOUND_B0000017, 0); @@ -52,7 +52,7 @@ void N(HoppingAI_Hop)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolu EffectInstance* emoteTemp; fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &emoteTemp); ai_enemy_play_sound(npc, SOUND_2F4, SOUND_PARAM_MORE_QUIET); - npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); script->AI_TEMP_STATE = 12; return; } @@ -83,16 +83,16 @@ void N(HoppingAI_Hop)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolu } } - if (npc->jumpVelocity < 0.0) { + if (npc->jumpVel < 0.0) { posX = npc->pos.x; posY = npc->pos.y + 13.0; posZ = npc->pos.z; - hitDepth = fabsf(npc->jumpVelocity) + 16.0; + hitDepth = fabsf(npc->jumpVel) + 16.0; if (npc_raycast_down_sides(npc->collisionChannel, &posX, &posY, &posZ, &hitDepth) && - hitDepth <= fabsf(npc->jumpVelocity) + 13.0) + hitDepth <= fabsf(npc->jumpVel) + 13.0) { - npc->jumpVelocity = 0.0f; + npc->jumpVel = 0.0f; npc->pos.y = posY; npc->flags &= ~NPC_FLAG_JUMPING; script->AI_TEMP_STATE = 2; @@ -108,8 +108,8 @@ void N(HoppingAI_Hop)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolu return; } } - npc->pos.y += npc->jumpVelocity; - npc->jumpVelocity -= npc->jumpScale; + npc->pos.y += npc->jumpVel; + npc->jumpVel -= npc->jumpScale; } void N(HoppingAI_LoiterInit)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolume* territory) { @@ -118,7 +118,7 @@ void N(HoppingAI_LoiterInit)(Evt* script, MobileAISettings* aiSettings, EnemyDet npc->duration = (aiSettings->waitTime / 2) + rand_int((aiSettings->waitTime / 2) + 1); npc->yaw = clamp_angle(npc->yaw + rand_int(180) - 90.0f); - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; script->AI_TEMP_STATE = 3; } @@ -130,7 +130,7 @@ void N(HoppingAI_Loiter)(Evt* script, MobileAISettings* aiSettings, EnemyDetectV EffectInstance* emoteTemp; fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &emoteTemp); ai_enemy_play_sound(npc, SOUND_2F4, SOUND_PARAM_MORE_QUIET); - npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); script->AI_TEMP_STATE = 12; } else if (npc->turnAroundYawAdjustment == 0) { npc->duration--; @@ -151,9 +151,9 @@ void N(HoppingAI_ChaseInit)(Evt* script, MobileAISettings* aiSettings, EnemyDete basic_ai_chase_init(script, aiSettings, territory); enemy->flags |= ENEMY_FLAG_800; - enemy->jumpVelocity = rand_int(5) + 10.0; + enemy->jumpVel = rand_int(5) + 10.0; enemy->jumpScale = 1.5f; - enemy->yaw = atan2(enemy->pos.x, enemy->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + enemy->yaw = atan2(enemy->pos.x, enemy->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); enemy->moveSpeed = aiSettings->chaseSpeed; script->AI_TEMP_STATE = 13; ai_enemy_play_sound(enemy, SOUND_B0000017, 0); @@ -179,7 +179,7 @@ void N(HoppingAI_Chase)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVo } } - if (npc->jumpVelocity < 0.0) { + if (npc->jumpVel < 0.0) { posX = npc->pos.x; groundY = 100.0f; posZ = npc->pos.z; @@ -189,9 +189,9 @@ void N(HoppingAI_Chase)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVo posX = npc->pos.x; posY = npc->pos.y + 13.0; posZ = npc->pos.z; - hitDepth = fabsf(npc->jumpVelocity) + 16.0; - if (npc_raycast_down_sides(npc->collisionChannel, &posX, &posY, &posZ, &hitDepth) && hitDepth <= fabsf(npc->jumpVelocity) + 13.0) { - npc->jumpVelocity = 0.0f; + hitDepth = fabsf(npc->jumpVel) + 16.0; + if (npc_raycast_down_sides(npc->collisionChannel, &posX, &posY, &posZ, &hitDepth) && hitDepth <= fabsf(npc->jumpVel) + 13.0) { + npc->jumpVel = 0.0f; npc->pos.y = posY; npc->flags &= ~NPC_FLAG_JUMPING; fx_walking_dust(2, npc->pos.x, npc->pos.y, npc->pos.z, 0.0f, 0.0f); @@ -205,8 +205,8 @@ void N(HoppingAI_Chase)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVo return; } } - npc->pos.y += npc->jumpVelocity; - npc->jumpVelocity -= npc->jumpScale; + npc->pos.y += npc->jumpVel; + npc->jumpVel -= npc->jumpScale; } void N(HoppingAI_LosePlayer)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolume* territory) { diff --git a/src/world/common/enemy/ai/KoopaPatrolAI.inc.c b/src/world/common/enemy/ai/KoopaPatrolAI.inc.c index d91285c1ee4..7e47002bfbd 100644 --- a/src/world/common/enemy/ai/KoopaPatrolAI.inc.c +++ b/src/world/common/enemy/ai/KoopaPatrolAI.inc.c @@ -32,7 +32,7 @@ API_CALLABLE(N(KoopaPatrolAI_Main)) { npc->duration = 0; script->functionTemp[0] = 0; enemy->hitboxIsActive = FALSE; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; npc->flags &= ~NPC_FLAG_JUMPING; npc->collisionHeight = enemy->varTable[6]; enemy->instigatorValue = 0; diff --git a/src/world/common/enemy/ai/LakituAI.inc.c b/src/world/common/enemy/ai/LakituAI.inc.c index 96190a066dd..85d6ffa8114 100644 --- a/src/world/common/enemy/ai/LakituAI.inc.c +++ b/src/world/common/enemy/ai/LakituAI.inc.c @@ -215,14 +215,14 @@ s32 N(LakituAI_Main)(Evt* script, s32 isInitialCall) { } if (script->AI_TEMP_STATE == AI_STATE_CHASE_INIT) { - npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); enemy->varTable[4] = N(LakituAI_GetAvailableSpiny)(); if (enemy->varTable[4] >= 0) { spinyEnemy = get_enemy(enemy->varTable[4]); spinyEnemy->varTable[10] = 1; spinyEnemy->varTable[11] = enemy->npcID; npc->duration = 15; - npc->currentAnim = ANIM_Lakitu_Anim14; + npc->curAnim = ANIM_Lakitu_Anim14; script->AI_TEMP_STATE = 30; } } @@ -255,7 +255,7 @@ s32 N(LakituAI_Main)(Evt* script, s32 isInitialCall) { if (npc->duration > 0) { break; } - npc->currentAnim = ANIM_Lakitu_Anim15; + npc->curAnim = ANIM_Lakitu_Anim15; spinyEnemy = get_enemy(enemy->varTable[4]); spinyEnemy->varTable[10] = 3; npc->duration = 10; @@ -281,8 +281,8 @@ s32 N(LakituAI_Main)(Evt* script, s32 isInitialCall) { f32 playerDist; f32 lerpDist; - npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); - playerDist = dist2D(gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z, npc->pos.x, npc->pos.z); + npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); + playerDist = dist2D(gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z, npc->pos.x, npc->pos.z); if (!is_point_within_region(territoryPtr->shape, territoryPtr->pointX, territoryPtr->pointZ, npc->pos.x, npc->pos.z, diff --git a/src/world/common/enemy/ai/MagikoopaAI.inc.c b/src/world/common/enemy/ai/MagikoopaAI.inc.c index 821e4b2f307..a92b842635c 100644 --- a/src/world/common/enemy/ai/MagikoopaAI.inc.c +++ b/src/world/common/enemy/ai/MagikoopaAI.inc.c @@ -21,7 +21,7 @@ void N(MagikoopaAI_00)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVol npc->duration--; if (npc->duration <= 0) { - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; npc->flags &= ~NPC_FLAG_INVISIBLE; npc->duration = 0; script->AI_TEMP_STATE = 1; @@ -75,12 +75,12 @@ void N(MagikoopaAI_06)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVol void N(MagikoopaAI_10)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolume* territory) { Enemy* enemy = script->owner1.enemy; Npc* npc = get_npc_unsafe(enemy->npcID); - f32 dist = dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + f32 dist = dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); f32 posX, posY, posZ; enemy->varTable[0] = 1; - npc->currentAnim = enemy->animList[8]; - npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + npc->curAnim = enemy->animList[8]; + npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); npc->flags &= ~NPC_FLAG_INVISIBLE; npc->scale.x = 0.1f; npc->scale.y = 0.1f; @@ -160,16 +160,16 @@ void N(MagikoopaAI_21)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVol npc->duration--; if (npc->duration == 0) { - npc->currentAnim = enemy->animList[0]; + npc->curAnim = enemy->animList[0]; fx_emote(2, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 12, &emoteTemp); - npc->currentAnim = enemy->animList[0]; + npc->curAnim = enemy->animList[0]; npc->duration = 0xF; script->AI_TEMP_STATE = 0; return; } if (N(MagikoopaAI_CanShootSpell)(script, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, territory) == 1) { ai_enemy_play_sound(npc, SOUND_SPELL_CAST1, 0); - npc->currentAnim = enemy->animList[8]; + npc->curAnim = enemy->animList[8]; posX = npc->pos.x; posY = npc->pos.y + 32.0f; posZ = npc->pos.z + 1.0f; @@ -186,7 +186,7 @@ void N(MagikoopaAI_22)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVol temp_v0->duration--; if (temp_v0->duration <= 0) { - temp_v0->currentAnim = temp_s0->animList[9]; + temp_v0->curAnim = temp_s0->animList[9]; temp_v0->duration = 9; script->AI_TEMP_STATE = 0x17; } @@ -203,7 +203,7 @@ void N(MagikoopaAI_23)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVol projectileEnemy = N(MagikoopaAI_CanShootSpell)(script, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, territory); if (projectileEnemy != 1) { fx_emote(2, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 0xC, &emoteTemp); - npc->currentAnim = enemy->animList[0]; + npc->curAnim = enemy->animList[0]; npc->duration = 15; script->AI_TEMP_STATE = 0; } else { @@ -221,7 +221,7 @@ void N(MagikoopaAI_24)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVol npc->duration--; if (npc->duration <= 0) { - npc->currentAnim = enemy->animList[0]; + npc->curAnim = enemy->animList[0]; npc->duration = 3; script->AI_TEMP_STATE = 0; } @@ -249,7 +249,7 @@ API_CALLABLE(N(MagikoopaAI_Main)) { territory.detectFlags = 0; if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND)) { - npc->currentAnim = enemy->animList[0]; + npc->curAnim = enemy->animList[0]; npc->flags &= ~NPC_FLAG_JUMPING; npc->flags |= NPC_FLAG_200000; enemy->flags |= ENEMY_FLAG_ACTIVE_WHILE_OFFSCREEN; @@ -320,7 +320,7 @@ API_CALLABLE(N(MagikoopaAI_OnPlayerFled)) { Npc* npc = get_npc_unsafe(enemy->npcID); npc->alpha = 255; - npc->currentAnim = enemy->animList[2]; + npc->curAnim = enemy->animList[2]; npc->duration = 0; script->functionTemp[0] = 0; return ApiStatus_DONE2; @@ -329,7 +329,7 @@ API_CALLABLE(N(MagikoopaAI_OnPlayerFled)) { API_CALLABLE(N(MagikoopaAI_OnHitInit)) { Enemy* enemy = script->owner1.enemy; - evt_set_variable(script, LVar0, gCurrentEncounter.currentEnemy == enemy); + evt_set_variable(script, LVar0, gCurrentEncounter.curEnemy == enemy); return ApiStatus_DONE2; } @@ -338,7 +338,7 @@ API_CALLABLE(N(MagikoopaAI_OnHit)) { Npc* npc = get_npc_unsafe(enemy->npcID); if (enemy->varTable[0] == 2) { - npc->jumpVelocity = 0.0f; + npc->jumpVel = 0.0f; npc->moveSpeed = 0.0f; } return ApiStatus_DONE2; diff --git a/src/world/common/enemy/ai/MagikoopaSpellAI.inc.c b/src/world/common/enemy/ai/MagikoopaSpellAI.inc.c index 9eb3f2bfe41..18626fd89a3 100644 --- a/src/world/common/enemy/ai/MagikoopaSpellAI.inc.c +++ b/src/world/common/enemy/ai/MagikoopaSpellAI.inc.c @@ -10,18 +10,18 @@ s32 N(MagikoopaAI_CanShootSpell)(Evt* script, f32 arg1, f32 arg2, EnemyDetectVol f32 angle; f32 t1; - if (clamp_angle(get_clamped_angle_diff(camera->currentYaw, npc->yaw)) < 180.0) { + if (clamp_angle(get_clamped_angle_diff(camera->curYaw, npc->yaw)) < 180.0) { angle = 90.0f; } else { angle = 270.0f; } - t1 = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + t1 = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); if (fabsf(get_clamped_angle_diff(angle, t1)) > 75.0) { return -1; } - t1 = atan2(0.0f, npc->pos.y, fabsf(npc->pos.x - gPlayerStatusPtr->position.x), gPlayerStatusPtr->position.y); + t1 = atan2(0.0f, npc->pos.y, fabsf(npc->pos.x - gPlayerStatusPtr->pos.x), gPlayerStatusPtr->pos.y); if (fabsf(t1 - 90.0) > 70.0) { return -1; } @@ -90,20 +90,20 @@ API_CALLABLE(N(MagikoopaAI_SpellMain)) { enemy->unk_10.z = npc1->pos.z; npc1->moveSpeed = 3.6f; - t1 = fabsf(npc1->pos.x - gPlayerStatusPtr->position.x); - t2 = atan2(0.0f, npc1->pos.y, t1, (gPlayerStatusPtr->position.y + 10.0)) - 90.0; - npc1->jumpVelocity = cosine(t2) * npc1->moveSpeed; - npc1->yaw = atan2(npc1->pos.x, npc1->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + t1 = fabsf(npc1->pos.x - gPlayerStatusPtr->pos.x); + t2 = atan2(0.0f, npc1->pos.y, t1, (gPlayerStatusPtr->pos.y + 10.0)) - 90.0; + npc1->jumpVel = cosine(t2) * npc1->moveSpeed; + npc1->yaw = atan2(npc1->pos.x, npc1->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); duration = dist3D(npc1->pos.x, npc1->pos.y, npc1->pos.z, - gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.y + 10.0, - gPlayerStatusPtr->position.z) / npc1->moveSpeed; + gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.y + 10.0, + gPlayerStatusPtr->pos.z) / npc1->moveSpeed; if (duration <= 0) { duration = 1; } enemy->varTable[3] = (s32)fx_shape_spell(0, npc1->pos.x, npc1->pos.y + 14.0f, npc1->pos.z, - gPlayerStatusPtr->position.x, - gPlayerStatusPtr->position.y + 10.0f + 14.0f, - gPlayerStatusPtr->position.z, duration); + gPlayerStatusPtr->pos.x, + gPlayerStatusPtr->pos.y + 10.0f + 14.0f, + gPlayerStatusPtr->pos.z, duration); npc1->duration = duration; script->functionTemp[0] = 2; } @@ -115,12 +115,12 @@ API_CALLABLE(N(MagikoopaAI_SpellMain)) { } if (timer == 0) { npc_move_heading(npc1, npc1->moveSpeed, npc1->yaw); - npc1->pos.y += npc1->jumpVelocity; + npc1->pos.y += npc1->jumpVel; break; } // fallthrough case 3: - npc1->jumpVelocity = 0.0f; + npc1->jumpVel = 0.0f; npc1->moveSpeed = 0.0f; npc1->pos.y -= npc1->collisionHeight * 0.5; enemy->varTable[0] = 3; diff --git a/src/world/common/enemy/ai/MeleeHitbox.inc.c b/src/world/common/enemy/ai/MeleeHitbox.inc.c index b742edfdc09..24baea7dbef 100644 --- a/src/world/common/enemy/ai/MeleeHitbox.inc.c +++ b/src/world/common/enemy/ai/MeleeHitbox.inc.c @@ -13,7 +13,7 @@ void N(MeleeHitbox_30)(Evt* script) { if (npc->turnAroundYawAdjustment == 0) { enemy->AI_VAR_ATTACK_STATE = MELEE_HITBOX_STATE_PRE; npc->duration = enemy->AI_VAR_MELEE_PRE_TIME; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_PRE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_PRE]; script->AI_TEMP_STATE = AI_STATE_MELEE_HITBOX_PRE; } } @@ -26,7 +26,7 @@ void N(MeleeHitbox_31)(Evt* script) { if (npc->duration <= 0) { enemy->AI_VAR_ATTACK_STATE = MELEE_HITBOX_STATE_ACTIVE; npc->duration = enemy->AI_VAR_MELEE_HIT_TIME; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_HIT]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_HIT]; script->AI_TEMP_STATE = AI_STATE_MELEE_HITBOX_ACTIVE; } } @@ -39,7 +39,7 @@ void N(MeleeHitbox_32)(Evt* script) { npc->duration--; if (npc->duration <= 0) { enemy->AI_VAR_ATTACK_STATE = MELEE_HITBOX_STATE_POST; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; npc->duration = enemy->AI_VAR_MELEE_MISS_TIME; if (enemy->AI_VAR_MELEE_MISS_TIME >= 8) { fx_emote(EMOTE_FRUSTRATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, enemy->AI_VAR_MELEE_MISS_TIME - 1, &emoteTemp); @@ -67,22 +67,22 @@ s32 N(MeleeHitbox_CanSeePlayer)(Evt* script) { f32 angle; s32 ret = TRUE; - if (dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z) > hitboxEnemy->AI_VAR_HITNPC_2) { + if (dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z) > hitboxEnemy->AI_VAR_HITNPC_2) { ret = FALSE; } - if (clamp_angle(get_clamped_angle_diff(camera->currentYaw, npc->yaw)) < 180.0) { + if (clamp_angle(get_clamped_angle_diff(camera->curYaw, npc->yaw)) < 180.0) { angle = 90.0f; } else { angle = 270.0f; } - if (fabsf(get_clamped_angle_diff(angle, atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, - gPlayerStatusPtr->position.z))) > hitboxEnemy->AI_VAR_HITNPC_3) { + if (fabsf(get_clamped_angle_diff(angle, atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, + gPlayerStatusPtr->pos.z))) > hitboxEnemy->AI_VAR_HITNPC_3) { ret = FALSE; } - if ((2.0 * npc->collisionHeight) <= fabsf(npc->pos.y - gPlayerStatusPtr->position.y)) { + if ((2.0 * npc->collisionHeight) <= fabsf(npc->pos.y - gPlayerStatusPtr->pos.y)) { ret = FALSE; } @@ -147,7 +147,7 @@ API_CALLABLE(N(MeleeHitbox_Main)) { hitboxNpc->pos.z = posZ; hitboxEnemy->unk_10.z = hitboxNpc->pos.z; - hitboxNpc->yaw = atan2(hitboxNpc->pos.x, hitboxNpc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + hitboxNpc->yaw = atan2(hitboxNpc->pos.x, hitboxNpc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); hitboxEnemy->flags &= ~(ENEMY_FLAG_100000 | ENEMY_FLAG_IGNORE_TOUCH | ENEMY_FLAG_IGNORE_JUMP | ENEMY_FLAG_IGNORE_HAMMER | ENEMY_FLAG_CANT_INTERACT | ENEMY_FLAG_IGNORE_PARTNER); hitboxNpc->duration = 0; script->functionTemp[0] = 1; diff --git a/src/world/common/enemy/ai/MontyMoleAI.inc.c b/src/world/common/enemy/ai/MontyMoleAI.inc.c index c1edde0b4e9..b765fa68b94 100644 --- a/src/world/common/enemy/ai/MontyMoleAI.inc.c +++ b/src/world/common/enemy/ai/MontyMoleAI.inc.c @@ -42,10 +42,10 @@ static s32 N(MontyMoleAI_CanAttack)(Evt* script, EnemyDetectVolume* territory, f retVal = basic_ai_check_player_dist(territory, enemy, radius * 1.1, arg3, 0) != 0; // check npc facing angle for sight of player angle = 270.0f; - if (clamp_angle(get_clamped_angle_diff(cam->currentYaw, npc->yaw)) < 180.0) { + if (clamp_angle(get_clamped_angle_diff(cam->curYaw, npc->yaw)) < 180.0) { angle = 90.0f; } - if (fabsf(get_clamped_angle_diff(angle, atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z))) > 60.0) { + if (fabsf(get_clamped_angle_diff(angle, atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z))) > 60.0) { retVal = FALSE; } // check for overlap with player @@ -53,7 +53,7 @@ static s32 N(MontyMoleAI_CanAttack)(Evt* script, EnemyDetectVolume* territory, f retVal = FALSE; } // check player elevation difference - if (fabsf(npc->pos.y - gPlayerStatusPtr->position.y) >= 40.0f) { + if (fabsf(npc->pos.y - gPlayerStatusPtr->pos.y) >= 40.0f) { retVal = FALSE; } // check for bow hiding @@ -130,8 +130,8 @@ static void N(MontyMoleAI_PreSurface)(Evt* script, MobileAISettings* aiSettings, npc->flags &= ~NPC_FLAG_INVISIBLE; ai_enemy_play_sound(npc, SOUND_BURROW_SURFACE, 0); - npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); - npc->currentAnim = ANIM_MontyMole_Anim10; // emerge from ground + npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); + npc->curAnim = ANIM_MontyMole_Anim10; // emerge from ground npc->duration = 10; script->AI_TEMP_STATE = AI_STATE_MOLE_SURFACE; } @@ -145,7 +145,7 @@ static void N(MontyMoleAI_Surface)(Evt* script, MobileAISettings* aiSettings, En enemy->flags &= ~MONTY_MOLE_UNK_NPC_FLAGS; } if (npc->duration <= 0) { - npc->currentAnim = ANIM_MontyMole_Anim18; // get and throw rock + npc->curAnim = ANIM_MontyMole_Anim18; // get and throw rock npc->duration = 10; script->AI_TEMP_STATE = AI_STATE_MOLE_DRAW_ROCK; } @@ -160,11 +160,11 @@ static void N(MontyMoleAI_DrawRock)(Evt* script, MobileAISettings* aiSettings, E if ((npc->duration) <= 0) { if (!N(MontyMoleAI_CanAttack)(script, territory, aiSettings->alertRadius * 1.1, aiSettings->alertOffsetDist)) { fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &emoteOut); - npc->currentAnim = ANIM_MontyMole_Anim01; // cancel attack + npc->curAnim = ANIM_MontyMole_Anim01; // cancel attack npc->duration = 30; script->AI_TEMP_STATE = AI_STATE_MOLE_PRE_BURROW; } else { - npc->currentAnim = ANIM_MontyMole_Anim1B; // throw rock + npc->curAnim = ANIM_MontyMole_Anim1B; // throw rock npc->duration = 15; script->AI_TEMP_STATE = AI_STATE_MOLE_THROW_ROCK; } @@ -185,13 +185,13 @@ static void N(MontyMoleAI_ThrowRock)(Evt* script, MobileAISettings* aiSettings, rockEnemy->varTable[0] = 1; } if (moleNpc->duration < 8) { - if (dist2D(moleNpc->pos.x, moleNpc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z) > 100.0) { - moleNpc->currentAnim = ANIM_MontyMole_Anim15; // clap + if (dist2D(moleNpc->pos.x, moleNpc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z) > 100.0) { + moleNpc->curAnim = ANIM_MontyMole_Anim15; // clap } } if (moleNpc->duration <= 0) { - if (moleNpc->currentAnim != ANIM_MontyMole_Anim15) { - moleNpc->currentAnim = ANIM_MontyMole_Anim01; + if (moleNpc->curAnim != ANIM_MontyMole_Anim15) { + moleNpc->curAnim = ANIM_MontyMole_Anim01; } moleNpc->duration = 15; script->AI_TEMP_STATE = AI_STATE_MOLE_PRE_BURROW; @@ -206,7 +206,7 @@ static void N(MontyMoleAI_PreBurrow)(Evt* script, MobileAISettings* aiSettings, if (npc->duration <= 0) { ai_enemy_play_sound(npc, SOUND_BURROW_DIG, 0); npc->duration = 11; - npc->currentAnim = ANIM_MontyMole_Anim11; // retreat into ground + npc->curAnim = ANIM_MontyMole_Anim11; // retreat into ground script->AI_TEMP_STATE = AI_STATE_MOLE_BURROW; } } diff --git a/src/world/common/enemy/ai/ParatroopaAI.inc.c b/src/world/common/enemy/ai/ParatroopaAI.inc.c index d4accf0d927..5528aa06cce 100644 --- a/src/world/common/enemy/ai/ParatroopaAI.inc.c +++ b/src/world/common/enemy/ai/ParatroopaAI.inc.c @@ -17,12 +17,12 @@ void N(ParatroopaAI_Windup)(Evt* script, MobileAISettings* aiSettings, EnemyDete Npc* npc = get_npc_unsafe(enemy->npcID); f32 yawTemp; - npc->currentAnim = enemy->animList[9]; - npc->jumpVelocity = -5.0f; + npc->curAnim = enemy->animList[9]; + npc->jumpVel = -5.0f; npc->jumpScale = 0.15f; npc->collisionHeight = enemy->varTable[8] / 2; - dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); npc->moveSpeed = 7.0f; enemy->unk_10.x = npc->pos.x; enemy->unk_10.y = npc->pos.y; @@ -30,7 +30,7 @@ void N(ParatroopaAI_Windup)(Evt* script, MobileAISettings* aiSettings, EnemyDete enemy->hitboxIsActive = TRUE; ai_enemy_play_sound(npc, SOUND_UNUSED_2C1, 0); - yawTemp = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + yawTemp = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); npc->duration = 12; npc->yaw = yawTemp; script->AI_TEMP_STATE = AI_STATE_PARATROOPA_DIVE; @@ -40,17 +40,17 @@ void N(ParatroopaAI_Dive)(Evt* script, MobileAISettings* aiSettings, EnemyDetect Enemy* enemy = script->owner1.enemy; Npc* npc = get_npc_unsafe(script->owner1.enemy->npcID); - npc->jumpVelocity += npc->jumpScale; - npc->pos.y += npc->jumpVelocity; + npc->jumpVel += npc->jumpScale; + npc->pos.y += npc->jumpVel; npc_move_heading(npc, npc->moveSpeed, npc->yaw); npc->duration--; if (npc->duration <= 0) { enemy->hitboxIsActive = FALSE; npc->jumpScale = 0.3f; - npc->jumpVelocity = 0.0f; + npc->jumpVel = 0.0f; npc->moveSpeed = 3.0f; - npc->currentAnim = enemy->animList[10]; + npc->curAnim = enemy->animList[10]; script->AI_TEMP_STATE = AI_STATE_PARATROOPA_OVERSHOOT; } } @@ -64,8 +64,8 @@ void N(ParatroopaAI_Overshoot)(Evt* script, MobileAISettings *arg1, EnemyDetectV f32 endOvershootHeight; f32 overshootAmt; - npc->jumpVelocity += npc->jumpScale; - npc->pos.y += npc->jumpVelocity; + npc->jumpVel += npc->jumpScale; + npc->pos.y += npc->jumpVel; overshootAmt = overshootAmtRaw / 100.0; npc_move_heading(npc, npc->moveSpeed, npc->yaw); @@ -81,7 +81,7 @@ void N(ParatroopaAI_Overshoot)(Evt* script, MobileAISettings *arg1, EnemyDetectV if (!(npc->pos.y < endOvershootHeight)) { npc->duration = 10; - npc->currentAnim = enemy->animList[11]; + npc->curAnim = enemy->animList[11]; npc->collisionHeight = enemy->varTable[8]; script->AI_TEMP_STATE = AI_STATE_PARATROOPA_RESET; } diff --git a/src/world/common/enemy/ai/PatrolNoAttackAI.inc.c b/src/world/common/enemy/ai/PatrolNoAttackAI.inc.c index 9da6ecc8931..248f9a95c62 100644 --- a/src/world/common/enemy/ai/PatrolNoAttackAI.inc.c +++ b/src/world/common/enemy/ai/PatrolNoAttackAI.inc.c @@ -36,7 +36,7 @@ API_CALLABLE(N(PatrolNoAttackAI_Main)) { if (isInitialCall || enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) { script->AI_TEMP_STATE = AI_STATE_PATROL_INIT; npc->duration = 0; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; npc->flags &= ~NPC_FLAG_JUMPING; if (!enemy->territory->patrol.isFlying) { diff --git a/src/world/common/enemy/ai/PiranhaPlantAI.inc.c b/src/world/common/enemy/ai/PiranhaPlantAI.inc.c index 6868541c95d..a611403079d 100644 --- a/src/world/common/enemy/ai/PiranhaPlantAI.inc.c +++ b/src/world/common/enemy/ai/PiranhaPlantAI.inc.c @@ -14,7 +14,7 @@ void N(PiranhaPlantAI_00)(Evt* script, MobileAISettings* aiSettings, EnemyDetect npc->duration--; } else { enemy->varTable[0] = 0; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; script->functionTemp[1] = 0; script->functionTemp[0] = 1; } @@ -29,7 +29,7 @@ void N(PiranhaPlantAI_01)(Evt* script, MobileAISettings* aiSettings, EnemyDetect ai_enemy_play_sound(npc, SOUND_BURROW_DIG, 0); fx_emote(EMOTE_EXCLAMATION, npc, 0, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 10, &temp); ai_enemy_play_sound(npc, SOUND_2F4, SOUND_PARAM_MORE_QUIET); - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_PRE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_PRE]; npc->duration = enemy->varTable[8]; script->functionTemp[0] = 10; } @@ -63,9 +63,9 @@ void N(PiranhaPlantAI_10)(Evt* script, MobileAISettings* aiSettings, EnemyDetect if (npc->duration == 0) { if (clamp_angle(gPlayerStatusPtr->spriteFacingAngle) < 180.0f) { - yaw2 = clamp_angle(gCameras[gCurrentCameraID].currentYaw - 90.0f); + yaw2 = clamp_angle(gCameras[gCurrentCameraID].curYaw - 90.0f); } else { - yaw2 = clamp_angle(gCameras[gCurrentCameraID].currentYaw + 90.0f); + yaw2 = clamp_angle(gCameras[gCurrentCameraID].curYaw + 90.0f); } yaw = clamp_angle(yaw2 + 180.0f); @@ -89,8 +89,8 @@ void N(PiranhaPlantAI_10)(Evt* script, MobileAISettings* aiSettings, EnemyDetect } } - npc->pos.x = gPlayerStatusPtr->position.x; - npc->pos.z = gPlayerStatusPtr->position.z; + npc->pos.x = gPlayerStatusPtr->pos.x; + npc->pos.z = gPlayerStatusPtr->pos.z; add_vec2D_polar(&npc->pos.x, &npc->pos.z, npc->collisionDiameter, yaw); npc_move_heading(npc, moveSpeed + npc->collisionDiameter, yaw2); @@ -122,13 +122,13 @@ void N(PiranhaPlantAI_10)(Evt* script, MobileAISettings* aiSettings, EnemyDetect } } else { if (!(npc->flags & NPC_FLAG_IGNORE_WORLD_COLLISION)) { - sp20 = gPlayerStatusPtr->position.x; - sp24 = gPlayerStatusPtr->position.y + 18.0; - sp28 = gPlayerStatusPtr->position.z; + sp20 = gPlayerStatusPtr->pos.x; + sp24 = gPlayerStatusPtr->pos.y + 18.0; + sp28 = gPlayerStatusPtr->pos.z; if (npc_test_move_simple_with_slipping(npc->collisionChannel, &sp20, &sp24, &sp28, moveSpeed, yaw2, npc->collisionHeight, npc->collisionDiameter)) { - sp20 = gPlayerStatusPtr->position.x; - sp24 = gPlayerStatusPtr->position.y + 45.0; - sp28 = gPlayerStatusPtr->position.z; + sp20 = gPlayerStatusPtr->pos.x; + sp24 = gPlayerStatusPtr->pos.y + 45.0; + sp28 = gPlayerStatusPtr->pos.z; cond1 = npc_test_move_simple_with_slipping(npc->collisionChannel, &sp20, &sp24, &sp28, moveSpeed, yaw2, npc->collisionHeight, npc->collisionDiameter); sp2C = npc->pos.x; sp30 = npc->pos.y + 100.0; @@ -138,26 +138,26 @@ void N(PiranhaPlantAI_10)(Evt* script, MobileAISettings* aiSettings, EnemyDetect if (!cond1 && cond2 && sp38 > 80.0 && sp38 < 120.0 && npc->pos.y != sp30) { phi_fp = TRUE; } else { - sp20 = gPlayerStatusPtr->position.x; - sp24 = gPlayerStatusPtr->position.y + 10.0; - sp28 = gPlayerStatusPtr->position.z; + sp20 = gPlayerStatusPtr->pos.x; + sp24 = gPlayerStatusPtr->pos.y + 10.0; + sp28 = gPlayerStatusPtr->pos.z; npc_test_move_simple_with_slipping(npc->collisionChannel, &sp20, &sp24, &sp28, moveSpeed, yaw2, npc->collisionHeight, npc->collisionDiameter); - posRadius = dist2D(gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z, sp20, sp28); - npc->pos.x = gPlayerStatusPtr->position.x; - npc->pos.z = gPlayerStatusPtr->position.z; + posRadius = dist2D(gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z, sp20, sp28); + npc->pos.x = gPlayerStatusPtr->pos.x; + npc->pos.z = gPlayerStatusPtr->pos.z; add_vec2D_polar(&npc->pos.x, &npc->pos.z, npc->collisionDiameter, yaw); npc_move_heading(npc, posRadius + npc->collisionDiameter, yaw2); phi_s7 = TRUE; } } } else { - sp20 = gPlayerStatusPtr->position.x; - sp24 = gPlayerStatusPtr->position.y + 18.0; - sp28 = gPlayerStatusPtr->position.z; + sp20 = gPlayerStatusPtr->pos.x; + sp24 = gPlayerStatusPtr->pos.y + 18.0; + sp28 = gPlayerStatusPtr->pos.z; if (npc_test_move_simple_with_slipping(npc->collisionChannel, &sp20, &sp24, &sp28, moveSpeed, yaw2, npc->collisionHeight, npc->collisionDiameter)) { - posRadius = dist2D(gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z, sp20, sp28); - npc->pos.x = gPlayerStatusPtr->position.x; - npc->pos.z = gPlayerStatusPtr->position.z; + posRadius = dist2D(gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z, sp20, sp28); + npc->pos.x = gPlayerStatusPtr->pos.x; + npc->pos.z = gPlayerStatusPtr->pos.z; add_vec2D_polar(&npc->pos.x, &npc->pos.z, npc->collisionDiameter, yaw); npc_move_heading(npc, posRadius + npc->collisionDiameter, yaw2); } @@ -211,9 +211,9 @@ void N(PiranhaPlantAI_10)(Evt* script, MobileAISettings* aiSettings, EnemyDetect } } - npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); ai_enemy_play_sound(npc, SOUND_BURROW_SURFACE, 0); - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_HIT]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_HIT]; npc->duration = enemy->varTable[10]; script->functionTemp[0] = 11; } @@ -228,7 +228,7 @@ void N(PiranhaPlantAI_11)(Evt* script, MobileAISettings* aiSettings, EnemyDetect enemy->flags &= ~(ENEMY_FLAG_100000 | ENEMY_FLAG_IGNORE_TOUCH | ENEMY_FLAG_IGNORE_JUMP | ENEMY_FLAG_IGNORE_HAMMER | ENEMY_FLAG_CANT_INTERACT | ENEMY_FLAG_IGNORE_PARTNER); } if (npc->duration == 0) { - npc->currentAnim = enemy->animList[10]; + npc->curAnim = enemy->animList[10]; npc->duration = 0; script->functionTemp[0] = 12; } @@ -241,7 +241,7 @@ void N(PiranhaPlantAI_12)(Evt* script, MobileAISettings* aiSettings, EnemyDetect npc->duration++; if (npc->duration == enemy->varTable[13]) { - npc->currentAnim = enemy->animList[11]; + npc->curAnim = enemy->animList[11]; } if (npc->duration == enemy->varTable[14]) { enemy->varTable[0] = 3; @@ -249,7 +249,7 @@ void N(PiranhaPlantAI_12)(Evt* script, MobileAISettings* aiSettings, EnemyDetect if (npc->duration >= enemy->varTable[12]) { enemy->varTable[0] = 4; npc->duration = 8; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; fx_emote(EMOTE_FRUSTRATION, npc, 0, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 10, &temp); script->functionTemp[0] = 13; } @@ -322,7 +322,7 @@ s32 N(PiranhaPlantAI_Main)(Evt* script, s32 isInitialCall) { if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND)) { script->AI_TEMP_STATE = AI_STATE_PIRANHA_PLANT_00; npc->duration = 0; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; enemy->AI_VAR_ATTACK_STATE = MELEE_HITBOX_STATE_NONE; if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) { diff --git a/src/world/common/enemy/ai/ProjectileHitbox.inc.c b/src/world/common/enemy/ai/ProjectileHitbox.inc.c index 5f48dfc5508..ececea58cbb 100644 --- a/src/world/common/enemy/ai/ProjectileHitbox.inc.c +++ b/src/world/common/enemy/ai/ProjectileHitbox.inc.c @@ -17,15 +17,15 @@ s32 N(ProjectileHitbox_GetUsableProjectileID)(Evt* script) { s32 i; if (ai_check_player_dist(enemy, 0, aiSettings->chaseRadius, aiSettings->chaseOffsetDist)) { - if (clamp_angle(get_clamped_angle_diff(camera->currentYaw, npc->yaw)) < 180.0) { + if (clamp_angle(get_clamped_angle_diff(camera->curYaw, npc->yaw)) < 180.0) { facingAngle = 90.0f; } else { facingAngle = 270.0f; } - angleToPlayer = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + angleToPlayer = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); deltaAngle = get_clamped_angle_diff(facingAngle, angleToPlayer); - if (fabsf(deltaAngle) > 75.0 || (2.0 * npc->collisionHeight <= fabsf(npc->pos.y - gPlayerStatusPtr->position.y))) { + if (fabsf(deltaAngle) > 75.0 || (2.0 * npc->collisionHeight <= fabsf(npc->pos.y - gPlayerStatusPtr->pos.y))) { return -1; } if (gPartnerStatus.actingPartner == PARTNER_BOW) { @@ -58,14 +58,14 @@ void N(UnkNpcAIFunc48)(Evt* script, f32 arg1, f32 arg2, EnemyDetectVolume* terri EffectInstance* sp28; fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &sp28); - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; npc->duration = 20; script->functionTemp[0] = 33; } else { s32 npcID = N(ProjectileHitbox_GetUsableProjectileID)(script); if (npcID != NPC_SELF && get_enemy(npcID)->varTable[0] == 0 && npc->turnAroundYawAdjustment == 0) { - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_PRE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_PRE]; npc->duration = enemy->varTable[1]; script->functionTemp[0] = 30; } @@ -84,11 +84,11 @@ void N(ProjectileHitbox_30)(Evt* script) { EffectInstance* emoteTemp; fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &emoteTemp); - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; } else { Enemy* hitboxEnemy; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_HIT]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_HIT]; hitboxEnemy = get_enemy(npcID); hitboxEnemy->varTable[4] = enemy->npcID; hitboxEnemy->varTable[0] = 1; @@ -113,7 +113,7 @@ void N(ProjectileHitbox_32)(Evt* script) { npc->yaw = atan2(npc->pos.x, npc->pos.z, npc2->pos.x, npc2->pos.z); if (enemy2->varTable[0] == 0) { - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; npc->duration = enemy->varTable[2]; script->functionTemp[0] = AI_STATE_PROJECTILE_HITBOX_33; } @@ -187,12 +187,12 @@ API_CALLABLE(N(ProjectileAI_Main)) { enemy->unk_10.x = npc->pos.x; enemy->unk_10.y = npc->pos.y; enemy->unk_10.z = npc->pos.z; - npc->rotation.x = 0.0f; - npc->rotation.y = 0.0f; - npc->rotation.z = 0.0f; + npc->rot.x = 0.0f; + npc->rot.y = 0.0f; + npc->rot.z = 0.0f; npc->moveSpeed = aiSettings->moveSpeed; - npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); - npc->jumpVelocity = aiSettings->alertRadius; + npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); + npc->jumpVel = aiSettings->alertRadius; npc->jumpScale = aiSettings->alertOffsetDist; npc->moveToPos.y = npc2->pos.y; npc->flags &= ~NPC_FLAG_INVISIBLE; @@ -223,7 +223,7 @@ API_CALLABLE(N(ProjectileAI_Main)) { z = npc->pos.z; hitDepth = 1000.0f; if ((npc_raycast_down_sides(npc->collisionChannel, &x, &y, &z, &hitDepth) != 0) && - (hitDepth < fabsf(npc->jumpVelocity)) && + (hitDepth < fabsf(npc->jumpVel)) && (fabsf(y - npc->moveToPos.y) < 20.0)) { npc->pos.y = y; @@ -241,18 +241,18 @@ API_CALLABLE(N(ProjectileAI_Main)) { if (phi_s6 == 0) { if (enemy->varTable[1] & 1) { - npc->rotation.z += 40.0; + npc->rot.z += 40.0; } npc_move_heading(npc, npc->moveSpeed, npc->yaw); - npc->pos.y += npc->jumpVelocity; - npc->jumpVelocity -= npc->jumpScale; + npc->pos.y += npc->jumpVel; + npc->jumpVel -= npc->jumpScale; } else { fx_walking_dust(2, npc->pos.x, npc->pos.y, npc->pos.z, 0, 0); enemy->varTable[0] = 0; npc->pos.x = NPC_DISPOSE_POS_X; npc->pos.y = NPC_DISPOSE_POS_Y; npc->pos.z = NPC_DISPOSE_POS_Z; - npc->jumpVelocity = 0.0f; + npc->jumpVel = 0.0f; npc->flags |= NPC_FLAG_INVISIBLE; disable_npc_shadow(npc); npc->flags &= ~NPC_FLAG_JUMPING; @@ -299,17 +299,17 @@ API_CALLABLE(N(ProjectileAI_Reflect)) { switch (script->functionTemp[0]) { case 0: fx_walking_dust(2, npc->pos.x, npc->pos.y, npc->pos.z, 0.0f, 0.0f); - yaw = clamp_angle(camera->currentYaw); + yaw = clamp_angle(camera->curYaw); temp_f20_2 = clamp_angle(yaw + 180.0); temp_f22 = clamp_angle(yaw + 90.0); temp_f20_3 = clamp_angle(temp_f20_2 + 90.0); - if (clamp_angle(get_clamped_angle_diff(camera->currentYaw, gPlayerStatusPtr->currentYaw)) < 180.0) { + if (clamp_angle(get_clamped_angle_diff(camera->curYaw, gPlayerStatusPtr->curYaw)) < 180.0) { npc->yaw = temp_f22; } else { npc->yaw = temp_f20_3; } npc->duration = 30; - npc->jumpVelocity = 10.0f; + npc->jumpVel = 10.0f; npc->jumpScale = 0.9f; npc->moveSpeed *= 1.2; script->functionTemp[0] = 1; @@ -327,21 +327,21 @@ API_CALLABLE(N(ProjectileAI_Reflect)) { } cond = FALSE; - if (npc->jumpVelocity < 0.0) { + if (npc->jumpVel < 0.0) { x = npc->pos.x; y = npc->pos.y + 13.0; z = npc->pos.z; - hitDepth = fabsf(npc->jumpVelocity) + 16.0; + hitDepth = fabsf(npc->jumpVel) + 16.0; if ((npc_raycast_down_sides(npc->collisionChannel, &x, &y, &z, &hitDepth) != 0) && - (hitDepth <= (fabsf(npc->jumpVelocity) + 13.0))) + (hitDepth <= (fabsf(npc->jumpVel) + 13.0))) { cond = TRUE; } } if (!cond) { - npc->pos.y += npc->jumpVelocity; - npc->jumpVelocity -= npc->jumpScale; + npc->pos.y += npc->jumpVel; + npc->jumpVel -= npc->jumpScale; } else { phi_s4 = 10; } @@ -367,7 +367,7 @@ API_CALLABLE(N(ProjectileAI_Reflect)) { return ApiStatus_DONE2; } if (enemy->varTable[1] & 1) { - npc->rotation.z += 60.0; + npc->rot.z += 60.0; } break; } diff --git a/src/world/common/enemy/ai/RangedAttackAI.inc.c b/src/world/common/enemy/ai/RangedAttackAI.inc.c index 05f0565fda2..49b1a5b3e32 100644 --- a/src/world/common/enemy/ai/RangedAttackAI.inc.c +++ b/src/world/common/enemy/ai/RangedAttackAI.inc.c @@ -32,7 +32,7 @@ API_CALLABLE(N(RangedAttackAI_Main)) { if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND)) { script->AI_TEMP_STATE = 0; npc->duration = 0; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; npc->flags &= ~NPC_FLAG_JUMPING; if (!enemy->territory->wander.isFlying) { @@ -74,7 +74,7 @@ API_CALLABLE(N(RangedAttackAI_Main)) { basic_ai_found_player_jump(script, settings, territoryPtr); break; case AI_STATE_CHASE_INIT: - dist = dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + dist = dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); if (enemy->varTable[0] == 0 || enemy->varTable[0] < dist) { N(UnkNpcAIFunc48)(script, settings->chaseRadius, settings->chaseOffsetDist, territoryPtr); if (script->AI_TEMP_STATE != AI_STATE_CHASE_INIT) { diff --git a/src/world/common/enemy/ai/SentinelAI.inc.c b/src/world/common/enemy/ai/SentinelAI.inc.c index 78aeea8acf3..c37251ac827 100644 --- a/src/world/common/enemy/ai/SentinelAI.inc.c +++ b/src/world/common/enemy/ai/SentinelAI.inc.c @@ -49,9 +49,9 @@ void N(SentinelAI_ChaseInit)(Evt* script, MobileAISettings* aiSettings, EnemyDet if (npc->duration <= 0) { npc->flags &= ~NPC_FLAG_200000; npc->duration = aiSettings->chaseUpdateInterval / 2 + rand_int(aiSettings->chaseUpdateInterval / 2 + 1); - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_PRE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_PRE]; npc->moveSpeed = aiSettings->chaseSpeed; - angle = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + angle = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); deltaAngle = get_clamped_angle_diff(npc->yaw, angle); if (aiSettings->chaseTurnRate < fabsf(deltaAngle)) { angle = npc->yaw; @@ -72,8 +72,8 @@ void N(SentinelAI_Chase)(Evt* script, MobileAISettings* aiSettings, EnemyDetectV if (basic_ai_check_player_dist(territory, enemy, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, 1)) { npc_move_heading(npc, npc->moveSpeed, npc->yaw); - if (dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, - gPlayerStatusPtr->position.z) <= (npc->moveSpeed * 2.5)) { + if (dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, + gPlayerStatusPtr->pos.z) <= (npc->moveSpeed * 2.5)) { npc->duration = 0; script->AI_TEMP_STATE = AI_STATE_SENTINEL_DESCEND_INIT; } else { @@ -100,8 +100,8 @@ void N(SentinelAI_DescendInit)(Evt* script, MobileAISettings* aiSettings, EnemyD } enemy->varTable[0] |= SENTINEL_AI_FLAG_CHASING; - npc->pos.x = gPlayerStatusPtr->position.x; - npc->pos.z = gPlayerStatusPtr->position.z; + npc->pos.x = gPlayerStatusPtr->pos.x; + npc->pos.z = gPlayerStatusPtr->pos.z; if (!(enemy->varTable[0] & SENTINEL_AI_FLAG_PLAYING_SOUND)) { enemy->varTable[0] |= SENTINEL_AI_FLAG_PLAYING_SOUND; } @@ -120,28 +120,28 @@ void N(SentinelAI_Descend)(Evt* script, MobileAISettings* aiSettings, EnemyDetec sfx_adjust_env_sound_pos(SOUND_80000011, SOUND_SPACE_FULL, npc->pos.x, npc->pos.y, npc->pos.z); if (!basic_ai_check_player_dist(territory, enemy, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, 1)) { enemy->varTable[0] &= ~SENTINEL_AI_FLAG_CHASING; - npc->rotation.y = 0.0f; + npc->rot.y = 0.0f; npc->flags &= ~NPC_FLAG_200000; script->AI_TEMP_STATE = AI_STATE_SENTINEL_LOSE_PLAYER_INIT; } else { - npc->pos.x = gPlayerStatusPtr->position.x; - npc->pos.z = gPlayerStatusPtr->position.z + 2.0f; - npc->rotation.y += 25.0f; - if (npc->rotation.y > 360.0) { - npc->rotation.y -= 360.0; + npc->pos.x = gPlayerStatusPtr->pos.x; + npc->pos.z = gPlayerStatusPtr->pos.z + 2.0f; + npc->rot.y += 25.0f; + if (npc->rot.y > 360.0) { + npc->rot.y -= 360.0; } - color = 255.0f - (cosine((s32)npc->rotation.y % 180) * 56.0f); + color = 255.0f - (cosine((s32)npc->rot.y % 180) * 56.0f); set_npc_imgfx_all(npc->spriteInstanceID, IMGFX_SET_COLOR, color, color, color, 255, 0); - posX = gPlayerStatusPtr->position.x; - posY = gPlayerStatusPtr->position.y; - posZ = gPlayerStatusPtr->position.z; + posX = gPlayerStatusPtr->pos.x; + posY = gPlayerStatusPtr->pos.y; + posZ = gPlayerStatusPtr->pos.z; hitDepth = 1000.0f; npc_raycast_down_sides(npc->collisionChannel, &posX, &posY, &posZ, &hitDepth); if (fabsf(npc->pos.y - posY) > 24.0) { npc->pos.y -= SENTINEL_AI_DESCEND_RATE; } else { - npc->rotation.y = 0.0f; + npc->rot.y = 0.0f; npc->flags &= ~NPC_FLAG_200000; if (gPartnerStatus.actingPartner != PARTNER_BOW) { disable_player_input(); @@ -165,7 +165,7 @@ void N(SentinelAI_LosePlayerInit)(Evt* script, MobileAISettings* aiSettings, Ene sfx_stop_sound(SOUND_80000011); enemy->varTable[0] &= ~SENTINEL_AI_FLAG_PLAYING_SOUND; } - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_HIT]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_HIT]; npc->duration = 20; script->AI_TEMP_STATE = AI_STATE_SENTINEL_LOSE_PLAYER; } diff --git a/src/world/common/enemy/ai/ShyGuyPatrolAI.inc.c b/src/world/common/enemy/ai/ShyGuyPatrolAI.inc.c index b09960abbaa..a5b2f2c6bc0 100644 --- a/src/world/common/enemy/ai/ShyGuyPatrolAI.inc.c +++ b/src/world/common/enemy/ai/ShyGuyPatrolAI.inc.c @@ -8,7 +8,7 @@ void N(ShyGuyPatrolAI_14)(Evt* script, MobileAISettings* aiSettings, EnemyDetect Npc* npc = get_npc_unsafe(enemy->npcID); npc->moveSpeed *= 0.6; - npc->currentAnim = enemy->animList[12]; + npc->curAnim = enemy->animList[12]; npc->duration = 5; script->functionTemp[0] = 0xF; } @@ -26,7 +26,7 @@ void N(ShyGuyPatrolAI_15)(Evt* script, MobileAISettings* aiSettings, EnemyDetect if (npc->duration == 0) { npc->moveSpeed *= 0.6; - npc->currentAnim = enemy->animList[11]; + npc->curAnim = enemy->animList[11]; npc->duration = 10; script->functionTemp[0] = 16; } @@ -54,7 +54,7 @@ void N(ShyGuyPatrolAI_17)(Evt* script, MobileAISettings* aiSettings, EnemyDetect npc->duration--; if (npc->duration == 0) { - npc->currentAnim = *enemy->animList; + npc->curAnim = *enemy->animList; script->functionTemp[0] = 0; } } @@ -83,7 +83,7 @@ API_CALLABLE(N(ShyGuyPatrolAI_Main)) { if (isInitialCall || enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) { script->functionTemp[0] = 0; npc->duration = 0; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; npc->flags &= ~NPC_FLAG_JUMPING; if (!enemy->territory->patrol.isFlying) { diff --git a/src/world/common/enemy/ai/ShyGuyWanderAI.inc.c b/src/world/common/enemy/ai/ShyGuyWanderAI.inc.c index 0c918bc5248..05ce7fa76ba 100644 --- a/src/world/common/enemy/ai/ShyGuyWanderAI.inc.c +++ b/src/world/common/enemy/ai/ShyGuyWanderAI.inc.c @@ -6,7 +6,7 @@ void N(ShyGuyWanderAI_14)(Evt* script, MobileAISettings* aiSettings, EnemyDetect Npc* npc = get_npc_unsafe(enemy->npcID); npc->moveSpeed *= 0.6; - npc->currentAnim = enemy->animList[12]; + npc->curAnim = enemy->animList[12]; npc->duration = 5; script->functionTemp[0] = 0xF; } @@ -24,7 +24,7 @@ void N(ShyGuyWanderAI_15)(Evt* script, MobileAISettings* aiSettings, EnemyDetect if (npc->duration == 0) { npc->moveSpeed *= 0.6; - npc->currentAnim = enemy->animList[11]; + npc->curAnim = enemy->animList[11]; npc->duration = 10; script->functionTemp[0] = 16; } @@ -52,7 +52,7 @@ void N(ShyGuyWanderAI_17)(Evt* script, MobileAISettings* aiSettings, EnemyDetect npc->duration--; if (npc->duration == 0) { - npc->currentAnim = *enemy->animList; + npc->curAnim = *enemy->animList; script->functionTemp[0] = 0; } } @@ -81,7 +81,7 @@ API_CALLABLE(N(ShyGuyWanderAI_Main)) { if (isInitialCall || enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) { script->functionTemp[0] = 0; npc->duration = 0; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; npc->flags &= ~NPC_FLAG_JUMPING; if (!enemy->territory->wander.isFlying) { diff --git a/src/world/common/enemy/ai/SpearGuyAI.inc.c b/src/world/common/enemy/ai/SpearGuyAI.inc.c index 5bad33da03e..46e9be18ad2 100644 --- a/src/world/common/enemy/ai/SpearGuyAI.inc.c +++ b/src/world/common/enemy/ai/SpearGuyAI.inc.c @@ -31,7 +31,7 @@ void N(SpearGuyAI_Loiter)(Evt* script, MobileAISettings* aiSettings, EnemyDetect case 1: enemy->varTable[0] = 2; enemy->varTable[1] = 0; - npc->currentAnim = ANIM_SpearGuy_Anim0F; + npc->curAnim = ANIM_SpearGuy_Anim0F; case 2: enemy->varTable[1]++; if (enemy->varTable[1] > 50) { @@ -41,7 +41,7 @@ void N(SpearGuyAI_Loiter)(Evt* script, MobileAISettings* aiSettings, EnemyDetect case 3: enemy->varTable[0] = 4; enemy->varTable[1] = 0; - npc->currentAnim = ANIM_SpearGuy_Anim10; + npc->curAnim = ANIM_SpearGuy_Anim10; case 4: enemy->varTable[1]++; if (enemy->varTable[1] == 25) { @@ -54,7 +54,7 @@ void N(SpearGuyAI_Loiter)(Evt* script, MobileAISettings* aiSettings, EnemyDetect case 5: enemy->varTable[0] = 6; enemy->varTable[1] = 0; - npc->currentAnim = ANIM_SpearGuy_Anim03; + npc->curAnim = ANIM_SpearGuy_Anim03; fx_sweat(0, npc->pos.x, npc->pos.y, npc->pos.z, npc->collisionHeight, 0, 10); case 6: enemy->varTable[1]++; @@ -100,7 +100,7 @@ ApiStatus N(SpearGuyAI_Main)(Evt* script, s32 isInitialCall) { if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND)) { script->AI_TEMP_STATE = AI_STATE_WANDER_INIT; npc->duration = 0; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; npc->flags &= ~NPC_FLAG_JUMPING; if (!enemy->territory->wander.isFlying) { diff --git a/src/world/common/enemy/ai/SpinyAI.inc.c b/src/world/common/enemy/ai/SpinyAI.inc.c index 831c37bdc40..9b735f86e30 100644 --- a/src/world/common/enemy/ai/SpinyAI.inc.c +++ b/src/world/common/enemy/ai/SpinyAI.inc.c @@ -44,7 +44,7 @@ API_CALLABLE(N(SpinyAI_Main)) { if (isInitialCall || (enemy->varTable[10] == 100)) { script->AI_TEMP_STATE = 100; npc->duration = 0; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; npc->flags &= ~NPC_FLAG_JUMPING; enemy->flags |= ENEMY_FLAG_ACTIVE_WHILE_OFFSCREEN; npc->flags &= ~NPC_FLAG_GRAVITY; @@ -61,15 +61,15 @@ API_CALLABLE(N(SpinyAI_Main)) { npc->collisionHeight = enemy->varTable[6]; enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND; if (npc->flags & NPC_FLAG_JUMPING) { - npc->currentAnim = ANIM_Spiny_Anim18; + npc->curAnim = ANIM_Spiny_Anim18; npc->moveSpeed = 0.0f; - npc->jumpVelocity = 0.0f; + npc->jumpVel = 0.0f; npc->jumpScale = 1.0f; script->AI_TEMP_STATE = 102; } else { EffectInstance* emoteTemp; fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 0x28, &emoteTemp); - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; script->functionTemp[1] = 0; script->AI_TEMP_STATE = 200; } @@ -126,21 +126,21 @@ API_CALLABLE(N(SpinyAI_Main)) { } npc->pos.y = npc2->pos.y + 25.0; npc->pos.z = npc2->pos.z + 1.0; - npc->rotation.y = 0.0f; + npc->rot.y = 0.0f; npc->flags |= NPC_FLAG_8; npc->flags &= ~NPC_FLAG_INVISIBLE; npc->flags &= ~NPC_FLAG_GRAVITY; npc->renderYaw = 0.0f; - npc->currentAnim = ANIM_Spiny_Anim18; + npc->curAnim = ANIM_Spiny_Anim18; script->AI_TEMP_STATE = 101; case 101: if (enemy->varTable[10] != 3) { break; } enemy->varTable[10] = 4; - npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); npc->moveSpeed = 2.5f; - npc->jumpVelocity = 8.0f; + npc->jumpVel = 8.0f; npc->jumpScale = 0.8f; npc->flags |= NPC_FLAG_JUMPING; script->AI_TEMP_STATE = 102; @@ -156,12 +156,12 @@ API_CALLABLE(N(SpinyAI_Main)) { npc->moveSpeed = 0.0f; } } - if (npc->jumpVelocity < 0.0) { + if (npc->jumpVel < 0.0) { x2 = npc->pos.x; y2 = npc->pos.y + 13.0; z2 = npc->pos.z; - w2 = fabsf(npc->jumpVelocity) + 16.0; - if ((npc_raycast_down_sides(npc->collisionChannel, &x2, &y2, &z2, &w2) != 0) && (w2 <= (fabsf(npc->jumpVelocity) + 13.0))) { + w2 = fabsf(npc->jumpVel) + 16.0; + if ((npc_raycast_down_sides(npc->collisionChannel, &x2, &y2, &z2, &w2) != 0) && (w2 <= (fabsf(npc->jumpVel) + 13.0))) { npc->pos.y = y2; enemy->territory->wander.centerPos.x = npc->pos.x; enemy->territory->wander.centerPos.y = npc->pos.y; @@ -187,22 +187,22 @@ API_CALLABLE(N(SpinyAI_Main)) { } npc->flags |= NPC_FLAG_IGNORE_CAMERA_FOR_YAW; npc->flags &= ~NPC_FLAG_JUMPING; - npc->jumpVelocity = 0.0f; - npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); - npc->currentAnim = ANIM_Spiny_Anim1A; + npc->jumpVel = 0.0f; + npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); + npc->curAnim = ANIM_Spiny_Anim1A; npc->duration = 3; script->AI_TEMP_STATE = 103; break; } } - npc->pos.y += npc->jumpVelocity; - npc->jumpVelocity -= npc->jumpScale; + npc->pos.y += npc->jumpVel; + npc->jumpVel -= npc->jumpScale; break; case 103: npc->duration--; if (npc->duration <= 0) { npc->flags &= ~NPC_FLAG_IGNORE_CAMERA_FOR_YAW; - npc->currentAnim = ANIM_Spiny_Anim01; + npc->curAnim = ANIM_Spiny_Anim01; script->AI_TEMP_STATE = 0; } break; diff --git a/src/world/common/enemy/ai/States_PatrolAI.inc.c b/src/world/common/enemy/ai/States_PatrolAI.inc.c index a18f001a5dc..74dda9d43e0 100644 --- a/src/world/common/enemy/ai/States_PatrolAI.inc.c +++ b/src/world/common/enemy/ai/States_PatrolAI.inc.c @@ -34,7 +34,7 @@ void N(PatrolAI_MoveInit)(Evt* script, MobileAISettings* aiSettings, EnemyDetect } } - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_WALK]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_WALK]; if (enemy->territory->patrol.moveSpeedOverride < 0) { npc->moveSpeed = aiSettings->moveSpeed; } else { @@ -99,7 +99,7 @@ void N(PatrolAI_LoiterInit)(Evt* script, MobileAISettings* aiSettings, EnemyDete npc->duration = (aiSettings->waitTime / 2) + rand_int((aiSettings->waitTime / 2) + 1); npc->yaw = clamp_angle(npc->yaw + rand_int(180) - 90.0f); - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; script->AI_TEMP_STATE = AI_STATE_LOITER; } @@ -111,7 +111,7 @@ void N(PatrolAI_Loiter)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVo if ((aiSettings->playerSearchInterval >= 0) && basic_ai_check_player_dist(territory, enemy, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, 0)) { fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 0xF, &emoteTemp); - npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); ai_enemy_play_sound(npc, SOUND_2F4, SOUND_PARAM_MORE_QUIET); if (!(enemy->npcSettings->actionFlags & AI_ACTION_JUMP_WHEN_SEE_PLAYER)) { script->AI_TEMP_STATE = AI_STATE_CHASE_INIT; @@ -146,7 +146,7 @@ void N(PatrolAI_PostLoiter)(Evt* script, MobileAISettings* aiSettings, EnemyDete if (script->functionTemp[2] >= enemy->territory->patrol.numPoints) { script->functionTemp[2] = 0; } - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_WALK]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_WALK]; if (enemy->territory->patrol.moveSpeedOverride < 0) { npc->moveSpeed = aiSettings->moveSpeed; } else { @@ -159,8 +159,8 @@ void N(PatrolAI_JumpInit)(Evt* script, MobileAISettings* aiSettings, EnemyDetect Enemy* enemy = script->owner1.enemy; Npc* npc = get_npc_unsafe(enemy->npcID); - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_JUMP]; - npc->jumpVelocity = 10.0f; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_JUMP]; + npc->jumpVel = 10.0f; npc->jumpScale = 2.0f; npc->moveToPos.y = npc->pos.y; npc->flags |= NPC_FLAG_JUMPING; @@ -170,12 +170,12 @@ void N(PatrolAI_JumpInit)(Evt* script, MobileAISettings* aiSettings, EnemyDetect void N(PatrolAI_Jump)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolume* territory) { Npc* npc = get_npc_unsafe(script->owner1.enemy->npcID); - npc->pos.y += npc->jumpVelocity; - npc->jumpVelocity -= npc->jumpScale; + npc->pos.y += npc->jumpVel; + npc->jumpVel -= npc->jumpScale; if (!(npc->pos.y > npc->moveToPos.y)) { npc->pos.y = npc->moveToPos.y; - npc->jumpVelocity = 0.0f; + npc->jumpVel = 0.0f; npc->flags &= ~NPC_FLAG_JUMPING; script->AI_TEMP_STATE = AI_STATE_CHASE_INIT; } @@ -188,10 +188,10 @@ void N(PatrolAI_ChaseInit)(Evt* script, MobileAISettings* aiSettings, EnemyDetec f32 angleDiff; npc->duration = (aiSettings->chaseUpdateInterval / 2) + rand_int(aiSettings->chaseUpdateInterval / 2 + 1); - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_CHASE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_CHASE]; npc->moveSpeed = aiSettings->chaseSpeed; - angle = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + angle = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); angleDiff = get_clamped_angle_diff(npc->yaw, angle); if (aiSettings->chaseTurnRate < fabsf(angleDiff)) { @@ -215,7 +215,7 @@ ApiStatus N(PatrolAI_Chase)(Evt* script, MobileAISettings* aiSettings, EnemyDete if (!basic_ai_check_player_dist(territory, enemy, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, 1)) { fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &emoteTemp); - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; npc->duration = 25; script->AI_TEMP_STATE = AI_STATE_LOSE_PLAYER; } else { @@ -257,7 +257,7 @@ void N(PatrolNoAttackAI_15)(Evt* script, MobileAISettings* aiSettings, EnemyDete } npc->moveSpeed = aiSettings->moveSpeed; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_WALK]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_WALK]; script->functionTemp[1] = 0; script->AI_TEMP_STATE = AI_STATE_PATROL; } diff --git a/src/world/common/enemy/ai/States_TackleAI.inc.c b/src/world/common/enemy/ai/States_TackleAI.inc.c index 9645ee2d13d..fcb2ab84bed 100644 --- a/src/world/common/enemy/ai/States_TackleAI.inc.c +++ b/src/world/common/enemy/ai/States_TackleAI.inc.c @@ -11,9 +11,9 @@ void N(set_script_owner_npc_anim)(Evt* script, MobileAISettings* aiSettings, Ene Enemy* enemy = script->owner1.enemy; Npc* npc = get_npc_unsafe(enemy->npcID); - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_PRE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_PRE]; npc->duration = enemy->varTable[2]; - npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); + npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z); script->AI_TEMP_STATE = 13; } @@ -24,13 +24,13 @@ ApiStatus N(UnkDistFunc)(Evt* script, MobileAISettings* aiSettings, EnemyDetectV if ((npc->duration <= 0) || (--npc->duration <= 0)) { if (npc->turnAroundYawAdjustment == 0) { - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_HIT]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_MELEE_HIT]; npc->moveSpeed = aiSettings->chaseSpeed; if ((enemy->varTable[7] == 5) || (enemy->varTable[7] == 0) || (enemy->varTable[7] == 1)) { npc->collisionHeight = enemy->varTable[6] / 2; } - npc->duration = (dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, - gPlayerStatusPtr->position.z) / npc->moveSpeed) + 0.8; + npc->duration = (dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, + gPlayerStatusPtr->pos.z) / npc->moveSpeed) + 0.8; if (npc->duration < enemy->varTable[3]) { npc->duration = enemy->varTable[3]; } @@ -66,7 +66,7 @@ void N(UnkNpcAIFunc12)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVol if ((npc->duration <= 0) || (--npc->duration <= 0) || (temp != 0)) { enemy->hitboxIsActive = FALSE; - npc->currentAnim = enemy->animList[10]; + npc->curAnim = enemy->animList[10]; npc->duration = 0; script->functionTemp[0] = 15; } diff --git a/src/world/common/enemy/ai/StoneChompAI.inc.c b/src/world/common/enemy/ai/StoneChompAI.inc.c index 7a39c818fd4..8e15dffd274 100644 --- a/src/world/common/enemy/ai/StoneChompAI.inc.c +++ b/src/world/common/enemy/ai/StoneChompAI.inc.c @@ -5,7 +5,7 @@ void N(StoneChompAI_HopInit)(Evt* script, MobileAISettings* aiSettings, EnemyDet Npc* npc = get_npc_unsafe(script->owner1.enemy->npcID); basic_ai_wander_init(script, aiSettings, territory); - npc->jumpVelocity = rand_int(5) + 8.0; + npc->jumpVel = rand_int(5) + 8.0; npc->jumpScale = 1.5f; } @@ -13,7 +13,7 @@ void N(StoneChompAI_ChaseInit)(Evt* script, MobileAISettings* aiSettings, EnemyD Npc* npc = get_npc_unsafe(script->owner1.enemy->npcID); basic_ai_chase_init(script, aiSettings, territory); - npc->jumpVelocity = rand_int(5) + 5.0; + npc->jumpVel = rand_int(5) + 5.0; npc->jumpScale = 1.5f; } diff --git a/src/world/common/enemy/ai/SwooperAI.inc.c b/src/world/common/enemy/ai/SwooperAI.inc.c index 48cb74f3056..b89ff5b2a14 100644 --- a/src/world/common/enemy/ai/SwooperAI.inc.c +++ b/src/world/common/enemy/ai/SwooperAI.inc.c @@ -43,7 +43,7 @@ API_CALLABLE(N(SwooperAI_Main)) { switch (script->functionTemp[0]) { case 0: - npc->currentAnim = enemy->animList[0]; + npc->curAnim = enemy->animList[0]; npc->verticalRenderOffset = npc->collisionHeight; npc->flags |= NPC_FLAG_UPSIDE_DOWN; script->functionTemp[1] = 0; @@ -63,10 +63,10 @@ API_CALLABLE(N(SwooperAI_Main)) { break; } case 10: - npc->currentAnim = enemy->animList[3]; - npc->planarFlyDist = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z); + npc->curAnim = enemy->animList[3]; + npc->planarFlyDist = atan2(npc->pos.x, npc->pos.z, playerStatus->pos.x, playerStatus->pos.z); npc->jumpScale = 1.3f; - npc->jumpVelocity = 0.0f; + npc->jumpVel = 0.0f; npc->moveSpeed = aiSettings->moveSpeed; x = npc->pos.x; y = npc->pos.y; @@ -76,7 +76,7 @@ API_CALLABLE(N(SwooperAI_Main)) { y = enemy->varTable[1]; npc->moveToPos.y = y + ((npc->pos.y - y) * 0.7); } else { - npc->moveToPos.y = playerStatus->position.y + ((npc->pos.y - playerStatus->position.y) * 0.7); + npc->moveToPos.y = playerStatus->pos.y + ((npc->pos.y - playerStatus->pos.y) * 0.7); } npc->moveToPos.z = npc->pos.y; script->functionTemp[0] = 11; @@ -88,12 +88,12 @@ API_CALLABLE(N(SwooperAI_Main)) { if (npc_test_move_simple_with_slipping(npc->collisionChannel, &x, &y, &z, npc->moveSpeed, npc->yaw, npc->collisionHeight, npc->collisionDiameter)) { npc->moveSpeed = 0.0f; } - npc->yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z); + npc->yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->pos.x, playerStatus->pos.z); npc_move_heading(npc, npc->moveSpeed, npc->yaw); } - npc->jumpVelocity -= npc->jumpScale; - npc->pos.y += npc->jumpVelocity; + npc->jumpVel -= npc->jumpScale; + npc->pos.y += npc->jumpVel; if (npc->pos.y < npc->moveToPos.y) { npc->pos.y = npc->moveToPos.y; script->functionTemp[0] = 12; @@ -101,7 +101,7 @@ API_CALLABLE(N(SwooperAI_Main)) { break; } case 12: - npc->planarFlyDist = dist2D(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z); + npc->planarFlyDist = dist2D(npc->pos.x, npc->pos.z, playerStatus->pos.x, playerStatus->pos.z); if (npc->planarFlyDist < 60.0f) { npc->planarFlyDist = 60.0f; } @@ -114,25 +114,25 @@ API_CALLABLE(N(SwooperAI_Main)) { if (npc->duration == 0) { npc->duration = 1; } - npc->jumpScale = -fabsf(-(2.0f * ((-npc->jumpVelocity * npc->duration) + y2)) / SQ(npc->duration)); + npc->jumpScale = -fabsf(-(2.0f * ((-npc->jumpVel * npc->duration) + y2)) / SQ(npc->duration)); npc->verticalRenderOffset = 0; npc->flags &= ~NPC_FLAG_UPSIDE_DOWN; enemy->varTable[0] = 5; npc->duration = 0; script->functionTemp[0] = 13; case 13: - npc->jumpVelocity -= npc->jumpScale; - if (npc->jumpVelocity < 0.0f) { + npc->jumpVel -= npc->jumpScale; + if (npc->jumpVel < 0.0f) { x = npc->pos.x; y = npc->pos.y; z = npc->pos.z; - hitDepth = -npc->jumpVelocity; + hitDepth = -npc->jumpVel; if (npc_raycast_down_sides(npc->collisionChannel, &x, &y, &z, &hitDepth) != 0) { - npc->jumpVelocity = 0.0f; + npc->jumpVel = 0.0f; } } - npc->pos.y += npc->jumpVelocity; + npc->pos.y += npc->jumpVel; if (npc->moveSpeed > 0.0) { x = npc->pos.x; y = npc->pos.y; @@ -141,10 +141,10 @@ API_CALLABLE(N(SwooperAI_Main)) { npc->collisionHeight, npc->collisionDiameter) != 0) { npc->moveSpeed = 0.0f; - } else if (npc->jumpVelocity < -2.5) { + } else if (npc->jumpVel < -2.5) { npc->duration++; if (npc->duration >= aiSettings->chaseUpdateInterval) { - f32 yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z); + f32 yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->pos.x, playerStatus->pos.z); f32 angleDiff = get_clamped_angle_diff(npc->yaw, yaw); if (aiSettings->chaseTurnRate < fabsf(angleDiff)) { @@ -173,7 +173,7 @@ API_CALLABLE(N(SwooperAI_Main)) { break; } case 14: - npc->currentAnim = enemy->animList[8]; + npc->curAnim = enemy->animList[8]; npc->verticalRenderOffset = npc->collisionHeight; npc->flags |= NPC_FLAG_UPSIDE_DOWN; npc->duration = 15; diff --git a/src/world/common/enemy/ai/TackleAI.inc.c b/src/world/common/enemy/ai/TackleAI.inc.c index 7e5829ff395..b6bd2a61bc3 100644 --- a/src/world/common/enemy/ai/TackleAI.inc.c +++ b/src/world/common/enemy/ai/TackleAI.inc.c @@ -47,7 +47,7 @@ API_CALLABLE(N(TackleAI_Main)) { script->AI_TEMP_STATE = 0; npc->duration = 0; enemy->hitboxIsActive = FALSE; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; npc->flags &= ~NPC_FLAG_JUMPING; npc->collisionHeight = enemy->varTable[6]; enemy->varTable[9] = 0; @@ -76,10 +76,10 @@ API_CALLABLE(N(TackleAI_Main)) { if (enemy->varTable[9] > 0) { enemy->varTable[9]--; if (enemy->varTable[9] == 0) { - if (npc->currentAnim == ANIM_BonyBeetle_Anim2E || - npc->currentAnim == ANIM_BonyBeetle_Anim2F) + if (npc->curAnim == ANIM_BonyBeetle_Anim2E || + npc->curAnim == ANIM_BonyBeetle_Anim2F) { - npc->currentAnim = ANIM_BonyBeetle_Anim0C; + npc->curAnim = ANIM_BonyBeetle_Anim0C; } } else { return ApiStatus_BLOCK; @@ -100,11 +100,11 @@ API_CALLABLE(N(TackleAI_Main)) { if (enemy->varTable[8] != 0) { enemy->varTable[8] = 0; enemy->instigatorValue = 0; - npc->currentAnim = ANIM_BonyBeetle_Anim2F; + npc->curAnim = ANIM_BonyBeetle_Anim2F; } else { enemy->varTable[8] = 1; enemy->instigatorValue = 1; - npc->currentAnim = ANIM_BonyBeetle_Anim2E; + npc->curAnim = ANIM_BonyBeetle_Anim2E; } enemy->varTable[9] = 7; return ApiStatus_BLOCK; @@ -136,7 +136,7 @@ API_CALLABLE(N(TackleAI_Main)) { enemy->instigatorValue = 0; } if (enemy->varTable[8] != 0) { - switch (npc->currentAnim) { + switch (npc->curAnim) { case ANIM_BonyBeetle_Anim04: case ANIM_BonyBeetle_Anim0C: case ANIM_BonyBeetle_Anim0E: @@ -144,7 +144,7 @@ API_CALLABLE(N(TackleAI_Main)) { case ANIM_BonyBeetle_Anim12: case ANIM_BonyBeetle_Anim16: case ANIM_BonyBeetle_Anim18: - npc->currentAnim++; + npc->curAnim++; break; } } diff --git a/src/world/common/enemy/ai/WanderMeleeAI.inc.c b/src/world/common/enemy/ai/WanderMeleeAI.inc.c index 18d2356c341..b5e8bc0e82a 100644 --- a/src/world/common/enemy/ai/WanderMeleeAI.inc.c +++ b/src/world/common/enemy/ai/WanderMeleeAI.inc.c @@ -41,7 +41,7 @@ ApiStatus N(WanderMeleeAI_Main)(Evt* script, s32 isInitialCall) { if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND)) { script->AI_TEMP_STATE = AI_STATE_WANDER_INIT; npc->duration = 0; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; npc->flags &= ~NPC_FLAG_JUMPING; if (!enemy->territory->wander.isFlying) { diff --git a/src/world/common/entity/Pipe.inc.c b/src/world/common/entity/Pipe.inc.c index 22ab447225c..015014daf60 100644 --- a/src/world/common/entity/Pipe.inc.c +++ b/src/world/common/entity/Pipe.inc.c @@ -45,7 +45,7 @@ API_CALLABLE(N(Pipe_SetAnimFlag)) { } API_CALLABLE(N(Pipe_GetCurrentFloor)) { - script->varTable[0] = gCollisionStatus.currentFloor; + script->varTable[0] = gCollisionStatus.curFloor; return ApiStatus_DONE2; } @@ -53,7 +53,7 @@ API_CALLABLE(N(Pipe_AwaitDownInput)) { CollisionStatus* collisionStatus = &gCollisionStatus; s32 stickX, stickY; - if (collisionStatus->currentFloor != script->varTable[11]) { + if (collisionStatus->curFloor != script->varTable[11]) { script->varTable[0] = FALSE; return ApiStatus_DONE2; } @@ -88,16 +88,16 @@ API_CALLABLE(N(Pipe_GetEntryPos)) { } API_CALLABLE(N(Pipe_GetCameraYaw)) { - script->varTable[0] = clamp_angle(gCameras[gCurrentCameraID].currentYaw + 180.0f); + script->varTable[0] = clamp_angle(gCameras[gCurrentCameraID].curYaw + 180.0f); return ApiStatus_DONE2; } API_CALLABLE(N(Pipe_GetPointAheadOfPlayer)) { PlayerStatus* playerStatus = &gPlayerStatus; f32 r = evt_get_float_variable(script, *script->ptrReadPos); - f32 x = playerStatus->position.x; - f32 y = playerStatus->position.y; - f32 z = playerStatus->position.z; + f32 x = playerStatus->pos.x; + f32 y = playerStatus->pos.y; + f32 z = playerStatus->pos.z; add_vec2D_polar(&x, &z, r, playerStatus->targetYaw); evt_set_float_variable(script, LVar0, x); diff --git a/src/world/common/entity/SuperBlock.inc.c b/src/world/common/entity/SuperBlock.inc.c index 790a2a94a69..9a981bd487e 100644 --- a/src/world/common/entity/SuperBlock.inc.c +++ b/src/world/common/entity/SuperBlock.inc.c @@ -196,7 +196,7 @@ API_CALLABLE(N(SuperBlock_SwitchToPartner)) { } API_CALLABLE(N(SuperBlock_LoadCurrentPartnerName)) { - set_message_msg(gPartnerPopupProperties[gPlayerData.currentPartner].nameMsg, 0); + set_message_msg(gPartnerPopupProperties[gPlayerData.curPartner].nameMsg, 0); return ApiStatus_DONE2; } @@ -205,7 +205,7 @@ API_CALLABLE(N(SuperBlock_StartGlowEffect)) { s32 entityIdx = evt_get_variable(script, *args++); Entity* entity = get_entity_by_index(entityIdx); s32 effectPtrOutVar = *args++; - EffectInstance* effectInst = fx_energy_orb_wave(0, entity->position.x, entity->position.y + 12.5f, entity->position.z, 0.7f, 0); + EffectInstance* effectInst = fx_energy_orb_wave(0, entity->pos.x, entity->pos.y + 12.5f, entity->pos.z, 0.7f, 0); evt_set_variable(script, effectPtrOutVar, (s32) effectInst); return ApiStatus_DONE2; @@ -221,7 +221,7 @@ API_CALLABLE(N(SuperBlock_EndGlowEffect)) { API_CALLABLE(N(SuperBlock_GatherEnergyFX)) { Entity* entity = get_entity_by_index(evt_get_variable(script, *script->ptrReadPos)); - fx_radial_shimmer(4, entity->position.x, entity->position.y + 12.5f, entity->position.z, 1.0f, 75); + fx_radial_shimmer(4, entity->pos.x, entity->pos.y + 12.5f, entity->pos.z, 1.0f, 75); return ApiStatus_DONE2; } @@ -256,7 +256,7 @@ API_CALLABLE(N(SuperBlock_AnimateEnergyOrbs)) { f32 t1; s32 i; - sin_cos_deg(gCameras[gCurrentCameraID].currentYaw, &sinTheta, &cosTheta); + sin_cos_deg(gCameras[gCurrentCameraID].curYaw, &sinTheta, &cosTheta); if (isInitialCall) { script->userData = (EnergyOrbSet*)general_heap_malloc(sizeof(EnergyOrbSet)); @@ -265,8 +265,8 @@ API_CALLABLE(N(SuperBlock_AnimateEnergyOrbs)) { userData->superBlock = get_entity_by_index(evt_get_variable(script, *args++)); for (i = 0; i < SUPER_BLOCK_NUM_ORBS; i++) { - userData->orbEffects[i] = (EffectInstance*)fx_motion_blur_flame(0, userData->superBlock->position.x, - userData->superBlock->position.y + 12.5f, userData->superBlock->position.z, 1.0f, -1); + userData->orbEffects[i] = (EffectInstance*)fx_motion_blur_flame(0, userData->superBlock->pos.x, + userData->superBlock->pos.y + 12.5f, userData->superBlock->pos.z, 1.0f, -1); t1 = 0.0f; userData->posZ[i] = t1; userData->posY[i] = t1; @@ -287,9 +287,9 @@ API_CALLABLE(N(SuperBlock_AnimateEnergyOrbs)) { add_vec2D_polar(&x, &userData->partnerPosY[i], t1, N(SuperBlock_UpgradeOrbAngles)[i]); userData->partnerPosX[i] = cosTheta * x; userData->partnerPosZ[i] = sinTheta * x; - userData->partnerPosX[i] = partner->pos.x - (userData->superBlock->position.x + userData->partnerPosX[i]); - userData->partnerPosY[i] = partner->pos.y - (userData->superBlock->position.y + userData->partnerPosY[i]); - userData->partnerPosZ[i] = partner->pos.z - (userData->superBlock->position.z + userData->partnerPosZ[i]); + userData->partnerPosX[i] = partner->pos.x - (userData->superBlock->pos.x + userData->partnerPosX[i]); + userData->partnerPosY[i] = partner->pos.y - (userData->superBlock->pos.y + userData->partnerPosY[i]); + userData->partnerPosZ[i] = partner->pos.z - (userData->superBlock->pos.z + userData->partnerPosZ[i]); } } diff --git a/src/world/common/lava_piranha/part2.inc.c b/src/world/common/lava_piranha/part2.inc.c index e79d272c079..b841c503e54 100644 --- a/src/world/common/lava_piranha/part2.inc.c +++ b/src/world/common/lava_piranha/part2.inc.c @@ -276,7 +276,7 @@ void N(worker_render_piranha_vines)(void) { renderTask.appendGfx = &N(appendGfx_piranha_vines); renderTask.appendGfxArg = 0; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_SURFACE_OPA; queue_render_task(&renderTask); diff --git a/src/world/common/npc/Boo_Patrol.inc.c b/src/world/common/npc/Boo_Patrol.inc.c index 2d49f322ba9..7ee385600cd 100644 --- a/src/world/common/npc/Boo_Patrol.inc.c +++ b/src/world/common/npc/Boo_Patrol.inc.c @@ -50,7 +50,7 @@ void N(BooPatrolAI_Loiter)(Evt* script, MobileAISettings* aiSettings, EnemyDetec npc->duration = aiSettings->waitTime / 2 + rand_int(aiSettings->waitTime / 2 + 1); } else { script->functionTemp[0] = 4; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; } } } diff --git a/src/world/common/todo/AddPlayerHandsOffset.inc.c b/src/world/common/todo/AddPlayerHandsOffset.inc.c index ec3c882eeb1..5219aabd14d 100644 --- a/src/world/common/todo/AddPlayerHandsOffset.inc.c +++ b/src/world/common/todo/AddPlayerHandsOffset.inc.c @@ -12,7 +12,7 @@ API_CALLABLE(N(AddPlayerHandsOffset)) { f32 z = (f32)evt_get_variable(script, zVar); f32 cameraYaw; - cameraYaw = gCameras[gCurrentCameraID].currentYaw; + cameraYaw = gCameras[gCurrentCameraID].curYaw; if (playerStatus->spriteFacingAngle == 0.0f) { cameraYaw -= 100.0f; diff --git a/src/world/common/todo/AwaitPlayerNearNpc.inc.c b/src/world/common/todo/AwaitPlayerNearNpc.inc.c index e4cd78c5869..e4b167484ae 100644 --- a/src/world/common/todo/AwaitPlayerNearNpc.inc.c +++ b/src/world/common/todo/AwaitPlayerNearNpc.inc.c @@ -14,7 +14,7 @@ API_CALLABLE(N(AwaitPlayerNearNpc)) { PlayerStatus* playerStatus = &gPlayerStatus; Npc* npc = get_npc_safe(script->owner2.npcID); - if (dist2D(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z) < 50.0f) { + if (dist2D(npc->pos.x, npc->pos.z, playerStatus->pos.x, playerStatus->pos.z) < 50.0f) { return ApiStatus_DONE2; } diff --git a/src/world/common/todo/GetEncounterEnemyIsOwner.inc.c b/src/world/common/todo/GetEncounterEnemyIsOwner.inc.c index a7bf2de6dac..0bf64258c89 100644 --- a/src/world/common/todo/GetEncounterEnemyIsOwner.inc.c +++ b/src/world/common/todo/GetEncounterEnemyIsOwner.inc.c @@ -4,6 +4,6 @@ API_CALLABLE(N(GetEncounterEnemyIsOwner)) { Enemy* enemy = script->owner1.enemy; - evt_set_variable(script, LVar0, gCurrentEncounter.currentEnemy == enemy); + evt_set_variable(script, LVar0, gCurrentEncounter.curEnemy == enemy); return ApiStatus_DONE2; } diff --git a/src/world/common/todo/GetEntityPosition.inc.c b/src/world/common/todo/GetEntityPosition.inc.c index 662ee135087..e220a380591 100644 --- a/src/world/common/todo/GetEntityPosition.inc.c +++ b/src/world/common/todo/GetEntityPosition.inc.c @@ -5,8 +5,8 @@ API_CALLABLE(N(GetEntityPosition)) { Bytecode* args = script->ptrReadPos; Entity* entity = get_entity_by_index(evt_get_variable(script, *args++)); - evt_set_variable(script, *args++, entity->position.x); - evt_set_variable(script, *args++, entity->position.y); - evt_set_variable(script, *args++, entity->position.z); + evt_set_variable(script, *args++, entity->pos.x); + evt_set_variable(script, *args++, entity->pos.y); + evt_set_variable(script, *args++, entity->pos.z); return ApiStatus_DONE2; } diff --git a/src/world/common/todo/GetFloorCollider.inc.c b/src/world/common/todo/GetFloorCollider.inc.c index 9de22266498..238ff3333f2 100644 --- a/src/world/common/todo/GetFloorCollider.inc.c +++ b/src/world/common/todo/GetFloorCollider.inc.c @@ -5,6 +5,6 @@ API_CALLABLE(N(GetFloorCollider)) { Bytecode* args = script->ptrReadPos; s32 outVar = *args++; - evt_set_variable(script, outVar, gCollisionStatus.currentFloor); + evt_set_variable(script, outVar, gCollisionStatus.curFloor); return ApiStatus_DONE2; } diff --git a/src/world/common/todo/GetLeftRightPoints.inc.c b/src/world/common/todo/GetLeftRightPoints.inc.c index 137dcd27621..b8cc35ea973 100644 --- a/src/world/common/todo/GetLeftRightPoints.inc.c +++ b/src/world/common/todo/GetLeftRightPoints.inc.c @@ -7,9 +7,9 @@ API_CALLABLE(N(GetLeftRightPoints)) { s32 posZ = evt_get_variable(script, *args++); f32 dist = evt_get_variable(script, *args++); - script->varTable[0] = posX + (sin_deg(gCameras[CAM_DEFAULT].currentYaw + 270.0f + dist) * 100.0f); - script->varTable[1] = posZ - (cos_deg(gCameras[CAM_DEFAULT].currentYaw + 270.0f + dist) * 100.0f); - script->varTable[2] = posX + (sin_deg(gCameras[CAM_DEFAULT].currentYaw + 90.0f + dist) * 100.0f); - script->varTable[3] = posZ - (cos_deg(gCameras[CAM_DEFAULT].currentYaw + 90.0f + dist) * 100.0f); + script->varTable[0] = posX + (sin_deg(gCameras[CAM_DEFAULT].curYaw + 270.0f + dist) * 100.0f); + script->varTable[1] = posZ - (cos_deg(gCameras[CAM_DEFAULT].curYaw + 270.0f + dist) * 100.0f); + script->varTable[2] = posX + (sin_deg(gCameras[CAM_DEFAULT].curYaw + 90.0f + dist) * 100.0f); + script->varTable[3] = posZ - (cos_deg(gCameras[CAM_DEFAULT].curYaw + 90.0f + dist) * 100.0f); return ApiStatus_DONE2; } diff --git a/src/world/common/todo/SetEntityPosition.inc.c b/src/world/common/todo/SetEntityPosition.inc.c index b7d14d19398..2c3582d850c 100644 --- a/src/world/common/todo/SetEntityPosition.inc.c +++ b/src/world/common/todo/SetEntityPosition.inc.c @@ -8,8 +8,8 @@ API_CALLABLE(N(SetEntityPosition)) { s32 z = evt_get_variable(script, *args++); Entity* entity = get_entity_by_index(entityIndex); - entity->position.x = x; - entity->position.y = y; - entity->position.z = z; + entity->pos.x = x; + entity->pos.y = y; + entity->pos.z = z; return ApiStatus_DONE2; } diff --git a/src/world/common/todo/SetEntityPositionF.inc.c b/src/world/common/todo/SetEntityPositionF.inc.c index 0560d3d5315..312ed180217 100644 --- a/src/world/common/todo/SetEntityPositionF.inc.c +++ b/src/world/common/todo/SetEntityPositionF.inc.c @@ -9,8 +9,8 @@ API_CALLABLE(N(SetEntityPositionF)) { f32 z = evt_get_variable(script, *args++); Entity* entity = get_entity_by_index(entityIndex); - entity->position.x = x; - entity->position.y = y; - entity->position.z = z; + entity->pos.x = x; + entity->pos.y = y; + entity->pos.z = z; return ApiStatus_DONE2; } diff --git a/src/world/common/todo/SomeItemEntityFunc.inc.c b/src/world/common/todo/SomeItemEntityFunc.inc.c index c3eaf38b860..48380d1bbab 100644 --- a/src/world/common/todo/SomeItemEntityFunc.inc.c +++ b/src/world/common/todo/SomeItemEntityFunc.inc.c @@ -5,14 +5,14 @@ API_CALLABLE(N(SomeItemEntityFunc)) { ItemEntity* itemEntity = get_item_entity(script->varTable[0]); if (isInitialCall) { - script->functionTempF[2] = itemEntity->position.y; + script->functionTempF[2] = itemEntity->pos.y; script->functionTemp[1] = 0; script->functionTemp[3] = 0; } switch (script->functionTemp[1]) { case 0: - itemEntity->position.y = script->functionTempF[2] + ((1.0f - cos_rad((script->functionTemp[3] * + itemEntity->pos.y = script->functionTempF[2] + ((1.0f - cos_rad((script->functionTemp[3] * (PI / 2)) / 30.0f)) * 20.0f); if (script->functionTemp[3] == 30) { script->functionTemp[1] = 1; @@ -22,7 +22,7 @@ API_CALLABLE(N(SomeItemEntityFunc)) { } break; case 1: - itemEntity->position.y = script->functionTempF[2] + 17.0f + (cos_deg(script->functionTemp[3]) * 3.0f); + itemEntity->pos.y = script->functionTempF[2] + 17.0f + (cos_deg(script->functionTemp[3]) * 3.0f); script->functionTemp[3] = clamp_angle(script->functionTemp[3] + 9); break; } diff --git a/src/world/common/todo/SpinyTromp_CheckDist.inc.c b/src/world/common/todo/SpinyTromp_CheckDist.inc.c index bb2304570bc..fb78b85fe66 100644 --- a/src/world/common/todo/SpinyTromp_CheckDist.inc.c +++ b/src/world/common/todo/SpinyTromp_CheckDist.inc.c @@ -2,9 +2,9 @@ #include "npc.h" API_CALLABLE(N(SpinyTromp_CheckDist)) { - f32 x = script->varTable[0] - gPlayerStatus.position.x; - f32 y = script->varTable[2] - gPlayerStatus.position.y; - f32 z = 0.0f - gPlayerStatus.position.z; + f32 x = script->varTable[0] - gPlayerStatus.pos.x; + f32 y = script->varTable[2] - gPlayerStatus.pos.y; + f32 z = 0.0f - gPlayerStatus.pos.z; script->varTable[4] = sqrtf(SQ(x) + SQ(y) + SQ(z)); diff --git a/src/world/common/todo/StarSpiritEffectFunc.inc.c b/src/world/common/todo/StarSpiritEffectFunc.inc.c index 635440664b5..706870afd9e 100644 --- a/src/world/common/todo/StarSpiritEffectFunc.inc.c +++ b/src/world/common/todo/StarSpiritEffectFunc.inc.c @@ -129,7 +129,7 @@ API_CALLABLE(N(StarSpiritEffectFunc3)) { case 2: ptr->unk_04 = ptr->unk_24 + (2.0f * (sin_deg(ptr->unk_4C) + 1.0f)); ptr->unk_4C = clamp_angle(ptr->unk_4C + 8); - if (!(dist3D(playerStatus->position.x, playerStatus->position.y + 20.0f, playerStatus->position.z, + if (!(dist3D(playerStatus->pos.x, playerStatus->pos.y + 20.0f, playerStatus->pos.z, ptr->unk_00, ptr->unk_04, ptr->unk_08) > 30.0f)) { ptr->unk_4E = 3; } @@ -184,7 +184,7 @@ API_CALLABLE(N(StarSpiritEffectFunc6)) { ptr->unk_04 = ptr->unk_24 + (2.0f * (sin_deg(ptr->unk_4C) + 1.0f)); ptr->unk_4C = clamp_angle(ptr->unk_4C + 8); - if (dist2D(playerStatus->position.x, playerStatus->position.z, + if (dist2D(playerStatus->pos.x, playerStatus->pos.z, ptr->unk_18, ptr->unk_20) <= 30.0f) { ptr->unk_4E = 3; } diff --git a/src/world/common/todo/UnkFunc12.inc.c b/src/world/common/todo/UnkFunc12.inc.c index b02ff48ab6e..6846ccbeeb9 100644 --- a/src/world/common/todo/UnkFunc12.inc.c +++ b/src/world/common/todo/UnkFunc12.inc.c @@ -6,21 +6,21 @@ API_CALLABLE(N(UnkFunc12)) { f32 posX, posY, posZ, hitDepth; if (script->varTable[5] == 0) { - playerStatus->position.x = script->varTable[0]; + playerStatus->pos.x = script->varTable[0]; } else { - playerStatus->position.z = script->varTable[0]; + playerStatus->pos.z = script->varTable[0]; } - posX = playerStatus->position.x; - posY = playerStatus->position.y + 10.0f; - posZ = playerStatus->position.z; + posX = playerStatus->pos.x; + posY = playerStatus->pos.y + 10.0f; + posZ = playerStatus->pos.z; hitDepth = 40.0f; npc_raycast_down_sides(0, &posX, &posY, &posZ, &hitDepth); - playerStatus->position.x = posX; - playerStatus->position.y = posY; - playerStatus->position.z = posZ; + playerStatus->pos.x = posX; + playerStatus->pos.y = posY; + playerStatus->pos.z = posZ; return ApiStatus_DONE2; } diff --git a/src/world/common/todo/UnkFunc62.inc.c b/src/world/common/todo/UnkFunc62.inc.c index 246941e7706..ef324d0bc62 100644 --- a/src/world/common/todo/UnkFunc62.inc.c +++ b/src/world/common/todo/UnkFunc62.inc.c @@ -38,38 +38,38 @@ API_CALLABLE(N(UnkFunc62)) { } if (script->functionTemp[0] == 0) { - state->currentPos.x = actor->currentPos.x; - state->currentPos.y = actor->currentPos.y; + state->curPos.x = actor->curPos.x; + state->curPos.y = actor->curPos.y; stateGoalX = state->goalPos.x; stateGoalZ = state->goalPos.z; - stateCurrentX = state->currentPos.x; - stateCurrentZ = actor->currentPos.z; - state->currentPos.z = stateCurrentZ; + stateCurrentX = state->curPos.x; + stateCurrentZ = actor->curPos.z; + state->curPos.z = stateCurrentZ; state->angle = atan2(stateCurrentX, stateCurrentZ, stateGoalX, stateGoalZ); - state->distance = dist2D(stateCurrentX, stateCurrentZ, stateGoalX, stateGoalZ); + state->dist = dist2D(stateCurrentX, stateCurrentZ, stateGoalX, stateGoalZ); if (state->moveTime == 0) { - state->moveTime = state->distance / state->speed; - phi_f8 = state->distance - (state->moveTime * state->speed); + state->moveTime = state->dist / state->speed; + phi_f8 = state->dist - (state->moveTime * state->speed); } else { - state->speed = state->distance / state->moveTime; - phi_f8 = state->distance - (state->moveTime * state->speed); + state->speed = state->dist / state->moveTime; + phi_f8 = state->dist - (state->moveTime * state->speed); } if (state->moveTime == 0) { return ApiStatus_DONE2; } - state->unk_30.x = (state->goalPos.x - state->currentPos.x) / state->moveTime; - state->unk_30.y = (state->goalPos.y - state->currentPos.y) / state->moveTime; - state->unk_30.z = (state->goalPos.z - state->currentPos.z) / state->moveTime; + state->unk_30.x = (state->goalPos.x - state->curPos.x) / state->moveTime; + state->unk_30.y = (state->goalPos.y - state->curPos.y) / state->moveTime; + state->unk_30.z = (state->goalPos.z - state->curPos.z) / state->moveTime; state->acceleration = PI_S / state->moveTime; - state->velocity = 0.0f; + state->vel = 0.0f; state->speed += phi_f8 / state->moveTime; if (state->moveArcAmplitude < 3) { state->unk_24 = 90.0f; state->unk_28 = 360 / state->moveTime; - phi_f8 = state->distance; + phi_f8 = state->dist; phi_f8 -= 20.0; phi_f8 /= 6.0; phi_f8 += 47.0; @@ -79,15 +79,15 @@ API_CALLABLE(N(UnkFunc62)) { } state->unk_18.x = 0.0f; state->unk_18.y = 0.0f; - phi_f20 = state->velocity; + phi_f20 = state->vel; temp_f22_2 = state->acceleration; phi_f0 = sin_rad(DEG_TO_RAD(state->unk_24)); phi_f2 = 0.53; - state->velocity = phi_f20 + ((phi_f0 * phi_f2 * temp_f22_2) + temp_f22_2); + state->vel = phi_f20 + ((phi_f0 * phi_f2 * temp_f22_2) + temp_f22_2); } else { state->unk_24 = 90.0f; state->unk_28 = 360 / state->moveTime; - phi_f8 = state->distance; + phi_f8 = state->dist; phi_f8 -= 20.0; phi_f8 /= 6.0; phi_f8 += 47.0; @@ -97,11 +97,11 @@ API_CALLABLE(N(UnkFunc62)) { } state->unk_18.x = 0.0f; state->unk_18.y = 0.0f; - velocity = state->velocity; + velocity = state->vel; temp_f22_3 = state->acceleration; phi_f0 = sin_rad(DEG_TO_RAD(state->unk_24)); phi_f2 = 0.8; - state->velocity = velocity + ((phi_f0 * phi_f2 * temp_f22_3) + temp_f22_3); + state->vel = velocity + ((phi_f0 * phi_f2 * temp_f22_3) + temp_f22_3); } set_animation(ACTOR_SELF, 1, state->animJumpRise); sfx_play_sound(SOUND_JUMP_2081); @@ -110,45 +110,45 @@ API_CALLABLE(N(UnkFunc62)) { switch (script->functionTemp[0]) { case 1: - if (state->velocity > PI_S / 2) { + if (state->vel > PI_S / 2) { set_animation(ACTOR_SELF, 1, state->animJumpFall); } - oldActorX = actor->currentPos.x; - oldActorY = actor->currentPos.y; - state->currentPos.x += state->unk_30.x; - state->currentPos.y = state->currentPos.y + state->unk_30.y; - state->currentPos.z = state->currentPos.z + state->unk_30.z; - state->unk_18.x = actor->currentPos.y; - actor->currentPos.x = state->currentPos.x; - actor->currentPos.y = state->currentPos.y + (state->bounceDivisor * sin_rad(state->velocity)); - actor->currentPos.z = state->currentPos.z; - if (state->goalPos.y > actor->currentPos.y && state->moveTime < 3) { - actor->currentPos.y = state->goalPos.y; + oldActorX = actor->curPos.x; + oldActorY = actor->curPos.y; + state->curPos.x += state->unk_30.x; + state->curPos.y = state->curPos.y + state->unk_30.y; + state->curPos.z = state->curPos.z + state->unk_30.z; + state->unk_18.x = actor->curPos.y; + actor->curPos.x = state->curPos.x; + actor->curPos.y = state->curPos.y + (state->bounceDivisor * sin_rad(state->vel)); + actor->curPos.z = state->curPos.z; + if (state->goalPos.y > actor->curPos.y && state->moveTime < 3) { + actor->curPos.y = state->goalPos.y; } - actor->rotation.z = -atan2(oldActorX, -oldActorY, actor->currentPos.x, -actor->currentPos.y); - state->unk_18.y = actor->currentPos.y; + actor->rot.z = -atan2(oldActorX, -oldActorY, actor->curPos.x, -actor->curPos.y); + state->unk_18.y = actor->curPos.y; if (state->moveArcAmplitude < 3) { - phi_f20_2 = state->velocity; + phi_f20_2 = state->vel; temp_f22_5 = state->acceleration; phi_f0_2 = sin_rad(DEG_TO_RAD(state->unk_24)); phi_f2_2 = 0.53; - state->velocity = phi_f20_2 + ((phi_f0_2 * phi_f2_2 * temp_f22_5) + temp_f22_5); + state->vel = phi_f20_2 + ((phi_f0_2 * phi_f2_2 * temp_f22_5) + temp_f22_5); } else { - temp_f20_6 = state->velocity; + temp_f20_6 = state->vel; temp_f22_6 = state->acceleration; phi_f0_2 = sin_rad(DEG_TO_RAD(state->unk_24)); phi_f2_2 = 0.8; - state->velocity = temp_f20_6 + ((phi_f0_2 * phi_f2_2 * temp_f22_6) + temp_f22_6); + state->vel = temp_f20_6 + ((phi_f0_2 * phi_f2_2 * temp_f22_6) + temp_f22_6); } state->unk_24 += state->unk_28; state->unk_24 = clamp_angle(state->unk_24); state->moveTime--; if (state->moveTime == 0) { - actor->currentPos.y = state->goalPos.y; + actor->curPos.y = state->goalPos.y; state->acceleration = 1.8f; - state->velocity = -(state->unk_18.x - state->unk_18.y); + state->vel = -(state->unk_18.x - state->unk_18.y); set_animation(ACTOR_SELF, 1, state->animJumpLand); return ApiStatus_DONE1; } @@ -157,23 +157,23 @@ API_CALLABLE(N(UnkFunc62)) { state->moveTime = 1; state->acceleration = 1.8f; state->unk_24 = 90.0f; - state->velocity = -(state->unk_18.x - state->unk_18.y); + state->vel = -(state->unk_18.x - state->unk_18.y); state->bounceDivisor = fabsf(state->unk_18.x - state->unk_18.y) / 16.5; state->unk_28 = 360 / state->moveTime; - state->currentPos.x = actor->currentPos.x; - state->currentPos.y = actor->currentPos.y; - state->currentPos.z = actor->currentPos.z; + state->curPos.x = actor->curPos.x; + state->curPos.y = actor->curPos.y; + state->curPos.z = actor->curPos.z; script->functionTemp[0] = 3; // fallthrough case 3: - currentPosX64 = state->currentPos.x; // required to match - state->currentPos.x = currentPosX64 + state->bounceDivisor * sin_rad(DEG_TO_RAD(state->unk_24)) / 33.0; - state->currentPos.y -= state->bounceDivisor * sin_rad(DEG_TO_RAD(state->unk_24)); + currentPosX64 = state->curPos.x; // required to match + state->curPos.x = currentPosX64 + state->bounceDivisor * sin_rad(DEG_TO_RAD(state->unk_24)) / 33.0; + state->curPos.y -= state->bounceDivisor * sin_rad(DEG_TO_RAD(state->unk_24)); state->unk_24 += state->unk_28; state->unk_24 = clamp_angle(state->unk_24); - actor->currentPos.x = state->currentPos.x; - actor->currentPos.y = state->currentPos.y; - actor->currentPos.z = state->currentPos.z; + actor->curPos.x = state->curPos.x; + actor->curPos.y = state->curPos.y; + actor->curPos.z = state->curPos.z; state->moveTime--; if (state->moveTime == 0) { diff --git a/src/world/common/todo/UnkMoveFunc1.inc.c b/src/world/common/todo/UnkMoveFunc1.inc.c index 0d91d762ba7..1449d8094bb 100644 --- a/src/world/common/todo/UnkMoveFunc1.inc.c +++ b/src/world/common/todo/UnkMoveFunc1.inc.c @@ -5,9 +5,9 @@ API_CALLABLE(N(UnkMoveFunc1)) { BattleStatus* battleStatus = &gBattleStatus; Actor* playerActor = battleStatus->playerActor; - f32 posX = playerActor->currentPos.x; - f32 posY = playerActor->currentPos.y; - f32 posZ = playerActor->currentPos.z; + f32 posX = playerActor->curPos.x; + f32 posY = playerActor->curPos.y; + f32 posZ = playerActor->curPos.z; f32 goalX = playerActor->state.goalPos.x; f32 goalY = playerActor->state.goalPos.y; f32 goalZ = playerActor->state.goalPos.z; diff --git a/src/world/common/todo/UpdateLogShadow.inc.c b/src/world/common/todo/UpdateLogShadow.inc.c index 69a04474c77..4d59eb9eaad 100644 --- a/src/world/common/todo/UpdateLogShadow.inc.c +++ b/src/world/common/todo/UpdateLogShadow.inc.c @@ -29,12 +29,12 @@ API_CALLABLE(N(UpdateLogShadow)) { z = model->center.z; entity_raycast_down(&x, &y, &z, &hitYaw, &hitPitch, &hitLength); set_standard_shadow_scale(shadow, hitLength); - shadow->rotation.y = 0.0f; - shadow->position.x = x; - shadow->position.y = y; - shadow->position.z = z; - shadow->rotation.x = hitYaw; - shadow->rotation.z = hitPitch; + shadow->rot.y = 0.0f; + shadow->pos.x = x; + shadow->pos.y = y; + shadow->pos.z = z; + shadow->rot.x = hitYaw; + shadow->rot.z = hitPitch; shadow->scale.x *= 2.0f; shadow->scale.z *= 2.0f; return ApiStatus_BLOCK; diff --git a/src/world/common/util/ChangeNpcToPartner.inc.c b/src/world/common/util/ChangeNpcToPartner.inc.c index 792bdbf5776..f982539bc49 100644 --- a/src/world/common/util/ChangeNpcToPartner.inc.c +++ b/src/world/common/util/ChangeNpcToPartner.inc.c @@ -12,7 +12,7 @@ API_CALLABLE(N(ChangeNpcToPartner)) { Npc* npc = get_npc_safe(npcID); if (isInitialCall) { - if (gPlayerData.currentPartner == PARTNER_NONE) { + if (gPlayerData.curPartner == PARTNER_NONE) { script->functionTemp[0] = 2; } else { script->functionTemp[0] = 0; @@ -32,10 +32,10 @@ API_CALLABLE(N(ChangeNpcToPartner)) { } break; case 2: - playerData->currentPartner = partnerID; + playerData->curPartner = partnerID; playerData->partners[partnerID].enabled = TRUE; partner_clear_player_tracking(npc); - func_800EB2A4(playerData->currentPartner); + func_800EB2A4(playerData->curPartner); script->functionTemp[0] = 3; break; case 3: diff --git a/src/world/common/util/CheckPositionRelativeToPlane.inc.c b/src/world/common/util/CheckPositionRelativeToPlane.inc.c index 5493583cf0f..14cf1edec87 100644 --- a/src/world/common/util/CheckPositionRelativeToPlane.inc.c +++ b/src/world/common/util/CheckPositionRelativeToPlane.inc.c @@ -47,7 +47,7 @@ API_CALLABLE(N(CheckPositionRelativeToPlane)) { dzdx = (Bz - Az) / (Bx - Ax); // this is equivalent to testing the determinant: ((Bx - Ax)*(Pz - Az) - (Bz - Az)*(Px - Ax)) < 0 - if (playerStatus->position.z < ((dzdx * playerStatus->position.x) + (Az - (dzdx * Ax)))) { + if (playerStatus->pos.z < ((dzdx * playerStatus->pos.x) + (Az - (dzdx * Ax)))) { script->varTable[0] = PLANE_SIDE_NEGATIVE; } else { script->varTable[0] = PLANE_SIDE_POSITIVE; diff --git a/src/world/common/util/GetKammyBroomEmitterPos.inc.c b/src/world/common/util/GetKammyBroomEmitterPos.inc.c index 357b7d46513..a06a2e795e3 100644 --- a/src/world/common/util/GetKammyBroomEmitterPos.inc.c +++ b/src/world/common/util/GetKammyBroomEmitterPos.inc.c @@ -9,8 +9,8 @@ API_CALLABLE(N(GetKammyBroomEmitterPos)) { Npc* npc = get_npc_unsafe(KAMMY_NPC); - script->varTable[0] = npc->pos.x + (sin_deg(npc->yaw + gCameras[CAM_DEFAULT].currentYaw + 180.0f) * 40.0f); + script->varTable[0] = npc->pos.x + (sin_deg(npc->yaw + gCameras[CAM_DEFAULT].curYaw + 180.0f) * 40.0f); script->varTable[1] = npc->pos.y + 8.0f; - script->varTable[2] = npc->pos.z - (cos_deg(npc->yaw + gCameras[CAM_DEFAULT].currentYaw + 180.0f) * 40.0f); + script->varTable[2] = npc->pos.z - (cos_deg(npc->yaw + gCameras[CAM_DEFAULT].curYaw + 180.0f) * 40.0f); return ApiStatus_DONE2; } diff --git a/src/world/common/util/MonitorPlayerOrbiting.inc.c b/src/world/common/util/MonitorPlayerOrbiting.inc.c index 2933c22f23b..ff09ed81189 100644 --- a/src/world/common/util/MonitorPlayerOrbiting.inc.c +++ b/src/world/common/util/MonitorPlayerOrbiting.inc.c @@ -33,8 +33,8 @@ API_CALLABLE(N(MonitorPlayerOrbiting)) { // wait for player to come within range dist = get_xz_dist_to_player(orbit->pos.x, orbit->pos.z); if (dist < orbit->startRadius) { - orbit->firstPlayerX = playerStatus->position.x; - orbit->firstPlayerZ = playerStatus->position.z; + orbit->firstPlayerX = playerStatus->pos.x; + orbit->firstPlayerZ = playerStatus->pos.z; orbit->state++; } break; @@ -44,7 +44,7 @@ API_CALLABLE(N(MonitorPlayerOrbiting)) { dist = get_xz_dist_to_player(orbit->pos.x, orbit->pos.z); if (dist < orbit->startRadius) { prevAngle = atan2(orbit->pos.x, orbit->pos.z, orbit->firstPlayerX, orbit->firstPlayerZ); - curAngle = atan2(orbit->pos.x, orbit->pos.z, playerStatus->position.x, playerStatus->position.z); + curAngle = atan2(orbit->pos.x, orbit->pos.z, playerStatus->pos.x, playerStatus->pos.z); deltaAngle = get_clamped_angle_diff(prevAngle, curAngle); orbit->direction = signF(deltaAngle); orbit->state++; @@ -57,11 +57,11 @@ API_CALLABLE(N(MonitorPlayerOrbiting)) { dist = get_xz_dist_to_player(orbit->pos.x, orbit->pos.z); if (dist < orbit->startRadius) { prevAngle = atan2(orbit->pos.x, orbit->pos.z, orbit->lastPlayerX, orbit->lastPlayerZ); - curAngle = atan2(orbit->pos.x, orbit->pos.z, playerStatus->position.x, playerStatus->position.z); + curAngle = atan2(orbit->pos.x, orbit->pos.z, playerStatus->pos.x, playerStatus->pos.z); deltaAngle = get_clamped_angle_diff(prevAngle, curAngle); if (orbit->direction == signF(deltaAngle)) { prevAngle = atan2(orbit->pos.x, orbit->pos.z, orbit->firstPlayerX, orbit->firstPlayerZ); - curAngle = atan2(orbit->pos.x, orbit->pos.z, playerStatus->position.x, playerStatus->position.z); + curAngle = atan2(orbit->pos.x, orbit->pos.z, playerStatus->pos.x, playerStatus->pos.z); deltaAngle = get_clamped_angle_diff(prevAngle, curAngle); if (fabsf(deltaAngle) > 90.0f) { if (orbit->eventListener != NULL) { @@ -80,7 +80,7 @@ API_CALLABLE(N(MonitorPlayerOrbiting)) { dist = get_xz_dist_to_player(orbit->pos.x, orbit->pos.z); if (dist < orbit->orbitRadius) { prevAngle = atan2(orbit->pos.x, orbit->pos.z, orbit->lastPlayerX, orbit->lastPlayerZ); - curAngle = atan2(orbit->pos.x, orbit->pos.z, playerStatus->position.x, playerStatus->position.z); + curAngle = atan2(orbit->pos.x, orbit->pos.z, playerStatus->pos.x, playerStatus->pos.z); deltaAngle = get_clamped_angle_diff(prevAngle, curAngle); if (orbit->direction != signF(deltaAngle)) { if (orbit->eventListener != NULL) { @@ -116,8 +116,8 @@ API_CALLABLE(N(MonitorPlayerOrbiting)) { break; } - orbit->lastPlayerX = playerStatus->position.x; - orbit->lastPlayerZ = playerStatus->position.z; + orbit->lastPlayerX = playerStatus->pos.x; + orbit->lastPlayerZ = playerStatus->pos.z; return ApiStatus_BLOCK; } diff --git a/src/world/dead/area_flo/flo_00/flo_00_5_beanstalk.c b/src/world/dead/area_flo/flo_00/flo_00_5_beanstalk.c index 806d89e43be..ddb04fa53ff 100644 --- a/src/world/dead/area_flo/flo_00/flo_00_5_beanstalk.c +++ b/src/world/dead/area_flo/flo_00/flo_00_5_beanstalk.c @@ -22,10 +22,10 @@ API_CALLABLE(N(PlayerRideBeanstalk)) { f32 clamped = clamp_angle(angle - temp); temp = sin_deg(clamped); - gPlayerStatus.position.x = BEANSTALK_BASE_X + (dist * temp); - gPlayerStatus.position.y = evt_get_variable(NULL, script->varTable[10]) + evt_get_variable(NULL, script->varTable[3]); + gPlayerStatus.pos.x = BEANSTALK_BASE_X + (dist * temp); + gPlayerStatus.pos.y = evt_get_variable(NULL, script->varTable[10]) + evt_get_variable(NULL, script->varTable[3]); temp = cos_deg(clamped); - gPlayerStatus.position.z = BEANSTALK_BASE_Z - (dist * temp); + gPlayerStatus.pos.z = BEANSTALK_BASE_Z - (dist * temp); return ApiStatus_DONE2; } diff --git a/src/world/dead/area_flo/flo_03/flo_03_3_npc.c b/src/world/dead/area_flo/flo_03/flo_03_3_npc.c index 071ac60b284..4ca8311cecb 100644 --- a/src/world/dead/area_flo/flo_03/flo_03_3_npc.c +++ b/src/world/dead/area_flo/flo_03/flo_03_3_npc.c @@ -70,7 +70,7 @@ API_CALLABLE(N(HideBehindTree)) { f64 dist; // get a point 46 units away from the tree on the side opposite the player - yaw = clamp_angle(atan2(-210.0f, -183.0f, gPlayerStatus.position.x, gPlayerStatus.position.z) + 180.0f); + yaw = clamp_angle(atan2(-210.0f, -183.0f, gPlayerStatus.pos.x, gPlayerStatus.pos.z) + 180.0f); posX = -210.0f; posZ = -183.0f; add_vec2D_polar(&posX, &posZ, 46.0f, yaw); @@ -102,18 +102,18 @@ API_CALLABLE(N(HideBehindTree)) { osSyncPrintf("cccc\n"); } } - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_RUN]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_RUN]; npc->yaw = atan2(npc->pos.x, npc->pos.z, posX, posZ); npc_move_heading(npc, 2.0f, npc->yaw); } else if (dist > 0.2) { npc->yaw = atan2(npc->pos.x, npc->pos.z, posX, posZ); npc->pos.x = posX; npc->pos.z = posZ; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_WALK]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_WALK]; } else { npc->pos.x = posX; npc->pos.z = posZ; - npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; + npc->curAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; } return ApiStatus_BLOCK; } diff --git a/src/world/dead/area_flo/flo_14/flo_14_3_bubbles.c b/src/world/dead/area_flo/flo_14/flo_14_3_bubbles.c index 3e693ecef66..9627b4c91b6 100644 --- a/src/world/dead/area_flo/flo_14/flo_14_3_bubbles.c +++ b/src/world/dead/area_flo/flo_14/flo_14_3_bubbles.c @@ -42,7 +42,7 @@ EvtScript N(EVS_TetherParterToPlayer) = { }; API_CALLABLE(N(SavePartnerFlags)) { - if (gPlayerData.currentPartner == PARTNER_NONE) { + if (gPlayerData.curPartner == PARTNER_NONE) { script->varTable[14] = FALSE; return ApiStatus_DONE2; } diff --git a/src/world/dead/area_flo/flo_19/flo_19_5_beanstalk.c b/src/world/dead/area_flo/flo_19/flo_19_5_beanstalk.c index 96db10c0a0b..90743d0c63a 100644 --- a/src/world/dead/area_flo/flo_19/flo_19_5_beanstalk.c +++ b/src/world/dead/area_flo/flo_19/flo_19_5_beanstalk.c @@ -20,10 +20,10 @@ API_CALLABLE(N(PlayerRideBeanstalk)) { f32 clamped = clamp_angle(angle - temp); temp = sin_deg(clamped); - gPlayerStatus.position.x = (dist * temp) + 0.0f; - gPlayerStatus.position.y = evt_get_variable(NULL, script->varTable[10]) + evt_get_variable(NULL, script->varTable[3]); + gPlayerStatus.pos.x = (dist * temp) + 0.0f; + gPlayerStatus.pos.y = evt_get_variable(NULL, script->varTable[10]) + evt_get_variable(NULL, script->varTable[3]); temp = cos_deg(clamped); - gPlayerStatus.position.z = 0.0f - (dist * temp); + gPlayerStatus.pos.z = 0.0f - (dist * temp); return ApiStatus_DONE2; } diff --git a/src/world/dead/area_kzn/kzn_11/kzn_11_2_platforms.c b/src/world/dead/area_kzn/kzn_11/kzn_11_2_platforms.c index 59d9dd93fea..3f0a7ca6509 100644 --- a/src/world/dead/area_kzn/kzn_11/kzn_11_2_platforms.c +++ b/src/world/dead/area_kzn/kzn_11/kzn_11_2_platforms.c @@ -9,13 +9,13 @@ API_CALLABLE(N(AddPushVelocity)) { CollisionStatus* collisionStatus= &gCollisionStatus; Npc* partner; - if ((collisionStatus->currentFloor == floorA) || (collisionStatus->lastTouchedFloor == floorA) - || (collisionStatus->currentFloor == floorB) || (collisionStatus->lastTouchedFloor == floorB)) { - playerStatus->pushVelocity.x = velX; + if ((collisionStatus->curFloor == floorA) || (collisionStatus->lastTouchedFloor == floorA) + || (collisionStatus->curFloor == floorB) || (collisionStatus->lastTouchedFloor == floorB)) { + playerStatus->pushVel.x = velX; } - if (gPlayerData.currentPartner != PARTNER_NONE){ + if (gPlayerData.curPartner != PARTNER_NONE){ partner = get_npc_unsafe(NPC_PARTNER); - if ((partner->currentFloor == floorA) || (partner->currentFloor == floorB)) { + if ((partner->curFloor == floorA) || (partner->curFloor == floorB)) { partner->pos.x += velX; } } @@ -26,7 +26,7 @@ API_CALLABLE(N(GetCurrentFloor)) { Bytecode* args = script->ptrReadPos; s32 outVar = *args++; - evt_set_variable(script, outVar, gCollisionStatus.currentFloor); + evt_set_variable(script, outVar, gCollisionStatus.curFloor); return ApiStatus_DONE2; } diff --git a/src/world/dead/area_kzn/kzn_11/kzn_11_3_npc.c b/src/world/dead/area_kzn/kzn_11/kzn_11_3_npc.c index e080aa99e7b..d884c077ba1 100644 --- a/src/world/dead/area_kzn/kzn_11/kzn_11_3_npc.c +++ b/src/world/dead/area_kzn/kzn_11/kzn_11_3_npc.c @@ -72,7 +72,7 @@ EvtScript N(EVS_FireBar_Defeated) = { FireBarAISettings N(AISettings_FireBar_01) = { .centerPos = { -300, 20, 15 }, - .rotationRate = 8, + .rotRate = 8, .firstNpc = NPC_FireBar_1A, .npcCount = 4, .callback = N(FireBarAI_Callback), @@ -80,7 +80,7 @@ FireBarAISettings N(AISettings_FireBar_01) = { FireBarAISettings N(AISettings_FireBar_02) = { .centerPos = { 0, 20, 15 }, - .rotationRate = -8, + .rotRate = -8, .firstNpc = NPC_FireBar_2A, .npcCount = 4, .callback = N(FireBarAI_Callback), @@ -88,7 +88,7 @@ FireBarAISettings N(AISettings_FireBar_02) = { FireBarAISettings N(AISettings_FireBar_03) = { .centerPos = { 325, 20, 15 }, - .rotationRate = -8, + .rotRate = -8, .firstNpc = NPC_FireBar_3A, .npcCount = 4, .callback = N(FireBarAI_Callback), diff --git a/src/world/dead/area_kzn/kzn_19/kzn_19_4_npc.c b/src/world/dead/area_kzn/kzn_19/kzn_19_4_npc.c index 3085c6658c2..682e9ca099f 100644 --- a/src/world/dead/area_kzn/kzn_19/kzn_19_4_npc.c +++ b/src/world/dead/area_kzn/kzn_19/kzn_19_4_npc.c @@ -337,7 +337,7 @@ void N(worker_render_piranha_vines)(void) { renderTask.appendGfx = &N(appendGfx_piranha_vines); renderTask.appendGfxArg = 0; - renderTask.distance = 10; + renderTask.dist = 10; renderTask.renderMode = RENDER_MODE_SURFACE_OPA; queue_render_task(&renderTask); diff --git a/src/world/dead/area_kzn/kzn_20/kzn_20_3_npc.c b/src/world/dead/area_kzn/kzn_20/kzn_20_3_npc.c index 73ad42efd15..1d56585b056 100644 --- a/src/world/dead/area_kzn/kzn_20/kzn_20_3_npc.c +++ b/src/world/dead/area_kzn/kzn_20/kzn_20_3_npc.c @@ -364,7 +364,7 @@ API_CALLABLE(N(GetFloorCollider)) { Bytecode* args = script->ptrReadPos; s32 outVar = *args++; - evt_set_variable(script, outVar, gCollisionStatus.currentFloor); + evt_set_variable(script, outVar, gCollisionStatus.curFloor); return ApiStatus_DONE2; } diff --git a/src/world/dead/area_kzn/kzn_22/kzn_22_2_main.c b/src/world/dead/area_kzn/kzn_22/kzn_22_2_main.c index fd15252b4fe..f7ff94243a4 100644 --- a/src/world/dead/area_kzn/kzn_22/kzn_22_2_main.c +++ b/src/world/dead/area_kzn/kzn_22/kzn_22_2_main.c @@ -68,7 +68,7 @@ API_CALLABLE(N(GetFloorCollider1)) { Bytecode* args = script->ptrReadPos; s32 outVar = *args++; - evt_set_variable(script, outVar, gCollisionStatus.currentFloor); + evt_set_variable(script, outVar, gCollisionStatus.curFloor); return ApiStatus_DONE2; } diff --git a/src/world/dead/area_kzn/kzn_22/kzn_22_4_npc.c b/src/world/dead/area_kzn/kzn_22/kzn_22_4_npc.c index fbeaeaf96a1..bc84fa73bca 100644 --- a/src/world/dead/area_kzn/kzn_22/kzn_22_4_npc.c +++ b/src/world/dead/area_kzn/kzn_22/kzn_22_4_npc.c @@ -5,7 +5,7 @@ API_CALLABLE(N(GetFloorCollider2)) { Bytecode* args = script->ptrReadPos; s32 outVar = *args++; - evt_set_variable(script, outVar, gCollisionStatus.currentFloor); + evt_set_variable(script, outVar, gCollisionStatus.curFloor); return ApiStatus_DONE2; } diff --git a/src/world/dead/area_kzn/kzn_23/kzn_23_3_npc.c b/src/world/dead/area_kzn/kzn_23/kzn_23_3_npc.c index 202869500dd..837a4178cb4 100644 --- a/src/world/dead/area_kzn/kzn_23/kzn_23_3_npc.c +++ b/src/world/dead/area_kzn/kzn_23/kzn_23_3_npc.c @@ -11,9 +11,9 @@ API_CALLABLE(N(SetChestPosition)) { f32 z = evt_get_variable(script, *args++); Entity* entity = get_entity_by_index(entityIndex); - entity->position.x = x; - entity->position.y = y; - entity->position.z = z; + entity->pos.x = x; + entity->pos.y = y; + entity->pos.z = z; return ApiStatus_DONE2; } @@ -21,9 +21,9 @@ API_CALLABLE(N(GetChestPosition)) { Bytecode* args = script->ptrReadPos; Entity* entity = get_entity_by_index(evt_get_variable(script, *args++)); - evt_set_variable(script, *args++, entity->position.x); - evt_set_variable(script, *args++, entity->position.y); - evt_set_variable(script, *args++, entity->position.z); + evt_set_variable(script, *args++, entity->pos.x); + evt_set_variable(script, *args++, entity->pos.y); + evt_set_variable(script, *args++, entity->pos.z); return ApiStatus_DONE2; } @@ -59,7 +59,7 @@ API_CALLABLE(N(AnimateChestSize)) { entity->scale.y = script->functionTemp[1] / 60.0f; entity->scale.z = script->functionTemp[1] / 60.0f; - entity->rotation.y = (1.0f - cos_rad(entity->scale.y * PI)) * 990.0 / 2.0; + entity->rot.y = (1.0f - cos_rad(entity->scale.y * PI)) * 990.0 / 2.0; script->functionTemp[1]--; if (~script->functionTemp[1] == 0) { //TODO remove ~ optimization diff --git a/src/world/partner/bombette.c b/src/world/partner/bombette.c index 379696c2ead..4ba18709c29 100644 --- a/src/world/partner/bombette.c +++ b/src/world/partner/bombette.c @@ -120,19 +120,19 @@ API_CALLABLE(N(Update)) { N(TweesterPhysicsPtr)->state++; N(TweesterPhysicsPtr)->prevFlags = bombette->flags; N(TweesterPhysicsPtr)->radius = fabsf(dist2D(bombette->pos.x, bombette->pos.z, - entity->position.x, entity->position.z)); - N(TweesterPhysicsPtr)->angle = atan2(entity->position.x, entity->position.z, + entity->pos.x, entity->pos.z)); + N(TweesterPhysicsPtr)->angle = atan2(entity->pos.x, entity->pos.z, bombette->pos.x, bombette->pos.z); - N(TweesterPhysicsPtr)->angularVelocity = 6.0f; - N(TweesterPhysicsPtr)->liftoffVelocityPhase = 50.0f; + N(TweesterPhysicsPtr)->angularVel = 6.0f; + N(TweesterPhysicsPtr)->liftoffVelPhase = 50.0f; N(TweesterPhysicsPtr)->countdown = 120; bombette->flags |= NPC_FLAG_IGNORE_CAMERA_FOR_YAW | NPC_FLAG_IGNORE_PLAYER_COLLISION | NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_8; bombette->flags &= ~NPC_FLAG_GRAVITY; case TWEESTER_PARTNER_ATTRACT: sin_cos_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->angle), &sinAngle, &cosAngle); - bombette->pos.x = entity->position.x + (sinAngle * N(TweesterPhysicsPtr)->radius); - bombette->pos.z = entity->position.z - (cosAngle * N(TweesterPhysicsPtr)->radius); - N(TweesterPhysicsPtr)->angle = clamp_angle(N(TweesterPhysicsPtr)->angle - N(TweesterPhysicsPtr)->angularVelocity); + bombette->pos.x = entity->pos.x + (sinAngle * N(TweesterPhysicsPtr)->radius); + bombette->pos.z = entity->pos.z - (cosAngle * N(TweesterPhysicsPtr)->radius); + N(TweesterPhysicsPtr)->angle = clamp_angle(N(TweesterPhysicsPtr)->angle - N(TweesterPhysicsPtr)->angularVel); if (N(TweesterPhysicsPtr)->radius > 20.0f) { N(TweesterPhysicsPtr)->radius--; @@ -140,19 +140,19 @@ API_CALLABLE(N(Update)) { N(TweesterPhysicsPtr)->radius++; } - liftoffVelocity = sin_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->liftoffVelocityPhase)) * 3.0f; - N(TweesterPhysicsPtr)->liftoffVelocityPhase += 3.0f; + liftoffVelocity = sin_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->liftoffVelPhase)) * 3.0f; + N(TweesterPhysicsPtr)->liftoffVelPhase += 3.0f; - if (N(TweesterPhysicsPtr)->liftoffVelocityPhase > 150.0f) { - N(TweesterPhysicsPtr)->liftoffVelocityPhase = 150.0f; + if (N(TweesterPhysicsPtr)->liftoffVelPhase > 150.0f) { + N(TweesterPhysicsPtr)->liftoffVelPhase = 150.0f; } bombette->pos.y += liftoffVelocity; bombette->renderYaw = clamp_angle(360.0f - N(TweesterPhysicsPtr)->angle); - N(TweesterPhysicsPtr)->angularVelocity += 0.8; + N(TweesterPhysicsPtr)->angularVel += 0.8; - if (N(TweesterPhysicsPtr)->angularVelocity > 40.0f) { - N(TweesterPhysicsPtr)->angularVelocity = 40.0f; + if (N(TweesterPhysicsPtr)->angularVel > 40.0f) { + N(TweesterPhysicsPtr)->angularVel = 40.0f; } if (--N(TweesterPhysicsPtr)->countdown == 0) { @@ -256,7 +256,7 @@ API_CALLABLE(N(UseAbility)) { N(PlayerWasFacingLeft) = partner_force_player_flip_done(); enable_npc_blur(npc); npc->duration = 4; - npc->yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z); + npc->yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->pos.x, playerStatus->pos.z); suggest_player_anim_allow_backward(ANIM_Mario1_Idle); script->USE_STATE = BLAST_STATE_GATHER; case BLAST_STATE_GATHER: @@ -269,10 +269,10 @@ API_CALLABLE(N(UseAbility)) { script->USE_STATE = BLAST_STATE_CANCEL; break; } - npc->moveToPos.x = playerStatus->position.x; - npc->moveToPos.y = playerStatus->position.y; - npc->moveToPos.z = playerStatus->position.z; - npc->currentAnim = ANIM_WorldBombette_Run; + npc->moveToPos.x = playerStatus->pos.x; + npc->moveToPos.y = playerStatus->pos.y; + npc->moveToPos.z = playerStatus->pos.z; + npc->curAnim = ANIM_WorldBombette_Run; add_vec2D_polar(&npc->moveToPos.x, &npc->moveToPos.z, 0.0f, playerStatus->targetYaw); temp_f0 = clamp_angle(playerStatus->targetYaw + (N(PlayerWasFacingLeft) ? -90.0f : 90.0f)); add_vec2D_polar(&npc->moveToPos.x, &npc->moveToPos.z, playerStatus->colliderDiameter / 4, temp_f0); @@ -296,7 +296,7 @@ API_CALLABLE(N(UseAbility)) { disable_npc_blur(npc); suggest_player_anim_allow_backward(ANIM_MarioW1_Lift); npc->yaw = playerStatus->targetYaw; - npc->currentAnim = ANIM_WorldBombette_Walk; + npc->curAnim = ANIM_WorldBombette_Walk; script->USE_STATE = BLAST_STATE_LIFT; script->functionTemp[1] = 10; // fallthrough @@ -305,7 +305,7 @@ API_CALLABLE(N(UseAbility)) { script->USE_STATE = BLAST_STATE_CANCEL; break; } - npc->pos.y = playerStatus->position.y + playerStatus->colliderHeight; + npc->pos.y = playerStatus->pos.y + playerStatus->colliderHeight; npc->yaw = playerStatus->targetYaw; if (script->functionTemp[1] == 1) { suggest_player_anim_allow_backward(ANIM_MarioW1_PlaceItem); @@ -317,8 +317,8 @@ API_CALLABLE(N(UseAbility)) { sfx_play_sound_at_npc(SOUND_80000000, SOUND_SPACE_MODE_0, NPC_PARTNER); N(PlayingFuseSound) = TRUE; add_vec2D_polar(&npc->pos.x, &npc->pos.z, 0.0f, npc->yaw); - npc->currentAnim = ANIM_WorldBombette_WalkLit; - npc->jumpVelocity = 0.0f; + npc->curAnim = ANIM_WorldBombette_WalkLit; + npc->jumpVel = 0.0f; N(MovementBlocked) = FALSE; npc->flags |= NPC_FLAG_GRAVITY; npc->flags &= ~NPC_FLAG_IGNORE_PLAYER_COLLISION; @@ -351,7 +351,7 @@ API_CALLABLE(N(UseAbility)) { if (playerStatus->actionState == ACTION_STATE_IDLE) { suggest_player_anim_allow_backward(ANIM_Mario1_Idle); } - npc->currentAnim = ANIM_WorldBombette_AboutToExplode; + npc->curAnim = ANIM_WorldBombette_AboutToExplode; npc->flags &= ~NPC_FLAG_GRAVITY; script->functionTemp[1] = 2; script->USE_STATE = BLAST_STATE_EXPLODE; @@ -393,7 +393,7 @@ API_CALLABLE(N(UseAbility)) { break; } } - npc->currentAnim = ANIM_WorldBombette_AboutToExplode; + npc->curAnim = ANIM_WorldBombette_AboutToExplode; script->functionTemp[1] = 20; script->USE_STATE = BLAST_STATE_EXPLODE; if (playerStatus->actionState == ACTION_STATE_IDLE) { @@ -411,8 +411,8 @@ API_CALLABLE(N(UseAbility)) { N(PlayingFuseSound) = FALSE; sfx_stop_sound(SOUND_80000000); } - fx_explosion(gPlayerData.partners[gPlayerData.currentPartner].level, npc->pos.x, npc->pos.y + (npc->collisionHeight * 0.5f), npc->pos.z); - switch (gPlayerData.partners[gPlayerData.currentPartner].level) { + fx_explosion(gPlayerData.partners[gPlayerData.curPartner].level, npc->pos.x, npc->pos.y + (npc->collisionHeight * 0.5f), npc->pos.z); + switch (gPlayerData.partners[gPlayerData.curPartner].level) { case 0: sfx_play_sound_at_npc(SOUND_CANNON1, SOUND_SPACE_MODE_0, NPC_PARTNER); break; @@ -442,7 +442,7 @@ API_CALLABLE(N(UseAbility)) { } partnerStatus->partnerActionState = PARTNER_ACTION_BOMBETTE_3; N(IsBlasting) = FALSE; - npc->jumpVelocity = ((playerStatus->position.y - npc->pos.y) / 20.0f) + 30.0; + npc->jumpVel = ((playerStatus->pos.y - npc->pos.y) / 20.0f) + 30.0; npc->moveSpeed = 0.8f; npc->yaw = rand_int(360); npc->jumpScale = 0.8f; @@ -452,9 +452,9 @@ API_CALLABLE(N(UseAbility)) { collisionStatus->bombetteExplosionPos.x = npc->pos.x; collisionStatus->bombetteExplosionPos.y = npc->pos.y; collisionStatus->bombetteExplosionPos.z = npc->pos.z; - npc->currentAnim = ANIM_WorldBombette_Aftermath; - angleToPlayer = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z); - if (!(get_clamped_angle_diff(camera->currentYaw, angleToPlayer) < 0.0f)) { + npc->curAnim = ANIM_WorldBombette_Aftermath; + angleToPlayer = atan2(npc->pos.x, npc->pos.z, playerStatus->pos.x, playerStatus->pos.z); + if (!(get_clamped_angle_diff(camera->curYaw, angleToPlayer) < 0.0f)) { script->functionTemp[2] = 1; } else { script->functionTemp[2] = -1; @@ -463,43 +463,43 @@ API_CALLABLE(N(UseAbility)) { script->USE_STATE = BLAST_STATE_FLY; break; case BLAST_STATE_FLY: - npc->pos.y += npc->jumpVelocity; - npc->jumpVelocity -= npc->jumpScale; - npc->rotation.z -= (script->functionTemp[2] * 79) / 2; - npc->rotation.x -= (script->functionTemp[2] * 67) / 2; + npc->pos.y += npc->jumpVel; + npc->jumpVel -= npc->jumpScale; + npc->rot.z -= (script->functionTemp[2] * 79) / 2; + npc->rot.x -= (script->functionTemp[2] * 67) / 2; if (script->functionTemp[1] != 0) { script->functionTemp[1]--; break; } if (!N(MaintainPosAfterBlast)) { - npc->pos.x = playerStatus->position.x; - npc->pos.z = playerStatus->position.z; + npc->pos.x = playerStatus->pos.x; + npc->pos.z = playerStatus->pos.z; } - npc->yaw = clamp_angle(gCameras[CAM_DEFAULT].currentYaw + playerStatus->spriteFacingAngle); + npc->yaw = clamp_angle(gCameras[CAM_DEFAULT].curYaw + playerStatus->spriteFacingAngle); add_vec2D_polar(&npc->pos.x, &npc->pos.z, 10.0f, npc->yaw); - npc->jumpVelocity = 0.0f; - npc->currentAnim = ANIM_WorldBombette_Aftermath; + npc->jumpVel = 0.0f; + npc->curAnim = ANIM_WorldBombette_Aftermath; npc->flags |= NPC_FLAG_JUMPING; script->USE_STATE = BLAST_STATE_FALL; break; case BLAST_STATE_FALL: - if (npc->pos.y + 10.0f < playerStatus->position.y + playerStatus->colliderHeight) { + if (npc->pos.y + 10.0f < playerStatus->pos.y + playerStatus->colliderHeight) { npc->flags &= ~NPC_FLAG_JUMPING; - if (fabsf(playerStatus->position.y - npc->pos.y) < 500.0) { + if (fabsf(playerStatus->pos.y - npc->pos.y) < 500.0) { script->USE_STATE = BLAST_STATE_FINISH; break; - } else if (npc_try_snap_to_ground(npc, npc->jumpVelocity)) { + } else if (npc_try_snap_to_ground(npc, npc->jumpVel)) { script->USE_STATE = BLAST_STATE_CANCEL; break; } } - npc->pos.y += npc->jumpVelocity; - npc->jumpVelocity -= npc->jumpScale; - if (npc->jumpVelocity < -8.0) { - npc->jumpVelocity = -8.0f; + npc->pos.y += npc->jumpVel; + npc->jumpVel -= npc->jumpScale; + if (npc->jumpVel < -8.0) { + npc->jumpVel = -8.0f; } - npc->rotation.z -= (script->functionTemp[2] * 79) / 2; - npc->rotation.x -= (script->functionTemp[2] * 67) / 2; + npc->rot.z -= (script->functionTemp[2] * 79) / 2; + npc->rot.x -= (script->functionTemp[2] * 67) / 2; break; } @@ -516,13 +516,13 @@ API_CALLABLE(N(UseAbility)) { } partnerStatus->partnerActionState = ACTION_STATE_IDLE; partnerStatus->actingPartner = PARTNER_NONE; - npc->jumpVelocity = 0.0f; + npc->jumpVel = 0.0f; N(IsBlasting) = FALSE; N(TriggeredEarlyDetonation) = FALSE; - npc->pos.y = playerStatus->position.y; - npc->rotation.x = 0.0f; - npc->rotation.z = 0.0f; - npc->currentAnim = ANIM_WorldBombette_Idle; + npc->pos.y = playerStatus->pos.y; + npc->rot.x = 0.0f; + npc->rot.z = 0.0f; + npc->curAnim = ANIM_WorldBombette_Idle; partner_clear_player_tracking(npc); if (N(PlayingFuseSound)) { N(PlayingFuseSound) = FALSE; @@ -537,14 +537,14 @@ API_CALLABLE(N(UseAbility)) { } partnerStatus->partnerActionState = PARTNER_ACTION_NONE; partnerStatus->actingPartner = PARTNER_NONE; - npc->jumpVelocity = 0.0f; - npc->pos.y = playerStatus->position.y; - npc->rotation.x = 0.0f; - npc->rotation.z = 0.0f; - npc->currentAnim = ANIM_WorldBombette_Idle; - npc->pos.x = playerStatus->position.x; - npc->pos.y = playerStatus->position.y; - npc->pos.z = playerStatus->position.z; + npc->jumpVel = 0.0f; + npc->pos.y = playerStatus->pos.y; + npc->rot.x = 0.0f; + npc->rot.z = 0.0f; + npc->curAnim = ANIM_WorldBombette_Idle; + npc->pos.x = playerStatus->pos.x; + npc->pos.y = playerStatus->pos.y; + npc->pos.z = playerStatus->pos.z; N(IsBlasting) = FALSE; N(TriggeredEarlyDetonation) = FALSE; if (!N(PlayerWasFacingLeft)) { @@ -552,7 +552,7 @@ API_CALLABLE(N(UseAbility)) { } else { add_vec2D_polar(&npc->pos.x, &npc->pos.z, playerStatus->colliderDiameter / 4, clamp_angle(playerStatus->targetYaw - 90.0f)); } - npc->jumpVelocity = 0.0f; + npc->jumpVel = 0.0f; partner_clear_player_tracking(npc); temp_ret = ApiStatus_DONE2; if (N(PlayingFuseSound)) { @@ -653,7 +653,7 @@ void N(pre_battle)(Npc* bombette) { N(IsBlasting) = FALSE; playerStatus->flags &= ~PS_FLAG_JUMPING; - bombette->jumpVelocity = 0.0f; + bombette->jumpVel = 0.0f; bombette->flags &= ~NPC_FLAG_JUMPING; set_action_state(ACTION_STATE_IDLE); @@ -662,9 +662,9 @@ void N(pre_battle)(Npc* bombette) { partnerStatus->partnerActionState = PARTNER_ACTION_NONE; partnerStatus->actingPartner = 0; - bombette->pos.x = playerStatus->position.x; - bombette->pos.y = playerStatus->position.y; - bombette->pos.z = playerStatus->position.z; + bombette->pos.x = playerStatus->pos.x; + bombette->pos.y = playerStatus->pos.y; + bombette->pos.z = playerStatus->pos.z; if (!N(PlayerWasFacingLeft)) { add_vec2D_polar(&bombette->pos.x, &bombette->pos.z, @@ -674,11 +674,11 @@ void N(pre_battle)(Npc* bombette) { playerStatus->colliderDiameter / 4, clamp_angle(playerStatus->targetYaw - 90.0f)); } - bombette->jumpVelocity = 0.0f; - bombette->pos.y = playerStatus->position.y; - bombette->rotation.x = 0.0f; - bombette->rotation.z = 0.0f; - bombette->currentAnim = ANIM_WorldBombette_Idle; + bombette->jumpVel = 0.0f; + bombette->pos.y = playerStatus->pos.y; + bombette->rot.x = 0.0f; + bombette->rot.z = 0.0f; + bombette->curAnim = ANIM_WorldBombette_Idle; partner_clear_player_tracking(bombette); disable_npc_blur(bombette); diff --git a/src/world/partner/bow.c b/src/world/partner/bow.c index ed22bb4ead2..d1dc7207dce 100644 --- a/src/world/partner/bow.c +++ b/src/world/partner/bow.c @@ -71,37 +71,37 @@ API_CALLABLE(N(Update)) { case TWEESTER_PARTNER_INIT: N(TweesterPhysicsPtr)->state++; N(TweesterPhysicsPtr)->prevFlags = bow->flags; - N(TweesterPhysicsPtr)->radius = fabsf(dist2D(bow->pos.x, bow->pos.z, entity->position.x, entity->position.z)); - N(TweesterPhysicsPtr)->angle = atan2(entity->position.x, entity->position.z, bow->pos.x, bow->pos.z); - N(TweesterPhysicsPtr)->angularVelocity = 6.0f; - N(TweesterPhysicsPtr)->liftoffVelocityPhase = 50.0f; + N(TweesterPhysicsPtr)->radius = fabsf(dist2D(bow->pos.x, bow->pos.z, entity->pos.x, entity->pos.z)); + N(TweesterPhysicsPtr)->angle = atan2(entity->pos.x, entity->pos.z, bow->pos.x, bow->pos.z); + N(TweesterPhysicsPtr)->angularVel = 6.0f; + N(TweesterPhysicsPtr)->liftoffVelPhase = 50.0f; N(TweesterPhysicsPtr)->countdown = 120; bow->flags |= NPC_FLAG_IGNORE_CAMERA_FOR_YAW | NPC_FLAG_IGNORE_PLAYER_COLLISION | NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_8; bow->flags &= ~NPC_FLAG_GRAVITY; case TWEESTER_PARTNER_ATTRACT: sin_cos_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->angle), &sinAngle, &cosAngle); - bow->pos.x = entity->position.x + (sinAngle * N(TweesterPhysicsPtr)->radius); - bow->pos.z = entity->position.z - (cosAngle * N(TweesterPhysicsPtr)->radius); - N(TweesterPhysicsPtr)->angle = clamp_angle(N(TweesterPhysicsPtr)->angle - N(TweesterPhysicsPtr)->angularVelocity); + bow->pos.x = entity->pos.x + (sinAngle * N(TweesterPhysicsPtr)->radius); + bow->pos.z = entity->pos.z - (cosAngle * N(TweesterPhysicsPtr)->radius); + N(TweesterPhysicsPtr)->angle = clamp_angle(N(TweesterPhysicsPtr)->angle - N(TweesterPhysicsPtr)->angularVel); if (N(TweesterPhysicsPtr)->radius > 20.0f) { N(TweesterPhysicsPtr)->radius -= 1.0f; } else if (N(TweesterPhysicsPtr)->radius < 19.0f) { N(TweesterPhysicsPtr)->radius++; } - liftoffVelocity = sin_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->liftoffVelocityPhase)) * 3.0f; - N(TweesterPhysicsPtr)->liftoffVelocityPhase += 3.0f; + liftoffVelocity = sin_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->liftoffVelPhase)) * 3.0f; + N(TweesterPhysicsPtr)->liftoffVelPhase += 3.0f; - if (N(TweesterPhysicsPtr)->liftoffVelocityPhase > 150.0f) { - N(TweesterPhysicsPtr)->liftoffVelocityPhase = 150.0f; + if (N(TweesterPhysicsPtr)->liftoffVelPhase > 150.0f) { + N(TweesterPhysicsPtr)->liftoffVelPhase = 150.0f; } bow->pos.y += liftoffVelocity; bow->renderYaw = clamp_angle(360.0f - N(TweesterPhysicsPtr)->angle); - N(TweesterPhysicsPtr)->angularVelocity += 0.8; + N(TweesterPhysicsPtr)->angularVel += 0.8; - if (N(TweesterPhysicsPtr)->angularVelocity > 40.0f) { - N(TweesterPhysicsPtr)->angularVelocity = 40.0f; + if (N(TweesterPhysicsPtr)->angularVel > 40.0f) { + N(TweesterPhysicsPtr)->angularVel = 40.0f; } if (--N(TweesterPhysicsPtr)->countdown == 0) { N(TweesterPhysicsPtr)->state++; @@ -150,14 +150,14 @@ s32 N(check_for_treadmill_overlaps)(void) { return NO_COLLIDER; } - if (playerStatus->pushVelocity.x == 0.0f && playerStatus->pushVelocity.z == 0.0f) { + if (playerStatus->pushVel.x == 0.0f && playerStatus->pushVel.z == 0.0f) { return NO_COLLIDER; } - yaw = atan2(0.0f, 0.0f, playerStatus->pushVelocity.x, playerStatus->pushVelocity.z); - x = playerStatus->position.x; - y = playerStatus->position.y + (playerStatus->colliderHeight * 0.5f); - z = playerStatus->position.z; + yaw = atan2(0.0f, 0.0f, playerStatus->pushVel.x, playerStatus->pushVel.z); + x = playerStatus->pos.x; + y = playerStatus->pos.y + (playerStatus->colliderHeight * 0.5f); + z = playerStatus->pos.z; add_vec2D_polar(&x, &z, playerStatus->colliderDiameter * 0.5f, clamp_angle(yaw + 180.0f)); return player_test_lateral_overlap(0, playerStatus, &x, &y, &z, playerStatus->colliderDiameter, yaw); @@ -254,31 +254,31 @@ API_CALLABLE(N(UseAbility)) { partnerStatus->actingPartner = 9; playerStatus->flags |= PS_FLAG_HAZARD_INVINCIBILITY; partner_force_player_flip_done(); - bow->moveToPos.x = playerStatus->position.x; - bow->moveToPos.y = playerStatus->position.y + (playerStatus->colliderHeight * 0.5f); - bow->moveToPos.z = playerStatus->position.z; - bow->currentAnim = ANIM_WorldBow_Walk; + bow->moveToPos.x = playerStatus->pos.x; + bow->moveToPos.y = playerStatus->pos.y + (playerStatus->colliderHeight * 0.5f); + bow->moveToPos.z = playerStatus->pos.z; + bow->curAnim = ANIM_WorldBow_Walk; bow->yaw = playerStatus->targetYaw; - add_vec2D_polar(&bow->moveToPos.x, &bow->moveToPos.z, -2.0f, gCameras[gCurrentCameraID].currentYaw); + add_vec2D_polar(&bow->moveToPos.x, &bow->moveToPos.z, -2.0f, gCameras[gCurrentCameraID].curYaw); add_vec2D_polar(&bow->moveToPos.x, &bow->moveToPos.z, playerStatus->colliderDiameter * 0.5f, bow->yaw); bow->duration = 5; - bow->yaw = atan2(bow->pos.x, bow->pos.z, playerStatus->position.x, playerStatus->position.z); + bow->yaw = atan2(bow->pos.x, bow->pos.z, playerStatus->pos.x, playerStatus->pos.z); set_action_state(ACTION_STATE_RIDE); suggest_player_anim_allow_backward(ANIM_Mario1_Idle); script->USE_STATE++; // OUTTA_SIGHT_GATHER break; case OUTTA_SIGHT_GATHER: - if (collisionStatus->currentFloor >= 0 && !(playerStatus->animFlags & PA_FLAG_CHANGING_MAP)) { - bow->moveToPos.x = playerStatus->position.x; - bow->moveToPos.y = playerStatus->position.y + (playerStatus->colliderHeight * 0.5f); - bow->moveToPos.z = playerStatus->position.z; + if (collisionStatus->curFloor >= 0 && !(playerStatus->animFlags & PA_FLAG_CHANGING_MAP)) { + bow->moveToPos.x = playerStatus->pos.x; + bow->moveToPos.y = playerStatus->pos.y + (playerStatus->colliderHeight * 0.5f); + bow->moveToPos.z = playerStatus->pos.z; bow->pos.x += ((bow->moveToPos.x - bow->pos.x) / bow->duration); bow->pos.y += ((bow->moveToPos.y - bow->pos.y) / bow->duration); bow->pos.z += ((bow->moveToPos.z - bow->pos.z) / bow->duration); - N(OuttaSightPosX) = playerStatus->position.x - bow->pos.x; - N(OuttaSightPosY) = playerStatus->position.y - bow->pos.y; - N(OuttaSightPosZ) = playerStatus->position.z - bow->pos.z; + N(OuttaSightPosX) = playerStatus->pos.x - bow->pos.x; + N(OuttaSightPosY) = playerStatus->pos.y - bow->pos.y; + N(OuttaSightPosZ) = playerStatus->pos.z - bow->pos.z; bow->duration--; if (bow->duration == 0) { bow->yaw = playerStatus->targetYaw; @@ -293,7 +293,7 @@ API_CALLABLE(N(UseAbility)) { return ApiStatus_DONE2; case OUTTA_SIGHT_VANISH: - if (collisionStatus->currentFloor >= 0) { + if (collisionStatus->curFloor >= 0) { playerStatus->alpha1 -= 8; if (playerStatus->alpha1 <= 128) { playerStatus->alpha1 = 128; @@ -305,26 +305,26 @@ API_CALLABLE(N(UseAbility)) { get_shadow_by_index(bow->shadowIndex)->alpha = playerStatus->alpha1 >> 1; npc_set_imgfx_params(bow, IMGFX_SET_ALPHA, playerStatus->alpha1, 0, 0, 0, 0); - bow->pos.x = playerStatus->position.x - N(OuttaSightPosX); - bow->pos.y = playerStatus->position.y - N(OuttaSightPosY); - bow->pos.z = playerStatus->position.z - N(OuttaSightPosZ); + bow->pos.x = playerStatus->pos.x - N(OuttaSightPosX); + bow->pos.y = playerStatus->pos.y - N(OuttaSightPosY); + bow->pos.z = playerStatus->pos.z - N(OuttaSightPosZ); break; } N(end_outta_sight_cleanup)(bow); return ApiStatus_DONE2; case OUTTA_SIGHT_IDLE: - if (collisionStatus->currentFloor <= NO_COLLIDER) { + if (collisionStatus->curFloor <= NO_COLLIDER) { N(end_outta_sight_cleanup)(bow); return ApiStatus_DONE2; } - bow->pos.x = playerStatus->position.x - N(OuttaSightPosX); - bow->pos.y = playerStatus->position.y - N(OuttaSightPosY); - bow->pos.z = playerStatus->position.z - N(OuttaSightPosZ); + bow->pos.x = playerStatus->pos.x - N(OuttaSightPosX); + bow->pos.y = playerStatus->pos.y - N(OuttaSightPosY); + bow->pos.z = playerStatus->pos.z - N(OuttaSightPosZ); stickInputMag = dist2D(0.0f, 0.0f, partnerStatus->stickX, partnerStatus->stickY); - if ((collisionStatus->currentFloor <= NO_COLLIDER) + if ((collisionStatus->curFloor <= NO_COLLIDER) || stickInputMag > 10.0f || partnerStatus->pressedButtons & (BUTTON_B | BUTTON_C_DOWN) || playerStatus->flags & PS_FLAG_HIT_FIRE diff --git a/src/world/partner/goombario.c b/src/world/partner/goombario.c index b84a2a8ba0f..06f3fbdac18 100644 --- a/src/world/partner/goombario.c +++ b/src/world/partner/goombario.c @@ -128,19 +128,19 @@ API_CALLABLE(N(Update)) { case 0: N(TweesterPhysicsPtr)->state = 1; N(TweesterPhysicsPtr)->prevFlags = npc->flags; - N(TweesterPhysicsPtr)->radius = fabsf(dist2D(npc->pos.x, npc->pos.z, entity->position.x, entity->position.z)); - N(TweesterPhysicsPtr)->angle = atan2(entity->position.x, entity->position.z, npc->pos.x, npc->pos.z); - N(TweesterPhysicsPtr)->angularVelocity = 6.0f; - N(TweesterPhysicsPtr)->liftoffVelocityPhase = 50.0f; + N(TweesterPhysicsPtr)->radius = fabsf(dist2D(npc->pos.x, npc->pos.z, entity->pos.x, entity->pos.z)); + N(TweesterPhysicsPtr)->angle = atan2(entity->pos.x, entity->pos.z, npc->pos.x, npc->pos.z); + N(TweesterPhysicsPtr)->angularVel = 6.0f; + N(TweesterPhysicsPtr)->liftoffVelPhase = 50.0f; N(TweesterPhysicsPtr)->countdown = 120; npc->flags |= NPC_FLAG_8 | NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_IGNORE_PLAYER_COLLISION | NPC_FLAG_IGNORE_CAMERA_FOR_YAW; npc->flags &= ~NPC_FLAG_GRAVITY; case 1: sin_cos_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->angle), &sinAngle, &cosAngle); - npc->pos.x = entity->position.x + (sinAngle * N(TweesterPhysicsPtr)->radius); - npc->pos.z = entity->position.z - (cosAngle * N(TweesterPhysicsPtr)->radius); - N(TweesterPhysicsPtr)->angle = clamp_angle(N(TweesterPhysicsPtr)->angle - N(TweesterPhysicsPtr)->angularVelocity); + npc->pos.x = entity->pos.x + (sinAngle * N(TweesterPhysicsPtr)->radius); + npc->pos.z = entity->pos.z - (cosAngle * N(TweesterPhysicsPtr)->radius); + N(TweesterPhysicsPtr)->angle = clamp_angle(N(TweesterPhysicsPtr)->angle - N(TweesterPhysicsPtr)->angularVel); if (N(TweesterPhysicsPtr)->radius > 20.0f) { N(TweesterPhysicsPtr)->radius--; @@ -148,20 +148,20 @@ API_CALLABLE(N(Update)) { N(TweesterPhysicsPtr)->radius++; } - liftoffVelocity = sin_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->liftoffVelocityPhase)) * 3.0f; - N(TweesterPhysicsPtr)->liftoffVelocityPhase += 3.0f; + liftoffVelocity = sin_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->liftoffVelPhase)) * 3.0f; + N(TweesterPhysicsPtr)->liftoffVelPhase += 3.0f; - if (N(TweesterPhysicsPtr)->liftoffVelocityPhase > 150.0f) { - N(TweesterPhysicsPtr)->liftoffVelocityPhase = 150.0f; + if (N(TweesterPhysicsPtr)->liftoffVelPhase > 150.0f) { + N(TweesterPhysicsPtr)->liftoffVelPhase = 150.0f; } npc->pos.y += liftoffVelocity; npc->renderYaw = clamp_angle(360.0f - N(TweesterPhysicsPtr)->angle); - N(TweesterPhysicsPtr)->angularVelocity += 0.8; + N(TweesterPhysicsPtr)->angularVel += 0.8; - if (N(TweesterPhysicsPtr)->angularVelocity > 40.0f) { - N(TweesterPhysicsPtr)->angularVelocity = 40.0f; + if (N(TweesterPhysicsPtr)->angularVel > 40.0f) { + N(TweesterPhysicsPtr)->angularVel = 40.0f; } if (--N(TweesterPhysicsPtr)->countdown == 0) { @@ -281,8 +281,8 @@ API_CALLABLE(N(SelectTattleMsg)) { case USE_TATTLE_FACE_PLAYER: set_time_freeze_mode(1); playerStatus->flags &= ~PS_FLAG_HAS_CONVERSATION_NPC; - goombario->currentAnim = ANIM_WorldGoombario_Idle; - goombario->yaw = clamp_angle(gCameras[CAM_DEFAULT].currentYaw + playerStatus->spriteFacingAngle - 90.0f); + goombario->curAnim = ANIM_WorldGoombario_Idle; + goombario->yaw = clamp_angle(gCameras[CAM_DEFAULT].curYaw + playerStatus->spriteFacingAngle - 90.0f); gPartnerStatus.partnerActionState = PARTNER_ACTION_USE; close_status_bar(); if (N(HadSpeechPrompt)) { diff --git a/src/world/partner/goompa.c b/src/world/partner/goompa.c index 8201882f510..4de99905f97 100644 --- a/src/world/partner/goompa.c +++ b/src/world/partner/goompa.c @@ -58,18 +58,18 @@ API_CALLABLE(N(Update)) { N(TweesterPhysicsPtr)->state++; N(TweesterPhysicsPtr)->prevFlags = goompa->flags; N(TweesterPhysicsPtr)->radius = fabsf(dist2D(goompa->pos.x, goompa->pos.z, - entity->position.x, entity->position.z)); - N(TweesterPhysicsPtr)->angle = atan2(entity->position.x, entity->position.z, goompa->pos.x, goompa->pos.z); - N(TweesterPhysicsPtr)->angularVelocity = 6.0f; - N(TweesterPhysicsPtr)->liftoffVelocityPhase = 50.0f; + entity->pos.x, entity->pos.z)); + N(TweesterPhysicsPtr)->angle = atan2(entity->pos.x, entity->pos.z, goompa->pos.x, goompa->pos.z); + N(TweesterPhysicsPtr)->angularVel = 6.0f; + N(TweesterPhysicsPtr)->liftoffVelPhase = 50.0f; N(TweesterPhysicsPtr)->countdown = 120; goompa->flags |= NPC_FLAG_8 | NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_IGNORE_PLAYER_COLLISION | NPC_FLAG_IGNORE_CAMERA_FOR_YAW; goompa->flags &= ~NPC_FLAG_GRAVITY; case TWEESTER_PARTNER_ATTRACT: sin_cos_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->angle), &sinAngle, &cosAngle); - goompa->pos.x = entity->position.x + (sinAngle * N(TweesterPhysicsPtr)->radius); - goompa->pos.z = entity->position.z - (cosAngle * N(TweesterPhysicsPtr)->radius); - N(TweesterPhysicsPtr)->angle = clamp_angle(N(TweesterPhysicsPtr)->angle - N(TweesterPhysicsPtr)->angularVelocity); + goompa->pos.x = entity->pos.x + (sinAngle * N(TweesterPhysicsPtr)->radius); + goompa->pos.z = entity->pos.z - (cosAngle * N(TweesterPhysicsPtr)->radius); + N(TweesterPhysicsPtr)->angle = clamp_angle(N(TweesterPhysicsPtr)->angle - N(TweesterPhysicsPtr)->angularVel); if (N(TweesterPhysicsPtr)->radius > 20.0f) { N(TweesterPhysicsPtr)->radius--; @@ -77,19 +77,19 @@ API_CALLABLE(N(Update)) { N(TweesterPhysicsPtr)->radius++; } - liftoffVelocity = sin_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->liftoffVelocityPhase)) * 3.0f; - N(TweesterPhysicsPtr)->liftoffVelocityPhase += 3.0f; + liftoffVelocity = sin_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->liftoffVelPhase)) * 3.0f; + N(TweesterPhysicsPtr)->liftoffVelPhase += 3.0f; - if (N(TweesterPhysicsPtr)->liftoffVelocityPhase > 150.0f) { - N(TweesterPhysicsPtr)->liftoffVelocityPhase = 150.0f; + if (N(TweesterPhysicsPtr)->liftoffVelPhase > 150.0f) { + N(TweesterPhysicsPtr)->liftoffVelPhase = 150.0f; } goompa->pos.y += liftoffVelocity; goompa->renderYaw = clamp_angle(360.0f - N(TweesterPhysicsPtr)->angle); - N(TweesterPhysicsPtr)->angularVelocity += 0.8; + N(TweesterPhysicsPtr)->angularVel += 0.8; - if (N(TweesterPhysicsPtr)->angularVelocity > 40.0f) { - N(TweesterPhysicsPtr)->angularVelocity = 40.0f; + if (N(TweesterPhysicsPtr)->angularVel > 40.0f) { + N(TweesterPhysicsPtr)->angularVel = 40.0f; } if (--N(TweesterPhysicsPtr)->countdown == 0) { diff --git a/src/world/partner/kooper.c b/src/world/partner/kooper.c index c798059fb81..06c7681b5d1 100644 --- a/src/world/partner/kooper.c +++ b/src/world/partner/kooper.c @@ -125,39 +125,39 @@ API_CALLABLE(N(Update)) { N(TweesterPhysicsPtr)->state++; N(TweesterPhysicsPtr)->prevFlags = kooper->flags; N(TweesterPhysicsPtr)->radius = fabsf(dist2D(kooper->pos.x, kooper->pos.z, - entity->position.x, entity->position.z)); - N(TweesterPhysicsPtr)->angle = atan2(entity->position.x, entity->position.z, kooper->pos.x, kooper->pos.z); - N(TweesterPhysicsPtr)->angularVelocity = 6.0f; - N(TweesterPhysicsPtr)->liftoffVelocityPhase = 50.0f; + entity->pos.x, entity->pos.z)); + N(TweesterPhysicsPtr)->angle = atan2(entity->pos.x, entity->pos.z, kooper->pos.x, kooper->pos.z); + N(TweesterPhysicsPtr)->angularVel = 6.0f; + N(TweesterPhysicsPtr)->liftoffVelPhase = 50.0f; N(TweesterPhysicsPtr)->countdown = 120; kooper->flags |= NPC_FLAG_IGNORE_CAMERA_FOR_YAW | NPC_FLAG_IGNORE_PLAYER_COLLISION | NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_8; kooper->flags &= ~NPC_FLAG_GRAVITY; case TWEESTER_PARTNER_ATTRACT: sin_cos_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->angle), &sinAngle, &cosAngle); - kooper->pos.x = entity->position.x + (sinAngle * N(TweesterPhysicsPtr)->radius); - kooper->pos.z = entity->position.z - (cosAngle * N(TweesterPhysicsPtr)->radius); + kooper->pos.x = entity->pos.x + (sinAngle * N(TweesterPhysicsPtr)->radius); + kooper->pos.z = entity->pos.z - (cosAngle * N(TweesterPhysicsPtr)->radius); - N(TweesterPhysicsPtr)->angle = clamp_angle(N(TweesterPhysicsPtr)->angle - N(TweesterPhysicsPtr)->angularVelocity); + N(TweesterPhysicsPtr)->angle = clamp_angle(N(TweesterPhysicsPtr)->angle - N(TweesterPhysicsPtr)->angularVel); if (N(TweesterPhysicsPtr)->radius > 20.0f) { N(TweesterPhysicsPtr)->radius--; } else if (N(TweesterPhysicsPtr)->radius < 19.0f) { N(TweesterPhysicsPtr)->radius++; } - liftoffVelocity = sin_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->liftoffVelocityPhase)) * 3.0f; + liftoffVelocity = sin_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->liftoffVelPhase)) * 3.0f; - N(TweesterPhysicsPtr)->liftoffVelocityPhase += 3.0f; + N(TweesterPhysicsPtr)->liftoffVelPhase += 3.0f; - if (N(TweesterPhysicsPtr)->liftoffVelocityPhase > 150.0f) { - N(TweesterPhysicsPtr)->liftoffVelocityPhase = 150.0f; + if (N(TweesterPhysicsPtr)->liftoffVelPhase > 150.0f) { + N(TweesterPhysicsPtr)->liftoffVelPhase = 150.0f; } kooper->pos.y += liftoffVelocity; kooper->renderYaw = clamp_angle(360.0f - N(TweesterPhysicsPtr)->angle); - N(TweesterPhysicsPtr)->angularVelocity += 0.8; - if (N(TweesterPhysicsPtr)->angularVelocity > 40.0f) { - N(TweesterPhysicsPtr)->angularVelocity = 40.0f; + N(TweesterPhysicsPtr)->angularVel += 0.8; + if (N(TweesterPhysicsPtr)->angularVel > 40.0f) { + N(TweesterPhysicsPtr)->angularVel = 40.0f; } if (--N(TweesterPhysicsPtr)->countdown == 0) { @@ -248,7 +248,7 @@ API_CALLABLE(N(UseAbility)) { partnerStatus->partnerActionState = PARTNER_ACTION_KOOPER_GATHER; partnerStatus->actingPartner = PARTNER_KOOPER; script->USE_STATE = SHELL_TOSS_STATE_HOLD; - kooper->currentAnim = ANIM_WorldKooper_SpinShell; + kooper->curAnim = ANIM_WorldKooper_SpinShell; N(ShellTossHoldTime) = 30; } } @@ -275,7 +275,7 @@ API_CALLABLE(N(UseAbility)) { enable_npc_blur(kooper); kooper->duration = 4; kooper->yaw = atan2(kooper->pos.x, kooper->pos.z, - playerStatus->position.x, playerStatus->position.z); + playerStatus->pos.x, playerStatus->pos.z); script->USE_STATE++; break; @@ -291,10 +291,10 @@ API_CALLABLE(N(UseAbility)) { } suggest_player_anim_allow_backward(ANIM_Mario1_BeforeJump); - kooper->moveToPos.x = N(ShellTossPosX) = playerStatus->position.x; - kooper->moveToPos.y = N(ShellTossPosY) = playerStatus->position.y; - kooper->moveToPos.z = N(ShellTossPosZ) = playerStatus->position.z; - kooper->currentAnim = ANIM_WorldKooper_Run; + kooper->moveToPos.x = N(ShellTossPosX) = playerStatus->pos.x; + kooper->moveToPos.y = N(ShellTossPosY) = playerStatus->pos.y; + kooper->moveToPos.z = N(ShellTossPosZ) = playerStatus->pos.z; + kooper->curAnim = ANIM_WorldKooper_Run; add_vec2D_polar(&kooper->moveToPos.x, &kooper->moveToPos.z, playerStatus->colliderDiameter / 3, playerStatus->targetYaw); moveAngle = clamp_angle(playerStatus->targetYaw + (N(PlayerWasFacingLeft) ? 90.0f : -90.0f)); @@ -321,13 +321,13 @@ API_CALLABLE(N(UseAbility)) { } kooper->yaw = playerStatus->targetYaw; - kooper->jumpVelocity = 18.0f; + kooper->jumpVel = 18.0f; kooper->jumpScale = 3.0f; - kooper->currentAnim = ANIM_WorldKooper_EnterShell; + kooper->curAnim = ANIM_WorldKooper_EnterShell; kooper->collisionHeight = 12; - kooper->moveToPos.y = playerStatus->position.y; - kooper->moveToPos.z = playerStatus->position.y + playerStatus->colliderHeight / 3; + kooper->moveToPos.y = playerStatus->pos.y; + kooper->moveToPos.z = playerStatus->pos.y + playerStatus->colliderHeight / 3; playerStatus->flags |= PS_FLAG_JUMPING; gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_IGNORE_PLAYER_Y; @@ -353,35 +353,35 @@ API_CALLABLE(N(UseAbility)) { break; } - kooper->jumpVelocity -= kooper->jumpScale; - playerStatus->position.y += kooper->jumpVelocity; - if (kooper->jumpVelocity < 0.0f) { + kooper->jumpVel -= kooper->jumpScale; + playerStatus->pos.y += kooper->jumpVel; + if (kooper->jumpVel < 0.0f) { if (!N(ShellTossKickFalling)) { N(ShellTossKickFalling) = TRUE; suggest_player_anim_allow_backward(ANIM_Mario1_Fall); } } - posX = playerStatus->position.x; - posY = (playerStatus->position.y + playerStatus->colliderHeight / 2) - kooper->jumpVelocity; - posZ = playerStatus->position.z; + posX = playerStatus->pos.x; + posY = (playerStatus->pos.y + playerStatus->colliderHeight / 2) - kooper->jumpVel; + posZ = playerStatus->pos.z; testLength = hitLength = playerStatus->colliderHeight / 2; if ((npc_raycast_up(COLLISION_CHANNEL_10000, &posX, &posY, &posZ, &hitLength)) && (hitLength < testLength)) { - collisionStatus->currentCeiling = NpcHitQueryColliderID; - playerStatus->position.y = posY - playerStatus->colliderHeight; + collisionStatus->curCeiling = NpcHitQueryColliderID; + playerStatus->pos.y = posY - playerStatus->colliderHeight; N(vertical_hit_interactable_entity)(kooper); } - if (!(kooper->jumpVelocity > 0.0f) && (playerStatus->position.y < kooper->moveToPos.z)) { + if (!(kooper->jumpVel > 0.0f) && (playerStatus->pos.y < kooper->moveToPos.z)) { N(D_802BEC5C) = 0; kooper->flags &= ~NPC_FLAG_IGNORE_PLAYER_COLLISION; partnerStatus->actingPartner = PARTNER_KOOPER; partnerStatus->partnerActionState = PARTNER_ACTION_KOOPER_TOSS; - kooper->rotation.z = 0.0f; + kooper->rot.z = 0.0f; kooper->planarFlyDist = 0.0f; kooper->moveSpeed = 8.0f; - kooper->currentAnim = ANIM_WorldKooper_SpinShell; + kooper->curAnim = ANIM_WorldKooper_SpinShell; ShellTossHitboxState = SHELL_TOSS_HITBOX_ENABLED; fx_damage_stars(3, kooper->pos.x, kooper->pos.y + kooper->collisionHeight, kooper->pos.z, sin_deg(playerStatus->targetYaw), -1.0f, -cos_deg(playerStatus->targetYaw), 3); @@ -467,7 +467,7 @@ API_CALLABLE(N(UseAbility)) { } if (!(npc_try_snap_to_ground(kooper, 6.0f) || playerStatus->flags & (PS_FLAG_JUMPING | PS_FLAG_FALLING))) { - kooper->pos.y += (playerStatus->position.y - kooper->pos.y) / 10.0f; + kooper->pos.y += (playerStatus->pos.y - kooper->pos.y) / 10.0f; } npc_do_other_npc_collision(kooper); @@ -568,7 +568,7 @@ API_CALLABLE(N(UseAbility)) { } if (npc_try_snap_to_ground(kooper, 6.0f) == 0) { - kooper->pos.y += (playerStatus->position.y - kooper->pos.y) / 10.0f; + kooper->pos.y += (playerStatus->pos.y - kooper->pos.y) / 10.0f; } posX = kooper->pos.x; @@ -597,9 +597,9 @@ API_CALLABLE(N(UseAbility)) { moveAngle = clamp_angle(playerStatus->targetYaw - (N(PlayerWasFacingLeft) ? 90.0f : -90.0f)); add_vec2D_polar(&posX, &posZ, 4.0f, moveAngle); - heldItem->position.x = posX; - heldItem->position.y = posY; - heldItem->position.z = posZ; + heldItem->pos.x = posX; + heldItem->pos.y = posY; + heldItem->pos.z = posZ; } if (kooper->planarFlyDist + 15.0f < kooper->moveSpeed) { @@ -625,9 +625,9 @@ API_CALLABLE(N(UseAbility)) { kooper->flags &= ~(NPC_FLAG_JUMPING | NPC_FLAG_IGNORE_WORLD_COLLISION); partnerStatus->actingPartner = PARTNER_NONE; partnerStatus->partnerActionState = PARTNER_ACTION_NONE; - kooper->jumpVelocity = 0.0f; + kooper->jumpVel = 0.0f; kooper->collisionHeight = 24; - kooper->currentAnim = ANIM_WorldKooper_Walk; + kooper->curAnim = ANIM_WorldKooper_Walk; sfx_stop_sound(SOUND_284); disable_npc_blur(kooper); @@ -745,7 +745,7 @@ void N(pre_battle)(Npc* kooper) { ShellTossHitboxState = SHELL_TOSS_HITBOX_DISABLED; playerStatus->flags &= ~PS_FLAG_JUMPING; - kooper->jumpVelocity = 0.0f; + kooper->jumpVel = 0.0f; kooper->flags &= ~NPC_FLAG_JUMPING; kooper->flags &= ~NPC_FLAG_IGNORE_WORLD_COLLISION; diff --git a/src/world/partner/lakilester.c b/src/world/partner/lakilester.c index 02789b4259b..42abe6b5370 100644 --- a/src/world/partner/lakilester.c +++ b/src/world/partner/lakilester.c @@ -59,7 +59,7 @@ void N(sync_player_position)(void) { f32 speed; if (playerStatus->flags & PS_FLAG_CUTSCENE_MOVEMENT) { - speed = playerStatus->currentSpeed; + speed = playerStatus->curSpeed; if (playerStatus->flags & PS_FLAG_ENTERING_BATTLE) { speed *= 0.5f; } @@ -68,10 +68,10 @@ void N(sync_player_position)(void) { lakilester->yaw = playerStatus->targetYaw; } - playerStatus->position.x = lakilester->pos.x; - playerStatus->position.y = lakilester->pos.y + 10.0f + abs(N(PlayerBounceOffset)) * 0.34f; - playerStatus->position.z = lakilester->pos.z; - add_vec2D_polar(&playerStatus->position.x, &playerStatus->position.z, 2.0f, gCameras[gCurrentCameraID].currentYaw); + playerStatus->pos.x = lakilester->pos.x; + playerStatus->pos.y = lakilester->pos.y + 10.0f + abs(N(PlayerBounceOffset)) * 0.34f; + playerStatus->pos.z = lakilester->pos.z; + add_vec2D_polar(&playerStatus->pos.x, &playerStatus->pos.z, 2.0f, gCameras[gCurrentCameraID].curYaw); } void N(init)(Npc* lakilester) { @@ -141,18 +141,18 @@ API_CALLABLE(N(Update)) { case TWEESTER_PARTNER_INIT: N(TweesterPhysicsPtr)->state++; N(TweesterPhysicsPtr)->prevFlags = lakilester->flags; - N(TweesterPhysicsPtr)->radius = fabsf(dist2D(lakilester->pos.x, lakilester->pos.z, entity->position.x, entity->position.z)); - N(TweesterPhysicsPtr)->angle = atan2(entity->position.x, entity->position.z, lakilester->pos.x, lakilester->pos.z); - N(TweesterPhysicsPtr)->angularVelocity = 6.0f; - N(TweesterPhysicsPtr)->liftoffVelocityPhase = 50.0f; + N(TweesterPhysicsPtr)->radius = fabsf(dist2D(lakilester->pos.x, lakilester->pos.z, entity->pos.x, entity->pos.z)); + N(TweesterPhysicsPtr)->angle = atan2(entity->pos.x, entity->pos.z, lakilester->pos.x, lakilester->pos.z); + N(TweesterPhysicsPtr)->angularVel = 6.0f; + N(TweesterPhysicsPtr)->liftoffVelPhase = 50.0f; N(TweesterPhysicsPtr)->countdown = 120; lakilester->flags |= NPC_FLAG_IGNORE_CAMERA_FOR_YAW | NPC_FLAG_IGNORE_PLAYER_COLLISION | NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_8; lakilester->flags &= ~NPC_FLAG_GRAVITY; case TWEESTER_PARTNER_ATTRACT: sin_cos_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->angle), &sinAngle, &cosAngle); - lakilester->pos.x = entity->position.x + (sinAngle * N(TweesterPhysicsPtr)->radius); - lakilester->pos.z = entity->position.z - (cosAngle * N(TweesterPhysicsPtr)->radius); - N(TweesterPhysicsPtr)->angle = clamp_angle(N(TweesterPhysicsPtr)->angle - N(TweesterPhysicsPtr)->angularVelocity); + lakilester->pos.x = entity->pos.x + (sinAngle * N(TweesterPhysicsPtr)->radius); + lakilester->pos.z = entity->pos.z - (cosAngle * N(TweesterPhysicsPtr)->radius); + N(TweesterPhysicsPtr)->angle = clamp_angle(N(TweesterPhysicsPtr)->angle - N(TweesterPhysicsPtr)->angularVel); if (N(TweesterPhysicsPtr)->radius > 20.0f) { N(TweesterPhysicsPtr)->radius--; @@ -160,19 +160,19 @@ API_CALLABLE(N(Update)) { N(TweesterPhysicsPtr)->radius++; } - liftoffVelocity = sin_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->liftoffVelocityPhase)) * 3.0f; - N(TweesterPhysicsPtr)->liftoffVelocityPhase += 3.0f; + liftoffVelocity = sin_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->liftoffVelPhase)) * 3.0f; + N(TweesterPhysicsPtr)->liftoffVelPhase += 3.0f; - if (N(TweesterPhysicsPtr)->liftoffVelocityPhase > 150.0f) { - N(TweesterPhysicsPtr)->liftoffVelocityPhase = 150.0f; + if (N(TweesterPhysicsPtr)->liftoffVelPhase > 150.0f) { + N(TweesterPhysicsPtr)->liftoffVelPhase = 150.0f; } lakilester->pos.y += liftoffVelocity; lakilester->renderYaw = clamp_angle(360.0f - N(TweesterPhysicsPtr)->angle); - N(TweesterPhysicsPtr)->angularVelocity += 0.8; + N(TweesterPhysicsPtr)->angularVel += 0.8; - if (N(TweesterPhysicsPtr)->angularVelocity > 40.0f) { - N(TweesterPhysicsPtr)->angularVelocity = 40.0f; + if (N(TweesterPhysicsPtr)->angularVel > 40.0f) { + N(TweesterPhysicsPtr)->angularVel = 40.0f; } if (--N(TweesterPhysicsPtr)->countdown == 0) { @@ -216,7 +216,7 @@ void N(get_movement_from_input)(f32* outAngle, f32* outSpeed) { PartnerStatus* partnerStatus = &gPartnerStatus; f32 stickX = partnerStatus->stickX; f32 stickY = partnerStatus->stickY; - f32 moveAngle = clamp_angle(atan2(0.0f, 0.0f, stickX, -stickY) + gCameras[CAM_DEFAULT].currentYaw); + f32 moveAngle = clamp_angle(atan2(0.0f, 0.0f, stickX, -stickY) + gCameras[CAM_DEFAULT].curYaw); f32 moveSpeed = 0.0f; if (dist2D(0.0f, 0.0f, stickX, -stickY) >= 1.0) { @@ -250,10 +250,10 @@ s32 N(can_dismount)(void) { canDismount = FALSE; outLength = 16.0f; outY = lakilester->moveToPos.y + 7.0f; - outX = playerStatus->position.x; - outZ = playerStatus->position.z; + outX = playerStatus->pos.x; + outZ = playerStatus->pos.z; currentCamera = &gCameras[gCurrentCameraID]; - add_vec2D_polar(&outX, &outZ, 2.0f, currentCamera->currentYaw); + add_vec2D_polar(&outX, &outZ, 2.0f, currentCamera->curYaw); hitResult = player_raycast_below_cam_relative(playerStatus, &outX, &outY, &outZ, &outLength, &hitRx, &hitRz, &hitDirX, &hitDirZ); temp = hitResult; @@ -279,9 +279,9 @@ s32 N(can_dismount)(void) { } s32 N(test_mounting_height_adjustment)(Npc* lakilester, f32 height, f32 dist) { - f32 x = gPlayerStatus.position.x; - f32 y = gPlayerStatus.position.y + height; - f32 z = gPlayerStatus.position.z; + f32 x = gPlayerStatus.pos.x; + f32 y = gPlayerStatus.pos.y + height; + f32 z = gPlayerStatus.pos.z; f32 depth = dist; f32 hitRx, hitRz; f32 hitDirX, hitDirZ; @@ -323,7 +323,7 @@ void N(apply_riding_static_collisions)(Npc* lakilester) { if (TEST_MOVE_AT_ANGLE(npc_test_move_complex_with_slipping, lakilester->yaw)) { lakilester->flags |= (NPC_FLAG_COLLDING_FORWARD_WITH_WORLD | NPC_FLAG_COLLDING_WITH_WORLD); - lakilester->currentWall = NpcHitQueryColliderID; + lakilester->curWall = NpcHitQueryColliderID; lakilester->pos.x = x; lakilester->pos.z = z; } else { @@ -381,7 +381,7 @@ void N(update_riding_physics)(Npc* lakilester) { moveSpeed = 0.0f; N(get_movement_from_input)(&moveAngle, &moveSpeed); - currentSurfaceType = get_collider_flags(lakilester->currentFloor) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; + currentSurfaceType = get_collider_flags(lakilester->curFloor) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; if (currentSurfaceType == SURFACE_TYPE_LAVA) { moveSpeed *= 0.5f; } @@ -417,7 +417,7 @@ void N(update_riding_physics)(Npc* lakilester) { if (npc_test_move_taller_with_slipping(lakilester->collisionChannel, &x, &y, &z, lakilester->collisionDiameter, lakilester->yaw, lakilester->collisionHeight, lakilester->collisionDiameter)) { - collisionStatus->currentInspect = (partnerStatus->pressedButtons & BUTTON_A) ? NpcHitQueryColliderID : NO_COLLIDER; + collisionStatus->curInspect = (partnerStatus->pressedButtons & BUTTON_A) ? NpcHitQueryColliderID : NO_COLLIDER; } if (moveSpeed != 0.0f) { @@ -492,9 +492,9 @@ void N(update_riding_physics)(Npc* lakilester) { lakilester->moveToPos.y -= lakilester->jumpScale; hitDepth = lakilester->collisionHeight + 2; y = lakilester->moveToPos.y + 12.0f; - x = playerStatus->position.x; - z = playerStatus->position.z; - add_vec2D_polar(&x, &z, 2.0f, gCameras[gCurrentCameraID].currentYaw); + x = playerStatus->pos.x; + z = playerStatus->pos.z; + add_vec2D_polar(&x, &z, 2.0f, gCameras[gCurrentCameraID].curYaw); raycastBelowResult = player_raycast_below_cam_relative(playerStatus, &x, &y, &z, &hitDepth, &sp40, &sp44, &sp48, &sp4C); N(CurrentGroundPitch) = get_player_normal_pitch(); @@ -510,12 +510,12 @@ void N(update_riding_physics)(Npc* lakilester) { } if (hitDepth <= height && raycastBelowResult > NO_COLLIDER) { - playerStatus->lastGoodPosition.x = lakilester->pos.x; - playerStatus->lastGoodPosition.y = lakilester->pos.y; - playerStatus->lastGoodPosition.z = lakilester->pos.z; - collisionStatus->currentFloor = raycastBelowResult; + playerStatus->lastGoodPos.x = lakilester->pos.x; + playerStatus->lastGoodPos.y = lakilester->pos.y; + playerStatus->lastGoodPos.z = lakilester->pos.z; + collisionStatus->curFloor = raycastBelowResult; - lakilester->currentFloor = raycastBelowResult; + lakilester->curFloor = raycastBelowResult; lakilester->moveToPos.y = y; lakilester->moveToPos.x = x; lakilester->moveToPos.z = z; @@ -524,18 +524,18 @@ void N(update_riding_physics)(Npc* lakilester) { belowSurfaceType = get_collider_flags(raycastBelowResult) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; if (belowSurfaceType == SURFACE_TYPE_LAVA) { - lakilester->currentAnim = ANIM_WorldLakilester_StrainWalk; + lakilester->curAnim = ANIM_WorldLakilester_StrainWalk; lakilester->moveSpeed = moveSpeed * 0.5f; } else { - lakilester->currentAnim = ANIM_WorldLakilester_Walk; + lakilester->curAnim = ANIM_WorldLakilester_Walk; lakilester->moveSpeed = moveSpeed; } return; } - collisionStatus->currentFloor = NO_COLLIDER; + collisionStatus->curFloor = NO_COLLIDER; playerStatus->timeInAir++; - lakilester->currentFloor = NO_COLLIDER; + lakilester->curFloor = NO_COLLIDER; lakilester->jumpScale += 1.8; if (lakilester->jumpScale > 12.0f) { @@ -549,9 +549,9 @@ s32 N(test_dismount_height)(f32* posY) { f32 hitRx, hitRz; f32 posX, posZ; - *posY = gPlayerStatus.position.y + colliderHeight; - posX = gPlayerStatus.position.x; - posZ = gPlayerStatus.position.z; + *posY = gPlayerStatus.pos.y + colliderHeight; + posX = gPlayerStatus.pos.x; + posZ = gPlayerStatus.pos.z; return player_raycast_below_cam_relative(&gPlayerStatus, &posX, posY, &posZ, &colliderHeight, &hitRx, &hitRz, &hitDirX, &hitDirZ); @@ -607,18 +607,18 @@ API_CALLABLE(N(UseAbility)) { lakilester->flags |= NPC_FLAG_IGNORE_PLAYER_COLLISION; set_action_state(ACTION_STATE_RIDE); suggest_player_anim_always_forward(ANIM_MarioW2_RideLaki); - lakilester->currentAnim = ANIM_WorldLakilester_Walk; + lakilester->curAnim = ANIM_WorldLakilester_Walk; N(MountState) = MOUNT_STATE_IN_PROGRESS; // unexpected lakilester->flags &= ~(NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_8); lakilester->flags |= (NPC_FLAG_IGNORE_PLAYER_COLLISION | NPC_FLAG_TOUCHES_GROUND); partnerStatus->actingPartner = PARTNER_LAKILESTER; partnerStatus->partnerActionState = PARTNER_ACTION_LAKILESTER_1; gGameStatusPtr->keepUsingPartnerOnMapChange = FALSE; - lakilester->pos.x = playerStatus->position.x; + lakilester->pos.x = playerStatus->pos.x; lakilester->pos.y = lakilester->moveToPos.y; - lakilester->pos.z = playerStatus->position.z; - lakilester->currentAnim = ANIM_WorldLakilester_Walk; - playerStatus->position.y = lakilester->pos.y + 10.0f; + lakilester->pos.z = playerStatus->pos.z; + lakilester->curAnim = ANIM_WorldLakilester_Walk; + playerStatus->pos.y = lakilester->pos.y + 10.0f; lakilester->moveSpeed = 3.0f; lakilester->jumpScale = 0.0f; lakilester->yaw = playerStatus->targetYaw; @@ -700,9 +700,9 @@ API_CALLABLE(N(UseAbility)) { set_action_state(ACTION_STATE_RIDE); N(MountState) = MOUNT_STATE_IN_PROGRESS; partner_force_player_flip_done(); - lakilester->moveToPos.x = playerStatus->position.x; - lakilester->moveToPos.y = playerStatus->position.y; - lakilester->moveToPos.z = playerStatus->position.z; + lakilester->moveToPos.x = playerStatus->pos.x; + lakilester->moveToPos.y = playerStatus->pos.y; + lakilester->moveToPos.z = playerStatus->pos.z; yaw = 0.0f; for (i = 0; i < 4; i++) { @@ -719,8 +719,8 @@ API_CALLABLE(N(UseAbility)) { lakilester->yaw = atan2(lakilester->pos.x, lakilester->pos.z, lakilester->moveToPos.x, lakilester->moveToPos.z); lakilester->duration = 12; - lakilester->currentAnim = ANIM_WorldLakilester_Walk; - lakilester->jumpVelocity = 8.0f; + lakilester->curAnim = ANIM_WorldLakilester_Walk; + lakilester->jumpVel = 8.0f; lakilester->jumpScale = 1.4f; suggest_player_anim_allow_backward(ANIM_Mario1_BeforeJump); N(AbilityState) = RIDE_STATE_MOUNT_2; @@ -737,13 +737,13 @@ API_CALLABLE(N(UseAbility)) { lakilester->pos.x += (lakilester->moveToPos.x - lakilester->pos.x) / lakilester->duration; lakilester->pos.z += (lakilester->moveToPos.z - lakilester->pos.z) / lakilester->duration; lakilester->pos.y += (lakilester->moveToPos.y - lakilester->pos.y) / lakilester->duration; - playerStatus->position.y += lakilester->jumpVelocity; + playerStatus->pos.y += lakilester->jumpVel; N(test_mounting_height_adjustment)(lakilester, playerStatus->colliderHeight, 2 * playerStatus->colliderHeight); - playerStatus->position.y += N(MountingDeltaY); + playerStatus->pos.y += N(MountingDeltaY); lakilester->pos.y += N(MountingDeltaY); - lakilester->jumpVelocity -= lakilester->jumpScale; + lakilester->jumpVel -= lakilester->jumpScale; - if (lakilester->jumpVelocity <= 0.0f) { + if (lakilester->jumpVel <= 0.0f) { suggest_player_anim_allow_backward(ANIM_Mario1_Fall); } @@ -752,10 +752,10 @@ API_CALLABLE(N(UseAbility)) { if (lakilester->duration > 0) { if (lakilester->duration == 1) { add_vec2D_polar(&lakilester->pos.x, &lakilester->pos.z, -2.0f, - gCameras[gCurrentCameraID].currentYaw); + gCameras[gCurrentCameraID].curYaw); } } else { - playerStatus->position.y = lakilester->pos.y + 10.0f; + playerStatus->pos.y = lakilester->pos.y + 10.0f; lakilester->moveSpeed = playerStatus->runSpeed; lakilester->jumpScale = 0.0f; lakilester->yaw = playerStatus->targetYaw; @@ -827,24 +827,24 @@ API_CALLABLE(N(UseAbility)) { lakilester->flags &= ~NPC_FLAG_IGNORE_WORLD_COLLISION; playerStatus->flags |= PS_FLAG_PAUSE_DISABLED; N(can_dismount)(); - camYaw = camera->currentYaw; + camYaw = camera->curYaw; if (playerStatus->spriteFacingAngle >= 90.0f && playerStatus->spriteFacingAngle < 270.0f) { yaw = (180.0f + camYaw) - 90.0f; } else { yaw = (0.0f + camYaw) - 90.0f; } lakilester->yaw = yaw; - dist = dist2D(playerStatus->position.x, playerStatus->position.z, + dist = dist2D(playerStatus->pos.x, playerStatus->pos.z, lakilester->moveToPos.x, lakilester->moveToPos.z); - lakilester->yaw = atan2(playerStatus->position.x, playerStatus->position.z, + lakilester->yaw = atan2(playerStatus->pos.x, playerStatus->pos.z, lakilester->moveToPos.x, lakilester->moveToPos.z); lakilester->duration = 14; lakilester->jumpScale = 1.2f; if (lakilester->moveToPos.y > lakilester->pos.y) { - lakilester->jumpVelocity = 6.0f + (lakilester->moveToPos.y - lakilester->pos.y) / 14.0f; + lakilester->jumpVel = 6.0f + (lakilester->moveToPos.y - lakilester->pos.y) / 14.0f; } else { - lakilester->jumpVelocity = 6.0f; + lakilester->jumpVel = 6.0f; } lakilester->moveSpeed = dist / lakilester->duration; @@ -857,34 +857,34 @@ API_CALLABLE(N(UseAbility)) { // fallthrough case RIDE_STATE_DISMOUNT_3: gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_IGNORE_PLAYER_Y; - playerStatus->position.y += lakilester->jumpVelocity; + playerStatus->pos.y += lakilester->jumpVel; dist = playerStatus->colliderHeight * 0.5f; - x = playerStatus->position.x; - y = playerStatus->position.y + (playerStatus->colliderHeight * 0.5f); - z = playerStatus->position.z; + x = playerStatus->pos.x; + y = playerStatus->pos.y + (playerStatus->colliderHeight * 0.5f); + z = playerStatus->pos.z; - yaw = playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].currentYaw; + yaw = playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].curYaw; if (player_raycast_up_corners(playerStatus, &x, &y, &z, &dist, yaw) >= 0) { N(AbilityState) = RIDE_STATE_FINISH_1; break; } - lakilester->jumpVelocity -= lakilester->jumpScale; - add_vec2D_polar(&playerStatus->position.x, &playerStatus->position.z, lakilester->moveSpeed, lakilester->yaw); + lakilester->jumpVel -= lakilester->jumpScale; + add_vec2D_polar(&playerStatus->pos.x, &playerStatus->pos.z, lakilester->moveSpeed, lakilester->yaw); func_800E4AD8(0); if (N(test_dismount_height)(&y) > NO_COLLIDER) { N(AbilityState) = RIDE_STATE_FINISH_1; - playerStatus->position.y = y; + playerStatus->pos.y = y; } break; } - gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; + gCameras[CAM_DEFAULT].targetPos.x = playerStatus->pos.x; gCameras[CAM_DEFAULT].targetPos.y = lakilester->moveToPos.y; - gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; + gCameras[CAM_DEFAULT].targetPos.z = playerStatus->pos.z; if (N(AbilityState) == RIDE_STATE_FINISH_1) { N(MountState) = MOUNT_STATE_NONE; @@ -963,25 +963,25 @@ API_CALLABLE(N(PutAway)) { switch (N(PutAwayState)) { case PUT_AWAY_DISMOUNT_1: N(can_dismount)(); - yaw = cam->currentYaw; + yaw = cam->curYaw; if ((playerStatus->spriteFacingAngle >= 90.0f) && (playerStatus->spriteFacingAngle < 270.0f)) { lakilester->yaw = (yaw + 180.0f) - 90.0f; } else { lakilester->yaw = (yaw + 0.0f) - 90.0f; } - sp2C = dist2D(playerStatus->position.x, playerStatus->position.z, + sp2C = dist2D(playerStatus->pos.x, playerStatus->pos.z, lakilester->moveToPos.x, lakilester->moveToPos.z); lakilester->duration = 14; if (lakilester->moveToPos.y > lakilester->pos.y ) { - lakilester->jumpVelocity = (lakilester->moveToPos.y - lakilester->pos.y) / 14.0f + 6.0f; + lakilester->jumpVel = (lakilester->moveToPos.y - lakilester->pos.y) / 14.0f + 6.0f; } else { - lakilester->jumpVelocity = 6.0f; + lakilester->jumpVel = 6.0f; } lakilester->jumpScale = 1.2f; lakilester->moveSpeed = sp2C / lakilester->duration; - lakilester->yaw = atan2(playerStatus->position.x, playerStatus->position.z, + lakilester->yaw = atan2(playerStatus->pos.x, playerStatus->pos.z, lakilester->moveToPos.x, lakilester->moveToPos.z); suggest_player_anim_allow_backward(ANIM_Mario1_BeforeJump); N(PutAwayState)++; @@ -990,33 +990,33 @@ API_CALLABLE(N(PutAway)) { suggest_player_anim_allow_backward(ANIM_Mario1_Jump); N(PutAwayState)++; case PUT_AWAY_DISMOUNT_3: - playerStatus->position.y += lakilester->jumpVelocity; - lakilester->jumpVelocity -= lakilester->jumpScale; - add_vec2D_polar(&playerStatus->position.x, &playerStatus->position.z, + playerStatus->pos.y += lakilester->jumpVel; + lakilester->jumpVel -= lakilester->jumpScale; + add_vec2D_polar(&playerStatus->pos.x, &playerStatus->pos.z, lakilester->moveSpeed, lakilester->yaw); func_800E4AD8(0); - if (lakilester->jumpVelocity <= 0.0f) { + if (lakilester->jumpVel <= 0.0f) { playerStatus->flags |= PS_FLAG_FALLING; - if (lakilester->jumpVelocity < -10.0) { - lakilester->jumpVelocity = -10.0f; + if (lakilester->jumpVel < -10.0) { + lakilester->jumpVel = -10.0f; } } - sp20 = playerStatus->position.x; - sp24 = playerStatus->position.y + playerStatus->colliderHeight; - sp28 = playerStatus->position.z; + sp20 = playerStatus->pos.x; + sp24 = playerStatus->pos.y + playerStatus->colliderHeight; + sp28 = playerStatus->pos.z; sp2C = playerStatus->colliderHeight; if (npc_raycast_down_around(0, &sp20, &sp24, &sp28, &sp2C, lakilester->yaw, lakilester->collisionDiameter)) { N(PutAwayState) = PUT_AWAY_FINISH_1; - playerStatus->position.y = sp24; + playerStatus->pos.y = sp24; } break; } - gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; - gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y; - gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; + gCameras[CAM_DEFAULT].targetPos.x = playerStatus->pos.x; + gCameras[CAM_DEFAULT].targetPos.y = playerStatus->pos.y; + gCameras[CAM_DEFAULT].targetPos.z = playerStatus->pos.z; switch (N(PutAwayState)) { case PUT_AWAY_FINISH_1: @@ -1118,7 +1118,7 @@ void N(offset_player_from_camera)(f32 speed) { Camera* currentCamera = &gCameras[gCurrentCameraID]; PlayerStatus* playerStatus = &gPlayerStatus; - add_vec2D_polar(&playerStatus->position.x, &playerStatus->position.z, speed, currentCamera->currentYaw); + add_vec2D_polar(&playerStatus->pos.x, &playerStatus->pos.z, speed, currentCamera->curYaw); } API_CALLABLE(N(EnterMap)) { @@ -1136,22 +1136,22 @@ API_CALLABLE(N(EnterMap)) { switch (script->functionTemp[0]) { case 0: if (!script->varTable[12]) { - temp_f0 = playerStatus->position.x; + temp_f0 = playerStatus->pos.x; lakilester->pos.x = temp_f0; lakilester->moveToPos.x = temp_f0; - temp_f4 = playerStatus->position.z; + temp_f4 = playerStatus->pos.z; lakilester->pos.z = temp_f4; lakilester->moveToPos.z = temp_f4; - playerStatus->position.y = lakilester->pos.y + 10.0f; + playerStatus->pos.y = lakilester->pos.y + 10.0f; partner_kill_ability_script(); } else { set_action_state(ACTION_STATE_RIDE); disable_player_static_collisions(); disable_player_input(); - lakilester->moveToPos.x = lakilester->pos.x = playerStatus->position.x; - lakilester->moveToPos.y = lakilester->pos.y = playerStatus->position.y; - lakilester->moveToPos.z = lakilester->pos.z = playerStatus->position.z; - playerStatus->position.y = lakilester->pos.y + 10.0f; + lakilester->moveToPos.x = lakilester->pos.x = playerStatus->pos.x; + lakilester->moveToPos.y = lakilester->pos.y = playerStatus->pos.y; + lakilester->moveToPos.z = lakilester->pos.z = playerStatus->pos.z; + playerStatus->pos.y = lakilester->pos.y + 10.0f; } script->functionTemp[1] = script->varTable[4]; @@ -1182,9 +1182,9 @@ API_CALLABLE(N(EnterMap)) { case 1: npc_move_heading(lakilester, lakilester->moveSpeed, lakilester->yaw); - playerStatus->position.x = lakilester->pos.x; - playerStatus->position.y = lakilester->pos.y + 10.0f; - playerStatus->position.z = lakilester->pos.z; + playerStatus->pos.x = lakilester->pos.x; + playerStatus->pos.y = lakilester->pos.y + 10.0f; + playerStatus->pos.z = lakilester->pos.z; playerStatus->targetYaw = lakilester->yaw; N(offset_player_from_camera)(2.0f); script->functionTemp[1] -= 1; diff --git a/src/world/partner/parakarry.c b/src/world/partner/parakarry.c index 46a310d174e..9777a082e75 100644 --- a/src/world/partner/parakarry.c +++ b/src/world/partner/parakarry.c @@ -87,19 +87,19 @@ API_CALLABLE(N(Update)) { N(TweesterPhysicsPtr)->state++; N(TweesterPhysicsPtr)->prevFlags = parakarry->flags; N(TweesterPhysicsPtr)->radius = fabsf(dist2D(parakarry->pos.x, parakarry->pos.z, - entity->position.x, entity->position.z)); - N(TweesterPhysicsPtr)->angle = atan2(entity->position.x, entity->position.z, + entity->pos.x, entity->pos.z)); + N(TweesterPhysicsPtr)->angle = atan2(entity->pos.x, entity->pos.z, parakarry->pos.x, parakarry->pos.z); - N(TweesterPhysicsPtr)->angularVelocity = 6.0f; - N(TweesterPhysicsPtr)->liftoffVelocityPhase = 50.0f; + N(TweesterPhysicsPtr)->angularVel = 6.0f; + N(TweesterPhysicsPtr)->liftoffVelPhase = 50.0f; N(TweesterPhysicsPtr)->countdown = 120; parakarry->flags |= NPC_FLAG_IGNORE_CAMERA_FOR_YAW | NPC_FLAG_IGNORE_PLAYER_COLLISION | NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_8; parakarry->flags &= ~NPC_FLAG_GRAVITY; case TWEESTER_PARTNER_ATTRACT: sin_cos_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->angle), &sinAngle, &cosAngle); - parakarry->pos.x = entity->position.x + (sinAngle * N(TweesterPhysicsPtr)->radius); - parakarry->pos.z = entity->position.z - (cosAngle * N(TweesterPhysicsPtr)->radius); - N(TweesterPhysicsPtr)->angle = clamp_angle(N(TweesterPhysicsPtr)->angle - N(TweesterPhysicsPtr)->angularVelocity); + parakarry->pos.x = entity->pos.x + (sinAngle * N(TweesterPhysicsPtr)->radius); + parakarry->pos.z = entity->pos.z - (cosAngle * N(TweesterPhysicsPtr)->radius); + N(TweesterPhysicsPtr)->angle = clamp_angle(N(TweesterPhysicsPtr)->angle - N(TweesterPhysicsPtr)->angularVel); if (N(TweesterPhysicsPtr)->radius > 20.0f) { N(TweesterPhysicsPtr)->radius--; @@ -107,19 +107,19 @@ API_CALLABLE(N(Update)) { N(TweesterPhysicsPtr)->radius++; } - liftoffVelocity = sin_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->liftoffVelocityPhase)) * 3.0f; - N(TweesterPhysicsPtr)->liftoffVelocityPhase += 3.0f; + liftoffVelocity = sin_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->liftoffVelPhase)) * 3.0f; + N(TweesterPhysicsPtr)->liftoffVelPhase += 3.0f; - if (N(TweesterPhysicsPtr)->liftoffVelocityPhase > 150.0f) { - N(TweesterPhysicsPtr)->liftoffVelocityPhase = 150.0f; + if (N(TweesterPhysicsPtr)->liftoffVelPhase > 150.0f) { + N(TweesterPhysicsPtr)->liftoffVelPhase = 150.0f; } parakarry->pos.y += liftoffVelocity; parakarry->renderYaw = clamp_angle(360.0f - N(TweesterPhysicsPtr)->angle); - N(TweesterPhysicsPtr)->angularVelocity += 0.8; + N(TweesterPhysicsPtr)->angularVel += 0.8; - if (N(TweesterPhysicsPtr)->angularVelocity > 40.0f) { - N(TweesterPhysicsPtr)->angularVelocity = 40.0f; + if (N(TweesterPhysicsPtr)->angularVel > 40.0f) { + N(TweesterPhysicsPtr)->angularVel = 40.0f; } if (--N(TweesterPhysicsPtr)->countdown == 0) { @@ -165,9 +165,9 @@ s32 N(update_current_floor)(void) { s32 hitResult; s32 surfaceType; - x = gPlayerStatus.position.x; - y = gPlayerStatus.position.y + (colliderBaseHeight * 0.5); - z = gPlayerStatus.position.z; + x = gPlayerStatus.pos.x; + y = gPlayerStatus.pos.y + (colliderBaseHeight * 0.5); + z = gPlayerStatus.pos.z; length = colliderBaseHeight / 2.0f; hitResult = player_raycast_below_cam_relative(&gPlayerStatus, &x, &y, &z, &length, &hitRx, @@ -218,7 +218,7 @@ API_CALLABLE(N(UseAbility)) { parakarry->flags &= ~(NPC_FLAG_JUMPING | NPC_FLAG_GRAVITY); N(UsingAbility) = TRUE; gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_IGNORE_PLAYER_Y; - parakarry->currentAnim = ANIM_WorldParakarry_CarryLight; + parakarry->curAnim = ANIM_WorldParakarry_CarryLight; partnerStatus->actingPartner = PARTNER_PARAKARRY; partnerStatus->partnerActionState = PARTNER_ACTION_PARAKARRY_HOVER; parakarry->flags &= ~NPC_FLAG_COLLDING_FORWARD_WITH_WORLD; @@ -263,7 +263,7 @@ API_CALLABLE(N(UseAbility)) { partnerStatus->partnerActionState = PARTNER_ACTION_PARAKARRY_HOVER; N(PlayerWasFacingLeft) = partner_force_player_flip_done(); enable_npc_blur(parakarry); - parakarry->yaw = atan2(parakarry->pos.x, parakarry->pos.z, playerStatus->position.x, playerStatus->position.z); + parakarry->yaw = atan2(parakarry->pos.x, parakarry->pos.z, playerStatus->pos.x, playerStatus->pos.z); parakarry->duration = 4; N(AbilityState)++; // AIR_LIFT_GATHER break; @@ -278,10 +278,10 @@ API_CALLABLE(N(UseAbility)) { N(AbilityState) = AIR_LIFT_DROP; } else { suggest_player_anim_allow_backward(ANIM_Mario1_Idle); - parakarry->moveToPos.x = playerStatus->position.x; - parakarry->moveToPos.y = playerStatus->position.y + 32.0f; - parakarry->moveToPos.z = playerStatus->position.z; - parakarry->currentAnim = ANIM_WorldParakarry_Run; + parakarry->moveToPos.x = playerStatus->pos.x; + parakarry->moveToPos.y = playerStatus->pos.y + 32.0f; + parakarry->moveToPos.z = playerStatus->pos.z; + parakarry->curAnim = ANIM_WorldParakarry_Run; add_vec2D_polar(¶karry->moveToPos.x, ¶karry->moveToPos.z, 0.0f, playerStatus->targetYaw); yaw = playerStatus->targetYaw; @@ -302,13 +302,13 @@ API_CALLABLE(N(UseAbility)) { disable_npc_blur(parakarry); parakarry->yaw = playerStatus->targetYaw; parakarry->moveSpeed = 0.2f; - parakarry->currentAnim = ANIM_WorldParakarry_CarryHeavy; + parakarry->curAnim = ANIM_WorldParakarry_CarryHeavy; parakarry->planarFlyDist = 0; suggest_player_anim_always_forward(ANIM_MarioW2_HoldOnto); sfx_play_sound_at_npc(SOUND_2009, SOUND_SPACE_MODE_0, NPC_PARTNER); gCollisionStatus.lastTouchedFloor = NO_COLLIDER; - gCollisionStatus.currentFloor = NO_COLLIDER; - parakarry->currentFloor = NO_COLLIDER; + gCollisionStatus.curFloor = NO_COLLIDER; + parakarry->curFloor = NO_COLLIDER; N(AbilityStateTime) = 20; N(AbilityState) = AIR_LIFT_PICKUP; } @@ -334,7 +334,7 @@ API_CALLABLE(N(UseAbility)) { } length = fabsf(sin_rad(DEG_TO_RAD((20 - N(AbilityStateTime)) * 18))) * 1.3; - playerStatus->position.y += length; + playerStatus->pos.y += length; parakarry->pos.y += length; x = parakarry->pos.x; y = parakarry->pos.y + parakarry->collisionHeight / 2.0f; @@ -349,23 +349,23 @@ API_CALLABLE(N(UseAbility)) { } length = playerStatus->colliderHeight / 2.0f; - x = playerStatus->position.x; - y = playerStatus->position.y + playerStatus->colliderHeight / 2.0f; - z = playerStatus->position.z; - halfCollisionHeight = playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].currentYaw; + x = playerStatus->pos.x; + y = playerStatus->pos.y + playerStatus->colliderHeight / 2.0f; + z = playerStatus->pos.z; + halfCollisionHeight = playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].curYaw; if (player_raycast_up_corners(playerStatus, &x, &y, &z, &length, halfCollisionHeight) >= 0) { suggest_player_anim_allow_backward(ANIM_Mario1_Idle); N(AbilityState) = AIR_LIFT_DROP; break; } - x = playerStatus->position.x; - y = playerStatus->position.y; - z = playerStatus->position.z; + x = playerStatus->pos.x; + y = playerStatus->pos.y; + z = playerStatus->pos.z; hitCount = npc_test_move_complex_with_slipping(COLLISION_CHANNEL_10000, &x, &y, &z, parakarry->moveSpeed, parakarry->yaw, playerStatus->colliderHeight, playerStatus->colliderDiameter); if (hitCount > 1) { - playerStatus->position.x += (x - playerStatus->position.x) / 8.0f; - playerStatus->position.z += (z - playerStatus->position.z) / 8.0f; + playerStatus->pos.x += (x - playerStatus->pos.x) / 8.0f; + playerStatus->pos.z += (z - playerStatus->pos.z) / 8.0f; parakarry->pos.x += (x - parakarry->pos.x) / 8.0f; parakarry->pos.z += (z - parakarry->pos.z) / 8.0f; } @@ -375,8 +375,8 @@ API_CALLABLE(N(UseAbility)) { z = parakarry->pos.z; hitCount = npc_test_move_complex_with_slipping(COLLISION_CHANNEL_10000, &x, &y, &z, parakarry->moveSpeed, parakarry->yaw, parakarry->collisionHeight, parakarry->collisionDiameter); if (hitCount > 1) { - playerDeltaX = (x - playerStatus->position.x) / 8.0f; - playerDeltaZ = (z - playerStatus->position.z) / 8.0f; + playerDeltaX = (x - playerStatus->pos.x) / 8.0f; + playerDeltaZ = (z - playerStatus->pos.z) / 8.0f; parakarryDeltaX = (x - parakarry->pos.x) / 8.0f; parakarryDeltaZ = (z - parakarry->pos.z) / 8.0f; @@ -388,8 +388,8 @@ API_CALLABLE(N(UseAbility)) { z = parakarry->pos.z; hitCount = npc_test_move_complex_with_slipping(COLLISION_CHANNEL_10000, &x, &y, &z, parakarry->moveSpeed, parakarry->yaw, parakarry->collisionHeight, parakarry->collisionDiameter); if (hitCount == 0) { - playerStatus->position.x += playerDeltaX; - playerStatus->position.z += playerDeltaZ; + playerStatus->pos.x += playerDeltaX; + playerStatus->pos.z += playerDeltaZ; parakarry->pos.x += parakarryDeltaX; parakarry->pos.z += parakarryDeltaZ; } @@ -397,13 +397,13 @@ API_CALLABLE(N(UseAbility)) { if (hitCount == 0 && !(playerStatus->animFlags & PA_FLAG_NPC_COLLIDED)) { add_vec2D_polar(¶karry->pos.x, ¶karry->pos.z, parakarry->moveSpeed, parakarry->yaw); - add_vec2D_polar(&playerStatus->position.x, &playerStatus->position.z, parakarry->moveSpeed, parakarry->yaw); + add_vec2D_polar(&playerStatus->pos.x, &playerStatus->pos.z, parakarry->moveSpeed, parakarry->yaw); parakarry->planarFlyDist += parakarry->moveSpeed; } - x = playerStatus->position.x; - y = playerStatus->position.y + playerStatus->colliderHeight / 2.0f; - z = playerStatus->position.z; + x = playerStatus->pos.x; + y = playerStatus->pos.y + playerStatus->colliderHeight / 2.0f; + z = playerStatus->pos.z; length = playerStatus->colliderHeight / 2.0f; if (npc_raycast_down_around(COLLISION_CHANNEL_10000, &x, &y, &z, &length, parakarry->yaw, parakarry->collisionDiameter)) { s32 surfaceType = get_collider_flags(NpcHitQueryColliderID) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; @@ -413,8 +413,8 @@ API_CALLABLE(N(UseAbility)) { N(AbilityState) = AIR_LIFT_DROP; } - playerStatus->position.y += (y - playerStatus->position.y) / 4.0f; - parakarry->pos.y = playerStatus->position.y + 32.0f; + playerStatus->pos.y += (y - playerStatus->pos.y) / 4.0f; + parakarry->pos.y = playerStatus->pos.y + 32.0f; } if (parakarry->flags & NPC_FLAG_COLLDING_FORWARD_WITH_WORLD) { @@ -423,24 +423,24 @@ API_CALLABLE(N(UseAbility)) { break; } - gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; - gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y; - gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; + gCameras[CAM_DEFAULT].targetPos.x = playerStatus->pos.x; + gCameras[CAM_DEFAULT].targetPos.y = playerStatus->pos.y; + gCameras[CAM_DEFAULT].targetPos.z = playerStatus->pos.z; if (N(AbilityStateTime) != 0) { N(AbilityStateTime)--; } else { - parakarry->jumpVelocity = -0.5f; + parakarry->jumpVel = -0.5f; parakarry->jumpScale = -0.01f; - parakarry->moveToPos.y = playerStatus->position.y; + parakarry->moveToPos.y = playerStatus->pos.y; parakarry->duration = 0; - parakarry->currentAnim = ANIM_WorldParakarry_CarryHeavy; + parakarry->curAnim = ANIM_WorldParakarry_CarryHeavy; parakarry->animationSpeed = 1.8f; - gCollisionStatus.currentFloor = NO_COLLIDER; + gCollisionStatus.curFloor = NO_COLLIDER; N(AbilityState)++; // AIR_LIFT_CARRY } break; case AIR_LIFT_CARRY: - gCollisionStatus.currentFloor = N(update_current_floor)(); + gCollisionStatus.curFloor = N(update_current_floor)(); if (playerStatus->actionState == ACTION_STATE_HIT_FIRE || playerStatus->actionState == ACTION_STATE_HIT_LAVA || playerStatus->actionState == ACTION_STATE_KNOCKBACK @@ -470,13 +470,13 @@ API_CALLABLE(N(UseAbility)) { sfx_play_sound_at_npc(SOUND_2009, SOUND_SPACE_MODE_0, NPC_PARTNER); } - parakarry->jumpVelocity -= parakarry->jumpScale; - if (parakarry->jumpVelocity > 0.0) { - parakarry->jumpVelocity = 0.0f; + parakarry->jumpVel -= parakarry->jumpScale; + if (parakarry->jumpVel > 0.0) { + parakarry->jumpVel = 0.0f; } - parakarry->pos.y += parakarry->jumpVelocity; - playerStatus->position.y += parakarry->jumpVelocity; + parakarry->pos.y += parakarry->jumpVel; + playerStatus->pos.y += parakarry->jumpVel; if (!(playerStatus->animFlags & PA_FLAG_NPC_COLLIDED)) { parakarry->moveSpeed += 0.1; if (parakarry->moveSpeed > 2.0) { @@ -484,7 +484,7 @@ API_CALLABLE(N(UseAbility)) { } add_vec2D_polar(¶karry->pos.x, ¶karry->pos.z, parakarry->moveSpeed, parakarry->yaw); - add_vec2D_polar(&playerStatus->position.x, &playerStatus->position.z, parakarry->moveSpeed, parakarry->yaw); + add_vec2D_polar(&playerStatus->pos.x, &playerStatus->pos.z, parakarry->moveSpeed, parakarry->yaw); parakarry->planarFlyDist += parakarry->moveSpeed; parakarry->animationSpeed -= 0.05; if (parakarry->animationSpeed < 1.5) { @@ -494,9 +494,9 @@ API_CALLABLE(N(UseAbility)) { parakarry->animationSpeed += 0.5; } if (!(playerStatus->animFlags & PA_FLAG_NPC_COLLIDED)) { - x = playerStatus->position.x; - y = playerStatus->position.y; - z = playerStatus->position.z; + x = playerStatus->pos.x; + y = playerStatus->pos.y; + z = playerStatus->pos.z; if (npc_test_move_complex_with_slipping(COLLISION_CHANNEL_10000, &x, &y, &z, parakarry->moveSpeed, parakarry->yaw, playerStatus->colliderHeight, playerStatus->colliderDiameter) @@ -522,19 +522,19 @@ API_CALLABLE(N(UseAbility)) { halfCollisionHeight = length; if (npc_raycast_up(COLLISION_CHANNEL_10000, &x, &y, &z, &length) && (length < halfCollisionHeight)) { parakarry->pos.y = y - parakarry->collisionHeight; - playerStatus->position.y = parakarry->pos.y - 32.0f; + playerStatus->pos.y = parakarry->pos.y - 32.0f; hitAbove = TRUE; } - x = playerStatus->position.x; - y = playerStatus->position.y + playerStatus->colliderHeight / 2.0f; - z = playerStatus->position.z; + x = playerStatus->pos.x; + y = playerStatus->pos.y + playerStatus->colliderHeight / 2.0f; + z = playerStatus->pos.z; length = playerStatus->colliderHeight / 2.0f; if (npc_raycast_down_around(COLLISION_CHANNEL_10000, &x, &y, &z, &length, parakarry->yaw, parakarry->collisionDiameter)) { - playerStatus->position.y += (y - playerStatus->position.y) / 4.0f; - parakarry->pos.y = playerStatus->position.y + 32.0f; + playerStatus->pos.y += (y - playerStatus->pos.y) / 4.0f; + parakarry->pos.y = playerStatus->pos.y + 32.0f; y = parakarry->pos.y; - parakarry->pos.y = playerStatus->position.y; + parakarry->pos.y = playerStatus->pos.y; spawn_surface_effects(parakarry, SURFACE_INTERACT_WALK); parakarry->pos.y = y; @@ -547,9 +547,9 @@ API_CALLABLE(N(UseAbility)) { if (!phys_adjust_cam_on_landing()) { gCameras[CAM_DEFAULT].moveFlags &= ~CAMERA_MOVE_FLAG_2; } - gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; - gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y; - gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; + gCameras[CAM_DEFAULT].targetPos.x = playerStatus->pos.x; + gCameras[CAM_DEFAULT].targetPos.y = playerStatus->pos.y; + gCameras[CAM_DEFAULT].targetPos.z = playerStatus->pos.z; if (!(parakarry->flags & NPC_FLAG_COLLDING_FORWARD_WITH_WORLD)) { parakarry->duration++; if (!(parakarry->planarFlyDist < 100.0f)) { @@ -577,9 +577,9 @@ API_CALLABLE(N(UseAbility)) { || N(AbilityState) == AIR_LIFT_DROP || N(AbilityState) == AIR_LIFT_CANCEL ) { - parakarry->currentAnim = ANIM_WorldParakarry_Idle; + parakarry->curAnim = ANIM_WorldParakarry_Idle; N(UsingAbility) = FALSE; - parakarry->jumpVelocity = 0.0f; + parakarry->jumpVel = 0.0f; parakarry->flags &= ~NPC_FLAG_JUMPING; parakarry->animationSpeed = 1.0f; partner_clear_player_tracking(parakarry); diff --git a/src/world/partner/sushie.c b/src/world/partner/sushie.c index a3784f6cf7b..ee3c38c7bc3 100644 --- a/src/world/partner/sushie.c +++ b/src/world/partner/sushie.c @@ -42,9 +42,9 @@ void N(sync_player_position)(void) { Camera* camera = &gCameras[CAM_DEFAULT]; s32 angleOffset; - playerStatus->position.x = partnerNPC->pos.x; - playerStatus->position.y = partnerNPC->pos.y + 16.0f; - playerStatus->position.z = partnerNPC->pos.z; + playerStatus->pos.x = partnerNPC->pos.x; + playerStatus->pos.y = partnerNPC->pos.y + 16.0f; + playerStatus->pos.z = partnerNPC->pos.z; playerStatus->targetYaw = partnerNPC->yaw; if (playerStatus->spriteFacingAngle < 90.0f || playerStatus->spriteFacingAngle > 270.0f) { @@ -53,8 +53,8 @@ void N(sync_player_position)(void) { angleOffset = 8; } - playerStatus->position.z -= cos_rad(DEG_TO_RAD( - camera->currentYaw + playerStatus->spriteFacingAngle - 90.0f + angleOffset)) * -4.0f; + playerStatus->pos.z -= cos_rad(DEG_TO_RAD( + camera->curYaw + playerStatus->spriteFacingAngle - 90.0f + angleOffset)) * -4.0f; } void N(get_movement_from_input)(f32* outAngle, f32* outSpeed) { @@ -65,7 +65,7 @@ void N(get_movement_from_input)(f32* outAngle, f32* outSpeed) { N(InputStickX) = stickX; N(InputStickY) = stickY; - moveAngle = clamp_angle(atan2(0.0f, 0.0f, stickX, -stickY) + gCameras[CAM_DEFAULT].currentYaw); + moveAngle = clamp_angle(atan2(0.0f, 0.0f, stickX, -stickY) + gCameras[CAM_DEFAULT].curYaw); moveSpeed = 0.0f; if (dist2D(0.0f, 0.0f, N(InputStickX), -N(InputStickY)) >= 1.0) { @@ -92,9 +92,9 @@ void N(test_for_water_level)(s32 ignoreFlags, f32 posX, f32 posY, f32 posZ, f32 depth = 200.0f; if (!npc_raycast_down_around(ignoreFlags, &posX, &posY, &posZ, &depth, yaw, radius)) { - collisionStatus->currentFloor = NO_COLLIDER; + collisionStatus->curFloor = NO_COLLIDER; } else { - collisionStatus->currentFloor = NpcHitQueryColliderID; + collisionStatus->curFloor = NpcHitQueryColliderID; N(WaterSurfaceY) = posY; } } @@ -154,7 +154,7 @@ void N(update_riding_physics)(Npc* sushie) { } } - moveAngle = clamp_angle(atan2(0.0f, 0.0f, N(InertialStickX), -N(InertialStickY)) + gCameras[CAM_DEFAULT].currentYaw); + moveAngle = clamp_angle(atan2(0.0f, 0.0f, N(InertialStickX), -N(InertialStickY)) + gCameras[CAM_DEFAULT].curYaw); if (N(InertialMoveSpeed) <= moveSpeed) { N(InertialMoveSpeed) += (moveSpeed - N(InertialMoveSpeed)) / moveSpeedDamping; if (N(InertialMoveSpeed) > moveSpeed) { @@ -251,7 +251,7 @@ void N(update_riding_physics)(Npc* sushie) { } } if (N(DiveState) == DIVE_STATE_DELAY) { - if ((partnerStatus->currentButtons & BUTTON_C_DOWN) && N(DiveTime) == 0) { + if ((partnerStatus->curButtons & BUTTON_C_DOWN) && N(DiveTime) == 0) { N(DiveState) = DIVE_STATE_DIVING; } } @@ -277,17 +277,17 @@ void N(update_riding_physics)(Npc* sushie) { } if (N(DiveTime) == 1) { suggest_player_anim_always_forward(ANIM_MarioW2_DiveSushie); - sushie->currentAnim = ANIM_WorldSushie_Ride; + sushie->curAnim = ANIM_WorldSushie_Ride; } - if (!N(IsUnderwater) && (playerStatus->position.y + (playerStatus->colliderHeight * 0.5f) < N(WaterSurfaceY))) { + if (!N(IsUnderwater) && (playerStatus->pos.y + (playerStatus->colliderHeight * 0.5f) < N(WaterSurfaceY))) { N(IsUnderwater) = TRUE; playerStatus->renderMode = RENDER_MODE_ALPHATEST; set_player_imgfx_all(playerStatus->trueAnimation, IMGFX_SET_WAVY, 2, 0, 0, 0, 0); npc_set_imgfx_params(sushie, IMGFX_SET_WAVY, 2, 0, 0, 0, 0); } if (N(DiveTime) >= 10) { - if (!(partnerStatus->currentButtons & BUTTON_C_DOWN) || N(DiveTime) >= 30) { - sushie->currentAnim = ANIM_WorldSushie_Rise; + if (!(partnerStatus->curButtons & BUTTON_C_DOWN) || N(DiveTime) >= 30) { + sushie->curAnim = ANIM_WorldSushie_Rise; sfx_play_sound_at_npc(SOUND_294 | SOUND_ID_TRIGGER_CHANGE_SOUND, SOUND_SPACE_MODE_0, NPC_PARTNER); N(DiveState) = DIVE_STATE_SURFACING; } @@ -321,7 +321,7 @@ void N(update_riding_physics)(Npc* sushie) { npc_set_imgfx_params(sushie, IMGFX_CLEAR, 0, 0, 0, 0, 0); } N(DiveState) = DIVE_STATE_NONE; - sushie->currentAnim = ANIM_WorldSushie_Ride; + sushie->curAnim = ANIM_WorldSushie_Ride; sushie->moveToPos.y = N(WaterSurfaceY) - (sushie->collisionHeight * 0.5f); suggest_player_anim_always_forward(ANIM_MarioW2_RideSushie); } @@ -391,7 +391,7 @@ API_CALLABLE(N(UseAbility)) { case SWIM_STATE_INIT: if (!gGameStatusPtr->keepUsingPartnerOnMapChange) { // are we colliding with a solid (non-entity) wall? - collider = collisionStatus->currentWall; + collider = collisionStatus->curWall; if (collider <= NO_COLLIDER || collider & COLLISION_WITH_ENTITY_BIT) { return ApiStatus_DONE1; } @@ -404,7 +404,7 @@ API_CALLABLE(N(UseAbility)) { } else { // resume riding state from previous map sushie->moveToPos.y = sushie->pos.y; - playerStatus->position.y = sushie->moveToPos.y + 16.0f; + playerStatus->pos.y = sushie->moveToPos.y + 16.0f; N(IsRiding) = TRUE; sushie->flags |= NPC_FLAG_8; sushie->flags &= ~NPC_FLAG_GRAVITY; @@ -413,7 +413,7 @@ API_CALLABLE(N(UseAbility)) { disable_player_shadow(); disable_npc_shadow(sushie); npc_set_imgfx_params(sushie, IMGFX_SET_WAVY, 2, 0, 0, 0, 0); - sushie->currentAnim = ANIM_WorldSushie_Ride; + sushie->curAnim = ANIM_WorldSushie_Ride; sushie->moveSpeed = playerStatus->runSpeed; sushie->jumpScale = 0.0f; partnerStatus->partnerActionState = PARTNER_ACTION_USE; @@ -427,15 +427,15 @@ API_CALLABLE(N(UseAbility)) { break; case SWIM_STATE_BEGIN: - if (collisionStatus->currentWall <= NO_COLLIDER) { + if (collisionStatus->curWall <= NO_COLLIDER) { return ApiStatus_DONE1; } // check for obstructions between player and center of current wall - get_collider_center(collisionStatus->currentWall, &x, &y, &z); - angle = atan2(x, z, playerStatus->position.x, playerStatus->position.z); - x = playerStatus->position.x; - y = playerStatus->position.y; - z = playerStatus->position.z; + get_collider_center(collisionStatus->curWall, &x, &y, &z); + angle = atan2(x, z, playerStatus->pos.x, playerStatus->pos.z); + x = playerStatus->pos.x; + y = playerStatus->pos.y; + z = playerStatus->pos.z; collider = N(test_ray_to_wall_center)(0, &x, &y, &z, playerStatus->colliderDiameter * 0.5f, 2.0f * playerStatus->colliderDiameter, &angle); // check surface type for wall @@ -452,9 +452,9 @@ API_CALLABLE(N(UseAbility)) { disable_player_static_collisions(); disable_player_input(); sushie->collisionChannel = COLLISION_CHANNEL_80000; - sushie->moveToPos.x = playerStatus->position.x; - sushie->moveToPos.y = playerStatus->position.y; - sushie->moveToPos.z = playerStatus->position.z; + sushie->moveToPos.x = playerStatus->pos.x; + sushie->moveToPos.y = playerStatus->pos.y; + sushie->moveToPos.z = playerStatus->pos.z; sushie->yaw = angle; playerStatus->targetYaw = angle; sushie->renderYaw = 90.0f; @@ -465,7 +465,7 @@ API_CALLABLE(N(UseAbility)) { dist = 100.0f; collider = npc_raycast_down_around(sushie->collisionChannel, &x, &y, &z, &dist, sushie->yaw, sushie->collisionDiameter); - sushie->currentAnim = ANIM_WorldSushie_Run; + sushie->curAnim = ANIM_WorldSushie_Run; sushie->duration = 12; sushie->moveToPos.y = y - (sushie->collisionHeight * 0.5f); suggest_player_anim_allow_backward(ANIM_Mario1_Idle); @@ -489,15 +489,15 @@ API_CALLABLE(N(UseAbility)) { sushie->flags &= ~(NPC_FLAG_GRAVITY | NPC_FLAG_IGNORE_WORLD_COLLISION); disable_npc_shadow(sushie); npc_set_imgfx_params(sushie, IMGFX_SET_WAVY, 2, 0, 0, 0, 0); - sushie->currentAnim = ANIM_WorldSushie_Ride; + sushie->curAnim = ANIM_WorldSushie_Ride; playerStatus->flags |= PS_FLAG_MOVEMENT_LOCKED; - dist = dist2D(playerStatus->position.x, playerStatus->position.z, sushie->moveToPos.x, sushie->moveToPos.z); - sushie->jumpVelocity = 5.0f; + dist = dist2D(playerStatus->pos.x, playerStatus->pos.z, sushie->moveToPos.x, sushie->moveToPos.z); + sushie->jumpVel = 5.0f; sushie->jumpScale = 0.6f; - y = sushie->moveToPos.y - playerStatus->position.y; - sushie->duration = (2.0f * sushie->jumpVelocity) / 0.6f; + y = sushie->moveToPos.y - playerStatus->pos.y; + sushie->duration = (2.0f * sushie->jumpVel) / 0.6f; sushie->moveSpeed = dist / sushie->duration; - sushie->jumpVelocity += y / sushie->duration; + sushie->jumpVel += y / sushie->duration; suggest_player_anim_allow_backward(ANIM_Mario1_Jump); script->USE_STATE++; // SWIM_STATE_EMBARK_1 fx_rising_bubble(0, sushie->pos.x, sushie->moveToPos.y + (sushie->collisionHeight * 0.5f), sushie->pos.z, 0.0f); @@ -511,15 +511,15 @@ API_CALLABLE(N(UseAbility)) { script->USE_STATE++; // fallthrough case SWIM_STATE_EMBARK_4: - playerStatus->position.y += sushie->jumpVelocity; - sushie->jumpVelocity -= sushie->jumpScale; - add_vec2D_polar(&playerStatus->position.x, &playerStatus->position.z, sushie->moveSpeed, sushie->yaw); - if (sushie->jumpVelocity <= 0.0f) { + playerStatus->pos.y += sushie->jumpVel; + sushie->jumpVel -= sushie->jumpScale; + add_vec2D_polar(&playerStatus->pos.x, &playerStatus->pos.z, sushie->moveSpeed, sushie->yaw); + if (sushie->jumpVel <= 0.0f) { suggest_player_anim_allow_backward(ANIM_Mario1_Fall); } - gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; - gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y; - gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; + gCameras[CAM_DEFAULT].targetPos.x = playerStatus->pos.x; + gCameras[CAM_DEFAULT].targetPos.y = playerStatus->pos.y; + gCameras[CAM_DEFAULT].targetPos.z = playerStatus->pos.z; if (sushie->duration != 0) { sushie->duration--; @@ -530,9 +530,9 @@ API_CALLABLE(N(UseAbility)) { playerStatus->flags &= ~PS_FLAG_MOVEMENT_LOCKED; suggest_player_anim_always_forward(ANIM_MarioW2_RideSushie); sfx_play_sound_at_npc(SOUND_2013, SOUND_SPACE_MODE_0, NPC_PARTNER); - playerStatus->position.x = sushie->pos.x; - playerStatus->position.y = sushie->pos.y; - playerStatus->position.z = sushie->pos.z; + playerStatus->pos.x = sushie->pos.x; + playerStatus->pos.y = sushie->pos.y; + playerStatus->pos.z = sushie->pos.z; playerStatus->targetYaw = sushie->yaw; sushie->moveSpeed = 3.0f; partnerStatus->partnerActionState = PARTNER_ACTION_USE; @@ -609,18 +609,18 @@ API_CALLABLE(N(UseAbility)) { if (npc_test_move_taller_with_slipping(sushie->collisionChannel, &x, &y, &z, 10.0f, sushie->yaw, sushie->collisionHeight, sushie->collisionDiameter) ) { - collisionStatus->pushingAgainstWall = sushie->currentWall = NpcHitQueryColliderID; + collisionStatus->pushingAgainstWall = sushie->curWall = NpcHitQueryColliderID; } else { collisionStatus->pushingAgainstWall = NO_COLLIDER; } - if (sushie->currentWall < 0 || sushie->currentWall & COLLISION_WITH_ENTITY_BIT) { + if (sushie->curWall < 0 || sushie->curWall & COLLISION_WITH_ENTITY_BIT) { if (N(DiveState) == DIVE_STATE_DIVING && N(DiveTime) == 1) { sfx_play_sound_at_npc(SOUND_294, SOUND_SPACE_MODE_0, NPC_PARTNER); } break; } - collider = get_collider_flags(sushie->currentWall) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; + collider = get_collider_flags(sushie->curWall) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; if (collider != SURFACE_TYPE_DOCK_WALL) { if (N(DiveState) == DIVE_STATE_DIVING && N(DiveTime) == 1) { sfx_play_sound_at_npc(SOUND_294, SOUND_SPACE_MODE_0, NPC_PARTNER); @@ -636,7 +636,7 @@ API_CALLABLE(N(UseAbility)) { // this var is a condition here collider = npc_raycast_down_around(sushie->collisionChannel, &x, &y, &z, &dist, sushie->yaw, 0.0f); if (collider) { - get_collider_center(sushie->currentWall, &x, &y, &z); + get_collider_center(sushie->curWall, &x, &y, &z); dist = dist2D(sushie->pos.x, sushie->pos.z, x, z); sin_cos_rad(DEG_TO_RAD(atan2(sushie->pos.x, sushie->pos.z, x, z)), &sinAngle, &cosAngle); x = sushie->pos.x + ((sinAngle * dist) * 0.6); @@ -646,14 +646,14 @@ API_CALLABLE(N(UseAbility)) { sushie->moveToPos.y = y; sushie->moveToPos.x = x; sushie->moveToPos.z = z; - playerStatus->targetYaw = atan2(playerStatus->position.x, playerStatus->position.z, x, z); + playerStatus->targetYaw = atan2(playerStatus->pos.x, playerStatus->pos.z, x, z); sushie->yaw = playerStatus->targetYaw; - dist = dist2D(playerStatus->position.x, playerStatus->position.z, sushie->moveToPos.x, sushie->moveToPos.z); - sushie->jumpVelocity = 5.0f; + dist = dist2D(playerStatus->pos.x, playerStatus->pos.z, sushie->moveToPos.x, sushie->moveToPos.z); + sushie->jumpVel = 5.0f; sushie->jumpScale = 0.6f; - sushie->duration = (2.0f * sushie->jumpVelocity) / 0.6f; + sushie->duration = (2.0f * sushie->jumpVel) / 0.6f; sushie->moveSpeed = dist / sushie->duration; - sushie->jumpVelocity += (sushie->moveToPos.y - playerStatus->position.y) / sushie->duration; + sushie->jumpVel += (sushie->moveToPos.y - playerStatus->pos.y) / sushie->duration; sfx_play_sound_at_npc(SOUND_JUMP_2081, SOUND_SPACE_MODE_0, NPC_PARTNER); suggest_player_anim_allow_backward(ANIM_Mario1_BeforeJump); enable_player_shadow(); @@ -667,26 +667,26 @@ API_CALLABLE(N(UseAbility)) { script->USE_STATE++; // fallthrough case SWIM_STATE_DISEMBARK_2: - if (sushie->jumpVelocity <= 0.0f) { + if (sushie->jumpVel <= 0.0f) { suggest_player_anim_allow_backward(ANIM_Mario1_Fall); script->USE_STATE++; } // fallthrough case SWIM_STATE_DISEMBARK_3: - if (sushie->jumpVelocity <= 0.0f) { - playerStatus->position.y = y = player_check_collision_below(sushie->jumpVelocity, &collider); + if (sushie->jumpVel <= 0.0f) { + playerStatus->pos.y = y = player_check_collision_below(sushie->jumpVel, &collider); if (collider > 0) { suggest_player_anim_allow_backward(ANIM_Mario1_Land); } } else { - playerStatus->position.y += sushie->jumpVelocity; + playerStatus->pos.y += sushie->jumpVel; } - sushie->jumpVelocity -= sushie->jumpScale; - gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; - gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y; - gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; + sushie->jumpVel -= sushie->jumpScale; + gCameras[CAM_DEFAULT].targetPos.x = playerStatus->pos.x; + gCameras[CAM_DEFAULT].targetPos.y = playerStatus->pos.y; + gCameras[CAM_DEFAULT].targetPos.z = playerStatus->pos.z; if (sushie->duration != 0) { - add_vec2D_polar(&playerStatus->position.x, &playerStatus->position.z, sushie->moveSpeed, sushie->yaw); + add_vec2D_polar(&playerStatus->pos.x, &playerStatus->pos.z, sushie->moveSpeed, sushie->yaw); sushie->duration--; break; } @@ -696,19 +696,19 @@ API_CALLABLE(N(UseAbility)) { sushie->flags |= NPC_FLAG_IGNORE_WORLD_COLLISION; dist = dist2D(sushie->pos.x, sushie->pos.z, sushie->moveToPos.x, sushie->moveToPos.z) + (playerStatus->colliderDiameter * 0.5f); - sushie->jumpVelocity = 8.0f; + sushie->jumpVel = 8.0f; sushie->jumpScale = 1.0f; sushie->moveSpeed = 4.0f; y = sushie->moveToPos.y - sushie->pos.y; - sushie->duration = (2.0f * sushie->jumpVelocity) / sushie->jumpScale; + sushie->duration = (2.0f * sushie->jumpVel) / sushie->jumpScale; sushie->moveSpeed = dist / sushie->duration; - sushie->jumpVelocity += y / sushie->duration; + sushie->jumpVel += y / sushie->duration; script->USE_STATE = SWIM_STATE_EXIT_WATER; } break; case SWIM_STATE_EXIT_WATER: - sushie->pos.y += sushie->jumpVelocity; - sushie->jumpVelocity -= sushie->jumpScale; + sushie->pos.y += sushie->jumpVel; + sushie->jumpVel -= sushie->jumpScale; add_vec2D_polar(&sushie->pos.x, &sushie->pos.z, sushie->moveSpeed, sushie->yaw); if (sushie->duration == 0) { enable_player_static_collisions(); @@ -796,18 +796,18 @@ API_CALLABLE(N(Update)) { N(TweesterPhysicsPtr)->state++; N(TweesterPhysicsPtr)->prevFlags = sushie->flags; N(TweesterPhysicsPtr)->radius = fabsf(dist2D(sushie->pos.x, sushie->pos.z, - entity->position.x, entity->position.z)); - N(TweesterPhysicsPtr)->angle = atan2(entity->position.x, entity->position.z, sushie->pos.x, sushie->pos.z); - N(TweesterPhysicsPtr)->angularVelocity = 6.0f; - N(TweesterPhysicsPtr)->liftoffVelocityPhase = 50.0f; + entity->pos.x, entity->pos.z)); + N(TweesterPhysicsPtr)->angle = atan2(entity->pos.x, entity->pos.z, sushie->pos.x, sushie->pos.z); + N(TweesterPhysicsPtr)->angularVel = 6.0f; + N(TweesterPhysicsPtr)->liftoffVelPhase = 50.0f; N(TweesterPhysicsPtr)->countdown = 120; sushie->flags |= NPC_FLAG_IGNORE_CAMERA_FOR_YAW | NPC_FLAG_IGNORE_PLAYER_COLLISION | NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_8; sushie->flags &= ~NPC_FLAG_GRAVITY; case TWEESTER_PARTNER_ATTRACT: sin_cos_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->angle), &sinAngle, &cosAngle); - sushie->pos.x = entity->position.x + (sinAngle * N(TweesterPhysicsPtr)->radius); - sushie->pos.z = entity->position.z - (cosAngle * N(TweesterPhysicsPtr)->radius); - N(TweesterPhysicsPtr)->angle = clamp_angle(N(TweesterPhysicsPtr)->angle - N(TweesterPhysicsPtr)->angularVelocity); + sushie->pos.x = entity->pos.x + (sinAngle * N(TweesterPhysicsPtr)->radius); + sushie->pos.z = entity->pos.z - (cosAngle * N(TweesterPhysicsPtr)->radius); + N(TweesterPhysicsPtr)->angle = clamp_angle(N(TweesterPhysicsPtr)->angle - N(TweesterPhysicsPtr)->angularVel); if (N(TweesterPhysicsPtr)->radius > 20.0f) { N(TweesterPhysicsPtr)->radius--; @@ -815,19 +815,19 @@ API_CALLABLE(N(Update)) { N(TweesterPhysicsPtr)->radius++; } - liftoffVelocity = sin_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->liftoffVelocityPhase)) * 3.0f; - N(TweesterPhysicsPtr)->liftoffVelocityPhase += 3.0f; + liftoffVelocity = sin_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->liftoffVelPhase)) * 3.0f; + N(TweesterPhysicsPtr)->liftoffVelPhase += 3.0f; - if (N(TweesterPhysicsPtr)->liftoffVelocityPhase > 150.0f) { - N(TweesterPhysicsPtr)->liftoffVelocityPhase = 150.0f; + if (N(TweesterPhysicsPtr)->liftoffVelPhase > 150.0f) { + N(TweesterPhysicsPtr)->liftoffVelPhase = 150.0f; } sushie->pos.y += liftoffVelocity; sushie->renderYaw = clamp_angle(360.0f - N(TweesterPhysicsPtr)->angle); - N(TweesterPhysicsPtr)->angularVelocity += 0.8; + N(TweesterPhysicsPtr)->angularVel += 0.8; - if (N(TweesterPhysicsPtr)->angularVelocity > 40.0f) { - N(TweesterPhysicsPtr)->angularVelocity = 40.0f; + if (N(TweesterPhysicsPtr)->angularVel > 40.0f) { + N(TweesterPhysicsPtr)->angularVel = 40.0f; } if (--N(TweesterPhysicsPtr)->countdown == 0) { @@ -915,7 +915,7 @@ API_CALLABLE(N(EnterMap)) { if (isInitialCall) { script->functionTemp[0] = 0; - N(WaterSurfaceY) = playerStatus->position.y; + N(WaterSurfaceY) = playerStatus->pos.y; } switch (script->functionTemp[0]) { @@ -923,14 +923,14 @@ API_CALLABLE(N(EnterMap)) { gGameStatusPtr->keepUsingPartnerOnMapChange = TRUE; disable_player_static_collisions(); disable_player_input(); - partnerNPC->pos.x = playerStatus->position.x; - partnerNPC->pos.z = playerStatus->position.z; - partnerNPC->pos.y = playerStatus->position.y; + partnerNPC->pos.x = playerStatus->pos.x; + partnerNPC->pos.z = playerStatus->pos.z; + partnerNPC->pos.y = playerStatus->pos.y; N(test_for_water_level)(partnerNPC->collisionChannel, partnerNPC->pos.x, partnerNPC->pos.y, partnerNPC->pos.z, partnerNPC->yaw, partnerNPC->collisionDiameter * 0.5f); partnerNPC->pos.y = N(WaterSurfaceY) - (partnerNPC->collisionHeight * 0.5f); partnerNPC->yaw = atan2(partnerNPC->pos.x, partnerNPC->pos.z, script->varTable[1], script->varTable[3]); - partnerNPC->currentAnim = ANIM_WorldSushie_Ride; + partnerNPC->curAnim = ANIM_WorldSushie_Ride; partnerNPC->jumpScale = 0.0f; partnerNPC->moveSpeed = 3.0f; partnerNPC->moveToPos.x = partnerNPC->pos.x; diff --git a/src/world/partner/watt.c b/src/world/partner/watt.c index 4ed8530d815..16a6cd3c0ec 100644 --- a/src/world/partner/watt.c +++ b/src/world/partner/watt.c @@ -122,13 +122,13 @@ API_CALLABLE(N(Update)) { if (!N(WattIsMoving)) { N(WattIsMoving) = TRUE; N(reset_static_effect)(1); - watt->currentAnim = ANIM_WorldWatt_Run; + watt->curAnim = ANIM_WorldWatt_Run; } } else { if (N(WattIsMoving)) { N(WattIsMoving) = FALSE; N(reset_static_effect)(0); - watt->currentAnim = ANIM_WorldWatt_Idle; + watt->curAnim = ANIM_WorldWatt_Idle; } } if (N(StaticEffect) != NULL) { @@ -143,18 +143,18 @@ API_CALLABLE(N(Update)) { case TWEESTER_PARTNER_INIT: N(TweesterPhysicsPtr)->state++; N(TweesterPhysicsPtr)->prevFlags = watt->flags; - N(TweesterPhysicsPtr)->radius = fabsf(dist2D(watt->pos.x, watt->pos.z, entity->position.x, entity->position.z)); - N(TweesterPhysicsPtr)->angle = atan2(entity->position.x, entity->position.z, watt->pos.x, watt->pos.z); - N(TweesterPhysicsPtr)->angularVelocity = 6.0f; - N(TweesterPhysicsPtr)->liftoffVelocityPhase = 50.0f; + N(TweesterPhysicsPtr)->radius = fabsf(dist2D(watt->pos.x, watt->pos.z, entity->pos.x, entity->pos.z)); + N(TweesterPhysicsPtr)->angle = atan2(entity->pos.x, entity->pos.z, watt->pos.x, watt->pos.z); + N(TweesterPhysicsPtr)->angularVel = 6.0f; + N(TweesterPhysicsPtr)->liftoffVelPhase = 50.0f; N(TweesterPhysicsPtr)->countdown = 120; watt->flags |= NPC_FLAG_IGNORE_CAMERA_FOR_YAW | NPC_FLAG_IGNORE_PLAYER_COLLISION | NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_8; watt->flags &= ~NPC_FLAG_GRAVITY; case TWEESTER_PARTNER_ATTRACT: sin_cos_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->angle), &sinAngle, &cosAngle); - watt->pos.x = entity->position.x + (sinAngle * N(TweesterPhysicsPtr)->radius); - watt->pos.z = entity->position.z - (cosAngle * N(TweesterPhysicsPtr)->radius); - N(TweesterPhysicsPtr)->angle = clamp_angle(N(TweesterPhysicsPtr)->angle - N(TweesterPhysicsPtr)->angularVelocity); + watt->pos.x = entity->pos.x + (sinAngle * N(TweesterPhysicsPtr)->radius); + watt->pos.z = entity->pos.z - (cosAngle * N(TweesterPhysicsPtr)->radius); + N(TweesterPhysicsPtr)->angle = clamp_angle(N(TweesterPhysicsPtr)->angle - N(TweesterPhysicsPtr)->angularVel); if (N(TweesterPhysicsPtr)->radius > 20.0f) { N(TweesterPhysicsPtr)->radius--; @@ -162,19 +162,19 @@ API_CALLABLE(N(Update)) { N(TweesterPhysicsPtr)->radius++; } - liftoffVelocity = sin_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->liftoffVelocityPhase)) * 3.0f; - N(TweesterPhysicsPtr)->liftoffVelocityPhase += 3.0f; + liftoffVelocity = sin_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->liftoffVelPhase)) * 3.0f; + N(TweesterPhysicsPtr)->liftoffVelPhase += 3.0f; - if (N(TweesterPhysicsPtr)->liftoffVelocityPhase > 150.0f) { - N(TweesterPhysicsPtr)->liftoffVelocityPhase = 150.0f; + if (N(TweesterPhysicsPtr)->liftoffVelPhase > 150.0f) { + N(TweesterPhysicsPtr)->liftoffVelPhase = 150.0f; } watt->pos.y += liftoffVelocity; watt->renderYaw = clamp_angle(360.0f - N(TweesterPhysicsPtr)->angle); - N(TweesterPhysicsPtr)->angularVelocity += 0.8; + N(TweesterPhysicsPtr)->angularVel += 0.8; - if (N(TweesterPhysicsPtr)->angularVelocity > 40.0f) { - N(TweesterPhysicsPtr)->angularVelocity = 40.0f; + if (N(TweesterPhysicsPtr)->angularVel > 40.0f) { + N(TweesterPhysicsPtr)->angularVel = 40.0f; } if (--N(TweesterPhysicsPtr)->countdown == 0) { @@ -253,7 +253,7 @@ API_CALLABLE(N(UseAbility)) { partnerStatus->shouldResumeAbility = FALSE; playerStatus->animFlags |= (PA_FLAG_USING_WATT | PA_FLAG_WATT_IN_HANDS); N(update_player_carry_anim)(); - npc->currentAnim = ANIM_WorldWatt_Idle; + npc->curAnim = ANIM_WorldWatt_Idle; N(AbilityState) = SHINING_STATE_HOLDING; script->functionTemp[1] = 2; } @@ -294,13 +294,13 @@ API_CALLABLE(N(UseAbility)) { gGameStatusPtr->keepUsingPartnerOnMapChange = FALSE; partnerStatus->partnerActionState = PARTNER_ACTION_USE; partnerStatus->actingPartner = PARTNER_WATT; - npc->moveToPos.x = playerStatus->position.x; - npc->moveToPos.y = playerStatus->position.y + 5.0f; - npc->moveToPos.z = playerStatus->position.z; - npc->currentAnim = ANIM_WorldWatt_Walk; + npc->moveToPos.x = playerStatus->pos.x; + npc->moveToPos.y = playerStatus->pos.y + 5.0f; + npc->moveToPos.z = playerStatus->pos.z; + npc->curAnim = ANIM_WorldWatt_Walk; add_vec2D_polar(&npc->moveToPos.x, &npc->moveToPos.z, 15.0f, playerStatus->targetYaw); npc->yaw = playerStatus->targetYaw; - npc->currentAnim = ANIM_WorldWatt_Idle; + npc->curAnim = ANIM_WorldWatt_Idle; playerStatus->animFlags |= PA_FLAG_WATT_IN_HANDS; N(update_player_carry_anim)(); npc_set_palswap_mode_A(npc, 1); @@ -314,13 +314,13 @@ API_CALLABLE(N(UseAbility)) { partnerStatus->partnerActionState = PARTNER_ACTION_USE; partnerStatus->actingPartner = PARTNER_WATT; partner_force_player_flip_done(); - npc->moveToPos.x = playerStatus->position.x; - npc->moveToPos.y = playerStatus->position.y + 5.0f; - npc->moveToPos.z = playerStatus->position.z; - npc->currentAnim = ANIM_WorldWatt_Walk; + npc->moveToPos.x = playerStatus->pos.x; + npc->moveToPos.y = playerStatus->pos.y + 5.0f; + npc->moveToPos.z = playerStatus->pos.z; + npc->curAnim = ANIM_WorldWatt_Walk; add_vec2D_polar(&npc->moveToPos.x, &npc->moveToPos.z, 15.0f, playerStatus->targetYaw); npc->duration = 8; - npc->yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z); + npc->yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->pos.x, playerStatus->pos.z); N(AbilityState)++; // SHINING_STATE_GATHER } break; @@ -331,7 +331,7 @@ API_CALLABLE(N(UseAbility)) { npc->duration--; if (npc->duration == 0) { npc->yaw = playerStatus->targetYaw; - npc->currentAnim = ANIM_WorldWatt_Idle; + npc->curAnim = ANIM_WorldWatt_Idle; partnerStatus->actingPartner = PARTNER_WATT; playerStatus->animFlags |= PA_FLAG_WATT_IN_HANDS; N(update_player_carry_anim)(); @@ -369,7 +369,7 @@ API_CALLABLE(N(UseAbility)) { if (N(AbilityState) == SHINING_STATE_RELEASE) { playerStatus->animFlags &= ~(PA_FLAG_WATT_IN_HANDS | PA_FLAG_USING_WATT); - npc->currentAnim = ANIM_WorldWatt_Idle; + npc->curAnim = ANIM_WorldWatt_Idle; partner_clear_player_tracking(npc); N(IsPlayerHolding) = FALSE; partnerStatus->actingPartner = PARTNER_NONE; @@ -466,7 +466,7 @@ API_CALLABLE(N(EnterMap)) { } script->functionTemp[1] = script->varTable[4]; - playerStatus->targetYaw = atan2(playerStatus->position.x, playerStatus->position.z, + playerStatus->targetYaw = atan2(playerStatus->pos.x, playerStatus->pos.z, script->varTable[1], script->varTable[3]); playerStatus->heading = playerStatus->targetYaw; move_player(script->functionTemp[1], playerStatus->heading, script->varTableF[5]); @@ -497,7 +497,7 @@ API_CALLABLE(N(EnterMap)) { void N(update_player_carry_anim)(void) { PlayerStatus* playerStatus = &gPlayerStatus; - f32 currentSpeed = playerStatus->currentSpeed; + f32 currentSpeed = playerStatus->curSpeed; AnimID anim; if (playerStatus->runSpeed <= currentSpeed) { @@ -539,19 +539,19 @@ void N(sync_held_position)(void) { } } - angle = DEG_TO_RAD(camera->currentYaw + 270.0f - gPlayerStatusPtr->spriteFacingAngle + angleOffset); + angle = DEG_TO_RAD(camera->curYaw + 270.0f - gPlayerStatusPtr->spriteFacingAngle + angleOffset); playerStatus = gPlayerStatusPtr; partnerNPC = wPartnerNpc; - partnerNPC->pos.x = playerStatus->position.x + (sin_rad(angle) * gPlayerStatusPtr->colliderDiameter * offsetScale); + partnerNPC->pos.x = playerStatus->pos.x + (sin_rad(angle) * gPlayerStatusPtr->colliderDiameter * offsetScale); new_var2 = wPartnerNpc; playerStatus = gPlayerStatusPtr; partnerNPC = new_var2; - partnerNPC->pos.z = playerStatus->position.z - (cos_rad(angle) * gPlayerStatusPtr->colliderDiameter * offsetScale); + partnerNPC->pos.z = playerStatus->pos.z - (cos_rad(angle) * gPlayerStatusPtr->colliderDiameter * offsetScale); wPartnerNpc->yaw = gPlayerStatusPtr->targetYaw; - wPartnerNpc->pos.y = gPlayerStatusPtr->position.y + 5.0f; + wPartnerNpc->pos.y = gPlayerStatusPtr->pos.y + 5.0f; } } diff --git a/src/world/partners.c b/src/world/partners.c index 10f556e429a..a979300de83 100644 --- a/src/world/partners.c +++ b/src/world/partners.c @@ -630,13 +630,13 @@ void _use_partner_ability(void) { if (partnerStatus->inputDisabledCount == 0) { partnerStatus->stickX = gGameStatusPtr->stickX[gGameStatusPtr->multiplayerEnabled]; partnerStatus->stickY = gGameStatusPtr->stickY[gGameStatusPtr->multiplayerEnabled]; - partnerStatus->currentButtons = gGameStatusPtr->currentButtons[gGameStatusPtr->multiplayerEnabled]; + partnerStatus->curButtons = gGameStatusPtr->curButtons[gGameStatusPtr->multiplayerEnabled]; partnerStatus->pressedButtons = gGameStatusPtr->pressedButtons[gGameStatusPtr->multiplayerEnabled]; partnerStatus->heldButtons = gGameStatusPtr->heldButtons[gGameStatusPtr->multiplayerEnabled]; } else { partnerStatus->stickX = 0; partnerStatus->stickY = 0; - partnerStatus->currentButtons = 0; + partnerStatus->curButtons = 0; partnerStatus->pressedButtons = 0; partnerStatus->heldButtons = 0; } @@ -682,7 +682,7 @@ void _use_partner_ability(void) { } set_time_freeze_mode(TIME_FREEZE_NORMAL); partner_free_npc(); - playerData->currentPartner = wCurrentPartnerId = NextPartnerID; + playerData->curPartner = wCurrentPartnerId = NextPartnerID; create_partner_npc(); sfx_play_sound(SOUND_E); wPartner->init(wPartnerNpc); @@ -718,12 +718,12 @@ void _use_partner_ability(void) { PartnerCommandState += 1; case 1: partner_free_npc(); - playerData->currentPartner = wCurrentPartnerId = NextPartnerID; + playerData->curPartner = wCurrentPartnerId = NextPartnerID; create_partner_npc(); wPartnerNpc->pos.x = wSavedPartnerPosX; wPartnerNpc->pos.y = wSavedPartnerPosY; wPartnerNpc->pos.z = wSavedPartnerPosZ; - wPartnerNpc->jumpVelocity = 0.0f; + wPartnerNpc->jumpVel = 0.0f; wPartnerNpc->scale.x = 1.0f; wPartnerNpc->scale.y = 1.0f; wPartnerNpc->scale.z = 1.0f; @@ -760,7 +760,7 @@ void _use_partner_ability(void) { } partner_free_npc(); PartnerCommand = PARTNER_CMD_INIT; - playerData->currentPartner = wCurrentPartnerId = NextPartnerID; + playerData->curPartner = wCurrentPartnerId = NextPartnerID; enable_player_input(); break; } @@ -770,7 +770,7 @@ void _use_partner_ability(void) { kill_script_by_ID(wPartnerCurrentScriptID); partner_free_npc(); PartnerCommand = PARTNER_CMD_INIT; - playerData->currentPartner = wCurrentPartnerId = NextPartnerID; + playerData->curPartner = wCurrentPartnerId = NextPartnerID; break; } break; @@ -778,7 +778,7 @@ void _use_partner_ability(void) { switch (PartnerCommandState) { case 0: // create the new partner disable_player_input(); - playerData->currentPartner = wCurrentPartnerId = NextPartnerID; + playerData->curPartner = wCurrentPartnerId = NextPartnerID; create_partner_npc(); wPartner->init(wPartnerNpc); PartnerCommandState += 1; @@ -808,12 +808,12 @@ void _use_partner_ability(void) { switch (PartnerCommandState) { case 0: disable_player_input(); - playerData->currentPartner = wCurrentPartnerId = NextPartnerID; + playerData->curPartner = wCurrentPartnerId = NextPartnerID; create_partner_npc(); wPartnerNpc->pos.x = wSavedPartnerPosX; wPartnerNpc->pos.y = wSavedPartnerPosY; wPartnerNpc->pos.z = wSavedPartnerPosZ; - wPartnerNpc->jumpVelocity = 0.0f; + wPartnerNpc->jumpVel = 0.0f; wPartnerNpc->scale.x = 1.0f; wPartnerNpc->scale.y = 1.0f; wPartnerNpc->scale.z = 1.0f; @@ -826,7 +826,7 @@ void _use_partner_ability(void) { wPartnerCurrentScriptID = wPartnerCurrentScript->id; wPartnerCurrentScript->groupFlags = EVT_GROUP_08 | EVT_GROUP_02; PartnerCommand = PARTNER_CMD_INIT; - wPartnerNpc->currentAnim = gPartnerAnimations[wCurrentPartnerId].fly; + wPartnerNpc->curAnim = gPartnerAnimations[wCurrentPartnerId].fly; enable_player_input(); break; } @@ -866,9 +866,9 @@ void _use_partner_ability(void) { break; case 2: if (partnerStatus->partnerActionState != 1) { - wSavedPartnerPosX = playerStatus->position.x; - wSavedPartnerPosY = playerStatus->position.y; - wSavedPartnerPosZ = playerStatus->position.z; + wSavedPartnerPosX = playerStatus->pos.x; + wSavedPartnerPosY = playerStatus->pos.y; + wSavedPartnerPosZ = playerStatus->pos.z; wPartnerCurrentScript = start_script(wPartner->update, EVT_PRIORITY_14, EVT_FLAG_RUN_IMMEDIATELY); wPartnerCurrentScript->owner2.npc = wPartnerNpc; wPartnerCurrentScriptID = wPartnerCurrentScript->id; @@ -910,9 +910,9 @@ void switch_to_partner(s32 partnerID) { NextPartnerCommand = PARTNER_CMD_PUT_AWAY; } else { NextPartnerCommand = PARTNER_CMD_TAKE_OUT; - wSavedPartnerPosX = playerStatus->position.x; - wSavedPartnerPosY = playerStatus->position.y; - wSavedPartnerPosZ = playerStatus->position.z; + wSavedPartnerPosX = playerStatus->pos.x; + wSavedPartnerPosY = playerStatus->pos.y; + wSavedPartnerPosZ = playerStatus->pos.z; } } } @@ -933,9 +933,9 @@ void partner_init_after_battle(s32 partnerID) { NextPartnerCommand = PARTNER_CMD_PUT_AWAY; } else { NextPartnerCommand = PARTNER_CMD_TAKE_OUT; - wSavedPartnerPosX = playerStatus->position.x; - wSavedPartnerPosY = playerStatus->position.y; - wSavedPartnerPosZ = playerStatus->position.z; + wSavedPartnerPosX = playerStatus->pos.x; + wSavedPartnerPosY = playerStatus->pos.y; + wSavedPartnerPosZ = playerStatus->pos.z; } } } @@ -962,7 +962,7 @@ s32 partner_use_ability(void) { && wPartner != NULL && (wPartner->canUseAbility == NULL || wPartner->canUseAbility(wPartnerNpc))) { - if (gGameStatusPtr->multiplayerEnabled && (partnerStatus->currentButtons & BUTTON_B)) { + if (gGameStatusPtr->multiplayerEnabled && (partnerStatus->curButtons & BUTTON_B)) { sfx_play_sound(SOUND_MENU_ERROR); } else if (wCurrentPartnerId != PARTNER_NONE) { D_8010CFE0 = 1; @@ -993,7 +993,7 @@ s32 partner_can_use_ability(void) { void partner_reset_data(void) { PlayerStatus* playerStatus = &gPlayerStatus; - s32 currentPartner = gPlayerData.currentPartner; + s32 currentPartner = gPlayerData.curPartner; mem_clear(&gPartnerStatus, sizeof(gPartnerStatus)); get_worker(create_worker_frontUI(_use_partner_ability, NULL)); @@ -1008,9 +1008,9 @@ void partner_reset_data(void) { } wPartner = NULL; - wSavedPartnerPosX = playerStatus->position.x; - wSavedPartnerPosY = playerStatus->position.y; - wSavedPartnerPosZ = playerStatus->position.z; + wSavedPartnerPosX = playerStatus->pos.x; + wSavedPartnerPosY = playerStatus->pos.y; + wSavedPartnerPosZ = playerStatus->pos.z; if (wCurrentPartnerId == PARTNER_NONE) { NextPartnerCommand = PARTNER_CMD_INIT; @@ -1088,7 +1088,7 @@ void partner_handle_after_battle(void) { NextPartnerCommand = PARTNER_CMD_INIT; - if (playerData->currentPartner != PARTNER_WATT && partnerStatus->actingPartner == PARTNER_WATT) { + if (playerData->curPartner != PARTNER_WATT && partnerStatus->actingPartner == PARTNER_WATT) { gPlayerStatusPtr->animFlags &= ~PA_FLAG_USING_WATT; gPlayerStatusPtr->animFlags &= ~PA_FLAG_WATT_IN_HANDS; partnerStatus->actingPartner = PARTNER_NONE; @@ -1134,9 +1134,9 @@ void partner_walking_enable(Npc* partner, s32 val) { partner->pos.z = wSavedPartnerPosZ; for (i = 0; i < ARRAY_COUNT(gPlayerMoveHistory); i++, it++) { - it->pos.x = playerStatus->position.x; - it->pos.y = playerStatus->position.y; - it->pos.z = playerStatus->position.z; + it->pos.x = playerStatus->pos.x; + it->pos.y = playerStatus->pos.y; + it->pos.z = playerStatus->pos.z; it->isJumping = FALSE; } @@ -1158,10 +1158,10 @@ void partner_walking_enable(Npc* partner, s32 val) { D_8010CFCC = 0; wPartnerMoveTime = 16; wPartnerTetherDistance = 40.0f; - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].idle; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].idle; func_800EA5B8(partner); partner->collisionChannel = COLLISION_CHANNEL_10000; - partner->jumpVelocity = 0.0f; + partner->jumpVel = 0.0f; partner->flags |= NPC_FLAG_TOUCHES_GROUND | NPC_FLAG_GRAVITY | NPC_FLAG_IGNORE_PLAYER_COLLISION; partner->jumpScale = 1.8f; } @@ -1178,16 +1178,16 @@ void partner_walking_update_player_tracking(Npc* partner) { } currentSnapshot = &gPlayerMoveHistory[gPlayerMoveHistoryIndex]; if ((!currentSnapshot->isJumping || !isPlayerJumping) && - ((currentSnapshot->pos.x != playerStatus->position.x) || (currentSnapshot->pos.y != playerStatus->position.y) - || (currentSnapshot->pos.z != playerStatus->position.z))) { + ((currentSnapshot->pos.x != playerStatus->pos.x) || (currentSnapshot->pos.y != playerStatus->pos.y) + || (currentSnapshot->pos.z != playerStatus->pos.z))) { if (D_8010CFBC != gPlayerMoveHistoryIndex + 1) { if (++gPlayerMoveHistoryIndex >= ARRAY_COUNT(gPlayerMoveHistory)) { gPlayerMoveHistoryIndex = 0; } currentSnapshot = &gPlayerMoveHistory[gPlayerMoveHistoryIndex]; - currentSnapshot->pos.x = playerStatus->position.x; - currentSnapshot->pos.y = playerStatus->position.y; - currentSnapshot->pos.z = playerStatus->position.z; + currentSnapshot->pos.x = playerStatus->pos.x; + currentSnapshot->pos.y = playerStatus->pos.y; + currentSnapshot->pos.z = playerStatus->pos.z; currentSnapshot->isJumping = isPlayerJumping; } } @@ -1207,11 +1207,11 @@ void partner_walking_update_motion(Npc* partner) { } } - if (wPartnerFollowState != 50 && fabsf(partner->pos.y - playerStatus->position.y) > 1000.0f) { - partner->pos.x = playerStatus->position.x; - partner->pos.y = playerStatus->position.y; - partner->pos.z = playerStatus->position.z; - partner->jumpVelocity = 0.0f; + if (wPartnerFollowState != 50 && fabsf(partner->pos.y - playerStatus->pos.y) > 1000.0f) { + partner->pos.x = playerStatus->pos.x; + partner->pos.y = playerStatus->pos.y; + partner->pos.z = playerStatus->pos.z; + partner->jumpVel = 0.0f; partner->jumpScale = 0.0f; partner->flags = partner->flags & ~PA_FLAG_OPENED_HIDDEN_PANEL; } @@ -1245,22 +1245,22 @@ void partner_walking_follow_player(Npc* partner) { z = partner->pos.z; partner->moveSpeed = 3.0f; - distance = dist2D(partner->pos.x, partner->pos.z, playerStatus->position.x, playerStatus->position.z); + distance = dist2D(partner->pos.x, partner->pos.z, playerStatus->pos.x, playerStatus->pos.z); if (distance >= 50.0) { partner->moveSpeed = !(playerStatus->animFlags & PA_FLAG_SPINNING) ? 5.0f : 7.0f; } if (wPartnerTetherDistance < 20.0) { partner->moveSpeed = 4.0f; } - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].run; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].run; if (!(partner->flags & NPC_FLAG_GROUNDED)) { - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].fall; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].fall; } while (TRUE) { distance = dist2D(x, z, moveHistoryX, moveHistoryZ); yaw = atan2(x, z, moveHistoryX, moveHistoryZ); if (partner->moveSpeed < distance) { - distance = dist2D(x, z, playerStatus->position.x, playerStatus->position.z); + distance = dist2D(x, z, playerStatus->pos.x, playerStatus->pos.z); if (distance >= 50.0) { break; } @@ -1277,7 +1277,7 @@ void partner_walking_follow_player(Npc* partner) { break; } else { partner->moveSpeed = 0.0f; - partner->yaw = atan2(partner->pos.x, partner->pos.z, playerStatus->position.x, playerStatus->position.z); + partner->yaw = atan2(partner->pos.x, partner->pos.z, playerStatus->pos.x, playerStatus->pos.z); } } if (D_8010CFBC == gPlayerMoveHistoryIndex) { @@ -1285,7 +1285,7 @@ void partner_walking_follow_player(Npc* partner) { partner->moveSpeed = 0.0f; partner->jumpScale = 0.0f; wPartnerFollowState = 5; - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].idle; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].idle; break; } else { D_8010CFBC++; @@ -1314,11 +1314,11 @@ void partner_walking_follow_player(Npc* partner) { partner->yaw = yaw; npc_move_heading(partner, partner->moveSpeed, partner->yaw); spawn_surface_effects(partner, (partner->moveSpeed < 4.0) ? SURFACE_INTERACT_WALK : SURFACE_INTERACT_RUN); - surfaceType = get_collider_flags(partner->currentFloor); + surfaceType = get_collider_flags(partner->curFloor); if (surfaceType == SURFACE_TYPE_SPIKES || surfaceType == SURFACE_TYPE_LAVA || (partner->flags & (NPC_FLAG_GROUNDED | NPC_FLAG_COLLDING_FORWARD_WITH_WORLD)) == (NPC_FLAG_GROUNDED | NPC_FLAG_COLLDING_FORWARD_WITH_WORLD)) { - if (!func_800EA4B0(partner->currentWall)) { + if (!func_800EA4B0(partner->curWall)) { D_8010CFBC++; if (D_8010CFBC >= 40) { D_8010CFBC = 0; @@ -1337,13 +1337,13 @@ void partner_walking_follow_player(Npc* partner) { } break; case 1: - surfaceType = get_collider_flags(partner->currentFloor); + surfaceType = get_collider_flags(partner->curFloor); if (D_8010CFBC == gPlayerMoveHistoryIndex) { if (surfaceType == SURFACE_TYPE_SPIKES || surfaceType == SURFACE_TYPE_LAVA) { moveHistoryX = partner->pos.x; - moveHistoryY = playerStatus->position.y; + moveHistoryY = playerStatus->pos.y; moveHistoryZ = partner->pos.z; - add_vec2D_polar(&moveHistoryX, &moveHistoryZ, 6.0f, atan2(partner->pos.x, partner->pos.z, playerStatus->position.x, playerStatus->position.z)); + add_vec2D_polar(&moveHistoryX, &moveHistoryZ, 6.0f, atan2(partner->pos.x, partner->pos.z, playerStatus->pos.x, playerStatus->pos.z)); } else { break; } @@ -1371,8 +1371,8 @@ void partner_walking_follow_player(Npc* partner) { distance = partner->planarFlyDist; y = partner->moveToPos.y - partner->pos.y; if (distance < wPartnerTetherDistance && !(surfaceType == SURFACE_TYPE_SPIKES || surfaceType == SURFACE_TYPE_LAVA)) { - partner->jumpVelocity = 0.0f; - partner->yaw = atan2(partner->pos.x, partner->pos.z, playerStatus->position.x, playerStatus->position.z); + partner->jumpVel = 0.0f; + partner->yaw = atan2(partner->pos.x, partner->pos.z, playerStatus->pos.x, playerStatus->pos.z); wPartnerFollowState = 0; return; } @@ -1381,17 +1381,17 @@ void partner_walking_follow_player(Npc* partner) { partner->duration = 10; } partner->moveSpeed = partner->planarFlyDist / partner->duration; - partner->jumpVelocity = (y + partner->jumpScale * partner->duration * partner->duration * 0.5f) / partner->duration; - if (partner->jumpVelocity > 20.0) { - partner->jumpVelocity = 20.0f; + partner->jumpVel = (y + partner->jumpScale * partner->duration * partner->duration * 0.5f) / partner->duration; + if (partner->jumpVel > 20.0) { + partner->jumpVel = 20.0f; } - if (partner->jumpVelocity < 0.0) { - partner->jumpVelocity = 0.0f; + if (partner->jumpVel < 0.0) { + partner->jumpVel = 0.0f; } if (!(surfaceType == SURFACE_TYPE_SPIKES || surfaceType == SURFACE_TYPE_LAVA)) { - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].jump; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].jump; } else { - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].hurt; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].hurt; } partner->moveToPos.x = partner->pos.x; @@ -1401,42 +1401,42 @@ void partner_walking_follow_player(Npc* partner) { wPartnerFollowState = 2; // fallthrough case 2: - partner->jumpVelocity -= partner->jumpScale; - partner->pos.y += partner->jumpVelocity; - if (partner->jumpVelocity <= 0.0f) { - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].fall; + partner->jumpVel -= partner->jumpScale; + partner->pos.y += partner->jumpVel; + if (partner->jumpVel <= 0.0f) { + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].fall; } if (partner->pos.y < -2000.0f) { - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].fly; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].fly; partner->flags &= ~NPC_FLAG_JUMPING; - partner->jumpVelocity = 0.0f; - partner->yaw = atan2(partner->pos.x, partner->pos.z, playerStatus->position.x, playerStatus->position.z); - partner->pos.x = playerStatus->position.x; - partner->pos.y = playerStatus->position.y; - partner->pos.z = playerStatus->position.z; + partner->jumpVel = 0.0f; + partner->yaw = atan2(partner->pos.x, partner->pos.z, playerStatus->pos.x, playerStatus->pos.z); + partner->pos.x = playerStatus->pos.x; + partner->pos.y = playerStatus->pos.y; + partner->pos.z = playerStatus->pos.z; wPartnerFollowState = 5; return; } - if (partner->jumpVelocity <= 0.0f) { - distance = fabsf(partner->jumpVelocity) + 11.0f; + if (partner->jumpVel <= 0.0f) { + distance = fabsf(partner->jumpVel) + 11.0f; x = partner->pos.x; y = partner->pos.y + distance; z = partner->pos.z; if (npc_raycast_down_around(partner->collisionChannel, &x, &y, &z, &distance, partner->yaw, partner->collisionDiameter) != 0) { - if (distance <= fabsf(partner->jumpVelocity) + 22.0f) { - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].fly; + if (distance <= fabsf(partner->jumpVel) + 22.0f) { + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].fly; partner->flags &= ~NPC_FLAG_JUMPING; - partner->jumpVelocity = 0.0f; + partner->jumpVel = 0.0f; partner->pos.y = y; - partner->yaw = atan2(x, z, playerStatus->position.x, playerStatus->position.z); + partner->yaw = atan2(x, z, playerStatus->pos.x, playerStatus->pos.z); spawn_surface_effects(partner, SURFACE_INTERACT_LAND); wPartnerFollowState = 0; distance = dist2D(partner->pos.x, partner->pos.z, partner->moveToPos.x, partner->moveToPos.z); if (distance < 5.0) { - partner->pos.x = playerStatus->position.x; - partner->pos.y = playerStatus->position.y; - partner->pos.z = playerStatus->position.z; - add_vec2D_polar(&partner->pos.x, &partner->pos.z, 5.0f, clamp_angle((cameras[CAM_DEFAULT].currentYaw + 90.0f) - playerStatus->spriteFacingAngle)); + partner->pos.x = playerStatus->pos.x; + partner->pos.y = playerStatus->pos.y; + partner->pos.z = playerStatus->pos.z; + add_vec2D_polar(&partner->pos.x, &partner->pos.z, 5.0f, clamp_angle((cameras[CAM_DEFAULT].curYaw + 90.0f) - playerStatus->spriteFacingAngle)); wPartnerFollowState = 5; } break; @@ -1452,32 +1452,32 @@ void partner_walking_follow_player(Npc* partner) { x = partner->pos.x; y = partner->pos.y; z = partner->pos.z; - distance = dist2D(partner->pos.x, partner->pos.z, playerStatus->position.x, playerStatus->position.z); + distance = dist2D(partner->pos.x, partner->pos.z, playerStatus->pos.x, playerStatus->pos.z); if (distance <= wPartnerTetherDistance) { if (D_8010CFCA == 0) { partner->moveSpeed = 0.0f; partner->jumpScale = 0.0f; - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].idle; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].idle; if (playerStatus->actionState == ACTION_STATE_TALK) { D_8010CFCA = 0; } - surfaceType = get_collider_flags(partner->currentFloor); + surfaceType = get_collider_flags(partner->curFloor); if (surfaceType == SURFACE_TYPE_SPIKES || surfaceType == SURFACE_TYPE_LAVA) { wPartnerFollowState = 0; return; } } else { - temp_a3 = clamp_angle(cameras[CAM_DEFAULT].currentYaw + (playerStatus->spriteFacingAngle < 180.0f ? 90.0f : -90.0f)); - partner->moveToPos.x = playerStatus->position.x; - partner->moveToPos.y = playerStatus->position.y; - partner->moveToPos.z = playerStatus->position.z; + temp_a3 = clamp_angle(cameras[CAM_DEFAULT].curYaw + (playerStatus->spriteFacingAngle < 180.0f ? 90.0f : -90.0f)); + partner->moveToPos.x = playerStatus->pos.x; + partner->moveToPos.y = playerStatus->pos.y; + partner->moveToPos.z = playerStatus->pos.z; add_vec2D_polar(&partner->moveToPos.x, &partner->moveToPos.z, wPartnerTetherDistance - 10.0f, temp_a3); yaw = atan2(partner->pos.x, partner->pos.z, partner->moveToPos.x, partner->moveToPos.z); distance = dist2D(partner->pos.x, partner->pos.z, partner->moveToPos.x, partner->moveToPos.z); partner->moveSpeed = 2.0f; if (distance > 2.0f) { partner->yaw = yaw; - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].run; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].run; if (!(partner->flags & NPC_FLAG_COLLDING_FORWARD_WITH_WORLD)) { D_800F803A = 0; } else { @@ -1487,18 +1487,18 @@ void partner_walking_follow_player(Npc* partner) { partner->moveSpeed = 0.0f; partner->jumpScale = 0.0f; partner->renderYaw = yaw; - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].idle; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].idle; if (D_8010CFCA == 2 || playerStatus->actionState == ACTION_STATE_TALK) { D_8010CFCA = 0; } } } } else { - yaw = atan2(partner->pos.x, partner->pos.z, playerStatus->position.x, playerStatus->position.z); + yaw = atan2(partner->pos.x, partner->pos.z, playerStatus->pos.x, playerStatus->pos.z); partner->yaw = yaw; partner->moveSpeed = 0.0f; partner->jumpScale = 0.0f; - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].idle; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].idle; if (D_8010CFCA == 2 || playerStatus->actionState == ACTION_STATE_TALK) { D_8010CFCA = 0; } @@ -1517,7 +1517,7 @@ void partner_walking_follow_player(Npc* partner) { npc_move_heading(partner, partner->moveSpeed, partner->yaw); partner->moveSpeed = 0.0f; partner->jumpScale = 0.0f; - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].idle; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].idle; if (D_8010CFCA == 2) { D_8010CFCA = 0; } else if (playerStatus->actionState == ACTION_STATE_TALK) { @@ -1530,7 +1530,7 @@ void partner_walking_follow_player(Npc* partner) { break; } } - distance = dist2D(partner->pos.x, partner->pos.z, playerStatus->position.x, playerStatus->position.z); + distance = dist2D(partner->pos.x, partner->pos.z, playerStatus->pos.x, playerStatus->pos.z); if (distance <= wPartnerTetherDistance) { if (!func_800EA4B0(NpcHitQueryColliderID)) { D_8010CFCA = 2; @@ -1541,7 +1541,7 @@ void partner_walking_follow_player(Npc* partner) { break; } yaw = atan2(partner->pos.x, partner->pos.z, moveHistoryX, moveHistoryZ); - if (fabsf(get_clamped_angle_diff(yaw, atan2(partner->pos.x, partner->pos.z, playerStatus->position.x, playerStatus->position.z))) < 90.0f) { + if (fabsf(get_clamped_angle_diff(yaw, atan2(partner->pos.x, partner->pos.z, playerStatus->pos.x, playerStatus->pos.z))) < 90.0f) { break; } if (D_8010CFBC == gPlayerMoveHistoryIndex) { @@ -1564,7 +1564,7 @@ void partner_walking_follow_player(Npc* partner) { break; } yaw = atan2(partner->pos.x, partner->pos.z, moveHistoryX, moveHistoryZ); - if (fabsf(get_clamped_angle_diff(yaw, atan2(partner->pos.x, partner->pos.z, playerStatus->position.x, playerStatus->position.z))) < 90.0f) { + if (fabsf(get_clamped_angle_diff(yaw, atan2(partner->pos.x, partner->pos.z, playerStatus->pos.x, playerStatus->pos.z))) < 90.0f) { break; } if (D_8010CFBC == gPlayerMoveHistoryIndex) { @@ -1586,14 +1586,14 @@ void partner_walking_follow_player(Npc* partner) { switch (D_8010CFCE) { case 0: angle = clamp_angle(func_800E5348() + 180.0f); - partner->moveToPos.x = playerStatus->position.x; - partner->moveToPos.y = playerStatus->position.y; - partner->moveToPos.z = playerStatus->position.z; + partner->moveToPos.x = playerStatus->pos.x; + partner->moveToPos.y = playerStatus->pos.y; + partner->moveToPos.z = playerStatus->pos.z; add_vec2D_polar(&partner->moveToPos.x, &partner->moveToPos.z, playerStatus->colliderDiameter, angle); distance = dist2D(partner->pos.x, partner->pos.z, partner->moveToPos.x, partner->moveToPos.z); wPartnerMoveSpeed = distance / wPartnerMoveTime; partner->moveSpeed = wPartnerMoveSpeed; - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].anims[wPartnerMoveSpeed >= 4.0 ? PARTNER_ANIM_INDEX_RUN : PARTNER_ANIM_INDEX_WALK]; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].anims[wPartnerMoveSpeed >= 4.0 ? PARTNER_ANIM_INDEX_RUN : PARTNER_ANIM_INDEX_WALK]; yaw = atan2(partner->pos.x, partner->pos.z, partner->moveToPos.x, partner->moveToPos.z); partner->yaw = D_800F8034 = yaw; D_8010CFCE++; @@ -1602,20 +1602,20 @@ void partner_walking_follow_player(Npc* partner) { if (wPartnerMoveTime != 0) { wPartnerMoveTime--; if (partner->jumpScale != 0.0f) { - partner->jumpVelocity -= partner->jumpScale; - partner->pos.y += partner->jumpVelocity; - if (partner->jumpVelocity <= 0.0f) { - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].fall; + partner->jumpVel -= partner->jumpScale; + partner->pos.y += partner->jumpVel; + if (partner->jumpVel <= 0.0f) { + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].fall; } - if (partner->jumpVelocity <= 0.0f) { - distance = fabsf(partner->jumpVelocity) + 11.0f; + if (partner->jumpVel <= 0.0f) { + distance = fabsf(partner->jumpVel) + 11.0f; x = partner->pos.x; y = partner->pos.y + distance; z = partner->pos.z; - if ((npc_raycast_down_around(partner->collisionChannel, &x, &y, &z, &distance, partner->yaw, partner->collisionDiameter) != 0) && (distance <= (fabsf(partner->jumpVelocity) + 22.0f))) { - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].anims[partner->moveSpeed >= 4.0 ? PARTNER_ANIM_INDEX_RUN : PARTNER_ANIM_INDEX_WALK]; + if ((npc_raycast_down_around(partner->collisionChannel, &x, &y, &z, &distance, partner->yaw, partner->collisionDiameter) != 0) && (distance <= (fabsf(partner->jumpVel) + 22.0f))) { + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].anims[partner->moveSpeed >= 4.0 ? PARTNER_ANIM_INDEX_RUN : PARTNER_ANIM_INDEX_WALK]; partner->jumpScale = 0.0f; - partner->jumpVelocity = 0.0f; + partner->jumpVel = 0.0f; partner->pos.y = y; partner->flags &= ~NPC_FLAG_JUMPING; } @@ -1629,8 +1629,8 @@ void partner_walking_follow_player(Npc* partner) { partner_clear_player_tracking(partner); partner->moveSpeed = 0.0f; partner->jumpScale = 0.0f; - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].idle; - partner->yaw = clamp_angle((cameras[CAM_DEFAULT].currentYaw + 270.0f) - playerStatus->spriteFacingAngle); + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].idle; + partner->yaw = clamp_angle((cameras[CAM_DEFAULT].curYaw + 270.0f) - playerStatus->spriteFacingAngle); wPartnerMoveTime = 30; D_8010CFCE++; } @@ -1650,41 +1650,41 @@ void partner_walking_follow_player(Npc* partner) { break; case 40: if (partner->flags & NPC_FLAG_GROUNDED) { - if (func_800EA4B0(partner->currentFloor)) { + if (func_800EA4B0(partner->curFloor)) { wPartnerFollowState = 50; - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].idle; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].idle; } else { wPartnerFollowState = 1; } break; } partner->jumpScale = 3.0f; - partner->jumpVelocity -= partner->jumpScale; - partner->pos.y += partner->jumpVelocity; - if (partner->jumpVelocity <= 0.0f) { - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].fall; + partner->jumpVel -= partner->jumpScale; + partner->pos.y += partner->jumpVel; + if (partner->jumpVel <= 0.0f) { + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].fall; } if (partner->pos.y < -2000.0f) { - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].idle; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].idle; partner->flags &= ~NPC_FLAG_JUMPING; - partner->jumpVelocity = 0.0f; - partner->yaw = atan2(partner->pos.x, partner->pos.z, playerStatus->position.x, playerStatus->position.z); - partner->pos.x = playerStatus->position.x; - partner->pos.y = playerStatus->position.y; - partner->pos.z = playerStatus->position.z; + partner->jumpVel = 0.0f; + partner->yaw = atan2(partner->pos.x, partner->pos.z, playerStatus->pos.x, playerStatus->pos.z); + partner->pos.x = playerStatus->pos.x; + partner->pos.y = playerStatus->pos.y; + partner->pos.z = playerStatus->pos.z; wPartnerFollowState = 50; return; } - distance = fabsf(partner->jumpVelocity) + 11.0f; + distance = fabsf(partner->jumpVel) + 11.0f; x = partner->pos.x; y = partner->pos.y + distance; z = partner->pos.z; if (npc_raycast_down_around(partner->collisionChannel, &x, &y, &z, &distance, partner->yaw, partner->collisionDiameter) != 0) { - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].idle; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].idle; partner->flags &= ~NPC_FLAG_JUMPING; - partner->jumpVelocity = 0.0f; + partner->jumpVel = 0.0f; partner->pos.y = y; - partner->yaw = atan2(x, z, playerStatus->position.x, playerStatus->position.z); + partner->yaw = atan2(x, z, playerStatus->pos.x, playerStatus->pos.z); spawn_surface_effects(partner, SURFACE_INTERACT_LAND); wPartnerFollowState = 50; } @@ -1734,7 +1734,7 @@ void partner_flying_enable(Npc* partner, s32 val) { D_8010CFCC = 0; wPartnerMoveTime = 16; wPartnerTetherDistance = 40.0f; - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].idle; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].idle; func_800EA5B8(partner); partner->collisionChannel = COLLISION_CHANNEL_10000; partner->flags |= NPC_FLAG_IGNORE_PLAYER_COLLISION; @@ -1747,21 +1747,21 @@ void partner_flying_update_player_tracking(Npc* partner) { f32 effectiveY; s32 isPlayerJumping = FALSE; - effectiveY = playerStatus->position.y; + effectiveY = playerStatus->pos.y; if ((playerStatus->actionState == ACTION_STATE_HIT_LAVA) || (playerStatus->actionState == ACTION_STATE_HIT_FIRE)) { - effectiveY = playerStatus->lastGoodPosition.y + partner->collisionHeight + 5; + effectiveY = playerStatus->lastGoodPos.y + partner->collisionHeight + 5; } currentSnapshot = &gPlayerMoveHistory[gPlayerMoveHistoryIndex]; - if ((!currentSnapshot->isJumping || !isPlayerJumping) && (currentSnapshot->pos.x != playerStatus->position.x || currentSnapshot->pos.y != effectiveY - || currentSnapshot->pos.z != playerStatus->position.z)) { + if ((!currentSnapshot->isJumping || !isPlayerJumping) && (currentSnapshot->pos.x != playerStatus->pos.x || currentSnapshot->pos.y != effectiveY + || currentSnapshot->pos.z != playerStatus->pos.z)) { if (D_8010CFBC != gPlayerMoveHistoryIndex + 1) { if (++gPlayerMoveHistoryIndex >= ARRAY_COUNT(gPlayerMoveHistory)) { gPlayerMoveHistoryIndex = 0; } currentSnapshot = &gPlayerMoveHistory[gPlayerMoveHistoryIndex]; - currentSnapshot->pos.x = playerStatus->position.x; + currentSnapshot->pos.x = playerStatus->pos.x; currentSnapshot->pos.y = effectiveY; - currentSnapshot->pos.z = playerStatus->position.z; + currentSnapshot->pos.z = playerStatus->pos.z; currentSnapshot->isJumping = isPlayerJumping; } } @@ -1786,11 +1786,11 @@ void partner_flying_update_motion(Npc* partner) { partnerStatus->partnerAction_unk_2 = FALSE; } } - if (wPartnerFollowState != 50 && fabsf(partner->pos.y - playerStatus->position.y) > 1000.0f) { - partner->pos.x = playerStatus->position.x; - partner->pos.y = playerStatus->position.y; - partner->pos.z = playerStatus->position.z; - partner->jumpVelocity = 0.0f; + if (wPartnerFollowState != 50 && fabsf(partner->pos.y - playerStatus->pos.y) > 1000.0f) { + partner->pos.x = playerStatus->pos.x; + partner->pos.y = playerStatus->pos.y; + partner->pos.z = playerStatus->pos.z; + partner->jumpVel = 0.0f; partner->jumpScale = 0.0f; partner->flags &= ~NPC_FLAG_JUMPING; } @@ -1814,15 +1814,15 @@ void partner_flying_update_motion(Npc* partner) { z = partner->pos.z; hitDepth = 1000.0f; if (npc_raycast_down_around(COLLISION_CHANNEL_10000, &x, &y, &z, &hitDepth, partner->yaw, partner->collisionDiameter) == 0) { - y = playerStatus->position.y; + y = playerStatus->pos.y; } if (partner->pos.y <= y + partner->collisionHeight + 2.0f) { - if (playerStatus->currentSpeed != 0.0f) { + if (playerStatus->curSpeed != 0.0f) { D_800F84F8 = ((y + (partner->collisionHeight / 2) + 2.0f) - partner->pos.y) * 0.125f; } else { - if (y < playerStatus->position.y) { - var_f0 = playerStatus->position.y + 10.0f - partner->pos.y; + if (y < playerStatus->pos.y) { + var_f0 = playerStatus->pos.y + 10.0f - partner->pos.y; } else { var_f0 = y + 10.0f - partner->pos.y; } @@ -1830,13 +1830,13 @@ void partner_flying_update_motion(Npc* partner) { D_800F84F8 = var_f0 * var_f2; } } else { - if (playerStatus->position.y + playerStatus->colliderHeight < y) { + if (playerStatus->pos.y + playerStatus->colliderHeight < y) { D_800F84F8 = (y + partner->collisionHeight - partner->pos.y) * 0.125f; if (partner->pos.y + D_800F84F8 <= y + partner->collisionHeight) { D_800F84F8 = (y + partner->collisionHeight - partner->pos.y) * 0.25f; } } else { - var_f0 = (playerStatus->position.y + playerStatus->colliderHeight + 5.0f) - partner->pos.y; + var_f0 = (playerStatus->pos.y + playerStatus->colliderHeight + 5.0f) - partner->pos.y; var_f2 = 0.0625f; D_800F84F8 = var_f0 * var_f2; } @@ -1880,9 +1880,9 @@ void partner_flying_follow_player(Npc* partner) { partner->pos.y = y + (moveHistoryY + 20.0f + var_f12 - y) * 0.125f; partner->moveSpeed = 3.0f; y = partner->pos.y; - distance = dist2D(partner->pos.x, partner->pos.z, playerStatus->position.x, playerStatus->position.z); + distance = dist2D(partner->pos.x, partner->pos.z, playerStatus->pos.x, playerStatus->pos.z); if (distance >= 50.0) { - if (partner->pos.y >= playerStatus->position.y) { + if (partner->pos.y >= playerStatus->pos.y) { partner->moveSpeed = distance * 0.25f; } else { partner->moveSpeed = 8.0f; @@ -1896,7 +1896,7 @@ void partner_flying_follow_player(Npc* partner) { yaw = atan2(x, z, moveHistoryX, moveHistoryZ); distance = dist2D(x, z, moveHistoryX, moveHistoryZ); if (partner->moveSpeed < distance) { - if (partner->pos.y >= playerStatus->position.y) { + if (partner->pos.y >= playerStatus->pos.y) { if (partner->moveSpeed >= distance * 0.25f) { partner->moveSpeed = distance * 0.25f; } else { @@ -1915,16 +1915,16 @@ void partner_flying_follow_player(Npc* partner) { yaw = partner->yaw; partner->moveSpeed = 0.0f; partner->jumpScale = 0.0f; - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].idle; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].idle; break; } - distance = dist2D(partner->pos.x, partner->pos.z, playerStatus->position.x, playerStatus->position.z); + distance = dist2D(partner->pos.x, partner->pos.z, playerStatus->pos.x, playerStatus->pos.z); if (distance <= wPartnerTetherDistance) { wPartnerFollowState = 5; yaw = partner->yaw; partner->moveSpeed = 0.0f; partner->jumpScale = 0.0f; - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].idle; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].idle; break; } D_8010CFBC++; @@ -1973,8 +1973,8 @@ void partner_flying_follow_player(Npc* partner) { } if (wPartnerFollowState == 1) { if (distance < wPartnerTetherDistance) { - partner->jumpVelocity = 0.0f; - partner->yaw = atan2(partner->pos.x, partner->pos.z, playerStatus->position.x, playerStatus->position.z); + partner->jumpVel = 0.0f; + partner->yaw = atan2(partner->pos.x, partner->pos.z, playerStatus->pos.x, playerStatus->pos.z); wPartnerFollowState = 5; return; } @@ -1987,30 +1987,30 @@ void partner_flying_follow_player(Npc* partner) { partner->duration = 10; } - partner->jumpVelocity = (y + (partner->jumpScale * partner->duration * partner->duration * 0.5f)) / partner->duration; - if (partner->jumpVelocity > 20.0) { - partner->jumpVelocity = 20.0f; + partner->jumpVel = (y + (partner->jumpScale * partner->duration * partner->duration * 0.5f)) / partner->duration; + if (partner->jumpVel > 20.0) { + partner->jumpVel = 20.0f; } wPartnerFollowState = 2; - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].jump; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].jump; partner->moveToPos.x = partner->pos.x; partner->moveToPos.y = partner->pos.y; partner->moveToPos.z = partner->pos.z; } break; case 2: - partner->jumpVelocity -= partner->jumpScale; - partner->pos.y += partner->jumpVelocity; - if (partner->jumpVelocity <= 0.0f) { - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].fall; + partner->jumpVel -= partner->jumpScale; + partner->pos.y += partner->jumpVel; + if (partner->jumpVel <= 0.0f) { + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].fall; } npc_move_heading(partner, partner->moveSpeed, partner->yaw); - if (partner->jumpVelocity <= 0.0f) { + if (partner->jumpVel <= 0.0f) { if (partner->pos.y < partner->moveToPos.y) { - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].fly; - partner->jumpVelocity = 0.0f; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].fly; + partner->jumpVel = 0.0f; partner->pos.y = partner->moveToPos.y; - partner->yaw = atan2(partner->pos.x, partner->pos.z, playerStatus->position.x, playerStatus->position.z); + partner->yaw = atan2(partner->pos.x, partner->pos.z, playerStatus->pos.x, playerStatus->pos.z); wPartnerFollowState = 0; distance = dist2D(partner->pos.x, partner->pos.z, partner->moveToPos.x, partner->moveToPos.z); if (distance < wPartnerTetherDistance) { @@ -2026,29 +2026,29 @@ void partner_flying_follow_player(Npc* partner) { currentSnapshot = &gPlayerMoveHistory[D_8010CFBC]; moveHistoryX = currentSnapshot->pos.x; moveHistoryZ = currentSnapshot->pos.z; - distance = dist2D(partner->pos.x, partner->pos.z, playerStatus->position.x, playerStatus->position.z); + distance = dist2D(partner->pos.x, partner->pos.z, playerStatus->pos.x, playerStatus->pos.z); if (distance <= wPartnerTetherDistance) { if (D_8010CFCA == 0) { - partner->pos.y = y + (((playerStatus->position.y + (playerStatus->colliderHeight - partner->collisionHeight / 2)) - partner->pos.y) * 0.03125); + partner->pos.y = y + (((playerStatus->pos.y + (playerStatus->colliderHeight - partner->collisionHeight / 2)) - partner->pos.y) * 0.03125); y = partner->pos.y; partner->moveSpeed = 0.0f; partner->jumpScale = 0.0f; - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].idle; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].idle; if (playerStatus->actionState == ACTION_STATE_TALK) { D_8010CFCA = 0; } } else { - temp_a3 = clamp_angle(camera->currentYaw + (playerStatus->spriteFacingAngle < 180.0f ? 90.0f : -90.0f)); - partner->moveToPos.x = playerStatus->position.x; - partner->moveToPos.y = playerStatus->position.y; - partner->moveToPos.z = playerStatus->position.z; + temp_a3 = clamp_angle(camera->curYaw + (playerStatus->spriteFacingAngle < 180.0f ? 90.0f : -90.0f)); + partner->moveToPos.x = playerStatus->pos.x; + partner->moveToPos.y = playerStatus->pos.y; + partner->moveToPos.z = playerStatus->pos.z; add_vec2D_polar(&partner->moveToPos.x, &partner->moveToPos.z, wPartnerTetherDistance - 10.0f, temp_a3); yaw = atan2(partner->pos.x, partner->pos.z, partner->moveToPos.x, partner->moveToPos.z); distance = dist2D(partner->pos.x, partner->pos.z, partner->moveToPos.x, partner->moveToPos.z); partner->moveSpeed = 2.0f; if (distance > 2.0f) { partner->yaw = yaw; - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].run; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].run; if (!(partner->flags & NPC_FLAG_COLLDING_FORWARD_WITH_WORLD)) { D_800F803A = 0; } else { @@ -2058,18 +2058,18 @@ void partner_flying_follow_player(Npc* partner) { partner->moveSpeed = 0.0f; partner->jumpScale = 0.0f; partner->renderYaw = yaw; - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].idle; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].idle; if (D_8010CFCA == 2 || playerStatus->actionState == ACTION_STATE_TALK) { D_8010CFCA = 0; } } } } else { - yaw = atan2(partner->pos.x, partner->pos.z, playerStatus->position.x, playerStatus->position.z); + yaw = atan2(partner->pos.x, partner->pos.z, playerStatus->pos.x, playerStatus->pos.z); partner->yaw = yaw; partner->moveSpeed = 0.0f; partner->jumpScale = 0.0f; - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].idle; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].idle; if (D_8010CFCA == 2 || playerStatus->actionState == ACTION_STATE_TALK) { D_8010CFCA = 0; } @@ -2080,12 +2080,12 @@ void partner_flying_follow_player(Npc* partner) { } } - distance = dist2D(partner->pos.x, partner->pos.z, playerStatus->position.x, playerStatus->position.z); + distance = dist2D(partner->pos.x, partner->pos.z, playerStatus->pos.x, playerStatus->pos.z); if (!(distance <= wPartnerTetherDistance)) { while (TRUE) { if (!currentSnapshot->isJumping) { yaw = atan2(partner->pos.x, partner->pos.z, moveHistoryX, moveHistoryZ); - if (!(fabsf(get_clamped_angle_diff(yaw, atan2(partner->pos.x, partner->pos.z, playerStatus->position.x, playerStatus->position.z))) < 90.0f)) { + if (!(fabsf(get_clamped_angle_diff(yaw, atan2(partner->pos.x, partner->pos.z, playerStatus->pos.x, playerStatus->pos.z))) < 90.0f)) { if (D_8010CFBC != gPlayerMoveHistoryIndex) { D_8010CFBC++; if (D_8010CFBC >= 40) { @@ -2108,13 +2108,13 @@ void partner_flying_follow_player(Npc* partner) { switch (D_8010CFCE) { case 0: temp_f0_15 = clamp_angle(func_800E5348() + 180.0f); - partner->moveToPos.x = playerStatus->position.x; - partner->moveToPos.y = playerStatus->position.y; - partner->moveToPos.z = playerStatus->position.z; + partner->moveToPos.x = playerStatus->pos.x; + partner->moveToPos.y = playerStatus->pos.y; + partner->moveToPos.z = playerStatus->pos.z; add_vec2D_polar(&partner->moveToPos.x, &partner->moveToPos.z, playerStatus->colliderDiameter, temp_f0_15); distance = dist2D(partner->pos.x, partner->pos.z, partner->moveToPos.x, partner->moveToPos.z); partner->moveSpeed = wPartnerMoveSpeed = distance / wPartnerMoveTime; - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].anims[(partner->moveSpeed < 4.0) ? PARTNER_ANIM_INDEX_WALK : PARTNER_ANIM_INDEX_RUN]; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].anims[(partner->moveSpeed < 4.0) ? PARTNER_ANIM_INDEX_WALK : PARTNER_ANIM_INDEX_RUN]; yaw = atan2(partner->pos.x, partner->pos.z, partner->moveToPos.x, partner->moveToPos.z); partner->yaw = D_800F8034 = yaw; D_8010CFCE++; @@ -2127,11 +2127,11 @@ void partner_flying_follow_player(Npc* partner) { distance = partner->collisionHeight + 1; wPartnerMoveTime--; if (npc_raycast_down_around(COLLISION_CHANNEL_10000, &x, &y, &z, &distance, partner->yaw, partner->collisionDiameter) == 0) { - if (partner->collisionHeight + 5 < fabs((partner->pos.y - playerStatus->position.y))) { - partner->pos.y += (playerStatus->position.y - partner->pos.y) / 10.0f; + if (partner->collisionHeight + 5 < fabs((partner->pos.y - playerStatus->pos.y))) { + partner->pos.y += (playerStatus->pos.y - partner->pos.y) / 10.0f; } } else { - partner->pos.y += (((playerStatus->position.y + playerStatus->colliderHeight) - partner->pos.y) * 0.125f); + partner->pos.y += (((playerStatus->pos.y + playerStatus->colliderHeight) - partner->pos.y) * 0.125f); } partner->moveSpeed = wPartnerMoveSpeed; partner->yaw = D_800F8034; @@ -2149,11 +2149,11 @@ void partner_flying_follow_player(Npc* partner) { partner_clear_player_tracking(partner); partner->moveSpeed = 0.0f; partner->jumpScale = 0.0f; - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].idle; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].idle; wPartnerFollowState = 0; D_8010CFCA = 0; D_8010CFCE = 0; - partner->yaw = clamp_angle((camera->currentYaw + 270.0f) - playerStatus->spriteFacingAngle); + partner->yaw = clamp_angle((camera->curYaw + 270.0f) - playerStatus->spriteFacingAngle); } } break; @@ -2161,7 +2161,7 @@ void partner_flying_follow_player(Npc* partner) { partner_move_to_goal(partner, TRUE); break; case 40: - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].idle; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].idle; break; case 50: break; @@ -2192,11 +2192,11 @@ s32 partner_put_away(Npc* partner) { tempMoveToZ = partner->pos.z; partner->flags &= ~NPC_FLAG_GRAVITY; partner->flags &= ~NPC_FLAG_8; - tempPosX = playerStatus->position.x; + tempPosX = playerStatus->pos.x; partner->moveToPos.x = tempPosX; - tempPosY = playerStatus->position.y + (playerStatus->colliderHeight / 2); - partner->moveToPos.y = playerStatus->position.y + (playerStatus->colliderHeight / 2); - tempPosZ = playerStatus->position.z; + tempPosY = playerStatus->pos.y + (playerStatus->colliderHeight / 2); + partner->moveToPos.y = playerStatus->pos.y + (playerStatus->colliderHeight / 2); + tempPosZ = playerStatus->pos.z; wSavedPartnerPosX = tempMoveToX; wSavedPartnerPosY = tempMoveToY; wSavedPartnerPosZ = tempMoveToZ; @@ -2208,16 +2208,16 @@ s32 partner_put_away(Npc* partner) { partner->duration = 15; partner->moveSpeed = partner->planarFlyDist / partner->duration; tempMoveToY = tempPosY - tempMoveToY; - partner->jumpVelocity = (tempMoveToY + partner->jumpScale * partner->duration * partner->duration * 0.5f) / partner->duration; - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].jump; + partner->jumpVel = (tempMoveToY + partner->jumpScale * partner->duration * partner->duration * 0.5f) / partner->duration; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].jump; enable_npc_blur(partner); wPartnerFollowState = 1; break; case 1: - partner->jumpVelocity -= partner->jumpScale; - partner->pos.y += partner->jumpVelocity; - if (partner->jumpVelocity <= 0.0f) { - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].fall; + partner->jumpVel -= partner->jumpScale; + partner->pos.y += partner->jumpVel; + if (partner->jumpVel <= 0.0f) { + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].fall; } npc_move_heading(partner, partner->moveSpeed, partner->yaw); tempDuration = partner->duration; @@ -2233,8 +2233,8 @@ s32 partner_put_away(Npc* partner) { } break; case 2: - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].fly; - partner->jumpVelocity = 0.0f; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].fly; + partner->jumpVel = 0.0f; partner->pos.y = partner->moveToPos.y; disable_npc_blur(partner); return TRUE; @@ -2260,16 +2260,16 @@ s32 partner_get_out(Npc* partner) { switch (wPartnerFollowState) { case 0: if (clamp_angle(playerStatus->spriteFacingAngle) < 180.0f) { - partner->yaw = clamp_angle(camera->currentYaw + 90.0f); + partner->yaw = clamp_angle(camera->curYaw + 90.0f); } else { - partner->yaw = clamp_angle(camera->currentYaw - 90.0f); + partner->yaw = clamp_angle(camera->curYaw - 90.0f); } - partner->moveToPos.x = playerStatus->position.x; - partner->moveToPos.y = playerStatus->position.y; + partner->moveToPos.x = playerStatus->pos.x; + partner->moveToPos.y = playerStatus->pos.y; if (wPartner->isFlying) { - partner->moveToPos.y = playerStatus->position.y; + partner->moveToPos.y = playerStatus->pos.y; } - partner->moveToPos.z = playerStatus->position.z; + partner->moveToPos.z = playerStatus->pos.z; add_vec2D_polar(&partner->moveToPos.x, &partner->moveToPos.z, playerStatus->colliderDiameter, partner->yaw); moveToX = partner->moveToPos.x; moveToY = partner->moveToPos.y; @@ -2278,29 +2278,29 @@ s32 partner_get_out(Npc* partner) { x = moveToX; y = moveToY + partner->collisionHeight; z = moveToZ; - add_vec2D_polar(&x, &z, 2.0f, gCameras[gCurrentCameraID].currentYaw); + add_vec2D_polar(&x, &z, 2.0f, gCameras[gCurrentCameraID].curYaw); hitDepth = 1000.0f; if (npc_raycast_down_around(COLLISION_CHANNEL_10000, &x, &y, &z, &hitDepth, partner->yaw, partner->collisionDiameter)) { // @bug? collider flags not properly masked with COLLIDER_FLAG_SURFACE_TYPE s32 surfaceType = get_collider_flags(NpcHitQueryColliderID); if ((surfaceType == SURFACE_TYPE_SPIKES || surfaceType == SURFACE_TYPE_LAVA) || (hitDepth > 100.0f)) { - moveToX = playerStatus->position.x; - moveToY = playerStatus->position.y; - moveToZ = playerStatus->position.z; - add_vec2D_polar(&x, &z, 2.0f, gCameras[gCurrentCameraID].currentYaw); + moveToX = playerStatus->pos.x; + moveToY = playerStatus->pos.y; + moveToZ = playerStatus->pos.z; + add_vec2D_polar(&x, &z, 2.0f, gCameras[gCurrentCameraID].curYaw); } } else { - moveToX = playerStatus->position.x; - moveToY = playerStatus->position.y; - moveToZ = playerStatus->position.z; - add_vec2D_polar(&x, &z, 2.0f, gCameras[gCurrentCameraID].currentYaw); + moveToX = playerStatus->pos.x; + moveToY = playerStatus->pos.y; + moveToZ = playerStatus->pos.z; + add_vec2D_polar(&x, &z, 2.0f, gCameras[gCurrentCameraID].curYaw); } } - x = partner->pos.x = playerStatus->position.x; - y = partner->pos.y = playerStatus->position.y + (playerStatus->colliderHeight / 2); - z = partner->pos.z = playerStatus->position.z; + x = partner->pos.x = playerStatus->pos.x; + y = partner->pos.y = playerStatus->pos.y + (playerStatus->colliderHeight / 2); + z = partner->pos.z = playerStatus->pos.z; partner->moveSpeed = 4.0f; partner->jumpScale = 1.2f; @@ -2311,21 +2311,21 @@ s32 partner_get_out(Npc* partner) { partner->duration = 10; partner->moveSpeed = partner->planarFlyDist / partner->duration; } - partner->jumpVelocity = (moveToY - y + (partner->jumpScale * partner->duration * partner->duration * 0.5f)) / + partner->jumpVel = (moveToY - y + (partner->jumpScale * partner->duration * partner->duration * 0.5f)) / partner->duration; wPartnerFollowState = 1; y = moveToY - y; - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].jump; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].jump; break; case 1: - if (partner->jumpVelocity < 0.0f && npc_try_snap_to_ground(partner, fabsf(partner->jumpVelocity))) { + if (partner->jumpVel < 0.0f && npc_try_snap_to_ground(partner, fabsf(partner->jumpVel))) { wPartnerFollowState = 2; break; } - partner->jumpVelocity -= partner->jumpScale; - partner->pos.y += partner->jumpVelocity; - if (partner->jumpVelocity <= 0.0f) { - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].fall; + partner->jumpVel -= partner->jumpScale; + partner->pos.y += partner->jumpVel; + if (partner->jumpVel <= 0.0f) { + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].fall; } npc_move_heading(partner, partner->moveSpeed, partner->yaw); npc_do_world_collision(partner); @@ -2345,7 +2345,7 @@ s32 partner_get_out(Npc* partner) { break; case 2: partner->pos.y = partner->moveToPos.y; - partner->jumpVelocity = 0.0f; + partner->jumpVel = 0.0f; partner->scale.x = 1.0f; partner->scale.y = 1.0f; partner->scale.z = 1.0f; @@ -2353,9 +2353,9 @@ s32 partner_get_out(Npc* partner) { partner->moveToPos.y = partner->pos.y; partner->moveToPos.z = partner->pos.z; partner->pos.x = partner->pos.x; - partner->pos.y = playerStatus->position.y; + partner->pos.y = playerStatus->pos.y; if (wPartner->isFlying) { - partner->pos.y = playerStatus->position.y; + partner->pos.y = playerStatus->pos.y; } partner->pos.z = partner->pos.z; partner_clear_player_tracking(partner); @@ -2452,21 +2452,21 @@ s32 partner_force_player_flip_done(void) { if (playerStatus->flipYaw[CAM_DEFAULT] == 0.0f) { if (!(playerStatus->spriteFacingAngle >= 90.0f) || !(playerStatus->spriteFacingAngle < 270.0f)) { isFacingLeft = TRUE; - playerStatus->targetYaw = clamp_angle(cameras[CAM_DEFAULT].currentYaw - 90.0f); + playerStatus->targetYaw = clamp_angle(cameras[CAM_DEFAULT].curYaw - 90.0f); } else { isFacingLeft = FALSE; - playerStatus->targetYaw = clamp_angle(cameras[CAM_DEFAULT].currentYaw + 90.0f); + playerStatus->targetYaw = clamp_angle(cameras[CAM_DEFAULT].curYaw + 90.0f); } - } else if (get_clamped_angle_diff(cameras[CAM_DEFAULT].currentYaw, playerStatus->targetYaw) < 0.0f) { + } else if (get_clamped_angle_diff(cameras[CAM_DEFAULT].curYaw, playerStatus->targetYaw) < 0.0f) { isFacingLeft = TRUE; - playerStatus->targetYaw = clamp_angle(cameras[CAM_DEFAULT].currentYaw - 90.0f); + playerStatus->targetYaw = clamp_angle(cameras[CAM_DEFAULT].curYaw - 90.0f); } else { isFacingLeft = FALSE; - playerStatus->targetYaw = clamp_angle(cameras[CAM_DEFAULT].currentYaw + 90.0f); + playerStatus->targetYaw = clamp_angle(cameras[CAM_DEFAULT].curYaw + 90.0f); } - playerStatus->currentYaw = playerStatus->targetYaw; + playerStatus->curYaw = playerStatus->targetYaw; return isFacingLeft; } @@ -2496,7 +2496,7 @@ void partner_do_player_collision(Npc* partner) { f32 W; transform_point(gCameras[CAM_DEFAULT].perspectiveMatrix, - playerStatus->position.x, playerStatus->position.y, playerStatus->position.z, 1.0f, + playerStatus->pos.x, playerStatus->pos.y, playerStatus->pos.z, 1.0f, &playerScreenX, &playerScreenY, &playerScreenZ, &W); transform_point(gCameras[CAM_DEFAULT].perspectiveMatrix, partner->pos.x, partner->pos.y, partner->pos.z, 1.0f, &partnerScreenX, &partnerScreenY, &partnerScreenZ, &W); @@ -2507,8 +2507,8 @@ void partner_do_player_collision(Npc* partner) { playerScreenY <= partner->collisionHeight + playerStatus->colliderHeight && playerScreenZ <= 4.0) { npc_move_heading(partner, 1.0f, - atan2(playerStatus->position.x, playerStatus->position.z, partner->pos.x, partner->pos.z)); - add_vec2D_polar(&partner->pos.x, &partner->pos.z, 2.0f, gCameras[gCurrentCameraID].currentYaw); + atan2(playerStatus->pos.x, playerStatus->pos.z, partner->pos.x, partner->pos.z)); + add_vec2D_polar(&partner->pos.x, &partner->pos.z, 2.0f, gCameras[gCurrentCameraID].curYaw); } } @@ -2520,7 +2520,7 @@ void partner_move_to_goal(Npc* partner, s32 isFlying) { switch (D_8010CFCE) { case 0: D_8010CFCE++; - partner->moveToPos.y = playerStatus->position.y; + partner->moveToPos.y = playerStatus->pos.y; partner->moveToPos.x = wPartnerMoveGoalX; partner->moveToPos.z = wPartnerMoveGoalZ; D_800F8034 = atan2(partner->pos.x, partner->pos.z, partner->moveToPos.x, partner->moveToPos.z); @@ -2529,36 +2529,36 @@ void partner_move_to_goal(Npc* partner, s32 isFlying) { wPartnerMoveTime = 18; temp = dist2D(partner->pos.x, partner->pos.z, partner->moveToPos.x, partner->moveToPos.z); partner->moveSpeed = wPartnerMoveSpeed = temp / wPartnerMoveTime; - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].anims[ + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].anims[ (partner->moveSpeed >= 4.0) ? PARTNER_ANIM_INDEX_RUN : PARTNER_ANIM_INDEX_WALK]; case 1: if (wPartnerMoveTime != 0) { wPartnerMoveTime--; if (!isFlying) { if (!(partner->flags & NPC_FLAG_GROUNDED)) { - partner->pos.y = playerStatus->position.y; + partner->pos.y = playerStatus->pos.y; } - if (partner->jumpVelocity != 0.0f) { - partner->jumpVelocity -= partner->jumpScale; - partner->pos.y += partner->jumpVelocity; - if (partner->jumpVelocity <= 0.0f) { - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].fall; + if (partner->jumpVel != 0.0f) { + partner->jumpVel -= partner->jumpScale; + partner->pos.y += partner->jumpVel; + if (partner->jumpVel <= 0.0f) { + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].fall; } - if (partner->jumpVelocity <= 0.0f) { - temp = fabsf(partner->jumpVelocity) + partner->collisionHeight; + if (partner->jumpVel <= 0.0f) { + temp = fabsf(partner->jumpVel) + partner->collisionHeight; y = partner->pos.y + partner->collisionHeight; x = partner->pos.x; z = partner->pos.z; if (npc_raycast_down_around(partner->collisionChannel, &x, &y, &z, &temp, partner->yaw, partner->collisionDiameter) && - (temp <= fabsf(partner->jumpVelocity) + 22.0f)) + (temp <= fabsf(partner->jumpVel) + 22.0f)) { - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].anims[ + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].anims[ (partner->moveSpeed >= 4.0) ? PARTNER_ANIM_INDEX_RUN : PARTNER_ANIM_INDEX_WALK]; partner->jumpScale = 0.0f; - partner->jumpVelocity = 0.0f; + partner->jumpVel = 0.0f; partner->pos.y = y; partner->flags &= ~NPC_FLAG_JUMPING; } @@ -2567,12 +2567,12 @@ void partner_move_to_goal(Npc* partner, s32 isFlying) { partner->moveSpeed = wPartnerMoveSpeed; partner->yaw = D_800F8034; npc_move_heading(partner, partner->moveSpeed, partner->yaw); - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].anims[ + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].anims[ (partner->moveSpeed >= 4.0) ? PARTNER_ANIM_INDEX_RUN : PARTNER_ANIM_INDEX_WALK]; npc_do_world_collision(partner); } else { - if (fabs(partner->pos.y - playerStatus->position.y) > 5.0) { - partner->pos.y += (playerStatus->position.y - partner->pos.y) * 0.5f; + if (fabs(partner->pos.y - playerStatus->pos.y) > 5.0) { + partner->pos.y += (playerStatus->pos.y - partner->pos.y) * 0.5f; } partner->moveSpeed = wPartnerMoveSpeed; partner->yaw = D_800F8034; @@ -2582,7 +2582,7 @@ void partner_move_to_goal(Npc* partner, s32 isFlying) { spawn_surface_effects(partner, (partner->moveSpeed < 4.0) ? SURFACE_INTERACT_WALK : SURFACE_INTERACT_RUN); } else { partner->flags &= ~NPC_FLAG_IGNORE_WORLD_COLLISION; - partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].idle; + partner->curAnim = gPartnerAnimations[wCurrentPartnerId].idle; D_8010CFCE++; } break; diff --git a/src/world/script_api/enter_exit.c b/src/world/script_api/enter_exit.c index 1cddd6c6141..31f3340ea88 100644 --- a/src/world/script_api/enter_exit.c +++ b/src/world/script_api/enter_exit.c @@ -24,16 +24,16 @@ API_CALLABLE(TeleportPartnerToPlayer) { PlayerStatus* playerStatus = &gPlayerStatus; Npc* partner; - if (gPlayerData.currentPartner == PARTNER_NONE) { + if (gPlayerData.curPartner == PARTNER_NONE) { return ApiStatus_DONE2; } partner = get_npc_unsafe(NPC_PARTNER); - partner->pos.x = playerStatus->position.x; - partner->pos.z = playerStatus->position.z; + partner->pos.x = playerStatus->pos.x; + partner->pos.z = playerStatus->pos.z; if (partner_is_flying()) { - partner->pos.y = playerStatus->position.y; + partner->pos.y = playerStatus->pos.y; } set_npc_yaw(partner, playerStatus->targetYaw); @@ -44,19 +44,19 @@ API_CALLABLE(TeleportPartnerToPlayer) { API_CALLABLE(SetPlayerPositionFromSaveData) { PlayerStatus* playerStatus = &gPlayerStatus; Camera* camera = &gCameras[gCurrentCameraID]; - s32 currentPartner = gPlayerData.currentPartner; + s32 currentPartner = gPlayerData.curPartner; - playerStatus->position.x = gGameStatusPtr->savedPos.x; - playerStatus->position.y = gGameStatusPtr->savedPos.y; - playerStatus->position.z = gGameStatusPtr->savedPos.z; + playerStatus->pos.x = gGameStatusPtr->savedPos.x; + playerStatus->pos.y = gGameStatusPtr->savedPos.y; + playerStatus->pos.z = gGameStatusPtr->savedPos.z; if (currentPartner != PARTNER_NONE) { Npc* partner = get_npc_unsafe(NPC_PARTNER); f32 angle = clamp_angle((playerStatus->spriteFacingAngle < 180.0f) ? (90.0f) : (-90.0f)); - partner->pos.x = playerStatus->position.x; - partner->pos.y = playerStatus->position.y; - partner->pos.z = playerStatus->position.z; + partner->pos.x = playerStatus->pos.x; + partner->pos.y = playerStatus->pos.y; + partner->pos.z = playerStatus->pos.z; add_vec2D_polar(&partner->pos.x, &partner->pos.z, playerStatus->colliderDiameter + 5, angle); enable_partner_ai(); } @@ -71,24 +71,24 @@ API_CALLABLE(EnterPlayerPostPipe) { ApiStatus ret = ApiStatus_BLOCK; if (isInitialCall) { - playerStatus->position.x = (*mapSettings->entryList)[gGameStatusPtr->entryID].x; - playerStatus->position.z = (*mapSettings->entryList)[gGameStatusPtr->entryID].z; + playerStatus->pos.x = (*mapSettings->entryList)[gGameStatusPtr->entryID].x; + playerStatus->pos.z = (*mapSettings->entryList)[gGameStatusPtr->entryID].z; script->varTable[2] = (*mapSettings->entryList)[gGameStatusPtr->entryID].y; - playerStatus->position.y = script->varTable[2] - 40; + playerStatus->pos.y = script->varTable[2] - 40; playerStatus->flags |= PS_FLAG_CAMERA_DOESNT_FOLLOW; } else { do { - playerStatus->position.y += 1.0f; - if (!(playerStatus->position.y < script->varTable[2])) { - playerStatus->position.y = script->varTable[2]; + playerStatus->pos.y += 1.0f; + if (!(playerStatus->pos.y < script->varTable[2])) { + playerStatus->pos.y = script->varTable[2]; playerStatus->flags &= ~PS_FLAG_CAMERA_DOESNT_FOLLOW; ret = ApiStatus_DONE2; } } while (0); // todo required to match } - gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; - gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y; - gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; + gCameras[CAM_DEFAULT].targetPos.x = playerStatus->pos.x; + gCameras[CAM_DEFAULT].targetPos.y = playerStatus->pos.y; + gCameras[CAM_DEFAULT].targetPos.z = playerStatus->pos.z; return ret; } diff --git a/src/world/script_api/push_blocks.c b/src/world/script_api/push_blocks.c index 42eb3fe0456..8e53c594122 100644 --- a/src/world/script_api/push_blocks.c +++ b/src/world/script_api/push_blocks.c @@ -32,8 +32,8 @@ f32 PushBlockMovePositions[] = { API_CALLABLE(MovePlayerTowardBlock) { PlayerStatus* playerStatus = &gPlayerStatus; - playerStatus->position.x += (script->varTable[0] - playerStatus->position.x) / 2; - playerStatus->position.z += (script->varTable[2] - playerStatus->position.z) / 2; + playerStatus->pos.x += (script->varTable[0] - playerStatus->pos.x) / 2; + playerStatus->pos.z += (script->varTable[2] - playerStatus->pos.z) / 2; return ApiStatus_DONE2; } @@ -45,37 +45,37 @@ API_CALLABLE(UpdatePushBlockMotion) { if (isInitialCall) { script->functionTemp[0] = 0; - script->varTable[0] = playerStatus->position.x; - script->varTable[1] = playerStatus->position.y; - script->varTable[2] = playerStatus->position.z; - script->varTable[3] = entity->position.x; - script->varTable[4] = entity->position.y; - script->varTable[5] = entity->position.z; - script->varTable[9] = entity->rotation.x; - script->varTable[12] = entity->rotation.z; + script->varTable[0] = playerStatus->pos.x; + script->varTable[1] = playerStatus->pos.y; + script->varTable[2] = playerStatus->pos.z; + script->varTable[3] = entity->pos.x; + script->varTable[4] = entity->pos.y; + script->varTable[5] = entity->pos.z; + script->varTable[9] = entity->rot.x; + script->varTable[12] = entity->rot.z; } moveRatio = PushBlockMovePositions[script->functionTemp[0]]; - playerStatus->position.x = script->varTable[0] + (script->varTable[6] * moveRatio * BLOCK_GRID_SIZE); - playerStatus->position.y = script->varTable[1] + (script->varTable[7] * moveRatio * BLOCK_GRID_SIZE); - playerStatus->position.z = script->varTable[2] + (script->varTable[8] * moveRatio * BLOCK_GRID_SIZE); - entity->position.x = script->varTable[3] + (script->varTable[6] * moveRatio * BLOCK_GRID_SIZE); - entity->position.y = script->varTable[4] + (script->varTable[7] * moveRatio * BLOCK_GRID_SIZE); - entity->position.z = script->varTable[5] + (script->varTable[8] * moveRatio * BLOCK_GRID_SIZE); + playerStatus->pos.x = script->varTable[0] + (script->varTable[6] * moveRatio * BLOCK_GRID_SIZE); + playerStatus->pos.y = script->varTable[1] + (script->varTable[7] * moveRatio * BLOCK_GRID_SIZE); + playerStatus->pos.z = script->varTable[2] + (script->varTable[8] * moveRatio * BLOCK_GRID_SIZE); + entity->pos.x = script->varTable[3] + (script->varTable[6] * moveRatio * BLOCK_GRID_SIZE); + entity->pos.y = script->varTable[4] + (script->varTable[7] * moveRatio * BLOCK_GRID_SIZE); + entity->pos.z = script->varTable[5] + (script->varTable[8] * moveRatio * BLOCK_GRID_SIZE); if (script->functionTemp[0] < 12) { - entity->rotation.z = script->varTable[12] + (script->varTable[6] * moveRatio * -90.0f); - entity->rotation.x = script->varTable[9] + (script->varTable[8] * moveRatio * 90.0f); - entity->position.y = entity->position.y + (sin_deg(moveRatio * 90.0f) * BLOCK_GRID_SIZE * 0.5); - entity->position.x = entity->position.x - (script->varTable[6] * sin_deg(moveRatio * 90.0f) * BLOCK_GRID_SIZE * 0.5); - entity->position.z = entity->position.z - (script->varTable[8] * sin_deg(moveRatio * 90.0f) * BLOCK_GRID_SIZE * 0.5); + entity->rot.z = script->varTable[12] + (script->varTable[6] * moveRatio * -90.0f); + entity->rot.x = script->varTable[9] + (script->varTable[8] * moveRatio * 90.0f); + entity->pos.y = entity->pos.y + (sin_deg(moveRatio * 90.0f) * BLOCK_GRID_SIZE * 0.5); + entity->pos.x = entity->pos.x - (script->varTable[6] * sin_deg(moveRatio * 90.0f) * BLOCK_GRID_SIZE * 0.5); + entity->pos.z = entity->pos.z - (script->varTable[8] * sin_deg(moveRatio * 90.0f) * BLOCK_GRID_SIZE * 0.5); } else { - entity->rotation.z = entity->rotation.x = 0.0f; + entity->rot.z = entity->rot.x = 0.0f; } - gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; - gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y; - gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; + gCameras[CAM_DEFAULT].targetPos.x = playerStatus->pos.x; + gCameras[CAM_DEFAULT].targetPos.y = playerStatus->pos.y; + gCameras[CAM_DEFAULT].targetPos.z = playerStatus->pos.z; script->functionTemp[0]++; if (script->functionTemp[0] == ARRAY_COUNT(PushBlockMovePositions)) { @@ -93,11 +93,11 @@ API_CALLABLE(FinishPushBlockMotion) { if (isInitialCall) { script->functionTemp[0] = 0; - script->varTable[0] = block->position.y; + script->varTable[0] = block->pos.y; - hitX = block->position.x; - hitZ = block->position.z; - hitY = block->position.y + 5.0f; + hitX = block->pos.x; + hitZ = block->pos.z; + hitY = block->pos.y + 5.0f; hitDepth = 35.0f; hitResult = npc_raycast_down_sides(0, &hitX, &hitY, &hitZ, &hitDepth); @@ -110,21 +110,21 @@ API_CALLABLE(FinishPushBlockMotion) { if (grid->dropCallback != NULL) { if (grid->dropCallback(block, script)) { - i = (block->position.x - grid->centerPos.x) / BLOCK_GRID_SIZE; - j = (block->position.z - grid->centerPos.z) / BLOCK_GRID_SIZE; + i = (block->pos.x - grid->centerPos.x) / BLOCK_GRID_SIZE; + j = (block->pos.z - grid->centerPos.z) / BLOCK_GRID_SIZE; grid->cells[i + (j * grid->numCellsX)] = 0; return ApiStatus_DONE1; } else { return ApiStatus_BLOCK; } } else { - block->position.y = script->varTable[0] - (PushBlockMovePositions[script->functionTemp[0]] * BLOCK_GRID_SIZE); + block->pos.y = script->varTable[0] - (PushBlockMovePositions[script->functionTemp[0]] * BLOCK_GRID_SIZE); script->functionTemp[0]++; if (script->functionTemp[0] != ARRAY_COUNT(PushBlockMovePositions)) { return ApiStatus_BLOCK; } - i = (block->position.x - grid->centerPos.x) / BLOCK_GRID_SIZE; - j = (block->position.z - grid->centerPos.z) / BLOCK_GRID_SIZE; + i = (block->pos.x - grid->centerPos.x) / BLOCK_GRID_SIZE; + j = (block->pos.z - grid->centerPos.z) / BLOCK_GRID_SIZE; grid->cells[i + (j * grid->numCellsX)] = PUSH_GRID_EMPTY; } return ApiStatus_DONE1; @@ -145,9 +145,9 @@ API_CALLABLE(FetchPushedBlockProperties) { gridCenterY = grid->centerPos.y; gridCenterZ = grid->centerPos.z; - xThing = gPlayerStatus.position.x; - yThing = gPlayerStatus.position.y; - zThing = gPlayerStatus.position.z; + xThing = gPlayerStatus.pos.x; + yThing = gPlayerStatus.pos.y; + zThing = gPlayerStatus.pos.z; xThing -= gridCenterX; yThing -= gridCenterY; @@ -179,9 +179,9 @@ API_CALLABLE(FetchPushedBlockProperties) { script->varTable[1] = yThing; script->varTable[2] = zThing; - script->varTable[3] = entityX = entity->position.x; - script->varTable[4] = entityY = entity->position.y; - script->varTable[5] = entityZ = entity->position.z; + script->varTable[3] = entityX = entity->pos.x; + script->varTable[4] = entityY = entity->pos.y; + script->varTable[5] = entityZ = entity->pos.z; xThing = entityX - grid->centerPos.x; zThing = entityZ - grid->centerPos.z; @@ -227,8 +227,8 @@ API_CALLABLE(ClearPushedBlockFromGrid) { s32 ip, jp; // prev grid pos (i,j) s32 in, jn; // next grid pos (i,j) - ip = ((s32)block->position.x - grid->centerPos.x) / BLOCK_GRID_SIZE; - jp = ((s32)block->position.z - grid->centerPos.z) / BLOCK_GRID_SIZE; + ip = ((s32)block->pos.x - grid->centerPos.x) / BLOCK_GRID_SIZE; + jp = ((s32)block->pos.z - grid->centerPos.z) / BLOCK_GRID_SIZE; in = ip + script->varTable[6]; jn = jp + script->varTable[8]; diff --git a/src/world/script_api/shops.c b/src/world/script_api/shops.c index a4a1e83782e..8fd73b5e276 100644 --- a/src/world/script_api/shops.c +++ b/src/world/script_api/shops.c @@ -204,7 +204,7 @@ API_CALLABLE(func_80280410) { s32 currentItemSlot = evt_get_variable(script, *script->ptrReadPos); if (!(shop->flags & SHOP_FLAG_8)) { - shop->currentItemSlot = currentItemSlot; + shop->curItemSlot = currentItemSlot; shop->flags |= SHOP_FLAG_1; func_800E98EC(); shop->unk_358 = 5; @@ -289,7 +289,7 @@ API_CALLABLE(ShowShopPurchaseDialog) { break; case PURCHASE_DIALOG_STATE_WAIT_FOR_SPEECH: if (script->functionTemp[2] == TRUE) { - if (D_80286528->currentOption == 0) { + if (D_80286528->curOption == 0) { if (playerData->coins < shopInventory->price) { script->functionTemp[1] = shop_owner_continue_speech(SHOP_MSG_NOT_ENOUGH_COINS); script->functionTemp[0] = PURCHASE_DIALOG_STATE_NOT_ENOUGH_COINS; @@ -528,7 +528,7 @@ API_CALLABLE(ShowShopOwnerDialog) { break; case DIALOG_STATE_AWAIT_MAIN_MENU: if (script->functionTemp[2] == 1) { - switch (D_80286538->currentOption) { + switch (D_80286538->curOption) { case 0: script->functionTemp[1] = shop_owner_continue_speech(SHOP_MSG_INSTRUCTIONS); script->functionTemp[0] = DIALOG_STATE_DONE_INSTRUCTIONS; @@ -614,7 +614,7 @@ API_CALLABLE(ShowShopOwnerDialog) { break; case DIALOG_STATE_HANDLE_SELL_CHOICE: if (script->functionTemp[2] == 1) { - if (D_80286538->currentOption == 0) { + if (D_80286538->curOption == 0) { add_coins(shop_get_sell_price(playerData->invItems[shop->selectedStoreItemSlot])); playerData->invItems[shop->selectedStoreItemSlot] = 0; if (get_item_count() == 0) { @@ -641,7 +641,7 @@ API_CALLABLE(ShowShopOwnerDialog) { break; case DIALOG_STATE_AWAIT_SELL_MORE_CHOICE: if (script->functionTemp[2] == 1) { - if (D_80286538->currentOption == 0) { + if (D_80286538->curOption == 0) { script->functionTemp[1] = shop_owner_end_speech(); script->functionTemp[0] = DIALOG_STATE_INIT_SELL_CHOICE; hide_coin_counter_immediately(); @@ -696,7 +696,7 @@ API_CALLABLE(ShowShopOwnerDialog) { break; case DIALOG_STATE_AWAIT_CHECK_MORE_CHOICE: if (script->functionTemp[2] == 1) { - if (D_80286538->currentOption == 0) { + if (D_80286538->curOption == 0) { script->functionTemp[1] = shop_owner_end_speech(); script->functionTemp[0] = DIALOG_STATE_INIT_CHECK_CHOICE; } else { @@ -749,7 +749,7 @@ API_CALLABLE(ShowShopOwnerDialog) { break; case DIALOG_STATE_AWAIT_CLAIM_MORE_CHOICE: if (script->functionTemp[2] == 1) { - if (D_80286538->currentOption == 0) { + if (D_80286538->curOption == 0) { script->functionTemp[1] = shop_owner_end_speech(); script->functionTemp[0] = DIALOG_STATE_INIT_CLAIM_CHOICE; } else { @@ -779,7 +779,7 @@ API_CALLABLE(ShowShopOwnerDialog) { void shop_draw_item_name(s32 arg0, s32 posX, s32 posY) { Shop* shop = gGameStatusPtr->mapShop; - ShopItemData* siItem = &shop->staticInventory[shop->currentItemSlot]; + ShopItemData* siItem = &shop->staticInventory[shop->curItemSlot]; ItemData* shopItem = &gItemTable[siItem->itemID]; draw_msg(shopItem->nameMsg, posX + 60 - (get_msg_width(shopItem->nameMsg, 0) >> 1), posY + 6, 255, MSG_PAL_WHITE, 0); @@ -787,7 +787,7 @@ void shop_draw_item_name(s32 arg0, s32 posX, s32 posY) { void shop_draw_item_desc(s32 arg0, s32 posX, s32 posY) { Shop* shop = gGameStatusPtr->mapShop; - ShopItemData* shopItem = &shop->staticInventory[shop->currentItemSlot]; + ShopItemData* shopItem = &shop->staticInventory[shop->curItemSlot]; draw_msg(shopItem->descMsg, posX + 8, posY, 255, MSG_PAL_STANDARD, 0); } @@ -844,7 +844,7 @@ void draw_shop_items(void) { draw_number(itemData->price, xTemp + xOffset, yTemp, DRAW_NUMBER_CHARSET_THIN, MSG_PAL_WHITE, 255, 0); } - if (i == shop->currentItemSlot) { + if (i == shop->curItemSlot) { hud_element_set_render_pos(shop->costIconID, (xTemp + xOffset) - 6, yTemp + 5); hud_element_set_scale(shop->costIconID, 0.7f); hud_element_draw_clipped(shop->costIconID); @@ -948,7 +948,7 @@ API_CALLABLE(MakeShop) { set_window_properties(WINDOW_ID_ITEM_INFO_DESC, 32, 184, 256, 32, WINDOW_PRIORITY_1, shop_draw_item_desc, NULL, -1); gWindowStyles[10].defaultStyleID = WINDOW_STYLE_9; gWindowStyles[11].defaultStyleID = WINDOW_STYLE_3; - shop->currentItemSlot = 0; + shop->curItemSlot = 0; shop->selectedStoreItemSlot = 0; shop->flags = 0; shop->owner = NULL; diff --git a/src/world/world.c b/src/world/world.c index 37bb0087bbb..b82575a8064 100644 --- a/src/world/world.c +++ b/src/world/world.c @@ -196,7 +196,7 @@ void load_map_by_IDs(s16 areaID, s16 mapID, s16 loadType) { clear_printers(); clear_item_entity_data(); - gPlayerStatus.targetYaw = gPlayerStatus.currentYaw; + gPlayerStatus.targetYaw = gPlayerStatus.curYaw; sfx_set_reverb_mode(WorldReverbModeMapping[*(s32*)mapConfig->unk_1C & 0x3]); sfx_reset_door_sounds(); diff --git a/tools/asm_sizes.py b/tools/asm_sizes.py index 6de3f3e84e1..05dad64aece 100755 --- a/tools/asm_sizes.py +++ b/tools/asm_sizes.py @@ -10,7 +10,7 @@ script_dir = os.path.dirname(os.path.realpath(__file__)) asm_dir = script_dir + "/../ver/current/asm/nonmatchings" -modes = [ "min", "max", "avg", "total", "size" ] +modes = ["min", "max", "avg", "total", "size"] sizes = {} @@ -47,18 +47,53 @@ def do_dir(root, dir): avg = 0 if len(files) == 0 else total / len(files) - sizes[root + "/" + dir] = ((min, max, total, avg, len(files))) + sizes[root + "/" + dir] = (min, max, total, avg, len(files)) -parser = argparse.ArgumentParser(description="A tool to receive information about the number of non-matching .s files " - +"per .c file, or the size of .s files, measured by their number of instructions. " - +"Option -p is used by default if no option is specified.") +parser = argparse.ArgumentParser( + description="A tool to receive information about the number of non-matching .s files " + + "per .c file, or the size of .s files, measured by their number of instructions. " + + "Option -p is used by default if no option is specified." +) group = parser.add_mutually_exclusive_group() -group.add_argument("-f", "--files", help="Default. Print the number of non-matching .s files per .c file, ordered by size.", action='store_true', required=False) -group.add_argument("-a", "--alphabetical", help="Print the size of .s files, ordered by name.", action='store_true', required=False) -group.add_argument("-s", "--size", help="Print the size of .s files, ordered by size.", action='store_true', required=False) -parser.add_argument("-l", "--limit", help="Only print the .c --files that are greater than or equal to the value.", type=int, default=0, required=False) -parser.add_argument("-m", "--mode", help="Switches between output modes for --files. Allowed values are: {min, max, avg, total, size}.", choices=modes, default="size", metavar='', required=False) +group.add_argument( + "-f", + "--files", + help="Default. Print the number of non-matching .s files per .c file, ordered by size.", + action="store_true", + required=False, +) +group.add_argument( + "-a", + "--alphabetical", + help="Print the size of .s files, ordered by name.", + action="store_true", + required=False, +) +group.add_argument( + "-s", + "--size", + help="Print the size of .s files, ordered by size.", + action="store_true", + required=False, +) +parser.add_argument( + "-l", + "--limit", + help="Only print the .c --files that are greater than or equal to the value.", + type=int, + default=0, + required=False, +) +parser.add_argument( + "-m", + "--mode", + help="Switches between output modes for --files. Allowed values are: {min, max, avg, total, size}.", + choices=modes, + default="size", + metavar="", + required=False, +) args = parser.parse_args() diff --git a/tools/build/bin_inc_c.py b/tools/build/bin_inc_c.py index c05118a0bd1..9a78c307cc5 100755 --- a/tools/build/bin_inc_c.py +++ b/tools/build/bin_inc_c.py @@ -12,6 +12,6 @@ with open(infile, "rb") as i: for char in i.read(): - f.write(f'0x{char:02X}, ') + f.write(f"0x{char:02X}, ") f.write(f"}};\n") diff --git a/tools/build/common.py b/tools/build/common.py index e8836d45890..f79263a8281 100644 --- a/tools/build/common.py +++ b/tools/build/common.py @@ -4,10 +4,7 @@ from pathlib import Path from typing import Tuple -ASSETS_DIR = ( - Path(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) - / "assets" -) +ASSETS_DIR = Path(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) / "assets" @lru_cache(maxsize=None) diff --git a/tools/build/configure.py b/tools/build/configure.py index 8b355d3d460..ab0674b3f9b 100755 --- a/tools/build/configure.py +++ b/tools/build/configure.py @@ -28,9 +28,7 @@ def exec_shell(command: List[str]) -> str: - ret = subprocess.run( - command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True - ) + ret = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) return ret.stdout @@ -50,9 +48,7 @@ def write_ninja_rules( if use_ccache: ccache = "ccache " try: - subprocess.call( - ["ccache"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL - ) + subprocess.call(["ccache"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) except FileNotFoundError: ccache = "" @@ -134,9 +130,7 @@ def write_ninja_rules( command="sha1sum -c $in && touch $out" if DO_SHA1_CHECK else "touch $out", ) - ninja.rule( - "cpp", description="cpp $in", command=f"{cpp} $in {extra_cppflags} -P -o $out" - ) + ninja.rule("cpp", description="cpp $in", command=f"{cpp} $in {extra_cppflags} -P -o $out") ninja.rule( "cc", @@ -287,9 +281,7 @@ def write_ninja_rules( command=f"$python {BUILD_TOOLS}/mapfs/pack_title_data.py $out $in", ) - ninja.rule( - "map_header", command=f"$python {BUILD_TOOLS}/mapfs/map_header.py $in > $out" - ) + ninja.rule("map_header", command=f"$python {BUILD_TOOLS}/mapfs/map_header.py $in > $out") ninja.rule("charset", command=f"$python {BUILD_TOOLS}/pm_charset.py $out $in") @@ -303,25 +295,17 @@ def write_ninja_rules( command=f"$python {BUILD_TOOLS}/sprite/sprite_shading_profiles.py $in $out $header_path", ) - ninja.rule( - "imgfx_data", command=f"$python {BUILD_TOOLS}/imgfx/imgfx_data.py $in $out" - ) + ninja.rule("imgfx_data", command=f"$python {BUILD_TOOLS}/imgfx/imgfx_data.py $in $out") ninja.rule("shape", command=f"$python {BUILD_TOOLS}/mapfs/shape.py $in $out") - ninja.rule( - "effect_data", command=f"$python {BUILD_TOOLS}/effects.py $in_yaml $out_dir" - ) + ninja.rule("effect_data", command=f"$python {BUILD_TOOLS}/effects.py $in_yaml $out_dir") ninja.rule("pm_sbn", command=f"$python {BUILD_TOOLS}/audio/sbn.py $out $in") with Path("tools/permuter_settings.toml").open("w") as f: - f.write( - f"compiler_command = \"{cc} {CPPFLAGS.replace('$version', 'pal')} {cflags} -DPERMUTER -fforce-addr\"\n" - ) - f.write( - f'assembler_command = "{cross}as -EB -march=vr4300 -mtune=vr4300 -Iinclude"\n' - ) + f.write(f"compiler_command = \"{cc} {CPPFLAGS.replace('$version', 'pal')} {cflags} -DPERMUTER -fforce-addr\"\n") + f.write(f'assembler_command = "{cross}as -EB -march=vr4300 -mtune=vr4300 -Iinclude"\n') f.write(f'compiler_type = "gcc"\n') f.write( """ @@ -512,11 +496,7 @@ def build( for object_path in object_paths: if object_path.suffixes[-1] == ".o": built_objects.add(str(object_path)) - elif ( - object_path.suffixes[-1] == ".h" - or task == "bin_inc_c" - or task == "pal_inc_c" - ): + elif object_path.suffixes[-1] == ".h" or task == "bin_inc_c" or task == "pal_inc_c": generated_headers.append(str(object_path)) # don't rebuild objects if we've already seen all of them @@ -580,15 +560,13 @@ def build( if isinstance(seg, segtypes.n64.header.N64SegHeader): build(entry.object_path, entry.src_paths, "as") elif isinstance(seg, segtypes.common.asm.CommonSegAsm) or ( - isinstance(seg, segtypes.common.data.CommonSegData) - and not seg.type[0] == "." + isinstance(seg, segtypes.common.data.CommonSegData) and not seg.type[0] == "." ): build(entry.object_path, entry.src_paths, "as") elif seg.type in ["pm_effect_loads", "pm_effect_shims"]: build(entry.object_path, entry.src_paths, "as") elif isinstance(seg, segtypes.common.c.CommonSegC) or ( - isinstance(seg, segtypes.common.data.CommonSegData) - and seg.type[0] == "." + isinstance(seg, segtypes.common.data.CommonSegData) and seg.type[0] == "." ): cflags = None if isinstance(seg.yaml, dict): @@ -619,16 +597,12 @@ def build( task = "cc_272" cflags = cflags.replace("gcc_272", "") - encoding = ( - "CP932" # similar to SHIFT-JIS, but includes backslash and tilde - ) + encoding = "CP932" # similar to SHIFT-JIS, but includes backslash and tilde if version == "ique": encoding = "EUC-JP" # Dead cod - if isinstance(seg.parent.yaml, dict) and seg.parent.yaml.get( - "dead_code", False - ): + if isinstance(seg.parent.yaml, dict) and seg.parent.yaml.get("dead_code", False): obj_path = str(entry.object_path) init_obj_path = Path(obj_path + ".dead") build( @@ -677,9 +651,7 @@ def build( src_paths = [seg.out_path().relative_to(ROOT)] inc_dir = self.build_path() / "include" / seg.dir - bin_path = ( - self.build_path() / seg.dir / (seg.name + ".png.bin") - ) + bin_path = self.build_path() / seg.dir / (seg.name + ".png.bin") build( bin_path, @@ -691,9 +663,7 @@ def build( }, ) - assert seg.vram_start is not None, ( - "img with vram_start unset: " + seg.name - ) + assert seg.vram_start is not None, "img with vram_start unset: " + seg.name c_sym = seg.create_symbol( addr=seg.vram_start, @@ -720,9 +690,7 @@ def build( elif isinstance(seg, segtypes.n64.palette.N64SegPalette): src_paths = [seg.out_path().relative_to(ROOT)] inc_dir = self.build_path() / "include" / seg.dir - bin_path = ( - self.build_path() / seg.dir / (seg.name + ".pal.bin") - ) + bin_path = self.build_path() / seg.dir / (seg.name + ".pal.bin") build( bin_path, @@ -833,9 +801,7 @@ def build( ) # Sprites .bin - sprite_player_header_path = str( - self.build_path() / "include/sprite/player.h" - ) + sprite_player_header_path = str(self.build_path() / "include/sprite/player.h") build( entry.object_path.with_suffix(".bin"), @@ -843,9 +809,7 @@ def build( "sprites", variables={ "header_out": sprite_player_header_path, - "build_dir": str( - self.build_path() / "assets" / self.version / "sprite" - ), + "build_dir": str(self.build_path() / "assets" / self.version / "sprite"), "asset_stack": ",".join(self.asset_stack), }, implicit_outputs=[sprite_player_header_path], @@ -859,9 +823,7 @@ def build( msg_bins = [] for section_idx, msg_path in enumerate(entry.src_paths): - bin_path = ( - entry.object_path.with_suffix("") / f"{section_idx:02X}.bin" - ) + bin_path = entry.object_path.with_suffix("") / f"{section_idx:02X}.bin" msg_bins.append(bin_path) build(bin_path, [msg_path], "msg") @@ -1005,16 +967,12 @@ def build( ) elif name.endswith("_shape_built"): base_name = name[:-6] - raw_bin_path = self.resolve_asset_path( - f"assets/x/mapfs/geom/{base_name}.bin" - ) + raw_bin_path = self.resolve_asset_path(f"assets/x/mapfs/geom/{base_name}.bin") bin_path = bin_path.parent / "geom" / (base_name + ".bin") if c_maps: # raw bin -> c -> o -> elf -> objcopy -> final bin file - c_file_path = ( - bin_path.parent / "geom" / base_name - ).with_suffix(".c") + c_file_path = (bin_path.parent / "geom" / base_name).with_suffix(".c") o_path = bin_path.parent / "geom" / (base_name + ".o") elf_path = bin_path.parent / "geom" / (base_name + ".elf") @@ -1056,12 +1014,7 @@ def build( rasters = [] for src_path in entry.src_paths: - out_path = ( - self.build_path() - / seg.dir - / seg.name - / (src_path.stem + ".bin") - ) + out_path = self.build_path() / seg.dir / seg.name / (src_path.stem + ".bin") build( out_path, [src_path], @@ -1079,13 +1032,7 @@ def build( palettes = [] for src_path in entry.src_paths: - out_path = ( - self.build_path() - / seg.dir - / seg.name - / "palette" - / (src_path.stem + ".bin") - ) + out_path = self.build_path() / seg.dir / seg.name / "palette" / (src_path.stem + ".bin") build( out_path, [src_path], @@ -1100,9 +1047,7 @@ def build( build(entry.object_path.with_suffix(""), palettes, "charset_palettes") build(entry.object_path, [entry.object_path.with_suffix("")], "bin") elif seg.type == "pm_sprite_shading_profiles": - header_path = str( - self.build_path() / "include/sprite/sprite_shading_profiles.h" - ) + header_path = str(self.build_path() / "include/sprite/sprite_shading_profiles.h") build( entry.object_path.with_suffix(""), entry.src_paths, @@ -1115,16 +1060,12 @@ def build( build(entry.object_path, [entry.object_path.with_suffix("")], "bin") elif seg.type == "pm_sbn": sbn_path = entry.object_path.with_suffix("") - build( - sbn_path, entry.src_paths, "pm_sbn" - ) # could have non-yaml inputs be implicit + build(sbn_path, entry.src_paths, "pm_sbn") # could have non-yaml inputs be implicit build(entry.object_path, [sbn_path], "bin") elif seg.type == "linker" or seg.type == "linker_offset": pass elif seg.type == "pm_imgfx_data": - c_file_path = ( - Path(f"assets/{self.version}") / "imgfx" / (seg.name + ".c") - ) + c_file_path = Path(f"assets/{self.version}") / "imgfx" / (seg.name + ".c") build(c_file_path, entry.src_paths, "imgfx_data") build( @@ -1138,9 +1079,7 @@ def build( }, ) else: - raise Exception( - f"don't know how to build {seg.__class__.__name__} '{seg.name}'" - ) + raise Exception(f"don't know how to build {seg.__class__.__name__} '{seg.name}'") # Run undefined_syms through cpp ninja.build( @@ -1218,20 +1157,14 @@ def make_current(self, ninja: ninja_syntax.Writer): action="store_true", help="Delete assets and previously-built files", ) - parser.add_argument( - "--splat", default="tools/splat", help="Path to splat tool to use" - ) - parser.add_argument( - "--split-code", action="store_true", help="Re-split code segments to asm files" - ) + parser.add_argument("--splat", default="tools/splat", help="Path to splat tool to use") + parser.add_argument("--split-code", action="store_true", help="Re-split code segments to asm files") parser.add_argument( "--no-split-assets", action="store_true", help="Don't split assets from the baserom(s)", ) - parser.add_argument( - "-d", "--debug", action="store_true", help="Generate debugging information" - ) + parser.add_argument("-d", "--debug", action="store_true", help="Generate debugging information") parser.add_argument( "-n", "--non-matching", @@ -1274,12 +1207,8 @@ def make_current(self, ninja: ninja_syntax.Writer): pass if args.cpp is None: print("error: system C preprocessor is not GNU!") - print( - "This is a known issue on macOS - only clang's cpp is installed by default." - ) - print( - "Use 'brew' to obtain GNU cpp, then run this script again with the --cpp option, e.g." - ) + print("This is a known issue on macOS - only clang's cpp is installed by default.") + print("Use 'brew' to obtain GNU cpp, then run this script again with the --cpp option, e.g.") print(f" ./configure --cpp {gcc_cpps[0]}") exit(1) @@ -1287,15 +1216,11 @@ def make_current(self, ninja: ninja_syntax.Writer): version = exec_shell([PIGMENT, "--version"]).split(" ")[1].strip() if version < PIGMENT_REQ_VERSION: - print( - f"error: {PIGMENT} version {PIGMENT_REQ_VERSION} or newer is required, system version is {version}\n" - ) + print(f"error: {PIGMENT} version {PIGMENT_REQ_VERSION} or newer is required, system version is {version}\n") exit(1) except (FileNotFoundError, PermissionError): print(f"error: {PIGMENT} is not installed\n") - print( - "To build and install it, obtain cargo:\n\tcurl https://sh.rustup.rs -sSf | sh" - ) + print("To build and install it, obtain cargo:\n\tcurl https://sh.rustup.rs -sSf | sh") print(f"and then run:\n\tcargo install {PIGMENT}") exit(1) @@ -1384,12 +1309,8 @@ def make_current(self, ninja: ninja_syntax.Writer): # include tools/splat_ext in the python path sys.path.append(str((ROOT / "tools/splat_ext").resolve())) - configure.split( - not args.no_split_assets, args.split_code, args.shift, args.debug - ) - configure.write_ninja( - ninja, skip_files, non_matching, args.modern_gcc, args.c_maps - ) + configure.split(not args.no_split_assets, args.split_code, args.shift, args.debug) + configure.write_ninja(ninja, skip_files, non_matching, args.modern_gcc, args.c_maps) all_rom_oks.append(str(configure.rom_ok_path())) diff --git a/tools/build/effects.py b/tools/build/effects.py index 9d8b48b308e..9705280c90f 100644 --- a/tools/build/effects.py +++ b/tools/build/effects.py @@ -9,9 +9,7 @@ if __name__ == "__main__": - parser = argparse.ArgumentParser( - description="Builds effect table, function declarations, macros, and enum" - ) + parser = argparse.ArgumentParser(description="Builds effect table, function declarations, macros, and enum") parser.add_argument("in_yaml") parser.add_argument("out_dir", type=Path) args = parser.parse_args() @@ -31,9 +29,7 @@ effect_enum_text += f" {enum_name} = 0x{i:02X},\n" if not effect.empty: - effect_table_text += ( - f" FX_ENTRY({effect.name}, effect_gfx_{effect.gfx}),\n" - ) + effect_table_text += f" FX_ENTRY({effect.name}, effect_gfx_{effect.gfx}),\n" fx_decls_text += effect.get_macro_call("fx_" + effect.name) + ";\n" main_decls_text += effect.get_macro_call(effect.name + "_main") + ";\n" macro_defs += effect.get_macro_def() + "\n" diff --git a/tools/build/genobjcopy.py b/tools/build/genobjcopy.py index 2232a4e8286..e70b0671eb0 100755 --- a/tools/build/genobjcopy.py +++ b/tools/build/genobjcopy.py @@ -1,23 +1,23 @@ #!/usr/bin/env python3 import sys, os -#Under normal compilation we rely on splat to use a discard option in the ldscript -#to not include sections in the elf then just output all sections, however under debug we want -#to have debug sections. -#In debugging mode splat is told to output a list of sections it is custom creating, which are -#all of the sections we export to the z64 file with an objcopy. The below chunk of code is -#responsible for adding -j to each of the names and outputting a file for objcopy to use -#so we can still generate a elf file with all the extra debugging sections and still output +# Under normal compilation we rely on splat to use a discard option in the ldscript +# to not include sections in the elf then just output all sections, however under debug we want +# to have debug sections. +# In debugging mode splat is told to output a list of sections it is custom creating, which are +# all of the sections we export to the z64 file with an objcopy. The below chunk of code is +# responsible for adding -j to each of the names and outputting a file for objcopy to use +# so we can still generate a elf file with all the extra debugging sections and still output # the required sections to the .z64 without outputting everything. if __name__ == "__main__": - infile, outfile = sys.argv[1:] + infile, outfile = sys.argv[1:] - #generate output based on input - file_data = open(infile,"r").read().split("\n") - if len(file_data[-1]) == 0: - file_data.pop() + # generate output based on input + file_data = open(infile, "r").read().split("\n") + if len(file_data[-1]) == 0: + file_data.pop() - outdata = "-j " + " -j ".join(file_data) - with open(outfile, "w") as f: - f.write(outdata) + outdata = "-j " + " -j ".join(file_data) + with open(outfile, "w") as f: + f.write(outdata) diff --git a/tools/build/img/build.py b/tools/build/img/build.py index 45041d302ab..f4f5eb3847b 100755 --- a/tools/build/img/build.py +++ b/tools/build/img/build.py @@ -221,12 +221,8 @@ def convert(self): # header (struct BackgroundHeader) for i, palette in enumerate(palettes): - out_bytes += (baseaddr + palettes_len + headers_len).to_bytes( - 4, byteorder="big" - ) # raster offset - out_bytes += (baseaddr + headers_len + 0x200 * i).to_bytes( - 4, byteorder="big" - ) # palette offset + out_bytes += (baseaddr + palettes_len + headers_len).to_bytes(4, byteorder="big") # raster offset + out_bytes += (baseaddr + headers_len + 0x200 * i).to_bytes(4, byteorder="big") # palette offset out_bytes += (12).to_bytes(2, byteorder="big") # startX out_bytes += (20).to_bytes(2, byteorder="big") # startY out_bytes += (out_width).to_bytes(2, byteorder="big") # width @@ -263,8 +259,6 @@ def convert(self): flip_x = "--flip-x" in argv flip_y = "--flip-y" in argv - (out_bytes, out_width, out_height) = Converter( - mode, infile, flip_x, flip_y - ).convert() + (out_bytes, out_width, out_height) = Converter(mode, infile, flip_x, flip_y).convert() with open(argv[3], "wb") as f: f.write(out_bytes) diff --git a/tools/build/imgfx/imgfx_data.py b/tools/build/imgfx/imgfx_data.py index 18126f1fc81..9056ba1bb18 100755 --- a/tools/build/imgfx/imgfx_data.py +++ b/tools/build/imgfx/imgfx_data.py @@ -6,6 +6,7 @@ from pathlib import Path from typing import Any, List + @dataclass class Vertex: idx: int @@ -20,7 +21,16 @@ class Vertex: a: int def toJSON(self): - return " { \"pos\": [" + f"{self.x}, {self.y}, {self.z}" + "], \"uv\": [" + f"{self.u}, {self.v}" + "], \"rgba\": [" + f"{self.r}, {self.g}, {self.b}, {self.a}" + "] }" + return ( + ' { "pos": [' + + f"{self.x}, {self.y}, {self.z}" + + '], "uv": [' + + f"{self.u}, {self.v}" + + '], "rgba": [' + + f"{self.r}, {self.g}, {self.b}, {self.a}" + + "] }" + ) + @dataclass class Triangle: @@ -31,6 +41,7 @@ class Triangle: def toJSON(self): return f" [{self.i}, {self.j}, {self.k}]" + @dataclass class Anim: name: str @@ -46,13 +57,15 @@ class Anim: triangles: List[Triangle] def toJSON(self): - framestr = ",\n".join([" [\n" + ",\n".join([v.toJSON() for v in frame]) + "\n ]" for i, frame in enumerate(self.frames)]) + framestr = ",\n".join( + [" [\n" + ",\n".join([v.toJSON() for v in frame]) + "\n ]" for i, frame in enumerate(self.frames)] + ) trianglestr = ",\n".join([t.toJSON() for t in self.triangles]) ret = "{\n" - ret += " \"flags\": " + str(self.flags) + ",\n" - ret += " \"frames\": [\n" + framestr + "],\n" - ret += " \"triangles\": [\n" + trianglestr + "]\n" + ret += ' "flags": ' + str(self.flags) + ",\n" + ret += ' "frames": [\n' + framestr + "],\n" + ret += ' "triangles": [\n' + trianglestr + "]\n" ret += "}" return ret @@ -60,7 +73,10 @@ def toJSON(self): @staticmethod def fromJSON(name: str, data: Any) -> "Anim": flags = data["flags"] - frames = [[Vertex(idx, *vtx["pos"], *vtx["uv"], *vtx["rgba"]) for idx, vtx in enumerate(frame)] for frame in data["frames"]] + frames = [ + [Vertex(idx, *vtx["pos"], *vtx["uv"], *vtx["rgba"]) for idx, vtx in enumerate(frame)] + for frame in data["frames"] + ] triangles = [Triangle(*t) for t in data["triangles"]] return Anim( @@ -73,15 +89,16 @@ def fromJSON(name: str, data: Any) -> "Anim": keyframes=len(frames), flags=flags, frames=frames, - triangles=triangles + triangles=triangles, ) + def build(inputs: List[Path], output: Path): with open(output, "w") as f: f.write("/* NOTE: This file is autogenerated, do not edit */\n\n") - f.write("#include \"PR/gbi.h\"\n") - f.write("#include \"macros.h\"\n") - f.write("#include \"imgfx.h\"\n\n") + f.write('#include "PR/gbi.h"\n') + f.write('#include "macros.h"\n') + f.write('#include "imgfx.h"\n\n') for input in inputs: with open(input, "r") as fin: @@ -101,7 +118,9 @@ def build(inputs: List[Path], output: Path): for frame in anim.frames: f.write(" {\n") for vtx in frame: - f.write(f" {{ {{{vtx.x}, {vtx.y}, {vtx.z}}}, {{{vtx.u}, {vtx.v}}}, {{{vtx.r}, {vtx.g}, {vtx.b}}}, {vtx.a} }},\n") + f.write( + f" {{ {{{vtx.x}, {vtx.y}, {vtx.z}}}, {{{vtx.u}, {vtx.v}}}, {{{vtx.r}, {vtx.g}, {vtx.b}}}, {vtx.a} }},\n" + ) f.write(" },\n") f.write("};\n\n") @@ -134,7 +153,9 @@ def build(inputs: List[Path], output: Path): # We need a new chunk if max_t1 >= 32 and not just_chunked: - chunk_text = f" gsSPVertex((u8*){vtx_name} + 0xC * {sub_num}, {min(32, max_t1 + 1)}, 0),\n" + chunk_text + chunk_text = ( + f" gsSPVertex((u8*){vtx_name} + 0xC * {sub_num}, {min(32, max_t1 + 1)}, 0),\n" + chunk_text + ) just_chunked = True f.write(chunk_text) chunk_text = "" @@ -155,7 +176,9 @@ def build(inputs: List[Path], output: Path): old_max_t = max(max_t1, max_t2) # Dump final chunk - chunk_text = f" gsSPVertex((u8*){vtx_name} + 0xC * {sub_num}, {max(max_t1, max_t2) + 1}, 0),\n" + chunk_text + chunk_text = ( + f" gsSPVertex((u8*){vtx_name} + 0xC * {sub_num}, {max(max_t1, max_t2) + 1}, 0),\n" + chunk_text + ) f.write(chunk_text) f.write(" gsSPEndDisplayList(),\n") f.write("};\n\n") diff --git a/tools/build/ld/multilink_calc.py b/tools/build/ld/multilink_calc.py index 05af4a7fa04..3239c0c4d5e 100755 --- a/tools/build/ld/multilink_calc.py +++ b/tools/build/ld/multilink_calc.py @@ -20,7 +20,7 @@ mode = sys.argv[2] syms_to_max = { - "entity_data_vram_end" : [ + "entity_data_vram_end": [ "entity_default_VRAM_END", "entity_jan_iwa_VRAM_END", "entity_sbk_omo_VRAM_END", @@ -44,7 +44,7 @@ "world_action_use_spinning_flower_VRAM_END", "world_action_use_tweester_VRAM_END", "world_action_sneaky_parasol_VRAM_END", - ] + ], } addrs: Dict[str, List[int]] = {} @@ -80,7 +80,9 @@ out_addrs = {sym: max(addrs[sym]) for sym in addrs} - out_addrs["entity_data_vram_end"] = out_addrs["entity_data_vram_end"] + out_addrs["world_action_vram_end"] - HARDCODED_ADDR + out_addrs["entity_data_vram_end"] = ( + out_addrs["entity_data_vram_end"] + out_addrs["world_action_vram_end"] - HARDCODED_ADDR + ) out = "" for sym in out_addrs: diff --git a/tools/build/mapfs/combine.py b/tools/build/mapfs/combine.py index 62b7ab95a74..0050c54e308 100755 --- a/tools/build/mapfs/combine.py +++ b/tools/build/mapfs/combine.py @@ -4,9 +4,11 @@ from pathlib import Path import struct + def next_multiple(pos, multiple): return pos + pos % multiple + def get_version_date(version): if version == "us": return "Map Ver.00/11/07 15:36" @@ -17,6 +19,7 @@ def get_version_date(version): else: return "Map Ver.??/??/?? ??:??" + def build_mapfs(out_bin, assets, version): # every TOC entry's name field has data after the null terminator made up from all the previous name fields. # we probably don't have to do this for the game to read the data properly (it doesn't read past the null terminator @@ -38,12 +41,12 @@ def build_mapfs(out_bin, assets, version): decompressed_size = decompressed.stat().st_size size = next_multiple(compressed.stat().st_size, 2) if compressed.exists() else decompressed_size - #print(f"{name} {offset:08X} {size:08X} {decompressed_size:08X}") + # print(f"{name} {offset:08X} {size:08X} {decompressed_size:08X}") # write all previously-written names; required to match - lastname = name + lastname[len(name):] + lastname = name + lastname[len(name) :] f.seek(toc_entry_pos) - f.write(lastname.encode('ascii')) + f.write(lastname.encode("ascii")) # write TOC entry. f.seek(toc_entry_pos + 0x10) @@ -61,14 +64,15 @@ def build_mapfs(out_bin, assets, version): last_name_entry = "end_data\0" f.seek(toc_entry_pos) - lastname = last_name_entry + lastname[len(last_name_entry):] - f.write(lastname.encode('ascii')) + lastname = last_name_entry + lastname[len(last_name_entry) :] + f.write(lastname.encode("ascii")) f.seek(toc_entry_pos + 0x18) - f.write((0x903F0000).to_bytes(4, byteorder="big")) # TODO: figure out purpose + f.write((0x903F0000).to_bytes(4, byteorder="big")) # TODO: figure out purpose + if __name__ == "__main__": - argv.pop(0) # python3 + argv.pop(0) # python3 version = argv.pop(0) out = argv.pop(0) @@ -76,6 +80,6 @@ def build_mapfs(out_bin, assets, version): # pairs for i in range(0, len(argv), 2): - assets.append((Path(argv[i]), Path(argv[i+1]))) + assets.append((Path(argv[i]), Path(argv[i + 1]))) build_mapfs(out, assets, version) diff --git a/tools/build/mapfs/map_header.py b/tools/build/mapfs/map_header.py index 7812fa31da4..f62efcdb736 100755 --- a/tools/build/mapfs/map_header.py +++ b/tools/build/mapfs/map_header.py @@ -4,17 +4,19 @@ from os import path from xml.dom.minidom import parse + def eprint(*args, **kwargs): print(*args, file=stderr, **kwargs) + if __name__ == "__main__": _, xml_path = argv xml = parse(xml_path) map_name = path.basename(xml_path)[:-4] - print("#include \"common.h\"") - print("#include \"map.h\"") + print('#include "common.h"') + print('#include "map.h"') print("") print("#ifndef NAMESPACE") print(f"#define NAMESPACE {map_name}") diff --git a/tools/build/mapfs/pack_title_data.py b/tools/build/mapfs/pack_title_data.py index 222c7f2697c..84e79782438 100755 --- a/tools/build/mapfs/pack_title_data.py +++ b/tools/build/mapfs/pack_title_data.py @@ -3,7 +3,7 @@ from sys import argv if __name__ == "__main__": - argv.pop(0) # python3 + argv.pop(0) # python3 if len(argv) > 4: out, img1, img2, img3, img2_pal = argv diff --git a/tools/build/mapfs/shape.py b/tools/build/mapfs/shape.py index 2f85e85ebe1..a2ee8ddff6a 100755 --- a/tools/build/mapfs/shape.py +++ b/tools/build/mapfs/shape.py @@ -90,27 +90,17 @@ def scan(self, shape): # note: do not push model root yet shape.root_node = NodeSegment(self.ptr_root_node, "Node") - shape.vtx_table = shape.push( - VertexTableSegment(self.ptr_vtx_table, "VertexTable") - ) - shape.model_names = shape.push( - StringListSegment(self.ptr_model_names, "ModelNames") - ) - shape.collider_names = shape.push( - StringListSegment(self.ptr_collider_names, "ColliderNames") - ) - shape.zone_names = shape.push( - StringListSegment(self.ptr_zone_names, "ZoneNames") - ) + shape.vtx_table = shape.push(VertexTableSegment(self.ptr_vtx_table, "VertexTable")) + shape.model_names = shape.push(StringListSegment(self.ptr_model_names, "ModelNames")) + shape.collider_names = shape.push(StringListSegment(self.ptr_collider_names, "ColliderNames")) + shape.zone_names = shape.push(StringListSegment(self.ptr_zone_names, "ZoneNames")) def print(self, shape): shape.print(f"ShapeFileHeader {self.get_sym()} = {{") shape.print(f" .root = &{shape.get_symbol(self.ptr_root_node)},") shape.print(f" .vertexTable = {shape.get_symbol(self.ptr_vtx_table)},") shape.print(f" .modelNames = {shape.get_symbol(self.ptr_model_names)},") - shape.print( - f" .colliderNames = {shape.get_symbol(self.ptr_collider_names)}," - ) + shape.print(f" .colliderNames = {shape.get_symbol(self.ptr_collider_names)},") if self.ptr_zone_names != 0: shape.print(f" .zoneNames = {shape.get_symbol(self.ptr_zone_names)},") shape.print("};") @@ -216,9 +206,7 @@ def scan(self, shape): self.model_name = shape.model_name_map[self.addr] shape.push(GroupDataSegment(self.ptr_group_data, "GroupData", self.model_name)) - shape.push( - DisplayDataSegment(self.ptr_display_data, "DisplayData", self.model_name) - ) + shape.push(DisplayDataSegment(self.ptr_display_data, "DisplayData", self.model_name)) shape.push( PropertyListSegment( self.ptr_property_list, @@ -284,37 +272,25 @@ def print(self, shape): if key == 0x5E: if value == 0: - shape.print( - f" {{ .key = {hex(key)}, .dataType = {fmt}, .data = {{ .p = NULL }}}}," - ) + shape.print(f" {{ .key = {hex(key)}, .dataType = {fmt}, .data = {{ .p = NULL }}}},") else: tex_name = read_ascii_string(shape.file_bytes, value) - shape.print( - f' {{ .key = {hex(key)}, .dataType = {fmt}, .data = {{ .p = "{tex_name}" }}}},' - ) + shape.print(f' {{ .key = {hex(key)}, .dataType = {fmt}, .data = {{ .p = "{tex_name}" }}}},') elif key == 0x5F: - shape.print( - f" {{ .key = {hex(key)}, .dataType = {fmt}, .data = {{ .s = {hex(value)} }}}}," - ) + shape.print(f" {{ .key = {hex(key)}, .dataType = {fmt}, .data = {{ .s = {hex(value)} }}}},") else: if fmt == 0: # int - shape.print( - f" {{ .key = {hex(key)}, .dataType = {fmt}, .data = {{ .s = {hex(value)} }}}}," - ) + shape.print(f" {{ .key = {hex(key)}, .dataType = {fmt}, .data = {{ .s = {hex(value)} }}}},") elif fmt == 1: # float temp = struct.pack(">I", value) (f,) = struct.unpack(">f", temp) - shape.print( - f" {{ .key = {hex(key)}, .dataType = {fmt}, .data = {{ .f = {f} }}}}," - ) + shape.print(f" {{ .key = {hex(key)}, .dataType = {fmt}, .data = {{ .f = {f} }}}},") elif fmt == 2: # pointer shape.print( f' {{ .key = {hex(key)}, .dataType = {fmt}, .data = {{ .p = "{shape.get_symbol(value)}" }}}},' ) else: - raise Exception( - f"Invalid property: 0x{key:08X} 0x{fmt:08X} 0x{value:08X}" - ) + raise Exception(f"Invalid property: 0x{key:08X} 0x{fmt:08X} 0x{value:08X}") shape.print("};") @@ -334,25 +310,15 @@ def scan(self, shape): self.ptr_children, ) = struct.unpack(">IIIII", shape.file_bytes[start : start + 20]) - shape.push( - NodeListSegment( - self.ptr_children, "Children", self.model_name, self.num_children - ) - ) - shape.push( - LightSetSegment(self.ptr_lights, "Lights", self.model_name, self.num_lights) - ) + shape.push(NodeListSegment(self.ptr_children, "Children", self.model_name, self.num_children)) + shape.push(LightSetSegment(self.ptr_lights, "Lights", self.model_name, self.num_lights)) shape.push(MatrixSegment(self.ptr_transform_mtx, "Mtx", self.model_name)) def print(self, shape): shape.print(f"ModelGroupData {self.get_sym()} = {{") if self.ptr_transform_mtx != 0: - shape.print( - f" .transformMatrix = (Mtx*) &{shape.get_symbol(self.ptr_transform_mtx)}," - ) - shape.print( - f" .lightingGroup = (Lightsn*) &{shape.get_symbol(self.ptr_lights)}," - ) + shape.print(f" .transformMatrix = (Mtx*) &{shape.get_symbol(self.ptr_transform_mtx)},") + shape.print(f" .lightingGroup = (Lightsn*) &{shape.get_symbol(self.ptr_lights)},") shape.print(f" .numLights = {self.num_lights},") shape.print(f" .childList = {shape.get_symbol(self.ptr_children)},") shape.print(f" .numChildren = {self.num_children},") @@ -392,18 +358,14 @@ def print(self, shape): for i in range(4): (a, b, c, d) = struct.unpack(">hhhh", shape.file_bytes[pos : pos + 8]) pos += 8 - shape.print( - f" {{ {hex(a):4}, {hex(b):4}, {hex(c):4}, {hex(d):4} }}," - ) + shape.print(f" {{ {hex(a):4}, {hex(b):4}, {hex(c):4}, {hex(d):4} }},") shape.print(" },") shape.print(" .frac = {") for i in range(4): (a, b, c, d) = struct.unpack(">hhhh", shape.file_bytes[pos : pos + 8]) pos += 8 - shape.print( - f" {{ {hex(a):4}, {hex(b):4}, {hex(c):4}, {hex(d):4} }}," - ) + shape.print(f" {{ {hex(a):4}, {hex(b):4}, {hex(c):4}, {hex(d):4} }},") shape.print(" },") shape.print("};") @@ -416,13 +378,9 @@ def __init__(self, addr: int, name: str, model_name: str): def scan(self, shape): start = self.addr - BASE_ADDR - (self.ptr_display_list,) = struct.unpack( - ">I", shape.file_bytes[start : start + 4] - ) + (self.ptr_display_list,) = struct.unpack(">I", shape.file_bytes[start : start + 4]) - gfx_segment = shape.push( - DisplayListSegment(self.ptr_display_list, "Gfx", self.model_name) - ) + gfx_segment = shape.push(DisplayListSegment(self.ptr_display_list, "Gfx", self.model_name)) # Gfx segments may have been already visited during root Gfx traversal # so we will now force the associated model name to be the current model gfx_segment.model_name = self.model_name @@ -449,15 +407,9 @@ def scan(self, shape): if op == GFX_END_DL: break elif op == GFX_START_DL: - shape.push( - DisplayListSegment( - w2, f"Gfx_{hex(w2)[2:].upper()}", self.model_name - ) - ) + shape.push(DisplayListSegment(w2, f"Gfx_{hex(w2)[2:].upper()}", self.model_name)) elif op == GFX_LOAD_MATRIX: - shape.push( - MatrixSegment(w2, f"Mtx_{hex(w2)[2:]}", model_name=self.model_name) - ) + shape.push(MatrixSegment(w2, f"Mtx_{hex(w2)[2:]}", model_name=self.model_name)) elif op == GFX_LOAD_VTX: num = (w1 >> 12) & 0xFFF idx = (w2 - shape.vtx_table.addr) // 0x10 @@ -492,9 +444,7 @@ def print(self, shape): end = (w1 & 0x00000FFF) // 2 buf_pos = end - num index = (w2 - shape.vtx_table.addr) // 0x10 - shape.print( - f" gsSPVertex(&{shape.vtx_table.get_sym()}[{index}], {num}, {buf_pos})," - ) + shape.print(f" gsSPVertex(&{shape.vtx_table.get_sym()}[{index}], {num}, {buf_pos}),") elif op == GFX_DRAW_TRI: i = (w1 & 0x00FF0000) >> 16 j = (w1 & 0x0000FF00) >> 8 @@ -507,9 +457,7 @@ def print(self, shape): d = (w2 & 0x00FF0000) >> 16 e = (w2 & 0x0000FF00) >> 8 f = w2 & 0x000000FF - shape.print( - f" gsSP2Triangles({a // 2}, {b // 2}, {c // 2}, 0, {d // 2}, {e // 2}, {f // 2}, 0)," - ) + shape.print(f" gsSP2Triangles({a // 2}, {b // 2}, {c // 2}, 0, {d // 2}, {e // 2}, {f // 2}, 0),") elif op == GFX_RDP_PIPE_SYNC: shape.print(" gsDPPipeSync(),") elif op == GFX_POP_MATRIX: @@ -522,9 +470,7 @@ def print(self, shape): flags = self.get_geometry_flags(~(w1 | 0xFF000000)) shape.print(f" gsSPClearGeometryMode({flags}),") elif op == GFX_LOAD_MATRIX: - shape.print( - f" gsSPMatrix(&{shape.get_symbol(w2)}, G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW)," - ) + shape.print(f" gsSPMatrix(&{shape.get_symbol(w2)}, G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW),") elif op == GFX_START_DL: shape.print(f" gsSPDisplayList({shape.get_symbol(w2)}),") elif op == GFX_END_DL: @@ -610,9 +556,7 @@ def build_model_name_map(self, node_addr: int, names: deque): child_start = ptr_children - BASE_ADDR for i in range(num_children): - (ptr_child,) = struct.unpack( - ">I", self.file_bytes[child_start : child_start + 4] - ) + (ptr_child,) = struct.unpack(">I", self.file_bytes[child_start : child_start + 4]) self.build_model_name_map(ptr_child, names) child_start += 4 diff --git a/tools/build/mapfs/tex.py b/tools/build/mapfs/tex.py index e0b39a5981b..f560a907a3f 100644 --- a/tools/build/mapfs/tex.py +++ b/tools/build/mapfs/tex.py @@ -40,15 +40,11 @@ def img_from_json(json_data, tex_name: str, asset_stack: Tuple[Path, ...]) -> Te if main_data == None: raise Exception(f"Texture {ret.img_name} has no definition for 'main'") - (main_fmt_name, ret.main_hwrap, ret.main_vwrap) = ret.read_json_img( - main_data, "main", ret.img_name - ) + (main_fmt_name, ret.main_hwrap, ret.main_vwrap) = ret.read_json_img(main_data, "main", ret.img_name) (ret.main_fmt, ret.main_depth) = get_format_code(main_fmt_name) # read main image - img_path = get_asset_path( - Path(f"mapfs/tex/{tex_name}/{ret.img_name}.png"), asset_stack - ) + img_path = get_asset_path(Path(f"mapfs/tex/{tex_name}/{ret.img_name}.png"), asset_stack) if not os.path.isfile(img_path): raise Exception(f"Could not find main image for texture: {ret.img_name}") ( @@ -62,9 +58,7 @@ def img_from_json(json_data, tex_name: str, asset_stack: Tuple[Path, ...]) -> Te ret.has_aux = "aux" in json_data if ret.has_aux: aux_data = json_data.get("aux") - (aux_fmt_name, ret.aux_hwrap, ret.aux_vwrap) = ret.read_json_img( - aux_data, "aux", ret.img_name - ) + (aux_fmt_name, ret.aux_hwrap, ret.aux_vwrap) = ret.read_json_img(aux_data, "aux", ret.img_name) if aux_fmt_name == "Shared": # aux tiles have blank attributes in SHARED mode @@ -79,9 +73,7 @@ def img_from_json(json_data, tex_name: str, asset_stack: Tuple[Path, ...]) -> Te ret.extra_tiles = TILES_INDEPENDENT_AUX # read aux image - img_path = get_asset_path( - Path(f"mapfs/tex/{tex_name}/{ret.img_name}_AUX.png"), asset_stack - ) + img_path = get_asset_path(Path(f"mapfs/tex/{tex_name}/{ret.img_name}_AUX.png"), asset_stack) if not os.path.isfile(img_path): raise Exception(f"Could not find AUX image for texture: {ret.img_name}") ( @@ -127,9 +119,7 @@ def img_from_json(json_data, tex_name: str, asset_stack: Tuple[Path, ...]) -> Te f"Texture {ret.img_name} is missing mipmap level {mipmap_idx} (size = {mmw} x {mmh})" ) - (raster, pal, width, height) = ret.get_img_file( - main_fmt_name, str(img_path) - ) + (raster, pal, width, height) = ret.get_img_file(main_fmt_name, str(img_path)) ret.mipmaps.append(raster) if width != mmw or height != mmh: raise Exception( @@ -160,9 +150,7 @@ def img_from_json(json_data, tex_name: str, asset_stack: Tuple[Path, ...]) -> Te return ret -def build( - out_path: Path, tex_name: str, asset_stack: Tuple[Path, ...], endian: str = "big" -): +def build(out_path: Path, tex_name: str, asset_stack: Tuple[Path, ...], endian: str = "big"): out_bytes = bytearray() json_path = get_asset_path(Path(f"mapfs/tex/{tex_name}.json"), asset_stack) @@ -172,9 +160,7 @@ def build( json_data = json.loads(json_str) if len(json_data) > 128: - raise Exception( - f"Maximum number of textures (128) exceeded by {tex_name} ({len(json_data)})`" - ) + raise Exception(f"Maximum number of textures (128) exceeded by {tex_name} ({len(json_data)})`") for img_data in json_data: img = img_from_json(img_data, tex_name, asset_stack) @@ -189,9 +175,7 @@ def build( parser.add_argument("bin_out", type=Path, help="Output binary file path") parser.add_argument("name", help="Name of tex subdirectory") parser.add_argument("asset_stack", help="comma-separated asset stack") - parser.add_argument( - "--endian", choices=["big", "little"], default="big", help="Output endianness" - ) + parser.add_argument("--endian", choices=["big", "little"], default="big", help="Output endianness") args = parser.parse_args() asset_stack = tuple(Path(d) for d in args.asset_stack.split(",")) diff --git a/tools/build/msg/combine.py b/tools/build/msg/combine.py index 5b6cc4af41c..b28f1e8d43a 100755 --- a/tools/build/msg/combine.py +++ b/tools/build/msg/combine.py @@ -6,6 +6,7 @@ import msgpack import os + class Message: def __init__(self, d: dict, header_file_index: int): self.section = d.get("section") @@ -14,6 +15,7 @@ def __init__(self, d: dict, header_file_index: int): self.bytes = d["bytes"] self.header_file_index = header_file_index + if __name__ == "__main__": if len(argv) < 3: print("usage: combine.py [out.bin] [out.h] [compiled...]") @@ -22,7 +24,7 @@ def __init__(self, d: dict, header_file_index: int): _, outfile, header_file, *infiles = argv messages = [] - #header_files = [] + # header_files = [] for i, infile in enumerate(infiles): # if infile == "--headers": @@ -34,12 +36,12 @@ def __init__(self, d: dict, header_file_index: int): with open(outfile, "wb") as f: # sectioned+indexed, followed by just sectioned, followed by just indexed, followed by named (unsectioned & unindexed) - #messages.sort(key=lambda msg: bool(msg.section)<<2 + bool(msg.index)) + # messages.sort(key=lambda msg: bool(msg.section)<<2 + bool(msg.index)) names = set() sections = [] - #messages_by_file = {} + # messages_by_file = {} for message in messages: if message.section is None: @@ -64,10 +66,10 @@ def __init__(self, d: dict, header_file_index: int): # else: # names.add(message.name) - # if message.header_file_index in messages_by_file: - # messages_by_file[message.header_file_index].add(message) - # else: - # messages_by_file[message.header_file_index] = set([message]) + # if message.header_file_index in messages_by_file: + # messages_by_file[message.header_file_index].add(message) + # else: + # messages_by_file[message.header_file_index] = set([message]) if message.index in section: print(f"warning: multiple messages allocated to id {section_idx:02X}:{message.index:03X}") @@ -77,7 +79,7 @@ def __init__(self, d: dict, header_file_index: int): section[message.index] = message - f.seek((len(sections) + 1) * 4) # skip past table of contents + f.seek((len(sections) + 1) * 4) # skip past table of contents section_offsets = [] for section in sections: @@ -97,21 +99,15 @@ def __init__(self, d: dict, header_file_index: int): # padding while f.tell() % 0x10 != 0: - f.write(b'\0\0\0\0') + f.write(b"\0\0\0\0") f.seek(0) for offset in section_offsets: f.write(offset.to_bytes(4, byteorder="big")) - f.write(b'\0\0\0\0') + f.write(b"\0\0\0\0") with open(header_file, "w") as f: - f.write( - f"#ifndef _MESSAGE_IDS_H_\n" - f"#define _MESSAGE_IDS_H_\n" - "\n" - '#include "messages.h"\n' - "\n" - ) + f.write(f"#ifndef _MESSAGE_IDS_H_\n" f"#define _MESSAGE_IDS_H_\n" "\n" '#include "messages.h"\n' "\n") for message in messages: if message.name: diff --git a/tools/build/msg/parse_compile.py b/tools/build/msg/parse_compile.py index 85d40c731a8..c9d4d2e345e 100755 --- a/tools/build/msg/parse_compile.py +++ b/tools/build/msg/parse_compile.py @@ -3,7 +3,8 @@ from sys import argv from collections import OrderedDict import re -import msgpack # way faster than pickle +import msgpack # way faster than pickle + class Message: def __init__(self, name, section, index): @@ -11,7 +12,8 @@ def __init__(self, name, section, index): self.section = section self.index = index - self.bytes = [] # XXX: bytearray would be better + self.bytes = [] # XXX: bytearray would be better + def try_convert_int(s): try: @@ -19,10 +21,11 @@ def try_convert_int(s): except: return s + def parse_command(source): if source[0] != "[": return None, [], {}, source - source = source[1:] # "[" + source = source[1:] # "[" inside_brackets = "" while source[0] != "]": @@ -31,7 +34,7 @@ def parse_command(source): inside_brackets += source[0] source = source[1:] - source = source[1:] # "]" + source = source[1:] # "]" command, *raw_args = inside_brackets.split(" ") @@ -58,6 +61,7 @@ def parse_command(source): return command.lower(), args, named_args, source + def color_to_code(color, style): COLORS = { "diary": { @@ -90,26 +94,30 @@ def color_to_code(color, style): "red": 0x19, "blue": 0x1A, "green": 0x1B, - } + }, } if type(color) is int: return color - return COLORS.get(style, { - # [style:left], [style:right] - "normal": 0x0A, - "red": 0x20, - "pink": 0x21, - "purple": 0x22, - "blue": 0x23, - "cyan": 0x24, - "green": 0x25, - "yellow": 0x26, - }).get(color) + return COLORS.get( + style, + { + # [style:left], [style:right] + "normal": 0x0A, + "red": 0x20, + "pink": 0x21, + "purple": 0x22, + "blue": 0x23, + "cyan": 0x24, + "green": 0x25, + "yellow": 0x26, + }, + ).get(color) + CHARSET = { - #"𝅘𝅥𝅮": 0x00, + # "𝅘𝅥𝅮": 0x00, "!": 0x01, '"': 0x02, "#": 0x03, @@ -323,19 +331,22 @@ def color_to_code(color, style): " ": 0xF7, } + def strip_c_comments(text): def replacer(match): s = match.group(0) - if s.startswith('/'): + if s.startswith("/"): return " " else: return s + pattern = re.compile( r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"', - re.DOTALL | re.MULTILINE + re.DOTALL | re.MULTILINE, ) return re.sub(pattern, replacer, text) + if __name__ == "__main__": if len(argv) < 3: print("usage: parse_compile.py [in.msg] [out.msgpack] [--c]") @@ -435,7 +446,7 @@ def replacer(match): print(f"{filename}:{lineno}: expected opening brace ('{{')") exit(1) - source = source[1:] # { + source = source[1:] # { # count indent level indent_level = 0 @@ -484,8 +495,8 @@ def replacer(match): exit(1) message.bytes += [0xFF, 0x05, color] - #color_stack.append(color) - #elif command == "/color": + # color_stack.append(color) + # elif command == "/color": # color_stack.pop() # message.bytes += [0xFF, 0x05, color_stack[0]] elif command == "style": @@ -517,7 +528,13 @@ def replacer(match): print(f"{filename}:{lineno}: 'choice' style requires size=_,_") exit(1) - message.bytes += [0x05, pos[0], pos[1], size[0], size[1]] + message.bytes += [ + 0x05, + pos[0], + pos[1], + size[0], + size[1], + ] elif style == "inspect": message.bytes += [0x06] elif style == "sign": @@ -553,7 +570,13 @@ def replacer(match): print(f"{filename}:{lineno}: 'upgrade' style requires size=_,_") exit(1) - message.bytes += [0x0C, pos[0], pos[1], size[0], size[1]] + message.bytes += [ + 0x0C, + pos[0], + pos[1], + size[0], + size[1], + ] elif style == "narrate": message.bytes += [0x0D] elif style == "epilogue": @@ -579,7 +602,7 @@ def replacer(match): exit(1) message.bytes += [0xFF, 0x00, font] - #font_stack.append(font) + # font_stack.append(font) if font == 3 or font == 4: charset = CHARSET_CREDITS @@ -709,7 +732,13 @@ def replacer(match): print(f"{filename}:{lineno}: {command} command requires raster=_") exit(1) - message.bytes += [0xFF, 0x16, spriteid >> 8, spriteid & 0xFF, raster] + message.bytes += [ + 0xFF, + 0x16, + spriteid >> 8, + spriteid & 0xFF, + raster, + ] elif command == "itemicon": itemid = named_args.get("itemid") @@ -722,7 +751,7 @@ def replacer(match): message.bytes += [0xFF, 0x17, itemid >> 8, itemid & 0xFF] elif command == "image": index = named_args.get("index") - pos = named_args.get("pos") # xx,y + pos = named_args.get("pos") # xx,y hasborder = named_args.get("hasborder") alpha = named_args.get("alpha") fadeamount = named_args.get("fadeamount") @@ -743,7 +772,17 @@ def replacer(match): print(f"{filename}:{lineno}: {command} command requires fadeamount=_") exit(1) - message.bytes += [0xFF, 0x18, index, pos[0] >> 8, pos[0] & 0xFF, pos[1], hasborder, alpha, fadeamount] + message.bytes += [ + 0xFF, + 0x18, + index, + pos[0] >> 8, + pos[0] & 0xFF, + pos[1], + hasborder, + alpha, + fadeamount, + ] elif command == "hideimage": fadeamount = named_args.get("fadeamount", 0) @@ -933,9 +972,16 @@ def replacer(match): exit(1) message.bytes += [ - 0xFF, 0x2C, - soundids[0] >> 24, (soundids[0] >> 16) & 0xFF, (soundids[0] >> 8) & 0xFF, soundids[0] & 0xFF, - soundids[1] >> 24, (soundids[1] >> 16) & 0xFF, (soundids[1] >> 8) & 0xFF, soundids[1] & 0xFF, + 0xFF, + 0x2C, + soundids[0] >> 24, + (soundids[0] >> 16) & 0xFF, + (soundids[0] >> 8) & 0xFF, + soundids[0] & 0xFF, + soundids[1] >> 24, + (soundids[1] >> 16) & 0xFF, + (soundids[1] >> 8) & 0xFF, + soundids[1] & 0xFF, ] elif command == "volume": if len(args) != 1: @@ -962,70 +1008,184 @@ def replacer(match): exit(1) message.bytes += [0xFF, 0x2F, sound] - #sound_stack.append(sound) + # sound_stack.append(sound) # elif command == "/sound": # sound_stack.pop() # message.bytes += [0xFF, 0x2F, sound_stack[0]] elif command == "a": color_code = color_to_code("blue", "button") assert color_code is not None - message.bytes += [0xFF, 0x24, 0xFF, 0x05, color_code, 0x98, 0xFF, 0x25] + message.bytes += [ + 0xFF, + 0x24, + 0xFF, + 0x05, + color_code, + 0x98, + 0xFF, + 0x25, + ] elif command == "b": - color_code = color_to_code(named_args.get("color", "green"), named_args.get("ctx", "button")) + color_code = color_to_code( + named_args.get("color", "green"), + named_args.get("ctx", "button"), + ) assert color_code is not None - message.bytes += [0xFF, 0x24, 0xFF, 0x05, color_code, 0x99, 0xFF, 0x25] + message.bytes += [ + 0xFF, + 0x24, + 0xFF, + 0x05, + color_code, + 0x99, + 0xFF, + 0x25, + ] elif command == "l": - color_code = color_to_code(named_args.get("color", "gray"), named_args.get("ctx", "button")) + color_code = color_to_code( + named_args.get("color", "gray"), + named_args.get("ctx", "button"), + ) assert color_code is not None - message.bytes += [0xFF, 0x24, 0xFF, 0x05, color_code, 0x9A, 0xFF, 0x25] + message.bytes += [ + 0xFF, + 0x24, + 0xFF, + 0x05, + color_code, + 0x9A, + 0xFF, + 0x25, + ] elif command == "r": - color_code = color_to_code(named_args.get("color", "gray"), named_args.get("ctx", "button")) + color_code = color_to_code( + named_args.get("color", "gray"), + named_args.get("ctx", "button"), + ) assert color_code is not None - message.bytes += [0xFF, 0x24, 0xFF, 0x05, color_code, 0x9B, 0xFF, 0x25] + message.bytes += [ + 0xFF, + 0x24, + 0xFF, + 0x05, + color_code, + 0x9B, + 0xFF, + 0x25, + ] elif command == "z": color_code = color_to_code("grey", "button") assert color_code is not None - message.bytes += [0xFF, 0x24, 0xFF, 0x05, color_code, 0x9C, 0xFF, 0x25] + message.bytes += [ + 0xFF, + 0x24, + 0xFF, + 0x05, + color_code, + 0x9C, + 0xFF, + 0x25, + ] elif command == "c-up": - color_code = color_to_code(named_args.get("color", "yellow"), named_args.get("ctx", "button")) + color_code = color_to_code( + named_args.get("color", "yellow"), + named_args.get("ctx", "button"), + ) assert color_code is not None - message.bytes += [0xFF, 0x24, 0xFF, 0x05, color_code, 0x9D, 0xFF, 0x25] + message.bytes += [ + 0xFF, + 0x24, + 0xFF, + 0x05, + color_code, + 0x9D, + 0xFF, + 0x25, + ] elif command == "c-down": - color_code = color_to_code(named_args.get("color", "yellow"), named_args.get("ctx", "button")) + color_code = color_to_code( + named_args.get("color", "yellow"), + named_args.get("ctx", "button"), + ) assert color_code is not None - message.bytes += [0xFF, 0x24, 0xFF, 0x05, color_code, 0x9E, 0xFF, 0x25] + message.bytes += [ + 0xFF, + 0x24, + 0xFF, + 0x05, + color_code, + 0x9E, + 0xFF, + 0x25, + ] elif command == "c-left": - color_code = color_to_code(named_args.get("color", "yellow"), named_args.get("ctx", "button")) + color_code = color_to_code( + named_args.get("color", "yellow"), + named_args.get("ctx", "button"), + ) assert color_code is not None - message.bytes += [0xFF, 0x24, 0xFF, 0x05, color_code, 0x9F, 0xFF, 0x25] + message.bytes += [ + 0xFF, + 0x24, + 0xFF, + 0x05, + color_code, + 0x9F, + 0xFF, + 0x25, + ] elif command == "c-right": - color_code = color_to_code(named_args.get("color", "yellow"), named_args.get("ctx", "button")) + color_code = color_to_code( + named_args.get("color", "yellow"), + named_args.get("ctx", "button"), + ) assert color_code is not None - message.bytes += [0xFF, 0x24, 0xFF, 0x05, color_code, 0xA0, 0xFF, 0x25] + message.bytes += [ + 0xFF, + 0x24, + 0xFF, + 0x05, + color_code, + 0xA0, + 0xFF, + 0x25, + ] elif command == "start": - color_code = color_to_code(named_args.get("color", "red"), named_args.get("ctx", "button"))# + color_code = color_to_code( + named_args.get("color", "red"), + named_args.get("ctx", "button"), + ) # assert color_code is not None - message.bytes += [0xFF, 0x24, 0xFF, 0x05, color_code, 0xA1, 0xFF, 0x25] + message.bytes += [ + 0xFF, + 0x24, + 0xFF, + 0x05, + color_code, + 0xA1, + 0xFF, + 0x25, + ] elif command == "~a": message.bytes += [0x98] elif command == "~b": message.bytes += [0x99] elif command == "~l": - message.bytes += [0x9a] + message.bytes += [0x9A] elif command == "~r": - message.bytes += [0x9b] + message.bytes += [0x9B] elif command == "~z": - message.bytes += [0x9c] + message.bytes += [0x9C] elif command == "~c-up": - message.bytes += [0x9d] + message.bytes += [0x9D] elif command == "~c-down": - message.bytes += [0x9e] + message.bytes += [0x9E] elif command == "~c-left": - message.bytes += [0x9f] + message.bytes += [0x9F] elif command == "~c-right": - message.bytes += [0xa0] + message.bytes += [0xA0] elif command == "~start": - message.bytes += [0xa1] + message.bytes += [0xA1] elif command == "note": message.bytes += [0x00] elif command == "heart": @@ -1043,24 +1203,24 @@ def replacer(match): elif command == "restorepos": message.bytes += [0xFF, 0x23] elif command == "enablecdownnext": - message.bytes += [0xFF, 0x2b] + message.bytes += [0xFF, 0x2B] elif command == "beginchoice": choiceindex = 0 - message.bytes += [0xFF, 0x09] # delayoff + message.bytes += [0xFF, 0x09] # delayoff elif command == "option" and choiceindex >= 0: - message.bytes += [0xFF, 0x1E, choiceindex] # cursor n - message.bytes += [0xFF, 0x21, choiceindex] # option n + message.bytes += [0xFF, 0x1E, choiceindex] # cursor n + message.bytes += [0xFF, 0x21, choiceindex] # option n choiceindex += 1 elif command == "endchoice" and choiceindex >= 0: cancel = named_args.get("cancel") - message.bytes += [0xFF, 0x21, 255] # option 255 - message.bytes += [0xFF, 0x0A] # delayon + message.bytes += [0xFF, 0x21, 255] # option 255 + message.bytes += [0xFF, 0x0A] # delayon if isinstance(cancel, int): - message.bytes += [0xFF, 0x20, cancel] # setcancel n + message.bytes += [0xFF, 0x20, cancel] # setcancel n - message.bytes += [0xFF, 0x1F, choiceindex] # endchoice n + message.bytes += [0xFF, 0x1F, choiceindex] # endchoice n choiceindex = -1 elif command == "animation" and choiceindex >= 0: @@ -1074,7 +1234,7 @@ def replacer(match): if source[0] == "}": if not explicit_end: print(f"{filename}:{lineno}: warning: string lacks an [end] command") - #message.bytes += [0xFD] + # message.bytes += [0xFD] explicit_end = False # sanity check @@ -1087,7 +1247,7 @@ def replacer(match): message.bytes += [0x00] message = None - source = source[1:] # } + source = source[1:] # } indent_level = 0 choiceindex = -1 continue @@ -1124,9 +1284,15 @@ def replacer(match): else: with open(outfile, "wb") as f: - msgpack.pack([{ - "section": message.section, - "index": message.index, - "name": message.name, - "bytes": bytes(message.bytes), - } for message in messages], f) + msgpack.pack( + [ + { + "section": message.section, + "index": message.index, + "name": message.name, + "bytes": bytes(message.bytes), + } + for message in messages + ], + f, + ) diff --git a/tools/build/pal_inc_c.py b/tools/build/pal_inc_c.py index 4a0ce30cf44..1299e0f1edb 100755 --- a/tools/build/pal_inc_c.py +++ b/tools/build/pal_inc_c.py @@ -10,8 +10,8 @@ f.write(f"unsigned short {cname}[] = {{ ") with open(infile, "rb") as i: - while (short := i.read(2)): - color = struct.unpack('>H', short)[0] - f.write(f'0x{color:04X}, ') + while short := i.read(2): + color = struct.unpack(">H", short)[0] + f.write(f"0x{color:04X}, ") f.write("};\n") diff --git a/tools/build/pm_charset.py b/tools/build/pm_charset.py index b7830021f75..43d47028d91 100755 --- a/tools/build/pm_charset.py +++ b/tools/build/pm_charset.py @@ -3,7 +3,7 @@ from sys import argv if __name__ == "__main__": - argv.pop(0) # python3 + argv.pop(0) # python3 out = argv.pop(0) with open(out, "wb") as f: @@ -11,4 +11,4 @@ with open(path, "rb") as j: f.write(j.read()) while f.tell() % 8 != 0: - f.write(b'\0') + f.write(b"\0") diff --git a/tools/build/pm_charset_palettes.py b/tools/build/pm_charset_palettes.py index af5040a2189..b16b5ca7489 100755 --- a/tools/build/pm_charset_palettes.py +++ b/tools/build/pm_charset_palettes.py @@ -3,7 +3,7 @@ from sys import argv if __name__ == "__main__": - argv.pop(0) # python3 + argv.pop(0) # python3 out = argv.pop(0) with open(out, "wb") as f: diff --git a/tools/build/pm_icons.py b/tools/build/pm_icons.py index d240d2d508d..5bb0e8111c7 100644 --- a/tools/build/pm_icons.py +++ b/tools/build/pm_icons.py @@ -9,6 +9,7 @@ from img.build import Converter import png + def get_img_file(fmt_str, img_file: str): def pack_color(r, g, b, a): r = r >> 3 @@ -34,6 +35,7 @@ def pack_color(r, g, b, a): return (out_img, out_pal, out_w, out_h) + def build(out_bin: Path, in_xml: Path, out_header: Path, asset_stack: Tuple[Path, ...]): out_bytes = bytearray() offsets: Dict[str, int] = {} @@ -47,11 +49,11 @@ def build(out_bin: Path, in_xml: Path, out_header: Path, asset_stack: Tuple[Path if file is None: raise Exception("Icon os missing attribute: 'name'") - + if type is None: raise Exception("Icon os missing attribute: 'type'") - - name = re.sub("\\W","_",file) + + name = re.sub("\\W", "_", file) if type == "solo" or type == "pair": img_path = str(get_asset_path(Path(f"icon/{file}.png"), asset_stack)) @@ -66,7 +68,7 @@ def build(out_bin: Path, in_xml: Path, out_header: Path, asset_stack: Tuple[Path if type == "pair": img_path = str(get_asset_path(Path(f"icon/{file}.disabled.png"), asset_stack)) (out_img, out_pal, out_w, out_h) = get_img_file("CI4", str(img_path)) - + offsets[name + "_disabled_raster"] = offsets[name + "_raster"] offsets[name + "_disabled_palette"] = len(out_bytes) out_bytes += out_pal @@ -88,12 +90,13 @@ def build(out_bin: Path, in_xml: Path, out_header: Path, asset_stack: Tuple[Path f.write("#ifndef ICON_OFFSETS_H\n") f.write("#define ICON_OFFSETS_H\n") f.write(f"/* This file is auto-generated. Do not edit. */\n\n") - + for name, offset in offsets.items(): f.write(f"#define ICON_{name} 0x{offset:X}\n") f.write("\n#endif // ICON_OFFSETS_H\n") + if __name__ == "__main__": parser = argparse.ArgumentParser(description="Icon archive") parser.add_argument("out_bin", type=Path, help="output binary file path") diff --git a/tools/build/sprite/header.py b/tools/build/sprite/header.py index 5a43f7a2e76..cb4b9d4c789 100755 --- a/tools/build/sprite/header.py +++ b/tools/build/sprite/header.py @@ -50,13 +50,9 @@ for p, palette_name in enumerate(sprite.palette_names): for a, name in enumerate(sprite.animation_names): if palette_name == "Default": - f.write( - f"#define ANIM_{sprite_name}_{name} 0x{s:02X}{p:02X}{a:02X}\n" - ) + f.write(f"#define ANIM_{sprite_name}_{name} 0x{s:02X}{p:02X}{a:02X}\n") else: - f.write( - f"#define ANIM_{sprite_name}_{palette_name}_{name} 0x{s:02X}{p:02X}{a:02X}\n" - ) + f.write(f"#define ANIM_{sprite_name}_{palette_name}_{name} 0x{s:02X}{p:02X}{a:02X}\n") f.write("\n") f.write("#endif\n") diff --git a/tools/build/sprite/npc_sprite.py b/tools/build/sprite/npc_sprite.py index c6df2759c4d..b60268899b2 100644 --- a/tools/build/sprite/npc_sprite.py +++ b/tools/build/sprite/npc_sprite.py @@ -76,9 +76,7 @@ def from_dir( palettes.append(palette) - palette_names.append( - Palette.get("name", Palette.attrib["src"].split(".png")[0]) - ) + palette_names.append(Palette.get("name", Palette.attrib["src"].split(".png")[0])) images = [] image_names: List[str] = [] @@ -192,9 +190,7 @@ def from_dir( palette_offsets.append(f.tell()) for rgba in palette: if rgba[3] not in (0, 0xFF): - print( - "error: translucent pixels not allowed in palette {sprite.palette_names[i]}" - ) + print("error: translucent pixels not allowed in palette {sprite.palette_names[i]}") exit(1) color = pack_color(*rgba) diff --git a/tools/build/sprite/sprite_shading_profiles.py b/tools/build/sprite/sprite_shading_profiles.py index 066f5d0d00b..3c5aee2c5c9 100755 --- a/tools/build/sprite/sprite_shading_profiles.py +++ b/tools/build/sprite/sprite_shading_profiles.py @@ -8,11 +8,13 @@ import struct from typing import List, Literal + class LightMode(Enum): UNIFORM = 0 LINEAR = 4 QUADRATIC = 8 + @dataclass class Light: flags: int @@ -83,9 +85,14 @@ def groups_from_json(data) -> List[SpriteShadingGroup]: ) return groups -def build(input: Path, bin_out: Path, header_out: Path, endian: Literal["big", "little"]="big", - matching: bool = True): +def build( + input: Path, + bin_out: Path, + header_out: Path, + endian: Literal["big", "little"] = "big", + matching: bool = True, +): END = ">" if endian == "big" else "<" with open(input, "r") as f: @@ -145,11 +152,11 @@ def build(input: Path, bin_out: Path, header_out: Path, endian: Literal["big", " offsets_table.extend(profile_lists) if matching: - offsets_table += b'\0' * (0x1D0 - len(offsets_table)) # Pad to 0x1D0 + offsets_table += b"\0" * (0x1D0 - len(offsets_table)) # Pad to 0x1D0 final_data = offsets_table + data_table if matching: - final_data += b'\0' * (0xE70 - len(final_data)) # Pad to 0xE70 + final_data += b"\0" * (0xE70 - len(final_data)) # Pad to 0xE70 with open(bin_out, "wb") as f: f.write(final_data) diff --git a/tools/build/sprite/sprites.py b/tools/build/sprite/sprites.py index bd131e62b10..931e1932e75 100755 --- a/tools/build/sprite/sprites.py +++ b/tools/build/sprite/sprites.py @@ -33,9 +33,7 @@ from dataclasses import dataclass from typing import Dict, List, Tuple -TOOLS_DIR = Path( - os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -) +TOOLS_DIR = Path(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) sys.path.append(str(TOOLS_DIR)) ASSET_DIR = TOOLS_DIR.parent / "assets" @@ -52,11 +50,7 @@ def pack_color(r, g, b, a) -> int: def get_player_sprite_metadata( asset_stack: Tuple[Path, ...], ) -> Tuple[str, List[str], List[str]]: - orderings_tree = ET.parse( - get_asset_path( - Path("sprite") / PLAYER_SPRITE_MEDADATA_XML_FILENAME, asset_stack - ) - ) + orderings_tree = ET.parse(get_asset_path(Path("sprite") / PLAYER_SPRITE_MEDADATA_XML_FILENAME, asset_stack)) build_info = str(orderings_tree.getroot()[0].text) @@ -72,9 +66,7 @@ def get_player_sprite_metadata( def get_npc_sprite_metadata(asset_stack: Tuple[Path, ...]) -> List[str]: - orderings_tree = ET.parse( - get_asset_path(Path("sprite") / NPC_SPRITE_MEDADATA_XML_FILENAME, asset_stack) - ) + orderings_tree = ET.parse(get_asset_path(Path("sprite") / NPC_SPRITE_MEDADATA_XML_FILENAME, asset_stack)) sprite_order: List[str] = [] for sprite_tag in orderings_tree.getroot()[0]: @@ -100,18 +92,14 @@ def size(self): PLAYER_XML_CACHE: Dict[str, ET.Element] = {} # TODO perhaps encode this better -SPECIAL_RASTER_BYTES = ( - b"\x80\x30\x02\x10\x00\x00\x02\x00\x00\x00\x00\x01\x00\x10\x00\x00" -) +SPECIAL_RASTER_BYTES = b"\x80\x30\x02\x10\x00\x00\x02\x00\x00\x00\x00\x01\x00\x10\x00\x00" def cache_player_rasters(raster_order: List[str], asset_stack: Tuple[Path, ...]): # Read all player rasters and cache them cur_offset = 0 for raster_name in raster_order: - png_path = get_asset_path( - Path(f"sprite/player/rasters/{raster_name}.png"), asset_stack - ) + png_path = get_asset_path(Path(f"sprite/player/rasters/{raster_name}.png"), asset_stack) # "Weird" raster if os.path.getsize(png_path) == 0x10: @@ -232,9 +220,7 @@ def player_xml_to_bytes(xml: ET.Element, asset_stack: Tuple[Path, ...]) -> List[ source = palette_xml.attrib["src"] front_only = bool(palette_xml.get("front_only", False)) if source not in PALETTE_CACHE: - palette_path = get_asset_path( - Path(f"sprite/player/palettes/{source}"), asset_stack - ) + palette_path = get_asset_path(Path(f"sprite/player/palettes/{source}"), asset_stack) with open(palette_path, "rb") as f: img = png.Reader(f) img.preamble(True) @@ -270,9 +256,7 @@ def player_xml_to_bytes(xml: ET.Element, asset_stack: Tuple[Path, ...]) -> List[ if "back" in raster_xml.attrib: has_back = True r = player_raster_from_xml(raster_xml, back=False) - raster_bytes += struct.pack( - ">IBBBB", raster_offset, r.width, r.height, r.palette_idx, 0xFF - ) + raster_bytes += struct.pack(">IBBBB", raster_offset, r.width, r.height, r.palette_idx, 0xFF) raster_offset += r.width * r.height // 2 @@ -292,9 +276,7 @@ def player_xml_to_bytes(xml: ET.Element, asset_stack: Tuple[Path, ...]) -> List[ height = int(special[1], 16) palette = int(raster_xml.attrib.get(BACK_PALETTE_XML, r.palette_idx)) - raster_bytes_back += struct.pack( - ">IBBBB", raster_offset, width, height, palette, 0xFF - ) + raster_bytes_back += struct.pack(">IBBBB", raster_offset, width, height, palette, 0xFF) if is_back: raster_offset += width * height // 2 @@ -312,9 +294,7 @@ def player_xml_to_bytes(xml: ET.Element, asset_stack: Tuple[Path, ...]) -> List[ raster_offsets_bytes_back = b"" for i in range(len(xml[1])): raster_offsets_bytes += int.to_bytes(raster_list_start + i * 8, 4, "big") - raster_offsets_bytes_back += int.to_bytes( - raster_list_start_back + i * 8, 4, "big" - ) + raster_offsets_bytes_back += int.to_bytes(raster_list_start_back + i * 8, 4, "big") raster_offsets_bytes += LIST_END_BYTES raster_offsets_bytes_back += LIST_END_BYTES @@ -330,9 +310,7 @@ def player_xml_to_bytes(xml: ET.Element, asset_stack: Tuple[Path, ...]) -> List[ palette_offsets_bytes += int.to_bytes(palette_list_start + i * 0x20, 4, "big") front_only = bool(palette_xml.attrib.get("front_only", False)) if not front_only: - palette_offsets_bytes_back += int.to_bytes( - palette_list_start_back + i * 0x20, 4, "big" - ) + palette_offsets_bytes_back += int.to_bytes(palette_list_start_back + i * 0x20, 4, "big") palette_offsets_bytes += LIST_END_BYTES palette_offsets_bytes_back += LIST_END_BYTES @@ -397,9 +375,7 @@ def write_player_sprite_header( for palette_xml in sprite_xml[0]: palette_id = int(palette_xml.attrib["id"], 0x10) palette_name = palette_xml.attrib["name"] - player_palettes[sprite_name][ - f"SPR_PAL_{sprite_name}_{palette_name}" - ] = palette_id + player_palettes[sprite_name][f"SPR_PAL_{sprite_name}_{palette_name}"] = palette_id for anim_id, anim_xml in enumerate(sprite_xml[2]): anim_name = anim_xml.attrib["name"] @@ -413,9 +389,7 @@ def write_player_sprite_header( for raster_xml in sprite_xml[1]: raster_id = int(raster_xml.attrib["id"], 0x10) raster_name = raster_xml.attrib["name"] - player_rasters[sprite_name][ - f"SPR_IMG_{sprite_name}_{raster_name}" - ] = raster_id + player_rasters[sprite_name][f"SPR_IMG_{sprite_name}_{raster_name}"] = raster_id raster = RASTER_CACHE[raster_xml.attrib["src"][:-4]] if max_size < raster.size: @@ -449,9 +423,7 @@ def write_player_sprite_header( f.write("};\n\n") for sprite_name in max_sprite_sizes: - f.write( - f"#define MAX_IMG_{sprite_name} 0x{max_sprite_sizes[sprite_name]:04X}\n" - ) + f.write(f"#define MAX_IMG_{sprite_name} 0x{max_sprite_sizes[sprite_name]:04X}\n") f.write("\n") for sprite_name in sprite_order: @@ -472,15 +444,11 @@ def write_player_sprite_header( f.write(f"#endif // {ifdef_name}\n") -def build_player_sprites( - sprite_order: List[str], build_dir: Path, asset_stack: Tuple[Path, ...] -) -> bytes: +def build_player_sprites(sprite_order: List[str], build_dir: Path, asset_stack: Tuple[Path, ...]) -> bytes: sprite_bytes: List[bytes] = [] for sprite_name in sprite_order: - sprite_bytes.extend( - player_xml_to_bytes(PLAYER_XML_CACHE[sprite_name], asset_stack) - ) + sprite_bytes.extend(player_xml_to_bytes(PLAYER_XML_CACHE[sprite_name], asset_stack)) # Compress sprite bytes compressed_sprite_bytes: bytes = b"" @@ -560,9 +528,7 @@ def build_player_rasters(sprite_order: List[str], raster_order: List[str]) -> by if has_back: if "back" in raster_xml.attrib: png_info = RASTER_CACHE[raster_xml.attrib["back"][:-4]] - sheet_rtes_back.append( - RasterTableEntry(png_info.offset, png_info.size) - ) + sheet_rtes_back.append(RasterTableEntry(png_info.offset, png_info.size)) else: sheet_rtes_back.append(RasterTableEntry(SPECIAL_RASTER, 0x10)) @@ -623,27 +589,21 @@ def build( build_dir: Path, asset_stack: Tuple[Path, ...], ) -> None: - build_info, player_sprite_order, player_raster_order = get_player_sprite_metadata( - asset_stack - ) + build_info, player_sprite_order, player_raster_order = get_player_sprite_metadata(asset_stack) npc_sprite_order = get_npc_sprite_metadata(asset_stack) cache_player_rasters(player_raster_order, asset_stack) # Read and cache player XMLs for sprite_name in player_sprite_order: - sprite_xml = ET.parse( - get_asset_path(Path(f"sprite/player/{sprite_name}.xml"), asset_stack) - ).getroot() + sprite_xml = ET.parse(get_asset_path(Path(f"sprite/player/{sprite_name}.xml"), asset_stack)).getroot() PLAYER_XML_CACHE[sprite_name] = sprite_xml # Encode build_info to bytes and pad to 0x10 build_info_bytes = build_info.encode("ascii") build_info_bytes += b"\0" * (0x10 - len(build_info_bytes)) - player_sprite_bytes = build_player_sprites( - player_sprite_order, build_dir / "player", asset_stack - ) + player_sprite_bytes = build_player_sprites(player_sprite_order, build_dir / "player", asset_stack) player_raster_bytes = build_player_rasters(player_sprite_order, player_raster_order) npc_sprite_bytes = build_npc_sprites(npc_sprite_order, build_dir) @@ -659,13 +619,7 @@ def build( npc_sprites_offset, ) - final_data = ( - build_info_bytes - + major_file_divisons - + player_raster_bytes - + player_sprite_bytes - + npc_sprite_bytes - ) + final_data = build_info_bytes + major_file_divisons + player_raster_bytes + player_sprite_bytes + npc_sprite_bytes with open(out_file, "wb") as f: f.write(final_data) diff --git a/tools/compare_shapes.py b/tools/compare_shapes.py index 00260f27888..19dc2e238a0 100755 --- a/tools/compare_shapes.py +++ b/tools/compare_shapes.py @@ -12,9 +12,7 @@ if file.endswith("_shape.bin"): total += 1 shape_file = os.path.join(root, file) - built_data_file = Path("ver/us/build") / shape_file.replace( - "_shape.bin", "_shape_data.bin" - ) + built_data_file = Path("ver/us/build") / shape_file.replace("_shape.bin", "_shape_data.bin") if filecmp.cmp(shape_file, built_data_file, shallow=False): matching += 1 diff --git a/tools/disasm_animation.py b/tools/disasm_animation.py index 7f50b962c24..14bea9e0e89 100755 --- a/tools/disasm_animation.py +++ b/tools/disasm_animation.py @@ -2,53 +2,61 @@ import struct + def read(f): - return struct.unpack('>h', f.read(2))[0] + return struct.unpack(">h", f.read(2))[0] + def i2f(x): return round(x * 180 / 32767 * 200) / 200 + def parse(f): - print('AnimScript script = {') - indent = ' ' + print("AnimScript script = {") + indent = " " while True: op = read(f) if op == 0: - print(f'{indent}AS_END,') + print(f"{indent}AS_END,") break if op == 1: - print(f'{indent}AS_WAIT, {read(f)},') + print(f"{indent}AS_WAIT, {read(f)},") elif op == 3: indent = indent[:-4] - print(f'{indent}AS_END_LOOP,') + print(f"{indent}AS_END_LOOP,") elif op == 5: - print(f'{indent}AS_SET_ROTATION, {read(f)}, AS_F({i2f(read(f))}), AS_F({i2f(read(f))}), AS_F({i2f(read(f))}),') + print( + f"{indent}AS_SET_ROTATION, {read(f)}, AS_F({i2f(read(f))}), AS_F({i2f(read(f))}), AS_F({i2f(read(f))})," + ) elif op == 6: - print(f'{indent}AS_ADD_ROTATION, {read(f)}, AS_F({i2f(read(f))}), AS_F({i2f(read(f))}), AS_F({i2f(read(f))}),') + print( + f"{indent}AS_ADD_ROTATION, {read(f)}, AS_F({i2f(read(f))}), AS_F({i2f(read(f))}), AS_F({i2f(read(f))})," + ) elif op == 8: - print(f'{indent}AS_SET_POS, {read(f)}, {read(f)}, {read(f)}, {read(f)},') + print(f"{indent}AS_SET_POS, {read(f)}, {read(f)}, {read(f)}, {read(f)},") elif op == 10: - print(f'{indent}AS_LOOP,') - indent += ' ' + print(f"{indent}AS_LOOP,") + indent += " " elif op == 14: - print(f'{indent}AS_SET_FLAGS, {read(f)},') + print(f"{indent}AS_SET_FLAGS, {read(f)},") elif op == 15: - print(f'{indent}AS_SET_NODE_FLAGS, {read(f)}, {read(f)},') + print(f"{indent}AS_SET_NODE_FLAGS, {read(f)}, {read(f)},") elif op == 16: - print(f'{indent}AS_CLEAR_NODE_FLAGS, {read(f)}, {read(f)},') + print(f"{indent}AS_CLEAR_NODE_FLAGS, {read(f)}, {read(f)},") elif op == 17: - print(f'{indent}AS_SET_SCALE, {read(f)}, AS_F({i2f(read(f))}), AS_F({i2f(read(f))}), AS_F({i2f(read(f))}),') + print(f"{indent}AS_SET_SCALE, {read(f)}, AS_F({i2f(read(f))}), AS_F({i2f(read(f))}), AS_F({i2f(read(f))}),") elif op == 18: - print(f'{indent}AS_SET_RENDER_MODE, {read(f)},') + print(f"{indent}AS_SET_RENDER_MODE, {read(f)},") elif op == 19: - print(f'{indent}AS_OP_19,') + print(f"{indent}AS_OP_19,") else: - raise Exception(str(f'Unknown opcode {op}')) - print('};') + raise Exception(str(f"Unknown opcode {op}")) + print("};") if __name__ == "__main__": import argparse + parser = argparse.ArgumentParser() parser.add_argument("file", type=str, help="File to dissassemble from") parser.add_argument("offset", help="Offset to start dissassembling from") diff --git a/tools/disasm_hud_element_animation.py b/tools/disasm_hud_element_animation.py index ce9a1dcc314..421899d8a84 100755 --- a/tools/disasm_hud_element_animation.py +++ b/tools/disasm_hud_element_animation.py @@ -3,62 +3,63 @@ import struct import argparse + def fmt_size(val): if val == 0: - return 'HUD_ELEMENT_SIZE_8x8' + return "HUD_ELEMENT_SIZE_8x8" elif val == 1: - return 'HUD_ELEMENT_SIZE_16x16' + return "HUD_ELEMENT_SIZE_16x16" elif val == 2: - return 'HUD_ELEMENT_SIZE_24x24' + return "HUD_ELEMENT_SIZE_24x24" elif val == 3: - return 'HUD_ELEMENT_SIZE_32x32' + return "HUD_ELEMENT_SIZE_32x32" elif val == 4: - return 'HUD_ELEMENT_SIZE_48x48' + return "HUD_ELEMENT_SIZE_48x48" elif val == 5: - return 'HUD_ELEMENT_SIZE_64x64' + return "HUD_ELEMENT_SIZE_64x64" elif val == 6: - return 'HUD_ELEMENT_SIZE_8x16' + return "HUD_ELEMENT_SIZE_8x16" elif val == 7: - return 'HUD_ELEMENT_SIZE_16x8' + return "HUD_ELEMENT_SIZE_16x8" elif val == 8: - return 'HUD_ELEMENT_SIZE_16x24' + return "HUD_ELEMENT_SIZE_16x24" elif val == 9: - return 'HUD_ELEMENT_SIZE_16x32' + return "HUD_ELEMENT_SIZE_16x32" elif val == 10: - return 'HUD_ELEMENT_SIZE_64x32' + return "HUD_ELEMENT_SIZE_64x32" elif val == 11: - return 'HUD_ELEMENT_SIZE_32x16' + return "HUD_ELEMENT_SIZE_32x16" elif val == 12: - return 'HUD_ELEMENT_SIZE_12x12' + return "HUD_ELEMENT_SIZE_12x12" elif val == 13: - return 'HUD_ELEMENT_SIZE_48x24' + return "HUD_ELEMENT_SIZE_48x24" elif val == 14: - return 'HUD_ELEMENT_SIZE_32x8' + return "HUD_ELEMENT_SIZE_32x8" elif val == 15: - return 'HUD_ELEMENT_SIZE_24x8' + return "HUD_ELEMENT_SIZE_24x8" elif val == 16: - return 'HUD_ELEMENT_SIZE_64x16' + return "HUD_ELEMENT_SIZE_64x16" elif val == 17: - return 'HUD_ELEMENT_SIZE_16x64' + return "HUD_ELEMENT_SIZE_16x64" elif val == 18: - return 'HUD_ELEMENT_SIZE_192x32' + return "HUD_ELEMENT_SIZE_192x32" elif val == 19: - return 'HUD_ELEMENT_SIZE_40x40' + return "HUD_ELEMENT_SIZE_40x40" elif val == 20: - return 'HUD_ELEMENT_SIZE_24x16' + return "HUD_ELEMENT_SIZE_24x16" elif val == 21: - return 'HUD_ELEMENT_SIZE_32x40' + return "HUD_ELEMENT_SIZE_32x40" elif val == 22: - return 'HUD_ELEMENT_SIZE_40x16' + return "HUD_ELEMENT_SIZE_40x16" elif val == 23: - return 'HUD_ELEMENT_SIZE_40x24' + return "HUD_ELEMENT_SIZE_40x24" elif val == 24: - return 'HUD_ELEMENT_SIZE_32x24' + return "HUD_ELEMENT_SIZE_32x24" else: return val -class HudElementScript(): +class HudElementScript: def __init__(self, symbol): self.symbol = symbol self.buffer = [] @@ -172,7 +173,7 @@ def print(self): if word > 0x8000000: word = f"0x{word:X}" else: - word, = struct.unpack(">i", struct.pack(">I", word)) + (word,) = struct.unpack(">i", struct.pack(">I", word)) print(word) except ValueError: pass diff --git a/tools/disasm_script.py b/tools/disasm_script.py index ddb420daff4..efabc612960 100755 --- a/tools/disasm_script.py +++ b/tools/disasm_script.py @@ -5,6 +5,8 @@ _script_lib = None + + def script_lib(offset=0): global _script_lib @@ -43,9 +45,9 @@ def script_lib(offset=0): raddr = "0xFFFFFFFF" if "rom:" in line: - raddr = line.split("rom:",1)[1] + raddr = line.split("rom:", 1)[1] if " " in raddr: - raddr = raddr.split(" ",1)[0] + raddr = raddr.split(" ", 1)[0] raddr = raddr.strip() if vaddr not in _script_lib: @@ -77,13 +79,15 @@ def extend_symbol_map(a, b): return a + def round_fixed(f: float) -> float: g = f * 100.0 whole = round(g) - if abs(g - whole) <= 100.0/1024.0: + if abs(g - whole) <= 100.0 / 1024.0: f = whole / 100.0 return f + def find_symbol_in_overlay(symbol_map, overlay_rom_addr, symbol_ram_addr): if not symbol_ram_addr in symbol_map: return None @@ -103,11 +107,12 @@ def find_symbol_in_overlay(symbol_map, overlay_rom_addr, symbol_ram_addr): return symbol_map[symbol_ram_addr][0][1] + def browse_header(valid_enums, enums): # enums - for i,line in enumerate(enums): + for i, line in enumerate(enums): if (line.startswith("enum ")) or (line.startswith("typedef enum ")): - enum_name = line.split("enum ",1)[1].split(" {",1)[0] + enum_name = line.split("enum ", 1)[1].split(" {", 1)[0] if enum_name in valid_enums: CONSTANTS[enum_name] = {} last_num = -1 @@ -118,10 +123,10 @@ def browse_header(valid_enums, enums): continue if "//" in enums[i]: - name = enums[i].split("//",1)[0].strip() + name = enums[i].split("//", 1)[0].strip() else: name = enums[i].strip() - val = last_num+1 + val = last_num + 1 if "=" in name: name, val = name.split(" = ") val = int(val[:-1], 0) @@ -130,30 +135,66 @@ def browse_header(valid_enums, enums): else: name = name[:-1] name = name.strip() - #print("\"" + name + "\"", "===", val) + # print("\"" + name + "\"", "===", val) CONSTANTS[enum_name][val] = name.strip() i += 1 last_num = val return + # Grab CONSTANTS from the include/ folder to save manual work CONSTANTS = {} SWITCH_TYPES = [] -LOCAL_WORDS = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] +LOCAL_WORDS = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] SAVE_VARS = set() + + def get_constants(): global CONSTANTS global VALID_SAVE_VARS - valid_enums = { "StoryProgress", "ItemIDs", "PlayerAnims", "ActorType", - "ActorIDs", "Events", "SoundIDs", "SongIDs", "Locations", - "AmbientSounds", "NpcIDs", "Emotes", "NpcFlags", "Statuses", "Elements", - "DamageTypes", "ElementImmunityFlags", "HitResults", "ActorFlags", "ActorPartFlags", - "ActorEventFlags", "ElementFlags", "EncounterTriggers", "Abilities", - "EasingType", "DecorationIDs", "HitResults", "Phases", "ItemSpawnModes", - "ActionStates", "Triggers", "Buttons", "ActionCommand", "MoveIDs", "BattleStatusFlags1", - "BattleStatusFlags2", "BtlCameraPreset", "EffectID", "StatusFlags" } + valid_enums = { + "StoryProgress", + "ItemIDs", + "PlayerAnims", + "ActorType", + "ActorIDs", + "Events", + "SoundIDs", + "SongIDs", + "Locations", + "AmbientSounds", + "NpcIDs", + "Emotes", + "NpcFlags", + "Statuses", + "Elements", + "DamageTypes", + "ElementImmunityFlags", + "HitResults", + "ActorFlags", + "ActorPartFlags", + "ActorEventFlags", + "ElementFlags", + "EncounterTriggers", + "Abilities", + "EasingType", + "DecorationIDs", + "HitResults", + "Phases", + "ItemSpawnModes", + "ActionStates", + "Triggers", + "Buttons", + "ActionCommand", + "MoveIDs", + "BattleStatusFlags1", + "BattleStatusFlags2", + "BtlCameraPreset", + "EffectID", + "StatusFlags", + } for enum in valid_enums: CONSTANTS[enum] = {} CONSTANTS["NPC_SPRITE"] = {} @@ -167,12 +208,11 @@ def get_constants(): enums = Path(include_path / "effects.h").read_text().splitlines() browse_header(valid_enums, enums) - include_path = Path(Path(__file__).resolve().parent.parent / "src" / "battle") enums = Path(include_path / "battle.h").read_text().splitlines() browse_header(valid_enums, enums) - ''' + """ # defines for line in enums: this_enum = "" @@ -186,11 +226,13 @@ def get_constants(): if " " in id_: id_ = id_.split(" ",1)[0] CONSTANTS[this_enum][int(id_, 16)] = name - ''' + """ - #exit() + # exit() # sprites - sprite_path = Path(Path(__file__).resolve().parent.parent / "ver" / "current" / "build" / "include" / "sprite" / "npc") + sprite_path = Path( + Path(__file__).resolve().parent.parent / "ver" / "current" / "build" / "include" / "sprite" / "npc" + ) for file in sprite_path.iterdir(): fd = file.read_text() for line in fd.splitlines(): @@ -199,7 +241,7 @@ def get_constants(): header_file_name = file.parts[-1] - name = line.split(" ",2)[1] + name = line.split(" ", 2)[1] value = int(line.split("0x", 1)[1], base=16) CONSTANTS["NPC_SPRITE"][value] = name @@ -215,8 +257,8 @@ def make_anim_macro(self, sprite, palette, anim): value = (sprite << 16) | (palette << 8) | anim if value in CONSTANTS["NPC_SPRITE"]: - self.INCLUDES_NEEDED["sprites"].add(CONSTANTS['NPC_SPRITE'][str(value) + ".h"]) - return CONSTANTS['NPC_SPRITE'][value] + self.INCLUDES_NEEDED["sprites"].add(CONSTANTS["NPC_SPRITE"][str(value) + ".h"]) + return CONSTANTS["NPC_SPRITE"][value] else: return f"0x{sprite:02X}{palette:02X}{anim:02X}" @@ -227,6 +269,7 @@ def remove_evt_ptr(s): else: return s + def make_flags(argNum, flags, new_args): enabled = [] for x in range(32): @@ -246,9 +289,8 @@ def fix_args(self, func, args, info): new_args = [] args = args.split(", ") - for i,arg in enumerate(args): - if ((remove_evt_ptr(arg).startswith("D_B")) or - (i == 0 and func == "MakeEntity" and arg.startswith("D_"))): + for i, arg in enumerate(args): + if (remove_evt_ptr(arg).startswith("D_B")) or (i == 0 and func == "MakeEntity" and arg.startswith("D_")): if func == "MakeEntity": arg = "MAKE_ENTITY_END" else: @@ -257,15 +299,15 @@ def fix_args(self, func, args, info): if "0x" in arg and int(remove_evt_ptr(arg), 16) >= 0xF0000000: arg = f"{int(remove_evt_ptr(arg), 16) - 0x100000000}" - if i in info or (i+1 == len(args) and -1 in info): + if i in info or (i + 1 == len(args) and -1 in info): if arg.startswith("LW"): argNum = trim_lw(arg) LOCAL_WORDS[int(argNum)] = info[i] new_args.append(f"{arg}") - #print(LOCAL_WORDS) + # print(LOCAL_WORDS) continue - if i+1 == len(args) and -1 in info: + if i + 1 == len(args) and -1 in info: i = -1 if "_" in arg: new_args.append(f"{arg}") @@ -283,25 +325,25 @@ def fix_args(self, func, args, info): elif info[i] == "CustomAnim": if argNum != -1: try: - value = (argNum & 0x00FFFFFF) + value = argNum & 0x00FFFFFF if func == "SetAnimation" and int(new_args[1], 10) == 0: call = f"{CONSTANTS['PlayerAnims'][argNum]}" elif value in CONSTANTS["NPC_SPRITE"]: - self.INCLUDES_NEEDED["sprites"].add(CONSTANTS['NPC_SPRITE'][str(value) + ".h"]) - call = CONSTANTS['NPC_SPRITE'][value] + self.INCLUDES_NEEDED["sprites"].add(CONSTANTS["NPC_SPRITE"][str(value) + ".h"]) + call = CONSTANTS["NPC_SPRITE"][value] else: call = f"{argNum:06X}" except ValueError: - call = f"0x{argNum:06X}" + call = f"0x{argNum:06X}" except KeyError: - call = f"0x{argNum:06X}" + call = f"0x{argNum:06X}" else: call = "-1" new_args.append(call) elif info[i] == "CustomMsg": type_ = (argNum & 0xFF0000) >> 16 - num_ = (argNum & 0xFFFF) >> 0 + num_ = (argNum & 0xFFFF) >> 0 new_args.append(f"MESSAGE_ID(0x{type_:02X}, 0x{num_:04X})") elif info[i] == "NpcFlags": make_flags(argNum, "NpcFlags", new_args) @@ -341,12 +383,14 @@ def fix_args(self, func, args, info): new_args.append(f"{CONSTANTS[info[i]][argNum]}") except KeyError: if not (info[i] == "NpcIDs" and argNum > 0): - print(f"0x{argNum:X} was not found within {info[i]} constants for function {func} arg {i}, add it.") + print( + f"0x{argNum:X} was not found within {info[i]} constants for function {func} arg {i}, add it." + ) - if (info[i] == "ItemIDs" and argNum < 0): + if info[i] == "ItemIDs" and argNum < 0: new_args.append(f"{int(argNum)}") else: - #Print the unknowns in hex + # Print the unknowns in hex new_args.append(self.var(argNum)) else: @@ -355,217 +399,212 @@ def fix_args(self, func, args, info): replace_funcs = { - "ActorExists" :{0:"ActorIDs", 1:"Bool"}, - "ActorSpeak" :{0:"CustomMsg", 1:"ActorIDs", 3:"CustomAnim", 4:"CustomAnim"}, - "AddActorDecoration" :{0:"ActorIDs"}, - "AddActorVar" :{0:"ActorIDs"}, - "AddKeyItem" :{0:"ItemIDs"}, - "AddGoalPos" :{0:"ActorIDs"}, - - "BattleCamTargetActor" :{0:"ActorIDs"}, - "BindHandleEvent" :{0:"ActorIDs"}, - "BindIdle" :{0:"ActorIDs"}, - "BindNextTurn" :{0:"ActorIDs"}, - "BindNpcAI" :{0:"NpcIDs"}, - "BindNpcDefeat" :{0:"NpcIDs"}, - "BindNpcIdle" :{0:"NpcIDs"}, - "BindNpcInteract" :{0:"NpcIDs"}, - "BindTakeTurn" :{0:"ActorIDs"}, - - "CheckButtonDown" :{0:"Hex", 1:"Bool"}, - "ContinueSpeech" :{1:"CustomAnim", 2:"CustomAnim", 4:"CustomMsg"}, - "CopyBuffs" :{0:"ActorIDs", 1:"ActorIDs"}, - "CopyStatusEffects" :{0:"ActorIDs", 1:"ActorIDs"}, - "CountPlayerTargets" :{0:"ActorIDs"}, - - "DisablePlayerInput" :{0:"Bool"}, - "DisablePlayerPhysics" :{0:"Bool"}, - "DispatchDamagePlayerEvent" :{1:"Events"}, - "DispatchEvent" :{0:"ActorIDs", 1:"Events"}, - - "EnableActorBlur" :{0:"ActorIDs"}, - "EnableActorGlow" :{0:"ActorIDs", 1:"Bool"}, - "EnableIdleScript" :{0:"ActorIDs"}, - "EnableNpcShadow" :{0:"NpcIDs", 1:"Bool"}, - "EndActorSpeech" :{0:"ActorIDs", 2:"CustomAnim", 3:"CustomAnim"}, - "EndSpeech" :{1:"CustomAnim", 2:"CustomAnim"}, - "EnemyDamageTarget" :{0:"ActorIDs", 1:"HitResults", 2:"DamageTypes", 4:"StatusFlags", 6:"BattleStatusFlags1"}, - "EnemyTestTarget" :{0:"ActorIDs", 1:"HitResults", 2:"DamageTypes", 3:"StatusFlags", 5:"BattleStatusFlags1"}, - - "FallToGoal" :{0:"ActorIDs"}, - "FindKeyItem" :{0:"ItemIDs"}, - "FlyPartTo" :{0:"ActorIDs"}, - "FlyToGoal" :{0:"ActorIDs"}, - "ForceHomePos" :{0:"ActorIDs"}, - - "func_8026DF88" :{0:"ActorIDs"}, - "SetActorPaletteEffect" :{0:"ActorIDs"}, - "SetActorPaletteSwapParams" :{0:"ActorIDs"}, - "func_8026ED20" :{0:"ActorIDs"}, - "HideHealthBar" :{0:"ActorIDs"}, - "func_8027D434" :{0:"ActorIDs"}, - "SetProjectileTargetOffset" :{0:"ActorIDs"}, - "GetInstigatorValue" :{0:"ActorIDs"}, - "SetNpcFoldParams" :{0:"NpcIDs"}, - "SetNpcFoldFlags" :{0:"NpcIDs"}, - "UpdatePlayerFold" :{0:"PlayerAnims"}, - - "GetAnimation" :{0:"ActorIDs", 2:"CustomAnim"}, - "GetActorFlags" :{0:"ActorIDs", 1:"ActorFlags"}, - "GetActorHP" :{0:"ActorIDs"}, - "GetActorPos" :{0:"ActorIDs"}, - "GetActorSize" :{0:"ActorIDs"}, - "GetActorVar" :{0:"ActorIDs"}, - "GetBattleFlags" :{0:"BattleStatusFlags1"}, - "GetBattlePhase" :{0:"Phases"}, - "GetDistanceToGoal" :{0:"ActorIDs"}, - "GetEnemyMaxHP" :{0:"ActorIDs"}, - "GetGoalPos" :{0:"ActorIDs"}, - "GetHomePos" :{0:"ActorIDs"}, - "GetIdleGoal" :{0:"ActorIDs"}, - "GetIndexFromHome" :{0:"ActorIDs"}, - "GetIndexFromPos" :{0:"ActorIDs"}, - "GetItemPower" :{0:"ItemIDs"}, - "GetLastDamage" :{0:"ActorIDs"}, - "GetLastElement" :{0:"DamageTypes"}, - "GetLastEvent" :{0:"ActorIDs", 1:"Events"}, - "GetPartOffset" :{0:"ActorIDs"}, - "GetPartPos" :{0:"ActorIDs"}, - "GetPartRotation" :{0:"ActorIDs"}, - "GetNpcPos" :{0:"NpcIDs"}, - "GetOriginalActorType" :{0:"ActorIDs", 1:"ActorType"}, - "GetStatusFlags" :{0:"ActorIDs", 1:"StatusFlags"}, - - "HidePlayerShadow" :{0:"Bool"}, - "HPBarToCurrent" :{0:"ActorIDs"}, - "HPBarToHome" :{0:"ActorIDs"}, - - "IdleFlyToGoal" :{0:"ActorIDs"}, - "IdleJumpToGoal" :{0:"ActorIDs"}, - "IdleRunToGoal" :{0:"ActorIDs"}, - "InterpNpcYaw" :{0:"NpcIDs"}, - - "JumpPartTo" :{0:"ActorIDs"}, - "JumpToGoal" :{0:"ActorIDs", 2:"Bool", 3:"Bool", 4:"Bool"}, - "JumpWithBounce" :{0:"ActorIDs"}, - - "LandJump" :{0:"ActorIDs"}, - "LoadActionCommand" :{0:"ActionCommand"}, - - "MakeEntity" :{0:"Hex"}, - "MakeItemEntity" :{0:"ItemIDs"}, - "ModifyColliderFlags" :{2:"Hex"}, - - "NpcFaceNpc" :{0:"NpcIDs", 1:"NpcIDs"}, - "NpcFacePlayer" :{0:"NpcIDs"}, - "NpcJump0" :{0:"NpcIDs"}, - "NpcJump1" :{0:"NpcIDs"}, - "NpcMoveTo" :{0:"NpcIDs"}, - - "PlayAmbientSounds" :{0:"AmbientSounds"}, - "PlayEffect" :{0:"EffectID"}, - "PlayLoopingSoundAtActor" :{0:"ActorIDs", 2:"SoundIDs"}, - "PlaySound" :{0:"SoundIDs"}, - "PlaySoundAt" :{0:"SoundIDs"}, - "PlaySoundAtActor" :{0:"ActorIDs", 1:"SoundIDs"}, - "PlaySoundAtModel" :{1:"SoundIDs"}, - "PlaySoundAtNpc" :{0:"NpcIDs", 1:"SoundIDs"}, - "PlaySoundAtPart" :{0:"ActorIDs", 2:"SoundIDs"}, - - "RemoveActor" :{0:"ActorIDs"}, - "RemoveActorDecoration" :{0:"ActorIDs"}, - "RemoveNpc" :{0:"NpcIDs"}, - "ResetActorSounds" :{0:"ActorIDs"}, - "ResetAllActorSounds" :{0:"ActorIDs"}, - "RunToGoal" :{0:"ActorIDs", 2:"Bool"}, - - "SetActorDispOffset" :{0:"ActorIDs"}, - "SetActorFlagBits" :{0:"ActorIDs", 1:"ActorFlags"}, - "SetActorIdleSpeed" :{0:"ActorIDs"}, - "SetActorIdleJumpGravity" :{0:"ActorIDs"}, - "SetActorJumpGravity" :{0:"ActorIDs"}, - "SetActorPos" :{0:"ActorIDs"}, - "SetActorRotation" :{0:"ActorIDs"}, - "SetActorRotationOffset" :{0:"ActorIDs"}, - "SetActorScale" :{0:"ActorIDs"}, - "SetActorSize" :{0:"ActorIDs"}, - "SetActorSounds" :{0:"ActorIDs"}, - "SetActorSpeed" :{0:"ActorIDs"}, - "SetActorType" :{0:"ActorIDs", 1:"ActorType"}, - "SetActorVar" :{0:"ActorIDs"}, - "SetActorYaw" :{0:"ActorIDs"}, - - "SetAnimation" :{0:"ActorIDs", 2:"CustomAnim"}, - "SetAnimationRate" :{0:"ActorIDs"}, - "SetBattleFlagBits" :{0:"BattleStatusFlags1"}, - "SetBattleFlagBits2" :{0:"BattleStatusFlags2"}, - "SetDefenseTable" :{0:"ActorIDs"}, - "SetEnemyHP" :{0:"ActorIDs"}, - "SetEnemyTargetOffset" :{0:"ActorIDs"}, - "SetGoalPos" :{0:"ActorIDs"}, - "SetGoalToFirstTarget" :{0:"ActorIDs"}, - "SetGoalToHome" :{0:"ActorIDs"}, - "SetGoalToIndex" :{0:"ActorIDs"}, - "SetGoalToTarget" :{0:"ActorIDs"}, - "SetHomePos" :{0:"ActorIDs"}, - "SetIdleAnimations" :{0:"ActorIDs"}, - "SetIdleGoal" :{0:"ActorIDs"}, - "SetIdleGoalToHome" :{0:"ActorIDs"}, - "SetJumpAnimations" :{0:"ActorIDs", 2:"PlayerAnims", 3:"PlayerAnims", 4:"PlayerAnims"}, - "SetMusicTrack" :{1:"SongIDs"}, - - "SetNpcAnimation" :{0:"NpcIDs", 1:"CustomAnim"}, - "SetNpcAux" :{0:"NpcIDs"}, - "SetNpcFlagBits" :{0:"NpcIDs", 1:"NpcFlags", 2:"Bool"}, - "SetNpcJumpscale" :{0:"NpcIDs"}, - "SetNpcPos" :{0:"NpcIDs"}, - "SetNpcRotation" :{0:"NpcIDs"}, - "SetNpcScale" :{0:"NpcIDs"}, - "SetNpcSpeed" :{0:"NpcIDs"}, - "SetNpcSprite" :{1:"Hex"}, - "SetNpcYaw" :{0:"NpcIDs"}, - - "SetOwnerID" :{0:"ActorIDs"}, - - "SetPartAlpha" :{0:"ActorIDs"}, - "SetPartDispOffset" :{0:"ActorIDs"}, - "SetPartEventBits" :{0:"ActorIDs", 2:"ActorEventFlags"}, - "SetPartFlags" :{0:"ActorIDs", 2:"ActorPartFlags"}, - "SetPartFlagBits" :{0:"ActorIDs", 2:"ActorPartFlags"}, - "SetPartJumpGravity" :{0:"ActorIDs"}, - "SetPartMoveSpeed" :{0:"ActorIDs"}, - "SetPartPos" :{0:"ActorIDs"}, - "SetPartRotation" :{0:"ActorIDs"}, - "SetPartRotationOffset" :{0:"ActorIDs"}, - "SetPartScale" :{0:"ActorIDs"}, - "SetPartSize" :{0:"ActorIDs"}, - "SetPartSounds" :{0:"ActorIDs"}, - "SetPartTargetFlagBits" :{0:"ActorIDs"}, - "SetPartYaw" :{0:"ActorIDs"}, - - "SetPlayerAnimation" :{0:"PlayerAnims"}, - "SetSelfEnemyFlagBits" :{0:"NpcFlags", 1:"Bool"}, - #"SetSelfVar" :{1:"Bool"}, # apparently this was a bool in some scripts but it passes non-0/1 values, including negatives - "SetSpriteShading" :{0:"CustomAnim"}, - "SetStatusTable" :{0:"ActorIDs"}, - "SetTargetActor" :{0:"ActorIDs", 1:"ActorIDs"}, - "SetTargetOffset" :{0:"ActorIDs"}, - "ShowChoice" :{0:"CustomMsg"}, - "ShowEmote" :{1:"Emotes"}, - "ShowMessageAtScreenPos" :{0:"CustomMsg"}, - "ShowMessageAtWorldPos" :{0:"CustomMsg"}, - "SpeakToPlayer" :{0:"NpcIDs", 1:"CustomAnim", 2:"CustomAnim", -1:"CustomMsg"}, - "StopLoopingSoundAtActor" :{0:"ActorIDs"}, - "SwitchMessage" :{0:"CustomMsg"}, - - "UseBattleCamPreset" :{0:"BtlCameraPreset"}, - "UseIdleAnimation" :{0:"ActorIDs", 1:"Bool"}, - - "WasStatusInflicted" :{0:"ActorIDs", 1:"Bool"}, + "ActorExists": {0: "ActorIDs", 1: "Bool"}, + "ActorSpeak": {0: "CustomMsg", 1: "ActorIDs", 3: "CustomAnim", 4: "CustomAnim"}, + "AddActorDecoration": {0: "ActorIDs"}, + "AddActorVar": {0: "ActorIDs"}, + "AddKeyItem": {0: "ItemIDs"}, + "AddGoalPos": {0: "ActorIDs"}, + "BattleCamTargetActor": {0: "ActorIDs"}, + "BindHandleEvent": {0: "ActorIDs"}, + "BindIdle": {0: "ActorIDs"}, + "BindNextTurn": {0: "ActorIDs"}, + "BindNpcAI": {0: "NpcIDs"}, + "BindNpcDefeat": {0: "NpcIDs"}, + "BindNpcIdle": {0: "NpcIDs"}, + "BindNpcInteract": {0: "NpcIDs"}, + "BindTakeTurn": {0: "ActorIDs"}, + "CheckButtonDown": {0: "Hex", 1: "Bool"}, + "ContinueSpeech": {1: "CustomAnim", 2: "CustomAnim", 4: "CustomMsg"}, + "CopyBuffs": {0: "ActorIDs", 1: "ActorIDs"}, + "CopyStatusEffects": {0: "ActorIDs", 1: "ActorIDs"}, + "CountPlayerTargets": {0: "ActorIDs"}, + "DisablePlayerInput": {0: "Bool"}, + "DisablePlayerPhysics": {0: "Bool"}, + "DispatchDamagePlayerEvent": {1: "Events"}, + "DispatchEvent": {0: "ActorIDs", 1: "Events"}, + "EnableActorBlur": {0: "ActorIDs"}, + "EnableActorGlow": {0: "ActorIDs", 1: "Bool"}, + "EnableIdleScript": {0: "ActorIDs"}, + "EnableNpcShadow": {0: "NpcIDs", 1: "Bool"}, + "EndActorSpeech": {0: "ActorIDs", 2: "CustomAnim", 3: "CustomAnim"}, + "EndSpeech": {1: "CustomAnim", 2: "CustomAnim"}, + "EnemyDamageTarget": { + 0: "ActorIDs", + 1: "HitResults", + 2: "DamageTypes", + 4: "StatusFlags", + 6: "BattleStatusFlags1", + }, + "EnemyTestTarget": { + 0: "ActorIDs", + 1: "HitResults", + 2: "DamageTypes", + 3: "StatusFlags", + 5: "BattleStatusFlags1", + }, + "FallToGoal": {0: "ActorIDs"}, + "FindKeyItem": {0: "ItemIDs"}, + "FlyPartTo": {0: "ActorIDs"}, + "FlyToGoal": {0: "ActorIDs"}, + "ForceHomePos": {0: "ActorIDs"}, + "func_8026DF88": {0: "ActorIDs"}, + "SetActorPaletteEffect": {0: "ActorIDs"}, + "SetActorPaletteSwapParams": {0: "ActorIDs"}, + "func_8026ED20": {0: "ActorIDs"}, + "HideHealthBar": {0: "ActorIDs"}, + "func_8027D434": {0: "ActorIDs"}, + "SetProjectileTargetOffset": {0: "ActorIDs"}, + "GetInstigatorValue": {0: "ActorIDs"}, + "SetNpcFoldParams": {0: "NpcIDs"}, + "SetNpcFoldFlags": {0: "NpcIDs"}, + "UpdatePlayerFold": {0: "PlayerAnims"}, + "GetAnimation": {0: "ActorIDs", 2: "CustomAnim"}, + "GetActorFlags": {0: "ActorIDs", 1: "ActorFlags"}, + "GetActorHP": {0: "ActorIDs"}, + "GetActorPos": {0: "ActorIDs"}, + "GetActorSize": {0: "ActorIDs"}, + "GetActorVar": {0: "ActorIDs"}, + "GetBattleFlags": {0: "BattleStatusFlags1"}, + "GetBattlePhase": {0: "Phases"}, + "GetDistanceToGoal": {0: "ActorIDs"}, + "GetEnemyMaxHP": {0: "ActorIDs"}, + "GetGoalPos": {0: "ActorIDs"}, + "GetHomePos": {0: "ActorIDs"}, + "GetIdleGoal": {0: "ActorIDs"}, + "GetIndexFromHome": {0: "ActorIDs"}, + "GetIndexFromPos": {0: "ActorIDs"}, + "GetItemPower": {0: "ItemIDs"}, + "GetLastDamage": {0: "ActorIDs"}, + "GetLastElement": {0: "DamageTypes"}, + "GetLastEvent": {0: "ActorIDs", 1: "Events"}, + "GetPartOffset": {0: "ActorIDs"}, + "GetPartPos": {0: "ActorIDs"}, + "GetPartRotation": {0: "ActorIDs"}, + "GetNpcPos": {0: "NpcIDs"}, + "GetOriginalActorType": {0: "ActorIDs", 1: "ActorType"}, + "GetStatusFlags": {0: "ActorIDs", 1: "StatusFlags"}, + "HidePlayerShadow": {0: "Bool"}, + "HPBarToCurrent": {0: "ActorIDs"}, + "HPBarToHome": {0: "ActorIDs"}, + "IdleFlyToGoal": {0: "ActorIDs"}, + "IdleJumpToGoal": {0: "ActorIDs"}, + "IdleRunToGoal": {0: "ActorIDs"}, + "InterpNpcYaw": {0: "NpcIDs"}, + "JumpPartTo": {0: "ActorIDs"}, + "JumpToGoal": {0: "ActorIDs", 2: "Bool", 3: "Bool", 4: "Bool"}, + "JumpWithBounce": {0: "ActorIDs"}, + "LandJump": {0: "ActorIDs"}, + "LoadActionCommand": {0: "ActionCommand"}, + "MakeEntity": {0: "Hex"}, + "MakeItemEntity": {0: "ItemIDs"}, + "ModifyColliderFlags": {2: "Hex"}, + "NpcFaceNpc": {0: "NpcIDs", 1: "NpcIDs"}, + "NpcFacePlayer": {0: "NpcIDs"}, + "NpcJump0": {0: "NpcIDs"}, + "NpcJump1": {0: "NpcIDs"}, + "NpcMoveTo": {0: "NpcIDs"}, + "PlayAmbientSounds": {0: "AmbientSounds"}, + "PlayEffect": {0: "EffectID"}, + "PlayLoopingSoundAtActor": {0: "ActorIDs", 2: "SoundIDs"}, + "PlaySound": {0: "SoundIDs"}, + "PlaySoundAt": {0: "SoundIDs"}, + "PlaySoundAtActor": {0: "ActorIDs", 1: "SoundIDs"}, + "PlaySoundAtModel": {1: "SoundIDs"}, + "PlaySoundAtNpc": {0: "NpcIDs", 1: "SoundIDs"}, + "PlaySoundAtPart": {0: "ActorIDs", 2: "SoundIDs"}, + "RemoveActor": {0: "ActorIDs"}, + "RemoveActorDecoration": {0: "ActorIDs"}, + "RemoveNpc": {0: "NpcIDs"}, + "ResetActorSounds": {0: "ActorIDs"}, + "ResetAllActorSounds": {0: "ActorIDs"}, + "RunToGoal": {0: "ActorIDs", 2: "Bool"}, + "SetActorDispOffset": {0: "ActorIDs"}, + "SetActorFlagBits": {0: "ActorIDs", 1: "ActorFlags"}, + "SetActorIdleSpeed": {0: "ActorIDs"}, + "SetActorIdleJumpGravity": {0: "ActorIDs"}, + "SetActorJumpGravity": {0: "ActorIDs"}, + "SetActorPos": {0: "ActorIDs"}, + "SetActorRotation": {0: "ActorIDs"}, + "SetActorRotationOffset": {0: "ActorIDs"}, + "SetActorScale": {0: "ActorIDs"}, + "SetActorSize": {0: "ActorIDs"}, + "SetActorSounds": {0: "ActorIDs"}, + "SetActorSpeed": {0: "ActorIDs"}, + "SetActorType": {0: "ActorIDs", 1: "ActorType"}, + "SetActorVar": {0: "ActorIDs"}, + "SetActorYaw": {0: "ActorIDs"}, + "SetAnimation": {0: "ActorIDs", 2: "CustomAnim"}, + "SetAnimationRate": {0: "ActorIDs"}, + "SetBattleFlagBits": {0: "BattleStatusFlags1"}, + "SetBattleFlagBits2": {0: "BattleStatusFlags2"}, + "SetDefenseTable": {0: "ActorIDs"}, + "SetEnemyHP": {0: "ActorIDs"}, + "SetEnemyTargetOffset": {0: "ActorIDs"}, + "SetGoalPos": {0: "ActorIDs"}, + "SetGoalToFirstTarget": {0: "ActorIDs"}, + "SetGoalToHome": {0: "ActorIDs"}, + "SetGoalToIndex": {0: "ActorIDs"}, + "SetGoalToTarget": {0: "ActorIDs"}, + "SetHomePos": {0: "ActorIDs"}, + "SetIdleAnimations": {0: "ActorIDs"}, + "SetIdleGoal": {0: "ActorIDs"}, + "SetIdleGoalToHome": {0: "ActorIDs"}, + "SetJumpAnimations": { + 0: "ActorIDs", + 2: "PlayerAnims", + 3: "PlayerAnims", + 4: "PlayerAnims", + }, + "SetMusicTrack": {1: "SongIDs"}, + "SetNpcAnimation": {0: "NpcIDs", 1: "CustomAnim"}, + "SetNpcAux": {0: "NpcIDs"}, + "SetNpcFlagBits": {0: "NpcIDs", 1: "NpcFlags", 2: "Bool"}, + "SetNpcJumpscale": {0: "NpcIDs"}, + "SetNpcPos": {0: "NpcIDs"}, + "SetNpcRotation": {0: "NpcIDs"}, + "SetNpcScale": {0: "NpcIDs"}, + "SetNpcSpeed": {0: "NpcIDs"}, + "SetNpcSprite": {1: "Hex"}, + "SetNpcYaw": {0: "NpcIDs"}, + "SetOwnerID": {0: "ActorIDs"}, + "SetPartAlpha": {0: "ActorIDs"}, + "SetPartDispOffset": {0: "ActorIDs"}, + "SetPartEventBits": {0: "ActorIDs", 2: "ActorEventFlags"}, + "SetPartFlags": {0: "ActorIDs", 2: "ActorPartFlags"}, + "SetPartFlagBits": {0: "ActorIDs", 2: "ActorPartFlags"}, + "SetPartJumpGravity": {0: "ActorIDs"}, + "SetPartMoveSpeed": {0: "ActorIDs"}, + "SetPartPos": {0: "ActorIDs"}, + "SetPartRotation": {0: "ActorIDs"}, + "SetPartRotationOffset": {0: "ActorIDs"}, + "SetPartScale": {0: "ActorIDs"}, + "SetPartSize": {0: "ActorIDs"}, + "SetPartSounds": {0: "ActorIDs"}, + "SetPartTargetFlagBits": {0: "ActorIDs"}, + "SetPartYaw": {0: "ActorIDs"}, + "SetPlayerAnimation": {0: "PlayerAnims"}, + "SetSelfEnemyFlagBits": {0: "NpcFlags", 1: "Bool"}, + # "SetSelfVar" :{1:"Bool"}, # apparently this was a bool in some scripts but it passes non-0/1 values, including negatives + "SetSpriteShading": {0: "CustomAnim"}, + "SetStatusTable": {0: "ActorIDs"}, + "SetTargetActor": {0: "ActorIDs", 1: "ActorIDs"}, + "SetTargetOffset": {0: "ActorIDs"}, + "ShowChoice": {0: "CustomMsg"}, + "ShowEmote": {1: "Emotes"}, + "ShowMessageAtScreenPos": {0: "CustomMsg"}, + "ShowMessageAtWorldPos": {0: "CustomMsg"}, + "SpeakToPlayer": {0: "NpcIDs", 1: "CustomAnim", 2: "CustomAnim", -1: "CustomMsg"}, + "StopLoopingSoundAtActor": {0: "ActorIDs"}, + "SwitchMessage": {0: "CustomMsg"}, + "UseBattleCamPreset": {0: "BtlCameraPreset"}, + "UseIdleAnimation": {0: "ActorIDs", 1: "Bool"}, + "WasStatusInflicted": {0: "ActorIDs", 1: "Bool"}, } + def trim_lw(arg): - return arg[arg.find("(")+1:arg.find(")")] + return arg[arg.find("(") + 1 : arg.find(")")] def replace_constants(self, func, args): @@ -584,23 +623,36 @@ def replace_constants(self, func, args): return args + def fix_1_arg(self, lw, arg, format): if lw: lw = int(trim_lw(lw)) if LOCAL_WORDS[lw]: - info = {0 : LOCAL_WORDS[lw]} + info = {0: LOCAL_WORDS[lw]} args = f"{arg}" return fix_args(self, 0, args, info) if format: - info = {0 : format} + info = {0: format} args = f"{arg}" return fix_args(self, 0, args, info) return arg + class ScriptDisassembler: - def __init__(self, bytes, script_name = "script", symbol_map = {}, romstart = 0, INCLUDES_NEEDED = {"forward": [], "sprites": set(), "npcs": []}, INCLUDED = {"functions": set(), "includes": set()}, prelude = True, transform_symbol_name=None, use_script_lib=True): + def __init__( + self, + bytes, + script_name="script", + symbol_map={}, + romstart=0, + INCLUDES_NEEDED={"forward": [], "sprites": set(), "npcs": []}, + INCLUDED={"functions": set(), "includes": set()}, + prelude=True, + transform_symbol_name=None, + use_script_lib=True, + ): self.bytes = bytes self.script_name = script_name self.prelude = prelude @@ -632,7 +684,7 @@ def disassemble(self): opcode = self.read_word() argc = self.read_word() - #print(f"Op {opcode:X}, argc {argc}") + # print(f"Op {opcode:X}, argc {argc}") if opcode > 0xFF or argc > 0xFF: raise Exception(f"script '{self.script_name}' is malformed (opcode {opcode:X}, argc {argc:X})") @@ -641,7 +693,7 @@ def disassemble(self): for i in range(0, argc): argv.append(self.read_word()) - #print(argv) + # print(argv) self.disassemble_command(opcode, argc, argv) @@ -652,8 +704,10 @@ def disassemble(self): return self.prefix + self.out def write(self, line): - if self.indent < 0: self.indent = 0 - if self.indent > 1: self.indent_used = True + if self.indent < 0: + self.indent = 0 + if self.indent > 1: + self.indent_used = True self.out += " " * self.indent self.out += line @@ -666,24 +720,35 @@ def prefix_line(self, line): self.prefix += line self.prefix += "\n" - def var(self, arg, prefer_hex = False, use_evt_ptr = True): + def var(self, arg, prefer_hex=False, use_evt_ptr=True): if arg in self.symbol_map: s = self.symbol_map[arg][0][1] return f"EVT_PTR({s})" if use_evt_ptr else s - v = arg - 2**32 # convert to s32 + v = arg - 2**32 # convert to s32 if v > -250000000: - if v <= -220000000: return f"EVT_FLOAT({round_fixed((v + 230000000) / 1024)})" - elif v <= -200000000: return f"ArrayFlag({v + 210000000})" - elif v <= -180000000: return f"ArrayVar({v + 190000000})" - elif v <= -160000000: return f"GameByte({v + 170000000})" - elif v <= -140000000: return f"AreaByte({v + 150000000})" - elif v <= -120000000: return f"GameFlag({v + 130000000})" - elif v <= -100000000: return f"AreaFlag({v + 110000000})" - elif v <= -80000000: return f"MapFlag({v + 90000000})" - elif v <= -60000000: return f"LocalFlag({v + 70000000})" - elif v <= -40000000: return f"MapVar({v + 50000000})" - elif v <= -20000000: return f"LocalVar({v + 30000000})" + if v <= -220000000: + return f"EVT_FLOAT({round_fixed((v + 230000000) / 1024)})" + elif v <= -200000000: + return f"ArrayFlag({v + 210000000})" + elif v <= -180000000: + return f"ArrayVar({v + 190000000})" + elif v <= -160000000: + return f"GameByte({v + 170000000})" + elif v <= -140000000: + return f"AreaByte({v + 150000000})" + elif v <= -120000000: + return f"GameFlag({v + 130000000})" + elif v <= -100000000: + return f"AreaFlag({v + 110000000})" + elif v <= -80000000: + return f"MapFlag({v + 90000000})" + elif v <= -60000000: + return f"LocalFlag({v + 70000000})" + elif v <= -40000000: + return f"MapVar({v + 50000000})" + elif v <= -20000000: + return f"LocalVar({v + 30000000})" if arg == 0xFFFFFFFF: return "-1" @@ -697,7 +762,7 @@ def var(self, arg, prefer_hex = False, use_evt_ptr = True): return f"{arg}" def replace_star_rod_function_name(self, name): - vram = int(name.split("_",1)[1], 16) + vram = int(name.split("_", 1)[1], 16) name = "N(" + name.replace("function", "func") + f"_{(vram - 0x80240000)+self.romstart:X}" + ")" return name @@ -737,7 +802,7 @@ def replace_star_rod_prefix(self, addr, isArg=False): self.INCLUDES_NEEDED["forward"].append(prefix + name + suffix + ";") self.INCLUDED["functions"].add(name) return name - elif not isArg or name.startswith("\""): + elif not isArg or name.startswith('"'): return name else: return str(addr) @@ -746,21 +811,33 @@ def replace_star_rod_prefix(self, addr, isArg=False): def addr_ref(self, addr, isArg=False): if addr in self.symbol_map: return self.replace_star_rod_prefix(addr, isArg) - return self.var(addr) #f"0x{addr:08X}" + return self.var(addr) # f"0x{addr:08X}" def trigger(self, trigger): - if trigger == 0x00000040: trigger = "TRIGGER_WALL_PUSH" - if trigger == 0x00000080: trigger = "TRIGGER_FLOOR_TOUCH" - if trigger == 0x00000100: trigger = "TRIGGER_WALL_PRESS_A" - if trigger == 0x00000200: trigger = "TRIGGER_FLOOR_JUMP" - if trigger == 0x00000400: trigger = "TRIGGER_WALL_TOUCH" - if trigger == 0x00000800: trigger = "TRIGGER_FLOOR_PRESS_A" - if trigger == 0x00001000: trigger = "TRIGGER_WALL_HAMMER" - if trigger == 0x00010000: trigger = "TRIGGER_GAME_FLAG_SET" - if trigger == 0x00020000: trigger = "TRIGGER_AREA_FLAG_SET" - if trigger == 0x00040000: trigger = "TRIGGER_CEILING_TOUCH" - if trigger == 0x00080000: trigger = "TRIGGER_FLOOR_ABOVE" - if trigger == 0x00100000: trigger = "TRIGGER_POINT_BOMB" + if trigger == 0x00000040: + trigger = "TRIGGER_WALL_PUSH" + if trigger == 0x00000080: + trigger = "TRIGGER_FLOOR_TOUCH" + if trigger == 0x00000100: + trigger = "TRIGGER_WALL_PRESS_A" + if trigger == 0x00000200: + trigger = "TRIGGER_FLOOR_JUMP" + if trigger == 0x00000400: + trigger = "TRIGGER_WALL_TOUCH" + if trigger == 0x00000800: + trigger = "TRIGGER_FLOOR_PRESS_A" + if trigger == 0x00001000: + trigger = "TRIGGER_WALL_HAMMER" + if trigger == 0x00010000: + trigger = "TRIGGER_GAME_FLAG_SET" + if trigger == 0x00020000: + trigger = "TRIGGER_AREA_FLAG_SET" + if trigger == 0x00040000: + trigger = "TRIGGER_CEILING_TOUCH" + if trigger == 0x00080000: + trigger = "TRIGGER_FLOOR_ABOVE" + if trigger == 0x00100000: + trigger = "TRIGGER_POINT_BOMB" return f"0x{trigger:X}" if type(trigger) is int else trigger def read_word(self): @@ -773,24 +850,32 @@ def disassemble_command(self, opcode, argc, argv): if self.prelude: try: - self.prefix_line(f"EvtScript D_{self.script_name - info[0] + info[2]:08X}_{self.script_name:06X} = {{") + self.prefix_line( + f"EvtScript D_{self.script_name - info[0] + info[2]:08X}_{self.script_name:06X} = {{" + ) self.write_line("};") except: self.prefix_line(f"EvtScript {self.script_name} = {{") self.write_line("};") self.done = True - elif opcode == 0x02: self.write_line(f"EVT_RETURN") - elif opcode == 0x03: self.write_line(f"EVT_LABEL({self.var(argv[0])})") - elif opcode == 0x04: self.write_line(f"EVT_GOTO({self.var(argv[0])})") + elif opcode == 0x02: + self.write_line(f"EVT_RETURN") + elif opcode == 0x03: + self.write_line(f"EVT_LABEL({self.var(argv[0])})") + elif opcode == 0x04: + self.write_line(f"EVT_GOTO({self.var(argv[0])})") elif opcode == 0x05: self.write_line(f"EVT_LOOP({self.var(argv[0])})") self.indent += 1 elif opcode == 0x06: self.indent -= 1 self.write_line("EVT_END_LOOP") - elif opcode == 0x07: self.write_line(f"EVT_BREAK_LOOP") - elif opcode == 0x08: self.write_line(f"EVT_WAIT({self.var(argv[0])})") - elif opcode == 0x09: self.write_line(f"EVT_WAIT_SECS({self.var(argv[0])})") + elif opcode == 0x07: + self.write_line(f"EVT_BREAK_LOOP") + elif opcode == 0x08: + self.write_line(f"EVT_WAIT({self.var(argv[0])})") + elif opcode == 0x09: + self.write_line(f"EVT_WAIT_SECS({self.var(argv[0])})") elif opcode == 0x0A: if self.var(argv[0]).startswith("LW"): args_str = fix_1_arg(self, self.var(argv[0]), self.var(argv[1]), 0) @@ -893,7 +978,8 @@ def disassemble_command(self, opcode, argc, argv): self.indent -= 1 self.write_line(f"EVT_CASE_RANGE({self.var(argv[0])}, {self.var(argv[1])})") self.indent += 1 - elif opcode == 0x22: self.write_line(f"EVT_BREAK_SWITCH") + elif opcode == 0x22: + self.write_line(f"EVT_BREAK_SWITCH") elif opcode == 0x23: self.indent -= 2 del SWITCH_TYPES[-1] @@ -902,17 +988,17 @@ def disassemble_command(self, opcode, argc, argv): if self.var(argv[0]).startswith("LW"): new_arg = trim_lw(self.var(argv[0])) if self.var(argv[1]).startswith("LW"): - from_arg = trim_lw(self.var(argv[1])) # Carry type info of LW if being set from an LW + from_arg = trim_lw(self.var(argv[1])) # Carry type info of LW if being set from an LW else: - from_arg = 0 # If a constant, we no longer know the type + from_arg = 0 # If a constant, we no longer know the type LOCAL_WORDS[int(new_arg)] = LOCAL_WORDS[int(from_arg)] self.write_line(f"EVT_SET({self.var(argv[0])}, {self.var(argv[1])})") elif opcode == 0x25: argNum = argv[1] - sprite = (argNum & 0xFF0000) >> 16 - palette = (argNum & 0xFF00) >> 8 - anim = (argNum & 0xFF) >> 0 + sprite = (argNum & 0xFF0000) >> 16 + palette = (argNum & 0xFF00) >> 8 + anim = (argNum & 0xFF) >> 0 if sprite > 0: value = make_anim_macro(self, sprite, palette, anim) elif argNum > 100: @@ -920,41 +1006,60 @@ def disassemble_command(self, opcode, argc, argv): else: value = f"{argNum}" self.write_line(f"EVT_SET_CONST({self.var(argv[0])}, {value})") - elif opcode == 0x26: self.write_line(f"EVT_SETF({self.var(argv[0])}, {self.var(argv[1])})") - elif opcode == 0x27: self.write_line(f"EVT_ADD({self.var(argv[0])}, {self.var(argv[1])})") - elif opcode == 0x28: self.write_line(f"EVT_SUB({self.var(argv[0])}, {self.var(argv[1])})") - elif opcode == 0x29: self.write_line(f"EVT_MUL({self.var(argv[0])}, {self.var(argv[1])})") - elif opcode == 0x2A: self.write_line(f"EVT_DIV({self.var(argv[0])}, {self.var(argv[1])})") - elif opcode == 0x2B: self.write_line(f"EVT_MOD({self.var(argv[0])}, {self.var(argv[1])})") - elif opcode == 0x2C: self.write_line(f"EVT_ADDF({self.var(argv[0])}, {self.var(argv[1])})") - elif opcode == 0x2D: self.write_line(f"EVT_SUBF({self.var(argv[0])}, {self.var(argv[1])})") - elif opcode == 0x2E: self.write_line(f"EVT_MULF({self.var(argv[0])}, {self.var(argv[1])})") - elif opcode == 0x2F: self.write_line(f"EVT_DIVF({self.var(argv[0])}, {self.var(argv[1])})") - elif opcode == 0x30: self.write_line(f"EVT_USE_BUF({self.var(argv[0])})") + elif opcode == 0x26: + self.write_line(f"EVT_SETF({self.var(argv[0])}, {self.var(argv[1])})") + elif opcode == 0x27: + self.write_line(f"EVT_ADD({self.var(argv[0])}, {self.var(argv[1])})") + elif opcode == 0x28: + self.write_line(f"EVT_SUB({self.var(argv[0])}, {self.var(argv[1])})") + elif opcode == 0x29: + self.write_line(f"EVT_MUL({self.var(argv[0])}, {self.var(argv[1])})") + elif opcode == 0x2A: + self.write_line(f"EVT_DIV({self.var(argv[0])}, {self.var(argv[1])})") + elif opcode == 0x2B: + self.write_line(f"EVT_MOD({self.var(argv[0])}, {self.var(argv[1])})") + elif opcode == 0x2C: + self.write_line(f"EVT_ADDF({self.var(argv[0])}, {self.var(argv[1])})") + elif opcode == 0x2D: + self.write_line(f"EVT_SUBF({self.var(argv[0])}, {self.var(argv[1])})") + elif opcode == 0x2E: + self.write_line(f"EVT_MULF({self.var(argv[0])}, {self.var(argv[1])})") + elif opcode == 0x2F: + self.write_line(f"EVT_DIVF({self.var(argv[0])}, {self.var(argv[1])})") + elif opcode == 0x30: + self.write_line(f"EVT_USE_BUF({self.var(argv[0])})") elif opcode == 0x31 or opcode == 0x32 or opcode == 0x33 or opcode == 0x34: args = [*map(self.var, argv)] self.write_line(f"EVT_BUF_READ{opcode - 0x30}({', '.join(args)})") elif opcode == 0x35: args = [*map(self.var, argv)] self.write_line(f"EVT_BUF_PEEK({', '.join(args)})") - elif opcode == 0x36: self.write_line(f"EVT_USE_FBUF({self.var(argv[0])})") + elif opcode == 0x36: + self.write_line(f"EVT_USE_FBUF({self.var(argv[0])})") elif opcode == 0x37 or opcode == 0x38 or opcode == 0x39 or opcode == 0x3A: args = [*map(self.var, argv)] self.write_line(f"EVT_FBUF_READ{opcode - 0x36}({', '.join(args)})") elif opcode == 0x3B: args = [*map(self.var, argv)] self.write_line(f"EVT_FBUF_PEEK({', '.join(args)})") - elif opcode == 0x3C: self.write_line(f"EVT_USE_ARRAY({self.var(argv[0])})") - elif opcode == 0x3D: self.write_line(f"EVT_USE_FLAG_ARRAY({self.var(argv[0])})") - elif opcode == 0x3E: self.write_line(f"EVT_MALLOC_ARRAY({self.var(argv[0])}, {self.var(argv[1])})") - elif opcode == 0x3F: self.write_line(f"EVT_BITWISE_AND({self.var(argv[0])}, {self.var(argv[1])})") - elif opcode == 0x40: self.write_line(f"EVT_BITWISE_AND_CONST({self.var(argv[0])}, {self.var(argv[1])})") - elif opcode == 0x41: self.write_line(f"EVT_BITWISE_OR({self.var(argv[0])}, 0x{argv[1]:X})") - elif opcode == 0x42: self.write_line(f"EVT_BITWISE_OR_CONST({self.var(argv[0])}, 0x{argv[1]:X})") + elif opcode == 0x3C: + self.write_line(f"EVT_USE_ARRAY({self.var(argv[0])})") + elif opcode == 0x3D: + self.write_line(f"EVT_USE_FLAG_ARRAY({self.var(argv[0])})") + elif opcode == 0x3E: + self.write_line(f"EVT_MALLOC_ARRAY({self.var(argv[0])}, {self.var(argv[1])})") + elif opcode == 0x3F: + self.write_line(f"EVT_BITWISE_AND({self.var(argv[0])}, {self.var(argv[1])})") + elif opcode == 0x40: + self.write_line(f"EVT_BITWISE_AND_CONST({self.var(argv[0])}, {self.var(argv[1])})") + elif opcode == 0x41: + self.write_line(f"EVT_BITWISE_OR({self.var(argv[0])}, 0x{argv[1]:X})") + elif opcode == 0x42: + self.write_line(f"EVT_BITWISE_OR_CONST({self.var(argv[0])}, 0x{argv[1]:X})") elif opcode == 0x43: func = self.addr_ref(argv[0]) args = [self.var(a, use_evt_ptr=True) for a in argv[1:]] - args_str = ', '.join(args) + args_str = ", ".join(args) args_str = replace_constants(self, func, args_str) if func.startswith("evt_"): # use func-specific macro @@ -963,34 +1068,60 @@ def disassemble_command(self, opcode, argc, argv): # or ar not migrated, we have to create a placeholder elif func == "GotoMap" or func == "GotoMapSpecial": args = [self.var(a, use_evt_ptr=True) for a in argv[2:]] - args_str = ', '.join(args) + args_str = ", ".join(args) self.write_line(f"EVT_CALL({func}, EVT_PTR(UNK_STR_{argv[1]:X}), {args_str})") elif args_str: self.write_line(f"EVT_CALL({func}, {args_str})") else: - self.write_line(f"EVT_CALL({func})") # no args - elif opcode == 0x44: self.write_line(f"EVT_EXEC({self.addr_ref(argv[0])})") - elif opcode == 0x45: self.write_line(f"EVT_EXEC_GET_TID({self.addr_ref(argv[0])}, {self.var(argv[1])})") - elif opcode == 0x46: self.write_line(f"EVT_EXEC_WAIT({self.addr_ref(argv[0])})") + self.write_line(f"EVT_CALL({func})") # no args + elif opcode == 0x44: + self.write_line(f"EVT_EXEC({self.addr_ref(argv[0])})") + elif opcode == 0x45: + self.write_line(f"EVT_EXEC_GET_TID({self.addr_ref(argv[0])}, {self.var(argv[1])})") + elif opcode == 0x46: + self.write_line(f"EVT_EXEC_WAIT({self.addr_ref(argv[0])})") elif opcode == 0x47: - args = [self.addr_ref(argv[0]), self.trigger(argv[1]), self.collider_id(argv[2]), *map(self.var, argv[3:])] + args = [ + self.addr_ref(argv[0]), + self.trigger(argv[1]), + self.collider_id(argv[2]), + *map(self.var, argv[3:]), + ] self.write_line(f"EVT_BIND_TRIGGER({', '.join(args)})") - elif opcode == 0x48: self.write_line(f"EVT_UNBIND") - elif opcode == 0x49: self.write_line(f"EVT_KILL_THREAD({self.var(argv[0])})") - elif opcode == 0x4A: self.write_line(f"EVT_JUMP({self.var(argv[0])})") - elif opcode == 0x4B: self.write_line(f"EVT_SET_PRIORITY({self.var(argv[0])})") - elif opcode == 0x4C: self.write_line(f"EVT_SET_TIMESCALE({self.var(argv[0])})") - elif opcode == 0x4D: self.write_line(f"EVT_SET_GROUP({self.var(argv[0])})") + elif opcode == 0x48: + self.write_line(f"EVT_UNBIND") + elif opcode == 0x49: + self.write_line(f"EVT_KILL_THREAD({self.var(argv[0])})") + elif opcode == 0x4A: + self.write_line(f"EVT_JUMP({self.var(argv[0])})") + elif opcode == 0x4B: + self.write_line(f"EVT_SET_PRIORITY({self.var(argv[0])})") + elif opcode == 0x4C: + self.write_line(f"EVT_SET_TIMESCALE({self.var(argv[0])})") + elif opcode == 0x4D: + self.write_line(f"EVT_SET_GROUP({self.var(argv[0])})") elif opcode == 0x4E: - args = [self.addr_ref(argv[0]), self.trigger(argv[1]), self.collider_id(argv[2]), *map(self.var, argv[3:])] + args = [ + self.addr_ref(argv[0]), + self.trigger(argv[1]), + self.collider_id(argv[2]), + *map(self.var, argv[3:]), + ] self.write_line(f"EVT_BIND_PADLOCK({', '.join(args)})") - elif opcode == 0x4F: self.write_line(f"EVT_SUSPEND_GROUP({self.var(argv[0])})") - elif opcode == 0x50: self.write_line(f"EVT_RESUME_GROUP({self.var(argv[0])})") - elif opcode == 0x51: self.write_line(f"EVT_SUSPEND_OTHERS({self.var(argv[0])})") - elif opcode == 0x52: self.write_line(f"EVT_RESUME_OTHERS({self.var(argv[0])})") - elif opcode == 0x53: self.write_line(f"EVT_SUSPEND_THREAD({self.var(argv[0])})") - elif opcode == 0x54: self.write_line(f"EVT_RESUME_THREAD({self.var(argv[0])})") - elif opcode == 0x55: self.write_line(f"EVT_IS_THREAD_RUNNING({self.var(argv[0])}, {self.var(argv[1])})") + elif opcode == 0x4F: + self.write_line(f"EVT_SUSPEND_GROUP({self.var(argv[0])})") + elif opcode == 0x50: + self.write_line(f"EVT_RESUME_GROUP({self.var(argv[0])})") + elif opcode == 0x51: + self.write_line(f"EVT_SUSPEND_OTHERS({self.var(argv[0])})") + elif opcode == 0x52: + self.write_line(f"EVT_RESUME_OTHERS({self.var(argv[0])})") + elif opcode == 0x53: + self.write_line(f"EVT_SUSPEND_THREAD({self.var(argv[0])})") + elif opcode == 0x54: + self.write_line(f"EVT_RESUME_THREAD({self.var(argv[0])})") + elif opcode == 0x55: + self.write_line(f"EVT_IS_THREAD_RUNNING({self.var(argv[0])}, {self.var(argv[1])})") elif opcode == 0x56: self.write_line("EVT_THREAD") self.indent += 1 @@ -1010,22 +1141,62 @@ def disassemble_command(self, opcode, argc, argv): argv_str += ", " argv_str += f"0x{arg:X}" self.write_line(f"0x{opcode:02X}{argv_str}),") + def collider_id(self, arg): if arg >= 0x4000 and arg <= 0x5000: return f"EVT_ENTITY_INDEX({arg - 0x4000})" else: return self.var(arg) + + class UnsupportedScript(Exception): pass + + if __name__ == "__main__": import argparse + parser = argparse.ArgumentParser() parser.add_argument("file", type=str, help="File to dissassemble from") parser.add_argument("offset", help="Offset to start dissassembling from") - parser.add_argument("-end", "-e", "--e", type=lambda x: int(x, 16), default=0, dest="end", required=False, help="End offset to stop dissassembling from.\nOnly used as a way to find valid scripts.") - parser.add_argument("-vram", "-v", "--v", type=lambda x: int(x, 16), default=0, dest="vram", required=False, help="VRAM start will be tracked and used for the script output name") - parser.add_argument("-si", "--si", action="store_true", default=False, dest="si", required=False, help="Force si script output") - parser.add_argument("-blob", "--b", action="store_true", default=False, dest="blob", required=False, help="If there is a blob of scripts.") + parser.add_argument( + "-end", + "-e", + "--e", + type=lambda x: int(x, 16), + default=0, + dest="end", + required=False, + help="End offset to stop dissassembling from.\nOnly used as a way to find valid scripts.", + ) + parser.add_argument( + "-vram", + "-v", + "--v", + type=lambda x: int(x, 16), + default=0, + dest="vram", + required=False, + help="VRAM start will be tracked and used for the script output name", + ) + parser.add_argument( + "-si", + "--si", + action="store_true", + default=False, + dest="si", + required=False, + help="Force si script output", + ) + parser.add_argument( + "-blob", + "--b", + action="store_true", + default=False, + dest="blob", + required=False, + help="If there is a blob of scripts.", + ) args = parser.parse_args() vram_base = args.vram get_constants() @@ -1057,25 +1228,35 @@ class UnsupportedScript(Exception): script_text = script.disassemble() if script.instructions > 1 and "_EVT_CMD" not in script_text: if gap and first_print: - potential_struct_sizes = { "NpcData": 0x1F0, "MobileAISettings":0x30, "NpcSettings":0x2C, "NpcGroupList":0xC } + potential_struct_sizes = { + "NpcData": 0x1F0, + "MobileAISettings": 0x30, + "NpcSettings": 0x2C, + "NpcGroupList": 0xC, + } gap_size = offset - gap_start potential_struct = "Unknown data" potential_count = 1 - for k,v in potential_struct_sizes.items(): + for k, v in potential_struct_sizes.items(): if gap_size % v == 0: potential_struct = k potential_count = gap_size // v - print(f"========== 0x{gap_size:X} byte gap ({potential_count} {potential_struct}?) 0x{gap_start:X} - 0x{offset:X} ==========") + print( + f"========== 0x{gap_size:X} byte gap ({potential_count} {potential_struct}?) 0x{gap_start:X} - 0x{offset:X} ==========" + ) print() gap = False - #print(f"EvtScript read from 0x{script.start_pos:X} to 0x{script.end_pos:X} " + # print(f"EvtScript read from 0x{script.start_pos:X} to 0x{script.end_pos:X} " # f"(0x{script.end_pos - script.start_pos:X} bytes, {script.instructions} instructions)") - #print() + # print() vram = f"{args.vram:X}_" if vram_base > 0 else f"" - script_text = script_text.replace("EvtScript script = SCRIPT({", f"EvtScript N(D_{vram}{offset:X}) = " + "SCRIPT({") + script_text = script_text.replace( + "EvtScript script = SCRIPT({", + f"EvtScript N(D_{vram}{offset:X}) = " + "SCRIPT({", + ) print(script_text, end="") print() - #print(f"Valid script found at 0x{offset:X}") + # print(f"Valid script found at 0x{offset:X}") args.vram += script.end_pos - offset offset = script.end_pos first_print = True @@ -1093,7 +1274,6 @@ class UnsupportedScript(Exception): args.vram += 4 else: with open(args.file, "rb") as f: - f.seek(offset) loffset = args.offset looping = 1 @@ -1102,7 +1282,10 @@ class UnsupportedScript(Exception): script = ScriptDisassembler(f, loffset, {}, 0x978DE0, INCLUDES_NEEDED, INCLUDED) if args.si: - print(ScriptDisassembler(f, loffset, {}, 0x978DE0, INCLUDES_NEEDED, INCLUDED).disassemble(), end="") + print( + ScriptDisassembler(f, loffset, {}, 0x978DE0, INCLUDES_NEEDED, INCLUDED).disassemble(), + end="", + ) else: try: script_text = script.disassemble() @@ -1120,7 +1303,7 @@ class UnsupportedScript(Exception): print(e) loffset = script.end_pos - LOCAL_WORDS = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] + LOCAL_WORDS = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] looping = args.blob try: loffset = _script_lib[loffset - info[0] + info[2]][0][1] diff --git a/tools/find_duplicates.py b/tools/find_duplicates.py index 862ea1f6619..46d75f98f05 100755 --- a/tools/find_duplicates.py +++ b/tools/find_duplicates.py @@ -59,7 +59,7 @@ def get_symbol_bytes(offsets, func): for ins in insns: ret.append(ins >> 2) - return bytes(ret).decode('utf-8'), bs + return bytes(ret).decode("utf-8"), bs def parse_map(fname): @@ -80,12 +80,7 @@ def parse_map(fname): continue prev_line = line - if ( - ram_offset is None - or "=" in line - or "*fill*" in line - or " 0x" not in line - ): + if ram_offset is None or "=" in line or "*fill*" in line or " 0x" not in line: continue ram = int(line[16 : 16 + 18], 0) rom = ram - ram_offset @@ -177,7 +172,7 @@ def do_query(query): break match_str = "{:.3f} - {}".format(matches[match], match) if match not in s_files: - match_str += " (decompiled)" + match_str += " (decompiled)" print(match_str) i += 1 print() @@ -203,7 +198,10 @@ def all_matches(all_funcs_flag): file = to_match_files[0] i += 1 - print("File matching progress: {:%}".format(i / (len(s_files) - iter_limit)), end='\r') + print( + "File matching progress: {:%}".format(i / (len(s_files) - iter_limit)), + end="\r", + ) if get_symbol_length(file) < 16: to_match_files.remove(file) @@ -241,18 +239,26 @@ def all_matches(all_funcs_flag): output_match_dict(match_dict, num_decomped_dupes, num_undecomped_dupes, num_perfect_dupes, i) -def output_match_dict(match_dict, num_decomped_dupes, num_undecomped_dupes, num_perfect_dupes, num_checked_files): - out_file = open(datetime.today().strftime('%Y-%m-%d-%H-%M-%S') + "_all_matches.txt", "w+") +def output_match_dict( + match_dict, + num_decomped_dupes, + num_undecomped_dupes, + num_perfect_dupes, + num_checked_files, +): + out_file = open(datetime.today().strftime("%Y-%m-%d-%H-%M-%S") + "_all_matches.txt", "w+") - out_file.write("Number of s-files: " + str(len(s_files)) + "\n" - "Number of checked s-files: " + str(round(num_checked_files)) + "\n" - "Number of decompiled duplicates found: " + str(num_decomped_dupes) + "\n" - "Number of undecompiled duplicates found: " + str(num_undecomped_dupes) + "\n" - "Number of overall exact duplicates found: " + str(num_perfect_dupes) + "\n\n") + out_file.write( + "Number of s-files: " + str(len(s_files)) + "\n" + "Number of checked s-files: " + str(round(num_checked_files)) + "\n" + "Number of decompiled duplicates found: " + str(num_decomped_dupes) + "\n" + "Number of undecompiled duplicates found: " + str(num_undecomped_dupes) + "\n" + "Number of overall exact duplicates found: " + str(num_perfect_dupes) + "\n\n" + ) sorted_dict = OrderedDict(sorted(match_dict.items(), key=lambda item: item[1][0], reverse=True)) - print("Creating output file: " + out_file.name, end='\n') + print("Creating output file: " + out_file.name, end="\n") for file_name, matches in sorted_dict.items(): out_file.write(file_name + " - found " + str(matches[0]) + " matches total:\n") for match in matches[1]: @@ -261,19 +267,23 @@ def output_match_dict(match_dict, num_decomped_dupes, num_undecomped_dupes, num_ out_file.close() + def is_decompiled(sym): return sym not in s_files + def do_cross_query(): ccount = Counter() clusters = [] sym_bytes = {} for sym_name in map_syms: - if not sym_name.startswith("D_") and \ - not sym_name.startswith("_binary") and \ - not sym_name.startswith("jtbl_") and \ - not re.match(r"L[0-9A-F]{8}_[0-9A-F]{5,6}", sym_name): + if ( + not sym_name.startswith("D_") + and not sym_name.startswith("_binary") + and not sym_name.startswith("jtbl_") + and not re.match(r"L[0-9A-F]{8}_[0-9A-F]{5,6}", sym_name) + ): if get_symbol_length(sym_name) > 16: sym_bytes[sym_name] = get_symbol_bytes(map_offsets, sym_name) @@ -303,14 +313,48 @@ def do_cross_query(): print(ccount.most_common(100)) -parser = argparse.ArgumentParser(description="Tool to find duplicates for a specific function or to find all duplicates across the codebase.") +parser = argparse.ArgumentParser( + description="Tool to find duplicates for a specific function or to find all duplicates across the codebase." +) group = parser.add_mutually_exclusive_group() -group.add_argument("-a", "--all", help="find ALL duplicates and output them into a file", action='store_true', required=False) -group.add_argument("-c", "--cross", help="do a cross query over the codebase", action='store_true', required=False) -group.add_argument("-s", "--short", help="find MOST duplicates besides some very small duplicates. Cuts the runtime in half with minimal loss", action='store_true', required=False) -parser.add_argument("query", help="function or file", nargs='?', default=None) -parser.add_argument("-t", "--threshold", help="score threshold between 0 and 1 (higher is more restrictive)", type=float, default=0.9, required=False) -parser.add_argument("-n", "--num-out", help="number of functions to display", type=int, default=100, required=False) +group.add_argument( + "-a", + "--all", + help="find ALL duplicates and output them into a file", + action="store_true", + required=False, +) +group.add_argument( + "-c", + "--cross", + help="do a cross query over the codebase", + action="store_true", + required=False, +) +group.add_argument( + "-s", + "--short", + help="find MOST duplicates besides some very small duplicates. Cuts the runtime in half with minimal loss", + action="store_true", + required=False, +) +parser.add_argument("query", help="function or file", nargs="?", default=None) +parser.add_argument( + "-t", + "--threshold", + help="score threshold between 0 and 1 (higher is more restrictive)", + type=float, + default=0.9, + required=False, +) +parser.add_argument( + "-n", + "--num-out", + help="number of functions to display", + type=int, + default=100, + required=False, +) args = parser.parse_args() diff --git a/tools/find_similar_areas.py b/tools/find_similar_areas.py index 303b8bc6613..09125e68b02 100755 --- a/tools/find_similar_areas.py +++ b/tools/find_similar_areas.py @@ -60,14 +60,10 @@ def get_all_unmatched_functions(): def get_func_sizes() -> Dict[str, int]: try: - result = subprocess.run( - ["mips-linux-gnu-objdump", "-x", elf_path], stdout=subprocess.PIPE - ) + result = subprocess.run(["mips-linux-gnu-objdump", "-x", elf_path], stdout=subprocess.PIPE) nm_lines = result.stdout.decode().split("\n") except: - print( - f"Error: Could not run objdump on {elf_path} - make sure that the project is built" - ) + print(f"Error: Could not run objdump on {elf_path} - make sure that the project is built") sys.exit(1) sizes: Dict[str, int] = {} @@ -127,12 +123,7 @@ def parse_map() -> OrderedDict[str, Symbol]: continue prev_line = line - if ( - ram_offset is None - or "=" in line - or "*fill*" in line - or " 0x" not in line - ): + if ram_offset is None or "=" in line or "*fill*" in line or " 0x" not in line: continue ram = int(line[16 : 16 + 18], 0) rom = ram - ram_offset @@ -240,9 +231,7 @@ def group_matches( continue if max is not None and query_start > max: continue - if contains is not None and ( - query_start > contains or query_start + length < contains - ): + if contains is not None and (query_start > contains or query_start + length < contains): continue ret.append(Result(query, target, query_start, target_start, length)) @@ -291,11 +280,7 @@ def get_line_numbers(obj_file: Path) -> Dict[int, int]: def get_tu_offset(obj_file: Path, symbol: str) -> Optional[int]: objdump = "mips-linux-gnu-objdump" - objdump_out = ( - subprocess.run([objdump, "-t", obj_file], stdout=subprocess.PIPE) - .stdout.decode("utf-8") - .split("\n") - ) + objdump_out = subprocess.run([objdump, "-t", obj_file], stdout=subprocess.PIPE).stdout.decode("utf-8").split("\n") if not objdump_out: return None @@ -398,9 +383,7 @@ def get_matches( if not matches: continue - results: list[Result] = group_matches( - query, symbol, matches, window_size, min, max, contains - ) + results: list[Result] = group_matches(query, symbol, matches, window_size, min, max, contains) if not results: continue @@ -427,12 +410,12 @@ def get_matches( target_range_str = "" if c_range: - target_range_str = ( - fg.li_cyan + f" (line {c_range} in {obj_file.stem})" + fg.rs - ) + target_range_str = fg.li_cyan + f" (line {c_range} in {obj_file.stem})" + fg.rs query_str = f"query [{result.query_start}-{result.query_end}]" - target_str = f"{symbol} [insn {result.target_start}-{result.target_end}] ({result.length} total){target_range_str}" + target_str = ( + f"{symbol} [insn {result.target_start}-{result.target_end}] ({result.length} total){target_range_str}" + ) print(f"\t{query_str} matches {target_str}") if show_disasm: @@ -441,20 +424,12 @@ def get_matches( except ImportError: print("rabbitizer not found, cannot show disassembly") sys.exit(1) - result_query_bytes = query_bytes.bytes[ - result.query_start * 4 : result.query_end * 4 - ] - result_target_bytes = sym_bytes.bytes[ - result.target_start * 4 : result.target_end * 4 - ] + result_query_bytes = query_bytes.bytes[result.query_start * 4 : result.query_end * 4] + result_target_bytes = sym_bytes.bytes[result.target_start * 4 : result.target_end * 4] for i in range(0, len(result_query_bytes), 4): - q_insn = rabbitizer.Instruction( - int.from_bytes(result_query_bytes[i : i + 4], "big") - ) - t_insn = rabbitizer.Instruction( - int.from_bytes(result_target_bytes[i : i + 4], "big") - ) + q_insn = rabbitizer.Instruction(int.from_bytes(result_query_bytes[i : i + 4], "big")) + t_insn = rabbitizer.Instruction(int.from_bytes(result_target_bytes[i : i + 4], "big")) print(f"\t\t{q_insn.disassemble():35} | {t_insn.disassemble()}") diff --git a/tools/get_variable.py b/tools/get_variable.py index 3455e5b6b0a..c6f8cae76d5 100755 --- a/tools/get_variable.py +++ b/tools/get_variable.py @@ -2,20 +2,32 @@ import sys + def get_variable(arg): - v = arg - 2**32 # convert to s32 + v = arg - 2**32 # convert to s32 if v > -250000000: - if v <= -220000000: return f"EVT_FLOAT({(v + 230000000) / 1024})" - elif v <= -200000000: return f"ArrayFlag({v + 210000000})" - elif v <= -180000000: return f"ArrayVar({v + 190000000})" - elif v <= -160000000: return f"GameByte({v + 170000000})" - elif v <= -140000000: return f"AreaByte({v + 150000000})" - elif v <= -120000000: return f"GameFlag({v + 130000000})" - elif v <= -100000000: return f"AreaFlag({v + 110000000})" - elif v <= -80000000: return f"MapFlag({v + 90000000})" - elif v <= -60000000: return f"LocalFlag({v + 70000000})" - elif v <= -40000000: return f"MapVar({v + 50000000})" - elif v <= -20000000: return f"LocalVar({v + 30000000})" + if v <= -220000000: + return f"EVT_FLOAT({(v + 230000000) / 1024})" + elif v <= -200000000: + return f"ArrayFlag({v + 210000000})" + elif v <= -180000000: + return f"ArrayVar({v + 190000000})" + elif v <= -160000000: + return f"GameByte({v + 170000000})" + elif v <= -140000000: + return f"AreaByte({v + 150000000})" + elif v <= -120000000: + return f"GameFlag({v + 130000000})" + elif v <= -100000000: + return f"AreaFlag({v + 110000000})" + elif v <= -80000000: + return f"MapFlag({v + 90000000})" + elif v <= -60000000: + return f"LocalFlag({v + 70000000})" + elif v <= -40000000: + return f"MapVar({v + 50000000})" + elif v <= -20000000: + return f"LocalVar({v + 30000000})" if arg == 0xFFFFFFFF: return "-1" @@ -26,6 +38,7 @@ def get_variable(arg): else: return f"{arg}" + if __name__ == "__main__": try: print(get_variable(int(sys.argv[1], 0))) diff --git a/tools/m2ctx.py b/tools/m2ctx.py index 7f2b17fe93c..6ec2de3f4f3 100755 --- a/tools/m2ctx.py +++ b/tools/m2ctx.py @@ -20,14 +20,14 @@ "-D_LANGUAGE_C", "-DF3DEX_GBI_2", "-D_MIPS_SZLONG=32", - "-DSCRIPT(test...)={}" - "-D__attribute__(test...)=", + "-DSCRIPT(test...)={}" "-D__attribute__(test...)=", "-D__asm__(test...)=", "-ffreestanding", "-DM2CTX", "-DVERSION_PAL", ] + def import_c_file(in_file) -> str: in_file = os.path.relpath(in_file, root_dir) cpp_command = ["gcc", "-E", "-P", "-dM", *CPP_FLAGS, in_file] @@ -42,10 +42,9 @@ def import_c_file(in_file) -> str: out_text += subprocess.check_output(cpp_command2, cwd=root_dir, encoding="utf-8") except subprocess.CalledProcessError: print( - "Failed to preprocess input file, when running command:\n" - + cpp_command, + "Failed to preprocess input file, when running command:\n" + cpp_command, file=sys.stderr, - ) + ) sys.exit(1) if not out_text: @@ -56,10 +55,9 @@ def import_c_file(in_file) -> str: out_text = out_text.replace(line + "\n", "") return out_text + def main(): - parser = argparse.ArgumentParser( - description="""Create a context file which can be used for mips_to_c""" - ) + parser = argparse.ArgumentParser(description="""Create a context file which can be used for mips_to_c""") parser.add_argument( "c_file", help="""File from which to create context""", diff --git a/tools/migrate_data_to_c.py b/tools/migrate_data_to_c.py index 743f946293c..42e0485334f 100755 --- a/tools/migrate_data_to_c.py +++ b/tools/migrate_data_to_c.py @@ -22,7 +22,7 @@ def data_to_c(file_path): output = "" pattern = re.compile(r"(dlabel (jtbl_.*|.+_.*)\n.(\w+) (.*))") - for (all, symbol, type, data) in re.findall(pattern, s): + for all, symbol, type, data in re.findall(pattern, s): if type == "word": if symbol.startswith("jtbl_"): output += "dlabel " + symbol + "\n" + ".word " + data.replace("L", ".L") + "\n\n" @@ -42,7 +42,7 @@ def out_to_file(output, file_path): if not os.path.exists(output_dir): os.mkdir(output_dir) - file_name = file_path[file_path.rfind("/"):-7] + file_name = file_path[file_path.rfind("/") : -7] file = open("data2c/" + file_name + ".c", "w+") file.write(output) file.close() @@ -74,9 +74,19 @@ def query(file, to_file): parser = argparse.ArgumentParser(description="Tool to translate .data.s files to data arrays") -parser.add_argument("query", help="data file", nargs='?', default=None) -parser.add_argument("--all", help="translate all data files at once and output them into /data2c", action='store_true', required=False) -parser.add_argument("--to-file", help="redirect the output into a file. Can not be used in combination with --all", action='store_true', required=False) +parser.add_argument("query", help="data file", nargs="?", default=None) +parser.add_argument( + "--all", + help="translate all data files at once and output them into /data2c", + action="store_true", + required=False, +) +parser.add_argument( + "--to-file", + help="redirect the output into a file. Can not be used in combination with --all", + action="store_true", + required=False, +) args = parser.parse_args() diff --git a/tools/mv_segment.py b/tools/mv_segment.py index 457435ce0e7..b73f9fe5565 100755 --- a/tools/mv_segment.py +++ b/tools/mv_segment.py @@ -26,12 +26,21 @@ if os.path.exists(f"ver/current/asm/nonmatchings/{args.src}"): print("moving asm/nonmatchings files") - os.rename(f"ver/current/asm/nonmatchings/{args.src}", f"ver/current/asm/nonmatchings/{args.dest}") + os.rename( + f"ver/current/asm/nonmatchings/{args.src}", + f"ver/current/asm/nonmatchings/{args.dest}", + ) if os.path.exists(f"ver/current/asm/data/{args.src}.data.s"): print("moving data file") - os.rename(f"ver/current/asm/data/{args.src}.data.s", f"ver/current/asm/data/{args.dest}.data.s") + os.rename( + f"ver/current/asm/data/{args.src}.data.s", + f"ver/current/asm/data/{args.dest}.data.s", + ) if os.path.exists(f"ver/current/asm/data/{args.src}.rodata.s"): print("moving rodata file") - os.rename(f"ver/current/asm/data/{args.src}.rodata.s", f"ver/current/asm/data/{args.dest}.rodata.s") + os.rename( + f"ver/current/asm/data/{args.src}.rodata.s", + f"ver/current/asm/data/{args.dest}.rodata.s", + ) diff --git a/tools/old/codescan.py b/tools/old/codescan.py index 95441525ae1..6a854e5119d 100755 --- a/tools/old/codescan.py +++ b/tools/old/codescan.py @@ -11,6 +11,7 @@ root_dir = os.path.abspath(os.path.join(script_dir, "../..")) import glob, os + os.chdir(root_dir) for f in Path(root_dir).rglob("*.bin"): @@ -20,7 +21,10 @@ continue ras = [] - result = subprocess.run(["mips-linux-gnu-objdump", "-Dz", "-bbinary", "-mmips", "-EB" , f], stdout=subprocess.PIPE) + result = subprocess.run( + ["mips-linux-gnu-objdump", "-Dz", "-bbinary", "-mmips", "-EB", f], + stdout=subprocess.PIPE, + ) output = result.stdout.decode().split("\n") for line in output: diff --git a/tools/old/create_renames.py b/tools/old/create_renames.py index 5552755162f..4811d4662be 100644 --- a/tools/old/create_renames.py +++ b/tools/old/create_renames.py @@ -18,7 +18,7 @@ break if area: - fname = line[line.rfind("`") + 1:line.rfind("'")] + fname = line[line.rfind("`") + 1 : line.rfind("'")] renames[fname] = area pairs = [] diff --git a/tools/old/fix_bad_evt_changes.py b/tools/old/fix_bad_evt_changes.py index e9ebfef7fa3..e2ce853113d 100644 --- a/tools/old/fix_bad_evt_changes.py +++ b/tools/old/fix_bad_evt_changes.py @@ -28,7 +28,7 @@ continue if old_line.startswith("N(") or old_line.startswith("await N("): - good_symbol_name = old_line[old_line.find("N("):].split(")", 1)[0] + ")" + good_symbol_name = old_line[old_line.find("N(") :].split(")", 1)[0] + ")" else: good_symbol_name = old_line.split("(", 1)[0] @@ -38,4 +38,3 @@ with open(filename, "w") as f: f.writelines(lines) - diff --git a/tools/old/gen_effect_renames.py b/tools/old/gen_effect_renames.py index 9886f610b72..2e30139752e 100755 --- a/tools/old/gen_effect_renames.py +++ b/tools/old/gen_effect_renames.py @@ -3,14 +3,14 @@ import argparse import os + def auto_int(x): return int(x, 0) + script_dir = os.path.dirname(os.path.realpath(__file__)) -parser = argparse.ArgumentParser( - description="Generate rename file for effects" -) +parser = argparse.ArgumentParser(description="Generate rename file for effects") parser.add_argument( "id", @@ -23,6 +23,7 @@ def auto_int(x): help="Name (in snake case) to change the effect to", ) + def main(args): id = args.id to = args.to @@ -31,7 +32,7 @@ def main(args): hex_str = f"{id:02x}".upper() - struct_name = ''.join(word.title() for word in to.split('_')) + struct_name = "".join(word.title() for word in to.split("_")) to_write.append(f"Effect{id} {struct_name}FXData") to_write.append(f"playFX_{hex_str} fx_{to}") to_write.append(f"FX_ENTRY_NUMBERED({id}, FX_ENTRY({to},") @@ -47,6 +48,7 @@ def main(args): for line in to_write: f.write(f"{line}\n") + if __name__ == "__main__": args = parser.parse_args() main(args) diff --git a/tools/old/gfxdis_loop.py b/tools/old/gfxdis_loop.py index a713d40bfd4..bcf171c843a 100644 --- a/tools/old/gfxdis_loop.py +++ b/tools/old/gfxdis_loop.py @@ -6,8 +6,8 @@ parser = argparse.ArgumentParser() parser.add_argument("baserom") -parser.add_argument("start", type=lambda x:int(x, 0)) -parser.add_argument("end", type=lambda x:int(x, 0)) +parser.add_argument("start", type=lambda x: int(x, 0)) +parser.add_argument("end", type=lambda x: int(x, 0)) args = parser.parse_args() baserom_path = Path(__file__).parent.parent / "baserom.z64" @@ -25,9 +25,13 @@ while unpack_from("B", baserom, i)[0] == 0: i += 1 - #print(f"Start {hex(dis_start)} end {hex(i)}") - gfxdis = subprocess.run(f"{gfxdis_path.resolve()} " + f"-x " + f"-dc " + f"-d {baserom[dis_start:i].hex()}", - capture_output=True, shell=True, text=True) + # print(f"Start {hex(dis_start)} end {hex(i)}") + gfxdis = subprocess.run( + f"{gfxdis_path.resolve()} " + f"-x " + f"-dc " + f"-d {baserom[dis_start:i].hex()}", + capture_output=True, + shell=True, + text=True, + ) commands = gfxdis.stdout.splitlines()[1:-1] new_commands = [] diff --git a/tools/old/make_npc_structs.py b/tools/old/make_npc_structs.py index aeded3429c3..d931ab4754c 100644 --- a/tools/old/make_npc_structs.py +++ b/tools/old/make_npc_structs.py @@ -3,11 +3,23 @@ from struct import unpack_from CONSTANTS = {} + + def get_constants(): global CONSTANTS - valid_enums = { "StoryProgress", "ItemIDs", "PlayerAnims", - "ActorIDs", "Events", "SoundIDs", "SongIDs", "Locations", - "AmbientSounds", "NpcIDs", "Emotes" } + valid_enums = { + "StoryProgress", + "ItemIDs", + "PlayerAnims", + "ActorIDs", + "Events", + "SoundIDs", + "SongIDs", + "Locations", + "AmbientSounds", + "NpcIDs", + "Emotes", + } for enum in valid_enums: CONSTANTS[enum] = {} CONSTANTS["NPC_SPRITE"] = {} @@ -16,7 +28,7 @@ def get_constants(): enums = Path(include_path / "enums.h").read_text().splitlines() # defines - ''' + """ for line in enums.splitlines(): this_enum = "" for enum in valid_enums: @@ -31,12 +43,12 @@ def get_constants(): id_ = id_.split(" ",1)[0] CONSTANTS[this_enum][int(id_, 16)] = name - ''' + """ # enums - for i,line in enumerate(enums): + for i, line in enumerate(enums): if line.startswith("enum "): - enum_name = line.split(" ",1)[1].split(" {",1)[0] + enum_name = line.split(" ", 1)[1].split(" {", 1)[0] if enum_name in valid_enums: CONSTANTS[enum_name] = {} last_num = 0 @@ -47,7 +59,7 @@ def get_constants(): continue name = enums[i].strip() - val = last_num+1 + val = last_num + 1 if "=" in name: name, val = name.split(" = ") val = int(val[:-1], 0) @@ -56,14 +68,16 @@ def get_constants(): else: name = name[:-1] name = name.strip() - #print("\"" + name + "\"", "===", val) + # print("\"" + name + "\"", "===", val) CONSTANTS[enum_name][val] = name.strip() i += 1 last_num = val # sprites - sprite_path = Path(Path(__file__).resolve().parent.parent / "ver" / "current" / "build" / "include" / "sprite" / "npc") + sprite_path = Path( + Path(__file__).resolve().parent.parent / "ver" / "current" / "build" / "include" / "sprite" / "npc" + ) for file in sprite_path.iterdir(): fd = file.read_text() for line in fd.splitlines(): @@ -76,10 +90,10 @@ def get_constants(): else: continue - name = line.split(" ",2)[1] + name = line.split(" ", 2)[1] id_ = line.split("0x", 1)[1] if " " in id_: - id_ = id_.split(" ",1)[0] + id_ = id_.split(" ", 1)[0] name = name.split(f"_{enum}_", 1)[1] if enum == "NPC_SPRITE": saved_name = name @@ -89,7 +103,11 @@ def get_constants(): if enum == "NPC_SPRITE": if int(id_, 16) not in CONSTANTS["NPC_SPRITE"]: - CONSTANTS[enum][int(id_, 16)] = {"name":"", "palettes":{}, "anims":{}} + CONSTANTS[enum][int(id_, 16)] = { + "name": "", + "palettes": {}, + "anims": {}, + } CONSTANTS[enum][int(id_, 16)]["name"] = name elif enum == "NPC_PALETTE": CONSTANTS["NPC_SPRITE"][int(saved_id, 16)]["palettes"][int(id_, 16)] = name @@ -97,20 +115,22 @@ def get_constants(): CONSTANTS["NPC_SPRITE"][int(saved_id, 16)]["anims"][int(id_, 16)] = name return + STRUCTS = {} + def parse_var(line): - #print(f"Parsing {line}") + # print(f"Parsing {line}") if "*/ " in line: - line = line.split("*/ ",1)[1] - line = line.split(";",1)[0].strip() + line = line.split("*/ ", 1)[1] + line = line.split(";", 1)[0].strip() if "," in line or "(*" in line: return (None, None, None, None) elif "union " in line: return ("union", None, None, None) - #print(f"Parsed {line}") + # print(f"Parsed {line}") if " " in line: if line.startswith("struct "): struct, type_, name = line.split(" ") @@ -131,22 +151,23 @@ def parse_var(line): is_ptr = "*" in type_ or type_ == "UNK_PTR" return (type_, name, count, is_ptr) + def parse_file(filename): fd = filename.read_text().splitlines() i = 0 while i < len(fd): - #supported = [f"typedef struct {x}" in fd[i] for x in SUPPORTED_STRUCTS] - #if any(supported): + # supported = [f"typedef struct {x}" in fd[i] for x in SUPPORTED_STRUCTS] + # if any(supported): if "typedef struct " in fd[i]: - #supported_name = [SUPPORTED_STRUCTS[i] for i,x in enumerate(supported) if x][0] + # supported_name = [SUPPORTED_STRUCTS[i] for i,x in enumerate(supported) if x][0] supported_name = fd[i].split("typedef struct ", 1)[1].split(" {", 1)[0] if supported_name == "{": supported_name = "" - #print(f"Parsing struct \"{supported_name}\"") + # print(f"Parsing struct \"{supported_name}\"") struct_to_add = [] i += 1 - while ("} " + f"{supported_name.upper()}") not in fd[i].split(";",1)[0].upper(): + while ("} " + f"{supported_name.upper()}") not in fd[i].split(";", 1)[0].upper(): type_, name, count, ptr = parse_var(fd[i]) if type_ == None: @@ -158,27 +179,37 @@ def parse_file(filename): i += 1 while "}" not in fd[i]: type_, name, count, ptr = parse_var(fd[i]) - union.append({"type":type_, "name": name, "num":count, "ptr":ptr}) + union.append({"type": type_, "name": name, "num": count, "ptr": ptr}) i += 1 name = fd[i].split("}", 1)[1].split(";", 1)[0] - #print(supported_name, type_, name, count) - struct_to_add.append({"type":type_, "name": name, "num":count, "ptr":ptr, "union":union}) + # print(supported_name, type_, name, count) + struct_to_add.append( + { + "type": type_, + "name": name, + "num": count, + "ptr": ptr, + "union": union, + } + ) i += 1 - #print(f"Broke on line {fd[i]}") - #print() + # print(f"Broke on line {fd[i]}") + # print() if supported_name == "": - supported_name = fd[i].split("} ",1)[1].split(";",1)[0] + supported_name = fd[i].split("} ", 1)[1].split(";", 1)[0] if "[" in supported_name: supported_name = supported_name[:-2] STRUCTS[supported_name] = struct_to_add i += 1 + def get_structs(): parse_file(Path(Path(__file__).parent.parent / "include" / "map.h")) parse_file(Path(Path(__file__).parent.parent / "include" / "common_structs.h")) + def get_vals(fd, offset, var): global STRUCTS @@ -192,63 +223,63 @@ def get_vals(fd, offset, var): for var2 in STRUCTS[var["type"]]: out3, offset = get_vals(fd, offset, var2) data.extend(out3) - #if var["num"] == 1: + # if var["num"] == 1: # out.extend(out2) - #else: - #out.append(out2) + # else: + # out.append(out2) else: type_ = "int" fmt = "d" - if var["type"] == "s8" or var["type"] == "char": - if var["type"] == "char": + if var["type"] == "s8" or var["type"] == "char": + if var["type"] == "char": type_ = "hex" fmt = "X" - data = unpack_from('>b', fd, offset)[0] + data = unpack_from(">b", fd, offset)[0] offset += 1 - elif var["type"] == "u8": - data = unpack_from('>B', fd, offset)[0] + elif var["type"] == "u8": + data = unpack_from(">B", fd, offset)[0] fmt = "d" offset += 1 - elif var["type"] == "s16" or var["type"] in ("s16"): + elif var["type"] == "s16" or var["type"] in ("s16"): offset += offset % 2 - data = unpack_from('>h', fd, offset)[0] + data = unpack_from(">h", fd, offset)[0] fmt = "d" offset += 2 - elif var["type"] == "u16": + elif var["type"] == "u16": offset += offset % 2 - data = unpack_from('>H', fd, offset)[0] + data = unpack_from(">H", fd, offset)[0] fmt = "d" offset += 2 - elif var["type"] == "s32" or var["type"] in ("s32"): + elif var["type"] == "s32" or var["type"] in ("s32"): poff = offset offset += offset % 4 - data = unpack_from('>i', fd, offset)[0] + data = unpack_from(">i", fd, offset)[0] fmt = "d" offset += 4 - elif var["type"] == "u32": + elif var["type"] == "u32": offset += offset % 4 - data = unpack_from('>I', fd, offset)[0] + data = unpack_from(">I", fd, offset)[0] fmt = "d" offset += 4 - elif var["type"] == "f32": + elif var["type"] == "f32": offset += offset % 4 - data = unpack_from('>f', fd, offset)[0] + data = unpack_from(">f", fd, offset)[0] type_ = "float" fmt = ".01f" offset += 4 elif var["type"] == "X32": offset += offset % 4 - data = unpack_from('>f', fd, offset)[0] + data = unpack_from(">f", fd, offset)[0] type_ = "Xfloat" fmt = ".01f" if data < -1000.0 or data > 1000.0: type_ = "Xint" fmt = "d" - data = unpack_from('>i', fd, offset)[0] + data = unpack_from(">i", fd, offset)[0] offset += 4 elif var["ptr"]: offset += offset % 4 - data = unpack_from('>I', fd, offset)[0] + data = unpack_from(">I", fd, offset)[0] type_ = "ptr" fmt = "08X" offset += 4 @@ -256,24 +287,26 @@ def get_vals(fd, offset, var): print(f"Unknown data type \"{var['type']}\"") exit() if var["num"] == 1: - out.append({"name":var["name"], "type":type_, "fmt":fmt, "data":data}) + out.append({"name": var["name"], "type": type_, "fmt": fmt, "data": data}) else: - arr.append({"name":var["name"], "type":type_, "fmt":fmt, "data":data}) + arr.append({"name": var["name"], "type": type_, "fmt": fmt, "data": data}) if var["num"] > 1: out.append(arr) return out, offset + def INDENT(depth): return f" " * depth + def print_data(vals, indent, needs_name, is_array=False, is_struct=False): out = [] for val in vals: line = "" if needs_name: line = INDENT(indent) - #print(val) + # print(val) # array if type(val) is list: line += f".{val[0]['name']} = " + "{ " @@ -291,10 +324,10 @@ def print_data(vals, indent, needs_name, is_array=False, is_struct=False): line += "\n" line += INDENT(indent) line += "{ " - for x,val2 in enumerate(val["data"]): + for x, val2 in enumerate(val["data"]): if x > 0: line += ", " - #line += f".{val2['name']} = " + # line += f".{val2['name']} = " fmt = val2["fmt"] if val2["type"] == "float": line += f"{val2['data']:{fmt}}f" @@ -315,7 +348,6 @@ def print_data(vals, indent, needs_name, is_array=False, is_struct=False): if not is_array: line += "," else: - if "flags" in val["name"].lower() or "animations" in val["name"].lower(): if val["name"] == "flags": val["fmt"] = "08X" @@ -338,10 +370,10 @@ def print_data(vals, indent, needs_name, is_array=False, is_struct=False): elif val["type"] == "hex": line += f"0x{val['data']:{fmt}}" elif val["type"] == "ptr": - if val["data"] == 0: - line += f"NULL" - else: - line += f"0x{val['data']:{fmt}}" + if val["data"] == 0: + line += f"NULL" + else: + line += f"0x{val['data']:{fmt}}" else: line += f"{val['data']}" @@ -352,6 +384,7 @@ def print_data(vals, indent, needs_name, is_array=False, is_struct=False): return out + def output_type2(fd, count, offset, var): ultra_out = [] for i in range(count): @@ -364,10 +397,11 @@ def output_type2(fd, count, offset, var): out.extend(print_data(vals, 1, True)) out.append("};") ultra_out.append(out) - return offset, ultra_out #"\n".join(out) + return offset, ultra_out # "\n".join(out) + -def check_list(vals, depth = 0): - for x,val in enumerate(vals): +def check_list(vals, depth=0): + for x, val in enumerate(vals): if type(val) == list: if check_list(val, depth + 1): return True @@ -375,9 +409,10 @@ def check_list(vals, depth = 0): return True return False + def recurse_check_list(vals): res = 0 - for x,val in enumerate(vals): + for x, val in enumerate(vals): if type(val) == list: if check_list(val, 1): return len(vals) - x @@ -385,14 +420,15 @@ def recurse_check_list(vals): return len(vals) - x return -1 + def get_single_struct_vals(fd, i): vals = [] if not fd[i].rstrip().endswith("},"): # must be a sub-struct over multiple lines old_i = i i += 1 - while not ("}," in fd[i] and "." in fd[i+1]): - temp = fd[i].split("{",1)[1].split("}",1)[0].split(", ") + while not ("}," in fd[i] and "." in fd[i + 1]): + temp = fd[i].split("{", 1)[1].split("}", 1)[0].split(", ") a = [] for x in temp: x = x.strip() @@ -405,7 +441,7 @@ def get_single_struct_vals(fd, i): i += 1 else: # single line - temp = fd[i].split("{",1)[1].split("}",1)[0].split(", ") + temp = fd[i].split("{", 1)[1].split("}", 1)[0].split(", ") a = [] for x in temp: x = x.strip() @@ -417,10 +453,11 @@ def get_single_struct_vals(fd, i): vals.extend(a) return vals, i + def cull_struct(fd, i, entirely=False): out = [] vals = [] - #print(f"Culling Starting at {fd[i]}") + # print(f"Culling Starting at {fd[i]}") if not fd[i].rstrip().endswith("},"): # must be a sub-struct over multiple lines old_i = i @@ -428,9 +465,9 @@ def cull_struct(fd, i, entirely=False): # reverse and cull entries of only zeros x = recurse_check_list(vals[::-1]) - #print(f"Found first index of empty values at idx {x}, vals: {vals}") + # print(f"Found first index of empty values at idx {x}, vals: {vals}") if x < 0: - #print(f"Ending at {fd[i]}") + # print(f"Ending at {fd[i]}") return None, i out.append(fd[old_i]) @@ -441,36 +478,37 @@ def cull_struct(fd, i, entirely=False): out.append(fd[old_i]) old_i += 1 - #print(f"Ending at {fd[i]}") + # print(f"Ending at {fd[i]}") else: - prefix = fd[i].split("{",1)[0] + "{ " + prefix = fd[i].split("{", 1)[0] + "{ " suffix = " }," vals, i = get_single_struct_vals(fd, i) # reverse and cull entries of only zeros x = recurse_check_list(vals[::-1]) - #print(f"Found first index of empty values at idx {x}, vals: {vals}") + # print(f"Found first index of empty values at idx {x}, vals: {vals}") if x < 0: - #print(f"Ending at {fd[i]}") + # print(f"Ending at {fd[i]}") return None, i - #out.append(prefix) + # out.append(prefix) if entirely: x = len(vals) temp = "" - for z,y in enumerate(range(x)): + for z, y in enumerate(range(x)): if z > 0: prefix += ", " prefix += f"{vals[y]}" out.append(prefix + suffix) - #print(f"Ending at {fd[i]}") + # print(f"Ending at {fd[i]}") return "\n".join(out), i + def MacroReplaceStaticNPC(fd): - structs = { "unk_1C":True, "movement":False, "unk_1E0":True } - #replace_cull_struct = { "unk_1C", "movement", "unk_1E0" } - #replace_cull = { "tattle", "extraAnimations", "itemDropChance" } + structs = {"unk_1C": True, "movement": False, "unk_1E0": True} + # replace_cull_struct = { "unk_1C", "movement", "unk_1E0" } + # replace_cull = { "tattle", "extraAnimations", "itemDropChance" } fd = fd.splitlines() out = [] i = 0 @@ -479,7 +517,7 @@ def MacroReplaceStaticNPC(fd): for x in structs: if f".{x}" in fd[i]: found = x - break; + break if found: # just cull it if possible vals, i = cull_struct(fd, i, structs[found]) @@ -489,9 +527,9 @@ def MacroReplaceStaticNPC(fd): i += 1 continue - name = fd[i].split(" = ",1)[0].strip()[1:] + name = fd[i].split(" = ", 1)[0].strip()[1:] if name not in structs and "{" not in fd[i] and name != ";": - val = fd[i].split(" = ",1)[1][:-1] + val = fd[i].split(" = ", 1)[1][:-1] if "0x" in val: val = int(val, 16) elif "NULL" in val: @@ -507,8 +545,8 @@ def MacroReplaceStaticNPC(fd): if ".itemDrops" in fd[i]: vals, x = cull_struct(fd, i) - indent = len(fd[i].split(".",1)[0]) // 4 - new_line = fd[i].split("{",1)[0] + "{\n" + indent = len(fd[i].split(".", 1)[0]) // 4 + new_line = fd[i].split("{", 1)[0] + "{\n" if not vals: i = x @@ -525,7 +563,7 @@ def MacroReplaceStaticNPC(fd): added_item = True item_name = CONSTANTS["ItemIDs"][item[0]] - new_line += " " * (indent+1) + "{ " + item_name + f", {item[1]}, {item[2]}" + " },\n" + new_line += " " * (indent + 1) + "{ " + item_name + f", {item[1]}, {item[2]}" + " },\n" if added_item: new_line += " " * indent + "}," @@ -534,18 +572,18 @@ def MacroReplaceStaticNPC(fd): i = x elif ".animations" in fd[i]: - indent = len(fd[i].split(".",1)[0]) // 4 - new_line = fd[i].split("{",1)[0] + "{\n" + indent = len(fd[i].split(".", 1)[0]) // 4 + new_line = fd[i].split("{", 1)[0] + "{\n" vals, x = get_single_struct_vals(fd, i) for val in vals: - sprite_id = (val & 0x00FF0000) >> 16 + sprite_id = (val & 0x00FF0000) >> 16 palette_id = (val & 0x0000FF00) >> 8 - anim_id = (val & 0x000000FF) >> 0 - sprite = CONSTANTS["NPC_SPRITE"][sprite_id]["name"] + anim_id = (val & 0x000000FF) >> 0 + sprite = CONSTANTS["NPC_SPRITE"][sprite_id]["name"] palette = CONSTANTS["NPC_SPRITE"][sprite_id]["palettes"][palette_id] - anim = CONSTANTS["NPC_SPRITE"][sprite_id]["anims"][anim_id] - new_line += " " * (indent+1) + f"NPC_ANIM_{sprite}_{palette}_{anim},\n" + anim = CONSTANTS["NPC_SPRITE"][sprite_id]["anims"][anim_id] + new_line += " " * (indent + 1) + f"NPC_ANIM_{sprite}_{palette}_{anim},\n" new_line += " " * indent + "}," out.append(new_line) i = x @@ -553,7 +591,7 @@ def MacroReplaceStaticNPC(fd): elif ".heartDrops" in fd[i] or ".flowerDrops" in fd[i]: vals, x = get_single_struct_vals(fd, i) - new_line = fd[i].split("{",1)[0] + new_line = fd[i].split("{", 1)[0] attempts = vals[0][2] @@ -564,10 +602,16 @@ def MacroReplaceStaticNPC(fd): new_line += f"GENEROUS_HEART_DROPS({attempts})," elif round(vals[0][1] / 327.67, 2) == 80 and round(vals[0][3] / 327.67, 2) == 60: new_line += f"GENEROUS_WHEN_LOW_HEART_DROPS({attempts})," - elif round(vals[0][0] / 327.67, 2) == 100 and round(vals[0][1] / 327.67, 2) == 0 and round(vals[0][2] / 327.67, 2) == 0: + elif ( + round(vals[0][0] / 327.67, 2) == 100 + and round(vals[0][1] / 327.67, 2) == 0 + and round(vals[0][2] / 327.67, 2) == 0 + ): new_line += f"NO_DROPS," else: - print(f"Unknown heart drop macro, values were {round(vals[0][1] / 327.67, 2)} and {round(vals[0][3] / 327.67, 2)}") + print( + f"Unknown heart drop macro, values were {round(vals[0][1] / 327.67, 2)} and {round(vals[0][3] / 327.67, 2)}" + ) exit() else: if round(vals[0][1] / 327.67, 2) == 50 and round(vals[0][3] / 327.67, 2) == 40: @@ -576,10 +620,16 @@ def MacroReplaceStaticNPC(fd): new_line += f"GENEROUS_WHEN_LOW_FLOWER_DROPS({attempts})," elif round(vals[0][1] / 327.67, 2) == 40 and round(vals[0][3] / 327.67, 2) == 40: new_line += f"REDUCED_FLOWER_DROPS({attempts})," - elif round(vals[0][0] / 327.67, 2) == 100 and round(vals[0][1] / 327.67, 2) == 0 and round(vals[0][2] / 327.67, 2) == 0: + elif ( + round(vals[0][0] / 327.67, 2) == 100 + and round(vals[0][1] / 327.67, 2) == 0 + and round(vals[0][2] / 327.67, 2) == 0 + ): new_line += f"NO_DROPS," else: - print(f"Unknown flower drop macro, values were {round(vals[0][1] / 327.67, 2)} and {round(vals[0][3] / 327.67, 2)}") + print( + f"Unknown flower drop macro, values were {round(vals[0][1] / 327.67, 2)} and {round(vals[0][3] / 327.67, 2)}" + ) exit() out.append(new_line) @@ -590,8 +640,9 @@ def MacroReplaceStaticNPC(fd): i += 1 return "\n".join(out) + def MacroReplaceNpcSettings(fd): - replace_cull = { "unk_00", "unk_24" } + replace_cull = {"unk_00", "unk_24"} fd = fd.splitlines() out = [] i = 0 @@ -605,6 +656,7 @@ def MacroReplaceNpcSettings(fd): i += 1 return "\n".join(out) + def MacroReplaceNpcGroupList(fd): fd = fd.splitlines() out = [] @@ -617,21 +669,31 @@ def MacroReplaceNpcGroupList(fd): val = 0 else: if "0x" in fd[i]: - val = int(fd[i].split(" = ",1)[1][:-1], 16) + val = int(fd[i].split(" = ", 1)[1][:-1], 16) else: - val = int(fd[i].split(" = ",1)[1][:-1], 10) + val = int(fd[i].split(" = ", 1)[1][:-1], 10) vals.append(val) i += 1 - out.append(f" NPC_GROUP(N(D_{vals[1]:X}), BATTLE_ID({(vals[2] & 0xFF000000) >> 24}, {(vals[2] & 0xFF0000) >> 16}, {(vals[2] & 0xFF00) >> 8}, {vals[2] & 0xFF})),") + out.append( + f" NPC_GROUP(N(D_{vals[1]:X}), BATTLE_ID({(vals[2] & 0xFF000000) >> 24}, {(vals[2] & 0xFF0000) >> 16}, {(vals[2] & 0xFF00) >> 8}, {vals[2] & 0xFF}))," + ) return "\n".join(out) + parser = argparse.ArgumentParser() parser.add_argument("file", type=str, help="File to decompile struct from") parser.add_argument("type", type=str, help="Struct type to decompile") parser.add_argument("offset", type=lambda x: int(x, 0), help="Offset to decompile struct from") -parser.add_argument("--count", "-c", "--c", type=int, default=0, help="Num to try and decompile (NpcGroupList)") +parser.add_argument( + "--count", + "-c", + "--c", + type=int, + default=0, + help="Num to try and decompile (NpcGroupList)", +) args = parser.parse_args() get_constants() @@ -641,14 +703,14 @@ def MacroReplaceNpcGroupList(fd): print(f"Unknown struct type {args.type}") exit() -''' +""" out = [f"{args.type} = " + "{\n"] offset = args.offset for var in STRUCTS[args.type]: line, offset = output_type(fd, offset, var, 1) out.append(line) out.append("};") -''' +""" if args.count == 0: args.count = 1 @@ -656,7 +718,7 @@ def MacroReplaceNpcGroupList(fd): fd = Path(args.file).resolve().read_bytes() offset, out = output_type2(fd, args.count, args.offset, STRUCTS[args.type]) -for i,entry in enumerate(out): +for i, entry in enumerate(out): out[i] = "\n".join(entry) print(f"EvtScript range 0x{args.offset:08X} - 0x{offset:08X}") diff --git a/tools/old/migrate_effect_rodata.py b/tools/old/migrate_effect_rodata.py index ce4fa2695da..07ffb0b17aa 100755 --- a/tools/old/migrate_effect_rodata.py +++ b/tools/old/migrate_effect_rodata.py @@ -90,6 +90,7 @@ "413F20": "star_outline", } + def handle_symbol(effect, symbol): for root, dirs, files in os.walk(asm_effects_dir + effect + "/"): for f_name in files: @@ -139,6 +140,7 @@ def handle_file(f_path): continue migrated = handle_symbol(data_to_thing[effect], symbol) + # Walk through asm files and rename stuff print("Walking through asm files") for root, dirs, files in os.walk(asm_data_dir): diff --git a/tools/old/migrate_exit_strings.py b/tools/old/migrate_exit_strings.py index 067f378bee7..93ae109d0a8 100755 --- a/tools/old/migrate_exit_strings.py +++ b/tools/old/migrate_exit_strings.py @@ -64,4 +64,3 @@ with open(c_file_path, "w", newline="\n") as f: f.write("".join(c_lines)) - diff --git a/tools/old/migrate_rodata.py b/tools/old/migrate_rodata.py index 65393e5b06f..1eb60364f27 100755 --- a/tools/old/migrate_rodata.py +++ b/tools/old/migrate_rodata.py @@ -9,6 +9,7 @@ asm_world_dir = asm_dir + "nonmatchings/world/" asm_data_dir = asm_dir + "data/" + def handle_symbol(area, symbol): for root, dirs, files in os.walk(asm_world_dir + area[0] + "/" + area[1]): for f_name in files: @@ -55,6 +56,7 @@ def handle_file(f_path): for symbol in reversed(symbols): migrated = handle_symbol(area, symbol) + # Walk through asm files and rename stuff print("Walking through asm files") for root, dirs, files in os.walk(asm_data_dir): diff --git a/tools/old/new_lines.py b/tools/old/new_lines.py index e669d0555f9..a9a8636c3a0 100644 --- a/tools/old/new_lines.py +++ b/tools/old/new_lines.py @@ -1,5 +1,6 @@ from pathlib import Path + def parse_folder(path): for entry in path.iterdir(): if entry.is_dir(): @@ -10,4 +11,5 @@ def parse_folder(path): fd.append("") entry.write_text("\n".join(fd)) + parse_folder(Path("src")) diff --git a/tools/old/sortsymz.py b/tools/old/sortsymz.py index f1b09e297a4..000ae6c500b 100755 --- a/tools/old/sortsymz.py +++ b/tools/old/sortsymz.py @@ -10,7 +10,7 @@ for line in f.readlines(): if line.strip() and not line.startswith("//"): name, addr = line.strip().strip(";").split(" = ") - try : + try: addr = int(addr, 0) except ValueError: continue diff --git a/tools/old/substitute.py b/tools/old/substitute.py index ea7c39f7fd9..264d81b24cc 100755 --- a/tools/old/substitute.py +++ b/tools/old/substitute.py @@ -12,7 +12,10 @@ asm_dir = root_dir + "ver/current/asm/" parser = argparse.ArgumentParser(description="Replace many functions with one") -parser.add_argument("from_list", help="path to line-separated file of functions to be replaced. first line is the string to replace them with") +parser.add_argument( + "from_list", + help="path to line-separated file of functions to be replaced. first line is the string to replace them with", +) args = parser.parse_args() diff --git a/tools/old/update_evts.py b/tools/old/update_evts.py index 256ee30f2c1..fc920e86b3f 100755 --- a/tools/old/update_evts.py +++ b/tools/old/update_evts.py @@ -47,11 +47,14 @@ def parse_symbol_addrs(): symbol_addrs = {} for line in lines: - name = line[:line.find(" ")] + name = line[: line.find(" ")] - attributes = line[line.find("//"):].split(" ") - ram_addr = int(line[:line.find(";")].split("=")[1].strip(), base=0) - rom_addr = next((int(attr.split(":")[1], base=0) for attr in attributes if attr.split(":")[0] == "rom"), None) + attributes = line[line.find("//") :].split(" ") + ram_addr = int(line[: line.find(";")].split("=")[1].strip(), base=0) + rom_addr = next( + (int(attr.split(":")[1], base=0) for attr in attributes if attr.split(":")[0] == "rom"), + None, + ) symbol_addrs[name] = Symbol(ram_addr, rom_addr) @@ -73,7 +76,7 @@ def find_old_script_ranges(lines, filename): if "#define NAMESPACE " in line_content: namespace = line_content.split(" ")[2].strip() - #elif namespace == "events" or namespace == "header": + # elif namespace == "events" or namespace == "header": # namespace = NAMESPACES.get(filename, filename.split("/")[-2].split(".")[0]) elif namespace_temp is not None: namespace = namespace_temp[0][:-2] @@ -113,7 +116,7 @@ def replace_old_script_macros(filename, symbol_addrs): lines[range.start] = lines[range.start][:macro_start_idx] + "{\n" # Remove other lines - lines = lines[:range.start + 1] + lines[range.end + 1:] + lines = lines[: range.start + 1] + lines[range.end + 1 :] # Find the symbol try: @@ -128,7 +131,7 @@ def replace_old_script_macros(filename, symbol_addrs): local_symbol_map = {} for sym in symbol_addrs: if sym.startswith(range.namespace): - key = "N(" + sym[len(range.namespace)+1:] + ")" + key = "N(" + sym[len(range.namespace) + 1 :] + ")" else: key = sym @@ -143,7 +146,8 @@ def replace_old_script_macros(filename, symbol_addrs): # Disassemble the script rom.seek(range_sym.rom_addr) - evt_code = ScriptDisassembler(rom, + evt_code = ScriptDisassembler( + rom, script_name=range.symbol_name, romstart=range_sym.rom_addr, prelude=False, diff --git a/tools/rename.py b/tools/rename.py index f245b9a9feb..05df53dca33 100755 --- a/tools/rename.py +++ b/tools/rename.py @@ -16,6 +16,7 @@ patterns = [] deletes = [] + def handle_file(f_path, try_rename_file=False): with open(f_path) as f: f_text_orig = f.read() @@ -35,17 +36,18 @@ def handle_file(f_path, try_rename_file=False): # replace all matches for match in matches: # head part - to_join.append(f_text[pos:match[1]]) + to_join.append(f_text[pos : match[1]]) to_replace = patterns[match[0]] to_join.append(renames[to_replace]) pos = match[2] # tail part to_join.append(f_text[pos:]) - f_text = ''.join(to_join); + f_text = "".join(to_join) # save changes with open(f_path, "w", newline="\n") as f: f.write(f_text) + # Read input file # One valid whitespace-separated find-replace pair is given per line with open(os.path.join(script_dir, "to_rename.txt")) as f: @@ -59,7 +61,7 @@ def handle_file(f_path, try_rename_file=False): renames[split[0]] = split[1] patterns.append(split[0]) elif len(split) != 0: - raise Exception("input contains invalid rename pattern: \n\"" + line.strip() + "\"") + raise Exception('input contains invalid rename pattern: \n"' + line.strip() + '"') ac = ahocorasick_rs.AhoCorasick(patterns, matchkind=MATCHKIND_LEFTMOST_LONGEST) diff --git a/tools/sjis.py b/tools/sjis.py index 19252ff3349..5677b2377b6 100755 --- a/tools/sjis.py +++ b/tools/sjis.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 + def decode(data): length = 0 is_dbl_char = False @@ -20,7 +21,8 @@ def decode(data): length += 1 - return data[:length].decode('shift-jis') + return data[:length].decode("shift-jis") + if __name__ == "__main__": import sys diff --git a/tools/splat_ext/gfx_common.py b/tools/splat_ext/gfx_common.py index dadfe1f85c2..ce70d2c7fc0 100644 --- a/tools/splat_ext/gfx_common.py +++ b/tools/splat_ext/gfx_common.py @@ -1,5 +1,6 @@ from segtypes.n64.gfx import N64SegGfx + class N64SegGfx_common(N64SegGfx): def format_sym_name(self, sym): return f"N({sym.name[7:]})" diff --git a/tools/splat_ext/pm_effect_shims.py b/tools/splat_ext/pm_effect_shims.py index 4caaaba14d1..0b5240dbc54 100644 --- a/tools/splat_ext/pm_effect_shims.py +++ b/tools/splat_ext/pm_effect_shims.py @@ -67,8 +67,6 @@ def get_linker_entries(self): ret = [] for shim in self.shims: - ret.append( - LinkerEntry(self, [self.shim_path(shim)], self.shim_path(shim), ".text") - ) + ret.append(LinkerEntry(self, [self.shim_path(shim)], self.shim_path(shim), ".text")) return ret diff --git a/tools/splat_ext/pm_icons.py b/tools/splat_ext/pm_icons.py index 36859be8171..2ad35fe447e 100644 --- a/tools/splat_ext/pm_icons.py +++ b/tools/splat_ext/pm_icons.py @@ -13,22 +13,22 @@ def indent(elem, level=0): - i = "\n" + level*" " + i = "\n" + level * " " if len(elem): if not elem.text or not elem.text.strip(): elem.text = i + " " if not elem.tail or not elem.tail.strip(): elem.tail = i for elem in elem: - indent(elem, level+1) + indent(elem, level + 1) if not elem.tail or not elem.tail.strip(): elem.tail = i else: if level and (not elem.tail or not elem.tail.strip()): - elem.tail = i + elem.tail = i -def pretty_print_xml(tree : ET.ElementTree, path : Path): +def pretty_print_xml(tree: ET.ElementTree, path: Path): root = tree.getroot() indent(root) xml_str = ET.tostring(root, encoding="unicode") @@ -49,11 +49,11 @@ def parse_palette(data): class N64SegPm_icons(N64Segment): def split(self, rom_bytes): self.out_dir = options.opts.asset_path / "icon" - + with open(script_dir / "icon.yaml") as f: self.icons = yaml_loader.load(f.read(), Loader=yaml_loader.SafeLoader) - data = rom_bytes[self.rom_start: self.rom_end] + data = rom_bytes[self.rom_start : self.rom_end] pos = 0 self.files = [] @@ -65,11 +65,11 @@ def write_img(name, img): IconList = ET.Element("Icons") - for (_, icon) in enumerate(self.icons): + for _, icon in enumerate(self.icons): # read yaml entry fmt = icon[0] name = icon[1] - w = int(icon[2]) + w = int(icon[2]) h = int(icon[3]) if fmt == "solo" or fmt == "pair": diff --git a/tools/splat_ext/pm_imgfx_data.py b/tools/splat_ext/pm_imgfx_data.py index b3b78165d24..3ec39f50b02 100644 --- a/tools/splat_ext/pm_imgfx_data.py +++ b/tools/splat_ext/pm_imgfx_data.py @@ -41,9 +41,7 @@ def scan(self, rom_bytes) -> None: frame: List[Vertex] = [] for j in range(vtx_count): - x, y, z, u, v, r, g, b, a = struct.unpack( - ">hhhBBbbbB", data[pos : pos + 12] - ) + x, y, z, u, v, r, g, b, a = struct.unpack(">hhhBBbbbB", data[pos : pos + 12]) pos += 12 frame.append(Vertex(j, x, y, z, u, v, r, g, b, a)) @@ -121,10 +119,7 @@ def get_linker_entries(self): return [ LinkerEntry( self, - [ - self.OUT_DIR / f"{name}.json" - for name, _ in self.yaml.get("animations") - ], + [self.OUT_DIR / f"{name}.json" for name, _ in self.yaml.get("animations")], options.opts.asset_path / "imgfx" / f"{self.name}.c", self.get_linker_section(), ) diff --git a/tools/splat_ext/pm_map_data.py b/tools/splat_ext/pm_map_data.py index 9fcc9098311..b47b5165109 100644 --- a/tools/splat_ext/pm_map_data.py +++ b/tools/splat_ext/pm_map_data.py @@ -135,65 +135,45 @@ def split(self, rom_bytes): w = png.Writer(150, 105, palette=parse_palette(bytes[:0x200])) w.write_array(f, bytes[0x200:]) elif name == "title_data": - if "ver/us" in str(options.opts.target_path) or "ver/pal" in str( - options.opts.target_path - ): + if "ver/us" in str(options.opts.target_path) or "ver/pal" in str(options.opts.target_path): w = 200 h = 112 - img = n64img.image.RGBA32( - data=bytes[0x2210 : 0x2210 + w * h * 4], width=w, height=h - ) + img = n64img.image.RGBA32(data=bytes[0x2210 : 0x2210 + w * h * 4], width=w, height=h) img.write(fs_dir / "title/logotype.png") w = 144 h = 32 - img = n64img.image.IA8( - data=bytes[0x10 : 0x10 + w * h], width=w, height=h - ) + img = n64img.image.IA8(data=bytes[0x10 : 0x10 + w * h], width=w, height=h) img.write(fs_dir / "title/copyright.png") w = 128 h = 32 - img = n64img.image.IA8( - data=bytes[0x1210 : 0x1210 + w * h], width=w, height=h - ) + img = n64img.image.IA8(data=bytes[0x1210 : 0x1210 + w * h], width=w, height=h) img.write(fs_dir / "title/press_start.png") else: w = 272 h = 88 - img = n64img.image.RGBA32( - data=bytes[0x1830 : 0x1830 + w * h * 4], width=w, height=h - ) + img = n64img.image.RGBA32(data=bytes[0x1830 : 0x1830 + w * h * 4], width=w, height=h) img.write(fs_dir / "title/logotype.png") w = 128 h = 32 - img = n64img.image.CI4( - data=bytes[0x10 : 0x10 + (w * h // 2)], width=w, height=h - ) + img = n64img.image.CI4(data=bytes[0x10 : 0x10 + (w * h // 2)], width=w, height=h) img.palette = parse_palette(bytes[0x810:0x830]) img.write(fs_dir / "title/copyright.png") w = 128 h = 32 - img = n64img.image.IA8( - data=bytes[0x830 : 0x830 + w * h], width=w, height=h - ) + img = n64img.image.IA8(data=bytes[0x830 : 0x830 + w * h], width=w, height=h) img.write(fs_dir / "title/press_start.png") elif name.endswith("_bg"): def write_bg_png(bytes, path, header_offset=0): header = bytes[header_offset : header_offset + 0x10] - raster_offset = ( - int.from_bytes(header[0:4], byteorder="big") - 0x80200000 - ) - palette_offset = ( - int.from_bytes(header[4:8], byteorder="big") - 0x80200000 - ) - assert ( - int.from_bytes(header[8:12], byteorder="big") == 0x000C0014 - ) # draw pos + raster_offset = int.from_bytes(header[0:4], byteorder="big") - 0x80200000 + palette_offset = int.from_bytes(header[4:8], byteorder="big") - 0x80200000 + assert int.from_bytes(header[8:12], byteorder="big") == 0x000C0014 # draw pos width = int.from_bytes(header[12:14], byteorder="big") height = int.from_bytes(header[14:16], byteorder="big") @@ -202,9 +182,7 @@ def write_bg_png(bytes, path, header_offset=0): w = png.Writer( width, height, - palette=parse_palette( - bytes[palette_offset : palette_offset + 512] - ), + palette=parse_palette(bytes[palette_offset : palette_offset + 512]), ) w.write_array(f, bytes[raster_offset:]) @@ -212,9 +190,7 @@ def write_bg_png(bytes, path, header_offset=0): # sbk_bg has an alternative palette if name == "sbk_bg": - write_bg_png( - bytes, fs_dir / "bg" / f"{name}.alt.png", header_offset=0x10 - ) + write_bg_png(bytes, fs_dir / "bg" / f"{name}.alt.png", header_offset=0x10) elif name.endswith("_tex"): TexArchive.extract(bytes, fs_dir / "tex" / name) else: diff --git a/tools/splat_ext/pm_msg.py b/tools/splat_ext/pm_msg.py index fa7be3ce9ee..7fce2326b50 100644 --- a/tools/splat_ext/pm_msg.py +++ b/tools/splat_ext/pm_msg.py @@ -188,13 +188,23 @@ 0x02: "[Style left]\n", 0x03: "[Style center]\n", 0x04: "[Style tattle]\n", - 0x05: {None: lambda d: (f"[Style choice pos={d[0]},{d[1]} size={d[2]},{d[3]}]\n", 4)}, + 0x05: { + None: lambda d: ( + f"[Style choice pos={d[0]},{d[1]} size={d[2]},{d[3]}]\n", + 4, + ) + }, 0x06: "[Style inspect]\n", 0x07: "[Style sign]\n", 0x08: {None: lambda d: (f"[Style lamppost height={d[0]}]\n", 1)}, 0x09: {None: lambda d: (f"[Style postcard index={d[0]}]\n", 1)}, 0x0A: "[Style popup]\n", - 0x0C: {None: lambda d: (f"[Style upgrade pos={d[0]},{d[1]} size={d[2]},{d[3]}]\n", 4)}, + 0x0C: { + None: lambda d: ( + f"[Style upgrade pos={d[0]},{d[1]} size={d[2]},{d[3]}]\n", + 4, + ) + }, 0x0D: "[Style narrate]\n", 0x0E: "[Style epilogue]\n", }, @@ -215,17 +225,13 @@ # 0x24: "[color:cyan]", # 0x25: "[color:green]", # 0x26: "[color:yellow]", - # 0x00: "[color=normal ctx=diary]", # 0x07: "[color=red ctx=diary]", - # 0x17: "[color=dark ctx=inspect]", - # 0x18: "[color=normal ctx=sign]", # 0x19: "[color=red ctx=sign]", # 0x1A: "[color=blue ctx=sign]", # 0x1B: "[color=green ctx=sign]", - # 0x28: "[color=red ctx=popup]", # 0x29: "[color=pink ctx=popup]", # 0x2A: "[color=purple ctx=popup]", @@ -234,7 +240,6 @@ # 0x2D: "[color=green ctx=popup]", # 0x2E: "[color=yellow ctx=popup]", # 0x2F: "[color=normal ctx=popup]", - None: lambda d: (f"[Color 0x{d[0]:X}]", 1), }, 0x07: "[InputOff]\n", @@ -252,9 +257,19 @@ 0x13: {None: lambda d: (f"[Down {d[0]}]", 1)}, 0x14: {None: lambda d: (f"[Up {d[0]}]", 1)}, 0x15: {None: lambda d: (f"[InlineImage index={d[0]}]\n", 1)}, - 0x16: {None: lambda d: (f"[AnimSprite spriteID=0x{d[0]:02X}{d[1]:02X} raster={d[2]}]\n", 3)}, + 0x16: { + None: lambda d: ( + f"[AnimSprite spriteID=0x{d[0]:02X}{d[1]:02X} raster={d[2]}]\n", + 3, + ) + }, 0x17: {None: lambda d: (f"[ItemIcon itemID=0x{d[0]:02X}{d[1]:02X}]\n", 2)}, - 0x18: {None: lambda d: (f"[Image index={d[0]} pos={(d[1] << 8) + d[2]},{d[3]} hasBorder={d[4]} alpha={d[5]} fadeAmount={d[6]}]\n", 7)}, + 0x18: { + None: lambda d: ( + f"[Image index={d[0]} pos={(d[1] << 8) + d[2]},{d[3]} hasBorder={d[4]} alpha={d[5]} fadeAmount={d[6]}]\n", + 7, + ) + }, 0x19: {None: lambda d: (f"[HideImage fadeAmount={d[0]}]\n", 1)}, 0x1A: {None: lambda d: (f"[AnimDelay index={d[1]} delay={d[2]}]", 3)}, 0x1B: {None: lambda d: (f"[AnimLoop {d[0]} {d[1]}]", 2)}, @@ -265,20 +280,24 @@ 0x21: {None: lambda d: (f"[Option {d[0]}]", 1)}, 0x22: "[SavePos]", 0x23: "[RestorePos]", - 0x24: {0xFF: {0x05: { - 0x10: {0x98: {0xFF: {0x25: "[A]"}}}, - 0x11: {0x99: {0xFF: {0x25: "[B]"}}}, - 0x12: {0xA1: {0xFF: {0x25: "[START]"}}}, - 0x13: { - 0x9D: {0xFF: {0x25: "[C-UP]"}}, - 0x9E: {0xFF: {0x25: "[C-DOWN]"}}, - 0x9F: {0xFF: {0x25: "[C-LEFT]"}}, - 0xA0: {0xFF: {0x25: "[C-RIGHT]"}}, - }, - 0x14: {0x9C: {0xFF: {0x25: "[Z]"}}}, - }}}, - #0x24: "[SaveColor]", - #0x25: "[RestoreColor]", + 0x24: { + 0xFF: { + 0x05: { + 0x10: {0x98: {0xFF: {0x25: "[A]"}}}, + 0x11: {0x99: {0xFF: {0x25: "[B]"}}}, + 0x12: {0xA1: {0xFF: {0x25: "[START]"}}}, + 0x13: { + 0x9D: {0xFF: {0x25: "[C-UP]"}}, + 0x9E: {0xFF: {0x25: "[C-DOWN]"}}, + 0x9F: {0xFF: {0x25: "[C-LEFT]"}}, + 0xA0: {0xFF: {0x25: "[C-RIGHT]"}}, + }, + 0x14: {0x9C: {0xFF: {0x25: "[Z]"}}}, + } + } + }, + # 0x24: "[SaveColor]", + # 0x25: "[RestoreColor]", 0x26: { 0x00: "[Shake]", 0x01: "[Wave]", @@ -307,7 +326,12 @@ 0x28: {None: lambda d: (f"[Var {d[0]}]", 1)}, 0x29: {None: lambda d: (f"[CenterX {d[0]}]", 1)}, 0x2B: "[EnableCDownNext]", - 0x2C: {None: lambda d: (f"[CustomVoice soundIDs=0x{d[0]:02X}{d[1]:02X}{d[2]:02X}{d[3]:02X},{d[4]:02X}{d[5]:02X}{d[6]:02X}{d[7]:02X}]", 8)}, + 0x2C: { + None: lambda d: ( + f"[CustomVoice soundIDs=0x{d[0]:02X}{d[1]:02X}{d[2]:02X}{d[3]:02X},{d[4]:02X}{d[5]:02X}{d[6]:02X}{d[7]:02X}]", + 8, + ) + }, 0x2E: {None: lambda d: (f"[Volume {d[0]}]", 1)}, 0x2F: { 0: "[Voice normal]\n", @@ -315,7 +339,7 @@ 2: "[Voice star]\n", None: lambda d: (f"[Voice {d[0]}]\n", 1), }, - #None: lambda d: (f"[func_{d[0]:02X}]", 1), + # None: lambda d: (f"[func_{d[0]:02X}]", 1), }, None: lambda d: (f"[Raw 0x{d[0]:02X}]", 1), } @@ -366,6 +390,7 @@ 0xF7: " ", } + class N64SegPm_msg(N64Segment): def __init__( self, @@ -393,12 +418,12 @@ def __init__( self.msg_names = yaml_loader.load(f.read(), Loader=yaml_loader.SafeLoader) def split(self, rom_bytes): - data = rom_bytes[self.rom_start: self.rom_end] + data = rom_bytes[self.rom_start : self.rom_end] section_offsets = [] pos = 0 while True: - offset = int.from_bytes(data[pos:pos+4], byteorder="big") + offset = int.from_bytes(data[pos : pos + 4], byteorder="big") if offset == 0: break @@ -417,7 +442,7 @@ def split(self, rom_bytes): msg_offsets = [] pos = section_offset while True: - offset = int.from_bytes(data[pos:pos+4], byteorder="big") + offset = int.from_bytes(data[pos : pos + 4], byteorder="big") if offset == section_offset: break @@ -425,7 +450,7 @@ def split(self, rom_bytes): msg_offsets.append(offset) pos += 4 - #self.log(f"Reading {len(msg_offsets)} messages in section {name} (0x{i:02X})") + # self.log(f"Reading {len(msg_offsets)} messages in section {name} (0x{i:02X})") path = msg_dir / Path(name + ".msg") @@ -449,7 +474,6 @@ def split(self, rom_bytes): self.write_message_markup(data[msg_offset:]) self.f.write("\n}\n") - def get_linker_entries(self): from segtypes.linker_entry import LinkerEntry @@ -458,7 +482,6 @@ def get_linker_entries(self): return [LinkerEntry(self, out_paths, base_path, ".data")] - @staticmethod def get_default_name(addr): return "msg" diff --git a/tools/splat_ext/pm_sbn.py b/tools/splat_ext/pm_sbn.py index b9ff454a197..c86c5ec80ff 100644 --- a/tools/splat_ext/pm_sbn.py +++ b/tools/splat_ext/pm_sbn.py @@ -52,9 +52,7 @@ def decode(self, data: bytes): entry_addr = header.tableOffset seen_entry_offsets = set() for i in range(header.numEntries): - entry = SBNFileEntry( - *struct.unpack_from(SBNFileEntry.fstring, data, entry_addr) - ) + entry = SBNFileEntry(*struct.unpack_from(SBNFileEntry.fstring, data, entry_addr)) entry_addr += SBNFileEntry.length # Check for duplicate entry offsets @@ -148,9 +146,7 @@ def encode(self) -> bytes: else: raise ValueError("Unsupported file extension") - entry = SBNFileEntry( - offset=current_file_offset, fmt=format, size=file.fakesize - ) + entry = SBNFileEntry(offset=current_file_offset, fmt=format, size=file.fakesize) struct.pack_into( SBNFileEntry.fstring, @@ -218,9 +214,7 @@ def write(self, path: Path): with open(path / "sbn.yaml", "w") as f: # Filename->ID map - f.write( - "# Mapping of filenames to entry IDs. Use 'id: auto' to automatically assign a unique ID.\n" - ) + f.write("# Mapping of filenames to entry IDs. Use 'id: auto' to automatically assign a unique ID.\n") f.write( """ # 'fakesize is an interesting case. In the final ROM, the size of a file is stored in the file header and the entry table. @@ -263,9 +257,7 @@ def write(self, path: Path): f.write("\n") # INIT mseqs - f.write( - "# AuGlobals::mseqFileList. Not sure why there's non-MSEQ files here!\n" - ) + f.write("# AuGlobals::mseqFileList. Not sure why there's non-MSEQ files here!\n") f.write("mseqs:\n") for id, entry in enumerate(self.init.mseq_entries): f.write(f" - id: 0x{id:02x}\n") @@ -353,9 +345,7 @@ def read(self, dir: Path) -> List[Path]: assert type(bk_file) == str bk_file_ids.append(self.lookup_file_id(bk_file)) - init_song_entry = InitSongEntry( - file_id, bk_file_ids[0], bk_file_ids[1], bk_file_ids[2] - ) + init_song_entry = InitSongEntry(file_id, bk_file_ids[0], bk_file_ids[1], bk_file_ids[2]) # Replace self.init.song_entries[id] if id < len(self.init.song_entries): @@ -558,9 +548,7 @@ def decode(self, data: bytes) -> int: song_addr = header.tblOffset song_number = 0 while True: - song = InitSongEntry( - *struct.unpack_from(InitSongEntry.fstring, data, song_addr) - ) + song = InitSongEntry(*struct.unpack_from(InitSongEntry.fstring, data, song_addr)) if song.bgmFileIndex == 0xFFFF: break @@ -586,9 +574,7 @@ def decode(self, data: bytes) -> int: entries_len = header.entriesSize // 4 - 1 for i in range(entries_len): - entry = BufferEntry( - *struct.unpack_from(BufferEntry.fstring, data, entries_addr) - ) + entry = BufferEntry(*struct.unpack_from(BufferEntry.fstring, data, entries_addr)) entries_addr += BufferEntry.length self.bk_entries.append(entry) @@ -704,9 +690,7 @@ def get_linker_entries(self): out = options.opts.asset_path / self.dir / (self.name + ".sbn") sbn = SBN() - config_files = sbn.read( - dir - ) # TODO: LayeredFS/AssetsFS read, supporting merges + config_files = sbn.read(dir) # TODO: LayeredFS/AssetsFS read, supporting merges inputs = config_files + [dir / f.file_name() for f in sbn.files] return [ LinkerEntry( diff --git a/tools/splat_ext/pm_sprite_shading_profiles.py b/tools/splat_ext/pm_sprite_shading_profiles.py index f951b34d498..7441870063b 100644 --- a/tools/splat_ext/pm_sprite_shading_profiles.py +++ b/tools/splat_ext/pm_sprite_shading_profiles.py @@ -140,9 +140,7 @@ def extract(input_data: bytes, endian: Literal["big", "little"] = "big") -> str: profile_list = [] for _ in range(len(PROFILE_NAMES[g])): - profile_list.append( - struct.unpack(END + "i", offsets_table[pl_it : pl_it + 4])[0] - ) + profile_list.append(struct.unpack(END + "i", offsets_table[pl_it : pl_it + 4])[0]) pl_it += 4 for j, pl_offset in enumerate(profile_list): diff --git a/tools/splat_ext/pm_sprites.py b/tools/splat_ext/pm_sprites.py index c9708ea2eeb..3e23a2b26bb 100644 --- a/tools/splat_ext/pm_sprites.py +++ b/tools/splat_ext/pm_sprites.py @@ -101,22 +101,22 @@ def indent(elem, level=0): - i = "\n" + level*" " + i = "\n" + level * " " if len(elem): if not elem.text or not elem.text.strip(): elem.text = i + " " if not elem.tail or not elem.tail.strip(): elem.tail = i for elem in elem: - indent(elem, level+1) + indent(elem, level + 1) if not elem.tail or not elem.tail.strip(): elem.tail = i else: if level and (not elem.tail or not elem.tail.strip()): - elem.tail = i + elem.tail = i -def pretty_print_xml(tree : ET.ElementTree, path : Path): +def pretty_print_xml(tree: ET.ElementTree, path: Path): root = tree.getroot() indent(root) xml_str = ET.tostring(root, encoding="unicode") @@ -136,9 +136,7 @@ class RasterTableEntry: raster_bytes: bytes = field(default_factory=bytes) palette: Optional[bytes] = None - def write_png( - self, raster_buffer: bytes, path: Path, palette: Optional[bytes] = None - ): + def write_png(self, raster_buffer: bytes, path: Path, palette: Optional[bytes] = None): if self.height == 0 or self.width == 0: raise ValueError("Raster size has not been set") @@ -149,9 +147,7 @@ def write_png( raise ValueError("Palette has not been set") if self.raster_bytes is not None: - self.raster_bytes = raster_buffer[ - self.offset : self.offset + (self.width * self.height // 2) - ] + self.raster_bytes = raster_buffer[self.offset : self.offset + (self.width * self.height // 2)] img = CI4(self.raster_bytes, self.width, self.height) img.set_palette(palette) @@ -264,9 +260,7 @@ def from_bytes(data: bytes, raster_set: PlayerSpriteRasterSet) -> "PlayerSprite" ) -def extract_raster_table_entries( - data: bytes, raster_sets: List[PlayerSpriteRasterSet] -) -> Dict[int, RasterTableEntry]: +def extract_raster_table_entries(data: bytes, raster_sets: List[PlayerSpriteRasterSet]) -> Dict[int, RasterTableEntry]: ret: Dict[int, RasterTableEntry] = {} current_section_pos = 0 current_section = 0 @@ -297,9 +291,7 @@ def extract_raster_table_entries( return ret -def extract_sprites( - yay0_data: bytes, raster_sets: List[PlayerSpriteRasterSet] -) -> List[PlayerSprite]: +def extract_sprites(yay0_data: bytes, raster_sets: List[PlayerSpriteRasterSet]) -> List[PlayerSprite]: yay0_splits = [] for i in range(14): yay0_splits.append(int.from_bytes(yay0_data[i * 4 : i * 4 + 4], "big")) @@ -375,9 +367,7 @@ def write_player_xmls( raster_table_entry_dict: Dict[int, RasterTableEntry], raster_names: List[str], ) -> None: - def get_sprite_name_from_offset( - offset: int, offsets: List[int], names: List[str] - ) -> str: + def get_sprite_name_from_offset(offset: int, offsets: List[int], names: List[str]) -> str: return names[offsets.index(offset)] sprite_idx = 0 @@ -426,9 +416,7 @@ def get_sprite_name_from_offset( back_raster = cur_sprite_back.rasters[i] if back_raster.is_special: - raster_attributes[ - "special" - ] = f"{back_raster.width & 0xFF:X},{back_raster.height & 0xFF:X}" + raster_attributes["special"] = f"{back_raster.width & 0xFF:X},{back_raster.height & 0xFF:X}" else: back_name_offset = raster_sets[sprite_idx + 1].raster_offsets[i] raster_attributes[ @@ -483,9 +471,7 @@ def get_sprite_name_from_offset( ) for anim in comp.animations: - ET.SubElement( - Component, anim.__class__.__name__, anim.get_attributes() - ) + ET.SubElement(Component, anim.__class__.__name__, anim.get_attributes()) xml = ET.ElementTree(SpriteSheet) pretty_print_xml(xml, out_path / f"{cur_sprite_name}.xml") @@ -547,12 +533,8 @@ def write_player_palettes( if pal_name not in dumped_palettes: offset = PLAYER_PAL_TO_RASTER[pal_name] if pal_name not in PLAYER_PAL_TO_RASTER: - print( - f"WARNING: Palette {pal_name} has no specified raster, not dumping!" - ) - raster_table_entry_dict[offset].write_png( - raster_data, path / (pal_name + ".png"), palette - ) + print(f"WARNING: Palette {pal_name} has no specified raster, not dumping!") + raster_table_entry_dict[offset].write_png(raster_data, path / (pal_name + ".png"), palette) ########### @@ -606,12 +588,8 @@ class NpcSprite: @staticmethod def from_bytes(data: bytearray): - image_offsets = read_offset_list( - data[int.from_bytes(data[0:4], byteorder="big") :] - ) - palette_offsets = read_offset_list( - data[int.from_bytes(data[4:8], byteorder="big") :] - ) + image_offsets = read_offset_list(data[int.from_bytes(data[0:4], byteorder="big") :]) + palette_offsets = read_offset_list(data[int.from_bytes(data[4:8], byteorder="big") :]) max_components = int.from_bytes(data[8:0xC], byteorder="big") num_variations = int.from_bytes(data[0xC:0x10], byteorder="big") animation_offsets = read_offset_list(data[0x10:]) @@ -683,11 +661,7 @@ def write_to_dir(self, path): ) for i, palette in enumerate(self.palettes): - name = ( - self.palette_names[i] - if (self.palette_names and i < len(self.palette_names)) - else f"Pal{i:02X}" - ) + name = self.palette_names[i] if (self.palette_names and i < len(self.palette_names)) else f"Pal{i:02X}" if i in palette_to_raster: img = palette_to_raster[i][0] @@ -710,9 +684,7 @@ def write_to_dir(self, path): AnimationList, "Animation", { - "name": self.animation_names[i] - if self.animation_names - else f"Anim{i:02X}", + "name": self.animation_names[i] if self.animation_names else f"Anim{i:02X}", }, ) @@ -727,9 +699,7 @@ def write_to_dir(self, path): ) for anim in comp.animations: - ET.SubElement( - Component, anim.__class__.__name__, anim.get_attributes() - ) + ET.SubElement(Component, anim.__class__.__name__, anim.get_attributes()) xml = ET.ElementTree(SpriteSheet) pretty_print_xml(xml, path / "SpriteSheet.xml") @@ -739,9 +709,7 @@ class N64SegPm_sprites(N64Segment): DEFAULT_NPC_SPRITE_NAMES = [f"{i:02X}" for i in range(0xEA)] def __init__(self, rom_start, rom_end, type, name, vram_start, args, yaml) -> None: - super().__init__( - rom_start, rom_end, type, name, vram_start, args=args, yaml=yaml - ) + super().__init__(rom_start, rom_end, type, name, vram_start, args=args, yaml=yaml) with (Path(__file__).parent / f"npc_sprite_names.yaml").open("r") as f: self.npc_cfg = yaml_loader.load(f.read(), Loader=yaml_loader.SafeLoader) @@ -752,9 +720,7 @@ def __init__(self, rom_start, rom_end, type, name, vram_start, args, yaml) -> No def out_path(self): return options.opts.asset_path / "sprite" / "sprites" - def split_player( - self, build_date: str, player_raster_data: bytes, player_yay0_data: bytes - ) -> None: + def split_player(self, build_date: str, player_raster_data: bytes, player_yay0_data: bytes) -> None: player_sprite_cfg = self.player_cfg["player_sprites"] player_raster_names: List[str] = self.player_cfg["player_rasters"] @@ -854,9 +820,7 @@ def split(self, rom_bytes) -> None: npc_yay0_offset = int.from_bytes(sprite_in_bytes[0x18:0x1C], "big") + 0x10 sprite_end_offset = int.from_bytes(sprite_in_bytes[0x1C:0x20], "big") + 0x10 - player_raster_data: bytes = sprite_in_bytes[ - player_raster_offset:player_yay0_offset - ] + player_raster_data: bytes = sprite_in_bytes[player_raster_offset:player_yay0_offset] player_yay0_data: bytes = sprite_in_bytes[player_yay0_offset:npc_yay0_offset] npc_yay0_data: bytes = sprite_in_bytes[npc_yay0_offset:sprite_end_offset] @@ -869,14 +833,9 @@ def get_linker_entries(self): src_paths = [options.opts.asset_path / "sprite"] # for NPC - src_paths += [ - options.opts.asset_path / "sprite" / "npc" / sprite_name - for sprite_name in self.npc_cfg - ] - - return [ - LinkerEntry(self, src_paths, self.out_path(), self.get_linker_section()) - ] + src_paths += [options.opts.asset_path / "sprite" / "npc" / sprite_name for sprite_name in self.npc_cfg] + + return [LinkerEntry(self, src_paths, self.out_path(), self.get_linker_section())] def cache(self): return (self.yaml, self.rom_end, self.player_cfg, self.npc_cfg) diff --git a/tools/splat_ext/sprite_common.py b/tools/splat_ext/sprite_common.py index 1284e39e6bc..dea9b1ecb06 100644 --- a/tools/splat_ext/sprite_common.py +++ b/tools/splat_ext/sprite_common.py @@ -217,7 +217,6 @@ class AnimComponent: def size(self): return len(self.commands) - @staticmethod def parse_commands(command_list: List[int]) -> List[Animation]: ret: List[Animation] = [] @@ -329,10 +328,7 @@ def from_bytes(data: bytes, sprite_data: bytes): x, y, z = struct.unpack(">hhh", data[6:12]) - commands = [ - int.from_bytes(d[0:2], byteorder="big", signed=False) - for d in iter_in_groups(commands_data, 2) - ] + commands = [int.from_bytes(d[0:2], byteorder="big", signed=False) for d in iter_in_groups(commands_data, 2)] return AnimComponent(x, y, z, commands) @property diff --git a/tools/splat_ext/tex_archives.py b/tools/splat_ext/tex_archives.py index 67cbd5e0649..3531d971466 100644 --- a/tools/splat_ext/tex_archives.py +++ b/tools/splat_ext/tex_archives.py @@ -260,9 +260,7 @@ def from_bytes(self, texbuf: TexBuffer): self.main_height, ) if self.main_fmt == FMT_CI: - self.main_img.palette = self.get_n64_pal( - texbuf, self.main_fmt, self.main_depth - ) + self.main_img.palette = self.get_n64_pal(texbuf, self.main_fmt, self.main_depth) # main img + mipmaps elif self.extra_tiles == TILES_MIPMAPS: self.has_mipmaps = True @@ -282,9 +280,7 @@ def from_bytes(self, texbuf: TexBuffer): break mmw = self.main_width // divisor mmh = self.main_height // divisor - mipmap = self.get_n64_img( - texbuf, self.main_fmt, self.main_depth, mmw, mmh - ) + mipmap = self.get_n64_img(texbuf, self.main_fmt, self.main_depth, mmw, mmh) self.mipmaps.append(mipmap) divisor = divisor * 2 @@ -334,13 +330,9 @@ def from_bytes(self, texbuf: TexBuffer): pal = self.get_n64_pal(texbuf, self.main_fmt, self.main_depth) self.main_img.palette = pal # read aux - self.aux_img = self.get_n64_img( - texbuf, self.aux_fmt, self.aux_depth, self.aux_width, self.aux_height - ) + self.aux_img = self.get_n64_img(texbuf, self.aux_fmt, self.aux_depth, self.aux_width, self.aux_height) if self.aux_fmt == FMT_CI: - self.aux_img.palette = self.get_n64_pal( - texbuf, self.aux_fmt, self.aux_depth - ) + self.aux_img.palette = self.get_n64_pal(texbuf, self.aux_fmt, self.aux_depth) # constructs a dictionary entry for the tex archive for this texture def get_json_entry(self): @@ -418,9 +410,7 @@ def pack_color(r, g, b, a): return (r << 11) | (g << 6) | (b << 1) | a - (out_img, out_w, out_h) = Converter( - mode=fmt_str.lower(), infile=img_file, flip_y=True - ).convert() + (out_img, out_w, out_h) = Converter(mode=fmt_str.lower(), infile=img_file, flip_y=True).convert() out_pal = bytearray() if fmt_str == "CI4" or fmt_str == "CI8": diff --git a/tools/splat_ext/vtx_common.py b/tools/splat_ext/vtx_common.py index c6c23e4b498..bdfa05815f6 100644 --- a/tools/splat_ext/vtx_common.py +++ b/tools/splat_ext/vtx_common.py @@ -1,5 +1,6 @@ from segtypes.n64.vtx import N64SegVtx + class N64SegVtx_common(N64SegVtx): def format_sym_name(self, sym): return f"N({sym.name[7:]})" diff --git a/tools/star_rod_enum_to_decomp.py b/tools/star_rod_enum_to_decomp.py index 0e9874325aa..2eed0cfa4e4 100755 --- a/tools/star_rod_enum_to_decomp.py +++ b/tools/star_rod_enum_to_decomp.py @@ -12,11 +12,11 @@ def create_enum(file_content, prefix, ordering): max_size = 0 if ordering: - for (key, value) in re.findall(r'(\S+)\s+=\s+(\S+)', file_content): + for key, value in re.findall(r"(\S+)\s+=\s+(\S+)", file_content): if len(key) > max_size: max_size = len(key) else: - for (key, value) in re.findall(r'(\S+)\s+=\s+(\S+)', file_content): + for key, value in re.findall(r"(\S+)\s+=\s+(\S+)", file_content): if len(value) > max_size: max_size = len(value) @@ -25,15 +25,25 @@ def create_enum(file_content, prefix, ordering): else: prefix = "" - for (key, value) in re.findall(r'(\S+)\s+=\s+(\S+)', file_content): + for key, value in re.findall(r"(\S+)\s+=\s+(\S+)", file_content): if ordering: - key = '_'.join(re.sub(r'([A-Z]{1,2})', r' \1', key).split()).replace("N_P_C", "NPC").replace("__", "_").replace("-", "") - key = prefix.upper() + '_{:<{width}}'.format(key, width=max_size + 2).upper() - ret += " " + key + " = 0x" + '{:>{fill}{width}}'.format(value, fill=0, width=8) + ",\n" + key = ( + "_".join(re.sub(r"([A-Z]{1,2})", r" \1", key).split()) + .replace("N_P_C", "NPC") + .replace("__", "_") + .replace("-", "") + ) + key = prefix.upper() + "_{:<{width}}".format(key, width=max_size + 2).upper() + ret += " " + key + " = 0x" + "{:>{fill}{width}}".format(value, fill=0, width=8) + ",\n" else: - value = '_'.join(re.sub(r'([A-Z]{1,2})', r' \1', value).split()).replace("N_P_C", "NPC").replace("__", "_").replace("-", "") - value = prefix.upper() + '_{:<{width}}'.format(value, width=max_size + 2).upper() - ret += " " + value + " = 0x" + '{:>{fill}{width}}'.format(key, fill=0, width=8) + ",\n" + value = ( + "_".join(re.sub(r"([A-Z]{1,2})", r" \1", value).split()) + .replace("N_P_C", "NPC") + .replace("__", "_") + .replace("-", "") + ) + value = prefix.upper() + "_{:<{width}}".format(value, width=max_size + 2).upper() + ret += " " + value + " = 0x" + "{:>{fill}{width}}".format(key, fill=0, width=8) + ",\n" ret += "};\n" @@ -51,9 +61,9 @@ def single_translation(file_path): print("File not found at the given path.") return "t", "y" - enum_namespace = re.search(r'(\w*)\s+%\s+namespace', file_content).group(1) - enum_name = re.search(r'(\w*)\s+%\s+library name', file_content).group(1) - reversed_order = re.search(r'(\w*)\s+%\s+reversed', file_content).group(1) + enum_namespace = re.search(r"(\w*)\s+%\s+namespace", file_content).group(1) + enum_name = re.search(r"(\w*)\s+%\s+library name", file_content).group(1) + reversed_order = re.search(r"(\w*)\s+%\s+reversed", file_content).group(1) ret += "enum " + enum_name + " {\n" if reversed_order == "true": @@ -76,9 +86,9 @@ def recursive_translation(database_path): except: continue - enum_namespace = re.search(r'(\w*)\s+%\s+namespace', file_content).group(1) - enum_name = re.search(r'(\w*)\s+%\s+library name', file_content).group(1) - reversed_order = re.search(r'(\w*)\s+%\s+reversed', file_content).group(1) + enum_namespace = re.search(r"(\w*)\s+%\s+namespace", file_content).group(1) + enum_name = re.search(r"(\w*)\s+%\s+library name", file_content).group(1) + reversed_order = re.search(r"(\w*)\s+%\s+reversed", file_content).group(1) ret += "enum " + enum_name + " {\n" if reversed_order == "true": @@ -106,9 +116,17 @@ def main(args): file.close() -parser = argparse.ArgumentParser(description='Convert a StarRod enum into an enum that is in a decomp compatible format') +parser = argparse.ArgumentParser( + description="Convert a StarRod enum into an enum that is in a decomp compatible format" +) parser.add_argument("query", help="StarRod enum file or folder") -parser.add_argument("-r", "--recursive", help="recursively convert all files to enums", type=bool, required=False) +parser.add_argument( + "-r", + "--recursive", + help="recursively convert all files to enums", + type=bool, + required=False, +) args = parser.parse_args() diff --git a/tools/star_rod_idx_to_c.py b/tools/star_rod_idx_to_c.py index 16bf191d57e..6098ce484f6 100755 --- a/tools/star_rod_idx_to_c.py +++ b/tools/star_rod_idx_to_c.py @@ -24,12 +24,16 @@ INCLUDES_NEEDED["sprites"] = set() INCLUDES_NEEDED["tattle"] = [] + def get_flag_name(arg): - v = arg - 2**32 # convert to s32 + v = arg - 2**32 # convert to s32 if v > -250000000: - if v <= -220000000: return str((v + 230000000) / 1024) - elif v <= -200000000: return f"ArrayFlag({v + 210000000})" - elif v <= -180000000: return f"ArrayVar({v + 190000000})" + if v <= -220000000: + return str((v + 230000000) / 1024) + elif v <= -200000000: + return f"ArrayFlag({v + 210000000})" + elif v <= -180000000: + return f"ArrayVar({v + 190000000})" elif v <= -160000000: if v + 170000000 == 0: return "GB_StoryProgress" @@ -37,13 +41,20 @@ def get_flag_name(arg): return "GB_WorldLocation" else: return f"GameByte({v + 170000000})" - elif v <= -140000000: return f"AreaByte({v + 150000000})" - elif v <= -120000000: return f"GameFlag({v + 130000000})" - elif v <= -100000000: return f"AreaFlag({v + 110000000})" - elif v <= -80000000: return f"MapFlag({v + 90000000})" - elif v <= -60000000: return f"LocalFlag({v + 70000000})" - elif v <= -40000000: return f"MapVar({v + 50000000})" - elif v <= -20000000: return f"LocalVar({v + 30000000})" + elif v <= -140000000: + return f"AreaByte({v + 150000000})" + elif v <= -120000000: + return f"GameFlag({v + 130000000})" + elif v <= -100000000: + return f"AreaFlag({v + 110000000})" + elif v <= -80000000: + return f"MapFlag({v + 90000000})" + elif v <= -60000000: + return f"LocalFlag({v + 70000000})" + elif v <= -40000000: + return f"MapVar({v + 50000000})" + elif v <= -20000000: + return f"LocalVar({v + 30000000})" if arg == 0xFFFFFFFF: return "-1" @@ -54,6 +65,7 @@ def get_flag_name(arg): else: return f"{arg}" + def get_function_list(area_name, map_name, rom_offset): map_file = (Path(__file__).parent.parent / "ver" / "current" / "build" / "papermario.map").read_text().splitlines() i = 0 @@ -70,7 +82,7 @@ def get_function_list(area_name, map_name, rom_offset): vram = int(vram, 16) func = func.replace(f"{map_name}_", "") if func.count("_") == 2: - func = func.rsplit("_",1)[0] + func = func.rsplit("_", 1)[0] functions[vram] = func i += 1 if firstFind: @@ -79,6 +91,7 @@ def get_function_list(area_name, map_name, rom_offset): return functions + def get_include_list(area_name, map_name): include_path = Path(__file__).parent.parent / "src" / "world" / "common" includes = set() @@ -87,16 +100,18 @@ def get_include_list(area_name, map_name): with open(file, "r", encoding="utf8") as f: for line in f: if (line.startswith("void N(") or line.startswith("ApiStatus N(")) and "{" in line: - func_name = line.split("N(",1)[1].split(")",1)[0] + func_name = line.split("N(", 1)[1].split(")", 1)[0] includes.add(func_name) return includes + def read_enum(num: int, constants_name: str) -> str: if num in disasm_script.CONSTANTS[constants_name]: return disasm_script.CONSTANTS[constants_name][num] else: return num + def read_flags(flags: int, constants_name: str) -> str: enabled = [] for x in range(32): @@ -115,6 +130,7 @@ def read_flags(flags: int, constants_name: str) -> str: return " | ".join(enabled) + def read_ptr(addr: int, symbol_map: dict, needs_ampersand: bool = False) -> str: if addr == 0: return "NULL" @@ -126,6 +142,7 @@ def read_ptr(addr: int, symbol_map: dict, needs_ampersand: bool = False) -> str: else: return f"(void*) 0x{addr:08X}" + def disassemble(bytes, midx, symbol_map={}, comments=True, romstart=0, namespace=None): global INCLUDES_NEEDED, INCLUDED out = "" @@ -139,7 +156,7 @@ def disassemble(bytes, midx, symbol_map={}, comments=True, romstart=0, namespace def transform_symbol_name(symbol): if namespace and symbol.startswith(namespace + "_"): - return "N(" + symbol[len(namespace)+1:] + ")" + return "N(" + symbol[len(namespace) + 1 :] + ")" return symbol while len(midx) > 0: @@ -148,7 +165,7 @@ def transform_symbol_name(symbol): name = struct["name"] print(name, file=sys.stderr) - #INCLUDED["functions"].add(name) + # INCLUDED["functions"].add(name) if comments: out += f"// {romstart+struct['start']:X}-{romstart+struct['end']:X} (VRAM: {struct['vaddr']:X})\n" @@ -165,18 +182,23 @@ def transform_symbol_name(symbol): main_script_name = name # For PlayMusic script if using a separate header file - #if afterHeader: + # if afterHeader: # INCLUDES_NEEDED["forward"].append(f"EvtScript " + name + ";") # afterHeader = False - disasm_script.LOCAL_WORDS = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] + disasm_script.LOCAL_WORDS = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] script_text = disasm_script.ScriptDisassembler( - bytes, name, symbol_map, romstart, INCLUDES_NEEDED, INCLUDED, + bytes, + name, + symbol_map, + romstart, + INCLUDES_NEEDED, + INCLUDED, transform_symbol_name=transform_symbol_name, use_script_lib=False, ).disassemble() if "EVS_ShakeTree" in name or "EVS_SearchBush" in name: - symbol_map[struct["vaddr"]][0][1] = name.split("_",1)[0] + ")" + symbol_map[struct["vaddr"]][0][1] = name.split("_", 1)[0] + ")" if not treePrint: out += f"=======================================\n" out += f"==========BELOW foliage.inc.c==========\n" @@ -188,9 +210,9 @@ def transform_symbol_name(symbol): script_text = script_text.splitlines() walkDistance = exitIdx = map_ = entryIdx = "" if "UseExitHeading" in script_text[2]: - walkDistance, exitIdx = script_text[2].split("(",1)[1].split(")",1)[0].split(",") + walkDistance, exitIdx = script_text[2].split("(", 1)[1].split(")", 1)[0].split(",") if "GotoMap" in script_text[4]: - map_, entryIdx = script_text[4].split("(",1)[1].split(")",1)[0].split(",") + map_, entryIdx = script_text[4].split("(", 1)[1].split(")", 1)[0].split(",") if walkDistance and exitIdx and map_ and entryIdx: out += f"EvtScript {name} = EVT_EXIT_WALK({walkDistance}, {exitIdx}, {map_}, {entryIdx});\n" else: @@ -210,8 +232,11 @@ def transform_symbol_name(symbol): z = [] w = [] for _ in range(entry_count): - a,b,c,d = unpack_from(">ffff", entry_list, pos) - x.append(f"{a:.01f}"); y.append(f"{b:.01f}"); z.append(f"{c:.01f}"); w.append(f"{d:.01f}") + a, b, c, d = unpack_from(">ffff", entry_list, pos) + x.append(f"{a:.01f}") + y.append(f"{b:.01f}") + z.append(f"{c:.01f}") + w.append(f"{d:.01f}") pos += 16 x_size = max([len(a) for a in x]) @@ -219,7 +244,7 @@ def transform_symbol_name(symbol): z_size = max([len(a) for a in z]) w_size = max([len(a) for a in w]) - for a,b,c,d in zip(x,y,z,w): + for a, b, c, d in zip(x, y, z, w): out += f"\n {{ {a:>{x_size}}f, {b:>{y_size}}f, {c:>{z_size}}f, {d:>{w_size}}f }}," out += f"\n}};\n" @@ -233,16 +258,29 @@ def transform_symbol_name(symbol): var_names = ["unk_00", "unk_24"] data = unpack_from(">4B", npcSettings, i) if not sum(data) == 0: - tmp_out += INDENT + f".{var_names[0] if i == 0 else var_names[1]} = {{ " + ", ".join(f"0x{x:02X}" for x in data) + f" }},\n" + tmp_out += ( + INDENT + + f".{var_names[0] if i == 0 else var_names[1]} = {{ " + + ", ".join(f"0x{x:02X}" for x in data) + + f" }},\n" + ) elif i == 0x4 or i == 0x28: var_names = ["height", "radius", "level", "unk_2A"] - for x,var in enumerate(unpack_from(">2h", npcSettings, i)): - var_name = var_names[x if i == 0x4 else x+2] + for x, var in enumerate(unpack_from(">2h", npcSettings, i)): + var_name = var_names[x if i == 0x4 else x + 2] if not var == 0: tmp_out += INDENT + f".{var_name} = {var},\n" elif i == 0x8: - var_names = ["otherAI", "onInteract", "ai", "onHit", "aux", "onDefeat", "flags"] - for x,var in enumerate(unpack_from(f">7I", npcSettings, i)): + var_names = [ + "otherAI", + "onInteract", + "ai", + "onHit", + "aux", + "onDefeat", + "flags", + ] + for x, var in enumerate(unpack_from(f">7I", npcSettings, i)): var_name = var_names[x] if not var == 0: if var == 0x80077F70: @@ -264,8 +302,20 @@ def transform_symbol_name(symbol): npcAISettings = bytes.read(struct["length"]) i = x = 0 - var_names = ["moveSpeed", "moveTime", "waitTime", "alertRadius", "unk_10", "unk_14", - "chaseSpeed", "unk_1C", "unk_20", "chaseRadius", "unk_28", "unk_2C"] + var_names = [ + "moveSpeed", + "moveTime", + "waitTime", + "alertRadius", + "unk_10", + "unk_14", + "chaseSpeed", + "unk_1C", + "unk_20", + "chaseRadius", + "unk_28", + "unk_2C", + ] while i < struct["length"]: var_f, var_i1, var_i2 = unpack_from(f">fii", npcAISettings, i) if not var_f == 0: @@ -274,7 +324,10 @@ def transform_symbol_name(symbol): # account for X32 if var_names[x + 1] in ["unk_10", "unk_1C", "unk_28"]: if var_i1 < -100000 or var_i1 > 100000: - tmp_out += INDENT + f".{var_names[x + 1]} = {{ .f = {unpack_from('>f', npcAISettings, i+4)[0]:.01f}f }},\n" + tmp_out += ( + INDENT + + f".{var_names[x + 1]} = {{ .f = {unpack_from('>f', npcAISettings, i+4)[0]:.01f}f }},\n" + ) else: tmp_out += INDENT + f".{var_names[x + 1]} = {{ .s = {var_i1} }},\n" else: @@ -289,32 +342,56 @@ def transform_symbol_name(symbol): elif struct["type"] == "NpcGroup": staticNpc = bytes.read(struct["length"]) curr_base = 0 - numNpcs = struct['length'] // 0x1F0 + numNpcs = struct["length"] // 0x1F0 tmp_out = f"NpcData {name}" + ("[]" if numNpcs > 1 else "") + f" = {{\n" for z in range(numNpcs): i = 0 - var_names = ["id", "settings", "pos", "flags", - "init", "unk_1C", "yaw", "dropFlags", - "itemDropChance", "itemDrops", "heartDrops", "flowerDrops", - "minCoinBonus", "maxCoinBonus", "movement", "animations", - "unk_1E0", "extraAnimations", "tattle"] + var_names = [ + "id", + "settings", + "pos", + "flags", + "init", + "unk_1C", + "yaw", + "dropFlags", + "itemDropChance", + "itemDrops", + "heartDrops", + "flowerDrops", + "minCoinBonus", + "maxCoinBonus", + "movement", + "animations", + "unk_1E0", + "extraAnimations", + "tattle", + ] if numNpcs > 1: tmp_out += INDENT + f"{{\n" - INDENT = INDENT*2 + INDENT = INDENT * 2 while i < 0x1F0: if i == 0x0 or i == 0x24: var_name = var_names[0] if i == 0x0 else var_names[6] - var = unpack_from(f">i", staticNpc, curr_base+i)[0] + var = unpack_from(f">i", staticNpc, curr_base + i)[0] if var_name == "id": tmp_out += INDENT + f".{var_name} = {disasm_script.CONSTANTS['MAP_NPCS'][var]},\n" else: tmp_out += INDENT + f".{var_name} = {var},\n" elif i == 0x4 or i == 0x14 or i == 0x18 or i == 0x1E8: - var_name = var_names[1] if i == 0x4 else var_names[3] if i == 0x14 else var_names[4] if i == 0x18 else var_names[17] - addr = unpack_from(f">I", staticNpc, curr_base+i)[0] + var_name = ( + var_names[1] + if i == 0x4 + else var_names[3] + if i == 0x14 + else var_names[4] + if i == 0x18 + else var_names[17] + ) + addr = unpack_from(f">I", staticNpc, curr_base + i)[0] if not addr == 0: if var_name != "flags" and addr in symbol_map: if var_name == "extraAnimations": @@ -338,17 +415,17 @@ def transform_symbol_name(symbol): enabled.append(0) tmp_out += INDENT + f".{var_name} = " + " | ".join(enabled) + f",\n" elif i == 0x8: - pos = unpack_from(f">fff", staticNpc, curr_base+i) + pos = unpack_from(f">fff", staticNpc, curr_base + i) if not sum(pos) == 0: tmp_out += INDENT + f".pos = {{ {pos[0]:.01f}f, {pos[1]:.01f}f, {pos[2]:.01f}f }},\n" elif i == 0x1C or i == 0x1E0: var_name = var_names[5] if i == 0x1C else var_names[16] - data = unpack_from(f">8B", staticNpc, curr_base+i) + data = unpack_from(f">8B", staticNpc, curr_base + i) if not sum(data) == 0: tmp_out += INDENT + f".{var_name} = {{ " + ", ".join(f"{x:02X}" for x in data) + f"}},\n" elif i == 0x28 or i == 0x29: var_name = var_names[7] if i == 0x28 else var_names[8] - var = unpack_from(f">b", staticNpc, curr_base+i)[0] + var = unpack_from(f">b", staticNpc, curr_base + i)[0] if not var == 0: if var_name == "dropFlags": tmp_out += INDENT + f".{var_name} = 0x{abs(var):02X},\n" @@ -358,10 +435,14 @@ def transform_symbol_name(symbol): var_name = var_names[9] tmp_tmp = "" for x in range(8): - item, weight, unk_08 = unpack_from(f">3h", staticNpc, curr_base+i) + item, weight, unk_08 = unpack_from(f">3h", staticNpc, curr_base + i) if not (item == 0 and weight == 0 and unk_08 == 0): - item = disasm_script.CONSTANTS["ItemIDs"][item] if item in disasm_script.CONSTANTS["ItemIDs"] else f"{item}" - tmp_tmp += INDENT*2 + f"{{ {item}, {weight}, {unk_08} }},\n" + item = ( + disasm_script.CONSTANTS["ItemIDs"][item] + if item in disasm_script.CONSTANTS["ItemIDs"] + else f"{item}" + ) + tmp_tmp += INDENT * 2 + f"{{ {item}, {weight}, {unk_08} }},\n" i += 0x6 if tmp_tmp: @@ -374,7 +455,12 @@ def transform_symbol_name(symbol): var_name = var_names[10] if i == 0x5A else var_names[11] drops = [] for x in range(8): - cutoff, generalChance, attempts, chancePerAttempt = unpack_from(f">4h", staticNpc, curr_base+i) + ( + cutoff, + generalChance, + attempts, + chancePerAttempt, + ) = unpack_from(f">4h", staticNpc, curr_base + i) if not (cutoff == 0 and generalChance == 0 and attempts == 0 and chancePerAttempt == 0): drops.append([cutoff, generalChance, attempts, chancePerAttempt]) i += 0x8 @@ -388,10 +474,16 @@ def transform_symbol_name(symbol): tmp_out += f"GENEROUS_HEART_DROPS({drops[0][2]})" elif round(drops[0][1] / 327.67, 2) == 80 and round(drops[0][3] / 327.67, 2) == 60: tmp_out += f"GENEROUS_WHEN_LOW_HEART_DROPS({drops[0][2]})" - elif round(drops[0][0] / 327.67, 2) == 100 and round(drops[0][1] / 327.67, 2) == 0 and round(drops[0][2] / 327.67, 2) == 0: + elif ( + round(drops[0][0] / 327.67, 2) == 100 + and round(drops[0][1] / 327.67, 2) == 0 + and round(drops[0][2] / 327.67, 2) == 0 + ): tmp_out += f"NO_DROPS" else: - print(f"Unknown heart drop macro, values were {round(drops[0][1] / 327.67, 2)} and {round(drops[0][3] / 327.67, 2)}") + print( + f"Unknown heart drop macro, values were {round(drops[0][1] / 327.67, 2)} and {round(drops[0][3] / 327.67, 2)}" + ) exit() else: if round(drops[0][1] / 327.67, 2) == 50 and round(drops[0][3] / 327.67, 2) == 40: @@ -400,56 +492,70 @@ def transform_symbol_name(symbol): tmp_out += f"GENEROUS_WHEN_LOW_FLOWER_DROPS({drops[0][2]})" elif round(drops[0][1] / 327.67, 2) == 40 and round(drops[0][3] / 327.67, 2) == 40: tmp_out += f"REDUCED_FLOWER_DROPS({drops[0][2]})" - elif round(drops[0][0] / 327.67, 2) == 100 and round(drops[0][1] / 327.67, 2) == 0 and round(drops[0][2] / 327.67, 2) == 0: + elif ( + round(drops[0][0] / 327.67, 2) == 100 + and round(drops[0][1] / 327.67, 2) == 0 + and round(drops[0][2] / 327.67, 2) == 0 + ): tmp_out += f"NO_DROPS" else: - print(f"Unknown flower drop macro, values were {round(drops[0][1] / 327.67, 2)} and {round(drops[0][3] / 327.67, 2)}") + print( + f"Unknown flower drop macro, values were {round(drops[0][1] / 327.67, 2)} and {round(drops[0][3] / 327.67, 2)}" + ) exit() tmp_out += f",\n" elif i == 0xDA or i == 0xDC: var_name = var_names[12] if i == 0xDA else var_names[13] - var = unpack_from(">h", staticNpc, curr_base+i)[0] + var = unpack_from(">h", staticNpc, curr_base + i)[0] if not var == 0: tmp_out += INDENT + f".{var_name} = {var},\n" elif i == 0xE0: - data = unpack_from(">48i", staticNpc, curr_base+i) + data = unpack_from(">48i", staticNpc, curr_base + i) if not sum(data) == 0: end_pos = len(data) - for x,datum in enumerate(data): + for x, datum in enumerate(data): if not datum == 0: end_pos = x - tmp_out += INDENT + f".territory = { .temp = {{ " + ", ".join(f"{x}" for x in data[:end_pos+1]) + f" }}},\n" + tmp_out += ( + INDENT + + f".territory = {{ .temp = {{ " + + ", ".join(f"{x}" for x in data[: end_pos + 1]) + + f" }}}},\n" + ) elif i == 0x1A0: tmp_out += INDENT + f".{var_names[15]} = {{\n" for x in range(16): - anim = unpack_from(">I", staticNpc, curr_base+i)[0] + anim = unpack_from(">I", staticNpc, curr_base + i)[0] if not anim == 0: - sprite_id = (anim & 0x00FF0000) >> 16 + sprite_id = (anim & 0x00FF0000) >> 16 palette_id = (anim & 0x0000FF00) >> 8 - anim_id = (anim & 0x000000FF) >> 0 - sprite = disasm_script.CONSTANTS["NPC_SPRITE"][sprite_id]["name"] + anim_id = (anim & 0x000000FF) >> 0 + sprite = disasm_script.CONSTANTS["NPC_SPRITE"][sprite_id]["name"] palette = disasm_script.CONSTANTS["NPC_SPRITE"][sprite_id]["palettes"][palette_id] - anim = disasm_script.CONSTANTS["NPC_SPRITE"][sprite_id]["anims"][anim_id] + anim = disasm_script.CONSTANTS["NPC_SPRITE"][sprite_id]["anims"][anim_id] if numNpcs > 1: tmp_out += INDENT + " " + f"NPC_ANIM_{sprite}_{palette}_{anim},\n" else: - tmp_out += INDENT*2 + f"NPC_ANIM_{sprite}_{palette}_{anim},\n" + tmp_out += INDENT * 2 + f"NPC_ANIM_{sprite}_{palette}_{anim},\n" INCLUDES_NEEDED["sprites"].add(sprite) i += 4 tmp_out += INDENT + f"}},\n" i -= 1 elif i == 0x1EC: - var = unpack_from(">I", staticNpc, curr_base+i)[0] + var = unpack_from(">I", staticNpc, curr_base + i)[0] if not var == 0: - tmp_out += INDENT + f".{var_names[18]} = MESSAGE_ID(0x{(var & 0xFF0000) >> 16:02X}, 0x{var & 0xFFFF:04X}),\n" + tmp_out += ( + INDENT + + f".{var_names[18]} = MESSAGE_ID(0x{(var & 0xFF0000) >> 16:02X}, 0x{var & 0xFFFF:04X}),\n" + ) i += 1 if numNpcs > 1: - INDENT = INDENT[:len(INDENT)//2] + INDENT = INDENT[: len(INDENT) // 2] tmp_out += INDENT + f"}},\n" - if z+1 == numNpcs: + if z + 1 == numNpcs: tmp_out += "};\n" curr_base += 0x1F0 @@ -464,12 +570,12 @@ def transform_symbol_name(symbol): if anim == 0xFFFFFFFF: tmp_out += INDENT + f"ANIM_LIST_END,\n" elif not anim == 0: - sprite_id = (anim & 0x00FF0000) >> 16 + sprite_id = (anim & 0x00FF0000) >> 16 palette_id = (anim & 0x0000FF00) >> 8 - anim_id = (anim & 0x000000FF) >> 0 - sprite = disasm_script.CONSTANTS["NPC_SPRITE"][sprite_id]["name"] + anim_id = (anim & 0x000000FF) >> 0 + sprite = disasm_script.CONSTANTS["NPC_SPRITE"][sprite_id]["name"] palette = disasm_script.CONSTANTS["NPC_SPRITE"][sprite_id]["palettes"][palette_id] - anim = disasm_script.CONSTANTS["NPC_SPRITE"][sprite_id]["anims"][anim_id] + anim = disasm_script.CONSTANTS["NPC_SPRITE"][sprite_id]["anims"][anim_id] tmp_out += INDENT + f"NPC_ANIM_{sprite}_{palette}_{anim},\n" INCLUDES_NEEDED["sprites"].add(sprite) i += 4 @@ -487,7 +593,10 @@ def transform_symbol_name(symbol): battle_b = (battle & 0x00FF0000) >> 16 battle_c = (battle & 0x0000FF00) >> 8 battle_d = (battle & 0x000000FF) >> 0 - tmp_out += INDENT + f"NPC_GROUP({symbol_map[npcs][0][1]}, BATTLE_ID({battle_a}, {battle_b}, {battle_c}, {battle_d})),\n" + tmp_out += ( + INDENT + + f"NPC_GROUP({symbol_map[npcs][0][1]}, BATTLE_ID({battle_a}, {battle_b}, {battle_c}, {battle_d})),\n" + ) if symbol_map[npcs][0][1] not in INCLUDED["functions"]: INCLUDES_NEEDED["forward"].append(symbol_map[npcs][0][1]) i += 0xC @@ -502,7 +611,7 @@ def transform_symbol_name(symbol): out += f" {disasm_script.CONSTANTS['ItemIDs'][item]},\n" out += f"}};\n" elif struct["type"] == "TreeDropList": - new_name = "N(" + name.split('_',1)[1][:-1].lower() + "_Drops)" + new_name = "N(" + name.split("_", 1)[1][:-1].lower() + "_Drops)" symbol_map[struct["vaddr"]][0][1] = new_name out += f"FoliageDropList {new_name} = {{\n" @@ -518,7 +627,7 @@ def transform_symbol_name(symbol): pos = 4 for _ in range(count): entry = list(unpack_from(">7I", data, pos)) - pos += 7*4 + pos += 7 * 4 entry[1] = entry[1] - 0x100000000 if entry[1] >= 0x80000000 else entry[1] entry[2] = entry[2] - 0x100000000 if entry[2] >= 0x80000000 else entry[2] @@ -532,9 +641,9 @@ def transform_symbol_name(symbol): out += f"{INDENT * 3}.pos = {{ {entry[1]}, {entry[2]}, {entry[3]} }},\n" if entry[4] != 0: out += f"{INDENT * 3}.spawnMode = 0x{entry[4]:X},\n" - if flag1 != '0': + if flag1 != "0": out += f"{INDENT * 3}.pickupFlag = {flag1},\n" - if flag2 != '0': + if flag2 != "0": out += f"{INDENT * 3}.spawnFlag = {flag2},\n" out += f"{INDENT * 2}}},\n" @@ -546,7 +655,7 @@ def transform_symbol_name(symbol): elif struct["type"] == "TreeModelList" or struct["type"] == "TreeEffectVectors": isModelList = struct["type"] == "TreeModelList" - name_parts = name.split('_') + name_parts = name.split("_") if isModelList: new_name = "N(" + name_parts[1].lower() + "_" + name_parts[2] else: @@ -590,7 +699,7 @@ def transform_symbol_name(symbol): entry[1] = entry[1] - 0x100000000 if entry[1] >= 0x80000000 else entry[1] entry[2] = entry[2] - 0x100000000 if entry[2] >= 0x80000000 else entry[2] - pos += 3*4 + pos += 3 * 4 out += f"{INDENT * 2}{{ {entry[0]}, {entry[1]}, {entry[2]} }},\n" @@ -600,10 +709,10 @@ def transform_symbol_name(symbol): out += f"}};\n" elif struct["type"] == "SearchBushEvent": - new_name = "N(" + name.split('_',1)[1].lower() + new_name = "N(" + name.split("_", 1)[1].lower() symbol_map[struct["vaddr"]][0][1] = new_name - num = int(new_name.split("bush",1)[1][:-1]) + num = int(new_name.split("bush", 1)[1][:-1]) out += f"SearchBushConfig {new_name} = {{\n" data = bytes.read(struct["length"]) @@ -621,10 +730,10 @@ def transform_symbol_name(symbol): out += f"}};\n" elif struct["type"] == "ShakeTreeEvent": - new_name = "N(" + name.split('_',1)[1].lower() + new_name = "N(" + name.split("_", 1)[1].lower() symbol_map[struct["vaddr"]][0][1] = new_name - num = int(new_name.split("tree",1)[1][:-1]) + num = int(new_name.split("tree", 1)[1][:-1]) out += f"ShakeTreeConfig {new_name} = {{\n" data = bytes.read(struct["length"]) @@ -656,20 +765,22 @@ def transform_symbol_name(symbol): bytes.read(0x10) - main,entry_list,entry_count = unpack(">IIi", bytes.read(4 * 3)) + main, entry_list, entry_count = unpack(">IIi", bytes.read(4 * 3)) out += f" .main = &N(main),\n" out += f" .entryList = &{entry_list_name},\n" out += f" .entryCount = ENTRY_COUNT({entry_list_name}),\n" bytes.read(0x1C) - bg,tattle = unpack(">II", bytes.read(4 * 2)) + bg, tattle = unpack(">II", bytes.read(4 * 2)) if bg == 0x80200000: out += f" .background = &gBackgroundImage,\n" elif bg != 0: raise Exception(f"unknown MapSettings background {bg:X}") - #out += f" .tattle = 0x{tattle:X},\n" - INCLUDES_NEEDED["tattle"].append(f"- [0x{(tattle & 0xFF0000) >> 16:02X}, 0x{tattle & 0xFFFF:04X}, {map_name}_tattle]") + # out += f" .tattle = 0x{tattle:X},\n" + INCLUDES_NEEDED["tattle"].append( + f"- [0x{(tattle & 0xFF0000) >> 16:02X}, 0x{tattle & 0xFFFF:04X}, {map_name}_tattle]" + ) out += f" .tattle = {{ MSG_{map_name}_tattle }},\n" out += f"}};\n" @@ -678,7 +789,7 @@ def transform_symbol_name(symbol): bytes.read(struct["length"]) out += f"s32 {name}();\n" elif struct["type"] == "FloatTable": - vram = int(name.split("_",1)[1][:-1], 16) + vram = int(name.split("_", 1)[1][:-1], 16) name = f"N(D_{vram:X}_{(vram - 0x80240000) + romstart:X})" struct["name"] = name out += f"f32 {name}[] = {{" @@ -695,10 +806,10 @@ def transform_symbol_name(symbol): if len(data) > 0: out += f"Vec3f {name}[] = {{\n" out += f"\t" - for i,pos in enumerate(range(0, len(data), 0xC)): + for i, pos in enumerate(range(0, len(data), 0xC)): x, y, z = unpack_from(">fff", data, pos) out += f" {{ {x:.01f}, {y:.01f}, {z:.01f} }}," - if (i+1) % 2 == 0: + if (i + 1) % 2 == 0: out += f"\n\t" out += f"\n}};\n" @@ -721,7 +832,6 @@ def transform_symbol_name(symbol): else: out += f".actor = {actor}, " - if position in symbol_map: out += f".home = {{ .vec = &{symbol_map[position][0][1]} }}" @@ -829,11 +939,11 @@ def transform_symbol_name(symbol): element = disasm_script.CONSTANTS["Statuses"][element] - value = (anim & 0x00FFFFFF) + value = anim & 0x00FFFFFF if value in disasm_script.CONSTANTS["NPC_SPRITE"]: - INCLUDES_NEEDED["sprites"].add(disasm_script.CONSTANTS['NPC_SPRITE'][str(value) + ".h"]) - anim = disasm_script.CONSTANTS['NPC_SPRITE'][value] + INCLUDES_NEEDED["sprites"].add(disasm_script.CONSTANTS["NPC_SPRITE"][str(value) + ".h"]) + anim = disasm_script.CONSTANTS["NPC_SPRITE"][value] else: anim = f"{anim:06X}" @@ -851,15 +961,15 @@ def transform_symbol_name(symbol): out += INDENT + "{\n" out += INDENT + INDENT + f".flags = {read_flags(d[0], 'ActorPartFlags')},\n" out += INDENT + INDENT + f".index = {d[1]},\n" - out += INDENT + INDENT + f".posOffset = {{ {d[2]}, {d[3]}, {d[4]} }},\n" - out += INDENT + INDENT + f".targetOffset = {{ {d[5]}, {d[6]} }},\n" - out += INDENT + INDENT + f".opacity = {d[7]},\n" - out += INDENT + INDENT + f".idleAnimations = N(IdleAnimations_{d[8]:08X}),\n" - out += INDENT + INDENT + f".defenseTable = N(DefenseTable_{d[9]:08X}),\n" - out += INDENT + INDENT + f".eventFlags = {read_flags(d[10], 'ActorEventFlags')},\n" - out += INDENT + INDENT + f".elementImmunityFlags = {read_flags(d[11], 'ElementImmunityFlags')},\n" - out += INDENT + INDENT + f".unk_1C = {d[12]},\n" - out += INDENT + INDENT + f".unk_1D = {d[13]},\n" + out += INDENT + INDENT + f".posOffset = {{ {d[2]}, {d[3]}, {d[4]} }},\n" + out += INDENT + INDENT + f".targetOffset = {{ {d[5]}, {d[6]} }},\n" + out += INDENT + INDENT + f".opacity = {d[7]},\n" + out += INDENT + INDENT + f".idleAnimations = N(IdleAnimations_{d[8]:08X}),\n" + out += INDENT + INDENT + f".defenseTable = N(DefenseTable_{d[9]:08X}),\n" + out += INDENT + INDENT + f".eventFlags = {read_flags(d[10], 'ActorEventFlags')},\n" + out += INDENT + INDENT + f".elementImmunityFlags = {read_flags(d[11], 'ElementImmunityFlags')},\n" + out += INDENT + INDENT + f".unk_1C = {d[12]},\n" + out += INDENT + INDENT + f".unk_1D = {d[13]},\n" out += INDENT + "},\n" out += f"}};\n" @@ -895,7 +1005,18 @@ def transform_symbol_name(symbol): elif struct["type"] == "Stage": out += f"Stage NAMESPACE = {{\n" - texture, shape, hit, preBattle, postBattle, bg, unk_18, unk_1C, unk_20, unk_24 = unpack(">IIIIIIIIII", bytes.read(struct["length"])) + ( + texture, + shape, + hit, + preBattle, + postBattle, + bg, + unk_18, + unk_1C, + unk_20, + unk_24, + ) = unpack(">IIIIIIIIII", bytes.read(struct["length"])) if texture != 0: out += f" .texture = {symbol_map[texture][0][1]},\n" @@ -928,9 +1049,9 @@ def transform_symbol_name(symbol): out += f" .unk_24 = {unk_24:X},\n" out += f"}};\n" - else: # unknown type of struct + else: # unknown type of struct if struct["name"].startswith("N(unk_802"): - vram = int(name.split("_",1)[1][:-1], 16) + vram = int(name.split("_", 1)[1][:-1], 16) name = f"N(D_{vram:X}_{(vram - 0x80240000) + romstart:X})" struct["name"] = name @@ -957,53 +1078,63 @@ def transform_symbol_name(symbol): # end of data return out + def parse_midx(file, prefix="", vram=0x80240000): structs = [] for line in file.readlines(): s = line.split("#") if len(s) == 5 or len(s) == 6: - if s[0] == "$Start": continue - if s[0] == "$End": continue - - structs.append({ - "name": "N(" + prefix + name_struct(s[0]) + ")", - "type": s[1], - "start": int(s[2], 16), - "vaddr": int(s[3], 16), - "length": int(s[4], 16), - "end": int(s[2], 16) + int(s[4], 16), - }) + if s[0] == "$Start": + continue + if s[0] == "$End": + continue + + structs.append( + { + "name": "N(" + prefix + name_struct(s[0]) + ")", + "type": s[1], + "start": int(s[2], 16), + "vaddr": int(s[3], 16), + "length": int(s[4], 16), + "end": int(s[2], 16) + int(s[4], 16), + } + ) elif "Missing" in s: start = int(s[1], 16) end = int(s[2], 16) vaddr = start + vram - structs.append({ - "name": f"{prefix}unk_missing_{vaddr:X}", - "type": "Missing", - "start": start, - "vaddr": vaddr, - "length": end - start, - "end": end, - }) + structs.append( + { + "name": f"{prefix}unk_missing_{vaddr:X}", + "type": "Missing", + "start": start, + "vaddr": vaddr, + "length": end - start, + "end": end, + } + ) elif "Padding" in s: start = int(s[1], 16) end = int(s[2], 16) vaddr = start + vram - structs.append({ - "name": f"{prefix}pad_{start:X}", - "type": "Padding", - "start": start, - "vaddr": vaddr, - "length": end - start, - "end": end, - }) + structs.append( + { + "name": f"{prefix}pad_{start:X}", + "type": "Padding", + "start": start, + "vaddr": vaddr, + "length": end - start, + "end": end, + } + ) else: raise Exception(str(s)) structs.sort(key=lambda s: s["start"]) return structs + def name_struct(s): s = s[1:].replace("???", "unk") @@ -1032,10 +1163,11 @@ def name_struct(s): return s[0].lower() + s[1:] + if __name__ == "__main__": parser = argparse.ArgumentParser(description="Converts split data to C using a Star Rod idx file") parser.add_argument("idxfile", help="Input .*idx file from Star Rod dump") - parser.add_argument("namespace", nargs='?', help="Value of NAMESPACE macro") + parser.add_argument("namespace", nargs="?", help="Value of NAMESPACE macro") parser.add_argument("--comments", action="store_true", help="Write offset/vaddr comments") args = parser.parse_args() @@ -1053,8 +1185,7 @@ def name_struct(s): segment_name = f"battle/partners/{battle_area}" elif "/starpower/src/" in args.idxfile: segment_name = ( - f"battle/star/{battle_area}" - .replace("starstorm", "star_storm") + f"battle/star/{battle_area}".replace("starstorm", "star_storm") .replace("chillout", "chill_out") .replace("timeout", "time_out") .replace("upandaway", "up_and_away") @@ -1069,6 +1200,7 @@ def name_struct(s): is_battle = True symbol_map = disasm_script.script_lib() + def add_to_symbol_map(addr, pair): if addr in symbol_map: symbol_map[addr].append(pair) @@ -1082,7 +1214,9 @@ def add_to_symbol_map(addr, pair): rom_offset = -1 for segment in splat_config["segments"]: - if isinstance(segment, dict) and (segment.get("dir") == segment_name or segment.get("name") == segment_name): + if isinstance(segment, dict) and ( + segment.get("dir") == segment_name or segment.get("name") == segment_name + ): rom_offset = segment["start"] vram = segment["vram"] break @@ -1102,11 +1236,11 @@ def add_to_symbol_map(addr, pair): with open(os.path.join(DIR, "../ver/current/baserom.z64"), "rb") as romfile: name_fixes = { - "script_NpcAI": "npcAI", - "aISettings": "npcAISettings", - "script_ExitWalk": "exitWalk", - "script_MakeEntities": "makeEntities", - } + "script_NpcAI": "npcAI", + "aISettings": "npcAISettings", + "script_ExitWalk": "exitWalk", + "script_MakeEntities": "makeEntities", + } total_npc_counts = {} for struct in midx: romfile.seek(struct["start"] + rom_offset) @@ -1116,13 +1250,13 @@ def add_to_symbol_map(addr, pair): if name.startswith("N("): name = name[2:-1] - if struct['vaddr'] in function_replacements: - name = function_replacements[struct['vaddr']] + if struct["vaddr"] in function_replacements: + name = function_replacements[struct["vaddr"]] - if name.split("_",1)[0] in name_fixes: - name = name_fixes[name.split("_",1)[0]] + "_" + name.rsplit("_",1)[1] + if name.split("_", 1)[0] in name_fixes: + name = name_fixes[name.split("_", 1)[0]] + "_" + name.rsplit("_", 1)[1] elif name.startswith("script_"): - name = name.split("script_",1)[1] + name = name.split("script_", 1)[1] elif "_Main_" in name: name = "main" elif "ASCII" in name: @@ -1154,19 +1288,19 @@ def add_to_symbol_map(addr, pair): double_literal = f"{double}" add_to_symbol_map(struct["vaddr"], [struct["vaddr"], double_literal]) elif struct["type"] == "NpcGroup": - for z in range(struct["length"]//0x1F0): + for z in range(struct["length"] // 0x1F0): npc = romfile.read(0x1F0) npc_id = unpack_from(">I", npc, 0)[0] if npc_id >= 0: anim = unpack_from(">I", npc, 0x1A0)[0] if not anim == 0: - sprite_id = (anim & 0x00FF0000) >> 16 - sprite = disasm_script.CONSTANTS["NPC_SPRITE"][sprite_id]["name"].upper() + sprite_id = (anim & 0x00FF0000) >> 16 + sprite = disasm_script.CONSTANTS["NPC_SPRITE"][sprite_id]["name"].upper() if npc_id not in total_npc_counts: total_npc_counts[npc_id] = sprite add_to_symbol_map(struct["vaddr"], [struct["vaddr"], struct["name"]]) else: - add_to_symbol_map(struct["vaddr"], [struct["vaddr"], struct["name"]]) + add_to_symbol_map(struct["vaddr"], [struct["vaddr"], struct["name"]]) # fix NPC names curr_counts = {} @@ -1186,17 +1320,24 @@ def add_to_symbol_map(addr, pair): romfile.seek(rom_offset, 0) - disasm = disassemble(romfile, midx, symbol_map, args.comments, rom_offset, namespace=args.namespace) + disasm = disassemble( + romfile, + midx, + symbol_map, + args.comments, + rom_offset, + namespace=args.namespace, + ) print("========== Includes needed: ===========\n") if is_battle: - print(f"#include \"battle/battle.h\"") + print(f'#include "battle/battle.h"') else: - print(f"#include \"map.h\"") - print(f"#include \"message_ids.h\"") + print(f'#include "map.h"') + print(f'#include "message_ids.h"') if INCLUDES_NEEDED["sprites"]: for npc in sorted(INCLUDES_NEEDED["sprites"]): - print(f"#include \"sprite/npc/{npc}\"") + print(f'#include "sprite/npc/{npc}"') print() if INCLUDES_NEEDED["forward"]: @@ -1213,7 +1354,7 @@ def add_to_symbol_map(addr, pair): print(f"enum {{") lastnum = -1 for i, (k, v) in enumerate(sorted(INCLUDES_NEEDED["npcs"].items())): - print(f" {v}" + (f" = {k}" if ((k > 0 and i == 0) or (k != lastnum+1)) else "") + ",") + print(f" {v}" + (f" = {k}" if ((k > 0 and i == 0) or (k != lastnum + 1)) else "") + ",") lastnum = k print(f"}};") print() diff --git a/tools/sym_info.py b/tools/sym_info.py index 74c4f5359fe..cfe6c07655c 100755 --- a/tools/sym_info.py +++ b/tools/sym_info.py @@ -6,29 +6,24 @@ script_dir = os.path.dirname(os.path.realpath(__file__)) root_dir = os.path.abspath(os.path.join(script_dir, "..")) -parser = argparse.ArgumentParser( - description="Display various information about a symbol or address." -) -parser.add_argument( - "name", - type=str, - default="", - help="symbol name or ROM/RAM address to lookup" -) +parser = argparse.ArgumentParser(description="Display various information about a symbol or address.") +parser.add_argument("name", type=str, default="", help="symbol name or ROM/RAM address to lookup") parser.add_argument( "-e", "--expected", dest="use_expected", action="store_true", - help="use the map file in expected/build/ instead of build/" + help="use the map file in expected/build/ instead of build/", ) + def get_map(expected: bool = False): mymap = os.path.join(root_dir, "ver", "current", "build", "papermario.map") if expected: mymap = os.path.join(root_dir, "ver", "current", "expected", "build", "papermario.map") return mymap + def search_address(target_addr, map=get_map()): is_ram = target_addr & 0x80000000 ram_offset = None @@ -52,12 +47,7 @@ def search_address(target_addr, map=get_map()): prev_line = line - if ( - ram_offset is None - or "=" in line - or "*fill*" in line - or " 0x" not in line - ): + if ram_offset is None or "=" in line or "*fill*" in line or " 0x" not in line: continue ram = int(line[16 : 16 + 18], 0) @@ -84,6 +74,7 @@ def search_address(target_addr, map=get_map()): return "at end of rom?" + def search_symbol(target_sym, map=get_map()): ram_offset = None cur_file = "" @@ -98,12 +89,7 @@ def search_symbol(target_sym, map=get_map()): prev_line = line - if ( - ram_offset is None - or "=" in line - or "*fill*" in line - or " 0x" not in line - ): + if ram_offset is None or "=" in line or "*fill*" in line or " 0x" not in line: continue ram = int(line[16 : 16 + 18], 0) @@ -122,6 +108,7 @@ def search_symbol(target_sym, map=get_map()): return None + if __name__ == "__main__": args = parser.parse_args() diff --git a/tools/update_symbol_addrs.py b/tools/update_symbol_addrs.py index 5e1263ecf41..c3df51f049e 100755 --- a/tools/update_symbol_addrs.py +++ b/tools/update_symbol_addrs.py @@ -26,6 +26,7 @@ verbose = False + def read_ignores(): with open(ignores_path) as f: lines = f.readlines() @@ -35,6 +36,7 @@ def read_ignores(): if name != "": ignores.add(name) + def scan_map(): ram_offset = None cur_file = "" @@ -49,12 +51,7 @@ def scan_map(): prev_line = line - if ( - ram_offset is None - or "=" in line - or "*fill*" in line - or " 0x" not in line - ): + if ram_offset is None or "=" in line or "*fill*" in line or " 0x" not in line: continue ram = int(line[16 : 16 + 18], 0) @@ -70,12 +67,13 @@ def scan_map(): map_symbols[sym] = (rom, cur_file, ram) + def read_symbol_addrs(): unique_lines = set() with open(symbol_addrs_path, "r") as f: for line in f.readlines(): - unique_lines.add(line) + unique_lines.add(line) for line in unique_lines: if "_ROM_START" in line or "_ROM_END" in line: @@ -117,9 +115,10 @@ def read_symbol_addrs(): else: dead_symbols.append([name, int(addr, 0), type, rom, opts]) + def read_elf(): try: - result = subprocess.run(['mips-linux-gnu-objdump', '-x', elf_path], stdout=subprocess.PIPE) + result = subprocess.run(["mips-linux-gnu-objdump", "-x", elf_path], stdout=subprocess.PIPE) objdump_lines = result.stdout.decode().split("\n") except: print(f"Error: Could not run objdump on {elf_path} - make sure that the project is built") @@ -133,13 +132,15 @@ def read_elf(): if "_ROM_START" in name or "_ROM_END" in name: continue - if "/" in name or \ - "." in name or \ - name in ignores or \ - name.startswith("_") or \ - name.startswith("jtbl_") or \ - name.endswith(".o") or \ - re.match(r"L[0-9A-F]{8}", name): + if ( + "/" in name + or "." in name + or name in ignores + or name.startswith("_") + or name.startswith("jtbl_") + or name.endswith(".o") + or re.match(r"L[0-9A-F]{8}", name) + ): continue addr = int(components[0], 16) @@ -153,14 +154,16 @@ def read_elf(): if name in map_symbols: rom = map_symbols[name][0] elif re.match(".*_[0-9A-F]{8}_[0-9A-F]{6}", name): - rom = int(name.split('_')[-1], 16) + rom = int(name.split("_")[-1], 16) elf_symbols.append((name, addr, type, rom)) + def log(s): if verbose: print(s) + def reconcile_symbols(): print(f"Processing {str(len(elf_symbols))} elf symbols...") @@ -175,7 +178,9 @@ def reconcile_symbols(): name_match = known_sym if elf_sym[1] != known_sym[1]: - log(f"Ram mismatch! {elf_sym[0]} is 0x{elf_sym[1]:X} in the elf and 0x{known_sym[1]} in symbol_addrs") + log( + f"Ram mismatch! {elf_sym[0]} is 0x{elf_sym[1]:X} in the elf and 0x{known_sym[1]} in symbol_addrs" + ) # Rom if not rom_match: @@ -186,7 +191,15 @@ def reconcile_symbols(): if not name_match and not rom_match: log(f"Creating new symbol {elf_sym[0]}") - symbol_addrs.append([elf_sym[0], elf_sym[1], elf_sym[2], elf_sym[3] if elf_sym[3] else -1, []]) + symbol_addrs.append( + [ + elf_sym[0], + elf_sym[1], + elf_sym[2], + elf_sym[3] if elf_sym[3] else -1, + [], + ] + ) elif not name_match: log(f"Renaming identical rom address symbol {rom_match[0]} to {elf_sym[0]}") rom_match[0] = elf_sym[0] @@ -197,6 +210,7 @@ def reconcile_symbols(): log(f"Adding rom address {elf_sym[3]} to symbol {name_match[0]}") name_match[3] = elf_sym[3] + def write_new_symbol_addrs(): with open(symbol_addrs_path, "w", newline="\n") as f: for symbol in sorted(symbol_addrs, key=lambda x: (x[3] == -1, x[3], x[1], x[0])): @@ -220,6 +234,7 @@ def write_new_symbol_addrs(): line += f" {thing}" f.write(line + "\n") + read_ignores() scan_map() read_symbol_addrs() diff --git a/tools/warnings_count/compare_warnings.py b/tools/warnings_count/compare_warnings.py index e6640f45255..cfd2008e9d8 100755 --- a/tools/warnings_count/compare_warnings.py +++ b/tools/warnings_count/compare_warnings.py @@ -11,8 +11,14 @@ def countFileLines(filename: str) -> int: def main(): parser = argparse.ArgumentParser() - parser.add_argument('currentwarnings', help="Name of file which contains the current warnings of the repo.") - parser.add_argument('newwarnings', help="Name of file which contains the *new* warnings of the repo.") + parser.add_argument( + "currentwarnings", + help="Name of file which contains the current warnings of the repo.", + ) + parser.add_argument( + "newwarnings", + help="Name of file which contains the *new* warnings of the repo.", + ) parser.add_argument("--pr-message", action="store_true") args = parser.parse_args()