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