Beispiel #1
0
void DoDie(void)
{//sound_beep(destw,0);
  NumMen--;
  if(NumMen<0) { QUITING=true;  DoGameOver(); }
  UpdateScore();
  WAITING=false;
  DIED=true;
  DrawScreen();
}
void
NetGame::Recv()
{
	NetMsg* msg = link->GetMessage();

	while (msg) {
		if (active) {
			// For Debug Convenience:
			// NetPlayer* player = FindPlayerByNetID(msg->NetID());

			switch (msg->Type()) {
			case NET_JOIN_REQUEST:     DoJoinRequest(msg);     break;
			case NET_JOIN_ANNOUNCE:    DoJoinAnnounce(msg);    break;
			case NET_QUIT_REQUEST:     DoQuitRequest(msg);     break;
			case NET_QUIT_ANNOUNCE:    DoQuitAnnounce(msg);    break;
			case NET_GAME_OVER:        DoGameOver(msg);        break;
			case NET_DISCONNECT:       DoDisconnect(msg);      break;

			case NET_OBJ_LOC:          DoObjLoc(msg);          break;
			case NET_OBJ_DAMAGE:       DoObjDamage(msg);       break;
			case NET_OBJ_KILL:         DoObjKill(msg);         break;
			case NET_OBJ_SPAWN:        DoObjSpawn(msg);        break;
			case NET_OBJ_HYPER:        DoObjHyper(msg);        break;
			case NET_OBJ_TARGET:       DoObjTarget(msg);       break;
			case NET_OBJ_EMCON:        DoObjEmcon(msg);        break;
			case NET_SYS_DAMAGE:       DoSysDamage(msg);       break;
			case NET_SYS_STATUS:       DoSysStatus(msg);       break;

			case NET_ELEM_CREATE:      DoElemCreate(msg);      break;
			case NET_ELEM_REQUEST:     DoElemRequest(msg);     break;
			case NET_SHIP_LAUNCH:      DoShipLaunch(msg);      break;
			case NET_NAV_DATA:         DoNavData(msg);         break;
			case NET_NAV_DELETE:       DoNavDelete(msg);       break;

			case NET_WEP_TRIGGER:      DoWepTrigger(msg);      break;
			case NET_WEP_RELEASE:      DoWepRelease(msg);      break;
			case NET_WEP_DESTROY:      DoWepDestroy(msg);      break;

			case NET_COMM_MESSAGE:     DoCommMsg(msg);         break;
			case NET_CHAT_MESSAGE:     DoChatMsg(msg);         break;
			case NET_SELF_DESTRUCT:    DoSelfDestruct(msg);    break;
			}
		}

		delete msg;
		msg = link->GetMessage();
	}
}
Beispiel #3
0
void UpdateScore(void)
{
  char foo[3];
  char num[100];
  if(NumMen<0) DoGameOver();
  //set_foregroundc(destw,fore);
  FONT_HIGH=destw->getHeight()/25;
  destw->setFontSize(FONT_HIGH);
  destw->moveTo(FONT_WIDE*1,SCREEN_Y-FONT_HIGH-8);  *destw<<(char *)"Score: ";
  sprintf(num,(char *)"%d",NumPoints);
  destw->moveTo(7*FONT_WIDE,SCREEN_Y-FONT_HIGH-8);
  *destw<<num;
  destw->moveTo(SCREEN_X/2,SCREEN_Y-FONT_HIGH-8); *destw<<(char *)"Men: ";
  foo[1]=0;
  foo[0]=(char)NumMen+'0';
  destw->moveTo(SCREEN_X/2+5*FONT_WIDE,SCREEN_Y-FONT_HIGH-8);
  *destw<<foo;
}
Beispiel #4
0
//called when the player has died
void DoPlayerDead()
{
	int cycle_window_vis = 1;
#ifdef NETWORK
	if ( (Game_mode & GM_MULTI) && (Netgame.SpawnStyle == SPAWN_STYLE_PREVIEW))  {
		cycle_window_vis = 0; 
	}
#endif

	if (Game_wind && cycle_window_vis)
		window_set_visible(Game_wind, 0);

	reset_palette_add();

	gr_palette_load (gr_palette);

	dead_player_end();		//terminate death sequence (if playing)

	#ifdef EDITOR
	if (Game_mode == GM_EDITOR) {			//test mine, not real level
		object * player = &Objects[Players[Player_num].objnum];
		//nm_messagebox( "You're Dead!", 1, "Continue", "Not a real game, though." );
		if (Game_wind)
			window_set_visible(Game_wind, 1);
		load_level("gamesave.lvl");
		init_player_stats_new_ship(Player_num);
		player->flags &= ~OF_SHOULD_BE_DEAD;
		StartLevel(0);
		return;
	}
	#endif

#ifdef NETWORK
	if ( Game_mode&GM_MULTI )
	{
		multi_do_death(Players[Player_num].objnum);
	}
	else
#endif
	{				//Note link to above else!
		Players[Player_num].lives--;
		if (Players[Player_num].lives == 0)
		{
			DoGameOver();
			return;
		}
	}

	if ( Control_center_destroyed ) {
		int	rval;

		//clear out stuff so no bonus
		Players[Player_num].hostages_on_board = 0;
		Players[Player_num].energy = 0;
		Players[Player_num].shields = 0;
#ifdef NETWORK
		Players[Player_num].connected = CONNECT_DIED_IN_MINE;
#endif

		do_screen_message(TXT_DIED_IN_MINE); // Give them some indication of what happened

		if (Current_level_num == Last_level) {
#ifdef NETWORK
			if ((Game_mode & GM_MULTI) && !(Game_mode & GM_MULTI_COOP))
			{
				multi_endlevel_score();
				rval = AdvanceLevel(0);			//if finished, go on to next level
			}
			else
#endif
			{			// Note link to above else!
				rval = AdvanceLevel(0);			//if finished, go on to next level
				DoEndLevelScoreGlitz(0);
			}
			init_player_stats_new_ship(Player_num);
			last_drawn_cockpit = -1;
		} else {
#ifdef NETWORK
			if (Game_mode & GM_MULTI)
				multi_endlevel_score();
			else
#endif
				DoEndLevelScoreGlitz(0);		// Note above link!

			rval = AdvanceLevel(0);			//if finished, go on to next level
			init_player_stats_new_ship(Player_num);
			last_drawn_cockpit = -1;
		}

		if (rval) {
#ifndef SHAREWARE
			if (PLAYING_BUILTIN_MISSION)
#endif
				scores_maybe_add_player(0);
			if (Game_wind)
				window_close(Game_wind);		// Exit out of game loop
		}
	} else {
		init_player_stats_new_ship(Player_num);
		StartLevel(1);
	}

	if (Game_wind  && cycle_window_vis)
		window_set_visible(Game_wind, 1);
	reset_time();
}
Beispiel #5
0
//called when the player has died
void DoPlayerDead()
{
	reset_palette_add();

	gr_palette_load (gr_palette);

	dead_player_end();		//terminate death sequence (if playing)

#ifdef HOSTAGE_FACES
	stop_all_hostage_clips();
#endif

	#ifdef EDITOR
	if (Game_mode == GM_EDITOR) {			//test mine, not real level
		object * player = &Objects[Players[Player_num].objnum];
		//nm_messagebox( "You're Dead!", 1, "Continue", "Not a real game, though." );
		load_level("gamesave.lvl");
		init_player_stats_new_ship();
		player->flags &= ~OF_SHOULD_BE_DEAD;
		StartLevel(0);
		return;
	}
	#endif

	#ifdef NETWORK
	if ( Game_mode&GM_MULTI )
	{
		multi_do_death(Players[Player_num].objnum);
	}
	else 
	#endif		
	{				//Note link to above else!
		Players[Player_num].lives--;
		if (Players[Player_num].lives == 0)
		{	
			DoGameOver();
			return;
		}
	}
				
	if ( Fuelcen_control_center_destroyed ) {
		int	rval;

		//clear out stuff so no bonus
		Players[Player_num].hostages_on_board = 0;
		Players[Player_num].energy = 0;
		Players[Player_num].shields = 0;
		Players[Player_num].connected = 3;

		died_in_mine_message(); // Give them some indication of what happened

		if (Current_level_num == Last_level) {
			#ifdef NETWORK
			if ((Game_mode & GM_MULTI) && !(Game_mode & GM_MULTI_COOP))
			{
				multi_endlevel_score();
				rval = AdvanceLevel(0);			//if finished, go on to next level
			}
			else
			#endif	
			{			// Note link to above else!
				rval = AdvanceLevel(0);			//if finished, go on to next level
				DoEndLevelScoreGlitz(0);	
			}
			init_player_stats_new_ship();
			last_drawn_cockpit = -1;
		} else {
			#ifdef NETWORK
			if (Game_mode & GM_MULTI)
				multi_endlevel_score();
			else
			#endif
				DoEndLevelScoreGlitz(0);		// Note above link!

			rval = AdvanceLevel(0);			//if finished, go on to next level
			init_player_stats_new_ship();
			last_drawn_cockpit = -1;
		}

		if (rval) {
#ifndef SHAREWARE
			if (PLAYING_BUILTIN_MISSION)
#endif
				scores_maybe_add_player(0);
			longjmp( LeaveGame, 1 );		// Exit out of game loop
		}
	} else {
		init_player_stats_new_ship();
		StartLevel(1);
	}

}