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

New MBF21 DEHACKED codepointers (first batch) #20

Merged
merged 20 commits into from
Apr 7, 2021

Conversation

XaserAcheron
Copy link
Contributor

Got the first handful of codepointers done. There's a few more I may try and sneak in (melee attacks and some of skillsaw's suggestions), but some of 'em will need a bit of research to figure out how best to do 'em, and I don't want to hold up the essentials any longer than I must. ;)

Quick summary of the 'pointers:

  • Actor pointers:
    • A_SpawnFacing(type, height) -- spawns an actor of type at height z units and sets its angle to the caller's angle.
    • A_MonsterProjectile(type, angle) -- generic monster projectile attack; always sets tracer field.
    • A_MonsterBulletAttack(damage, spread) -- generic monster bullet attack w/horizontal spread; if spread is negative, apply vertical spread equal to 2/3 of this value (approx. equal to SSG vert-spread)
    • A_RadiusDamage(damage, radius) -- generic A_Explode, w/customizable damage and radius (helll yeah)
  • Weapon pointers:
    • A_WeaponProjectile(type, angle) -- generic weapon projectile attack; does not consume ammo
    • A_WeaponBulletAttack(damage, spread) -- generic weapon bullet attack; does not consume ammo; same spread behavior as A_MonsterBulletAttack
    • A_WeaponSound(sound, fullvol) -- same as A_PlaySound, but for weapons
    • A_WeaponJump(state, chance) -- same as A_RandomJump, but for weapons
    • A_ConsumeAmmo(amount) -- subtract amount units of ammo. if amount is zero, use the weapon slot's ammopershot. will not reduce ammo below zero.
    • A_CheckAmmo(state, amount) -- jumps to state if ammo is below amount; if amount is zero, use the weapon slot's ammopershot value instead
    • A_RefireTo(state, noammocheck) -- jumps to state if trigger is still held down; will also check ammo unless noammocheck is set
    • A_GunFlashTo(state, nothirdperson) -- sets the weapon's flash state to state; also sets the player's 3rd-person sprite to the player actor's firing frame unless nothirdperson is set

A bit more than the 5 pointers I originally planned, but eh. Low-hanging fruit gets monched. :P

// according to plan...
//

int P_GetAmmoPerShot(player_t *player)
Copy link
Owner

Choose a reason for hiding this comment

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

This isn't hit by any existing code, right? It will only be hit downstream of the new code pointers? Just making sure heretic doesn't need to be considered :^)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently no, but the eventual plan is for P_CheckAmmo to call this function if (mbf21) in my eventual ammopershot PR. Means it still ought not affect Heretic though; presuming you can't set the new complevel there. ;)

Copy link
Owner

Choose a reason for hiding this comment

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

Instead of a method, what do you think about using an array shotammo to match the existing maxammo and clipammo? That will fit in with the use of maxammo and clipammo in d_deh, assuming we will be making it all configurable the same way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense -- though that seems like a thing to do for the new ammopershot PR. I'll probably rip out the P_GetAmmoPerShot function completely if it's indeed as simple as indexing an array. ;)

if (!mbf21 || !actor->state->misc1)
return;

mobj_t *mo = P_SpawnMobj(actor->x, actor->y, (actor->state->misc2 << FRACBITS) + actor->z, actor->state->misc1 - 1);
Copy link
Owner

Choose a reason for hiding this comment

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

We need to declare this variable at the top and then set it here to avoid a warning in C, right? 🤓

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Heh, maybe. :P -- Fixed for consistency at least. ;)

@kraflab
Copy link
Owner

kraflab commented Apr 5, 2021

Please add a code pointers header in https://github.com/kraflab/dsda-doom/blob/master/prboom2/src/mbf21.md and link this pr as well as list the ones added here. Just basic info is fine - it isn't meant to be a spec for public consumption so we can go into more detail once mbf21 is more finalized.

@XaserAcheron
Copy link
Contributor Author

Just pushed an update to mbf21.md -- in this PR; it's self-referential now. :P

@kraflab kraflab merged commit 1d5cd63 into kraflab:master Apr 7, 2021
@XaserAcheron XaserAcheron deleted the mbfplus-codepointers branch April 7, 2021 16:59
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