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

Some chocolate strife bugs #663

Open
nukeykt opened this issue Feb 2, 2016 · 12 comments
Open

Some chocolate strife bugs #663

nukeykt opened this issue Feb 2, 2016 · 12 comments
Assignees

Comments

@nukeykt
Copy link
Contributor

nukeykt commented Feb 2, 2016

Hi. During my pcstrife port development, i think i found some bugs in Chocolate Strife:
p_enemy.c

  1. In A_ReaverAttack damage formula should be 3 * ((P_Random() & 7) + 1)
  2. In A_ProgrammerMelee damage formula should be 6 * (P_Random() % 10 + 1)
  3. A_TeleportBeacon sets mobj->theshold to 100. See:https://github.com/nukeykt/pcstrife/blob/master/P_ENEMY.C#L3210
    p_inter.c
  4. Box of rockets gives 4 units, while rocket gives 20 units. Bug in P_TouchSpecialThing function.
  5. P_KillMobj: Function doesn't clear MF_SOLID flag and adds 5*FRACUNIT to momz.
  6. P_DamageMobj: Chocolate strife code clears pw_communicator, when player dies in flame. Actually pw_invisibility should be cleared instead.

Misc:

  1. Numpad key 5 acts like ALT.
  2. Strife doesn't crash after 100 screenshots.
@haleyjd
Copy link
Contributor

haleyjd commented Feb 4, 2016

I'll try to verify all these in the assembly as soon as I get a chance. Currently working on Turok editor for NDS.

@jmtd jmtd added the Strife label Feb 10, 2016
@haleyjd haleyjd self-assigned this Mar 1, 2016
@haleyjd
Copy link
Contributor

haleyjd commented Mar 1, 2016

Visual Studio project has been broken such that I am no longer able to build; I receive several hundred errors about not being able to find SDL.h - this was never an issue before.

@haleyjd
Copy link
Contributor

haleyjd commented Mar 1, 2016

I figured out this is actually a change in my local VC++ config that was necessary for work I've been doing on other projects; the chocolate .sln file doesn't specify additional include directories. The problem is, I cannot add these back to my global VC++ includes path because they conflict with SDL 2.0 which I need for these other projects. I am probably going to modify the .gitignore for the msvc directory so that it allows SDL to be present in that directory if the builder so chooses to place it there.

@haleyjd
Copy link
Contributor

haleyjd commented Mar 6, 2016

Leaving some notes on what went wrong to cause these problems as I fix them:
p_enemy:

  1. The 3x mul was just plain left out, simple human error or even a typo while putting in the code
  2. I missed a sub ecx, edx which subtracts 1 edx worth from a previously calculated 4*edx before it is again doubled below by an add ecx, ecx; so this resulted in our incorrect multiplier of 8 instead of 6. Hex-Rays cannot decompile this function properly due to the idiv opcode used to compute the modulus 10, so it had to be translated directly from the assembly.
  3. This beacon function's a nightmare, that's all I can say. Was already significantly improved during SVE dev, I wouldn't be surprised if there are still problems. Watcom made Swiss cheese out of this code.

p_inter:

  1. P_TouchSpecialThing can also not be decompiled due to having a jumptable in it, as well as being optimized into a binary tree of jump instructions which try to determine the case in O(log N) operations. Somehow we reversed these case labels. People complained about this during SVE launch but I disregarded it because I thought it was an original game bug.
  2. Sorry you're going to have to be much more specific here, I'm not even going to try to find what you're talking about w/o it as this function is hundreds of lines of assembly. There's already a momz += 5*FRACUNIT for players when they die at line 857.
  3. Your assertion does not agree with the disassembly for this one:
cseg01:00023B80                 mov     eax, [edi+mobj_t.player]
cseg01:00023B86                 mov     dword ptr [eax+31h], 0

Because player->powers[] is based at offset 0x2D, 0x31 is at index 4 into the array, and 4 is pw_communicator.
The misc issues are Chocolate issues; I have no way to change the behavior of V_ScreenShot for Strife because it is in a shared module; fraggle will have to approve any solution to that. Key input is also shared between games and is handled by low level SDL code.

@haleyjd haleyjd assigned fragglet and unassigned haleyjd Mar 6, 2016
@haleyjd
Copy link
Contributor

haleyjd commented Mar 6, 2016

Reassigned to fraggle due to last two issues on the list. If you can clarify the code you think is wrong in P_KillMobj by line number, I will take a second crack at that one.

@haleyjd
Copy link
Contributor

haleyjd commented Mar 6, 2016

I just realized the error with p_inter item 3; the array is a DWORD array, so 0x31 is in fact index 1, not index 4... fixing that now! 😃

@nukeykt
Copy link
Contributor Author

nukeykt commented Mar 6, 2016

Another bug. In vanilla strife automap marks spots at player position, while in chocolate strife marks at screen center.
See: https://github.com/nukeykt/pcstrife/blob/master/AM_MAP.C#L322

@nukeykt
Copy link
Contributor Author

nukeykt commented Mar 6, 2016

About p_inter bug:
In chocolate strife,lines 855-858:
target->flags &= ~MF_SOLID;
target->player->playerstate = PST_DEAD;
target->player->mo->momz = 5*FRACUNIT; // [STRIFE]: small hop!
P_DropWeapon(target->player);

In disassembly:
target->player->playerstate = PST_DEAD;
target->player->mo->momz += 5*FRACUNIT; // [STRIFE]: small hop!
P_DropWeapon(target->player);

@haleyjd
Copy link
Contributor

haleyjd commented Mar 6, 2016

Thanks I'll check those out.

@haleyjd
Copy link
Contributor

haleyjd commented Mar 6, 2016

These are taken care of.

@nukeykt
Copy link
Contributor Author

nukeykt commented Mar 6, 2016

Thanks

@nukeykt
Copy link
Contributor Author

nukeykt commented Mar 7, 2016

In strife mark clear command binded to backspace key, not to 'C'.

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

No branches or pull requests

4 participants