void MessageHandlerC::HandleMessages() { while(MessageQueue.empty() != true) { //0: Kill //1: Spawn //2: Focus Message message = MessageQueue.front(); //the kill command if (message.command == 0) { KillActor(message.ref); } //An impromptu spawn command I guess else if (message.command == 1) { SpawnActor(message.hexCoords); } //now get rid of the message MessageQueue.pop(); } }
AActor* UWorld::SpawnActor( UClass* Class, FVector const* Location, FRotator const* Rotation, const FActorSpawnParameters& SpawnParameters ) { FTransform Transform; if (Location) { Transform.SetLocation(*Location); } if (Rotation) { Transform.SetRotation(FQuat(*Rotation)); } return SpawnActor(Class, &Transform, SpawnParameters); }
/* ----------------------------------------------------------------------------- Function: Parameters: Returns: Notes: ----------------------------------------------------------------------------- */ PUBLIC void SpawnBoss( enemy_t which, int x, int y ) { entity_t *self; dir4type face; switch( which ) { case en_boss: case en_schabbs: case en_fat: case en_hitler: face = dir4_south; break; case en_fake: case en_gretel: case en_gift: face = dir4_north; break; case en_trans: case en_uber: case en_will: case en_death: case en_angel: case en_spectre: face = dir4_nodir; break; default: face = dir4_nodir; break; } self = SpawnActor( which, x, y, face, r_world ); if( ! self ) { return; } self->state = which == en_spectre ? st_path1 : st_stand; self->speed = SPDPATROL; self->health = starthitpoints[ (int)skill->value ][ which ]; self->ticcount = objstate[ which ][ st_stand ].timeout ? US_RndT() % objstate[ which ][ st_stand ].timeout + 1 : 0; self->flags |= FL_SHOOTABLE | FL_AMBUSH; levelstate.total_monsters++; }
/* ----------------------------------------------------------------------------- Function: Parameters: Returns: Notes: ----------------------------------------------------------------------------- */ PUBLIC void SpawnDeadGuard( enemy_t which, int x, int y ) { entity_t *self; self = SpawnActor( which, x, y, dir4_nodir, r_world ); if( ! self ) { return; } self->state = st_dead; self->speed = 0; self->health = 0; self->ticcount = objstate[ which ][ st_dead ].timeout ? US_RndT() % objstate[ which ][ st_dead ].timeout + 1 : 0; }
/* ----------------------------------------------------------------------------- Function: Parameters: Returns: Notes: ----------------------------------------------------------------------------- */ void SpawnBJVictory( void ) { entity_t *bj; bj = SpawnActor( en_bj, POS2TILE(Player.position.origin[0]), POS2TILE(Player.position.origin[1]), dir4_north, r_world ); if( ! bj ) { return; } bj->x = Player.position.origin[ 0 ]; bj->y = Player.position.origin[ 1 ]; bj->state = st_path1; bj->speed = BJRUNSPEED; bj->flags = FL_NONMARK; // FL_NEVERMARK; bj->temp2 = 6; }
/* ----------------------------------------------------------------------------- Function: Parameters: Returns: Notes: ----------------------------------------------------------------------------- */ PUBLIC void SpawnGhosts( enemy_t which, int x, int y ) { entity_t *self; self = SpawnActor( which, x, y, dir4_nodir, r_world ); if( ! self ) { return; } self->state = st_chase1; self->speed = SPDPATROL * 3; self->health = starthitpoints[ (int)skill->value ][ which ]; self->ticcount = objstate[ which ][ st_chase1 ].timeout ? US_RndT() % objstate[ which ][ st_chase1 ].timeout + 1: 0; self->flags |= FL_AMBUSH; levelstate.total_monsters++; }
/* ----------------------------------------------------------------------------- Function: Parameters: Returns: Notes: ----------------------------------------------------------------------------- */ PUBLIC void SpawnPatrol( enemy_t which, int x, int y, int dir ) { entity_t *self; self = SpawnActor( which, x, y, dir, r_world ); if( ! self ) { return; } self->state = st_path1; self->speed = (which == en_dog) ? SPDDOG : SPDPATROL; self->distance = TILEGLOBAL; self->ticcount = objstate[ which ][ st_path1 ].timeout ? US_RndT() % objstate[ which ][ st_path1 ].timeout + 1 : 0; self->flags |= FL_SHOOTABLE; levelstate.total_monsters++; }
/* ----------------------------------------------------------------------------- Function: Parameters: Returns: Notes: ----------------------------------------------------------------------------- */ PUBLIC void SpawnStand( enemy_t which, int x, int y, int dir, LevelData_t *lvl ) { entity_t *self; self = SpawnActor( which, x, y, dir, r_world ); if( ! self ) { return; } self->state = st_stand; self->speed = SPDPATROL; self->ticcount = objstate[ which ][ st_stand ].timeout ? US_RndT() % objstate[ which ][ st_stand ].timeout + 1 : 0; self->flags |= FL_SHOOTABLE; if( lvl->tilemap[ x ][ y ] & AMBUSH_TILE ) { self->flags |= FL_AMBUSH; } levelstate.total_monsters++; }