Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SoloTogether and BunnyExtinction #6

Open
wants to merge 26 commits into
base: main
Choose a base branch
from

Conversation

MicrowaveBunny
Copy link
Contributor

Please publish only SoloTogether and BunnyExtinction. Do not publish HyperbolicPlus yet.

Add new mods, SoloTogether and BunnyExtinction
Updates Fullmetal to be compatible with first hallway choice
README of Fullmetal now contains attributions for people who have helped with the project

HyperbolicPlus version 1.0.2, used for tournament 1
Basic enemies can now be used
Rewriting BattleData to have cleaner structure
Added new config settings
Imported old battleData
Fixed basic patterns
Hyperbolic+
Fixed random for mixes
Added player death order print

BunnyExtinction:
Added BunnyExtinction 0.0.1
Added Twili1 mix
Timed all bosses
Merran phase 1 and Matti phase 2 cannot be played as mixes
hook for diffswitch would affect enemy health and patterns. A check was added to only affect player health
Items like Sunflower Crown, Grasswoven Bracelet, and Vitality Potion no longer give extra health. Config also properly updates when option is enabled or disabled
Max speed is now 6.30, or -2 in terms of base stats
Updated README's for MicrowaveBunny's mods. Now includes acknowledgement for users who helped with development
Invuln now works properly in BEX.
Shira invulns work properly again
Array for storing speeds was incorrectly initialized
Now works if host is spectating
Copy link
Collaborator

@fuzzything44 fuzzything44 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I got all the cases where you're returning a reference to a variable on the stack, but if I missed any that you know of feel free to fix them.

if (this.IsReady(out var rnsReloaded, out var hooks, out var utils, out var scrbp, out var bp)) {
// setting hp to smite players
RValue* playerHp = rnsReloaded.FindValue(rnsReloaded.GetGlobalInstance(), "playerHp");
for (int i = 0; i < 4; i++) { // iterate through bitmask
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend using utils.getNumPlayers() instead of 4 here.

returnValue = hook!.OriginalFunction(self, other, returnValue, argc, argv);
// diifSwitch is used for multiple things
// to intercept health, we check all the arguments
if (argv[0]->Real == 8 && argv[1]->Real == 5 && argv[2]->Real == 5 && argv[3]->Real == 3) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add comments to what the args mean/why you're looking for those specific values if you know?

// store original speed
var s = new RValue(self);
int id = (int) utils.RValueToLong(rnsReloaded.FindValue(self, "playerId"));
this.movementSpeeds[id] = utils.RValueToDouble(returnValue);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break if there's ever >4 players. Which might happen in the future, IDK.

Comment on lines +322 to +323
RValue newRadius = new RValue(-1);
argv[2] = &newRadius;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of setting this to a reference to newly created variable could you just instead set arvg[2]->Real and argv[2]->Type fields?

I'm not 100% sure this is memory safe and I suspect it'll either cause a potential segfault (if &newRadius is allocated on the stack, or a memory leak with either this or the old argument not being properly garbage collected, potentially.

Comment on lines +223 to +224
RValue result = new RValue(0);
return &result;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not memory safe, please modify returnValue and return it.


private RValue* EnrageTimeDetour(CInstance* self, CInstance* other, RValue* returnValue, int argc, RValue** argv) {
var a = new RValue(-1);
return &a;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, don't return a reference to a variable on the stack.

private RValue* ReviveDetour(CInstance* self, CInstance* other, RValue* returnValue, int argc, RValue** argv) {
// canRevive is false
RValue result = new RValue(0);
return &result;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again.

// if KOtimer is drawn, add player to mask
int id = (int) utils.RValueToLong(argv[0]);
if ((this.deadPlayers & (1 << id)) == 0) { // player hasn't been marked dead yet
Console.WriteLine($"Player {id} has just fallen");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the logging library instead of Console.WriteLine

@@ -0,0 +1,76 @@
using System.Drawing;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate file, remove and use the RNSReloaded version.


private RValue* ReviveDetour(CInstance* self, CInstance* other, RValue* returnValue, int argc, RValue** argv) {
var hook = ScriptHooks["scr_kotracker_can_revive"];
RValue result = new RValue(0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants