1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-06-08 17:41:56 +00:00

Documentation pass on scene/room commands (#1226)

* Rename handler functions

* Rename cmd_id enum names for consistency

* `char` -> `s8` for explicit padding in cmd structs

* `Room.unk03/03` -> `behaviorType2/1`

* `UNK_PTR` -> `void*`

* `showInvisActors` -> `lensActorsMode` + enum

* Add `ROOM_BEHAVIOR_TYPE1/2_` enums

* "mesh" -> "mesh header"

* `Polygon polygon` -> `PolygonBase base` (for now...)

* Misc cleanup

* "lens actors mode" -> "lens actor mode"

* Revert "`char` -> `s8` for explicit padding in cmd structs"

This reverts commit 59b9295828.

* `LENS_ACTOR_MODE_` -> `LENS_MODE_HIDE/SHOW_ACTORS`
This commit is contained in:
Dragorn421 2022-05-21 14:54:51 +02:00 committed by GitHub
parent 4f0018bf36
commit 154f44b6da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 144 additions and 124 deletions

View file

@ -796,13 +796,10 @@ typedef struct {
typedef struct {
/* 0x00 */ u8 type;
/* 0x01 */ u8 num; // number of dlist entries
/* 0x04 */ void* start;
/* 0x08 */ void* end;
} Polygon; // size = 0xC
} PolygonBase;
typedef struct {
/* 0x00 */ u8 type;
/* 0x00 */ PolygonBase base;
/* 0x01 */ u8 num; // number of dlist entries
/* 0x04 */ void* start;
/* 0x08 */ void* end;
@ -823,7 +820,7 @@ typedef struct {
} BgImage; // size = 0x1C
typedef struct {
/* 0x00 */ u8 type;
/* 0x00 */ PolygonBase base;
/* 0x01 */ u8 format; // 1 = single, 2 = multi
/* 0x04 */ Gfx* dlist;
union {
@ -853,27 +850,51 @@ typedef struct {
} PolygonDlist2; // size = 0x8
typedef struct {
/* 0x00 */ u8 type;
/* 0x00 */ PolygonBase base;
/* 0x01 */ u8 num; // number of dlist entries
/* 0x04 */ void* start;
/* 0x08 */ void* end;
} PolygonType2; // size = 0xC
typedef union {
Polygon polygon;
PolygonBase base;
PolygonType0 polygon0;
PolygonType1 polygon1;
PolygonType2 polygon2;
} Mesh; // "Ground Shape"
} MeshHeader; // "Ground Shape"
typedef enum {
/* 0 */ LENS_MODE_HIDE_ACTORS, // lens actors are visible by default, and hidden by using lens (for example, fake walls)
/* 1 */ LENS_MODE_SHOW_ACTORS // lens actors are invisible by default, and shown by using lens (for example, invisible enemies)
} LensMode;
typedef enum {
/* 0 */ ROOM_BEHAVIOR_TYPE1_0,
/* 1 */ ROOM_BEHAVIOR_TYPE1_1,
/* 2 */ ROOM_BEHAVIOR_TYPE1_2,
/* 3 */ ROOM_BEHAVIOR_TYPE1_3, // unused
/* 4 */ ROOM_BEHAVIOR_TYPE1_4, // unused
/* 5 */ ROOM_BEHAVIOR_TYPE1_5
} RoomBehaviorType1;
typedef enum {
/* 0 */ ROOM_BEHAVIOR_TYPE2_0,
/* 1 */ ROOM_BEHAVIOR_TYPE2_1,
/* 2 */ ROOM_BEHAVIOR_TYPE2_2,
/* 3 */ ROOM_BEHAVIOR_TYPE2_3,
/* 4 */ ROOM_BEHAVIOR_TYPE2_4,
/* 5 */ ROOM_BEHAVIOR_TYPE2_5,
/* 6 */ ROOM_BEHAVIOR_TYPE2_6
} RoomBehaviorType2;
typedef struct {
/* 0x00 */ s8 num;
/* 0x01 */ u8 unk_01;
/* 0x02 */ u8 unk_02;
/* 0x03 */ u8 unk_03;
/* 0x02 */ u8 behaviorType2;
/* 0x03 */ u8 behaviorType1;
/* 0x04 */ s8 echo;
/* 0x05 */ u8 showInvisActors;
/* 0x08 */ Mesh* mesh; // original name: "ground_shape"
/* 0x05 */ u8 lensMode;
/* 0x08 */ MeshHeader* meshHeader; // original name: "ground_shape"
/* 0x0C */ void* segment;
/* 0x10 */ char unk_10[0x4];
} Room; // size = 0x14
@ -1208,7 +1229,7 @@ typedef struct GlobalContext {
/* 0x11DF0 */ RomFile* roomList;
/* 0x11DF4 */ ActorEntry* linkActorEntry;
/* 0x11DF8 */ ActorEntry* setupActorList;
/* 0x11DFC */ UNK_PTR unk_11DFC;
/* 0x11DFC */ void* unk_11DFC;
/* 0x11E00 */ EntranceEntry* setupEntranceList;
/* 0x11E04 */ s16* setupExitList;
/* 0x11E08 */ Path* setupPathList;

View file

@ -343,20 +343,20 @@ typedef enum {
typedef enum {
/* 0x00 */ SCENE_CMD_ID_SPAWN_LIST,
/* 0x01 */ SCENE_CMD_ID_ACTOR_LIST,
/* 0x02 */ SCENE_CMD_ID_UNUSED_02,
/* 0x03 */ SCENE_CMD_ID_COL_HEADER,
/* 0x02 */ SCENE_CMD_ID_UNUSED_2,
/* 0x03 */ SCENE_CMD_ID_COLLISION_HEADER,
/* 0x04 */ SCENE_CMD_ID_ROOM_LIST,
/* 0x05 */ SCENE_CMD_ID_WIND_SETTINGS,
/* 0x06 */ SCENE_CMD_ID_ENTRANCE_LIST,
/* 0x07 */ SCENE_CMD_ID_SPECIAL_FILES,
/* 0x08 */ SCENE_CMD_ID_ROOM_BEHAVIOR,
/* 0x09 */ SCENE_CMD_ID_UNK_09,
/* 0x0A */ SCENE_CMD_ID_MESH,
/* 0x09 */ SCENE_CMD_ID_UNDEFINED_9,
/* 0x0A */ SCENE_CMD_ID_MESH_HEADER,
/* 0x0B */ SCENE_CMD_ID_OBJECT_LIST,
/* 0x0C */ SCENE_CMD_ID_LIGHT_LIST,
/* 0x0D */ SCENE_CMD_ID_PATH_LIST,
/* 0x0E */ SCENE_CMD_ID_TRANSI_ACTOR_LIST,
/* 0x0F */ SCENE_CMD_ID_ENV_LIGHT_SETTINGS,
/* 0x0E */ SCENE_CMD_ID_TRANSITION_ACTOR_LIST,
/* 0x0F */ SCENE_CMD_ID_LIGHT_SETTINGS_LIST,
/* 0x10 */ SCENE_CMD_ID_TIME_SETTINGS,
/* 0x11 */ SCENE_CMD_ID_SKYBOX_SETTINGS,
/* 0x12 */ SCENE_CMD_ID_SKYBOX_DISABLES,
@ -377,10 +377,10 @@ typedef enum {
{ SCENE_CMD_ID_ACTOR_LIST, numActors, CMD_PTR(actorList) }
#define SCENE_CMD_UNUSED_02(unk, data) \
{ SCENE_CMD_ID_UNUSED_02, unk, CMD_PTR(data) }
{ SCENE_CMD_ID_UNUSED_2, unk, CMD_PTR(data) }
#define SCENE_CMD_COL_HEADER(colHeader) \
{ SCENE_CMD_ID_COL_HEADER, 0, CMD_PTR(colHeader) }
{ SCENE_CMD_ID_COLLISION_HEADER, 0, CMD_PTR(colHeader) }
#define SCENE_CMD_ROOM_LIST(numRooms, roomList) \
{ SCENE_CMD_ID_ROOM_LIST, numRooms, CMD_PTR(roomList) }
@ -399,10 +399,10 @@ typedef enum {
curRoomUnk2 | _SHIFTL(showInvisActors, 8, 1) | _SHIFTL(disableWarpSongs, 10, 1) }
#define SCENE_CMD_UNK_09() \
{ SCENE_CMD_ID_UNK_09, 0, CMD_W(0) }
{ SCENE_CMD_ID_UNDEFINED_9, 0, CMD_W(0) }
#define SCENE_CMD_MESH(meshHeader) \
{ SCENE_CMD_ID_MESH, 0, CMD_PTR(meshHeader) }
{ SCENE_CMD_ID_MESH_HEADER, 0, CMD_PTR(meshHeader) }
#define SCENE_CMD_OBJECT_LIST(numObjects, objectList) \
{ SCENE_CMD_ID_OBJECT_LIST, numObjects, CMD_PTR(objectList) }
@ -414,10 +414,10 @@ typedef enum {
{ SCENE_CMD_ID_PATH_LIST, 0, CMD_PTR(pathList) }
#define SCENE_CMD_TRANSITION_ACTOR_LIST(numActors, list) \
{ SCENE_CMD_ID_TRANSI_ACTOR_LIST, numActors, CMD_PTR(list) }
{ SCENE_CMD_ID_TRANSITION_ACTOR_LIST, numActors, CMD_PTR(list) }
#define SCENE_CMD_ENV_LIGHT_SETTINGS(numLightSettings, lightSettingsList) \
{ SCENE_CMD_ID_ENV_LIGHT_SETTINGS, numLightSettings, CMD_PTR(lightSettingsList) }
{ SCENE_CMD_ID_LIGHT_SETTINGS_LIST, numLightSettings, CMD_PTR(lightSettingsList) }
#define SCENE_CMD_TIME_SETTINGS(hour, min, speed) \
{ SCENE_CMD_ID_TIME_SETTINGS, 0, CMD_BBBB(hour, min, speed, 0) }

View file

@ -1009,7 +1009,7 @@ void func_8002DE04(GlobalContext* globalCtx, Actor* actorA, Actor* actorB) {
}
void func_8002DE74(GlobalContext* globalCtx, Player* player) {
if ((globalCtx->roomCtx.curRoom.unk_03 != 4) && func_800C0CB8(globalCtx)) {
if ((globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_4) && func_800C0CB8(globalCtx)) {
Camera_ChangeSetting(Play_GetCamera(globalCtx, CAM_ID_MAIN), CAM_SET_HORSE);
}
}
@ -2289,7 +2289,7 @@ void Actor_DrawLensActors(GlobalContext* globalCtx, s32 numInvisibleActors, Acto
gDPPipeSync(POLY_XLU_DISP++);
if (globalCtx->roomCtx.curRoom.showInvisActors == 0) {
if (globalCtx->roomCtx.curRoom.lensMode == LENS_MODE_HIDE_ACTORS) {
// Update both the color frame buffer and the z-buffer
gDPSetOtherMode(POLY_XLU_DISP++,
G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE |
@ -2338,7 +2338,7 @@ void Actor_DrawLensActors(GlobalContext* globalCtx, s32 numInvisibleActors, Acto
// "Magic lens invisible Actor display END"
gDPNoOpString(POLY_OPA_DISP++, "魔法のメガネ 見えないc表示 END", numInvisibleActors);
if (globalCtx->roomCtx.curRoom.showInvisActors != 0) {
if (globalCtx->roomCtx.curRoom.lensMode != LENS_MODE_HIDE_ACTORS) {
// Draw the lens overlay to the color frame buffer
gDPNoOpString(POLY_OPA_DISP++, "青い眼鏡(外側)", 0); // "Blue spectacles (exterior)"
@ -2431,8 +2431,8 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) {
if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(71) == 0)) {
if ((actor->init == NULL) && (actor->draw != NULL) && (actor->flags & (ACTOR_FLAG_5 | ACTOR_FLAG_6))) {
if ((actor->flags & ACTOR_FLAG_7) &&
((globalCtx->roomCtx.curRoom.showInvisActors == 0) || globalCtx->actorCtx.lensActive ||
(actor->room != globalCtx->roomCtx.curRoom.num))) {
((globalCtx->roomCtx.curRoom.lensMode == LENS_MODE_HIDE_ACTORS) ||
globalCtx->actorCtx.lensActive || (actor->room != globalCtx->roomCtx.curRoom.num))) {
ASSERT(invisibleActorCounter < INVISIBLE_ACTOR_MAX,
"invisible_actor_counter < INVISIBLE_ACTOR_MAX", "../z_actor.c", 6464);
invisibleActors[invisibleActorCounter] = actor;

View file

@ -6929,19 +6929,20 @@ void func_80057FC4(Camera* camera) {
if (camera != &camera->globalCtx->mainCamera) {
camera->prevSetting = camera->setting = CAM_SET_FREE0;
camera->unk_14C &= ~0x4;
} else if (camera->globalCtx->roomCtx.curRoom.mesh->polygon.type != 1) {
switch (camera->globalCtx->roomCtx.curRoom.unk_03) {
case 1:
} else if (camera->globalCtx->roomCtx.curRoom.meshHeader->base.type != 1) {
switch (camera->globalCtx->roomCtx.curRoom.behaviorType1) {
case ROOM_BEHAVIOR_TYPE1_1:
Camera_ChangeDoorCam(camera, NULL, -99, 0, 0, 18, 10);
camera->prevSetting = camera->setting = CAM_SET_DUNGEON0;
break;
case 0:
case ROOM_BEHAVIOR_TYPE1_0:
osSyncPrintf("camera: room type: default set field\n");
Camera_ChangeDoorCam(camera, NULL, -99, 0, 0, 18, 10);
camera->prevSetting = camera->setting = CAM_SET_NORMAL0;
break;
default:
osSyncPrintf("camera: room type: default set etc (%d)\n", camera->globalCtx->roomCtx.curRoom.unk_03);
osSyncPrintf("camera: room type: default set etc (%d)\n",
camera->globalCtx->roomCtx.curRoom.behaviorType1);
Camera_ChangeDoorCam(camera, NULL, -99, 0, 0, 18, 10);
camera->prevSetting = camera->setting = CAM_SET_NORMAL0;
camera->unk_14C |= 4;
@ -7250,7 +7251,7 @@ s32 Camera_UpdateWater(Camera* camera) {
s32 Camera_UpdateHotRoom(Camera* camera) {
camera->distortionFlags &= ~DISTORTION_HOT_ROOM;
if (camera->globalCtx->roomCtx.curRoom.unk_02 == 3) {
if (camera->globalCtx->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) {
camera->distortionFlags |= DISTORTION_HOT_ROOM;
}
@ -7776,7 +7777,7 @@ s32 Camera_ChangeModeFlags(Camera* camera, s16 mode, u8 flags) {
func_80078884(0);
break;
case 2:
if (camera->globalCtx->roomCtx.curRoom.unk_03 == 1) {
if (camera->globalCtx->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_1) {
func_80078884(NA_SE_SY_ATTENTION_URGENCY);
} else {
func_80078884(NA_SE_SY_ATTENTION_ON);

View file

@ -2502,7 +2502,7 @@ void Environment_AdjustLights(GlobalContext* globalCtx, f32 arg1, f32 arg2, f32
f32 temp;
s32 i;
if (globalCtx->roomCtx.curRoom.unk_03 != 5 && func_800C0CB8(globalCtx)) {
if (globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_5 && func_800C0CB8(globalCtx)) {
arg1 = CLAMP_MIN(arg1, 0.0f);
arg1 = CLAMP_MAX(arg1, 1.0f);

View file

@ -612,7 +612,7 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) {
break;
}
if ((globalCtx->roomCtx.curRoom.unk_03 == 1) && (interfaceCtx->minimapAlpha >= 255)) {
if ((globalCtx->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_1) && (interfaceCtx->minimapAlpha >= 255)) {
interfaceCtx->minimapAlpha = 255;
}
}
@ -4173,7 +4173,8 @@ void Interface_Update(GlobalContext* globalCtx) {
gTimeSpeed = sPrevTimeSpeed;
globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04;
}
} else if ((globalCtx->roomCtx.curRoom.unk_03 != 1) && (interfaceCtx->restrictions.sunsSong != 3)) {
} else if ((globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_1) &&
(interfaceCtx->restrictions.sunsSong != 3)) {
if ((gSaveContext.dayTime >= CLOCK_TIME(6, 30)) && (gSaveContext.dayTime < CLOCK_TIME(18, 0) + 1)) {
gSaveContext.nextDayTime = NEXT_TIME_NIGHT;
globalCtx->transitionType = TRANS_TYPE_FADE_BLACK_FAST;

View file

@ -1808,7 +1808,7 @@ void Play_TriggerRespawn(GlobalContext* this) {
}
s32 func_800C0CB8(GlobalContext* this) {
return (this->roomCtx.curRoom.mesh->polygon.type != 1) && (YREG(15) != 0x20) && (YREG(15) != 0x30) &&
return (this->roomCtx.curRoom.meshHeader->base.type != 1) && (YREG(15) != 0x20) && (YREG(15) != 0x30) &&
(YREG(15) != 0x40) && (this->sceneNum != SCENE_HAIRAL_NIWA);
}

View file

@ -474,7 +474,7 @@ void Player_SetBootData(GlobalContext* globalCtx, Player* this) {
IREG(69) = bootRegs[15];
MREG(95) = bootRegs[16];
if (globalCtx->roomCtx.curRoom.unk_03 == 2) {
if (globalCtx->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_2) {
REG(45) = 500;
}
}
@ -775,7 +775,7 @@ s32 func_8008F2F8(GlobalContext* globalCtx) {
TextTriggerEntry* triggerEntry;
s32 var;
if (globalCtx->roomCtx.curRoom.unk_02 == 3) { // Room is hot
if (globalCtx->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) { // Room is hot
var = 0;
} else if ((this->unk_840 > 80) &&
((this->currentBoots == PLAYER_BOOTS_IRON) || (this->unk_840 >= 300))) { // Deep underwater

View file

@ -1012,7 +1012,7 @@ void func_80093C80(GlobalContext* globalCtx) {
func_80093D18(gfxCtx);
if (globalCtx->roomCtx.curRoom.unk_03 == 3) {
if (globalCtx->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_3) {
OPEN_DISPS(gfxCtx, "../z_rcp.c", 1460);
gDPSetColorDither(POLY_OPA_DISP++, G_CD_DISABLE);

View file

@ -53,7 +53,7 @@ void func_80095AB4(GlobalContext* globalCtx, Room* room, u32 flags) {
gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
}
polygon0 = &room->mesh->polygon0;
polygon0 = &room->meshHeader->polygon0;
polygonDlist = SEGMENTED_TO_VIRTUAL(polygon0->start);
for (i = 0; i < polygon0->num; i++) {
if ((flags & 1) && (polygonDlist->opa != NULL)) {
@ -114,7 +114,7 @@ void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) {
gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
}
polygon2 = &room->mesh->polygon2;
polygon2 = &room->meshHeader->polygon2;
polygonDlist = SEGMENTED_TO_VIRTUAL(polygon2->start);
spA4 = spB8;
@ -320,7 +320,7 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) {
activeCam = GET_ACTIVE_CAM(globalCtx);
isFixedCamera = (activeCam->setting == CAM_SET_PREREND_FIXED);
polygon1 = &room->mesh->polygon1;
polygon1 = &room->meshHeader->polygon1;
polygonDlist = SEGMENTED_TO_VIRTUAL(polygon1->dlist);
drawBg = (flags & 1) && isFixedCamera && polygon1->single.source && !(SREG(25) & 1);
drawOpa = (flags & 1) && (polygonDlist->opa != NULL) && !(SREG(25) & 2);
@ -412,7 +412,7 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) {
activeCam = GET_ACTIVE_CAM(globalCtx);
isFixedCamera = (activeCam->setting == CAM_SET_PREREND_FIXED);
polygon1 = &room->mesh->polygon1;
polygon1 = &room->meshHeader->polygon1;
polygonDlist = SEGMENTED_TO_VIRTUAL(polygon1->dlist);
bgImage = func_80096A74(polygon1, globalCtx);
drawBg = (flags & 1) && isFixedCamera && bgImage->source && !(SREG(25) & 1);
@ -459,7 +459,7 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) {
// Room Draw Polygon Type 1
void func_80096F6C(GlobalContext* globalCtx, Room* room, u32 flags) {
PolygonType1* polygon1 = &room->mesh->polygon1;
PolygonType1* polygon1 = &room->meshHeader->polygon1;
if (polygon1->format == 1) {
func_80096680(globalCtx, room, flags);
@ -585,9 +585,9 @@ s32 func_800973FC(GlobalContext* globalCtx, RoomContext* roomCtx) {
void Room_Draw(GlobalContext* globalCtx, Room* room, u32 flags) {
if (room->segment != NULL) {
gSegments[3] = VIRTUAL_TO_PHYSICAL(room->segment);
ASSERT(room->mesh->polygon.type < ARRAY_COUNTU(sRoomDrawHandlers),
ASSERT(room->meshHeader->base.type < ARRAY_COUNTU(sRoomDrawHandlers),
"this->ground_shape->polygon.type < number(Room_Draw_Proc)", "../z_room.c", 1125);
sRoomDrawHandlers[room->mesh->polygon.type](globalCtx, room, flags);
sRoomDrawHandlers[room->meshHeader->base.type](globalCtx, room, flags);
}
}

View file

@ -182,8 +182,7 @@ s32 Scene_ExecuteCommands(GlobalContext* globalCtx, SceneCmd* sceneCmd) {
return 0;
}
// Scene Command 0x00: Spawn List
void func_80098508(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandSpawnList(GlobalContext* globalCtx, SceneCmd* cmd) {
ActorEntry* linkEntry = globalCtx->linkActorEntry = (ActorEntry*)SEGMENTED_TO_VIRTUAL(cmd->spawnList.segment) +
globalCtx->setupEntranceList[globalCtx->curSpawn].spawn;
s16 linkObjectId;
@ -196,19 +195,16 @@ void func_80098508(GlobalContext* globalCtx, SceneCmd* cmd) {
Object_Spawn(&globalCtx->objectCtx, linkObjectId);
}
// Scene Command 0x01: Actor List
void func_800985DC(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandActorList(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->numSetupActors = cmd->actorList.num;
globalCtx->setupActorList = SEGMENTED_TO_VIRTUAL(cmd->actorList.segment);
}
// Scene Command 0x02: Unused 02
void func_80098630(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandUnused2(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->unk_11DFC = SEGMENTED_TO_VIRTUAL(cmd->unused02.segment);
}
// Scene Command 0x03: Collision Header
void func_80098674(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandCollisionHeader(GlobalContext* globalCtx, SceneCmd* cmd) {
CollisionHeader* colHeader = SEGMENTED_TO_VIRTUAL(cmd->colHeader.segment);
colHeader->vtxList = SEGMENTED_TO_VIRTUAL(colHeader->vtxList);
@ -220,19 +216,16 @@ void func_80098674(GlobalContext* globalCtx, SceneCmd* cmd) {
BgCheck_Allocate(&globalCtx->colCtx, globalCtx, colHeader);
}
// Scene Command 0x04: Room List
void func_800987A4(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandRoomList(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->numRooms = cmd->roomList.num;
globalCtx->roomList = SEGMENTED_TO_VIRTUAL(cmd->roomList.segment);
}
// Scene Command 0x06: Entrance List
void func_800987F8(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandEntranceList(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->setupEntranceList = SEGMENTED_TO_VIRTUAL(cmd->entranceList.segment);
}
// Scene Command 0x07: Special Files
void func_8009883C(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandSpecialFiles(GlobalContext* globalCtx, SceneCmd* cmd) {
if (cmd->specialFiles.keepObjectId != OBJECT_INVALID) {
globalCtx->objectCtx.subKeepIndex = Object_Spawn(&globalCtx->objectCtx, cmd->specialFiles.keepObjectId);
gSegments[5] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment);
@ -243,21 +236,18 @@ void func_8009883C(GlobalContext* globalCtx, SceneCmd* cmd) {
}
}
// Scene Command 0x08: Room Behavior
void func_80098904(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->roomCtx.curRoom.unk_03 = cmd->roomBehavior.gpFlag1;
globalCtx->roomCtx.curRoom.unk_02 = cmd->roomBehavior.gpFlag2 & 0xFF;
globalCtx->roomCtx.curRoom.showInvisActors = (cmd->roomBehavior.gpFlag2 >> 8) & 1;
void Scene_CommandRoomBehavior(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->roomCtx.curRoom.behaviorType1 = cmd->roomBehavior.gpFlag1;
globalCtx->roomCtx.curRoom.behaviorType2 = cmd->roomBehavior.gpFlag2 & 0xFF;
globalCtx->roomCtx.curRoom.lensMode = (cmd->roomBehavior.gpFlag2 >> 8) & 1;
globalCtx->msgCtx.disableWarpSongs = (cmd->roomBehavior.gpFlag2 >> 0xA) & 1;
}
// Scene Command 0x0A: Mesh Header
void func_80098958(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->roomCtx.curRoom.mesh = SEGMENTED_TO_VIRTUAL(cmd->mesh.segment);
void Scene_CommandMeshHeader(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->roomCtx.curRoom.meshHeader = SEGMENTED_TO_VIRTUAL(cmd->mesh.segment);
}
// Scene Command 0x0B: Object List
void func_8009899C(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandObjectList(GlobalContext* globalCtx, SceneCmd* cmd) {
s32 i;
s32 j;
s32 k;
@ -294,8 +284,6 @@ void func_8009899C(GlobalContext* globalCtx, SceneCmd* cmd) {
ASSERT(cmd->objectList.num <= OBJECT_EXCHANGE_BANK_MAX, "scene_info->object_bank.num <= OBJECT_EXCHANGE_BANK_MAX",
"../z_scene.c", 705);
if (1) {}
while (k < cmd->objectList.num) {
nextPtr = func_800982FC(&globalCtx->objectCtx, i, *objectEntry);
if (i < OBJECT_EXCHANGE_BANK_MAX - 1) {
@ -309,8 +297,7 @@ void func_8009899C(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->objectCtx.num = i;
}
// Scene Command 0x0C: Light List
void func_80098B74(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandLightList(GlobalContext* globalCtx, SceneCmd* cmd) {
s32 i;
LightInfo* lightInfo = SEGMENTED_TO_VIRTUAL(cmd->lightList.segment);
@ -320,13 +307,11 @@ void func_80098B74(GlobalContext* globalCtx, SceneCmd* cmd) {
}
}
// Scene Command 0x0D: Path List
void func_80098C24(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandPathList(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->setupPathList = SEGMENTED_TO_VIRTUAL(cmd->pathList.segment);
}
// Scene Command 0x0E: Transition Actor List
void func_80098C68(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandTransitionActorList(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->transiActorCtx.numActors = cmd->transiActorList.num;
globalCtx->transiActorCtx.list = SEGMENTED_TO_VIRTUAL(cmd->transiActorList.segment);
}
@ -335,27 +320,23 @@ void TransitionActor_InitContext(GameState* state, TransitionActorContext* trans
transiActorCtx->numActors = 0;
}
// Scene Command 0x0F: Light Setting List
void func_80098CC8(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandLightSettingsList(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->envCtx.numLightSettings = cmd->lightSettingList.num;
globalCtx->envCtx.lightSettingsList = SEGMENTED_TO_VIRTUAL(cmd->lightSettingList.segment);
}
// Scene Command 0x11: Skybox Settings
void func_80098D1C(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandSkyboxSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->skyboxId = cmd->skyboxSettings.skyboxId;
globalCtx->envCtx.skyboxConfig = globalCtx->envCtx.changeSkyboxNextConfig = cmd->skyboxSettings.unk_05;
globalCtx->envCtx.lightMode = cmd->skyboxSettings.unk_06;
}
// Scene Command 0x12: Skybox Disables
void func_80098D5C(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandSkyboxDisables(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->envCtx.skyboxDisabled = cmd->skyboxDisables.unk_04;
globalCtx->envCtx.sunMoonDisabled = cmd->skyboxDisables.unk_05;
}
// Scene Command 0x10: Time Settings
void func_80098D80(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandTimeSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
if ((cmd->timeSettings.hour != 0xFF) && (cmd->timeSettings.min != 0xFF)) {
gSaveContext.skyboxTime = gSaveContext.dayTime =
((cmd->timeSettings.hour + (cmd->timeSettings.min / 60.0f)) * 60.0f) / ((f32)(24 * 60) / 0x10000);
@ -391,8 +372,7 @@ void func_80098D80(GlobalContext* globalCtx, SceneCmd* cmd) {
}
}
// Scene Command 0x05: Wind Settings
void func_80099090(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandWindSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
s8 x = cmd->windSettings.x;
s8 y = cmd->windSettings.y;
s8 z = cmd->windSettings.z;
@ -404,17 +384,14 @@ void func_80099090(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->envCtx.windSpeed = cmd->windSettings.unk_07;
}
// Scene Command 0x13: Exit List
void func_800990F0(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandExitList(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->setupExitList = SEGMENTED_TO_VIRTUAL(cmd->exitList.segment);
}
// Scene Command 0x09: Undefined
void func_80099134(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandUndefined9(GlobalContext* globalCtx, SceneCmd* cmd) {
}
// Scene Command 0x15: Sound Settings
void func_80099140(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandSoundSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->sequenceCtx.seqId = cmd->soundSettings.seqId;
globalCtx->sequenceCtx.natureAmbienceId = cmd->soundSettings.natureAmbienceId;
@ -423,13 +400,11 @@ void func_80099140(GlobalContext* globalCtx, SceneCmd* cmd) {
}
}
// Scene Command 0x16: Echo Setting
void func_8009918C(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandEchoSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->roomCtx.curRoom.echo = cmd->echoSettings.echo;
}
// Scene Command 0x18: Alternate Headers
void func_800991A0(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandAlternateHeaderList(GlobalContext* globalCtx, SceneCmd* cmd) {
s32 pad;
SceneCmd* altHeader;
@ -465,14 +440,13 @@ void func_800991A0(GlobalContext* globalCtx, SceneCmd* cmd) {
}
}
// Scene Command 0x17: Cutscene Data
void func_8009934C(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandCutsceneData(GlobalContext* globalCtx, SceneCmd* cmd) {
osSyncPrintf("\ngame_play->demo_play.data=[%x]", globalCtx->csCtx.segment);
globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(cmd->cutsceneData.segment);
}
// Scene Command 0x19: Misc. Settings (Camera & World Map Area)
void func_800993C0(GlobalContext* globalCtx, SceneCmd* cmd) {
// Camera & World Map Area
void Scene_CommandMiscSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
YREG(15) = cmd->miscSettings.cameraMovement;
gSaveContext.worldMapArea = cmd->miscSettings.area;
@ -493,10 +467,32 @@ void func_800993C0(GlobalContext* globalCtx, SceneCmd* cmd) {
}
void (*gSceneCmdHandlers[SCENE_CMD_ID_MAX])(GlobalContext*, SceneCmd*) = {
func_80098508, func_800985DC, func_80098630, func_80098674, func_800987A4, func_80099090, func_800987F8,
func_8009883C, func_80098904, func_80099134, func_80098958, func_8009899C, func_80098B74, func_80098C24,
func_80098C68, func_80098CC8, func_80098D80, func_80098D1C, func_80098D5C, func_800990F0, NULL,
func_80099140, func_8009918C, func_8009934C, func_800991A0, func_800993C0,
Scene_CommandSpawnList, // SCENE_CMD_ID_SPAWN_LIST
Scene_CommandActorList, // SCENE_CMD_ID_ACTOR_LIST
Scene_CommandUnused2, // SCENE_CMD_ID_UNUSED_2
Scene_CommandCollisionHeader, // SCENE_CMD_ID_COLLISION_HEADER
Scene_CommandRoomList, // SCENE_CMD_ID_ROOM_LIST
Scene_CommandWindSettings, // SCENE_CMD_ID_WIND_SETTINGS
Scene_CommandEntranceList, // SCENE_CMD_ID_ENTRANCE_LIST
Scene_CommandSpecialFiles, // SCENE_CMD_ID_SPECIAL_FILES
Scene_CommandRoomBehavior, // SCENE_CMD_ID_ROOM_BEHAVIOR
Scene_CommandUndefined9, // SCENE_CMD_ID_UNDEFINED_9
Scene_CommandMeshHeader, // SCENE_CMD_ID_MESH_HEADER
Scene_CommandObjectList, // SCENE_CMD_ID_OBJECT_LIST
Scene_CommandLightList, // SCENE_CMD_ID_LIGHT_LIST
Scene_CommandPathList, // SCENE_CMD_ID_PATH_LIST
Scene_CommandTransitionActorList, // SCENE_CMD_ID_TRANSITION_ACTOR_LIST
Scene_CommandLightSettingsList, // SCENE_CMD_ID_LIGHT_SETTINGS_LIST
Scene_CommandTimeSettings, // SCENE_CMD_ID_TIME_SETTINGS
Scene_CommandSkyboxSettings, // SCENE_CMD_ID_SKYBOX_SETTINGS
Scene_CommandSkyboxDisables, // SCENE_CMD_ID_SKYBOX_DISABLES
Scene_CommandExitList, // SCENE_CMD_ID_EXIT_LIST
NULL, // SCENE_CMD_ID_END
Scene_CommandSoundSettings, // SCENE_CMD_ID_SOUND_SETTINGS
Scene_CommandEchoSettings, // SCENE_CMD_ID_ECHO_SETTINGS
Scene_CommandCutsceneData, // SCENE_CMD_ID_CUTSCENE_DATA
Scene_CommandAlternateHeaderList, // SCENE_CMD_ID_ALTERNATE_HEADER_LIST
Scene_CommandMiscSettings, // SCENE_CMD_ID_MISC_SETTINGS
};
RomFile sNaviMsgFiles[] = {

View file

@ -92,7 +92,7 @@ void func_8087DB24(BgHakaMegane* this, GlobalContext* globalCtx) {
this->dyna.actor.objBankIndex = this->objBankIndex;
this->dyna.actor.draw = BgHakaMegane_Draw;
Actor_SetObjectDependency(globalCtx, &this->dyna.actor);
if (globalCtx->roomCtx.curRoom.showInvisActors) {
if (globalCtx->roomCtx.curRoom.lensMode != LENS_MODE_HIDE_ACTORS) {
this->actionFunc = func_8087DBF0;
collision = sCollisionHeaders[this->dyna.actor.params];
if (collision != NULL) {

View file

@ -138,7 +138,7 @@ void MagicDark_DimLighting(GlobalContext* globalCtx, f32 intensity) {
f32 colorScale;
f32 fogScale;
if (globalCtx->roomCtx.curRoom.unk_03 != 5) {
if (globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_5) {
intensity = CLAMP_MIN(intensity, 0.0f);
intensity = CLAMP_MAX(intensity, 1.0f);
fogScale = intensity - 0.2f;

View file

@ -5228,8 +5228,8 @@ void func_8083BCD0(Player* this, GlobalContext* globalCtx, s32 arg2) {
s32 func_8083BDBC(Player* this, GlobalContext* globalCtx) {
s32 sp2C;
if (CHECK_BTN_ALL(sControlInput->press.button, BTN_A) && (globalCtx->roomCtx.curRoom.unk_03 != 2) &&
(D_808535E4 != 7) &&
if (CHECK_BTN_ALL(sControlInput->press.button, BTN_A) &&
(globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && (D_808535E4 != 7) &&
(SurfaceType_GetSlope(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId) != 1)) {
sp2C = this->unk_84B[this->unk_846];
@ -5417,8 +5417,8 @@ s32 func_8083C544(Player* this, GlobalContext* globalCtx) {
}
s32 func_8083C61C(GlobalContext* globalCtx, Player* this) {
if ((globalCtx->roomCtx.curRoom.unk_03 != 2) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) &&
(AMMO(ITEM_NUT) != 0)) {
if ((globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) &&
(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (AMMO(ITEM_NUT) != 0)) {
func_80835C58(globalCtx, this, func_8084E604, 0);
func_80832264(globalCtx, this, &gPlayerAnim_003048);
this->unk_6AD = 0;
@ -6943,7 +6943,7 @@ void func_808409CC(GlobalContext* globalCtx, Player* this) {
if (this->stateFlags1 & PLAYER_STATE1_11) {
anim = func_80833338(this);
} else {
sp38 = globalCtx->roomCtx.curRoom.unk_02;
sp38 = globalCtx->roomCtx.curRoom.behaviorType2;
if (heathIsCritical) {
if (this->unk_6AC >= 0) {
sp38 = 7;
@ -8102,7 +8102,7 @@ static struct_80832924 D_808545F0[] = {
void func_80843CEC(Player* this, GlobalContext* globalCtx) {
if (this->currentTunic != PLAYER_TUNIC_GORON) {
if ((globalCtx->roomCtx.curRoom.unk_02 == 3) || (D_808535E4 == 9) ||
if ((globalCtx->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) || (D_808535E4 == 9) ||
((func_80838144(D_808535E4) >= 0) &&
!SurfaceType_IsWallDamage(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId))) {
func_8083821C(this);
@ -9553,11 +9553,12 @@ void func_808473D4(GlobalContext* globalCtx, Player* this) {
!Player_IsChildWithHylianShield(this))) {
if ((!(this->stateFlags1 & PLAYER_STATE1_14) && (sp20 <= 0) &&
(func_8008E9C4(this) ||
((D_808535E4 != 7) &&
(func_80833B2C(this) || ((globalCtx->roomCtx.curRoom.unk_03 != 2) &&
((D_808535E4 != 7) && (func_80833B2C(this) ||
((globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) &&
!(this->stateFlags1 & PLAYER_STATE1_22) && (sp20 == 0))))))) {
doAction = DO_ACTION_ATTACK;
} else if ((globalCtx->roomCtx.curRoom.unk_03 != 2) && func_80833BCC(this) && (sp20 > 0)) {
} else if ((globalCtx->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) &&
func_80833BCC(this) && (sp20 > 0)) {
doAction = DO_ACTION_JUMP;
} else if ((this->heldItemActionParam >= PLAYER_AP_SWORD_MASTER) ||
((this->stateFlags2 & PLAYER_STATE2_20) &&