Skip to content

Commit

Permalink
Zombie motion interval (#20)
Browse files Browse the repository at this point in the history
* Hook `MotionIntervalController::setIntervalLevel`.

* Fix accidentally setting the instance pointer to zero.

* Set the value and not the pointer.

* Update README.md
  • Loading branch information
TheTedder authored Nov 27, 2022
1 parent 42b1ff4 commit cbd91f4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,11 @@ namespace REFix {

return REFRAMEWORK_HOOK_SKIP_ORIGINAL;
}

int pre_set_interval_level(int argc, void** argv, REFrameworkTypeDefinitionHandle* arg_tys)
{
int32_t* level = (int32_t*)&argv[2];
*level = 0;
return REFRAMEWORK_HOOK_CALL_ORIGINAL;
}
}
1 change: 1 addition & 0 deletions Hooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ namespace REFix {
void post_hook_null(void** ret_val, REFrameworkTypeDefinitionHandle ret_ty);
int pre_update_pitch_yaw(int argc, void** argv, REFrameworkTypeDefinitionHandle* arg_tys);
int pre_add_rank_point_direct(int argc, void** argv, REFrameworkTypeDefinitionHandle* arg_tys);
int pre_set_interval_level(int argc, void** argv, REFrameworkTypeDefinitionHandle* arg_tys);
}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ The mouse sensitivity decreases when the FOV is lower and vice versa. This is mo
### Removes dynamic difficulty
Normally, certain actions in the game suck as firing a weapon, damaging an enemy, or taking damage yourself will cause the difficulty scale of the game to be adjusted slightly. This adds up over the course of a playthrough, resulting in unfairly tanky enemies if you play too well; therefore, the best strategy is to periodically take intentional damage to keep the game's difficulty low. This is undesireable because it actually rewards the player for playing worse, and lowers the skill ceiling by not allowing the player to get a feel for how many hits it takes to defeat each enemy. This mod removes this feature, although scripted difficulty changes are still present. For example, the difficult setting starts out low during the intro sequence at the gas station and then increases upon entering RPD.

### Improves zombie animation framerate

At low LODs, the framerate of the zombie animations is reduced in order to save some processing power. This looks really bad though, and it barely saves any CPU time, so this mod forces all zombies to animate at full speed. This functionality is reverse-engineered from TheEggPie's mod that does the same exact thing. See https://www.nexusmods.com/residentevil22019/mods/728.

## Installation
### Prerequisites
* A compatible game (see above)
Expand Down
5 changes: 5 additions & 0 deletions init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,10 @@ bool reframework_plugin_initialize(const REFrameworkPluginInitializeParam* param
// Remove dynamic difficulty modulation.

tdb->find_method("app.ropeway.GameRankSystem", "addRankPointDirect")->add_hook(REFix::pre_add_rank_point_direct, REFix::post_hook_null, false);

// Make zombies animate at 60fps.

tdb->find_method("app.ropeway.MotionIntervalController", "setIntervalLevel")->add_hook(REFix::pre_set_interval_level, REFix::post_hook_null, false);

return true;
}

0 comments on commit cbd91f4

Please sign in to comment.