diff options
| author | Tharo <17233964+Thar0@users.noreply.github.com> | 2024-08-14 20:29:43 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-14 21:29:43 +0200 |
| commit | eaf955ad22ad7252e93c9f1429efeae897400d2b (patch) | |
| tree | 8b1445f9b185718b5d48966c4e22110f1c5be770 /src/code | |
| parent | 137e0d2a10fa5ff4d115d1105846e4da1dc58d56 (diff) | |
Generic actor params getters (#1359)
* Initial PARAMS_GET macros
* NOSHIFT macro
* Use number of bits rather than raw mask values
* Add descriptions for each generic macro
* Reformat
* Adjust comment
* format
* edit en_door macro names
* edit redead macro name
* edit bdan switch macro name, and remove unneeded comments in go2
* mizushutter macro names
* remove PARAMS_GET_S, rework ishi switch flag handling
* actually remove PARAMS_GET_S
* remove PARAMS_GET2_S
* PARAMS_GET_U and PARAMS_GET_S
* format
* fix merge
* format
---------
Co-authored-by: fig02 <fig02srl@gmail.com>
Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/z_en_a_keep.c | 2 | ||||
| -rw-r--r-- | src/code/z_en_item00.c | 4 | ||||
| -rw-r--r-- | src/code/z_play.c | 2 | ||||
| -rw-r--r-- | src/code/z_room.c | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/src/code/z_en_a_keep.c b/src/code/z_en_a_keep.c index 57799c22e..37c5abcf2 100644 --- a/src/code/z_en_a_keep.c +++ b/src/code/z_en_a_keep.c @@ -80,7 +80,7 @@ void EnAObj_Init(Actor* thisx, PlayState* play) { EnAObj* this = (EnAObj*)thisx; f32 shadowScale = 6.0f; - this->textId = (thisx->params >> 8) & 0xFF; + this->textId = PARAMS_GET_U(thisx->params, 8, 8); thisx->params &= 0xFF; switch (thisx->params) { diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index 7306c4689..a009c7cfc 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -142,10 +142,10 @@ void EnItem00_Init(Actor* thisx, PlayState* play) { f32 yOffset = 980.0f; f32 shadowScale = 6.0f; s32 getItemId = GI_NONE; - s16 spawnParam8000 = this->actor.params & 0x8000; + s16 spawnParam8000 = PARAMS_GET_NOSHIFT(this->actor.params, 15, 1); s32 pad1; - this->collectibleFlag = (this->actor.params & 0x3F00) >> 8; + this->collectibleFlag = PARAMS_GET_S(this->actor.params, 8, 6); this->actor.params &= 0xFF; diff --git a/src/code/z_play.c b/src/code/z_play.c index e211862d6..7ebb6ccea 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -443,7 +443,7 @@ void Play_Init(GameState* thisx) { Camera_InitDataUsingPlayer(&this->mainCamera, player); Camera_RequestMode(&this->mainCamera, CAM_MODE_NORMAL); - playerStartBgCamIndex = player->actor.params & 0xFF; + playerStartBgCamIndex = PARAMS_GET_U(player->actor.params, 0, 8); if (playerStartBgCamIndex != 0xFF) { PRINTF("player has start camera ID (" VT_FGCOL(BLUE) "%d" VT_RST ")\n", playerStartBgCamIndex); Camera_RequestBgCam(&this->mainCamera, playerStartBgCamIndex); diff --git a/src/code/z_room.c b/src/code/z_room.c index cb3b624ac..3093d4e68 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -429,7 +429,7 @@ RoomShapeImageMultiBgEntry* Room_GetImageMultiBgEntry(RoomShapeImageMulti* roomS } player = GET_PLAYER(play); - player->actor.params = (player->actor.params & 0xFF00) | bgCamIndex; + player->actor.params = PARAMS_GET_NOSHIFT(player->actor.params, 8, 8) | bgCamIndex; bgEntry = SEGMENTED_TO_VIRTUAL(roomShapeImageMulti->backgrounds); for (i = 0; i < roomShapeImageMulti->numBackgrounds; i++) { |
