mirror of
https://github.com/zeldaret/mm.git
synced 2026-08-04 09:08:34 -04:00
General Cleanup (#1529)
* Cleanup * vi define cleanup * kdebugserver * osmotor * Remove sqrtf.c * Move osFlash out of libultra * PadUtils_Destroy * BOOT_ADDRESS_ULTRA * Fault * Format * viconfig.h * More small cleanups * gfx cleanup * Format * Forgot to save * variables.h * dListTable -> dListSides * Fix header includes
This commit is contained in:
@@ -0,0 +1,318 @@
|
||||
#include "ultra64.h"
|
||||
#include "PR/os_internal_flash.h"
|
||||
#include "alignment.h"
|
||||
#include "macros.h"
|
||||
|
||||
u32 __osFlashID[4] ALIGNED(8);
|
||||
OSIoMesg __osFlashMsg ALIGNED(8);
|
||||
OSMesgQueue __osFlashMessageQ ALIGNED(8);
|
||||
OSPiHandle __osFlashHandler ALIGNED(8);
|
||||
OSMesg __osFlashMsgBuf[1];
|
||||
s32 __osFlashVersion;
|
||||
static s32 sBssPad[5];
|
||||
|
||||
uintptr_t osFlashGetAddr(u32 pageNum) {
|
||||
uintptr_t addr;
|
||||
|
||||
if (__osFlashVersion == OLD_FLASH) {
|
||||
// Account for hardware bug in old flash where the address bits are shifted 1-off where they should be
|
||||
addr = pageNum * (FLASH_BLOCK_SIZE >> 1);
|
||||
} else {
|
||||
addr = pageNum * FLASH_BLOCK_SIZE;
|
||||
}
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
OSPiHandle* osFlashReInit(u8 latency, u8 pulse, u8 pageSize, u8 relDuration, u32 start) {
|
||||
__osFlashHandler.baseAddress = PHYS_TO_K1(start);
|
||||
__osFlashHandler.type++;
|
||||
__osFlashHandler.latency = latency;
|
||||
__osFlashHandler.pulse = pulse;
|
||||
__osFlashHandler.pageSize = pageSize;
|
||||
__osFlashHandler.relDuration = relDuration;
|
||||
__osFlashHandler.domain = PI_DOMAIN2;
|
||||
|
||||
return &__osFlashHandler;
|
||||
}
|
||||
|
||||
void osFlashChange(u32 flashNum) {
|
||||
__osFlashHandler.baseAddress = PHYS_TO_K1(FLASH_START_ADDR + (flashNum * FLASH_SIZE));
|
||||
__osFlashHandler.type = DEVICE_TYPE_FLASH + flashNum;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
OSPiHandle* osFlashInit(void) {
|
||||
u32 flashType;
|
||||
u32 flashVendor;
|
||||
|
||||
osCreateMesgQueue(&__osFlashMessageQ, __osFlashMsgBuf, ARRAY_COUNT(__osFlashMsgBuf));
|
||||
|
||||
if (__osFlashHandler.baseAddress == PHYS_TO_K1(FLASH_START_ADDR)) {
|
||||
return &__osFlashHandler;
|
||||
}
|
||||
|
||||
__osFlashHandler.type = DEVICE_TYPE_FLASH;
|
||||
__osFlashHandler.baseAddress = PHYS_TO_K1(FLASH_START_ADDR);
|
||||
__osFlashHandler.latency = FLASH_LATENCY;
|
||||
__osFlashHandler.pulse = FLASH_PULSE;
|
||||
__osFlashHandler.pageSize = FLASH_PAGE_SIZE;
|
||||
__osFlashHandler.relDuration = FLASH_REL_DURATION;
|
||||
__osFlashHandler.domain = PI_DOMAIN2;
|
||||
__osFlashHandler.speed = 0;
|
||||
|
||||
bzero(&__osFlashHandler.transferInfo, sizeof(__OSTranxInfo));
|
||||
|
||||
osEPiLinkHandle(&__osFlashHandler);
|
||||
osFlashReadId(&flashType, &flashVendor);
|
||||
|
||||
if ((flashVendor == FLASH_VERSION_MX_C) || (flashVendor == FLASH_VERSION_MX_A) ||
|
||||
(flashVendor == FLASH_VERSION_MX_PROTO_A)) {
|
||||
__osFlashVersion = OLD_FLASH;
|
||||
} else {
|
||||
__osFlashVersion = NEW_FLASH;
|
||||
}
|
||||
|
||||
return &__osFlashHandler;
|
||||
}
|
||||
|
||||
void osFlashReadStatus(u8* flashStatus) {
|
||||
u32 outFlashStatus;
|
||||
|
||||
osEPiWriteIo(&__osFlashHandler, __osFlashHandler.baseAddress | FLASH_CMD_REG, FLASH_CMD_STATUS);
|
||||
// read status using IO
|
||||
osEPiReadIo(&__osFlashHandler, __osFlashHandler.baseAddress, &outFlashStatus);
|
||||
|
||||
// why twice ?
|
||||
osEPiWriteIo(&__osFlashHandler, __osFlashHandler.baseAddress | FLASH_CMD_REG, FLASH_CMD_STATUS);
|
||||
osEPiReadIo(&__osFlashHandler, __osFlashHandler.baseAddress, &outFlashStatus);
|
||||
|
||||
*flashStatus = outFlashStatus & 0xFF;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void osFlashReadId(u32* flashType, u32* flashVendor) {
|
||||
u8 flashStatus;
|
||||
|
||||
// why read status?
|
||||
osFlashReadStatus(&flashStatus);
|
||||
|
||||
// select silicon id read mode
|
||||
osEPiWriteIo(&__osFlashHandler, __osFlashHandler.baseAddress | FLASH_CMD_REG, FLASH_CMD_ID);
|
||||
|
||||
// read silicon id using DMA
|
||||
__osFlashMsg.hdr.pri = OS_MESG_PRI_NORMAL;
|
||||
__osFlashMsg.hdr.retQueue = &__osFlashMessageQ;
|
||||
__osFlashMsg.dramAddr = __osFlashID;
|
||||
__osFlashMsg.devAddr = 0;
|
||||
__osFlashMsg.size = 2 * sizeof(u32);
|
||||
|
||||
osInvalDCache(__osFlashID, sizeof(__osFlashID));
|
||||
osEPiStartDma(&__osFlashHandler, &__osFlashMsg, OS_READ);
|
||||
osRecvMesg(&__osFlashMessageQ, NULL, OS_MESG_BLOCK);
|
||||
|
||||
*flashType = __osFlashID[0];
|
||||
*flashVendor = __osFlashID[1];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void osFlashClearStatus(void) {
|
||||
// select status mode
|
||||
osEPiWriteIo(&__osFlashHandler, __osFlashHandler.baseAddress | FLASH_CMD_REG, FLASH_CMD_STATUS);
|
||||
// clear status
|
||||
osEPiWriteIo(&__osFlashHandler, __osFlashHandler.baseAddress, 0);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
s32 osFlashAllErase(void) {
|
||||
u32 status;
|
||||
OSTimer timer;
|
||||
OSMesgQueue mq;
|
||||
OSMesg msg;
|
||||
|
||||
// start chip erase operation
|
||||
osEPiWriteIo(&__osFlashHandler, __osFlashHandler.baseAddress | FLASH_CMD_REG, FLASH_CMD_CHIP_ERASE);
|
||||
osEPiWriteIo(&__osFlashHandler, __osFlashHandler.baseAddress | FLASH_CMD_REG, FLASH_CMD_EXECUTE_ERASE);
|
||||
|
||||
// wait for completion by polling erase-busy flag
|
||||
osCreateMesgQueue(&mq, &msg, 1);
|
||||
do {
|
||||
osSetTimer(&timer, OS_USEC_TO_CYCLES(15000), 0, &mq, &msg);
|
||||
osRecvMesg(&mq, &msg, OS_MESG_BLOCK);
|
||||
osEPiReadIo(&__osFlashHandler, __osFlashHandler.baseAddress, &status);
|
||||
} while ((status & FLASH_STATUS_ERASE_BUSY) == FLASH_STATUS_ERASE_BUSY);
|
||||
|
||||
// check erase operation status, clear status
|
||||
osEPiReadIo(&__osFlashHandler, __osFlashHandler.baseAddress, &status);
|
||||
osFlashClearStatus();
|
||||
|
||||
if (((status & 0xFF) == 0x08) || ((status & 0xFF) == 0x48) || ((status & 0x08) == 0x08)) {
|
||||
return FLASH_STATUS_ERASE_OK;
|
||||
} else {
|
||||
return FLASH_STATUS_ERASE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
void osFlashAllEraseThrough(void) {
|
||||
// start chip erase operation
|
||||
osEPiWriteIo(&__osFlashHandler, __osFlashHandler.baseAddress | FLASH_CMD_REG, FLASH_CMD_CHIP_ERASE);
|
||||
osEPiWriteIo(&__osFlashHandler, __osFlashHandler.baseAddress | FLASH_CMD_REG, FLASH_CMD_EXECUTE_ERASE);
|
||||
}
|
||||
|
||||
s32 osFlashCheckEraseEnd(void) {
|
||||
u8 status;
|
||||
|
||||
// check if erase operation is completed
|
||||
osFlashReadStatus(&status);
|
||||
if ((status & FLASH_STATUS_ERASE_BUSY) == FLASH_STATUS_ERASE_BUSY) {
|
||||
return FLASH_STATUS_ERASE_BUSY;
|
||||
} else {
|
||||
// check erase operation status, clear status
|
||||
osFlashReadStatus(&status);
|
||||
}
|
||||
osFlashClearStatus();
|
||||
|
||||
if (((status & 0xFF) == 0x08) || ((status & 0xFF) == 0x48) || ((status & 0x08) == 0x08)) {
|
||||
return FLASH_STATUS_ERASE_OK;
|
||||
} else {
|
||||
return FLASH_STATUS_ERASE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
s32 osFlashSectorErase(u32 pageNum) {
|
||||
u32 status;
|
||||
OSTimer timer;
|
||||
OSMesgQueue mq;
|
||||
OSMesg msg;
|
||||
|
||||
// start sector erase operation
|
||||
osEPiWriteIo(&__osFlashHandler, __osFlashHandler.baseAddress | FLASH_CMD_REG, FLASH_CMD_SECTOR_ERASE | pageNum);
|
||||
osEPiWriteIo(&__osFlashHandler, __osFlashHandler.baseAddress | FLASH_CMD_REG, FLASH_CMD_EXECUTE_ERASE);
|
||||
|
||||
// wait for completion by polling erase-busy flag
|
||||
osCreateMesgQueue(&mq, &msg, 1);
|
||||
do {
|
||||
osSetTimer(&timer, OS_USEC_TO_CYCLES(12500), 0, &mq, &msg);
|
||||
osRecvMesg(&mq, &msg, OS_MESG_BLOCK);
|
||||
osEPiReadIo(&__osFlashHandler, __osFlashHandler.baseAddress, &status);
|
||||
} while ((status & FLASH_STATUS_ERASE_BUSY) == FLASH_STATUS_ERASE_BUSY);
|
||||
|
||||
// check erase operation status, clear status
|
||||
osEPiReadIo(&__osFlashHandler, __osFlashHandler.baseAddress, &status);
|
||||
osFlashClearStatus();
|
||||
|
||||
if (((status & 0xFF) == 0x08) || ((status & 0xFF) == 0x48) || ((status & 0x08) == 0x08)) {
|
||||
return FLASH_STATUS_ERASE_OK;
|
||||
} else {
|
||||
return FLASH_STATUS_ERASE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
void osFlashSectorEraseThrough(u32 pageNum) {
|
||||
// start sector erase operation
|
||||
osEPiWriteIo(&__osFlashHandler, __osFlashHandler.baseAddress | FLASH_CMD_REG, FLASH_CMD_SECTOR_ERASE | pageNum);
|
||||
osEPiWriteIo(&__osFlashHandler, __osFlashHandler.baseAddress | FLASH_CMD_REG, FLASH_CMD_EXECUTE_ERASE);
|
||||
}
|
||||
|
||||
s32 osFlashWriteBuffer(OSIoMesg* mb, s32 priority, void* dramAddr, OSMesgQueue* mq) {
|
||||
s32 ret;
|
||||
|
||||
// select load page mode
|
||||
osEPiWriteIo(&__osFlashHandler, __osFlashHandler.baseAddress | FLASH_CMD_REG, FLASH_CMD_PAGE_PROGRAM);
|
||||
|
||||
// DMA 128-byte page
|
||||
mb->hdr.pri = priority;
|
||||
mb->hdr.retQueue = mq;
|
||||
mb->dramAddr = dramAddr;
|
||||
mb->devAddr = 0;
|
||||
mb->size = FLASH_BLOCK_SIZE;
|
||||
|
||||
ret = osEPiStartDma(&__osFlashHandler, mb, OS_WRITE);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 osFlashWriteArray(u32 pageNum) {
|
||||
u32 status;
|
||||
OSTimer timer;
|
||||
OSMesgQueue mq;
|
||||
OSMesg msg;
|
||||
|
||||
// only needed for new flash ?
|
||||
if (__osFlashVersion == NEW_FLASH) {
|
||||
osEPiWriteIo(&__osFlashHandler, __osFlashHandler.baseAddress | FLASH_CMD_REG, FLASH_CMD_PAGE_PROGRAM);
|
||||
}
|
||||
|
||||
// start program page operation
|
||||
osEPiWriteIo(&__osFlashHandler, __osFlashHandler.baseAddress | FLASH_CMD_REG, FLASH_CMD_PROGRAM_PAGE | pageNum);
|
||||
|
||||
// wait for completion by polling write-busy flag
|
||||
osCreateMesgQueue(&mq, &msg, 1);
|
||||
do {
|
||||
osSetTimer(&timer, OS_USEC_TO_CYCLES(200), 0, &mq, &msg);
|
||||
osRecvMesg(&mq, &msg, OS_MESG_BLOCK);
|
||||
osEPiReadIo(&__osFlashHandler, __osFlashHandler.baseAddress, &status);
|
||||
} while ((status & FLASH_STATUS_WRITE_BUSY) == FLASH_STATUS_WRITE_BUSY);
|
||||
|
||||
// check program operation status, clear status
|
||||
osEPiReadIo(&__osFlashHandler, __osFlashHandler.baseAddress, &status);
|
||||
osFlashClearStatus();
|
||||
|
||||
if (((status & 0xFF) == 0x04) || ((status & 0xFF) == 0x44) || ((status & 0x04) == 0x04)) {
|
||||
return FLASH_STATUS_WRITE_OK;
|
||||
} else {
|
||||
return FLASH_STATUS_WRITE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
s32 osFlashReadArray(OSIoMesg* mb, s32 priority, u32 pageNum, void* dramAddr, u32 pageCount, OSMesgQueue* mq) {
|
||||
s32 ret;
|
||||
u32 dummy;
|
||||
u32 last_page;
|
||||
u32 pages;
|
||||
|
||||
// select read array mode
|
||||
osEPiWriteIo(&__osFlashHandler, __osFlashHandler.baseAddress | FLASH_CMD_REG, FLASH_CMD_READ_ARRAY);
|
||||
|
||||
// dummy read to initiate "fast-page" reads ?
|
||||
osEPiReadIo(&__osFlashHandler, __osFlashHandler.baseAddress, &dummy);
|
||||
|
||||
// DMA requested pages
|
||||
mb->hdr.pri = priority;
|
||||
mb->hdr.retQueue = mq;
|
||||
mb->dramAddr = dramAddr;
|
||||
|
||||
last_page = pageNum + pageCount - 1;
|
||||
|
||||
if ((last_page & 0xF00) != (pageNum & 0xF00)) {
|
||||
pages = 256 - (pageNum & 0xFF);
|
||||
pageCount -= pages;
|
||||
mb->size = pages * FLASH_BLOCK_SIZE;
|
||||
mb->devAddr = osFlashGetAddr(pageNum);
|
||||
osEPiStartDma(&__osFlashHandler, mb, OS_READ);
|
||||
osRecvMesg(mq, NULL, OS_MESG_BLOCK);
|
||||
pageNum = (pageNum + 256) & 0xF00;
|
||||
mb->dramAddr = (void*)((uintptr_t)mb->dramAddr + mb->size);
|
||||
}
|
||||
|
||||
while (pageCount > 256) {
|
||||
pages = 256;
|
||||
pageCount -= 256;
|
||||
mb->size = pages * FLASH_BLOCK_SIZE;
|
||||
mb->devAddr = osFlashGetAddr(pageNum);
|
||||
osEPiStartDma(&__osFlashHandler, mb, OS_READ);
|
||||
osRecvMesg(mq, NULL, OS_MESG_BLOCK);
|
||||
pageNum += 256;
|
||||
mb->dramAddr = (void*)((uintptr_t)mb->dramAddr + mb->size);
|
||||
}
|
||||
|
||||
mb->size = pageCount * FLASH_BLOCK_SIZE;
|
||||
mb->devAddr = osFlashGetAddr(pageNum);
|
||||
ret = osEPiStartDma(&__osFlashHandler, mb, OS_READ);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "fault.h"
|
||||
#include "idle.h"
|
||||
#include "libc64/sleep.h"
|
||||
#include "viconfig.h"
|
||||
#include "z64.h"
|
||||
|
||||
// Variables are put before most headers as a hacky way to bypass bss reordering
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "libc64/malloc.h"
|
||||
#include "yaz0.h"
|
||||
|
||||
#include "yaz0.h"
|
||||
#include "z64dma.h"
|
||||
|
||||
+7
-7
@@ -91,7 +91,7 @@ void ActorShape_Init(ActorShape* actorShape, f32 yOffset, ActorShadowFunc shadow
|
||||
actorShape->shadowAlpha = 255;
|
||||
}
|
||||
|
||||
void ActorShadow_Draw(Actor* actor, Lights* lights, PlayState* play, Gfx* dlist, Color_RGBA8* color) {
|
||||
void ActorShadow_Draw(Actor* actor, Lights* lights, PlayState* play, Gfx* dList, Color_RGBA8* color) {
|
||||
if (actor->floorPoly != NULL) {
|
||||
f32 dy = actor->world.pos.y - actor->floorHeight;
|
||||
|
||||
@@ -122,7 +122,7 @@ void ActorShadow_Draw(Actor* actor, Lights* lights, PlayState* play, Gfx* dlist,
|
||||
func_800C0094(actor->floorPoly, actor->world.pos.x, actor->floorHeight, actor->world.pos.z, &mtx);
|
||||
Matrix_Put(&mtx);
|
||||
|
||||
if ((dlist != gCircleShadowDL) || (actor->scale.x != actor->scale.z)) {
|
||||
if ((dList != gCircleShadowDL) || (actor->scale.x != actor->scale.z)) {
|
||||
Matrix_RotateYS(actor->shape.rot.y, MTXMODE_APPLY);
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ void ActorShadow_Draw(Actor* actor, Lights* lights, PlayState* play, Gfx* dlist,
|
||||
Matrix_Scale(actor->scale.x * shadowScale, 1.0f, actor->scale.z * shadowScale, MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
gSPDisplayList(POLY_OPA_DISP++, dlist);
|
||||
gSPDisplayList(POLY_OPA_DISP++, dList);
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
@@ -1742,7 +1742,7 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight,
|
||||
}
|
||||
}
|
||||
|
||||
Gfx* Hilite_Draw(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* gfxCtx, Gfx* dl, Hilite** hiliteP) {
|
||||
Gfx* Hilite_Draw(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* gfxCtx, Gfx* gfx, Hilite** hiliteP) {
|
||||
LookAt* lookAt = GRAPH_ALLOC(gfxCtx, sizeof(LookAt));
|
||||
f32 correctedEyeX = (eye->x == object->x) && (eye->z == object->z) ? eye->x + 0.001f : eye->x;
|
||||
|
||||
@@ -1752,10 +1752,10 @@ Gfx* Hilite_Draw(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* gf
|
||||
0.0f, 1.0f, 0.0f, lightDir->x, lightDir->y, lightDir->z, lightDir->x, lightDir->y, lightDir->z, 0x10,
|
||||
0x10);
|
||||
|
||||
gSPLookAt(dl++, lookAt);
|
||||
gDPSetHilite1Tile(dl++, 1, *hiliteP, 0x10, 0x10);
|
||||
gSPLookAt(gfx++, lookAt);
|
||||
gDPSetHilite1Tile(gfx++, 1, *hiliteP, 0x10, 0x10);
|
||||
|
||||
return dl;
|
||||
return gfx;
|
||||
}
|
||||
|
||||
Hilite* Hilite_DrawOpa(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* gfxCtx) {
|
||||
|
||||
+14
-14
@@ -3,18 +3,18 @@
|
||||
/**
|
||||
* Draws a display list to the opaque display buffer
|
||||
*/
|
||||
void Gfx_DrawDListOpa(PlayState* play, Gfx* dlist) {
|
||||
Gfx* dl;
|
||||
void Gfx_DrawDListOpa(PlayState* play, Gfx* dList) {
|
||||
Gfx* gfx;
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
dl = POLY_OPA_DISP;
|
||||
gfx = POLY_OPA_DISP;
|
||||
|
||||
gSPDisplayList(&dl[0], gSetupDLs[SETUPDL_25]);
|
||||
gSPMatrix(&dl[1], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(&dl[2], dlist);
|
||||
gSPDisplayList(&gfx[0], gSetupDLs[SETUPDL_25]);
|
||||
gSPMatrix(&gfx[1], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(&gfx[2], dList);
|
||||
|
||||
POLY_OPA_DISP = &dl[3];
|
||||
POLY_OPA_DISP = &gfx[3];
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
@@ -22,18 +22,18 @@ void Gfx_DrawDListOpa(PlayState* play, Gfx* dlist) {
|
||||
/**
|
||||
* Draws a display list to the translucent display buffer
|
||||
*/
|
||||
void Gfx_DrawDListXlu(PlayState* play, Gfx* dlist) {
|
||||
Gfx* dl;
|
||||
void Gfx_DrawDListXlu(PlayState* play, Gfx* dList) {
|
||||
Gfx* gfx;
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
dl = POLY_XLU_DISP;
|
||||
gfx = POLY_XLU_DISP;
|
||||
|
||||
gSPDisplayList(&dl[0], gSetupDLs[SETUPDL_25]);
|
||||
gSPMatrix(&dl[1], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(&dl[2], dlist);
|
||||
gSPDisplayList(&gfx[0], gSetupDLs[SETUPDL_25]);
|
||||
gSPMatrix(&gfx[1], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(&gfx[2], dList);
|
||||
|
||||
POLY_XLU_DISP = &dl[3];
|
||||
POLY_XLU_DISP = &gfx[3];
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
+9
-9
@@ -3301,24 +3301,24 @@ void Environment_Draw(PlayState* play) {
|
||||
}
|
||||
|
||||
void Environment_DrawSkyboxStars(PlayState* play) {
|
||||
Gfx* nextOpa;
|
||||
Gfx* opa;
|
||||
Gfx* gfx;
|
||||
Gfx* gfxHead;
|
||||
|
||||
if (sSkyboxStarsDList != NULL) {
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
opa = POLY_OPA_DISP;
|
||||
nextOpa = Graph_GfxPlusOne(opa);
|
||||
gfxHead = POLY_OPA_DISP;
|
||||
gfx = Graph_GfxPlusOne(gfxHead);
|
||||
|
||||
gSPDisplayList(sSkyboxStarsDList, nextOpa);
|
||||
gSPDisplayList(sSkyboxStarsDList, gfx);
|
||||
|
||||
Environment_DrawSkyboxStarsImpl(play, &nextOpa);
|
||||
Environment_DrawSkyboxStarsImpl(play, &gfx);
|
||||
|
||||
gSPEndDisplayList(nextOpa++);
|
||||
gSPEndDisplayList(gfx++);
|
||||
|
||||
Graph_BranchDlist(opa, nextOpa);
|
||||
Graph_BranchDlist(gfxHead, gfx);
|
||||
|
||||
POLY_OPA_DISP = nextOpa;
|
||||
POLY_OPA_DISP = gfx;
|
||||
sSkyboxStarsDList = NULL;
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
|
||||
+10
-10
@@ -135,7 +135,7 @@ void Lights_BindPoint(Lights* lights, LightParams* params, PlayState* play) {
|
||||
f32 radiusF = params->point.radius;
|
||||
Vec3f posF;
|
||||
Vec3f adjustedPos;
|
||||
u32 pad;
|
||||
s32 pad;
|
||||
|
||||
if (radiusF > 0) {
|
||||
posF.x = params->point.x;
|
||||
@@ -415,21 +415,21 @@ void Lights_GlowCheck(PlayState* play) {
|
||||
}
|
||||
|
||||
void Lights_DrawGlow(PlayState* play) {
|
||||
Gfx* dl;
|
||||
Gfx* gfx;
|
||||
LightPoint* params;
|
||||
LightNode* light = play->lightCtx.listHead;
|
||||
|
||||
if (light != NULL) {
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
dl = Gfx_SetupDL65_NoCD(POLY_XLU_DISP);
|
||||
gfx = Gfx_SetupDL65_NoCD(POLY_XLU_DISP);
|
||||
|
||||
gDPSetDither(dl++, G_CD_NOISE);
|
||||
gDPSetDither(gfx++, G_CD_NOISE);
|
||||
|
||||
gDPSetCombineLERP(dl++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE,
|
||||
gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE,
|
||||
0);
|
||||
|
||||
gSPDisplayList(dl++, gameplay_keep_DL_029CB0);
|
||||
gSPDisplayList(gfx++, gameplay_keep_DL_029CB0);
|
||||
|
||||
do {
|
||||
if (light->info->type == LIGHT_POINT_GLOW) {
|
||||
@@ -437,21 +437,21 @@ void Lights_DrawGlow(PlayState* play) {
|
||||
if (params->drawGlow) {
|
||||
f32 scale = SQ((f32)params->radius) * 2e-6f;
|
||||
|
||||
gDPSetPrimColor(dl++, 0, 0, params->color[0], params->color[1], params->color[2], 50);
|
||||
gDPSetPrimColor(gfx++, 0, 0, params->color[0], params->color[1], params->color[2], 50);
|
||||
|
||||
Matrix_Translate(params->x, params->y, params->z, MTXMODE_NEW);
|
||||
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(dl++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPMatrix(gfx++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
gSPDisplayList(dl++, gameplay_keep_DL_029CF0);
|
||||
gSPDisplayList(gfx++, gameplay_keep_DL_029CF0);
|
||||
}
|
||||
}
|
||||
|
||||
light = light->next;
|
||||
} while (light != NULL);
|
||||
|
||||
POLY_XLU_DISP = dl;
|
||||
POLY_XLU_DISP = gfx;
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
@@ -5092,23 +5092,23 @@ void Message_DrawMain(PlayState* play, Gfx** gfxP) {
|
||||
}
|
||||
|
||||
void Message_Draw(PlayState* play) {
|
||||
Gfx* nextDisplayList;
|
||||
Gfx* polyOpa;
|
||||
Gfx* gfx;
|
||||
Gfx* gfxHead;
|
||||
GraphicsContext* gfxCtx = play->state.gfxCtx;
|
||||
|
||||
OPEN_DISPS(gfxCtx);
|
||||
|
||||
polyOpa = POLY_OPA_DISP;
|
||||
nextDisplayList = Graph_GfxPlusOne(polyOpa);
|
||||
gSPDisplayList(OVERLAY_DISP++, nextDisplayList);
|
||||
gfxHead = POLY_OPA_DISP;
|
||||
gfx = Graph_GfxPlusOne(gfxHead);
|
||||
gSPDisplayList(OVERLAY_DISP++, gfx);
|
||||
|
||||
if ((play->msgCtx.currentTextId != 0x5E6) || !Play_InCsMode(play)) {
|
||||
Message_DrawMain(play, &nextDisplayList);
|
||||
Message_DrawMain(play, &gfx);
|
||||
}
|
||||
|
||||
gSPEndDisplayList(nextDisplayList++);
|
||||
Graph_BranchDlist(polyOpa, nextDisplayList);
|
||||
POLY_OPA_DISP = nextDisplayList;
|
||||
gSPEndDisplayList(gfx++);
|
||||
Graph_BranchDlist(gfxHead, gfx);
|
||||
POLY_OPA_DISP = gfx;
|
||||
|
||||
CLOSE_DISPS(gfxCtx);
|
||||
}
|
||||
|
||||
+9
-9
@@ -1105,23 +1105,23 @@ void Play_PostWorldDraw(PlayState* this) {
|
||||
|
||||
// Shrink the whole screen display (at the end of First and Second Day by default)
|
||||
if (gSaveContext.screenScaleFlag) {
|
||||
Gfx* nextOpa;
|
||||
Gfx* opa;
|
||||
Gfx* gfx;
|
||||
Gfx* gfxHead;
|
||||
GraphicsContext* gfxCtx = this->state.gfxCtx;
|
||||
|
||||
sPlayVisFbufInstance->scale = gSaveContext.screenScale / 1000.0f;
|
||||
|
||||
OPEN_DISPS(gfxCtx);
|
||||
|
||||
opa = POLY_OPA_DISP;
|
||||
nextOpa = Graph_GfxPlusOne(opa);
|
||||
gSPDisplayList(OVERLAY_DISP++, nextOpa);
|
||||
gfxHead = POLY_OPA_DISP;
|
||||
gfx = Graph_GfxPlusOne(gfxHead);
|
||||
gSPDisplayList(OVERLAY_DISP++, gfx);
|
||||
|
||||
VisFbuf_Draw(sPlayVisFbufInstance, &nextOpa, this->unk_18E60);
|
||||
VisFbuf_Draw(sPlayVisFbufInstance, &gfx, this->unk_18E60);
|
||||
|
||||
gSPEndDisplayList(nextOpa++);
|
||||
Graph_BranchDlist(opa, nextOpa);
|
||||
POLY_OPA_DISP = nextOpa;
|
||||
gSPEndDisplayList(gfx++);
|
||||
Graph_BranchDlist(gfxHead, gfx);
|
||||
POLY_OPA_DISP = gfx;
|
||||
|
||||
CLOSE_DISPS(gfxCtx);
|
||||
}
|
||||
|
||||
@@ -1979,7 +1979,7 @@ void func_8012536C(void) {
|
||||
void Player_DrawZoraShield(PlayState* play, Player* player) {
|
||||
u8* phi_a0;
|
||||
Vtx* vtx;
|
||||
Gfx* dList;
|
||||
Gfx* gfx;
|
||||
f32 scale = player->unk_B62 * (10.0f / 51.0f);
|
||||
s32 i;
|
||||
|
||||
@@ -2000,12 +2000,12 @@ void Player_DrawZoraShield(PlayState* play, Player* player) {
|
||||
phi_a0++;
|
||||
}
|
||||
|
||||
dList = POLY_XLU_DISP;
|
||||
gfx = POLY_XLU_DISP;
|
||||
|
||||
gSPMatrix(&dList[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(&dList[1], object_link_zora_DL_011760);
|
||||
gSPMatrix(&gfx[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(&gfx[1], object_link_zora_DL_011760);
|
||||
|
||||
POLY_XLU_DISP = &dList[2];
|
||||
POLY_XLU_DISP = &gfx[2];
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
@@ -3263,7 +3263,7 @@ void Player_DrawGreatFairysMask(PlayState* play, Player* player) {
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
s32 func_80128640(PlayState* play, Player* player, Gfx* dlist) {
|
||||
s32 func_80128640(PlayState* play, Player* player, Gfx* dList) {
|
||||
s32 temp_v1 = player->skelAnime.animation == &gPlayerAnim_cl_maskoff;
|
||||
f32 temp_f0;
|
||||
|
||||
@@ -3334,7 +3334,7 @@ s32 func_80128640(PlayState* play, Player* player, Gfx* dlist) {
|
||||
Matrix_Pop();
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
} else if (dlist == object_link_zora_DL_00E2A0) { // zora guitar
|
||||
} else if (dList == object_link_zora_DL_00E2A0) { // zora guitar
|
||||
s16 sp26 = Math_SinS(player->unk_B86[0]) * (ABS_ALT(player->upperLimbRot.x) * ((f32)(IREG(52) + 20)) / 100.0f);
|
||||
s16 sp24 = Math_SinS(player->unk_B86[1]) * (ABS_ALT(player->upperLimbRot.y) * ((f32)(IREG(53) + 15)) / 100.0f);
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "viconfig.h"
|
||||
#include "z_prenmi.h"
|
||||
|
||||
void PreNMI_Stop(PreNMIState* this) {
|
||||
|
||||
+23
-23
@@ -70,7 +70,7 @@ void Room_DrawCullable(PlayState* play, Room* room, u32 flags) {
|
||||
RoomShapeCullableEntryLinked* head = NULL;
|
||||
RoomShapeCullableEntryLinked* tail = NULL;
|
||||
RoomShapeCullableEntryLinked* iter;
|
||||
Gfx* displayList;
|
||||
Gfx* dList;
|
||||
RoomShapeCullableEntryLinked* insert;
|
||||
f32 entryBoundsNearZ;
|
||||
s32 i;
|
||||
@@ -119,31 +119,31 @@ void Room_DrawCullable(PlayState* play, Room* room, u32 flags) {
|
||||
(i <= R_ROOM_CULL_DEBUG_TARGET)) ||
|
||||
((R_ROOM_CULL_DEBUG_MODE == ROOM_CULL_DEBUG_MODE_ONLY_TARGET) && (i == R_ROOM_CULL_DEBUG_TARGET))) {
|
||||
if (flags & ROOM_DRAW_OPA) {
|
||||
displayList = roomShapeCullableEntry->opa;
|
||||
if (displayList != NULL) {
|
||||
gSPDisplayList(POLY_OPA_DISP++, displayList);
|
||||
dList = roomShapeCullableEntry->opa;
|
||||
if (dList != NULL) {
|
||||
gSPDisplayList(POLY_OPA_DISP++, dList);
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & ROOM_DRAW_XLU) {
|
||||
displayList = roomShapeCullableEntry->xlu;
|
||||
if (displayList != NULL) {
|
||||
gSPDisplayList(POLY_XLU_DISP++, displayList);
|
||||
dList = roomShapeCullableEntry->xlu;
|
||||
if (dList != NULL) {
|
||||
gSPDisplayList(POLY_XLU_DISP++, dList);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (flags & ROOM_DRAW_OPA) {
|
||||
displayList = roomShapeCullableEntry->opa;
|
||||
if (displayList != NULL) {
|
||||
gSPDisplayList(POLY_OPA_DISP++, displayList);
|
||||
dList = roomShapeCullableEntry->opa;
|
||||
if (dList != NULL) {
|
||||
gSPDisplayList(POLY_OPA_DISP++, dList);
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & ROOM_DRAW_XLU) {
|
||||
displayList = roomShapeCullableEntry->xlu;
|
||||
if (displayList != NULL) {
|
||||
gSPDisplayList(POLY_XLU_DISP++, displayList);
|
||||
dList = roomShapeCullableEntry->xlu;
|
||||
if (dList != NULL) {
|
||||
gSPDisplayList(POLY_XLU_DISP++, dList);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -240,15 +240,15 @@ void Room_DrawCullable(PlayState* play, Room* room, u32 flags) {
|
||||
((R_ROOM_CULL_DEBUG_MODE == ROOM_CULL_DEBUG_MODE_ONLY_TARGET) &&
|
||||
(i == R_ROOM_CULL_DEBUG_TARGET))) {
|
||||
|
||||
displayList = roomShapeCullableEntry->opa;
|
||||
if (displayList != NULL) {
|
||||
gSPDisplayList(POLY_OPA_DISP++, displayList);
|
||||
dList = roomShapeCullableEntry->opa;
|
||||
if (dList != NULL) {
|
||||
gSPDisplayList(POLY_OPA_DISP++, dList);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
displayList = roomShapeCullableEntry->opa;
|
||||
if (displayList != NULL) {
|
||||
gSPDisplayList(POLY_OPA_DISP++, displayList);
|
||||
dList = roomShapeCullableEntry->opa;
|
||||
if (dList != NULL) {
|
||||
gSPDisplayList(POLY_OPA_DISP++, dList);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -260,9 +260,9 @@ void Room_DrawCullable(PlayState* play, Room* room, u32 flags) {
|
||||
f32 temp_fv1;
|
||||
|
||||
roomShapeCullableEntry = tail->entry;
|
||||
displayList = roomShapeCullableEntry->xlu;
|
||||
dList = roomShapeCullableEntry->xlu;
|
||||
|
||||
if (displayList != NULL) {
|
||||
if (dList != NULL) {
|
||||
if (roomShapeCullableEntry->boundsSphereRadius & 1) {
|
||||
|
||||
temp_fv0 = tail->boundsNearZ - (f32)(iREG(93) + 0xBB8);
|
||||
@@ -275,10 +275,10 @@ void Room_DrawCullable(PlayState* play, Room* room, u32 flags) {
|
||||
var_a1 = 255 - (s32)((temp_fv0 / temp_fv1) * 255.0f);
|
||||
}
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, var_a1);
|
||||
gSPDisplayList(POLY_XLU_DISP++, displayList);
|
||||
gSPDisplayList(POLY_XLU_DISP++, dList);
|
||||
}
|
||||
} else {
|
||||
gSPDisplayList(POLY_XLU_DISP++, displayList);
|
||||
gSPDisplayList(POLY_XLU_DISP++, dList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+32
-32
@@ -54,12 +54,12 @@ void SkelAnime_DrawLimbLod(PlayState* play, s32 limbIndex, void** skeleton, Vec3
|
||||
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &dList, &pos, &rot, actor)) {
|
||||
Matrix_TranslateRotateZYX(&pos, &rot);
|
||||
if (dList != NULL) {
|
||||
Gfx* polyTemp = POLY_OPA_DISP;
|
||||
Gfx* gfx = POLY_OPA_DISP;
|
||||
|
||||
gSPMatrix(&polyTemp[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_LOAD);
|
||||
gSPMatrix(&gfx[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_LOAD);
|
||||
|
||||
gSPDisplayList(&polyTemp[1], dList);
|
||||
POLY_OPA_DISP = &polyTemp[2];
|
||||
gSPDisplayList(&gfx[1], dList);
|
||||
POLY_OPA_DISP = &gfx[2];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,13 +111,13 @@ void SkelAnime_DrawLod(PlayState* play, void** skeleton, Vec3s* jointTable, Over
|
||||
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &dList, &pos, &rot, actor)) {
|
||||
Matrix_TranslateRotateZYX(&pos, &rot);
|
||||
if (dList != NULL) {
|
||||
Gfx* polyTemp = POLY_OPA_DISP;
|
||||
Gfx* gfx = POLY_OPA_DISP;
|
||||
|
||||
gSPMatrix(&polyTemp[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_LOAD);
|
||||
gSPMatrix(&gfx[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_LOAD);
|
||||
|
||||
gSPDisplayList(&polyTemp[1], dList);
|
||||
gSPDisplayList(&gfx[1], dList);
|
||||
|
||||
POLY_OPA_DISP = &polyTemp[2];
|
||||
POLY_OPA_DISP = &gfx[2];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,11 +231,11 @@ void SkelAnime_DrawFlexLod(PlayState* play, void** skeleton, Vec3s* jointTable,
|
||||
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &newDList, &pos, &rot, actor)) {
|
||||
Matrix_TranslateRotateZYX(&pos, &rot);
|
||||
if (newDList != NULL) {
|
||||
Gfx* polyTemp = POLY_OPA_DISP;
|
||||
Gfx* gfx = POLY_OPA_DISP;
|
||||
|
||||
gSPMatrix(&polyTemp[0], Matrix_ToMtx(mtx), G_MTX_LOAD);
|
||||
gSPDisplayList(&polyTemp[1], newDList);
|
||||
POLY_OPA_DISP = &polyTemp[2];
|
||||
gSPMatrix(&gfx[0], Matrix_ToMtx(mtx), G_MTX_LOAD);
|
||||
gSPDisplayList(&gfx[1], newDList);
|
||||
POLY_OPA_DISP = &gfx[2];
|
||||
mtx++;
|
||||
} else if (limbDList != NULL) {
|
||||
Matrix_ToMtx(mtx);
|
||||
@@ -282,11 +282,11 @@ void SkelAnime_DrawLimbOpa(PlayState* play, s32 limbIndex, void** skeleton, Vec3
|
||||
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &dList, &pos, &rot, actor)) {
|
||||
Matrix_TranslateRotateZYX(&pos, &rot);
|
||||
if (dList != NULL) {
|
||||
Gfx* polyTemp = POLY_OPA_DISP;
|
||||
Gfx* gfx = POLY_OPA_DISP;
|
||||
|
||||
gSPMatrix(&polyTemp[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_LOAD);
|
||||
gSPDisplayList(&polyTemp[1], dList);
|
||||
POLY_OPA_DISP = &polyTemp[2];
|
||||
gSPMatrix(&gfx[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_LOAD);
|
||||
gSPDisplayList(&gfx[1], dList);
|
||||
POLY_OPA_DISP = &gfx[2];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,11 +337,11 @@ void SkelAnime_DrawOpa(PlayState* play, void** skeleton, Vec3s* jointTable, Over
|
||||
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &dList, &pos, &rot, actor)) {
|
||||
Matrix_TranslateRotateZYX(&pos, &rot);
|
||||
if (dList != NULL) {
|
||||
Gfx* polyTemp = POLY_OPA_DISP;
|
||||
Gfx* gfx = POLY_OPA_DISP;
|
||||
|
||||
gSPMatrix(&polyTemp[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_LOAD);
|
||||
gSPDisplayList(&polyTemp[1], dList);
|
||||
POLY_OPA_DISP = &polyTemp[2];
|
||||
gSPMatrix(&gfx[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_LOAD);
|
||||
gSPDisplayList(&gfx[1], dList);
|
||||
POLY_OPA_DISP = &gfx[2];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -450,11 +450,11 @@ void SkelAnime_DrawFlexOpa(PlayState* play, void** skeleton, Vec3s* jointTable,
|
||||
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &newDList, &pos, &rot, actor)) {
|
||||
Matrix_TranslateRotateZYX(&pos, &rot);
|
||||
if (newDList != NULL) {
|
||||
Gfx* polyTemp = POLY_OPA_DISP;
|
||||
Gfx* gfx = POLY_OPA_DISP;
|
||||
|
||||
gSPMatrix(&polyTemp[0], Matrix_ToMtx(mtx), G_MTX_LOAD);
|
||||
gSPDisplayList(&polyTemp[1], newDList);
|
||||
POLY_OPA_DISP = &polyTemp[2];
|
||||
gSPMatrix(&gfx[0], Matrix_ToMtx(mtx), G_MTX_LOAD);
|
||||
gSPDisplayList(&gfx[1], newDList);
|
||||
POLY_OPA_DISP = &gfx[2];
|
||||
mtx++;
|
||||
} else {
|
||||
if (limbDList != NULL) {
|
||||
@@ -508,11 +508,11 @@ void SkelAnime_DrawTransformFlexLimbOpa(PlayState* play, s32 limbIndex, void** s
|
||||
transformLimbDraw(play, limbIndex, actor);
|
||||
|
||||
if (newDList != NULL) {
|
||||
Gfx* polyTemp = POLY_OPA_DISP;
|
||||
Gfx* gfx = POLY_OPA_DISP;
|
||||
|
||||
gSPMatrix(&polyTemp[0], Matrix_ToMtx(*mtx), G_MTX_LOAD);
|
||||
gSPDisplayList(&polyTemp[1], newDList);
|
||||
POLY_OPA_DISP = &polyTemp[2];
|
||||
gSPMatrix(&gfx[0], Matrix_ToMtx(*mtx), G_MTX_LOAD);
|
||||
gSPDisplayList(&gfx[1], newDList);
|
||||
POLY_OPA_DISP = &gfx[2];
|
||||
(*mtx)++;
|
||||
} else {
|
||||
if (limbDList != NULL) {
|
||||
@@ -590,11 +590,11 @@ void SkelAnime_DrawTransformFlexOpa(PlayState* play, void** skeleton, Vec3s* joi
|
||||
transformLimbDraw(play, 1, actor);
|
||||
|
||||
if (newDList != NULL) {
|
||||
Gfx* polyTemp = POLY_OPA_DISP;
|
||||
Gfx* gfx = POLY_OPA_DISP;
|
||||
|
||||
gSPMatrix(&polyTemp[0], Matrix_ToMtx(mtx), G_MTX_LOAD);
|
||||
gSPDisplayList(&polyTemp[1], newDList);
|
||||
POLY_OPA_DISP = &polyTemp[2];
|
||||
gSPMatrix(&gfx[0], Matrix_ToMtx(mtx), G_MTX_LOAD);
|
||||
gSPDisplayList(&gfx[1], newDList);
|
||||
POLY_OPA_DISP = &gfx[2];
|
||||
mtx++;
|
||||
} else {
|
||||
if (limbDList != NULL) {
|
||||
|
||||
+7
-7
@@ -149,7 +149,7 @@ void Skin_DrawAnimatedLimb(GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, s
|
||||
Skin_ApplyLimbModifications(gfxCtx, skin, limbIndex, arg3);
|
||||
}
|
||||
|
||||
gSPDisplayList(POLY_OPA_DISP++, data->dlist);
|
||||
gSPDisplayList(POLY_OPA_DISP++, data->dList);
|
||||
|
||||
CLOSE_DISPS(gfxCtx);
|
||||
}
|
||||
@@ -157,24 +157,24 @@ void Skin_DrawAnimatedLimb(GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, s
|
||||
/**
|
||||
* Draw a limb of type SKIN_LIMB_TYPE_NORMAL, of the skeleton `skin` at index `limbIndex`
|
||||
*/
|
||||
void Skin_DrawLimb(GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, Gfx* dListOverride, s32 drawFlags) {
|
||||
Gfx* gfx = dListOverride;
|
||||
void Skin_DrawLimb(GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, Gfx* dList, s32 drawFlags) {
|
||||
Gfx* limbDList = dList;
|
||||
SkinLimb** skeleton;
|
||||
|
||||
OPEN_DISPS(gfxCtx);
|
||||
|
||||
skeleton = Lib_SegmentedToVirtual(skin->skeletonHeader->segment);
|
||||
|
||||
if (dListOverride == NULL) {
|
||||
gfx = ((SkinLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]))->segment;
|
||||
if (dList == NULL) {
|
||||
limbDList = ((SkinLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]))->segment;
|
||||
}
|
||||
|
||||
if (gfx != NULL) {
|
||||
if (limbDList != NULL) {
|
||||
Mtx* mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &gSkinLimbMatrices[limbIndex]);
|
||||
|
||||
if (mtx != NULL) {
|
||||
gSPMatrix(POLY_OPA_DISP++, mtx, G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_OPA_DISP++, gfx);
|
||||
gSPDisplayList(POLY_OPA_DISP++, limbDList);
|
||||
gSPPopMatrix(POLY_OPA_DISP++, G_MTX_MODELVIEW);
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
}
|
||||
|
||||
+5
-5
@@ -108,7 +108,7 @@ Gfx* SubS_DrawTransformFlex(PlayState* play, void** skeleton, Vec3s* jointTable,
|
||||
TransformLimbDraw transformLimbDraw, Actor* actor, Gfx* gfx) {
|
||||
StandardLimb* rootLimb;
|
||||
s32 pad;
|
||||
Gfx* newDlist;
|
||||
Gfx* newDList;
|
||||
Gfx* limbDList;
|
||||
Vec3f pos;
|
||||
Vec3s rot;
|
||||
@@ -125,19 +125,19 @@ Gfx* SubS_DrawTransformFlex(PlayState* play, void** skeleton, Vec3s* jointTable,
|
||||
pos.y = jointTable[LIMB_ROOT_POS].y;
|
||||
pos.z = jointTable[LIMB_ROOT_POS].z;
|
||||
rot = jointTable[LIMB_ROOT_ROT];
|
||||
newDlist = rootLimb->dList;
|
||||
newDList = rootLimb->dList;
|
||||
limbDList = rootLimb->dList;
|
||||
|
||||
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &newDlist, &pos, &rot, actor, &gfx)) {
|
||||
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &newDList, &pos, &rot, actor, &gfx)) {
|
||||
Matrix_TranslateRotateZYX(&pos, &rot);
|
||||
Matrix_Push();
|
||||
|
||||
transformLimbDraw(play, 1, actor, &gfx);
|
||||
|
||||
if (newDlist != NULL) {
|
||||
if (newDList != NULL) {
|
||||
Matrix_ToMtx(mtx);
|
||||
gSPMatrix(gfx++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(gfx++, newDlist);
|
||||
gSPDisplayList(gfx++, newDList);
|
||||
mtx++;
|
||||
} else if (limbDList != NULL) {
|
||||
Matrix_ToMtx(mtx);
|
||||
|
||||
+9
-9
@@ -77,9 +77,9 @@ void ViMode_Configure(OSViMode* viMode, s32 type, s32 tvType, s32 loRes, s32 ant
|
||||
yScaleHiOddField = modeF ? (loResInterlaced ? 0x3000000 : 0x2000000) : 0;
|
||||
|
||||
viMode->type = type;
|
||||
viMode->comRegs.ctrl = OS_VI_UNK2000 | OS_VI_UNK1000 | OS_VI_GAMMA | OS_VI_GAMMA_DITHER |
|
||||
(!loResDeinterlaced ? OS_VI_UNK40 : 0) | (antialiasOn ? OS_VI_DIVOT : 0) |
|
||||
(fb32Bit ? OS_VI_UNK2 | OS_VI_UNK1 : OS_VI_UNK2);
|
||||
viMode->comRegs.ctrl = VI_CTRL_PIXEL_ADV_3 | VI_CTRL_GAMMA_ON | VI_CTRL_GAMMA_DITHER_ON |
|
||||
(!loResDeinterlaced ? VI_CTRL_SERRATE_ON : 0) | (antialiasOn ? VI_CTRL_DIVOT_ON : 0) |
|
||||
(fb32Bit ? VI_CTRL_TYPE_32 : VI_CTRL_TYPE_16);
|
||||
|
||||
if (modeLAN1) {
|
||||
// Anti-aliased, fetch extra lines as-needed
|
||||
@@ -246,22 +246,22 @@ void ViMode_ConfigureFeatures(ViMode* viMode, s32 viFeatures) {
|
||||
u32 ctrl = viMode->customViMode.comRegs.ctrl;
|
||||
|
||||
if (viFeatures & OS_VI_GAMMA_ON) {
|
||||
ctrl |= OS_VI_GAMMA;
|
||||
ctrl |= VI_CTRL_GAMMA_ON;
|
||||
}
|
||||
if (viFeatures & OS_VI_GAMMA_OFF) {
|
||||
ctrl &= ~OS_VI_GAMMA;
|
||||
ctrl &= ~VI_CTRL_GAMMA_ON;
|
||||
}
|
||||
if (viFeatures & OS_VI_GAMMA_DITHER_ON) {
|
||||
ctrl |= OS_VI_GAMMA_DITHER;
|
||||
ctrl |= VI_CTRL_GAMMA_DITHER_ON;
|
||||
}
|
||||
if (viFeatures & OS_VI_GAMMA_DITHER_OFF) {
|
||||
ctrl &= ~OS_VI_GAMMA_DITHER;
|
||||
ctrl &= ~VI_CTRL_GAMMA_DITHER_ON;
|
||||
}
|
||||
if (viFeatures & OS_VI_DIVOT_ON) {
|
||||
ctrl |= OS_VI_DIVOT;
|
||||
ctrl |= VI_CTRL_DIVOT_ON;
|
||||
}
|
||||
if (viFeatures & OS_VI_DIVOT_OFF) {
|
||||
ctrl &= ~OS_VI_DIVOT;
|
||||
ctrl &= ~VI_CTRL_DIVOT_ON;
|
||||
}
|
||||
viMode->customViMode.comRegs.ctrl = ctrl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user