Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Blastfrog

Attempting to get coding help for my TC's engine

Recommended Posts

Just did bobbing code changes in DoomLegacy (no, I am already full time tied up by DoomLegacy). That code is all over the place.
That is because it is not independent of player movement.
Every attempt to fix bobbing resulted in compromises that would affect player movement, so Killough finally came up with the independent player bobbing momentum fields, player->momx and player->momy (which in DoomLegacy are bob_momx, and bob_momy). Anything derived from sources earlier than MBF do not have those fields (only have player->mo->momx, player->mo->momy).

First thing, make a copy of your working directory, and only work in your experimental directory. When you are satisfied with your mods, then do a DIFF against the original that you started with, to create a patch file. Then read that patch file carefully, so you can remove patches that are not part of your fix.

To test an idea use #if 0 ... #endif around that parts that you are cutting out.

Mark your code with comments like
#if 1
// [WDJ] Test of new bobbing code 6/24/2011
..
#else
// [WDJ] Original bobbing code
..
#endif

Grep will find all the uses of most variable uses. It would be better if the authors had not used the same field names in so many structures.
Many times end up using multiple greps.
grep "bob" * | grep "momentum" | less

It would be useful to DIFF against a close relative that has the bobbing the way you want it. But Chocolate Doom may emulate the original behavior but I expect the internal coding is all changed.
That means you have to do the comparisons by eye.

All bobbing is closely tied to changes in player->mo->momx, player->mo->momy.
The orignal updated this in some closely related functions, P_PlayerMove, P_Bob, P_Thrust.

You will see player->momx and player->bob both in one function.
Only change the player->bob (like changing the sign of what is added to it). Changing player->mo->momx and player->mo->momy will affect player movement, with many consequences.

Not having Chocolate Doom source, I can only guess whether it keeps the original names, or has new functions, and new structure.
DoomLegacy has changed many of its function names too (to make grep more useful if nothing else).

Beware of adding anything to info.c structures, they are indexed by other definitions made in other files. Only add to the end of a structure, and then you will have to also create definition names to index the new entries. See how any advanced port added Heretic to the original Doom info.c entries.

I do not remember anything about "0.4 alpha bobbing", do not know what it is.

Share this post


Link to post

Here is a modified choco executable that has the alpha's bobbing behavior:

http://www.speedyshare.com/files/29184864/chocolate-doom.exe

I changed psp->sy = WEAPONTOP + FixedMul (player->bob, finesine[angle]); to psp->sy = WEAPONTOP - FixedMul (player->bob, finesine[angle]); in order to invert the vertical angle of the bob.

Be noted however that the bottoms of the sprites (the flat cutoff point) will be visible unless you make them vertically longer than usual. The chaingun, rocket launcher, and bfg for example are all vertically longer than the other weapon sprites meaning that the bottoms of them will stay off-screen.

I'll mess around with the source later to implement the other bob related things you wanted.

Share this post


Link to post

Won't be able to see what the changes are from an executable, and exe format assumes MSWindows.
Can you make that a patch or other diff file.

Share this post


Link to post
wesleyjohnson said:

Won't be able to see what the changes are from an executable, and exe format assumes MSWindows.
Can you make that a patch or other diff file.


Here is the modified version of p_pspr.c that changes the bob:

http://pastebin.com/WG4CEs6e

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×