Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.20)
project(MegaManXSNESRecomp VERSION 2.3.12 LANGUAGES C CXX)
project(MegaManXSNESRecomp VERSION 2.3.13 LANGUAGES C CXX)
# Qualified Windows x64 default; retain explicit selections and other-target floors.
set(_MMX_RASTER_IMPL_DEFAULT "LLE")
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" _MMX_RASTER_IMPL_PROCESSOR)
Expand Down Expand Up @@ -99,6 +99,7 @@ function(add_mmx_variant TARGET GEN_DIR CFG_DIR)
src/main.c src/mmx_startup.c src/mmx_netplay.c src/mmx_display.c ${MMX_RENDERER_SOURCE} src/mmx_render_assets.c src/mmx_wide_policy.c
src/mmx_00.c src/gen_stubs.c src/mmx_cpu_infra.c src/mmx_rtl.c
src/mmx_spc_player.c src/mmx_replay.c src/mods/mmx_diagnostics_plugin.c
src/mmx_damage.c src/mods/mmx_damage_plugin.c
src/mods/mmx_widescreen_plugin.c src/mods/mmx_msu1_plugin.c
src/mods/mmx_hadouken_plugin.c src/mods/mmx_password_plugin.c src/mods/mmx_boss_rush_plugin.c src/mmx_password_save.cpp
src/mods/mmx_zero_plugin.c src/mods/mmx_armor_plugin.c src/mmx_zero.c src/mmx_armor.c src/mmx_armor_launcher.c src/mmx_weapons.c src/mmx_weapon_combat.c src/mmx_knc_bugfix.c src/mmx_coop.c src/mmx_coop_trace.c src/mmx_coop_view.c
Expand Down Expand Up @@ -141,6 +142,7 @@ function(add_mmx_variant TARGET GEN_DIR CFG_DIR)
${CMAKE_CURRENT_SOURCE_DIR}/tools/apply_renderer_capture.py
${CMAKE_CURRENT_SOURCE_DIR}/tools/apply_password_hooks.py
${CMAKE_CURRENT_SOURCE_DIR}/tools/apply_zero_hooks.py
${CMAKE_CURRENT_SOURCE_DIR}/tools/apply_damage_hooks.py
${CMAKE_CURRENT_SOURCE_DIR}/tools/apply_coop_hooks.py
${CMAKE_CURRENT_SOURCE_DIR}/tools/apply_weapon_hooks.py
${CMAKE_CURRENT_SOURCE_DIR}/tools/apply_boss_rush_hooks.py)
Expand All @@ -159,6 +161,8 @@ function(add_mmx_variant TARGET GEN_DIR CFG_DIR)
--gen-dir ${GEN_DIR}
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/apply_boss_rush_hooks.py
--gen-dir ${GEN_DIR}
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/apply_damage_hooks.py
--gen-dir ${GEN_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Applying Mega Man X generated-code mod hooks" VERBATIM)
add_dependencies(${TARGET} ${TARGET}_widescreen_overrides)
Expand Down Expand Up @@ -191,6 +195,14 @@ add_mmx_variant(RockmanXSNESRecomp "${CMAKE_CURRENT_SOURCE_DIR}/variants/jp/gen"

include(CTest)
if(BUILD_TESTING)
add_executable(mmx_damage_test tests/mmx_damage_test.c src/mmx_damage.c)
target_include_directories(mmx_damage_test PRIVATE src)
add_test(NAME mmx_damage_multipliers COMMAND mmx_damage_test)
if(MSVC)
target_compile_options(mmx_damage_test PRIVATE /UNDEBUG)
else()
target_compile_options(mmx_damage_test PRIVATE -UNDEBUG)
endif()
add_executable(mmx_armor_launcher_test tests/mmx_armor_launcher_test.c src/mmx_armor_launcher.c)
target_include_directories(mmx_armor_launcher_test PRIVATE src ${RECOMP_UI_ROOT}/src)
target_compile_definitions(mmx_armor_launcher_test PRIVATE RECOMP_LAUNCHER=1)
Expand Down Expand Up @@ -355,6 +367,15 @@ if(TARGET mmx_state_tests)
set_property(TARGET mmx_state_tests PROPERTY SOURCES
tests/mmx_adaptive_state_test.c ${mmx_state_sources})
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/mmx.sfc")
set(damage_test_dir "${CMAKE_CURRENT_BINARY_DIR}/damage-runtime")
file(MAKE_DIRECTORY "${damage_test_dir}")
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/mods/preloaded/" DESTINATION "${damage_test_dir}/catalog")
add_test(NAME mmx_damage_runtime
COMMAND ${CMAKE_COMMAND} -E env SDL_AUDIODRIVER=dummy SDL_VIDEODRIVER=dummy
MMX_REPLAY_RECORD=0 MMX_DAMAGE_TEST=1
$<TARGET_FILE:mmx_state_tests> "${CMAKE_CURRENT_SOURCE_DIR}/mmx.sfc")
set_tests_properties(mmx_damage_runtime PROPERTIES
WORKING_DIRECTORY "${damage_test_dir}" LABELS "rom;damage")
set(rush_report_dir "${CMAKE_CURRENT_BINARY_DIR}/boss-rush-reports")
set(render_rollback_dir "${CMAKE_CURRENT_BINARY_DIR}/render-rollback")
file(MAKE_DIRECTORY "${render_rollback_dir}")
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ Rev 1 build.
| &#9745; | **[Boss Rush](docs/boss-rush.md)** | Endless fights against two different Mavericks, solo or co-op, from the game's title menu. |
| &#9745; | **X2 weapons** | All eight boss weapons and their charged attacks, adapted for X and Zero. |
| &#9745; | **X3 weapons** | All eight boss weapons and their charged attacks, adapted for X and Zero. |
| &#9745; | **Damage multipliers** | Separate mods for X's damage dealt and player damage received, from 0.1x to 10x. |
| &#9745; | **X2 / X3 Armor (experimental)** | Donor X graphics and abilities, unlocked through X1's armor capsules. X3 Gold Armor is awarded by the Hadouken capsule. |
| &#9745; | **Netplay** | Two-player online co-op with lobbies and rollback, plus optional fixed widescreen. |

Expand Down Expand Up @@ -139,6 +140,17 @@ No ROMs or extracted assets are included in the downloads.
For Storm Eagle's speedrun trick and local practice saves, see the
[Magic Carpet guide](docs/magic-carpet.md).

In **Mods > Gameplay**, enable **X damage dealt** or **Player damage received**
and choose its **Damage multiplier**. The two mods are independent: 0.5x halves
damage, 1x keeps normal damage, and 2x doubles it. Choices range from 0.1x to
10x; both mods start disabled with 1x selected. X's multiplier includes native
and imported weapons and leaves Zero's attacks unchanged. Received damage
applies to both characters after armor reduction. Fractional damage carries
between hits, separately for each enemy and player: at 0.1x, five 2-HP hits
cost 1 HP in total. Individual hits can cause no HP loss while retaining their
normal hurt reaction. Damage caps safely at 127 HP. Immunities and instant-death
hazards keep their native behavior. Save states and rewind preserve fractions.

### Which ROM?

The game needs the **v1.1 (Rev 1)** cartridge dump. The original v1.0 release
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ id = "widescreen"
name = "Widescreen"
description = "Extend the stage view with live enemies, preserved encounter timing, and anchored health bars."
group = "Display"
default_enabled = false
default_enabled = true

[[option]]
feature = "widescreen"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
format_version = 1
id = "megaman-x.gameplay.damage-dealt"
version = "1.0.1"
name = "X damage dealt"
author = "mstan"
description = "Multiply damage dealt by X, including native and imported weapons. Zero retains his own damage."
license = "PolyForm-Noncommercial-1.0.0"
resolver = "declarative"
save_compatibility = "requires-same-mods"

[[target]]
game_id = "megaman-x-us"
rom_sha256 = "b8f70a6e7fb93819f79693578887e2c11e196bdf1ac6ddc7cb924b1ad0be2d32"

[[feature]]
id = "damage"
name = "X damage dealt"
description = "Multiply damage dealt by X, including native and imported weapons. Zero retains his own damage."
group = "Gameplay"
default_enabled = false

[[option]]
feature = "damage"
id = "multiplier"
label = "Damage multiplier"
description = "1x is normal, 0.5x is half, 2x is double. Fractional damage carries between hits; some hits cost no HP. Maximum 127 HP per hit. Immunities remain unchanged."
type = "choice"
default = "1"

[[option.choice]]
value = "0.1"
label = "0.1x"

[[option.choice]]
value = "0.25"
label = "0.25x"

[[option.choice]]
value = "0.5"
label = "0.5x"

[[option.choice]]
value = "0.75"
label = "0.75x"

[[option.choice]]
value = "1"
label = "1x"

[[option.choice]]
value = "1.25"
label = "1.25x"

[[option.choice]]
value = "1.5"
label = "1.5x"

[[option.choice]]
value = "1.75"
label = "1.75x"

[[option.choice]]
value = "2"
label = "2x"

[[option.choice]]
value = "2.5"
label = "2.5x"

[[option.choice]]
value = "3"
label = "3x"

[[option.choice]]
value = "4"
label = "4x"

[[option.choice]]
value = "5"
label = "5x"

[[option.choice]]
value = "7.5"
label = "7.5x"

[[option.choice]]
value = "10"
label = "10x"

[[plugin]]
feature = "damage"
id = "megaman-x.damage-dealt"
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
format_version = 1
id = "megaman-x.gameplay.damage-received"
version = "1.0.1"
name = "Player damage received"
author = "mstan"
description = "Multiply damage received by either player after armor reduction. Instant-death hazards retain their native behavior."
license = "PolyForm-Noncommercial-1.0.0"
resolver = "declarative"
save_compatibility = "requires-same-mods"

[[target]]
game_id = "megaman-x-us"
rom_sha256 = "b8f70a6e7fb93819f79693578887e2c11e196bdf1ac6ddc7cb924b1ad0be2d32"

[[feature]]
id = "damage"
name = "Player damage received"
description = "Multiply damage received by either player after armor reduction. Instant-death hazards retain their native behavior."
group = "Gameplay"
default_enabled = false

[[option]]
feature = "damage"
id = "multiplier"
label = "Damage multiplier"
description = "1x is normal, 0.5x is half, 2x is double. Fractional damage carries between hits; some hits cost no HP. Maximum 127 HP per hit. Immunities remain unchanged."
type = "choice"
default = "1"

[[option.choice]]
value = "0.1"
label = "0.1x"

[[option.choice]]
value = "0.25"
label = "0.25x"

[[option.choice]]
value = "0.5"
label = "0.5x"

[[option.choice]]
value = "0.75"
label = "0.75x"

[[option.choice]]
value = "1"
label = "1x"

[[option.choice]]
value = "1.25"
label = "1.25x"

[[option.choice]]
value = "1.5"
label = "1.5x"

[[option.choice]]
value = "1.75"
label = "1.75x"

[[option.choice]]
value = "2"
label = "2x"

[[option.choice]]
value = "2.5"
label = "2.5x"

[[option.choice]]
value = "3"
label = "3x"

[[option.choice]]
value = "4"
label = "4x"

[[option.choice]]
value = "5"
label = "5x"

[[option.choice]]
value = "7.5"
label = "7.5x"

[[option.choice]]
value = "10"
label = "10x"

[[plugin]]
feature = "damage"
id = "megaman-x.damage-received"
5 changes: 5 additions & 0 deletions src/mmx_coop.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "mmx_coop.h"
#include "mmx_damage.h"
#include "mmx_coop_view.h"
#include "mmx_renderer.h"
#include "mmx_coop_trace.h"
Expand Down Expand Up @@ -1903,6 +1904,7 @@ static struct {
uint8_t pass,kind,p,db;uint16_t a,x,y,s,d;uint32_t resume;
uint8_t body[0x90];
MmxWeaponCombatState combat;MmxZeroState zero;MmxRendererPieceMark pieces;
MmxDamageState damage;
MmxCoopViewWorldState world;
} shot_ghost;
static MmxBossRushAudioState shot_ghost_audio;
Expand Down Expand Up @@ -1975,6 +1977,7 @@ static void shot_ghost_begin(CpuState *cpu,unsigned kind,uint32_t resume) {
shot_ghost.kind=(uint8_t)kind;shot_ghost.resume=resume;
memcpy(shot_ghost_ram,g_ram,sizeof(shot_ghost_ram));
shot_ghost.combat=MmxWeaponsGetCombatState();shot_ghost.zero=MmxZeroGetState();
shot_ghost.damage=MmxDamageGetState();
shot_ghost.pieces=MmxRendererMarkPieces();shot_ghost.world=MmxCoopViewsGetWorldState();
shot_ghost_state=state;shot_ghost_audio=MmxBossRushAudioGetState();
memcpy(shot_ghost_lift,&lift,sizeof(lift));memcpy(shot_ghost_cart,&cart,sizeof(cart));
Expand All @@ -1994,6 +1997,8 @@ static void shot_ghost_end(CpuState *cpu,uint32_t pc) {
memcpy(g_ram,shot_ghost_ram,sizeof(shot_ghost_ram));
memcpy(g_ram+GHOST_SPC_MIRROR,spc,sizeof(spc));
MmxWeaponsSetCombatState(shot_ghost.combat);MmxZeroSelectState(shot_ghost.zero);
if(shot_ghost.kind==GHOST_SHOTS) MmxDamageSetState(&shot_ghost.damage);
else MmxDamageRestoreWorld(&shot_ghost.damage);
MmxRendererRewindPieces(shot_ghost.pieces);MmxCoopViewsSetWorldState(&shot_ghost.world);
state=shot_ghost_state;MmxBossRushAudioSetState(&shot_ghost_audio);
memcpy(&lift,shot_ghost_lift,sizeof(lift));memcpy(&cart,shot_ghost_cart,sizeof(cart));
Expand Down
Loading
Loading