-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Initial attempt * Fix symbols for renamed story/itemflagMgrs * Improvements xD * OK with pragma * Update variable name
- Loading branch information
Showing
15 changed files
with
161 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,48 @@ | ||
#ifndef D_T_SW_AREA_H | ||
#define D_T_SW_AREA_H | ||
|
||
#include "d/a/d_a_base.h" | ||
#include "d/t/d_tg.h" | ||
#include "m/m_mtx.h" | ||
|
||
class dTgSwArea_c : public dAcBase_c { | ||
class dTgSwArea_c : public dTg_c { | ||
public: | ||
dTgSwArea_c() {} | ||
virtual ~dTgSwArea_c() {} | ||
|
||
virtual int create() override; | ||
virtual int actorExecute() override; | ||
|
||
private: | ||
u8 getSetSceneflag() { | ||
return params; | ||
} | ||
|
||
u8 getUnsetSceneflag() { | ||
return params >> 0x8; | ||
} | ||
|
||
u8 getIsPersistent() { | ||
return params >> 0x10 & 1; | ||
} | ||
|
||
mAng getSetStoryflag() { | ||
return rotation.x & 0x7FF; | ||
} | ||
|
||
mAng getUnsetStoryflag() { | ||
return rotation.z & 0x7FF; | ||
} | ||
|
||
mMtx_c area; | ||
u8 setSceneflag; | ||
u8 unsetSceneflag; | ||
bool isTemporary; | ||
f32 scale; | ||
u16 setStoryflag; | ||
u16 unsetStoryflag; | ||
|
||
static u32 sDefaultRotX; | ||
static u32 sDefaultRotZ; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,79 @@ | ||
#include "d/t/d_t_sw_area.h" | ||
#include "d/a/d_a_player.h" | ||
#include "toBeSorted/area_math.h" | ||
#include "toBeSorted/sceneflag_manager.h" | ||
#include "toBeSorted/item_story_flag_manager.h" | ||
|
||
SPECIAL_ACTOR_PROFILE(SW_AREA_TAG, dTgSwArea_c, fProfile::SW_AREA_TAG, 0x292, 0, 0); | ||
|
||
// sDefaultRotX got placed in .data despite being zero. | ||
// There is a handy pragma for this but it's probably not | ||
// the correct solution. | ||
#pragma explicit_zero_data on | ||
u32 dTgSwArea_c::sDefaultRotX = 0; | ||
u32 dTgSwArea_c::sDefaultRotZ = 0; | ||
#pragma explicit_zero_data off | ||
|
||
int dTgSwArea_c::create() { | ||
setSceneflag = getSetSceneflag(); | ||
unsetSceneflag = getUnsetSceneflag(); | ||
isTemporary = !getIsPersistent(); | ||
|
||
setStoryflag = getSetStoryflag(); | ||
unsetStoryflag = getUnsetStoryflag(); | ||
rotation.x = sDefaultRotX; | ||
rotation.z = sDefaultRotZ; | ||
|
||
matrixCreateFromPosRotYScale(area, position, rotation.y, mScale, nullptr, 0.0f); | ||
return SUCCEEDED; | ||
} | ||
|
||
bool isValidStoryFlag(u16 storyflag) { | ||
bool valid = false; | ||
|
||
if (storyflag != 0 && storyflag < 0x7FF) { | ||
valid = true; | ||
} | ||
|
||
return valid; | ||
} | ||
|
||
int dTgSwArea_c::actorExecute() { | ||
if (checkIfVec3fInMatrix(area, dAcPy_c::LINK->position)) { | ||
SceneflagManager::sInstance->setFlag(roomid, setSceneflag); | ||
SceneflagManager::sInstance->unsetFlag(roomid, unsetSceneflag); | ||
|
||
if (isValidStoryFlag(setStoryflag)) { | ||
StoryflagManager::sInstance->setFlag(setStoryflag); | ||
} | ||
|
||
if (isValidStoryFlag(unsetStoryflag)) { | ||
StoryflagManager::sInstance->unsetFlag(unsetStoryflag); | ||
} | ||
|
||
if (scale < 1.0f) { | ||
scale = 50.0f; | ||
matrixCreateFromPosRotYScale(area, position, rotation.y, mScale, nullptr, scale); | ||
} | ||
} else { | ||
if (scale > 1.0f) { | ||
scale = 0.0f; | ||
matrixCreateFromPosRotYScale(area, position, rotation.y, mScale, nullptr, scale); | ||
} | ||
|
||
if (isTemporary) { | ||
SceneflagManager::sInstance->unsetFlag(roomid, setSceneflag); | ||
SceneflagManager::sInstance->setFlag(roomid, unsetSceneflag); | ||
|
||
if (isValidStoryFlag(setStoryflag)) { | ||
StoryflagManager::sInstance->unsetFlag(setStoryflag); | ||
} | ||
|
||
if (isValidStoryFlag(unsetStoryflag)) { | ||
StoryflagManager::sInstance->setFlag(unsetStoryflag); | ||
} | ||
} | ||
} | ||
|
||
return SUCCEEDED; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters