Refresh 8
This commit is contained in:
1 parent
06ec56df7f
commit
c45aa301bb
279 files changed
+6522
-7273
No files matched your search
+621
-450
File diff suppressed because it is too large.
Load diff
@@ -1,30 +1,29 @@
|
||||
#ifndef _BEHAVIOR_SCRIPT_H_
|
||||
#define _BEHAVIOR_SCRIPT_H_
|
||||
|
||||
#define BEH_BREAK 1
|
||||
#define BEH_CONTINUE 0
|
||||
#define BHV_PROC_CONTINUE 0
|
||||
#define BHV_PROC_BREAK 1
|
||||
|
||||
#define cur_object_get_int(offset) gCurrentObject->OBJECT_FIELD_S32(offset)
|
||||
#define cur_object_get_float(offset) gCurrentObject->OBJECT_FIELD_F32(offset)
|
||||
#define cur_obj_get_int(offset) gCurrentObject->OBJECT_FIELD_S32(offset)
|
||||
#define cur_obj_get_float(offset) gCurrentObject->OBJECT_FIELD_F32(offset)
|
||||
|
||||
#define cur_object_add_float(offset, value) gCurrentObject->OBJECT_FIELD_F32(offset) += (f32)(value)
|
||||
#define cur_object_set_float(offset, value) gCurrentObject->OBJECT_FIELD_F32(offset) = (f32)(value)
|
||||
#define cur_object_add_int(offset, value) gCurrentObject->OBJECT_FIELD_S32(offset) += (s32)(value)
|
||||
#define cur_object_set_int(offset, value) gCurrentObject->OBJECT_FIELD_S32(offset) = (s32)(value)
|
||||
#define cur_object_or_int(offset, value) gCurrentObject->OBJECT_FIELD_S32(offset) |= (s32)(value)
|
||||
#define cur_object_and_int(offset, value) gCurrentObject->OBJECT_FIELD_S32(offset) &= (s32)(value)
|
||||
#define cur_object_set_vptr(offset, value) gCurrentObject->OBJECT_FIELD_VPTR(offset) = (void *)(value)
|
||||
#define cur_obj_add_float(offset, value) gCurrentObject->OBJECT_FIELD_F32(offset) += (f32)(value)
|
||||
#define cur_obj_set_float(offset, value) gCurrentObject->OBJECT_FIELD_F32(offset) = (f32)(value)
|
||||
#define cur_obj_add_int(offset, value) gCurrentObject->OBJECT_FIELD_S32(offset) += (s32)(value)
|
||||
#define cur_obj_set_int(offset, value) gCurrentObject->OBJECT_FIELD_S32(offset) = (s32)(value)
|
||||
#define cur_obj_or_int(offset, value) gCurrentObject->OBJECT_FIELD_S32(offset) |= (s32)(value)
|
||||
#define cur_obj_and_int(offset, value) gCurrentObject->OBJECT_FIELD_S32(offset) &= (s32)(value)
|
||||
#define cur_obj_set_vptr(offset, value) gCurrentObject->OBJECT_FIELD_VPTR(offset) = (void *)(value)
|
||||
|
||||
#define object_and_int(object, offset, value) object->OBJECT_FIELD_S32(offset) &= (s32)(value)
|
||||
#define obj_and_int(object, offset, value) object->OBJECT_FIELD_S32(offset) &= (s32)(value)
|
||||
|
||||
u16 RandomU16(void);
|
||||
float RandomFloat(void);
|
||||
s32 RandomSign(void);
|
||||
u16 random_u16(void);
|
||||
float random_float(void);
|
||||
s32 random_sign(void);
|
||||
|
||||
void func_80383D68(struct Object *object);
|
||||
void obj_update_gfx_pos_and_angle(struct Object *);
|
||||
void stub_behavior_script_2(void);
|
||||
|
||||
void stub_80385BF0(void);
|
||||
|
||||
void cur_object_exec_behavior(void);
|
||||
void cur_obj_update(void);
|
||||
|
||||
#endif /* _BEHAVIOR_SCRIPT_H_ */
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "buffers/framebuffers.h"
|
||||
#include "buffers/zbuffer.h"
|
||||
#include "game/area.h"
|
||||
#include "game/display.h"
|
||||
#include "game/game_init.h"
|
||||
#include "game/mario.h"
|
||||
#include "game/memory.h"
|
||||
#include "game/object_helpers.h"
|
||||
|
||||
@@ -20,12 +20,9 @@
|
||||
*/
|
||||
static s32 find_wall_collisions_from_list(struct SurfaceNode *surfaceNode,
|
||||
struct WallCollisionData *data) {
|
||||
#ifdef VERSION_EU
|
||||
UNUSED u8 pad;
|
||||
#endif
|
||||
register struct Surface *surf;
|
||||
register f32 offset;
|
||||
register f32 radius = data->radius;
|
||||
register struct Surface *surf;
|
||||
register f32 x = data->x;
|
||||
register f32 y = data->y + data->offsetY;
|
||||
register f32 z = data->z;
|
||||
|
||||
+24
-21
@@ -103,6 +103,10 @@ static void clear_static_surfaces(void) {
|
||||
|
||||
/**
|
||||
* Add a surface to the correct cell list of surfaces.
|
||||
* @param dynamic Determines whether the surface is static or dynamic
|
||||
* @param cellX The X position of the cell in which the surface resides
|
||||
* @param cellZ The Z position of the cell in which the surface resides
|
||||
* @param surface The surface to add
|
||||
*/
|
||||
static void add_surface_to_cell(s16 dynamic, s16 cellX, s16 cellZ, struct Surface *surface) {
|
||||
struct SurfaceNode *newNode = alloc_surface_node();
|
||||
@@ -191,23 +195,24 @@ static s16 max_3(s16 a0, s16 a1, s16 a2) {
|
||||
/**
|
||||
* Every level is split into 16 * 16 cells of surfaces (to limit computing
|
||||
* time). This function determines the lower cell for a given x/z position.
|
||||
* @param coord The coordinate to test
|
||||
*/
|
||||
static s16 lower_cell_index(s16 t) {
|
||||
static s16 lower_cell_index(s16 coord) {
|
||||
s16 index;
|
||||
|
||||
// Move from range [-0x2000, 0x2000) to [0, 0x4000)
|
||||
t += 0x2000;
|
||||
if (t < 0) {
|
||||
t = 0;
|
||||
coord += 0x2000;
|
||||
if (coord < 0) {
|
||||
coord = 0;
|
||||
}
|
||||
|
||||
// [0, 16)
|
||||
index = t / 0x400;
|
||||
index = coord / 0x400;
|
||||
|
||||
// Include extra cell if close to boundary
|
||||
//! Some wall checks are larger than the buffer, meaning wall checks can
|
||||
// miss walls that are near a cell border.
|
||||
if (t % 0x400 < 50) {
|
||||
if (coord % 0x400 < 50) {
|
||||
index -= 1;
|
||||
}
|
||||
|
||||
@@ -222,23 +227,24 @@ static s16 lower_cell_index(s16 t) {
|
||||
/**
|
||||
* Every level is split into 16 * 16 cells of surfaces (to limit computing
|
||||
* time). This function determines the upper cell for a given x/z position.
|
||||
* @param coord The coordinate to test
|
||||
*/
|
||||
static s16 upper_cell_index(s16 t) {
|
||||
static s16 upper_cell_index(s16 coord) {
|
||||
s16 index;
|
||||
|
||||
// Move from range [-0x2000, 0x2000) to [0, 0x4000)
|
||||
t += 0x2000;
|
||||
if (t < 0) {
|
||||
t = 0;
|
||||
coord += 0x2000;
|
||||
if (coord < 0) {
|
||||
coord = 0;
|
||||
}
|
||||
|
||||
// [0, 16)
|
||||
index = t / 0x400;
|
||||
index = coord / 0x400;
|
||||
|
||||
// Include extra cell if close to boundary
|
||||
//! Some wall checks are larger than the buffer, meaning wall checks can
|
||||
// miss walls that are near a cell border.
|
||||
if (t % 0x400 > 0x400 - 50) {
|
||||
if (coord % 0x400 > 0x400 - 50) {
|
||||
index += 1;
|
||||
}
|
||||
|
||||
@@ -254,6 +260,8 @@ static s16 upper_cell_index(s16 t) {
|
||||
* Every level is split into 16x16 cells, this takes a surface, finds
|
||||
* the appropriate cells (with a buffer), and adds the surface to those
|
||||
* cells.
|
||||
* @param surface The surface to check
|
||||
* @param dynamic Boolean determining whether the surface is static or dynamic
|
||||
*/
|
||||
static void add_surface(struct Surface *surface, s32 dynamic) {
|
||||
// minY/maxY maybe? s32 instead of s16, though.
|
||||
@@ -283,12 +291,13 @@ static void add_surface(struct Surface *surface, s32 dynamic) {
|
||||
}
|
||||
}
|
||||
|
||||
static void unused_80382B6C(void) {
|
||||
static void stub_surface_load_1(void) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize a surface from reading it's data and putting it into a surface
|
||||
* stuct.
|
||||
* Initializes a Surface struct using the given vertex data
|
||||
* @param vertexData The raw data containing vertex positions
|
||||
* @param vertexIndices Helper which tells positions in vertexData to start reading vertices
|
||||
*/
|
||||
static struct Surface *read_surface_data(s16 *vertexData, s16 **vertexIndices) {
|
||||
struct Surface *surface;
|
||||
@@ -602,14 +611,8 @@ static void unused_80383604(void) {
|
||||
*/
|
||||
void transform_object_vertices(s16 **data, s16 *vertexData) {
|
||||
register s16 *vertices;
|
||||
|
||||
#ifdef VERSION_EU
|
||||
register f32 vx, vy, vz;
|
||||
register s32 numVertices;
|
||||
#else
|
||||
register s32 numVertices;
|
||||
register f32 vx, vy, vz;
|
||||
#endif
|
||||
|
||||
Mat4 *objectTransform;
|
||||
Mat4 m;
|
||||
|
||||
Reference in new issue
Block a user