Gez
Why don't I have a custom title by now?!
Posts: 9148
Registered: 07-07 |
Perfectly valid nevertheless.
This is the code for the cacodemon's states in Doom's source code:
code:
{SPR_SARG,0,10,{A_Look},S_SARG_STND2,0,0}, // S_SARG_STND
{SPR_SARG,1,10,{A_Look},S_SARG_STND,0,0}, // S_SARG_STND2
{SPR_SARG,0,2,{A_Chase},S_SARG_RUN2,0,0}, // S_SARG_RUN1
{SPR_SARG,0,2,{A_Chase},S_SARG_RUN3,0,0}, // S_SARG_RUN2
{SPR_SARG,1,2,{A_Chase},S_SARG_RUN4,0,0}, // S_SARG_RUN3
{SPR_SARG,1,2,{A_Chase},S_SARG_RUN5,0,0}, // S_SARG_RUN4
{SPR_SARG,2,2,{A_Chase},S_SARG_RUN6,0,0}, // S_SARG_RUN5
{SPR_SARG,2,2,{A_Chase},S_SARG_RUN7,0,0}, // S_SARG_RUN6
{SPR_SARG,3,2,{A_Chase},S_SARG_RUN8,0,0}, // S_SARG_RUN7
{SPR_SARG,3,2,{A_Chase},S_SARG_RUN1,0,0}, // S_SARG_RUN8
{SPR_SARG,4,8,{A_FaceTarget},S_SARG_ATK2,0,0}, // S_SARG_ATK1
{SPR_SARG,5,8,{A_FaceTarget},S_SARG_ATK3,0,0}, // S_SARG_ATK2
{SPR_SARG,6,8,{A_SargAttack},S_SARG_RUN1,0,0}, // S_SARG_ATK3
{SPR_SARG,7,2,{NULL},S_SARG_PAIN2,0,0}, // S_SARG_PAIN
{SPR_SARG,7,2,{A_Pain},S_SARG_RUN1,0,0}, // S_SARG_PAIN2
{SPR_SARG,8,8,{NULL},S_SARG_DIE2,0,0}, // S_SARG_DIE1
{SPR_SARG,9,8,{A_Scream},S_SARG_DIE3,0,0}, // S_SARG_DIE2
{SPR_SARG,10,4,{NULL},S_SARG_DIE4,0,0}, // S_SARG_DIE3
{SPR_SARG,11,4,{A_Fall},S_SARG_DIE5,0,0}, // S_SARG_DIE4
{SPR_SARG,12,4,{NULL},S_SARG_DIE6,0,0}, // S_SARG_DIE5
{SPR_SARG,13,-1,{NULL},S_NULL,0,0}, // S_SARG_DIE6
{SPR_SARG,13,5,{NULL},S_SARG_RAISE2,0,0}, // S_SARG_RAISE1
{SPR_SARG,12,5,{NULL},S_SARG_RAISE3,0,0}, // S_SARG_RAISE2
{SPR_SARG,11,5,{NULL},S_SARG_RAISE4,0,0}, // S_SARG_RAISE3
{SPR_SARG,10,5,{NULL},S_SARG_RAISE5,0,0}, // S_SARG_RAISE4
{SPR_SARG,9,5,{NULL},S_SARG_RAISE6,0,0}, // S_SARG_RAISE5
{SPR_SARG,8,5,{NULL},S_SARG_RUN1,0,0}, // S_SARG_RAISE6
{ // MT_SERGEANT
3002, // doomednum
S_SARG_STND, // spawnstate
150, // spawnhealth
S_SARG_RUN1, // seestate
sfx_sgtsit, // seesound
8, // reactiontime
sfx_sgtatk, // attacksound
S_SARG_PAIN, // painstate
180, // painchance
sfx_dmpain, // painsound
S_SARG_ATK1, // meleestate
0, // missilestate
S_SARG_DIE1, // deathstate
S_NULL, // xdeathstate
sfx_sgtdth, // deathsound
10, // speed
30*FRACUNIT, // radius
56*FRACUNIT, // height
400, // mass
0, // damage
sfx_dmact, // activesound
MF_SOLID|MF_SHOOTABLE|MF_COUNTKILL, // flags
S_SARG_RAISE1 // raisestate
},
It's in two different places in the info.c, and you have to refer to the lower part (the mobj declaration) to see how the states are attached.
The same code on the ZDoom wiki:
code: ACTOR Demon 3002
{
Game Doom
SpawnID 8
Health 150
PainChance 180
Speed 10
Radius 30
Height 56
Mass 400
Monster
+FLOORCLIP +FASTER +FASTMELEE
SeeSound "demon/sight"
AttackSound "demon/melee"
PainSound "demon/pain"
DeathSound "demon/death"
ActiveSound "demon/active"
Obituary "$OB_DEMONHIT" // "%o was bit by a demon."
States
{
Spawn:
SARG AB 10 A_Look
Loop
See:
SARG AABBCCDD 2 A_Chase
Loop
Melee:
SARG EF 8 A_FaceTarget
SARG G 8 A_SargAttack
Goto See
Pain:
SARG H 2
SARG H 2 A_Pain
Goto See
Death:
SARG I 8
SARG J 8 A_Scream
SARG K 4
SARG L 4 A_NoBlocking
SARG M 4
SARG N -1
Stop
Raise:
SARG N 5
SARG MLKJI 5
Goto See
}
}
In addition, in ZDoom, everything is in the actor declaration. Those FASTER and FASTMELEE flags? In vanilla Doom, they don't exist, you have to grep through the source code for "MT_SERGEANT" to find out the parts that they refer to. The state table and mobj declarations are not enough, you also have to analyze common interaction functions to discover things such as why revenants prefer to punch you, or why archviles aren't retaliated against, etc.
Which one is the most legible, especially for a non-programmer?
Last edited by Gez on 05-26-12 at 18:41
|