From 8db52a03eb790f7d455c214b7461141c9c2ae5f5 Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Fri, 14 Mar 2003 21:24:03 +0000 Subject: [PATCH] formatting, minor cleanups --- ChangeLog | 3 + main/ai.c | 1025 +++++++++----- main/ai.h | 495 ++++--- main/bm.h | 66 +- main/crypt.c | 56 +- main/joydefs.h | 6 +- main/multi.c | 3637 ++++++++++++++++++++++++------------------------ 7 files changed, 2834 insertions(+), 2454 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0d98629f..fe14cba1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2003-03-14 Bradley Bell + * main/ai.c, main/ai.h, main/bm.h, main/crypt.c, main/joydefs.h, + main/multi.c: formatting, minor cleanups + * 2d/rle.c (rle_swap_0_255): need to swap line_size on bigendian machines diff --git a/main/ai.c b/main/ai.c index 70c1a355..eb82ae03 100644 --- a/main/ai.c +++ b/main/ai.c @@ -1,4 +1,4 @@ -/* $Id: ai.c,v 1.4 2002-08-06 05:21:33 btb Exp $ */ +/* $Id: ai.c,v 1.5 2003-03-14 21:24:03 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -12,12 +12,263 @@ AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ +/* + * + * Autonomous Individual movement. + * + * Old Log: + * Revision 1.1 1995/12/05 14:15:37 allender + * Initial revision + * + * Revision 1.10 1995/11/09 09:36:12 allender + * cheats not active during demo playback + * + * Revision 1.9 1995/11/03 12:51:55 allender + * shareware changes + * + * Revision 1.8 1995/10/31 10:25:07 allender + * shareware stuff + * + * Revision 1.7 1995/10/26 14:01:38 allender + * optimization for doing robot stuff only if anim angles done last frame + * + * Revision 1.6 1995/10/25 09:35:43 allender + * prototype some functions causing mcc problems + * + * Revision 1.5 1995/10/17 13:11:40 allender + * fix in ai code that makes bots only look for you every so often + * + * Revision 1.4 1995/10/10 11:48:10 allender + * PC ai code + * + * Revision 2.11 1995/07/09 11:15:48 john + * Put in Mike's code to fix bug where bosses don't gate in bots after + * 32767 seconds of playing. + * + * Revision 2.10 1995/06/15 12:31:08 john + * Fixed bug with cheats getting enabled when you type + * the whole alphabet. + * + * Revision 2.9 1995/05/26 16:16:18 john + * Split SATURN into define's for requiring cd, using cd, etc. + * Also started adding all the Rockwell stuff. + * + * Revision 2.8 1995/04/06 15:12:27 john + * Fixed bug with insane not working. + * + * Revision 2.7 1995/03/30 16:36:44 mike + * text localization. + * + * Revision 2.6 1995/03/28 11:22:24 john + * Added cheats to save file. Changed lunacy text. + * + * Revision 2.5 1995/03/27 16:45:07 john + * Fixed some cheat bugs. Added astral cheat. + * + * Revision 2.4 1995/03/24 15:29:17 mike + * add new cheats. + * + * Revision 2.3 1995/03/21 14:39:45 john + * Ifdef'd out the NETWORK code. + * + * Revision 2.2 1995/03/14 18:24:39 john + * Force Destination Saturn to use CD-ROM drive. + * + * Revision 2.1 1995/03/06 16:47:14 mike + * destination saturn + * + * Revision 2.0 1995/02/27 11:30:01 john + * New version 2.0, which has no anonymous unions, builds with + * Watcom 10.0, and doesn't require parsing BITMAPS.TBL. + * + * Revision 1.295 1995/02/22 13:23:04 allender + * remove anonymous unions from object structure + * + * Revision 1.294 1995/02/13 11:00:43 rob + * Make brain guys high enough to get an open slot. + * + * Revision 1.293 1995/02/13 10:31:55 mike + * Make brains understand they can't open locked doors. + * + * Revision 1.292 1995/02/13 10:18:01 rob + * Reduced brain guy's level of awareness to keep him from hogging slots. + * + * Revision 1.291 1995/02/11 12:27:12 mike + * fix path-to-exit cheat. + * + * Revision 1.290 1995/02/11 01:56:30 mike + * robots don't fire cheat. + * + * Revision 1.289 1995/02/10 17:15:09 rob + * Fixed some stuff with 64 awareness stuff. + * + * Revision 1.288 1995/02/10 16:31:32 mike + * oops. + * + * Revision 1.287 1995/02/10 16:24:45 mike + * fix the network follow path fix. + * + * Revision 1.286 1995/02/10 16:11:40 mike + * in serial or modem games, follow path guys don't move if far away and + * can't see player. + * + * Revision 1.285 1995/02/09 13:11:35 mike + * comment out a bunch of mprintfs. + * add toaster (drops prox bombs, runs away) to boss gate list. + * + * Revision 1.284 1995/02/08 22:44:53 rob + * Lowerd anger level for follow path of any sort. + * + * Revision 1.283 1995/02/08 22:30:43 mike + * lower awareness on station guys if they are returning home (multiplayer). + * + * Revision 1.282 1995/02/08 17:01:06 rob + * Fixed problem with toasters dropping of proximity bombs. + * + * Revision 1.281 1995/02/08 11:49:35 rob + * Reduce Green-guy attack awareness level so we don't let him attack us too. + * + * Revision 1.280 1995/02/08 11:37:52 mike + * Check for failures in call to obj_create. + * + * Revision 1.279 1995/02/07 20:38:46 mike + * fix toasters in multiplayer + * + * + * Revision 1.278 1995/02/07 16:51:07 mike + * fix sound time play bug. + * + * Revision 1.277 1995/02/06 22:33:04 mike + * make robots follow path better in cooperative/roboarchy. + * + * Revision 1.276 1995/02/06 18:15:42 rob + * Added forced sends for evasion movemnet. + * + * Revision 1.275 1995/02/06 16:41:22 rob + * Change some positioning calls. + * + * Revision 1.274 1995/02/06 11:40:33 mike + * replace some lint-related hacks with clean, proper code. + * + * Revision 1.273 1995/02/04 17:28:19 mike + * make station guys return better. + * + * Revision 1.272 1995/02/03 17:40:55 mike + * fix problem with robots falling asleep if you sit in game overnight, not in pause...bah. + * + * Revision 1.271 1995/02/02 21:11:25 rob + * Tweaking stuff for multiplayer ai. + * + * Revision 1.270 1995/02/02 17:32:06 john + * Added Hack for Assert that Mike put in after using Lint to find + * uninitialized variables. + * + * Revision 1.269 1995/02/02 16:46:31 mike + * fix boss gating. + * + * Revision 1.268 1995/02/02 16:27:29 mike + * make boss not put out infinite robots. + * + * Revision 1.267 1995/02/01 21:10:02 mike + * lint found bug! player_visibility not initialized! + * + * Revision 1.266 1995/02/01 20:51:27 john + * Lintized + * + * Revision 1.265 1995/02/01 17:14:05 mike + * fix robot sounds. + * + * Revision 1.264 1995/01/31 16:16:40 mike + * Comment out "Darn you, John" Int3(). + * + * Revision 1.263 1995/01/30 20:55:04 mike + * fix nonsense in robot firing when a player is cloaked. + * + * Revision 1.262 1995/01/30 17:15:10 rob + * Fixed problems with bigboss eclip messages. + * Tweaked robot position sending for modem purposes. + * + * Revision 1.261 1995/01/30 15:30:31 rob + * Prevent non-master players from gating in robots. + * + * Revision 1.260 1995/01/30 13:30:55 mike + * new cases for firing at other players were bogus, could send position + * without permission. + * + * Revision 1.259 1995/01/30 13:01:17 mike + * Make robots fire at player other than one they are controlled by sometimes. + * + * Revision 1.258 1995/01/29 16:09:17 rob + * Trying to get robots to shoot at non-controlling players. + * + * Revision 1.257 1995/01/29 13:47:05 mike + * Make boss have more fireballs on death, have until end (though silent at end). + * Fix bug which was preventing him from teleporting until hit, so he'd always + * be in the same place when the player enters the room. + * + * Revision 1.256 1995/01/28 17:40:18 mike + * make boss teleport & gate before you see him. + * + * Revision 1.255 1995/01/27 17:02:08 mike + * move code around, was sending one frame (or worse!) old robot information. + * + * Revision 1.254 1995/01/26 17:02:43 mike + * make fusion cannon have more chrome, make fusion, mega rock you! + * + * Revision 1.253 1995/01/26 15:11:17 rob + * Shutup! I fixed it! + * + * Revision 1.252 1995/01/26 15:08:55 rob + * Changed robot gating to accomodate multiplayer. + * + * Revision 1.251 1995/01/26 14:49:04 rob + * Increase awareness level for firing to 94. + * + * Revision 1.250 1995/01/26 12:41:20 mike + * fix bogus multiplayer code, would send permission without getting permission. + * + * Revision 1.249 1995/01/26 12:23:23 rob + * Removed defines that were moved to ai.h + * + * Revision 1.248 1995/01/25 23:38:48 mike + * modify list of robots gated in by super boss. + * + * Revision 1.247 1995/01/25 21:21:13 rob + * Trying to let robots fire at a player even if they're not in control. + * + * Revision 1.246 1995/01/25 13:50:37 mike + * Robots make angry sounds. + * + * Revision 1.245 1995/01/25 10:53:47 mike + * better handling of robots which poke out of mine and try to recover. + * + * Revision 1.244 1995/01/24 22:03:02 mike + * Tricky code to move a robot to a legal position if he is poking out of + * the mine, even if it means moving him to another segment. + * + * Revision 1.243 1995/01/24 20:12:06 rob + * Changed robot fire awareness level from 74 to 94. + * + * Revision 1.242 1995/01/24 13:22:32 mike + * make robots accelerate faster, and Difficulty_level dependent. + * + * Revision 1.241 1995/01/24 12:09:39 mike + * make robots animate in multiplayer. + * + * Revision 1.240 1995/01/21 21:21:10 mike + * Make boss only gate robots into specified segments. + * + * Revision 1.239 1995/01/20 20:21:26 mike + * prevent unnecessary boss cloaking. + * + */ + #ifdef HAVE_CONFIG_H #include #endif -char ai_rcsid[] = "$Id: ai.c,v 1.4 2002-08-06 05:21:33 btb Exp $"; +char ai_rcsid[] = "$Id: ai.c,v 1.5 2003-03-14 21:24:03 btb Exp $"; #include #include @@ -72,68 +323,68 @@ char ai_rcsid[] = "$Id: ai.c,v 1.4 2002-08-06 05:21:33 btb Exp $"; #include #endif -// ---------- John: These variables must be saved as part of gamesave. ---------- -int Ai_initialized = 0; -int Overall_agitation; -ai_local Ai_local_info[MAX_OBJECTS]; -point_seg Point_segs[MAX_POINT_SEGS]; -point_seg *Point_segs_free_ptr = Point_segs; -ai_cloak_info Ai_cloak_info[MAX_AI_CLOAK_INFO]; -fix Boss_cloak_start_time = 0; -fix Boss_cloak_end_time = 0; -fix Last_teleport_time = 0; -fix Boss_teleport_interval = F1_0*8; -fix Boss_cloak_interval = F1_0*10; // Time between cloaks -fix Boss_cloak_duration = BOSS_CLOAK_DURATION; -fix Last_gate_time = 0; -fix Gate_interval = F1_0*6; -fix Boss_dying_start_time; -fix Boss_hit_time; -byte Boss_dying, Boss_dying_sound_playing, unused123, unused234; +// ---------- John: These variables must be saved as part of gamesave. -------- +int Ai_initialized = 0; +int Overall_agitation; +ai_local Ai_local_info[MAX_OBJECTS]; +point_seg Point_segs[MAX_POINT_SEGS]; +point_seg *Point_segs_free_ptr = Point_segs; +ai_cloak_info Ai_cloak_info[MAX_AI_CLOAK_INFO]; +fix Boss_cloak_start_time = 0; +fix Boss_cloak_end_time = 0; +fix Last_teleport_time = 0; +fix Boss_teleport_interval = F1_0*8; +fix Boss_cloak_interval = F1_0*10; // Time between cloaks +fix Boss_cloak_duration = BOSS_CLOAK_DURATION; +fix Last_gate_time = 0; +fix Gate_interval = F1_0*6; +fix Boss_dying_start_time; +fix Boss_hit_time; +byte Boss_dying, Boss_dying_sound_playing, unused123, unused234; -// -- MK, 10/21/95, unused! -- int Boss_been_hit=0; +// -- MK, 10/21/95, unused! -- int Boss_been_hit=0; -// ---------- John: End of variables which must be saved as part of gamesave. ---------- +// ------ John: End of variables which must be saved as part of gamesave. ----- -// -- ubyte Boss_cloaks[NUM_D2_BOSSES] = {1,1,1,1,1,1}; // Set byte if this boss can cloak +// -- ubyte Boss_cloaks[NUM_D2_BOSSES] = {1,1,1,1,1,1}; // Set byte if this boss can cloak -ubyte Boss_teleports[NUM_D2_BOSSES] = {1,1,1,1,1,1, 1,1}; // Set byte if this boss can teleport -ubyte Boss_spew_more[NUM_D2_BOSSES] = {0,1,0,0,0,0, 0,0}; // If set, 50% of time, spew two bots. -ubyte Boss_spews_bots_energy[NUM_D2_BOSSES] = {1,1,0,1,0,1, 1,1}; // Set byte if boss spews bots when hit by energy weapon. -ubyte Boss_spews_bots_matter[NUM_D2_BOSSES] = {0,0,1,1,1,1, 0,1}; // Set byte if boss spews bots when hit by matter weapon. -ubyte Boss_invulnerable_energy[NUM_D2_BOSSES] = {0,0,1,1,0,0, 0,0}; // Set byte if boss is invulnerable to energy weapons. -ubyte Boss_invulnerable_matter[NUM_D2_BOSSES] = {0,0,0,0,1,1, 1,0}; // Set byte if boss is invulnerable to matter weapons. -ubyte Boss_invulnerable_spot[NUM_D2_BOSSES] = {0,0,0,0,0,1, 0,1}; // Set byte if boss is invulnerable in all but a certain spot. (Dot product fvec|vec_to_collision < BOSS_INVULNERABLE_DOT) +ubyte Boss_teleports[NUM_D2_BOSSES] = {1,1,1,1,1,1, 1,1}; // Set byte if this boss can teleport +ubyte Boss_spew_more[NUM_D2_BOSSES] = {0,1,0,0,0,0, 0,0}; // If set, 50% of time, spew two bots. +ubyte Boss_spews_bots_energy[NUM_D2_BOSSES] = {1,1,0,1,0,1, 1,1}; // Set byte if boss spews bots when hit by energy weapon. +ubyte Boss_spews_bots_matter[NUM_D2_BOSSES] = {0,0,1,1,1,1, 0,1}; // Set byte if boss spews bots when hit by matter weapon. +ubyte Boss_invulnerable_energy[NUM_D2_BOSSES] = {0,0,1,1,0,0, 0,0}; // Set byte if boss is invulnerable to energy weapons. +ubyte Boss_invulnerable_matter[NUM_D2_BOSSES] = {0,0,0,0,1,1, 1,0}; // Set byte if boss is invulnerable to matter weapons. +ubyte Boss_invulnerable_spot[NUM_D2_BOSSES] = {0,0,0,0,0,1, 0,1}; // Set byte if boss is invulnerable in all but a certain spot. (Dot product fvec|vec_to_collision < BOSS_INVULNERABLE_DOT) -int ai_evaded=0; +int ai_evaded=0; -// -- byte Super_boss_gate_list[MAX_GATE_INDEX] = {0, 1, 8, 9, 10, 11, 12, 15, 16, 18, 19, 20, 22, 0, 8, 11, 19, 20, 8, 20, 8}; +// -- byte Super_boss_gate_list[MAX_GATE_INDEX] = {0, 1, 8, 9, 10, 11, 12, 15, 16, 18, 19, 20, 22, 0, 8, 11, 19, 20, 8, 20, 8}; -int Robot_firing_enabled = 1; -int Animation_enabled = 1; +int Robot_firing_enabled = 1; +int Animation_enabled = 1; #ifndef NDEBUG -int Ai_info_enabled=0; +int Ai_info_enabled=0; #endif -// These globals are set by a call to find_vector_intersection, which is a slow routine, -// so we don't want to call it again (for this object) unless we have to. -vms_vector Hit_pos; -int Hit_type, Hit_seg; -fvi_info Hit_data; +// These globals are set by a call to find_vector_intersection, which is a slow routine, +// so we don't want to call it again (for this object) unless we have to. +vms_vector Hit_pos; +int Hit_type, Hit_seg; +fvi_info Hit_data; -int Num_awareness_events = 0; -awareness_event Awareness_events[MAX_AWARENESS_EVENTS]; +int Num_awareness_events = 0; +awareness_event Awareness_events[MAX_AWARENESS_EVENTS]; -vms_vector Believed_player_pos; -int Believed_player_seg; +vms_vector Believed_player_pos; +int Believed_player_seg; #ifndef NDEBUG -// Index into this array with ailp->mode -char *mode_text[18] = { +// Index into this array with ailp->mode +char *mode_text[18] = { "STILL", "WANDER", "FOL_PATH", @@ -152,11 +403,10 @@ char *mode_text[18] = { "TH_ATTACK", "TH_RETREAT", "TH_WAIT", - }; // Index into this array with aip->behavior -char behavior_text[6][9] = { +char behavior_text[6][9] = { "STILL ", "NORMAL ", "HIDE ", @@ -165,8 +415,8 @@ char behavior_text[6][9] = { "STATION " }; -// Index into this array with aip->GOAL_STATE or aip->CURRENT_STATE -char state_text[8][5] = { +// Index into this array with aip->GOAL_STATE or aip->CURRENT_STATE +char state_text[8][5] = { "NONE", "REST", "SRCH", @@ -181,68 +431,68 @@ char state_text[8][5] = { #endif // Current state indicates where the robot current is, or has just done. -// Transition table between states for an AI object. -// First dimension is trigger event. -// Second dimension is current state. -// Third dimension is goal state. -// Result is new goal state. -// ERR_ means something impossible has happened. +// Transition table between states for an AI object. +// First dimension is trigger event. +// Second dimension is current state. +// Third dimension is goal state. +// Result is new goal state. +// ERR_ means something impossible has happened. byte Ai_transition_table[AI_MAX_EVENT][AI_MAX_STATE][AI_MAX_STATE] = { { - // Event = AIE_FIRE, a nearby object fired - // none rest srch lock flin fire reco // CURRENT is rows, GOAL is columns - { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_RECO}, // none - { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_RECO}, // rest - { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_RECO}, // search - { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_RECO}, // lock - { AIS_ERR_, AIS_REST, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FIRE, AIS_RECO}, // flinch - { AIS_ERR_, AIS_FIRE, AIS_FIRE, AIS_FIRE, AIS_FLIN, AIS_FIRE, AIS_RECO}, // fire - { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_FIRE} // recoil + // Event = AIE_FIRE, a nearby object fired + // none rest srch lock flin fire reco // CURRENT is rows, GOAL is columns + { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_RECO }, // none + { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_RECO }, // rest + { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_RECO }, // search + { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_RECO }, // lock + { AIS_ERR_, AIS_REST, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FIRE, AIS_RECO }, // flinch + { AIS_ERR_, AIS_FIRE, AIS_FIRE, AIS_FIRE, AIS_FLIN, AIS_FIRE, AIS_RECO }, // fire + { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_FIRE } // recoil }, - // Event = AIE_HITT, a nearby object was hit (or a wall was hit) + // Event = AIE_HITT, a nearby object was hit (or a wall was hit) { - { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_RECO}, - { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_RECO}, - { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_RECO}, - { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_RECO}, - { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FLIN}, - { AIS_ERR_, AIS_REST, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FIRE, AIS_RECO}, - { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_FIRE} + { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_RECO}, + { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_RECO}, + { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_RECO}, + { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_RECO}, + { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FLIN}, + { AIS_ERR_, AIS_REST, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FIRE, AIS_RECO}, + { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_FIRE} }, - // Event = AIE_COLL, player collided with robot + // Event = AIE_COLL, player collided with robot { - { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_RECO}, - { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_RECO}, - { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_RECO}, - { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_RECO}, - { AIS_ERR_, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_LOCK, AIS_FLIN, AIS_FLIN}, - { AIS_ERR_, AIS_REST, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FIRE, AIS_RECO}, - { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_FIRE} + { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_RECO}, + { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_RECO}, + { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_RECO}, + { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_RECO}, + { AIS_ERR_, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_LOCK, AIS_FLIN, AIS_FLIN}, + { AIS_ERR_, AIS_REST, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FIRE, AIS_RECO}, + { AIS_ERR_, AIS_LOCK, AIS_LOCK, AIS_LOCK, AIS_FLIN, AIS_FIRE, AIS_FIRE} }, - // Event = AIE_HURT, player hurt robot (by firing at and hitting it) - // Note, this doesn't necessarily mean the robot JUST got hit, only that that is the most recent thing that happened. + // Event = AIE_HURT, player hurt robot (by firing at and hitting it) + // Note, this doesn't necessarily mean the robot JUST got hit, only that that is the most recent thing that happened. { - { AIS_ERR_, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN}, - { AIS_ERR_, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN}, - { AIS_ERR_, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN}, - { AIS_ERR_, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN}, - { AIS_ERR_, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN}, - { AIS_ERR_, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN}, - { AIS_ERR_, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN} + { AIS_ERR_, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN}, + { AIS_ERR_, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN}, + { AIS_ERR_, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN}, + { AIS_ERR_, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN}, + { AIS_ERR_, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN}, + { AIS_ERR_, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN}, + { AIS_ERR_, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN, AIS_FLIN} } }; -fix Dist_to_last_fired_upon_player_pos = 0; +fix Dist_to_last_fired_upon_player_pos = 0; -// -------------------------------------------------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- void init_ai_frame(void) { - int ab_state; + int ab_state; Dist_to_last_fired_upon_player_pos = vm_vec_dist_quick(&Last_fired_upon_player_pos, &Believed_player_pos); @@ -253,10 +503,10 @@ void init_ai_frame(void) } } -// -------------------------------------------------------------------------------------------------------------------- -// Return firing status. -// If ready to fire a weapon, return true, else return false. -// Ready to fire a weapon if next_fire <= 0 or next_fire2 <= 0. +// ---------------------------------------------------------------------------- +// Return firing status. +// If ready to fire a weapon, return true, else return false. +// Ready to fire a weapon if next_fire <= 0 or next_fire2 <= 0. int ready_to_fire(robot_info *robptr, ai_local *ailp) { if (robptr->weapon_type2 != -1) @@ -265,21 +515,22 @@ int ready_to_fire(robot_info *robptr, ai_local *ailp) return (ailp->next_fire <= 0); } -// -------------------------------------------------------------------------------------------------------------------- -// Make a robot near the player snipe. +// ---------------------------------------------------------------------------- +// Make a robot near the player snipe. #define MNRS_SEG_MAX 70 void make_nearby_robot_snipe(void) { - int bfs_length, i; - short bfs_list[MNRS_SEG_MAX]; + int bfs_length, i; + short bfs_list[MNRS_SEG_MAX]; create_bfs_list(ConsoleObject->segnum, bfs_list, &bfs_length, MNRS_SEG_MAX); for (i=0; iid]; + object *objp = &Objects[objnum]; + robot_info *robptr = &Robot_info[objp->id]; if ((objp->type == OBJ_ROBOT) && (objp->id != ROBOT_BRAIN)) { if ((objp->ctype.ai_info.behavior != AIB_SNIPE) && (objp->ctype.ai_info.behavior != AIB_RUN_FROM) && !Robot_info[objp->id].boss_flag && !robptr->companion) { @@ -294,31 +545,31 @@ void make_nearby_robot_snipe(void) } mprintf((0, "Couldn't find a robot to make snipe!\n")); - + } -int Ai_last_missile_camera; +int Ai_last_missile_camera; -int Robots_kill_robots_cheat = 0; +int Robots_kill_robots_cheat = 0; // -------------------------------------------------------------------------------------------------------------------- void do_ai_frame(object *obj) { - int objnum = obj-Objects; - ai_static *aip = &obj->ctype.ai_info; - ai_local *ailp = &Ai_local_info[objnum]; - fix dist_to_player; - vms_vector vec_to_player; - fix dot; - robot_info *robptr; - int player_visibility=-1; - int obj_ref; - int object_animates; - int new_goal_state; - int visibility_and_vec_computed = 0; - int previous_visibility; - vms_vector gun_point; - vms_vector vis_vec_pos; + int objnum = obj-Objects; + ai_static *aip = &obj->ctype.ai_info; + ai_local *ailp = &Ai_local_info[objnum]; + fix dist_to_player; + vms_vector vec_to_player; + fix dot; + robot_info *robptr; + int player_visibility=-1; + int obj_ref; + int object_animates; + int new_goal_state; + int visibility_and_vec_computed = 0; + int previous_visibility; + vms_vector gun_point; + vms_vector vis_vec_pos; ailp->next_action_time -= FrameTime; @@ -340,16 +591,16 @@ void do_ai_frame(object *obj) if (do_any_robot_dying_frame(obj)) return; - // Kind of a hack. If a robot is flinching, but it is time for it to fire, unflinch it. - // Else, you can turn a big nasty robot into a wimp by firing flares at it. - // This also allows the player to see the cool flinch effect for mechs without unbalancing the game. + // Kind of a hack. If a robot is flinching, but it is time for it to fire, unflinch it. + // Else, you can turn a big nasty robot into a wimp by firing flares at it. + // This also allows the player to see the cool flinch effect for mechs without unbalancing the game. if ((aip->GOAL_STATE == AIS_FLIN) && ready_to_fire(robptr, ailp)) { aip->GOAL_STATE = AIS_FIRE; } #ifndef NDEBUG if ((aip->behavior == AIB_RUN_FROM) && (ailp->mode != AIM_RUN_FROM_OBJECT)) - Int3(); // This is peculiar. Behavior is run from, but mode is not. Contact Mike. + Int3(); // This is peculiar. Behavior is run from, but mode is not. Contact Mike. mprintf_animation_info((obj)); @@ -358,15 +609,15 @@ void do_ai_frame(object *obj) if (Break_on_object != -1) if ((obj-Objects) == Break_on_object) - Int3(); // Contact Mike: This is a debug break + Int3(); // Contact Mike: This is a debug break #endif - // mprintf((0, "Object %i: behavior = %02x, mode = %i, awareness = %i, time = %7.3f\n", obj-Objects, aip->behavior, ailp->mode, ailp->player_awareness_type, f2fl(ailp->player_awareness_time))); - // mprintf((0, "Object %i: behavior = %02x, mode = %i, awareness = %i, cur=%i, goal=%i\n", obj-Objects, aip->behavior, ailp->mode, ailp->player_awareness_type, aip->CURRENT_STATE, aip->GOAL_STATE)); + //mprintf((0, "Object %i: behavior = %02x, mode = %i, awareness = %i, time = %7.3f\n", obj-Objects, aip->behavior, ailp->mode, ailp->player_awareness_type, f2fl(ailp->player_awareness_time))); + //mprintf((0, "Object %i: behavior = %02x, mode = %i, awareness = %i, cur=%i, goal=%i\n", obj-Objects, aip->behavior, ailp->mode, ailp->player_awareness_type, aip->CURRENT_STATE, aip->GOAL_STATE)); -// Assert((aip->behavior >= MIN_BEHAVIOR) && (aip->behavior <= MAX_BEHAVIOR)); + //Assert((aip->behavior >= MIN_BEHAVIOR) && (aip->behavior <= MAX_BEHAVIOR)); if (!((aip->behavior >= MIN_BEHAVIOR) && (aip->behavior <= MAX_BEHAVIOR))) { - // mprintf((0, "Object %i behavior is %i, setting to AIB_NORMAL, fix in editor!\n", objnum, aip->behavior)); + //mprintf((0, "Object %i behavior is %i, setting to AIB_NORMAL, fix in editor!\n", objnum, aip->behavior)); aip->behavior = AIB_NORMAL; } @@ -387,17 +638,17 @@ void do_ai_frame(object *obj) if (ailp->time_since_processed < F1_0*256) ailp->time_since_processed += FrameTime; - previous_visibility = ailp->previous_visibility; // Must get this before we toast the master copy! + previous_visibility = ailp->previous_visibility; // Must get this before we toast the master copy! // -- (No robots have this behavior...) - // -- // Deal with cloaking for robots which are cloaked except just before firing. + // -- // Deal with cloaking for robots which are cloaked except just before firing. // -- if (robptr->cloak_type == RI_CLOAKED_EXCEPT_FIRING) // -- if (ailp->next_fire < F1_0/2) // -- aip->CLOAKED = 1; // -- else // -- aip->CLOAKED = 0; - // If only awake because of a camera, make that the believed player position. + // If only awake because of a camera, make that the believed player position. if ((aip->SUB_FLAGS & SUB_FLAGS_CAMERA_AWAKE) && (Ai_last_missile_camera != -1)) Believed_player_pos = Objects[Ai_last_missile_camera].pos; else { @@ -405,8 +656,8 @@ void do_ai_frame(object *obj) vis_vec_pos = obj->pos; compute_vis_and_vec(obj, &vis_vec_pos, ailp, &vec_to_player, &player_visibility, robptr, &visibility_and_vec_computed); if (player_visibility) { - int ii, min_obj = -1; - fix min_dist = F1_0*200, cur_dist; + int ii, min_obj = -1; + fix min_dist = F1_0*200, cur_dist; for (ii=0; ii<=Highest_object_index; ii++) if ((Objects[ii].type == OBJ_ROBOT) && (ii != objnum)) { @@ -437,14 +688,14 @@ _exit_cheat: } } dist_to_player = vm_vec_dist_quick(&Believed_player_pos, &obj->pos); -// if (robptr->companion) -// mprintf((0, "%3i: %3i %8.3f %8s %8s [%3i %4i]\n", objnum, obj->segnum, f2fl(dist_to_player), mode_text[ailp->mode], behavior_text[aip->behavior-0x80], aip->hide_index, aip->path_length)); + //if (robptr->companion) + // mprintf((0, "%3i: %3i %8.3f %8s %8s [%3i %4i]\n", objnum, obj->segnum, f2fl(dist_to_player), mode_text[ailp->mode], behavior_text[aip->behavior-0x80], aip->hide_index, aip->path_length)); - // If this robot can fire, compute visibility from gun position. - // Don't want to compute visibility twice, as it is expensive. (So is call to calc_gun_point). + // If this robot can fire, compute visibility from gun position. + // Don't want to compute visibility twice, as it is expensive. (So is call to calc_gun_point). if ((previous_visibility || !(obj_ref & 3)) && ready_to_fire(robptr, ailp) && (dist_to_player < F1_0*200) && (robptr->n_guns) && !(robptr->attack_type)) { - // Since we passed ready_to_fire(), either next_fire or next_fire2 <= 0. calc_gun_point from relevant one. - // If both are <= 0, we will deal with the mess in ai_do_actual_firing_stuff + // Since we passed ready_to_fire(), either next_fire or next_fire2 <= 0. calc_gun_point from relevant one. + // If both are <= 0, we will deal with the mess in ai_do_actual_firing_stuff if (ailp->next_fire <= 0) calc_gun_point(&gun_point, obj, aip->CURRENT_GUN); else @@ -453,17 +704,17 @@ _exit_cheat: } else { vis_vec_pos = obj->pos; vm_vec_zero(&gun_point); - // mprintf((0, "Visibility = %i, computed from center.\n", player_visibility)); + //mprintf((0, "Visibility = %i, computed from center.\n", player_visibility)); } // MK: Debugging, July 26, 1995! // if (objnum == 1) // { -// compute_vis_and_vec(obj, &vis_vec_pos, ailp, &vec_to_player, &player_visibility, robptr, &visibility_and_vec_computed); -// mprintf((0, "Frame %i: dist=%7.3f, vecdot = %7.3f, mode=%i\n", FrameCount, f2fl(dist_to_player), f2fl(vm_vec_dot(&vec_to_player, &obj->orient.fvec)), ailp->mode)); +// compute_vis_and_vec(obj, &vis_vec_pos, ailp, &vec_to_player, &player_visibility, robptr, &visibility_and_vec_computed); +// mprintf((0, "Frame %i: dist=%7.3f, vecdot = %7.3f, mode=%i\n", FrameCount, f2fl(dist_to_player), f2fl(vm_vec_dot(&vec_to_player, &obj->orient.fvec)), ailp->mode)); // } - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Occasionally make non-still robots make a path to the player. Based on agitation and distance from player. + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // Occasionally make non-still robots make a path to the player. Based on agitation and distance from player. if ((aip->behavior != AIB_SNIPE) && (aip->behavior != AIB_RUN_FROM) && (aip->behavior != AIB_STILL) && !(Game_mode & GM_MULTI) && (robptr->companion != 1) && (robptr->thief != 1)) if (Overall_agitation > 70) { if ((dist_to_player < F1_0*200) && (d_rand() < FrameTime/4)) { @@ -475,11 +726,12 @@ _exit_cheat: } } - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // If retry count not 0, then add it into consecutive_retries. - // If it is 0, cut down consecutive_retries. - // This is largely a hack to speed up physics and deal with stupid AI. This is low level - // communication between systems of a sort that should not be done. + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // If retry count not 0, then add it into consecutive_retries. + // If it is 0, cut down consecutive_retries. + // This is largely a hack to speed up physics and deal with stupid + // AI. This is low level communication between systems of a sort + // that should not be done. if ((ailp->retry_count) && !(Game_mode & GM_MULTI)) { ailp->consecutive_retries += ailp->retry_count; ailp->retry_count = 0; @@ -495,11 +747,11 @@ _exit_cheat: case AIM_GOTO_OBJECT: // -- mprintf((0, "Buddy stuck going to object...\n")); Escort_goal_object = ESCORT_GOAL_UNSPECIFIED; -// if (obj->segnum == ConsoleObject->segnum) { -// if (Point_segs[aip->hide_index + aip->cur_path_index].segnum == obj->segnum) -// if ((aip->cur_path_index + aip->PATH_DIR >= 0) && (aip->cur_path_index + aip->PATH_DIR < aip->path_length-1)) -// aip->cur_path_index += aip->PATH_DIR; -// } + //if (obj->segnum == ConsoleObject->segnum) { + // if (Point_segs[aip->hide_index + aip->cur_path_index].segnum == obj->segnum) + // if ((aip->cur_path_index + aip->PATH_DIR >= 0) && (aip->cur_path_index + aip->PATH_DIR < aip->path_length-1)) + // aip->cur_path_index += aip->PATH_DIR; + //} break; case AIM_CHASE_OBJECT: // -- mprintf((0, "(2) Object #%i, retries while chasing, creating path to player in frame %i\n", objnum, FrameCount)); @@ -508,11 +760,11 @@ _exit_cheat: case AIM_STILL: if (robptr->attack_type) move_towards_segment_center(obj); - else if (!((aip->behavior == AIB_STILL) || (aip->behavior == AIB_STATION) || (aip->behavior == AIB_FOLLOW))) // Behavior is still, so don't follow path. + else if (!((aip->behavior == AIB_STILL) || (aip->behavior == AIB_STATION) || (aip->behavior == AIB_FOLLOW))) // Behavior is still, so don't follow path. attempt_to_resume_path(obj); - break; + break; case AIM_FOLLOW_PATH: - // mprintf((0, "Object %i following path got %i retries in frame %i\n", obj-Objects, ailp->consecutive_retries, FrameCount)); + // mprintf((0, "Object %i following path got %i retries in frame %i\n", obj-Objects, ailp->consecutive_retries, FrameCount)); if (Game_mode & GM_MULTI) { ailp->mode = AIM_STILL; } else @@ -538,7 +790,7 @@ _exit_cheat: break; #ifndef NDEBUG case AIM_FOLLOW_PATH_2: - Int3(); // Should never happen! + Int3(); // Should never happen! break; #endif } @@ -547,31 +799,31 @@ _exit_cheat: } else ailp->consecutive_retries /= 2; - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // If in materialization center, exit - if (!(Game_mode & GM_MULTI) && (Segment2s[obj->segnum].special == SEGMENT_IS_ROBOTMAKER)) { + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // If in materialization center, exit + if (!(Game_mode & GM_MULTI) && (Segment2s[obj->segnum].special == SEGMENT_IS_ROBOTMAKER)) { if (Station[Segment2s[obj->segnum].value].Enabled) { - ai_follow_path(obj, 1, 1, NULL); // 1 = player is visible, which might be a lie, but it works. - return; + ai_follow_path(obj, 1, 1, NULL); // 1 = player is visible, which might be a lie, but it works. + return; } - } + } - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Decrease player awareness due to the passage of time. + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // Decrease player awareness due to the passage of time. if (ailp->player_awareness_type) { if (ailp->player_awareness_time > 0) { ailp->player_awareness_time -= FrameTime; if (ailp->player_awareness_time <= 0) { - ailp->player_awareness_time = F1_0*2; //new: 11/05/94 - ailp->player_awareness_type--; //new: 11/05/94 + ailp->player_awareness_time = F1_0*2; //new: 11/05/94 + ailp->player_awareness_type--; //new: 11/05/94 } } else { ailp->player_awareness_type--; ailp->player_awareness_time = F1_0*2; - // aip->GOAL_STATE = AIS_REST; + //aip->GOAL_STATE = AIS_REST; } } else - aip->GOAL_STATE = AIS_REST; //new: 12/13/94 + aip->GOAL_STATE = AIS_REST; //new: 12/13/94 if (Player_is_dead && (ailp->player_awareness_type == 0)) @@ -593,22 +845,22 @@ _exit_cheat: } } -// -- // Make sure that if this guy got hit or bumped, then he's chasing player. -// -- if ((ailp->player_awareness_type == PA_WEAPON_ROBOT_COLLISION) || (ailp->player_awareness_type >= PA_PLAYER_COLLISION)) { -// -- if ((ailp->mode != AIM_BEHIND) && (aip->behavior != AIB_STILL) && (aip->behavior != AIB_SNIPE) && (aip->behavior != AIB_RUN_FROM) && (!robptr->companion) && (!robptr->thief) && (obj->id != ROBOT_BRAIN)) { -// -- ailp->mode = AIM_CHASE_OBJECT; -// -- ailp->player_awareness_type = 0; -// -- ailp->player_awareness_time = 0; -// -- } -// -- } + // -- // Make sure that if this guy got hit or bumped, then he's chasing player. + // -- if ((ailp->player_awareness_type == PA_WEAPON_ROBOT_COLLISION) || (ailp->player_awareness_type >= PA_PLAYER_COLLISION)) { + // -- if ((ailp->mode != AIM_BEHIND) && (aip->behavior != AIB_STILL) && (aip->behavior != AIB_SNIPE) && (aip->behavior != AIB_RUN_FROM) && (!robptr->companion) && (!robptr->thief) && (obj->id != ROBOT_BRAIN)) { + // -- ailp->mode = AIM_CHASE_OBJECT; + // -- ailp->player_awareness_type = 0; + // -- ailp->player_awareness_time = 0; + // -- } + // -- } - // Make sure that if this guy got hit or bumped, then he's chasing player. + // Make sure that if this guy got hit or bumped, then he's chasing player. if ((ailp->player_awareness_type == PA_WEAPON_ROBOT_COLLISION) || (ailp->player_awareness_type >= PA_PLAYER_COLLISION)) { compute_vis_and_vec(obj, &vis_vec_pos, ailp, &vec_to_player, &player_visibility, robptr, &visibility_and_vec_computed); - if (player_visibility == 1) // Only increase visibility if unobstructed, else claw guys attack through doors. + if (player_visibility == 1) // Only increase visibility if unobstructed, else claw guys attack through doors. player_visibility = 2; } else if (((obj_ref&3) == 0) && !previous_visibility && (dist_to_player < F1_0*100)) { - fix sval, rval; + fix sval, rval; rval = d_rand(); sval = (dist_to_player * (Difficulty_level+1))/64; @@ -628,34 +880,35 @@ _exit_cheat: } - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if ((aip->GOAL_STATE == AIS_FLIN) && (aip->CURRENT_STATE == AIS_FLIN)) aip->GOAL_STATE = AIS_LOCK; - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Note: Should only do these two function calls for objects which animate + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // Note: Should only do these two function calls for objects which animate if (Animation_enabled && (dist_to_player < F1_0*100)) { // && !(Game_mode & GM_MULTI)) { object_animates = do_silly_animation(obj); if (object_animates) ai_frame_animation(obj); //mprintf((0, "Object %i: goal=%i, current=%i\n", obj-Objects, obj->ctype.ai_info.GOAL_STATE, obj->ctype.ai_info.CURRENT_STATE)); } else { - // If Object is supposed to animate, but we don't let it animate due to distance, then - // we must change its state, else it will never update. + // If Object is supposed to animate, but we don't let it animate due to distance, then + // we must change its state, else it will never update. aip->CURRENT_STATE = aip->GOAL_STATE; - object_animates = 0; // If we're not doing the animation, then should pretend it doesn't animate. + object_animates = 0; // If we're not doing the animation, then should pretend it doesn't animate. } switch (Robot_info[obj->id].boss_flag) { - case 0: - break; + case 0: + break; - case 1: - case 2: - mprintf((1, "Warning: D1 boss detected. Not supported!\n")); - break; + case 1: + case 2: + mprintf((1, "Warning: D1 boss detected. Not supported!\n")); + break; - default: { + default: + { int pv; fix dtp = dist_to_player/4; @@ -668,7 +921,7 @@ _exit_cheat: pv = player_visibility; - // If player cloaked, visibility is screwed up and superboss will gate in robots when not supposed to. + // If player cloaked, visibility is screwed up and superboss will gate in robots when not supposed to. if (Players[Player_num].flags & PLAYER_FLAGS_CLOAKED) { pv = 0; dtp = vm_vec_dist_quick(&ConsoleObject->pos, &obj->pos)/4; @@ -679,37 +932,39 @@ _exit_cheat: break; } - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Time-slice, don't process all the time, purely an efficiency hack. - // Guys whose behavior is station and are not at their hide segment get processed anyway. + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // Time-slice, don't process all the time, purely an efficiency hack. + // Guys whose behavior is station and are not at their hide segment get processed anyway. if (!((aip->behavior == AIB_SNIPE) && (ailp->mode != AIM_SNIPE_WAIT)) && !robptr->companion && !robptr->thief && (ailp->player_awareness_type < PA_WEAPON_ROBOT_COLLISION-1)) { // If robot got hit, he gets to attack player always! - #ifndef NDEBUG - if (Break_on_object != objnum) { // don't time slice if we're interested in this object. - #endif +#ifndef NDEBUG + if (Break_on_object != objnum) { // don't time slice if we're interested in this object. +#endif if ((aip->behavior == AIB_STATION) && (ailp->mode == AIM_FOLLOW_PATH) && (aip->hide_segment != obj->segnum)) { - if (dist_to_player > F1_0*250) // station guys not at home always processed until 250 units away. + if (dist_to_player > F1_0*250) // station guys not at home always processed until 250 units away. return; - } else if ((!ailp->previous_visibility) && ((dist_to_player >> 7) > ailp->time_since_processed)) { // 128 units away (6.4 segments) processed after 1 second. + } else if ((!ailp->previous_visibility) && ((dist_to_player >> 7) > ailp->time_since_processed)) { // 128 units away (6.4 segments) processed after 1 second. if (robptr->thief) mprintf((0, "T")); return; } - #ifndef NDEBUG +#ifndef NDEBUG } - #endif +#endif } - // Reset time since processed, but skew objects so not everything processed synchronously, else - // we get fast frames with the occasional very slow frame. + // Reset time since processed, but skew objects so not everything + // processed synchronously, else we get fast frames with the + // occasional very slow frame. // AI_proc_time = ailp->time_since_processed; ailp->time_since_processed = - ((objnum & 0x03) * FrameTime ) / 2; - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Perform special ability switch (obj->id) { case ROBOT_BRAIN: - // Robots function nicely if behavior is Station. This means they won't move until they - // can see the player, at which time they will start wandering about opening doors. + // Robots function nicely if behavior is Station. This + // means they won't move until they can see the player, at + // which time they will start wandering about opening doors. if (ConsoleObject->segnum == obj->segnum) { if (!ai_multiplayer_awareness(obj, 97)) return; @@ -717,7 +972,7 @@ _exit_cheat: move_away_from_player(obj, &vec_to_player, 0); ai_multi_send_robot_position(objnum, -1); } else if (ailp->mode != AIM_STILL) { - int r; + int r; r = openable_doors_in_segment(obj->segnum); if (r != -1) { @@ -726,7 +981,7 @@ _exit_cheat: } else if (ailp->mode != AIM_FOLLOW_PATH) { if (!ai_multiplayer_awareness(obj, 50)) return; - create_n_segment_path_to_door(obj, 8+Difficulty_level, -1); // third parameter is avoid_seg, -1 means avoid nothing. + create_n_segment_path_to_door(obj, 8+Difficulty_level, -1); // third parameter is avoid_seg, -1 means avoid nothing. ai_multi_send_robot_position(objnum, -1); } @@ -742,7 +997,7 @@ _exit_cheat: if (player_visibility) { if (!ai_multiplayer_awareness(obj, 50)) return; - create_n_segment_path_to_door(obj, 8+Difficulty_level, -1); // third parameter is avoid_seg, -1 means avoid nothing. + create_n_segment_path_to_door(obj, 8+Difficulty_level, -1); // third parameter is avoid_seg, -1 means avoid nothing. ai_multi_send_robot_position(objnum, -1); } } @@ -761,7 +1016,7 @@ _exit_cheat: if (!(obj_ref & 3) || previous_visibility) { compute_vis_and_vec(obj, &vis_vec_pos, ailp, &vec_to_player, &player_visibility, robptr, &visibility_and_vec_computed); - // If this sniper is in still mode, if he was hit or can see player, switch to snipe mode. + // If this sniper is in still mode, if he was hit or can see player, switch to snipe mode. if (ailp->mode == AIM_STILL) if (player_visibility || (ailp->player_awareness_type == PA_WEAPON_ROBOT_COLLISION)) ailp->mode = AIM_SNIPE_ATTACK; @@ -772,7 +1027,7 @@ _exit_cheat: return; } - // More special ability stuff, but based on a property of a robot, not its ID. + // More special ability stuff, but based on a property of a robot, not its ID. if (robptr->companion) { compute_vis_and_vec(obj, &vis_vec_pos, ailp, &vec_to_player, &player_visibility, robptr, &visibility_and_vec_computed); @@ -782,7 +1037,7 @@ _exit_cheat: object *dobjp = &Objects[obj->ctype.ai_info.danger_laser_num]; if ((dobjp->type == OBJ_WEAPON) && (dobjp->signature == obj->ctype.ai_info.danger_laser_signature)) { - fix circle_distance; + fix circle_distance; // -- mprintf((0, "Evading! ")); circle_distance = robptr->circle_distance[Difficulty_level] + ConsoleObject->size; ai_move_relative_to_player(obj, ailp, dist_to_player, &vec_to_player, circle_distance, 1, player_visibility); @@ -790,7 +1045,7 @@ _exit_cheat: } if (ready_to_fire(robptr, ailp)) { - int do_stuff = 0; + int do_stuff = 0; if (openable_doors_in_segment(obj->segnum) != -1) do_stuff = 1; else if (openable_doors_in_segment(Point_segs[aip->hide_index + aip->cur_path_index + aip->PATH_DIR].segnum) != -1) @@ -806,7 +1061,7 @@ _exit_cheat: if (do_stuff) { Laser_create_new_easy( &obj->orient.fvec, &obj->pos, obj-Objects, FLARE_ID, 1); ailp->next_fire = F1_0/2; - if (!Buddy_allowed_to_talk) // If buddy not talking, make him fire flares less often. + if (!Buddy_allowed_to_talk) // If buddy not talking, make him fire flares less often. ailp->next_fire += d_rand()*4; } @@ -819,7 +1074,7 @@ _exit_cheat: do_thief_frame(obj, dist_to_player, player_visibility, &vec_to_player); if (ready_to_fire(robptr, ailp)) { - int do_stuff = 0; + int do_stuff = 0; if (openable_doors_in_segment(obj->segnum) != -1) do_stuff = 1; else if (openable_doors_in_segment(Point_segs[aip->hide_index + aip->cur_path_index + aip->PATH_DIR].segnum) != -1) @@ -828,28 +1083,28 @@ _exit_cheat: do_stuff = 1; if (do_stuff) { - // @mk, 05/08/95: Firing flare from center of object, this is dumb... + // @mk, 05/08/95: Firing flare from center of object, this is dumb... Laser_create_new_easy( &obj->orient.fvec, &obj->pos, obj-Objects, FLARE_ID, 1); ailp->next_fire = F1_0/2; - if (Stolen_item_index == 0) // If never stolen an item, fire flares less often (bad: Stolen_item_index wraps, but big deal) + if (Stolen_item_index == 0) // If never stolen an item, fire flares less often (bad: Stolen_item_index wraps, but big deal) ailp->next_fire += d_rand()*4; } } } - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - switch (ailp->mode) { - case AIM_CHASE_OBJECT: { // chasing player, sort of, chase if far, back off if close, circle in between - fix circle_distance; + case AIM_CHASE_OBJECT: { // chasing player, sort of, chase if far, back off if close, circle in between + fix circle_distance; circle_distance = robptr->circle_distance[Difficulty_level] + ConsoleObject->size; - // Green guy doesn't get his circle distance boosted, else he might never attack. + // Green guy doesn't get his circle distance boosted, else he might never attack. if (robptr->attack_type != 1) circle_distance += (objnum&0xf) * F1_0/2; compute_vis_and_vec(obj, &vis_vec_pos, ailp, &vec_to_player, &player_visibility, robptr, &visibility_and_vec_computed); - // @mk, 12/27/94, structure here was strange. Would do both clauses of what are now this if/then/else. Used to be if/then, if/then. + // @mk, 12/27/94, structure here was strange. Would do both clauses of what are now this if/then/else. Used to be if/then, if/then. if ((player_visibility < 2) && (previous_visibility == 2)) { // this is redundant: mk, 01/15/95: && (ailp->mode == AIM_CHASE_OBJECT)) { // -- mprintf((0, "I used to be able to see the player!\n")); if (!ai_multiplayer_awareness(obj, 53)) { @@ -861,8 +1116,9 @@ _exit_cheat: create_path_to_player(obj, 8, 1); ai_multi_send_robot_position(objnum, -1); } else if ((player_visibility == 0) && (dist_to_player > F1_0*80) && (!(Game_mode & GM_MULTI))) { - // If pretty far from the player, player cannot be seen (obstructed) and in chase mode, switch to follow path mode. - // This has one desirable benefit of avoiding physics retries. + // If pretty far from the player, player cannot be seen + // (obstructed) and in chase mode, switch to follow path mode. + // This has one desirable benefit of avoiding physics retries. if (aip->behavior == AIB_STATION) { ailp->goal_segment = aip->hide_segment; // -- mprintf((0, "(1) Object #%i going from chase to STATION in frame %i.\n", objnum, FrameCount)); @@ -915,9 +1171,9 @@ _exit_cheat: if (ai_evaded) { ai_multi_send_robot_position(objnum, 1); ai_evaded = 0; - } else + } else ai_multi_send_robot_position(objnum, -1); - + do_firing_stuff(obj, player_visibility, &vec_to_player); } break; @@ -932,7 +1188,7 @@ _exit_cheat: } - // If in multiplayer, only do if player visible. If not multiplayer, do always. + // If in multiplayer, only do if player visible. If not multiplayer, do always. if (!(Game_mode & GM_MULTI) || player_visibility) if (ai_multiplayer_awareness(obj, 75)) { ai_follow_path(obj, player_visibility, previous_visibility, &vec_to_player); @@ -944,14 +1200,17 @@ _exit_cheat: else if (aip->CURRENT_STATE == AIS_FLIN) aip->GOAL_STATE = AIS_LOCK; - // Bad to let run_from robot fire at player because it will cause a war in which it turns towards the - // player to fire and then towards its goal to move. + // Bad to let run_from robot fire at player because it + // will cause a war in which it turns towards the player + // to fire and then towards its goal to move. // do_firing_stuff(obj, player_visibility, &vec_to_player); - // Instead, do this: - // (Note, only drop if player is visible. This prevents the bombs from being a giveaway, and - // also ensures that the robot is moving while it is dropping. Also means fewer will be dropped.) + // Instead, do this: + // (Note, only drop if player is visible. This prevents + // the bombs from being a giveaway, and also ensures that + // the robot is moving while it is dropping. Also means + // fewer will be dropped.) if ((ailp->next_fire <= 0) && (player_visibility)) { - vms_vector fire_vec, fire_pos; + vms_vector fire_vec, fire_pos; if (!ai_multiplayer_awareness(obj, 75)) return; @@ -965,31 +1224,31 @@ _exit_cheat: else Laser_create_new_easy( &fire_vec, &fire_pos, obj-Objects, PROXIMITY_ID, 1); - ailp->next_fire = (F1_0/2)*(NDL+5 - Difficulty_level); // Drop a proximity bomb every 5 seconds. + ailp->next_fire = (F1_0/2)*(NDL+5 - Difficulty_level); // Drop a proximity bomb every 5 seconds. #ifdef NETWORK - #ifndef SHAREWARE +#ifndef SHAREWARE if (Game_mode & GM_MULTI) { ai_multi_send_robot_position(obj-Objects, -1); - if (aip->SUB_FLAGS & SUB_FLAGS_SPROX) - multi_send_robot_fire(obj-Objects, -2, &fire_vec); - else - multi_send_robot_fire(obj-Objects, -1, &fire_vec); + if (aip->SUB_FLAGS & SUB_FLAGS_SPROX) + multi_send_robot_fire(obj-Objects, -2, &fire_vec); + else + multi_send_robot_fire(obj-Objects, -1, &fire_vec); } - #endif +#endif #endif } break; case AIM_GOTO_PLAYER: case AIM_GOTO_OBJECT: - ai_follow_path(obj, 2, previous_visibility, &vec_to_player); // Follows path as if player can see robot. + ai_follow_path(obj, 2, previous_visibility, &vec_to_player); // Follows path as if player can see robot. ai_multi_send_robot_position(objnum, -1); break; case AIM_FOLLOW_PATH: { - int anger_level = 65; + int anger_level = 65; if (aip->behavior == AIB_STATION) if (Point_segs[aip->hide_index + aip->path_length - 1].segnum == aip->hide_segment) { @@ -1026,7 +1285,7 @@ _exit_cheat: if ((player_visibility == 2) && (aip->behavior != AIB_SNIPE) && (aip->behavior != AIB_FOLLOW) && (aip->behavior != AIB_RUN_FROM) && (obj->id != ROBOT_BRAIN) && (robptr->companion != 1) && (robptr->thief != 1)) { if (robptr->attack_type == 0) ailp->mode = AIM_CHASE_OBJECT; - // This should not just be distance based, but also time-since-player-seen based. + // This should not just be distance based, but also time-since-player-seen based. } else if ((dist_to_player > F1_0*(20*(2*Difficulty_level + robptr->pursuit))) && (GameTime - ailp->time_player_seen > (F1_0/2*(Difficulty_level+robptr->pursuit))) && (player_visibility == 0) @@ -1054,20 +1313,20 @@ _exit_cheat: compute_vis_and_vec(obj, &vis_vec_pos, ailp, &vec_to_player, &player_visibility, robptr, &visibility_and_vec_computed); if (player_visibility == 2) { - // Get behind the player. - // Method: - // If vec_to_player dot player_rear_vector > 0, behind is goal. - // Else choose goal with larger dot from left, right. - vms_vector goal_point, goal_vector, vec_to_goal, rand_vec; - fix dot; - + // Get behind the player. + // Method: + // If vec_to_player dot player_rear_vector > 0, behind is goal. + // Else choose goal with larger dot from left, right. + vms_vector goal_point, goal_vector, vec_to_goal, rand_vec; + fix dot; + dot = vm_vec_dot(&ConsoleObject->orient.fvec, &vec_to_player); - if (dot > 0) { // Remember, we're interested in the rear vector dot being < 0. + if (dot > 0) { // Remember, we're interested in the rear vector dot being < 0. goal_vector = ConsoleObject->orient.fvec; vm_vec_negate(&goal_vector); // -- mprintf((0, "Goal is BEHIND\n")); } else { - fix dot; + fix dot; dot = vm_vec_dot(&ConsoleObject->orient.rvec, &vec_to_player); goal_vector = ConsoleObject->orient.rvec; if (dot > 0) { @@ -1076,7 +1335,7 @@ _exit_cheat: } else ; // -- mprintf((0, "Goal is RIGHT\n")); } - + vm_vec_scale(&goal_vector, 2*(ConsoleObject->size + obj->size + (((objnum*4 + FrameCount) & 63) << 12))); vm_vec_add(&goal_point, &ConsoleObject->pos, &goal_vector); make_random_vector(&rand_vec); @@ -1100,7 +1359,7 @@ _exit_cheat: if ((dist_to_player < F1_0*120+Difficulty_level*F1_0*20) || (ailp->player_awareness_type >= PA_WEAPON_ROBOT_COLLISION-1)) { compute_vis_and_vec(obj, &vis_vec_pos, ailp, &vec_to_player, &player_visibility, robptr, &visibility_and_vec_computed); - // turn towards vector if visible this time or last time, or rand + // turn towards vector if visible this time or last time, or rand // new! if ((player_visibility == 2) || (previous_visibility == 2)) { // -- MK, 06/09/95: || ((d_rand() > 0x4000) && !(Game_mode & GM_MULTI))) { if (!ai_multiplayer_awareness(obj, 71)) { @@ -1113,7 +1372,7 @@ _exit_cheat: } do_firing_stuff(obj, player_visibility, &vec_to_player); - if (player_visibility == 2) { // Changed @mk, 09/21/95: Require that they be looking to evade. Change, MK, 01/03/95 for Multiplayer reasons. If robots can't see you (even with eyes on back of head), then don't do evasion. + if (player_visibility == 2) { // Changed @mk, 09/21/95: Require that they be looking to evade. Change, MK, 01/03/95 for Multiplayer reasons. If robots can't see you (even with eyes on back of head), then don't do evasion. if (robptr->attack_type == 1) { aip->behavior = AIB_NORMAL; if (!ai_multiplayer_awareness(obj, 80)) { @@ -1129,7 +1388,7 @@ _exit_cheat: else ai_multi_send_robot_position(objnum, -1); } else { - // Robots in hover mode are allowed to evade at half normal speed. + // Robots in hover mode are allowed to evade at half normal speed. if (!ai_multiplayer_awareness(obj, 81)) { if (maybe_ai_do_actual_firing_stuff(obj, aip)) ai_do_actual_firing_stuff(obj, aip, ailp, robptr, &vec_to_player, dist_to_player, &gun_point, player_visibility, object_animates, aip->CURRENT_GUN); @@ -1140,12 +1399,14 @@ _exit_cheat: ai_multi_send_robot_position(objnum, -1); ai_evaded = 0; } - else + else ai_multi_send_robot_position(objnum, -1); } } else if ((obj->segnum != aip->hide_segment) && (dist_to_player > F1_0*80) && (!(Game_mode & GM_MULTI))) { - // If pretty far from the player, player cannot be seen (obstructed) and in chase mode, switch to follow path mode. - // This has one desirable benefit of avoiding physics retries. + // If pretty far from the player, player cannot be + // seen (obstructed) and in chase mode, switch to + // follow path mode. + // This has one desirable benefit of avoiding physics retries. if (aip->behavior == AIB_STATION) { ailp->goal_segment = aip->hide_segment; // -- mprintf((0, "(2) Object #%i going from STILL to STATION in frame %i.\n", objnum, FrameCount)); @@ -1156,9 +1417,9 @@ _exit_cheat: } break; - case AIM_OPEN_DOOR: { // trying to open a door. - vms_vector center_point, goal_vector; - Assert(obj->id == ROBOT_BRAIN); // Make sure this guy is allowed to be in this mode. + case AIM_OPEN_DOOR: { // trying to open a door. + vms_vector center_point, goal_vector; + Assert(obj->id == ROBOT_BRAIN); // Make sure this guy is allowed to be in this mode. if (!ai_multiplayer_awareness(obj, 62)) return; @@ -1193,28 +1454,28 @@ _exit_cheat: case AIM_THIEF_WAIT: case AIM_THIEF_ATTACK: case AIM_THIEF_RETREAT: - case AIM_WANDER: // Used for Buddy Bot + case AIM_WANDER: // Used for Buddy Bot break; default: mprintf((0, "Unknown mode = %i in robot %i, behavior = %i\n", ailp->mode, obj-Objects, aip->behavior)); ailp->mode = AIM_CHASE_OBJECT; break; - } // end: switch (ailp->mode) { + } // end: switch (ailp->mode) { - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // If the robot can see you, increase his awareness of you. - // This prevents the problem of a robot looking right at you but doing nothing. - // Assert(player_visibility != -1); // Means it didn't get initialized! + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // If the robot can see you, increase his awareness of you. + // This prevents the problem of a robot looking right at you but doing nothing. + // Assert(player_visibility != -1); // Means it didn't get initialized! compute_vis_and_vec(obj, &vis_vec_pos, ailp, &vec_to_player, &player_visibility, robptr, &visibility_and_vec_computed); if ((player_visibility == 2) && (aip->behavior != AIB_FOLLOW) && (!robptr->thief)) { if ((ailp->player_awareness_type == 0) && (aip->SUB_FLAGS & SUB_FLAGS_CAMERA_AWAKE)) aip->SUB_FLAGS &= ~SUB_FLAGS_CAMERA_AWAKE; - else if (ailp->player_awareness_type == 0) + else if (ailp->player_awareness_type == 0) ailp->player_awareness_type = PA_PLAYER_COLLISION; } - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if (!object_animates) { aip->CURRENT_STATE = aip->GOAL_STATE; // mprintf((0, "Setting current to goal (%i) because object doesn't animate.\n", aip->GOAL_STATE)); @@ -1224,11 +1485,11 @@ _exit_cheat: Assert(aip->CURRENT_STATE < AIS_MAX); Assert(aip->GOAL_STATE < AIS_MAX); - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if (ailp->player_awareness_type) { new_goal_state = Ai_transition_table[ailp->player_awareness_type-1][aip->CURRENT_STATE][aip->GOAL_STATE]; if (ailp->player_awareness_type == PA_WEAPON_ROBOT_COLLISION) { - // Decrease awareness, else this robot will flinch every frame. + // Decrease awareness, else this robot will flinch every frame. ailp->player_awareness_type--; ailp->player_awareness_time = F1_0*3; } @@ -1243,100 +1504,100 @@ _exit_cheat: } - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // If new state = fire, then set all gun states to fire. + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // If new state = fire, then set all gun states to fire. if ((aip->GOAL_STATE == AIS_FIRE) ) { - int i,num_guns; + int i,num_guns; num_guns = Robot_info[obj->id].n_guns; for (i=0; igoal_state[i] = AIS_FIRE; } - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Hack by mk on 01/04/94, if a guy hasn't animated to the firing state, but his next_fire says ok to fire, bash him there + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // Hack by mk on 01/04/94, if a guy hasn't animated to the firing state, but his next_fire says ok to fire, bash him there if (ready_to_fire(robptr, ailp) && (aip->GOAL_STATE == AIS_FIRE)) aip->CURRENT_STATE = AIS_FIRE; if ((aip->GOAL_STATE != AIS_FLIN) && (obj->id != ROBOT_BRAIN)) { switch (aip->CURRENT_STATE) { - case AIS_NONE: - compute_vis_and_vec(obj, &vis_vec_pos, ailp, &vec_to_player, &player_visibility, robptr, &visibility_and_vec_computed); + case AIS_NONE: + compute_vis_and_vec(obj, &vis_vec_pos, ailp, &vec_to_player, &player_visibility, robptr, &visibility_and_vec_computed); - dot = vm_vec_dot(&obj->orient.fvec, &vec_to_player); - if (dot >= F1_0/2) - if (aip->GOAL_STATE == AIS_REST) - aip->GOAL_STATE = AIS_SRCH; - break; - case AIS_REST: - if (aip->GOAL_STATE == AIS_REST) { - compute_vis_and_vec(obj, &vis_vec_pos, ailp, &vec_to_player, &player_visibility, robptr, &visibility_and_vec_computed); - if (ready_to_fire(robptr, ailp) && (player_visibility)) { - // mprintf((0, "Setting goal state to fire from rest.\n")); - aip->GOAL_STATE = AIS_FIRE; - } + dot = vm_vec_dot(&obj->orient.fvec, &vec_to_player); + if (dot >= F1_0/2) + if (aip->GOAL_STATE == AIS_REST) + aip->GOAL_STATE = AIS_SRCH; + break; + case AIS_REST: + if (aip->GOAL_STATE == AIS_REST) { + compute_vis_and_vec(obj, &vis_vec_pos, ailp, &vec_to_player, &player_visibility, robptr, &visibility_and_vec_computed); + if (ready_to_fire(robptr, ailp) && (player_visibility)) { + // mprintf((0, "Setting goal state to fire from rest.\n")); + aip->GOAL_STATE = AIS_FIRE; } - break; - case AIS_SRCH: - if (!ai_multiplayer_awareness(obj, 60)) - return; + } + break; + case AIS_SRCH: + if (!ai_multiplayer_awareness(obj, 60)) + return; - compute_vis_and_vec(obj, &vis_vec_pos, ailp, &vec_to_player, &player_visibility, robptr, &visibility_and_vec_computed); + compute_vis_and_vec(obj, &vis_vec_pos, ailp, &vec_to_player, &player_visibility, robptr, &visibility_and_vec_computed); - if (player_visibility == 2) { + if (player_visibility == 2) { + ai_turn_towards_vector(&vec_to_player, obj, robptr->turn_time[Difficulty_level]); + ai_multi_send_robot_position(objnum, -1); + } + break; + case AIS_LOCK: + compute_vis_and_vec(obj, &vis_vec_pos, ailp, &vec_to_player, &player_visibility, robptr, &visibility_and_vec_computed); + + if (!(Game_mode & GM_MULTI) || (player_visibility)) { + if (!ai_multiplayer_awareness(obj, 68)) + return; + + if (player_visibility == 2) { // @mk, 09/21/95, require that they be looking towards you to turn towards you. ai_turn_towards_vector(&vec_to_player, obj, robptr->turn_time[Difficulty_level]); ai_multi_send_robot_position(objnum, -1); } - break; - case AIS_LOCK: - compute_vis_and_vec(obj, &vis_vec_pos, ailp, &vec_to_player, &player_visibility, robptr, &visibility_and_vec_computed); + } + break; + case AIS_FIRE: + compute_vis_and_vec(obj, &vis_vec_pos, ailp, &vec_to_player, &player_visibility, robptr, &visibility_and_vec_computed); - if (!(Game_mode & GM_MULTI) || (player_visibility)) { - if (!ai_multiplayer_awareness(obj, 68)) + if (player_visibility == 2) { + if (!ai_multiplayer_awareness(obj, (ROBOT_FIRE_AGITATION-1))) { + if (Game_mode & GM_MULTI) { + ai_do_actual_firing_stuff(obj, aip, ailp, robptr, &vec_to_player, dist_to_player, &gun_point, player_visibility, object_animates, aip->CURRENT_GUN); return; - - if (player_visibility == 2) { // @mk, 09/21/95, require that they be looking towards you to turn towards you. - ai_turn_towards_vector(&vec_to_player, obj, robptr->turn_time[Difficulty_level]); - ai_multi_send_robot_position(objnum, -1); } } - break; - case AIS_FIRE: - compute_vis_and_vec(obj, &vis_vec_pos, ailp, &vec_to_player, &player_visibility, robptr, &visibility_and_vec_computed); + ai_turn_towards_vector(&vec_to_player, obj, robptr->turn_time[Difficulty_level]); + ai_multi_send_robot_position(objnum, -1); + } + + // Fire at player, if appropriate. + ai_do_actual_firing_stuff(obj, aip, ailp, robptr, &vec_to_player, dist_to_player, &gun_point, player_visibility, object_animates, aip->CURRENT_GUN); + break; + case AIS_RECO: + if (!(obj_ref & 3)) { + compute_vis_and_vec(obj, &vis_vec_pos, ailp, &vec_to_player, &player_visibility, robptr, &visibility_and_vec_computed); if (player_visibility == 2) { - if (!ai_multiplayer_awareness(obj, (ROBOT_FIRE_AGITATION-1))) { - if (Game_mode & GM_MULTI) { - ai_do_actual_firing_stuff(obj, aip, ailp, robptr, &vec_to_player, dist_to_player, &gun_point, player_visibility, object_animates, aip->CURRENT_GUN); - return; - } - } + if (!ai_multiplayer_awareness(obj, 69)) + return; ai_turn_towards_vector(&vec_to_player, obj, robptr->turn_time[Difficulty_level]); ai_multi_send_robot_position(objnum, -1); - } - - // Fire at player, if appropriate. - ai_do_actual_firing_stuff(obj, aip, ailp, robptr, &vec_to_player, dist_to_player, &gun_point, player_visibility, object_animates, aip->CURRENT_GUN); - - break; - case AIS_RECO: - if (!(obj_ref & 3)) { - compute_vis_and_vec(obj, &vis_vec_pos, ailp, &vec_to_player, &player_visibility, robptr, &visibility_and_vec_computed); - if (player_visibility == 2) { - if (!ai_multiplayer_awareness(obj, 69)) - return; - ai_turn_towards_vector(&vec_to_player, obj, robptr->turn_time[Difficulty_level]); - ai_multi_send_robot_position(objnum, -1); - } // -- MK, 06/09/95: else if (!(Game_mode & GM_MULTI)) { - } - break; - case AIS_FLIN: - // mprintf((0, "State = flinch, goal = %i.\n", aip->GOAL_STATE)); - break; - default: - mprintf((1, "Unknown mode for AI object #%i\n", objnum)); - aip->GOAL_STATE = AIS_REST; - aip->CURRENT_STATE = AIS_REST; - break; + } // -- MK, 06/09/95: else if (!(Game_mode & GM_MULTI)) { + } + break; + case AIS_FLIN: + // mprintf((0, "State = flinch, goal = %i.\n", aip->GOAL_STATE)); + break; + default: + mprintf((1, "Unknown mode for AI object #%i\n", objnum)); + aip->GOAL_STATE = AIS_REST; + aip->CURRENT_STATE = AIS_REST; + break; } } // end of: if (aip->GOAL_STATE != AIS_FLIN) { @@ -1345,7 +1606,7 @@ _exit_cheat: aip->CURRENT_GUN++; if (aip->CURRENT_GUN >= Robot_info[obj->id].n_guns) { - if ((robptr->n_guns == 1) || (robptr->weapon_type2 == -1)) // Two weapon types hack. + if ((robptr->n_guns == 1) || (robptr->weapon_type2 == -1)) // Two weapon types hack. aip->CURRENT_GUN = 0; else aip->CURRENT_GUN = 1; @@ -1354,10 +1615,10 @@ _exit_cheat: } -// ----------------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- void ai_do_cloak_stuff(void) { - int i; + int i; for (i=0; ipos; @@ -1365,17 +1626,17 @@ void ai_do_cloak_stuff(void) Ai_cloak_info[i].last_time = GameTime; } - // Make work for control centers. + // Make work for control centers. Believed_player_pos = Ai_cloak_info[0].last_position; Believed_player_seg = Ai_cloak_info[0].last_segment; } -// ----------------------------------------------------------------------------------- -// Returns false if awareness is considered too puny to add, else returns true. +// ---------------------------------------------------------------------------- +// Returns false if awareness is considered too puny to add, else returns true. int add_awareness_event(object *objp, int type) { - // If player cloaked and hit a robot, then increase awareness + // If player cloaked and hit a robot, then increase awareness if ((type == PA_WEAPON_ROBOT_COLLISION) || (type == PA_WEAPON_WALL_COLLISION) || (type == PA_PLAYER_COLLISION)) ai_do_cloak_stuff(); @@ -1383,26 +1644,27 @@ int add_awareness_event(object *objp, int type) if ((type == PA_WEAPON_WALL_COLLISION) || (type == PA_WEAPON_ROBOT_COLLISION)) if (objp->id == VULCAN_ID) if (d_rand() > 3276) - return 0; // For vulcan cannon, only about 1/10 actually cause awareness + return 0; // For vulcan cannon, only about 1/10 actually cause awareness Awareness_events[Num_awareness_events].segnum = objp->segnum; Awareness_events[Num_awareness_events].pos = objp->pos; Awareness_events[Num_awareness_events].type = type; Num_awareness_events++; } else { -// Int3(); // Hey -- Overflowed Awareness_events, make more or something - // This just gets ignored, so you can just continue. + //Int3(); // Hey -- Overflowed Awareness_events, make more or something + // This just gets ignored, so you can just + // continue. } return 1; } // ---------------------------------------------------------------------------------- -// Robots will become aware of the player based on something that occurred. -// The object (probably player or weapon) which created the awareness is objp. +// Robots will become aware of the player based on something that occurred. +// The object (probably player or weapon) which created the awareness is objp. void create_awareness_event(object *objp, int type) { - // If not in multiplayer, or in multiplayer with robots, do this, else unnecessary! + // If not in multiplayer, or in multiplayer with robots, do this, else unnecessary! if (!(Game_mode & GM_MULTI) || (Game_mode & GM_MULTI_ROBOTS)) { if (add_awareness_event(objp, type)) { if (((d_rand() * (type+4)) >> 15) > 4) @@ -1413,12 +1675,12 @@ void create_awareness_event(object *objp, int type) } } -byte New_awareness[MAX_SEGMENTS]; +byte New_awareness[MAX_SEGMENTS]; // ---------------------------------------------------------------------------------- void pae_aux(int segnum, int type, int level) { - int j; + int j; if (New_awareness[segnum] < type) New_awareness[segnum] = type; @@ -1441,7 +1703,7 @@ void pae_aux(int segnum, int type, int level) // ---------------------------------------------------------------------------------- void process_awareness_events(void) { - int i; + int i; if (!(Game_mode & GM_MULTI) || (Game_mode & GM_MULTI_ROBOTS)) { memset(New_awareness, 0, sizeof(New_awareness[0]) * (Highest_segment_index+1)); @@ -1457,7 +1719,7 @@ void process_awareness_events(void) // ---------------------------------------------------------------------------------- void set_player_awareness_all(void) { - int i; + int i; process_awareness_events(); @@ -1468,23 +1730,23 @@ void set_player_awareness_all(void) Ai_local_info[i].player_awareness_time = PLAYER_AWARENESS_INITIAL_TIME; } - // Clear the bit that says this robot is only awake because a camera woke it up. + // Clear the bit that says this robot is only awake because a camera woke it up. if (New_awareness[Objects[i].segnum] > Ai_local_info[i].player_awareness_type) Objects[i].ctype.ai_info.SUB_FLAGS &= ~SUB_FLAGS_CAMERA_AWAKE; } } #ifndef NDEBUG -int Ai_dump_enable = 0; +int Ai_dump_enable = 0; FILE *Ai_dump_file = NULL; -char Ai_error_message[128] = ""; +char Ai_error_message[128] = ""; // ---------------------------------------------------------------------------------- void force_dump_ai_objects_all(char *msg) { - int tsave; + int tsave; tsave = Ai_dump_enable; @@ -1511,9 +1773,9 @@ void turn_off_ai_dump(void) extern void do_boss_dying_frame(object *objp); // ---------------------------------------------------------------------------------- -// Do things which need to get done for all AI objects each frame. -// This includes: -// Setting player_awareness (a fix, time in seconds which object is aware of player) +// Do things which need to get done for all AI objects each frame. +// This includes: +// Setting player_awareness (a fix, time in seconds which object is aware of player) void do_ai_frame_all(void) { #ifndef NDEBUG @@ -1523,9 +1785,9 @@ void do_ai_frame_all(void) set_player_awareness_all(); if (Ai_last_missile_camera != -1) { - // Clear if supposed misisle camera is not a weapon, or just every so often, just in case. + // Clear if supposed misisle camera is not a weapon, or just every so often, just in case. if (((FrameCount & 0x0f) == 0) || (Objects[Ai_last_missile_camera].type != OBJ_WEAPON)) { - int i; + int i; Ai_last_missile_camera = -1; for (i=0; i<=Highest_object_index; i++) @@ -1534,9 +1796,9 @@ void do_ai_frame_all(void) } } - // (Moved here from do_boss_stuff() because that only gets called if robot aware of player.) + // (Moved here from do_boss_stuff() because that only gets called if robot aware of player.) if (Boss_dying) { - int i; + int i; for (i=0; i<=Highest_object_index; i++) if (Objects[i].type == OBJ_ROBOT) @@ -1549,12 +1811,12 @@ void do_ai_frame_all(void) extern int Final_boss_is_dead; extern fix Boss_invulnerable_dot; -// Initializations to be performed for all robots for a new level. +// Initializations to be performed for all robots for a new level. void init_robots_for_level(void) { Overall_agitation = 0; - Final_boss_is_dead=0; - + Final_boss_is_dead=0; + Buddy_objnum = 0; Buddy_allowed_to_talk = 0; @@ -1636,7 +1898,7 @@ int ai_restore_state( FILE * fp, int version ) fread( &Escort_goal_index, sizeof(Escort_goal_index), 1, fp); fread( &Stolen_items, sizeof(Stolen_items[0])*MAX_STOLEN_ITEMS, 1, fp); } else { - int i; + int i; Escort_kill_object = -1; Escort_last_path_created = 0; @@ -1651,7 +1913,7 @@ int ai_restore_state( FILE * fp, int version ) } if (version >= 15) { - int temp; + int temp; fread( &temp, sizeof(int), 1, fp ); Point_segs_free_ptr = &Point_segs[temp]; } else @@ -1671,10 +1933,9 @@ int ai_restore_state( FILE * fp, int version ) // -- Num_boss_gate_segs = 1; // -- Boss_teleport_segs[0] = 0; // -- Boss_gate_segs[0] = 0; - // Note: Maybe better to leave alone...will probably be ok. + // Note: Maybe better to leave alone...will probably be ok. mprintf((1, "Warning: If you fight the boss, he might teleport to segment #0!\n")); } - return 1; } diff --git a/main/ai.h b/main/ai.h index 4b82901a..efb00fd7 100644 --- a/main/ai.h +++ b/main/ai.h @@ -1,3 +1,4 @@ +/* $Id: ai.h,v 1.3 2003-03-14 21:24:03 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -7,10 +8,142 @@ IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS -AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. +AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ +/* + * + * Header file for AI system. + * + * Old Log: + * Revision 1.3 1995/10/15 16:28:07 allender + * added flag to player_is_visible function + * + * Revision 1.2 1995/10/10 11:48:32 allender + * PC ai header + * + * Revision 1.1 1995/05/16 15:54:00 allender + * Initial revision + * + * Revision 2.0 1995/02/27 11:33:07 john + * New version 2.0, which has no anonymous unions, builds with + * Watcom 10.0, and doesn't require parsing BITMAPS.TBL. + * + * Revision 1.57 1995/02/04 17:28:31 mike + * make station guys return better. + * + * Revision 1.56 1995/02/04 10:03:23 mike + * Fly to exit cheat. + * + * Revision 1.55 1995/02/01 19:23:52 rob + * Externed a boss var. + * + * Revision 1.54 1995/01/30 13:00:58 mike + * Make robots fire at player other than one they are controlled by sometimes. + * + * Revision 1.53 1995/01/26 15:09:16 rob + * Changed robot gating to accomodate multiplayer. + * + * Revision 1.52 1995/01/26 12:23:12 rob + * Added new externs needed for multiplayer. + * + * Revision 1.51 1995/01/21 21:22:14 mike + * Kill prototype of init_boss_segments, which didn't need to be public + * and had changed. + * + * Revision 1.50 1995/01/16 19:24:29 mike + * Publicize BOSS_GATE_MATCEN_NUM and Boss_been_hit. + * + * Revision 1.49 1995/01/02 16:17:35 mike + * prototype some super boss function for gameseq. + * + * Revision 1.48 1994/12/19 17:08:06 mike + * deal with new ai_multiplayer_awareness which returns a value saying whether this object can be moved by this player. + * + * Revision 1.47 1994/12/12 17:18:04 mike + * make boss cloak/teleport when get hit, make quad laser 3/4 as powerful. + * + * Revision 1.46 1994/12/08 15:46:16 mike + * better robot behavior. + * + * Revision 1.45 1994/11/27 23:16:08 matt + * Made debug code go away when debugging turned off + * + * Revision 1.44 1994/11/16 23:38:41 mike + * new improved boss teleportation behavior. + * + * Revision 1.43 1994/11/10 17:45:11 mike + * debugging. + * + * Revision 1.42 1994/11/07 10:37:42 mike + * hooks for rob's network code. + * + * Revision 1.41 1994/11/06 15:10:50 mike + * prototype a debug function for dumping ai info. + * + * Revision 1.40 1994/11/02 17:57:30 rob + * Added extern of Believe_player_pos needed to get control centers + * locating people. + * + * Revision 1.39 1994/10/28 19:43:39 mike + * Prototype Boss_cloak_start_time, Boss_cloak_end_time. + * + * Revision 1.38 1994/10/22 14:14:42 mike + * Prototype ai_reset_all_paths. + * + * Revision 1.37 1994/10/21 20:42:01 mike + * Define MAX_PATH_LENGTH: maximum allowed length of a path. + * + * Revision 1.36 1994/10/20 09:49:18 mike + * Prototype something. + * + * + * Revision 1.35 1994/10/18 15:37:52 mike + * Define ROBOT_BOSS1. + * + * Revision 1.34 1994/10/13 11:12:25 mike + * Prototype some door functions. + * + * Revision 1.33 1994/10/12 21:28:51 mike + * Prototype create_n_segment_path_to_door + * Prototype ai_open_doors_in_segment + * Prototype ai_door_is_openable. + * + * Revision 1.32 1994/10/11 15:59:41 mike + * Prototype Robot_firing_enabled. + * + * Revision 1.31 1994/10/09 22:02:48 mike + * Adapt create_path_points and create_n_segment_path prototypes to use avoid_seg for player evasion. + * + * Revision 1.30 1994/09/18 18:07:44 mike + * Update prototypes for create_path_points and create_path_to_player. + * + * Revision 1.29 1994/09/15 16:34:08 mike + * Prototype do_ai_robot_hit_attack. + * + * Revision 1.28 1994/09/12 19:12:35 mike + * Prototype attempt_to_resume_path. + * + * Revision 1.27 1994/08/25 21:55:32 mike + * Add some prototypes. + * + * Revision 1.26 1994/08/10 19:53:24 mike + * Prototype create_path_to_player and init_robots_for_level. + * + * Revision 1.25 1994/08/04 16:32:58 mike + * prototype create_path_to_player. + * + * Revision 1.24 1994/08/03 15:17:20 mike + * Prototype make_random_vector. + * + * Revision 1.23 1994/07/31 18:10:34 mike + * Update prototype for create_path_points. + * + * Revision 1.22 1994/07/28 12:36:14 matt + * Cleaned up object bumping code + * + */ #ifndef _AI_H #define _AI_H @@ -21,45 +154,45 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "fvi.h" #include "robot.h" -#define PLAYER_AWARENESS_INITIAL_TIME (3*F1_0) -#define MAX_PATH_LENGTH 30 // Maximum length of path in ai path following. -#define MAX_DEPTH_TO_SEARCH_FOR_PLAYER 10 -#define BOSS_GATE_MATCEN_NUM -1 -#define MAX_BOSS_TELEPORT_SEGS 100 -#define BOSS_ECLIP_NUM 53 +#define PLAYER_AWARENESS_INITIAL_TIME (3*F1_0) +#define MAX_PATH_LENGTH 30 // Maximum length of path in ai path following. +#define MAX_DEPTH_TO_SEARCH FOR_PLAYER 10 +#define BOSS_GATE_MATCEN_NUM -1 +#define MAX_BOSS_TELEPORT_SEGS 100 +#define BOSS_ECLIP_NUM 53 -#define ROBOT_BRAIN 7 -#define ROBOT_BOSS1 17 +#define ROBOT_BRAIN 7 +#define ROBOT_BOSS1 17 #define ROBOT_FIRE_AGITATION 94 -#define BOSS_D2 21 // Minimum D2 boss value. -#define BOSS_COOL 21 -#define BOSS_WATER 22 -#define BOSS_FIRE 23 -#define BOSS_ICE 24 -#define BOSS_ALIEN1 25 -#define BOSS_ALIEN2 26 - -#define NUM_D2_BOSSES 8 - -extern ubyte Boss_teleports[NUM_D2_BOSSES]; // Set byte if this boss can teleport -extern ubyte Boss_spew_more[NUM_D2_BOSSES]; // Set byte if this boss can teleport -//extern ubyte Boss_cloaks[NUM_D2_BOSSES]; // Set byte if this boss can cloak -extern ubyte Boss_spews_bots_energy[NUM_D2_BOSSES]; // Set byte if boss spews bots when hit by energy weapon. -extern ubyte Boss_spews_bots_matter[NUM_D2_BOSSES]; // Set byte if boss spews bots when hit by matter weapon. -extern ubyte Boss_invulnerable_energy[NUM_D2_BOSSES]; // Set byte if boss is invulnerable to energy weapons. -extern ubyte Boss_invulnerable_matter[NUM_D2_BOSSES]; // Set byte if boss is invulnerable to matter weapons. -extern ubyte Boss_invulnerable_spot[NUM_D2_BOSSES]; // Set byte if boss is invulnerable in all but a certain spot. (Dot product fvec|vec_to_collision < BOSS_INVULNERABLE_DOT) +#define BOSS_D2 21 // Minimum D2 boss value. +#define BOSS_COOL 21 +#define BOSS_WATER 22 +#define BOSS_FIRE 23 +#define BOSS_ICE 24 +#define BOSS_ALIEN1 25 +#define BOSS_ALIEN2 26 + +#define NUM_D2_BOSSES 8 + +extern ubyte Boss_teleports[NUM_D2_BOSSES]; // Set byte if this boss can teleport +extern ubyte Boss_spew_more[NUM_D2_BOSSES]; // Set byte if this boss can teleport +//extern ubyte Boss_cloaks[NUM_D2_BOSSES]; // Set byte if this boss can cloak +extern ubyte Boss_spews_bots_energy[NUM_D2_BOSSES]; // Set byte if boss spews bots when hit by energy weapon. +extern ubyte Boss_spews_bots_matter[NUM_D2_BOSSES]; // Set byte if boss spews bots when hit by matter weapon. +extern ubyte Boss_invulnerable_energy[NUM_D2_BOSSES]; // Set byte if boss is invulnerable to energy weapons. +extern ubyte Boss_invulnerable_matter[NUM_D2_BOSSES]; // Set byte if boss is invulnerable to matter weapons. +extern ubyte Boss_invulnerable_spot[NUM_D2_BOSSES]; // Set byte if boss is invulnerable in all but a certain spot. (Dot product fvec|vec_to_collision < BOSS_INVULNERABLE_DOT) extern fix Boss_cloak_start_time, Boss_cloak_end_time; -extern int Num_boss_teleport_segs; -extern short Boss_teleport_segs[MAX_BOSS_TELEPORT_SEGS]; -extern fix Last_teleport_time; -extern fix Boss_cloak_duration; +extern int Num_boss_teleport_segs; +extern short Boss_teleport_segs[MAX_BOSS_TELEPORT_SEGS]; +extern fix Last_teleport_time; +extern fix Boss_cloak_duration; -extern ai_local Ai_local_info[MAX_OBJECTS]; -extern vms_vector Believed_player_pos; +extern ai_local Ai_local_info[MAX_OBJECTS]; +extern vms_vector Believed_player_pos; extern int Believed_player_seg; extern void move_towards_segment_center(object *objp); @@ -72,7 +205,7 @@ extern void ai_move_one(object *objp); extern void do_ai_frame(object *objp); extern void init_ai_object(int objnum, int initial_mode, int hide_segment); extern void update_player_awareness(object *objp, fix new_awareness); -extern void create_awareness_event(object *objp, int type); // object *objp can create awareness of player, amount based on "type" +extern void create_awareness_event(object *objp, int type); // object *objp can create awareness of player, amount based on "type" extern void do_ai_frame_all(void); extern void init_ai_system(void); extern void reset_ai_states(object *objp); @@ -95,20 +228,20 @@ extern int ready_to_fire(robot_info *robptr, ai_local *ailp); extern int polish_path(object *objp, point_seg *psegs, int num_points); extern void move_towards_player(object *objp, vms_vector *vec_to_player); -// max_length is maximum depth of path to create. -// If -1, use default: MAX_DEPTH_TO_SEARCH_FOR_PLAYER +// max_length is maximum depth of path to create. +// If -1, use default: MAX_DEPTH_TO_SEARCH_FOR_PLAYER extern void create_path_to_player(object *objp, int max_length, int safety_flag); extern void attempt_to_resume_path(object *objp); -// When a robot and a player collide, some robots attack! +// When a robot and a player collide, some robots attack! extern void do_ai_robot_hit_attack(object *robot, object *player, vms_vector *collision_point); extern void ai_open_doors_in_segment(object *robot); extern int ai_door_is_openable(object *objp, segment *segp, int sidenum); extern int player_is_visible_from_object(object *objp, vms_vector *pos, fix field_of_view, vms_vector *vec_to_player); -extern void ai_reset_all_paths(void); // Reset all paths. Call at the start of a level. +extern void ai_reset_all_paths(void); // Reset all paths. Call at the start of a level. extern int ai_multiplayer_awareness(object *objp, int awareness_level); -// In escort.c +// In escort.c extern void do_escort_frame(object *objp, fix dist_to_player, int player_visibility); extern void do_snipe_frame(object *objp, fix dist_to_player, int player_visibility, vms_vector *vec_to_player); extern void do_thief_frame(object *objp, fix dist_to_player, int player_visibility, vms_vector *vec_to_player); @@ -124,167 +257,167 @@ extern void ai_init_boss_for_ship(void); extern int Boss_been_hit; extern fix AI_proc_time; -// Stuff moved from ai.c by MK on 05/25/95. -#define ANIM_RATE (F1_0/16) -#define DELTA_ANG_SCALE 16 +// Stuff moved from ai.c by MK on 05/25/95. +#define ANIM_RATE (F1_0/16) +#define DELTA_ANG_SCALE 16 -#define OVERALL_AGITATION_MAX 100 -#define MAX_AI_CLOAK_INFO 8 // Must be a power of 2! +#define OVERALL_AGITATION_MAX 100 +#define MAX_AI_CLOAK_INFO 8 // Must be a power of 2! typedef struct { - fix last_time; - int last_segment; - vms_vector last_position; + fix last_time; + int last_segment; + vms_vector last_position; } ai_cloak_info; -#define BOSS_CLOAK_DURATION (F1_0*7) -#define BOSS_DEATH_DURATION (F1_0*6) +#define BOSS_CLOAK_DURATION (F1_0*7) +#define BOSS_DEATH_DURATION (F1_0*6) -#define CHASE_TIME_LENGTH (F1_0*8) -#define DEFAULT_ROBOT_SOUND_VOLUME F1_0 +#define CHASE_TIME_LENGTH (F1_0*8) +#define DEFAULT_ROBOT_SOUND_VOLUME F1_0 -extern fix Dist_to_last_fired_upon_player_pos; -extern vms_vector Last_fired_upon_player_pos; -extern int Laser_rapid_fire; +extern fix Dist_to_last_fired_upon_player_pos; +extern vms_vector Last_fired_upon_player_pos; +extern int Laser_rapid_fire; -#define MAX_AWARENESS_EVENTS 64 +#define MAX_AWARENESS_EVENTS 64 typedef struct awareness_event { - short segnum; // segment the event occurred in - short type; // type of event, defines behavior - vms_vector pos; // absolute 3 space location of event + short segnum; // segment the event occurred in + short type; // type of event, defines behavior + vms_vector pos; // absolute 3 space location of event } awareness_event; -#define AIS_MAX 8 -#define AIE_MAX 4 - -#define ESCORT_GOAL_UNSPECIFIED -1 - -#define ESCORT_GOAL_UNSPECIFIED -1 -#define ESCORT_GOAL_BLUE_KEY 1 -#define ESCORT_GOAL_GOLD_KEY 2 -#define ESCORT_GOAL_RED_KEY 3 -#define ESCORT_GOAL_CONTROLCEN 4 -#define ESCORT_GOAL_EXIT 5 - -// Custom escort goals. -#define ESCORT_GOAL_ENERGY 6 -#define ESCORT_GOAL_ENERGYCEN 7 -#define ESCORT_GOAL_SHIELD 8 -#define ESCORT_GOAL_POWERUP 9 -#define ESCORT_GOAL_ROBOT 10 -#define ESCORT_GOAL_HOSTAGE 11 -#define ESCORT_GOAL_PLAYER_SPEW 12 -#define ESCORT_GOAL_SCRAM 13 -#define ESCORT_GOAL_EXIT2 14 -#define ESCORT_GOAL_BOSS 15 -#define ESCORT_GOAL_MARKER1 16 -#define ESCORT_GOAL_MARKER2 17 -#define ESCORT_GOAL_MARKER3 18 -#define ESCORT_GOAL_MARKER4 19 -#define ESCORT_GOAL_MARKER5 20 -#define ESCORT_GOAL_MARKER6 21 -#define ESCORT_GOAL_MARKER7 22 -#define ESCORT_GOAL_MARKER8 23 -#define ESCORT_GOAL_MARKER9 24 - -#define MAX_ESCORT_GOALS 25 - -#define MAX_ESCORT_DISTANCE (F1_0*80) -#define MIN_ESCORT_DISTANCE (F1_0*40) - -#define FUELCEN_CHECK 1000 - -extern fix Escort_last_path_created; -extern int Escort_goal_object, Escort_special_goal, Escort_goal_index; - -#define GOAL_WIDTH 11 - -#define SNIPE_RETREAT_TIME (F1_0*5) -#define SNIPE_ABORT_RETREAT_TIME (SNIPE_RETREAT_TIME/2) // Can abort a retreat with this amount of time left in retreat -#define SNIPE_ATTACK_TIME (F1_0*10) -#define SNIPE_WAIT_TIME (F1_0*5) -#define SNIPE_FIRE_TIME (F1_0*2) - -#define THIEF_PROBABILITY 16384 // 50% chance of stealing an item at each attempt -#define MAX_STOLEN_ITEMS 10 // Maximum number kept track of, will keep stealing, causes stolen weapons to be lost! - -extern int Max_escort_length; -extern int Escort_kill_object; +#define AIS_MAX 8 +#define AIE_MAX 4 + +#define ESCORT_GOAL_UNSPECIFIED -1 + +#define ESCORT_GOAL_UNSPECIFIED -1 +#define ESCORT_GOAL_BLUE_KEY 1 +#define ESCORT_GOAL_GOLD_KEY 2 +#define ESCORT_GOAL_RED_KEY 3 +#define ESCORT_GOAL_CONTROLCEN 4 +#define ESCORT_GOAL_EXIT 5 + +// Custom escort goals. +#define ESCORT_GOAL_ENERGY 6 +#define ESCORT_GOAL_ENERGYCEN 7 +#define ESCORT_GOAL_SHIELD 8 +#define ESCORT_GOAL_POWERUP 9 +#define ESCORT_GOAL_ROBOT 10 +#define ESCORT_GOAL_HOSTAGE 11 +#define ESCORT_GOAL_PLAYER_SPEW 12 +#define ESCORT_GOAL_SCRAM 13 +#define ESCORT_GOAL_EXIT2 14 +#define ESCORT_GOAL_BOSS 15 +#define ESCORT_GOAL_MARKER1 16 +#define ESCORT_GOAL_MARKER2 17 +#define ESCORT_GOAL_MARKER3 18 +#define ESCORT_GOAL_MARKER4 19 +#define ESCORT_GOAL_MARKER5 20 +#define ESCORT_GOAL_MARKER6 21 +#define ESCORT_GOAL_MARKER7 22 +#define ESCORT_GOAL_MARKER8 23 +#define ESCORT_GOAL_MARKER9 24 + +#define MAX_ESCORT_GOALS 25 + +#define MAX_ESCORT_DISTANCE (F1_0*80) +#define MIN_ESCORT_DISTANCE (F1_0*40) + +#define FUELCEN_CHECK 1000 + +extern fix Escort_last_path_created; +extern int Escort_goal_object, Escort_special_goal, Escort_goal_index; + +#define GOAL_WIDTH 11 + +#define SNIPE_RETREAT_TIME (F1_0*5) +#define SNIPE_ABORT_RETREAT_TIME (SNIPE_RETREAT_TIME/2) // Can abort a retreat with this amount of time left in retreat +#define SNIPE_ATTACK_TIME (F1_0*10) +#define SNIPE_WAIT_TIME (F1_0*5) +#define SNIPE_FIRE_TIME (F1_0*2) + +#define THIEF_PROBABILITY 16384 // 50% chance of stealing an item at each attempt +#define MAX_STOLEN_ITEMS 10 // Maximum number kept track of, will keep stealing, causes stolen weapons to be lost! + +extern int Max_escort_length; +extern int Escort_kill_object; extern ubyte Stolen_items[MAX_STOLEN_ITEMS]; -extern fix Escort_last_path_created; -extern int Escort_goal_object, Escort_special_goal, Escort_goal_index; +extern fix Escort_last_path_created; +extern int Escort_goal_object, Escort_special_goal, Escort_goal_index; -extern void create_buddy_bot(void); +extern void create_buddy_bot(void); -extern int Max_escort_length; +extern int Max_escort_length; -extern char *Escort_goal_text[MAX_ESCORT_GOALS]; +extern char *Escort_goal_text[MAX_ESCORT_GOALS]; -extern void ai_multi_send_robot_position(int objnum, int force); +extern void ai_multi_send_robot_position(int objnum, int force); -extern int Flinch_scale; -extern int Attack_scale; -extern byte Mike_to_matt_xlate[]; +extern int Flinch_scale; +extern int Attack_scale; +extern byte Mike_to_matt_xlate[]; -// Amount of time since the current robot was last processed for things such as movement. -// It is not valid to use FrameTime because robots do not get moved every frame. +// Amount of time since the current robot was last processed for things such as movement. +// It is not valid to use FrameTime because robots do not get moved every frame. -extern int Num_boss_teleport_segs; +extern int Num_boss_teleport_segs; extern short Boss_teleport_segs[]; -extern int Num_boss_gate_segs; -extern short Boss_gate_segs[]; - - -// ---------- John: These variables must be saved as part of gamesave. ---------- -extern int Ai_initialized; -extern int Overall_agitation; -extern ai_local Ai_local_info[MAX_OBJECTS]; -extern point_seg Point_segs[MAX_POINT_SEGS]; -extern point_seg *Point_segs_free_ptr; -extern ai_cloak_info Ai_cloak_info[MAX_AI_CLOAK_INFO]; -extern fix Boss_cloak_start_time; -extern fix Boss_cloak_end_time; -extern fix Last_teleport_time; -extern fix Boss_teleport_interval; -extern fix Boss_cloak_interval; // Time between cloaks -extern fix Boss_cloak_duration; -extern fix Last_gate_time; -extern fix Gate_interval; -extern fix Boss_dying_start_time; -extern byte Boss_dying, Boss_dying_sound_playing; -extern fix Boss_hit_time; -// -- extern int Boss_been_hit; -// ---------- John: End of variables which must be saved as part of gamesave. ---------- - -extern int ai_evaded; - -extern byte Super_boss_gate_list[]; -#define MAX_GATE_INDEX 25 - -extern int Ai_info_enabled; -extern int Robot_firing_enabled; - - -// These globals are set by a call to find_vector_intersection, which is a slow routine, -// so we don't want to call it again (for this object) unless we have to. -extern vms_vector Hit_pos; -extern int Hit_type, Hit_seg; -extern fvi_info Hit_data; - -extern int Num_awareness_events; -extern awareness_event Awareness_events[MAX_AWARENESS_EVENTS]; - -extern vms_vector Believed_player_pos; +extern int Num_boss_gate_segs; +extern short Boss_gate_segs[]; + + +// --------- John: These variables must be saved as part of gamesave. --------- +extern int Ai_initialized; +extern int Overall_agitation; +extern ai_local Ai_local_info[MAX_OBJECTS]; +extern point_seg Point_segs[MAX_POINT_SEGS]; +extern point_seg *Point_segs_free_ptr; +extern ai_cloak_info Ai_cloak_info[MAX_AI_CLOAK_INFO]; +extern fix Boss_cloak_start_time; +extern fix Boss_cloak_end_time; +extern fix Last_teleport_time; +extern fix Boss_teleport_interval; +extern fix Boss_cloak_interval; // Time between cloaks +extern fix Boss_cloak_duration; +extern fix Last_gate_time; +extern fix Gate_interval; +extern fix Boss_dying_start_time; +extern byte Boss_dying, Boss_dying_sound_playing; +extern fix Boss_hit_time; +// -- extern int Boss_been_hit; +// ------ John: End of variables which must be saved as part of gamesave. ----- + +extern int ai_evaded; + +extern byte Super_boss_gate_list[]; +#define MAX_GATE_INDEX 25 + +extern int Ai_info_enabled; +extern int Robot_firing_enabled; + + +// These globals are set by a call to find_vector_intersection, which is a slow routine, +// so we don't want to call it again (for this object) unless we have to. +extern vms_vector Hit_pos; +extern int Hit_type, Hit_seg; +extern fvi_info Hit_data; + +extern int Num_awareness_events; +extern awareness_event Awareness_events[MAX_AWARENESS_EVENTS]; + +extern vms_vector Believed_player_pos; #ifndef NDEBUG -// Index into this array with ailp->mode -extern char *mode_text[18]; +// Index into this array with ailp->mode +extern char *mode_text[18]; -// Index into this array with aip->behavior -extern char behavior_text[6][9]; +// Index into this array with aip->behavior +extern char behavior_text[6][9]; -// Index into this array with aip->GOAL_STATE or aip->CURRENT_STATE -extern char state_text[8][5]; +// Index into this array with aip->GOAL_STATE or aip->CURRENT_STATE +extern char state_text[8][5]; extern int Do_ai_flag, Break_on_object; @@ -292,7 +425,7 @@ extern void mprintf_animation_info(object *objp); #endif //ifndef NDEBUG -extern int Stolen_item_index; // Used in ai.c for controlling rate of Thief flare firing. +extern int Stolen_item_index; // Used in ai.c for controlling rate of Thief flare firing. extern void ai_frame_animation(object *objp); extern int do_silly_animation(object *objp); @@ -315,20 +448,18 @@ extern void create_bfs_list(int start_seg, short bfs_list[], int *length, int ma extern void init_thief_for_level(); - - extern int Escort_goal_object; extern int ai_save_state( FILE * fp ); extern int ai_restore_state( FILE * fp, int version ); -extern int Buddy_objnum, Buddy_allowed_to_talk; +extern int Buddy_objnum, Buddy_allowed_to_talk; extern void start_robot_death_sequence(object *objp); extern int do_any_robot_dying_frame(object *objp); extern void buddy_message(char * format, ... ); -#define SPECIAL_REACTOR_ROBOT 65 +#define SPECIAL_REACTOR_ROBOT 65 extern void special_reactor_stuff(void); -#endif +#endif /* _AI_H */ diff --git a/main/bm.h b/main/bm.h index 177f48cd..989bfecb 100644 --- a/main/bm.h +++ b/main/bm.h @@ -1,3 +1,4 @@ +/* $Id: bm.h,v 1.7 2003-03-14 21:24:03 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -7,7 +8,7 @@ IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS -AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. +AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ @@ -17,27 +18,27 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "gr.h" #include "piggy.h" -#define MAX_TEXTURES 1200 +#define MAX_TEXTURES 1200 //tmapinfo flags -#define TMI_VOLATILE 1 //this material blows up when hit -#define TMI_WATER 2 //this material is water -#define TMI_FORCE_FIELD 4 //this is force field - flares don't stick -#define TMI_GOAL_BLUE 8 //this is used to remap the blue goal -#define TMI_GOAL_RED 16 //this is used to remap the red goal -#define TMI_GOAL_HOARD 32 //this is used to remap the goals +#define TMI_VOLATILE 1 //this material blows up when hit +#define TMI_WATER 2 //this material is water +#define TMI_FORCE_FIELD 4 //this is force field - flares don't stick +#define TMI_GOAL_BLUE 8 //this is used to remap the blue goal +#define TMI_GOAL_RED 16 //this is used to remap the red goal +#define TMI_GOAL_HOARD 32 //this is used to remap the goals typedef struct { - ubyte flags; //values defined above - ubyte pad[3]; //keep alignment - fix lighting; //how much light this casts - fix damage; //how much damage being against this does (for lava) - short eclip_num; //the eclip that changes this, or -1 - short destroyed; //bitmap to show when destroyed, or -1 - short slide_u,slide_v; //slide rates of texture, stored in 8:8 fix + ubyte flags; //values defined above + ubyte pad[3]; //keep alignment + fix lighting; //how much light this casts + fix damage; //how much damage being against this does (for lava) + short eclip_num; //the eclip that changes this, or -1 + short destroyed; //bitmap to show when destroyed, or -1 + short slide_u,slide_v; //slide rates of texture, stored in 8:8 fix #ifdef EDITOR - char filename[13]; //used by editor to remap textures - char pad2[3]; + char filename[13]; //used by editor to remap textures + char pad2[3]; #endif } __pack__ tmap_info; @@ -68,23 +69,23 @@ void bm_close(); // Initializes the Texture[] array of bmd_bitmap structures. void init_textures(); -#define OL_ROBOT 1 -#define OL_HOSTAGE 2 -#define OL_POWERUP 3 -#define OL_CONTROL_CENTER 4 -#define OL_PLAYER 5 -#define OL_CLUTTER 6 //some sort of misc object -#define OL_EXIT 7 //the exit model for external scenes -#define OL_WEAPON 8 //a weapon that can be placed +#define OL_ROBOT 1 +#define OL_HOSTAGE 2 +#define OL_POWERUP 3 +#define OL_CONTROL_CENTER 4 +#define OL_PLAYER 5 +#define OL_CLUTTER 6 //some sort of misc object +#define OL_EXIT 7 //the exit model for external scenes +#define OL_WEAPON 8 //a weapon that can be placed -#define MAX_OBJTYPE 140 +#define MAX_OBJTYPE 140 -extern int Num_total_object_types; // Total number of object types, including robots, hostages, powerups, control centers, faces -extern byte ObjType[MAX_OBJTYPE]; // Type of an object, such as Robot, eg if ObjType[11] == OL_ROBOT, then object #11 is a robot -extern byte ObjId[MAX_OBJTYPE]; // ID of a robot, within its class, eg if ObjType[11] == 3, then object #11 is the third robot -extern fix ObjStrength[MAX_OBJTYPE]; // initial strength of each object +extern int Num_total_object_types; // Total number of object types, including robots, hostages, powerups, control centers, faces +extern byte ObjType[MAX_OBJTYPE]; // Type of an object, such as Robot, eg if ObjType[11] == OL_ROBOT, then object #11 is a robot +extern byte ObjId[MAX_OBJTYPE]; // ID of a robot, within its class, eg if ObjType[11] == 3, then object #11 is the third robot +extern fix ObjStrength[MAX_OBJTYPE]; // initial strength of each object -#define MAX_OBJ_BITMAPS 610 +#define MAX_OBJ_BITMAPS 610 extern bitmap_index ObjBitmaps[MAX_OBJ_BITMAPS]; extern ushort ObjBitmapPtrs[MAX_OBJ_BITMAPS]; @@ -98,5 +99,4 @@ extern void bm_read_all(CFILE * fp); int load_exit_models(); void free_exit_model_data(); -#endif - +#endif /* _BM_H */ diff --git a/main/crypt.c b/main/crypt.c index 7a72842c..9ef7ec2a 100644 --- a/main/crypt.c +++ b/main/crypt.c @@ -1,3 +1,4 @@ +/* $Id: crypt.c,v 1.3 2003-03-14 21:24:03 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -7,7 +8,7 @@ IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS -AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. +AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ @@ -16,44 +17,35 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #endif #ifdef RCS -char crypt_rcsid[] = "$Id: crypt.c,v 1.2 2001-01-31 15:17:50 bradleyb Exp $"; +char crypt_rcsid[] = "$Id: crypt.c,v 1.3 2003-03-14 21:24:03 btb Exp $"; #endif -#include -#include +//#include +//#include #include -#include "inferno.h" +//#include "inferno.h" char *jcrypt (char *plainstring) - { - int i,t,len; - static char cryptstring[20]; - - len=strlen (plainstring); - if (len>8) - len=8; - - for (i=0;i8) + len=8; + + for (i=0;i= N_players) || (owner < -1)) { Int3(); // Illegal! @@ -298,7 +284,7 @@ int objnum_remote_to_local(int remote_objnum, int owner) if (owner == -1) return(remote_objnum); - + if ((remote_objnum < 0) || (remote_objnum >= MAX_OBJECTS)) return(-1); @@ -315,8 +301,8 @@ int objnum_remote_to_local(int remote_objnum, int owner) { mprintf((1, "Remote object owner %d number %d doesn't match owner %d.\n", owner, remote_objnum, object_owner[result])); } -#endif -// Assert(object_owner[result] == owner); +#endif + //Assert(object_owner[result] == owner); return(result); } @@ -342,11 +328,11 @@ int objnum_local_to_remote(int local_objnum, byte *owner) *owner = -1; return local_objnum; } - + result = local_to_remote[local_objnum]; - -// mprintf((0, "Local object %d mapped to owner %d objnum %d.\n", local_objnum, -// *owner, result)); + + //mprintf((0, "Local object %d mapped to owner %d objnum %d.\n", local_objnum, + // *owner, result)); if (result < 0) { @@ -400,7 +386,7 @@ map_objnum_local_to_local(int local_objnum) void multi_endlevel_score(void) { - int old_connect=0; + int old_connect=0; int i; // Show a score list to end of net players @@ -411,9 +397,9 @@ multi_endlevel_score(void) { old_connect = Players[Player_num].connected; if (Players[Player_num].connected!=3) - Players[Player_num].connected = CONNECT_END_MENU; + Players[Player_num].connected = CONNECT_END_MENU; Network_status = NETSTAT_ENDLEVEL; - + } #endif @@ -421,7 +407,7 @@ multi_endlevel_score(void) Function_mode = FMODE_MENU; - kmatrix_view(Game_mode & GM_NETWORK); + kmatrix_view(Game_mode & GM_NETWORK); Function_mode = FMODE_GAME; @@ -429,30 +415,30 @@ multi_endlevel_score(void) if (Game_mode & GM_NETWORK) { - Players[Player_num].connected = old_connect; + Players[Player_num].connected = old_connect; } #ifndef SHAREWARE if (Game_mode & GM_MULTI_COOP) { - int i; + int i; for (i = 0; i < MaxNumNetPlayers; i++) - // Reset keys + // Reset keys Players[i].flags &= ~(PLAYER_FLAGS_BLUE_KEY | PLAYER_FLAGS_RED_KEY | PLAYER_FLAGS_GOLD_KEY); } for (i = 0; i < MaxNumNetPlayers; i++) - Players[i].flags &= ~(PLAYER_FLAGS_FLAG); // Clear capture flag - + Players[i].flags &= ~(PLAYER_FLAGS_FLAG); // Clear capture flag + #endif - for (i=0;i= MAX_NUM_NET_PLAYERS) || (playernum < 0)) { @@ -607,17 +593,17 @@ int multi_get_kill_list(int *plist) int n = 0; for (i = 0; i < N_players; i++) -// if (Players[sorted_kills[i]].connected) - plist[n++] = sorted_kills[i]; + //if (Players[sorted_kills[i]].connected) + plist[n++] = sorted_kills[i]; if (n == 0) Int3(); // SEE ROB OR MATT -// memcpy(plist, sorted_kills, N_players*sizeof(int)); + //memcpy(plist, sorted_kills, N_players*sizeof(int)); return(n); } - + void multi_sort_kill_list(void) { @@ -626,7 +612,7 @@ multi_sort_kill_list(void) int kills[MAX_NUM_NET_PLAYERS]; int i; int changed = 1; - + for (i = 0; i < MAX_NUM_NET_PLAYERS; i++) { #ifndef SHAREWARE @@ -635,13 +621,13 @@ multi_sort_kill_list(void) else #endif if (Show_kill_list==2) - { - if (Players[i].net_killed_total+Players[i].net_kills_total==0) - kills[i]=-1; // always draw the ones without any ratio last - else - kills[i]=(int)((float)((float)Players[i].net_kills_total/((float)Players[i].net_killed_total+(float)Players[i].net_kills_total))*100.0); - } - else + { + if (Players[i].net_killed_total+Players[i].net_kills_total==0) + kills[i]=-1; // always draw the ones without any ratio last + else + kills[i]=(int)((float)((float)Players[i].net_kills_total/((float)Players[i].net_killed_total+(float)Players[i].net_kills_total))*100.0); + } + else kills[i] = Players[i].net_kills_total; } @@ -659,7 +645,7 @@ multi_sort_kill_list(void) } } } - mprintf((0, "Sorted kills %d %d.\n", sorted_kills[0], sorted_kills[1])); + mprintf((0, "Sorted kills %d %d.\n", sorted_kills[0], sorted_kills[1])); } extern object *obj_find_first_of_type (int); @@ -677,9 +663,9 @@ void multi_compute_kill(int killer, int killed) char killer_name[(CALLSIGN_LEN*2)+4]; kmatrix_kills_changed = 1; - Multi_killed_yourself=0; - - // Both object numbers are localized already! + Multi_killed_yourself=0; + + // Both object numbers are localized already! mprintf((0, "compute_kill passed: object %d killed object %d.\n", killer, killed)); @@ -691,9 +677,9 @@ void multi_compute_kill(int killer, int killed) killed_type = Objects[killed].type; killer_type = Objects[killer].type; - killer_id = Objects[killer].id; + killer_id = Objects[killer].id; - if ((killed_type != OBJ_PLAYER) && (killed_type != OBJ_GHOST)) + if ((killed_type != OBJ_PLAYER) && (killed_type != OBJ_GHOST)) { Int3(); // compute_kill passed non-player object! return; @@ -701,7 +687,7 @@ void multi_compute_kill(int killer, int killed) killed_pnum = Objects[killed].id; - PKilledFlags[killed_pnum]=1; + PKilledFlags[killed_pnum]=1; Assert ((killed_pnum >= 0) && (killed_pnum < N_players)); @@ -715,8 +701,8 @@ void multi_compute_kill(int killer, int killed) digi_play_sample( SOUND_HUD_KILL, F3_0 ); - if (Control_center_destroyed) - Players[killed_pnum].connected=3; + if (Control_center_destroyed) + Players[killed_pnum].connected=3; if (killer_type == OBJ_CNTRLCEN) { @@ -727,37 +713,37 @@ void multi_compute_kill(int killer, int killed) newdemo_record_multi_kill(killed_pnum, -1); if (killed_pnum == Player_num) - { + { HUD_init_message("%s %s.", TXT_YOU_WERE, TXT_KILLED_BY_NONPLAY); multi_add_lifetime_killed (); - } + } else HUD_init_message("%s %s %s.", killed_name, TXT_WAS, TXT_KILLED_BY_NONPLAY ); - return; + return; } #ifndef SHAREWARE else if ((killer_type != OBJ_PLAYER) && (killer_type != OBJ_GHOST)) { - if (killer_id==PMINE_ID && killer_type!=OBJ_ROBOT) - { - if (killed_pnum == Player_num) + if (killer_id==PMINE_ID && killer_type!=OBJ_ROBOT) + { + if (killed_pnum == Player_num) HUD_init_message("You were killed by a mine!"); else HUD_init_message("%s was killed by a mine!",killed_name); - } + } else - { - if (killed_pnum == Player_num) - { - HUD_init_message("%s %s.", TXT_YOU_WERE, TXT_KILLED_BY_ROBOT); + { + if (killed_pnum == Player_num) + { + HUD_init_message("%s %s.", TXT_YOU_WERE, TXT_KILLED_BY_ROBOT); multi_add_lifetime_killed(); - } - else + } + else HUD_init_message("%s %s %s.", killed_name, TXT_WAS, TXT_KILLED_BY_ROBOT ); - } + } Players[killed_pnum].net_killed_total++; - return; + return; } #else else if ((killer_type != OBJ_PLAYER) && (killer_type != OBJ_GHOST) && (killer_id!=PMINE_ID)) @@ -765,17 +751,17 @@ void multi_compute_kill(int killer, int killed) Int3(); // Illegal killer type? return; } - if (killer_id==PMINE_ID) - { - if (killed_pnum==Player_num) - HUD_init_message("You were killed by a mine!"); - else - HUD_init_message("%s was killed by a mine!",killed_name); - - Players[killed_pnum].net_killed_total++; - - return; - } + if (killer_id==PMINE_ID) + { + if (killed_pnum==Player_num) + HUD_init_message("You were killed by a mine!"); + else + HUD_init_message("%s was killed by a mine!",killed_name); + + Players[killed_pnum].net_killed_total++; + + return; + } #endif killer_pnum = Objects[killer].id; @@ -794,7 +780,7 @@ void multi_compute_kill(int killer, int killed) if (killer_pnum == killed_pnum) { - if (!(Game_mode & GM_HOARD)) + if (!(Game_mode & GM_HOARD)) { if (Game_mode & GM_TEAM) team_kills[get_team(killed_pnum)] -= 1; @@ -808,11 +794,11 @@ void multi_compute_kill(int killer, int killed) kill_matrix[killed_pnum][killed_pnum] += 1; // # of suicides if (killer_pnum == Player_num) - { - HUD_init_message("%s %s %s!", TXT_YOU, TXT_KILLED, TXT_YOURSELF ); - Multi_killed_yourself=1; + { + HUD_init_message("%s %s %s!", TXT_YOU, TXT_KILLED, TXT_YOURSELF ); + Multi_killed_yourself=1; multi_add_lifetime_killed(); - } + } else HUD_init_message("%s %s", killed_name, TXT_SUICIDE); } @@ -843,7 +829,7 @@ void multi_compute_kill(int killer, int killed) Multi_killed_yourself=1; } } - + kill_matrix[killer_pnum][killed_pnum] += 1; Players[killed_pnum].net_killed_total += 1; if (killer_pnum == Player_num) { @@ -853,50 +839,50 @@ void multi_compute_kill(int killer, int killed) add_points_to_score(-1000); } else if (killed_pnum == Player_num) - { + { HUD_init_message("%s %s %s!", killer_name, TXT_KILLED, TXT_YOU); multi_add_lifetime_killed(); - if (Game_mode & GM_HOARD) - { + if (Game_mode & GM_HOARD) + { if (Players[Player_num].secondary_ammo[PROXIMITY_INDEX]>3) multi_send_play_by_play (1,killer_pnum,Player_num); else if (Players[Player_num].secondary_ammo[PROXIMITY_INDEX]>0) multi_send_play_by_play (0,killer_pnum,Player_num); - } - } + } + } else HUD_init_message("%s %s %s!", killer_name, TXT_KILLED, killed_name); } - TheGoal=Netgame.KillGoal*5; + TheGoal=Netgame.KillGoal*5; - if (Netgame.KillGoal>0) + if (Netgame.KillGoal>0) { - if (Players[killer_pnum].KillGoalCount>=TheGoal) - { - if (killer_pnum==Player_num) - { - HUD_init_message("You reached the kill goal!"); - Players[Player_num].shields=i2f(200); - } - else - HUD_init_message ("%s has reached the kill goal!",Players[killer_pnum].callsign); + if (Players[killer_pnum].KillGoalCount>=TheGoal) + { + if (killer_pnum==Player_num) + { + HUD_init_message("You reached the kill goal!"); + Players[Player_num].shields=i2f(200); + } + else + HUD_init_message ("%s has reached the kill goal!",Players[killer_pnum].callsign); - HUD_init_message ("The control center has been destroyed!"); - net_destroy_controlcen (obj_find_first_of_type (OBJ_CNTRLCEN)); - } + HUD_init_message ("The control center has been destroyed!"); + net_destroy_controlcen (obj_find_first_of_type (OBJ_CNTRLCEN)); + } } multi_sort_kill_list(); multi_show_player_list(); - Players[killed_pnum].flags&=(~(PLAYER_FLAGS_HEADLIGHT_ON)); // clear the killed guys flags/headlights + Players[killed_pnum].flags&=(~(PLAYER_FLAGS_HEADLIGHT_ON)); // clear the killed guys flags/headlights } void multi_do_frame(void) { - static int lasttime=0; - int i; + static int lasttime=0; + int i; if (!(Game_mode & GM_MULTI)) { @@ -904,18 +890,18 @@ multi_do_frame(void) return; } - if ((Game_mode & GM_NETWORK) && Netgame.PlayTimeAllowed && lasttime!=f2i (ThisLevelTime)) + if ((Game_mode & GM_NETWORK) && Netgame.PlayTimeAllowed && lasttime!=f2i (ThisLevelTime)) { - for (i=0;i= 0); + // Assert(buf[0] >= 0); if (Game_mode & GM_NETWORK) Assert(buf[0] > 0); @@ -966,8 +952,8 @@ void multi_leave_game(void) { -// if (Function_mode != FMODE_GAME) -// return; + // if (Function_mode != FMODE_GAME) + // return; if (!(Game_mode & GM_MULTI)) return; @@ -994,17 +980,17 @@ multi_leave_game(void) Game_mode |= GM_GAME_OVER; - if (Function_mode!=FMODE_EXIT) + if (Function_mode!=FMODE_EXIT) Function_mode = FMODE_MENU; -// N_players = 0; + // N_players = 0; -// change_playernum_to(0); -// Viewer = ConsoleObject = &Objects[0]; + // change_playernum_to(0); + // Viewer = ConsoleObject = &Objects[0]; } - -void + +void multi_show_player_list() { if (!(Game_mode & GM_MULTI) || (Game_mode & GM_MULTI_COOP)) @@ -1017,7 +1003,7 @@ multi_show_player_list() Show_kill_list = 1; } -int +int multi_endlevel(int *secret) { int result = 0; @@ -1026,8 +1012,8 @@ multi_endlevel(int *secret) com_endlevel(secret); // an opportunity to re-sync or whatever else if (Game_mode & GM_NETWORK) result = network_endlevel(secret); - - return(result); + + return(result); } // @@ -1039,7 +1025,7 @@ multi_endlevel(int *secret) //extern PORT *com_port; #endif -int +int multi_menu_poll(void) { fix old_shields; @@ -1061,12 +1047,12 @@ multi_menu_poll(void) multi_in_menu++; // Track level of menu nesting - GameLoop( 0, 0 ); + GameLoop( 0, 0 ); multi_in_menu--; - timer_delay(f1_0/10); // delay 100 milliseconds - + timer_delay(f0_1); // delay 100 milliseconds + if (Endlevel_sequence || (Control_center_destroyed && !was_fuelcen_alive) || (Player_is_dead != player_was_dead) || (Players[Player_num].shields < old_shields)) { multi_leave_menu = 1; @@ -1097,18 +1083,18 @@ multi_define_macro(int key) key &= (~KEY_SHIFTED); - switch(key) + switch(key) { - case KEY_F9: - multi_defining_message = 1; break; - case KEY_F10: - multi_defining_message = 2; break; - case KEY_F11: - multi_defining_message = 3; break; - case KEY_F12: - multi_defining_message = 4; break; - default: - Int3(); + case KEY_F9: + multi_defining_message = 1; break; + case KEY_F10: + multi_defining_message = 2; break; + case KEY_F11: + multi_defining_message = 3; break; + case KEY_F12: + multi_defining_message = 4; break; + default: + Int3(); } if (multi_defining_message) { @@ -1172,9 +1158,9 @@ multi_message_feedback(void) Assert(strlen(feedback_result) < 200); HUD_init_message(feedback_result); -// sprintf (temp,"%s",colon); -// sprintf (Network_message,"%s",temp); - + //sprintf (temp,"%s",colon); + //sprintf (Network_message,"%s",temp); + } } @@ -1184,18 +1170,18 @@ multi_send_macro(int key) if (! (Game_mode & GM_MULTI) ) return; - switch(key) + switch(key) { - case KEY_F9: - key = 0; break; - case KEY_F10: - key = 1; break; - case KEY_F11: - key = 2; break; - case KEY_F12: - key = 3; break; - default: - Int3(); + case KEY_F9: + key = 0; break; + case KEY_F10: + key = 1; break; + case KEY_F11: + key = 2; break; + case KEY_F12: + key = 3; break; + default: + Int3(); } if (!Network_message_macro[key][0]) @@ -1212,7 +1198,7 @@ multi_send_macro(int key) } -void +void multi_send_message_start() { if (Game_mode&GM_MULTI) { @@ -1235,38 +1221,38 @@ void network_dump_appletalk_player(ubyte node, ushort net, ubyte socket, int why void multi_send_message_end() { char *mytempbuf; - int i,t; - + int i,t; + Network_message_reciever = 100; if (!strnicmp (Network_message,"!Names",6)) - { - NameReturning=1-NameReturning; - HUD_init_message ("Name returning is now %s.",NameReturning?"active":"disabled"); - } + { + NameReturning=1-NameReturning; + HUD_init_message ("Name returning is now %s.",NameReturning?"active":"disabled"); + } else if (!strnicmp (Network_message,"Handicap:",9)) - { - mytempbuf=&Network_message[9]; - mprintf ((0,"Networkhandi=%s\n",mytempbuf)); - StartingShields=atol (mytempbuf); - if (StartingShields<10) + { + mytempbuf=&Network_message[9]; + mprintf ((0,"Networkhandi=%s\n",mytempbuf)); + StartingShields=atol (mytempbuf); + if (StartingShields<10) StartingShields=10; - if (StartingShields>100) - { - sprintf (Network_message,"%s has tried to cheat!",Players[Player_num].callsign); - StartingShields=100; - } - else + if (StartingShields>100) + { + sprintf (Network_message,"%s has tried to cheat!",Players[Player_num].callsign); + StartingShields=100; + } + else sprintf (Network_message,"%s handicap is now %d",Players[Player_num].callsign,StartingShields); - HUD_init_message ("Telling others of your handicap of %d!",StartingShields); - StartingShields=i2f(StartingShields); - } + HUD_init_message ("Telling others of your handicap of %d!",StartingShields); + StartingShields=i2f(StartingShields); + } else if (!strnicmp (Network_message,"NoBombs",7)) - Netgame.DoSmartMine=0; + Netgame.DoSmartMine=0; else if (!strnicmp (Network_message,"Ping:",5)) - { - if (Game_mode & GM_NETWORK) + { + if (Game_mode & GM_NETWORK) { int name_index=5; if (strlen(Network_message) > 5) @@ -1274,108 +1260,108 @@ void multi_send_message_end() name_index++; if (strlen(Network_message)<=name_index) - { + { HUD_init_message ("You must specify a name to ping"); return; - } + } for (i = 0; i < N_players; i++) - if ((!strnicmp(Players[i].callsign, &Network_message[name_index], strlen(Network_message)-name_index)) && (i != Player_num) && (Players[i].connected)) - { - PingLaunchTime=timer_get_fixed_seconds(); - network_send_ping (i); - HUD_init_message("Pinging %s...",Players[i].callsign); - multi_message_index = 0; - multi_sending_message = 0; - return; - } + if ((!strnicmp(Players[i].callsign, &Network_message[name_index], strlen(Network_message)-name_index)) && (i != Player_num) && (Players[i].connected)) + { + PingLaunchTime=timer_get_fixed_seconds(); + network_send_ping (i); + HUD_init_message("Pinging %s...",Players[i].callsign); + multi_message_index = 0; + multi_sending_message = 0; + return; + } } - else // Modem/Serial ping - { - PingLaunchTime=timer_get_fixed_seconds(); - multi_send_modem_ping (); - HUD_init_message("Pinging opponent..."); + else // Modem/Serial ping + { + PingLaunchTime=timer_get_fixed_seconds(); + multi_send_modem_ping (); + HUD_init_message("Pinging opponent..."); multi_message_index = 0; - multi_sending_message = 0; - return; - } - } + multi_sending_message = 0; + return; + } + } else if (!strnicmp (Network_message,"move:",5)) - { + { mprintf ((0,"moving?\n")); - - if ((Game_mode & GM_NETWORK) && (Game_mode & GM_TEAM)) + + if ((Game_mode & GM_NETWORK) && (Game_mode & GM_TEAM)) { int name_index=5; if (strlen(Network_message) > 5) while (Network_message[name_index] == ' ') name_index++; - if (!network_i_am_master()) - { - HUD_init_message ("Only %s can move players!",Players[network_who_is_master()].callsign); - return; + if (!network_i_am_master()) + { + HUD_init_message ("Only %s can move players!",Players[network_who_is_master()].callsign); + return; } - + if (strlen(Network_message)<=name_index) - { + { HUD_init_message ("You must specify a name to move"); return; - } + } for (i = 0; i < N_players; i++) - if ((!strnicmp(Players[i].callsign, &Network_message[name_index], strlen(Network_message)-name_index)) && (Players[i].connected)) - { - if ((Game_mode & GM_CAPTURE) && (Players[i].flags & PLAYER_FLAGS_FLAG)) - { - HUD_init_message ("Can't move player because s/he has a flag!"); - return; - } - - if (Netgame.team_vector & (1< 5) while (Network_message[name_index] == ' ') name_index++; - if (!network_i_am_master()) - { - HUD_init_message ("Only %s can kick others out!",Players[network_who_is_master()].callsign); - multi_message_index = 0; - multi_sending_message = 0; - return; + if (!network_i_am_master()) + { + HUD_init_message ("Only %s can kick others out!",Players[network_who_is_master()].callsign); + multi_message_index = 0; + multi_sending_message = 0; + return; } if (strlen(Network_message)<=name_index) - { + { HUD_init_message ("You must specify a name to kick"); multi_message_index = 0; multi_sending_message = 0; return; - } + } if (Network_message[name_index] == '#' && isdigit(Network_message[name_index+1])) { int players[MAX_NUM_NET_PLAYERS]; @@ -1386,9 +1372,9 @@ void multi_send_message_end() if (Show_kill_list==1 || Show_kill_list==2) { if (listpos == 0 || listpos >= N_players) { HUD_init_message ("Invalid player number for kick."); - multi_message_index = 0; - multi_sending_message = 0; - return; + multi_message_index = 0; + multi_sending_message = 0; + return; } multi_get_kill_list(players); i = players[listpos]; @@ -1396,34 +1382,34 @@ void multi_send_message_end() goto kick_player; } else HUD_init_message ("You cannot use # kicking with in team display."); - + multi_message_index = 0; - multi_sending_message = 0; - return; + multi_sending_message = 0; + return; } for (i = 0; i < N_players; i++) - if ((!strnicmp(Players[i].callsign, &Network_message[name_index], strlen(Network_message)-name_index)) && (i != Player_num) && (Players[i].connected)) { -kick_player:; - if (Network_game_type == IPX_GAME) + if ((!strnicmp(Players[i].callsign, &Network_message[name_index], strlen(Network_message)-name_index)) && (i != Player_num) && (Players[i].connected)) { + kick_player:; + if (Network_game_type == IPX_GAME) network_dump_player(NetPlayers.players[i].network.ipx.server,NetPlayers.players[i].network.ipx.node, 7); else network_dump_appletalk_player(NetPlayers.players[i].network.appletalk.node,NetPlayers.players[i].network.appletalk.net, NetPlayers.players[i].network.appletalk.socket, 7); - + HUD_init_message("Dumping %s...",Players[i].callsign); multi_message_index = 0; multi_sending_message = 0; return; } - } + } - else + else HUD_init_message("%s '%s'", TXT_SENDING, Network_message); multi_send_message(); - multi_message_feedback(); + multi_message_feedback(); multi_message_index = 0; multi_sending_message = 0; @@ -1457,7 +1443,7 @@ void multi_message_input_sub( int key ) Network_message[multi_message_index] = 0; break; case KEY_ENTER: - if ( multi_sending_message ) + if ( multi_sending_message ) multi_send_message_end(); else if ( multi_defining_message ) multi_define_macro_end(); @@ -1470,7 +1456,7 @@ void multi_message_input_sub( int key ) if (multi_message_index < MAX_MESSAGE_LEN-2 ) { Network_message[multi_message_index++] = ascii; Network_message[multi_message_index] = 0; - } else if ( multi_sending_message ) { + } else if ( multi_sending_message ) { int i; char * ptext, * pcolon; ptext = NULL; @@ -1492,14 +1478,14 @@ void multi_message_input_sub( int key ) else strcpy( Network_message, ptext ); multi_message_index = strlen( Network_message ); - } + } } } } } } -void +void multi_send_message_dialog(void) { newmenu_item m[1]; @@ -1516,7 +1502,7 @@ multi_send_message_dialog(void) if ((choice > -1) && (strlen(Network_message) > 0)) { Network_message_reciever = 100; HUD_init_message("%s '%s'", TXT_SENDING, Network_message); - multi_message_feedback(); + multi_message_feedback(); } } @@ -1529,7 +1515,7 @@ multi_do_death(int objnum) objnum = objnum; - if (!(Game_mode & GM_MULTI_COOP)) + if (!(Game_mode & GM_MULTI_COOP)) { mprintf((0, "Setting all keys for player %d.\n", Player_num)); Players[Player_num].flags |= (PLAYER_FLAGS_RED_KEY | PLAYER_FLAGS_BLUE_KEY | PLAYER_FLAGS_GOLD_KEY); @@ -1542,25 +1528,25 @@ multi_do_fire(char *buf) ubyte weapon; char pnum; byte flags; - //static dum=0; - + //static dum=0; + // Act out the actual shooting pnum = buf[1]; #ifndef MACINTOSH - weapon = (int)buf[2]; + weapon = (int)buf[2]; #else weapon = buf[2]; #endif flags = buf[4]; Network_laser_track = INTEL_SHORT(*(short *)(buf+6)); - + Assert (pnum < N_players); if (Objects[Players[(int)pnum].objnum].type == OBJ_GHOST) multi_make_ghost_player(pnum); - // mprintf((0,"multi_do_fire, weapon = %d\n",weapon)); + // mprintf((0,"multi_do_fire, weapon = %d\n",weapon)); if (weapon == FLARE_ADJUST) Laser_player_fire( Objects+Players[(int)pnum].objnum, FLARE_ID, 6, 1, 0); @@ -1572,10 +1558,10 @@ multi_do_fire(char *buf) mprintf((0,"missile id = %d, gun = %d\n",weapon_id,weapon_gun)); if (weapon-MISSILE_ADJUST==GUIDED_INDEX) - { - mprintf ((0,"Missile is guided!!!\n")); - Multi_is_guided=1; - } + { + mprintf ((0,"Missile is guided!!!\n")); + Multi_is_guided=1; + } Laser_player_fire( Objects+Players[(int)pnum].objnum, weapon_id, weapon_gun, 1, 0 ); } @@ -1592,38 +1578,38 @@ multi_do_fire(char *buf) else Players[(int)pnum].flags &= ~PLAYER_FLAGS_QUAD_LASERS; } - + do_laser_firing(Players[(int)pnum].objnum, weapon, (int)buf[3], flags, (int)buf[5]); - + if (weapon == FUSION_INDEX) Fusion_charge = save_charge; } } -void +void multi_do_message(char *buf) { char *colon; - char *tilde,mesbuf[100]; - int tloc,t; + char *tilde,mesbuf[100]; + int tloc,t; int loc = 2; - - if ((tilde=strchr (buf+loc,'$'))) // do that stupid name stuff - { // why'd I put this in? Probably for the - tloc=tilde-(buf+loc); // same reason you can name your guidebot - mprintf ((0,"Tloc=%d\n",tloc)); - - if (tloc>0) - strncpy (mesbuf,buf+loc,tloc); - strcpy (mesbuf+tloc,Players[Player_num].callsign); - strcpy (mesbuf+strlen(Players[Player_num].callsign)+tloc,buf+loc+tloc+1); - strcpy (buf+loc,mesbuf); - } - + + if ((tilde=strchr (buf+loc,'$'))) // do that stupid name stuff + { // why'd I put this in? Probably for the + tloc=tilde-(buf+loc); // same reason you can name your guidebot + mprintf ((0,"Tloc=%d\n",tloc)); + + if (tloc>0) + strncpy (mesbuf,buf+loc,tloc); + strcpy (mesbuf+tloc,Players[Player_num].callsign); + strcpy (mesbuf+strlen(Players[Player_num].callsign)+tloc,buf+loc+tloc+1); + strcpy (buf+loc,mesbuf); + } + if (((colon = strrchr(buf+loc, ':')) == NULL) || (colon-(buf+loc) < 1) || (colon-(buf+loc) > CALLSIGN_LEN)) { - mesbuf[0] = 1; + mesbuf[0] = 1; mesbuf[1] = BM_XRGB(28, 0, 0); strcpy(&mesbuf[2], Players[(int)buf[1]].callsign); t = strlen(mesbuf); @@ -1638,9 +1624,9 @@ multi_do_message(char *buf) else { if ( (!strnicmp(Players[Player_num].callsign, buf+loc, colon-(buf+loc))) || - ((Game_mode & GM_TEAM) && ( (get_team(Player_num) == atoi(buf+loc)-1) || !strnicmp(Netgame.team_name[get_team(Player_num)], buf+loc, colon-(buf+loc)))) ) + ((Game_mode & GM_TEAM) && ( (get_team(Player_num) == atoi(buf+loc)-1) || !strnicmp(Netgame.team_name[get_team(Player_num)], buf+loc, colon-(buf+loc)))) ) { - mesbuf[0] = 1; + mesbuf[0] = 1; mesbuf[1] = BM_XRGB(0, 32, 32); strcpy(&mesbuf[2], Players[(int)buf[1]].callsign); t = strlen(mesbuf); @@ -1649,15 +1635,15 @@ multi_do_message(char *buf) mesbuf[t+2] = BM_XRGB(0, 31, 0); mesbuf[t+3] = 0; - digi_play_sample(SOUND_HUD_MESSAGE, F1_0); - HUD_init_message("%s %s", mesbuf, colon+1); + digi_play_sample(SOUND_HUD_MESSAGE, F1_0); + HUD_init_message("%s %s", mesbuf, colon+1); } } } void multi_do_position(char *buf) -{ +{ #ifdef MACINTOSH shortpos sp; #endif @@ -1670,11 +1656,11 @@ multi_do_position(char *buf) Assert(&Objects[Players[pnum].objnum] != ConsoleObject); if (Game_mode & GM_NETWORK) - { - Int3(); // Get Jason, what the hell are we doing here? - return; + { + Int3(); // Get Jason, what the hell are we doing here? + return; } - + #ifndef MACINTOSH extract_shortpos(&Objects[Players[pnum].objnum], (shortpos *)(buf+1),0); @@ -1696,15 +1682,15 @@ multi_do_reappear(char *buf) objnum = INTEL_SHORT(*(short *)(buf+1)); Assert(objnum >= 0); -// Assert(Players[Objects[objnum].id]].objnum == objnum); - -// mprintf((0, "Switching rendering back on for object %d.\n", objnum)); + // Assert(Players[Objects[objnum].id]].objnum == objnum); + + // mprintf((0, "Switching rendering back on for object %d.\n", objnum)); multi_make_ghost_player(Objects[objnum].id); create_player_appearance_effect(&Objects[objnum]); PKilledFlags[Objects[objnum].id]=0; } - + void multi_do_player_explode(char *buf) { @@ -1737,7 +1723,7 @@ multi_do_player_explode(char *buf) #endif // Stuff the Players structure to prepare for the explosion - + count = 2; Players[pnum].primary_weapon_flags = INTEL_SHORT(*(ushort *)(buf+count)); count += 2; Players[pnum].secondary_weapon_flags = INTEL_SHORT(*(ushort *)(buf+count)); count += 2; @@ -1757,20 +1743,20 @@ multi_do_player_explode(char *buf) Players[pnum].primary_ammo[VULCAN_INDEX] = INTEL_SHORT(*(ushort *)(buf+count)); count += 2; Players[pnum].primary_ammo[GAUSS_INDEX] = INTEL_SHORT(*(ushort *)(buf+count)); count += 2; Players[pnum].flags = INTEL_INT(*(uint *)(buf+count)); count += 4; - + multi_adjust_remote_cap (pnum); objp = Objects+Players[pnum].objnum; -// objp->phys_info.velocity = *(vms_vector *)(buf+16); // 12 bytes -// objp->pos = *(vms_vector *)(buf+28); // 12 bytes + // objp->phys_info.velocity = *(vms_vector *)(buf+16); // 12 bytes + // objp->pos = *(vms_vector *)(buf+28); // 12 bytes remote_created = buf[count++]; // How many did the other guy create? Net_create_loc = 0; drop_player_eggs(objp); - + // Create mapping from remote to local numbering system mprintf((0, "I Created %d powerups, remote created %d.\n", Net_create_loc, remote_created)); @@ -1782,20 +1768,20 @@ multi_do_player_explode(char *buf) for (i = 0; i < remote_created; i++) { short s; - + s = INTEL_SHORT(*(short *)(buf+count)); - + if ((i < Net_create_loc) && (s > 0)) - map_objnum_local_to_remote((short)Net_create_objnums[i], s, pnum); + map_objnum_local_to_remote((short)Net_create_objnums[i], s, pnum); else if (*(short *)(buf+count) <= 0) { mprintf((0, "WARNING: Remote created object has non-valid number %d (player %d)", s, pnum)); } - else + else { mprintf((0, "WARNING: Could not create all powerups created by player %d.\n", pnum)); } -// Assert(s > 0); + // Assert(s > 0); count += 2; } for (i = remote_created; i < Net_create_loc; i++) { @@ -1806,7 +1792,7 @@ multi_do_player_explode(char *buf) if (buf[0] == MULTI_PLAYER_EXPLODE) { explode_badass_player(objp); - + objp->flags &= ~OF_SHOULD_BE_DEAD; //don't really kill player multi_make_player_ghost(pnum); } @@ -1825,17 +1811,17 @@ multi_do_kill(char *buf) int killer, killed; int count = 1; int pnum; - + pnum = (int)(buf[count]); if ((pnum < 0) || (pnum >= N_players)) { Int3(); // Invalid player number killed return; } - killed = Players[pnum].objnum; + killed = Players[pnum].objnum; count += 1; - killer = INTEL_SHORT(*(short *)(buf+count)); + killer = INTEL_SHORT(*(short *)(buf+count)); if (killer > 0) killer = objnum_remote_to_local(killer, (byte)buf[count+2]); @@ -1846,7 +1832,7 @@ multi_do_kill(char *buf) mprintf( (1, "SOFT INT3: MULTI.C Non-player object %d of type %d killed! (JOHN)\n", killed, Objects[killed].type )); return; } -#endif +#endif multi_compute_kill(killer, killed); @@ -1863,14 +1849,14 @@ void multi_do_controlcen_destroy(char *buf) objnum = INTEL_SHORT(*(short *)(buf+1)); who = buf[3]; - if (Control_center_destroyed != 1) + if (Control_center_destroyed != 1) { if ((who < N_players) && (who != Player_num)) { HUD_init_message("%s %s", Players[who].callsign, TXT_HAS_DEST_CONTROL); } else if (who == Player_num) HUD_init_message(TXT_YOU_DEST_CONTROL); - else + else HUD_init_message(TXT_CONTROL_DESTROYED); if (objnum != -1) @@ -1880,7 +1866,7 @@ void multi_do_controlcen_destroy(char *buf) } } -void +void multi_do_escape(char *buf) { int objnum; @@ -1889,7 +1875,7 @@ multi_do_escape(char *buf) digi_play_sample(SOUND_HUD_MESSAGE, F1_0); digi_kill_sound_linked_to_object (objnum); - + if (buf[2] == 0) { HUD_init_message("%s %s", Players[(int)buf[1]].callsign, TXT_HAS_ESCAPED); @@ -1898,7 +1884,7 @@ multi_do_escape(char *buf) if (!multi_goto_secret) multi_goto_secret = 2; } - else if (buf[2] == 1) + else if (buf[2] == 1) { HUD_init_message("%s %s", Players[(int)buf[1]].callsign, TXT_HAS_FOUND_SECRET); if (Game_mode & GM_NETWORK) @@ -1927,7 +1913,7 @@ multi_do_remobj(char *buf) local_objnum = objnum_remote_to_local(objnum, obj_owner); // translate to local objnum -// mprintf((0, "multi_do_remobj: %d owner %d = %d.\n", objnum, obj_owner, local_objnum)); + // mprintf((0, "multi_do_remobj: %d owner %d = %d.\n", objnum, obj_owner, local_objnum)); if (local_objnum < 0) { @@ -1940,39 +1926,39 @@ multi_do_remobj(char *buf) mprintf((1, "multi_get_remobj: tried to remove invalid type %d.\n", Objects[local_objnum].type)); return; } - + if (Network_send_objects && network_objnum_is_past(local_objnum)) { mprintf((0, "Resetting object sync due to object removal.\n")); Network_send_objnum = -1; } if (Objects[local_objnum].type==OBJ_POWERUP) - if (Game_mode & GM_NETWORK) + if (Game_mode & GM_NETWORK) { - if (PowerupsInMine[Objects[local_objnum].id]>0) - PowerupsInMine[Objects[local_objnum].id]--; + if (PowerupsInMine[Objects[local_objnum].id]>0) + PowerupsInMine[Objects[local_objnum].id]--; - if (multi_powerup_is_4pack (Objects[local_objnum].id)) - { + if (multi_powerup_is_4pack (Objects[local_objnum].id)) + { mprintf ((0,"Hey babe! Doing that wacky 4 pack stuff.")); - + if (PowerupsInMine[Objects[local_objnum].id-1]-4<0) PowerupsInMine[Objects[local_objnum].id-1]=0; else PowerupsInMine[Objects[local_objnum].id-1]-=4; - } - - mprintf ((0,"Decrementing powerups! %d\n",PowerupsInMine[Objects[local_objnum].id])); + } + + mprintf ((0,"Decrementing powerups! %d\n",PowerupsInMine[Objects[local_objnum].id])); } Objects[local_objnum].flags |= OF_SHOULD_BE_DEAD; // quick and painless - + } void multi_do_quit(char *buf) { - + if (Game_mode & GM_NETWORK) { int i, n = 0; @@ -1980,7 +1966,7 @@ multi_do_quit(char *buf) digi_play_sample( SOUND_HUD_MESSAGE, F1_0 ); HUD_init_message( "%s %s", Players[(int)buf[1]].callsign, TXT_HAS_LEFT_THE_GAME); - + network_disconnect_player(buf[1]); if (multi_in_menu) @@ -2014,7 +2000,7 @@ multi_do_cloak(char *buf) pnum = (int)(buf[1]); Assert(pnum < N_players); - + mprintf((0, "Cloaking player %d\n", pnum)); Players[pnum].flags |= PLAYER_FLAGS_CLOAKED; @@ -2029,7 +2015,7 @@ multi_do_cloak(char *buf) if (Newdemo_state == ND_STATE_RECORDING) newdemo_record_multi_cloak(pnum); } - + void multi_do_decloak(char *buf) { @@ -2041,7 +2027,7 @@ multi_do_decloak(char *buf) newdemo_record_multi_decloak(pnum); } - + void multi_do_door_open(char *buf) { @@ -2055,7 +2041,7 @@ multi_do_door_open(char *buf) side = buf[3]; flag= buf[4]; -// mprintf((0, "Opening door on side %d of segment # %d.\n", side, segnum)); + // mprintf((0, "Opening door on side %d of segment # %d.\n", side, segnum)); if ((segnum < 0) || (segnum > Highest_segment_index) || (side < 0) || (side > 5)) { @@ -2084,13 +2070,13 @@ multi_do_door_open(char *buf) else if (w->state != WALL_DOOR_OPENING) { wall_open_door(seg, side); - w->flags=flag; + w->flags=flag; } else - w->flags=flag; + w->flags=flag; -// else -// mprintf((0, "Door already opening!\n")); + // else + // mprintf((0, "Door already opening!\n")); } void @@ -2101,10 +2087,10 @@ multi_do_create_explosion(char *buf) pnum = buf[count++]; -// mprintf((0, "Creating small fireball.\n")); + // mprintf((0, "Creating small fireball.\n")); create_small_fireball_on_object(&Objects[Players[pnum].objnum], F1_0, 1); } - + void multi_do_controlcen_fire(char *buf) { @@ -2114,11 +2100,11 @@ multi_do_controlcen_fire(char *buf) int count = 1; memcpy(&to_target, buf+count, 12); count += 12; - #ifdef MACINTOSH // swap the vector to_target +#ifdef MACINTOSH // swap the vector to_target to_target.x = (fix)INTEL_INT((int)to_target.x); to_target.y = (fix)INTEL_INT((int)to_target.y); to_target.z = (fix)INTEL_INT((int)to_target.z); - #endif +#endif gun_num = buf[count]; count += 1; objnum = INTEL_SHORT(*(short *)(buf+count)); count += 2; @@ -2148,7 +2134,7 @@ multi_do_create_powerup(char *buf) Int3(); return; } - + new_pos = *(vms_vector *)(buf+count); count+=sizeof(vms_vector); #ifdef MACINTOSH new_pos.x = (fix)SWAPINT((int)new_pos.x); @@ -2173,7 +2159,7 @@ multi_do_create_powerup(char *buf) Objects[my_objnum].pos = new_pos; vm_vec_zero(&Objects[my_objnum].mtype.phys_info.velocity); - + obj_relink(my_objnum, segnum); map_objnum_local_to_remote(my_objnum, objnum, pnum); @@ -2181,9 +2167,9 @@ multi_do_create_powerup(char *buf) object_create_explosion(segnum, &new_pos, i2f(5), VCLIP_POWERUP_DISAPPEARANCE); mprintf((0, "Creating powerup type %d in segment %i.\n", powerup_type, segnum)); - if (Game_mode & GM_NETWORK) + if (Game_mode & GM_NETWORK) PowerupsInMine[(int)powerup_type]++; -} +} void multi_do_play_sound(char *buf) @@ -2198,14 +2184,14 @@ multi_do_play_sound(char *buf) Assert(Players[pnum].objnum >= 0); Assert(Players[pnum].objnum <= Highest_object_index); - digi_link_sound_to_object( sound_num, Players[pnum].objnum, 0, volume); + digi_link_sound_to_object( sound_num, Players[pnum].objnum, 0, volume); } void multi_do_score(char *buf) { int pnum = (int)(buf[1]); - + if ((pnum < 0) || (pnum >= N_players)) { Int3(); // Non-terminal, see rob @@ -2225,8 +2211,8 @@ multi_do_trigger(char *buf) { int pnum = (int)(buf[1]); int trigger = (int)(buf[2]); - - mprintf ((0,"MULTI doing trigger!\n")); + + mprintf ((0,"MULTI doing trigger!\n")); if ((pnum < 0) || (pnum >= N_players) || (pnum == Player_num)) { @@ -2242,31 +2228,31 @@ multi_do_trigger(char *buf) } void multi_do_drop_marker (char *buf) - { - int i; - int pnum=(int)(buf[1]); - int mesnum=(int)(buf[2]); - vms_vector position; +{ + int i; + int pnum=(int)(buf[1]); + int mesnum=(int)(buf[2]); + vms_vector position; - if (pnum==Player_num) // my marker? don't set it down cuz it might screw up the orientation - return; + if (pnum==Player_num) // my marker? don't set it down cuz it might screw up the orientation + return; - position.x=(fix)INTEL_INT(*(int *)(buf+3)); - position.y=(fix)INTEL_INT(*(int *)(buf+7)); - position.z=(fix)INTEL_INT(*(int *)(buf+11)); + position.x=(fix)INTEL_INT(*(int *)(buf+3)); + position.y=(fix)INTEL_INT(*(int *)(buf+7)); + position.z=(fix)INTEL_INT(*(int *)(buf+11)); - for (i=0;i<40;i++) - MarkerMessage[(pnum*2)+mesnum][i]=buf[15+i]; + for (i=0;i<40;i++) + MarkerMessage[(pnum*2)+mesnum][i]=buf[15+i]; - MarkerPoint[(pnum*2)+mesnum]=position; + MarkerPoint[(pnum*2)+mesnum]=position; - if (MarkerObject[(pnum*2)+mesnum] !=-1 && Objects[MarkerObject[(pnum*2)+mesnum]].type!=OBJ_NONE && MarkerObject[(pnum*2)+mesnum] !=0) + if (MarkerObject[(pnum*2)+mesnum] !=-1 && Objects[MarkerObject[(pnum*2)+mesnum]].type!=OBJ_NONE && MarkerObject[(pnum*2)+mesnum] !=0) obj_delete(MarkerObject[(pnum*2)+mesnum]); - MarkerObject[(pnum*2)+mesnum] = drop_marker_object(&position,Objects[Players[Player_num].objnum].segnum,&Objects[Players[Player_num].objnum].orient,(pnum*2)+mesnum); - strcpy (MarkerOwner[(pnum*2)+mesnum],Players[pnum].callsign); - mprintf ((0,"Dropped player %d message: %s\n",pnum,MarkerMessage[(pnum*2)+mesnum])); - } + MarkerObject[(pnum*2)+mesnum] = drop_marker_object(&position,Objects[Players[Player_num].objnum].segnum,&Objects[Players[Player_num].objnum].orient,(pnum*2)+mesnum); + strcpy (MarkerOwner[(pnum*2)+mesnum],Players[pnum].callsign); + mprintf ((0,"Dropped player %d message: %s\n",pnum,MarkerMessage[(pnum*2)+mesnum])); +} void multi_do_hostage_door_status(char *buf) @@ -2274,7 +2260,7 @@ void multi_do_hostage_door_status(char *buf) // Update hit point status of a door int count = 1; - int wallnum; + int wallnum; fix hps; wallnum = INTEL_SHORT(*(short *)(buf+count)); count += 2; @@ -2286,7 +2272,7 @@ void multi_do_hostage_door_status(char *buf) return; } -// mprintf((0, "Damaging wall number %d to %f points.\n", wallnum, f2fl(hps))); + // mprintf((0, "Damaging wall number %d to %f points.\n", wallnum, f2fl(hps))); if (hps < Walls[wallnum].hps) wall_damage(&Segments[Walls[wallnum].segnum], Walls[wallnum].sidenum, Walls[wallnum].hps - hps); @@ -2318,7 +2304,7 @@ void multi_do_restore_game(char *buf) multi_restore_game( slot, id ); } - + void multi_do_req_player(char *buf) { netplayer_stats ps; @@ -2337,7 +2323,7 @@ void multi_do_send_player(char *buf) { // Got a player packet from someone!!! netplayer_stats * p; - p = (netplayer_stats *)buf; + p = (netplayer_stats *)buf; Assert( p->Player_num <= N_players ); @@ -2351,7 +2337,7 @@ void multi_reset_stuff(void) { // A generic, emergency function to solve problems that crop up - // when a player exits quick-out from the game because of a + // when a player exits quick-out from the game because of a // serial connection loss. Fixes several weird bugs! dead_player_end(); @@ -2381,7 +2367,7 @@ multi_reset_player_object(object *objp) objp->mtype.phys_info.brakes = objp->mtype.phys_info.turnroll = 0; objp->mtype.phys_info.mass = Player_ship->mass; objp->mtype.phys_info.drag = Player_ship->drag; -// objp->mtype.phys_info.flags &= ~(PF_TURNROLL | PF_LEVELLING | PF_WIGGLE | PF_USES_THRUST); + // objp->mtype.phys_info.flags &= ~(PF_TURNROLL | PF_LEVELLING | PF_WIGGLE | PF_USES_THRUST); objp->mtype.phys_info.flags &= ~(PF_TURNROLL | PF_LEVELLING | PF_WIGGLE); //Init render info @@ -2394,19 +2380,19 @@ multi_reset_player_object(object *objp) //reset textures for this, if not player 0 - multi_reset_object_texture (objp); - + multi_reset_object_texture (objp); + // Clear misc objp->flags = 0; - + if (objp->type == OBJ_GHOST) objp->render_type = RT_NONE; } void multi_reset_object_texture (object *objp) - { +{ int id,i; if (Game_mode & GM_TEAM) @@ -2426,8 +2412,8 @@ void multi_reset_object_texture (object *objp) multi_player_textures[id-1][5] = ObjBitmaps[ObjBitmapPtrs[First_multi_bitmap_num+(id-1)*2+1]]; objp->rtype.pobj_info.alt_textures = id; - } - } + } +} @@ -2439,7 +2425,7 @@ void multi_process_bigdata(char *buf, int len) { // Takes a bunch of messages, check them for validity, - // and pass them to multi_process_data. + // and pass them to multi_process_data. int type, sub_len, bytes_processed = 0; @@ -2482,11 +2468,11 @@ multi_send_fire(void) multibuf[3] = (char)Network_laser_level; multibuf[4] = (char)Network_laser_flags; multibuf[5] = (char)Network_laser_fired; - + *(short *)(multibuf+6) = INTEL_SHORT(Network_laser_track); multi_send_data(multibuf, 8, 0); - + Network_laser_fired = 0; } @@ -2503,35 +2489,35 @@ multi_send_destroy_controlcen(int objnum, int player) multibuf[0] = (char)MULTI_CONTROLCEN; *(ushort *)(multibuf+1) = INTEL_SHORT(objnum); multibuf[3] = player; - multi_send_data(multibuf, 4, 2); + multi_send_data(multibuf, 4, 2); } void multi_send_drop_marker (int player,vms_vector position,char messagenum,char text[]) - { - int i; - - if (player message_length[MULTI_PLAYER_EXPLODE]) { @@ -2634,206 +2620,206 @@ extern ubyte Primary_weapon_to_powerup[]; // to prevent rampant powerups in netgames void multi_cap_objects () - { - char type,flagtype; - int index; +{ + char type,flagtype; + int index; - if (!(Game_mode & GM_NETWORK)) - return; + if (!(Game_mode & GM_NETWORK)) + return; - for (index=0;index=MaxPowerupsAllowed[(int)type]) - if(Players[Player_num].primary_weapon_flags & (1 << index)) + if (PowerupsInMine[(int)type]>=MaxPowerupsAllowed[(int)type]) + if(Players[Player_num].primary_weapon_flags & (1 << index)) { - mprintf ((0,"PIM=%d MPA=%d\n",PowerupsInMine[(int)type],MaxPowerupsAllowed[(int)type])); - mprintf ((0,"Killing a primary cuz there's too many! (%d)\n",(int)type)); - Players[Player_num].primary_weapon_flags&=(~(1 << index)); + mprintf ((0,"PIM=%d MPA=%d\n",PowerupsInMine[(int)type],MaxPowerupsAllowed[(int)type])); + mprintf ((0,"Killing a primary cuz there's too many! (%d)\n",(int)type)); + Players[Player_num].primary_weapon_flags&=(~(1 << index)); } } - - // Don't do the adjustment stuff for Hoard mode - if (!(Game_mode & GM_HOARD)) - Players[Player_num].secondary_ammo[2]/=4; - Players[Player_num].secondary_ammo[7]/=4; - - for (index=0;indexMaxPowerupsAllowed[(int)type]) - { - if (MaxPowerupsAllowed[(int)type]-PowerupsInMine[(int)type]<0) - Players[Player_num].secondary_ammo[index]=0; - else - Players[Player_num].secondary_ammo[index]=(MaxPowerupsAllowed[(int)type]-PowerupsInMine[(int)type]); - + + if ((Players[Player_num].secondary_ammo[index]+PowerupsInMine[(int)type])>MaxPowerupsAllowed[(int)type]) + { + if (MaxPowerupsAllowed[(int)type]-PowerupsInMine[(int)type]<0) + Players[Player_num].secondary_ammo[index]=0; + else + Players[Player_num].secondary_ammo[index]=(MaxPowerupsAllowed[(int)type]-PowerupsInMine[(int)type]); + mprintf ((0,"Hey! I killed secondary type %d because PIM=%d MPA=%d\n",(int)type,PowerupsInMine[(int)type],MaxPowerupsAllowed[(int)type])); - } + } } - if (!(Game_mode & GM_HOARD)) - Players[Player_num].secondary_ammo[2]*=4; - Players[Player_num].secondary_ammo[7]*=4; - - if (Players[Player_num].laser_level > MAX_LASER_LEVEL) - if (PowerupsInMine[POW_SUPER_LASER]+1 > MaxPowerupsAllowed[POW_SUPER_LASER]) + if (!(Game_mode & GM_HOARD)) + Players[Player_num].secondary_ammo[2]*=4; + Players[Player_num].secondary_ammo[7]*=4; + + if (Players[Player_num].laser_level > MAX_LASER_LEVEL) + if (PowerupsInMine[POW_SUPER_LASER]+1 > MaxPowerupsAllowed[POW_SUPER_LASER]) Players[Player_num].laser_level=0; - if (Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS) - if (PowerupsInMine[POW_QUAD_FIRE]+1 > MaxPowerupsAllowed[POW_QUAD_FIRE]) + if (Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS) + if (PowerupsInMine[POW_QUAD_FIRE]+1 > MaxPowerupsAllowed[POW_QUAD_FIRE]) Players[Player_num].flags&=(~PLAYER_FLAGS_QUAD_LASERS); - if (Players[Player_num].flags & PLAYER_FLAGS_CLOAKED) - if (PowerupsInMine[POW_CLOAK]+1 > MaxPowerupsAllowed[POW_CLOAK]) + if (Players[Player_num].flags & PLAYER_FLAGS_CLOAKED) + if (PowerupsInMine[POW_CLOAK]+1 > MaxPowerupsAllowed[POW_CLOAK]) Players[Player_num].flags&=(~PLAYER_FLAGS_CLOAKED); - if (Players[Player_num].flags & PLAYER_FLAGS_MAP_ALL) - if (PowerupsInMine[POW_FULL_MAP]+1 > MaxPowerupsAllowed[POW_FULL_MAP]) + if (Players[Player_num].flags & PLAYER_FLAGS_MAP_ALL) + if (PowerupsInMine[POW_FULL_MAP]+1 > MaxPowerupsAllowed[POW_FULL_MAP]) Players[Player_num].flags&=(~PLAYER_FLAGS_MAP_ALL); - if (Players[Player_num].flags & PLAYER_FLAGS_AFTERBURNER) - if (PowerupsInMine[POW_AFTERBURNER]+1 > MaxPowerupsAllowed[POW_AFTERBURNER]) + if (Players[Player_num].flags & PLAYER_FLAGS_AFTERBURNER) + if (PowerupsInMine[POW_AFTERBURNER]+1 > MaxPowerupsAllowed[POW_AFTERBURNER]) Players[Player_num].flags&=(~PLAYER_FLAGS_AFTERBURNER); - if (Players[Player_num].flags & PLAYER_FLAGS_AMMO_RACK) - if (PowerupsInMine[POW_AMMO_RACK]+1 > MaxPowerupsAllowed[POW_AMMO_RACK]) + if (Players[Player_num].flags & PLAYER_FLAGS_AMMO_RACK) + if (PowerupsInMine[POW_AMMO_RACK]+1 > MaxPowerupsAllowed[POW_AMMO_RACK]) Players[Player_num].flags&=(~PLAYER_FLAGS_AMMO_RACK); - if (Players[Player_num].flags & PLAYER_FLAGS_CONVERTER) - if (PowerupsInMine[POW_CONVERTER]+1 > MaxPowerupsAllowed[POW_CONVERTER]) + if (Players[Player_num].flags & PLAYER_FLAGS_CONVERTER) + if (PowerupsInMine[POW_CONVERTER]+1 > MaxPowerupsAllowed[POW_CONVERTER]) Players[Player_num].flags&=(~PLAYER_FLAGS_CONVERTER); - if (Players[Player_num].flags & PLAYER_FLAGS_HEADLIGHT) - if (PowerupsInMine[POW_HEADLIGHT]+1 > MaxPowerupsAllowed[POW_HEADLIGHT]) + if (Players[Player_num].flags & PLAYER_FLAGS_HEADLIGHT) + if (PowerupsInMine[POW_HEADLIGHT]+1 > MaxPowerupsAllowed[POW_HEADLIGHT]) Players[Player_num].flags&=(~PLAYER_FLAGS_HEADLIGHT); - - if (Game_mode & GM_CAPTURE) + + if (Game_mode & GM_CAPTURE) + { + if (Players[Player_num].flags & PLAYER_FLAGS_FLAG) { - if (Players[Player_num].flags & PLAYER_FLAGS_FLAG) - { - if (get_team(Player_num)==TEAM_RED) + if (get_team(Player_num)==TEAM_RED) flagtype=POW_FLAG_BLUE; - else + else flagtype=POW_FLAG_RED; - - if (PowerupsInMine[(int)flagtype]+1 > MaxPowerupsAllowed[(int)flagtype]) - Players[Player_num].flags&=(~PLAYER_FLAGS_FLAG); - } + + if (PowerupsInMine[(int)flagtype]+1 > MaxPowerupsAllowed[(int)flagtype]) + Players[Player_num].flags&=(~PLAYER_FLAGS_FLAG); } + } - } +} // adds players inventory to multi cap void multi_adjust_cap_for_player (int pnum) - { - char type; - - int index; +{ + char type; + + int index; - if (!(Game_mode & GM_NETWORK)) - return; + if (!(Game_mode & GM_NETWORK)) + return; - for (index=0;index MAX_LASER_LEVEL) - MaxPowerupsAllowed[POW_SUPER_LASER]++; + if (Players[pnum].laser_level > MAX_LASER_LEVEL) + MaxPowerupsAllowed[POW_SUPER_LASER]++; - if (Players[pnum].flags & PLAYER_FLAGS_QUAD_LASERS) - MaxPowerupsAllowed[POW_QUAD_FIRE]++; + if (Players[pnum].flags & PLAYER_FLAGS_QUAD_LASERS) + MaxPowerupsAllowed[POW_QUAD_FIRE]++; - if (Players[pnum].flags & PLAYER_FLAGS_CLOAKED) - MaxPowerupsAllowed[POW_CLOAK]++; + if (Players[pnum].flags & PLAYER_FLAGS_CLOAKED) + MaxPowerupsAllowed[POW_CLOAK]++; - if (Players[pnum].flags & PLAYER_FLAGS_MAP_ALL) - MaxPowerupsAllowed[POW_FULL_MAP]++; + if (Players[pnum].flags & PLAYER_FLAGS_MAP_ALL) + MaxPowerupsAllowed[POW_FULL_MAP]++; - if (Players[pnum].flags & PLAYER_FLAGS_AFTERBURNER) - MaxPowerupsAllowed[POW_AFTERBURNER]++; + if (Players[pnum].flags & PLAYER_FLAGS_AFTERBURNER) + MaxPowerupsAllowed[POW_AFTERBURNER]++; - if (Players[pnum].flags & PLAYER_FLAGS_AMMO_RACK) - MaxPowerupsAllowed[POW_AMMO_RACK]++; + if (Players[pnum].flags & PLAYER_FLAGS_AMMO_RACK) + MaxPowerupsAllowed[POW_AMMO_RACK]++; - if (Players[pnum].flags & PLAYER_FLAGS_CONVERTER) - MaxPowerupsAllowed[POW_CONVERTER]++; + if (Players[pnum].flags & PLAYER_FLAGS_CONVERTER) + MaxPowerupsAllowed[POW_CONVERTER]++; - if (Players[pnum].flags & PLAYER_FLAGS_HEADLIGHT) - MaxPowerupsAllowed[POW_HEADLIGHT]++; - } + if (Players[pnum].flags & PLAYER_FLAGS_HEADLIGHT) + MaxPowerupsAllowed[POW_HEADLIGHT]++; +} void multi_adjust_remote_cap (int pnum) - { - char type; - - int index; +{ + char type; - if (!(Game_mode & GM_NETWORK)) - return; + int index; + + if (!(Game_mode & GM_NETWORK)) + return; - for (index=0;index MAX_LASER_LEVEL) - PowerupsInMine[POW_SUPER_LASER]++; + if (Players[pnum].laser_level > MAX_LASER_LEVEL) + PowerupsInMine[POW_SUPER_LASER]++; - if (Players[pnum].flags & PLAYER_FLAGS_QUAD_LASERS) - PowerupsInMine[POW_QUAD_FIRE]++; + if (Players[pnum].flags & PLAYER_FLAGS_QUAD_LASERS) + PowerupsInMine[POW_QUAD_FIRE]++; - if (Players[pnum].flags & PLAYER_FLAGS_CLOAKED) - PowerupsInMine[POW_CLOAK]++; + if (Players[pnum].flags & PLAYER_FLAGS_CLOAKED) + PowerupsInMine[POW_CLOAK]++; - if (Players[pnum].flags & PLAYER_FLAGS_MAP_ALL) - PowerupsInMine[POW_FULL_MAP]++; + if (Players[pnum].flags & PLAYER_FLAGS_MAP_ALL) + PowerupsInMine[POW_FULL_MAP]++; - if (Players[pnum].flags & PLAYER_FLAGS_AFTERBURNER) - PowerupsInMine[POW_AFTERBURNER]++; + if (Players[pnum].flags & PLAYER_FLAGS_AFTERBURNER) + PowerupsInMine[POW_AFTERBURNER]++; - if (Players[pnum].flags & PLAYER_FLAGS_AMMO_RACK) - PowerupsInMine[POW_AMMO_RACK]++; + if (Players[pnum].flags & PLAYER_FLAGS_AMMO_RACK) + PowerupsInMine[POW_AMMO_RACK]++; - if (Players[pnum].flags & PLAYER_FLAGS_CONVERTER) - PowerupsInMine[POW_CONVERTER]++; + if (Players[pnum].flags & PLAYER_FLAGS_CONVERTER) + PowerupsInMine[POW_CONVERTER]++; - if (Players[pnum].flags & PLAYER_FLAGS_HEADLIGHT) - PowerupsInMine[POW_HEADLIGHT]++; + if (Players[pnum].flags & PLAYER_FLAGS_HEADLIGHT) + PowerupsInMine[POW_HEADLIGHT]++; - } +} void multi_send_message(void) @@ -2855,7 +2841,7 @@ multi_send_reappear() { multibuf[0] = (char)MULTI_REAPPEAR; *(short *)(multibuf+1) = INTEL_SHORT(Players[Player_num].objnum); - + multi_send_data(multibuf, 3, 2); PKilledFlags[Player_num]=0; } @@ -2871,7 +2857,7 @@ multi_send_position(int objnum) if (Game_mode & GM_NETWORK) { return; } - + multibuf[count++] = (char)MULTI_POSITION; #ifndef MACINTOSH create_shortpos((shortpos *)(multibuf+count), Objects+objnum,0); @@ -2899,15 +2885,15 @@ multi_send_kill(int objnum) killer_objnum = Players[Player_num].killer_objnum; multi_compute_kill(killer_objnum, objnum); - + multibuf[0] = (char)MULTI_KILL; count += 1; multibuf[1] = Player_num; count += 1; - if (killer_objnum > -1) { + if (killer_objnum > -1) { short s; // do it with variable since INTEL_SHORT won't work on return val from function. - + s = (short)objnum_local_to_remote(killer_objnum, (byte *)&multibuf[count+2]); *(short *)(multibuf+count) = INTEL_SHORT(s); - } + } else { *(short *)(multibuf+count) = INTEL_SHORT((short)-1); @@ -2930,33 +2916,33 @@ multi_send_remobj(int objnum) byte obj_owner; short remote_objnum; - if (Objects[objnum].type==OBJ_POWERUP && (Game_mode & GM_NETWORK)) + if (Objects[objnum].type==OBJ_POWERUP && (Game_mode & GM_NETWORK)) { if (PowerupsInMine[Objects[objnum].id] > 0) - { - PowerupsInMine[Objects[objnum].id]--; - if (multi_powerup_is_4pack (Objects[objnum].id)) - { + { + PowerupsInMine[Objects[objnum].id]--; + if (multi_powerup_is_4pack (Objects[objnum].id)) + { mprintf ((0,"Hey babe! Doing that wacky 4 pack stuff.")); - + if (PowerupsInMine[Objects[objnum].id-1]-4<0) PowerupsInMine[Objects[objnum].id-1]=0; else PowerupsInMine[Objects[objnum].id-1]-=4; - } - } - - } - + } + } + + } + multibuf[0] = (char)MULTI_REMOVE_OBJECT; remote_objnum = objnum_local_to_remote((short)objnum, &obj_owner); *(short *)(multibuf+1) = INTEL_SHORT(remote_objnum); // Map to network objnums - multibuf[3] = obj_owner; + multibuf[3] = obj_owner; -// mprintf((0, "multi_send_remobj: %d = %d owner %d.\n", objnum, remote_objnum, obj_owner)); + // mprintf((0, "multi_send_remobj: %d = %d owner %d.\n", objnum, remote_objnum, obj_owner)); multi_send_data(multibuf, 4, 0); @@ -2966,7 +2952,7 @@ multi_send_remobj(int objnum) Network_send_objnum = -1; } } - + void multi_send_quit(int why) { @@ -3015,8 +3001,8 @@ multi_send_door_open(int segnum, int side,ubyte flag) multibuf[0] = MULTI_DOOR_OPEN; *(short *)(multibuf+1) = INTEL_SHORT( (short)segnum ); multibuf[3] = (byte)side; - multibuf[4] = flag; - + multibuf[4] = flag; + multi_send_data(multibuf, 5, 2); } @@ -3028,19 +3014,19 @@ multi_send_door_open_specific(int pnum,int segnum, int side,ubyte flag) // For sending doors only to a specific person (usually when they're joining) Assert (Game_mode & GM_NETWORK); -// Assert (pnum>-1 && pnum-1 && pnumx ); swapped_vec.y = (fix)INTEL_INT( (int)to_goal->y ); swapped_vec.z = (fix)INTEL_INT( (int)to_goal->z ); memcpy(multibuf+count, &swapped_vec, 12); count += 12; - #endif +#endif multibuf[count] = (char)best_gun_num; count += 1; *(short *)(multibuf+count) = INTEL_SHORT( (short)objnum ); count += 2; // ------------ @@ -3095,8 +3081,8 @@ multi_send_create_powerup(int powerup_type, int segnum, int objnum, vms_vector * #endif int count = 0; - if (Game_mode & GM_NETWORK) - PowerupsInMine[powerup_type]++; + if (Game_mode & GM_NETWORK) + PowerupsInMine[powerup_type]++; multibuf[count] = MULTI_CREATE_POWERUP; count += 1; multibuf[count] = Player_num; count += 1; @@ -3123,7 +3109,7 @@ multi_send_create_powerup(int powerup_type, int segnum, int objnum, vms_vector * mprintf((0, "Creating powerup type %d in segment %i.\n", powerup_type, segnum)); map_objnum_local_to_local(objnum); -} +} void multi_send_play_sound(int sound_num, fix volume) @@ -3174,14 +3160,14 @@ multi_send_score(void) *(int *)(multibuf+count) = INTEL_INT( Players[Player_num].score ); count += 4; multi_send_data(multibuf, count, 0); } -} +} void multi_send_save_game(ubyte slot, uint id, char * desc) { int count = 0; - + multibuf[count] = MULTI_SAVE_GAME; count += 1; multibuf[count] = slot; count += 1; // Save slot=0 *(uint *)(multibuf+count) = INTEL_INT( id ); count += 4; // Save id @@ -3194,7 +3180,7 @@ void multi_send_restore_game(ubyte slot, uint id) { int count = 0; - + multibuf[count] = MULTI_RESTORE_GAME; count += 1; multibuf[count] = slot; count += 1; // Save slot=0 *(uint *)(multibuf+count) = INTEL_INT( id ); count += 4; // Save id @@ -3206,7 +3192,7 @@ void multi_send_netplayer_stats_request(ubyte player_num) { int count = 0; - + multibuf[count] = MULTI_REQ_PLAYER; count += 1; multibuf[count] = player_num; count += 1; @@ -3217,17 +3203,17 @@ void multi_send_trigger(int triggernum) { // Send an even to trigger something in the mine - + int count = 0; - + multibuf[count] = MULTI_TRIGGER; count += 1; multibuf[count] = Player_num; count += 1; multibuf[count] = (ubyte)triggernum; count += 1; - - mprintf ((0,"Sending trigger %d\n",triggernum)); - multi_send_data(multibuf, count, 1); -// multi_send_data(multibuf, count, 1); // twice? + mprintf ((0,"Sending trigger %d\n",triggernum)); + + multi_send_data(multibuf, count, 1); + //multi_send_data(multibuf, count, 1); // twice? } void @@ -3237,14 +3223,14 @@ multi_send_hostage_door_status(int wallnum) // should be int count = 0; - + Assert(Walls[wallnum].type == WALL_BLASTABLE); multibuf[count] = MULTI_HOSTAGE_DOOR; count += 1; *(short *)(multibuf+count) = INTEL_SHORT( (short)wallnum ); count += 2; *(fix *)(multibuf+count) = (fix)INTEL_INT( (int)Walls[wallnum].hps ); count += 4; -// mprintf((0, "Door %d damaged by %f points.\n", wallnum, f2fl(Walls[wallnum].hps))); + // mprintf((0, "Door %d damaged by %f points.\n", wallnum, f2fl(Walls[wallnum].hps))); multi_send_data(multibuf, count, 0); } @@ -3259,7 +3245,7 @@ void multi_prep_level(void) // Do any special stuff to the level required for serial games // before we begin playing in it. - // Player_num MUST be set before calling this procedure. + // Player_num MUST be set before calling this procedure. // This function must be called before checksuming the Object array, // since the resulting checksum with depend on the value of Player_num @@ -3271,15 +3257,15 @@ void multi_prep_level(void) Assert(Game_mode & GM_MULTI); Assert(NumNetPlayerPositions > 0); - - PhallicLimit=0; - PhallicMan=-1; - Drop_afterburner_blob_flag=0; - ConsistencyCount=0; - - for (i=0;i= POW_KEY_BLUE) && (Objects[i].id <= POW_KEY_GOLD)) - { - Objects[i].id = POW_SHIELD_BOOST; - Objects[i].rtype.vclip_info.vclip_num = Powerup_info[Objects[i].id].vclip_num; - Objects[i].rtype.vclip_info.frametime = Vclip[Objects[i].rtype.vclip_info.vclip_num].frame_time; - } + { + Objects[i].id = POW_SHIELD_BOOST; + Objects[i].rtype.vclip_info.vclip_num = Powerup_info[Objects[i].id].vclip_num; + Objects[i].rtype.vclip_info.frametime = Vclip[Objects[i].rtype.vclip_info.vclip_num].frame_time; + } if (Objects[i].id == POW_INVULNERABILITY) { - if (inv_count >= 3 || (ng && !Netgame.DoInvulnerability)) { + if (inv_count >= 3 || (ng && !Netgame.DoInvulnerability)) { mprintf((0, "Bashing Invulnerability object #%i to shield.\n", i)); Objects[i].id = POW_SHIELD_BOOST; Objects[i].rtype.vclip_info.vclip_num = Powerup_info[Objects[i].id].vclip_num; @@ -3378,7 +3364,7 @@ void multi_prep_level(void) } if (Objects[i].id == POW_CLOAK) { - if (cloak_count >= 3 || (ng && !Netgame.DoCloak)) { + if (cloak_count >= 3 || (ng && !Netgame.DoCloak)) { mprintf((0, "Bashing Cloak object #%i to shield.\n", i)); Objects[i].id = POW_SHIELD_BOOST; Objects[i].rtype.vclip_info.vclip_num = Powerup_info[Objects[i].id].vclip_num; @@ -3387,95 +3373,95 @@ void multi_prep_level(void) cloak_count++; } - if (Objects[i].id == POW_AFTERBURNER && ng && !Netgame.DoAfterburner) - bash_to_shield (i,"afterburner"); - if (Objects[i].id == POW_FUSION_WEAPON && ng && !Netgame.DoFusions) - bash_to_shield (i,"fusion"); - if (Objects[i].id == POW_PHOENIX_WEAPON && ng && !Netgame.DoPhoenix) - bash_to_shield (i,"phoenix"); - - if (Objects[i].id == POW_HELIX_WEAPON && ng && !Netgame.DoHelix) - bash_to_shield (i,"helix"); - - if (Objects[i].id == POW_MEGA_WEAPON && ng && !Netgame.DoMegas) - bash_to_shield (i,"mega"); - - if (Objects[i].id == POW_SMARTBOMB_WEAPON && ng && !Netgame.DoSmarts) - bash_to_shield (i,"smartmissile"); - - if (Objects[i].id == POW_GAUSS_WEAPON && ng && !Netgame.DoGauss) - bash_to_shield (i,"gauss"); - - if (Objects[i].id == POW_VULCAN_WEAPON && ng && !Netgame.DoVulcan) - bash_to_shield (i,"vulcan"); - - if (Objects[i].id == POW_PLASMA_WEAPON && ng && !Netgame.DoPlasma) - bash_to_shield (i,"plasma"); - - if (Objects[i].id == POW_OMEGA_WEAPON && ng && !Netgame.DoOmega) - bash_to_shield (i,"omega"); - - if (Objects[i].id == POW_SUPER_LASER && ng && !Netgame.DoSuperLaser) - bash_to_shield (i,"superlaser"); - - if (Objects[i].id == POW_PROXIMITY_WEAPON && ng && !Netgame.DoProximity) - bash_to_shield (i,"proximity"); - -// Special: Make all proximity bombs into shields if in hoard mode because -// we use the proximity slot in the player struct to signify how many orbs -// the player has. - - if (Objects[i].id == POW_PROXIMITY_WEAPON && ng && (Game_mode & GM_HOARD)) - bash_to_shield (i,"proximity"); - - if (Objects[i].id==POW_VULCAN_AMMO && ng && (!Netgame.DoVulcan && !Netgame.DoGauss)) - bash_to_shield(i,"vulcan ammo"); - - if (Objects[i].id == POW_SPREADFIRE_WEAPON && ng && !Netgame.DoSpread) - bash_to_shield (i,"spread"); - if (Objects[i].id == POW_SMART_MINE && ng && !Netgame.DoSmartMine) - bash_to_shield (i,"smartmine"); - if (Objects[i].id == POW_SMISSILE1_1 && ng && !Netgame.DoFlash) - bash_to_shield (i,"flash"); - if (Objects[i].id == POW_SMISSILE1_4 && ng && !Netgame.DoFlash) - bash_to_shield (i,"flash"); - if (Objects[i].id == POW_GUIDED_MISSILE_1 && ng && !Netgame.DoGuided) - bash_to_shield (i,"guided"); - if (Objects[i].id == POW_GUIDED_MISSILE_4 && ng && !Netgame.DoGuided) - bash_to_shield (i,"guided"); - if (Objects[i].id == POW_EARTHSHAKER_MISSILE && ng && !Netgame.DoEarthShaker) - bash_to_shield (i,"earth"); - if (Objects[i].id == POW_MERCURY_MISSILE_1 && ng && !Netgame.DoMercury) - bash_to_shield (i,"Mercury"); - if (Objects[i].id == POW_MERCURY_MISSILE_4 && ng && !Netgame.DoMercury) - bash_to_shield (i,"Mercury"); - if (Objects[i].id == POW_CONVERTER && ng && !Netgame.DoConverter) - bash_to_shield (i,"Converter"); - if (Objects[i].id == POW_AMMO_RACK && ng && !Netgame.DoAmmoRack) - bash_to_shield (i,"Ammo rack"); - if (Objects[i].id == POW_HEADLIGHT && ng && !Netgame.DoHeadlight) - bash_to_shield (i,"Headlight"); - if (Objects[i].id == POW_LASER && ng && !Netgame.DoLaserUpgrade) - bash_to_shield (i,"Laser powerup"); - if (Objects[i].id == POW_HOMING_AMMO_1 && ng && !Netgame.DoHoming) - bash_to_shield (i,"Homing"); - if (Objects[i].id == POW_HOMING_AMMO_4 && ng && !Netgame.DoHoming) - bash_to_shield (i,"Homing"); - if (Objects[i].id == POW_QUAD_FIRE && ng && !Netgame.DoQuadLasers) - bash_to_shield (i,"Quad Lasers"); - if (Objects[i].id == POW_FLAG_BLUE && !(Game_mode & GM_CAPTURE)) - bash_to_shield (i,"Blue flag"); - if (Objects[i].id == POW_FLAG_RED && !(Game_mode & GM_CAPTURE)) - bash_to_shield (i,"Red flag"); - } - } - + if (Objects[i].id == POW_AFTERBURNER && ng && !Netgame.DoAfterburner) + bash_to_shield (i,"afterburner"); + if (Objects[i].id == POW_FUSION_WEAPON && ng && !Netgame.DoFusions) + bash_to_shield (i,"fusion"); + if (Objects[i].id == POW_PHOENIX_WEAPON && ng && !Netgame.DoPhoenix) + bash_to_shield (i,"phoenix"); + + if (Objects[i].id == POW_HELIX_WEAPON && ng && !Netgame.DoHelix) + bash_to_shield (i,"helix"); + + if (Objects[i].id == POW_MEGA_WEAPON && ng && !Netgame.DoMegas) + bash_to_shield (i,"mega"); + + if (Objects[i].id == POW_SMARTBOMB_WEAPON && ng && !Netgame.DoSmarts) + bash_to_shield (i,"smartmissile"); + + if (Objects[i].id == POW_GAUSS_WEAPON && ng && !Netgame.DoGauss) + bash_to_shield (i,"gauss"); + + if (Objects[i].id == POW_VULCAN_WEAPON && ng && !Netgame.DoVulcan) + bash_to_shield (i,"vulcan"); + + if (Objects[i].id == POW_PLASMA_WEAPON && ng && !Netgame.DoPlasma) + bash_to_shield (i,"plasma"); + + if (Objects[i].id == POW_OMEGA_WEAPON && ng && !Netgame.DoOmega) + bash_to_shield (i,"omega"); + + if (Objects[i].id == POW_SUPER_LASER && ng && !Netgame.DoSuperLaser) + bash_to_shield (i,"superlaser"); + + if (Objects[i].id == POW_PROXIMITY_WEAPON && ng && !Netgame.DoProximity) + bash_to_shield (i,"proximity"); + + // Special: Make all proximity bombs into shields if in + // hoard mode because we use the proximity slot in the + // player struct to signify how many orbs the player has. + + if (Objects[i].id == POW_PROXIMITY_WEAPON && ng && (Game_mode & GM_HOARD)) + bash_to_shield (i,"proximity"); + + if (Objects[i].id==POW_VULCAN_AMMO && ng && (!Netgame.DoVulcan && !Netgame.DoGauss)) + bash_to_shield(i,"vulcan ammo"); + + if (Objects[i].id == POW_SPREADFIRE_WEAPON && ng && !Netgame.DoSpread) + bash_to_shield (i,"spread"); + if (Objects[i].id == POW_SMART_MINE && ng && !Netgame.DoSmartMine) + bash_to_shield (i,"smartmine"); + if (Objects[i].id == POW_SMISSILE1_1 && ng && !Netgame.DoFlash) + bash_to_shield (i,"flash"); + if (Objects[i].id == POW_SMISSILE1_4 && ng && !Netgame.DoFlash) + bash_to_shield (i,"flash"); + if (Objects[i].id == POW_GUIDED_MISSILE_1 && ng && !Netgame.DoGuided) + bash_to_shield (i,"guided"); + if (Objects[i].id == POW_GUIDED_MISSILE_4 && ng && !Netgame.DoGuided) + bash_to_shield (i,"guided"); + if (Objects[i].id == POW_EARTHSHAKER_MISSILE && ng && !Netgame.DoEarthShaker) + bash_to_shield (i,"earth"); + if (Objects[i].id == POW_MERCURY_MISSILE_1 && ng && !Netgame.DoMercury) + bash_to_shield (i,"Mercury"); + if (Objects[i].id == POW_MERCURY_MISSILE_4 && ng && !Netgame.DoMercury) + bash_to_shield (i,"Mercury"); + if (Objects[i].id == POW_CONVERTER && ng && !Netgame.DoConverter) + bash_to_shield (i,"Converter"); + if (Objects[i].id == POW_AMMO_RACK && ng && !Netgame.DoAmmoRack) + bash_to_shield (i,"Ammo rack"); + if (Objects[i].id == POW_HEADLIGHT && ng && !Netgame.DoHeadlight) + bash_to_shield (i,"Headlight"); + if (Objects[i].id == POW_LASER && ng && !Netgame.DoLaserUpgrade) + bash_to_shield (i,"Laser powerup"); + if (Objects[i].id == POW_HOMING_AMMO_1 && ng && !Netgame.DoHoming) + bash_to_shield (i,"Homing"); + if (Objects[i].id == POW_HOMING_AMMO_4 && ng && !Netgame.DoHoming) + bash_to_shield (i,"Homing"); + if (Objects[i].id == POW_QUAD_FIRE && ng && !Netgame.DoQuadLasers) + bash_to_shield (i,"Quad Lasers"); + if (Objects[i].id == POW_FLAG_BLUE && !(Game_mode & GM_CAPTURE)) + bash_to_shield (i,"Blue flag"); + if (Objects[i].id == POW_FLAG_RED && !(Game_mode & GM_CAPTURE)) + bash_to_shield (i,"Red flag"); + } + } + if (Game_mode & GM_HOARD) init_hoard_data(); - if ((Game_mode & GM_CAPTURE) || (Game_mode & GM_HOARD)) - multi_apply_goal_textures(); - + if ((Game_mode & GM_CAPTURE) || (Game_mode & GM_HOARD)) + multi_apply_goal_textures(); + multi_sort_kill_list(); multi_show_player_list(); @@ -3493,22 +3479,22 @@ void multi_apply_goal_textures() int i,j,tex; segment *seg; segment2 *seg2; - + for (i=0; i <= Highest_segment_index; i++) - { + { seg = &Segments[i]; seg2 = &Segment2s[i]; - - if (seg2->special==SEGMENT_IS_GOAL_BLUE) - { - + + if (seg2->special==SEGMENT_IS_GOAL_BLUE) + { + Goal_blue_segnum = i; if (Game_mode & GM_HOARD) tex=find_goal_texture (TMI_GOAL_HOARD); else tex=find_goal_texture (TMI_GOAL_BLUE); - + if (tex>-1) for (j = 0; j < 6; j++) { int v; @@ -3519,10 +3505,10 @@ void multi_apply_goal_textures() seg2->static_light = i2f(100); //make static light bright - } - - if (seg2->special==SEGMENT_IS_GOAL_RED) - { + } + + if (seg2->special==SEGMENT_IS_GOAL_RED) + { Goal_red_segnum = i; // Make both textures the same if Hoard mode @@ -3531,7 +3517,7 @@ void multi_apply_goal_textures() tex=find_goal_texture (TMI_GOAL_HOARD); else tex=find_goal_texture (TMI_GOAL_RED); - + if (tex>-1) for (j = 0; j < 6; j++) { int v; @@ -3541,37 +3527,37 @@ void multi_apply_goal_textures() } seg2->static_light = i2f(100); //make static light bright - } - } - } + } + } +} int find_goal_texture (ubyte t) - { - int i; - - for (i=0;itype==OBJ_PLAYER) || (objp->type==OBJ_GHOST)) + if ((objp->type==OBJ_PLAYER) || (objp->type==OBJ_GHOST)) nnp++; else if ((objp->type==OBJ_ROBOT) && (Game_mode & GM_MULTI_ROBOTS)) ; else if ( (objp->type!=OBJ_NONE) && (objp->type!=OBJ_PLAYER) && (objp->type!=OBJ_POWERUP) && (objp->type!=OBJ_CNTRLCEN) && (objp->type!=OBJ_HOSTAGE) && !(objp->type==OBJ_WEAPON && objp->id==PMINE_ID) ) { - // Before deleting object, if it's a robot, drop it's special powerup, if any + // Before deleting object, if it's a robot, drop it's special powerup, if any if (objp->type == OBJ_ROBOT) if (objp->contains_count && (objp->contains_type == OBJ_POWERUP)) object_create_egg(objp); @@ -3622,7 +3608,7 @@ int multi_delete_extra_objects() return nnp; } -void change_playernum_to( int new_Player_num ) +void change_playernum_to( int new_Player_num ) { if (Player_num > -1) memcpy( Players[new_Player_num].callsign, Players[Player_num].callsign, CALLSIGN_LEN+1 ); @@ -3630,15 +3616,15 @@ void change_playernum_to( int new_Player_num ) } int multi_all_players_alive() - { - int i; - for (i=0;iflags = INTEL_INT(pd->flags); // Powerup flags, see below... - ps->energy = (fix)INTEL_INT(pd->energy); // Amount of energy remaining. - ps->shields = (fix)INTEL_INT(pd->shields); // shields remaining (protection) - ps->lives = pd->lives; // Lives remaining, 0 = game over. - ps->laser_level = pd->laser_level; // Current level of the laser. - ps->primary_weapon_flags=pd->primary_weapon_flags; // bit set indicates the player has this weapon. - ps->secondary_weapon_flags=pd->secondary_weapon_flags; // bit set indicates the player has this weapon. + + ps->flags = INTEL_INT(pd->flags); // Powerup flags, see below... + ps->energy = (fix)INTEL_INT(pd->energy); // Amount of energy remaining. + ps->shields = (fix)INTEL_INT(pd->shields); // shields remaining (protection) + ps->lives = pd->lives; // Lives remaining, 0 = game over. + ps->laser_level = pd->laser_level; // Current level of the laser. + ps->primary_weapon_flags=pd->primary_weapon_flags; // bit set indicates the player has this weapon. + ps->secondary_weapon_flags=pd->secondary_weapon_flags; // bit set indicates the player has this weapon. for (i = 0; i < MAX_PRIMARY_WEAPONS; i++) ps->primary_ammo[i] = INTEL_SHORT(pd->primary_ammo[i]); for (i = 0; i < MAX_SECONDARY_WEAPONS; i++) ps->secondary_ammo[i] = INTEL_SHORT(pd->secondary_ammo[i]); -// memcpy( ps->primary_ammo, pd->primary_ammo, MAX_PRIMARY_WEAPONS*sizeof(short) ); // How much ammo of each type. -// memcpy( ps->secondary_ammo, pd->secondary_ammo, MAX_SECONDARY_WEAPONS*sizeof(short) ); // How much ammo of each type. + //memcpy( ps->primary_ammo, pd->primary_ammo, MAX_PRIMARY_WEAPONS*sizeof(short) ); // How much ammo of each type. + //memcpy( ps->secondary_ammo, pd->secondary_ammo, MAX_SECONDARY_WEAPONS*sizeof(short) ); // How much ammo of each type. - ps->last_score=INTEL_INT(pd->last_score); // Score at beginning of current level. - ps->score=INTEL_INT(pd->score); // Current score. - ps->cloak_time=(fix)INTEL_INT(pd->cloak_time); // Time cloaked - ps->homing_object_dist=(fix)INTEL_INT(pd->homing_object_dist); // Distance of nearest homing object. - ps->invulnerable_time=(fix)INTEL_INT(pd->invulnerable_time); // Time invulnerable + ps->last_score=INTEL_INT(pd->last_score); // Score at beginning of current level. + ps->score=INTEL_INT(pd->score); // Current score. + ps->cloak_time=(fix)INTEL_INT(pd->cloak_time); // Time cloaked + ps->homing_object_dist=(fix)INTEL_INT(pd->homing_object_dist); // Distance of nearest homing object. + ps->invulnerable_time=(fix)INTEL_INT(pd->invulnerable_time); // Time invulnerable ps->KillGoalCount=INTEL_SHORT(pd->KillGoalCount); - ps->net_killed_total=INTEL_SHORT(pd->net_killed_total); // Number of times killed total - ps->net_kills_total=INTEL_SHORT(pd->net_kills_total); // Number of net kills total - ps->num_kills_level=INTEL_SHORT(pd->num_kills_level); // Number of kills this level - ps->num_kills_total=INTEL_SHORT(pd->num_kills_total); // Number of kills total - ps->num_robots_level=INTEL_SHORT(pd->num_robots_level); // Number of initial robots this level - ps->num_robots_total=INTEL_SHORT(pd->num_robots_total); // Number of robots total - ps->hostages_rescued_total=INTEL_SHORT(pd->hostages_rescued_total); // Total number of hostages rescued. - ps->hostages_total=INTEL_SHORT(pd->hostages_total); // Total number of hostages. - ps->hostages_on_board=pd->hostages_on_board; // Number of hostages on ship. + ps->net_killed_total=INTEL_SHORT(pd->net_killed_total); // Number of times killed total + ps->net_kills_total=INTEL_SHORT(pd->net_kills_total); // Number of net kills total + ps->num_kills_level=INTEL_SHORT(pd->num_kills_level); // Number of kills this level + ps->num_kills_total=INTEL_SHORT(pd->num_kills_total); // Number of kills total + ps->num_robots_level=INTEL_SHORT(pd->num_robots_level); // Number of initial robots this level + ps->num_robots_total=INTEL_SHORT(pd->num_robots_total); // Number of robots total + ps->hostages_rescued_total=INTEL_SHORT(pd->hostages_rescued_total); // Total number of hostages rescued. + ps->hostages_total=INTEL_SHORT(pd->hostages_total); // Total number of hostages. + ps->hostages_on_board=pd->hostages_on_board; // Number of hostages on ship. } void use_netplayer_stats( player * ps, netplayer_stats *pd ) { int i; - - ps->flags = INTEL_INT(pd->flags); // Powerup flags, see below... - ps->energy = (fix)INTEL_INT((int)pd->energy); // Amount of energy remaining. - ps->shields = (fix)INTEL_INT((int)pd->shields); // shields remaining (protection) - ps->lives = pd->lives; // Lives remaining, 0 = game over. - ps->laser_level = pd->laser_level; // Current level of the laser. - ps->primary_weapon_flags=pd->primary_weapon_flags; // bit set indicates the player has this weapon. - ps->secondary_weapon_flags=pd->secondary_weapon_flags; // bit set indicates the player has this weapon. + + ps->flags = INTEL_INT(pd->flags); // Powerup flags, see below... + ps->energy = (fix)INTEL_INT((int)pd->energy); // Amount of energy remaining. + ps->shields = (fix)INTEL_INT((int)pd->shields); // shields remaining (protection) + ps->lives = pd->lives; // Lives remaining, 0 = game over. + ps->laser_level = pd->laser_level; // Current level of the laser. + ps->primary_weapon_flags=pd->primary_weapon_flags; // bit set indicates the player has this weapon. + ps->secondary_weapon_flags=pd->secondary_weapon_flags; // bit set indicates the player has this weapon. for (i = 0; i < MAX_PRIMARY_WEAPONS; i++) ps->primary_ammo[i] = INTEL_SHORT(pd->primary_ammo[i]); for (i = 0; i < MAX_SECONDARY_WEAPONS; i++) ps->secondary_ammo[i] = INTEL_SHORT(pd->secondary_ammo[i]); -// memcpy( ps->primary_ammo, pd->primary_ammo, MAX_PRIMARY_WEAPONS*sizeof(short) ); // How much ammo of each type. -// memcpy( ps->secondary_ammo, pd->secondary_ammo, MAX_SECONDARY_WEAPONS*sizeof(short) ); // How much ammo of each type. - ps->last_score = INTEL_INT(pd->last_score); // Score at beginning of current level. - ps->score = INTEL_INT(pd->score); // Current score. - ps->cloak_time = (fix)INTEL_INT((int)pd->cloak_time); // Time cloaked - ps->homing_object_dist = (fix)INTEL_INT((int)pd->homing_object_dist); // Distance of nearest homing object. - ps->invulnerable_time = (fix)INTEL_INT((int)pd->invulnerable_time); // Time invulnerable + //memcpy( ps->primary_ammo, pd->primary_ammo, MAX_PRIMARY_WEAPONS*sizeof(short) ); // How much ammo of each type. + //memcpy( ps->secondary_ammo, pd->secondary_ammo, MAX_SECONDARY_WEAPONS*sizeof(short) ); // How much ammo of each type. + ps->last_score = INTEL_INT(pd->last_score); // Score at beginning of current level. + ps->score = INTEL_INT(pd->score); // Current score. + ps->cloak_time = (fix)INTEL_INT((int)pd->cloak_time); // Time cloaked + ps->homing_object_dist = (fix)INTEL_INT((int)pd->homing_object_dist); // Distance of nearest homing object. + ps->invulnerable_time = (fix)INTEL_INT((int)pd->invulnerable_time); // Time invulnerable ps->KillGoalCount=INTEL_SHORT(pd->KillGoalCount); - ps->net_killed_total = INTEL_SHORT(pd->net_killed_total); // Number of times killed total - ps->net_kills_total = INTEL_SHORT(pd->net_kills_total); // Number of net kills total - ps->num_kills_level = INTEL_SHORT(pd->num_kills_level); // Number of kills this level - ps->num_kills_total = INTEL_SHORT(pd->num_kills_total); // Number of kills total - ps->num_robots_level = INTEL_SHORT(pd->num_robots_level); // Number of initial robots this level - ps->num_robots_total = INTEL_SHORT(pd->num_robots_total); // Number of robots total - ps->hostages_rescued_total = INTEL_SHORT(pd->hostages_rescued_total); // Total number of hostages rescued. - ps->hostages_total = INTEL_SHORT(pd->hostages_total); // Total number of hostages. - ps->hostages_on_board=pd->hostages_on_board; // Number of hostages on ship. + ps->net_killed_total = INTEL_SHORT(pd->net_killed_total); // Number of times killed total + ps->net_kills_total = INTEL_SHORT(pd->net_kills_total); // Number of net kills total + ps->num_kills_level = INTEL_SHORT(pd->num_kills_level); // Number of kills this level + ps->num_kills_total = INTEL_SHORT(pd->num_kills_total); // Number of kills total + ps->num_robots_level = INTEL_SHORT(pd->num_robots_level); // Number of initial robots this level + ps->num_robots_total = INTEL_SHORT(pd->num_robots_total); // Number of robots total + ps->hostages_rescued_total = INTEL_SHORT(pd->hostages_rescued_total); // Total number of hostages rescued. + ps->hostages_total = INTEL_SHORT(pd->hostages_total); // Total number of hostages. + ps->hostages_on_board=pd->hostages_on_board; // Number of hostages on ship. } void multi_send_drop_weapon (int objnum,int seed) - { +{ object *objp; - int count=0; + int count=0; int ammo_count; objp = &Objects[objnum]; @@ -3866,31 +3855,31 @@ void multi_send_drop_weapon (int objnum,int seed) ammo_count = objp->ctype.powerup_info.count; if (objp->id == POW_OMEGA_WEAPON && ammo_count == F1_0) - ammo_count = F1_0 - 1; //make fit in short + ammo_count = F1_0 - 1; //make fit in short + + Assert(ammo_count < F1_0); //make sure fits in short + + multibuf[count++]=(char)MULTI_DROP_WEAPON; + multibuf[count++]=(char)objp->id; - Assert(ammo_count < F1_0); //make sure fits in short + *(short *) (multibuf+count)=INTEL_SHORT(Player_num); count += 2; + *(short *) (multibuf+count)=INTEL_SHORT(objnum); count += 2; + *(short *) (multibuf+count)=INTEL_SHORT(ammo_count); count += 2; + *(int *) (multibuf+count)=INTEL_INT(seed); - multibuf[count++]=(char)MULTI_DROP_WEAPON; - multibuf[count++]=(char)objp->id; + map_objnum_local_to_local(objnum); - *(short *) (multibuf+count)=INTEL_SHORT(Player_num); count += 2; - *(short *) (multibuf+count)=INTEL_SHORT(objnum); count += 2; - *(short *) (multibuf+count)=INTEL_SHORT(ammo_count); count += 2; - *(int *) (multibuf+count)=INTEL_INT(seed); - - map_objnum_local_to_local(objnum); - - if (Game_mode & GM_NETWORK) - PowerupsInMine[objp->id]++; + if (Game_mode & GM_NETWORK) + PowerupsInMine[objp->id]++; - multi_send_data(multibuf, 12, 2); - } + multi_send_data(multibuf, 12, 2); +} void multi_do_drop_weapon (char *buf) - { - int pnum,ammo,objnum,remote_objnum,seed; +{ + int pnum,ammo,objnum,remote_objnum,seed; object *objp; - int powerup_id; + int powerup_id; powerup_id=(int)(buf[1]); pnum = INTEL_SHORT(*(short *)(buf+2)); @@ -3902,34 +3891,34 @@ void multi_do_drop_weapon (char *buf) objnum = spit_powerup(objp, powerup_id, seed); - map_objnum_local_to_remote(objnum, remote_objnum, pnum); + map_objnum_local_to_remote(objnum, remote_objnum, pnum); if (objnum!=-1) - Objects[objnum].ctype.powerup_info.count = ammo; - - if (Game_mode & GM_NETWORK) + Objects[objnum].ctype.powerup_info.count = ammo; + + if (Game_mode & GM_NETWORK) PowerupsInMine[powerup_id]++; - mprintf ((0,"Dropped weapon %d!\n")); - - } + mprintf ((0,"Dropped weapon %d!\n")); + +} void multi_send_guided_info (object *miss,char done) { #ifdef MACINTOSH shortpos sp; #endif - int count=0; + int count=0; - mprintf ((0,"Sending guided info!\n")); + mprintf ((0,"Sending guided info!\n")); - multibuf[count++]=(char)MULTI_GUIDED; - multibuf[count++]=(char)Player_num; - multibuf[count++]=done; + multibuf[count++]=(char)MULTI_GUIDED; + multibuf[count++]=(char)Player_num; + multibuf[count++]=done; #ifndef MACINTOSH - create_shortpos((shortpos *)(multibuf+count), miss,0); - count+=sizeof(shortpos); + create_shortpos((shortpos *)(multibuf+count), miss,0); + count+=sizeof(shortpos); #else create_shortpos(&sp, miss, 1); memcpy(&(multibuf[count]), (ubyte *)(sp.bytemat), 9); @@ -3938,330 +3927,331 @@ void multi_send_guided_info (object *miss,char done) count += 14; #endif - multi_send_data(multibuf, count, 0); - } + multi_send_data(multibuf, count, 0); +} void multi_do_guided (char *buf) - { - char pnum=buf[1]; - int count=3; - static int fun=200; +{ + char pnum=buf[1]; + int count=3; + static int fun=200; #ifdef MACINTOSH shortpos sp; #endif - if (Guided_missile[(int)pnum]==NULL) - { - if (++fun>=50) - { - mprintf ((0,"Guided missile for %s is NULL!\n",Players[(int)pnum].callsign)); - fun=0; - } - return; - } - else if (++fun>=50) - { - mprintf ((0,"Got guided info for %d (%s)\n",pnum,Players[(int)pnum].callsign)); - fun=0; - } + if (Guided_missile[(int)pnum]==NULL) + { + if (++fun>=50) + { + mprintf ((0,"Guided missile for %s is NULL!\n",Players[(int)pnum].callsign)); + fun=0; + } + return; + } + else if (++fun>=50) + { + mprintf ((0,"Got guided info for %d (%s)\n",pnum,Players[(int)pnum].callsign)); + fun=0; + } - if (buf[2]) - { - release_guided_missile(pnum); - return; + if (buf[2]) + { + release_guided_missile(pnum); + return; } - if (Guided_missile[(int)pnum]-Objects<0 || Guided_missile[(int)pnum]-Objects > Highest_object_index) - { - Int3(); // Get Jason immediately! - return; + if (Guided_missile[(int)pnum]-Objects<0 || Guided_missile[(int)pnum]-Objects > Highest_object_index) + { + Int3(); // Get Jason immediately! + return; } -#ifndef MACINTOSH - extract_shortpos(Guided_missile[(int)pnum], (shortpos *)(buf+count),0); +#ifndef MACINTOSH + extract_shortpos(Guided_missile[(int)pnum], (shortpos *)(buf+count),0); #else memcpy((ubyte *)(sp.bytemat), (ubyte *)(buf + count), 9); memcpy((ubyte *)&(sp.xo), (ubyte *)(buf + count + 9), 14); extract_shortpos(Guided_missile[(int)pnum], &sp, 1); #endif - count+=sizeof (shortpos); + count+=sizeof (shortpos); - update_object_seg(Guided_missile[(int)pnum]); - } + update_object_seg(Guided_missile[(int)pnum]); +} void multi_send_stolen_items () - { - int i,count=1; - multibuf[0]=MULTI_STOLEN_ITEMS; - - for (i=0;i-1 && pnum-1 && pnum=0); - Walls[wallnum].type=type; - Walls[wallnum].flags=flag; -// Assert(state <= 4); - Walls[wallnum].state=state; - - if (Walls[wallnum].type==WALL_OPEN) - { - digi_kill_sound_linked_to_segment(Walls[wallnum].segnum,Walls[wallnum].sidenum,SOUND_FORCEFIELD_HUM); - // digi_kill_sound_linked_to_segment(csegp-Segments,cside,SOUND_FORCEFIELD_HUM); - } +{ + short wallnum; + ubyte flag,type,state; + + wallnum=INTEL_SHORT( *(short *)(buf+1) ); + type=buf[3]; + flag=buf[4]; + state=buf[5]; + + Assert (wallnum>=0); + Walls[wallnum].type=type; + Walls[wallnum].flags=flag; + //Assert(state <= 4); + Walls[wallnum].state=state; - -// mprintf ((0,"Got a walls packet.\n")); - } + if (Walls[wallnum].type==WALL_OPEN) + { + digi_kill_sound_linked_to_segment(Walls[wallnum].segnum,Walls[wallnum].sidenum,SOUND_FORCEFIELD_HUM); + //digi_kill_sound_linked_to_segment(csegp-Segments,cside,SOUND_FORCEFIELD_HUM); + } + + + //mprintf ((0,"Got a walls packet.\n")); +} void multi_send_jason_cheat (int num) - { - num=num; - return; - } +{ + num=num; + return; +} void multi_send_kill_goal_counts() - { - int i,count=1; - multibuf[0]=MULTI_KILLGOALS; - - for (i=0;ibest) - { - best=Players[i].KillGoalCount; - bestnum=i; - } - } +{ + int i,best=0,bestnum=0; + object *objp; - if (bestnum==Player_num) - { - HUD_init_message("You have the best score at %d kills!",best); -// Players[Player_num].shields=i2f(200); - } - else + if (Control_center_destroyed) + return; - HUD_init_message ("%s has the best score with %d kills!",Players[bestnum].callsign,best); + for (i=0;ibest) + { + best=Players[i].KillGoalCount; + bestnum=i; + } + } + + if (bestnum==Player_num) + { + HUD_init_message("You have the best score at %d kills!",best); + //Players[Player_num].shields=i2f(200); + } + else + + HUD_init_message ("%s has the best score with %d kills!",Players[bestnum].callsign,best); + + HUD_init_message ("The control center has been destroyed!"); + + objp=obj_find_first_of_type (OBJ_CNTRLCEN); + net_destroy_controlcen (objp); +} - HUD_init_message ("The control center has been destroyed!"); - - objp=obj_find_first_of_type (OBJ_CNTRLCEN); - net_destroy_controlcen (objp); - } - void multi_send_seismic (fix start,fix end) - { - int count=1; - - multibuf[0]=MULTI_SEISMIC; - *(fix *)(multibuf+count)=(fix)INTEL_INT(start); count+=(sizeof(fix)); - *(fix *)(multibuf+count)=(fix)INTEL_INT(end); count+=(sizeof(fix)); - - multi_send_data(multibuf, count, 1); - } +{ + int count=1; + + multibuf[0]=MULTI_SEISMIC; + *(fix *)(multibuf+count)=(fix)INTEL_INT(start); count+=(sizeof(fix)); + *(fix *)(multibuf+count)=(fix)INTEL_INT(end); count+=(sizeof(fix)); + + multi_send_data(multibuf, count, 1); +} extern fix Seismic_disturbance_start_time; extern fix Seismic_disturbance_end_time; - + void multi_do_seismic (char *buf) - { - Seismic_disturbance_start_time=(fix)INTEL_INT( *(int *)(buf+1) ); - Seismic_disturbance_end_time=(fix)INTEL_INT( *(int *)(buf+5) ); - digi_play_sample (SOUND_SEISMIC_DISTURBANCE_START, F1_0); - } +{ + Seismic_disturbance_start_time=(fix)INTEL_INT( *(int *)(buf+1) ); + Seismic_disturbance_end_time=(fix)INTEL_INT( *(int *)(buf+5) ); + digi_play_sample (SOUND_SEISMIC_DISTURBANCE_START, F1_0); +} void multi_send_light (int segnum,ubyte val) - { - int count=1,i; - multibuf[0]=MULTI_LIGHT; - *(int *)(multibuf+count)=INTEL_INT(segnum); count+=(sizeof(int)); - *(char *)(multibuf+count)=val; count++; - for (i=0;i<6;i++) +{ + int count=1,i; + multibuf[0]=MULTI_LIGHT; + *(int *)(multibuf+count)=INTEL_INT(segnum); count+=(sizeof(int)); + *(char *)(multibuf+count)=val; count++; + for (i=0;i<6;i++) { - //mprintf ((0,"Sending %d!\n",Segments[segnum].sides[i].tmap_num2)); - *(short *)(multibuf+count)=INTEL_SHORT(Segments[segnum].sides[i].tmap_num2); count+=2; + //mprintf ((0,"Sending %d!\n",Segments[segnum].sides[i].tmap_num2)); + *(short *)(multibuf+count)=INTEL_SHORT(Segments[segnum].sides[i].tmap_num2); count+=2; } - multi_send_data(multibuf, count, 1); - } + multi_send_data(multibuf, count, 1); +} void multi_send_light_specific (int pnum,int segnum,ubyte val) - { - int count=1,i; +{ + int count=1,i; - Assert (Game_mode & GM_NETWORK); -// Assert (pnum>-1 && pnum-1 && pnum= N_players) || (pnum == Player_num)) //@@ { @@ -4274,8 +4264,8 @@ void multi_do_light (char *buf) //@@ return; //@@ } //@@ -//@@ if (!(Triggers[trigger].flags & TF_SPRUNG)) -//@@ check_trigger_sub(trigger, pnum,0); +//@@ if (!(Triggers[trigger].flags & TF_SPRUNG)) +//@@ check_trigger_sub(trigger, pnum,0); //@@} @@ -4289,71 +4279,71 @@ void multi_do_flags (char *buf) } void multi_send_flags (char pnum) - { - multibuf[0]=MULTI_FLAGS; - multibuf[1]=pnum; - *(uint *)(multibuf+2)=INTEL_INT(Players[(int)pnum].flags); - - multi_send_data(multibuf, 6, 1); - } - +{ + multibuf[0]=MULTI_FLAGS; + multibuf[1]=pnum; + *(uint *)(multibuf+2)=INTEL_INT(Players[(int)pnum].flags); + + multi_send_data(multibuf, 6, 1); +} + void multi_send_drop_blobs (char pnum) - { - multibuf[0]=MULTI_DROP_BLOB; - multibuf[1]=pnum; +{ + multibuf[0]=MULTI_DROP_BLOB; + multibuf[1]=pnum; - multi_send_data(multibuf, 2, 0); - } + multi_send_data(multibuf, 2, 0); +} void multi_do_drop_blob (char *buf) - { - char pnum=buf[1]; - drop_afterburner_blobs (&Objects[Players[(int)pnum].objnum], 2, i2f(5)/2, -1); - } +{ + char pnum=buf[1]; + drop_afterburner_blobs (&Objects[Players[(int)pnum].objnum], 2, i2f(5)/2, -1); +} void multi_send_powerup_update () - { - int i; +{ + int i; - - multibuf[0]=MULTI_POWERUP_UPDATE; - for (i=0;iMaxPowerupsAllowed[i]) - MaxPowerupsAllowed[i]=buf[i+1]; - } + for (i=0;iMaxPowerupsAllowed[i]) + MaxPowerupsAllowed[i]=buf[i+1]; +} extern active_door ActiveDoors[]; -extern int Num_open_doors; // Number of open doors - +extern int Num_open_doors; // Number of open doors + void multi_send_active_door (char i) { int count; - + multibuf[0]=MULTI_ACTIVE_DOOR; multibuf[1]=i; - multibuf[2]=Num_open_doors; + multibuf[2]=Num_open_doors; count = 3; #ifndef MACINTOSH memcpy ((char *)(&multibuf[3]),&ActiveDoors[(int)i],sizeof(struct active_door)); count += sizeof(active_door); #else - *(int *)(multibuf + count) = INTEL_INT(ActiveDoors[i].n_parts); count += 4; - *(short *)(multibuf + count) = INTEL_SHORT(ActiveDoors[i].front_wallnum[0]); count += 2; - *(short *)(multibuf + count) = INTEL_SHORT(ActiveDoors[i].front_wallnum[1]); count += 2; - *(short *)(multibuf + count) = INTEL_SHORT(ActiveDoors[i].back_wallnum[0]); count += 2; - *(short *)(multibuf + count) = INTEL_SHORT(ActiveDoors[i].back_wallnum[1]); count += 2; - *(int *)(multibuf + count) = INTEL_INT(ActiveDoors[i].time); count += 4; + *(int *)(multibuf + count) = INTEL_INT(ActiveDoors[i].n_parts); count += 4; + *(short *)(multibuf + count) = INTEL_SHORT(ActiveDoors[i].front_wallnum[0]); count += 2; + *(short *)(multibuf + count) = INTEL_SHORT(ActiveDoors[i].front_wallnum[1]) count += 2; + *(short *)(multibuf + count) = INTEL_SHORT(ActiveDoors[i].back_wallnum[0]); count += 2; + *(short *)(multibuf + count) = INTEL_SHORT(ActiveDoors[i].back_wallnum[1]); count += 2; + *(int *)(multibuf + count) = INTEL_INT(ActiveDoors[i].time); count += 4; #endif -// multi_send_data (multibuf,sizeof(struct active_door)+3,1); + //multi_send_data (multibuf,sizeof(struct active_door)+3,1); multi_send_data (multibuf,count,1); } @@ -4362,90 +4352,90 @@ void multi_do_active_door (char *buf) int count; char i=multibuf[1]; Num_open_doors=buf[2]; - + count = 3; #ifndef MACINTOSH memcpy (&ActiveDoors[(int)i],buf+count,sizeof(struct active_door)); #else - ActiveDoors[i].n_parts = INTEL_INT( *(int *)(buf+count) ); count += 4; - ActiveDoors[i].front_wallnum[0] = INTEL_SHORT( *(short *)(buf+count) ); count +=2; - ActiveDoors[i].front_wallnum[1] = INTEL_SHORT( *(short *)(buf+count) ); count +=2; - ActiveDoors[i].back_wallnum[0] = INTEL_SHORT( *(short *)(buf+count) ); count +=2; - ActiveDoors[i].back_wallnum[1] = INTEL_SHORT( *(short *)(buf+count) ); count +=2; - ActiveDoors[i].time = INTEL_INT( *(int *)(buf+count) ); count += 4; + ActiveDoors[i].n_parts = INTEL_INT( *(int *)(buf+count) ); count += 4; + ActiveDoors[i].front_wallnum[0] = INTEL_SHORT( *(short *)(buf+count) ); count +=2; + ActiveDoors[i].front_wallnum[1] = INTEL_SHORT( *(short *)(buf+count) ); count +=2; + ActiveDoors[i].back_wallnum[0] = INTEL_SHORT( *(short *)(buf+count) ); count +=2; + ActiveDoors[i].back_wallnum[1] = INTEL_SHORT( *(short *)(buf+count) ); count +=2; + ActiveDoors[i].time = INTEL_INT( *(int *)(buf+count) ); count += 4; #endif -} +} void multi_send_sound_function (char whichfunc,char sound) { int count=0; - - multibuf[0]=MULTI_SOUND_FUNCTION; count++; - multibuf[1]=Player_num; count++; - multibuf[2]=whichfunc; count++; - #ifndef MACINTOSH - *(uint *)(multibuf+count)=sound; count++; - #else - multibuf[3] = sound; count++; // this would probably work on the PC as well. Jason? - #endif + + multibuf[0]=MULTI_SOUND_FUNCTION; count++; + multibuf[1]=Player_num; count++; + multibuf[2]=whichfunc; count++; +#ifndef MACINTOSH + *(uint *)(multibuf+count)=sound; count++; +#else + multibuf[3] = sound; count++; // this would probably work on the PC as well. Jason? +#endif multi_send_data (multibuf,4,0); } -#define AFTERBURNER_LOOP_START 20098 -#define AFTERBURNER_LOOP_END 25776 +#define AFTERBURNER_LOOP_START 20098 +#define AFTERBURNER_LOOP_END 25776 void multi_do_sound_function (char *buf) { - // for afterburner - + // for afterburner + char pnum,whichfunc; - int sound; + int sound; - if (Players[Player_num].connected!=1) - return; + if (Players[Player_num].connected!=1) + return; - pnum=buf[1]; + pnum=buf[1]; whichfunc=buf[2]; sound=buf[3]; - + if (whichfunc==0) digi_kill_sound_linked_to_object (Players[(int)pnum].objnum); else if (whichfunc==3) - digi_link_sound_to_object3( sound, Players[(int)pnum].objnum, 1,F1_0, i2f(256), AFTERBURNER_LOOP_START, AFTERBURNER_LOOP_END); -} + digi_link_sound_to_object3( sound, Players[(int)pnum].objnum, 1,F1_0, i2f(256), AFTERBURNER_LOOP_START, AFTERBURNER_LOOP_END); +} void multi_send_capture_bonus (char pnum) { - Assert (Game_mode & GM_CAPTURE); - - multibuf[0]=MULTI_CAPTURE_BONUS; - multibuf[1]=pnum; + Assert (Game_mode & GM_CAPTURE); - multi_send_data (multibuf,2,1); - multi_do_capture_bonus (multibuf); + multibuf[0]=MULTI_CAPTURE_BONUS; + multibuf[1]=pnum; + + multi_send_data (multibuf,2,1); + multi_do_capture_bonus (multibuf); } void multi_send_orb_bonus (char pnum) { - Assert (Game_mode & GM_HOARD); - - multibuf[0]=MULTI_ORB_BONUS; - multibuf[1]=pnum; - multibuf[2]=Players[Player_num].secondary_ammo[PROXIMITY_INDEX]; + Assert (Game_mode & GM_HOARD); + + multibuf[0]=MULTI_ORB_BONUS; + multibuf[1]=pnum; + multibuf[2]=Players[Player_num].secondary_ammo[PROXIMITY_INDEX]; - multi_send_data (multibuf,3,1); - multi_do_orb_bonus (multibuf); + multi_send_data (multibuf,3,1); + multi_do_orb_bonus (multibuf); } void multi_do_capture_bonus(char *buf) { // Figure out the results of a network kills and add it to the // appropriate player's tally. - char pnum=buf[1]; - int TheGoal; + char pnum=buf[1]; + int TheGoal; kmatrix_kills_changed = 1; - - if (pnum==Player_num) + + if (pnum==Player_num) HUD_init_message("You have Scored!"); else HUD_init_message("%s has Scored!",Players[(int)pnum].callsign); @@ -4463,23 +4453,23 @@ void multi_do_capture_bonus(char *buf) Players[(int)pnum].net_kills_total += 5; Players[(int)pnum].KillGoalCount+=5; - if (Netgame.KillGoal>0) + if (Netgame.KillGoal>0) { - TheGoal=Netgame.KillGoal*5; + TheGoal=Netgame.KillGoal*5; - if (Players[(int)pnum].KillGoalCount>=TheGoal) - { - if (pnum==Player_num) - { - HUD_init_message("You reached the kill goal!"); - Players[Player_num].shields=i2f(200); - } - else - HUD_init_message ("%s has reached the kill goal!",Players[(int)pnum].callsign); + if (Players[(int)pnum].KillGoalCount>=TheGoal) + { + if (pnum==Player_num) + { + HUD_init_message("You reached the kill goal!"); + Players[Player_num].shields=i2f(200); + } + else + HUD_init_message ("%s has reached the kill goal!",Players[(int)pnum].callsign); - HUD_init_message ("The control center has been destroyed!"); - net_destroy_controlcen (obj_find_first_of_type (OBJ_CNTRLCEN)); - } + HUD_init_message ("The control center has been destroyed!"); + net_destroy_controlcen (obj_find_first_of_type (OBJ_CNTRLCEN)); + } } multi_sort_kill_list(); @@ -4487,25 +4477,25 @@ void multi_do_capture_bonus(char *buf) } int GetOrbBonus (char num) - { - int bonus; +{ + int bonus; - bonus=num*(num+1)/2; - return (bonus); - } + bonus=num*(num+1)/2; + return (bonus); +} void multi_do_orb_bonus(char *buf) { // Figure out the results of a network kills and add it to the // appropriate player's tally. - char pnum=buf[1]; - int TheGoal; + char pnum=buf[1]; + int TheGoal; int bonus=GetOrbBonus (buf[2]); kmatrix_kills_changed = 1; - - if (pnum==Player_num) + + if (pnum==Player_num) HUD_init_message("You have scored %d points!",bonus); else HUD_init_message("%s has scored with %d orbs!",Players[(int)pnum].callsign,buf[2]); @@ -4513,28 +4503,28 @@ void multi_do_orb_bonus(char *buf) if (pnum==Player_num) digi_start_sound_queued (SOUND_HUD_YOU_GOT_GOAL,F1_0*2); else if (Game_mode & GM_TEAM) - { - if (get_team(pnum)==TEAM_RED) - digi_play_sample (SOUND_HUD_RED_GOT_GOAL,F1_0*2); - else - digi_play_sample (SOUND_HUD_BLUE_GOT_GOAL,F1_0*2); - } + { + if (get_team(pnum)==TEAM_RED) + digi_play_sample (SOUND_HUD_RED_GOT_GOAL,F1_0*2); + else + digi_play_sample (SOUND_HUD_BLUE_GOT_GOAL,F1_0*2); + } else digi_play_sample (SOUND_OPPONENT_HAS_SCORED,F1_0*2); - if (bonus>PhallicLimit) + if (bonus>PhallicLimit) { - if (pnum==Player_num) - HUD_init_message ("You have the record with %d points!",bonus); - else - HUD_init_message ("%s has the record with %d points!",Players[(int)pnum].callsign,bonus); - digi_play_sample (SOUND_BUDDY_MET_GOAL,F1_0*2); - PhallicMan=pnum; - PhallicLimit=bonus; - } + if (pnum==Player_num) + HUD_init_message ("You have the record with %d points!",bonus); + else + HUD_init_message ("%s has the record with %d points!",Players[(int)pnum].callsign,bonus); + digi_play_sample (SOUND_BUDDY_MET_GOAL,F1_0*2); + PhallicMan=pnum; + PhallicLimit=bonus; + } Players[(int)pnum].flags &= ~(PLAYER_FLAGS_FLAG); // Clear orb flag - + team_kills[get_team(pnum)] += bonus; Players[(int)pnum].net_kills_total += bonus; Players[(int)pnum].KillGoalCount+=bonus; @@ -4543,23 +4533,23 @@ void multi_do_orb_bonus(char *buf) Players[(int)pnum].net_kills_total%=1000; Players[(int)pnum].KillGoalCount%=1000; - if (Netgame.KillGoal>0) + if (Netgame.KillGoal>0) { - TheGoal=Netgame.KillGoal*5; - - if (Players[(int)pnum].KillGoalCount>=TheGoal) - { - if (pnum==Player_num) - { - HUD_init_message("You reached the kill goal!"); - Players[Player_num].shields=i2f(200); - } - else - HUD_init_message ("%s has reached the kill goal!",Players[(int)pnum].callsign); - - HUD_init_message ("The control center has been destroyed!"); - net_destroy_controlcen (obj_find_first_of_type (OBJ_CNTRLCEN)); - } + TheGoal=Netgame.KillGoal*5; + + if (Players[(int)pnum].KillGoalCount>=TheGoal) + { + if (pnum==Player_num) + { + HUD_init_message("You reached the kill goal!"); + Players[Player_num].shields=i2f(200); + } + else + HUD_init_message ("%s has reached the kill goal!",Players[(int)pnum].callsign); + + HUD_init_message ("The control center has been destroyed!"); + net_destroy_controlcen (obj_find_first_of_type (OBJ_CNTRLCEN)); + } } multi_sort_kill_list(); multi_show_player_list(); @@ -4567,13 +4557,13 @@ void multi_do_orb_bonus(char *buf) void multi_send_got_flag (char pnum) { - multibuf[0]=MULTI_GOT_FLAG; - multibuf[1]=pnum; - - digi_start_sound_queued (SOUND_HUD_YOU_GOT_FLAG,F1_0*2); + multibuf[0]=MULTI_GOT_FLAG; + multibuf[1]=pnum; + + digi_start_sound_queued (SOUND_HUD_YOU_GOT_FLAG,F1_0*2); - multi_send_data (multibuf,2,1); - multi_send_flags (Player_num); + multi_send_data (multibuf,2,1); + multi_send_flags (Player_num); } int SoundHacked=0; @@ -4581,45 +4571,45 @@ digi_sound ReversedSound; void multi_send_got_orb (char pnum) { - multibuf[0]=MULTI_GOT_ORB; - multibuf[1]=pnum; - - digi_play_sample (SOUND_YOU_GOT_ORB,F1_0*2); + multibuf[0]=MULTI_GOT_ORB; + multibuf[1]=pnum; - multi_send_data (multibuf,2,1); - multi_send_flags (Player_num); + digi_play_sample (SOUND_YOU_GOT_ORB,F1_0*2); + + multi_send_data (multibuf,2,1); + multi_send_flags (Player_num); } void multi_do_got_flag (char *buf) { char pnum=buf[1]; - if (pnum==Player_num) + if (pnum==Player_num) digi_start_sound_queued (SOUND_HUD_YOU_GOT_FLAG,F1_0*2); else if (get_team(pnum)==TEAM_RED) digi_start_sound_queued (SOUND_HUD_RED_GOT_FLAG,F1_0*2); - else + else digi_start_sound_queued (SOUND_HUD_BLUE_GOT_FLAG,F1_0*2); - Players[(int)pnum].flags|=PLAYER_FLAGS_FLAG; + Players[(int)pnum].flags|=PLAYER_FLAGS_FLAG; HUD_init_message ("%s picked up a flag!",Players[(int)pnum].callsign); } void multi_do_got_orb (char *buf) { char pnum=buf[1]; - Assert (Game_mode & GM_HOARD); + Assert (Game_mode & GM_HOARD); - if (Game_mode & GM_TEAM) - { - if (get_team(pnum)==get_team(Player_num)) - digi_play_sample (SOUND_FRIEND_GOT_ORB,F1_0*2); - else - digi_play_sample (SOUND_OPPONENT_GOT_ORB,F1_0*2); + if (Game_mode & GM_TEAM) + { + if (get_team(pnum)==get_team(Player_num)) + digi_play_sample (SOUND_FRIEND_GOT_ORB,F1_0*2); + else + digi_play_sample (SOUND_OPPONENT_GOT_ORB,F1_0*2); } - else - digi_play_sample (SOUND_OPPONENT_GOT_ORB,F1_0*2); + else + digi_play_sample (SOUND_OPPONENT_GOT_ORB,F1_0*2); - Players[(int)pnum].flags|=PLAYER_FLAGS_FLAG; + Players[(int)pnum].flags|=PLAYER_FLAGS_FLAG; HUD_init_message ("%s picked up an orb!",Players[(int)pnum].callsign); } @@ -4629,32 +4619,32 @@ void DropOrb () int objnum,seed; if (!(Game_mode & GM_HOARD)) - Int3(); // How did we get here? Get Leighton! + Int3(); // How did we get here? Get Leighton! if (!Players[Player_num].secondary_ammo[PROXIMITY_INDEX]) { - HUD_init_message("No orbs to drop!"); + HUD_init_message("No orbs to drop!"); return; } seed = d_rand(); - objnum = spit_powerup(ConsoleObject,POW_HOARD_ORB,seed); - - if (objnum<0) + objnum = spit_powerup(ConsoleObject,POW_HOARD_ORB,seed); + + if (objnum<0) return; HUD_init_message("Orb dropped!"); digi_play_sample (SOUND_DROP_WEAPON,F1_0); if ((Game_mode & GM_HOARD) && objnum>-1) - multi_send_drop_flag(objnum,seed); - + multi_send_drop_flag(objnum,seed); + Players[Player_num].secondary_ammo[PROXIMITY_INDEX]--; - // If empty, tell everyone to stop drawing the box around me + // If empty, tell everyone to stop drawing the box around me if (Players[Player_num].secondary_ammo[PROXIMITY_INDEX]==0) - multi_send_flags (Player_num); + multi_send_flags (Player_num); } void DropFlag () @@ -4667,11 +4657,11 @@ void DropFlag () { DropOrb(); return; - } + } if (!(Players[Player_num].flags & PLAYER_FLAGS_FLAG)) { - HUD_init_message("No flag to drop!"); + HUD_init_message("No flag to drop!"); return; } @@ -4681,12 +4671,12 @@ void DropFlag () seed = d_rand(); - if (get_team (Player_num)==TEAM_RED) - objnum = spit_powerup(ConsoleObject,POW_FLAG_BLUE,seed); + if (get_team (Player_num)==TEAM_RED) + objnum = spit_powerup(ConsoleObject,POW_FLAG_BLUE,seed); else - objnum = spit_powerup(ConsoleObject,POW_FLAG_RED,seed); - - if (objnum<0) + objnum = spit_powerup(ConsoleObject,POW_FLAG_RED,seed); + + if (objnum<0) return; if ((Game_mode & GM_CAPTURE) && objnum>-1) @@ -4705,19 +4695,19 @@ void multi_send_drop_flag (int objnum,int seed) multibuf[count++]=(char)MULTI_DROP_FLAG; multibuf[count++]=(char)objp->id; - + *(short *) (multibuf+count)=INTEL_SHORT(Player_num); count += 2; *(short *) (multibuf+count)=INTEL_SHORT(objnum); count += 2; *(short *) (multibuf+count)=INTEL_SHORT(objp->ctype.powerup_info.count); count += 2; *(int *) (multibuf+count)=INTEL_INT(seed); - + map_objnum_local_to_local(objnum); - - if (!(Game_mode & GM_HOARD)) + + if (!(Game_mode & GM_HOARD)) if (Game_mode & GM_NETWORK) PowerupsInMine[objp->id]++; - multi_send_data(multibuf, 12, 2); + multi_send_data(multibuf, 12, 2); } void multi_do_drop_flag (char *buf) @@ -4736,26 +4726,26 @@ void multi_do_drop_flag (char *buf) objnum = spit_powerup(objp, powerup_id, seed); - map_objnum_local_to_remote(objnum, remote_objnum, pnum); + map_objnum_local_to_remote(objnum, remote_objnum, pnum); if (objnum!=-1) - Objects[objnum].ctype.powerup_info.count = ammo; - + Objects[objnum].ctype.powerup_info.count = ammo; + if (!(Game_mode & GM_HOARD)) { if (Game_mode & GM_NETWORK) PowerupsInMine[powerup_id]++; - Players[pnum].flags &= ~(PLAYER_FLAGS_FLAG); - } + Players[pnum].flags &= ~(PLAYER_FLAGS_FLAG); + } mprintf ((0,"Dropped flag %d!\n")); - + } void multi_bad_restore () { Function_mode = FMODE_MENU; - nm_messagebox(NULL, 1, TXT_OK, -"A multi-save game was restored\nthat you are missing or does not\nmatch that of the others.\nYou must rejoin if you wish to\ncontinue."); + nm_messagebox(NULL, 1, TXT_OK, + "A multi-save game was restored\nthat you are missing or does not\nmatch that of the others.\nYou must rejoin if you wish to\ncontinue."); Function_mode = FMODE_GAME; multi_quit_game = 1; multi_leave_menu = 1; @@ -4773,312 +4763,313 @@ extern byte robot_fire_buf[MAX_ROBOTS_CONTROLLED][18+3]; void multi_send_robot_controls (char pnum) - { - int count=2; - - mprintf ((0,"Sending ROBOT_CONTROLS!!!\n")); - - multibuf[0]=MULTI_ROBOT_CONTROLS; - multibuf[1]=pnum; - memcpy (&(multibuf[count]),&robot_controlled,MAX_ROBOTS_CONTROLLED*4); - count+=(MAX_ROBOTS_CONTROLLED*4); - memcpy (&(multibuf[count]),&robot_agitation,MAX_ROBOTS_CONTROLLED*4); - count+=(MAX_ROBOTS_CONTROLLED*4); - memcpy (&(multibuf[count]),&robot_controlled_time,MAX_ROBOTS_CONTROLLED*4); - count+=(MAX_ROBOTS_CONTROLLED*4); - memcpy (&(multibuf[count]),&robot_last_send_time,MAX_ROBOTS_CONTROLLED*4); - count+=(MAX_ROBOTS_CONTROLLED*4); - memcpy (&(multibuf[count]),&robot_last_message_time,MAX_ROBOTS_CONTROLLED*4); - count+=(MAX_ROBOTS_CONTROLLED*4); - memcpy (&(multibuf[count]),&robot_send_pending,MAX_ROBOTS_CONTROLLED*4); - count+=(MAX_ROBOTS_CONTROLLED*4); - memcpy (&(multibuf[count]),&robot_fired,MAX_ROBOTS_CONTROLLED*4); - count+=(MAX_ROBOTS_CONTROLLED*4); - - network_send_naked_packet (multibuf,142,pnum); - } +{ + int count=2; + + mprintf ((0,"Sending ROBOT_CONTROLS!!!\n")); + + multibuf[0]=MULTI_ROBOT_CONTROLS; + multibuf[1]=pnum; + memcpy (&(multibuf[count]),&robot_controlled,MAX_ROBOTS_CONTROLLED*4); + count+=(MAX_ROBOTS_CONTROLLED*4); + memcpy (&(multibuf[count]),&robot_agitation,MAX_ROBOTS_CONTROLLED*4); + count+=(MAX_ROBOTS_CONTROLLED*4); + memcpy (&(multibuf[count]),&robot_controlled_time,MAX_ROBOTS_CONTROLLED*4); + count+=(MAX_ROBOTS_CONTROLLED*4); + memcpy (&(multibuf[count]),&robot_last_send_time,MAX_ROBOTS_CONTROLLED*4); + count+=(MAX_ROBOTS_CONTROLLED*4); + memcpy (&(multibuf[count]),&robot_last_message_time,MAX_ROBOTS_CONTROLLED*4); + count+=(MAX_ROBOTS_CONTROLLED*4); + memcpy (&(multibuf[count]),&robot_send_pending,MAX_ROBOTS_CONTROLLED*4); + count+=(MAX_ROBOTS_CONTROLLED*4); + memcpy (&(multibuf[count]),&robot_fired,MAX_ROBOTS_CONTROLLED*4); + count+=(MAX_ROBOTS_CONTROLLED*4); + + network_send_naked_packet (multibuf,142,pnum); +} void multi_do_robot_controls(char *buf) - { - int count=2; +{ + int count=2; - mprintf ((0,"Recieved ROBOT_CONTROLS!!!\n")); - - if (buf[1]!=Player_num) + mprintf ((0,"Recieved ROBOT_CONTROLS!!!\n")); + + if (buf[1]!=Player_num) { - Int3(); // Get Jason! Recieved a coop_sync that wasn't ours! - return; - } + Int3(); // Get Jason! Recieved a coop_sync that wasn't ours! + return; + } - memcpy (&robot_controlled,&(buf[count]),MAX_ROBOTS_CONTROLLED*4); - count+=(MAX_ROBOTS_CONTROLLED*4); - memcpy (&robot_agitation,&(buf[count]),MAX_ROBOTS_CONTROLLED*4); - count+=(MAX_ROBOTS_CONTROLLED*4); - memcpy (&robot_controlled_time,&(buf[count]),MAX_ROBOTS_CONTROLLED*4); - count+=(MAX_ROBOTS_CONTROLLED*4); - memcpy (&robot_last_send_time,&(buf[count]),MAX_ROBOTS_CONTROLLED*4); - count+=(MAX_ROBOTS_CONTROLLED*4); - memcpy (&robot_last_message_time,&(buf[count]),MAX_ROBOTS_CONTROLLED*4); - count+=(MAX_ROBOTS_CONTROLLED*4); - memcpy (&robot_send_pending,&(buf[count]),MAX_ROBOTS_CONTROLLED*4); - count+=(MAX_ROBOTS_CONTROLLED*4); - memcpy (&robot_fired,&(buf[count]),MAX_ROBOTS_CONTROLLED*4); - count+=(MAX_ROBOTS_CONTROLLED*4); - } + memcpy (&robot_controlled,&(buf[count]),MAX_ROBOTS_CONTROLLED*4); + count+=(MAX_ROBOTS_CONTROLLED*4); + memcpy (&robot_agitation,&(buf[count]),MAX_ROBOTS_CONTROLLED*4); + count+=(MAX_ROBOTS_CONTROLLED*4); + memcpy (&robot_controlled_time,&(buf[count]),MAX_ROBOTS_CONTROLLED*4); + count+=(MAX_ROBOTS_CONTROLLED*4); + memcpy (&robot_last_send_time,&(buf[count]),MAX_ROBOTS_CONTROLLED*4); + count+=(MAX_ROBOTS_CONTROLLED*4); + memcpy (&robot_last_message_time,&(buf[count]),MAX_ROBOTS_CONTROLLED*4); + count+=(MAX_ROBOTS_CONTROLLED*4); + memcpy (&robot_send_pending,&(buf[count]),MAX_ROBOTS_CONTROLLED*4); + count+=(MAX_ROBOTS_CONTROLLED*4); + memcpy (&robot_fired,&(buf[count]),MAX_ROBOTS_CONTROLLED*4); + count+=(MAX_ROBOTS_CONTROLLED*4); +} #define POWERUPADJUSTS 5 int PowerupAdjustMapping[]={11,19,39,41,44}; int multi_powerup_is_4pack (int id) - { - int i; - - for (i=0;irank) - strcpy (rankstr,"demoted"); - else - return; - - NetPlayers.players[(int)pnum].rank=rank; - - if (!FindArg("-norankings")) - HUD_init_message ("%s has been %s to %s!",Players[(int)pnum].callsign,rankstr,RankStrings[(int)rank]); - } +{ + char rankstr[20]; + char pnum=buf[1]; + char rank=buf[2]; + + if (NetPlayers.players[(int)pnum].rankrank) + strcpy (rankstr,"demoted"); + else + return; + + NetPlayers.players[(int)pnum].rank=rank; + + if (!FindArg("-norankings")) + HUD_init_message ("%s has been %s to %s!",Players[(int)pnum].callsign,rankstr,RankStrings[(int)rank]); +} void multi_send_modem_ping () { - multibuf[0]=MULTI_MODEM_PING; - multi_send_data (multibuf,1,1); + multibuf[0]=MULTI_MODEM_PING; + multi_send_data (multibuf,1,1); } void multi_send_modem_ping_return () - { - multibuf[0]=MULTI_MODEM_PING_RETURN; - multi_send_data (multibuf,1,1); - } +{ + multibuf[0]=MULTI_MODEM_PING_RETURN; + multi_send_data (multibuf,1,1); +} void multi_do_modem_ping_return () - { - if (PingLaunchTime==0) +{ + if (PingLaunchTime==0) { - mprintf ((0,"Got invalid PING RETURN from opponent!\n")); - return; - } - - PingReturnTime=timer_get_fixed_seconds(); + mprintf ((0,"Got invalid PING RETURN from opponent!\n")); + return; + } - HUD_init_message ("Ping time for opponent is %d ms!",f2i(fixmul(PingReturnTime-PingLaunchTime,i2f(1000)))); - PingLaunchTime=0; - } + PingReturnTime=timer_get_fixed_seconds(); + HUD_init_message ("Ping time for opponent is %d ms!",f2i(fixmul(PingReturnTime-PingLaunchTime,i2f(1000)))); + PingLaunchTime=0; +} -void multi_quick_sound_hack (int num) - { - int length,i; - num = digi_xlat_sound(num); - length=GameSounds[num].length; - ReversedSound.data=(ubyte *)d_malloc (length); - ReversedSound.length=length; - - for (i=0;i"); + Error("can't open "); n_orb_frames = cfile_read_short(ifile); orb_w = cfile_read_short(ifile); @@ -5175,17 +5166,17 @@ void init_hoard_data() //Create obj powerup Powerup_info[POW_HOARD_ORB].vclip_num = orb_vclip; - Powerup_info[POW_HOARD_ORB].hit_sound = -1; //Powerup_info[POW_SHIELD_BOOST].hit_sound; + Powerup_info[POW_HOARD_ORB].hit_sound = -1; //Powerup_info[POW_SHIELD_BOOST].hit_sound; Powerup_info[POW_HOARD_ORB].size = Powerup_info[POW_SHIELD_BOOST].size; Powerup_info[POW_HOARD_ORB].light = Powerup_info[POW_SHIELD_BOOST].light; //Create orb goal wall effect Hoard_goal_eclip = Num_effects++; Assert(Num_effects < MAX_EFFECTS); - Effects[Hoard_goal_eclip] = Effects[94]; //copy from blue goal + Effects[Hoard_goal_eclip] = Effects[94]; //copy from blue goal Effects[Hoard_goal_eclip].changing_wall_texture = NumTextures; Effects[Hoard_goal_eclip].vc.num_frames=n_goal_frames; - + TmapInfo[NumTextures] = TmapInfo[find_goal_texture(TMI_GOAL_BLUE)]; TmapInfo[NumTextures].eclip_num = Hoard_goal_eclip; TmapInfo[NumTextures].flags = TMI_GOAL_HOARD; @@ -5210,7 +5201,7 @@ void init_hoard_data() } //Load and remap bitmap data for goal texture - cfile_read_short(ifile); //skip frame count + cfile_read_short(ifile); //skip frame count cfread(palette,3,256,ifile); for (i=0;i MULTI_MAX_TYPE) { mprintf((1, "multi_process_data: invalid type %d.\n", type)); @@ -5284,141 +5275,141 @@ multi_process_data(char *buf, int len) } - #ifdef NETPROFILING - TTRecv[type]++; - fprintf (RecieveLogFile,"Packet type: %d Len:%d TT=%d\n",type,len,TTRecv[type]); - fflush (RecieveLogFile); - #endif - - switch(type) +#ifdef NETPROFILING + TTRecv[type]++; + fprintf (RecieveLogFile,"Packet type: %d Len:%d TT=%d\n",type,len,TTRecv[type]); + fflush (RecieveLogFile); +#endif + + switch(type) { - case MULTI_POSITION: - if (!Endlevel_sequence) multi_do_position(buf); break; - case MULTI_REAPPEAR: - if (!Endlevel_sequence) multi_do_reappear(buf); break; - case MULTI_FIRE: - if (!Endlevel_sequence) multi_do_fire(buf); break; - case MULTI_KILL: - multi_do_kill(buf); break; - case MULTI_REMOVE_OBJECT: - if (!Endlevel_sequence) multi_do_remobj(buf); break; - case MULTI_PLAYER_DROP: - case MULTI_PLAYER_EXPLODE: - if (!Endlevel_sequence) multi_do_player_explode(buf); break; - case MULTI_MESSAGE: - if (!Endlevel_sequence) multi_do_message(buf); break; - case MULTI_QUIT: - if (!Endlevel_sequence) multi_do_quit(buf); break; - case MULTI_BEGIN_SYNC: - break; - case MULTI_CONTROLCEN: - if (!Endlevel_sequence) multi_do_controlcen_destroy(buf); break; - case MULTI_POWERUP_UPDATE: - if (!Endlevel_sequence) multi_do_powerup_update(buf); break; - case MULTI_SOUND_FUNCTION: - multi_do_sound_function(buf); break; - case MULTI_MARKER: - if (!Endlevel_sequence) multi_do_drop_marker (buf); break; - case MULTI_DROP_WEAPON: - if (!Endlevel_sequence) multi_do_drop_weapon(buf); break; - case MULTI_DROP_FLAG: - if (!Endlevel_sequence) multi_do_drop_flag(buf); break; - case MULTI_GUIDED: - if (!Endlevel_sequence) multi_do_guided (buf); break; - case MULTI_STOLEN_ITEMS: - if (!Endlevel_sequence) multi_do_stolen_items(buf); break; - case MULTI_WALL_STATUS: - if (!Endlevel_sequence) multi_do_wall_status(buf); break; - case MULTI_HEARTBEAT: - if (!Endlevel_sequence) multi_do_heartbeat (buf); break; - case MULTI_SEISMIC: + case MULTI_POSITION: + if (!Endlevel_sequence) multi_do_position(buf); break; + case MULTI_REAPPEAR: + if (!Endlevel_sequence) multi_do_reappear(buf); break; + case MULTI_FIRE: + if (!Endlevel_sequence) multi_do_fire(buf); break; + case MULTI_KILL: + multi_do_kill(buf); break; + case MULTI_REMOVE_OBJECT: + if (!Endlevel_sequence) multi_do_remobj(buf); break; + case MULTI_PLAYER_DROP: + case MULTI_PLAYER_EXPLODE: + if (!Endlevel_sequence) multi_do_player_explode(buf); break; + case MULTI_MESSAGE: + if (!Endlevel_sequence) multi_do_message(buf); break; + case MULTI_QUIT: + if (!Endlevel_sequence) multi_do_quit(buf); break; + case MULTI_BEGIN_SYNC: + break; + case MULTI_CONTROLCEN: + if (!Endlevel_sequence) multi_do_controlcen_destroy(buf); break; + case MULTI_POWERUP_UPDATE: + if (!Endlevel_sequence) multi_do_powerup_update(buf); break; + case MULTI_SOUND_FUNCTION: + multi_do_sound_function(buf); break; + case MULTI_MARKER: + if (!Endlevel_sequence) multi_do_drop_marker (buf); break; + case MULTI_DROP_WEAPON: + if (!Endlevel_sequence) multi_do_drop_weapon(buf); break; + case MULTI_DROP_FLAG: + if (!Endlevel_sequence) multi_do_drop_flag(buf); break; + case MULTI_GUIDED: + if (!Endlevel_sequence) multi_do_guided (buf); break; + case MULTI_STOLEN_ITEMS: + if (!Endlevel_sequence) multi_do_stolen_items(buf); break; + case MULTI_WALL_STATUS: + if (!Endlevel_sequence) multi_do_wall_status(buf); break; + case MULTI_HEARTBEAT: + if (!Endlevel_sequence) multi_do_heartbeat (buf); break; + case MULTI_SEISMIC: if (!Endlevel_sequence) multi_do_seismic (buf); break; - case MULTI_LIGHT: + case MULTI_LIGHT: if (!Endlevel_sequence) multi_do_light (buf); break; - case MULTI_KILLGOALS: - - if (!Endlevel_sequence) multi_do_kill_goal_counts (buf); break; - case MULTI_ENDLEVEL_START: - if (!Endlevel_sequence) multi_do_escape(buf); break; - case MULTI_END_SYNC: - break; - case MULTI_CLOAK: - if (!Endlevel_sequence) multi_do_cloak(buf); break; - case MULTI_DECLOAK: - if (!Endlevel_sequence) multi_do_decloak(buf); break; - case MULTI_DOOR_OPEN: - if (!Endlevel_sequence) multi_do_door_open(buf); break; - case MULTI_CREATE_EXPLOSION: - if (!Endlevel_sequence) multi_do_create_explosion(buf); break; - case MULTI_CONTROLCEN_FIRE: - if (!Endlevel_sequence) multi_do_controlcen_fire(buf); break; - case MULTI_CREATE_POWERUP: - if (!Endlevel_sequence) multi_do_create_powerup(buf); break; - case MULTI_PLAY_SOUND: - if (!Endlevel_sequence) multi_do_play_sound(buf); break; - case MULTI_CAPTURE_BONUS: - if (!Endlevel_sequence) multi_do_capture_bonus(buf); break; - case MULTI_ORB_BONUS: - if (!Endlevel_sequence) multi_do_orb_bonus(buf); break; - case MULTI_GOT_FLAG: - if (!Endlevel_sequence) multi_do_got_flag(buf); break; - case MULTI_GOT_ORB: - if (!Endlevel_sequence) multi_do_got_orb(buf); break; - case MULTI_PLAY_BY_PLAY: - if (!Endlevel_sequence) multi_do_play_by_play(buf); break; - case MULTI_RANK: - if (!Endlevel_sequence) multi_do_ranking (buf); break; - case MULTI_MODEM_PING: - if (!Endlevel_sequence) multi_send_modem_ping_return(); break; - case MULTI_MODEM_PING_RETURN: - if (!Endlevel_sequence) multi_do_modem_ping_return(); break; + case MULTI_KILLGOALS: + + if (!Endlevel_sequence) multi_do_kill_goal_counts (buf); break; + case MULTI_ENDLEVEL_START: + if (!Endlevel_sequence) multi_do_escape(buf); break; + case MULTI_END_SYNC: + break; + case MULTI_CLOAK: + if (!Endlevel_sequence) multi_do_cloak(buf); break; + case MULTI_DECLOAK: + if (!Endlevel_sequence) multi_do_decloak(buf); break; + case MULTI_DOOR_OPEN: + if (!Endlevel_sequence) multi_do_door_open(buf); break; + case MULTI_CREATE_EXPLOSION: + if (!Endlevel_sequence) multi_do_create_explosion(buf); break; + case MULTI_CONTROLCEN_FIRE: + if (!Endlevel_sequence) multi_do_controlcen_fire(buf); break; + case MULTI_CREATE_POWERUP: + if (!Endlevel_sequence) multi_do_create_powerup(buf); break; + case MULTI_PLAY_SOUND: + if (!Endlevel_sequence) multi_do_play_sound(buf); break; + case MULTI_CAPTURE_BONUS: + if (!Endlevel_sequence) multi_do_capture_bonus(buf); break; + case MULTI_ORB_BONUS: + if (!Endlevel_sequence) multi_do_orb_bonus(buf); break; + case MULTI_GOT_FLAG: + if (!Endlevel_sequence) multi_do_got_flag(buf); break; + case MULTI_GOT_ORB: + if (!Endlevel_sequence) multi_do_got_orb(buf); break; + case MULTI_PLAY_BY_PLAY: + if (!Endlevel_sequence) multi_do_play_by_play(buf); break; + case MULTI_RANK: + if (!Endlevel_sequence) multi_do_ranking (buf); break; + case MULTI_MODEM_PING: + if (!Endlevel_sequence) multi_send_modem_ping_return(); break; + case MULTI_MODEM_PING_RETURN: + if (!Endlevel_sequence) multi_do_modem_ping_return(); break; #ifndef SHAREWARE - case MULTI_FINISH_GAME: - multi_do_finish_game(buf); break; // do this one regardless of endsequence - case MULTI_ROBOT_CONTROLS: - if (!Endlevel_sequence) multi_do_robot_controls(buf); break; - case MULTI_ROBOT_CLAIM: - if (!Endlevel_sequence) multi_do_claim_robot(buf); break; - case MULTI_ROBOT_POSITION: - if (!Endlevel_sequence) multi_do_robot_position(buf); break; - case MULTI_ROBOT_EXPLODE: - if (!Endlevel_sequence) multi_do_robot_explode(buf); break; - case MULTI_ROBOT_RELEASE: - if (!Endlevel_sequence) multi_do_release_robot(buf); break; - case MULTI_ROBOT_FIRE: - if (!Endlevel_sequence) multi_do_robot_fire(buf); break; + case MULTI_FINISH_GAME: + multi_do_finish_game(buf); break; // do this one regardless of endsequence + case MULTI_ROBOT_CONTROLS: + if (!Endlevel_sequence) multi_do_robot_controls(buf); break; + case MULTI_ROBOT_CLAIM: + if (!Endlevel_sequence) multi_do_claim_robot(buf); break; + case MULTI_ROBOT_POSITION: + if (!Endlevel_sequence) multi_do_robot_position(buf); break; + case MULTI_ROBOT_EXPLODE: + if (!Endlevel_sequence) multi_do_robot_explode(buf); break; + case MULTI_ROBOT_RELEASE: + if (!Endlevel_sequence) multi_do_release_robot(buf); break; + case MULTI_ROBOT_FIRE: + if (!Endlevel_sequence) multi_do_robot_fire(buf); break; #endif - case MULTI_SCORE: - if (!Endlevel_sequence) multi_do_score(buf); break; - case MULTI_CREATE_ROBOT: - if (!Endlevel_sequence) multi_do_create_robot(buf); break; - case MULTI_TRIGGER: - if (!Endlevel_sequence) multi_do_trigger(buf); break; - case MULTI_START_TRIGGER: - if (!Endlevel_sequence) multi_do_start_trigger(buf); break; - case MULTI_FLAGS: - if (!Endlevel_sequence) multi_do_flags(buf); break; - case MULTI_DROP_BLOB: - if (!Endlevel_sequence) multi_do_drop_blob(buf); break; - case MULTI_ACTIVE_DOOR: - if (!Endlevel_sequence) multi_do_active_door(buf); break; - case MULTI_BOSS_ACTIONS: - if (!Endlevel_sequence) multi_do_boss_actions(buf); break; - case MULTI_CREATE_ROBOT_POWERUPS: - if (!Endlevel_sequence) multi_do_create_robot_powerups(buf); break; - case MULTI_HOSTAGE_DOOR: - if (!Endlevel_sequence) multi_do_hostage_door_status(buf); break; - case MULTI_SAVE_GAME: - if (!Endlevel_sequence) multi_do_save_game(buf); break; - case MULTI_RESTORE_GAME: - if (!Endlevel_sequence) multi_do_restore_game(buf); break; - case MULTI_REQ_PLAYER: - if (!Endlevel_sequence) multi_do_req_player(buf); break; - case MULTI_SEND_PLAYER: - if (!Endlevel_sequence) multi_do_send_player(buf); break; - - default: - mprintf((1, "Invalid type in multi_process_input().\n")); - Int3(); + case MULTI_SCORE: + if (!Endlevel_sequence) multi_do_score(buf); break; + case MULTI_CREATE_ROBOT: + if (!Endlevel_sequence) multi_do_create_robot(buf); break; + case MULTI_TRIGGER: + if (!Endlevel_sequence) multi_do_trigger(buf); break; + case MULTI_START_TRIGGER: + if (!Endlevel_sequence) multi_do_start_trigger(buf); break; + case MULTI_FLAGS: + if (!Endlevel_sequence) multi_do_flags(buf); break; + case MULTI_DROP_BLOB: + if (!Endlevel_sequence) multi_do_drop_blob(buf); break; + case MULTI_ACTIVE_DOOR: + if (!Endlevel_sequence) multi_do_active_door(buf); break; + case MULTI_BOSS_ACTIONS: + if (!Endlevel_sequence) multi_do_boss_actions(buf); break; + case MULTI_CREATE_ROBOT_POWERUPS: + if (!Endlevel_sequence) multi_do_create_robot_powerups(buf); break; + case MULTI_HOSTAGE_DOOR: + if (!Endlevel_sequence) multi_do_hostage_door_status(buf); break; + case MULTI_SAVE_GAME: + if (!Endlevel_sequence) multi_do_save_game(buf); break; + case MULTI_RESTORE_GAME: + if (!Endlevel_sequence) multi_do_restore_game(buf); break; + case MULTI_REQ_PLAYER: + if (!Endlevel_sequence) multi_do_req_player(buf); break; + case MULTI_SEND_PLAYER: + if (!Endlevel_sequence) multi_do_send_player(buf); break; + + default: + mprintf((1, "Invalid type in multi_process_input().\n")); + Int3(); } } -- 2.39.2