diff --git a/include/config.h b/include/config.h index 828261c4..d962be29 100644 --- a/include/config.h +++ b/include/config.h @@ -65,7 +65,7 @@ // Uncomment this if you want to keep the mario head and not skip it //#define KEEP_MARIO_HEAD // Number of possible unique model ID's (keep it higher than 256) -#define MODEL_ID_COUNT 0x10000 +#define MODEL_ID_COUNT 256 /* Coordinate overflow fix setting: * Scales the world down by this factor, increasing how far you can render on diff --git a/include/level_commands.h b/include/level_commands.h index c7804aa8..b3a2816b 100644 --- a/include/level_commands.h +++ b/include/level_commands.h @@ -210,15 +210,13 @@ CMD_BBH(0x20, 0x04, 0x0000) #define LOAD_MODEL_FROM_DL(model, dl, layer) \ - CMD_BBH(0x21, 0x10, 0), \ + CMD_BBH(0x21, 0x0C, 0), \ CMD_PTR(dl), \ - CMD_W(layer), \ - CMD_W(model) + CMD_HH(layer, model) #define LOAD_MODEL_FROM_GEO(model, geo) \ - CMD_BBH(0x22, 0x0C, 0), \ - CMD_PTR(geo), \ - CMD_W(model) + CMD_BBH(0x22, 0x08, model), \ + CMD_PTR(geo) // unk8 is float, but doesn't really matter since CMD23 is unused #define CMD23(model, unk4, unk8) \ @@ -237,10 +235,9 @@ OBJECT_WITH_ACTS(model, posX, posY, posZ, angleX, angleY, angleZ, behParam, beh, 0x1F) #define MARIO(model, behArg, beh) \ - CMD_BBH(0x25, 0x10, 0), \ + CMD_BBH(0x25, 0x0C, model), \ CMD_W(behArg), \ - CMD_PTR(beh), \ - CMD_W(model) + CMD_PTR(beh) #define WARP_NODE(id, destLevel, destArea, destNode, flags) \ CMD_BBBB(0x26, 0x08, id, destLevel), \ diff --git a/include/types.h b/include/types.h index 5548eab8..475655cf 100644 --- a/include/types.h +++ b/include/types.h @@ -54,7 +54,7 @@ typedef s16 Trajectory; typedef s16 PaintingData; typedef uintptr_t BehaviorScript; typedef u8 Texture; -typedef u32 ModelID; +typedef u16 ModelID; enum SpTaskState { SPTASK_STATE_NOT_STARTED, diff --git a/src/engine/level_script.c b/src/engine/level_script.c index 24c83bb0..c823b1a9 100644 --- a/src/engine/level_script.c +++ b/src/engine/level_script.c @@ -375,8 +375,8 @@ static void level_cmd_end_area(void) { } static void level_cmd_load_model_from_dl(void) { - ModelID model = CMD_GET(ModelID, 0xC); - s16 layer = CMD_GET(u32, 0x8); + ModelID model = CMD_GET(ModelID, 0xA); + s16 layer = CMD_GET(u16, 0x8); void *dl_ptr = CMD_GET(void *, 4); if (model < MODEL_ID_COUNT) { @@ -388,7 +388,7 @@ static void level_cmd_load_model_from_dl(void) { } static void level_cmd_load_model_from_geo(void) { - ModelID model = CMD_GET(ModelID, 8); + ModelID model = CMD_GET(ModelID, 2); void *geo = CMD_GET(void *, 4); if (model < MODEL_ID_COUNT) { @@ -428,7 +428,7 @@ static void level_cmd_init_mario(void) { gMarioSpawnInfo->areaIndex = 0; gMarioSpawnInfo->behaviorArg = CMD_GET(u32, 4); gMarioSpawnInfo->behaviorScript = CMD_GET(void *, 8); - gMarioSpawnInfo->unk18 = gLoadedGraphNodes[CMD_GET(ModelID, 0xC)]; + gMarioSpawnInfo->unk18 = gLoadedGraphNodes[CMD_GET(ModelID, 0x2)]; gMarioSpawnInfo->next = NULL; sCurrentCmd = CMD_NEXT; @@ -440,7 +440,7 @@ static void level_cmd_place_object(void) { struct SpawnInfo *spawnInfo; if (sCurrAreaIndex != -1 && ((CMD_GET(u8, 2) & val7) || CMD_GET(u8, 2) == 0x1F)) { - model = CMD_GET(ModelID, 0x18); + model = CMD_GET(u32, 0x18); spawnInfo = alloc_only_pool_alloc(sLevelPool, sizeof(struct SpawnInfo)); spawnInfo->startPos[0] = CMD_GET(s16, 4);