1 /* $Id: fuelcen.c,v 1.7 2003-10-04 03:14:47 btb Exp $ */
3 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
4 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
5 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
6 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
7 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
8 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
9 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
10 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
11 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
12 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
17 * Functions for refueling centers.
20 * $Log: not supported by cvs2svn $
21 * Revision 1.2 1995/10/31 10:23:40 allender
24 * Revision 1.1 1995/05/16 15:24:50 allender
27 * Revision 2.3 1995/03/21 14:38:40 john
28 * Ifdef'd out the NETWORK code.
30 * Revision 2.2 1995/03/06 15:23:09 john
31 * New screen techniques.
33 * Revision 2.1 1995/02/27 13:13:26 john
34 * Removed floating point.
36 * Revision 2.0 1995/02/27 11:27:20 john
37 * New version 2.0, which has no anonymous unions, builds with
38 * Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
40 * Revision 1.159 1995/02/22 13:48:10 allender
41 * remove anonymous unions in object structure
43 * Revision 1.158 1995/02/08 11:37:48 mike
44 * Check for failures in call to obj_create.
46 * Revision 1.157 1995/02/07 20:39:39 mike
47 * fix toasters in multiplayer
50 * Revision 1.156 1995/02/02 18:40:10 john
51 * Fixed bug with full screen cockpit flashing non-white.
53 * Revision 1.155 1995/01/28 15:27:22 yuan
54 * Make sure fuelcen nums are valid.
56 * Revision 1.154 1995/01/03 14:26:23 rob
57 * Better ifdef for robot centers.
59 * Revision 1.153 1995/01/03 11:27:49 rob
60 * Added include of fuelcen.c
62 * Revision 1.152 1995/01/03 09:47:22 john
63 * Some ifdef SHAREWARE lines.
65 * Revision 1.151 1995/01/02 21:02:07 rob
66 * added matcen support for coop/multirobot.
68 * Revision 1.150 1994/12/15 18:31:22 mike
69 * fix confusing precedence problems.
71 * Revision 1.149 1994/12/15 13:04:22 mike
72 * Replace Players[Player_num].time_total references with GameTime.
74 * Revision 1.148 1994/12/15 03:05:18 matt
75 * Added error checking for NULL return from object_create_explosion()
77 * Revision 1.147 1994/12/13 19:49:12 rob
78 * Made the fuelcen noise quieter.
80 * Revision 1.146 1994/12/13 12:03:18 john
81 * Made the warning sirens not start until after "desccruction
82 * secquence activated voice".
84 * Revision 1.145 1994/12/12 17:18:30 mike
85 * make warning siren louder.
87 * Revision 1.144 1994/12/11 23:18:04 john
89 * Added RealFrameTime.
90 * Put in a pause when sound initialization error.
91 * Made controlcen countdown and framerate use RealFrameTime.
93 * Revision 1.143 1994/12/11 14:10:16 mike
96 * Revision 1.142 1994/12/06 11:33:19 yuan
97 * Fixed bug with fueling when above 100.
99 * Revision 1.141 1994/12/05 23:37:14 matt
100 * Took out calls to warning() function
102 * Revision 1.140 1994/12/05 23:19:18 yuan
103 * Fixed fuel center refuelers..
105 * Revision 1.139 1994/12/03 12:48:12 mike
106 * diminish rocking due to control center destruction.
108 * Revision 1.138 1994/12/02 23:30:32 mike
109 * fix bumpiness after toasting control center.
111 * Revision 1.137 1994/12/02 22:48:14 mike
112 * rock the ship after toasting the control center!
114 * Revision 1.136 1994/12/02 17:12:11 rob
115 * Fixed countdown sounds.
117 * Revision 1.135 1994/11/29 20:59:43 rob
118 * Don't run out of fuel in net games (don't want to sync it between machines)
120 * Revision 1.134 1994/11/29 19:10:57 john
121 * Took out debugging mprintf.
123 * Revision 1.133 1994/11/29 13:19:40 john
124 * Made voice for "destruction actived in t-"
127 * Revision 1.132 1994/11/29 12:19:46 john
128 * MAde the "Mine desctruction will commence"
129 * voice play at 12.5 secs.
131 * Revision 1.131 1994/11/29 12:12:54 adam
132 * *** empty log message ***
134 * Revision 1.130 1994/11/28 21:04:26 rob
135 * Added code to cast noise when player refuels.
137 * Revision 1.129 1994/11/27 23:15:04 matt
138 * Made changes for new mprintf calling convention
140 * Revision 1.128 1994/11/21 16:27:51 mike
141 * debug code for morphing.
143 * Revision 1.127 1994/11/21 12:33:50 matt
144 * For control center explosions, use small fireball, not pseudo-random vclip
146 * Revision 1.126 1994/11/20 22:12:15 mike
147 * Fix bug in initializing materialization centers.
149 * Revision 1.125 1994/11/19 15:18:22 mike
150 * rip out unused code and data.
152 * Revision 1.124 1994/11/08 12:18:59 mike
153 * Initialize Fuelcen_seconds_left.
155 * Revision 1.123 1994/10/30 14:12:33 mike
156 * rip out repair center stuff
158 * Revision 1.122 1994/10/28 14:42:45 john
159 * Added sound volumes to all sound calls.
161 * Revision 1.121 1994/10/16 12:44:02 mike
162 * Make time to exit mine after control center destruction diff level dependent.
164 * Revision 1.120 1994/10/09 22:03:26 mike
165 * Adapt to new create_n_segment_path parameters.
167 * Revision 1.119 1994/10/06 14:52:42 mike
168 * Remove last of ability to damage fuel centers.
170 * Revision 1.118 1994/10/06 14:08:45 matt
171 * Made morph flash effect get orientation from segment
173 * Revision 1.117 1994/10/05 16:09:03 mike
174 * Put debugging code into matcen/fuelcen synchronization problem.
176 * Revision 1.116 1994/10/04 15:32:41 john
177 * Took out the old PLAY_SOUND??? code and replaced it
178 * with direct calls into digi_link_??? so that all sounds
181 * Revision 1.115 1994/10/03 23:37:57 mike
182 * Clean up this mess of confusion to the point where maybe matcens actually work.
184 * Revision 1.114 1994/10/03 13:34:40 matt
185 * Added new (and hopefully better) game sequencing functions
187 * Revision 1.113 1994/09/30 14:41:57 matt
188 * Fixed bug as per Mike's instructions
190 * Revision 1.112 1994/09/30 00:37:33 mike
191 * Balance materialization centers.
193 * Revision 1.111 1994/09/28 23:12:52 matt
194 * Macroized palette flash system
196 * Revision 1.110 1994/09/27 15:42:31 mike
197 * Add names of Specials.
199 * Revision 1.109 1994/09/27 00:02:23 mike
200 * Yet more materialization center stuff.
202 * Revision 1.108 1994/09/26 11:26:23 mike
203 * Balance materialization centers.
205 * Revision 1.107 1994/09/25 23:40:47 matt
206 * Changed the object load & save code to read/write the structure fields one
207 * at a time (rather than the whole structure at once). This mean that the
208 * object structure can be changed without breaking the load/save functions.
209 * As a result of this change, the local_object data can be and has been
210 * incorporated into the object array. Also, timeleft is now a property
211 * of all objects, and the object structure has been otherwise cleaned up.
213 * Revision 1.106 1994/09/25 15:55:58 mike
214 * Balance materialization centers, make them emit light, make them re-triggerable after awhile.
216 * Revision 1.105 1994/09/24 17:42:33 mike
217 * Making materialization centers be activated by triggers and balancing them.
219 * Revision 1.104 1994/09/24 14:16:06 mike
220 * Support new network constants.
222 * Revision 1.103 1994/09/20 19:14:40 john
223 * Massaged the sound system; used a better formula for determining
224 * which l/r balance, also, put in Mike's stuff that searches for a connection
225 * between the 2 sounds' segments, stopping for closed doors, etc.
227 * Revision 1.102 1994/09/17 01:40:51 matt
228 * Added status bar/sizable window mode, and in the process revamped the
229 * whole cockpit mode system.
231 * Revision 1.101 1994/08/31 20:57:25 matt
232 * Cleaned up endlevel/death code
234 * Revision 1.100 1994/08/30 17:54:20 mike
235 * Slow down rate of creation of objects by materialization centers.
237 * Revision 1.99 1994/08/29 11:47:01 john
238 * Added warning if no control centers in mine.
247 static char rcsid[] = "$Id: fuelcen.c,v 1.7 2003-10-04 03:14:47 btb Exp $";
257 #include "game.h" // For FrameTime
262 #include "fireball.h"
273 #include "gamemine.h"
274 #include "gamesave.h"
282 #include "multibot.h"
285 // The max number of fuel stations per mine.
287 fix Fuelcen_refill_speed = i2f(1);
288 fix Fuelcen_give_amount = i2f(25);
289 fix Fuelcen_max_amount = i2f(100);
291 // Every time a robot is created in the morphing code, it decreases capacity of the morpher
292 // by this amount... when capacity gets to 0, no more morphers...
293 fix EnergyToCreateOneRobot = i2f(1);
295 #define MATCEN_HP_DEFAULT F1_0*500; // Hitpoints
296 #define MATCEN_INTERVAL_DEFAULT F1_0*5; // 5 seconds
298 matcen_info RobotCenters[MAX_ROBOT_CENTERS];
299 int Num_robot_centers;
301 FuelCenter Station[MAX_NUM_FUELCENS];
302 int Num_fuelcenters = 0;
304 segment * PlayerSegment= NULL;
307 char Special_names[MAX_CENTER_TYPES][11] = {
318 //------------------------------------------------------------
319 // Resets all fuel center info
325 //mprintf( (0, "All fuel centers reset.\n"));
327 for(i=0; i<MAX_SEGMENTS; i++ )
328 Segment2s[i].special = SEGMENT_IS_NOTHING;
330 Num_robot_centers = 0;
334 #ifndef NDEBUG //this is sometimes called by people from the debugger
335 void reset_all_robot_centers()
339 // Remove all materialization centers
340 for (i=0; i<Num_segments; i++)
341 if (Segment2s[i].special == SEGMENT_IS_ROBOTMAKER) {
342 Segment2s[i].special = SEGMENT_IS_NOTHING;
343 Segment2s[i].matcen_num = -1;
348 //------------------------------------------------------------
349 // Turns a segment into a fully charged up fuel center...
350 void fuelcen_create( segment *segp)
352 segment2 *seg2p = &Segment2s[segp-Segments];
356 station_type = seg2p->special;
358 switch( station_type ) {
359 case SEGMENT_IS_NOTHING:
360 case SEGMENT_IS_GOAL_BLUE:
361 case SEGMENT_IS_GOAL_RED:
363 case SEGMENT_IS_FUELCEN:
364 case SEGMENT_IS_REPAIRCEN:
365 case SEGMENT_IS_CONTROLCEN:
366 case SEGMENT_IS_ROBOTMAKER:
369 Error( "Invalid station type %d in fuelcen.c\n", station_type );
372 Assert( (seg2p != NULL) );
373 if ( seg2p == NULL ) return;
375 Assert( Num_fuelcenters < MAX_NUM_FUELCENS );
376 Assert( Num_fuelcenters > -1 );
378 seg2p->value = Num_fuelcenters;
379 Station[Num_fuelcenters].Type = station_type;
380 Station[Num_fuelcenters].MaxCapacity = Fuelcen_max_amount;
381 Station[Num_fuelcenters].Capacity = Station[Num_fuelcenters].MaxCapacity;
382 Station[Num_fuelcenters].segnum = seg2p-Segment2s;
383 Station[Num_fuelcenters].Timer = -1;
384 Station[Num_fuelcenters].Flag = 0;
385 // Station[Num_fuelcenters].NextRobotType = -1;
386 // Station[Num_fuelcenters].last_created_obj=NULL;
387 // Station[Num_fuelcenters].last_created_sig = -1;
388 compute_segment_center(&Station[Num_fuelcenters].Center, segp);
390 // if (station_type == SEGMENT_IS_ROBOTMAKER)
391 // Station[Num_fuelcenters].Capacity = i2f(Difficulty_level + 3);
393 //mprintf( (0, "Segment %d is assigned to be fuel center %d.\n", Station[Num_fuelcenters].segnum, Num_fuelcenters ));
397 //------------------------------------------------------------
398 // Adds a matcen that already is a special type into the Station array.
399 // This function is separate from other fuelcens because we don't want values reset.
400 void matcen_create( segment *segp)
402 segment2 *seg2p = &Segment2s[segp-Segments];
404 int station_type = seg2p->special;
406 Assert( (seg2p != NULL) );
407 Assert(station_type == SEGMENT_IS_ROBOTMAKER);
408 if ( seg2p == NULL ) return;
410 Assert( Num_fuelcenters < MAX_NUM_FUELCENS );
411 Assert( Num_fuelcenters > -1 );
413 seg2p->value = Num_fuelcenters;
414 Station[Num_fuelcenters].Type = station_type;
415 Station[Num_fuelcenters].Capacity = i2f(Difficulty_level + 3);
416 Station[Num_fuelcenters].MaxCapacity = Station[Num_fuelcenters].Capacity;
418 Station[Num_fuelcenters].segnum = seg2p-Segment2s;
419 Station[Num_fuelcenters].Timer = -1;
420 Station[Num_fuelcenters].Flag = 0;
421 // Station[Num_fuelcenters].NextRobotType = -1;
422 // Station[Num_fuelcenters].last_created_obj=NULL;
423 // Station[Num_fuelcenters].last_created_sig = -1;
424 compute_segment_center(&Station[Num_fuelcenters].Center, &Segments[seg2p-Segment2s] );
426 seg2p->matcen_num = Num_robot_centers;
429 RobotCenters[seg2p->matcen_num].hit_points = MATCEN_HP_DEFAULT;
430 RobotCenters[seg2p->matcen_num].interval = MATCEN_INTERVAL_DEFAULT;
431 RobotCenters[seg2p->matcen_num].segnum = seg2p-Segment2s;
432 RobotCenters[seg2p->matcen_num].fuelcen_num = Num_fuelcenters;
434 //mprintf( (0, "Segment %d is assigned to be fuel center %d.\n", Station[Num_fuelcenters].segnum, Num_fuelcenters ));
438 //------------------------------------------------------------
439 // Adds a segment that already is a special type into the Station array.
440 void fuelcen_activate( segment * segp, int station_type )
442 segment2 *seg2p = &Segment2s[segp-Segments];
444 seg2p->special = station_type;
446 if (seg2p->special == SEGMENT_IS_ROBOTMAKER)
447 matcen_create( segp);
449 fuelcen_create( segp);
453 // The lower this number is, the more quickly the center can be re-triggered.
454 // If it's too low, it can mean all the robots won't be put out, but for about 5
455 // robots, that's not real likely.
456 #define MATCEN_LIFE (i2f(30-2*Difficulty_level))
458 //------------------------------------------------------------
459 // Trigger (enable) the materialization center in segment segnum
460 void trigger_matcen(int segnum)
462 // -- segment *segp = &Segments[segnum];
463 segment2 *seg2p = &Segment2s[segnum];
464 vms_vector pos, delta;
465 FuelCenter *robotcen;
468 mprintf((0, "Trigger matcen, segment %i\n", segnum));
470 Assert(seg2p->special == SEGMENT_IS_ROBOTMAKER);
471 Assert(seg2p->matcen_num < Num_fuelcenters);
472 Assert((seg2p->matcen_num >= 0) && (seg2p->matcen_num <= Highest_segment_index));
474 robotcen = &Station[RobotCenters[seg2p->matcen_num].fuelcen_num];
476 if (robotcen->Enabled == 1)
479 if (!robotcen->Lives)
482 // MK: 11/18/95, At insane, matcens work forever!
483 if (Difficulty_level+1 < NDL)
486 robotcen->Timer = F1_0*1000; // Make sure the first robot gets emitted right away.
487 robotcen->Enabled = 1; // Say this center is enabled, it can create robots.
488 robotcen->Capacity = i2f(Difficulty_level + 3);
489 robotcen->Disable_time = MATCEN_LIFE;
491 // Create a bright object in the segment.
492 pos = robotcen->Center;
493 vm_vec_sub(&delta, &Vertices[Segments[segnum].verts[0]], &robotcen->Center);
494 vm_vec_scale_add2(&pos, &delta, F1_0/2);
495 objnum = obj_create( OBJ_LIGHT, 0, segnum, &pos, NULL, 0, CT_LIGHT, MT_NONE, RT_NONE );
497 Objects[objnum].lifeleft = MATCEN_LIFE;
498 Objects[objnum].ctype.light_info.intensity = i2f(8); // Light cast by a fuelcen.
500 mprintf((1, "Can't create invisible flare for matcen.\n"));
503 // mprintf((0, "Created invisibile flare, object=%i, segment=%i, pos=%7.3f %7.3f%7.3f\n", objnum, segnum, f2fl(pos.x), f2fl(pos.y), f2fl(pos.z)));
507 //------------------------------------------------------------
508 // Takes away a segment's fuel center properties.
509 // Deletes the segment point entry in the FuelCenter list.
510 void fuelcen_delete( segment * segp )
512 segment2 *seg2p = &Segment2s[segp-Segments];
519 for (i=0; i<Num_fuelcenters; i++ ) {
520 if ( Station[i].segnum == segp-Segments ) {
522 // If Robot maker is deleted, fix Segments and RobotCenters.
523 if (Station[i].Type == SEGMENT_IS_ROBOTMAKER) {
525 Assert(Num_robot_centers >= 0);
527 for (j=seg2p->matcen_num; j<Num_robot_centers; j++)
528 RobotCenters[j] = RobotCenters[j+1];
530 for (j=0; j<Num_fuelcenters; j++) {
531 if ( Station[j].Type == SEGMENT_IS_ROBOTMAKER )
532 if ( Segment2s[Station[j].segnum].matcen_num > seg2p->matcen_num )
533 Segment2s[Station[j].segnum].matcen_num--;
537 //fix RobotCenters so they point to correct fuelcenter
538 for (j=0; j<Num_robot_centers; j++ )
539 if (RobotCenters[j].fuelcen_num > i) //this robotcenter's fuelcen is changing
540 RobotCenters[j].fuelcen_num--;
543 Assert(Num_fuelcenters >= 0);
544 for (j=i; j<Num_fuelcenters; j++ ) {
545 Station[j] = Station[j+1];
546 Segment2s[Station[j].segnum].value = j;
555 #define ROBOT_GEN_TIME (i2f(5))
557 object * create_morph_robot( segment *segp, vms_vector *object_pos, int object_id)
561 int default_behavior;
563 Players[Player_num].num_robots_level++;
564 Players[Player_num].num_robots_total++;
566 objnum = obj_create(OBJ_ROBOT, object_id, segp-Segments, object_pos,
567 &vmd_identity_matrix, Polygon_models[Robot_info[object_id].model_num].rad,
568 CT_AI, MT_PHYSICS, RT_POLYOBJ);
571 mprintf((1, "Can't create morph robot. Aborting morph.\n"));
576 obj = &Objects[objnum];
578 //Set polygon-object-specific data
580 obj->rtype.pobj_info.model_num = Robot_info[obj->id].model_num;
581 obj->rtype.pobj_info.subobj_flags = 0;
585 obj->mtype.phys_info.mass = Robot_info[obj->id].mass;
586 obj->mtype.phys_info.drag = Robot_info[obj->id].drag;
588 obj->mtype.phys_info.flags |= (PF_LEVELLING);
590 obj->shields = Robot_info[obj->id].strength;
592 default_behavior = Robot_info[obj->id].behavior;
594 init_ai_object(obj-Objects, default_behavior, -1 ); // Note, -1 = segment this robot goes to to hide, should probably be something useful
596 create_n_segment_path(obj, 6, -1); // Create a 6 segment path from creation point.
598 Ai_local_info[objnum].mode = ai_behavior_to_mode(default_behavior);
603 int Num_extry_robots = 15;
606 int FrameCount_last_msg = 0;
609 // ----------------------------------------------------------------------------------------------------------
610 void robotmaker_proc( FuelCenter * robotcen )
613 vms_vector cur_object_loc; //, direction;
614 int matcen_num, segnum, objnum;
617 vms_vector direction;
619 if (robotcen->Enabled == 0)
622 if (robotcen->Disable_time > 0) {
623 robotcen->Disable_time -= FrameTime;
624 if (robotcen->Disable_time <= 0) {
625 mprintf((0, "Robot center #%i gets disabled due to time running out.\n", robotcen-Station));
626 robotcen->Enabled = 0;
630 // mprintf((0, "Capacity of robot maker #%i is %i\n", robotcen - Station, robotcen->Capacity));
632 // No robot making in multiplayer mode.
635 if ((Game_mode & GM_MULTI) && (!(Game_mode & GM_MULTI_ROBOTS) || !network_i_am_master()))
638 if (Game_mode & GM_MULTI)
643 // Wait until transmorgafier has capacity to make a robot...
644 if ( robotcen->Capacity <= 0 ) {
648 matcen_num = Segment2s[robotcen->segnum].matcen_num;
649 //mprintf((0, "Robotmaker #%i flags = %8x\n", matcen_num, RobotCenters[matcen_num].robot_flags));
651 if ( matcen_num == -1 ) {
652 mprintf((0, "Non-functional robotcen at %d\n", robotcen->segnum));
656 if (RobotCenters[matcen_num].robot_flags[0]==0 && RobotCenters[matcen_num].robot_flags[1]==0) {
657 //mprintf((0, "robot_flags = 0 at robot maker #%i\n", RobotCenters[matcen_num].robot_flags));
661 // Wait until we have a free slot for this puppy...
662 // <<<<<<<<<<<<<<<< Num robots in mine >>>>>>>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<< Max robots in mine >>>>>>>>>>>>>>>
663 if ( (Players[Player_num].num_robots_level - Players[Player_num].num_kills_level) >= (Gamesave_num_org_robots + Num_extry_robots ) ) {
665 if (FrameCount > FrameCount_last_msg + 20) {
666 mprintf((0, "Cannot morph until you kill one!\n"));
667 FrameCount_last_msg = FrameCount;
673 robotcen->Timer += FrameTime;
675 switch( robotcen->Flag ) {
676 case 0: // Wait until next robot can generate
677 if (Game_mode & GM_MULTI)
679 top_time = ROBOT_GEN_TIME;
683 dist_to_player = vm_vec_dist_quick( &ConsoleObject->pos, &robotcen->Center );
684 top_time = dist_to_player/64 + d_rand() * 2 + F1_0*2;
685 if ( top_time > ROBOT_GEN_TIME )
686 top_time = ROBOT_GEN_TIME + d_rand();
687 if ( top_time < F1_0*2 )
688 top_time = F1_0*3/2 + d_rand()*2;
691 // mprintf( (0, "Time between morphs %d seconds, dist_to_player = %7.3f\n", f2i(top_time), f2fl(dist_to_player) ));
693 if (robotcen->Timer > top_time ) {
695 int i, my_station_num = robotcen-Station;
698 // Make sure this robotmaker hasn't put out its max without having any of them killed.
699 for (i=0; i<=Highest_object_index; i++)
700 if (Objects[i].type == OBJ_ROBOT)
701 if ((Objects[i].matcen_creator^0x80) == my_station_num)
703 if (count > Difficulty_level + 3) {
704 mprintf((0, "Cannot morph: center %i has already put out %i robots.\n", my_station_num, count));
705 robotcen->Timer /= 2;
709 // Whack on any robot or player in the matcen segment.
711 segnum = robotcen->segnum;
712 for (objnum=Segments[segnum].objects;objnum!=-1;objnum=Objects[objnum].next) {
714 if ( count > MAX_OBJECTS ) {
715 mprintf((0, "Object list in segment %d is circular.", segnum ));
719 if (Objects[objnum].type==OBJ_ROBOT) {
720 collide_robot_and_materialization_center(&Objects[objnum]);
721 robotcen->Timer = top_time/2;
723 } else if (Objects[objnum].type==OBJ_PLAYER ) {
724 collide_player_and_materialization_center(&Objects[objnum]);
725 robotcen->Timer = top_time/2;
730 compute_segment_center(&cur_object_loc, &Segments[robotcen->segnum]);
731 // HACK!!! The 10 under here should be something equal to the 1/2 the size of the segment.
732 obj = object_create_explosion(robotcen->segnum, &cur_object_loc, i2f(10), VCLIP_MORPHING_ROBOT );
735 extract_orient_from_segment(&obj->orient,&Segments[robotcen->segnum]);
737 if ( Vclip[VCLIP_MORPHING_ROBOT].sound_num > -1 ) {
738 digi_link_sound_to_pos( Vclip[VCLIP_MORPHING_ROBOT].sound_num, robotcen->segnum, 0, &cur_object_loc, 0, F1_0 );
745 case 1: // Wait until 1/2 second after VCLIP started.
746 if (robotcen->Timer > (Vclip[VCLIP_MORPHING_ROBOT].play_time/2) ) {
748 robotcen->Capacity -= EnergyToCreateOneRobot;
752 compute_segment_center(&cur_object_loc, &Segments[robotcen->segnum]);
754 // If this is the first materialization, set to valid robot.
755 if (RobotCenters[matcen_num].robot_flags[0] != 0 || RobotCenters[matcen_num].robot_flags[1] != 0) {
758 sbyte legal_types[64]; // 64 bits, the width of robot_flags[].
759 int num_types, robot_index, i;
764 flags = RobotCenters[matcen_num].robot_flags[i];
767 legal_types[num_types++] = robot_index;
773 //mprintf((0, "Flags = %08x, %2i legal types to morph: \n", RobotCenters[matcen_num].robot_flags, num_types));
774 //for (i=0; i<num_types; i++)
775 // mprintf((0, "%2i ", legal_types[i]));
776 //mprintf((0, "\n"));
779 type = legal_types[0];
781 type = legal_types[(d_rand() * num_types) / 32768];
783 mprintf((0, "Morph: (type = %i) (seg = %i) (capacity = %08x)\n", type, robotcen->segnum, robotcen->Capacity));
784 obj = create_morph_robot(&Segments[robotcen->segnum], &cur_object_loc, type );
788 if (Game_mode & GM_MULTI)
789 multi_send_create_robot(robotcen-Station, obj-Objects, type);
792 obj->matcen_creator = (robotcen-Station) | 0x80;
794 // Make object faces player...
795 vm_vec_sub( &direction, &ConsoleObject->pos,&obj->pos );
796 vm_vector_2_matrix( &obj->orient, &direction, &obj->orient.uvec, NULL);
799 //robotcen->last_created_obj = obj;
800 //robotcen->last_created_sig = robotcen->last_created_obj->signature;
802 mprintf((0, "Warning: create_morph_robot returned NULL (no objects left?)\n"));
815 //-------------------------------------------------------------
816 // Called once per frame, replenishes fuel supply.
817 void fuelcen_update_all()
820 fix AmountToreplenish;
822 AmountToreplenish = fixmul(FrameTime,Fuelcen_refill_speed);
824 for (i=0; i<Num_fuelcenters; i++ ) {
825 if ( Station[i].Type == SEGMENT_IS_ROBOTMAKER ) {
826 if (! (Game_suspended & SUSP_ROBOTS))
827 robotmaker_proc( &Station[i] );
828 } else if ( Station[i].Type == SEGMENT_IS_CONTROLCEN ) {
829 //controlcen_proc( &Station[i] );
831 } else if ( (Station[i].MaxCapacity > 0) && (PlayerSegment!=&Segments[Station[i].segnum]) ) {
832 if ( Station[i].Capacity < Station[i].MaxCapacity ) {
833 Station[i].Capacity += AmountToreplenish;
834 //mprintf( (0, "Fuel center %d replenished to %d.\n", i, f2i(Station[i].Capacity) ));
835 if ( Station[i].Capacity >= Station[i].MaxCapacity ) {
836 Station[i].Capacity = Station[i].MaxCapacity;
837 //gauge_message( "Fuel center is fully recharged! " );
844 //--unused-- //-------------------------------------------------------------
845 //--unused-- // replenishes all fuel supplies.
846 //--unused-- void fuelcen_replenish_all()
850 //--unused-- for (i=0; i<Num_fuelcenters; i++ ) {
851 //--unused-- Station[i].Capacity = Station[i].MaxCapacity;
853 //--unused-- //mprintf( (0, "All fuel centers are replenished\n" ));
857 #define FUELCEN_SOUND_DELAY (f1_0/4) //play every half second
859 //-------------------------------------------------------------
860 fix fuelcen_give_fuel(segment *segp, fix MaxAmountCanTake )
862 segment2 *seg2p = &Segment2s[segp-Segments];
864 static fix last_play_time=0;
866 Assert( segp != NULL );
868 PlayerSegment = segp;
870 if ( (segp) && (seg2p->special==SEGMENT_IS_FUELCEN) ) {
873 detect_escort_goal_accomplished(-4); // UGLY! Hack! -4 means went through fuelcen.
875 // if (Station[segp->value].MaxCapacity<=0) {
876 // HUD_init_message( "Fuelcenter %d is destroyed.", segp->value );
880 // if (Station[segp->value].Capacity<=0) {
881 // HUD_init_message( "Fuelcenter %d is empty.", segp->value );
885 if (MaxAmountCanTake <= 0 ) {
886 // //gauge_message( "Fueled up!");
890 amount = fixmul(FrameTime,Fuelcen_give_amount);
892 if (amount > MaxAmountCanTake )
893 amount = MaxAmountCanTake;
895 // if (!(Game_mode & GM_MULTI))
896 // if ( Station[segp->value].Capacity < amount ) {
897 // amount = Station[segp->value].Capacity;
898 // Station[segp->value].Capacity = 0;
900 // Station[segp->value].Capacity -= amount;
903 if (last_play_time > GameTime)
906 if (GameTime > last_play_time+FUELCEN_SOUND_DELAY) {
908 digi_play_sample( SOUND_REFUEL_STATION_GIVING_FUEL, F1_0/2 );
910 if (Game_mode & GM_MULTI)
911 multi_send_play_sound(SOUND_REFUEL_STATION_GIVING_FUEL, F1_0/2);
914 last_play_time = GameTime;
918 //HUD_init_message( "Fuelcen %d has %d/%d fuel", segp->value,f2i(Station[segp->value].Capacity),f2i(Station[segp->value].MaxCapacity) );
926 //--unused-- //-----------------------------------------------------------
927 //--unused-- // Damages a fuel center
928 //--unused-- void fuelcen_damage(segment *segp, fix damage )
930 //--unused-- //int i;
931 //--unused-- // int station_num = segp->value;
933 //--unused-- Assert( segp != NULL );
934 //--unused-- if ( segp == NULL ) return;
936 //--unused-- mprintf((0, "Obsolete function fuelcen_damage() called with seg=%i, damage=%7.3f\n", segp-Segments, f2fl(damage)));
937 //--unused-- switch( segp->special ) {
938 //--unused-- case SEGMENT_IS_NOTHING:
940 //--unused-- case SEGMENT_IS_ROBOTMAKER:
941 //--unused-- //-- // Robotmaker hit by laser
942 //--unused-- //-- if (Station[station_num].MaxCapacity<=0 ) {
943 //--unused-- //-- // Shooting a already destroyed materializer
944 //--unused-- //-- } else {
945 //--unused-- //-- Station[station_num].MaxCapacity -= damage;
946 //--unused-- //-- if (Station[station_num].Capacity > Station[station_num].MaxCapacity ) {
947 //--unused-- //-- Station[station_num].Capacity = Station[station_num].MaxCapacity;
949 //--unused-- //-- if (Station[station_num].MaxCapacity <= 0 ) {
950 //--unused-- //-- Station[station_num].MaxCapacity = 0;
951 //--unused-- //-- // Robotmaker dead
952 //--unused-- //-- for (i=0; i<6; i++ )
953 //--unused-- //-- segp->sides[i].tmap_num2 = 0;
956 //--unused-- //-- //mprintf( (0, "Materializatormografier has %x capacity left\n", Station[station_num].MaxCapacity ));
958 //--unused-- case SEGMENT_IS_FUELCEN:
959 //--unused-- //-- digi_play_sample( SOUND_REFUEL_STATION_HIT );
960 //--unused-- //-- if (Station[station_num].MaxCapacity>0 ) {
961 //--unused-- //-- Station[station_num].MaxCapacity -= damage;
962 //--unused-- //-- if (Station[station_num].Capacity > Station[station_num].MaxCapacity ) {
963 //--unused-- //-- Station[station_num].Capacity = Station[station_num].MaxCapacity;
965 //--unused-- //-- if (Station[station_num].MaxCapacity <= 0 ) {
966 //--unused-- //-- Station[station_num].MaxCapacity = 0;
967 //--unused-- //-- digi_play_sample( SOUND_REFUEL_STATION_DESTROYED );
969 //--unused-- //-- } else {
970 //--unused-- //-- Station[station_num].MaxCapacity = 0;
972 //--unused-- //-- HUD_init_message( "Fuelcenter %d damaged", station_num );
974 //--unused-- case SEGMENT_IS_REPAIRCEN:
976 //--unused-- case SEGMENT_IS_CONTROLCEN:
978 //--unused-- default:
979 //--unused-- Error( "Invalid type in fuelcen.c" );
983 //--unused-- // ----------------------------------------------------------------------------------------------------------
984 //--unused-- fixang my_delta_ang(fixang a,fixang b)
986 //--unused-- fixang delta0,delta1;
988 //--unused-- return (abs(delta0 = a - b) < abs(delta1 = b - a)) ? delta0 : delta1;
992 //--unused-- // ----------------------------------------------------------------------------------------------------------
993 //--unused-- //return though which side of seg0 is seg1
994 //--unused-- int john_find_connect_side(int seg0,int seg1)
996 //--unused-- segment *Seg=&Segments[seg0];
999 //--unused-- for (i=MAX_SIDES_PER_SEGMENT;i--;) if (Seg->children[i]==seg1) return i;
1001 //--unused-- return -1;
1004 // ----------------------------------------------------------------------------------------------------------
1005 //--unused-- vms_angvec start_angles, delta_angles, goal_angles;
1006 //--unused-- vms_vector start_pos, delta_pos, goal_pos;
1007 //--unused-- int FuelStationSeg;
1008 //--unused-- fix current_time,delta_time;
1009 //--unused-- int next_side, side_index;
1010 //--unused-- int * sidelist;
1012 //--repair-- int Repairing;
1013 //--repair-- vms_vector repair_save_uvec; //the player's upvec when enter repaircen
1014 //--repair-- object *RepairObj=NULL; //which object getting repaired
1015 //--repair-- int disable_repair_center=0;
1016 //--repair-- fix repair_rate;
1017 //--repair-- #define FULL_REPAIR_RATE i2f(10)
1019 //--unused-- ubyte save_control_type,save_movement_type;
1021 //--unused-- int SideOrderBack[] = {WFRONT, WRIGHT, WTOP, WLEFT, WBOTTOM, WBACK};
1022 //--unused-- int SideOrderFront[] = {WBACK, WLEFT, WTOP, WRIGHT, WBOTTOM, WFRONT};
1023 //--unused-- int SideOrderLeft[] = { WRIGHT, WBACK, WTOP, WFRONT, WBOTTOM, WLEFT };
1024 //--unused-- int SideOrderRight[] = { WLEFT, WFRONT, WTOP, WBACK, WBOTTOM, WRIGHT };
1025 //--unused-- int SideOrderTop[] = { WBOTTOM, WLEFT, WBACK, WRIGHT, WFRONT, WTOP };
1026 //--unused-- int SideOrderBottom[] = { WTOP, WLEFT, WFRONT, WRIGHT, WBACK, WBOTTOM };
1028 //--unused-- int SideUpVector[] = {WBOTTOM, WFRONT, WBOTTOM, WFRONT, WBOTTOM, WBOTTOM };
1030 //--repair-- // ----------------------------------------------------------------------------------------------------------
1031 //--repair-- void refuel_calc_deltas(object *obj, int next_side, int repair_seg)
1033 //--repair-- vms_vector nextcenter, headfvec, *headuvec;
1034 //--repair-- vms_matrix goal_orient;
1036 //--repair-- // Find time for this movement
1037 //--repair-- delta_time = F1_0; // one second...
1039 //--repair-- // Find start and goal position
1040 //--repair-- start_pos = obj->pos;
1042 //--repair-- // Find delta position to get to goal position
1043 //--repair-- compute_segment_center(&goal_pos,&Segments[repair_seg]);
1044 //--repair-- vm_vec_sub( &delta_pos,&goal_pos,&start_pos);
1046 //--repair-- // Find start angles
1047 //--repair-- //angles_from_vector(&start_angles,&obj->orient.fvec);
1048 //--repair-- vm_extract_angles_matrix(&start_angles,&obj->orient);
1050 //--repair-- // Find delta angles to get to goal orientation
1051 //--repair-- med_compute_center_point_on_side(&nextcenter,&Segments[repair_seg],next_side);
1052 //--repair-- vm_vec_sub(&headfvec,&nextcenter,&goal_pos);
1053 //--repair-- //mprintf( (0, "Next_side = %d, Head fvec = %d,%d,%d\n", next_side, headfvec.x, headfvec.y, headfvec.z ));
1055 //--repair-- if (next_side == 5) //last side
1056 //--repair-- headuvec = &repair_save_uvec;
1058 //--repair-- headuvec = &Segments[repair_seg].sides[SideUpVector[next_side]].normals[0];
1060 //--repair-- vm_vector_2_matrix(&goal_orient,&headfvec,headuvec,NULL);
1061 //--repair-- vm_extract_angles_matrix(&goal_angles,&goal_orient);
1062 //--repair-- delta_angles.p = my_delta_ang(start_angles.p,goal_angles.p);
1063 //--repair-- delta_angles.b = my_delta_ang(start_angles.b,goal_angles.b);
1064 //--repair-- delta_angles.h = my_delta_ang(start_angles.h,goal_angles.h);
1065 //--repair-- current_time = 0;
1066 //--repair-- Repairing = 0;
1069 //--repair-- // ----------------------------------------------------------------------------------------------------------
1070 //--repair-- //if repairing, cut it short
1071 //--repair-- abort_repair_center()
1073 //--repair-- if (!RepairObj || side_index==5)
1074 //--repair-- return;
1076 //--repair-- current_time = 0;
1077 //--repair-- side_index = 5;
1078 //--repair-- next_side = sidelist[side_index];
1079 //--repair-- refuel_calc_deltas(RepairObj, next_side, FuelStationSeg);
1082 //--repair-- // ----------------------------------------------------------------------------------------------------------
1083 //--repair-- void repair_ship_damage()
1085 //--repair-- //mprintf((0,"Repairing ship damage\n"));
1088 //--repair-- // ----------------------------------------------------------------------------------------------------------
1089 //--repair-- int refuel_do_repair_effect( object * obj, int first_time, int repair_seg ) {
1091 //--repair-- obj->mtype.phys_info.velocity.x = 0;
1092 //--repair-- obj->mtype.phys_info.velocity.y = 0;
1093 //--repair-- obj->mtype.phys_info.velocity.z = 0;
1095 //--repair-- if (first_time) {
1096 //--repair-- int entry_side;
1097 //--repair-- current_time = 0;
1099 //--repair-- digi_play_sample( SOUND_REPAIR_STATION_PLAYER_ENTERING, F1_0 );
1101 //--repair-- entry_side = john_find_connect_side(repair_seg,obj->segnum );
1102 //--repair-- Assert( entry_side > -1 );
1104 //--repair-- switch( entry_side ) {
1105 //--repair-- case WBACK: sidelist = SideOrderBack; break;
1106 //--repair-- case WFRONT: sidelist = SideOrderFront; break;
1107 //--repair-- case WLEFT: sidelist = SideOrderLeft; break;
1108 //--repair-- case WRIGHT: sidelist = SideOrderRight; break;
1109 //--repair-- case WTOP: sidelist = SideOrderTop; break;
1110 //--repair-- case WBOTTOM: sidelist = SideOrderBottom; break;
1112 //--repair-- side_index = 0;
1113 //--repair-- next_side = sidelist[side_index];
1115 //--repair-- refuel_calc_deltas(obj,next_side, repair_seg);
1118 //--repair-- //update shields
1119 //--repair-- if (Players[Player_num].shields < MAX_SHIELDS) { //if above max, don't mess with it
1121 //--repair-- Players[Player_num].shields += fixmul(FrameTime,repair_rate);
1123 //--repair-- if (Players[Player_num].shields > MAX_SHIELDS)
1124 //--repair-- Players[Player_num].shields = MAX_SHIELDS;
1127 //--repair-- current_time += FrameTime;
1129 //--repair-- if (current_time >= delta_time ) {
1130 //--repair-- vms_angvec av;
1131 //--repair-- obj->pos = goal_pos;
1132 //--repair-- av = goal_angles;
1133 //--repair-- vm_angles_2_matrix(&obj->orient,&av);
1135 //--repair-- if (side_index >= 5 )
1136 //--repair-- return 1; // Done being repaired...
1138 //--repair-- if (Repairing==0) {
1139 //--repair-- //mprintf( (0, "<MACHINE EFFECT ON SIDE %d>\n", next_side ));
1140 //--repair-- //digi_play_sample( SOUND_REPAIR_STATION_FIXING );
1141 //--repair-- Repairing=1;
1143 //--repair-- switch( next_side ) {
1144 //--repair-- case 0: digi_play_sample( SOUND_REPAIR_STATION_FIXING_1,F1_0 ); break;
1145 //--repair-- case 1: digi_play_sample( SOUND_REPAIR_STATION_FIXING_2,F1_0 ); break;
1146 //--repair-- case 2: digi_play_sample( SOUND_REPAIR_STATION_FIXING_3,F1_0 ); break;
1147 //--repair-- case 3: digi_play_sample( SOUND_REPAIR_STATION_FIXING_4,F1_0 ); break;
1148 //--repair-- case 4: digi_play_sample( SOUND_REPAIR_STATION_FIXING_1,F1_0 ); break;
1149 //--repair-- case 5: digi_play_sample( SOUND_REPAIR_STATION_FIXING_2,F1_0 ); break;
1152 //--repair-- repair_ship_damage();
1156 //--repair-- if (current_time >= (delta_time+(F1_0/2)) ) {
1157 //--repair-- current_time = 0;
1158 //--repair-- // Find next side...
1159 //--repair-- side_index++;
1160 //--repair-- if (side_index >= 6 ) return 1;
1161 //--repair-- next_side = sidelist[side_index];
1163 //--repair-- refuel_calc_deltas(obj, next_side, repair_seg);
1166 //--repair-- } else {
1167 //--repair-- fix factor, p,b,h;
1168 //--repair-- vms_angvec av;
1170 //--repair-- factor = fixdiv( current_time,delta_time );
1172 //--repair-- // Find object's current position
1173 //--repair-- obj->pos = delta_pos;
1174 //--repair-- vm_vec_scale( &obj->pos, factor );
1175 //--repair-- vm_vec_add2( &obj->pos, &start_pos );
1177 //--repair-- // Find object's current orientation
1178 //--repair-- p = fixmul(delta_angles.p,factor);
1179 //--repair-- b = fixmul(delta_angles.b,factor);
1180 //--repair-- h = fixmul(delta_angles.h,factor);
1181 //--repair-- av.p = (fixang)p + start_angles.p;
1182 //--repair-- av.b = (fixang)b + start_angles.b;
1183 //--repair-- av.h = (fixang)h + start_angles.h;
1184 //--repair-- vm_angles_2_matrix(&obj->orient,&av);
1188 //--repair-- update_object_seg(obj); //update segment
1190 //--repair-- return 0;
1193 //--repair-- // ----------------------------------------------------------------------------------------------------------
1194 //--repair-- //do the repair center for this frame
1195 //--repair-- void do_repair_sequence(object *obj)
1197 //--repair-- Assert(obj == RepairObj);
1199 //--repair-- if (refuel_do_repair_effect( obj, 0, FuelStationSeg )) {
1200 //--repair-- if (Players[Player_num].shields < MAX_SHIELDS)
1201 //--repair-- Players[Player_num].shields = MAX_SHIELDS;
1202 //--repair-- obj->control_type = save_control_type;
1203 //--repair-- obj->movement_type = save_movement_type;
1204 //--repair-- disable_repair_center=1;
1205 //--repair-- RepairObj = NULL;
1208 //--repair-- //the two lines below will spit the player out of the rapair center,
1209 //--repair-- //but what happen is that the ship just bangs into the door
1210 //--repair-- //if (obj->movement_type == MT_PHYSICS)
1211 //--repair-- // vm_vec_copy_scale(&obj->mtype.phys_info.velocity,&obj->orient.fvec,i2f(200));
1216 //--repair-- // ----------------------------------------------------------------------------------------------------------
1217 //--repair-- //see if we should start the repair center
1218 //--repair-- void check_start_repair_center(object *obj)
1220 //--repair-- if (RepairObj != NULL) return; //already in repair center
1222 //--repair-- if (Lsegments[obj->segnum].special_type & SS_REPAIR_CENTER) {
1224 //--repair-- if (!disable_repair_center) {
1225 //--repair-- //have just entered repair center
1227 //--repair-- RepairObj = obj;
1228 //--repair-- repair_save_uvec = obj->orient.uvec;
1230 //--repair-- repair_rate = fixmuldiv(FULL_REPAIR_RATE,(MAX_SHIELDS - Players[Player_num].shields),MAX_SHIELDS);
1232 //--repair-- save_control_type = obj->control_type;
1233 //--repair-- save_movement_type = obj->movement_type;
1235 //--repair-- obj->control_type = CT_REPAIRCEN;
1236 //--repair-- obj->movement_type = MT_NONE;
1238 //--repair-- FuelStationSeg = Lsegments[obj->segnum].special_segment;
1239 //--repair-- Assert(FuelStationSeg != -1);
1241 //--repair-- if (refuel_do_repair_effect( obj, 1, FuelStationSeg )) {
1242 //--repair-- Int3(); //can this happen?
1243 //--repair-- obj->control_type = CT_FLYING;
1244 //--repair-- obj->movement_type = MT_PHYSICS;
1249 //--repair-- disable_repair_center=0;
1253 // --------------------------------------------------------------------------------------------
1254 void disable_matcens(void)
1258 for (i=0; i<Num_robot_centers; i++) {
1259 Station[i].Enabled = 0;
1260 Station[i].Disable_time = 0;
1264 // --------------------------------------------------------------------------------------------
1265 // Initialize all materialization centers.
1266 // Give them all the right number of lives.
1267 void init_all_matcens(void)
1271 for (i=0; i<Num_fuelcenters; i++)
1272 if (Station[i].Type == SEGMENT_IS_ROBOTMAKER) {
1273 Station[i].Lives = 3;
1274 Station[i].Enabled = 0;
1275 Station[i].Disable_time = 0;
1278 // Make sure this fuelcen is pointed at by a matcen.
1280 for (j=0; j<Num_robot_centers; j++) {
1281 if (RobotCenters[j].fuelcen_num == i)
1284 Assert(j != Num_robot_centers);
1291 // Make sure all matcens point at a fuelcen
1292 for (i=0; i<Num_robot_centers; i++) {
1293 int fuelcen_num = RobotCenters[i].fuelcen_num;
1295 Assert(fuelcen_num < Num_fuelcenters);
1296 Assert(Station[fuelcen_num].Type == SEGMENT_IS_ROBOTMAKER);
1303 extern void multi_send_capture_bonus (char);
1305 void fuelcen_check_for_goal(segment *segp)
1307 segment2 *seg2p = &Segment2s[segp-Segments];
1309 Assert( segp != NULL );
1310 Assert (Game_mode & GM_CAPTURE);
1312 if (seg2p->special==SEGMENT_IS_GOAL_BLUE ) {
1314 if ((get_team(Player_num)==TEAM_BLUE) && (Players[Player_num].flags & PLAYER_FLAGS_FLAG))
1316 mprintf ((0,"In goal segment BLUE\n"));
1318 multi_send_capture_bonus (Player_num);
1319 Players[Player_num].flags &=(~(PLAYER_FLAGS_FLAG));
1320 maybe_drop_net_powerup (POW_FLAG_RED);
1323 if ( seg2p->special==SEGMENT_IS_GOAL_RED) {
1325 if ((get_team(Player_num)==TEAM_RED) && (Players[Player_num].flags & PLAYER_FLAGS_FLAG))
1327 mprintf ((0,"In goal segment RED\n"));
1328 multi_send_capture_bonus (Player_num);
1329 Players[Player_num].flags &=(~(PLAYER_FLAGS_FLAG));
1330 maybe_drop_net_powerup (POW_FLAG_BLUE);
1335 void fuelcen_check_for_hoard_goal(segment *segp)
1337 segment2 *seg2p = &Segment2s[segp-Segments];
1339 Assert( segp != NULL );
1340 Assert (Game_mode & GM_HOARD);
1345 if (seg2p->special==SEGMENT_IS_GOAL_BLUE || seg2p->special==SEGMENT_IS_GOAL_RED )
1347 if (Players[Player_num].secondary_ammo[PROXIMITY_INDEX])
1349 mprintf ((0,"In orb goal!\n"));
1350 multi_send_orb_bonus (Player_num);
1351 Players[Player_num].flags &=(~(PLAYER_FLAGS_FLAG));
1352 Players[Player_num].secondary_ammo[PROXIMITY_INDEX]=0;
1360 #ifndef FAST_FILE_IO
1362 * reads an old_matcen_info structure from a CFILE
1364 void old_matcen_info_read(old_matcen_info *mi, CFILE *fp)
1366 mi->robot_flags = cfile_read_int(fp);
1367 mi->hit_points = cfile_read_fix(fp);
1368 mi->interval = cfile_read_fix(fp);
1369 mi->segnum = cfile_read_short(fp);
1370 mi->fuelcen_num = cfile_read_short(fp);
1374 * reads a matcen_info structure from a CFILE
1376 void matcen_info_read(matcen_info *mi, CFILE *fp)
1378 mi->robot_flags[0] = cfile_read_int(fp);
1379 mi->robot_flags[1] = cfile_read_int(fp);
1380 mi->hit_points = cfile_read_fix(fp);
1381 mi->interval = cfile_read_fix(fp);
1382 mi->segnum = cfile_read_short(fp);
1383 mi->fuelcen_num = cfile_read_short(fp);