📄 wl_act2.c
字号:
ob->flags &= ~FL_ATTACKMODE;
ob->dir = nodir;
NewState (ob,&s_spectrewait1);
}
#endif
/*
=============================================================================
SCHABBS / GIFT / FAT
=============================================================================
*/
#ifndef SPEAR
/*
===============
=
= SpawnGhosts
=
===============
*/
void SpawnGhosts (int which, int tilex, int tiley)
{
unsigned far *map,tile;
switch(which)
{
case en_blinky:
SpawnNewObj (tilex,tiley,&s_blinkychase1);
break;
case en_clyde:
SpawnNewObj (tilex,tiley,&s_clydechase1);
break;
case en_pinky:
SpawnNewObj (tilex,tiley,&s_pinkychase1);
break;
case en_inky:
SpawnNewObj (tilex,tiley,&s_inkychase1);
break;
}
new->obclass = ghostobj;
new->speed = SPDDOG;
new->dir = east;
new->flags |= FL_AMBUSH;
if (!loadedgame)
gamestate.killtotal++;
}
void T_Gift (objtype *ob);
void T_GiftThrow (objtype *ob);
void T_Fat (objtype *ob);
void T_FatThrow (objtype *ob);
//
// schabb
//
extern statetype s_schabbstand;
extern statetype s_schabbchase1;
extern statetype s_schabbchase1s;
extern statetype s_schabbchase2;
extern statetype s_schabbchase3;
extern statetype s_schabbchase3s;
extern statetype s_schabbchase4;
extern statetype s_schabbdie1;
extern statetype s_schabbdie2;
extern statetype s_schabbdie3;
extern statetype s_schabbdie4;
extern statetype s_schabbdie5;
extern statetype s_schabbdie6;
extern statetype s_schabbshoot1;
extern statetype s_schabbshoot2;
extern statetype s_needle1;
extern statetype s_needle2;
extern statetype s_needle3;
extern statetype s_needle4;
extern statetype s_schabbdeathcam;
statetype s_schabbstand = {false,SPR_SCHABB_W1,0,T_Stand,NULL,&s_schabbstand};
statetype s_schabbchase1 = {false,SPR_SCHABB_W1,10,T_Schabb,NULL,&s_schabbchase1s};
statetype s_schabbchase1s = {false,SPR_SCHABB_W1,3,NULL,NULL,&s_schabbchase2};
statetype s_schabbchase2 = {false,SPR_SCHABB_W2,8,T_Schabb,NULL,&s_schabbchase3};
statetype s_schabbchase3 = {false,SPR_SCHABB_W3,10,T_Schabb,NULL,&s_schabbchase3s};
statetype s_schabbchase3s = {false,SPR_SCHABB_W3,3,NULL,NULL,&s_schabbchase4};
statetype s_schabbchase4 = {false,SPR_SCHABB_W4,8,T_Schabb,NULL,&s_schabbchase1};
statetype s_schabbdeathcam = {false,SPR_SCHABB_W1,1,NULL,NULL,&s_schabbdie1};
statetype s_schabbdie1 = {false,SPR_SCHABB_W1,10,NULL,A_DeathScream,&s_schabbdie2};
statetype s_schabbdie2 = {false,SPR_SCHABB_W1,10,NULL,NULL,&s_schabbdie3};
statetype s_schabbdie3 = {false,SPR_SCHABB_DIE1,10,NULL,NULL,&s_schabbdie4};
statetype s_schabbdie4 = {false,SPR_SCHABB_DIE2,10,NULL,NULL,&s_schabbdie5};
statetype s_schabbdie5 = {false,SPR_SCHABB_DIE3,10,NULL,NULL,&s_schabbdie6};
statetype s_schabbdie6 = {false,SPR_SCHABB_DEAD,20,NULL,A_StartDeathCam,&s_schabbdie6};
statetype s_schabbshoot1 = {false,SPR_SCHABB_SHOOT1,30,NULL,NULL,&s_schabbshoot2};
statetype s_schabbshoot2 = {false,SPR_SCHABB_SHOOT2,10,NULL,T_SchabbThrow,&s_schabbchase1};
statetype s_needle1 = {false,SPR_HYPO1,6,T_Projectile,NULL,&s_needle2};
statetype s_needle2 = {false,SPR_HYPO2,6,T_Projectile,NULL,&s_needle3};
statetype s_needle3 = {false,SPR_HYPO3,6,T_Projectile,NULL,&s_needle4};
statetype s_needle4 = {false,SPR_HYPO4,6,T_Projectile,NULL,&s_needle1};
//
// gift
//
extern statetype s_giftstand;
extern statetype s_giftchase1;
extern statetype s_giftchase1s;
extern statetype s_giftchase2;
extern statetype s_giftchase3;
extern statetype s_giftchase3s;
extern statetype s_giftchase4;
extern statetype s_giftdie1;
extern statetype s_giftdie2;
extern statetype s_giftdie3;
extern statetype s_giftdie4;
extern statetype s_giftdie5;
extern statetype s_giftdie6;
extern statetype s_giftshoot1;
extern statetype s_giftshoot2;
extern statetype s_needle1;
extern statetype s_needle2;
extern statetype s_needle3;
extern statetype s_needle4;
extern statetype s_giftdeathcam;
extern statetype s_boom1;
extern statetype s_boom2;
extern statetype s_boom3;
statetype s_giftstand = {false,SPR_GIFT_W1,0,T_Stand,NULL,&s_giftstand};
statetype s_giftchase1 = {false,SPR_GIFT_W1,10,T_Gift,NULL,&s_giftchase1s};
statetype s_giftchase1s = {false,SPR_GIFT_W1,3,NULL,NULL,&s_giftchase2};
statetype s_giftchase2 = {false,SPR_GIFT_W2,8,T_Gift,NULL,&s_giftchase3};
statetype s_giftchase3 = {false,SPR_GIFT_W3,10,T_Gift,NULL,&s_giftchase3s};
statetype s_giftchase3s = {false,SPR_GIFT_W3,3,NULL,NULL,&s_giftchase4};
statetype s_giftchase4 = {false,SPR_GIFT_W4,8,T_Gift,NULL,&s_giftchase1};
statetype s_giftdeathcam = {false,SPR_GIFT_W1,1,NULL,NULL,&s_giftdie1};
statetype s_giftdie1 = {false,SPR_GIFT_W1,1,NULL,A_DeathScream,&s_giftdie2};
statetype s_giftdie2 = {false,SPR_GIFT_W1,10,NULL,NULL,&s_giftdie3};
statetype s_giftdie3 = {false,SPR_GIFT_DIE1,10,NULL,NULL,&s_giftdie4};
statetype s_giftdie4 = {false,SPR_GIFT_DIE2,10,NULL,NULL,&s_giftdie5};
statetype s_giftdie5 = {false,SPR_GIFT_DIE3,10,NULL,NULL,&s_giftdie6};
statetype s_giftdie6 = {false,SPR_GIFT_DEAD,20,NULL,A_StartDeathCam,&s_giftdie6};
statetype s_giftshoot1 = {false,SPR_GIFT_SHOOT1,30,NULL,NULL,&s_giftshoot2};
statetype s_giftshoot2 = {false,SPR_GIFT_SHOOT2,10,NULL,T_GiftThrow,&s_giftchase1};
//
// fat
//
extern statetype s_fatstand;
extern statetype s_fatchase1;
extern statetype s_fatchase1s;
extern statetype s_fatchase2;
extern statetype s_fatchase3;
extern statetype s_fatchase3s;
extern statetype s_fatchase4;
extern statetype s_fatdie1;
extern statetype s_fatdie2;
extern statetype s_fatdie3;
extern statetype s_fatdie4;
extern statetype s_fatdie5;
extern statetype s_fatdie6;
extern statetype s_fatshoot1;
extern statetype s_fatshoot2;
extern statetype s_fatshoot3;
extern statetype s_fatshoot4;
extern statetype s_fatshoot5;
extern statetype s_fatshoot6;
extern statetype s_needle1;
extern statetype s_needle2;
extern statetype s_needle3;
extern statetype s_needle4;
extern statetype s_fatdeathcam;
statetype s_fatstand = {false,SPR_FAT_W1,0,T_Stand,NULL,&s_fatstand};
statetype s_fatchase1 = {false,SPR_FAT_W1,10,T_Fat,NULL,&s_fatchase1s};
statetype s_fatchase1s = {false,SPR_FAT_W1,3,NULL,NULL,&s_fatchase2};
statetype s_fatchase2 = {false,SPR_FAT_W2,8,T_Fat,NULL,&s_fatchase3};
statetype s_fatchase3 = {false,SPR_FAT_W3,10,T_Fat,NULL,&s_fatchase3s};
statetype s_fatchase3s = {false,SPR_FAT_W3,3,NULL,NULL,&s_fatchase4};
statetype s_fatchase4 = {false,SPR_FAT_W4,8,T_Fat,NULL,&s_fatchase1};
statetype s_fatdeathcam = {false,SPR_FAT_W1,1,NULL,NULL,&s_fatdie1};
statetype s_fatdie1 = {false,SPR_FAT_W1,1,NULL,A_DeathScream,&s_fatdie2};
statetype s_fatdie2 = {false,SPR_FAT_W1,10,NULL,NULL,&s_fatdie3};
statetype s_fatdie3 = {false,SPR_FAT_DIE1,10,NULL,NULL,&s_fatdie4};
statetype s_fatdie4 = {false,SPR_FAT_DIE2,10,NULL,NULL,&s_fatdie5};
statetype s_fatdie5 = {false,SPR_FAT_DIE3,10,NULL,NULL,&s_fatdie6};
statetype s_fatdie6 = {false,SPR_FAT_DEAD,20,NULL,A_StartDeathCam,&s_fatdie6};
statetype s_fatshoot1 = {false,SPR_FAT_SHOOT1,30,NULL,NULL,&s_fatshoot2};
statetype s_fatshoot2 = {false,SPR_FAT_SHOOT2,10,NULL,T_GiftThrow,&s_fatshoot3};
statetype s_fatshoot3 = {false,SPR_FAT_SHOOT3,10,NULL,T_Shoot,&s_fatshoot4};
statetype s_fatshoot4 = {false,SPR_FAT_SHOOT4,10,NULL,T_Shoot,&s_fatshoot5};
statetype s_fatshoot5 = {false,SPR_FAT_SHOOT3,10,NULL,T_Shoot,&s_fatshoot6};
statetype s_fatshoot6 = {false,SPR_FAT_SHOOT4,10,NULL,T_Shoot,&s_fatchase1};
/*
===============
=
= SpawnSchabbs
=
===============
*/
void SpawnSchabbs (int tilex, int tiley)
{
unsigned far *map,tile;
if (DigiMode != sds_Off)
s_schabbdie2.tictime = 140;
else
s_schabbdie2.tictime = 5;
SpawnNewObj (tilex,tiley,&s_schabbstand);
new->speed = SPDPATROL;
new->obclass = schabbobj;
new->hitpoints = starthitpoints[gamestate.difficulty][en_schabbs];
new->dir = south;
new->flags |= FL_SHOOTABLE|FL_AMBUSH;
if (!loadedgame)
gamestate.killtotal++;
}
/*
===============
=
= SpawnGift
=
===============
*/
void SpawnGift (int tilex, int tiley)
{
unsigned far *map,tile;
if (DigiMode != sds_Off)
s_giftdie2.tictime = 140;
else
s_giftdie2.tictime = 5;
SpawnNewObj (tilex,tiley,&s_giftstand);
new->speed = SPDPATROL;
new->obclass = giftobj;
new->hitpoints = starthitpoints[gamestate.difficulty][en_gift];
new->dir = north;
new->flags |= FL_SHOOTABLE|FL_AMBUSH;
if (!loadedgame)
gamestate.killtotal++;
}
/*
===============
=
= SpawnFat
=
===============
*/
void SpawnFat (int tilex, int tiley)
{
unsigned far *map,tile;
if (DigiMode != sds_Off)
s_fatdie2.tictime = 140;
else
s_fatdie2.tictime = 5;
SpawnNewObj (tilex,tiley,&s_fatstand);
new->speed = SPDPATROL;
new->obclass = fatobj;
new->hitpoints = starthitpoints[gamestate.difficulty][en_fat];
new->dir = south;
new->flags |= FL_SHOOTABLE|FL_AMBUSH;
if (!loadedgame)
gamestate.killtotal++;
}
/*
=================
=
= T_SchabbThrow
=
=================
*/
void T_SchabbThrow (objtype *ob)
{
long deltax,deltay;
float angle;
int iangle;
deltax = player->x - ob->x;
deltay = ob->y - player->y;
angle = atan2 (deltay,deltax);
if (angle<0)
angle = M_PI*2+angle;
iangle = angle/(M_PI*2)*ANGLES;
GetNewActor ();
new->state = &s_needle1;
new->ticcount = 1;
new->tilex = ob->tilex;
new->tiley = ob->tiley;
new->x = ob->x;
new->y = ob->y;
new->obclass = needleobj;
new->dir = nodir;
new->angle = iangle;
new->speed = 0x2000l;
new->flags = FL_NONMARK;
new->active = true;
PlaySoundLocActor (SCHABBSTHROWSND,new);
}
/*
=================
=
= T_GiftThrow
=
=================
*/
void T_GiftThrow (objtype *ob)
{
long deltax,deltay;
float angle;
int iangle;
deltax = player->x - ob->x;
deltay = ob->y - player->y;
angle = atan2 (deltay,deltax);
if (angle<0)
angle = M_PI*2+angle;
iangle = angle/(M_PI*2)*ANGLES;
GetNewActor ();
new->state = &s_rocket;
new->ticcount = 1;
new->tilex = ob->tilex;
new->tiley = ob->tiley;
new->x = ob->x;
new->y = ob->y;
new->obclass = rocketobj;
new->dir = nodir;
new->angle = iangle;
new->speed = 0x2000l;
new->flags = FL_NONMARK;
new->active = true;
PlaySoundLocActor (MISSILEFIRESND,new);
}
/*
=================
=
= T_Schabb
=
=================
*/
void T_Schabb (objtype *ob)
{
long move;
int dx,dy,dist;
boolean dodge;
dodge = false;
dx = abs(ob->tilex - player->tilex);
dy = abs(ob->tiley - player->tiley);
dist = dx>dy ? dx : dy;
if (CheckLine(ob)) // got a shot at player?
{
if ( US_RndT() < (tics<<3) )
{
//
// go into attack frame
//
NewState (ob,&s_schabbshoot1);
return;
}
dodge = true;
}
if (ob->dir == nodir)
{
if (dodge)
SelectDodgeDir (ob);
else
SelectChaseDir (ob);
if (ob->dir == nodir)
return; // object is blocked in
}
move = ob->speed*tics;
while (move)
{
if (ob->distance < 0)
{
//
// waiting for a door to open
//
OpenDoor (-ob->distance-1);
if (doorobjlist[-ob->distance-1].action != dr_open)
return;
ob->distance = TILEGLOBAL; // go ahead, the door is now opoen
}
if (move < ob->distance)
{
MoveObj (ob,move);
break;
}
//
// reached goal tile, so select another one
//
//
// fix position to account for round off during moving
//
ob->x = ((long)ob->tilex<<TILESHIFT)+TILEGLOBAL/2;
ob->y = ((long)ob->tiley<<TILESHIFT)+TILEGLOBAL/2;
move -= ob->distance;
if (dist <4)
SelectRunDir (ob);
else if (dodge)
SelectDodgeDir (ob);
else
SelectChaseDir (ob);
if (ob->dir == nodir)
return; // object is blocked in
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -