mirror of
https://github.com/zeldaret/oot.git
synced 2025-05-12 03:53:47 +00:00
Improve the format in z_map_mark_data.c and cleanup mapmark.py (#798)
* Cleanup mapmark.py script * Rename map mark defines * Remove unused entries from map_mark_data
This commit is contained in:
parent
3fbdccbdba
commit
0b8252cfe9
4 changed files with 354 additions and 1673 deletions
|
@ -3,9 +3,9 @@
|
|||
|
||||
#include "ultra64.h"
|
||||
|
||||
#define MAP_MARK_ICON_NONE -1
|
||||
#define MAP_MARK_ICON_CHEST 0
|
||||
#define MAP_MARK_ICON_BOSS 1
|
||||
#define MAP_MARK_NONE -1
|
||||
#define MAP_MARK_CHEST 0
|
||||
#define MAP_MARK_BOSS 1
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ s8 chestFlag; // chest icon is only displayed if this flag is not set for the current room
|
||||
|
|
|
@ -98,7 +98,7 @@ void MapMark_Draw(GlobalContext* globalCtx) {
|
|||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_map_mark.c", 303);
|
||||
|
||||
while (true) {
|
||||
if (mapMarkIconData->markType == MAP_MARK_ICON_NONE) {
|
||||
if (mapMarkIconData->markType == MAP_MARK_NONE) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -109,8 +109,7 @@ void MapMark_Draw(GlobalContext* globalCtx) {
|
|||
|
||||
markPoint = mapMarkIconData->points;
|
||||
for (i = 0; i < mapMarkIconData->count; i++) {
|
||||
if (mapMarkIconData->markType != MAP_MARK_ICON_CHEST ||
|
||||
!Flags_GetTreasure(globalCtx, markPoint->chestFlag)) {
|
||||
if ((mapMarkIconData->markType != MAP_MARK_CHEST) || !Flags_GetTreasure(globalCtx, markPoint->chestFlag)) {
|
||||
markInfo = &sMapMarkInfoTable[mapMarkIconData->markType];
|
||||
|
||||
gDPPipeSync(OVERLAY_DISP++);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -6,7 +6,6 @@ import sys
|
|||
NUM_SCENES = 10
|
||||
SIMPLIFY_OUTPUT = True # setting to True reduces the final output by ~9k lines
|
||||
MAP_MARK_RAM = 0x80858B70
|
||||
MAP_MARK_ROM = 0x00C27940
|
||||
gMapMarkDataTable = 0x8085F5E8
|
||||
|
||||
DUNGEON_NAMES = [
|
||||
|
@ -43,10 +42,10 @@ def GetMapsPerScene(ptrs):
|
|||
result.append(v)
|
||||
return result
|
||||
|
||||
def GetPoints(data, ptr):
|
||||
def GetPoints(data, ptr, numPoints):
|
||||
points = []
|
||||
off = RamToOff(ptr);
|
||||
for i in range(12):
|
||||
for i in range(numPoints):
|
||||
points.append(struct.unpack_from(">bBB", data[off:off+3]))
|
||||
off = off + 3
|
||||
return points
|
||||
|
@ -54,13 +53,14 @@ def GetPoints(data, ptr):
|
|||
def GetIconData(data, ptr):
|
||||
off = RamToOff(ptr)
|
||||
v = struct.unpack_from(">bB", data[off:off+2])
|
||||
points = GetPoints(data, ptr+2)
|
||||
points = GetPoints(data, ptr+2, v[1])
|
||||
return [v[0], v[1], points]
|
||||
|
||||
def GetSceneMap(data, ptr):
|
||||
icons = []
|
||||
for i in range(3):
|
||||
icon = GetIconData(data, ptr + (i * 0x26))
|
||||
if icon[0] != 0 or icon[1] > 0:
|
||||
icons.append(icon)
|
||||
return icons
|
||||
|
||||
|
@ -78,11 +78,11 @@ def GetDungeonName(i):
|
|||
|
||||
def GetIconName(v):
|
||||
if v == 0:
|
||||
return "MAP_MARK_ICON_CHEST"
|
||||
return "MAP_MARK_CHEST"
|
||||
if v == 1:
|
||||
return "MAP_MARK_ICON_BOSS"
|
||||
return "MAP_MARK_BOSS"
|
||||
if v == -1:
|
||||
return "MAP_MARK_ICON_NONE"
|
||||
return "MAP_MARK_NONE"
|
||||
return v
|
||||
|
||||
def IND(n):
|
||||
|
@ -116,9 +116,7 @@ for scenemap in scenemaps:
|
|||
cstr += IND(1) + f"// {GetDungeonName(scenemap[0])} minimap {mapId}\n"
|
||||
cstr += IND(1) + "{\n"
|
||||
for icon in map:
|
||||
if SIMPLIFY_OUTPUT and icon[0] == 0 and icon[1] == 0:
|
||||
cstr += IND(2) + "{ 0 },\n"
|
||||
elif SIMPLIFY_OUTPUT and icon[0] == -1:
|
||||
if SIMPLIFY_OUTPUT and icon[0] == -1:
|
||||
cstr += IND(2) + f"{{ {GetIconName(icon[0])}, 0, {{ 0 }} }},\n"
|
||||
else:
|
||||
cstr += IND(2) + "{\n"
|
||||
|
@ -134,7 +132,7 @@ for scenemap in scenemaps:
|
|||
cstr += "MapMarkData* gMapMarkDataTable[] = {\n"
|
||||
for scenemap in scenemaps:
|
||||
cstr += f" {GetDungeonSymbol(scenemap[0])},\n"
|
||||
cstr += "};"
|
||||
cstr += "};\n"
|
||||
|
||||
with open(sys.argv[1], "w") as file:
|
||||
file.write(cstr)
|
Loading…
Add table
Reference in a new issue