Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
SRB2
SRB2
  • Project
    • Overview
    • Details
    • Activity
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 265
    • Issues 265
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 74
    • Merge Requests 74
  • Wiki
    • Wiki
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Commits
  • Issue Boards
  • STJr
  • SRB2SRB2
  • Wiki
  • Internal documentation dump

Internal documentation dump

Last edited by MascaraSnake Dec 28, 2019
Page history

This is where I dump all the internal documentation of 2.2 features that I can find, so y'all can put it on the wiki. Be warned that some of the information may be outdated, so it's a good idea to double-check stuff first.

Damage types

This is an additional argument to P_DamageMobj, P_KillMobj, and functions for the hooks ShouldDamage, MobjDamage, MobjDeath and HurtMsg. As you can guess, they tell the game what type of damage was dealt to the target. However, nearly all of them do something special only for players.

Here is the full list of damage type constants currently in master branch (0 is considered to be the default "type"):

  • DMG_WATER - Water damage (old THZ harmful goop)
  • DMG_FIRE - Fire damage (MF_FIRE, lava)
  • DMG_ELECTRIC - Electric damage (THZ electric floors)
  • DMG_SPIKE - Spike damage (Spike Things, Spikes sector type)
  • DMG_NUKE - Armageddon shield explosion
  • DMG_INSTAKILL Generic instant kill (this marks the start of the "instant kill" types)
  • DMG_DROWNED - Died by drowning
  • DMG_SPACEDROWN - Died in space countdown sector
  • DMG_DEATHPIT - Died in death pit
  • DMG_CRUSHED - Died by crusher/solid objects landing on top of you
  • DMG_SPECTATOR - This allows you to kill spectators
  • DMG_DEATHMASK - A special mask/flag constant that allows you to check if a damage type is "instant kill" or not (e.g. damagetype & DMG_DEATHMASK)

New Lua hooks

  • "ShieldSpawn" - A hook called when a shield orb spawning function (like P_SpawnShieldOrb, or any of the monitor spawning functions) is called. Takes player as argument. If returning true, do not spawn existing orb.
  • "ShieldSpecial" - A hook called when pressing spin in midair and you have any shield in SH_NOSTACK (ie, not the fire flower). Takes player as argument. If returning true, do not perform existing shield actions.
  • "MobjMoveBlocked" - A hook that calls functions when your X/Y movement is blocked. It doesn't matter what stopped you, though you have no way to tell anyway. See this Gitlab MR for info: http://git.magicalgirl.moe/STJr/SRB2...ge_requests/67
  • "MapThingSpawn" - A hook that calls functions when a certain object type is spawned via a Map Thing on level load. See this GitLab MR for info: http://git.magicalgirl.moe/STJr/SRB2...ge_requests/83

Getting sprite patches for the HUD:

Begone with ye terrible hacks involving getting the sprite lumps by exact name, I have made a more sophisticated method of getting sprite patches! They come in the form of two video library functions accessible only through hud.add functions, named v.getSpritePatch (for normal sprites) and v.getSprite2Patch (for character skin sprites).

See this GitLab MR for info: http://git.magicalgirl.moe/STJr/SRB2...e_requests/105

Miscellaneous changes you may want to know about:

  • Also included in the "Lua additions" branch (linked in "Blockmap search" section) is the function P_PointOnLineSide(x, y, line), which basically returns which side of a line the x,y position is on (0 = front, 1 = back). You can even supply a custom line like with P_ClosestPointOnLine!
  • userdataType(variable) now exists to print the userdata type of whatever you supply as a string, e.g. "player_t" or "mobj_t". Was included with this MR: http://git.magicalgirl.moe/STJr/SRB2...ge_requests/67

Plane displacement

Linedef types 66-68 are the plane displacement specials; 66 = move floor only, 67 = move ceiling only, 68 = both

  • Front sector = control sector
  • Tag = tag of target sectors to be moved whenever the control sector floor moves
  • Linedef length = movement factor relative to control sector movement, 256 = 1:1 with control sector. 128 is half as much, 512 is twice as much, etc.

