Skip to content

Commit

Permalink
The SceneObj based WaterRiseSwitch
Browse files Browse the repository at this point in the history
  • Loading branch information
Evanbowl committed May 31, 2024
1 parent 9251841 commit 535a50b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
8 changes: 4 additions & 4 deletions PTD/MinorPatches/source/MinorPatches.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace pt {

kmCall(0x800413F0, getErrorMessage); // MR::getGameMessageDirect will return the error message instead of NULL

extern void* loadArcAndFile(const char *pArc, const char *pFile);
extern void* loadArcAndFile(const char* pArc, const char* pFile);
void* loadPTPictureFont() {
return pt::loadArcAndFile("/SystemData/PictureFont.arc", "/PictureFont.brfnt");
}
Expand All @@ -59,8 +59,8 @@ namespace pt {

ResTIMG* CustomFlagTextures(LiveActor* pActor, const char* pStr, const JMapInfoIter& rIter) {
s32 flagTex = 0;
char* outArcStr = new char[24];
char* outTexStr = new char[24];
char outArcStr[24];
char outTexStr[24];
MR::getJMapInfoArg0NoInit(rIter, &flagTex);

snprintf(outArcStr, 24, "%s.arc", pStr);
Expand Down Expand Up @@ -109,7 +109,7 @@ namespace pt {
const char* YesNoDialogueExtensions(const TalkMessageCtrl* msg) {
u16 selectTxt = ((u16*)msg->mTalkNodeCtrl->getNextNodeBranch())[4];

char* str = new char[5];
char str[5];
sprintf(str, "New%d", selectTxt - 18);

return selectTxt < 18 ? msg->getBranchID() : str;
Expand Down
14 changes: 6 additions & 8 deletions PTD/WaterRiseSwitch/source/WaterRiseSwitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,24 @@

void joinRailMoveWaterObjs(RailMoveObj* pActor, const JMapInfoIter& rIter) {
pActor->RailMoveObj::init(rIter);
ModelObj* pObj = MR::createIndirectModel(pActor, pActor->getBaseMtx());
asm("stw %0, 0xE0(%1)" : "=r" (pObj) : "=r" (pActor));

s32 group = -1;
MR::getJMapInfoArg3NoInit(rIter, &group);
if (MR::isExistSceneObj(EXT_SCENE_OBJ_WATER_RISE_HOLDER))
if (MR::isExistSceneObj(EXT_SCENE_OBJ_WATER_RISE_HOLDER)) {
pt::getWaterRiseHolder()->mGroups[group]->registerActor(pActor);
OSReport("Yes %s %d %d\n", pt::getWaterRiseHolder()->mGroups[group]->mName, group, pt::getWaterRiseHolder()->mGroups[group]->mNumObjs);
}
}

//kmCall(0x802EA380, joinRailMoveWaterObjs);
//kmWrite32(0x802EA384, 0x4E800020);
kmCall(0x802EA394, joinRailMoveWaterObjs);

namespace pt {
extern void clampS32(s32 min, s32 max, s32* val);

WaterRiseHolder::WaterRiseHolder(const char* pName) : NameObj(pName) {
for (s32 i = 0; i < 4; i++) {
char str[17];
snprintf(str, 17, "WaterRiseGroup%d", i);
char str[16];
snprintf(str, 16, "WaterRiseGroup%d", i);
mGroups[i] = new LiveActorGroup(str, 16);
}
}
Expand Down Expand Up @@ -82,7 +81,6 @@ namespace pt {
MR::addHitSensorMapObj(this, "WaterRise", 8, 10.0f, TVec3f(0));
MR::validateHitSensor(getSensor("WaterRise"));
makeActorAppeared();
OSReport("%d\n", getWaterRiseHolder()->mGroups[mWaterRiseGroup]->mNumObjs);
}

void WaterRiseSwitch::attackSensor(HitSensor *pReceiver, HitSensor *pSender) {
Expand Down

0 comments on commit 535a50b

Please sign in to comment.