-
Notifications
You must be signed in to change notification settings - Fork 432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
z_map decompiled #1032
Merged
Merged
z_map decompiled #1032
Changes from all commits
Commits
Show all changes
56 commits
Select commit
Hold shift + click to select a range
31f40ad
First batch of functions
mzxrules 7769846
more ok
mzxrules 0b99719
Merge remote-tracking branch 'upstream/master' into z_map_
mzxrules 30465e1
z_map_data OK
mzxrules 2ac9fe4
More OKs, MinimapList ZAPD breaking change
mzxrules bbdf16e
func_80103A58 improvements, more OK
mzxrules 4ae7b95
Merge remote-tracking branch 'upstream/master' into z_map_
mzxrules 90d82ee
func_80106D5C and func_801091F0 decomped
mzxrules 5c616b9
func_801031D0 decomped and some fixes
mzxrules 723c82c
house cleaning, more OKs more decomp
mzxrules e5c6aac
Merge remote-tracking branch 'upstream/master' into z_map_
mzxrules cdabbfd
Even more OKs
mzxrules 5ece255
func_80105C40 almost OK, more OKs
mzxrules 7879695
func_80108AF8 OK and more
mzxrules e71c8e6
All functions attempted
mzxrules 30b83c1
func_8010534C OK
mzxrules 64bced7
Start documentation, rename DoorCtx
mzxrules 1da0fa1
More OKs, split map_data.data, more doc
mzxrules a65750c
incremental clean-up, more function names
mzxrules b78ac55
more function names
mzxrules 49492b6
Merge remote-tracking branch 'origin/master' into z_map_
mzxrules 0a8d285
Merge remote-tracking branch 'origin/master' into z_map_
mzxrules 88a9eb5
Merge remote-tracking branch 'origin/master' into z_map_
mzxrules 98c44d5
func_801068FC OK
mzxrules b8af4ef
Merge remote-tracking branch 'origin/master' into z_map_
mzxrules 91a12ce
Merge remote-tracking branch 'origin/master' into z_map_
mzxrules 7630165
old uncommitted changes
mzxrules de4f30d
Merge remote-tracking branch 'origin/main' into z_map_
mzxrules 413d778
Merge remote-tracking branch 'origin/main' into z_map_
mzxrules fffc9d0
minor tweaks
mzxrules 9282fed
Merge remote-tracking branch 'origin/main' into z_map_
mzxrules 3444cdb
implement easy fixes
mzxrules f605759
more fixes
mzxrules 0e374ca
z_map_disp OK, implement more suggestions
mzxrules 6c438d0
delete utility program
mzxrules 9d3a447
migrate data
mzxrules 396379a
TransiActor ->TransitionActor
mzxrules b89b64d
Major documentation pass
mzxrules 1d0257c
first pass of changes
mzxrules 88b8340
Merge remote-tracking branch 'origin/main' into z_map_
mzxrules 651c120
warning fix attempt, revert ZFile.cpp
mzxrules f6495ce
Merge remote-tracking branch 'origin/main' into z_map_
mzxrules c73dfb2
Fix FAKE match
mzxrules eb411c4
Easy fixes
mzxrules 2c33644
implement gDPLoadTextureBlock_Runtime
mzxrules 72e98a8
Merge remote-tracking branch 'origin/main' into z_map_
mzxrules e4f2865
z_demo bss patch
mzxrules 2488d3b
Extract white square texture
mzxrules 5db5048
Implement more suggestions
mzxrules 2df69d3
Merge remote-tracking branch 'origin/main' into z_map_
mzxrules b32db23
rework MapIndex/DungeonIndex
mzxrules 4534bba
revert dungeonSceneIndex -> mapIndex in some spots, implement suggest…
mzxrules d7528dc
Merge remote-tracking branch 'origin/main' into z_map_
mzxrules 7b464e1
more suggestions
mzxrules b69772a
minor nits
mzxrules 40ccffa
fix #include
mzxrules File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<Root> | ||
<File Name="code" OutName="z_map_disp" BaseAddress="0x800A5AC0" RangeStart="0x119078" RangeEnd="0x1190F8" > | ||
<Texture Name="sWhiteSquareTex" OutName="white_square" Format="i4" Width="16" Height="16" Offset="0x119078"/> | ||
</File> | ||
</Root> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,143 @@ | ||
#ifndef Z64MAP_H | ||
#define Z64MAP_H | ||
#include "ultra64.h" | ||
#include "z64scene.h" | ||
|
||
struct PlayState; | ||
|
||
/* | ||
Handles the minimap and pause screen dungeon map system. | ||
|
||
z_map_data.c stores MapSpriteInfo and helper functions to "simplify" accessing this data | ||
|
||
Two separate Id systems are used to access data | ||
|
||
mapId | ||
0x000-0x004 fetches minimap sprite data from gameplay_dangeon_keep | ||
0x005-0x039 fetches dungeon map sprite data from map_i_static | ||
0x100-0x161 fetches minimap sprite data from map_grand_static | ||
|
||
mapCompactId | ||
0x000-0x039 fetches dungeon map sprite data from map_i_static | ||
0x03A-0x09B fetches minimap sprite data from map_grand_static | ||
*/ | ||
|
||
#define FLOOR_INDEX_MAX 4 | ||
#define FLOOR_MIN_Y -32767 | ||
|
||
/* z_map_data */ | ||
#define MAPDATA_GAMEPLAY_DANGEON_KEEP_MAX 5 | ||
#define MAPDATA_MAP_I_MAX 0x3A | ||
#define MAPDATA_MAP_GRAND 0x100 | ||
#define MAPDATA_MAP_GRAND_MAX 0x162 | ||
#define MAPDATA_GET_MAP_GRAND_ID_FROM_COMPACT_ID(id) ((id) + (MAPDATA_MAP_GRAND - MAPDATA_MAP_I_MAX)) | ||
#define MAPDATA_GET_MAP_GRAND_ID_FROM_MAP_ID(mapId) ((mapId) - MAPDATA_MAP_GRAND) | ||
|
||
#define MAPDATA_MID_GAMEPLAY_DANGEON_KEEP 0 | ||
#define MAPDATA_MID_MAP_GRAND_STATIC 1 | ||
#define MAPDATA_MID_MAP_I_STATIC 2 | ||
|
||
#define MAPDATA_CPID_MAP_GRAND_STATIC 0 | ||
#define MAPDATA_CPID_MAP_I_STATIC 1 | ||
#define MAPDATA_CPID_2 2 | ||
|
||
#define MAPDATA_DRAW_0 0 | ||
#define MAPDATA_DRAW_1 1 | ||
#define MAPDATA_DRAW_2 2 | ||
#define MAPDATA_DRAW_3 3 | ||
|
||
/* z_map_disp */ | ||
typedef struct { | ||
/* 0x00 */ MapDataScene* mapDataScene; | ||
/* 0x04 */ s32 curRoom; | ||
/* 0x08 */ s16 minimapBaseX; | ||
/* 0x0A */ s16 minimapBaseY; | ||
/* 0x0C */ s16 minimapCurX; | ||
/* 0x0E */ s16 minimapCurY; | ||
/* 0x10 */ TexturePtr minimapCurTex; // gameplay cur minimap room | ||
/* 0x14 */ s32 prevRoom; | ||
/* 0x18 */ TexturePtr minimapPrevTex; | ||
/* 0x1C */ s16 minimapPrevX; // for room swap animation | ||
/* 0x1E */ s16 minimapPrevY; // for room swap animation | ||
/* 0x20 */ s32 unk20; | ||
/* 0x24 */ s32 swapAnimTimer; | ||
/* 0x28 */ void* texBuff0; | ||
/* 0x2C */ void* texBuff1; | ||
/* 0x30 */ s16 sceneMinX; //scene minBounds.x | ||
/* 0x32 */ s16 sceneMinZ; //scene minBounds.z | ||
/* 0x34 */ s16 sceneWidth; //scene boundsWidth.x | ||
/* 0x36 */ s16 sceneHeight; //scene boundsWidth.z | ||
/* 0x38 */ s16 sceneMidX; //scene boundsMidpoint.x | ||
/* 0x3A */ s16 sceneMidZ; //scene boundsMidpoint.z | ||
/* 0x3C */ s16* roomStoreyList; // list of lowest storey each room crosses | ||
/* 0x40 */ s16 numStoreys; // number of distinct storeys | ||
/* 0x42 */ s16 pauseMapCurStorey; | ||
/* 0x44 */ s16 bottomStorey; // configures what storey 0 is displayed as | ||
/* 0x48 */ s16* storeyYList; // list of min Ys for each storey | ||
/* 0x4C */ s16 timer; | ||
/* 0x50 */ s32 numChests; | ||
/* 0x54 */ MapDataChest* mapDataChests; | ||
/* 0x58 */ s16 bossRoomStorey; | ||
/* 0x5A */ s16 unk5A; | ||
} MapDisp; // size = 0x5C | ||
|
||
typedef struct { | ||
/* 0x000 */ s32 textureCount; | ||
/* 0x004 */ s32 mapI_mapCompactId[ROOM_MAX]; | ||
/* 0x084 */ void* mapI_roomTextures[ROOM_MAX]; | ||
/* 0x104 */ void* roomSprite[ROOM_MAX]; | ||
/* 0x184 */ s32 animTimer; | ||
} PauseDungeonMap; // size = 0x188 | ||
|
||
/* z_map_disp */ | ||
void func_80102EB4(u32 flag); | ||
void func_80102ED0(u32 flag); | ||
s32 MapDisp_CurRoomHasMapI(struct PlayState* play); | ||
void MapDisp_Init(struct PlayState* play); | ||
s32 MapDisp_GetBossIconY(void); | ||
s16 MapDisp_GetBossRoomStorey(void); | ||
void MapDisp_InitMapData(struct PlayState* play, void* segmentAddress); | ||
void MapDisp_InitChestData(struct PlayState* play, s32 num, void* segmentAddress); | ||
void MapDisp_InitTransitionActorData(struct PlayState* play, s32 num, TransitionActorEntry* transitionActorList); | ||
void MapDisp_Destroy(struct PlayState* play); | ||
void MapDisp_Update(struct PlayState* play); | ||
void MapDisp_SwapRooms(s16 nextRoom); | ||
s32 MapDisp_IsMinimapToggleBlocked(struct PlayState* play); | ||
void MapDisp_DrawMinimap(struct PlayState* play, s32 playerInitX, s32 playerInitZ, s32 playerInitDir); | ||
void* MapDisp_AllocDungeonMap(struct PlayState* play, void* heap); | ||
void MapDisp_DrawDungeonFloorSelect(struct PlayState* play); | ||
s32 MapDisp_IsValidStorey(s32 storey); | ||
s32 MapDisp_GetPlayerStorey(s16 checkY); | ||
void MapDisp_DrawDungeonMap(struct PlayState* play); | ||
void MapDisp_UpdateDungeonMap(struct PlayState* play); | ||
|
||
/* z_map_data */ | ||
void MapData_GetMapColor(s32 colorIndex, Color_RGBA8* color); | ||
TexturePtr MapData_GetMapTexGameplayDangeonKeep(s32); | ||
s32 MapData_GetMapCompactId(s32); | ||
s32 MapData_MID_GetType(s32); | ||
s32 MapData_CPID_GetSizeOfMapTex(s32); | ||
void MapData_GetDrawType(s32, s32*); | ||
s32 MapData_GetMapColorIndex(s32); | ||
s32 MapDisp_GetSizeOfMapITex(s32 mapCompactId); | ||
s32 MapData_GetMapIId(s32); | ||
s32 MapData_GetSizeOfMapGrandTex(s32 mapId); | ||
void MapData_GetMapTexDim(s32 mapId, s32* width, s32* height); | ||
void MapData_GetMapTexOffset(s32 mapId, s32* offsetX, s32* offsetY); | ||
void MapData_GetMapScale(s32 mapId, s32 *scale); | ||
void MapData_CPID_GetTexDim(s32 mapCompactId, s32* width, s32* height); | ||
void MapData_CPID_GetTexOffset(s32 mapCompactId, s32* offsetX, s32* offsetY); | ||
s16 MapData_CPID_GetMapScale(s32 mapCompactId); | ||
|
||
/* z_map_exp */ | ||
s32 Map_IsInDungeonOrBossScene(struct PlayState* play); | ||
s32 Map_CurRoomHasMapI(struct PlayState* play); | ||
s32 Map_IsInBossScene(struct PlayState* play); | ||
void Map_SetAreaEntrypoint(struct PlayState* play); | ||
void Map_InitRoomData(struct PlayState* play, s16 room); | ||
void Map_Destroy(struct PlayState* play); | ||
void Map_Init(struct PlayState* play); | ||
void Map_DrawMinimap(struct PlayState* play); | ||
void Map_Update(struct PlayState* play); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks nicer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer keep coordinates stored in decimal, to stay consistent with e.g. z64bgcheck.h