Skip to content

Commit

Permalink
Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
sauraen committed Jun 10, 2024
1 parent f6c8210 commit d55bbcc
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/code/occlusionplanes.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static s32 OcclusionPlane_Choose(PlayState* play, Vec3f* selCandidate){
break;
}

OcclusionPlaneCandidate* cand = room->occPlaneList[c];
OcclusionPlaneCandidate* cand = &room->occPlaneList[c];
Vec3f v[4];
for(s32 p=0; p<4; ++p){
v[p].x = cand->v[p].x;
Expand Down
13 changes: 9 additions & 4 deletions src/code/sys_ucode.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,20 @@ volatile s8 gF3DEX3NOCVersion = 1;
s8 gF3DEX3OccMode = F3DEX3_OCC_MODE_AUTO;

void SysUcode_LoadNewUcodeIfChanged() {
if (gF3DEX3OccMode == F3DEX3_OCC_MODE_ALWAYS) {
gF3DEX3NOCVersion = 0;
} else if (gF3DEX3OccMode == F3DEX3_OCC_MODE_NEVER) {
gF3DEX3NOCVersion = 1;
} // else if AUTO, controlled by occlusion planes system
s8 ver = gF3DEX3ProfVersion | (gF3DEX3NOCVersion << 2);
if (gLoadedF3DEX3Version == ver) {
return;
}
ver &= 7; // make sure valid

u8* textVrom = sF3DEX3TextRomStartAddrs[ver];
const u8* textVrom = sF3DEX3TextRomStartAddrs[ver];
u32 textSize = sF3DEX3TextRomEndAddrs[ver] - textVrom;
u8* dataVrom = sF3DEX3DataRomStartAddrs[ver];
const u8* dataVrom = sF3DEX3DataRomStartAddrs[ver];
u32 dataSize = sF3DEX3DataRomEndAddrs[ver] - dataVrom;
if (textSize > F3DEX3_TEXT_MAX_SIZE) {
Fault_AddHungupAndCrash("ucode_text_too_big", __LINE__);
Expand All @@ -87,8 +92,8 @@ void SysUcode_LoadNewUcodeIfChanged() {
Fault_AddHungupAndCrash("ucode_data_too_big", __LINE__);
return;
}
DMA_REQUEST_SYNC(gF3DEX3TextBuffer, textVrom, textSize, "sys_ucode.c", __LINE__);
DMA_REQUEST_SYNC(gF3DEX3DataBuffer, dataVrom, dataSize, "sys_ucode.c", __LINE__);
DMA_REQUEST_SYNC(gF3DEX3TextBuffer, (u32)textVrom, textSize, "sys_ucode.c", __LINE__);
DMA_REQUEST_SYNC(gF3DEX3DataBuffer, (u32)dataVrom, dataSize, "sys_ucode.c", __LINE__);

gLoadedF3DEX3Version = ver;
}
Expand Down
3 changes: 2 additions & 1 deletion src/code/z_play.c
Original file line number Diff line number Diff line change
Expand Up @@ -1245,7 +1245,8 @@ void Play_Draw(PlayState* this) {

{
// Only clear the FB if there is no skybox or it is solid color
s32 clearFB = this->skyboxId == SKYBOX_NONE || this->skyboxId == SKYBOX_UNSET_1D || this->envCtx.skyboxDisabled;
//s32 clearFB = this->skyboxId == SKYBOX_NONE || this->skyboxId == SKYBOX_UNSET_1D || this->envCtx.skyboxDisabled;
const s32 clearFB = 1;

// For no skybox, black background
u8 clearR = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/code/z_room.c
Original file line number Diff line number Diff line change
Expand Up @@ -606,8 +606,8 @@ s32 func_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomNum) {
u32 size;

roomCtx->prevRoom = roomCtx->curRoom;
func_80096FD4(play, &roomCtx->curRoom);
roomCtx->curRoom.num = roomNum;
roomCtx->curRoom.segment = NULL;
roomCtx->status = 1;

ASSERT(roomNum < play->numRooms, "read_room_ID < game_play->room_rom_address.num", "../z_room.c", 1009);
Expand Down
11 changes: 5 additions & 6 deletions src/debug/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ void Menu_Update(Menu* this) {
u8 i;

if(!this->bShow && !isHoldingR && pressDLeft){
gF3DEX3NOCVersion ^= 1;
if(gF3DEX3OccMode == F3DEX3_OCC_MODE_NEVER){
gF3DEX3OccMode = F3DEX3_OCC_MODE_ALWAYS;
}else if(gF3DEX3OccMode == F3DEX3_OCC_MODE_ALWAYS){
gF3DEX3OccMode = F3DEX3_OCC_MODE_NEVER;
}
}

if (isHoldingR && CHECK_BTN_ALL(pressBtn, BTN_L)) {
Expand Down Expand Up @@ -86,11 +90,6 @@ void Menu_Update(Menu* this) {
if (pressDRight && gF3DEX3OccMode < F3DEX3_OCC_MODE_COUNT - 1) {
gF3DEX3OccMode++;
}
if (gF3DEX3OccMode == F3DEX3_OCC_MODE_ALWAYS) {
gF3DEX3NOCVersion = 0;
} else if (gF3DEX3OccMode == F3DEX3_OCC_MODE_NEVER) {
gF3DEX3NOCVersion = 1;
}
}
#endif

Expand Down

0 comments on commit d55bbcc

Please sign in to comment.