mirror of
https://github.com/MorsGames/sm64plus.git
synced 2025-01-22 15:42:58 -05:00
Merge branch 'dev' into master
This commit is contained in:
commit
ec9cacf8a3
41 changed files with 557 additions and 217 deletions
45
Makefile
45
Makefile
|
@ -39,42 +39,11 @@ ifeq ($(TARGET_N64),0)
|
|||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_WINDOWS),1)
|
||||
# On Windows, default to DirectX 11
|
||||
ifneq ($(ENABLE_OPENGL),1)
|
||||
ifneq ($(ENABLE_DX12),1)
|
||||
ENABLE_DX11 ?= 1
|
||||
endif
|
||||
endif
|
||||
else
|
||||
# On others, default to OpenGL
|
||||
ifeq ($(TARGET_WINDOWS),0)
|
||||
# Enable OpenGL on non-Windows systems
|
||||
ENABLE_OPENGL ?= 1
|
||||
endif
|
||||
|
||||
# Sanity checks
|
||||
ifeq ($(ENABLE_DX11),1)
|
||||
ifneq ($(TARGET_WINDOWS),1)
|
||||
$(error The DirectX 11 backend is only supported on Windows)
|
||||
endif
|
||||
ifeq ($(ENABLE_OPENGL),1)
|
||||
$(error Cannot specify multiple graphics backends)
|
||||
endif
|
||||
ifeq ($(ENABLE_DX12),1)
|
||||
$(error Cannot specify multiple graphics backends)
|
||||
endif
|
||||
endif
|
||||
ifeq ($(ENABLE_DX12),1)
|
||||
ifneq ($(TARGET_WINDOWS),1)
|
||||
$(error The DirectX 12 backend is only supported on Windows)
|
||||
endif
|
||||
ifeq ($(ENABLE_OPENGL),1)
|
||||
$(error Cannot specify multiple graphics backends)
|
||||
endif
|
||||
ifeq ($(ENABLE_DX11),1)
|
||||
$(error Cannot specify multiple graphics backends)
|
||||
endif
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(COMPILER),gcc)
|
||||
|
@ -458,7 +427,7 @@ ifeq ($(ENABLE_OPENGL),1)
|
|||
GFX_LDFLAGS :=
|
||||
ifeq ($(TARGET_WINDOWS),1)
|
||||
GFX_CFLAGS += $(shell sdl2-config --cflags) -DGLEW_STATIC
|
||||
GFX_LDFLAGS += $(shell sdl2-config --libs) -Llib -lpthread -lglew32 -lm -lglu32 -lsetupapi -ldinput8 -luser32 -lgdi32 -limm32 -lole32 -loleaut32 -lshell32 -lwinmm -lversion -luuid -lopengl32 -static
|
||||
GFX_LDFLAGS += $(shell sdl2-config --libs) -Llib -lpthread -lglew32 -lm -lglu32 -lsetupapi -ldinput8 -luser32 -limm32 -lole32 -loleaut32 -lshell32 -lwinmm -lversion -luuid -lopengl32 -static
|
||||
endif
|
||||
ifeq ($(TARGET_LINUX),1)
|
||||
GFX_CFLAGS += $(shell sdl2-config --cflags)
|
||||
|
@ -469,12 +438,8 @@ ifeq ($(ENABLE_OPENGL),1)
|
|||
GFX_LDFLAGS += -lGL -lSDL2
|
||||
endif
|
||||
endif
|
||||
ifeq ($(ENABLE_DX11),1)
|
||||
GFX_CFLAGS := -DENABLE_DX11
|
||||
PLATFORM_LDFLAGS += -lgdi32 -static
|
||||
endif
|
||||
ifeq ($(ENABLE_DX12),1)
|
||||
GFX_CFLAGS := -DENABLE_DX12
|
||||
ifeq ($(TARGET_WINDOWS),1)
|
||||
GFX_CFLAGS :=
|
||||
PLATFORM_LDFLAGS += -lgdi32 -static
|
||||
endif
|
||||
|
||||
|
|
23
README.md
23
README.md
|
@ -85,6 +85,29 @@ If you're still stuck after trying all that, you can post your error to the #hel
|
|||
|
||||
## Changelog
|
||||
|
||||
### v1.1.0 (??/04/2021):
|
||||
**Launcher:**
|
||||
- Added the new settings to the launcher.
|
||||
- Made it take longer to reload settings from the launcher.
|
||||
|
||||
**Game itself:**
|
||||
- Added the "Graphics Backend" setting, which makes it possible to switch between Direct3D11 and Direct3D12 without rebuilding.
|
||||
- Added "Increase Underwater Shell Time", which makes the underwater shells last longer.
|
||||
- Added "Casual Mode", which makes Mario not lose any health when underwater, and reduces all damage taken by half.
|
||||
- Added a bunch of mouse related settings. You can now control the camera and some of the menus with your mouse.
|
||||
- Added a key which makes Mario walk slower. This is to compensate for the lack of analog controls with a keyboard.
|
||||
- Added "Paper Mode", which makes Mario thin like a paper.
|
||||
- Added "Wireframe Mode". Guess what this one does.
|
||||
- Split the "Analog Stick Deadzone" setting into two, one for each analog stick.
|
||||
- Added more options for the "Infinite Lives Mode" and "Encore Mode" settings, allowing further customizability.
|
||||
- Made Mario lose health slower when underwater during hard mode.
|
||||
- Tweaked wall jumping to be stronger when wall sliding is enabled.
|
||||
- Ground pound diving is also made faster now.
|
||||
- Made Metal Mario more consistent with the "Improved Metal Mario" setting.
|
||||
- Made the window center on the screen at game start.
|
||||
- Reverted the level select level order back to original and fixed a crash casued by missing characters.
|
||||
- Fixed other various minor bugs.
|
||||
|
||||
### v1.0.1 (06/04/2021):
|
||||
**Launcher:**
|
||||
- Disabled DirectInput support because the game itself doesn't support it yet, which causes confusion.
|
||||
|
|
|
@ -60,8 +60,8 @@ typedef struct {
|
|||
u16 button;
|
||||
s8 stick_x; /* -80 <= stick_x <= 80 */
|
||||
s8 stick_y; /* -80 <= stick_y <= 80 */
|
||||
s8 stick2_x; /* -80 <= stick_x <= 80 */
|
||||
s8 stick2_y; /* -80 <= stick_y <= 80 */
|
||||
s16 stick2_x;
|
||||
s16 stick2_y;
|
||||
u8 errnum;
|
||||
} OSContPad;
|
||||
|
||||
|
|
|
@ -17,45 +17,41 @@
|
|||
|
||||
// NOTE: Be sure to edit sZoomOutAreaMasks in camera.c, as there isnt a good way to macro those right now.
|
||||
// TODO: Figure something out for sZoomOutAreaMasks?
|
||||
DEFINE_LEVEL("CASTLE GROUNDS", LEVEL_CASTLE_GROUNDS, COURSE_NONE, castle_grounds, outside, 25000, 0x08, 0x08, 0x08, _, _)
|
||||
DEFINE_LEVEL("CASTLE INSIDE", LEVEL_CASTLE, COURSE_NONE, castle_inside, inside, 20000, 0x20, 0x20, 0x30, _, sCamCastle)
|
||||
DEFINE_LEVEL("COURTYARD", LEVEL_CASTLE_COURTYARD, COURSE_NONE, castle_courtyard, outside, 20000, 0x08, 0x08, 0x08, _, _)
|
||||
DEFINE_LEVEL("BOB", LEVEL_BOB, COURSE_BOB, bob, generic, 15000, 0x08, 0x08, 0x08, _, _)
|
||||
DEFINE_LEVEL("WF", LEVEL_WF, COURSE_WF, wf, grass, 13000, 0x08, 0x08, 0x08, _, _)
|
||||
DEFINE_LEVEL("IRB", LEVEL_JRB, COURSE_JRB, jrb, water, 20000, 0x10, 0x18, 0x18, sDynJrb, _)
|
||||
DEFINE_LEVEL("CCM", LEVEL_CCM, COURSE_CCM, ccm, snow, 17000, 0x10, 0x38, 0x38, _, sCamCCM)
|
||||
DEFINE_LEVEL("BBH", LEVEL_BBH, COURSE_BBH, bbh, spooky, 28000, 0x28, 0x28, 0x28, sDynBbh, sCamBBH)
|
||||
DEFINE_LEVEL("HMC", LEVEL_HMC, COURSE_HMC, hmc, cave, 16000, 0x28, 0x28, 0x28, sDynHmc, sCamHMC)
|
||||
DEFINE_LEVEL("LLL", LEVEL_LLL, COURSE_LLL, lll, fire, 22000, 0x08, 0x30, 0x30, _, _)
|
||||
DEFINE_LEVEL("SSL", LEVEL_SSL, COURSE_SSL, ssl, generic, 15000, 0x08, 0x30, 0x30, _, sCamSSL)
|
||||
DEFINE_LEVEL("DDD", LEVEL_DDD, COURSE_DDD, ddd, water, 17000, 0x10, 0x20, 0x20, sDynDdd, _)
|
||||
DEFINE_LEVEL("SL", LEVEL_SL, COURSE_SL, sl, snow, 14000, 0x10, 0x28, 0x28, _, sCamSL)
|
||||
DEFINE_LEVEL("WDW", LEVEL_WDW, COURSE_WDW, wdw, grass, 17000, 0x10, 0x18, 0x18, sDynWdw, _)
|
||||
DEFINE_LEVEL("TTM", LEVEL_TTM, COURSE_TTM, ttm, mountain, 15000, 0x08, 0x08, 0x08, _, _)
|
||||
DEFINE_LEVEL("THI", LEVEL_THI, COURSE_THI, thi, grass, 20000, 0x0c, 0x0c, 0x20, _, sCamTHI)
|
||||
DEFINE_LEVEL("TTC", LEVEL_TTC, COURSE_TTC, ttc, machine, 18000, 0x18, 0x18, 0x18, _, _)
|
||||
DEFINE_LEVEL("RR", LEVEL_RR, COURSE_RR, rr, sky, 20000, 0x20, 0x20, 0x20, _, sCamRR)
|
||||
|
||||
DEFINE_LEVEL("BIDW", LEVEL_BITDW, COURSE_BITDW, bitdw, sky, 16000, 0x28, 0x28, 0x28, _, _)
|
||||
DEFINE_LEVEL("BITFS", LEVEL_BITFS, COURSE_BITFS, bitfs, sky, 16000, 0x28, 0x28, 0x28, _, _)
|
||||
DEFINE_LEVEL("BITS", LEVEL_BITS, COURSE_BITS, bits, sky, 16000, 0x28, 0x28, 0x28, _, _)
|
||||
|
||||
DEFINE_LEVEL("PSS", LEVEL_PSS, COURSE_PSS, pss, mountain, 20000, 0x28, 0x28, 0x28, _, _)
|
||||
DEFINE_LEVEL("COTMC", LEVEL_COTMC, COURSE_COTMC, cotmc, cave, 18000, 0x28, 0x28, 0x28, _, sCamCotMC)
|
||||
DEFINE_LEVEL("TOTWC", LEVEL_TOTWC, COURSE_TOTWC, totwc, sky, 20000, 0x20, 0x20, 0x20, _, _)
|
||||
DEFINE_LEVEL("UCUTM", LEVEL_VCUTM, COURSE_VCUTM, vcutm, outside, 30000, 0x28, 0x28, 0x28, _, _)
|
||||
DEFINE_LEVEL("WMOTR", LEVEL_WMOTR, COURSE_WMOTR, wmotr, generic, 20000, 0x28, 0x28, 0x28, _, _)
|
||||
DEFINE_LEVEL("SA", LEVEL_SA, COURSE_SA, sa, inside, 20000, 0x10, 0x10, 0x10, _, _)
|
||||
|
||||
DEFINE_LEVEL("BOWSER 1", LEVEL_BOWSER_1, COURSE_BITDW, bowser_1, generic, VAL_DIFF, 0x40, 0x40, 0x40, _, _)
|
||||
DEFINE_LEVEL("BOWSER 2", LEVEL_BOWSER_2, COURSE_BITFS, bowser_2, fire, VAL_DIFF, 0x40, 0x40, 0x40, _, _)
|
||||
DEFINE_LEVEL("BOWSER 3", LEVEL_BOWSER_3, COURSE_BITS, bowser_3, generic, VAL_DIFF, 0x40, 0x40, 0x40, _, _)
|
||||
STUB_LEVEL( "", LEVEL_UNKNOWN_1, COURSE_NONE, 20000, 0x00, 0x00, 0x00, _, _)
|
||||
STUB_LEVEL( "", LEVEL_UNKNOWN_2, COURSE_NONE, 20000, 0x00, 0x00, 0x00, _, _)
|
||||
STUB_LEVEL( "", LEVEL_UNKNOWN_3, COURSE_NONE, 20000, 0x00, 0x00, 0x00, _, _)
|
||||
DEFINE_LEVEL("TERESA OBAKE", LEVEL_BBH, COURSE_BBH, bbh, spooky, 28000, 0x28, 0x28, 0x28, sDynBbh, sCamBBH)
|
||||
DEFINE_LEVEL("YYAMA1 % YSLD1", LEVEL_CCM, COURSE_CCM, ccm, snow, 17000, 0x10, 0x38, 0x38, _, sCamCCM)
|
||||
DEFINE_LEVEL("SELECT ROOM", LEVEL_CASTLE, COURSE_NONE, castle_inside, inside, 20000, 0x20, 0x20, 0x30, _, sCamCastle)
|
||||
DEFINE_LEVEL("HORROR DUNGEON", LEVEL_HMC, COURSE_HMC, hmc, cave, 16000, 0x28, 0x28, 0x28, sDynHmc, sCamHMC)
|
||||
DEFINE_LEVEL("SABAKU % PYRMD", LEVEL_SSL, COURSE_SSL, ssl, generic, 15000, 0x08, 0x30, 0x30, _, sCamSSL)
|
||||
DEFINE_LEVEL("BATTLE FIELD", LEVEL_BOB, COURSE_BOB, bob, generic, 15000, 0x08, 0x08, 0x08, _, _)
|
||||
DEFINE_LEVEL("YUKIYAMA2", LEVEL_SL, COURSE_SL, sl, snow, 14000, 0x10, 0x28, 0x28, _, sCamSL)
|
||||
DEFINE_LEVEL("POOL KAI", LEVEL_WDW, COURSE_WDW, wdw, grass, 17000, 0x10, 0x18, 0x18, sDynWdw, _)
|
||||
DEFINE_LEVEL("WTDG % TINBOTU", LEVEL_JRB, COURSE_JRB, jrb, water, 20000, 0x10, 0x18, 0x18, sDynJrb, _)
|
||||
DEFINE_LEVEL("BIG WORLD", LEVEL_THI, COURSE_THI, thi, grass, 20000, 0x0c, 0x0c, 0x20, _, sCamTHI)
|
||||
DEFINE_LEVEL("CLOCK TOWER", LEVEL_TTC, COURSE_TTC, ttc, machine, 18000, 0x18, 0x18, 0x18, _, _)
|
||||
DEFINE_LEVEL("RAINBOW CRUISE", LEVEL_RR, COURSE_RR, rr, sky, 20000, 0x20, 0x20, 0x20, _, sCamRR)
|
||||
DEFINE_LEVEL("MAIN MAP", LEVEL_CASTLE_GROUNDS, COURSE_NONE, castle_grounds, outside, 25000, 0x08, 0x08, 0x08, _, _)
|
||||
DEFINE_LEVEL("EXT1 YOKO SCRL", LEVEL_BITDW, COURSE_BITDW, bitdw, sky, 16000, 0x28, 0x28, 0x28, _, _)
|
||||
DEFINE_LEVEL("EXT7 HORI MINI", LEVEL_VCUTM, COURSE_VCUTM, vcutm, outside, 30000, 0x28, 0x28, 0x28, _, _)
|
||||
DEFINE_LEVEL("EXT2 TIKA LAVA", LEVEL_BITFS, COURSE_BITFS, bitfs, sky, 16000, 0x28, 0x28, 0x28, _, _)
|
||||
DEFINE_LEVEL("EXT9 SUISOU", LEVEL_SA, COURSE_SA, sa, inside, 20000, 0x10, 0x10, 0x10, _, _)
|
||||
DEFINE_LEVEL("EXT3 HEAVEN", LEVEL_BITS, COURSE_BITS, bits, sky, 16000, 0x28, 0x28, 0x28, _, _)
|
||||
DEFINE_LEVEL("FIREB1 % INVLC", LEVEL_LLL, COURSE_LLL, lll, fire, 22000, 0x08, 0x30, 0x30, _, _)
|
||||
DEFINE_LEVEL("WATER LAND", LEVEL_DDD, COURSE_DDD, ddd, water, 17000, 0x10, 0x20, 0x20, sDynDdd, _)
|
||||
DEFINE_LEVEL("MOUNTAIN", LEVEL_WF, COURSE_WF, wf, grass, 13000, 0x08, 0x08, 0x08, _, _)
|
||||
DEFINE_LEVEL("ENDING", LEVEL_ENDING, COURSE_CAKE_END, ending, generic, 20000, 0x00, 0x00, 0x00, _, _)
|
||||
|
||||
STUB_LEVEL( "UNUSED 1", LEVEL_UNKNOWN_1, COURSE_NONE, 20000, 0x00, 0x00, 0x00, _, _)
|
||||
STUB_LEVEL( "UNUSED 2", LEVEL_UNKNOWN_2, COURSE_NONE, 20000, 0x00, 0x00, 0x00, _, _)
|
||||
STUB_LEVEL( "UNUSED 3", LEVEL_UNKNOWN_3, COURSE_NONE, 20000, 0x00, 0x00, 0x00, _, _)
|
||||
STUB_LEVEL( "UNUSED 32", LEVEL_UNKNOWN_32, COURSE_NONE, 20000, 0x70, 0x00, 0x00, _, _)
|
||||
STUB_LEVEL( "UNUSED 35", LEVEL_UNKNOWN_35, COURSE_NONE, 20000, 0x00, 0x00, 0x00, _, _)
|
||||
STUB_LEVEL( "UNUSED 37", LEVEL_UNKNOWN_37, COURSE_NONE, 20000, 0x00, 0x00, 0x00, _, _)
|
||||
STUB_LEVEL( "UNUSED 38", LEVEL_UNKNOWN_38, COURSE_NONE, 20000, 0x00, 0x00, 0x00, sDynUnk38, _)
|
||||
DEFINE_LEVEL("URANIWA", LEVEL_CASTLE_COURTYARD, COURSE_NONE, castle_courtyard, outside, 20000, 0x08, 0x08, 0x08, _, _)
|
||||
DEFINE_LEVEL("EXT4 MINI SLID", LEVEL_PSS, COURSE_PSS, pss, mountain, 20000, 0x28, 0x28, 0x28, _, _)
|
||||
DEFINE_LEVEL("IN THE FALL", LEVEL_COTMC, COURSE_COTMC, cotmc, cave, 18000, 0x28, 0x28, 0x28, _, sCamCotMC)
|
||||
DEFINE_LEVEL("EXT6 MARIO FLY", LEVEL_TOTWC, COURSE_TOTWC, totwc, sky, 20000, 0x20, 0x20, 0x20, _, _)
|
||||
DEFINE_LEVEL("KUPPA1", LEVEL_BOWSER_1, COURSE_BITDW, bowser_1, generic, VAL_DIFF, 0x40, 0x40, 0x40, _, _)
|
||||
DEFINE_LEVEL("EXT8 BLUE SKY", LEVEL_WMOTR, COURSE_WMOTR, wmotr, generic, 20000, 0x28, 0x28, 0x28, _, _)
|
||||
STUB_LEVEL( "", LEVEL_UNKNOWN_32, COURSE_NONE, 20000, 0x70, 0x00, 0x00, _, _)
|
||||
DEFINE_LEVEL("KUPPA2", LEVEL_BOWSER_2, COURSE_BITFS, bowser_2, fire, VAL_DIFF, 0x40, 0x40, 0x40, _, _)
|
||||
DEFINE_LEVEL("KUPPA3", LEVEL_BOWSER_3, COURSE_BITS, bowser_3, generic, VAL_DIFF, 0x40, 0x40, 0x40, _, _)
|
||||
STUB_LEVEL( "", LEVEL_UNKNOWN_35, COURSE_NONE, 20000, 0x00, 0x00, 0x00, _, _)
|
||||
DEFINE_LEVEL("DONKEY % SLID2", LEVEL_TTM, COURSE_TTM, ttm, mountain, 15000, 0x08, 0x08, 0x08, _, _)
|
||||
STUB_LEVEL( "", LEVEL_UNKNOWN_37, COURSE_NONE, 20000, 0x00, 0x00, 0x00, _, _)
|
||||
STUB_LEVEL( "", LEVEL_UNKNOWN_38, COURSE_NONE, 20000, 0x00, 0x00, 0x00, sDynUnk38, _)
|
||||
|
|
|
@ -465,7 +465,7 @@ static void boo_act_4(void) {
|
|||
dialogID = DIALOG_107;
|
||||
}
|
||||
|
||||
if (!gBooDialogueWasSaid) {
|
||||
if (!gBooDialogueWasSaid || dialogID == DIALOG_108) {
|
||||
if (cur_obj_update_dialog(2, 2, dialogID, 0)) {
|
||||
create_sound_spawner(SOUND_OBJ_DYING_ENEMY1);
|
||||
obj_mark_for_deletion(o);
|
||||
|
|
|
@ -36,7 +36,7 @@ void whirpool_orient_graph(void) {
|
|||
}
|
||||
|
||||
void bhv_whirlpool_loop(void) {
|
||||
if (o->oDistanceToMario < 5000.0f * gDrawDistanceMultiplier && !gDisableDrawDistance) {
|
||||
if (o->oDistanceToMario < 5000.0f * gDrawDistanceMultiplier || gDisableDrawDistance) {
|
||||
o->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE;
|
||||
|
||||
// not sure if actually an array
|
||||
|
|
|
@ -72,11 +72,7 @@ u16 gDemoInputListID = 0;
|
|||
struct DemoInput gRecordedDemoInput = { 0 }; // possibly removed in EU. TODO: Check
|
||||
|
||||
s8 get_mirror() {
|
||||
if (gEncoreMode == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (gCurrCourseNum == COURSE_CAKE_END) {
|
||||
if (gEncoreMode == 0 || gEncoreMode == 2 || gCurrCourseNum == COURSE_CAKE_END) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -84,7 +80,7 @@ s8 get_mirror() {
|
|||
}
|
||||
|
||||
s16 get_palette() {
|
||||
if (!gEncoreMode || !gCanMirror) {
|
||||
if (gEncoreMode == 0 || gEncoreMode == 3 || !gCanMirror) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -486,10 +482,12 @@ void adjust_analog_stick(struct Controller *controller) {
|
|||
controller->stickY *= 64 / controller->stickMag;
|
||||
controller->stickMag = 64;
|
||||
}
|
||||
if (controller->stick2Mag > 64) {
|
||||
controller->stick2X *= 64 / controller->stick2Mag;
|
||||
controller->stick2Y *= 64 / controller->stick2Mag;
|
||||
controller->stick2Mag = 64;
|
||||
// The value is much higher for the second stick since we want the camera to move faster with mouse in use.
|
||||
// Not too fast though...
|
||||
if (controller->stick2Mag > 768) {
|
||||
controller->stick2X *= 768 / controller->stick2Mag;
|
||||
controller->stick2Y *= 768 / controller->stick2Mag;
|
||||
controller->stick2Mag = 768;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -362,12 +362,7 @@ void render_hud_mario_lives(void) {
|
|||
x = get_left(22);
|
||||
y = HUD_TOP_Y;
|
||||
}
|
||||
/*if (gLifeMode) {
|
||||
print_text(x, y, "Q"); // The new'Mario Head' glyph
|
||||
}
|
||||
else {*/
|
||||
print_text(x, y, ","); // 'Mario Head' glyph
|
||||
//}
|
||||
print_text(x, y, ","); // 'Mario Head' glyph
|
||||
if (gHudStyle > 0) {
|
||||
print_text(x+17, y, "*"); // 'X' glyph
|
||||
print_text_fmt_int(x+33, y, "%d", gHudDisplay.lives);
|
||||
|
@ -785,7 +780,7 @@ void render_hud(void) {
|
|||
render_hud_cannon_reticle();
|
||||
}
|
||||
|
||||
if (hudDisplayFlags & HUD_DISPLAY_FLAG_LIVES && !(save_file_get_flags() & SAVE_FLAG_HARDCORE_MODE)) {
|
||||
if (hudDisplayFlags & HUD_DISPLAY_FLAG_LIVES && !(save_file_get_flags() & SAVE_FLAG_HARDCORE_MODE) && gLifeMode != 1) {
|
||||
render_hud_mario_lives();
|
||||
}
|
||||
|
||||
|
|
|
@ -714,7 +714,7 @@ u32 take_damage_from_interact_object(struct MarioState *m) {
|
|||
u32 take_damage_and_knock_back(struct MarioState *m, struct Object *o) {
|
||||
u32 damage;
|
||||
|
||||
if (!sInvulnerable && !(m->flags & MARIO_VANISH_CAP)
|
||||
if (!sInvulnerable && !(m->flags & MARIO_VANISH_CAP) && (!mario_has_improved_metal_cap(m))
|
||||
&& !(o->oInteractionSubtype & INT_SUBTYPE_DELAY_INVINCIBILITY)) {
|
||||
o->oInteractStatus = INT_STATUS_INTERACTED | INT_STATUS_ATTACKED_MARIO;
|
||||
m->interactObj = o;
|
||||
|
|
|
@ -1259,6 +1259,11 @@ void squish_mario_model(struct MarioState *m) {
|
|||
|
||||
vec3f_set(m->marioObj->header.gfx.scale, 1.4f, 0.4f, 1.4f);
|
||||
}
|
||||
if (gPaperMode) {
|
||||
m->marioObj->header.gfx.scale[0] *= 1.0625;
|
||||
m->marioObj->header.gfx.scale[1] *= 1.0625;
|
||||
m->marioObj->header.gfx.scale[2] *= 0.03125;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1497,7 +1502,7 @@ void update_mario_health(struct MarioState *m) {
|
|||
m->health -= 4;
|
||||
}
|
||||
} else {
|
||||
if ((m->action & ACT_FLAG_SWIMMING) && !(m->action & ACT_FLAG_INTANGIBLE)) {
|
||||
if ((m->action & ACT_FLAG_SWIMMING) && !(m->action & ACT_FLAG_INTANGIBLE) && (!mario_has_improved_metal_cap(m))) {
|
||||
terrainIsSnow = (m->area->terrainType & TERRAIN_MASK) == TERRAIN_SNOW;
|
||||
|
||||
// When Mario is near the water surface, recover health (unless in snow),
|
||||
|
@ -1509,7 +1514,11 @@ void update_mario_health(struct MarioState *m) {
|
|||
}
|
||||
} else if (!(save_file_get_flags() & SAVE_FLAG_DAREDEVIL_MODE)) {
|
||||
if (save_file_get_flags() & SAVE_FLAG_HARD_MODE) {
|
||||
m->health -= (terrainIsSnow ? 6 : 3);
|
||||
m->health -= (terrainIsSnow ? 4 : 2);
|
||||
}
|
||||
else if (gCasualMode) {
|
||||
if (terrainIsSnow)
|
||||
m->health -= 1;
|
||||
}
|
||||
else {
|
||||
m->health -= (terrainIsSnow ? 3 : 1);
|
||||
|
@ -1524,7 +1533,10 @@ void update_mario_health(struct MarioState *m) {
|
|||
m->healCounter--;
|
||||
}
|
||||
if (m->hurtCounter > 0) {
|
||||
m->health -= 0x40;
|
||||
if (gCasualMode)
|
||||
m->health -= 0x20;
|
||||
else
|
||||
m->health -= 0x40;
|
||||
m->hurtCounter--;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ s32 check_fall_damage(struct MarioState *m, u32 hardFallAction) {
|
|||
play_sound(SOUND_MARIO_ATTACKED, m->marioObj->header.gfx.cameraToObject);
|
||||
return drop_and_set_mario_action(m, hardFallAction, 4);
|
||||
} else if (fallHeight > damageHeight && !mario_floor_is_slippery(m)) {
|
||||
if (!gDisableFallDamage) {
|
||||
if ((!gDisableFallDamage) && (!mario_has_improved_metal_cap(m))) {
|
||||
m->hurtCounter += (m->flags & MARIO_CAP_ON_HEAD) ? 8 : 12;
|
||||
}
|
||||
m->squishTimer = 30;
|
||||
|
@ -1077,7 +1077,7 @@ s32 act_ground_pound(struct MarioState *m) {
|
|||
|
||||
if (gOdysseyDive && m->input & INPUT_B_PRESSED) {
|
||||
set_mario_action(m, ACT_DIVE, 0);
|
||||
mario_set_forward_vel(m, 24.0f);
|
||||
mario_set_forward_vel(m, 40.0f);
|
||||
m->vel[1] = 28;
|
||||
}
|
||||
|
||||
|
@ -1261,6 +1261,7 @@ s32 act_wall_slide(struct MarioState *m) {
|
|||
m->marioObj->header.gfx.angle[1] = m->faceAngle[1];
|
||||
if (m->input & INPUT_A_PRESSED) {
|
||||
m->faceAngle[1] += 0x8000;
|
||||
mario_set_forward_vel(m, 32.0f);
|
||||
m->particleFlags |= PARTICLE_VERTICAL_STAR;
|
||||
return set_mario_action(m, ACT_WALL_KICK_AIR, 0);
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ s32 act_idle(struct MarioState *m) {
|
|||
return set_mario_action(m, ACT_IN_QUICKSAND, 0);
|
||||
}
|
||||
|
||||
if (m->input & INPUT_IN_POISON_GAS) {
|
||||
if ((m->input & INPUT_IN_POISON_GAS) && (!mario_has_improved_metal_cap(m))){
|
||||
return set_mario_action(m, ACT_COUGHING, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -778,7 +778,7 @@ static s32 act_water_shell_swimming(struct MarioState *m) {
|
|||
return set_mario_action(m, ACT_WATER_THROW, 0);
|
||||
}
|
||||
|
||||
if (m->actionTimer++ == 240) {
|
||||
if (m->actionTimer++ == gIncreaseShellTime ? 480 : 240) {
|
||||
m->heldObj->oInteractStatus = INT_STATUS_STOP_RIDING;
|
||||
m->heldObj = NULL;
|
||||
stop_shell_music();
|
||||
|
|
|
@ -355,6 +355,9 @@ s8 char_to_glyph_index(char c) {
|
|||
void add_glyph_texture(s8 glyphIndex) {
|
||||
const u8 *const *glyphs = segmented_to_virtual(main_hud_lut);
|
||||
|
||||
if(glyphs[glyphIndex] == NULL)
|
||||
return;
|
||||
|
||||
gDPPipeSync(gDisplayListHead++);
|
||||
gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, glyphs[glyphIndex]);
|
||||
gSPDisplayList(gDisplayListHead++, dl_hud_img_load_tex_block);
|
||||
|
|
|
@ -162,6 +162,7 @@ unsigned int configWindowHeight = 720;
|
|||
s8 configCustomInternalResolution = 0;
|
||||
unsigned int configInternalResolutionWidth = 3840;
|
||||
unsigned int configInternalResolutionHeight = 2160;
|
||||
unsigned int configGraphicsBackend = 1;
|
||||
|
||||
float configSeqVolume[] = {1, 1, 1};
|
||||
|
||||
|
@ -183,6 +184,7 @@ s8 gDisableFallDamage = 0;
|
|||
s8 gFixVariousBugs = 1;
|
||||
s8 gRespawnBlueCoinSwitch = 1;
|
||||
s8 gRemoveAnnoyingWarps = 1;
|
||||
s8 gIncreaseShellTime = 1;
|
||||
// TODO (Mors): Turn this into a "updated powerups" option eventually.
|
||||
// Vanish Mario would fall slower, and Wing Mario would have completely revamped flying.
|
||||
s8 gImprovedMetalCap = 1;
|
||||
|
@ -215,6 +217,12 @@ s8 gShow100CoinStar = 0;
|
|||
s8 gAlwaysShowHealth = 0;
|
||||
s8 gHideHud = 0;
|
||||
|
||||
s8 gMouseCam = 1;
|
||||
float gMouseSensitivity = 4.0f;
|
||||
unsigned int configMouseLeft = A_BUTTON;
|
||||
unsigned int configMouseRight = B_BUTTON;
|
||||
unsigned int configMouseMiddle = Z_TRIG;
|
||||
|
||||
s8 gWallSliding = 1;
|
||||
s8 gGroundPoundJump = 0;
|
||||
s8 gSunshineDive = 0;
|
||||
|
@ -227,14 +235,17 @@ s8 gTwirlTripleJump = 0;
|
|||
s8 gSpawnSparkles = 0;
|
||||
s8 gReplaceKeysWithStars = 0;
|
||||
|
||||
s8 gLifeMode = 0;
|
||||
s8 gEncoreMode = 0;
|
||||
unsigned int gLifeMode = 0;
|
||||
unsigned int gEncoreMode = 0;
|
||||
s8 gGreenDemon = 0;
|
||||
s8 gHardSave = 0;
|
||||
s8 gDaredevilSave = 0;
|
||||
s8 gHardcoreSave = 0;
|
||||
s8 gCasualMode = 0;
|
||||
|
||||
s8 gPaperMode = 0;
|
||||
s8 gFXMode = 0;
|
||||
s8 gWireframeMode = 0;
|
||||
s8 gDisableLighting = 0;
|
||||
s8 gForceLowPoly = 0;
|
||||
s8 gNearestNeighbor = 0;
|
||||
|
@ -256,7 +267,8 @@ unsigned int configButtonZL = Z_TRIG;
|
|||
unsigned int configButtonZR = R_TRIG;
|
||||
unsigned int configButtonThumbLeft = 0;
|
||||
unsigned int configButtonThumbRight = L_TRIG;
|
||||
unsigned int gControllerDeadzone = 512;
|
||||
unsigned int gControllerLeftDeadzone = 512;
|
||||
unsigned int gControllerRightDeadzone = 512;
|
||||
|
||||
unsigned int configKeyA = DIK_L;
|
||||
unsigned int configKeyB = DIK_COMMA;
|
||||
|
@ -272,6 +284,7 @@ unsigned int configKeyStickUp = DIK_W;
|
|||
unsigned int configKeyStickDown = DIK_S;
|
||||
unsigned int configKeyStickLeft = DIK_A;
|
||||
unsigned int configKeyStickRight = DIK_D;
|
||||
unsigned int configKeyWalk = DIK_LSHIFT;
|
||||
|
||||
// These probably don't belong here, but I don't have a better place for them at the moment.
|
||||
// TODO (Mors): Move this out to somewhere that fits.
|
||||
|
|
|
@ -12,6 +12,7 @@ extern unsigned int configWindowHeight;
|
|||
extern s8 configCustomInternalResolution;
|
||||
extern unsigned int configInternalResolutionWidth;
|
||||
extern unsigned int configInternalResolutionHeight;
|
||||
extern unsigned int configGraphicsBackend;
|
||||
|
||||
extern float configSeqVolume[];
|
||||
|
||||
|
@ -32,6 +33,7 @@ extern s8 gDisableFallDamage;
|
|||
extern s8 gFixVariousBugs;
|
||||
extern s8 gRespawnBlueCoinSwitch;
|
||||
extern s8 gRemoveAnnoyingWarps;
|
||||
extern s8 gIncreaseShellTime;
|
||||
extern s8 gImprovedMetalCap;
|
||||
extern s8 gDisableBooDialogue;
|
||||
extern s8 gTalkEasier;
|
||||
|
@ -62,6 +64,12 @@ extern s8 gShow100CoinStar;
|
|||
extern s8 gAlwaysShowHealth;
|
||||
extern s8 gHideHud;
|
||||
|
||||
extern s8 gMouseCam;
|
||||
extern float gMouseSensitivity;
|
||||
extern unsigned int configMouseLeft;
|
||||
extern unsigned int configMouseRight;
|
||||
extern unsigned int configMouseMiddle;
|
||||
|
||||
extern s8 gWallSliding;
|
||||
extern s8 gGroundPoundJump;
|
||||
extern s8 gSunshineDive;
|
||||
|
@ -74,14 +82,17 @@ extern s8 gTwirlTripleJump;
|
|||
extern s8 gSpawnSparkles;
|
||||
extern s8 gReplaceKeysWithStars;
|
||||
|
||||
extern s8 gLifeMode;
|
||||
extern s8 gEncoreMode;
|
||||
extern unsigned int gLifeMode;
|
||||
extern unsigned int gEncoreMode;
|
||||
extern s8 gGreenDemon;
|
||||
extern s8 gHardSave;
|
||||
extern s8 gDaredevilSave;
|
||||
extern s8 gHardcoreSave;
|
||||
extern s8 gCasualMode;
|
||||
|
||||
extern s8 gPaperMode;
|
||||
extern s8 gFXMode;
|
||||
extern s8 gWireframeMode;
|
||||
extern s8 gDisableLighting;
|
||||
extern s8 gForceLowPoly;
|
||||
extern s8 gNearestNeighbor;
|
||||
|
@ -103,7 +114,8 @@ extern unsigned int configButtonZL;
|
|||
extern unsigned int configButtonZR;
|
||||
extern unsigned int configButtonThumbLeft;
|
||||
extern unsigned int configButtonThumbRight;
|
||||
extern unsigned int gControllerDeadzone;
|
||||
extern unsigned int gControllerLeftDeadzone;
|
||||
extern unsigned int gControllerRightDeadzone;
|
||||
|
||||
extern unsigned int configKeyA;
|
||||
extern unsigned int configKeyB;
|
||||
|
@ -119,6 +131,7 @@ extern unsigned int configKeyStickUp;
|
|||
extern unsigned int configKeyStickDown;
|
||||
extern unsigned int configKeyStickLeft;
|
||||
extern unsigned int configKeyStickRight;
|
||||
extern unsigned int configKeyWalk;
|
||||
|
||||
extern s16 gCollectedStar;
|
||||
extern s8 stay_in_level();
|
||||
|
|
|
@ -21,6 +21,11 @@
|
|||
#include "shape_helper.h"
|
||||
#include "skin.h"
|
||||
|
||||
#include "./game/settings.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "gfx_dimensions.h"
|
||||
|
||||
#define MAX_GD_DLS 1000
|
||||
#define OS_MESG_SI_COMPLETE 0x33333333
|
||||
|
||||
|
@ -2392,12 +2397,12 @@ void parse_p1_controller(void) {
|
|||
p1cont = &sGdContPads[0];
|
||||
p1contPrev = &sPrevFrameCont[0];
|
||||
// stick values
|
||||
gdctrl->stickXf = (f32) p1cont->stick_x;
|
||||
gdctrl->stickYf = (f32) p1cont->stick_y;
|
||||
gdctrl->stickXf = (f32) p1cont->stick_x + (gMouseCam ? p1cont->stick2_x : 0);
|
||||
gdctrl->stickYf = (f32) p1cont->stick_y - (gMouseCam ? p1cont->stick2_y : 0);
|
||||
gdctrl->stickDeltaX = gdctrl->stickX;
|
||||
gdctrl->stickDeltaY = gdctrl->stickY;
|
||||
gdctrl->stickX = (s32) p1cont->stick_x;
|
||||
gdctrl->stickY = (s32) p1cont->stick_y;
|
||||
gdctrl->stickX = (s32) p1cont->stick_x + (gMouseCam ? p1cont->stick2_x : 0);
|
||||
gdctrl->stickY = (s32) p1cont->stick_y - (gMouseCam ? p1cont->stick2_y : 0);
|
||||
gdctrl->stickDeltaX -= gdctrl->stickX;
|
||||
gdctrl->stickDeltaY -= gdctrl->stickY;
|
||||
// button values (as bools)
|
||||
|
@ -2475,24 +2480,49 @@ void parse_p1_controller(void) {
|
|||
gdctrl->csrY -= gdctrl->stickY * 0.1; //? 0.1f
|
||||
}
|
||||
// border checks? is this for the cursor finger movement?
|
||||
if ((f32) gdctrl->csrX < (sScreenView2->parent->upperLeft.x + 16.0f)) {
|
||||
gdctrl->csrX = (s32)(sScreenView2->parent->upperLeft.x + 16.0f);
|
||||
}
|
||||
if (gCenterHud || configForce4by3) {
|
||||
|
||||
if ((f32) gdctrl->csrX
|
||||
> (sScreenView2->parent->upperLeft.x + sScreenView2->parent->lowerRight.x - 48.0f)) {
|
||||
gdctrl->csrX =
|
||||
(s32)(sScreenView2->parent->upperLeft.x + sScreenView2->parent->lowerRight.x - 48.0f);
|
||||
}
|
||||
if ((f32) gdctrl->csrX < (sScreenView2->parent->upperLeft.x + 16.0f)) {
|
||||
gdctrl->csrX = (s32)(sScreenView2->parent->upperLeft.x + 16.0f);
|
||||
}
|
||||
|
||||
if ((f32) gdctrl->csrY < (sScreenView2->parent->upperLeft.y + 16.0f)) {
|
||||
gdctrl->csrY = (s32)(sScreenView2->parent->upperLeft.y + 16.0f);
|
||||
}
|
||||
if ((f32) gdctrl->csrX
|
||||
> (sScreenView2->parent->upperLeft.x + sScreenView2->parent->lowerRight.x - 48.0f)) {
|
||||
gdctrl->csrX =
|
||||
(s32)(sScreenView2->parent->upperLeft.x + sScreenView2->parent->lowerRight.x - 48.0f);
|
||||
}
|
||||
|
||||
if ((f32) gdctrl->csrY
|
||||
> (sScreenView2->parent->upperLeft.y + sScreenView2->parent->lowerRight.y - 32.0f)) {
|
||||
gdctrl->csrY =
|
||||
(s32)(sScreenView2->parent->upperLeft.y + sScreenView2->parent->lowerRight.y - 32.0f);
|
||||
if ((f32) gdctrl->csrY < (sScreenView2->parent->upperLeft.y + 16.0f)) {
|
||||
gdctrl->csrY = (s32)(sScreenView2->parent->upperLeft.y + 16.0f);
|
||||
}
|
||||
|
||||
if ((f32) gdctrl->csrY
|
||||
> (sScreenView2->parent->upperLeft.y + sScreenView2->parent->lowerRight.y - 32.0f)) {
|
||||
gdctrl->csrY =
|
||||
(s32)(sScreenView2->parent->upperLeft.y + sScreenView2->parent->lowerRight.y - 32.0f);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
if ((f32) gdctrl->csrX < (GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(sScreenView2->parent->upperLeft.x))) {
|
||||
gdctrl->csrX = (s32)(GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(sScreenView2->parent->upperLeft.x));
|
||||
}
|
||||
|
||||
if ((f32) gdctrl->csrX
|
||||
> (GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(sScreenView2->parent->upperLeft.x + sScreenView2->parent->upperLeft.x) - 32.0f)) {
|
||||
gdctrl->csrX =
|
||||
(s32)(GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(sScreenView2->parent->upperLeft.x + sScreenView2->parent->upperLeft.x) - 32.0f);
|
||||
}
|
||||
|
||||
if ((f32) gdctrl->csrY < (sScreenView2->parent->upperLeft.y)) {
|
||||
gdctrl->csrY = (s32)(sScreenView2->parent->upperLeft.y);
|
||||
}
|
||||
|
||||
if ((f32) gdctrl->csrY
|
||||
> (sScreenView2->parent->upperLeft.y + sScreenView2->parent->lowerRight.y - 32.0f)) {
|
||||
gdctrl->csrY =
|
||||
(s32)(sScreenView2->parent->upperLeft.y + sScreenView2->parent->lowerRight.y - 32.0f);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(OSContPad); i++) {
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
#include "sm64.h"
|
||||
#include "text_strings.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "gfx_dimensions.h"
|
||||
|
||||
#include "game/settings.h"
|
||||
|
||||
#include "eu_translation.h"
|
||||
|
@ -1629,22 +1632,39 @@ void handle_controller_cursor_input(void) {
|
|||
}
|
||||
|
||||
// Move cursor
|
||||
sCursorPos[0] += rawStickX / 8;
|
||||
sCursorPos[1] += rawStickY / 8;
|
||||
sCursorPos[0] += (rawStickX + (gMouseCam ? gPlayer1Controller->rawStick2X : 0)) / 8;
|
||||
sCursorPos[1] += (rawStickY - (gMouseCam ? gPlayer1Controller->rawStick2Y : 0)) / 8;
|
||||
|
||||
// Stop cursor from going offscreen
|
||||
if (sCursorPos[0] > 132.0f) {
|
||||
sCursorPos[0] = 132.0f;
|
||||
}
|
||||
if (sCursorPos[0] < -132.0f) {
|
||||
sCursorPos[0] = -132.0f;
|
||||
}
|
||||
if (gCenterHud || configForce4by3) {
|
||||
if (sCursorPos[0] > 132.0f) {
|
||||
sCursorPos[0] = 132.0f;
|
||||
}
|
||||
if (sCursorPos[0] < -132.0f) {
|
||||
sCursorPos[0] = -132.0f;
|
||||
}
|
||||
|
||||
if (sCursorPos[1] > 90.0f) {
|
||||
sCursorPos[1] = 90.0f;
|
||||
if (sCursorPos[1] > 90.0f) {
|
||||
sCursorPos[1] = 90.0f;
|
||||
}
|
||||
if (sCursorPos[1] < -90.0f) {
|
||||
sCursorPos[1] = -90.0f;
|
||||
}
|
||||
}
|
||||
if (sCursorPos[1] < -90.0f) {
|
||||
sCursorPos[1] = -90.0f;
|
||||
else {
|
||||
if (sCursorPos[0] > SCREEN_WIDTH/2*GFX_DIMENSIONS_ASPECT_RATIO - 98.0f) {
|
||||
sCursorPos[0] = SCREEN_WIDTH/2*GFX_DIMENSIONS_ASPECT_RATIO - 98.0f;
|
||||
}
|
||||
if (sCursorPos[0] < -SCREEN_WIDTH/2*GFX_DIMENSIONS_ASPECT_RATIO + 76.0f) {
|
||||
sCursorPos[0] = -SCREEN_WIDTH/2*GFX_DIMENSIONS_ASPECT_RATIO + 76.0f;
|
||||
}
|
||||
|
||||
if (sCursorPos[1] > SCREEN_HEIGHT/2 - 6.0f) {
|
||||
sCursorPos[1] = SCREEN_HEIGHT/2 - 6.0f;
|
||||
}
|
||||
if (sCursorPos[1] < -SCREEN_HEIGHT/2 + 26.0f) {
|
||||
sCursorPos[1] = -SCREEN_HEIGHT/2 + 26.0f;
|
||||
}
|
||||
}
|
||||
|
||||
if (sCursorClickingTimer == 0) {
|
||||
|
|
|
@ -45,6 +45,7 @@ static const struct ConfigOption options[] = {
|
|||
{ .name = "custom_internal_resolution", .type = CONFIG_TYPE_BOOL, .boolValue = &configCustomInternalResolution },
|
||||
{ .name = "internal_resolution_width", .type = CONFIG_TYPE_UINT, .uintValue = &configInternalResolutionWidth },
|
||||
{ .name = "internal_resolution_height", .type = CONFIG_TYPE_UINT, .uintValue = &configInternalResolutionHeight },
|
||||
{ .name = "graphics_backend", .type = CONFIG_TYPE_UINT, .uintValue = &configGraphicsBackend },
|
||||
|
||||
{ .name = "AUDIO", .type = CONFIG_TYPE_SECTION },
|
||||
{ .name = "music_volume", .type = CONFIG_TYPE_FLOAT, .floatValue = &configSeqVolume[0] },
|
||||
|
@ -59,10 +60,6 @@ static const struct ConfigOption options[] = {
|
|||
{ .name = "noise_type", .type = CONFIG_TYPE_UINT, .uintValue = &gNoiseType },
|
||||
{ .name = "force_4by3", .type = CONFIG_TYPE_BOOL, .boolValue = &configForce4by3 },
|
||||
|
||||
{ .name = "AUDIO", .type = CONFIG_TYPE_SECTION },
|
||||
{ .name = "music_volume", .type = CONFIG_TYPE_FLOAT, .floatValue = &configSeqVolume[0] },
|
||||
{ .name = "jingle_volume", .type = CONFIG_TYPE_FLOAT, .floatValue = &configSeqVolume[1] },
|
||||
{ .name = "sound_volume", .type = CONFIG_TYPE_FLOAT, .floatValue = &configSeqVolume[2] },
|
||||
{ .name = "CONTROLS", .type = CONFIG_TYPE_SECTION },
|
||||
{ .name = "improved_controls", .type = CONFIG_TYPE_BOOL, .boolValue = &gImprovedControls },
|
||||
{ .name = "backward_speed_cap", .type = CONFIG_TYPE_BOOL, .boolValue = &gBackwardSpeedCap },
|
||||
|
@ -75,6 +72,7 @@ static const struct ConfigOption options[] = {
|
|||
{ .name = "fix_various_bugs", .type = CONFIG_TYPE_BOOL, .boolValue = &gFixVariousBugs },
|
||||
{ .name = "make_blue_coin_switches_respawn", .type = CONFIG_TYPE_BOOL, .boolValue = &gRespawnBlueCoinSwitch },
|
||||
{ .name = "remove_annoying_warps", .type = CONFIG_TYPE_BOOL, .boolValue = &gRemoveAnnoyingWarps },
|
||||
{ .name = "increase_underwater_shell_time", .type = CONFIG_TYPE_BOOL, .boolValue = &gIncreaseShellTime },
|
||||
{ .name = "improve_metal_mario", .type = CONFIG_TYPE_BOOL, .boolValue = &gImprovedMetalCap },
|
||||
{ .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 },
|
||||
|
@ -107,6 +105,13 @@ static const struct ConfigOption options[] = {
|
|||
{ .name = "always_show_the_health_meter", .type = CONFIG_TYPE_BOOL, .boolValue = &gAlwaysShowHealth },
|
||||
{ .name = "hide_hud", .type = CONFIG_TYPE_BOOL, .boolValue = &gHideHud },
|
||||
|
||||
{ .name = "MOUSE", .type = CONFIG_TYPE_SECTION },
|
||||
{ .name = "mouse_support", .type = CONFIG_TYPE_BOOL, .boolValue = &gMouseCam },
|
||||
{ .name = "mouse_sensitivity", .type = CONFIG_TYPE_FLOAT, .floatValue = &gMouseSensitivity },
|
||||
{ .name = "left_mouse_button_action", .type = CONFIG_TYPE_UINT, .uintValue = &configMouseLeft },
|
||||
{ .name = "right_mouse_button_action", .type = CONFIG_TYPE_UINT, .uintValue = &configMouseRight },
|
||||
{ .name = "middle_mouse_button_action", .type = CONFIG_TYPE_UINT, .uintValue = &configMouseMiddle },
|
||||
|
||||
{ .name = "EXTRA MOVES", .type = CONFIG_TYPE_SECTION },
|
||||
{ .name = "wall_sliding", .type = CONFIG_TYPE_BOOL, .boolValue = &gWallSliding },
|
||||
{ .name = "ground_pound_jump", .type = CONFIG_TYPE_BOOL, .boolValue = &gGroundPoundJump },
|
||||
|
@ -122,15 +127,18 @@ static const struct ConfigOption options[] = {
|
|||
{ .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 },
|
||||
{ .name = "infinite_lives_mode", .type = CONFIG_TYPE_UINT, .uintValue = &gLifeMode },
|
||||
{ .name = "encore_mode", .type = CONFIG_TYPE_UINT, .uintValue = &gEncoreMode },
|
||||
{ .name = "green_demon_mode", .type = CONFIG_TYPE_BOOL, .boolValue = &gGreenDemon },
|
||||
{ .name = "hard_mode", .type = CONFIG_TYPE_BOOL, .boolValue = &gHardSave },
|
||||
{ .name = "daredevil_mode", .type = CONFIG_TYPE_BOOL, .boolValue = &gDaredevilSave },
|
||||
{ .name = "permadeath_mode", .type = CONFIG_TYPE_BOOL, .boolValue = &gHardcoreSave },
|
||||
{ .name = "casual_mode", .type = CONFIG_TYPE_BOOL, .boolValue = &gCasualMode },
|
||||
|
||||
{ .name = "FOR FUN", .type = CONFIG_TYPE_SECTION },
|
||||
{ .name = "paper_mode", .type = CONFIG_TYPE_BOOL, .boolValue = &gPaperMode },
|
||||
{ .name = "fx_mode", .type = CONFIG_TYPE_BOOL, .boolValue = &gFXMode },
|
||||
{ .name = "wireframe_mode", .type = CONFIG_TYPE_BOOL, .boolValue = &gWireframeMode },
|
||||
{ .name = "disable_lighting", .type = CONFIG_TYPE_BOOL, .boolValue = &gDisableLighting },
|
||||
{ .name = "force_use_low_poly_mario", .type = CONFIG_TYPE_BOOL, .boolValue = &gForceLowPoly },
|
||||
{ .name = "nearest_neighbor_filtering", .type = CONFIG_TYPE_BOOL, .boolValue = &gNearestNeighbor },
|
||||
|
@ -157,7 +165,8 @@ static const struct ConfigOption options[] = {
|
|||
{ .name = "button_zr", .type = CONFIG_TYPE_UINT, .uintValue = &configButtonZR },
|
||||
{ .name = "button_thumbleft", .type = CONFIG_TYPE_UINT, .uintValue = &configButtonThumbLeft },
|
||||
{ .name = "button_thumbright", .type = CONFIG_TYPE_UINT, .uintValue = &configButtonThumbRight },
|
||||
{ .name = "analog_stick_deadzone", .type = CONFIG_TYPE_UINT, .uintValue = &gControllerDeadzone },
|
||||
{ .name = "left_analog_stick_deadzone", .type = CONFIG_TYPE_UINT, .uintValue = &gControllerLeftDeadzone },
|
||||
{ .name = "right_analog_stick_deadzone", .type = CONFIG_TYPE_UINT, .uintValue = &gControllerRightDeadzone },
|
||||
|
||||
{ .name = "KEY MAPPING", .type = CONFIG_TYPE_SECTION },
|
||||
{ .name = "key_a", .type = CONFIG_TYPE_UINT, .uintValue = &configKeyA },
|
||||
|
@ -174,6 +183,7 @@ static const struct ConfigOption options[] = {
|
|||
{ .name = "key_stickdown", .type = CONFIG_TYPE_UINT, .uintValue = &configKeyStickDown },
|
||||
{ .name = "key_stickleft", .type = CONFIG_TYPE_UINT, .uintValue = &configKeyStickLeft },
|
||||
{ .name = "key_stickright", .type = CONFIG_TYPE_UINT, .uintValue = &configKeyStickRight },
|
||||
{ .name = "key_walktrigger", .type = CONFIG_TYPE_UINT, .uintValue = &configKeyWalk },
|
||||
};
|
||||
|
||||
// Reads an entire line from a file (excluding the newline character) and returns an allocated string
|
||||
|
|
143
src/pc/controller/controller_directinput.c
Normal file
143
src/pc/controller/controller_directinput.c
Normal file
|
@ -0,0 +1,143 @@
|
|||
/*
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
|
||||
#include <windows.h>
|
||||
#include <dinput.h>
|
||||
|
||||
#include <ultra64.h>
|
||||
|
||||
#include "controller_api.h"
|
||||
#include "game/settings.h"
|
||||
|
||||
// DirectInput stuff
|
||||
extern HINSTANCE main_instance;
|
||||
LPDIRECTINPUT8 lpdi = NULL;
|
||||
LPDIRECTINPUTDEVICE8 lpdijoy = NULL;
|
||||
GUID joystick_guid;
|
||||
DIJOYSTATE joy_state;
|
||||
|
||||
BOOL CALLBACK enum_joysticks(LPCDIDEVICEINSTANCE lpddi, LPVOID guid_ptr)
|
||||
{
|
||||
*(GUID*)guid_ptr = lpddi->guidInstance;
|
||||
|
||||
return DIENUM_STOP;
|
||||
}
|
||||
|
||||
static void directinput_init(void) {
|
||||
DirectInput8Create(main_instance, DIRECTINPUT_VERSION, IID_IDirectInput8, (void **)&lpdi,NULL)
|
||||
|
||||
lpdi->EnumDevices(DI8DEVCLASS_GAMECTRL,
|
||||
enum_joysticks,
|
||||
&joystick_guid,
|
||||
DIEDFL_ATTACHEDONLY);
|
||||
|
||||
LPDIRECTINPUTDEVICE lpdijoy_temp = NULL;
|
||||
|
||||
lpdi->CreateDevice(joystick_guid, &lpdijoy, NULL);
|
||||
|
||||
lpdijoy->SetCooperativeLevel(main_window_handle,
|
||||
DISCL_NONEXCLUSIVE | DISCL_BACKGROUND);
|
||||
|
||||
lpdijoy->SetDataFormat(&c_dfDIJoystick);
|
||||
|
||||
DIPROPRANGE joy_axis_range;
|
||||
|
||||
// Game expects stick coordinates within -80..80
|
||||
joy_axis_range.lMin = -80;
|
||||
joy_axis_range.lMax = 80;
|
||||
|
||||
joy_axis_range.diph.dwSize = sizeof(DIPROPRANGE);
|
||||
joy_axis_range.diph.dwHeaderSize = sizeof(DIPROPHEADER);
|
||||
joy_axis_range.diph.dwObj = DIJOFS_X;
|
||||
joy_axis_range.diph.dwHow = DIPH_BYOFFSET;
|
||||
|
||||
lpdijoy->SetProperty(DIPROP_RANGE,&joy_axis_range.diph);
|
||||
|
||||
// Same with the y axis
|
||||
joy_axis_range.lMin = -80;
|
||||
joy_axis_range.lMax = 80;
|
||||
|
||||
joy_axis_range.diph.dwSize = sizeof(DIPROPRANGE);
|
||||
joy_axis_range.diph.dwHeaderSize = sizeof(DIPROPHEADER);
|
||||
joy_axis_range.diph.dwObj = DIJOFS_Y;
|
||||
joy_axis_range.diph.dwHow = DIPH_BYOFFSET;
|
||||
|
||||
lpdijoy->SetProperty(DIPROP_RANGE,&joy_axis_range.diph);
|
||||
|
||||
DIPROPDWORD deadzone;
|
||||
|
||||
deadzone.diph.dwSize = sizeof(deadzone);
|
||||
deadzone.diph.dwHeaderSize = sizeof(deadzone.diph);
|
||||
deadzone.diph.dwObj = DIJOFS_X;
|
||||
deadzone.diph.dwHow = DIPH_BYOFFSET;
|
||||
|
||||
deadzone.dwData = gControllerLeftDeadzone;
|
||||
|
||||
lpdijoy->SetProperty(DIPROP_DEADZONE,&deadzone.diph);
|
||||
|
||||
deadzone.diph.dwSize = sizeof(deadzone);
|
||||
deadzone.diph.dwHeaderSize = sizeof(deadzone.diph);
|
||||
deadzone.diph.dwObj = DIJOFS_Y;
|
||||
deadzone.diph.dwHow = DIPH_BYOFFSET;
|
||||
|
||||
deadzone.dwData = gControllerRightDeadzone;
|
||||
|
||||
lpdijoy->SetProperty(DIPROP_DEADZONE,&deadzone.diph);
|
||||
|
||||
lpdijoy->Acquire();
|
||||
}
|
||||
|
||||
static void directinput_read(OSContPad *pad) {
|
||||
if (lpdijoy) {
|
||||
lpdijoy->Poll();
|
||||
lpdijoy->GetDeviceState(sizeof(DIJOYSTATE), (LPVOID)&joy_state);
|
||||
}
|
||||
else {
|
||||
memset(&joy_state, 0, sizeof(joy_state));
|
||||
}
|
||||
|
||||
if (joy_state.rgbButtons[0]) pad->button |= configButtonA;
|
||||
if (joy_state.rgbButtons[1]) pad->button |= configButtonB;
|
||||
if (joy_state.rgbButtons[2]) pad->button |= configButtonX;
|
||||
if (joy_state.rgbButtons[3]) pad->button |= configButtonY;
|
||||
if (joy_state.rgbButtons[4]) pad->button |= configButtonStart;
|
||||
if (joy_state.rgbButtons[5]) pad->button |= configButtonSelect;
|
||||
if (joy_state.rgbButtons[6]) pad->button |= configButtonL;
|
||||
if (joy_state.rgbButtons[7]) pad->button |= configButtonR;
|
||||
if (joy_state.rglSlider[0] > 16) pad->button |= configButtonZL;
|
||||
if (joy_state.rglSlider[1] > 16) pad->button |= configButtonZR;
|
||||
if (joy_state.rgbButtons[8]) pad->button |= configButtonThumbLeft;
|
||||
if (joy_state.rgbButtons[9]) pad->button |= configButtonThumbRight;
|
||||
|
||||
if (joy_state.rgdwPOV[0]) pad->button |= L_JPAD;
|
||||
if (joy_state.rgdwPOV[1]) pad->button |= R_JPAD;
|
||||
if (joy_state.rgdwPOV[2]) pad->button |= U_JPAD;
|
||||
if (joy_state.rgdwPOV[3]) pad->button |= D_JPAD;
|
||||
|
||||
if (!gImprovedCamera) {
|
||||
if (joy_state.lRx < -40) pad->button |= L_CBUTTONS;
|
||||
if (joy_state.lRy > 40) pad->button |= R_CBUTTONS;
|
||||
}
|
||||
if (!gVerticalCamera) {
|
||||
if (joy_state.lRx < -40) pad->button |= D_CBUTTONS;
|
||||
if (joy_state.lRy > 40) pad->button |= U_CBUTTONS;
|
||||
}
|
||||
|
||||
pad->stick_x = joy_state.lX;
|
||||
pad->stick_y = joy_state.lY;
|
||||
|
||||
if (gImprovedCamera) {
|
||||
pad->stick2_x = joy_state.lRx;
|
||||
}
|
||||
if (gVerticalCamera) {
|
||||
pad->stick2_y = joy_state.lRy;
|
||||
}
|
||||
}
|
||||
|
||||
struct ControllerAPI controller_directinput = {
|
||||
directinput_init,
|
||||
directinput_read
|
||||
};
|
||||
|
||||
#endif
|
||||
*/
|
14
src/pc/controller/controller_directinput.h
Normal file
14
src/pc/controller/controller_directinput.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
#ifndef CONTROLLER_DIRECTINPUT_H
|
||||
#define CONTROLLER_DIRECTINPUT_H
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
|
||||
#include "controller_api.h"
|
||||
|
||||
extern struct ControllerAPI controller_directinput;
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
*/
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#include "controller_xinput.h"
|
||||
//#include "controller_directinput.h"
|
||||
#else
|
||||
#include "controller_sdl.h"
|
||||
#endif
|
||||
|
@ -20,6 +21,7 @@ static struct ControllerAPI *controller_implementations[] = {
|
|||
&controller_recorded_tas,
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
&controller_xinput,
|
||||
//&controller_directinput,
|
||||
#else
|
||||
&controller_sdl,
|
||||
#endif
|
||||
|
|
|
@ -11,7 +11,10 @@
|
|||
|
||||
static int keyboard_buttons_down;
|
||||
|
||||
static int keyboard_mapping[14][2];
|
||||
static long mouse_x;
|
||||
static long mouse_y;
|
||||
|
||||
static int keyboard_mapping[15][2];
|
||||
|
||||
static int keyboard_map_scancode(int scancode) {
|
||||
int ret = 0;
|
||||
|
@ -39,6 +42,28 @@ void keyboard_on_all_keys_up(void) {
|
|||
keyboard_buttons_down = 0;
|
||||
}
|
||||
|
||||
void keyboard_on_mouse_move(long x, long y) {
|
||||
mouse_x = x;
|
||||
mouse_y = y;
|
||||
}
|
||||
|
||||
void keyboard_on_mouse_press(s8 left, s8 right, s8 middle) {
|
||||
if (left > 0)
|
||||
keyboard_buttons_down |= configMouseLeft;
|
||||
if (left < 0)
|
||||
keyboard_buttons_down &= ~configMouseLeft;
|
||||
|
||||
if (right > 0)
|
||||
keyboard_buttons_down |= configMouseRight;
|
||||
if (right < 0)
|
||||
keyboard_buttons_down &= ~configMouseRight;
|
||||
|
||||
if (middle > 0)
|
||||
keyboard_buttons_down |= configMouseMiddle;
|
||||
if (middle < 0)
|
||||
keyboard_buttons_down &= ~configMouseMiddle;
|
||||
}
|
||||
|
||||
static void set_keyboard_mapping(int index, int mask, int scancode) {
|
||||
keyboard_mapping[index][0] = scancode;
|
||||
keyboard_mapping[index][1] = mask;
|
||||
|
@ -69,6 +94,7 @@ static void keyboard_init(void) {
|
|||
set_keyboard_mapping(i++, L_TRIG, configKeyL);
|
||||
set_keyboard_mapping(i++, R_TRIG, configKeyR);
|
||||
set_keyboard_mapping(i++, START_BUTTON, configKeyStart);
|
||||
set_keyboard_mapping(i++, 0x1000000, configKeyWalk);
|
||||
|
||||
#ifdef TARGET_WEB
|
||||
controller_emscripten_keyboard_init();
|
||||
|
@ -76,31 +102,39 @@ static void keyboard_init(void) {
|
|||
}
|
||||
|
||||
static void keyboard_read(OSContPad *pad) {
|
||||
// Camera movement with mouse
|
||||
if (gMouseCam) {
|
||||
if (mouse_x != 0)
|
||||
pad->stick2_x = mouse_x*gMouseSensitivity;
|
||||
if (mouse_y != 0)
|
||||
pad->stick2_y = mouse_y*gMouseSensitivity;
|
||||
}
|
||||
|
||||
pad->button |= keyboard_buttons_down;
|
||||
if ((keyboard_buttons_down & 0x30000) == 0x10000) {
|
||||
pad->stick_x = -128;
|
||||
pad->stick_x = (keyboard_buttons_down & 0x1000000) ? -32 : -128;
|
||||
}
|
||||
if ((keyboard_buttons_down & 0x30000) == 0x20000) {
|
||||
pad->stick_x = 127;
|
||||
pad->stick_x = (keyboard_buttons_down & 0x1000000) ? 32 : 127;
|
||||
}
|
||||
if ((keyboard_buttons_down & 0xc0000) == 0x40000) {
|
||||
pad->stick_y = -128;
|
||||
pad->stick_y = (keyboard_buttons_down & 0x1000000) ? -32 : -128;
|
||||
}
|
||||
if ((keyboard_buttons_down & 0xc0000) == 0x80000) {
|
||||
pad->stick_y = 127;
|
||||
pad->stick_y = (keyboard_buttons_down & 0x1000000) ? 32 : 127;
|
||||
}
|
||||
|
||||
if ((keyboard_buttons_down & 0x300000) == 0x100000) {
|
||||
pad->stick2_x = -128;
|
||||
pad->stick2_x = -80;
|
||||
}
|
||||
if ((keyboard_buttons_down & 0x300000) == 0x200000) {
|
||||
pad->stick2_x = 127;
|
||||
pad->stick2_x = 80;
|
||||
}
|
||||
if ((keyboard_buttons_down & 0xc00000) == 0x400000) {
|
||||
pad->stick2_y = -128;
|
||||
pad->stick2_y = -80;
|
||||
}
|
||||
if ((keyboard_buttons_down & 0xc00000) == 0x800000) {
|
||||
pad->stick2_y = 127;
|
||||
pad->stick2_y = 80;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@ extern "C" {
|
|||
bool keyboard_on_key_down(int scancode);
|
||||
bool keyboard_on_key_up(int scancode);
|
||||
void keyboard_on_all_keys_up(void);
|
||||
void keyboard_on_mouse_move(long x, long y);
|
||||
void keyboard_on_mouse_press(s8 left, s8 right, s8 middle);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -82,7 +82,7 @@ static void controller_sdl_read(OSContPad *pad) {
|
|||
#endif
|
||||
|
||||
if (gImprovedCamera) {
|
||||
uint32_t magnitude_sq2 = (uint32_t)(rightx * rightx) + (uint32_t)(righty * righty);
|
||||
uint32_t magnitude_sq2 = (uint32_t)(rightx * rightx);
|
||||
if (magnitude_sq2 > (uint32_t)(DEADZONE * DEADZONE)) {
|
||||
pad->stick2_x = rightx / 409;
|
||||
}
|
||||
|
@ -91,9 +91,17 @@ static void controller_sdl_read(OSContPad *pad) {
|
|||
if (rightx < -0x4000) pad->button |= L_CBUTTONS;
|
||||
if (rightx > 0x4000) pad->button |= R_CBUTTONS;
|
||||
}
|
||||
|
||||
if (righty < -0x4000) pad->button |= U_CBUTTONS;
|
||||
if (righty > 0x4000) pad->button |= D_CBUTTONS;
|
||||
|
||||
if (gVerticalCamera) {
|
||||
uint32_t magnitude_sq2 = (uint32_t)(righty * righty);
|
||||
if (magnitude_sq2 > (uint32_t)(DEADZONE * DEADZONE)) {
|
||||
pad->stick2_y = righty / 409;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (righty < -0x4000) pad->button |= U_CBUTTONS;
|
||||
if (righty > 0x4000) pad->button |= D_CBUTTONS;
|
||||
}
|
||||
|
||||
if (ltrig > 30 * 256) pad->button |= Z_TRIG;
|
||||
if (rtrig > 30 * 256) pad->button |= R_TRIG;
|
||||
|
|
|
@ -33,13 +33,19 @@ static void controller_wup_read(OSContPad *pad) {
|
|||
if (buttons & 0x0200) pad->button |= B_BUTTON;
|
||||
if (buttons & 0x1000) pad->button |= L_TRIG;
|
||||
if (gImprovedCamera) {
|
||||
if (pad->stick2_x != 0 || pad->stick2_y != 0) {
|
||||
if (pad->stick2_x != 0) {
|
||||
pad->stick2_x = saturate(axis[2] - 128 - 0);
|
||||
//pad->stick2_y = saturate(axis[3] - 128 - 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (axis[2] < 0x40) pad->button |= L_CBUTTONS;
|
||||
}
|
||||
if (gVerticalCamera) {
|
||||
if (pad->stick2_y != 0) {
|
||||
pad->stick2_y = saturate(axis[3] - 128 - 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (axis[2] > 0xC0) pad->button |= R_CBUTTONS;
|
||||
}
|
||||
if (axis[3] < 0x40) pad->button |= D_CBUTTONS;
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
#include "controller_api.h"
|
||||
#include "game/settings.h"
|
||||
|
||||
#define DEADZONE gControllerDeadzone*10
|
||||
#define LEFT_DEADZONE gControllerLeftDeadzone*10
|
||||
#define RIGHT_DEADZONE gControllerRightDeadzone*10
|
||||
|
||||
static void xinput_init(void) {
|
||||
}
|
||||
|
@ -47,7 +48,7 @@ static void xinput_read(OSContPad *pad) {
|
|||
}
|
||||
|
||||
uint32_t magnitude_sq = (uint32_t)(gp->sThumbLX * gp->sThumbLX) + (uint32_t)(gp->sThumbLY * gp->sThumbLY);
|
||||
if (magnitude_sq > (uint32_t)(DEADZONE * DEADZONE)) {
|
||||
if (magnitude_sq > (uint32_t)(LEFT_DEADZONE * LEFT_DEADZONE)) {
|
||||
// Game expects stick coordinates within -80..80
|
||||
// 32768 / 409 = ~80
|
||||
pad->stick_x = gp->sThumbLX / 409;
|
||||
|
@ -55,13 +56,13 @@ static void xinput_read(OSContPad *pad) {
|
|||
}
|
||||
if (gImprovedCamera) {
|
||||
uint32_t magnitude_sq2 = (uint32_t)(gp->sThumbRX * gp->sThumbRX) + (uint32_t)(gp->sThumbRY * gp->sThumbRY);
|
||||
if (magnitude_sq2 > (uint32_t)(DEADZONE * DEADZONE)) {
|
||||
if (magnitude_sq2 > (uint32_t)(RIGHT_DEADZONE * RIGHT_DEADZONE)) {
|
||||
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)) {
|
||||
if (magnitude_sq2 > (uint32_t)(RIGHT_DEADZONE * RIGHT_DEADZONE)) {
|
||||
pad->stick2_y = gp->sThumbRY / 409;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#ifdef ENABLE_DX11
|
||||
#if !defined(__linux__) && !defined(__BSD__)
|
||||
|
||||
#include <cstdio>
|
||||
#include <vector>
|
||||
|
@ -259,7 +259,7 @@ static void gfx_d3d11_init(void) {
|
|||
d3d.swap_chain = gfx_dxgi_create_swap_chain(d3d.device.Get());
|
||||
|
||||
// Enable MSAA
|
||||
// I fucking TRIED but couldn't get it working I'm STUPID if anyone reading this that knows what they are doing let me know lol
|
||||
// I fricking (no swearing in my kids game) TRIED but couldn't get it working I'm STUPID if anyone reading this that knows what they are doing let me know lol
|
||||
/*
|
||||
DXGI_SWAP_CHAIN_DESC1 swap_chain_desc;
|
||||
ThrowIfFailed(d3d.swap_chain->GetDesc1(&swap_chain_desc));
|
||||
|
@ -600,7 +600,7 @@ static void gfx_d3d11_draw_triangles(float buf_vbo[], size_t buf_vbo_len, size_t
|
|||
D3D11_RASTERIZER_DESC rasterizer_desc;
|
||||
ZeroMemory(&rasterizer_desc, sizeof(D3D11_RASTERIZER_DESC));
|
||||
|
||||
rasterizer_desc.FillMode = D3D11_FILL_SOLID;
|
||||
rasterizer_desc.FillMode = gWireframeMode ? D3D11_FILL_WIREFRAME : D3D11_FILL_SOLID;
|
||||
rasterizer_desc.CullMode = D3D11_CULL_NONE;
|
||||
rasterizer_desc.FrontCounterClockwise = true;
|
||||
rasterizer_desc.DepthBias = 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#ifdef ENABLE_DX11
|
||||
#if !defined(__linux__) && !defined(__BSD__)
|
||||
|
||||
#ifndef GFX_DIRECT3D11_H
|
||||
#define GFX_DIRECT3D11_H
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#ifdef ENABLE_DX12
|
||||
#if !defined(__linux__) && !defined(__BSD__)
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
@ -487,6 +487,7 @@ static void gfx_direct3d12_draw_triangles(float buf_vbo[], size_t buf_vbo_len, s
|
|||
desc.RasterizerState.SlopeScaledDepthBias = -2.0f;
|
||||
}
|
||||
desc.RasterizerState.CullMode = D3D12_CULL_MODE_NONE;
|
||||
desc.RasterizerState.FillMode = gWireframeMode ? D3D12_FILL_MODE_WIREFRAME : D3D12_FILL_MODE_SOLID;
|
||||
if (prg->shader_id & SHADER_OPT_ALPHA) {
|
||||
D3D12_BLEND_DESC bd = {};
|
||||
bd.AlphaToCoverageEnable = FALSE;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#ifdef ENABLE_DX12
|
||||
#if !defined(__linux__) && !defined(__BSD__)
|
||||
|
||||
#ifndef GFX_DIRECT3D12_H
|
||||
#define GFX_DIRECT3D12_H
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if defined(ENABLE_DX11) || defined(ENABLE_DX12)
|
||||
#if !defined(__linux__) && !defined(__BSD__)
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if defined(ENABLE_DX11) || defined(ENABLE_DX12)
|
||||
#if !defined(__linux__) && !defined(__BSD__)
|
||||
|
||||
#ifndef GFX_DIRECT3D_COMMON_H
|
||||
#define GFX_DIRECT3D_COMMON_H
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifdef ENABLE_GFX_DUMMY
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
#include "gfx_window_manager_api.h"
|
||||
#include "gfx_rendering_api.h"
|
||||
|
@ -8,7 +8,7 @@
|
|||
static void gfx_dummy_wm_init(const char *game_name, bool start_in_fullscreen) {
|
||||
}
|
||||
|
||||
static void gfx_dummy_wm_set_keyboard_callbacks(bool (*on_key_down)(int scancode), bool (*on_key_up)(int scancode), void (*on_all_keys_up)(void)) {
|
||||
static void gfx_dummy_wm_set_keyboard_callbacks(bool (*on_key_down)(int scancode), bool (*on_key_up)(int scancode), void (*on_all_keys_up)(void), void (*on_mouse_move)(long x, long y), void on_mouse_press(s8 left, s8 right, s8 middle)) {
|
||||
}
|
||||
|
||||
static void gfx_dummy_wm_set_fullscreen_changed_callback(void (*on_fullscreen_changed)(bool is_now_fullscreen)) {
|
||||
|
@ -188,5 +188,4 @@ struct GfxRenderingAPI gfx_dummy_renderer_api = {
|
|||
gfx_dummy_renderer_start_frame,
|
||||
gfx_dummy_renderer_end_frame,
|
||||
gfx_dummy_renderer_finish_render
|
||||
};
|
||||
#endif
|
||||
};
|
|
@ -1,5 +1,3 @@
|
|||
#ifdef ENABLE_GFX_DUMMY
|
||||
|
||||
#ifndef GFX_DUMMY_H
|
||||
#define GFX_DUMMY_H
|
||||
|
||||
|
@ -9,6 +7,4 @@
|
|||
extern struct GfxRenderingAPI gfx_dummy_renderer_api;
|
||||
extern struct GfxWindowManagerAPI gfx_dummy_wm_api;
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -1,4 +1,4 @@
|
|||
#if defined(ENABLE_DX11) || defined(ENABLE_DX12)
|
||||
#if !defined(__linux__) && !defined(__BSD__)
|
||||
|
||||
#include <stdint.h>
|
||||
#include <math.h>
|
||||
|
@ -76,6 +76,8 @@ static struct {
|
|||
bool (*on_key_down)(int scancode);
|
||||
bool (*on_key_up)(int scancode);
|
||||
void (*on_all_keys_up)(void);
|
||||
void (*on_mouse_move)(long x, long y);
|
||||
void (*on_mouse_press)(s8 left, s8 right, s8 middle);
|
||||
} dxgi;
|
||||
|
||||
static void load_dxgi_library(void) {
|
||||
|
@ -193,8 +195,8 @@ static void toggle_borderless_window_full_screen(bool enable, bool call_callback
|
|||
SetWindowPos(dxgi.h_wnd, NULL, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_FRAMECHANGED);
|
||||
ShowWindow(dxgi.h_wnd, SW_RESTORE);
|
||||
}
|
||||
|
||||
ShowCursor(TRUE);
|
||||
if (gMouseCam)
|
||||
ShowCursor(TRUE);
|
||||
|
||||
dxgi.is_full_screen = false;
|
||||
} else {
|
||||
|
@ -230,7 +232,8 @@ static void toggle_borderless_window_full_screen(bool enable, bool call_callback
|
|||
SetWindowLongPtr(dxgi.h_wnd, GWL_STYLE, WS_VISIBLE | WS_POPUP);
|
||||
SetWindowPos(dxgi.h_wnd, HWND_TOP, primary.left, primary.top, primary.right - primary.left, primary.bottom - primary.top, SWP_FRAMECHANGED);
|
||||
|
||||
ShowCursor(FALSE);
|
||||
if (gMouseCam)
|
||||
ShowCursor(FALSE);
|
||||
|
||||
dxgi.is_full_screen = true;
|
||||
}
|
||||
|
@ -298,6 +301,24 @@ static LRESULT CALLBACK gfx_dxgi_wnd_proc(HWND h_wnd, UINT message, WPARAM w_par
|
|||
} else {
|
||||
return DefWindowProcW(h_wnd, message, w_param, l_param);
|
||||
}
|
||||
case WM_LBUTTONDOWN:
|
||||
dxgi.on_mouse_press(1, 0, 0);
|
||||
break;
|
||||
case WM_RBUTTONDOWN:
|
||||
dxgi.on_mouse_press(0, 1, 0);
|
||||
break;
|
||||
case WM_MBUTTONDOWN:
|
||||
dxgi.on_mouse_press(0, 0, 1);
|
||||
break;
|
||||
case WM_LBUTTONUP:
|
||||
dxgi.on_mouse_press(-1, 0, 0);
|
||||
break;
|
||||
case WM_RBUTTONUP:
|
||||
dxgi.on_mouse_press(0, -1, 0);
|
||||
break;
|
||||
case WM_MBUTTONUP:
|
||||
dxgi.on_mouse_press(0, 0, -1);
|
||||
break;
|
||||
default:
|
||||
return DefWindowProcW(h_wnd, message, w_param, l_param);
|
||||
}
|
||||
|
@ -338,6 +359,8 @@ static void gfx_dxgi_init(const char *game_name, bool start_in_fullscreen) {
|
|||
|
||||
ATOM winclass = RegisterClassExW(&wcex);
|
||||
|
||||
if (gMouseCam)
|
||||
ShowCursor(FALSE);
|
||||
|
||||
run_as_dpi_aware([&] () {
|
||||
// We need to be dpi aware when calculating the size
|
||||
|
@ -345,7 +368,7 @@ static void gfx_dxgi_init(const char *game_name, bool start_in_fullscreen) {
|
|||
AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, FALSE);
|
||||
|
||||
dxgi.h_wnd = CreateWindowW(WINCLASS_NAME, w_title, WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT, 0, wr.right - wr.left, wr.bottom - wr.top, nullptr, nullptr, nullptr, nullptr);
|
||||
GetSystemMetrics(SM_CXFULLSCREEN)/2 - wr.right/2, GetSystemMetrics(SM_CYFULLSCREEN)/2 - wr.bottom/2, wr.right - wr.left, wr.bottom - wr.top, nullptr, nullptr, nullptr, nullptr);
|
||||
});
|
||||
|
||||
load_dxgi_library();
|
||||
|
@ -366,10 +389,12 @@ static void gfx_dxgi_set_fullscreen(bool enable) {
|
|||
toggle_borderless_window_full_screen(enable, true);
|
||||
}
|
||||
|
||||
static void gfx_dxgi_set_keyboard_callbacks(bool (*on_key_down)(int scancode), bool (*on_key_up)(int scancode), void (*on_all_keys_up)(void)) {
|
||||
static void gfx_dxgi_set_keyboard_callbacks(bool (*on_key_down)(int scancode), bool (*on_key_up)(int scancode), void (*on_all_keys_up)(void), void (*on_mouse_move)(long x, long y), void on_mouse_press(s8 left, s8 right, s8 middle)) {
|
||||
dxgi.on_key_down = on_key_down;
|
||||
dxgi.on_key_up = on_key_up;
|
||||
dxgi.on_all_keys_up = on_all_keys_up;
|
||||
dxgi.on_mouse_move = on_mouse_move;
|
||||
dxgi.on_mouse_press = on_mouse_press;
|
||||
}
|
||||
|
||||
static void gfx_dxgi_main_loop(void (*run_one_game_iter)(void)) {
|
||||
|
@ -400,6 +425,19 @@ static uint64_t qpc_to_us(uint64_t qpc) {
|
|||
}
|
||||
|
||||
static bool gfx_dxgi_start_frame(void) {
|
||||
|
||||
// Before rendering, center the mouse cursor and set the mouse movement variables.
|
||||
if (gMouseCam) {
|
||||
POINT cursorPoint;
|
||||
GetCursorPos(&cursorPoint);
|
||||
POINT screenPoint;
|
||||
screenPoint.x = dxgi.current_width/2;
|
||||
screenPoint.y = dxgi.current_height/2;
|
||||
ClientToScreen(dxgi.h_wnd, &screenPoint);
|
||||
dxgi.on_mouse_move(cursorPoint.x-screenPoint.x, cursorPoint.y-screenPoint.y);
|
||||
SetCursorPos(screenPoint.x, screenPoint.y);
|
||||
}
|
||||
|
||||
DXGI_FRAME_STATISTICS stats;
|
||||
if (dxgi.swap_chain->GetFrameStatistics(&stats) == S_OK && (stats.SyncRefreshCount != 0 || stats.SyncQPCTime.QuadPart != 0ULL)) {
|
||||
{
|
||||
|
|
|
@ -167,6 +167,8 @@ static struct {
|
|||
bool (*on_key_down)(int scancode);
|
||||
bool (*on_key_up)(int scancode);
|
||||
void (*on_all_keys_up)(void);
|
||||
void (*on_mouse_move)(long x, long y);
|
||||
void (*on_mouse_press)(s8 left, s8 right, s8 middle);
|
||||
|
||||
PFNGLXGETSYNCVALUESOMLPROC glXGetSyncValuesOML;
|
||||
PFNGLXSWAPBUFFERSMSCOMLPROC glXSwapBuffersMscOML;
|
||||
|
@ -395,7 +397,7 @@ static void gfx_glx_set_fullscreen(bool enable) {
|
|||
gfx_glx_set_fullscreen_state(enable, true);
|
||||
}
|
||||
|
||||
static void gfx_glx_set_keyboard_callbacks(bool (*on_key_down)(int scancode), bool (*on_key_up)(int scancode), void (*on_all_keys_up)(void)) {
|
||||
static void gfx_glx_set_keyboard_callbacks(bool (*on_key_down)(int scancode), bool (*on_key_up)(int scancode), void (*on_all_keys_up)(void), void (*on_mouse_move)(long x, long y), void (*on_mouse_press)(s8 left, s8 right, s8 middle)) {
|
||||
glx.on_key_down = on_key_down;
|
||||
glx.on_key_up = on_key_up;
|
||||
glx.on_all_keys_up = on_all_keys_up;
|
||||
|
|
|
@ -496,6 +496,8 @@ static void gfx_opengl_start_frame(void) {
|
|||
glDepthMask(GL_TRUE); // Must be set to clear Z-buffer
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
if (gWireframeMode)
|
||||
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@ static void (*on_fullscreen_changed_callback)(bool is_now_fullscreen);
|
|||
static bool (*on_key_down_callback)(int scancode);
|
||||
static bool (*on_key_up_callback)(int scancode);
|
||||
static void (*on_all_keys_up_callback)(void);
|
||||
static void (*on_mouse_move)(long x, long y);
|
||||
static void (*on_mouse_press)(s8 left, s8 right, s8 middle);
|
||||
|
||||
static Uint32 last_time;
|
||||
|
||||
|
@ -237,7 +239,7 @@ static void gfx_sdl_set_fullscreen(bool enable) {
|
|||
set_fullscreen(enable, true);
|
||||
}
|
||||
|
||||
static void gfx_sdl_set_keyboard_callbacks(bool (*on_key_down)(int scancode), bool (*on_key_up)(int scancode), void (*on_all_keys_up)(void)) {
|
||||
static void gfx_sdl_set_keyboard_callbacks(bool (*on_key_down)(int scancode), bool (*on_key_up)(int scancode), void (*on_all_keys_up)(void), void (*on_mouse_move)(long x, long y), void (*on_mouse_press)(s8 left, s8 right, s8 middle)) {
|
||||
on_key_down_callback = on_key_down;
|
||||
on_key_up_callback = on_key_up;
|
||||
on_all_keys_up_callback = on_all_keys_up;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
struct GfxWindowManagerAPI {
|
||||
void (*init)(const char *game_name, bool start_in_fullscreen);
|
||||
void (*set_keyboard_callbacks)(bool (*on_key_down)(int scancode), bool (*on_key_up)(int scancode), void (*on_all_keys_up)(void));
|
||||
void (*set_keyboard_callbacks)(bool (*on_key_down)(int scancode), bool (*on_key_up)(int scancode), void (*on_all_keys_up)(void), void (*on_mouse_move)(long x, long y), void (*on_mouse_press)(s8 left, s8 right, s8 middle));
|
||||
void (*set_fullscreen_changed_callback)(void (*on_fullscreen_changed)(bool is_now_fullscreen));
|
||||
void (*set_fullscreen)(bool enable);
|
||||
void (*main_loop)(void (*run_one_game_iter)(void));
|
||||
|
|
|
@ -195,28 +195,39 @@ void main_func(void) {
|
|||
request_anim_frame(on_anim_frame);
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_DX12)
|
||||
rendering_api = &gfx_direct3d12_api;
|
||||
wm_api = &gfx_dxgi_api;
|
||||
#elif defined(ENABLE_DX11)
|
||||
rendering_api = &gfx_direct3d11_api;
|
||||
wm_api = &gfx_dxgi_api;
|
||||
#elif defined(ENABLE_OPENGL)
|
||||
rendering_api = &gfx_opengl_api;
|
||||
#if defined(__linux__) || defined(__BSD__)
|
||||
wm_api = &gfx_glx;
|
||||
#else
|
||||
wm_api = &gfx_sdl;
|
||||
#endif
|
||||
#elif defined(ENABLE_GFX_DUMMY)
|
||||
rendering_api = &gfx_dummy_renderer_api;
|
||||
wm_api = &gfx_dummy_wm_api;
|
||||
#endif
|
||||
switch (configGraphicsBackend)
|
||||
{
|
||||
#if !defined(__linux__) && !defined(__BSD__)
|
||||
case 0:
|
||||
rendering_api = &gfx_direct3d11_api;
|
||||
wm_api = &gfx_dxgi_api;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
rendering_api = &gfx_direct3d12_api;
|
||||
wm_api = &gfx_dxgi_api;
|
||||
break;
|
||||
|
||||
#if defined(ENABLE_OPENGL)
|
||||
case 2:
|
||||
rendering_api = &gfx_opengl_api;
|
||||
wm_api = &gfx_sdl;
|
||||
break;
|
||||
#endif
|
||||
#else
|
||||
case 0:
|
||||
rendering_api = &gfx_opengl_api;
|
||||
wm_api = &gfx_glx;
|
||||
#endif
|
||||
default:
|
||||
rendering_api = &gfx_dummy_renderer_api;
|
||||
wm_api = &gfx_dummy_wm_api;
|
||||
break;
|
||||
}
|
||||
gfx_init(wm_api, rendering_api, gTitleString, 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);
|
||||
wm_api->set_keyboard_callbacks(keyboard_on_key_down, keyboard_on_key_up, keyboard_on_all_keys_up, keyboard_on_mouse_move, keyboard_on_mouse_press);
|
||||
|
||||
#if HAVE_WASAPI
|
||||
if (audio_api == NULL && audio_wasapi.init()) {
|
||||
|
|
Loading…
Reference in a new issue