Some additions, mostly camera

This commit is contained in:
Mors 2021-03-30 01:36:16 +03:00
parent 6de4a4da64
commit 33cc07883e
26 changed files with 251 additions and 2184 deletions

View file

@ -422,7 +422,7 @@ else # TARGET_N64
AS := as
ifneq ($(TARGET_WEB),1)
CC := gcc
CXX := g++
CXX := g++ -o sm64plus icon.res
else
CC := emcc
endif

View file

@ -1,6 +1,6 @@
# Super Mario 64 Port Thingy
# Super Mario 64 Plus
Super Mario 64 Port Thingy is a fork of [sm64-port](https://github.com/sm64-port/sm64-port) that aims to add features that will fix the issues in the base game and enhance the gameplay, while keeping the vanilla feel of the game.
Super Mario 64 Plus is a fork of [sm64-port](https://github.com/sm64-port/sm64-port) that aims to add features that will fix the issues in the base game and enhance the gameplay, while keeping the vanilla feel of the game.
These features include (but not limited to):
- More responsive controls.

1
create_res.sh Normal file
View file

@ -0,0 +1 @@
windres icon.rc -O coff -o icon.res

File diff suppressed because it is too large Load diff

View file

@ -1,61 +0,0 @@
# Super Mario 64 Enhancements
This directory contains unofficial patches to the source code that provide various features
and enhancements.
To apply a patch, run `tools/apply_patch.sh [patch]` where `[patch]` is the name of the
.patch file you wish to apply. This will perform all of the patch's changes
to the source code.
Likewise, to undo the changes from a patch you applied, run
`tools/revert_patch.sh` with the name of the .patch file you wish to undo.
To create your own enhancement patch, switch to the `master` Git
branch, make your changes to the code (but do not commit), then run `tools/create_patch.sh`. Your changes will be stored in the .patch file you specify.
The following enhancements are included in this directory:
## 60 FPS - `60fps.patch`
This patch is only supported when not targeting N64. It also currently requires a 64-bit platform. If compiled for a 32-bit platform, the game will run out of memory and crash.
This allows the game to be rendered at 60 FPS instead of 30 FPS by interpolation.
The Mario head intro is the only exception which is still rendered at 30 FPS.
## Crash Screen - `crash.patch`
This enhancement provides a crash screen that is displayed when the code throws a hardware exception. This may be useful for diagnosing crashes in game code.
## Debug Box - `debug_box.patch`
This allows you to draw 3D boxes for debugging purposes.
Call the `debug_box` function whenever you want to draw one. `debug_box` by default takes two arguments: a center and bounds vec3f. This will draw a box starting from the point (center - bounds) to (center + bounds).
Use `debug_box_rot` to draw a box rotated in the xz-plane. If you want to draw a box by specifying min and max points, use `debug_box_pos` instead.
## FPS Counter - `fps.patch`
This patch provides an in-game FPS counter to measure the frame rate.
## iQue Player Support - `ique_support.patch`
This enhancement allows the same ROM to work on both the Nintendo 64 and the iQue Player.
## Memory Expansion Pak Error Screen - `mem_error_screen.patch`
Use this patch if your game requires over 4 MB of memory and requires the
Expansion Pak. If the Expansion Pak is not present, an error message will be
shown on startup.
## Demo Input Recorder - `record_demo.patch`
This patch allows you to record gameplay demos for the attract screen. It requires the latest nightly versions of Project64, and uses the Project64 JavaScript API to dump the demo input data from RAM and write it to a file.
Place the `enhancements/RecordDemo.js` file in the `/Scripts/` folder in the Project64 directory.
In the Scripts window, double click on "RecordDemo" on the list on the left side.
When this is done, it should turn green which lets you know that it has started.
When your demo has been recorded, it will be dumped to the newly created `/SM64_DEMOS/` folder within the Project64 directory.

3
icon.rc Normal file
View file

@ -0,0 +1,3 @@
#include "resource.h"
STAR_ICON ICON "star.ico"

BIN
icon.res Normal file

Binary file not shown.

View file

@ -201,6 +201,7 @@
#define TEXT_MYSCORE _("MYSCORE")
#define TEXT_CONTINUE _("CONTINUE")
#define TEXT_EXIT_COURSE _("EXIT COURSE")
#define TEXT_EXIT_GAME _("QUIT GAME")
#ifndef VERSION_EU // "R" text is different in EU
#define TEXT_CAMERA_ANGLE_R _("SET CAMERA ANGLE WITH R")
#endif
@ -208,8 +209,10 @@
// Camera Options
#define TEXT_LAKITU_MARIO _("LAKITU + MARIO")
#define TEXT_LAKITU_STOP _("LAKITU + STOP")
#define TEXT_LAKITU_MANUAL _("LAKITU + MANUAL")
#define TEXT_NORMAL_UPCLOSE __("(NORMAL)(UP-CLOSE)")
#define TEXT_NORMAL_FIXED __("(NORMAL)(FIXED)")
#define TEXT_NORMAL_3RDPERSON __("(NORMAL)(3RD PERS.)")
// Course Completed Misc Text
#define TEXT_CATCH _("CATCH")

View file

@ -1,94 +0,0 @@
[DISPLAY]
fullscreen = "true"
custom_fullscreen_resolution = "false"
fullscreen_width = "1920"
fullscreen_height = "1080"
fullscreen_refresh_rate = "60"
window_width = "1280"
window_height = "720"
custom_internal_resolution = "false"
internal_resolution_width = "3840"
internal_resolution_height = "2160"
force_4by3 = "false"
[CONTROLS]
improved_controls = "true"
backward_speed_cap = "true"
dpad_controls = "true"
full_air_control = "false"
disable_blj = "false"
disable_fall_damage = "false"
analog_stick_deadzone = "512"
[TWEAKS]
fix_collision_errors = "true"
fix_manta_ray_rings = "true"
make_blue_coin_switches_respawn = "true"
remove_annoying_warps = "true"
enable_the_unused_pyramid_cutscene = "true"
enable_the_unused_trapdoor_sound = "true"
disable_repeat_boo_messages = "true"
make_it_easier_to_talk_to_the_npcs = "true"
disable_toads_fading_out = "true"
skip_cutscenes = "false"
allow_leaving_the_level_at_any_time = "false"
show_the_100_coin_star_in_star_select = "false"
make_secrets_visible = "false"
allow_the_cannons_to_rotate_more = "false"
stay_in_level_after_getting_a_star = "0"
[CAMERA]
improved_camera = "true"
center_camera_button = "true"
invert_camera_controls = "false"
analog_camera_speed = "32.000000"
additional_camera_distance = "0.000000"
additional_fov = "0.000000"
[GRAPHICS]
60fps = "true"
disable_draw_distance = "true"
disable_low_poly_mario = "true"
draw_distance_multiplier = "1.000000"
noise_type = "0"
[HUD]
hud_style = "2"
4by3_hud = "false"
hud_filtering = "false"
hud_upscaling = "0"
always_show_the_health_meter = "false"
hide_hud = "false"
[EXTRA MOVES]
wall_sliding = "true"
sunshine_dive_hop = "false"
odyssey_ground_pound_dive = "false"
flashback_ground_pound = "false"
[BONUS MODES]
infinite_lives_mode = "false"
encore_mode = "false"
green_demon_mode = "false"
hard_mode = "false"
daredevil_mode = "false"
permadeath_mode = "false"
[FOR FUN]
fx_mode = "false"
disable_lighting = "false"
force_use_low_poly_mario = "false"
nearest_neighbor_filtering = "false"
[DEBUG]
level_select = "false"
show_debug_display = "false"
debug_movement_mode = "false"
show_debug_profiler = "false"
texture_upscaling = "0"
[KEY MAPPING]
key_a = "38"
key_b = "51"
key_start = "57"
key_l = "53"
key_r = "54"
key_z = "37"
key_cup = "328"
key_cdown = "336"
key_cleft = "331"
key_cright = "333"
key_stickup = "17"
key_stickdown = "31"
key_stickleft = "30"
key_stickright = "32"

View file

@ -1,3 +0,0 @@
/// @desc Save the settings
save_settings(INI_PATH);

1
resource.h Normal file
View file

@ -0,0 +1 @@
#define STAR_ICON 640

View file

@ -7,7 +7,7 @@ void bhv_celebration_star_init(void) {
o->oMoveAngleYaw = gMarioObject->header.gfx.angle[1] + 0x8000;
o->oCelebStarDiameterOfRotation = 100;
#if BUGFIX_STAR_BOWSER_KEY
if (gCurrLevelNum == LEVEL_BOWSER_1 || gCurrLevelNum == LEVEL_BOWSER_2) {
if ((!gReplaceKeysWithStars) && (gCurrLevelNum == LEVEL_BOWSER_1 || gCurrLevelNum == LEVEL_BOWSER_2)) {
o->header.gfx.sharedChild = gLoadedGraphNodes[MODEL_BOWSER_KEY];
o->oFaceAnglePitch = 0;
o->oFaceAngleRoll = 49152;

View file

@ -338,6 +338,11 @@ s16 s8DirModeBaseYaw;
*/
s16 s8DirModeYawOffset;
/**
* Player-controlled yaw offset in manual, a multiple of 22.5 degrees.
*/
s16 sManualModeYawOffset;
/**
* The distance that the camera will look ahead of Mario in the direction Mario is facing.
*/
@ -953,6 +958,29 @@ s32 update_8_directions_camera(struct Camera *c, Vec3f focus, Vec3f pos) {
return camYaw;
}
/**
* Update the camera during manual mode
*/
s32 update_manual_camera(struct Camera *c, Vec3f focus, Vec3f pos) {
UNUSED f32 cenDistX = sMarioCamState->pos[0] - c->areaCenX;
UNUSED f32 cenDistZ = sMarioCamState->pos[2] - c->areaCenZ;
s16 camYaw = s8DirModeBaseYaw + sManualModeYawOffset;
s16 pitch = look_down_slopes(camYaw)/2;
f32 posY;
f32 focusY;
UNUSED f32 unused1;
UNUSED f32 unused2;
UNUSED f32 unused3;
f32 yOff = 150.f;
f32 baseDist = 700.f+gAdditionalCameraDistance;
sAreaYaw = camYaw;
calc_y_to_curr_floor(&posY, 1.f, 200.f, &focusY, 0.9f, 200.f);
focus_on_mario(focus, pos, posY + yOff, focusY + yOff, sLakituDist + baseDist, pitch, camYaw);
return camYaw;
}
/**
* Moves the camera for the radial and outward radial camera modes.
*
@ -1249,6 +1277,55 @@ void mode_8_directions_camera(struct Camera *c) {
set_camera_height(c, pos[1]);
}
/**
* A custom mode that gives you more control with the camera
*/
void mode_manual_camera(struct Camera *c) {
Vec3f pos;
UNUSED u8 unused[8];
s16 oldAreaYaw = sAreaYaw;
radial_camera_input(c, 0.f);
if (gPlayer1Controller->buttonPressed & R_CBUTTONS) {
sManualModeYawOffset += DEGREES(22.5);
play_sound_cbutton_side();
}
if (gPlayer1Controller->buttonPressed & L_CBUTTONS) {
sManualModeYawOffset -= DEGREES(22.5);
play_sound_cbutton_side();
}
// Analog camera code
if (gPlayer1Controller->stick2X != 0) {
if (gPlayer1Controller->stick2X > 0) {
gCameraMovementFlags &= ~(CAM_MOVE_ROTATE_RIGHT | CAM_MOVE_ENTERED_ROTATE_SURFACE);
}
else {
gCameraMovementFlags &= ~(CAM_MOVE_ROTATE_LEFT | CAM_MOVE_ENTERED_ROTATE_SURFACE);
}
sManualModeYawOffset -= ANALOG_AMOUNT * (gPlayer1Controller->stick2X / 32.0f) * gCameraSpeed;
}
if (gCenterCameraButton) {
if (gPlayer1Controller->buttonPressed & L_TRIG) {
sManualModeYawOffset = sMarioCamState->faceAngle[1] + DEGREES(180);
play_sound_rbutton_changed();
}
if (gPlayer1Controller->buttonDown & L_TRIG) {
camera_approach_s16_symmetric_bool(&sManualModeYawOffset, sMarioCamState->faceAngle[1] + DEGREES(180), LROTATE_SPEED);
}
}
lakitu_zoom(800.f, 0x900);
c->nextYaw = update_manual_camera(c, c->focus, pos);
c->pos[0] = pos[0];
c->pos[2] = pos[2];
sAreaYawChange = sAreaYaw - oldAreaYaw;
set_camera_height(c, pos[1]);
}
/**
* Updates the camera in outward radial mode.
* sModeOffsetYaw is calculated in radial_camera_move, which calls offset_yaw_outward_radial
@ -3095,6 +3172,9 @@ void update_camera(struct Camera *c) {
if (gPlayer1Controller->buttonPressed & R_TRIG) {
if (set_cam_angle(0) == CAM_ANGLE_LAKITU) {
set_cam_angle(CAM_ANGLE_MARIO);
if (gManualCamera) {
sManualModeYawOffset = sMarioCamState->faceAngle[1] + DEGREES(180);
}
} else {
set_cam_angle(CAM_ANGLE_LAKITU);
}
@ -3171,7 +3251,10 @@ void update_camera(struct Camera *c) {
break;
default:
mode_mario_camera(c);
if (gManualCamera)
mode_manual_camera(c);
else
mode_mario_camera(c);
}
} else {
switch (c->mode) {

View file

@ -784,7 +784,11 @@ void handle_menu_scrolling(s8 scrollDirection, s8 *currentIndex, s8 minIndex, s8
}
}
if (gMenuHoldKeyTimer == 10) {
if (gQuitOption && gMenuHoldKeyTimer == 14) {
gMenuHoldKeyTimer = 12;
gMenuHoldKeyIndex = 0;
}
else if (gMenuHoldKeyTimer == 10) {
gMenuHoldKeyTimer = 8;
gMenuHoldKeyIndex = 0;
} else {
@ -2366,6 +2370,7 @@ void render_pause_my_score_coins(void) {
void render_pause_camera_options(s16 x, s16 y, s8 *index, s16 xIndex) {
u8 textLakituMario[] = { TEXT_LAKITU_MARIO };
u8 textLakituStop[] = { TEXT_LAKITU_STOP };
u8 textLakituManual[] = { TEXT_LAKITU_MANUAL };
#ifdef VERSION_EU
u8 textNormalUpClose[][20] = {
{ TEXT_NORMAL_UPCLOSE },
@ -2382,6 +2387,7 @@ void render_pause_camera_options(s16 x, s16 y, s8 *index, s16 xIndex) {
#else
u8 textNormalUpClose[] = { TEXT_NORMAL_UPCLOSE };
u8 textNormalFixed[] = { TEXT_NORMAL_FIXED };
u8 textNormal3rdPerson[] = { TEXT_NORMAL_3RDPERSON };
#endif
handle_menu_scrolling(MENU_SCROLL_HORIZONTAL, index, 1, 2);
@ -2389,8 +2395,8 @@ void render_pause_camera_options(s16 x, s16 y, s8 *index, s16 xIndex) {
gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gDialogTextAlpha);
print_generic_string(x + 14, y + 2, textLakituMario);
print_generic_string(x + TXT1_X, y - 13, textNormalUpClose);
print_generic_string(x + 14, y + 2, gManualCamera ? textLakituManual : textLakituMario);
print_generic_string(x + TXT1_X, y - 13, gManualCamera ? textNormal3rdPerson : textNormalUpClose);
print_generic_string(x + 124, y + 2, textLakituStop);
print_generic_string(x + TXT2_X, y - 13, textNormalFixed);
@ -2442,9 +2448,13 @@ void render_pause_course_options(s16 x, s16 y, s8 *index, s16 yIndex) {
u8 textContinue[] = { TEXT_CONTINUE };
u8 textExitCourse[] = { TEXT_EXIT_COURSE };
u8 textCameraAngleR[] = { TEXT_CAMERA_ANGLE_R };
u8 textExitGame[] = { TEXT_EXIT_GAME };
#endif
handle_menu_scrolling(MENU_SCROLL_VERTICAL, index, 1, 3);
if (gQuitOption)
handle_menu_scrolling(MENU_SCROLL_VERTICAL, index, 1, 4);
else
handle_menu_scrolling(MENU_SCROLL_VERTICAL, index, 1, 3);
gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gDialogTextAlpha);
@ -2452,8 +2462,16 @@ void render_pause_course_options(s16 x, s16 y, s8 *index, s16 yIndex) {
print_generic_string(x + 10, y - 2, textContinue);
print_generic_string(x + 10, y - 17, textExitCourse);
if (index[0] != 3) {
print_generic_string(x + 10, y - 33, textCameraAngleR);
if ((gQuitOption && index[0] != 4) || (!gQuitOption && index[0] != 3)) {
if (gQuitOption) {
print_generic_string(x + 10, y - 33, textExitGame);
print_generic_string(x + 10, y - 49, textCameraAngleR);
}
else {
print_generic_string(x + 10, y - 33, textCameraAngleR);
}
gSPDisplayList(gDisplayListHead++, dl_ia_text_end);
create_dl_translation_matrix(MENU_MTX_PUSH, x - X_VAL8, (y - ((index[0] - 1) * yIndex)) - Y_VAL8, 0);
@ -2463,9 +2481,13 @@ void render_pause_course_options(s16 x, s16 y, s8 *index, s16 yIndex) {
gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);
}
if (index[0] == 3) {
if (!gQuitOption && index[0] == 3) {
render_pause_camera_options(x - 42, y - 42, &gDialogCameraAngleIndex, 110);
}
if (gQuitOption && index[0] == 4) {
print_generic_string(x + 10, y - 33, textExitGame);
render_pause_camera_options(x - 42, y - 50, &gDialogCameraAngleIndex, 110);
}
}
void render_pause_castle_menu_box(s16 x, s16 y) {
@ -2702,7 +2724,7 @@ s16 render_pause_courses_and_castle(void) {
gDialogBoxState = DIALOG_STATE_OPENING;
gMenuMode = -1;
if (gDialogLineNum == 2) {
if ((gQuitOption && gDialogLineNum == 3) || (gDialogLineNum == 2)) {
num = gDialogLineNum;
} else {
num = 1;

View file

@ -772,10 +772,11 @@ u32 interact_star_or_key(struct MarioState *m, UNUSED u32 interactType, struct O
u32 starGrabAction = ACT_STAR_DANCE_EXIT;
u32 noExit = (o->oInteractionSubtype & INT_SUBTYPE_NO_EXIT) != 0;
u32 grandStar = (o->oInteractionSubtype & INT_SUBTYPE_GRAND_STAR) != 0;
u32 canStay = gStayInLevel && gCurrLevelNum != LEVEL_BOWSER_1 && gCurrLevelNum != LEVEL_BOWSER_2
&& gCurrLevelNum != LEVEL_CASTLE && gCurrLevelNum != LEVEL_CASTLE_COURTYARD && gCurrLevelNum != LEVEL_CASTLE_GROUNDS;
// Don't kick Mario if staying in levels is active
if (gStayInLevel && gCurrLevelNum != LEVEL_BOWSER_1 && gCurrLevelNum != LEVEL_BOWSER_2
&& gCurrLevelNum != LEVEL_CASTLE && gCurrLevelNum != LEVEL_CASTLE_COURTYARD && gCurrLevelNum != LEVEL_CASTLE_GROUNDS) {
if (canStay) {
noExit = 1;
}
@ -809,6 +810,10 @@ u32 interact_star_or_key(struct MarioState *m, UNUSED u32 interactType, struct O
starGrabAction = ACT_FALL_AFTER_STAR_GRAB;
}
if (canStay) {
starGrabAction = ACT_STAR_DANCE_NO_EXIT;
}
spawn_object(o, MODEL_NONE, bhvStarKeyCollectionPuffSpawner);
o->oInteractStatus = INT_STATUS_INTERACTED;
@ -1710,8 +1715,7 @@ u32 check_read_sign(struct MarioState *m, struct Object *o) {
if (((m->input & READ_MASK && !gTalkEasier) || (gTalkEasier && m->input & INPUT_B_PRESSED))
&& mario_can_talk(m, 0) && object_facing_mario(m, o, SIGN_RANGE)) {
s16 facingDYaw = (s16)(o->oMoveAngleYaw + 0x8000) - m->faceAngle[1];
if ((facingDYaw >= -SIGN_RANGE && facingDYaw <= SIGN_RANGE) ||
(gTalkEasier && facingDYaw >= -0x8000 && facingDYaw <= 0x8000)) {
if ((facingDYaw >= -SIGN_RANGE && facingDYaw <= SIGN_RANGE) || (gTalkEasier)) {
f32 targetX = o->oPosX + 105.0f * sins(o->oMoveAngleYaw);
f32 targetZ = o->oPosZ + 105.0f * coss(o->oMoveAngleYaw);
@ -1732,8 +1736,7 @@ u32 check_npc_talk(struct MarioState *m, struct Object *o) {
if (((m->input & READ_MASK && !gTalkEasier) || (gTalkEasier && m->input & INPUT_B_PRESSED))
&& mario_can_talk(m, 1)) {
s16 facingDYaw = mario_obj_angle_to_object(m, o) - m->faceAngle[1];
if ((facingDYaw >= -0x4000 && facingDYaw <= 0x4000) ||
(gTalkEasier && facingDYaw >= -0x8000 && facingDYaw <= 0x8000)) {
if ((facingDYaw >= -0x4000 && facingDYaw <= 0x4000) || (gTalkEasier)) {
o->oInteractStatus = INT_STATUS_INTERACTED;
m->interactObj = o;

View file

@ -1,5 +1,7 @@
#include <ultra64.h>
#include <stdlib.h>
#include "sm64.h"
#include "seq_ids.h"
#include "dialog_ids.h"
@ -114,12 +116,13 @@ const char *credits16[] = { "4SCREEN TEXT WRITER", "GERMAN TRANSLATION", "THOMAS
"THOMAS SPINDLER" };
#endif
const char *credits17[] = { "4MARIO VOICE", "PEACH VOICE", "CHARLES MARTINET", "LESLIE SWAN" };
const char *credits18[] = { "3SPECIAL THANKS TO", "EAD STAFF", "ALL NINTENDO PERSONNEL",
const char *credits18[] = { "3SM64 PLUS BY", "MORS" };
/*const char *credits18[] = { "3SPECIAL THANKS TO", "EAD STAFF", "ALL NINTENDO PERSONNEL",
#ifdef VERSION_US
"MARIO CLUB STAFF" };
#else // VERSION_EU
"SUPER MARIO CLUB STAFF" };
#endif
#endif*/
const char *credits19[] = { "1PRODUCER", "SHIGERU MIYAMOTO" };
const char *credits20[] = { "1EXECUTIVE PRODUCER", "HIROSHI YAMAUCHI" };
#endif
@ -1041,6 +1044,8 @@ s32 play_mode_paused(void) {
raise_background_noise(1);
gCameraMovementFlags &= ~CAM_MOVE_PAUSE_SCREEN;
set_play_mode(PLAY_MODE_NORMAL);
} else if (gQuitOption && gPauseScreenMode == 3) {
exit(0);
} else {
// Exit level

View file

@ -148,15 +148,15 @@
#define DIK_MEDIASELECT 0xED /* Media Select */
s8 configFullscreen = 1;
int configCustomFullscreenResolution = 0;
int configFullscreenWidth = 1920;
int configFullscreenHeight = 1080;
int configFullscreenRefreshRate = 60;
int configWindowWidth = 1280;
int configWindowHeight = 720;
unsigned int configCustomFullscreenResolution = 0;
unsigned int configFullscreenWidth = 1920;
unsigned int configFullscreenHeight = 1080;
unsigned int configFullscreenRefreshRate = 60;
unsigned int configWindowWidth = 1280;
unsigned int configWindowHeight = 720;
s8 configCustomInternalResolution = 0;
int configInternalResolutionWidth = 3840;
int configInternalResolutionHeight = 2160;
unsigned int configInternalResolutionWidth = 3840;
unsigned int configInternalResolutionHeight = 2160;
s8 configForce4by3 = 0;
s8 gImprovedControls = 1;
@ -165,7 +165,7 @@ s8 gDpadControls = 1;
s8 gFullAirControl = 0;
s8 gDisableBLJ = 0;
s8 gDisableFallDamage = 0;
int gControllerDeadzone = 512;
unsigned int gControllerDeadzone = 512;
s8 gCollisionFixes = 1;
s8 gFixMantaRayRings = 1;
@ -174,14 +174,16 @@ s8 gRemoveAnnoyingWarps = 1;
s8 gDisableBooDialogue = 1;
s8 gTalkEasier = 1;
s8 gDisableToadFading = 1;
s8 gQuitOption = 1;
s8 gLeaveAnyTime = 0;
s8 gShow100CoinStar = 0;
s8 gVisibleSecrets = 0;
s8 gFlexibleCannons = 0;
int gStayInLevel = 0;
unsigned int gStayInLevel = 0;
s8 gSkipCutscenes = 0;
s8 gImprovedCamera = 1;
s8 gManualCamera = 1;
s8 gCenterCameraButton = 1;
s8 gInvertedCamera = 0;
float gCameraSpeed = 32.0f;
@ -192,12 +194,12 @@ s8 g60FPS = 1;
s8 gDisableDrawDistance = 1;
s8 gDisableLowPoly = 1;
float gDrawDistanceMultiplier = 1.0f;
int gNoiseType = 0;
unsigned int gNoiseType = 0;
int gHudStyle = 2;
unsigned int gHudStyle = 2;
s8 gCenterHud = 0;
s8 gHUDFiltering = 0;
int gHUDUpscaling = 0;
unsigned int gHUDUpscaling = 0;
s8 gAlwaysShowHealth = 0;
s8 gHideHud = 0;
@ -211,6 +213,7 @@ s8 gPyramidCutscene = 1;
s8 gTrapdoorSound = 1;
s8 gTwirlTripleJump = 0;
s8 gSpawnSparkles = 0;
s8 gReplaceKeysWithStars = 0;
s8 gLifeMode = 0;
s8 gEncoreMode = 0;
@ -225,8 +228,8 @@ s8 gForceLowPoly = 0;
s8 gNearestNeighbor = 0;
s8 gDebugMovementMode = 0;
int gTextureUpscaling = 0;
s8 gVerticalCamera = 0;
unsigned int gTextureUpscaling = 0;
unsigned int configButtonA = A_BUTTON;
unsigned int configButtonB = Z_TRIG;
@ -247,10 +250,10 @@ unsigned int configKeyStart = DIK_SPACE;
unsigned int configKeyL = DIK_C;
unsigned int configKeyR = DIK_RSHIFT;
unsigned int configKeyZ = DIK_K;
unsigned int configKeyCUp = DIK_UP;
unsigned int configKeyCDown = DIK_DOWN;
unsigned int configKeyCLeft = DIK_LEFT;
unsigned int configKeyCRight = DIK_RIGHT;
unsigned int configKeyCUp = 0x0148;
unsigned int configKeyCDown = 0x0150;
unsigned int configKeyCLeft = 0x014B;
unsigned int configKeyCRight = 0x014D;
unsigned int configKeyStickUp = DIK_W;
unsigned int configKeyStickDown = DIK_S;
unsigned int configKeyStickLeft = DIK_A;

View file

@ -27,6 +27,7 @@ extern s8 gRemoveAnnoyingWarps;
extern s8 gDisableBooDialogue;
extern s8 gTalkEasier;
extern s8 gDisableToadFading;
extern s8 gQuitOption;
extern s8 gLeaveAnyTime;
extern s8 gShow100CoinStar;
extern s8 gVisibleSecrets;
@ -35,6 +36,7 @@ extern unsigned int gStayInLevel;
extern s8 gSkipCutscenes;
extern s8 gImprovedCamera;
extern s8 gManualCamera;
extern s8 gCenterCameraButton;
extern s8 gInvertedCamera;
extern float gCameraSpeed;
@ -64,6 +66,7 @@ extern s8 gPyramidCutscene;
extern s8 gTrapdoorSound;
extern s8 gTwirlTripleJump;
extern s8 gSpawnSparkles;
extern s8 gReplaceKeysWithStars;
extern s8 gLifeMode;
extern s8 gEncoreMode;
@ -78,7 +81,7 @@ extern s8 gForceLowPoly;
extern s8 gNearestNeighbor;
extern s8 gDebugMovementMode;
extern s8 gVerticalCamera;
extern unsigned int gTextureUpscaling;
extern unsigned int configButtonA;

View file

@ -60,6 +60,7 @@ static const struct ConfigOption options[] = {
{ .name = "disable_repeat_boo_messages", .type = CONFIG_TYPE_BOOL, .boolValue = &gDisableBooDialogue },
{ .name = "make_it_easier_to_talk_to_the_npcs", .type = CONFIG_TYPE_BOOL, .boolValue = &gTalkEasier },
{ .name = "disable_toads_fading_out", .type = CONFIG_TYPE_BOOL, .boolValue = &gDisableToadFading },
{ .name = "add_a_quit_option_to_the_pause_menu", .type = CONFIG_TYPE_BOOL, .boolValue = &gQuitOption },
{ .name = "allow_leaving_the_level_at_any_time", .type = CONFIG_TYPE_BOOL, .boolValue = &gLeaveAnyTime },
{ .name = "show_the_100_coin_star_in_star_select", .type = CONFIG_TYPE_BOOL, .boolValue = &gShow100CoinStar },
{ .name = "make_secrets_visible", .type = CONFIG_TYPE_BOOL, .boolValue = &gVisibleSecrets },
@ -68,7 +69,8 @@ static const struct ConfigOption options[] = {
{ .name = "skip_cutscenes", .type = CONFIG_TYPE_BOOL, .boolValue = &gSkipCutscenes },
{ .name = "CAMERA", .type = CONFIG_TYPE_SECTION },
{ .name = "improved_camera", .type = CONFIG_TYPE_BOOL, .boolValue = &gImprovedCamera },
{ .name = "analog_camera", .type = CONFIG_TYPE_BOOL, .boolValue = &gImprovedCamera },
{ .name = "manual_camera", .type = CONFIG_TYPE_BOOL, .boolValue = &gManualCamera },
{ .name = "center_camera_button", .type = CONFIG_TYPE_BOOL, .boolValue = &gCenterCameraButton },
{ .name = "invert_camera_controls", .type = CONFIG_TYPE_BOOL, .boolValue = &gInvertedCamera },
{ .name = "analog_camera_speed", .type = CONFIG_TYPE_FLOAT, .floatValue = &gCameraSpeed },
@ -102,7 +104,8 @@ static const struct ConfigOption options[] = {
{ .name = "enable_the_unused_trapdoor_sound", .type = CONFIG_TYPE_BOOL, .boolValue = &gTrapdoorSound },
{ .name = "replace_triple_jump_with_twirl", .type = CONFIG_TYPE_BOOL, .boolValue = &gTwirlTripleJump },
{ .name = "make_mario_sparkle_at_level_start", .type = CONFIG_TYPE_BOOL, .boolValue = &gSpawnSparkles },
{ .name = "replace_keys_with_stars_when_collected", .type = CONFIG_TYPE_BOOL, .boolValue = &gReplaceKeysWithStars },
{ .name = "BONUS MODES", .type = CONFIG_TYPE_SECTION },
{ .name = "infinite_lives_mode", .type = CONFIG_TYPE_BOOL, .boolValue = &gLifeMode },
{ .name = "encore_mode", .type = CONFIG_TYPE_BOOL, .boolValue = &gEncoreMode },
@ -121,8 +124,8 @@ static const struct ConfigOption options[] = {
{ .name = "level_select", .type = CONFIG_TYPE_BOOL, .boolValue = &gDebugLevelSelect },
{ .name = "show_debug_display", .type = CONFIG_TYPE_BOOL, .boolValue = &gShowDebugText },
{ .name = "debug_movement_mode", .type = CONFIG_TYPE_BOOL, .boolValue = &gDebugMovementMode },
{ .name = "show_debug_profiler", .type = CONFIG_TYPE_BOOL, .boolValue = &gShowProfiler },
{ .name = "vertical_analog_camera", .type = CONFIG_TYPE_BOOL, .boolValue = &gVerticalCamera },
{ .name = "texture_upscaling", .type = CONFIG_TYPE_UINT, .uintValue = &gTextureUpscaling },
{ .name = "XINPUT MAPPING", .type = CONFIG_TYPE_SECTION },

View file

@ -54,10 +54,18 @@ static void keyboard_init(void) {
set_keyboard_mapping(i++, A_BUTTON, configKeyA);
set_keyboard_mapping(i++, B_BUTTON, configKeyB);
set_keyboard_mapping(i++, Z_TRIG, configKeyZ);
set_keyboard_mapping(i++, U_CBUTTONS, configKeyCUp);
set_keyboard_mapping(i++, L_CBUTTONS, configKeyCLeft);
set_keyboard_mapping(i++, D_CBUTTONS, configKeyCDown);
set_keyboard_mapping(i++, R_CBUTTONS, configKeyCRight);
if (gImprovedCamera) {
set_keyboard_mapping(i++, U_CBUTTONS, configKeyCUp);
set_keyboard_mapping(i++, 0x100000, configKeyCLeft);
set_keyboard_mapping(i++, D_CBUTTONS, configKeyCDown);
set_keyboard_mapping(i++, 0x200000, configKeyCRight);
}
else {
set_keyboard_mapping(i++, U_CBUTTONS, configKeyCUp);
set_keyboard_mapping(i++, L_CBUTTONS, configKeyCLeft);
set_keyboard_mapping(i++, D_CBUTTONS, configKeyCDown);
set_keyboard_mapping(i++, R_CBUTTONS, configKeyCRight);
}
set_keyboard_mapping(i++, L_TRIG, configKeyL);
set_keyboard_mapping(i++, R_TRIG, configKeyR);
set_keyboard_mapping(i++, START_BUTTON, configKeyStart);
@ -81,6 +89,19 @@ static void keyboard_read(OSContPad *pad) {
if ((keyboard_buttons_down & 0xc0000) == 0x80000) {
pad->stick_y = 127;
}
if ((keyboard_buttons_down & 0x300000) == 0x100000) {
pad->stick2_x = -128;
}
if ((keyboard_buttons_down & 0x300000) == 0x200000) {
pad->stick2_x = 127;
}
if ((keyboard_buttons_down & 0xc00000) == 0x400000) {
pad->stick2_y = -128;
}
if ((keyboard_buttons_down & 0xc00000) == 0x800000) {
pad->stick2_y = 127;
}
}
struct ControllerAPI controller_keyboard = {

View file

@ -41,8 +41,10 @@ static void xinput_read(OSContPad *pad) {
if (gp->sThumbRX < -0x4000) pad->button |= L_CBUTTONS;
if (gp->sThumbRX > 0x4000) pad->button |= R_CBUTTONS;
}
if (gp->sThumbRY < -0x4000) pad->button |= D_CBUTTONS;
if (gp->sThumbRY > 0x4000) pad->button |= U_CBUTTONS;
if (!gVerticalCamera) {
if (gp->sThumbRY < -0x4000) pad->button |= D_CBUTTONS;
if (gp->sThumbRY > 0x4000) pad->button |= U_CBUTTONS;
}
uint32_t magnitude_sq = (uint32_t)(gp->sThumbLX * gp->sThumbLX) + (uint32_t)(gp->sThumbLY * gp->sThumbLY);
if (magnitude_sq > (uint32_t)(DEADZONE * DEADZONE)) {
@ -57,6 +59,12 @@ static void xinput_read(OSContPad *pad) {
pad->stick2_x = gp->sThumbRX / 409;
}
}
if (gVerticalCamera) {
uint32_t magnitude_sq2 = (uint32_t)(gp->sThumbRX * gp->sThumbRX) + (uint32_t)(gp->sThumbRY * gp->sThumbRY);
if (magnitude_sq2 > (uint32_t)(DEADZONE * DEADZONE)) {
pad->stick2_y = gp->sThumbRY / 409;
}
}
break;
}
}

View file

@ -27,6 +27,8 @@
#include "gfx_screen_config.h"
#include "gfx_pc.h"
#include ".\resource.h"
#define DECLARE_GFX_DXGI_FUNCTIONS
#include "gfx_dxgi.h"
@ -327,12 +329,12 @@ static void gfx_dxgi_init(const char *game_name, bool start_in_fullscreen) {
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = nullptr;
wcex.hIcon = nullptr;
wcex.hIcon = LoadIcon(nullptr, MAKEINTRESOURCE(STAR_ICON));
wcex.hIconSm = LoadIcon(nullptr, MAKEINTRESOURCE(STAR_ICON));
wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wcex.lpszMenuName = nullptr;
wcex.lpszClassName = WINCLASS_NAME;
wcex.hIconSm = nullptr;
ATOM winclass = RegisterClassExW(&wcex);

View file

@ -5,6 +5,10 @@
#include <stdbool.h>
#include <assert.h>
//#include <stdio.h>
//#define STB_IMAGE_IMPLEMENTATION
//#include <stb/stb_image.h>
#ifndef _LANGUAGE_C
#define _LANGUAGE_C
#endif
@ -666,6 +670,23 @@ static void import_texture_ci8(int tile) {
gfx_rapi->upload_texture(rgba32_buf, width, height);
}
/*static bool import_texture_custom(const char *fullpath) {
int w, h;
u8 *data = stbi_load(fullpath, &w, &h, NULL, 4);
if (data == NULL)
{
return FALSE;
}
gfx_rapi->upload_texture(data, w, h);
stbi_image_free(data);
return TRUE;
}*/
static void import_texture(int tile) {
uint8_t fmt = rdp.texture_tile.fmt;
uint8_t siz = rdp.texture_tile.siz;
@ -674,6 +695,20 @@ static void import_texture(int tile) {
return;
}
/*if (gExternalTextures) {
char path[1024];
snprintf(path, sizeof(path), "custom_textures/%x.png", (unsigned int)PHYSICAL_TO_VIRTUAL(rdp.texture_to_load.addr));
if (import_texture_custom(path))
return;
FILE* fp = fopen(path, "w");
fwrite(rdp.loaded_texture[tile].addr, siz, 1, fp);
fclose(fp);
}*/
int t0 = get_time();
if (fmt == G_IM_FMT_RGBA) {
if (siz == G_IM_SIZ_16b) {

View file

@ -32,7 +32,7 @@
#include "compat.h"
#define CONFIG_FILE "\\SM64Thing\\settings.ini"
#define CONFIG_FILE "\\SM64Plus\\settings.ini"
OSMesg D_80339BEC;
OSMesgQueue gSIEventMesgQueue;
@ -202,7 +202,7 @@ void main_func(void) {
wm_api = &gfx_dummy_wm_api;
#endif
gfx_init(wm_api, rendering_api, "Super Mario 64 PC-Port", configFullscreen);
gfx_init(wm_api, rendering_api, "Super Mario 64 Plus", configFullscreen);
wm_api->set_fullscreen_changed_callback(on_fullscreen_changed);
wm_api->set_keyboard_callbacks(keyboard_on_key_down, keyboard_on_key_up, keyboard_on_all_keys_up);

View file

@ -8,7 +8,7 @@
#include <emscripten.h>
#endif
#define SAVE_PATH "\\SM64Thing\\savedata.bin"
#define SAVE_PATH "\\SM64Plus\\savedata.bin"
extern OSMgrArgs piMgrArgs;

BIN
star.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB