mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-22 03:55:11 +00:00
Reset hardcoded values on disconnect
This commit is contained in:
parent
27db236b5d
commit
897f6712a3
4 changed files with 30 additions and 9 deletions
|
@ -37,7 +37,7 @@
|
|||
// Levels //
|
||||
////////////
|
||||
|
||||
struct LevelValues gLevelValues = {
|
||||
struct LevelValues gDefaultLevelValues = {
|
||||
.entryLevel = LEVEL_CASTLE_GROUNDS,
|
||||
.exitCastleLevel = LEVEL_CASTLE,
|
||||
.exitCastleArea = 1,
|
||||
|
@ -86,11 +86,13 @@ struct LevelValues gLevelValues = {
|
|||
},
|
||||
};
|
||||
|
||||
struct LevelValues gLevelValues = { 0 };
|
||||
|
||||
///////////////
|
||||
// Behaviors //
|
||||
///////////////
|
||||
|
||||
struct BehaviorValues gBehaviorValues = {
|
||||
struct BehaviorValues gDefaultBehaviorValues = {
|
||||
.KoopaBobAgility = 4.0f,
|
||||
.KoopaCatchupAgility = 8.0f,
|
||||
.KoopaThiAgility = 6.0f,
|
||||
|
@ -218,3 +220,14 @@ struct BehaviorValues gBehaviorValues = {
|
|||
.PlatformLll2Trajectory = (Trajectory*) lll_seg7_trajectory_07028660,
|
||||
},
|
||||
};
|
||||
|
||||
struct BehaviorValues gBehaviorValues = { 0 };
|
||||
|
||||
///////////////
|
||||
// functions //
|
||||
///////////////
|
||||
|
||||
void hardcoded_reset_default_values(void) {
|
||||
gLevelValues = gDefaultLevelValues;
|
||||
gBehaviorValues = gDefaultBehaviorValues;
|
||||
}
|
||||
|
|
|
@ -195,4 +195,6 @@ struct BehaviorValues {
|
|||
|
||||
extern struct BehaviorValues gBehaviorValues;
|
||||
|
||||
void hardcoded_reset_default_values(void);
|
||||
|
||||
#endif
|
|
@ -378,10 +378,10 @@ static void geo_process_ortho_projection(struct GraphNodeOrthoProjection *node)
|
|||
if (node->node.children != NULL) {
|
||||
Mtx *mtx = alloc_display_list(sizeof(*mtx));
|
||||
if (mtx == NULL) { return; }
|
||||
f32 left = (gCurGraphNodeRoot->x - gCurGraphNodeRoot->width) / 2.0f * node->scale;
|
||||
f32 right = (gCurGraphNodeRoot->x + gCurGraphNodeRoot->width) / 2.0f * node->scale;
|
||||
f32 top = (gCurGraphNodeRoot->y - gCurGraphNodeRoot->height) / 2.0f * node->scale;
|
||||
f32 bottom = (gCurGraphNodeRoot->y + gCurGraphNodeRoot->height) / 2.0f * node->scale;
|
||||
f32 left = ((gCurGraphNodeRoot->x - gCurGraphNodeRoot->width) / 2.0f) * node->scale;
|
||||
f32 right = ((gCurGraphNodeRoot->x + gCurGraphNodeRoot->width) / 2.0f) * node->scale;
|
||||
f32 top = ((gCurGraphNodeRoot->y - gCurGraphNodeRoot->height) / 2.0f) * node->scale;
|
||||
f32 bottom = ((gCurGraphNodeRoot->y + gCurGraphNodeRoot->height) / 2.0f) * node->scale;
|
||||
|
||||
guOrtho(mtx, left, right, bottom, top, -2.0f, 2.0f, 1.0f);
|
||||
gSPPerspNormalize(gDisplayListHead++, 0xFFFF);
|
||||
|
@ -404,10 +404,12 @@ static void geo_process_perspective(struct GraphNodePerspective *node) {
|
|||
Mtx *mtx = alloc_display_list(sizeof(*mtx));
|
||||
if (mtx == NULL) { return; }
|
||||
|
||||
f32 divisor = (f32) gCurGraphNodeRoot->height;
|
||||
if (divisor == 0) { divisor = 1; }
|
||||
#ifdef VERSION_EU
|
||||
f32 aspect = ((f32) gCurGraphNodeRoot->width / (f32) gCurGraphNodeRoot->height) * 1.1f;
|
||||
f32 aspect = ((f32) gCurGraphNodeRoot->width / divisor) * 1.1f;
|
||||
#else
|
||||
f32 aspect = (f32) gCurGraphNodeRoot->width / (f32) gCurGraphNodeRoot->height;
|
||||
f32 aspect = (f32) gCurGraphNodeRoot->width / divisor;
|
||||
#endif
|
||||
|
||||
guPerspective(mtx, &perspNorm, not_zero(node->prevFov, gOverrideFOV), aspect, not_zero(node->near, gOverrideNear), not_zero(node->far, gOverrideFar), 1.0f);
|
||||
|
@ -1066,7 +1068,9 @@ static s32 obj_is_in_view(struct GraphNodeObject *node, Mat4 matrix) {
|
|||
// Half of the fov in in-game angle units instead of degrees.
|
||||
s16 halfFov = (gCurGraphNodeCamFrustum->fov / 2.0f + 1.0f) * 32768.0f / 180.0f + 0.5f;
|
||||
|
||||
f32 hScreenEdge = -matrix[3][2] * sins(halfFov) / coss(halfFov);
|
||||
f32 divisor = coss(halfFov);
|
||||
if (divisor == 0) { divisor = 1; }
|
||||
f32 hScreenEdge = -matrix[3][2] * sins(halfFov) / divisor;
|
||||
// -matrix[3][2] is the depth, which gets multiplied by tan(halfFov) to get
|
||||
// the amount of units between the center of the screen and the horizontal edge
|
||||
// given the distance from the object to the camera.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "smlua.h"
|
||||
#include "game/hardcoded.h"
|
||||
#include "pc/mods/mods.h"
|
||||
#include "pc/mods/mods_utils.h"
|
||||
#include "pc/crash_handler.h"
|
||||
|
@ -178,6 +179,7 @@ void smlua_update(void) {
|
|||
}
|
||||
|
||||
void smlua_shutdown(void) {
|
||||
hardcoded_reset_default_values();
|
||||
smlua_text_utils_reset_all();
|
||||
smlua_audio_utils_reset_all();
|
||||
audio_custom_shutdown();
|
||||
|
|
Loading…
Reference in a new issue