Here's how I got it to work.
1) In wl_act2.cpp, around line 450, inside the GUARD section, underneath the guard externs and statetypes:
//
// ghosts
//
extern statetype s_blinkywait1;
extern statetype s_blinkychase1;
extern statetype s_blinkychase2;
extern statetype s_blinkychase3;
extern statetype s_blinkychase4;
extern statetype s_blinkydie1;
extern statetype s_blinkydie2;
extern statetype s_blinkydie3;
extern statetype s_blinkydie4;
statetype s_blinkywait1 = {false,SPR_BLINKY_W1,0,(statefunc)T_Stand,NULL,&s_blinkywait1};
statetype s_blinkychase1 = {false,SPR_BLINKY_W1,10,(statefunc)T_Ghosts,NULL,&s_blinkychase2};
statetype s_blinkychase2 = {false,SPR_BLINKY_W2,10,(statefunc)T_Ghosts,NULL,&s_blinkychase3};
statetype s_blinkychase3 = {false,SPR_PINKY_W1,10,(statefunc)T_Ghosts,NULL,&s_blinkychase4};
statetype s_blinkychase4 = {false,SPR_PINKY_W2,10,(statefunc)T_Ghosts,NULL,&s_blinkychase1};
statetype s_blinkydie1 = {false,SPR_INKY_W1,10,NULL,NULL,&s_blinkydie2};
statetype s_blinkydie2 = {false,SPR_INKY_W2,10,NULL,NULL,&s_blinkydie3};
statetype s_blinkydie3 = {false,SPR_CLYDE_W1,10,NULL,NULL,&s_blinkydie4};
statetype s_blinkydie4 = {false,SPR_CLYDE_W2,10,NULL,NULL,&s_blinkydie4};
#endif
2) In wl_Act2, Around line 2004, inside the SCHABBS / GIFT / FAT section. There's an #indef SPEAR at the beginning. Immediately following:
/*
===============
=
= SpawnGhosts
=
===============
*/
#indef SPEAR
void SpawnGhosts (int which, int tilex, int tiley)
{
SpawnNewObj (tilex,tiley,&s_blinkywait1);
newobj->obclass = ghostobj;
newobj->speed = SPDDOG;
newobj->dir = nodir;
newobj->hitpoints = starthitpoints[gamestate.difficulty][en_blinky];
newobj->flags |= FL_SHOOTABLE; //change to |= FL_SHOOTABLE|FL_AMBUSH; if you want ghost to initiate attack only on sight
if (!loadedgame)
gamestate.killtotal++;
}
3) In wl_def.h, around line 1253, insert this inside WL_ACT2 DEFINITIONS. I put it underneath s_grddie1:
extern statetype s_blinkydie1;
3.b) Also, place this in a slightly lower section. I chose to put it above s_hitlerchase1:
extern statetype s_blinkychase1;
4) In wl_state.cpp, insert this inside KILLACTOR Section. I put it directly underneath case_dogobj;
case ghostobj:
GivePoints (1000);
NewState (ob,&s_blinkydie1);
break;
5) In wl_state.cpp, insert this in First Sighting section. I put it directly underneath case_realhitlerobj;
case ghostobj:
PlaySoundLocActor(SCHABBSHASND,ob);
NewState (ob,&s_blinkychase1);
ob->speed *=2; // go faster when chasing player
break;
6) In wl_state.cpp, insert this in Sight Player section. I put it directly above case_bossobj;
case ghostobj:
This should be it.
I'm getting an error message if I try to incorporate a death sound, so I can work out the kinks of that later. Note that this is my flavor for a pac-man ghost enemy. I like to have him wait until he hears me to attack. Pac-Man actually charges after you once the game begins. If you want to have this, for step 2, change
SpawnNewObj (tilex,tiley,&s_blinkywait1);
into
SpawnNewObj (tilex,tiley,&s_blinkychase1);
Also, I prefer
newobj->speed = SPDDOG;
if this is too fast, you can change to
newobj->speed = SPDPATROL;
and then, if you want to adjust from there, change, in STEP 5, the number 2 to a different number.
ob->speed *=2; // go faster when chasing player
Hope I helped! I'll tidy up this post later. I'm off to work.