Added global force parameter (thx cozies)

This commit is contained in:
Reonu
2021-08-02 17:44:03 +01:00
parent cc3ecd1939
commit 179fc3196b
4 changed files with 41 additions and 0 deletions

View File

@@ -52,6 +52,7 @@ This is a fork of the ultrasm64 repo by CrashOveride which includes the followin
- There is a `gIsConsole` variable that is 1 when running on console and 0 when running on emulator. This way you can wrap your code in a console check.
- Expanded audio heap allows for a larger concurrent note count and the importing of more m64 sequences and sound banks (By ArcticJaguar725) *
- You can set a test level in config.h in order to boot straight into it, so you can quickly test the level you're working on. *
- Allows all surfaces in the game to have a `force` parameter. Activating this doesn't REQUIRE you to set `force` for every surface: If you don't set, it will default to 0x0000 rather than crashing. Increases RAM usage of collision. *
- Colored ia4 text support. Format: `"@XXXXXXXX[YOUR TEXT]@--------"` (By ArcticJaguar725)
- Example Text: `"@FF0000FFRED @00FF00FFGREEN @0000FFFFBLUE @FFFFFF00INVISIBLE @--------NORMAL"`
- NOTE: It is not mandatory to reset the text color with `"@--------"`, but text will need to be recolored each time it scrolls in a dialog box, or the custom color will reset.

View File

@@ -107,6 +107,8 @@
#define MODEL_ID_COUNT 256
// Increase audio heap size to allow for more concurrent notes to be played and for more custom sequences/banks to be imported (does nothing with EU and SH versions)
#define EXPAND_AUDIO_HEAP
// Allow all surfaces types to have force, (doesn't require setting force, just allows it to be optional).
#define ALL_SURFACES_HAVE_FORCE
// BUG/GAME QOL FIXES
// Fix instant warp offset not working when warping across different areas

View File

@@ -1,6 +1,8 @@
#ifndef SURFACE_TERRAINS_H
#define SURFACE_TERRAINS_H
#include "config.h"
// Surface Types
#define SURFACE_DEFAULT 0x0000 // Environment default
#define SURFACE_BURNING 0x0001 // Lava / Frostbite (in SL), but is used mostly for Lava
@@ -202,7 +204,11 @@
#define COL_TRI_INIT(surfType, triNum) surfType, triNum
// Collision Tri
#ifdef ALL_SURFACES_HAVE_FORCE
#define COL_TRI(v1, v2, v3) v1, v2, v3, 0
#else
#define COL_TRI(v1, v2, v3) v1, v2, v3
#endif
// Collision Tri With Special Params
#define COL_TRI_SPECIAL(v1, v2, v3, param) v1, v2, v3, param

View File

@@ -15,6 +15,8 @@
#include "game/object_list_processor.h"
#include "surface_load.h"
#include "config.h"
s32 unused8038BE90;
/**
@@ -389,6 +391,7 @@ static struct Surface *read_surface_data(s16 *vertexData, s16 **vertexIndices) {
return surface;
}
#ifndef ALL_SURFACES_HAVE_FORCE
/**
* Returns whether a surface has exertion/moves Mario
* based on the surface type.
@@ -412,6 +415,7 @@ static s32 surface_has_force(s16 surfaceType) {
}
return hasForce;
}
#endif
/**
* Returns whether a surface should have the
@@ -444,7 +448,9 @@ static void load_static_surfaces(s16 **data, s16 *vertexData, s16 surfaceType, s
s32 numSurfaces;
struct Surface *surface;
s8 room = 0;
#ifndef ALL_SURFACES_HAVE_FORCE
s16 hasForce = surface_has_force(surfaceType);
#endif
s16 flags = surf_has_no_cam_collision(surfaceType);
numSurfaces = *(*data);
@@ -462,19 +468,27 @@ static void load_static_surfaces(s16 **data, s16 *vertexData, s16 surfaceType, s
surface->type = surfaceType;
surface->flags = (s8) flags;
#ifdef ALL_SURFACES_HAVE_FORCE
surface->force = *(*data + 3);
#else
if (hasForce) {
surface->force = *(*data + 3);
} else {
surface->force = 0;
}
#endif
add_surface(surface, FALSE);
}
#ifdef ALL_SURFACES_HAVE_FORCE
*data += 4;
#else
*data += 3;
if (hasForce) {
*data += 1;
}
#endif
}
}
@@ -549,7 +563,9 @@ u32 get_area_terrain_size(s16 *data) {
s32 numVertices;
s32 numRegions;
s32 numSurfaces;
#ifndef ALL_SURFACES_HAVE_FORCE
s16 hasForce;
#endif
while (!end) {
terrainLoadType = *data++;
@@ -578,8 +594,12 @@ u32 get_area_terrain_size(s16 *data) {
default:
numSurfaces = *data++;
#ifdef ALL_SURFACES_HAVE_FORCE
data += 4 * numSurfaces;
#else
hasForce = surface_has_force(terrainLoadType);
data += (3 + hasForce) * numSurfaces;
#endif
break;
}
}
@@ -709,7 +729,9 @@ void load_object_surfaces(s16 **data, s16 *vertexData) {
s32 surfaceType;
s32 i;
s32 numSurfaces;
#ifndef ALL_SURFACES_HAVE_FORCE
s16 hasForce;
#endif
s16 flags;
s16 room;
@@ -719,7 +741,9 @@ void load_object_surfaces(s16 **data, s16 *vertexData) {
numSurfaces = *(*data);
(*data)++;
#ifndef ALL_SURFACES_HAVE_FORCE
hasForce = surface_has_force(surfaceType);
#endif
flags = surf_has_no_cam_collision(surfaceType);
flags |= SURFACE_FLAG_DYNAMIC;
@@ -739,22 +763,30 @@ void load_object_surfaces(s16 **data, s16 *vertexData) {
surface->object = gCurrentObject;
surface->type = surfaceType;
#ifdef ALL_SURFACES_HAVE_FORCE
surface->force = *(*data + 3);
#else
if (hasForce) {
surface->force = *(*data + 3);
} else {
surface->force = 0;
}
#endif
surface->flags |= flags;
surface->room = (s8) room;
add_surface(surface, TRUE);
}
#ifdef ALL_SURFACES_HAVE_FORCE
*data += 4;
#else
if (hasForce) {
*data += 4;
} else {
*data += 3;
}
#endif
}
}