You've already forked Microtransactions64
mirror of
https://github.com/Print-and-Panic/Microtransactions64.git
synced 2026-01-21 10:17:19 -08:00
Refresh 10
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
#include <ultra64.h>
|
||||
#ifdef NO_SEGMENTED_MEMORY
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include "sm64.h"
|
||||
#include "audio/external.h"
|
||||
@@ -17,13 +20,11 @@
|
||||
#include "geo_layout.h"
|
||||
#include "graph_node.h"
|
||||
#include "level_script.h"
|
||||
#include "level_misc_macros.h"
|
||||
#include "math_util.h"
|
||||
#include "surface_collision.h"
|
||||
#include "surface_load.h"
|
||||
|
||||
#define CMD_SIZE_SHIFT (sizeof(void *) >> 3)
|
||||
#define CMD_PROCESS_OFFSET(offset) ((offset & 3) | ((offset & ~3) << CMD_SIZE_SHIFT))
|
||||
|
||||
#define CMD_GET(type, offset) (*(type *) (CMD_PROCESS_OFFSET(offset) + (u8 *) sCurrentCmd))
|
||||
|
||||
// These are equal
|
||||
@@ -353,7 +354,7 @@ static void level_cmd_begin_area(void) {
|
||||
|
||||
sCurrAreaIndex = areaIndex;
|
||||
screenArea->areaIndex = areaIndex;
|
||||
gAreas[areaIndex].unk04 = (struct GraphNode *) screenArea;
|
||||
gAreas[areaIndex].unk04 = screenArea;
|
||||
|
||||
if (node != NULL) {
|
||||
gAreas[areaIndex].camera = (struct Camera *) node->config.camera;
|
||||
@@ -601,7 +602,18 @@ static void level_cmd_set_gamma(void) {
|
||||
|
||||
static void level_cmd_set_terrain_data(void) {
|
||||
if (sCurrAreaIndex != -1) {
|
||||
#ifndef NO_SEGMENTED_MEMORY
|
||||
gAreas[sCurrAreaIndex].terrainData = segmented_to_virtual(CMD_GET(void *, 4));
|
||||
#else
|
||||
Collision *data;
|
||||
u32 size;
|
||||
|
||||
// The game modifies the terrain data and must be reset upon level reload.
|
||||
data = segmented_to_virtual(CMD_GET(void *, 4));
|
||||
size = get_area_terrain_size(data) * sizeof(Collision);
|
||||
gAreas[sCurrAreaIndex].terrainData = alloc_only_pool_alloc(sLevelPool, size);
|
||||
memcpy(gAreas[sCurrAreaIndex].terrainData, data, size);
|
||||
#endif
|
||||
}
|
||||
sCurrentCmd = CMD_NEXT;
|
||||
}
|
||||
@@ -615,7 +627,19 @@ static void level_cmd_set_rooms(void) {
|
||||
|
||||
static void level_cmd_set_macro_objects(void) {
|
||||
if (sCurrAreaIndex != -1) {
|
||||
#ifndef NO_SEGMENTED_MEMORY
|
||||
gAreas[sCurrAreaIndex].macroObjects = segmented_to_virtual(CMD_GET(void *, 4));
|
||||
#else
|
||||
// The game modifies the macro object data (for example marking coins as taken),
|
||||
// so it must be reset when the level reloads.
|
||||
MacroObject *data = segmented_to_virtual(CMD_GET(void *, 4));
|
||||
s32 len = 0;
|
||||
while (data[len++] != MACRO_OBJECT_END()) {
|
||||
len += 4;
|
||||
}
|
||||
gAreas[sCurrAreaIndex].macroObjects = alloc_only_pool_alloc(sLevelPool, len * sizeof(MacroObject));
|
||||
memcpy(gAreas[sCurrAreaIndex].macroObjects, data, len * sizeof(MacroObject));
|
||||
#endif
|
||||
}
|
||||
sCurrentCmd = CMD_NEXT;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user