mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-05 15:34:41 +00:00
Decompile z_map_exp.c (2 non matchings left) (#104)
Also documented the map data table (not decompiled yet however), and added a DungeonItem enum to use with gSaveContext.dungeonItems reads/writes.
This commit is contained in:
parent
9f1c996db5
commit
9f98210488
36 changed files with 894 additions and 1998 deletions
|
@ -18,9 +18,9 @@ typedef struct {
|
|||
/* 0x00 */ void* loadedRamAddr; // original name: "allocp"
|
||||
/* 0x04 */ u32 vromStart;
|
||||
/* 0x08 */ u32 vromEnd;
|
||||
/* 0x0C */ u32 vramStart;
|
||||
/* 0x10 */ u32 vramEnd;
|
||||
/* 0x14 */ u32 vramTable;
|
||||
/* 0x0C */ void* vramStart;
|
||||
/* 0x10 */ void* vramEnd;
|
||||
/* 0x14 */ void* vramTable;
|
||||
} MapMarkDataOverlay; // size = 0x18
|
||||
|
||||
static u32 sBaseImageSizes[] = { 0, 1, 2, 3 };
|
||||
|
@ -46,18 +46,16 @@ static MapMarkDataOverlay sMapMarkDataOvl = {
|
|||
NULL,
|
||||
(u32)_ovl_map_mark_dataSegmentRomStart,
|
||||
(u32)_ovl_map_mark_dataSegmentRomEnd,
|
||||
(u32)_ovl_map_mark_dataSegmentStart,
|
||||
(u32)_ovl_map_mark_dataSegmentEnd,
|
||||
(u32)gMapMarkDataTable,
|
||||
_ovl_map_mark_dataSegmentStart,
|
||||
_ovl_map_mark_dataSegmentEnd,
|
||||
gMapMarkDataTable,
|
||||
};
|
||||
|
||||
static MapMarksData** sLoadedMarkDataTable;
|
||||
|
||||
extern u8** D_8015FFD0;
|
||||
|
||||
void MapMark_Init(GlobalContext* globalCtx) {
|
||||
MapMarkDataOverlay* overlay = &sMapMarkDataOvl;
|
||||
u32 overlaySize = overlay->vramEnd - overlay->vramStart;
|
||||
u32 overlaySize = (u32)overlay->vramEnd - (u32)overlay->vramStart;
|
||||
|
||||
overlay->loadedRamAddr = Game_Alloc(&globalCtx->state, overlaySize, "../z_map_mark.c", 235);
|
||||
LogUtils_CheckNullPointer("dlftbl->allocp", overlay->loadedRamAddr, "../z_map_mark.c", 236);
|
||||
|
@ -65,10 +63,10 @@ void MapMark_Init(GlobalContext* globalCtx) {
|
|||
Overlay_Load(overlay->vromStart, overlay->vromEnd, overlay->vramStart, overlay->vramEnd, overlay->loadedRamAddr);
|
||||
|
||||
sLoadedMarkDataTable = gMapMarkDataTable;
|
||||
sLoadedMarkDataTable =
|
||||
(void*)(s32)((overlay->vramTable != 0)
|
||||
? (void*)(overlay->vramTable - (s32)(overlay->vramStart - (s32)overlay->loadedRamAddr))
|
||||
: NULL);
|
||||
sLoadedMarkDataTable = (void*)(u32)(
|
||||
(overlay->vramTable != NULL)
|
||||
? (void*)((u32)overlay->vramTable - (s32)((u32)overlay->vramStart - (u32)overlay->loadedRamAddr))
|
||||
: NULL);
|
||||
}
|
||||
|
||||
void MapMark_ClearPointers(GlobalContext* globalCtx) {
|
||||
|
@ -81,24 +79,24 @@ void MapMark_Draw(GlobalContext* globalCtx) {
|
|||
MapMarkData* mapMarkData;
|
||||
MapMarkPoint* markPoint;
|
||||
MapMarkInfo* markInfo;
|
||||
u16 dungeonId;
|
||||
u16 dungeon;
|
||||
s32 i;
|
||||
s32 rectLeft;
|
||||
s32 rectTop;
|
||||
GraphicsContext* gfxCtx;
|
||||
Gfx* dispRefs[4];
|
||||
|
||||
dungeonId = gSaveContext.dungeonIndex;
|
||||
dungeon = gSaveContext.mapIndex;
|
||||
interfaceCtx = &globalCtx->interfaceCtx;
|
||||
|
||||
if ((D_8015FFD0 != NULL) && (globalCtx->interfaceCtx.roomNum >= D_8015FFD0[7][dungeonId])) {
|
||||
if ((gMapData != NULL) && (globalCtx->interfaceCtx.mapRoomNum >= gMapData->dgnMinimapCount[dungeon])) {
|
||||
// Translates to: "ROOM NUMBER EXCEEDED, YIKES %d/%d MapMarkDraw PROCESSING INTERRUPTED"
|
||||
osSyncPrintf(VT_COL(RED, WHITE) "部屋番号がオーバーしてるで,ヤバイで %d/%d \nMapMarkDraw の処理を中断します\n",
|
||||
VT_RST, globalCtx->interfaceCtx.roomNum, D_8015FFD0[7][dungeonId]);
|
||||
VT_RST, globalCtx->interfaceCtx.mapRoomNum, gMapData->dgnMinimapCount[dungeon]);
|
||||
return;
|
||||
}
|
||||
|
||||
mapMarkData = &sLoadedMarkDataTable[dungeonId][interfaceCtx->roomNum][0];
|
||||
mapMarkData = &sLoadedMarkDataTable[dungeon][interfaceCtx->mapRoomNum][0];
|
||||
|
||||
gfxCtx = globalCtx->state.gfxCtx;
|
||||
Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_map_mark.c", 303);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue