int KillBreakSprite(short BreakSprite) { SPRITEp bp = &sprite[BreakSprite]; USERp bu = User[BreakSprite]; short i; // Does not actually kill the sprite so it will be valid for the rest // of the loop traversal. // IMPORTANT: Do not change the statnum if possible so that NEXTI in // SpriteControl loop traversals will maintain integrity. SpriteQueueDelete(BreakSprite); if (bu) { if (bp->statnum == STAT_DEFAULT) // special case allow kill of sprites on STAT_DEFAULT list // a few things have users and are not StateControlled KillSprite(BreakSprite); else SetSuicide(BreakSprite); } else { change_sprite_stat(BreakSprite, STAT_SUICIDE); } return(0); }
///////////////////////////////////////////////////// // Initialize any of my special use sprites ///////////////////////////////////////////////////// void JS_SpriteSetup( void ) { SPRITEp sp; short SpriteNum = 0, NextSprite, ndx; USERp u; short i, num; TRAVERSE_SPRITE_STAT(headspritestat[0], SpriteNum, NextSprite) { short tag; short bit; sp = &sprite[SpriteNum]; tag = sp->hitag; switch (sprite[SpriteNum].picnum) { case ST1: if (tag == MIRROR_CAM) { // Just change it to static, sprite has all the info I need change_sprite_stat(SpriteNum, STAT_ST1); }else if (tag == MIRROR_SPAWNSPOT) { // Just change it to static, sprite has all the info I need change_sprite_stat(SpriteNum, STAT_ST1); }else if (tag == AMBIENT_SOUND) { change_sprite_stat(SpriteNum, STAT_ST1); PlaySound(sp->lotag,&sp->x,&sp->y,&sp->z,v3df_ambient); } break; } }
VOID EnemyDefaults(short SpriteNum, ACTOR_ACTION_SETp action, PERSONALITYp person) { USERp u = User[SpriteNum]; SPRITEp sp = &sprite[SpriteNum]; unsigned int wpn; short wpn_cnt; short depth = 0; extern short TotalKillable; extern BOOL DebugSecret; switch(u->ID) { case PACHINKO1: case PACHINKO2: case PACHINKO3: case PACHINKO4: case 623: case TOILETGIRL_R0: case WASHGIRL_R0: case CARGIRL_R0: case MECHANICGIRL_R0: case SAILORGIRL_R0: case PRUNEGIRL_R0: case TRASHCAN: case BUNNY_RUN_R0: break; default: { TotalKillable++; #if DEBUG if (DebugSecret) { sprintf(ds,"COUNTED: spnum %d, pic %d, x %d, y %d",SpriteNum,sp->picnum,sp->x,sp->y); DebugWriteString(ds); } #endif } break; } RESET(sp->cstat, CSTAT_SPRITE_RESTORE); u->spal = sp->pal; u->RotNum = 5; sp->clipdist = (256) >> 2; u->zclip = Z(48); u->lo_step = Z(32); u->floor_dist = u->zclip - u->lo_step; u->ceiling_dist = SPRITEp_SIZE_Z(sp) - u->zclip; u->Radius = 400; u->MaxHealth = u->Health; u->PainThreshold = DIV16(u->Health) - 1; //u->PainThreshold = DIV4(u->Health) - 1; SET(sp->cstat,CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); SET(sp->extra,SPRX_PLAYER_OR_ENEMY); sprite[SpriteNum].picnum = u->State->Pic; change_sprite_stat(SpriteNum, STAT_ENEMY); u->Personality = person; u->ActorActionSet = action; DoActorZrange(SpriteNum); //KeepActorOnFloor(SpriteNum); // for swimming actors // make sure we start in the water if thats where we are if (u->lo_sectp)// && SectUser[u->lo_sectp - sector]) { short i,nexti; short sectnum = u->lo_sectp - sector; if (SectUser[sectnum] && TEST(u->lo_sectp->extra, SECTFX_SINK)) { depth = SectUser[sectnum]->depth; } else { TRAVERSE_SPRITE_SECT(headspritesect[sectnum],i,nexti) { SPRITEp np = &sprite[i]; if (np->picnum == ST1 && np->hitag == SECT_SINK) { depth = np->lotag; } } }
///////////////////////////////////////////////////// // Initialize any of my special use sprites ///////////////////////////////////////////////////// void JS_SpriteSetup(void) { SPRITEp sp; short SpriteNum = 0, NextSprite, ndx; USERp u; short i, num; int handle; TRAVERSE_SPRITE_STAT(headspritestat[0], SpriteNum, NextSprite) { short tag; short bit; sp = &sprite[SpriteNum]; tag = sp->hitag; // Non static camera. Camera sprite will be drawn! if (tag == MIRROR_CAM && sprite[SpriteNum].picnum != ST1) { // Just change it to static, sprite has all the info I need // u = SpawnUser(SpriteNum, sp->picnum, NULL); // RESET(sp->cstat, CSTAT_SPRITE_BLOCK); // SET(sp->cstat, CSTAT_SPRITE_BLOCK_HITSCAN); change_sprite_stat(SpriteNum, STAT_SPAWN_SPOT); } switch (sprite[SpriteNum].picnum) { case ST1: if (tag == MIRROR_CAM) { // Just change it to static, sprite has all the info I need // ST1 cameras won't move with SOBJ's! change_sprite_stat(SpriteNum, STAT_ST1); } else if (tag == MIRROR_SPAWNSPOT) { // Just change it to static, sprite has all the info I need change_sprite_stat(SpriteNum, STAT_ST1); } else if (tag == AMBIENT_SOUND) { change_sprite_stat(SpriteNum, STAT_AMBIENT); // PlaySound(sp->lotag, &sp->x, &sp->y, &sp->z, v3df_ambient // | v3df_init | v3df_doppler); } else if (tag == TAG_ECHO_SOUND) { change_sprite_stat(SpriteNum, STAT_ECHO); } else if (tag == TAG_DRIPGEN) { ANIMATOR GenerateDrips; u = SpawnUser(SpriteNum, 0, NULL); ASSERT(u != NULL); u->RotNum = 0; u->WaitTics = sp->lotag * 120; u->ActorActionFunc = GenerateDrips; change_sprite_stat(SpriteNum, STAT_NO_STATE); SET(sp->cstat, CSTAT_SPRITE_INVISIBLE); } break; // Sprites in editart that should play ambient sounds // automatically case 380: case 396: case 430: case 443: case 512: case 521: case 541: case 2720: case 3143: case 3157: handle = PlaySound(DIGI_FIRE1, &sp->x, &sp->y, &sp->z, v3df_follow|v3df_dontpan|v3df_doppler); if (handle != -1) Set3DSoundOwner(SpriteNum); break; case 795: case 880: handle = PlaySound(DIGI_WATERFLOW1, &sp->x, &sp->y, &sp->z, v3df_follow|v3df_dontpan|v3df_doppler); if (handle != -1) Set3DSoundOwner(SpriteNum); break; case 460: // Wind Chimes handle = PlaySound(79, &sp->x, &sp->y, &sp->z, v3df_ambient | v3df_init | v3df_doppler | v3df_follow); if (handle != -1) Set3DSoundOwner(SpriteNum); break; } }