Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

d_a_obj_tumble_weed mostly done #88

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove cM::calcTimer
elijah-thomas774 committed Nov 3, 2024
commit b97f0a561dc0398eabce40ff8bc4b404d9c126ba
2 changes: 1 addition & 1 deletion config/SOUE01/rels/d_t_gekotagNP/symbols.txt
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ initializeState_Wait__10dTgGekoTagFv = .text:0x00000660; // type:function size:0
executeState_Wait__10dTgGekoTagFv = .text:0x00000670; // type:function size:0x4
finalizeState_Wait__10dTgGekoTagFv = .text:0x00000680; // type:function size:0x4
doExecute__10dTgGekoTagFv = .text:0x00000690; // type:function size:0x1A8
calcTimer<Us>__2cMFPUs_Us = .text:0x00000840; // type:function size:0x1C
calcTimer<Us>__4sLibFPUs_Us = .text:0x00000840; // type:function size:0x1C
__dt__10dTgGekoTagFv = .text:0x00000860; // type:function size:0xE0
getStateID__79sStateMgr_c<10dTgGekoTag,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00000940; // type:function size:0x10
build__26sFStateFct_c<10dTgGekoTag>FRC12sStateIDIf_c = .text:0x00000950; // type:function size:0x60
2 changes: 1 addition & 1 deletion config/SOUE01/rels/d_t_touchNP/symbols.txt
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ executeState__80sStateMgr_c<11dTgTouchTag,20sStateMethodUsr_FI_c,12sFStateFct_c,
draw__11dTgTouchTagFv = .text:0x00000590; // type:function size:0x8
initializeState_Wait__11dTgTouchTagFv = .text:0x000005A0; // type:function size:0xC
executeState_Wait__11dTgTouchTagFv = .text:0x000005B0; // type:function size:0x138
calcTimer<Us>__2cMFPUs_Us = .text:0x000006F0; // type:function size:0x1C
calcTimer<Us>__4sLibFPUs_Us = .text:0x000006F0; // type:function size:0x1C
finalizeState_Wait__11dTgTouchTagFv = .text:0x00000710; // type:function size:0x4
__dt__11dTgTouchTagFv = .text:0x00000720; // type:function size:0xC8
getStateID__80sStateMgr_c<11dTgTouchTag,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x000007F0; // type:function size:0x10
2 changes: 1 addition & 1 deletion config/SOUE01/rels/d_t_tumble_weedNP/symbols.txt
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ changeState__84sStateMgr_c<15dTgTumbleWeed_c,20sStateMethodUsr_FI_c,12sFStateFct
doDelete__15dTgTumbleWeed_cFv = .text:0x00000490; // type:function size:0x8
actorExecute__15dTgTumbleWeed_cFv = .text:0x000004A0; // type:function size:0x48
executeState__84sStateMgr_c<15dTgTumbleWeed_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x000004F0; // type:function size:0x10
decr__FPUs = .text:0x00000500; // type:function size:0x1C
calcTimer<Us>__4sLibFPUs_Us = .text:0x00000500; // type:function size:0x1C
draw__15dTgTumbleWeed_cFv = .text:0x00000520; // type:function size:0x8
initializeState_AreaOut__15dTgTumbleWeed_cFv = .text:0x00000530; // type:function size:0x4
executeState_AreaOut__15dTgTumbleWeed_cFv = .text:0x00000540; // type:function size:0xA0
4 changes: 2 additions & 2 deletions config/SOUE01/symbols.txt
Original file line number Diff line number Diff line change
@@ -1418,13 +1418,13 @@ fn_80037A30 = .text:0x80037A30; // type:function size:0xCC
fn_80037B00 = .text:0x80037B00; // type:function size:0x20
fn_80037B20 = .text:0x80037B20; // type:function size:0x4C
fn_80037B70 = .text:0x80037B70; // type:function size:0x1D4
calcTimer<Us>__2cMFPUs_Us = .text:0x80037D50; // type:function size:0x1C
calcTimer<Us>__4sLibFPUs_Us = .text:0x80037D50; // type:function size:0x1C
fn_80037D70 = .text:0x80037D70; // type:function size:0x158
fn_80037ED0 = .text:0x80037ED0; // type:function size:0x14
fn_80037EF0 = .text:0x80037EF0; // type:function size:0xA4
fn_80037FA0 = .text:0x80037FA0; // type:function size:0x220
fn_800381C0 = .text:0x800381C0; // type:function size:0x2F0
calcTimer<Uc>__2cMFPUc_Uc = .text:0x800384B0; // type:function size:0x1C
calcTimer<Uc>__4sLibFPUc_Uc = .text:0x800384B0; // type:function size:0x1C
fn_800384D0 = .text:0x800384D0; // type:function size:0x64
fn_80038540 = .text:0x80038540; // type:function size:0x108
fn_80038650 = .text:0x80038650; // type:function size:0x144
8 changes: 0 additions & 8 deletions include/c/c_math.h
Original file line number Diff line number Diff line change
@@ -11,14 +11,6 @@ int rndInt(int max);
f32 rndF(f32 max);
f32 rndFX(f32 amp);

template <typename T>
T calcTimer(T *value) {
if (*(T *)value != 0) {
*value = *value - 1;
}
return *value;
}

} // namespace cM

#endif
7 changes: 3 additions & 4 deletions src/REL/d/t/d_t_gekotag.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#include "d/t/d_t_gekotag.h"

#include "c/c_math.h"
#include "common.h"
#include "d/a/d_a_player.h"
#include "d/a/e/d_a_e_geko.h"
#include "d/a/obj/d_a_obj_base.h"
#include "f/f_base.h"
#include "f/f_profile_name.h"
#include "m/m_angle.h"
#include "s/s_Math.h"

