mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-04 15:04:31 +00:00
Improve PHYSICAL/VIRTUAL macros and match Interface_LoadActionLabel (#371)
This commit is contained in:
parent
b4ac94a8fd
commit
b8da64ee01
12 changed files with 22 additions and 133 deletions
|
@ -805,7 +805,7 @@ void Actor_SetScale(Actor* actor, f32 scale) {
|
|||
}
|
||||
|
||||
void Actor_SetObjectDependency(GlobalContext* globalCtx, Actor* actor) {
|
||||
gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[actor->objBankIndex].segment);
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[actor->objBankIndex].segment);
|
||||
}
|
||||
|
||||
void Actor_Init(Actor* actor, GlobalContext* globalCtx) {
|
||||
|
|
|
@ -2055,8 +2055,6 @@ void func_80086D5C(s32* buf, u16 size) {
|
|||
|
||||
u32 sDoActionTextures[] = { 0x07000000, 0x07000180 };
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// 0x80000000 is reused in the 2 *_TO_VIRTUAL macros when it shouldn't
|
||||
void Interface_LoadActionLabel(InterfaceContext* interfaceCtx, u16 action, s16 arg2) {
|
||||
if (action >= 0x1D) {
|
||||
action = 0x0A;
|
||||
|
@ -2077,14 +2075,10 @@ void Interface_LoadActionLabel(InterfaceContext* interfaceCtx, u16 action, s16 a
|
|||
&interfaceCtx->loadQueue, NULL, "../z_parameter.c", 2145);
|
||||
osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK);
|
||||
} else {
|
||||
gSegments[7] = PHYSICAL_TO_VIRTUAL(interfaceCtx->do_actionSegment);
|
||||
gSegments[7] = VIRTUAL_TO_PHYSICAL(interfaceCtx->do_actionSegment);
|
||||
func_80086D5C(SEGMENTED_TO_VIRTUAL(sDoActionTextures[arg2]), 0x180 / 4);
|
||||
}
|
||||
}
|
||||
#else
|
||||
void Interface_LoadActionLabel(InterfaceContext* interfaceCtx, u16 action, s16 arg2);
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Interface_LoadActionLabel.s")
|
||||
#endif
|
||||
|
||||
void Interface_SetDoAction(GlobalContext* globalCtx, u16 action) {
|
||||
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
|
||||
|
|
|
@ -453,9 +453,9 @@ void Gameplay_Update(GlobalContext* globalCtx) {
|
|||
ActorOverlayTable_LogPrint();
|
||||
}
|
||||
|
||||
gSegments[4] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[globalCtx->objectCtx.mainKeepIndex].segment);
|
||||
gSegments[5] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment);
|
||||
gSegments[2] = PHYSICAL_TO_VIRTUAL(globalCtx->sceneSegment);
|
||||
gSegments[4] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[globalCtx->objectCtx.mainKeepIndex].segment);
|
||||
gSegments[5] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment);
|
||||
gSegments[2] = VIRTUAL_TO_PHYSICAL(globalCtx->sceneSegment);
|
||||
|
||||
if (func_8008E6AC(&globalCtx->sub_7B8, &input[1]) != 0) {
|
||||
if ((globalCtx->transitionMode == 0) && (globalCtx->sceneLoadFlag != 0)) {
|
||||
|
@ -1076,9 +1076,9 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
|
|||
|
||||
OPEN_DISPS(gfxCtx, "../z_play.c", 3907);
|
||||
|
||||
gSegments[4] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[globalCtx->objectCtx.mainKeepIndex].segment);
|
||||
gSegments[5] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment);
|
||||
gSegments[2] = PHYSICAL_TO_VIRTUAL(globalCtx->sceneSegment);
|
||||
gSegments[4] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[globalCtx->objectCtx.mainKeepIndex].segment);
|
||||
gSegments[5] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment);
|
||||
gSegments[2] = VIRTUAL_TO_PHYSICAL(globalCtx->sceneSegment);
|
||||
|
||||
gSPSegment(oGfxCtx->polyOpa.p++, 0x00, NULL);
|
||||
gSPSegment(oGfxCtx->polyXlu.p++, 0x00, NULL);
|
||||
|
@ -1491,7 +1491,7 @@ void Gameplay_SpawnScene(GlobalContext* globalCtx, s32 sceneNum, s32 spawn) {
|
|||
if (globalCtx->sceneSegment == NULL) {
|
||||
__assert("this->sceneSegment != NULL", "../z_play.c", 4960);
|
||||
}
|
||||
gSegments[2] = PHYSICAL_TO_VIRTUAL(globalCtx->sceneSegment);
|
||||
gSegments[2] = VIRTUAL_TO_PHYSICAL(globalCtx->sceneSegment);
|
||||
|
||||
Gameplay_InitScene(globalCtx, spawn);
|
||||
|
||||
|
|
|
@ -509,7 +509,7 @@ void func_800907E4(GlobalContext* globalCtx, Player* player, Vec3f* arg2, s32 ar
|
|||
|
||||
sp4C = (player->exchangeItemId != 0) ? 6.0f : 14.0f;
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 0x961);
|
||||
gSegments[6] = PHYSICAL_TO_VIRTUAL(player->getItemModel);
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(player->getItemModel);
|
||||
|
||||
gSPSegment(oGfxCtx->polyOpa.p++, 0x06, player->getItemModel);
|
||||
gSPSegment(oGfxCtx->polyXlu.p++, 0x06, player->getItemModel);
|
||||
|
|
|
@ -596,7 +596,7 @@ s32 func_800973FC(GlobalContext* globalCtx, RoomContext* roomCtx) {
|
|||
if (!osRecvMesg(&roomCtx->loadQueue, NULL, OS_MESG_NOBLOCK)) {
|
||||
roomCtx->status = 0;
|
||||
roomCtx->curRoom.segment = roomCtx->unk_34;
|
||||
gSegments[3] = PHYSICAL_TO_VIRTUAL2(roomCtx->unk_34);
|
||||
gSegments[3] = VIRTUAL_TO_PHYSICAL(roomCtx->unk_34);
|
||||
|
||||
Scene_ExecuteCommands(globalCtx, roomCtx->curRoom.segment);
|
||||
func_8008E750(globalCtx, PLAYER);
|
||||
|
@ -613,7 +613,7 @@ s32 func_800973FC(GlobalContext* globalCtx, RoomContext* roomCtx) {
|
|||
|
||||
void Room_Draw(GlobalContext* globalCtx, Room* room, u32 flags) {
|
||||
if (room->segment != NULL) {
|
||||
gSegments[3] = PHYSICAL_TO_VIRTUAL(room->segment);
|
||||
gSegments[3] = VIRTUAL_TO_PHYSICAL(room->segment);
|
||||
if (room->mesh->polygon.type >= ARRAY_COUNTU(sRoomDrawHandlers)) {
|
||||
__assert("this->ground_shape->polygon.type < number(Room_Draw_Proc)", "../z_room.c", 1125);
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ void Object_InitBank(GlobalContext* globalCtx, ObjectContext* objectCtx) {
|
|||
objectCtx->spaceEnd = (void*)((s32)objectCtx->spaceStart + spaceSize);
|
||||
|
||||
objectCtx->mainKeepIndex = Object_Spawn(objectCtx, OBJECT_GAMEPLAY_KEEP);
|
||||
gSegments[4] = PHYSICAL_TO_VIRTUAL(objectCtx->status[objectCtx->mainKeepIndex].segment);
|
||||
gSegments[4] = VIRTUAL_TO_PHYSICAL(objectCtx->status[objectCtx->mainKeepIndex].segment);
|
||||
}
|
||||
|
||||
void Object_UpdateBank(ObjectContext* objectCtx) {
|
||||
|
@ -255,7 +255,7 @@ void func_800987F8(GlobalContext* globalCtx, SceneCmd* cmd) {
|
|||
void func_8009883C(GlobalContext* globalCtx, SceneCmd* cmd) {
|
||||
if (cmd->specialFiles.keepObjectId != 0) {
|
||||
globalCtx->objectCtx.subKeepIndex = Object_Spawn(&globalCtx->objectCtx, cmd->specialFiles.keepObjectId);
|
||||
gSegments[5] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment);
|
||||
gSegments[5] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment);
|
||||
}
|
||||
|
||||
if (cmd->specialFiles.cUpElfMsgNum != 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue