Merge pull request #6 from someone2639/u16_models

U16 models (again)
This commit is contained in:
Reonu
2021-05-27 19:00:28 +01:00
committed by GitHub
4 changed files with 13 additions and 16 deletions

View File

@@ -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

View File

@@ -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), \

View File

@@ -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,

View File

@@ -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);