#pragma explicit_zero_data on
static u32 initialRotX = 0;
@@ -60,8 +59,8 @@ void dTgGekoTag::executeState_Wait() {
void dTgGekoTag::finalizeState_Wait() {}

void dTgGekoTag::doExecute() {
cM::calcTimer(&mTimer2);
if (cM::calcTimer(&mTimer1) != 0) {
sLib::calcTimer(&mTimer2);
if (sLib::calcTimer(&mTimer1) != 0) {
return;
}

6 changes: 3 additions & 3 deletions src/REL/d/t/d_t_touch.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "d/t/d_t_touch.h"

#include "c/c_math.h"
#include "toBeSorted/area_math.h"
#include "d/flag/sceneflag_manager.h"

#include "s/s_Math.h"
#include "toBeSorted/area_math.h"

SPECIAL_ACTOR_PROFILE(TOUCH_TAG, dTgTouchTag, fProfile::TOUCH_TAG, 0x028E, 0, 0);

@@ -59,7 +59,7 @@ void dTgTouchTag::executeState_Wait() {
actor = static_cast<dAcBase_c *>(fManager_c::searchBaseByProfName(ACTIVATORS[mActivatorIndex], actor));
}

if (cM::calcTimer(&mFlagTimer) == 0) {
if (sLib::calcTimer(&mFlagTimer) == 0) {
if (mZoneFlag != 0xFF && SceneflagManager::sInstance->checkBoolFlag(roomid, mZoneFlag)) {
SceneflagManager::sInstance->unsetFlag(roomid, mZoneFlag);
}
18 changes: 5 additions & 13 deletions src/REL/d/t/d_t_tumble_weed.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#include "d/t/d_t_tumble_weed.h"

#include "c/c_math.h"
#include "m/m_vec.h"
#include "s/s_Math.h"


SPECIAL_ACTOR_PROFILE(TUMBLE_WEED_TAG, dTgTumbleWeed_c, fProfile::TUMBLE_WEED_TAG, 0x0244, 0, 0);

@@ -16,32 +17,23 @@ int dTgTumbleWeed_c::create() {
return SUCCEEDED;
}

u16 decr(u16 *num);

int dTgTumbleWeed_c::doDelete() {
return SUCCEEDED;
}

int dTgTumbleWeed_c::actorExecute() {
mStateMgr.executeState();
decr(&tumbleweedTimer);
sLib::calcTimer(&tumbleweedTimer);
return SUCCEEDED;
}

u16 decr(u16 *num) {
if (*num != 0) {
(*num)--;
}
return *num;
}

int dTgTumbleWeed_c::draw() {
return SUCCEEDED;
}

void dTgTumbleWeed_c::initializeState_AreaOut() {}
void dTgTumbleWeed_c::executeState_AreaOut() {
if (decr(&windTimer) == 0) {
if (sLib::calcTimer(&windTimer) == 0) {
windTimer = 0x96;
if (shouldDoWind()) {
mStateMgr.changeState(StateID_Wind);
@@ -62,7 +54,7 @@ void dTgTumbleWeed_c::executeState_AreaIn() {
}
tumbleweedTimer = 600;
}
if (decr(&windTimer) == 0) {
if (sLib::calcTimer(&windTimer) == 0) {
windTimer = 0x96;
if (shouldDoWind()) {
mStateMgr.changeState(StateID_Wind);
5 changes: 2 additions & 3 deletions src/d/a/obj/d_a_obj_switch.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#include "d/a/obj/d_a_obj_switch.h"

#include "c/c_math.h"
#include "d/a/d_a_player.h"
#include "d/col/bg/d_bg_s.h"
#include "d/col/bg/d_bg_w.h"
#include "d/flag/sceneflag_manager.h"
#include "nw4r/g3d/g3d_resfile.h"
#include "s/s_Math.h"
#include "d/flag/sceneflag_manager.h"

SPECIAL_ACTOR_PROFILE(OBJ_SW, dAcOsw_c, fProfile::OBJ_SW, 0x12B, 0, 0x1002);

@@ -269,7 +268,7 @@ void dAcOsw_c::executeState_OffWait() {
if (field_0x5F1 != 0) {
field_0x5F3 = 1;
}
if (mSwitchType != 1 && cM::calcTimer(&field_0x5EC) == 0 && field_0x5F3 == 0) {
if (mSwitchType != 1 && sLib::calcTimer(&field_0x5EC) == 0 && field_0x5F3 == 0) {
mStateMgr.changeState(StateID_Off);
}
}
8 changes: 4 additions & 4 deletions src/d/tg/d_t_switch.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "d/t/d_t_switch.h"

#include "c/c_math.h"
#include "toBeSorted/event.h"
#include "d/flag/sceneflag_manager.h"
#include "s/s_Math.h"
#include "toBeSorted/event.h"
#include "toBeSorted/scgame.h"


@@ -144,7 +144,7 @@ void dTgSw_c::initializeState_On() {
mTimer = 4;
}
void dTgSw_c::executeState_On() {
if (cM::calcTimer(&mTimer) == 0) {
if (sLib::calcTimer(&mTimer) == 0) {
mStateMgr.changeState(StateID_OffWait);
}
}
@@ -173,7 +173,7 @@ void dTgSw_c::executeState_Off() {
mActorEvent.scheduleEvent(event, 0);
return;
}
if (cM::calcTimer(&mTimer) == 0) {
if (sLib::calcTimer(&mTimer) == 0) {
if (mThird2 == 1) {
resetAllSwitches();
} else if (mThird2 != 2) {