Whenever the control sector floor moves (not ceiling, never ceiling), the selected planes of the tagged sectors all move (mind, they have a tic delay due to how it all works, it's not perfect really).

Turn on Not Climbable on any of the plane displacement linedef types to enable inverse plane displacement for any sectors tagged by them. This causes moving the control sector to move all tagged sector planes in the reverse direction.

FOF wall slope skewing

FOF walls now can optionally skew with respect to slopes (software mode only currently):

  • Upper Unpegged on the CONTROL linedef enables wall skewing
  • Lower Unpegged on the IN-LEVEL linedefs 1 determine which slope to skew with respect to (off = top slope, on = bottom slope)
  • If Transfer Line is used however, Lower Unpegged on the control sector's linedefs does the above's job instead

1 (this is because they already control pegging of individual FOF walls as it is, so this is for convenience and my sanity that they also deal with skewing)

TEXTURES additions

Some new features and fixes for textures and the TEXTURES lump:

  • Flipping of individual patches used by textures is now supported, both horizontally and vertically. The formatting for doing so in TEXTURES should match that of ZDoom's:
WallTexture EXAMPLE, 128, 128
{
    Patch TEST, 0, 0
    Patch TEST, 64, 0
    {
        FlipX
    }
    Patch TEST, 0, 64
    {
        FlipY
    }
    Patch TEST, 64, 64
    {
        FlipX
        FlipY
    }
}

(in other words you need { and } below the Patch you want to flip, containing FlipX if you want horizontal flipping or FlipY if you want vertical flipping... or both, if you want both!)

  • Negative patch y-offsets should now work properly for multi-patch textures or single-patch textures with no holes.

Crumble FOF

  • EV_StartCrumble for lua, format: EV_StartCrumble(controlsec, rover, [floating?, [player, [origalpha, [crumblereturn?]]]])
    • controlsec is the FOF's control sector
    • rover is the FOF itself
    • (optional) floating? does the FOF float on water after crumbling? Defaults to false (NOTE: probably should be set to rover.flags & FF_FLOATBOB for best results currently, kind of weird otherwise)
    • (optional) player is the player that caused the FOF to fall; needed for some effects such as who to award points to if you killed someone =3 Defaults to nil
    • (optional) origalpha is the FOF's original alpha before crumbling (the thinker for respawning + floating crumbling FOFs tinkers with the alpha for some reason). Defaults to rover.alpha
    • (optional) crumblereturn? will the FOF respawn afterwards? Defaults to false (NOTE: probably should be set to not (rover.flags & FF_NORETURN) for best results currently, kind of weird otherwise)
    • the return value of EV_StartCrumble means something I forget offhand now ...it's either true or false though, mind

Damage control + Match rebalancing

Changes from damage-control:

  • player->health (formerly the "HUD copy" of player->mo->health) is now player->rings, and is also now the player's actual ring count.
  • player->mo->health (formerly rings + 1) is now always 1 when alive, regardless of ring count; if player with rings is damaged, this is untouched.
  • P_RingDamage now includes ring spilling code.
  • P_ShieldDamage now has a damagetype argument, allowing me to remove the last MT_NULL hack left in from the pre-damagetype days that I forgot about.
  • The old "switch-to-seestate" enemy damaging behavior in P_DamageMobj has been removed. This was a Doom left-over and doesn't really affect SRB2's enemies anyway - see, Doom enemies had a random chance of using seestate or painstate, SRB2 enemies always use painstate.
  • Other minor efforts to reorganise damaging code and have it make more sense, but otherwise nothing that should affect gameplay in general.

Changes from match-rebalancing:

  • New weapon/ammo dropping behavior: if you have the weapon panel + ammo, you drop the panel (but not the ammo); if you don't, you just drop the ammo.
  • New Match ammo consumption: Weapon rings can now be fired with no rings at double the ammo cost.
  • New emerald behaviour: collecting all 7 emeralds no longer turns you super (read: Match super is dead now) but instead steal points from enemies and gives you and teammates invincibility + sneakers
  • Tails ringslinger buff: Any character with CA_FLY will now throw rings 1.5x as fast.
Clone repository
  • Feedback on issues and merge requests
  • How to describe issues
  • Internal documentation dump
  • Home
  • Modern opengl overhaul
  • Changelogs
    • 2.2.1
    • 2.2.2
    • 2.2.3
    • 2.2.4
    • 2.2.5
    • 2.2.6
    • 2.2.7
    • 2.2.8
    • 2.2.9
  • Internal-documentation-dump
    • New title screen features
More Pages
×

New Wiki Page

Tip: You can specify the full path for the new file. We will automatically create any missing directories.