Skip to content

Commit

Permalink
MERGE PR 403
Browse files Browse the repository at this point in the history
  • Loading branch information
quentin452 committed May 2, 2024
1 parent e52bd4a commit 2bd08f1
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 21 deletions.
2 changes: 2 additions & 0 deletions include/text_options_strings.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
#define TEXT_OPT_DRAWDIST _("DRAW DISTANCE")
#define TEXT_OPT_APPLY _("APPLY")
#define TEXT_OPT_RESETWND _("RESET WINDOW")
#define TEXT_OPT_BOWSERCAM _("BOWSER LEVEL 8-WAY CAMERA")

#define TEXT_BIND_A _("A BUTTON")
#define TEXT_BIND_B _("B BUTTON")
Expand Down Expand Up @@ -126,6 +127,7 @@
#define TEXT_OPT_DRAWDIST _("Draw Distance")
#define TEXT_OPT_APPLY _("Apply")
#define TEXT_OPT_RESETWND _("Reset Window")
#define TEXT_OPT_BOWSERCAM _("Bowser Level 8-way Camera")

#define TEXT_BIND_A _("A Button")
#define TEXT_BIND_B _("B Button")
Expand Down
51 changes: 33 additions & 18 deletions src/game/bettercamera.inc.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ u16 newcam_modeflags;
s16 newcam_saved_mode = -1;
s16 newcam_saved_defmode = -1;

u8 bowser_cam_changed;
/// This is called at every level initialisation.
void newcam_init(struct Camera *c, u8 dv) {
newcam_tilt = 1500;
Expand All @@ -138,24 +139,6 @@ void newcam_init(struct Camera *c, u8 dv) {
/// This here will dictate what modes the camera will start in at the beginning of a level. Below
/// are some examples.
switch (gCurrLevelNum) {
case LEVEL_BITDW:
newcam_yaw = 0x4000;
newcam_mode = NC_MODE_8D;
newcam_tilt = 4000;
newcam_distance_target = newcam_distance_values[2];
break;
case LEVEL_BITFS:
newcam_yaw = 0x4000;
newcam_mode = NC_MODE_8D;
newcam_tilt = 4000;
newcam_distance_target = newcam_distance_values[2];
break;
case LEVEL_BITS:
newcam_yaw = 0x4000;
newcam_mode = NC_MODE_8D;
newcam_tilt = 4000;
newcam_distance_target = newcam_distance_values[2];
break;
case LEVEL_WF:
newcam_yaw = 0x4000;
newcam_tilt = 2000;
Expand Down Expand Up @@ -187,6 +170,15 @@ void newcam_init(struct Camera *c, u8 dv) {
newcam_mode = NC_MODE_SLIDE;
break;
}
if ((gCurrLevelNum == LEVEL_BITDW) || (gCurrLevelNum == LEVEL_BITFS)
|| (gCurrLevelNum == LEVEL_BITS)) {
newcam_yaw = 0x4000;
if (configBowserCam) {
newcam_mode = NC_MODE_8D;
}
newcam_tilt = 4000;
newcam_distance_target = newcam_distance_values[2];
}

// clear these out when entering a new level to prevent "camera mode buffering"
newcam_saved_defmode = -1;
Expand Down Expand Up @@ -245,6 +237,29 @@ void newcam_init_settings(void) {
newcam_degrade = (f32) configCameraDegrade;

newcam_toggle(configEnableCamera);

if (bowser_cam_changed != configBowserCam) {
bowser_cam_changed = configBowserCam;
if ((gCurrLevelNum == LEVEL_BITDW) || (gCurrLevelNum == LEVEL_BITFS)
|| (gCurrLevelNum == LEVEL_BITS)) {
if (configEnableCamera) {
newcam_saved_defmode = -1;
newcam_saved_mode = -1;
if (configBowserCam) {
newcam_yaw = 0x4000;
newcam_mode = NC_MODE_8D;
newcam_tilt = 4000;
newcam_distance_target = newcam_distance_values[2];
newcam_tilt_acc = 0;
newcam_yaw_acc = 0;
} else {
newcam_mode = NC_MODE_NORMAL;
}
newcam_intendedmode = newcam_mode;
newcam_modeflags = newcam_mode;
}
}
}
}

/** Mathematic calculations. This stuffs so basic even *I* understand it lol
Expand Down
7 changes: 4 additions & 3 deletions src/game/options_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ static const u8 menuStr[][32] = {
};

static const u8 optsCameraStr[][32] = {
{ TEXT_OPT_CAMX }, { TEXT_OPT_CAMY }, { TEXT_OPT_INVERTX }, { TEXT_OPT_INVERTY },
{ TEXT_OPT_CAMC }, { TEXT_OPT_CAMP }, { TEXT_OPT_ANALOGUE }, { TEXT_OPT_MOUSE },
{ TEXT_OPT_CAMD }, { TEXT_OPT_CAMON },
{ TEXT_OPT_CAMX }, { TEXT_OPT_CAMY }, { TEXT_OPT_INVERTX }, { TEXT_OPT_INVERTY },
{ TEXT_OPT_CAMC }, { TEXT_OPT_CAMP }, { TEXT_OPT_ANALOGUE }, { TEXT_OPT_MOUSE },
{ TEXT_OPT_CAMD }, { TEXT_OPT_CAMON }, { TEXT_OPT_BOWSERCAM },
};

static const u8 optsVideoStr[][32] = {
Expand Down Expand Up @@ -201,6 +201,7 @@ static struct Option optsCamera[] = {
DEF_OPT_SCROLL(optsCameraStr[4], &configCameraAggr, 0, 100, 1),
DEF_OPT_SCROLL(optsCameraStr[5], &configCameraPan, 0, 100, 1),
DEF_OPT_SCROLL(optsCameraStr[8], &configCameraDegrade, 0, 100, 1),
DEF_OPT_TOGGLE(optsCameraStr[10], &configBowserCam),
};

static struct Option optsControls[] = {
Expand Down
2 changes: 2 additions & 0 deletions src/pc/configfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ bool configCameraInvertY = false;
bool configEnableCamera = false;
bool configCameraAnalog = true;
bool configCameraMouse = false;
bool configBowserCam = true;
bool configSkipIntro = 0;
bool configHUD = true;
unsigned int configDrawDistance = 100;
Expand Down Expand Up @@ -140,6 +141,7 @@ static const struct ConfigOption options[] = {
{ .name = "bettercam_aggression", .type = CONFIG_TYPE_UINT, .uintValue = &configCameraAggr },
{ .name = "bettercam_pan_level", .type = CONFIG_TYPE_UINT, .uintValue = &configCameraPan },
{ .name = "bettercam_degrade", .type = CONFIG_TYPE_UINT, .uintValue = &configCameraDegrade },
{ .name = "bettercam_bowser_cam", .type = CONFIG_TYPE_BOOL, .boolValue = &configBowserCam },
{ .name = "skip_intro", .type = CONFIG_TYPE_BOOL, .boolValue = &configSkipIntro },
#ifdef DISCORDRPC
{ .name = "discordrpc_enable", .type = CONFIG_TYPE_BOOL, .boolValue = &configDiscordRPC },
Expand Down
1 change: 1 addition & 0 deletions src/pc/configfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ extern bool configCameraInvertY;
extern bool configEnableCamera;
extern bool configCameraMouse;
extern bool configCameraAnalog;
extern bool configBowserCam;
extern bool configHUD;
extern unsigned int configDrawDistance;
extern bool configSkipIntro;
Expand Down

0 comments on commit 2bd08f1

Please sign in to comment.