diff --git a/anarchy/Anarchy.h b/anarchy/Anarchy.h deleted file mode 100644 index 9b085ed7..00000000 --- a/anarchy/Anarchy.h +++ /dev/null @@ -1,162 +0,0 @@ -/* -* $Logfile: /DescentIII/Main/anarchy/Anarchy.h $ -* $Revision: 1.1.1.1 $ -* $Date: 2003-08-26 03:56:37 $ -* $Author: kevinb $ -* -* -* -* $Log: not supported by cvs2svn $ - * - * 33 10/21/99 9:28p Jeff - * B.A. Macintosh code merge - * - * 32 5/12/99 11:28a Jeff - * added sourcesafe comment block -* -* $NoKeywords: $ -*/ - - - -#ifndef __DMFC_APP_H_ -#define __DMFC_APP_H_ - -#include "osiris_share.h" -#include "d3events.h" - -//Setup and processing functions -void AnarchyGameInit(int teams); -void AnarchyGameClose(void); - -void OnKeypress(int key); -void OnHUDInterval(void); -void OnInterval(void); -void OnClientPlayerKilled(object *killer_obj,int victim_pnum); -void OnClientPlayerEntersGame(int player_num); -void OnClientLevelStart(void); -void OnClientLevelEnd(void); -void OnServerGameCreated(void); -void OnPLRInterval(void); -void OnPLRInit(void); -void OnSaveStatsToFile(void); -void OnLevelEndSaveStatsToFile(void); -void OnDisconnectSaveStatsToFile(void); -void OnPrintScores(int level); -extern IDMFC *DMFCBase; - - - -/************************************************************************************************* - *The following functions and declaration are needed to connect the DLL to the game. These must * - *stay here and must call the functions that are in them. You can not delete from here, but you * - *can add to it no problem * - ************************************************************************************************* -*/ -// These next two function prototypes MUST appear in the extern "C" block if called -// from a CPP file. -#ifdef __cplusplus -extern "C" -{ -#endif - DLLEXPORT void DLLFUNCCALL DLLGameInit (int *api_func,ubyte *all_ok,int num_teams_to_use); - DLLEXPORT void DLLFUNCCALL DLLGameCall (int eventnum,dllinfo *data); - DLLEXPORT void DLLFUNCCALL DLLGameClose (); - DLLEXPORT void DLLFUNCCALL DLLGetGameInfo (tDLLOptions *options); - DLLEXPORT int DLLFUNCCALL GetGOScriptID(char *name,ubyte isdoor); - DLLEXPORT void DLLFUNCCALLPTR CreateInstance(int id); - DLLEXPORT void DLLFUNCCALL DestroyInstance(int id,void *ptr); - DLLEXPORT short DLLFUNCCALL CallInstanceEvent(int id,void *ptr,int event,tOSIRISEventInfo *data); - DLLEXPORT int DLLFUNCCALL SaveRestoreState( void *file_ptr, ubyte saving_state ); -#ifdef __cplusplus -} -#endif - -#ifdef MACINTOSH -#pragma export on -#endif - -// The main entry point where the game calls the dll -void DLLFUNCCALL DLLGameCall (int eventnum,dllinfo *data) -{ - if((eventnumGetLocalRole()!=LR_SERVER)){ - return; - } - - DMFCBase->TranslateEvent(eventnum,data); -} - - -// GetGOScriptID -// Purpose: -// Given the name of the object (from it's pagename), this function will search through it's -// list of General Object Scripts for a script with a matching name (to see if there is a script -// for that type/id of object within this DLL). If a matching scriptname is found, a UNIQUE ID -// is to be returned back to Descent 3. This ID will be used from here on out for all future -// interaction with the DLL. Since doors are not part of the generic object's, it's possible -// for a door to have the same name as a generic object (OBJ_POWERUP, OBJ_BUILDING, OBJ_CLUTTER -// or OBJ_ROBOT), therefore, a 1 is passed in for isdoor if the given object name refers to a -// door, else it is a 0. The return value is the unique identifier, else -1 if the script -// does not exist in the DLL. -int DLLFUNCCALL GetGOScriptID(char *name,ubyte isdoor) -{ - return -1; -} - -// CreateInstance -// Purpose: -// Given an ID from a call to GetGOScriptID(), this function will create a new instance for that -// particular script (by allocating and initializing memory, etc.). A pointer to this instance -// is to be returned back to Descent 3. This pointer will be passed around, along with the ID -// for CallInstanceEvent() and DestroyInstance(). Return NULL if there was an error. -void DLLFUNCCALLPTR CreateInstance(int id) -{ - return NULL; -} - -// DestroyInstance -// Purpose: -// Given an ID, and a pointer to a particular instance of a script, this function will delete and -// destruct all information associated with that script, so it will no longer exist. -void DLLFUNCCALL DestroyInstance(int id,void *ptr) -{ -} - -// CallInstanceEvent -// Purpose: -// Given an ID, a pointer to a script instance, an event and a pointer to the struct of -// information about the event, this function will translate who this event belongs to and -// passes the event to that instance of the script to be handled. Return a combination of -// CONTINUE_CHAIN and CONTINUE_DEFAULT, to give instructions on what to do based on the -// event. CONTINUE_CHAIN means to continue through the chain of scripts (custom script, level -// script, mission script, and finally default script). If CONTINUE_CHAIN is not specified, -// than the chain is broken and those scripts of lower priority will never get the event. Return -// CONTINUE_DEFAULT in order to tell D3 if you want process the normal action that is built into -// the game for that event. This only pertains to certain events. If the chain continues -// after this script, than the CONTINUE_DEFAULT setting will be overridden by lower priority -// scripts return value. -short DLLFUNCCALL CallInstanceEvent(int id,void *ptr,int event,tOSIRISEventInfo *data) -{ - return CONTINUE_CHAIN|CONTINUE_DEFAULT; -} - -// SaveRestoreState -// Purpose: -// This function is called when Descent 3 is saving or restoring the game state. In this function -// you should save/restore any global data that you want preserved through load/save (which includes -// demos). You must be very careful with this function, corrupting the file (reading or writing too -// much or too little) may be hazardous to the game (possibly making it impossible to restore the -// state). It would be best to use version information to keep older versions of saved states still -// able to be used. IT IS VERY IMPORTANT WHEN SAVING THE STATE TO RETURN THE NUMBER OF _BYTES_ WROTE -// TO THE FILE. When restoring the data, the return value is ignored. saving_state is 1 when you should -// write data to the file_ptr, 0 when you should read in the data. -int DLLFUNCCALL SaveRestoreState( void *file_ptr, ubyte saving_state ) -{ - return 0; -} - -#ifdef MACINTOSH -#pragma export off -#endif - -#endif diff --git a/anarchy/Makefile b/anarchy/Makefile deleted file mode 100644 index 49fc25cb..00000000 --- a/anarchy/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -include ../../default.mak - -OBJS = anarchy.o -REFS = anarchy.cpp -LIBNAME = ../../netgames/anarchy.d3m - -CDLFLAGS = $(CFLAGS) -fPIC -LDLFLAGS = -shared -ldl - -all: depall $(OBJS) - gcc $(LDLFLAGS) -o $(LIBNAME) $(OBJS) /usr/lib/dmfc.so - -depall: - $(CC) -E -M $(CFLAGS) $(DEFINES) $(REFS) > .depend - -clean: - rm -f $(OBJS) *~ $(LIBNAME) core - -%.o: %.cpp - $(CC) $(CDLFLAGS) $(DEFINES) -c $< -o $@ - -ifeq (.depend,$(wildcard .depend)) -include .depend -endif diff --git a/anarchy/anarchy.cpp b/anarchy/anarchy.cpp deleted file mode 100644 index 1969ebc3..00000000 --- a/anarchy/anarchy.cpp +++ /dev/null @@ -1,1017 +0,0 @@ -/* -* $Logfile: /DescentIII/Main/anarchy/anarchy.cpp $ -* $Revision: 1.1.1.1 $ -* $Date: 2003-08-26 03:56:37 $ -* $Author: kevinb $ -* -* -* -* $Log: not supported by cvs2svn $ - * - * 84 11/08/99 11:42p Jeff - * SourceSafe Test...ignore - * - * 83 10/21/99 9:27p Jeff - * B.A. Macintosh code merge - * - * 82 7/12/99 1:22p Jeff - * updated for new netflags - * - * 81 7/11/99 6:43p Jeff - * cleaner plr if the list is too long - * - * 80 5/23/99 3:04a Jason - * fixed bug with player rankings not being updated correctly - * - * 79 5/12/99 11:28a Jeff - * added sourcesafe comment block -* -* $NoKeywords: $ -*/ - - - -#include -#include -#include -#include "idmfc.h" -#include "Anarchy.h" -#include "anarchystr.h" -IDMFC *DMFCBase = NULL; -IDmfcStats *dstat = NULL; - -int SortedPlayers[MAX_PLAYER_RECORDS]; //sorted player nums -bool DisplayScoreScreen; -int Highlight_bmp = -1; - -#define AHD_NONE 0 -#define AHD_SCORE 1 -#define AHD_EFFICIENCY 2 -#define ACM_PLAYERCOLOR 0 -#define ACM_NORMAL 1 -ubyte Anarchy_hud_display = AHD_SCORE; -ubyte HUD_color_model = ACM_PLAYERCOLOR; -bool display_my_welcome = false; - -void DisplayHUDScores(struct tHUDItem *hitem); -void DisplayScores(void); -void DisplayWelcomeMessage(int player_num); -void SaveStatsToFile(char *filename); -void SwitchHUDColor(int i); - -/////////////////////////////////////////////// -//localization info -char **StringTable; -int StringTableSize = 0; -char *_ErrorString = "Missing String"; -char *GetString(int d){if( (d<0) || (d>=StringTableSize) ) return _ErrorString; else return StringTable[d];} -/////////////////////////////////////////////// - -void SwitchAnarchyScores(int i) -{ - if(i<0) - i = 0; - if(i>2) - i = 2; - - Anarchy_hud_display = i; - - switch(i){ - case AHD_NONE: - DLLAddHUDMessage(TXT_HUDD_NONE); - break; - case AHD_SCORE: - DLLAddHUDMessage(TXT_HUDD_SCORES); - break; - case AHD_EFFICIENCY: - DLLAddHUDMessage(TXT_HUDD_EFFIC); - break; - }; -} - -#ifdef MACINTOSH -#pragma export on -#endif - -// This function gets called by the game when it wants to learn some info about the game -void DLLFUNCCALL DLLGetGameInfo (tDLLOptions *options) -{ - options->flags = DOF_MAXTEAMS; - options->max_teams = 1; - strcpy(options->game_name,"Anarchy"); - strcpy(options->requirements,""); -} - -// Initializes the game function pointers -void DLLFUNCCALL DLLGameInit (int *api_func,ubyte *all_ok,int num_teams_to_use) -{ - *all_ok = 1; - DMFCBase = CreateDMFC(); - if(!DMFCBase) - { - *all_ok = 0; - return; - } - - dstat = CreateDmfcStats(); - if(!dstat) - { - *all_ok = 0; - return; - } - - DMFCBase->LoadFunctions(api_func); - - // Setup the event handlers that we handle - DMFCBase->Set_OnKeypress(OnKeypress); - DMFCBase->Set_OnHUDInterval(OnHUDInterval); - DMFCBase->Set_OnInterval(OnInterval); - DMFCBase->Set_OnClientPlayerKilled(OnClientPlayerKilled); - DMFCBase->Set_OnClientPlayerEntersGame(OnClientPlayerEntersGame); - DMFCBase->Set_OnClientLevelStart(OnClientLevelStart); - DMFCBase->Set_OnClientLevelEnd(OnClientLevelEnd); - DMFCBase->Set_OnServerGameCreated(OnServerGameCreated); - DMFCBase->Set_OnPLRInterval(OnPLRInterval); - DMFCBase->Set_OnPLRInit(OnPLRInit); - DMFCBase->Set_OnSaveStatsToFile(OnSaveStatsToFile); - DMFCBase->Set_OnLevelEndSaveStatsToFile(OnLevelEndSaveStatsToFile); - DMFCBase->Set_OnDisconnectSaveStatsToFile(OnDisconnectSaveStatsToFile); - DMFCBase->Set_OnPrintScores(OnPrintScores); - - - DLLCreateStringTable("Anarchy.str",&StringTable,&StringTableSize); - mprintf((0,"%d strings loaded from string table\n",StringTableSize)); - if(!StringTableSize){ - *all_ok = 0; - return; - } - - AnarchyGameInit(1); - - //add the death and suicide messages - DMFCBase->AddDeathMessage(TXT_DEATH1,true); - DMFCBase->AddDeathMessage(TXT_DEATH2,true); - DMFCBase->AddDeathMessage(TXT_DEATH3,false); - DMFCBase->AddDeathMessage(TXT_DEATH4,false); - DMFCBase->AddDeathMessage(TXT_DEATH5,true); - DMFCBase->AddDeathMessage(TXT_DEATH6,true); - DMFCBase->AddDeathMessage(TXT_DEATH7,false); - DMFCBase->AddDeathMessage(TXT_DEATH8,true); - DMFCBase->AddDeathMessage(TXT_DEATH9,true); - DMFCBase->AddDeathMessage(TXT_DEATH10,true); - - DMFCBase->AddSuicideMessage(TXT_SUICIDE1); - DMFCBase->AddSuicideMessage(TXT_SUICIDE2); - DMFCBase->AddSuicideMessage(TXT_SUICIDE3); - DMFCBase->AddSuicideMessage(TXT_SUICIDE4); - DMFCBase->AddSuicideMessage(TXT_SUICIDE5); - DMFCBase->AddSuicideMessage(TXT_SUICIDE6); - - DMFCBase->SetNumberOfTeams(1); - - netgame_info *Netgame = DMFCBase->GetNetgameInfo(); - Netgame->flags |= (NF_DAMAGE_FRIENDLY|NF_TRACK_RANK); - - Highlight_bmp = DLLbm_AllocBitmap(32,32,0); - if(Highlight_bmp>BAD_BITMAP_HANDLE){ - ushort *data = DLLbm_data(Highlight_bmp,0); - if(!data){ - //bail on out of here - *all_ok = 0; - return; - } - for(int x=0;x<32*32;x++){ - data[x] = GR_RGB16(50,50,50)|OPAQUE_FLAG; - } - } - - DMFCBase->AddHUDItemCallback(HI_TEXT,DisplayHUDScores); - - DisplayScoreScreen = false; - -} -// Called when the DLL is shutdown -void DLLFUNCCALL DLLGameClose () -{ - if(Highlight_bmp>BAD_BITMAP_HANDLE) - DLLbm_FreeBitmap(Highlight_bmp); - - DLLDestroyStringTable(StringTable,StringTableSize); - - if(dstat) - { - dstat->DestroyPointer(); - dstat = NULL; - } - - if(DMFCBase) - { - AnarchyGameClose(); - DMFCBase->GameClose(); - DMFCBase->DestroyPointer(); - DMFCBase = NULL; - } -} - -void DetermineScore(int precord_num,int column_num,char *buffer,int buffer_size) -{ - player_record *pr = DMFCBase->GetPlayerRecord(precord_num); - if(!pr || pr->state==STATE_EMPTY){ - buffer[0] = '\0'; - return; - } - - sprintf(buffer,"%d", pr->dstats.kills[DSTAT_LEVEL]-pr->dstats.suicides[DSTAT_LEVEL]); -} - -void AnarchyGameClose(void) -{ -} - -// DMFCApp::GameInit -// -// Sets up all the DLL functions and pointers and preps the class for use. This ABSOLUTLY must be -// called, so if you override DMFCApp::GameInit, make sure that you put a call to this somewhere in -// the override. -void AnarchyGameInit(int teams) -{ - //add the anarchy menu/submenus - IMenuItem *lev1,*lev2; - - lev1 = CreateMenuItemWArgs("Anarchy",MIT_NORMAL,0,NULL); - - lev2 = CreateMenuItemWArgs(TXT_MNU_HUDSTYLE,MIT_STATE,0,SwitchAnarchyScores); - lev2->SetStateItemList(3,TXT_NONE,TXT_SCOREHD,TXT_EFFICIENCY); - lev2->SetState(1); - lev1->AddSubMenu(lev2); - - lev2 = CreateMenuItemWArgs(TXT_MNU_HUDCOLOR,MIT_STATE,0,SwitchHUDColor); - lev2->SetStateItemList(2,TXT_PLAYERCOLORS,TXT_NORMAL); - lev2->SetState(HUD_color_model); - lev1->AddSubMenu(lev2); - - lev2 = DMFCBase->GetOnScreenMenu(); - lev2->AddSubMenu(lev1); - - DMFCBase->GameInit(teams); - - // Initialize the Stats Manager - // ---------------------------- - - tDmfcStatsInit tsi; - tDmfcStatsColumnInfo pl_col[6]; - char gname[20]; - strcpy(gname,"Anarchy"); - - tsi.flags = DSIF_SHOW_PIC|DSIF_SHOW_OBSERVERICON; - tsi.cColumnCountDetailed = 0; - tsi.cColumnCountPlayerList = 6; - tsi.clbDetailedColumn = NULL; - tsi.clbDetailedColumnBMP = NULL; - tsi.clbPlayerColumn = DetermineScore; - tsi.clbPlayerColumnBMP = NULL; - tsi.DetailedColumns = NULL; - tsi.GameName = gname; - tsi.MaxNumberDisplayed = NULL; - tsi.PlayerListColumns = pl_col; - tsi.SortedPlayerRecords = SortedPlayers; - - pl_col[0].color_type = DSCOLOR_SHIPCOLOR; - strcpy(pl_col[0].title,TXT_PILOT); - pl_col[0].type = DSCOL_PILOT_NAME; - pl_col[0].width = 120; - - pl_col[1].color_type = DSCOLOR_SHIPCOLOR; - strcpy(pl_col[1].title,TXT_SCORE); - pl_col[1].type = DSCOL_CUSTOM; - pl_col[1].width = 50; - - pl_col[2].color_type = DSCOLOR_SHIPCOLOR; - strcpy(pl_col[2].title,TXT_KILLS_SHORT); - pl_col[2].type = DSCOL_KILLS_LEVEL; - pl_col[2].width = 50; - - pl_col[3].color_type = DSCOLOR_SHIPCOLOR; - strcpy(pl_col[3].title,TXT_DEATHS_SHORT); - pl_col[3].type = DSCOL_DEATHS_LEVEL; - pl_col[3].width = 60; - - pl_col[4].color_type = DSCOLOR_SHIPCOLOR; - strcpy(pl_col[4].title,TXT_SUICIDES_SHORT); - pl_col[4].type = DSCOL_SUICIDES_LEVEL; - pl_col[4].width = 65; - - pl_col[5].color_type = DSCOLOR_SHIPCOLOR; - strcpy(pl_col[5].title,TXT_PING); - pl_col[5].type = DSCOL_PING; - pl_col[5].width = 40; - - dstat->Initialize(&tsi); -} - -void OnHUDInterval(void) -{ - dstat->DoFrame(); - DMFCBase->DisplayOutrageLogo(); - DMFCBase->OnHUDInterval(); -} - -void OnInterval(void) -{ - DMFCBase->GetSortedPlayerSlots(SortedPlayers,MAX_PLAYER_RECORDS); - DMFCBase->OnInterval(); -} - -void OnKeypress(int key) -{ - dllinfo *Data = DMFCBase->GetDLLInfoCallData(); - - switch(key){ - case K_F7: - DisplayScoreScreen = !DisplayScoreScreen; - DMFCBase->EnableOnScreenMenu(false); - dstat->Enable(DisplayScoreScreen); - break; - case K_PAGEDOWN: - if(DisplayScoreScreen){ - dstat->ScrollDown(); - Data->iRet = 1; - } - break; - case K_PAGEUP: - if(DisplayScoreScreen){ - dstat->ScrollUp(); - Data->iRet = 1; - } - break; - case K_F6: - DisplayScoreScreen = false; - dstat->Enable(false); - break; - case K_ESC: - if(DisplayScoreScreen){ - dstat->Enable(false); - DisplayScoreScreen = false; - Data->iRet = 1; - } - break; - } - - DMFCBase->OnKeypress(key); -} - -// The server has just started, so clear out all the stats and game info -void OnServerGameCreated(void) -{ - DMFCBase->OnServerGameCreated(); -} - -// The server has started a new level, so clear out any scores needed to be reset -void OnClientLevelStart(void) -{ - for(int i=0;iOnClientLevelStart(); -} - -void OnClientLevelEnd(void) -{ - DMFCBase->OnClientLevelEnd(); -} - -// A new player has entered the game, zero their stats out -void OnClientPlayerEntersGame(int player_num) -{ - DMFCBase->OnClientPlayerEntersGame(player_num); - - if(player_num!=DMFCBase->GetPlayerNum()) - DisplayWelcomeMessage(player_num); - else - display_my_welcome = true; -} - -// We need to adjust the scores -void OnClientPlayerKilled(object *killer_obj,int victim_pnum) -{ - DMFCBase->OnClientPlayerKilled(killer_obj,victim_pnum); - player_record *kpr; - - int kpnum; - - if(killer_obj){ - if((killer_obj->type==OBJ_PLAYER)||(killer_obj->type==OBJ_GHOST)) - kpnum = killer_obj->id; - else if(killer_obj->type==OBJ_ROBOT || killer_obj->type == OBJ_BUILDING){ - //countermeasure kill - kpnum = DMFCBase->GetCounterMeasureOwner(killer_obj); - }else{ - kpnum = -1; - } - }else{ - kpnum = -1; - } - - kpr = DMFCBase->GetPlayerRecordByPnum(kpnum); - if(kpr){ - int goal; - if(DMFCBase->GetScoreLimit(&goal)){ - int score = kpr->dstats.kills[DSTAT_LEVEL] - kpr->dstats.suicides[DSTAT_LEVEL]; - if(score>=goal){ - DMFCBase->EndLevel(); - } - } - } -} - -bool compare_slots(int a,int b) -{ - int ascore,bscore; - player_record *apr,*bpr; - apr = DMFCBase->GetPlayerRecord(a); - bpr = DMFCBase->GetPlayerRecord(b); - if( !apr ) - return true; - if( !bpr ) - return false; - if( apr->state==STATE_EMPTY ) - return true; - if( bpr->state==STATE_EMPTY ) - return false; - if( (apr->state==STATE_INGAME) && (bpr->state==STATE_INGAME) ){ - //both players were in the game - ascore = apr->dstats.kills[DSTAT_LEVEL] - apr->dstats.suicides[DSTAT_LEVEL]; - bscore = bpr->dstats.kills[DSTAT_LEVEL] - bpr->dstats.suicides[DSTAT_LEVEL]; - return (ascorestate==STATE_INGAME) && (bpr->state==STATE_DISCONNECTED) ){ - //apr gets priority since he was in the game on exit - return false; - } - if( (apr->state==STATE_DISCONNECTED) && (bpr->state==STATE_INGAME) ){ - //bpr gets priority since he was in the game on exit - return true; - } - //if we got here then both players were disconnected - ascore = apr->dstats.kills[DSTAT_LEVEL] - apr->dstats.suicides[DSTAT_LEVEL]; - bscore = bpr->dstats.kills[DSTAT_LEVEL] - bpr->dstats.suicides[DSTAT_LEVEL]; - return (ascore=0 && compare_slots(tempsort[j],t); j--){ - tempsort[j+1] = tempsort[j]; - } - // insert - tempsort[j+1] = t; - } - - //copy the array over - memcpy(SortedPlayers,tempsort,DLLMAX_PLAYERS*sizeof(int)); - - DMFCBase->OnPLRInit(); -} - -void OnPLRInterval(void) -{ -#define PLAYERS_COL 130 -#define SCORE_COL 280 -#define DEATHS_COL 330 -#define SUICIDES_COL 390 -#define TOTAL_COL 460 - - DMFCBase->OnPLRInterval(); - - int y = 40; - - int height = DLLgrfont_GetHeight((DMFCBase->GetGameFontTranslateArray())[SMALL_UI_FONT_INDEX]) + 1; - DLLgrtext_SetFont((DMFCBase->GetGameFontTranslateArray())[SMALL_UI_FONT_INDEX]); - - //print out header - DLLgrtext_SetColor(GR_RGB(255,255,150)); - DLLgrtext_Printf(PLAYERS_COL,y,TXT_PILOT); - DLLgrtext_Printf(SCORE_COL,y,TXT_KILLS_SHORT); - DLLgrtext_Printf(DEATHS_COL,y,TXT_DEATHS_SHORT); - DLLgrtext_Printf(SUICIDES_COL,y,TXT_SUICIDES_SHORT); - DLLgrtext_Printf(TOTAL_COL,y,TXT_SCORE); - y+=height; - - //print out player stats - int rank = 1; - int slot,pnum; - player_record *pr; - - for(int i=0;iGetPlayerRecord(slot); - if((pr) && (pr->state!=STATE_EMPTY) ){ - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue;//skip a dedicated server - - pnum=DMFCBase->WasPlayerInGameAtLevelEnd(slot); - if(pnum!=-1) - { - DLLgrtext_SetColor((DMFCBase->GetPlayerColors())[pnum]); - }else - { - DLLgrtext_SetColor(GR_RGB(128,128,128)); - } - - char temp[100]; - sprintf(temp,"%d)%s",rank,pr->callsign); - DMFCBase->ClipString(SCORE_COL - PLAYERS_COL - 10,temp,true); - DLLgrtext_Printf(PLAYERS_COL,y,"%s",temp); - - DLLgrtext_Printf(SCORE_COL,y,"%d",pr->dstats.kills[DSTAT_LEVEL]); - DLLgrtext_Printf(DEATHS_COL,y,"%d",pr->dstats.deaths[DSTAT_LEVEL]); - DLLgrtext_Printf(SUICIDES_COL,y,"%d",pr->dstats.suicides[DSTAT_LEVEL]); - DLLgrtext_Printf(TOTAL_COL,y,"%d",pr->dstats.kills[DSTAT_LEVEL]-pr->dstats.suicides[DSTAT_LEVEL]); - y+=height; - rank++; - - if(y>=440) - goto quick_exit; - - } - } - -quick_exit:; -} - - -void SaveStatsToFile(char *filename) -{ - CFILE *file; - DLLOpenCFILE(&file,filename,"wt"); - if(!file){ - mprintf((0,"Unable to open output file\n")); - return; - } - - //write out game stats - #define BUFSIZE 150 - char buffer[BUFSIZE]; - char tempbuffer[25]; - int sortedslots[MAX_PLAYER_RECORDS]; - player_record *pr,*dpr; - tPInfoStat stat; - int count,length,p; - - //sort the stats - DMFCBase->GetSortedPlayerSlots(sortedslots,MAX_PLAYER_RECORDS); - count = 1; - - sprintf(buffer,TXT_SAVE_HEADER,(DMFCBase->GetNetgameInfo())->name,(DMFCBase->GetCurrentMission())->cur_level); - DLLcf_WriteString(file,buffer); - - sprintf(buffer,TXT_SAVE_HEADERB); - DLLcf_WriteString(file,buffer); - sprintf(buffer,"-----------------------------------------------------------------------------------------------"); - DLLcf_WriteString(file,buffer); - - - for(int s=0;sGetPlayerRecord(p); - if( pr && pr->state!=STATE_EMPTY) { - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue; //skip dedicated server - - memset(buffer,' ',BUFSIZE); - - sprintf(tempbuffer,"%d)",count); - memcpy(&buffer[0],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%s%s",(pr->state==STATE_INGAME)?"":"*",pr->callsign); - memcpy(&buffer[7],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d[%d]",pr->dstats.kills[DSTAT_LEVEL]-pr->dstats.suicides[DSTAT_LEVEL],pr->dstats.kills[DSTAT_OVERALL]-pr->dstats.suicides[DSTAT_OVERALL]); - memcpy(&buffer[36],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d[%d]",pr->dstats.kills[DSTAT_LEVEL],pr->dstats.kills[DSTAT_OVERALL]); - memcpy(&buffer[48],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d[%d]",pr->dstats.deaths[DSTAT_LEVEL],pr->dstats.deaths[DSTAT_OVERALL]); - memcpy(&buffer[60],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d[%d]",pr->dstats.suicides[DSTAT_LEVEL],pr->dstats.suicides[DSTAT_OVERALL]); - memcpy(&buffer[71],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%s",DMFCBase->GetTimeString(DMFCBase->GetTimeInGame(p))); - memcpy(&buffer[82],tempbuffer,strlen(tempbuffer)); - - int pos; - pos = 82 + strlen(tempbuffer) + 1; - if(posGetPlayerRecord(p); - if( pr && pr->state!=STATE_EMPTY) { - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue; //skip dedicated server - - //Write out header - sprintf(buffer,"%d) %s%s",count,(pr->state==STATE_INGAME)?"":"*",pr->callsign); - DLLcf_WriteString(file,buffer); - length = strlen(buffer); - memset(buffer,'=',length); - buffer[length] = '\0'; - DLLcf_WriteString(file,buffer); - - //time in game - sprintf(buffer,TXT_SAVE_TIMEINGAME,DMFCBase->GetTimeString(DMFCBase->GetTimeInGame(p))); - DLLcf_WriteString(file,buffer); - - if(DMFCBase->FindPInfoStatFirst(p,&stat)){ - sprintf(buffer,TXT_SAVE_KILLERLIST); - DLLcf_WriteString(file,buffer); - - if(stat.slot!=p){ - memset(buffer,' ',BUFSIZE); - dpr = DMFCBase->GetPlayerRecord(stat.slot); - int pos; - - ASSERT(dpr!=NULL); - if(dpr){ - sprintf(tempbuffer,"%s",dpr->callsign); - memcpy(buffer,tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d",stat.kills); - memcpy(&buffer[30],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d",stat.deaths); - memcpy(&buffer[40],tempbuffer,strlen(tempbuffer)); - - pos = 40 + strlen(tempbuffer) + 1; - if(posFindPInfoStatNext(&stat)){ - if(stat.slot!=p){ - int pos; - memset(buffer,' ',BUFSIZE); - dpr = DMFCBase->GetPlayerRecord(stat.slot); - - if(dpr) - { - sprintf(tempbuffer,"%s",dpr->callsign); - memcpy(buffer,tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d",stat.kills); - memcpy(&buffer[30],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d",stat.deaths); - memcpy(&buffer[40],tempbuffer,strlen(tempbuffer)); - - pos = 40 + strlen(tempbuffer) + 1; - if(posFindPInfoStatClose(); - DLLcf_WriteString(file,""); //skip a line - count++; - } - } - - //done writing stats - DLLcfclose(file); - DLLAddHUDMessage(TXT_MSG_SAVESTATS); -} - -#define ROOTFILENAME "Anarchy" -void OnSaveStatsToFile(void) -{ - char filename[256]; - DMFCBase->GenerateStatFilename(filename,ROOTFILENAME,false); - SaveStatsToFile(filename); -} - -void OnLevelEndSaveStatsToFile(void) -{ - char filename[256]; - DMFCBase->GenerateStatFilename(filename,ROOTFILENAME,true); - SaveStatsToFile(filename); -} - -void OnDisconnectSaveStatsToFile(void) -{ - char filename[256]; - DMFCBase->GenerateStatFilename(filename,ROOTFILENAME,false); - SaveStatsToFile(filename); -} - -void OnPrintScores(int level) -{ - char buffer[256]; - char name[50]; - memset(buffer,' ',256); - - int t; - int pos[6]; - int len[6]; - pos[0] = 0; t = len[0] = 20; //give ample room for pilot name - pos[1] = pos[0] + t + 1; t = len[1] = strlen(TXT_POINTS); - pos[2] = pos[1] + t + 1; t = len[2] = strlen(TXT_KILLS_SHORT); - pos[3] = pos[2] + t + 1; t = len[3] = strlen(TXT_DEATHS_SHORT); - pos[4] = pos[3] + t + 1; t = len[4] = strlen(TXT_SUICIDES_SHORT); - pos[5] = pos[4] + t + 1; t = len[5] = strlen(TXT_PING); - - memcpy(&buffer[pos[0]],TXT_PILOT,strlen(TXT_PILOT)); - memcpy(&buffer[pos[1]],TXT_POINTS,len[1]); - memcpy(&buffer[pos[2]],TXT_KILLS_SHORT,len[2]); - memcpy(&buffer[pos[3]],TXT_DEATHS_SHORT,len[3]); - memcpy(&buffer[pos[4]],TXT_SUICIDES_SHORT,len[4]); - memcpy(&buffer[pos[5]],TXT_PING,len[5]); - buffer[pos[5]+len[5]+1] = '\n'; - buffer[pos[5]+len[5]+2] = '\0'; - DPrintf(buffer); - - int slot; - player_record *pr; - int pcount; - - if(level<0 || level>=MAX_PLAYER_RECORDS) - pcount = MAX_PLAYER_RECORDS; - else - pcount = level; - - int sortedplayers[MAX_PLAYER_RECORDS]; - DMFCBase->GetSortedPlayerSlots(sortedplayers,MAX_PLAYER_RECORDS); - - for(int i=0;iGetPlayerRecord(slot); - if((pr)&&(pr->state!=STATE_EMPTY)){ - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue; //skip dedicated server - - sprintf(name,"%s%s:",(pr->state==STATE_DISCONNECTED)?"*":"",pr->callsign); - name[19] = '\0'; - - memset(buffer,' ',256); - t = strlen(name); memcpy(&buffer[pos[0]],name,(tdstats.kills[DSTAT_LEVEL]-pr->dstats.suicides[DSTAT_LEVEL]); - t = strlen(name); memcpy(&buffer[pos[1]],name,(tdstats.kills[DSTAT_LEVEL]); - t = strlen(name); memcpy(&buffer[pos[2]],name,(tdstats.deaths[DSTAT_LEVEL]); - t = strlen(name); memcpy(&buffer[pos[3]],name,(tdstats.suicides[DSTAT_LEVEL]); - t = strlen(name); memcpy(&buffer[pos[4]],name,(tstate==STATE_INGAME) - sprintf(name,"%.0f",(DMFCBase->GetNetPlayers())[pr->pnum].ping_time*1000.0f); - else - strcpy(name,"---"); - t = strlen(name); memcpy(&buffer[pos[5]],name,(tGetPlayerNum()); - display_my_welcome = false; - } - - if(DisplayScoreScreen) - return; - - int height = DLLgrfont_GetHeight((DMFCBase->GetGameFontTranslateArray())[HUD_FONT_INDEX]) + 3; - ubyte alpha = DMFCBase->ConvertHUDAlpha((ubyte)((DisplayScoreScreen)?128:255)); - int y = (DMFCBase->GetGameWindowH()/2) - ((height*5)/2); - int x = 520; - ddgr_color color; - - int rank = 1; - player_record *pr; - - //Display your Kills & Deaths on the top corners of the screen - pr = DMFCBase->GetPlayerRecordByPnum(DMFCBase->GetPlayerNum()); - if(pr){ - int y = 25,x; - int lwidth; - char buffer[20]; - - int w_kill,w_death,max_w; - w_kill = DLLgrtext_GetTextLineWidth(TXT_KILLS); - w_death = DLLgrtext_GetTextLineWidth(TXT_DEATHS); - max_w = max(w_kill,w_death); - - x = DMFCBase->GetGameWindowW() - DMFCBase->GetGameWindowW()*0.0078125f; - DLLgrtext_SetColor(GR_GREEN); - DLLgrtext_SetAlpha(alpha); - DLLgrtext_Printf(x-(max_w/2)-(w_kill/2),y,TXT_KILLS); - y+=height; - - sprintf(buffer,"%d",pr->dstats.kills[DSTAT_LEVEL]); - lwidth = DLLgrtext_GetTextLineWidth(buffer); - DLLgrtext_SetColor(GR_GREEN); - DLLgrtext_SetAlpha(alpha); - DLLgrtext_Printf(x-(max_w/2)-(lwidth/2),y,buffer); - y+=height+3; - - DLLgrtext_SetColor(GR_GREEN); - DLLgrtext_SetAlpha(alpha); - DLLgrtext_Printf(x - (max_w/2) - (w_death/2),y,TXT_DEATHS); - y+=height; - - sprintf(buffer,"%d",pr->dstats.deaths[DSTAT_LEVEL]); - lwidth = DLLgrtext_GetTextLineWidth(buffer); - DLLgrtext_SetColor(GR_GREEN); - DLLgrtext_SetAlpha(alpha); - DLLgrtext_Printf(x - (max_w/2) - (lwidth/2),y,buffer); - } - - int ESortedPlayers[DLLMAX_PLAYERS]; - - switch(Anarchy_hud_display){ - case AHD_NONE: - return; - break; - case AHD_EFFICIENCY: - DMFCBase->GetSortedPlayerSlots(ESortedPlayers,DLLMAX_PLAYERS); - break; - } - - char name[30]; - - //determine coordinates to use here - //we'll use a virtual width of 85 pixels on a 640x480 screen - //so first determine the new width - int name_width = 85.0f * DMFCBase->GetHudAspectX(); - int score_width = DLLgrtext_GetTextLineWidth("888"); - int name_x = DMFCBase->GetGameWindowW() - name_width - score_width - 10; - int score_x = DMFCBase->GetGameWindowW() - score_width - 5; - - for(int i=0;iGetPlayerRecord(slot); - - if((pr)&&(pr->state!=STATE_EMPTY)){ - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue; //skip dedicated server - - if( (pr->state==STATE_DISCONNECTED) || (pr->state==STATE_INGAME && !DMFCBase->IsPlayerObserver(pr->pnum)) ){ - - if(pr->pnum==DMFCBase->GetPlayerNum()){ - - switch(HUD_color_model){ - case ACM_PLAYERCOLOR: - color = (DMFCBase->GetPlayerColors())[pr->pnum]; - break; - case ACM_NORMAL: - color = GR_RGB(40,255,40); - break; - }; - - if(Highlight_bmp>BAD_BITMAP_HANDLE){ - //draw the highlite bar in the background - DLLrend_SetAlphaValue(alpha*0.50f); - DLLrend_SetZBufferState (0); - DLLrend_SetTextureType (TT_LINEAR); - DLLrend_SetLighting (LS_NONE); - DLLrend_SetAlphaType (AT_CONSTANT_TEXTURE); - DLLrend_DrawScaledBitmap(name_x-2,y-2,score_x+score_width+2,y+height-1,Highlight_bmp,0,0,1,1,1.0); - DLLrend_SetZBufferState (1); - } - - strcpy(name,pr->callsign); - DMFCBase->ClipString(name_width,name,true); - - DLLgrtext_SetAlpha(alpha); - DLLgrtext_SetColor(color); - DLLgrtext_Printf(name_x,y,"%s",name); - - if(Anarchy_hud_display==AHD_EFFICIENCY){ - float t = pr->dstats.kills[DSTAT_LEVEL]+pr->dstats.suicides[DSTAT_LEVEL]+pr->dstats.deaths[DSTAT_LEVEL]; - float value = (float)(pr->dstats.kills[DSTAT_LEVEL])/((t)?t:0.0000001f); - DLLgrtext_Printf(score_x,y,"%.1f",value); - }else{ - DLLgrtext_Printf(score_x,y,"%d",pr->dstats.kills[DSTAT_LEVEL]-pr->dstats.suicides[DSTAT_LEVEL]); - } - - y+=height; - }else - if(rank<6){ - - if(pr->state==STATE_DISCONNECTED){ - color = GR_GREY; - }else{ - switch(HUD_color_model){ - case ACM_PLAYERCOLOR: - color = (DMFCBase->GetPlayerColors())[pr->pnum]; - break; - case ACM_NORMAL: - color = GR_RGB(40,255,40); - break; - }; - } - strcpy(name,pr->callsign); - DMFCBase->ClipString(name_width,name,true); - - DLLgrtext_SetAlpha(alpha); - DLLgrtext_SetColor(color); - DLLgrtext_Printf(name_x,y,"%s",name); - - if(Anarchy_hud_display==AHD_EFFICIENCY){ - float t = pr->dstats.kills[DSTAT_LEVEL]+pr->dstats.suicides[DSTAT_LEVEL]+pr->dstats.deaths[DSTAT_LEVEL]; - float value = (float)(pr->dstats.kills[DSTAT_LEVEL])/((t)?t:0.0000001f); - DLLgrtext_Printf(score_x,y,"%.1f",value); - }else{ - DLLgrtext_Printf(score_x,y,"%d",pr->dstats.kills[DSTAT_LEVEL]-pr->dstats.suicides[DSTAT_LEVEL]); - } - - y+=height; - } - rank++; - } - } - } -} - -void DisplayWelcomeMessage(int player_num) -{ - char name_buffer[64]; - strcpy(name_buffer,(DMFCBase->GetPlayers())[player_num].callsign); - - if(player_num==DMFCBase->GetPlayerNum()) - { - DLLAddHUDMessage(TXT_WELCOME,name_buffer); - } - else - { - DLLAddHUDMessage(TXT_JOINED,name_buffer); - } -} - -void SwitchHUDColor(int i) -{ - if(i<0 || i>1) - return; - HUD_color_model = i; - - switch(HUD_color_model){ - case ACM_PLAYERCOLOR: - DLLAddHUDMessage(TXT_MSG_COLORPLR); - break; - case ACM_NORMAL: - DLLAddHUDMessage(TXT_MSG_COLORNORM); - break; - }; -} - -#ifdef MACINTOSH -#pragma export off -#endif \ No newline at end of file diff --git a/anarchy/anarchystr.h b/anarchy/anarchystr.h deleted file mode 100644 index 216a7bc7..00000000 --- a/anarchy/anarchystr.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef __ANARCHY_STRING_TABLE_H_ -#define __ANARCHY_STRING_TABLE_H_ - -#define TXT(d) GetString(d) - - -#define TXT_DEATH1 TXT(0) //"%s got blasted by %s" -#define TXT_DEATH2 TXT(1) //"%s knows %s is his god" -#define TXT_DEATH3 TXT(2) //"%s sucks %s's milk" -#define TXT_DEATH4 TXT(3) //"%s realizes %s's power" -#define TXT_DEATH5 TXT(4) //"%s got killed by %s" -#define TXT_DEATH6 TXT(5) //"%s begs for %s's mercy" -#define TXT_DEATH7 TXT(6) //"%s realizes %s is a better player" -#define TXT_DEATH8 TXT(7) //"%s was no match for %s" -#define TXT_DEATH9 TXT(8) //"%s wishes he was as good as %s" -#define TXT_DEATH10 TXT(9) //"%s got messed up by %s" -#define TXT_SUICIDE1 TXT(10) //"%s blasts himself" -#define TXT_SUICIDE2 TXT(11) //"%s Bursts his own bubble" -#define TXT_SUICIDE3 TXT(12) //"%s doesn't know his own strength" -#define TXT_SUICIDE4 TXT(13) //"No prize for %s" -#define TXT_SUICIDE5 TXT(14) //"%s doesn't wish to live anymore" -#define TXT_SUICIDE6 TXT(15) //"%s SUCKS!" -#define TXT_PILOT TXT(16) //"Pilot" -#define TXT_KILLS TXT(17) //"Kills" -#define TXT_DEATHS TXT(18) //"Deaths" -#define TXT_SUICIDES TXT(19) //"Suicides" -#define TXT_SCORE TXT(20) //"Score" -#define TXT_STATS TXT(21) //"Stats" -#define TXT_WELCOME TXT(22) //"Welcome to the Anarchy %s!" -#define TXT_JOINED TXT(23) //"%s has joined the Anarchy" -#define TXT_POINTS TXT(24) //"Points" -#define TXT_HUDD_NONE TXT(25) //"Anarchy: HUD Display set to None" -#define TXT_HUDD_SCORES TXT(26) //"Anarchy: HUD Display set to Scores" -#define TXT_HUDD_EFFIC TXT(27) //"Anarchy: HUD Display set to Efficiency" -#define TXT_MNU_HUDSTYLE TXT(28) //"HUD Display" -#define TXT_NONE TXT(29) //"None" -#define TXT_SCOREHD TXT(30) //"Score" -#define TXT_EFFICIENCY TXT(31) //"Efficiency" -#define TXT_MNU_HUDCOLOR TXT(32) //"HUD Score Colors" -#define TXT_PLAYERCOLORS TXT(33) //"Player Colors" -#define TXT_NORMAL TXT(34) //"Normal" -#define TXT_PING TXT(35) //"Ping" -#define TXT_SAVE_HEADER TXT(36) //"Anarchy\r\nGame: %s\r\nLevel: %d\r\n" -#define TXT_SAVE_HEADERB TXT(37) //"[Rank] [Name] [Score] [Kills] [Deaths] [Suicides] [Time In Game]" -#define TXT_SAVE_HEADERC TXT(38) //"\r\nIndividual Stats\r\n" -#define TXT_SAVE_TIMEINGAME TXT(39) //"Total Time In Game: %s" -#define TXT_SAVE_KILLERLIST TXT(40) //"Callsign: Kills: Deaths:" -#define TXT_MSG_SAVESTATS TXT(41) //"Stats saved to file" -#define TXT_MSG_COLORPLR TXT(42) //"Anarchy HUD Color Model: Player Colors" -#define TXT_MSG_COLORNORM TXT(43) //"Anarchy HUD Color Model: Normal" -#define TXT_KILLS_SHORT TXT(44) //"K" -#define TXT_DEATHS_SHORT TXT(45) //"D" -#define TXT_SUICIDES_SHORT TXT(46) //"S" - -#endif diff --git a/coop/Makefile b/coop/Makefile deleted file mode 100644 index d25a6188..00000000 --- a/coop/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -include ../../default.mak - -OBJS = coop.o -REFS = coop.cpp -LIBNAME = ../../netgames/co-op.d3m - -CDLFLAGS = $(CFLAGS) -fPIC -LDLFLAGS = -shared -ldl - -all: depall $(OBJS) - gcc $(LDLFLAGS) -o $(LIBNAME) $(OBJS) /usr/lib/dmfc.so - -depall: - $(CC) -E -M $(CFLAGS) $(DEFINES) $(REFS) > .depend - -clean: - rm -f $(OBJS) *~ $(LIBNAME) core - -%.o: %.cpp - $(CC) $(CDLFLAGS) $(DEFINES) -c $< -o $@ - -ifeq (.depend,$(wildcard .depend)) -include .depend -endif diff --git a/coop/coop.cpp b/coop/coop.cpp deleted file mode 100644 index f3699d67..00000000 --- a/coop/coop.cpp +++ /dev/null @@ -1,859 +0,0 @@ -/* -* $Logfile: /DescentIII/Main/coop/coop.cpp $ -* $Revision: 1.1.1.1 $ -* $Date: 2003-08-26 03:56:42 $ -* $Author: kevinb $ -* -* Co-Op Play -* -* $Log: not supported by cvs2svn $ - * - * 23 10/21/99 9:27p Jeff - * B.A. Macintosh code merge - * - * 22 7/12/99 1:17p Jeff - * added netgame flag NF_COOP - * - * 21 5/23/99 3:04a Jason - * fixed bug with player rankings not being updated correctly - * - * 20 5/19/99 3:53p Jeff - * fixed possible (???) bug with displaying hud names - * - * 19 5/12/99 11:04p Jeff - * dmfc and multiplayer games now have endian friendly packets (*whew*) - * - * 18 5/09/99 6:20a Jeff - * improved Entropy (added sounds, max virii per room). Fixed rendering - * bugs for other multiplayer dlls. - * - * 17 5/07/99 12:52p Jeff - * audio taunt icon is ppic if available. coop has hard max team set of 4 - * - * 16 5/02/99 8:39a Jeff - * made quick & dirty PLR for coop - * - * 15 4/23/99 6:15p Jeff - * fixed double calls to GameClose - * - * 14 4/23/99 12:43p Jeff - * forgot to call CloseGame - * - * 13 4/21/99 5:34p Jeff - * added requirements - * - * 12 4/19/99 6:07p Jeff - * compile for Linux - * - * 11 3/27/99 4:53p Jeff - * player rankings in multiplayer games implemented. Fixed join message - * so it doesn't get cut off - * - * 10 3/19/99 12:54p Jeff - * base support for requesting the number of teams for a multiplayer game - * - * 9 3/18/99 8:40p Jeff - * hi res font fixes - * - * 8 3/17/99 12:23p Jeff - * converted DMFC to be COM interface - * - * 7 3/01/99 4:17p Jeff - * added net flag whether buddy bot allowed - * - * 6 2/11/99 3:09p Jeff - * localized - * - * 5 2/11/99 12:49a Jeff - * changed names of exported variables - * - * 3 2/07/99 2:06a Jeff - * updated coop...fixed bug when getting countermeasure owner, if owner is - * observer - * - * 2 2/03/99 7:22p Jeff - * - * 1 2/03/99 7:19p Jeff -* -* $NoKeywords: $ -*/ - - -#include -#include -#include -#include "idmfc.h" -#include "coop.h" -#include "coopstr.h" -IDMFC *DMFCBase = NULL; -IDmfcStats *dstat = NULL; -player *dPlayers; - -typedef struct{ - int Score[2]; -}tPlayerStat; -int pack_pstat(tPlayerStat *user_info,ubyte *data) -{ - int count = 0; - MultiAddInt(user_info->Score[0],data,&count); - MultiAddInt(user_info->Score[1],data,&count); - return count; -} - -int unpack_pstat(tPlayerStat *user_info,ubyte *data) -{ - int count = 0; - user_info->Score[0] = MultiGetInt(data,&count); - user_info->Score[1] = MultiGetInt(data,&count); - return count; -} - - -/////////////////////////////////////////////// -//localization info -char **StringTable; -int StringTableSize = 0; -char *_ErrorString = "Missing String"; -char *GetStringFromTable(int d){if( (d<0) || (d>=StringTableSize) ) return _ErrorString; else return StringTable[d];} -/////////////////////////////////////////////// -int SortedPlayers[MAX_PLAYER_RECORDS]; -bool DisplayScoreScreen = false; -bool FirstFrame = false; -bool display_my_welcome = false; - -void DisplayWelcomeMessage(int player_num); -void DisplayHUDScores(struct tHUDItem *hitem); -int Highlight_bmp = -1; - -void OnPLRInterval(void); -void OnPLRInit(void); - -#ifdef MACINTOSH -#pragma export on -#endif - -void DetermineScore(int precord_num,int column_num,char *buffer,int buffer_size) -{ - player_record *pr = DMFCBase->GetPlayerRecord(precord_num); - if(!pr || pr->state==STATE_EMPTY){ - buffer[0] = '\0'; - return; - } - tPlayerStat *stat = (tPlayerStat *)pr->user_info; - - sprintf(buffer,"%d",stat->Score[DSTAT_LEVEL]); -} - -// This function gets called by the game when it wants to learn some info about the game -void DLLFUNCCALL DLLGetGameInfo (tDLLOptions *options) -{ - options->flags = DOF_MAXTEAMS; - options->max_teams = 1; - strcpy(options->game_name,TXT_COOP); - strcpy(options->requirements,"COOP"); -} - -// Initializes the game function pointers -void DLLFUNCCALL DLLGameInit (int *api_func,ubyte *all_ok,int num_teams_to_use) -{ - *all_ok = 1; - DMFCBase = CreateDMFC(); - if(!DMFCBase) - { - *all_ok = 0; - return; - } - - dstat = CreateDmfcStats(); - if(!dstat) - { - *all_ok = 0; - return; - } - - DMFCBase->LoadFunctions(api_func); - - //Setup event handlers - DMFCBase->Set_OnHUDInterval(OnHUDInterval); - DMFCBase->Set_OnInterval(OnInterval); - DMFCBase->Set_OnKeypress(OnKeypress); - DMFCBase->Set_OnClientPlayerEntersGame(OnClientPlayerEntersGame); - DMFCBase->Set_OnServerObjectKilled(OnServerObjectKilled); - DMFCBase->Set_OnClientObjectKilled(OnClientObjectKilled); - DMFCBase->Set_OnPlayerConnect(OnPlayerConnect); - DMFCBase->Set_OnServerGameCreated(OnServerGameCreated); - DMFCBase->Set_OnClientLevelStart(OnClientLevelStart); - DMFCBase->Set_OnGameStateRequest(OnGameStateRequest); - DMFCBase->Set_OnSaveStatsToFile(OnSaveStatsToFile); - DMFCBase->Set_OnLevelEndSaveStatsToFile(OnLevelEndSaveStatsToFile); - DMFCBase->Set_OnDisconnectSaveStatsToFile(OnDisconnectSaveStatsToFile); - DMFCBase->Set_OnPrintScores(OnPrintScores); - DMFCBase->Set_OnPLRInterval(OnPLRInterval); - DMFCBase->Set_OnPLRInit(OnPLRInit); - - dPlayers = DMFCBase->GetPlayers(); - - DLLCreateStringTable("Coop.str",&StringTable,&StringTableSize); - mprintf((0,"%d strings loaded from string table\n",StringTableSize)); - if(!StringTableSize){ - *all_ok = 0; - return; - } - - DMFCBase->GameInit(1); - - Highlight_bmp = DLLbm_AllocBitmap(32,32,0); - if(Highlight_bmp>BAD_BITMAP_HANDLE){ - ushort *data = DLLbm_data(Highlight_bmp,0); - if(!data){ - //bail on out of here - *all_ok = 0; - return; - } - for(int x=0;x<32*32;x++){ - data[x] = GR_RGB16(50,50,50)|OPAQUE_FLAG; - } - } - - DMFCBase->AddHUDItemCallback(HI_TEXT,DisplayHUDScores); - DMFCBase->SetupPlayerRecord(sizeof(tPlayerStat),(int (*)(void *,ubyte *))pack_pstat,(int (*)(void *,ubyte *))unpack_pstat); - DMFCBase->SetNumberOfTeams(1); - - netgame_info *netgameinfo = DMFCBase->GetNetgameInfo(); - netgameinfo->flags |= (NF_USE_ROBOTS|NF_RESPAWN_WAYPOINT|NF_ALLOWGUIDEBOT|NF_COOP); - netgameinfo->max_players = min(4,netgameinfo->max_players); - DMFCBase->SetMaxPlayerHardLimit(4); - - // Initialize the Stats Manager - // ---------------------------- - tDmfcStatsInit tsi; - tDmfcStatsColumnInfo pl_col[5]; - char gname[20]; - strcpy(gname,TXT_STATGAMENAME); - - tsi.flags = DSIF_SHOW_PIC|DSIF_SHOW_OBSERVERICON|DSIF_NOLASTKILLER|DSIF_NOLASTVICTIM|DSIF_NODETAILEDINFO|DSIF_SHOWPLAYERVIEW; - tsi.cColumnCountDetailed = 0; - tsi.cColumnCountPlayerList = 5; - tsi.clbDetailedColumn = NULL; - tsi.clbDetailedColumnBMP = NULL; - tsi.clbPlayerColumn = DetermineScore; - tsi.clbPlayerColumnBMP = NULL; - tsi.DetailedColumns = NULL; - tsi.GameName = gname; - tsi.MaxNumberDisplayed = NULL; - tsi.PlayerListColumns = pl_col; - tsi.SortedPlayerRecords = SortedPlayers; - - pl_col[0].color_type = DSCOLOR_SHIPCOLOR; - strcpy(pl_col[0].title,TXT_PILOT); - pl_col[0].type = DSCOL_PILOT_NAME; - pl_col[0].width = 84; - - pl_col[1].color_type = DSCOLOR_SHIPCOLOR; - strcpy(pl_col[1].title,TXT_KILLS); - pl_col[1].type = DSCOL_CUSTOM; - pl_col[1].width = 51; - - pl_col[2].color_type = DSCOLOR_SHIPCOLOR; - strcpy(pl_col[2].title,TXT_DEATHS); - pl_col[2].type = DSCOL_DEATHS_LEVEL; - pl_col[2].width = 64; - - pl_col[3].color_type = DSCOLOR_SHIPCOLOR; - strcpy(pl_col[3].title,TXT_SUICIDES); - pl_col[3].type = DSCOL_SUICIDES_LEVEL; - pl_col[3].width = 69; - - pl_col[4].color_type = DSCOLOR_SHIPCOLOR; - strcpy(pl_col[4].title,TXT_PING); - pl_col[4].type = DSCOL_PING; - pl_col[4].width = 40; - - dstat->Initialize(&tsi); -} -// Called when the DLL is shutdown -void DLLFUNCCALL DLLGameClose () -{ - if(Highlight_bmp>BAD_BITMAP_HANDLE) - DLLbm_FreeBitmap(Highlight_bmp); - - DLLDestroyStringTable(StringTable,StringTableSize); - - if(dstat) - { - dstat->DestroyPointer(); - dstat = NULL; - } - - if(DMFCBase) - { - DMFCBase->GameClose(); - DMFCBase->DestroyPointer(); - DMFCBase = NULL; - } -} - - -void OnHUDInterval(void) -{ - dstat->DoFrame(); - DMFCBase->DisplayOutrageLogo(); - DMFCBase->OnHUDInterval(); -} - -bool compare_slots(int a,int b) -{ - int ascore,bscore; - player_record *apr,*bpr; - tPlayerStat *astat,*bstat; - - apr = DMFCBase->GetPlayerRecord(a); - bpr = DMFCBase->GetPlayerRecord(b); - if( !apr ) - return true; - if( !bpr ) - return false; - if( apr->state==STATE_EMPTY ) - return true; - if( bpr->state==STATE_EMPTY ) - return false; - astat = (tPlayerStat *)apr->user_info; - bstat = (tPlayerStat *)bpr->user_info; - - if( (apr->state==STATE_INGAME) && (bpr->state==STATE_INGAME) ){ - //both players were in the game - ascore = (astat)?astat->Score[DSTAT_LEVEL]:0; - bscore = (bstat)?bstat->Score[DSTAT_LEVEL]:0; - return (ascorestate==STATE_INGAME) && (bpr->state==STATE_DISCONNECTED) ){ - //apr gets priority since he was in the game on exit - return false; - } - if( (apr->state==STATE_DISCONNECTED) && (bpr->state==STATE_INGAME) ){ - //bpr gets priority since he was in the game on exit - return true; - } - //if we got here then both players were disconnected - ascore = (astat)?astat->Score[DSTAT_LEVEL]:0; - bscore = (bstat)?bstat->Score[DSTAT_LEVEL]:0; - return (ascore=0 && compare_slots(SortedPlayers[j],t); j--){ - SortedPlayers[j+1] = SortedPlayers[j]; - } - // insert - SortedPlayers[j+1] = t; - } - - FirstFrame = true; - DMFCBase->OnInterval(); -} - -void OnKeypress(int key) -{ - dllinfo *Data = DMFCBase->GetDLLInfoCallData(); - - switch(key){ - case K_F7: - DisplayScoreScreen = !DisplayScoreScreen; - DMFCBase->EnableOnScreenMenu(false); - dstat->Enable(DisplayScoreScreen); - break; - case K_PAGEDOWN: - if(DisplayScoreScreen){ - dstat->ScrollDown(); - Data->iRet = 1; - } - break; - case K_PAGEUP: - if(DisplayScoreScreen){ - dstat->ScrollUp(); - Data->iRet = 1; - } - break; - case K_F6: - DisplayScoreScreen = false; - dstat->Enable(false); - break; - case K_ESC: - if(DisplayScoreScreen){ - dstat->Enable(false); - DisplayScoreScreen = false; - Data->iRet = 1; - } - break; - } - - DMFCBase->OnKeypress(key); -} - -void OnClientPlayerEntersGame(int player_num) -{ - if(player_num==DMFCBase->GetPlayerNum()){ - FirstFrame = false; - DisplayScoreScreen = false; - } - - DMFCBase->OnClientPlayerEntersGame(player_num); - - if(player_num!=DMFCBase->GetPlayerNum()) - DisplayWelcomeMessage(player_num); - else - display_my_welcome = true; -} - -// A new player has entered the game, zero there stats out -void OnPlayerConnect(int player_num) -{ - DMFCBase->OnPlayerConnect(player_num); - - tPlayerStat *stat = (tPlayerStat *)DMFCBase->GetPlayerRecordData(player_num); - if(stat){ - stat->Score[DSTAT_LEVEL] = 0; - stat->Score[DSTAT_OVERALL] = 0; - } -} - - -// The server has just started, so clear out all the stats and game info -void OnServerGameCreated(void) -{ - DMFCBase->OnServerGameCreated(); - player_record *pr; - tPlayerStat *stat; - for(int i=0;iGetPlayerRecord(i); - if(pr) - stat = (tPlayerStat *) pr->user_info; - else - stat = NULL; - if(stat){ - stat->Score[DSTAT_LEVEL] = 0; - stat->Score[DSTAT_OVERALL] = 0; - } - } -} - -// The server has started a new level, so clear out level scores -void OnClientLevelStart(void) -{ - DMFCBase->OnClientLevelStart(); - player_record *pr; - tPlayerStat *stat; - for(int i=0;iGetPlayerRecord(i); - if(pr) - stat = (tPlayerStat *)pr->user_info; - else - stat = NULL; - - if(stat){ - stat->Score[DSTAT_LEVEL] = 0; - } - } - DMFCBase->RequestGameState(); -} - -// We need to send all the inventory info out to the new player -void OnGameStateRequest(int player_num) -{ - DMFCBase->OnGameStateRequest(player_num); -} - -void DisplayWelcomeMessage(int player_num) -{ - char name_buffer[64]; - strcpy(name_buffer,(DMFCBase->GetPlayers())[player_num].callsign); - - if(player_num==DMFCBase->GetPlayerNum()) - { - DLLAddHUDMessage(TXT_WELCOME,name_buffer); - } - else - { - DLLAddHUDMessage(TXT_JOINED,name_buffer); - } -} - -void OnServerObjectKilled(object *obj,object *killer) -{ - if(!killer) - return; //can't handle this - - if(obj->type==OBJ_ROBOT || (obj->type == OBJ_BUILDING && obj->ai_info)){ - - //check to see if the killer is a player - bool ok_to_call = false; - - if(killer->type==OBJ_PLAYER){ - ok_to_call = true; - }else if(killer->type==OBJ_ROBOT){ - if(DMFCBase->GetCounterMeasureOwner(killer)!=-1){ - ok_to_call = true; - } - } - - if(ok_to_call){ - DMFCBase->CallClientEvent(EVT_CLIENT_GAMEOBJKILLED,DMFCBase->GetMeObjNum(),DMFCBase->GetItObjNum(),-1); - DMFCBase->CallOnClientObjectKilled(obj,killer); - } - } - - DMFCBase->OnServerObjectKilled(obj,killer); -} - -void OnClientObjectKilled(object *obj,object *killer) -{ - object *parent; - DLLGetUltimateParentForObject(&parent,killer); - - if((parent->type!=OBJ_PLAYER)&&(parent->type!=OBJ_OBSERVER)){ - mprintf((0,"Robot killed wasn't by a OBJ_PLAYER or OBJ_OBSERVER (%d)\n",parent->type)); - return; - } - - int killer_pnum = parent->id; - - player_record *pr = DMFCBase->GetPlayerRecordByPnum(killer_pnum); - if(!pr){ - mprintf((0,"Invalid player record!\n")); - Int3(); - return; - } - - tPlayerStat *stat = (tPlayerStat *)pr->user_info; - - stat->Score[DSTAT_LEVEL]++; - stat->Score[DSTAT_OVERALL]++; - - mprintf((0,"%s's score is now %d\n",dPlayers[killer_pnum].callsign,stat->Score[DSTAT_LEVEL])); - - DMFCBase->OnClientObjectKilled(obj,killer); -} - -void DisplayHUDScores(struct tHUDItem *hitem) -{ - if(!FirstFrame) - return; - - if(display_my_welcome) - { - DisplayWelcomeMessage(DMFCBase->GetPlayerNum()); - display_my_welcome = false; - } - - if(DisplayScoreScreen) - return; - - if(DMFCBase->IAmDedicatedServer()) - return; - - int old_font = DLLgrtext_GetFont(); - int start_y; - int i; - - DLLgrtext_SetFont((DMFCBase->GetGameFontTranslateArray())[HUD_FONT_INDEX]); - int height = DLLRenderHUDGetTextHeight("X") + 1; - int players_in_game = 0; - - for(i=0;iCheckPlayerNum(i) && !DMFCBase->IsPlayerDedicatedServer(i)){ - players_in_game++; - } - } - - if(players_in_game<=0) - return; - - players_in_game = min(players_in_game,8); - - start_y = (DMFCBase->GetGameWindowH()/2) - ((players_in_game*5)/2); - //determine coordinates to use here - //we'll use a virtual width of 85 pixels on a 640x480 screen - //so first determine the new width - int name_width = 85.0f * DMFCBase->GetHudAspectX(); - int name_x = DMFCBase->GetGameWindowW() - name_width - 10; - - int pnum,index = 0; - ubyte alpha = DMFCBase->ConvertHUDAlpha((ubyte)((DisplayScoreScreen)?128:255)); - - DLLgrtext_SetAlpha(alpha); - char name[64]; - - // Display only the players in the game - while( (players_in_game > 0) && (indexCheckPlayerNum(pnum) && !DMFCBase->IsPlayerDedicatedServer(pnum) ){ - //valid player - if(pnum==DMFCBase->GetPlayerNum()) - { - if(Highlight_bmp>BAD_BITMAP_HANDLE){ - //draw the highlite bar in the background - DLLrend_SetAlphaValue(alpha*0.50f); - DLLrend_SetZBufferState (0); - DLLrend_SetTextureType (TT_LINEAR); - DLLrend_SetLighting (LS_NONE); - DLLrend_SetAlphaType (AT_CONSTANT_TEXTURE); - - DLLrend_DrawScaledBitmap(name_x-2,start_y-2,DMFCBase->GetGameWindowW()-8,start_y+height+1,Highlight_bmp,0,0,1,1,1.0); - DLLrend_SetZBufferState (1); - } - } - - strcpy(name,dPlayers[pnum].callsign); - DMFCBase->ClipString(name_width,name,true); - - DLLgrtext_SetColor((DMFCBase->GetPlayerColors())[pnum]); - DLLgrtext_Printf(name_x,start_y,name); - - start_y += height; - players_in_game--; - } - index++; - } - - DLLgrtext_SetFont(old_font); -} - -void SaveStatsToFile(char *filename) -{ - /* - CFILE *file; - DLLOpenCFILE(&file,filename,"wt"); - if(!file){ - mprintf((0,"Unable to open output file\n")); - return; - } - - //write out game stats - #define BUFSIZE 150 - char buffer[BUFSIZE]; - char tempbuffer[25]; - int sortedslots[MAX_PLAYER_RECORDS]; - player_record *pr,*dpr; - tPInfoStat stat; - int count,length,p; - - count = 1; - - sprintf(buffer,TXT_SAVE_HEADER,Netgame->name,Current_mission->cur_level); - DLLcf_WriteString(file,buffer); - - sprintf(buffer,TXT_SAVE_HEADERB); - DLLcf_WriteString(file,buffer); - sprintf(buffer,"-----------------------------------------------------------------------------------"); - DLLcf_WriteString(file,buffer); - - - tPlayerStat *st; - for(int s=0;sstate!=STATE_EMPTY) { - - if(IsPlayerDedicatedServer(pr)) - continue; //skip dedicated server - - st = (tPlayerStat *)pr->user_info; - - memset(buffer,' ',BUFSIZE); - - sprintf(tempbuffer,"%d)",count); - memcpy(&buffer[0],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%s%s",(pr->state==STATE_INGAME)?"":"*",pr->callsign); - memcpy(&buffer[7],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d[%d]",st->Score[DSTAT_LEVEL],st->Score[DSTAT_OVERALL]); - memcpy(&buffer[36],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d[%d]",pr->dstats.deaths[DSTAT_LEVEL],pr->dstats.deaths[DSTAT_OVERALL]); - memcpy(&buffer[48],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d[%d]",pr->dstats.suicides[DSTAT_LEVEL],pr->dstats.suicides[DSTAT_OVERALL]); - memcpy(&buffer[60],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%s",GetTimeString(GetTimeInGame(p))); - memcpy(&buffer[71],tempbuffer,strlen(tempbuffer)); - - int pos; - pos = 71 + strlen(tempbuffer) + 1; - if(posGenerateStatFilename(filename,ROOTFILENAME,false); - SaveStatsToFile(filename); -} - -void OnLevelEndSaveStatsToFile(void) -{ - char filename[256]; - DMFCBase->GenerateStatFilename(filename,ROOTFILENAME,true); - SaveStatsToFile(filename); -} - -void OnDisconnectSaveStatsToFile(void) -{ - char filename[256]; - DMFCBase->GenerateStatFilename(filename,ROOTFILENAME,false); - SaveStatsToFile(filename); -} - -void OnPrintScores(int level) -{ - /* - char buffer[256]; - char name[50]; - memset(buffer,' ',256); - - int t; - int pos[5]; - int len[5]; - pos[0] = 0; t = len[0] = 20; //give ample room for pilot name - pos[1] = pos[0] + t + 1; t = len[1] = strlen(TXT_KILLS_SHORT); - pos[2] = pos[1] + t + 1; t = len[2] = strlen(TXT_DEATHS_SHORT); - pos[3] = pos[2] + t + 1; t = len[3] = strlen(TXT_SUICIDES_SHORT); - pos[4] = pos[3] + t + 1; t = len[4] = strlen(TXT_PING); - - memcpy(&buffer[pos[0]],TXT_PILOT,strlen(TXT_PILOT)); - memcpy(&buffer[pos[1]],TXT_KILLS_SHORT,len[1]); - memcpy(&buffer[pos[2]],TXT_DEATHS_SHORT,len[2]); - memcpy(&buffer[pos[3]],TXT_SUICIDES_SHORT,len[3]); - memcpy(&buffer[pos[4]],TXT_PING,len[4]); - buffer[pos[4]+len[4]+1] = '\n'; - buffer[pos[4]+len[4]+2] = '\0'; - DPrintf(buffer); - - int slot; - player_record *pr; - int pcount; - - if(level<0 || level>=MAX_PLAYER_RECORDS) - pcount = MAX_PLAYER_RECORDS; - else - pcount = level; - - tPlayerStat *st; - - for(int i=0;istate!=STATE_EMPTY)){ - - if(IsPlayerDedicatedServer(pr)) - continue; //skip dedicated server - - st = (tPlayerStat *)pr->user_info; - - sprintf(name,"%s%s:",(pr->state==STATE_DISCONNECTED)?"*":"",pr->callsign); - name[19] = '\0'; - - memset(buffer,' ',256); - t = strlen(name); memcpy(&buffer[pos[0]],name,(tScore[DSTAT_LEVEL]); - t = strlen(name); memcpy(&buffer[pos[1]],name,(tdstats.deaths[DSTAT_LEVEL]); - t = strlen(name); memcpy(&buffer[pos[2]],name,(tdstats.suicides[DSTAT_LEVEL]); - t = strlen(name); memcpy(&buffer[pos[3]],name,(tstate==STATE_INGAME) - sprintf(name,"%.0f",NetPlayers[pr->pnum].ping_time*1000.0f); - else - strcpy(name,"---"); - t = strlen(name); memcpy(&buffer[pos[4]],name,(tGetGametime(); -} - -void OnPLRInterval(void) -{ - level_info *li = DMFCBase->GetLevelInfo(); - - int height = DLLgrfont_GetHeight((DMFCBase->GetGameFontTranslateArray())[BIG_FONT_INDEX]); - DLLgrtext_SetFont((DMFCBase->GetGameFontTranslateArray())[BIG_FONT_INDEX]); - - int y = 240; - - float ft,newtime; - newtime = DMFCBase->GetGametime(); - ft = newtime - PLRLasttime; - PLRLasttime = newtime; - PLRElapsedtime += ft; - - float alpha; - - if(PLRElapsedtime>5.0f) - { - alpha = 1.0f; - } - else - { - alpha = (5.0f - PLRElapsedtime)/5.0f; - } - - DLLrend_ClearScreen(GR_BLACK); - DLLgrtext_SetColor(GR_RGB(40,40,255)); - DLLgrtext_CenteredPrintf(0,y-height-1,TXT_LEVELCOMPLETE); - - if(li) - { - DLLgrtext_SetAlpha((ubyte)(alpha*255.0f)); - DLLgrtext_SetColor(GR_RGB(255,255,255)); - DLLgrtext_CenteredPrintf(0,y+1,li->name); - } - - DLLgrtext_Flush(); -} - -#ifdef MACINTOSH -#pragma export off -#endif diff --git a/coop/coop.h b/coop/coop.h deleted file mode 100644 index 5c229f6b..00000000 --- a/coop/coop.h +++ /dev/null @@ -1,168 +0,0 @@ -/* -* $Logfile: /DescentIII/Main/coop/coop.h $ -* $Revision: 1.1.1.1 $ -* $Date: 2003-08-26 03:56:42 $ -* $Author: kevinb $ -* -* Co-Op play -* -* $Log: not supported by cvs2svn $ - * - * 8 10/21/99 9:28p Jeff - * B.A. Macintosh code merge - * - * 7 3/22/99 5:51p Matt - * Removed some includes from one file and added some to other files, to - * reduce the amount of rebuilding when headers change. - * - * 6 3/19/99 12:54p Jeff - * base support for requesting the number of teams for a multiplayer game - * - * 5 3/17/99 12:23p Jeff - * converted DMFC to be COM interface - * - * 4 2/08/99 12:46a Jeff - * updated - * - * 3 2/07/99 2:06a Jeff - * updated coop...fixed bug when getting countermeasure owner, if owner is - * observer - * - * 2 2/03/99 8:48p Josh - * Luke: Checked in for Josh (copied from Jeff) so he could work - * - * 1 2/03/99 8:47p Josh -* -* $NoKeywords: $ -*/ - - -#ifndef __DMFC_APP_H_ -#define __DMFC_APP_H_ - -#include "osiris_share.h" -#include "d3events.h" - -void OnHUDInterval(void); -void OnInterval(void); -void OnKeypress(int key); -void OnClientPlayerEntersGame(int player_num); -void OnServerObjectKilled(object *obj,object *killer); -void OnClientObjectKilled(object *obj,object *killer); -void OnPlayerConnect(int player_num); -void OnServerGameCreated(void); -void OnClientLevelStart(void); -void OnGameStateRequest(int player_num); -void SaveStatsToFile(char *filename); -void OnSaveStatsToFile(void); -void OnLevelEndSaveStatsToFile(void); -void OnDisconnectSaveStatsToFile(void); -void OnPrintScores(int level); -extern IDMFC *DMFCBase; - -// These next two function prototypes MUST appear in the extern "C" block if called -// from a CPP file. -#ifdef __cplusplus -extern "C" -{ -#endif - DLLEXPORT void DLLFUNCCALL DLLGameInit (int *api_func,ubyte *all_ok,int num_teams_to_use); - DLLEXPORT void DLLFUNCCALL DLLGameCall (int eventnum,dllinfo *data); - DLLEXPORT void DLLFUNCCALL DLLGameClose (); - DLLEXPORT void DLLFUNCCALL DLLGetGameInfo (tDLLOptions *options); - DLLEXPORT int DLLFUNCCALL GetGOScriptID(char *name,ubyte isdoor); - DLLEXPORT void DLLFUNCCALLPTR CreateInstance(int id); - DLLEXPORT void DLLFUNCCALL DestroyInstance(int id,void *ptr); - DLLEXPORT short DLLFUNCCALL CallInstanceEvent(int id,void *ptr,int event,tOSIRISEventInfo *data); - DLLEXPORT int DLLFUNCCALL SaveRestoreState( void *file_ptr, ubyte saving_state ); -#ifdef __cplusplus -} -#endif - -#ifdef MACINTOSH -#pragma export on -#endif - -// The main entry point where the game calls the dll -void DLLFUNCCALL DLLGameCall (int eventnum,dllinfo *data) -{ - if((eventnumGetLocalRole()!=LR_SERVER)){ - return; - } - - DMFCBase->TranslateEvent(eventnum,data); -} - -// GetGOScriptID -// Purpose: -// Given the name of the object (from it's pagename), this function will search through it's -// list of General Object Scripts for a script with a matching name (to see if there is a script -// for that type/id of object within this DLL). If a matching scriptname is found, a UNIQUE ID -// is to be returned back to Descent 3. This ID will be used from here on out for all future -// interaction with the DLL. Since doors are not part of the generic object's, it's possible -// for a door to have the same name as a generic object (OBJ_POWERUP, OBJ_BUILDING, OBJ_CLUTTER -// or OBJ_ROBOT), therefore, a 1 is passed in for isdoor if the given object name refers to a -// door, else it is a 0. The return value is the unique identifier, else -1 if the script -// does not exist in the DLL. -int DLLFUNCCALL GetGOScriptID(char *name,ubyte isdoor) -{ - return -1; -} - -// CreateInstance -// Purpose: -// Given an ID from a call to GetGOScriptID(), this function will create a new instance for that -// particular script (by allocating and initializing memory, etc.). A pointer to this instance -// is to be returned back to Descent 3. This pointer will be passed around, along with the ID -// for CallInstanceEvent() and DestroyInstance(). Return NULL if there was an error. -void DLLFUNCCALLPTR CreateInstance(int id) -{ - return NULL; -} - -// DestroyInstance -// Purpose: -// Given an ID, and a pointer to a particular instance of a script, this function will delete and -// destruct all information associated with that script, so it will no longer exist. -void DLLFUNCCALL DestroyInstance(int id,void *ptr) -{ -} - -// CallInstanceEvent -// Purpose: -// Given an ID, a pointer to a script instance, an event and a pointer to the struct of -// information about the event, this function will translate who this event belongs to and -// passes the event to that instance of the script to be handled. Return a combination of -// CONTINUE_CHAIN and CONTINUE_DEFAULT, to give instructions on what to do based on the -// event. CONTINUE_CHAIN means to continue through the chain of scripts (custom script, level -// script, mission script, and finally default script). If CONTINUE_CHAIN is not specified, -// than the chain is broken and those scripts of lower priority will never get the event. Return -// CONTINUE_DEFAULT in order to tell D3 if you want process the normal action that is built into -// the game for that event. This only pertains to certain events. If the chain continues -// after this script, than the CONTINUE_DEFAULT setting will be overridden by lower priority -// scripts return value. -short DLLFUNCCALL CallInstanceEvent(int id,void *ptr,int event,tOSIRISEventInfo *data) -{ - return CONTINUE_CHAIN|CONTINUE_DEFAULT; -} - -// SaveRestoreState -// Purpose: -// This function is called when Descent 3 is saving or restoring the game state. In this function -// you should save/restore any global data that you want preserved through load/save (which includes -// demos). You must be very careful with this function, corrupting the file (reading or writing too -// much or too little) may be hazardous to the game (possibly making it impossible to restore the -// state). It would be best to use version information to keep older versions of saved states still -// able to be used. IT IS VERY IMPORTANT WHEN SAVING THE STATE TO RETURN THE NUMBER OF _BYTES_ WROTE -// TO THE FILE. When restoring the data, the return value is ignored. saving_state is 1 when you should -// write data to the file_ptr, 0 when you should read in the data. -int DLLFUNCCALL SaveRestoreState( void *file_ptr, ubyte saving_state ) -{ - return 0; -} - -#ifdef MACINTOSH -#pragma export off -#endif - -#endif diff --git a/coop/coopstr.h b/coop/coopstr.h deleted file mode 100644 index 2c14b641..00000000 --- a/coop/coopstr.h +++ /dev/null @@ -1,23 +0,0 @@ -//Defines for indexes into the string table for in-code strings - -#ifndef __STRING_TABLE____ -#define __STRING_TABLE____ - -#define TXT(index) GetStringFromTable(index) - -//Returns a pointer to the string at the index location from the string table -//if it is a bad index given, then the pointer to the error string "ERROR MISSING STRING" is given - -char *GetStringFromTable(int index); - -#define TXT_COOP TXT(0) //"Coop" -#define TXT_STATGAMENAME TXT(1) //"Co-op Descent 3" -#define TXT_PILOT TXT(2) //"Pilot" -#define TXT_KILLS TXT(3) //"Kills" -#define TXT_DEATHS TXT(4) //"Deaths" -#define TXT_SUICIDES TXT(5) //"Suicides" -#define TXT_PING TXT(6) //"Ping" -#define TXT_WELCOME TXT(7) //"Welcome to the Co-Op Game %s" -#define TXT_JOINED TXT(8) //"%s has joined the game" -#define TXT_LEVELCOMPLETE TXT(9) //"Level Completed!" -#endif diff --git a/ctf/CTFstr.h b/ctf/CTFstr.h deleted file mode 100644 index ac49c5a0..00000000 --- a/ctf/CTFstr.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef __CTF_STR_H_ -#define __CTF_STR_H_ - -#define TXT(d) GetString(d) - -#define TXT_DEATH1 TXT(0) //"%s got blasted by %s" -#define TXT_DEATH2 TXT(1) //"%s knows %s is his god" -#define TXT_DEATH3 TXT(2) //"%s sucks %s's milk" -#define TXT_DEATH4 TXT(3) //"%s realizes %s's power" -#define TXT_DEATH5 TXT(4) //"%s got killed by %s" -#define TXT_DEATH6 TXT(5) //"%s begs for %s's mercy" -#define TXT_DEATH7 TXT(6) //"%s realizes %s is a better player" -#define TXT_DEATH8 TXT(7) //"%s was no match for %s" -#define TXT_DEATH9 TXT(8) //"%s wishes he was as good as %s" -#define TXT_DEATH10 TXT(9) //"%s got messed up by %s" -#define TXT_SUICIDE1 TXT(10) //"%s blasts himself" -#define TXT_SUICIDE2 TXT(11) //"%s Bursts his own bubble" -#define TXT_SUICIDE3 TXT(12) //"%s doesn't know his own strength" -#define TXT_SUICIDE4 TXT(13) //"No prize for %s" -#define TXT_SUICIDE5 TXT(14) //"%s doesn't wish to live anymore" -#define TXT_SUICIDE6 TXT(15) //"%s SUCKS!" -#define TXT_TEAMSCORE TXT(16) //"%s Team Scores %d Points [%d]" -#define TXT_PICKUPFLAGSPEW TXT(17) //"%s (%s) finds the %s Flag among some debris!" -#define TXT_PICKUPFLAG TXT(18) //"%s (%s) picks up the %s flag" -#define TXT_STATS TXT(19) //"Stats" -#define TXT_TEAMSCOREFORM TXT(20) //"%s Team %d[%d]" -#define TXT_TEAMFORM TXT(21) //"%s Team" -#define TXT_WELCOME TXT(22) //"Welcome to Capture The Flag %s!" -#define TXT_JOINED TXT(23) //"%s has joined CTF" -#define TXT_PILOT TXT(24) //"Pilot" -#define TXT_KILLS TXT(25) //"Kills" -#define TXT_DEATHS TXT(26) //"Deaths" -#define TXT_SUICIDES TXT(27) //"Suicides" -#define TXT_POINTS TXT(28) //"Points" -#define TXT_CTF TXT(29) //"Capture The Flag" -#define TXT_PING TXT(30) //"Ping" -#define TXT_HATTRICK TXT(31) //"%s has achieved a Hat Trick!!!" -#define TXT_HATTRICKFIRST TXT(32) //"%s is the first to get a Hat Trick!!!" -#define TXT_CAPTURE TXT(33) //"%s (%s) captures the %s Flag!" -#define TXT_CAPTURETWO TXT(34) //"%s (%s) captures the %s and %s Flags!" -#define TXT_CAPTURETHREE TXT(35) //"%s (%s) captures the %s, %s and %s Flags!" -#define TXT_RETURN TXT(36) //"%s (%s) returns the %s Flag!" -#define TXT_STAT_HEADING TXT(37) //"Capture The Flag\r\nGame: %s\r\nLevel: %d\r\n" -#define TXT_STAT_HEADINGA TXT(38) //"Rank Team Name Score Kills Deaths Suicides Time In Game" -#define TXT_STAT_HEADINGB TXT(39) //"\r\nIndividual Stats\r\n" -#define TXT_STAT_TIG TXT(40) //"Total Time In Game: %s" -#define TXT_STAT_HEADINGC TXT(41) //"Callsign: Kills: Deaths:" -#define TXT_STAT_SAVED TXT(42) //"Stats saved to file" -#define TXT_KILLS_SHORT TXT(43) //"K" -#define TXT_DEATHS_SHORT TXT(44) //"D" -#define TXT_SUICIDES_SHORT TXT(45) //"S" - -#endif \ No newline at end of file diff --git a/ctf/Makefile b/ctf/Makefile deleted file mode 100644 index 05c5efd8..00000000 --- a/ctf/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -include ../../default.mak - -OBJS = ctf.o -REFS = ctf.cpp -LIBNAME = ../../netgames/ctf.d3m - -CDLFLAGS = $(CFLAGS) -fPIC -LDLFLAGS = -shared -ldl - -all: depall $(OBJS) - gcc $(LDLFLAGS) -o $(LIBNAME) $(OBJS) /usr/lib/dmfc.so - -depall: - $(CC) -E -M $(CFLAGS) $(DEFINES) $(REFS) > .depend - -clean: - rm -f $(OBJS) *~ $(LIBNAME) core - -%.o: %.cpp - $(CC) $(CDLFLAGS) $(DEFINES) -c $< -o $@ - -ifeq (.depend,$(wildcard .depend)) -include .depend -endif diff --git a/ctf/ctf.cpp b/ctf/ctf.cpp deleted file mode 100644 index 03efe66a..00000000 --- a/ctf/ctf.cpp +++ /dev/null @@ -1,2834 +0,0 @@ -/* -* $Logfile: /DescentIII/Main/ctf/ctf.cpp $ -* $Revision: 1.1.1.1 $ -* $Date: 2003-08-26 03:56:47 $ -* $Author: kevinb $ -* -* -* -* $Log: not supported by cvs2svn $ - * - * 140 10/03/01 1:05p Matt - * Made team_name buffer large enough to hold the team number *plus* the - * number of players on the team. - * - * 139 9/24/01 2:28p Matt - * Allowed room for longer team name on results screen. - * - * 138 9/20/01 12:58p Matt - * Added a team member list to the stats file. - * - * 137 10/21/99 9:27p Jeff - * B.A. Macintosh code merge - * - * 136 9/03/99 5:30p Jeff - * use the flag's roomnumber instead of the player's roomnum when checking - * for a score (in case of a really thin room that the flag is in) - * - * 135 8/17/99 5:53p Jeff - * track ranks on PXO - * - * 134 7/15/99 1:17a Jeff - * fixed up $scores - * - * 133 7/13/99 12:10p Jeff - * added some specific text taunt token decoding - * - * 132 7/12/99 2:27p Jeff - * fixed PLR to only display the team label for the disconnected list if - * there are people in the list - * - * 131 7/11/99 6:54p Jeff - * fixed PLR so it doesn't go off the screen on long lists and active - * players in the game are shown first - * - * 130 6/10/99 5:21p Jeff - * fixed crash in french version, due to local array being to small - * - * 129 5/26/99 4:38a Jeff - * fixed ctf bad scoring bugs - * - * 128 5/23/99 3:04a Jason - * fixed bug with player rankings not being updated correctly - * - * 127 5/20/99 7:54p 3dsmax - * changed number of attach points - * - * 126 5/12/99 11:04p Jeff - * dmfc and multiplayer games now have endian friendly packets (*whew*) - * - * 125 5/12/99 11:28a Jeff - * added sourcesafe comment block -* -* $NoKeywords: $ -*/ - - - -#include "gamedll_header.h" -#include - -#include "idmfc.h" -#include "ctf.h" -#include "CTFstr.h" - -IDMFC *DMFCBase; -IDmfcStats *dstat; - -object *dObjects; -player *dPlayers; -room *dRooms; -netplayer *dNetPlayers; - -#define SPID_GAMESTATE 0x01 -#define SPID_ADDDELFLAG 0x02 -#define SPID_COLLIDE 0x03 - -//Inventory flags -#define FLAGMASK_REDTEAM 0x01 -#define FLAGMASK_BLUETEAM 0x02 -#define FLAGMASK_GREENTEAM 0x04 -#define FLAGMASK_YELLOWTEAM 0x08 - -//athome masks -#define REDAH 0x001 -#define BLUEAH 0x002 -#define GREENAH 0x004 -#define YELLOWAH 0x008 - -#define FLAG_TIMEOUT_VALUE 120 -//Sound name defines -#define SOUND_PICKUPFLAG_OWNTEAM "CTFPickupFlag1" -#define SOUND_PICKUPFLAG_OTHERTEAM "CTFPickupFlag1" -#define SOUND_SCORE_OWNTEAM "CTFScore1" -#define SOUND_SCORE_OTHERTEAM "CTFScore1" -#define SOUND_LOSEFLAG_OWNTEAM "CTFLostFlag1" -#define SOUND_LOSEFLAG_OTHERTEAM "CTFLostFlag1" -#define SOUND_FLAGRETURNED_OWNTEAM "CTFReturnedFlag1" -#define SOUND_FLAGRETURNED_OTHERTEAM "CTFReturnedFlag1" -#define SOUND_HATTRICK_FIRST "CTFHatTrick" -#define SOUND_HATTRICK_REGULAR "CTFHatTrick" -/* -$$TABLE_SOUND "CTFPickupFlag1" -$$TABLE_SOUND "CTFPickupFlag1" -$$TABLE_SOUND "CTFScore1" -$$TABLE_SOUND "CTFScore1" -$$TABLE_SOUND "CTFLostFlag1" -$$TABLE_SOUND "CTFLostFlag1" -$$TABLE_SOUND "CTFReturnedFlag1" -$$TABLE_SOUND "CTFReturnedFlag1" -$$TABLE_SOUND "CTFHatTrick" -$$TABLE_SOUND "CTFHatTrick" -*/ -int snd_return_ownteam = -1; -int snd_return_otherteam = -1; -int snd_pickedup_otherteam = -1; -int snd_pickedup_ownteam = -1; -int snd_score_ownteam = -1; -int snd_score_otherteam = -1; -int snd_lose_ownteam = -1; -int snd_lose_otherteam = -1; -int snd_hattrick_first = -1; -int snd_hattrick_reg = -1; - -typedef struct -{ - int Score[2]; -}tPlayerStat; //Overall scores (throughout the game) -int pack_pstat(tPlayerStat *user_info,ubyte *data) -{ - int count = 0; - MultiAddInt(user_info->Score[0],data,&count); - MultiAddInt(user_info->Score[1],data,&count); - return count; -} - -int unpack_pstat(tPlayerStat *user_info,ubyte *data) -{ - int count = 0; - user_info->Score[0] = MultiGetInt(data,&count); - user_info->Score[1] = MultiGetInt(data,&count); - return count; -} - -int SortedPlayers[MAX_PLAYER_RECORDS]; //sorted player nums -int SortedPLRPlayers[DLLMAX_TEAMS][MAX_PLAYER_RECORDS]; - -int TeamScores[DLLMAX_TEAMS]; //teams scores -int OverallTeamScores[DLLMAX_TEAMS]; //overall scores per team -int SortedTeams[DLLMAX_TEAMS]; //sorted team scores -int Highlight_bmp = -1; -bool DisplayScoreScreen; -bool Someone_has_hattrick = false; //this is false if no one has had a hattrick this level -bool First_game_frame = false; - -int FlagIDs[DLLMAX_TEAMS]; //Flag Object ID's -int AFlagIDs[DLLMAX_TEAMS]; //Attached Flag Object ID's -int GoalRooms[DLLMAX_TEAMS]; //Goal Rooms for Teams -int FlagBmp[DLLMAX_TEAMS]; //Flag Bitmap handles -int FlagAHBmp[DLLMAX_TEAMS]; //Flag At Home Bitmap handles -int DimFlagAHBmp[DLLMAX_TEAMS]; //Dimmed versions of the Flag At Home Bitmaps -bool FlagAtHome[DLLMAX_TEAMS]; //Flag At Home bools -int HasFlag[DLLMAX_TEAMS]; //List of Playernums of who has what flag, -1 if no one does -bool DisplayFlagBlink=true,DisplayScoreBlink=true; -int WhoJustFlagged=-1,WhoJustFlaggedTimer=-1; -int WhoJustScored=-1,WhoJustScoredTimer=-1; -int CTFNumOfTeams = 2; -int ChildFlags[DLLMAX_TEAMS]; //Object handles of attached flags as a player has em - -float Flag_timeout_timers[DLLMAX_TEAMS]; -bool display_my_welcome = false; - -void OnTimerScoreKill(void); //timer callback: when a score flash timer ends -void OnTimerScore(void); //timer callback: on a score flash interval -void OnTimer(void); //timer callback: when a flag taken flash timer ends -void OnTimerKill(void); //timer callback: on a flag taken flash interval -void DisplayWelcomeMessage(int player_num); //displays a welcome message to the player when he joins -void SortTeamScores(int *sortedindex,int *scores); //sorts an array of team scores, filling in the sorted index numbers -void DisplayHUDScores(struct tHUDItem *hitem); //callback when the HUD info is to be drawn -void ReceiveGameState(ubyte *data); //callback when a gamestate packet is received from the server -void SendGameState(int playernum); //called when the server is to send gamestate packet to a client -void SetColoredBalls(int playernum,bool reset=false);//sets the colored balls around a player (determined by what is in their inventory) -void ChangeNumberOfTeams(int newsize); //called when the number of teams in the game is changed or to be changed -void DoFlagReturnedHome(int team); //called to handle any events when a flag is returned home for a team -void DoLoseFlag(int team); //called to handle any events when a team loses their flag -void TellClientsToAddorDelFlag(int pnum,int team,int objnum,bool add); -void ServerIsTellingMeToAddorDelAFlag(ubyte *data); -void OnGetTokenString(char *src,char *dest,int dest_size); -// returns the number of flags a player has, 0 if none, or an invalid pnum -int GetFlagCountForPlayer(int pnum); -// returns the mask of which flags this player currently has -ubyte GetFlagMaskForPlayer(int pnum); -// adds a flag to a player, as a precaution, it will go through all the players and makes sure that no one -// has the flag that is being added. If they are adding the flag, than remove that flag from whoever we thought had it -// it will return false if it had to remove a flag from a player -bool GivePlayerFlag(int pnum,ubyte team); -//this function takes a flag away from the player, useful for when he scores, spews, disconnects, or observer modes -void LoseFlagForPlayer(int pnum,ubyte team,bool remove_from_inven=true); - -/////////////////////////////////////////////// -//localization info/functions -char **StringTable; -int StringTableSize = 0; -char *_ErrorString = "Missing String"; -char *GetString(int d){if( (d<0) || (d>=StringTableSize) ) return _ErrorString; else return StringTable[d];} -void SaveStatsToFile(char *filename); - -#ifdef MACINTOSH -#pragma export on -#endif - -// This function gets called by the game when it wants to learn some info about the game -void DLLFUNCCALL DLLGetGameInfo (tDLLOptions *options) -{ - options->flags = DOF_MAXTEAMS|DOF_MINTEAMS; - options->max_teams = 4; - options->min_teams = 2; - strcpy(options->game_name,TXT_CTF); - strcpy(options->requirements,"MINGOALS2,GOALPERTEAM"); -} - -void DetermineScore(int precord_num,int column_num,char *buffer,int buffer_size) -{ - player_record *pr = DMFCBase->GetPlayerRecord(precord_num); - if(!pr || pr->state==STATE_EMPTY){ - buffer[0] = '\0'; - return; - } - - tPlayerStat *stat = (tPlayerStat *)pr->user_info; - sprintf(buffer,"%d",(stat)?stat->Score[DSTAT_LEVEL]:0); -} - -void TeamScoreCallback(int team,char *buffer,int buffer_size) -{ - ASSERT(team>=0 && teamGetPlayerRecord(precord_num); - int flagcount,flagmask; - - if(pr && pr->state==STATE_INGAME ){ - - flagcount = GetFlagCountForPlayer(pr->pnum); - - if(!flagcount) - return; - - flagmask = GetFlagMaskForPlayer(pr->pnum); - - //Display the flags that this player has - x = x + w - (11*flagcount); - for(int q=0;q>1; - } - } -} - - -/////////////////////////////////////////////// -// Initializes the game function pointers -void DLLFUNCCALL DLLGameInit(int *api_func,ubyte *all_ok,int num_teams_to_use) -{ - *all_ok = 1; - DMFCBase = CreateDMFC(); - if(!DMFCBase) - { - *all_ok = 0; - return; - } - - dstat = CreateDmfcStats(); - if(!dstat) - { - *all_ok = 0; - return; - } - - DMFCBase->LoadFunctions(api_func); - - // Setup event handlers - DMFCBase->Set_OnInterval(OnInterval); - DMFCBase->Set_OnHUDInterval(OnHUDInterval); - DMFCBase->Set_OnKeypress(OnKeypress); - DMFCBase->Set_OnServerGameCreated(OnServerGameCreated); - DMFCBase->Set_OnClientLevelStart(OnClientLevelStart); - DMFCBase->Set_OnClientLevelEnd(OnClientLevelEnd); - DMFCBase->Set_OnGameStateRequest(OnGameStateRequest); - DMFCBase->Set_OnPlayerConnect(OnPlayerConnect); - DMFCBase->Set_OnClientPlayerKilled(OnClientPlayerKilled); - DMFCBase->Set_OnServerCollide(OnServerCollide); - //DMFCBase->Set_OnClientCollide(OnClientCollide); - DMFCBase->Set_OnPLRInterval(OnPLRInterval); - DMFCBase->Set_OnPLRInit(OnPLRInit); - DMFCBase->Set_OnCanChangeTeam(OnCanChangeTeam); - DMFCBase->Set_OnSaveStatsToFile(OnSaveStatsToFile); - DMFCBase->Set_OnLevelEndSaveStatsToFile(OnLevelEndSaveStatsToFile); - DMFCBase->Set_OnDisconnectSaveStatsToFile(OnDisconnectSaveStatsToFile); - DMFCBase->Set_OnPrintScores(OnPrintScores); - DMFCBase->Set_OnPlayerEntersObserver(OnPlayerEntersObserver); - DMFCBase->Set_OnClientPlayerDisconnect(OnClientPlayerDisconnect); - DMFCBase->Set_OnPlayerChangeTeam(OnPlayerChangeTeam); - DMFCBase->Set_OnGetTokenString(OnGetTokenString); - - // Setup arrays for easier to read code - dObjects = DMFCBase->GetObjects(); - dPlayers = DMFCBase->GetPlayers(); - dRooms = DMFCBase->GetRooms(); - dNetPlayers = DMFCBase->GetNetPlayers(); - - netgame_info *Netgame = DMFCBase->GetNetgameInfo(); - Netgame->flags |= (NF_TRACK_RANK); - - CTFNumOfTeams = num_teams_to_use; - - DMFCBase->GameInit(CTFNumOfTeams); - DLLCreateStringTable("CTF.str",&StringTable,&StringTableSize); - DLLmprintf((0,"%d strings loaded from string table\n",StringTableSize)); - if(!StringTableSize){ - *all_ok = 0; - return; - } - - ChangeNumberOfTeams(CTFNumOfTeams); - - //add the death and suicide messages - DMFCBase->AddDeathMessage(TXT_DEATH1,true); - DMFCBase->AddDeathMessage(TXT_DEATH2,true); - DMFCBase->AddDeathMessage(TXT_DEATH3,false); - DMFCBase->AddDeathMessage(TXT_DEATH4,false); - DMFCBase->AddDeathMessage(TXT_DEATH5,true); - DMFCBase->AddDeathMessage(TXT_DEATH6,true); - DMFCBase->AddDeathMessage(TXT_DEATH7,false); - DMFCBase->AddDeathMessage(TXT_DEATH8,true); - DMFCBase->AddDeathMessage(TXT_DEATH9,true); - DMFCBase->AddDeathMessage(TXT_DEATH10,true); - - DMFCBase->AddSuicideMessage(TXT_SUICIDE1); - DMFCBase->AddSuicideMessage(TXT_SUICIDE2); - DMFCBase->AddSuicideMessage(TXT_SUICIDE3); - DMFCBase->AddSuicideMessage(TXT_SUICIDE4); - DMFCBase->AddSuicideMessage(TXT_SUICIDE5); - DMFCBase->AddSuicideMessage(TXT_SUICIDE6); - - //setup the Playerstats struct so DMFC can handle it automatically when a new player enters the game - DMFCBase->SetupPlayerRecord(sizeof(tPlayerStat),(int (*)(void *,ubyte *))pack_pstat,(int (*)(void *,ubyte *))unpack_pstat); - - DMFCBase->AddHUDItemCallback(HI_TEXT,DisplayHUDScores); - - DMFCBase->RegisterPacketReceiver(SPID_GAMESTATE,ReceiveGameState); - DMFCBase->RegisterPacketReceiver(SPID_ADDDELFLAG,ServerIsTellingMeToAddorDelAFlag); - DMFCBase->RegisterPacketReceiver(SPID_COLLIDE,OnClientCollide); - - //Load all the bitmaps - FlagBmp[RED_TEAM] = DLLbm_AllocLoadFileBitmap("RedFlagIcon.ogf",0); - FlagBmp[BLUE_TEAM] = DLLbm_AllocLoadFileBitmap("BlueFlagIcon.ogf",0); - FlagBmp[GREEN_TEAM] = DLLbm_AllocLoadFileBitmap("GreenFlagIcon.ogf",0); - FlagBmp[YELLOW_TEAM] = DLLbm_AllocLoadFileBitmap("YellowFlagIcon.ogf",0); - //athome bitmaps - FlagAHBmp[RED_TEAM] = DLLbm_AllocLoadFileBitmap("RedFlagIcon.ogf",0); - FlagAHBmp[BLUE_TEAM] = DLLbm_AllocLoadFileBitmap("BlueFlagIcon.ogf",0); - FlagAHBmp[GREEN_TEAM] = DLLbm_AllocLoadFileBitmap("GreenFlagIcon.ogf",0); - FlagAHBmp[YELLOW_TEAM] = DLLbm_AllocLoadFileBitmap("YellowFlagIcon.ogf",0); - DimFlagAHBmp[RED_TEAM] = DLLbm_AllocLoadFileBitmap("RedFlagIconDim.ogf",0); - DimFlagAHBmp[BLUE_TEAM] = DLLbm_AllocLoadFileBitmap("BlueFlagIconDim.ogf",0); - DimFlagAHBmp[GREEN_TEAM] = DLLbm_AllocLoadFileBitmap("GreenFlagIconDim.ogf",0); - DimFlagAHBmp[YELLOW_TEAM] = DLLbm_AllocLoadFileBitmap("YellowFlagIconDim.ogf",0); - //fill in the IDs - - - FlagIDs[RED_TEAM] = DLLFindObjectIDName("FlagRed"); - FlagIDs[BLUE_TEAM] = DLLFindObjectIDName("Flagblue"); - FlagIDs[GREEN_TEAM] = DLLFindObjectIDName("FlagGreen"); - FlagIDs[YELLOW_TEAM] = DLLFindObjectIDName("FlagYellow"); - AFlagIDs[RED_TEAM] = DLLFindObjectIDName("ShipRedFlag"); - AFlagIDs[BLUE_TEAM] = DLLFindObjectIDName("ShipBlueFlag"); - AFlagIDs[GREEN_TEAM] = DLLFindObjectIDName("ShipGreenFlag"); - AFlagIDs[YELLOW_TEAM] = DLLFindObjectIDName("ShipYellowFlag"); - - //give initial values for the at home so they're set - FlagAtHome[RED_TEAM] = FlagAtHome[BLUE_TEAM] = - FlagAtHome[GREEN_TEAM] = FlagAtHome[YELLOW_TEAM] = false; - - //make sure all was init ok - for(int i=0;iBAD_BITMAP_HANDLE){ - ushort *data = DLLbm_data(Highlight_bmp,0); - if(!data){ - //bail on out of here - *all_ok = 0; - return; - } - for(int x=0;x<32*32;x++){ - data[x] = GR_RGB16(50,50,50)|OPAQUE_FLAG; - } - } - - //Load in and touch all the sounds so they're ready to rock - snd_score_ownteam = DLLFindSoundName(IGNORE_TABLE(SOUND_SCORE_OWNTEAM)); - if(snd_score_ownteam!=-1) - DLLTouchSound(snd_score_ownteam); - snd_score_otherteam = DLLFindSoundName(IGNORE_TABLE(SOUND_SCORE_OTHERTEAM)); - if(snd_score_otherteam!=-1) - DLLTouchSound(snd_score_otherteam); - snd_pickedup_otherteam =DLLFindSoundName(IGNORE_TABLE(SOUND_PICKUPFLAG_OWNTEAM)); - if(snd_pickedup_otherteam!=-1) - DLLTouchSound(snd_pickedup_otherteam); - snd_pickedup_ownteam =DLLFindSoundName(IGNORE_TABLE(SOUND_PICKUPFLAG_OTHERTEAM)); - if(snd_pickedup_ownteam!=-1) - DLLTouchSound(snd_pickedup_ownteam); - snd_return_ownteam = DLLFindSoundName(IGNORE_TABLE(SOUND_FLAGRETURNED_OWNTEAM)); - if(snd_return_ownteam!=-1) - DLLTouchSound(snd_return_ownteam); - snd_return_otherteam = DLLFindSoundName(IGNORE_TABLE(SOUND_FLAGRETURNED_OTHERTEAM)); - if(snd_return_otherteam!=-1) - DLLTouchSound(snd_return_otherteam); - snd_lose_ownteam = DLLFindSoundName(IGNORE_TABLE(SOUND_LOSEFLAG_OWNTEAM)); - if(snd_lose_ownteam!=-1) - DLLTouchSound(snd_lose_ownteam); - snd_lose_otherteam = DLLFindSoundName(IGNORE_TABLE(SOUND_LOSEFLAG_OTHERTEAM)); - if(snd_lose_otherteam!=-1) - DLLTouchSound(snd_lose_otherteam); - snd_hattrick_first = DLLFindSoundName(IGNORE_TABLE(SOUND_HATTRICK_FIRST)); - if(snd_hattrick_first!=-1) - DLLTouchSound(snd_hattrick_first); - snd_hattrick_reg = DLLFindSoundName(IGNORE_TABLE(SOUND_HATTRICK_REGULAR)); - if(snd_hattrick_reg!=-1) - DLLTouchSound(snd_hattrick_reg); - - DisplayScoreScreen = false; - - - // Initialize the Stats Manager - // ---------------------------- - - tDmfcStatsInit tsi; - tDmfcStatsColumnInfo pl_col[7]; - char gname[32]; - strcpy(gname,TXT_CTF); - - tsi.flags = DSIF_SHOW_PIC|DSIF_SHOW_OBSERVERICON|DSIF_SEPERATE_BY_TEAM; - tsi.cColumnCountDetailed = 0; - tsi.cColumnCountPlayerList = 7; - tsi.clbDetailedColumnBMP = NULL; - tsi.clbDetailedColumn = NULL; - tsi.clbPlayerColumn = DetermineScore; - tsi.clbPlayerColumnBMP = ShowStatBitmap; - tsi.DetailedColumns = NULL; - tsi.GameName = gname; - tsi.MaxNumberDisplayed = NULL; - tsi.PlayerListColumns = pl_col; - tsi.SortedPlayerRecords = SortedPlayers; - tsi.clTeamLine = TeamScoreCallback; - - pl_col[0].color_type = DSCOLOR_TEAM; - pl_col[0].title[0] = '\0'; - pl_col[0].type = DSCOL_BMP; - pl_col[0].width = 33; - - pl_col[1].color_type = DSCOLOR_TEAM; - strcpy(pl_col[1].title,TXT_PILOT); - pl_col[1].type = DSCOL_PILOT_NAME; - pl_col[1].width = 120; - - pl_col[2].color_type = DSCOLOR_TEAM; - strcpy(pl_col[2].title,TXT_POINTS); - pl_col[2].type = DSCOL_CUSTOM; - pl_col[2].width = 52; - - pl_col[3].color_type = DSCOLOR_TEAM; - strcpy(pl_col[3].title,TXT_KILLS_SHORT); - pl_col[3].type = DSCOL_KILLS_LEVEL; - pl_col[3].width = 47; - - pl_col[4].color_type = DSCOLOR_TEAM; - strcpy(pl_col[4].title,TXT_DEATHS_SHORT); - pl_col[4].type = DSCOL_DEATHS_LEVEL; - pl_col[4].width = 47; - - pl_col[5].color_type = DSCOLOR_TEAM; - strcpy(pl_col[5].title,TXT_SUICIDES_SHORT); - pl_col[5].type = DSCOL_SUICIDES_LEVEL; - pl_col[5].width = 47; - - pl_col[6].color_type = DSCOLOR_TEAM; - strcpy(pl_col[6].title,TXT_PING); - pl_col[6].type = DSCOL_PING; - pl_col[6].width = 40; - - dstat->Initialize(&tsi); -} -// Called when the DLL is shutdown -void DLLFUNCCALL DLLGameClose () -{ - //@@SaveConfig(); - //@@DMFCBase->CFGClose(); - - //Free all the bitmaps - DLLbm_FreeBitmap(FlagBmp[RED_TEAM]); - DLLbm_FreeBitmap(FlagBmp[BLUE_TEAM]); - DLLbm_FreeBitmap(FlagBmp[GREEN_TEAM]); - DLLbm_FreeBitmap(FlagBmp[YELLOW_TEAM]); - DLLbm_FreeBitmap(DimFlagAHBmp[RED_TEAM]); - DLLbm_FreeBitmap(DimFlagAHBmp[BLUE_TEAM]); - DLLbm_FreeBitmap(DimFlagAHBmp[GREEN_TEAM]); - DLLbm_FreeBitmap(DimFlagAHBmp[YELLOW_TEAM]); - DLLbm_FreeBitmap(FlagAHBmp[RED_TEAM]); - DLLbm_FreeBitmap(FlagAHBmp[BLUE_TEAM]); - DLLbm_FreeBitmap(FlagAHBmp[GREEN_TEAM]); - DLLbm_FreeBitmap(FlagAHBmp[YELLOW_TEAM]); - - if(Highlight_bmp>BAD_BITMAP_HANDLE) - DLLbm_FreeBitmap(Highlight_bmp); - - DLLDestroyStringTable(StringTable,StringTableSize); - - if(dstat) - { - dstat->DestroyPointer(); - dstat = NULL; - } - - if(DMFCBase) - { - DMFCBase->GameClose(); - DMFCBase->DestroyPointer(); - DMFCBase = NULL; - } -} - -///////////////////////////////////////////////////////////// -//DMFC Overrides - -//OnHUDInterval -void OnHUDInterval(void) -{ - dstat->DoFrame(); - - DMFCBase->DisplayOutrageLogo(); - - DMFCBase->OnHUDInterval(); -} - -//OnInterval -void OnInterval(void) -{ - DMFCBase->GetSortedPlayerSlots(SortedPlayers,MAX_PLAYER_RECORDS); - - SortTeamScores(SortedTeams,TeamScores); - - //Determine if a flag has timed out yet - for(int i=0;iGetGametime()>=Flag_timeout_timers[i]){ - //the timeout has expired, move home! - vector home_pos; - int home,objnum; - - Flag_timeout_timers[i] = 0; - FlagAtHome[i] = true; - HasFlag[i] = -1; - home = GoalRooms[i]; - objnum = -1; - - //find the flag objnum - for(int o=0;oGetLocalRole()==LR_SERVER){ - int flagid = FlagIDs[i]; - if( (flagid!=-1) && (home>=0) && (home<=DMFCBase->GetHighestRoomIndex()) && (!ROOMNUM_OUTSIDE(home)) && (dRooms[home].used) ){ - //Safe to create the flag - DLLComputeRoomCenter(&home_pos,&dRooms[home]); - objnum = DLLObjCreate(OBJ_POWERUP,flagid,home,&home_pos,NULL); - DLLMultiSendObject(&dObjects[objnum],0); - } - } - }else{ - if( (home>=0) && (home<=DMFCBase->GetHighestRoomIndex()) && (!ROOMNUM_OUTSIDE(home)) && (dRooms[home].used) ){ - DLLComputeRoomCenter(&home_pos,&dRooms[home]); - DLLObjSetPos(&dObjects[objnum],&home_pos,home,NULL,false); - } - } - } - } - } - - DMFCBase->OnInterval(); - - First_game_frame = true; -} - -//OnKeypress -// What it needs to do: -// 1) Test for F7 keypress -void OnKeypress(int key) -{ - dllinfo *Data; - Data = DMFCBase->GetDLLInfoCallData(); - - switch(key){ - case K_F7: - DisplayScoreScreen = !DisplayScoreScreen; - DMFCBase->EnableOnScreenMenu(false); - dstat->Enable(DisplayScoreScreen); - break; - case K_PAGEDOWN: - if(DisplayScoreScreen){ - dstat->ScrollDown(); - Data->iRet = 1; - } - break; - case K_PAGEUP: - if(DisplayScoreScreen){ - dstat->ScrollUp(); - Data->iRet = 1; - } - break; - case K_F6: - DisplayScoreScreen = false; - dstat->Enable(false); - break; - case K_ESC: - if(DisplayScoreScreen){ - dstat->Enable(false); - DisplayScoreScreen = false; - Data->iRet = 1; - } - break; - } - - DMFCBase->OnKeypress(key); -} - -//OnServerGameCreated -// What it needs to do: -// 1) Zero out all the stats for every player -// 2) Zero out team scores -// 3) Display welcome message to server -void OnServerGameCreated(void) -{ - DMFCBase->OnServerGameCreated(); - tPlayerStat *stat; - player_record *pr; - int i; - - for(i=0;iGetPlayerRecord(i); - if(pr){ - stat = (tPlayerStat *)pr->user_info; - if(stat){ - stat->Score[DSTAT_LEVEL] = 0; - stat->Score[DSTAT_OVERALL] = 0; - } - } - } - for(i=0;iOnClientLevelStart(); - - First_game_frame = false; - - for(i=0;iGetPlayerRecord(i); - if(pr){ - stat = (tPlayerStat *)pr->user_info; - if(stat){ - stat->Score[DSTAT_LEVEL] = 0; - } - } - } - for(i=0;iSetNumberOfTeams(CTFNumOfTeams); - DLLMultiPaintGoalRooms(NULL); - - //Bash the inventory since it doesn't get reset for the server - DLLInvReset(DMFCBase->GetPlayerNum()); - - //Display our welcome message - display_my_welcome = true; - - //If we are the server create the flags - if(DMFCBase->GetLocalRole()!=LR_SERVER){ - //Get the game state - DMFCBase->RequestGameState(); - return; - } - - vector vpos; - int objnum; - int flagid,goalroom; - - for(i=0;i=0) && (goalroom<=DMFCBase->GetHighestRoomIndex()) && (!ROOMNUM_OUTSIDE(goalroom)) && (dRooms[goalroom].used) ){ - //Safe to create the flag - DLLmprintf((0,"Creating %s Flag\n",DMFCBase->GetTeamString(i))); - DLLComputeRoomCenter(&vpos,&dRooms[goalroom]); - objnum = DLLObjCreate(OBJ_POWERUP,flagid,goalroom,&vpos,NULL); - DLLMultiSendObject(&dObjects[objnum],0); - } - } -} - -//OnServerCollide -// What it needs to do: -// 1) See if the player has collided with a flag, if so pass to clients -void OnServerCollide(object *me_obj,object *it_obj) -{ - //see if we need to send this event to the clients - //only if me==player it==flag powerup - if(!me_obj || !it_obj) - return; - if( (me_obj->type==OBJ_PLAYER||me_obj->type==OBJ_GHOST) && (it_obj->type==OBJ_POWERUP) ) - if( (it_obj->id==FlagIDs[RED_TEAM]) || - (it_obj->id==FlagIDs[BLUE_TEAM]) || - (it_obj->id==FlagIDs[GREEN_TEAM]) || - (it_obj->id==FlagIDs[YELLOW_TEAM]) ){ - - //Start a packet for the collide - ubyte data[MAX_GAME_DATA_SIZE]; - int count = 0; - DMFCBase->StartPacket(data,SPID_COLLIDE,&count); - int start = count; - - //we need me, it and me roomnum - MultiAddUshort((me_obj-dObjects),data,&count); - MultiAddUshort((it_obj-dObjects),data,&count); - MultiAddInt(it_obj->roomnum,data,&count); - - DMFCBase->SendPacket(data,count,SP_ALL); - OnClientCollide(&data[start]); - } -} - -//OnClientCollide -// What it needs to do: -// 1) See if Player collided with own flag -// 1.1) Check to see if in home goal -// 1.1.1) Reset colored balls -// 1.1.2) Remove all the flags from the inventory, send them back to their home goal -// 1.1.3) Add scores -// 1.1.4) Print out score -// 1.1.5) Do Kill Goal check -// 1,2) Move home flag to center of base -// 2) else collide with another team's flag -// 2.1) Add flag to inventory -// 2.2) Set rotating balls -// 2.3) Print out message -void OnClientCollide(ubyte *data) -{ - object *me_obj,*it_obj; - int me_roomnum; - int count = 0; - int me_serv_objnum,it_serv_objnum,me_client_objnum,it_client_objnum; - - me_serv_objnum = MultiGetUshort(data,&count); - it_serv_objnum = MultiGetUshort(data,&count); - me_roomnum = MultiGetInt(data,&count); - - me_client_objnum = DMFCBase->ConvertServerToLocalObjnum(me_serv_objnum); - it_client_objnum = DMFCBase->ConvertServerToLocalObjnum(it_serv_objnum); - - if(me_client_objnum==-1 || it_client_objnum==-1) - { - Int3(); - return; - } - - me_obj = &dObjects[me_client_objnum]; - it_obj = &dObjects[it_client_objnum]; - - // now process the collide - - int fteam=-1; //flags team - int pnum = me_obj->id; //player number - int pteam=DMFCBase->GetPlayerTeam(pnum); //player's team - int i; - bool play_return_home_msg = false; - - for(i=0;iid==FlagIDs[i]) - fteam = i; - } - - if(fteam==-1){ - return; //something wrong, as none of the IDs are one of the flag's IDs - } - - // Reset the timer for this flag since it's guaranteed someone owns it now - // or it has been sent home. - Flag_timeout_timers[fteam] = 0; - - //Did player collide with his own team's flag? - if(fteam==pteam) - { - short flag_count = 0; - vector fpos; - int groom; - int flagcount; - int flagmask; - - bool captured_flags[DLLMAX_TEAMS]; - for(int i=0;i=0) && (groom<=DMFCBase->GetHighestRoomIndex()) && (!ROOMNUM_OUTSIDE(groom)) && (dRooms[groom].used)){ - //the room is valid, so move it back to home - - LoseFlagForPlayer(pnum,i); - - if(DMFCBase->GetLocalRole()==LR_SERVER){ - //if we are the server create the object and send it on it's way to the player's - DLLComputeRoomCenter(&fpos,&dRooms[groom]); - int objnum = DLLObjCreate(OBJ_POWERUP,FlagIDs[i],groom,&fpos,NULL); - DLLMultiSendObject(&dObjects[objnum],1); - }//end server create - }//end room ok - - //set it's at home flag - FlagAtHome[i] = true; - }//end flag check - //rotate the flagmask over one to check for the next flag - flagmask = flagmask >> 1; - }//end for loop - - //remove any rotating balls - SetColoredBalls(pnum,true); - - //Now handle any scoring - int score = 0; - switch(flagcount) - { - case 0: - break; - case 1: - score = 1; - break; - case 2: - score = 3; - break; - case 3: - score = 9; - break; - } - - //print out the message and add to the scores - - if(score) - { - tPlayerStat *stat = (tPlayerStat *)DMFCBase->GetPlayerRecordData(pnum); - if(stat){ - stat->Score[DSTAT_LEVEL] +=score; - stat->Score[DSTAT_OVERALL] +=score; - - if(stat->Score[DSTAT_LEVEL]==3){ - if(Someone_has_hattrick){ - DLLAddHUDMessage(TXT_HATTRICK,dPlayers[pnum].callsign); - if(snd_hattrick_reg!=-1) - DLLPlay2dSound(snd_hattrick_reg); - }else{ - DLLAddHUDMessage(TXT_HATTRICKFIRST,dPlayers[pnum].callsign); - if(snd_hattrick_first!=-1) - DLLPlay2dSound(snd_hattrick_first); - Someone_has_hattrick = true; - } - } - } - - TeamScores[pteam]+=score; - OverallTeamScores[pteam]+=score; - int newscore=TeamScores[pteam]; - - switch(flagcount){ - case 1: - { - char t[20]; - t[0] = '\0'; - for(int c=0;cGetTeamString(c)); - break; - } - } - DLLAddHUDMessage(TXT_CAPTURE,dPlayers[pnum].callsign,DMFCBase->GetTeamString(pteam),t); - }break; - case 2: - { - char t[2][20]; - t[0][0] = '\0'; - t[1][0] = '\0'; - int index = 0; - for(int c=0;cGetTeamString(c)); - index++; - if(index==2) - break; - } - } - DLLAddHUDMessage(TXT_CAPTURETWO,dPlayers[pnum].callsign, - DMFCBase->GetTeamString(pteam),t[0],t[1]); - }break; - case 3: - { - char t[3][20]; - t[0][0] = '\0'; - t[1][0] = '\0'; - t[2][0] = '\0'; - - int index = 0; - for(int c=0;cGetTeamString(c)); - index++; - if(index==3) - break; - } - } - DLLAddHUDMessage(TXT_CAPTURETHREE,dPlayers[pnum].callsign, - DMFCBase->GetTeamString(pteam),t[0],t[1],t[2]); - } - } - - if(dPlayers[DMFCBase->GetPlayerNum()].team==pteam){ - if(snd_score_ownteam!=-1) - DLLPlay2dSound(snd_score_ownteam); - }else{ - if(snd_score_otherteam!=-1) - DLLPlay2dSound(snd_score_otherteam); - } - - //Set a Timer to display - if(WhoJustScoredTimer!=-1) - DMFCBase->KillTimer(WhoJustScoredTimer); - WhoJustScoredTimer = DMFCBase->SetTimerInterval(OnTimerScore,0.5f,5.0f,OnTimerScoreKill); - WhoJustScored = pteam; - } - //do the killgoal check - int killgoal; - if(DMFCBase->GetScoreLimit(&killgoal)){ - if(TeamScores[pteam]>=killgoal){ - //That's all she wrote for this level - DLLmprintf((0,"OnClientCollide:Kill Goal Reached!\n")); - DMFCBase->EndLevel(); - } - } - }else{ - DoFlagReturnedHome(pteam); - if(DMFCBase->CheckPlayerNum(pnum)){ - char parm1[20],parm2[20]; - strcpy(parm1,DMFCBase->GetTeamString(pteam)); - strcpy(parm2,DMFCBase->GetTeamString(fteam)); - DLLAddHUDMessage(TXT_RETURN,dPlayers[pnum].callsign,parm1,parm2); - } - } - - //since the player collided with his own team's flag we need to move the flag back home - FlagAtHome[pteam] = true; - HasFlag[pteam] = -1; - vector home_pos; - int home = GoalRooms[pteam]; - - if( (home>=0) && (home<=DMFCBase->GetHighestRoomIndex()) && (!ROOMNUM_OUTSIDE(home)) && (dRooms[home].used) ) - { - DLLComputeRoomCenter(&home_pos,&dRooms[home]); - DLLObjSetPos(it_obj,&home_pos,home,NULL,false); - } - - }//end Player Collides with own team's flag - else{ - //The Player collide with another team's flag - FlagAtHome[fteam] = false; - - //add the flag to the player - GivePlayerFlag(pnum,fteam); - - if(dPlayers[DMFCBase->GetPlayerNum()].team==dPlayers[pnum].team){ - if(snd_pickedup_ownteam!=-1) - DLLPlay2dSound(snd_pickedup_ownteam); - }else{ - if(snd_pickedup_otherteam!=-1) - DLLPlay2dSound(snd_pickedup_otherteam); - } - - //Set a Timer to display - if(WhoJustFlaggedTimer!=-1) - DMFCBase->KillTimer(WhoJustFlaggedTimer); - WhoJustFlaggedTimer = DMFCBase->SetTimerInterval(OnTimer,0.5f,5.0f,OnTimerKill); - WhoJustFlagged = fteam; - - char parm1[20],parm2[20]; - strcpy(parm1,DMFCBase->GetTeamString(pteam)); - strcpy(parm2,DMFCBase->GetTeamString(fteam)); - if(dObjects[dPlayers[pnum].objnum].roomnum==GoalRooms[fteam]){ - DLLAddHUDMessage(TXT_PICKUPFLAG,dPlayers[pnum].callsign,parm1,parm2); - }else{ - DLLAddHUDMessage(TXT_PICKUPFLAGSPEW,dPlayers[pnum].callsign,parm1,parm2); - } - - //remove the flag from the world - if(DMFCBase->GetLocalRole()==LR_SERVER){ - //tell the clients to remove this flag - DLLSetObjectDeadFlag(it_obj,true,false); - } - } -} - -//OnGameStateRequest -// 1) Send game state to new player -void OnGameStateRequest(int player_num) -{ - SendGameState(player_num); - DMFCBase->OnGameStateRequest(player_num); -} - -void OnPlayerConnect(int player_num) -{ - DMFCBase->OnPlayerConnect(player_num); - - tPlayerStat *stat; - stat = (tPlayerStat *)DMFCBase->GetPlayerRecordData(player_num); - if(stat){ - stat->Score[DSTAT_LEVEL] = 0; - stat->Score[DSTAT_OVERALL] = 0; - } - - if(player_num!=DMFCBase->GetPlayerNum()) - { - //announce the arrival of the player - DisplayWelcomeMessage(player_num); - } -} - -void OnClientLevelEnd(void) -{ - DMFCBase->OnClientLevelEnd(); -} - -void OnPlayerChangeTeam(int player_num,int newteam,bool announce,bool spew_onrespawn) -{ - DMFCBase->OnPlayerChangeTeam(player_num,newteam,announce,spew_onrespawn); - player_record *pr = DMFCBase->GetPlayerRecordByPnum(player_num); -} - -//OnClientPlayerKilled -// 1) If suicide add to suicides -// 2) Else add to killer's kill, add to victim's deaths -// 3) Reset colored balls -// 4) If killed in a flag's home goal than put it in the center of the room -void OnClientPlayerKilled(object *killer_obj,int victim_pnum) -{ - int kpnum = -1; - - if(killer_obj){ - if((killer_obj->type==OBJ_PLAYER)||(killer_obj->type==OBJ_GHOST)||(killer_obj->type==OBJ_OBSERVER)) - kpnum = killer_obj->id; - else if(killer_obj->type==OBJ_ROBOT || killer_obj->type == OBJ_BUILDING){ - //countermeasure kill - kpnum = DMFCBase->GetCounterMeasureOwner(killer_obj); - }else{ - kpnum = -1; - } - } - - HandlePlayerSpew(victim_pnum); - DMFCBase->OnClientPlayerKilled(killer_obj,victim_pnum); -} - -void OnClientPlayerDisconnect(int player_num) -{ - HandlePlayerSpew(player_num); - DMFCBase->OnClientPlayerDisconnect(player_num); -} - -void OnPlayerEntersObserver(int pnum,object *piggy) -{ - HandlePlayerSpew(pnum); - DMFCBase->OnPlayerEntersObserver(pnum,piggy); -} - -bool OnCanChangeTeam(int pnum,int newteam) -{ - if(!DMFCBase->OnCanChangeTeam(pnum,newteam)) - return false; - - if(GetFlagCountForPlayer(pnum)){ - DMFCBase->AnnounceTeamChangeDeny(pnum); - return false; - } - - return true; -} - -bool compare_slots(int a,int b) -{ - int ascore,bscore; - player_record *apr,*bpr; - tPlayerStat *astat,*bstat; - - apr = DMFCBase->GetPlayerRecord(a); - bpr = DMFCBase->GetPlayerRecord(b); - if( !apr ) - return true; - if( !bpr ) - return false; - if( apr->state==STATE_EMPTY ) - return true; - if( bpr->state==STATE_EMPTY ) - return false; - astat = (tPlayerStat *)apr->user_info; - bstat = (tPlayerStat *)bpr->user_info; - - if( (apr->state==STATE_INGAME) && (bpr->state==STATE_INGAME) ){ - //both players were in the game - ascore = (astat)?astat->Score[DSTAT_LEVEL]:0; - bscore = (bstat)?bstat->Score[DSTAT_LEVEL]:0; - return (ascorestate==STATE_INGAME) && (bpr->state==STATE_DISCONNECTED) ){ - //apr gets priority since he was in the game on exit - return false; - } - if( (apr->state==STATE_DISCONNECTED) && (bpr->state==STATE_INGAME) ){ - //bpr gets priority since he was in the game on exit - return true; - } - //if we got here then both players were disconnected - ascore = (astat)?astat->Score[DSTAT_LEVEL]:0; - bscore = (bstat)?bstat->Score[DSTAT_LEVEL]:0; - return (ascore=0 && compare_slots(tempsort[j],t); j--){ - tempsort[j+1] = tempsort[j]; - } - // insert - tempsort[j+1] = t; - } - - //copy the array over - memcpy(SortedPlayers,tempsort,MAX_PLAYER_RECORDS*sizeof(int)); - - //Now fill in the final structure of sorted names - int TeamCount[DLLMAX_TEAMS]; - int team; - for(i=0;iGetPlayerRecord(slot); - if(pr && pr->state!=STATE_EMPTY){ - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue; //skip dedicated server - - team = (pr->state==STATE_INGAME)?dPlayers[pr->pnum].team:pr->team; - - if(team>=CTFNumOfTeams) - team = 0; - - SortedPLRPlayers[team][TeamCount[team]] = slot; - - TeamCount[team]++; - } - } - for(i=0;iOnPLRInit(); -} - -void OnPLRInterval(void) -{ - DMFCBase->OnPLRInterval(); - - int TeamCol = 35; - int NameCol = 180; - int PointsCol = 320; - int KillsCol = 370; - int DeathsCol = 410; - int SuicidesCol = 450; - int y = 40; - int slot; - bool had_members; - player_record *pr; - tPlayerStat *stat; - - DLLgrtext_SetFont((DMFCBase->GetGameFontTranslateArray())[SMALL_UI_FONT_INDEX]); - - int height = DLLgrfont_GetHeight((DMFCBase->GetGameFontTranslateArray())[SMALL_UI_FONT_INDEX]) + 1; - - //print out header - DLLgrtext_SetColor(GR_RGB(255,255,150)); - DLLgrtext_Printf(PointsCol,y,TXT_POINTS); - DLLgrtext_Printf(NameCol,y,TXT_PILOT); - DLLgrtext_Printf(KillsCol,y,TXT_KILLS_SHORT); - DLLgrtext_Printf(DeathsCol,y,TXT_DEATHS_SHORT); - DLLgrtext_Printf(SuicidesCol,y,TXT_SUICIDES_SHORT); - y+=height; - - bool doing_connected = true; - -do_disconnected_folk: - - for(int team=0;teamWasPlayerInGameAtLevelEnd(SortedPLRPlayers[team][temp_idx]); - if(pnum==-1) - { - show_team_label = true; - break; - } - temp_idx++; - } - }else - { - show_team_label = true; - } - - if(show_team_label){ - //is there anyone on this team? - DLLgrtext_SetColor(DMFCBase->GetTeamColor(team)); - DLLgrtext_Printf(TeamCol,y,TXT_TEAMSCOREFORM,DMFCBase->GetTeamString(team),TeamScores[team],OverallTeamScores[team]); - } - had_members = false; - - for(int index=0;indexGetPlayerRecord(slot); - if(!pr || pr->state==STATE_EMPTY) - continue; - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue; - - if( (doing_connected && DMFCBase->WasPlayerInGameAtLevelEnd(slot)==-1) || - (!doing_connected && DMFCBase->WasPlayerInGameAtLevelEnd(slot)!=-1) ) - continue;//we're not handling them right now - - stat = (tPlayerStat *)pr->user_info; - - int pnum=DMFCBase->WasPlayerInGameAtLevelEnd(slot); - if(pnum!=-1) - { - DLLgrtext_SetColor(DMFCBase->GetTeamColor(team)); - }else - { - DLLgrtext_SetColor(GR_RGB(128,128,128)); - } - - //valid player - char temp[120]; - sprintf(temp,"%s",pr->callsign); - DMFCBase->ClipString(PointsCol - NameCol - 10,temp,true); - - DLLgrtext_Printf(NameCol,y,"%s",temp); - DLLgrtext_Printf(PointsCol,y,"%d",(stat)?stat->Score[DSTAT_LEVEL]:0); - DLLgrtext_Printf(KillsCol,y,"%d",pr->dstats.kills[DSTAT_LEVEL]); - DLLgrtext_Printf(DeathsCol,y,"%d",pr->dstats.deaths[DSTAT_LEVEL]); - DLLgrtext_Printf(SuicidesCol,y,"%d",pr->dstats.suicides[DSTAT_LEVEL]); - y+=height; - - if(y>=440) - goto quick_exit; - - had_members = true; - - }//end for - - if(!had_members) - { - //skip a line - y+=height; - - if(y>=440) - goto quick_exit; - } - //on to the next team - }//end for - - if(doing_connected) - { - doing_connected = false; - goto do_disconnected_folk; - } - -quick_exit:; - -} - -void SaveStatsToFile(char *filename) -{ - CFILE *file; - DLLOpenCFILE(&file,filename,"wt"); - if(!file){ - DLLmprintf((0,"Unable to open output file\n")); - return; - } - - //write out game stats - #define BUFSIZE 150 - char buffer[BUFSIZE]; - char tempbuffer[25]; - int sortedslots[MAX_PLAYER_RECORDS]; - player_record *pr,*dpr; - tPInfoStat stat; - tPlayerStat *ps; - int count,length,p; - int team; - - //sort the stats - DMFCBase->GetSortedPlayerSlots(sortedslots,MAX_PLAYER_RECORDS); - - int i,t,j; - - for(i=0;i=0 && compare_slots(sortedslots[j],t); j--){ - sortedslots[j+1] = sortedslots[j]; - } - // insert - sortedslots[j+1] = t; - } - - count = 1; - - sprintf(buffer,TXT_STAT_HEADING,(DMFCBase->GetNetgameInfo())->name,(DMFCBase->GetCurrentMission())->cur_level); - DLLcf_WriteString(file,buffer); - - for(i=0;iGetNumTeams();i++){ - int team = SortedTeams[i]; - - sprintf(buffer,"%s: %d[%d]",DMFCBase->GetTeamString(team),TeamScores[team],OverallTeamScores[team]); - DLLcf_WriteString(file,buffer); - } - strcpy(buffer,"\r\n"); - DLLcf_WriteString(file,buffer); - - //Write team members - DLLcf_WriteString(file,""); //blank line - for(t=0;tGetNumTeams();t++){ - int team_i = SortedTeams[t]; - - sprintf(buffer,"%s:",DMFCBase->GetTeamString(team_i)); - DLLcf_WriteString(file,buffer); - - for(p=0;pGetPlayerRecord(sortedslots[p]); - if( pr && pr->state!=STATE_EMPTY) { - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue;//skip dedicated server - - if (pr->team == team_i) { //Check if current team - sprintf(buffer," %s",pr->callsign); - DLLcf_WriteString(file,buffer); - } - } - } - } - DLLcf_WriteString(file,""); //blank line - - sprintf(buffer,TXT_STAT_HEADINGA); - DLLcf_WriteString(file,buffer); - sprintf(buffer,"--------------------------------------------------------------------------------------------------"); - DLLcf_WriteString(file,buffer); - - for(int pslot=0;pslotGetPlayerRecord(real_slot); - if( pr && pr->state!=STATE_EMPTY){ - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue;//skip dedicated server - - //we have a valid play - ps = (tPlayerStat *)pr->user_info; - memset(buffer,' ',BUFSIZE); - - team = pr->team; - - sprintf(tempbuffer,"%d)",count); - memcpy(&buffer[0],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%.6s",DMFCBase->GetTeamString(team)); - memcpy(&buffer[5],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%s%s",(pr->state==STATE_INGAME)?"":"*",pr->callsign); - memcpy(&buffer[12],tempbuffer,strlen(tempbuffer)); - - if(ps){ - sprintf(tempbuffer,"%d[%d]",ps->Score[DSTAT_LEVEL],ps->Score[DSTAT_OVERALL]); - memcpy(&buffer[41],tempbuffer,strlen(tempbuffer)); - } - - sprintf(tempbuffer,"%d[%d]",pr->dstats.kills[DSTAT_LEVEL],pr->dstats.kills[DSTAT_OVERALL]); - memcpy(&buffer[53],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d[%d]",pr->dstats.deaths[DSTAT_LEVEL],pr->dstats.deaths[DSTAT_OVERALL]); - memcpy(&buffer[65],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d[%d]",pr->dstats.suicides[DSTAT_LEVEL],pr->dstats.suicides[DSTAT_OVERALL]); - memcpy(&buffer[76],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%s",DMFCBase->GetTimeString(DMFCBase->GetTimeInGame(real_slot))); - memcpy(&buffer[86],tempbuffer,strlen(tempbuffer)); - - int pos; - pos = 86 + strlen(tempbuffer) + 1; - if(posGetPlayerRecord(p); - if( pr && pr->state!=STATE_EMPTY) { - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue;//skip dedicated server - - //Write out header - sprintf(buffer,"%d) %s%s",count,(pr->state==STATE_INGAME)?"":"*",pr->callsign); - DLLcf_WriteString(file,buffer); - length = strlen(buffer); - memset(buffer,'=',length); - buffer[length] = '\0'; - DLLcf_WriteString(file,buffer); - - //time in game - sprintf(buffer,TXT_STAT_TIG,DMFCBase->GetTimeString(DMFCBase->GetTimeInGame(p))); - DLLcf_WriteString(file,buffer); - - if(DMFCBase->FindPInfoStatFirst(p,&stat)){ - sprintf(buffer,TXT_STAT_HEADINGC); - DLLcf_WriteString(file,buffer); - - if(stat.slot!=p){ - memset(buffer,' ',BUFSIZE); - dpr = DMFCBase->GetPlayerRecord(stat.slot); - int pos; - - if(dpr) - { - sprintf(tempbuffer,"%s",dpr->callsign); - memcpy(buffer,tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d",stat.kills); - memcpy(&buffer[30],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d",stat.deaths); - memcpy(&buffer[40],tempbuffer,strlen(tempbuffer)); - - pos = 40 + strlen(tempbuffer) + 1; - if(posFindPInfoStatNext(&stat)){ - if(stat.slot!=p){ - int pos; - memset(buffer,' ',BUFSIZE); - dpr = DMFCBase->GetPlayerRecord(stat.slot); - if(dpr) - { - sprintf(tempbuffer,"%s",dpr->callsign); - memcpy(buffer,tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d",stat.kills); - memcpy(&buffer[30],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d",stat.deaths); - memcpy(&buffer[40],tempbuffer,strlen(tempbuffer)); - - pos = 40 + strlen(tempbuffer) + 1; - if(posFindPInfoStatClose(); - DLLcf_WriteString(file,""); //skip a line - count++; - } - } - - //done writing stats - DLLcfclose(file); - DLLAddHUDMessage(TXT_STAT_SAVED); -} - -#define ROOTFILENAME "CTF" -void OnSaveStatsToFile(void) -{ - char filename[256]; - DMFCBase->GenerateStatFilename(filename,ROOTFILENAME,false); - SaveStatsToFile(filename); -} - -void OnLevelEndSaveStatsToFile(void) -{ - char filename[256]; - DMFCBase->GenerateStatFilename(filename,ROOTFILENAME,true); - SaveStatsToFile(filename); -} - -void OnDisconnectSaveStatsToFile(void) -{ - char filename[256]; - DMFCBase->GenerateStatFilename(filename,ROOTFILENAME,false); - SaveStatsToFile(filename); -} - -void OnPrintScores(int level) -{ - char buffer[256]; - char name[70]; - int t,i; - int pos[6]; - int len[6]; - - - for(i=0;iGetTeamString(i),TeamScores[i]); - DPrintf(buffer); - } - - memset(buffer,' ',256); - pos[0] = 0; t = len[0] = 30; //give ample room for pilot name - pos[1] = pos[0] + t + 1; t = len[1] = strlen(TXT_POINTS); - pos[2] = pos[1] + t + 1; t = len[2] = strlen(TXT_KILLS_SHORT); - pos[3] = pos[2] + t + 1; t = len[3] = strlen(TXT_DEATHS_SHORT); - pos[4] = pos[3] + t + 1; t = len[4] = strlen(TXT_SUICIDES_SHORT); - pos[5] = pos[4] + t + 1; t = len[5] = strlen(TXT_PING); - - memcpy(&buffer[pos[0]],TXT_PILOT,strlen(TXT_PILOT)); - memcpy(&buffer[pos[1]],TXT_POINTS,len[1]); - memcpy(&buffer[pos[2]],TXT_KILLS_SHORT,len[2]); - memcpy(&buffer[pos[3]],TXT_DEATHS_SHORT,len[3]); - memcpy(&buffer[pos[4]],TXT_SUICIDES_SHORT,len[4]); - memcpy(&buffer[pos[5]],TXT_PING,len[5]); - buffer[pos[5]+len[5]+1] = '\n'; - buffer[pos[5]+len[5]+2] = '\0'; - DPrintf(buffer); - - int slot; - player_record *pr; - int pcount; - - if(level<0 || level>=MAX_PLAYER_RECORDS) - pcount = MAX_PLAYER_RECORDS; - else - pcount = level; - - int sortedplayers[MAX_PLAYER_RECORDS]; - DMFCBase->GetSortedPlayerSlots(sortedplayers,MAX_PLAYER_RECORDS); - - for(i=0;iGetPlayerRecord(slot); - if((pr)&&(pr->state!=STATE_EMPTY)){ - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue; //skip dedicated server - - sprintf(name,"%s%s: %.8s",(pr->state==STATE_DISCONNECTED)?"*":"",pr->callsign,DMFCBase->GetTeamString(pr->team)); - name[29] = '\0'; - - tPlayerStat *stat; - stat = (tPlayerStat *)pr->user_info; - - memset(buffer,' ',256); - t = strlen(name); memcpy(&buffer[pos[0]],name,(tScore[DSTAT_LEVEL]:0); - t = strlen(name); memcpy(&buffer[pos[1]],name,(tdstats.kills[DSTAT_LEVEL]); - t = strlen(name); memcpy(&buffer[pos[2]],name,(tdstats.deaths[DSTAT_LEVEL]); - t = strlen(name); memcpy(&buffer[pos[3]],name,(tdstats.suicides[DSTAT_LEVEL]); - t = strlen(name); memcpy(&buffer[pos[4]],name,(tstate==STATE_INGAME) - sprintf(name,"%.0f",dNetPlayers[pr->pnum].ping_time*1000.0f); - else - strcpy(name,"---"); - t = strlen(name); memcpy(&buffer[pos[5]],name,(tGetLocalRole()==LR_SERVER){ - //if we are the server put the flag back in the center of the goal and tell all the players to do the same - DLLComputeRoomCenter(&fpos,&dRooms[GoalRooms[color]]); - int objnum = DLLObjCreate(OBJ_POWERUP,FlagIDs[color],GoalRooms[color],&fpos,NULL); - DLLMultiSendObject(&dObjects[objnum],1); - } - }else{ - //ok the flag is spewing out into the great beyond - //Start the timer! - Flag_timeout_timers[color] = DMFCBase->GetGametime() + FLAG_TIMEOUT_VALUE; - } - - //player has the flag - LoseFlagForPlayer(pnum,color,false); - } - //rotate flagmask so it is pointing at the next bit - flagmask = (flagmask>>1); - } - - // Reset colored balls - SetColoredBalls(pnum,true); - - - if(play_lose) - DoLoseFlag(DMFCBase->GetPlayerTeam(pnum)); -} - -///////////////////////////////////////////////////////////// -//CTF Functions -void DisplayHUDScores(struct tHUDItem *hitem) -{ - if(display_my_welcome) - { - //announce our arrival to ourselves (as server) - DisplayWelcomeMessage(DMFCBase->GetPlayerNum()); - display_my_welcome = false; - } - - if(!First_game_frame || DisplayScoreScreen) //interval hasn't been called yet or we are display the stats - return; - - ubyte alpha = DMFCBase->ConvertHUDAlpha((ubyte)((DisplayScoreScreen)?128:255)); - - int height = DLLgrfont_GetHeight((DMFCBase->GetGameFontTranslateArray())[HUD_FONT_INDEX]) + 3; - - int y = 170; - int x = 540; - int team = DMFCBase->GetPlayerTeam(DMFCBase->GetPlayerNum()); - int myteam = team; - int i; - - //Flag bitmaps - //if (HasFlag[team]!=-1) then draw a dimmed flag with the team flag of who has it on top - //if (HasFlag[team]==-1) && (FlagAtHome[team]==true) then draw normal flag - //if (HasFlag[team]==-1) && (FlagAtHome[team]==false) then draw dimmed flag - int cx,cy; - for(i=0;iGetPlayerTeam(HasFlag[i])],alpha); - } - else{ - if(FlagAtHome[i]){ - //draw normal flag - DLLRenderHUDQuad(cx,cy,DLLbm_w(FlagAHBmp[i],0),DLLbm_h(FlagAHBmp[i],0),0,0,1,1,FlagAHBmp[i],alpha); - } - else{ - //draw dimmed flag - int f_height = DLLbm_h(DimFlagAHBmp[i],0); - DLLRenderHUDQuad(cx,cy,DLLbm_w(DimFlagAHBmp[i],0),f_height,0,0,1,1,DimFlagAHBmp[i],alpha); - - //Draw timeout time - int time_left; - time_left = (int)( Flag_timeout_timers[i] - DMFCBase->GetGametime()); - if(time_left>0 && Flag_timeout_timers[i]!=0){ - int minutes; - minutes = time_left/60; - time_left = time_left%60; - DLLRenderHUDText(GR_GREEN,alpha,0,cx,cy+2+f_height,"%01d:%02d",minutes,time_left); - } - - } - } - } - } - - x = 520; - - if(Highlight_bmp<=BAD_BITMAP_HANDLE){ - //write the name of your team at the top of the screen since for some reason we don't a highlight bmp - DLLRenderHUDText(DMFCBase->GetTeamColor(team),alpha,0,x,y,TXT_TEAMFORM,DMFCBase->GetTeamString(team)); y+=height; - } - - //determine coordinates to use here - //we'll use a virtual width of 85 pixels on a 640x480 screen - //so first determine the new width - int name_width = 85.0f * DMFCBase->GetHudAspectX(); - int score_width = DLLgrtext_GetTextLineWidth("888"); - int name_x = DMFCBase->GetGameWindowW() - name_width - score_width - 10; - int score_x = DMFCBase->GetGameWindowW() - score_width - 5; - y = (DMFCBase->GetGameWindowH()/2) - ((height*DMFCBase->GetNumTeams())/2); - - //draw the team scores - for(team=0;team=CTFNumOfTeams) - continue; - - if((WhoJustScored!=i) || (DisplayScoreBlink) ){ - - //determine the number of players on the team - int num_players; - num_players = 0; - for(int w=0;wCheckPlayerNum(w) && dPlayers[w].team==i && !DMFCBase->IsPlayerDedicatedServer(w)) - num_players++; - } - - if(i==myteam && Highlight_bmp>BAD_BITMAP_HANDLE){ - //draw the highlite bar in the background - DLLrend_SetAlphaValue(alpha*0.50f); - DLLrend_SetZBufferState (0); - DLLrend_SetTextureType (TT_LINEAR); - DLLrend_SetLighting (LS_NONE); - DLLrend_SetAlphaType (AT_CONSTANT_TEXTURE); - - DLLrend_DrawScaledBitmap(name_x-2,y-2,score_x+score_width+2,y+height-1,Highlight_bmp,0,0,1,1,1.0); - DLLrend_SetZBufferState (1); - } - - char team_name[MAX_TEAMNAME_LEN+5]; - sprintf(team_name,"[%d]%s",num_players,DMFCBase->GetTeamString(i)); - //DMFCBase->ClipString(615 - x - 10,team_name,true); - //DLLRenderHUDText(DMFCBase->GetTeamColor(i),alpha,0,x,y,team_name); - //DLLRenderHUDText(DMFCBase->GetTeamColor(i),alpha,0,615,y,"%d",TeamScores[i]); - DMFCBase->ClipString(name_width,team_name,true); - - DLLgrtext_SetAlpha(alpha); - DLLgrtext_SetColor(DMFCBase->GetTeamColor(i)); - DLLgrtext_Printf(name_x,y,team_name); - DLLgrtext_Printf(score_x,y,"%d",TeamScores[i]); - - } - y+=height; - } - - //draw the bitmap for any flags you have currently - int flagcount; - int flagmask; - - flagcount = GetFlagCountForPlayer(DMFCBase->GetPlayerNum()); - flagmask = GetFlagMaskForPlayer(DMFCBase->GetPlayerNum()); - - if(flagcount==0) - return; - - y+=5; - - for(i=0;i>1; - } - -} - -#define compGT(a,b) (a < b) -void SortTeamScores(int *sortedindex,int *scores) -{ - int t; - int i, j; - - //copy scores into scoreinfo array - for(i=0;i=0 && compGT(scores[sortedindex[j]],scores[t]); j--){ - sortedindex[j+1] = sortedindex[j]; - } - // insert - sortedindex[j+1] = t; - } -} - -void DisplayWelcomeMessage(int player_num) -{ - char name_buffer[64]; - strcpy(name_buffer,(DMFCBase->GetPlayers())[player_num].callsign); - - if(player_num==DMFCBase->GetPlayerNum()) - { - DLLAddHUDMessage(TXT_WELCOME,name_buffer); - } - else - { - DLLAddHUDMessage(TXT_JOINED,name_buffer); - } -} - - -//adds a colored ball to a player (without removing what he has already) -void SetColoredBalls(int playernum,bool reset) -{ - float redb[4]; - float greenb[4]; - float blueb[4]; - - if(reset){ - DLLPlayerSetRotatingBall(playernum,0,0,NULL,NULL,NULL); - return; - } - - int flagcount; - int flagmask; - - bool red,blue,green,yellow; - red=blue=green=yellow = false; - - flagcount = GetFlagCountForPlayer(playernum); - flagmask = GetFlagMaskForPlayer(playernum); - - if(flagcount==0){ - DLLPlayerSetRotatingBall(playernum,0,0,NULL,NULL,NULL); - return; - } - - if(flagmask&FLAGMASK_REDTEAM) - red = true; - if(flagmask&FLAGMASK_BLUETEAM) - blue = true; - if(flagmask&FLAGMASK_GREENTEAM) - green = true; - if(flagmask&FLAGMASK_YELLOWTEAM) - yellow = true; - - for(int i=0;iSetNumberOfTeams(CTFNumOfTeams); -} - - -void DoFlagReturnedHome(int team) -{ - if(DMFCBase->GetPlayerTeam(DMFCBase->GetPlayerNum())==team){ - if(snd_return_ownteam!=-1) - DLLPlay2dSound(snd_return_ownteam); - }else{ - if(snd_return_otherteam!=-1) - DLLPlay2dSound(snd_return_otherteam); - } -} - -void DoLoseFlag(int team) -{ - if(DMFCBase->GetPlayerTeam(DMFCBase->GetPlayerNum())==team){ - if(snd_lose_ownteam!=-1) - DLLPlay2dSound(snd_lose_ownteam); - }else{ - if(snd_lose_otherteam!=-1) - DLLPlay2dSound(snd_lose_otherteam); - } - -} - -// VerifyFlagPosition -// Call this at certain intervals to verify a flags position. It will look at the -// flags room and makes sure that if it's in it's home room, the correct values -// are set, and vice versa. -void VerifyFlagPosition(void) -{ -} - -// AddFlagToPlayer -// gives a player a flag -bool AddFlagToPlayer(int pnum,int team,int flagobjnum) -{ - object *pobj = &dObjects[dPlayers[pnum].objnum]; - bool ret = true; - - if(DMFCBase->GetLocalRole()==LR_SERVER){ - //We're the server, so we need to create the flag and tell the clients, and then attach it - flagobjnum = DLLObjCreate(OBJ_POWERUP,AFlagIDs[team],pobj->roomnum,&pobj->pos,NULL); - - if(flagobjnum!=-1){ - //tell the clients that the flag has been created and they should attach it - TellClientsToAddorDelFlag(pnum,team,flagobjnum,true); - } - - // Attach the flag - - // 1st figure out how many flags the guy already has - // ------------------------------------------------- - int max_num_attach = 3; //based off chrishack for multiplayer - int num_attached = 0; - - if(!pobj->attach_children) - ret = false; - else - { - for(int ap=0;apattach_children[ap]!=OBJECT_HANDLE_NONE) - { - //attempt to make sure it's a valid object - object *tobj; - if(DLLObjGet(pobj->attach_children[ap],&tobj)) - { - num_attached++; - } - } - } - - // 2nd num_attached is the current number of flags this object has - // --------------------------------------------------------------- - switch(num_attached) - { - case 0: - { - //the easy case, nothing is attached, so just attach it to ap0 - ret = DLLAttachObject(pobj,0,&dObjects[flagobjnum],0,true); - }break; - - case 1: - { - bool retval; - object *tobj; - - //we should have a flag at ap0, move it to ap1 - ASSERT(pobj->attach_children[0]!=OBJECT_HANDLE_NONE); - int saved_ap0 = pobj->attach_children[0]; - retval = DLLUnattachChild(pobj,0); - ASSERT(retval); - - retval = DLLObjGet(saved_ap0,&tobj); - ASSERT(retval); - - //attach to ap1 - retval = DLLAttachObject(pobj,1,tobj,0,true); - ASSERT(retval); - - //attach new flag to ap2 - retval = DLLAttachObject(pobj,2,&dObjects[flagobjnum],0,true); - ASSERT(retval); - - ret = retval; - - }break; - - case 2: - { - //we should have a flag at ap1 and ap2 - //so just add this to ap3 - - //attach new flag to ap3 - ret = DLLAttachObject(pobj,0,&dObjects[flagobjnum],0,true); - - }break; - - case 3: - default: - { - Int3(); //Get Jeff - ret = false; - }break; - } - } - - if(!ret){ - //couldn't attach the flag - mprintf((0,"CTF: COULDN'T ATTACH FLAG TO PLAYER, DELETING\n")); - //tell the clients to remove this flag - DLLSetObjectDeadFlag(&dObjects[flagobjnum],true,false); - } - } - - if(flagobjnum==-1){ - //there was an error creating the flag...not good - mprintf((0,"CTF: Couldn't create/unhash flag for attachment\n")); - DMFCBase->DisconnectMe(); - return false; - } - - ChildFlags[team] = dObjects[flagobjnum].handle; - - return ret; -} - -// RemoveFlagFromPlayer -// removes a flag from a player -bool RemoveFlagFromPlayer(int pnum,int team) -{ - int flagobjnum = -1; - - if ( DMFCBase->GetLocalRole()==LR_SERVER) { - - if(ChildFlags[team]==OBJECT_HANDLE_NONE) - return false; - - object *fptr; - if(!DLLObjGet(ChildFlags[team],&fptr)){ - //the flag is already dead?!? - return false; - } - - DLLSetObjectDeadFlag(fptr,true,false); - - //tell the clients to remove the flag - TellClientsToAddorDelFlag(pnum,team,-1,false); - } - - ChildFlags[team] = OBJECT_HANDLE_NONE; - - return true; -} - -void TellClientsToAddorDelFlag(int pnum,int team,int objnum,bool add) -{ - if(add){ - //if we are adding a flag, than we need to send the object to them to make sure that - //they have it for when we go to process it - DLLMultiSendObject(&dObjects[objnum],false); - } - - ubyte data[MAX_GAME_DATA_SIZE]; - int size = 0; - DMFCBase->StartPacket(data,SPID_ADDDELFLAG,&size); - - MultiAddByte(pnum,data,&size); - MultiAddByte(team,data,&size); - MultiAddByte(add,data,&size); - - if(add){ - //add the objnum of the flag and pack it into the packet - MultiAddInt(objnum,data,&size); - } - - DMFCBase->SendPacket(data,size,SP_ALL); -} - -void ServerIsTellingMeToAddorDelAFlag(ubyte *data) -{ - int size = 0; - int pnum,team; - bool add; - - pnum = MultiGetByte(data,&size); - team = MultiGetByte(data,&size); - add = (MultiGetByte(data,&size))?true:false; - - //determine if we should add or delete a flag - if(add){ - int objnum; - objnum = MultiGetInt(data,&size); - objnum = DMFCBase->ConvertServerToLocalObjnum(objnum); - if(objnum==-1){ - //uh oh...corruption??? - FatalError("CTF: Server->Local Object Corruption\n"); - return; - } - AddFlagToPlayer(pnum,team,objnum); - }else{ - RemoveFlagFromPlayer(pnum,team); - } -} - - -///////////////////////////////// -//Timer event handlers -void OnTimer(void) -{ - DisplayFlagBlink = !DisplayFlagBlink; -} -void OnTimerKill(void) -{ - DisplayFlagBlink = true; - WhoJustFlagged = WhoJustFlaggedTimer = -1; -} - -void OnTimerScore(void) -{ - DisplayScoreBlink = !DisplayScoreBlink; -} -void OnTimerScoreKill(void) -{ - DisplayScoreBlink = true; - WhoJustScored = WhoJustScoredTimer = -1; -} - -/////////////////////////////////////////////////////////////////////////////////// -int PackByte(ubyte byte,ubyte *buffer,int pos) -{ - buffer[pos] = byte; - pos++; - return pos; -} - -int UnPackByte(ubyte *byte,ubyte *buffer,int pos) -{ - *byte = buffer[pos]; - pos++; - return pos; -} - -int PackBytes(ubyte *bytes,int count,ubyte *buffer,int pos) -{ - memcpy(&buffer[pos],bytes,count); - pos += count; - return pos; -} - -int UnPackBytes(ubyte *bytes,int count,ubyte *buffer,int pos) -{ - memcpy(bytes,&buffer[pos],count); - pos += count; - return pos; -} - -int PackWord(ushort word,ubyte *buffer,int pos) -{ - return PackBytes((ubyte *)&word,sizeof(ushort),buffer,pos); -} - -int UnPackWord(ushort *word,ubyte *buffer,int pos) -{ - return UnPackBytes((ubyte *)word,sizeof(ushort),buffer,pos); -} - -int PackInt(int data,ubyte *buffer,int pos) -{ - return PackBytes((ubyte *)&data,sizeof(int),buffer,pos); -} - -int UnPackInt(int *data,ubyte *buffer,int pos) -{ - return UnPackBytes((ubyte *)data,sizeof(int),buffer,pos); -} - -int PackArray(ubyte *data,int size,int count,ubyte *buffer,int pos) -{ - return PackBytes(data,size*count,buffer,pos); -} - -int UnPackArray(ubyte *data,int size,int count,ubyte *buffer,int pos) -{ - return UnPackBytes(data,size*count,buffer,pos); -} - -void SendGameState(int pnum) -{ - ubyte data[MAX_GAME_DATA_SIZE]; - int count = 0; - int i; - - DMFCBase->StartPacket(data,SPID_GAMESTATE,&count); - - //pack number of teams in this game - MultiAddInt(CTFNumOfTeams,data,&count); - - //pack flag whether someone has scored a hattrick - MultiAddByte(Someone_has_hattrick,data,&count); - - for(i=0;iSendPacket(data,count,pnum); -} - -void ReceiveGameState(ubyte *data) -{ - int count = 0; - int num_teams; - int i; - - for( i=0;iChildFlags and Attach the flags - for(i = 0; i ConvertServerToLocalObjnum(server_objnums[i]); - - if(our_objnum==-1){ - //fatal error - mprintf((0,"CTF: Local Objnums don't match server objnums\n")); - ChildFlags[i] = OBJECT_HANDLE_NONE; - DMFCBase->DisconnectMe(); - }else{ - //yeah! a valid objnum, attach it!!! - if(HasFlag[i]!=-1) - AddFlagToPlayer(HasFlag[i],i,our_objnum); - else{ - //hmm, HasFlag doesn't match ChildFlags - mprintf((0,"CTF: HasFlag doesn't match ChildFlags!!!!\n")); - ChildFlags[i] = OBJECT_HANDLE_NONE; - } - } - }else{ - //ok invalid... - ChildFlags[i] = OBJECT_HANDLE_NONE; - } - } -} - -/* -******************************************************************************************** -*/ - - -// returns the number of flags a player has, 0 if none, or an invalid pnum -int GetFlagCountForPlayer(int pnum) -{ - //1st check the pnum, make sure it is OK, is it isn't, return 0 - if(pnum<0 || pnum>=DLLMAX_PLAYERS){ - //invalid player number, return 0 flags - mprintf((0,"CTF: Invalid PNUM passed to GetFlagCountForPlayer()\n")); - return 0; - } - - int flag_count = 0; - //2nd, go through all the team flags, and check the player's inventory, see if they have the ID, - //if so, add it to their count - for(int i = 0; i < DLLMAX_TEAMS; i++){ - if(DLLInvCheckItem(pnum,OBJ_POWERUP,FlagIDs[i])){ - //they have this flag - flag_count++; - } - } - - return flag_count; -} - -// returns the mask of which flags this player currently has -ubyte GetFlagMaskForPlayer(int pnum) -{ - //1st check the pnum, make sure it is OK, if it isn't, return 0, meaning no flags - if(pnum<0 || pnum>=DLLMAX_PLAYERS){ - //invalid player number, return 0 flags - mprintf((0,"CTF: Invalid PNUM passed to GetFlagMaskForPlayer()\n")); - return 0; - } - - int flag_mask = 0; - ubyte mask = 0x01; - - //2nd go through all the teams flags, and check the player's inventory, see if they have the ID, - //if so, OR the current mask to the running flag_mask - for(int i = 0; i < DLLMAX_TEAMS; i++){ - if(DLLInvCheckItem(pnum,OBJ_POWERUP,FlagIDs[i])){ - //the have this flag - flag_mask |= mask; - } - //adjust the mask because we are moving to the next flag - mask = mask << 1; - } - - return flag_mask; -} - -// adds a flag to a player, as a precaution, it will go through all the players and makes sure that no one -// has the flag that is being added. If they are adding the flag, than remove that flag from whoever we thought had it -// it will return false if it had to remove a flag from a player -bool GivePlayerFlag(int pnum,ubyte team) -{ - //1st check the player num, make sure it is valid - if(!DMFCBase->CheckPlayerNum(pnum)){ - //not a valid player - mprintf((0,"CTF: Invalid pnum passed to GivePlayerFlag()\n")); - return false; - } - - //2nd check to make sure the team given is valid, and not our own team - if(team >= CTFNumOfTeams){ - //not a valid team - mprintf((0,"CTF: Invalid team passed to GivePlayerFlag() (team>=CTFNumOfTeams)\n")); - return false; - } - if(team == DMFCBase->GetPlayerTeam(pnum)){ - //we can't add a flag of the same team to a player - mprintf((0,"CTF: In GivePlayerFlag(), trying to add a player's home team flag\n")); - return false; - } - - //3rd, make sure no one else currently has this flag - //we'll check our HasFlags[] first - if(HasFlag[team]!=-1){ - //hmm, we have someone listed as already having this flag...odd - mprintf((0,"CTF: In GivePlayerFlag(), trying to add a flag, but we see someone else should already have it\n")); - int player = HasFlag[team]; - if(DMFCBase->CheckPlayerNum(player)){ - //this player is in the game... - //make sure this player doesn't have the flag in his inventory - while(DLLInvCheckItem(player,OBJ_POWERUP,FlagIDs[team])){ - //we have it listed that he does - mprintf((0,"CTF: In GivePlayerFlag(), we detected the flag in someone elses inventory\n")); - //remove all the flags that this player has of this team...very weird - DLLInvRemove(player,OBJ_POWERUP,FlagIDs[team]); - SetColoredBalls(player,false); - //check to see if the player had a flag attached to him - if(ChildFlags[team] != OBJECT_HANDLE_NONE && DMFCBase->GetLocalRole()==LR_SERVER){ - //he does have a flag attached to him...kill it - RemoveFlagFromPlayer(player,team); - } - } - } - //reset this value of the array - HasFlag[team] = -1; - if(DMFCBase->GetLocalRole()!=LR_SERVER){ - mprintf((0,"CTF: Game must be out of sync, requesting game state\n")); - DMFCBase->RequestGameState(); - } - } - - //loop through all the players and make sure they don't have this flag - for(int player = 0; player < DLLMAX_PLAYERS; player++ ){ - //check to see if it's an active player - if(!DMFCBase->CheckPlayerNum(player)) - continue; - - //remove all the flags the player has - while(DLLInvCheckItem(player,OBJ_POWERUP,FlagIDs[team])){ - mprintf((0,"CTF: In GivePlayerFlag(), detected a flag in a stranger's inventory\n")); - DLLInvRemove(player,OBJ_POWERUP,FlagIDs[team]); - SetColoredBalls(player,false); - //check to see if the player had a flag attached to him - if(ChildFlags[team]!=OBJECT_HANDLE_NONE && DMFCBase->GetLocalRole()==LR_SERVER){ - //he does have a flag attached to him...kill it - RemoveFlagFromPlayer(player,team); - } - } - } - - //ok, when we get here everything should be ducky, just add the flag and do the necessary things - DLLInvAddTypeID(pnum,OBJ_POWERUP,FlagIDs[team]); - HasFlag[team] = pnum; - SetColoredBalls(pnum); - - if(DMFCBase->GetLocalRole()==LR_SERVER){ - //so we got here and added a flag to the player, now we need to attach the flag to the player - if(!AddFlagToPlayer(pnum,team)){ - //there was an error adding the flag,,,,ack! - mprintf((0,"CTF: In GivePlayerFlag(), couldn't attach the flag to the player\n")); - } - } - - return true; -} - -//this function takes a flag away from the player, useful for when he scores, spews, disconnects, or observer modes -void LoseFlagForPlayer(int pnum,ubyte team,bool remove_from_inven) -{ - //1st check the player number - if(pnum<0 || pnum>=DLLMAX_PLAYERS){ - mprintf((0,"CTF:Invalid pnum passed to LoseFlagForPlayer()\n")); - return; - } - - //2nd check the team number - if(team>=CTFNumOfTeams){ - mprintf((0,"CTF:Invalid team passed to LoseFlagForPlayer()\n")); - return; - } - - if(team==DMFCBase->GetPlayerTeam(pnum)){ - mprintf((0,"CTF:Invalid team passed to LoseFlagForPlayer()...same team as player\n")); - return; - } - - //ok, we have it registered that the flag belongs to us - while(remove_from_inven && DLLInvCheckItem(pnum,OBJ_POWERUP,FlagIDs[team])){ - DLLInvRemove(pnum,OBJ_POWERUP,FlagIDs[team]); - } - - SetColoredBalls(pnum); - HasFlag[team] = -1; - - //check to see if the player had a flag attached to him - if(ChildFlags[team] != OBJECT_HANDLE_NONE){ - //he does have a flag attached to him...kill it - if(DMFCBase->GetLocalRole()==LR_SERVER){ - //remove this flag and tell the clients to do so, cause we're the server - RemoveFlagFromPlayer(pnum,team); - } - } -} - -void OnGetTokenString(char *src,char *dest,int dest_size) -{ - if(!stricmp(src,"flag")) - { - int mypnum = DMFCBase->GetPlayerNum(); - int flagcount = GetFlagCountForPlayer(mypnum); - int flagmask = GetFlagMaskForPlayer(mypnum); - int team; - bool hasflag[DLLMAX_TEAMS]; - - for(team=0;team>1; - } - for(;teamGetTeamString(team)); - break; - } - } - - strncpy(dest,t,dest_size-1); - dest[dest_size-1] = '\0'; - return; - }break; - case 2: - { - char t[2][64]; - int found = 0; - for(team=0;teamGetTeamString(team)); - found++; - if(found==flagcount) - break; - } - } - - char buffer[256]; - sprintf(buffer,"%s and %s",t[0],t[1]); - strncpy(dest,buffer,dest_size-1); - dest[dest_size-1] = '\0'; - return; - }break; - case 3: - { - char t[3][64]; - int found = 0; - for(team=0;teamGetTeamString(team)); - found++; - if(found==flagcount) - break; - } - } - - char buffer[256]; - sprintf(buffer,"%s, %s and %s",t[0],t[1],t[2]); - strncpy(dest,buffer,dest_size-1); - dest[dest_size-1] = '\0'; - return; - - }break; - default: - strncpy(dest,"No",dest_size-1); - dest[dest_size-1] = '\0'; - return; - break; - } - - } - - DMFCBase->OnGetTokenString(src,dest,dest_size); -} - -#ifdef MACINTOSH -#pragma export off -#endif \ No newline at end of file diff --git a/ctf/ctf.h b/ctf/ctf.h deleted file mode 100644 index 169d6a55..00000000 --- a/ctf/ctf.h +++ /dev/null @@ -1,148 +0,0 @@ -#ifndef __DMFC_APP_H_ -#define __DMFC_APP_H_ - -#include "osiris_share.h" -#include "d3events.h" - -// If a player dies, becomes an observer or disconnects, it's possible that they -// have a flag or more. This function will handle setting certain variables, timer -// and other various settings related to a flag spew -void HandlePlayerSpew(int pnum); -// AddFlagToPlayer -// gives a player a flag -bool AddFlagToPlayer(int pnum,int team,int flagobjnum = -1); -// RemoveFlagFromPlayer -// removes a flag from a player -bool RemoveFlagFromPlayer(int pnum,int team); - - -void OnInterval(void); -void OnHUDInterval(void); -void OnKeypress(int key); -void OnServerGameCreated(void); -void OnClientLevelStart(void); -void OnClientLevelEnd(void); -void OnGameStateRequest(int player_num); -void OnPlayerConnect(int player_num); -void OnClientPlayerKilled(object *killer_obj,int victim_pnum); -void OnServerCollide(object *me_obj,object *it_obj); -void OnClientCollide(ubyte *data); -void OnPLRInterval(void); -void OnPLRInit(void); -bool OnCanChangeTeam(int pnum,int newteam); -void OnSaveStatsToFile(void); -void OnLevelEndSaveStatsToFile(void); -void OnDisconnectSaveStatsToFile(void); -void OnPrintScores(int level); -void OnPlayerEntersObserver(int pnum,object *piggy); -void OnClientPlayerDisconnect(int player_num); -void OnPlayerChangeTeam(int player_num,int newteam,bool announce,bool spew_onrespawn); - -extern IDMFC *DMFCBase; - -// These next two function prototypes MUST appear in the extern "C" block if called -// from a CPP file. -#ifdef __cplusplus -extern "C" -{ -#endif - DLLEXPORT void DLLFUNCCALL DLLGameInit (int *api_func,ubyte *all_ok,int num_teams_to_use); - DLLEXPORT void DLLFUNCCALL DLLGameCall (int eventnum,dllinfo *data); - DLLEXPORT void DLLFUNCCALL DLLGameClose (); - DLLEXPORT void DLLFUNCCALL DLLGetGameInfo (tDLLOptions *options); - DLLEXPORT int DLLFUNCCALL GetGOScriptID(char *name,ubyte isdoor); - DLLEXPORT void DLLFUNCCALLPTR CreateInstance(int id); - DLLEXPORT void DLLFUNCCALL DestroyInstance(int id,void *ptr); - DLLEXPORT short DLLFUNCCALL CallInstanceEvent(int id,void *ptr,int event,tOSIRISEventInfo *data); - DLLEXPORT int DLLFUNCCALL SaveRestoreState( void *file_ptr, ubyte saving_state ); -#ifdef __cplusplus -} -#endif - -#ifdef MACINTOSH -#pragma export on -#endif - -// The main entry point where the game calls the dll -void DLLFUNCCALL DLLGameCall (int eventnum,dllinfo *data) -{ - if((eventnumGetLocalRole()!=LR_SERVER)){ - return; - } - - DMFCBase->TranslateEvent(eventnum,data); -} - -// GetGOScriptID -// Purpose: -// Given the name of the object (from it's pagename), this function will search through it's -// list of General Object Scripts for a script with a matching name (to see if there is a script -// for that type/id of object within this DLL). If a matching scriptname is found, a UNIQUE ID -// is to be returned back to Descent 3. This ID will be used from here on out for all future -// interaction with the DLL. Since doors are not part of the generic object's, it's possible -// for a door to have the same name as a generic object (OBJ_POWERUP, OBJ_BUILDING, OBJ_CLUTTER -// or OBJ_ROBOT), therefore, a 1 is passed in for isdoor if the given object name refers to a -// door, else it is a 0. The return value is the unique identifier, else -1 if the script -// does not exist in the DLL. -int DLLFUNCCALL GetGOScriptID(char *name,ubyte isdoor) -{ - return -1; -} - -// CreateInstance -// Purpose: -// Given an ID from a call to GetGOScriptID(), this function will create a new instance for that -// particular script (by allocating and initializing memory, etc.). A pointer to this instance -// is to be returned back to Descent 3. This pointer will be passed around, along with the ID -// for CallInstanceEvent() and DestroyInstance(). Return NULL if there was an error. -void DLLFUNCCALLPTR CreateInstance(int id) -{ - return NULL; -} - -// DestroyInstance -// Purpose: -// Given an ID, and a pointer to a particular instance of a script, this function will delete and -// destruct all information associated with that script, so it will no longer exist. -void DLLFUNCCALL DestroyInstance(int id,void *ptr) -{ -} - -// CallInstanceEvent -// Purpose: -// Given an ID, a pointer to a script instance, an event and a pointer to the struct of -// information about the event, this function will translate who this event belongs to and -// passes the event to that instance of the script to be handled. Return a combination of -// CONTINUE_CHAIN and CONTINUE_DEFAULT, to give instructions on what to do based on the -// event. CONTINUE_CHAIN means to continue through the chain of scripts (custom script, level -// script, mission script, and finally default script). If CONTINUE_CHAIN is not specified, -// than the chain is broken and those scripts of lower priority will never get the event. Return -// CONTINUE_DEFAULT in order to tell D3 if you want process the normal action that is built into -// the game for that event. This only pertains to certain events. If the chain continues -// after this script, than the CONTINUE_DEFAULT setting will be overridden by lower priority -// scripts return value. -short DLLFUNCCALL CallInstanceEvent(int id,void *ptr,int event,tOSIRISEventInfo *data) -{ - return CONTINUE_CHAIN|CONTINUE_DEFAULT; -} - -// SaveRestoreState -// Purpose: -// This function is called when Descent 3 is saving or restoring the game state. In this function -// you should save/restore any global data that you want preserved through load/save (which includes -// demos). You must be very careful with this function, corrupting the file (reading or writing too -// much or too little) may be hazardous to the game (possibly making it impossible to restore the -// state). It would be best to use version information to keep older versions of saved states still -// able to be used. IT IS VERY IMPORTANT WHEN SAVING THE STATE TO RETURN THE NUMBER OF _BYTES_ WROTE -// TO THE FILE. When restoring the data, the return value is ignored. saving_state is 1 when you should -// write data to the file_ptr, 0 when you should read in the data. -int DLLFUNCCALL SaveRestoreState( void *file_ptr, ubyte saving_state ) -{ - return 0; -} - -#ifdef MACINTOSH -#pragma export off -#endif - -#endif diff --git a/entropy/Entropy.h b/entropy/Entropy.h deleted file mode 100644 index 75417fab..00000000 --- a/entropy/Entropy.h +++ /dev/null @@ -1,159 +0,0 @@ -#ifndef __DMFC_APP_H_ -#define __DMFC_APP_H_ - -/* -The following #includes are used to 'import' OSIRIS support -so if wanted to have OSIRIS scripts in this mod, We can use -OSIRIS functions to control them. -*/ -#include "osiris_share.h" -#include "d3events.h" - -/* -===================================================================== -Event handler prototypes -===================================================================== -*/ -void OnGameStateRequest(int pnum); -void OnClientPlayerKilled(object *killer_obj,int victim_pnum); -void OnServerGameCreated(void); -void OnClientLevelStart(void); -void OnClientLevelEnd(void); -void OnClientPlayerEntersGame(int player_num); -void OnInterval(void); -void OnHUDInterval(void); -void OnKeypress(int key); -void OnPLRInterval(void); -void OnPLRInit(void); -void OnSaveStatsToFile(void); -void OnClientPlayerDisconnect(int pnum); -void OnServerPlayerChangeSegment(int player_num,int newseg,int oldseg); -void OnClientPlayerChangeSegment(int player_num,int newseg,int oldseg); -void OnServerCollide(object *me_obj,object *it_obj); -void OnControlMessage(ubyte msg,int from_pnum); -void OnClientShowUI(int id,void *user_data); - -/* -===================================================================== -Our DMFC Object, externed here so everyone can know about it -===================================================================== -*/ -extern IDMFC *DMFCBase; - -/* -===================================================================== -Prototypes needed for the Game->DLL/D3M Interface -===================================================================== -*/ -// These next two function prototypes MUST appear in the extern "C" block if called -// from a CPP file. -extern "C" -{ - DLLEXPORT void DLLFUNCCALL DLLGameInit (int *api_func,ubyte *all_ok,int num_teams_to_use); - DLLEXPORT void DLLFUNCCALL DLLGameCall (int eventnum,dllinfo *data); - DLLEXPORT void DLLFUNCCALL DLLGameClose (); - DLLEXPORT void DLLFUNCCALL DLLGetGameInfo (tDLLOptions *options); - DLLEXPORT int DLLFUNCCALL GetGOScriptID(char *name,ubyte isdoor); - DLLEXPORT void DLLFUNCCALLPTR CreateInstance(int id); - DLLEXPORT void DLLFUNCCALL DestroyInstance(int id,void *ptr); - DLLEXPORT short DLLFUNCCALL CallInstanceEvent(int id,void *ptr,int event,tOSIRISEventInfo *data); - DLLEXPORT int DLLFUNCCALL SaveRestoreState( void *file_ptr, ubyte saving_state ); -} - -/* -===================================================================== -The following function stubs must be in every mod. They are here -for OSIRIS, incase you want to put OSIRIS scripts in your mod. If -you are familiar with OSIRIS, then you will/should recognize the -functions. -===================================================================== -*/ - -#ifdef MACINTOSH -#pragma export on -#endif - -// The main entry point where the game calls the dll -void DLLFUNCCALL DLLGameCall (int eventnum,dllinfo *data) -{ - if((eventnumGetLocalRole()!=LR_SERVER)){ - return; - } - - DMFCBase->TranslateEvent(eventnum,data); -} - - -// GetGOScriptID -// Purpose: -// Given the name of the object (from it's pagename), this function will search through it's -// list of General Object Scripts for a script with a matching name (to see if there is a script -// for that type/id of object within this DLL). If a matching scriptname is found, a UNIQUE ID -// is to be returned back to Descent 3. This ID will be used from here on out for all future -// interaction with the DLL. Since doors are not part of the generic object's, it's possible -// for a door to have the same name as a generic object (OBJ_POWERUP, OBJ_BUILDING, OBJ_CLUTTER -// or OBJ_ROBOT), therefore, a 1 is passed in for isdoor if the given object name refers to a -// door, else it is a 0. The return value is the unique identifier, else -1 if the script -// does not exist in the DLL. -int DLLFUNCCALL GetGOScriptID(char *name,ubyte isdoor) -{ - return -1; -} - -// CreateInstance -// Purpose: -// Given an ID from a call to GetGOScriptID(), this function will create a new instance for that -// particular script (by allocating and initializing memory, etc.). A pointer to this instance -// is to be returned back to Descent 3. This pointer will be passed around, along with the ID -// for CallInstanceEvent() and DestroyInstance(). Return NULL if there was an error. -void DLLFUNCCALLPTR CreateInstance(int id) -{ - return NULL; -} - -// DestroyInstance -// Purpose: -// Given an ID, and a pointer to a particular instance of a script, this function will delete and -// destruct all information associated with that script, so it will no longer exist. -void DLLFUNCCALL DestroyInstance(int id,void *ptr) -{ -} - -// CallInstanceEvent -// Purpose: -// Given an ID, a pointer to a script instance, an event and a pointer to the struct of -// information about the event, this function will translate who this event belongs to and -// passes the event to that instance of the script to be handled. Return a combination of -// CONTINUE_CHAIN and CONTINUE_DEFAULT, to give instructions on what to do based on the -// event. CONTINUE_CHAIN means to continue through the chain of scripts (custom script, level -// script, mission script, and finally default script). If CONTINUE_CHAIN is not specified, -// than the chain is broken and those scripts of lower priority will never get the event. Return -// CONTINUE_DEFAULT in order to tell D3 if you want process the normal action that is built into -// the game for that event. This only pertains to certain events. If the chain continues -// after this script, than the CONTINUE_DEFAULT setting will be overridden by lower priority -// scripts return value. -short DLLFUNCCALL CallInstanceEvent(int id,void *ptr,int event,tOSIRISEventInfo *data) -{ - return CONTINUE_CHAIN|CONTINUE_DEFAULT; -} - -// SaveRestoreState -// Purpose: -// This function is called when Descent 3 is saving or restoring the game state. In this function -// you should save/restore any global data that you want preserved through load/save (which includes -// demos). You must be very careful with this function, corrupting the file (reading or writing too -// much or too little) may be hazardous to the game (possibly making it impossible to restore the -// state). It would be best to use version information to keep older versions of saved states still -// able to be used. IT IS VERY IMPORTANT WHEN SAVING THE STATE TO RETURN THE NUMBER OF _BYTES_ WROTE -// TO THE FILE. When restoring the data, the return value is ignored. saving_state is 1 when you should -// write data to the file_ptr, 0 when you should read in the data. -int DLLFUNCCALL SaveRestoreState( void *file_ptr, ubyte saving_state ) -{ - return 0; -} - -#ifdef MACINTOSH -#pragma export off -#endif - -#endif \ No newline at end of file diff --git a/entropy/EntropyAux.h b/entropy/EntropyAux.h deleted file mode 100644 index 40694c86..00000000 --- a/entropy/EntropyAux.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef __ENTROPY_AUX_H__ -#define __ENTROPY_AUX_H__ - -/* -===================================================================== -Entropy Special Packet IDs -===================================================================== -*/ -#define SPID_NEWPLAYER 0 -#define SPID_TAKEOVER 1 -#define SPID_MATCHOBJNUM 2 -#define SPID_ROOMINFO 3 -#define SPID_PICKUPVIRUS 4 -#define SPID_VIRUSCREATE 5 - -/* -===================================================================== -Some general defines for Entropy -===================================================================== -*/ -#define MAX_VIRII 16 //maximum number of virii for each team not picked up -#define MAX_VIRII_PER_ROOM 4 //maximum number of virii allowed to be alive in a lab at once -#define NUM_TEAMS 2 //Only 2 teams supported in this game - -//the following are control message code (when the server sends status info to the client) -#define VIRUS_NOTENOUGHKILLS 0 -#define VIRUS_CANTKILL 1 -#define VIRUS_DESTROYED 2 - -/* -===================================================================== -Some common function prototypes -===================================================================== -*/ -void SendRoomInfo(int pnum); -void ReceiveRoomInfo(ubyte *data); -void SendClientPickupVirus(int player_num); -void ReceivePickupVirus(ubyte *data); -void SendGameStartPacket(int pnum); -void GetGameStartPacket(ubyte *data); -void SendTakeOverPacket(int newteam,int oldteam,int room,int victor); -void ReceiveTakeOverPacket(ubyte *data); -void DoVirusCreate(ubyte *data); -void SendVirusCreate(object *obj); -bool IsPlayerInEnemy(int pnum); - -//Functions in EntropyRoom.cpp -int SpewObjectInRoom(int type,int id,int roomnum); -bool PaintRoomWithTexture(int texture,int roomnum); - -//Take over functions -void TakeOverRoom(int newteam,int oldteam,int room,int victor); -void SendTakeOverPacket(int newteam,int oldteam,int room,int victor); -void ReceiveTakeOverPacket(ubyte *data); - -/* -===================================================================== -Externed globals needed throughout Entropy -===================================================================== -*/ -extern int NumberOfKillsSinceLastDeath[DLLMAX_PLAYERS]; //'kills in a row' for a player -extern int TeamScore[NUM_TEAMS]; //team scores -extern int TeamOwnedRooms[NUM_TEAMS]; //Number of rooms each team has -extern int EnergyText[NUM_TEAMS]; //texture handles to Energy room textures -extern int RepairText[NUM_TEAMS]; //texture handles to Repair room textures -extern int LabText[NUM_TEAMS]; //texture handles to Lab room textures -extern int virus_id; //Object ID of the Virus object -extern int *RoomList; //List of room index's that are special for Entropy (i.e. all the labs, repairs and energy rooms) -extern int RoomCount; //Size of RoomList when it's finally allocated - -#endif \ No newline at end of file diff --git a/entropy/EntropyBase.cpp b/entropy/EntropyBase.cpp deleted file mode 100644 index 256d4877..00000000 --- a/entropy/EntropyBase.cpp +++ /dev/null @@ -1,2093 +0,0 @@ -/* -* $Logfile: /DescentIII/Main/entropy/EntropyBase.cpp $ -* $Revision: 1.1.1.1 $ -* $Date: 2003-08-26 03:57:41 $ -* $Author: kevinb $ -* -* -* -* $Log: not supported by cvs2svn $ - * - * 59 9/24/01 2:28p Matt - * Allowed room for longer team name on results screen. - * - * 58 9/13/01 5:31p Matt - * Added a team member list to the stats display. - * Fixed a non-terminated string bug. - * - * 57 10/21/99 9:27p Jeff - * B.A. Macintosh code merge - * - * 56 9/03/99 5:27p Jeff - * fixed energy bug (going into an energy center with >100 energy) - * - * 55 8/17/99 5:53p Jeff - * track ranks on PXO - * - * 54 7/23/99 2:31p Jeff - * fixed bug where if the killer is not known, a player would still be - * able to carry virus after dying. - * - * 53 7/15/99 1:18a Jeff - * fixed up $scores - * - * 52 7/15/99 1:01a Jeff - * added $scores support - * - * 51 7/13/99 12:11p Jeff - * added some specific text taunt token decoding - * - * 50 7/12/99 2:27p Jeff - * fixed PLR to only display the team label for the disconnected list if - * there are people in the list. Play fanfare and print out a message is - * someone takes over the last base - * - * 49 7/11/99 6:54p Jeff - * fixed PLR so it doesn't go off the screen on long lists and active - * players in the game are shown first - * - * 48 6/08/99 7:08p Jeff - * begining to comment for SDK release - * - * 47 5/23/99 3:04a Jason - * fixed bug with player rankings not being updated correctly - * - * 46 5/23/99 2:22a Jeff - * added countdown. fixed takeover time...off by .5 seconds - * - * 45 5/22/99 1:12a Jeff - * play a sound on the server when picking up a virus - * - * 44 5/21/99 10:30p Jason - * made some rule changes to make more fun - * - * 43 5/21/99 10:03a Jeff - * hopefully filled in any remaining gaps related to have more than you - * can carry virus loads - * - * 42 5/12/99 11:04p Jeff - * dmfc and multiplayer games now have endian friendly packets (*whew*) - * - * 41 5/12/99 11:28a Jeff - * when a player scores, dont remove all virii, just what they used -* -* $NoKeywords: $ -*/ - - - -#include "gamedll_header.h" //included by all mods, it includes all needed headers, etc. -#include -#include "idmfc.h" //dmfc! (required) -#include "Entropy.h" -#include "Entropystr.h" //our string table for Entropy -#include "EntropyAux.h" - -// the DMFC object, used throughout, and required by all mods -IDMFC *DMFCBase = NULL; -// our DmfcStats object, used for the F7 screen -IDmfcStats *dstat = NULL; -// these are some helper pointers, so we don't have to constantly query -// DMFC for these arrays, we can query once and just save it for just future use. -object *dObjects; -player *dPlayers; -room *dRooms; - -//////////////////////////////////////////////////// -// Customization flags -// These are 'the rules' to Entropy basically - -//scoring -#define SCORE_PLYR_TAKEOVER_ROOM 5 //num points for a player when he/she takes over a room -#define SCORE_TEAM_WINSGAME 10 //num points for a team when they win a round -#define SCORE_TEAM_TAKEOVER_ROOM 3 //num points for a team when a teammate of their's takes over a room - -//rates -#define REPAIR_RATE 5.0f //units/sec of the repair room -#define ENERGY_RATE 5.0f //units/sec of the energy room -#define DAMAGE_RATE 5.0f //units/sec of damage when in an enemy room -#define ENERGY_CAP 100.0f //max energy given to a player via an Energy room -#define SHIELD_CAP 100.0f //max shields given to a player via a Repair room -#define VIRUS_SPEW 20.0f //How long it takes for a lab to spew a virus -#define VIRUS_PER_KILL 2.0f //How many virii a player can carry per kill-in-a-row. - -#define MINIMUM_VIRUS_COUNT 5 //Minimum number of virii needed to take over a room -#define TAKEOVER_TIME 3.0f //How long a player must stand still to take over a room - -//////////////////////////////////////////////////// -typedef struct -{ - float total_time; - vector last_pos; -}tPlayerPos; - -typedef struct -{ - int Score[2]; -}tPlayerStat; //Overall scores (throughout the game) -int pack_pstat(tPlayerStat *user_info,ubyte *data) -{ - int count = 0; - MultiAddInt(user_info->Score[0],data,&count); - MultiAddInt(user_info->Score[1],data,&count); - return count; -} - -int unpack_pstat(tPlayerStat *user_info,ubyte *data) -{ - int count = 0; - user_info->Score[0] = MultiGetInt(data,&count); - user_info->Score[1] = MultiGetInt(data,&count); - return count; -} - - -int TeamOwnedRooms[NUM_TEAMS]; -int TeamVirii[NUM_TEAMS][MAX_VIRII]; -int NumberOfKillsSinceLastDeath[DLLMAX_PLAYERS]; -int SortedPLRPlayers[NUM_TEAMS][MAX_PLAYER_RECORDS]; -int TeamScore[NUM_TEAMS]; -int SortedTeams[NUM_TEAMS]; -int SortedPlayers[MAX_PLAYER_RECORDS]; -int EnergyText[NUM_TEAMS]; -int RepairText[NUM_TEAMS]; -int LabText[NUM_TEAMS]; -tPlayerPos TimeInRoom[DLLMAX_PLAYERS]; -bool DisplayScoreScreen; -int virus_id = -1; -int *RoomList = NULL; -int RoomCount; -int Highlight_bmp = -1; -bool display_my_welcome = false; -float Server_last_play_damage_sound = 0; -int Player_who_took_over_last_base = -1; - -int snd_repair_center = -1; -int snd_energy_center = -1; -int snd_score = -1; -int snd_virus_destroy = -1; -int snd_damage = -1; -int snd_virus_pickup = -1; - -//void DisplayScores(void); -void DisplayHUDScores(struct tHUDItem *hitem); -void DisplayWelcomeMessage(int player_num); -void SortTeamScores(int *sortedindex,int *scores); -void SaveStatsToFile(char *filename); -void OnLabSpewTimer(void); -void RemoveVirusFromPlayer(int player_num,bool remove_all); -bool ScanForLaboratory(int team,int *newlab); -bool CompareDistanceTravel(vector *curr_pos,vector *last_pos); -void OnDisconnectSaveStatsToFile(void); -void OnLevelEndSaveStatsToFile(void); -void OnGetTokenString(char *src,char *dest,int dest_size); -//Player in special room functions -void DoIntervalPlayerFrame(void); -void DoPlayerInLab(int pnum,float time); -void DoPlayerInEnergy(int pnum,float time); -void DoPlayerInRepair(int pnum,float time); -void DoPlayerInEnemy(int pnum,float time); - -void DoServerConfigureDialog(void); -void OnPrintScores(int level); - -/////////////////////////////////////////////// -//localization info -char **StringTable; -int StringTableSize = 0; -char *_ErrorString = "Missing String"; -char *GetStringFromTable(int d){if( (d<0) || (d>=StringTableSize) ) return _ErrorString; else return StringTable[d];} -/////////////////////////////////////////////// - -#ifdef MACINTOSH -#pragma export on -#endif - -// This function gets called by the game when it wants to learn some info about the game -void DLLFUNCCALL DLLGetGameInfo (tDLLOptions *options) -{ - options->flags = DOF_MAXTEAMS|DOF_MINTEAMS; - options->max_teams = NUM_TEAMS; - options->min_teams = NUM_TEAMS; - strcpy(options->game_name,TXT_GAMENAME); - strcpy(options->requirements,"ENTROPY"); -} - -void DetermineScore(int precord_num,int column_num,char *buffer,int buffer_size) -{ - player_record *pr = DMFCBase->GetPlayerRecord(precord_num); - if(!pr || pr->state==STATE_EMPTY){ - buffer[0] = '\0'; - return; - } - - tPlayerStat *stat = (tPlayerStat *)pr->user_info; - sprintf(buffer,"%d[%d]",(stat)?stat->Score[DSTAT_LEVEL]:0,(stat)?stat->Score[DSTAT_OVERALL]:0); -} - -void TeamScoreCallback(int team,char *buffer,int buffer_size) -{ - ASSERT(team>=0 && teamLoadFunctions(api_func); - - //Setup event handlers - DMFCBase->Set_OnGameStateRequest(OnGameStateRequest); - DMFCBase->Set_OnClientPlayerKilled(OnClientPlayerKilled); - DMFCBase->Set_OnServerGameCreated(OnServerGameCreated); - DMFCBase->Set_OnClientLevelStart(OnClientLevelStart); - DMFCBase->Set_OnClientLevelEnd(OnClientLevelEnd); - DMFCBase->Set_OnClientPlayerEntersGame(OnClientPlayerEntersGame); - DMFCBase->Set_OnInterval(OnInterval); - DMFCBase->Set_OnHUDInterval(OnHUDInterval); - DMFCBase->Set_OnKeypress(OnKeypress); - DMFCBase->Set_OnPLRInterval(OnPLRInterval); - DMFCBase->Set_OnPLRInit(OnPLRInit); - DMFCBase->Set_OnSaveStatsToFile(OnSaveStatsToFile); - DMFCBase->Set_OnLevelEndSaveStatsToFile(OnLevelEndSaveStatsToFile); - DMFCBase->Set_OnDisconnectSaveStatsToFile(OnDisconnectSaveStatsToFile); - DMFCBase->Set_OnClientPlayerDisconnect(OnClientPlayerDisconnect); - DMFCBase->Set_OnServerPlayerChangeSegment(OnServerPlayerChangeSegment); - DMFCBase->Set_OnClientPlayerChangeSegment(OnClientPlayerChangeSegment); - DMFCBase->Set_OnServerCollide(OnServerCollide); - DMFCBase->Set_OnControlMessage(OnControlMessage); - DMFCBase->Set_OnClientShowUI(OnClientShowUI); - DMFCBase->Set_OnGetTokenString(OnGetTokenString); - DMFCBase->Set_OnPrintScores(OnPrintScores); - - // Setup arrays for easier to read code - dObjects = DMFCBase->GetObjects(); - dPlayers = DMFCBase->GetPlayers(); - dRooms = DMFCBase->GetRooms(); - - netgame_info *Netgame = DMFCBase->GetNetgameInfo(); - Netgame->flags |= (NF_TRACK_RANK); - - DMFCBase->GameInit(NUM_TEAMS); - DLLCreateStringTable("entropy.str",&StringTable,&StringTableSize); - DLLmprintf((0,"%d strings loaded from string table\n",StringTableSize)); - if(!StringTableSize){ - *all_ok = 0; - return; - } - - //add the death and suicide messages - DMFCBase->AddDeathMessage(TXT_KILLA,true); - - DMFCBase->AddSuicideMessage(TXT_SUICIDEA); - - //register special packet receivers - DMFCBase->RegisterPacketReceiver(SPID_NEWPLAYER,GetGameStartPacket); - DMFCBase->RegisterPacketReceiver(SPID_TAKEOVER,ReceiveTakeOverPacket); - DMFCBase->RegisterPacketReceiver(SPID_ROOMINFO,ReceiveRoomInfo); - DMFCBase->RegisterPacketReceiver(SPID_PICKUPVIRUS,ReceivePickupVirus); - DMFCBase->RegisterPacketReceiver(SPID_VIRUSCREATE,DoVirusCreate); - - DMFCBase->SetNumberOfTeams(NUM_TEAMS); - - DMFCBase->AddHUDItemCallback(HI_TEXT,DisplayHUDScores); - - EnergyText[RED_TEAM] = DLLFindTextureName("RedEnergy"); - EnergyText[BLUE_TEAM] = DLLFindTextureName("BlueEnergy"); - RepairText[RED_TEAM] = DLLFindTextureName("RedRepair"); - RepairText[BLUE_TEAM] = DLLFindTextureName("BlueRepair"); - LabText[RED_TEAM] = DLLFindTextureName("RedLab"); - LabText[BLUE_TEAM] = DLLFindTextureName("BlueLab"); - - snd_repair_center = DLLFindSoundName("EntropyRepair"); - snd_energy_center = DLLFindSoundName("EntropyEnergy"); - snd_score = DLLFindSoundName("EntropyScore"); - snd_virus_destroy = DLLFindSoundName("EntropyDestroy"); - snd_damage = DLLFindSoundName("HitEnergy"); - snd_virus_pickup = DLLFindSoundName("Powerup pickup"); - - DMFCBase->SetupPlayerRecord(sizeof(tPlayerStat),(int (*)(void *,ubyte *))pack_pstat,(int (*)(void *,ubyte *))unpack_pstat); - - virus_id = DLLFindObjectIDName("EntropyVirus"); - - DisplayScoreScreen = false; - - Highlight_bmp = DLLbm_AllocBitmap(32,32,0); - if(Highlight_bmp>BAD_BITMAP_HANDLE){ - ushort *data = DLLbm_data(Highlight_bmp,0); - if(!data){ - //bail on out of here - *all_ok = 0; - return; - } - for(int x=0;x<32*32;x++){ - data[x] = GR_RGB16(50,50,50)|OPAQUE_FLAG; - } - } - - - // Initialize the Stats Manager - // ---------------------------- - tDmfcStatsInit tsi; - tDmfcStatsColumnInfo pl_col[6]; - char gname[20]; - strcpy(gname,TXT_STATSGAMENAME); - - tsi.flags = DSIF_SHOW_PIC|DSIF_SHOW_OBSERVERICON|DSIF_SEPERATE_BY_TEAM; - tsi.cColumnCountDetailed = 0; - tsi.cColumnCountPlayerList = 6; - tsi.clbDetailedColumnBMP = NULL; - tsi.clbDetailedColumn = NULL; - tsi.clbPlayerColumn = DetermineScore; - tsi.clbPlayerColumnBMP = NULL; - tsi.DetailedColumns = NULL; - tsi.GameName = gname; - tsi.MaxNumberDisplayed = NULL; - tsi.PlayerListColumns = pl_col; - tsi.SortedPlayerRecords = SortedPlayers; - tsi.clTeamLine = TeamScoreCallback; - - pl_col[0].color_type = DSCOLOR_TEAM; - strcpy(pl_col[0].title,TXT_PILOT); - pl_col[0].type = DSCOL_PILOT_NAME; - pl_col[0].width = 120; - - pl_col[1].color_type = DSCOLOR_TEAM; - strcpy(pl_col[1].title,TXT_SCORE); - pl_col[1].type = DSCOL_CUSTOM; - pl_col[1].width = 47; - - pl_col[2].color_type = DSCOLOR_TEAM; - strcpy(pl_col[2].title,TXT_KILLS); - pl_col[2].type = DSCOL_KILLS_LEVEL; - pl_col[2].width = 47; - - pl_col[3].color_type = DSCOLOR_TEAM; - strcpy(pl_col[3].title,TXT_DEATHS); - pl_col[3].type = DSCOL_DEATHS_LEVEL; - pl_col[3].width = 57; - - pl_col[4].color_type = DSCOLOR_TEAM; - strcpy(pl_col[4].title,TXT_SUICIDES); - pl_col[4].type = DSCOL_SUICIDES_LEVEL; - pl_col[4].width = 62; - - pl_col[5].color_type = DSCOLOR_TEAM; - strcpy(pl_col[5].title,TXT_PING); - pl_col[5].type = DSCOL_PING; - pl_col[5].width = 40; - - dstat->Initialize(&tsi); -} -// Called when the DLL is shutdown -void DLLFUNCCALL DLLGameClose () -{ - if(Highlight_bmp>BAD_BITMAP_HANDLE) - DLLbm_FreeBitmap(Highlight_bmp); - - if(RoomList){ - free(RoomList); - RoomList = NULL; - } - - DLLDestroyStringTable(StringTable,StringTableSize); - - if(dstat) - { - dstat->DestroyPointer(); - dstat = NULL; - } - - if(DMFCBase) - { - DMFCBase->GameClose(); - DMFCBase->DestroyPointer(); - DMFCBase = NULL; - } -} - -// The server has just started, so clear out all the stats and game info -void OnServerGameCreated(void) -{ - DMFCBase->OnServerGameCreated(); - - tPlayerStat *stat; - player_record *pr; - int i; - - for(i=0;iGetPlayerRecord(i); - if(pr){ - stat = (tPlayerStat *)pr->user_info; - if(stat){ - stat->Score[DSTAT_LEVEL] = 0; - stat->Score[DSTAT_OVERALL] = 0; - } - } - } - for(i=0;iOnClientLevelStart(); - int i; - - for(i=0;iGetPlayerRecord(i); - if(pr){ - stat = (tPlayerStat *)pr->user_info; - if(stat){ - stat->Score[DSTAT_LEVEL] = 0; - } - } - } - - //reset damage timer - Server_last_play_damage_sound = 0; - - //reset the id to -1, so we are ready for the new level - Player_who_took_over_last_base = -1; - - if(DMFCBase->GetLocalRole()==LR_SERVER){ - DMFCBase->SetTimerInterval(OnLabSpewTimer,VIRUS_SPEW,-1.0f); - } - - if(RoomList){ - free(RoomList); - RoomList = NULL; - } - RoomCount = 0; - int r; - for(r=0;r<=DMFCBase->GetHighestRoomIndex();r++){ - if(dRooms[r].used){ - int flags = dRooms[r].flags; - if(flags&RF_SPECIAL1||flags&RF_SPECIAL2||flags&RF_SPECIAL3|| - flags&RF_SPECIAL4||flags&RF_SPECIAL5||flags&RF_SPECIAL6){ - RoomCount++; - } - } - } - - if(RoomCount==0){ - FatalError("No Special Rooms Defined"); - return; - } - - RoomList = (int *)malloc(sizeof(int)*RoomCount); - if(!RoomList){ - FatalError("Out of memory"); - return; - } - - bool room_used_already; - int special_room_index = 0; - - for(r=0;r<=DMFCBase->GetHighestRoomIndex();r++){ - if(dRooms[r].used){ - if(dRooms[r].flags&RF_FUELCEN) - { - dRooms[r].flags &= ~RF_FUELCEN; - dRooms[r].room_change_flags |= RCF_GOALSPECIAL_FLAGS; - } - - room_used_already = false; - if(dRooms[r].flags&RF_SPECIAL1){ //Red Team Laboratory - TeamOwnedRooms[RED_TEAM]++; - room_used_already = true; - PaintRoomWithTexture(LabText[RED_TEAM],r); - RoomList[special_room_index] = r; - special_room_index++; - } - if(dRooms[r].flags&RF_SPECIAL4){ //Blue Team Laboratory - if(room_used_already) - { - dRooms[r].flags &= ~RF_SPECIAL4; - dRooms[r].room_change_flags |= RCF_GOALSPECIAL_FLAGS; - } - else - { - TeamOwnedRooms[BLUE_TEAM]++; - room_used_already = true; - PaintRoomWithTexture(LabText[BLUE_TEAM],r); - RoomList[special_room_index] = r; - special_room_index++; - } - } - if(dRooms[r].flags&RF_SPECIAL2){ //Red Team Energy Room - if(room_used_already) - { - dRooms[r].flags &= ~RF_SPECIAL2; - dRooms[r].room_change_flags |= RCF_GOALSPECIAL_FLAGS; - } - else{ - TeamOwnedRooms[RED_TEAM]++; - room_used_already = true; - PaintRoomWithTexture(EnergyText[RED_TEAM],r); - RoomList[special_room_index] = r; - special_room_index++; - } - } - if(dRooms[r].flags&RF_SPECIAL5){ //Blue Team Energy Room - if(room_used_already) - { - dRooms[r].flags &= ~RF_SPECIAL5; - dRooms[r].room_change_flags |= RCF_GOALSPECIAL_FLAGS; - } - else{ - TeamOwnedRooms[BLUE_TEAM]++; - room_used_already = true; - PaintRoomWithTexture(EnergyText[BLUE_TEAM],r); - RoomList[special_room_index] = r; - special_room_index++; - } - } - if(dRooms[r].flags&RF_SPECIAL3){ //Red Team Repair Room - if(room_used_already) - { - dRooms[r].flags &= ~RF_SPECIAL3; - dRooms[r].room_change_flags |= RCF_GOALSPECIAL_FLAGS; - } - else{ - TeamOwnedRooms[RED_TEAM]++; - room_used_already = true; - PaintRoomWithTexture(RepairText[RED_TEAM],r); - RoomList[special_room_index] = r; - special_room_index++; - } - } - if(dRooms[r].flags&RF_SPECIAL6){ //Blue Team Repair Room - if(room_used_already) - { - dRooms[r].flags &= ~RF_SPECIAL6; - dRooms[r].room_change_flags |= RCF_GOALSPECIAL_FLAGS; - } - else{ - TeamOwnedRooms[BLUE_TEAM]++; - room_used_already = true; - PaintRoomWithTexture(RepairText[BLUE_TEAM],r); - RoomList[special_room_index] = r; - special_room_index++; - } - } - } - } - - //zero out other arrays - for(i=0;iGetLocalRole()==LR_SERVER){ - //spew 3 virii in each lab - for(i=0;i<3;i++) - OnLabSpewTimer(); - } - - DMFCBase->RequestGameState(); -} - -void OnClientLevelEnd(void) -{ - DMFCBase->OnClientLevelEnd(); -} - - -// A New Player has entered the game, so we want to send him a game status packet that -// has information about the game -void OnGameStateRequest(int player_num) -{ - SendGameStartPacket(player_num); - DMFCBase->OnGameStateRequest(player_num); -} - -// A new player has entered the game, zero there stats out -void OnClientPlayerEntersGame(int player_num) -{ - DMFCBase->OnClientPlayerEntersGame(player_num); - if(player_num!=DMFCBase->GetPlayerNum()) - DisplayWelcomeMessage(player_num); - else - display_my_welcome = true; - - if(player_num!=-1){ - NumberOfKillsSinceLastDeath[player_num] = 0; - } - TimeInRoom[player_num].total_time = 0; - RemoveVirusFromPlayer(player_num,true); -} - -void OnServerPlayerChangeSegment(int player_num,int newseg,int oldseg) -{ - if(player_num==-1){ - DMFCBase->OnServerPlayerChangeSegment(player_num,newseg,oldseg); - return; - } - - //check to make sure it is an 'indoor' room and not terrain - if(!ROOMNUM_OUTSIDE(newseg)) - { - //Check the room flags, see if we entered a special room - room *rp = &dRooms[newseg]; - if(rp->flags&RF_EXTERNAL){ - DMFCBase->OnServerPlayerChangeSegment(player_num,newseg,oldseg); - return; - } - - if( (rp->flags&RF_SPECIAL1) || (rp->flags&RF_SPECIAL2) || (rp->flags&RF_SPECIAL3) || - (rp->flags&RF_SPECIAL4) || (rp->flags&RF_SPECIAL5) || (rp->flags&RF_SPECIAL6) ){ - DMFCBase->CallClientEvent(EVT_CLIENT_GAMEPLAYERCHANGESEG,DMFCBase->GetMeObjNum(),DMFCBase->GetItObjNum(),-1); - DMFCBase->CallOnClientPlayerChangeSegment(player_num,newseg,oldseg); - } - } - - DMFCBase->OnServerPlayerChangeSegment(player_num,newseg,oldseg); -} - -void OnClientPlayerChangeSegment(int player_num,int newseg,int oldseg) -{ - //someone has entered a special room - TimeInRoom[player_num].total_time = 0; - - DMFCBase->OnClientPlayerChangeSegment(player_num,newseg,oldseg); -} - - -// We need to adjust the scores -void OnClientPlayerKilled(object *killer_obj,int victim_pnum) -{ - int kpnum; - - if(victim_pnum!=-1) - RemoveVirusFromPlayer(victim_pnum,true); - - if(killer_obj){ - if((killer_obj->type==OBJ_PLAYER)||(killer_obj->type==OBJ_GHOST)) - kpnum = killer_obj->id; - else if(killer_obj->type==OBJ_ROBOT || (killer_obj->type == OBJ_BUILDING && killer_obj->ai_info)){ - //countermeasure kill - kpnum = DMFCBase->GetCounterMeasureOwner(killer_obj); - }else{ - kpnum = -1; - } - }else - kpnum = -1; - - - if(kpnum!=-1){ - if(kpnum==victim_pnum){ - NumberOfKillsSinceLastDeath[kpnum] = 0; - }else{ - NumberOfKillsSinceLastDeath[kpnum]++; - - if(victim_pnum!=-1) - NumberOfKillsSinceLastDeath[victim_pnum] = 0; - } - }else - { - //this would be the case if the room killed a player - if(victim_pnum!=-1) - NumberOfKillsSinceLastDeath[victim_pnum] = 0; - } - - //TODO: Handle a kill if killed by a room - DMFCBase->OnClientPlayerKilled(killer_obj,victim_pnum); -} - -void OnHUDInterval(void) -{ - dstat->DoFrame(); - DMFCBase->DisplayOutrageLogo(); - - DMFCBase->OnHUDInterval(); -} - -void OnInterval(void) -{ - SortTeamScores(SortedTeams,TeamScore); - //TODO: Correct Sorting based on score - DMFCBase->GetSortedPlayerSlots(SortedPlayers,MAX_PLAYER_RECORDS); - DoIntervalPlayerFrame(); - DMFCBase->OnInterval(); -} - -void OnClientPlayerDisconnect(int pnum) -{ - if(pnum!=-1){ - NumberOfKillsSinceLastDeath[pnum] = 0; - } - DMFCBase->OnClientPlayerDisconnect(pnum); -} - -void OnKeypress(int key) -{ - dllinfo *Data = DMFCBase->GetDLLInfoCallData(); - switch(key){ - case K_F7: - DisplayScoreScreen = !DisplayScoreScreen; - DMFCBase->EnableOnScreenMenu(false); - dstat->Enable(DisplayScoreScreen); - break; - case K_PAGEDOWN: - if(DisplayScoreScreen){ - dstat->ScrollDown(); - Data->iRet = 1; - } - break; - case K_PAGEUP: - if(DisplayScoreScreen){ - dstat->ScrollUp(); - Data->iRet = 1; - } - break; - case K_F6: - DisplayScoreScreen = false; - dstat->Enable(false); - break; - case K_ESC: - if(DisplayScoreScreen){ - dstat->Enable(false); - DisplayScoreScreen = false; - Data->iRet = 1; - } - break; - } - - //if(key==K_E && DMFCBase->GetLocalRole()==LR_SERVER){ - // DMFCBase->StartUIWindow(1); - //} - - DMFCBase->OnKeypress(key); -} - -void OnClientShowUI(int id,void *user_data) -{ - if(id==1) - DoServerConfigureDialog(); - DMFCBase->OnClientShowUI(id,user_data); -} - -void OnServerCollide(object *me_obj,object *it_obj) -{ - if( !me_obj || !it_obj ) - return; - - if(virus_id==-1){ - FatalError("Unable to find Virus Object"); - return; - } - - if( (me_obj->type==OBJ_PLAYER) && (it_obj->type==OBJ_POWERUP) && (it_obj->id==virus_id) ) - { - //determine what to do with this collision - int virus_objnum = it_obj - dObjects; - int virus_team = -1; - int virus_index = -1; - int player_num = me_obj->id; - - //find which team the virus belongs to - for(int v=0;vOnServerCollide(me_obj,it_obj); - DLLSetObjectDeadFlag(it_obj,true,false); - return; - } - - int curr_count = DLLInvGetTypeIDCount(player_num,OBJ_POWERUP,it_obj->id); - if(dPlayers[player_num].team==virus_team){ - //a player has collided with a virus from his team - //see if the player has enough kills to pick up this virus - int max_carry = NumberOfKillsSinceLastDeath[player_num]*VIRUS_PER_KILL; - if(curr_count+1>max_carry){ - //the player can't carry another virii yet - if(player_num==DMFCBase->GetPlayerNum()){ - DLLAddHUDMessage(TXT_CANTCARRY); - }else{ - DMFCBase->SendControlMessageToPlayer(player_num,VIRUS_NOTENOUGHKILLS); - } - }else{ - //pick this guy up - TeamVirii[virus_team][virus_index] = -1; - SendClientPickupVirus(player_num); - DLLSetObjectDeadFlag(it_obj,true,true); - if(snd_virus_pickup!=-1) - { - DLLPlay2dSound(snd_virus_pickup,MAX_GAME_VOLUME); - } - - } - } - else - { - //a player has collided with a virus from another team - //kill this object - TeamVirii[virus_team][virus_index] = -1; - DLLSetObjectDeadFlag(it_obj,true,false); - if(player_num==DMFCBase->GetPlayerNum()) - { - DLLAddHUDMessage(TXT_VIRUSDESTROYED); - if(snd_virus_destroy!=-1) - { - DLLPlay2dSound(snd_virus_destroy,MAX_GAME_VOLUME); - } - } - else - { - DMFCBase->SendControlMessageToPlayer(player_num,VIRUS_DESTROYED); - } - - } - } - - DMFCBase->OnServerCollide(me_obj,it_obj); -} - -void TakeOverRoom(int newteam,int oldteam,int roomnum,int victor) -{ - if(ROOMNUM_OUTSIDE(roomnum)) - { - Int3(); - return; - } - - bool server = false; - bool success = false; - if(DMFCBase->GetLocalRole()==LR_SERVER) - server = true; - - TeamOwnedRooms[newteam]++; - TeamOwnedRooms[oldteam]--; - - tPlayerStat *stat = (tPlayerStat *)DMFCBase->GetPlayerRecordData(victor); - if(stat){ - stat->Score[DSTAT_LEVEL]+=SCORE_PLYR_TAKEOVER_ROOM; - stat->Score[DSTAT_OVERALL]+=SCORE_PLYR_TAKEOVER_ROOM; - TeamScore[DMFCBase->GetPlayerTeam(victor)]+=SCORE_TEAM_TAKEOVER_ROOM; - - if(snd_score!=-1) - { - DLLPlay2dSound(snd_score,MAX_GAME_VOLUME); - } - } - - char room_buf[40]; - - room *rp = &dRooms[roomnum]; - - if(oldteam==RED_TEAM){ - if(rp->flags&RF_SPECIAL1){ - rp->flags &= ~RF_SPECIAL1; - rp->flags |= RF_SPECIAL4; - rp->room_change_flags |= RCF_GOALSPECIAL_FLAGS; - PaintRoomWithTexture(LabText[BLUE_TEAM],roomnum); - if(server) - SendTakeOverPacket(newteam,oldteam,roomnum,victor); - strcpy(room_buf,"Laboratory"); - success = true; - } - if(rp->flags&RF_SPECIAL2){ - rp->flags &= ~RF_SPECIAL2; - rp->flags |= RF_SPECIAL5; - rp->room_change_flags |= RCF_GOALSPECIAL_FLAGS; - PaintRoomWithTexture(EnergyText[BLUE_TEAM],roomnum); - if(server) - SendTakeOverPacket(newteam,oldteam,roomnum,victor); - strcpy(room_buf,"Energy"); - success = true; - } - if(rp->flags&RF_SPECIAL3){ - rp->flags &= ~RF_SPECIAL3; - rp->flags |= RF_SPECIAL6; - rp->room_change_flags |= RCF_GOALSPECIAL_FLAGS; - PaintRoomWithTexture(RepairText[BLUE_TEAM],roomnum); - if(server) - SendTakeOverPacket(newteam,oldteam,roomnum,victor); - strcpy(room_buf,"Repair"); - success = true; - } - }else{ - if(rp->flags&RF_SPECIAL4){ - rp->flags &= ~RF_SPECIAL4; - rp->flags |= RF_SPECIAL1; - rp->room_change_flags |= RCF_GOALSPECIAL_FLAGS; - PaintRoomWithTexture(LabText[RED_TEAM],roomnum); - if(server) - SendTakeOverPacket(newteam,oldteam,roomnum,victor); - strcpy(room_buf,"Laboratory"); - success = true; - } - if(rp->flags&RF_SPECIAL5){ - rp->flags &= ~RF_SPECIAL5; - rp->flags |= RF_SPECIAL2; - rp->room_change_flags |= RCF_GOALSPECIAL_FLAGS; - PaintRoomWithTexture(EnergyText[RED_TEAM],roomnum); - if(server) - SendTakeOverPacket(newteam,oldteam,roomnum,victor); - strcpy(room_buf,"Energy"); - success = true; - } - if(rp->flags&RF_SPECIAL6){ - rp->flags &= ~RF_SPECIAL6; - rp->flags |= RF_SPECIAL3; - rp->room_change_flags |= RCF_GOALSPECIAL_FLAGS; - PaintRoomWithTexture(RepairText[RED_TEAM],roomnum); - if(server) - SendTakeOverPacket(newteam,oldteam,roomnum,victor); - strcpy(room_buf,"Repair"); - success = true; - } - } - - if(!success){ - DLLmprintf((0,"Invalid Takeover!!!!!!!\n")); - return; - } - - //print out hud message (and sound?) - char buffer[256]; - DLLmprintf((0,"old=%d new=%d\n",oldteam,newteam)); - sprintf(buffer,TXT_TAKEOVER,(victor!=-1)?dPlayers[victor].callsign:TXT_NONAME,DMFCBase->GetTeamString(oldteam),room_buf); - DLLAddHUDMessage(buffer); - if(victor!=-1) - RemoveVirusFromPlayer(victor,false); - - if(TeamOwnedRooms[oldteam]<=0){ - TeamScore[newteam]+=SCORE_TEAM_WINSGAME; - Player_who_took_over_last_base = victor; - if(server){ - DMFCBase->EndLevel(); - } - } - - int newlab; - if(!ScanForLaboratory(oldteam,&newlab)){ - //we need to turn newlab into a new laboratory - int flag = 0; - room *rp = &dRooms[newlab]; - if(oldteam==RED_TEAM){ - rp->flags &= ~RF_SPECIAL2; - rp->flags &= ~RF_SPECIAL3; - flag = RF_SPECIAL1; - }else{ - rp->flags &= ~RF_SPECIAL5; - rp->flags &= ~RF_SPECIAL6; - flag = RF_SPECIAL4; - } - rp->flags |= flag; - rp->room_change_flags |= RCF_GOALSPECIAL_FLAGS; - PaintRoomWithTexture(LabText[oldteam],newlab); - } -} - - -void DoPlayerInLab(int pnum,float time) -{ - //nothing to do in here -} - -void DoPlayerInEnergy(int pnum,float time) -{ - //restore player's energy - float amount = REPAIR_RATE*time; - - if(dPlayers[pnum].energy>=ENERGY_CAP) - return; - - if(dPlayers[pnum].energy+amount>ENERGY_CAP) - dPlayers[pnum].energy = ENERGY_CAP; - else - dPlayers[pnum].energy += amount; - - if(dPlayers[pnum].energyGetPlayerNum() && snd_energy_center>=0) - { - DLLPlay2dSound(snd_energy_center); - } -} - -void DoPlayerInRepair(int pnum,float time) -{ - //restore player's shields, give at a rate of 3 per second - float amount = REPAIR_RATE*time; - float curr_shields = dObjects[dPlayers[pnum].objnum].shields; - float max_amount = SHIELD_CAP - curr_shields; - if(amount>max_amount) - amount = max_amount; - if(curr_shields>=SHIELD_CAP) - return; - - DMFCBase->DoDamageToPlayer(pnum,PD_ENERGY_WEAPON,-amount); - - if(amount>0 && pnum==DMFCBase->GetPlayerNum() && snd_repair_center>=0) - { - DLLPlay2dSound(snd_repair_center,MAX_GAME_VOLUME*0.75f); - } -} - -void DoPlayerInEnemy(int pnum,float time) -{ - float damage_amount = DAMAGE_RATE*time; - - if(dPlayers[pnum].flags&PLAYER_FLAGS_DYING || dPlayers[pnum].flags&PLAYER_FLAGS_DEAD) - return; - - //only play sound if player is a client, else do our own sound - //so it isn't framerate dependant - if(DMFCBase->GetLocalRole()==LR_SERVER) - { - if(pnum!=DMFCBase->GetPlayerNum()) - { - DMFCBase->DoDamageToPlayer(pnum,PD_ENERGY_WEAPON,damage_amount,true); - }else - { - DMFCBase->DoDamageToPlayer(pnum,PD_ENERGY_WEAPON,damage_amount,false); - //time to play sound? - float gt = DMFCBase->GetGametime(); - if(gt - Server_last_play_damage_sound > (1.0f/5.0f) )//fake 5pps - { - //time to play sound - Server_last_play_damage_sound = gt; - if(snd_damage!=-1) - { - DLLPlay2dSound(snd_damage); - } - } - } - } - - //check to see if the player has 5 virii in his inventory, if he does, he's - //trying to take over this room - if(DLLInvGetTypeIDCount(pnum,OBJ_POWERUP,virus_id)GetLocalRole()==LR_SERVER){ - int newteam = DMFCBase->GetPlayerTeam(pnum); - int oldteam = (newteam==RED_TEAM)?BLUE_TEAM:RED_TEAM; - int room = dObjects[dPlayers[pnum].objnum].roomnum; - TakeOverRoom(newteam,oldteam,room,pnum); - } - } -} - -void DoIntervalPlayerFrame(void) -{ - static float last_frametime = 0; - static bool update_this_frame = false; - float frametime = 0; - - - if(update_this_frame){ - frametime = last_frametime + DMFCBase->GetFrametime(); - last_frametime = 0; - update_this_frame = false; - }else{ - last_frametime = DMFCBase->GetFrametime(); - update_this_frame = true; - return; - } - - for(int i=0;iCheckPlayerNum(i)){ - if( i==DMFCBase->GetPlayerNum() || DMFCBase->GetLocalRole()==LR_SERVER ){ - - if(dObjects[dPlayers[i].objnum].type!=OBJ_PLAYER) - continue;//only work with OBJ_PLAYERS...this automatically handles observers,dedicated server - - //only need to be here if we are the player that has to do with this - //or we are the server - - //first check to see if this player is in a special room - if(ROOMNUM_OUTSIDE(dObjects[dPlayers[i].objnum].roomnum)) - continue; - - int team = DMFCBase->GetPlayerTeam(i); - room *rp = &dRooms[dObjects[dPlayers[i].objnum].roomnum]; - if(rp->flags&RF_SPECIAL1){ - if(team==RED_TEAM) - DoPlayerInLab(i,frametime); - else - DoPlayerInEnemy(i,frametime); - } - if(rp->flags&RF_SPECIAL2){ - if(team==RED_TEAM) - DoPlayerInEnergy(i,frametime); - else - DoPlayerInEnemy(i,frametime); - } - if(rp->flags&RF_SPECIAL3){ - if(team==RED_TEAM) - DoPlayerInRepair(i,frametime); - else - DoPlayerInEnemy(i,frametime); - } - if(rp->flags&RF_SPECIAL4){ - if(team==BLUE_TEAM) - DoPlayerInLab(i,frametime); - else - DoPlayerInEnemy(i,frametime); - } - if(rp->flags&RF_SPECIAL5){ - if(team==BLUE_TEAM) - DoPlayerInEnergy(i,frametime); - else - DoPlayerInEnemy(i,frametime); - } - if(rp->flags&RF_SPECIAL6){ - if(team==BLUE_TEAM) - DoPlayerInRepair(i,frametime); - else - DoPlayerInEnemy(i,frametime); - } - } - } - } -} - -bool compare_slots(int a,int b) -{ - int ascore,bscore; - player_record *apr,*bpr; - tPlayerStat *as,*bs; - - apr = DMFCBase->GetPlayerRecord(a); - bpr = DMFCBase->GetPlayerRecord(b); - if( !apr ) - return true; - if( !bpr ) - return false; - as = (tPlayerStat *)apr->user_info; - bs = (tPlayerStat *)bpr->user_info; - if( !as ) - return true; - if( !bs ) - return false; - - if( apr->state==STATE_EMPTY ) - return true; - if( bpr->state==STATE_EMPTY ) - return false; - if( (apr->state==STATE_INGAME) && (bpr->state==STATE_INGAME) ){ - //both players were in the game - ascore = as->Score[DSTAT_LEVEL]; - bscore = bs->Score[DSTAT_LEVEL]; - return (ascorestate==STATE_INGAME) && (bpr->state==STATE_DISCONNECTED) ){ - //apr gets priority since he was in the game on exit - return false; - } - if( (apr->state==STATE_DISCONNECTED) && (bpr->state==STATE_INGAME) ){ - //bpr gets priority since he was in the game on exit - return true; - } - //if we got here then both players were disconnected - ascore = as->Score[DSTAT_LEVEL]; - bscore = bs->Score[DSTAT_LEVEL]; - return (ascore=0 && compare_slots(tempsort[j],t); j--){ - tempsort[j+1] = tempsort[j]; - } - // insert - tempsort[j+1] = t; - } - - //copy the array over - memcpy(SortedPlayers,tempsort,MAX_PLAYER_RECORDS*sizeof(int)); - - //Now fill in the final structure of sorted names - int TeamCount[NUM_TEAMS]; - int team; - for(i=0;iGetPlayerRecord(slot); - if(pr && pr->state!=STATE_EMPTY){ - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue;//skip dedicated server - - team = (pr->state==STATE_INGAME)?dPlayers[pr->pnum].team:pr->team; - SortedPLRPlayers[team][TeamCount[team]] = slot; - TeamCount[team]++; - } - } - for(i=0;iOnPLRInit(); -} - -void OnPLRInterval(void) -{ - DMFCBase->OnPLRInterval(); - - int TeamCol = 35; - int NameCol = 165; - int KillsCol = 335; - int DeathsCol = 375; - int SuicidesCol = 425; - int y = 40; - int slot; - player_record *pr; - - DLLgrtext_SetFont((DMFCBase->GetGameFontTranslateArray())[SMALL_UI_FONT_INDEX]); - int height = DLLgrfont_GetHeight((DMFCBase->GetGameFontTranslateArray())[SMALL_UI_FONT_INDEX]) + 1; - - if(Player_who_took_over_last_base!=-1) - { - //print out at the top who took over the last room - int team = (DMFCBase->GetPlayerTeam(Player_who_took_over_last_base)==RED_TEAM)?BLUE_TEAM:RED_TEAM; - DLLgrtext_SetColor(GR_RGB(40,255,40)); - char message[384]; - sprintf(message,"%s successfully took over %s team's last base!",dPlayers[Player_who_took_over_last_base].callsign,DMFCBase->GetTeamString(team)); - DLLgrtext_CenteredPrintf(0,y,message); - y+=height; - } - - //print out header - DLLgrtext_SetColor(GR_RGB(255,255,150)); - DLLgrtext_Printf(NameCol,y,TXT_PILOT); - DLLgrtext_Printf(KillsCol,y,TXT_KILLS); - DLLgrtext_Printf(DeathsCol,y,TXT_DEATHS); - DLLgrtext_Printf(SuicidesCol,y,TXT_SUICIDES); - y+=height; - - tPlayerStat *stat; - bool has_members; - bool doing_connected = true; - -do_disconnected_folk: - - for(int team=0;teamWasPlayerInGameAtLevelEnd(SortedPLRPlayers[team][temp_idx]); - if(pnum==-1) - { - show_team_label = true; - break; - } - temp_idx++; - } - }else - { - show_team_label = true; - } - - if(show_team_label){ - //is there anyone on this team? - DLLgrtext_SetColor(DMFCBase->GetTeamColor(team)); - DLLgrtext_Printf(TeamCol,y,TXT_HUDDISPLAY,DMFCBase->GetTeamString(team),TeamScore[team]); - } - has_members = false; - - for(int index=0;indexGetPlayerRecord(slot); - if(pr && pr->state!=STATE_EMPTY){ - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue;//dedicated server - - int pnum=DMFCBase->WasPlayerInGameAtLevelEnd(slot); - - if( (doing_connected && pnum==-1) || - (!doing_connected && pnum!=-1) ) - continue;//we're not handling them right now - - if(pnum!=-1) - { - DLLgrtext_SetColor(DMFCBase->GetTeamColor(team)); - }else - { - DLLgrtext_SetColor(GR_RGB(128,128,128)); - } - - stat = (tPlayerStat *)pr->user_info; - //valid player - DLLgrtext_Printf(NameCol,y,"%s %d[%d]",pr->callsign,(stat)?stat->Score[DSTAT_LEVEL]:0,(stat)?stat->Score[DSTAT_OVERALL]:0); - DLLgrtext_Printf(KillsCol,y,"%d[%d]",pr->dstats.kills[DSTAT_LEVEL],pr->dstats.kills[DSTAT_OVERALL]); - DLLgrtext_Printf(DeathsCol,y,"%d[%d]",pr->dstats.deaths[DSTAT_LEVEL],pr->dstats.deaths[DSTAT_OVERALL]); - DLLgrtext_Printf(SuicidesCol,y,"%d[%d]",pr->dstats.suicides[DSTAT_LEVEL],pr->dstats.suicides[DSTAT_OVERALL]); - y+=height; - has_members = true; - - if(y>=440) - goto quick_exit; - } - }//end for - //on to the next team - - if(!has_members) - y+=height; //on to the next line - - if(y>=440) - goto quick_exit; - }//end for - - if(doing_connected) - { - doing_connected = false; - goto do_disconnected_folk; - } - -quick_exit:; -} - -void OnControlMessage(ubyte msg,int from_pnum) -{ - switch(msg){ - case VIRUS_NOTENOUGHKILLS: - DLLAddHUDMessage(TXT_CANTCARRY); - break; - case VIRUS_CANTKILL: - DLLAddHUDMessage(TXT_CANTKILLVIRUS); - break; - case VIRUS_DESTROYED: - DLLAddHUDMessage(TXT_VIRUSDESTROYED); - if(snd_virus_destroy!=-1) - { - DLLPlay2dSound(snd_virus_destroy,MAX_GAME_VOLUME); - } - break; - default: - DMFCBase->OnControlMessage(msg,from_pnum); - break; - } -} - -void SaveStatsToFile(char *filename) -{ - CFILE *file; - DLLOpenCFILE(&file,filename,"wt"); - if(!file){ - DLLmprintf((0,"Unable to open output file\n")); - return; - } - - //write out game stats - #define BUFSIZE 150 - char buffer[BUFSIZE]; - char tempbuffer[25]; - int sortedslots[MAX_PLAYER_RECORDS]; - player_record *pr,*dpr; - tPInfoStat stat; - tPlayerStat *st; - int count,length,p; - - //sort the stats - DMFCBase->GetSortedPlayerSlots(sortedslots,MAX_PLAYER_RECORDS); - SortTeamScores(SortedTeams,TeamScore); - count = 1; - - sprintf(buffer,TXT_SAVESTATSA,(DMFCBase->GetNetgameInfo())->name,(DMFCBase->GetCurrentMission())->cur_level); - DLLcf_WriteString(file,buffer); - - for(p=0;pGetTeamString(team_i)); - memcpy(&buffer[0],tempbuffer,strlen(tempbuffer)); - sprintf(tempbuffer,"[%d]",TeamScore[team_i]); - memcpy(&buffer[20],tempbuffer,strlen(tempbuffer)); - buffer[20 + strlen(tempbuffer)] = '\0'; - DLLcf_WriteString(file,buffer); - } - - //Write team members - DLLcf_WriteString(file,""); //blank line - for(int t=0;tGetTeamString(team_i)); - strcat(buffer,":"); - DLLcf_WriteString(file,buffer); - - for(p=0;pGetPlayerRecord(sortedslots[p]); - if( pr && pr->state!=STATE_EMPTY) { - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue;//skip dedicated server - - if (pr->team == team_i) { //Check if current team - sprintf(buffer," %s",pr->callsign); - DLLcf_WriteString(file,buffer); - } - } - } - } - DLLcf_WriteString(file,""); //blank line - - sprintf(buffer,TXT_CURRRANKINGS); - DLLcf_WriteString(file,buffer); - - sprintf(buffer,TXT_SAVESTATSB); - DLLcf_WriteString(file,buffer); - sprintf(buffer,"-----------------------------------------------------------------------------"); - DLLcf_WriteString(file,buffer); - - - for(p=0;pGetPlayerRecord(sortedslots[p]); - if( pr && pr->state!=STATE_EMPTY) { - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue;//skip dedicated server - - st = (tPlayerStat *)pr->user_info; - memset(buffer,' ',BUFSIZE); - - sprintf(tempbuffer,"%d)",count); - memcpy(&buffer[0],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%s%s",(pr->state==STATE_INGAME)?"":"*",pr->callsign); - memcpy(&buffer[5],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d[%d]",(st)?st->Score[DSTAT_LEVEL]:0,(st)?st->Score[DSTAT_OVERALL]:0); - memcpy(&buffer[34],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d[%d]",pr->dstats.kills[DSTAT_LEVEL],pr->dstats.kills[DSTAT_OVERALL]); - memcpy(&buffer[46],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d[%d]",pr->dstats.deaths[DSTAT_LEVEL],pr->dstats.deaths[DSTAT_OVERALL]); - memcpy(&buffer[58],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d[%d]",pr->dstats.suicides[DSTAT_LEVEL],pr->dstats.suicides[DSTAT_OVERALL]); - memcpy(&buffer[69],tempbuffer,strlen(tempbuffer)); - - int pos; - pos = 69 + strlen(tempbuffer) + 1; - if(posGetPlayerRecord(p); - if( pr && pr->state!=STATE_EMPTY) { - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue;//skip dedicated server - - //Write out header - sprintf(buffer,"%d) %s%s",count,(pr->state==STATE_INGAME)?"":"*",pr->callsign); - DLLcf_WriteString(file,buffer); - length = strlen(buffer); - memset(buffer,'=',length); - buffer[length] = '\0'; - DLLcf_WriteString(file,buffer); - - //time in game - sprintf(buffer,TXT_TIMEINGAME,DMFCBase->GetTimeString(DMFCBase->GetTimeInGame(p))); - DLLcf_WriteString(file,buffer); - - if(DMFCBase->FindPInfoStatFirst(p,&stat)){ - sprintf(buffer,TXT_SAVESTATSD); - DLLcf_WriteString(file,buffer); - - if(stat.slot!=p){ - memset(buffer,' ',BUFSIZE); - dpr = DMFCBase->GetPlayerRecord(stat.slot); - int pos; - - if(dpr) - { - sprintf(tempbuffer,"%s",dpr->callsign); - memcpy(buffer,tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d",stat.kills); - memcpy(&buffer[30],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d",stat.deaths); - memcpy(&buffer[40],tempbuffer,strlen(tempbuffer)); - - pos = 40 + strlen(tempbuffer) + 1; - if(posFindPInfoStatNext(&stat)){ - if(stat.slot!=p){ - int pos; - memset(buffer,' ',BUFSIZE); - dpr = DMFCBase->GetPlayerRecord(stat.slot); - - if(dpr) - { - sprintf(tempbuffer,"%s",dpr->callsign); - memcpy(buffer,tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d",stat.kills); - memcpy(&buffer[30],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d",stat.deaths); - memcpy(&buffer[40],tempbuffer,strlen(tempbuffer)); - - pos = 40 + strlen(tempbuffer) + 1; - if(posFindPInfoStatClose(); - DLLcf_WriteString(file,""); //skip a line - count++; - } - } - - //done writing stats - DLLcfclose(file); - DLLAddHUDMessage(TXT_SAVED); -} - -#define ROOTFILENAME "Entropy" -void OnSaveStatsToFile(void) -{ - char filename[256]; - DMFCBase->GenerateStatFilename(filename,ROOTFILENAME,false); - SaveStatsToFile(filename); -} - -void OnLevelEndSaveStatsToFile(void) -{ - char filename[256]; - DMFCBase->GenerateStatFilename(filename,ROOTFILENAME,true); - SaveStatsToFile(filename); -} - -void OnDisconnectSaveStatsToFile(void) -{ - char filename[256]; - DMFCBase->GenerateStatFilename(filename,ROOTFILENAME,false); - SaveStatsToFile(filename); -} - -void DisplayHUDScores(struct tHUDItem *hitem) -{ - if(display_my_welcome) - { - DisplayWelcomeMessage(DMFCBase->GetPlayerNum()); - display_my_welcome = false; - } - - if(DisplayScoreScreen) - return; - - // Display the countdown if there should be one - if(IsPlayerInEnemy(DMFCBase->GetPlayerNum()) && DLLInvGetTypeIDCount(DMFCBase->GetPlayerNum(),OBJ_POWERUP,virus_id)>=MINIMUM_VIRUS_COUNT) - { - float time_remaining = (TAKEOVER_TIME - TimeInRoom[DMFCBase->GetPlayerNum()].total_time); - - int font=(DMFCBase->GetGameFontTranslateArray())[BIG_FONT_INDEX]; - DLLgrtext_SetFont(font); - int fontheight=DLLgrfont_GetHeight(font); - - char buffer[255]; - int max_w=DMFCBase->GetGameWindowW(); - sprintf(buffer,"T - %.1f",(time_remaining>=0)?time_remaining:0); - int lwidth = DLLgrtext_GetTextLineWidth(buffer); - DLLgrtext_SetColor(GR_RGB(40,255,40)); - DLLgrtext_SetAlpha(255); - DLLgrtext_Printf((max_w/2) - (lwidth/2),fontheight*5,buffer); - } - - - int font = (DMFCBase->GetGameFontTranslateArray())[HUD_FONT_INDEX]; - int height = DLLgrfont_GetHeight(font) + 3; - DLLgrtext_SetFont(font); - - int y = (DMFCBase->GetGameWindowH()/2) - ((height*3)/2); - int x = 520; - int team; - ubyte alpha = DMFCBase->ConvertHUDAlpha((ubyte)((DisplayScoreScreen)?128:255)); - - team = DMFCBase->GetMyTeam(); - DLLRenderHUDText(DMFCBase->GetTeamColor(team),alpha,0,x,0,TXT_TEAMINFO,DMFCBase->GetTeamString(team)); - - //determine coordinates to use here - //we'll use a virtual width of 85 pixels on a 640x480 screen - //so first determine the new width - int name_width = 100.0f * DMFCBase->GetHudAspectX(); - int score_width = DLLgrtext_GetTextLineWidth("888"); - int name_x = DMFCBase->GetGameWindowW() - name_width - score_width - 10; - int score_x = DMFCBase->GetGameWindowW() - score_width - 5; - char buffer[256]; - - for(int i=0;iGetMyTeam()) - { - if(Highlight_bmp>BAD_BITMAP_HANDLE){ - //draw the highlite bar in the background - DLLrend_SetAlphaValue(alpha*0.50f); - DLLrend_SetZBufferState (0); - DLLrend_SetTextureType (TT_LINEAR); - DLLrend_SetLighting (LS_NONE); - DLLrend_SetAlphaType (AT_CONSTANT_TEXTURE); - DLLrend_DrawScaledBitmap(name_x-2,y-2,score_x+score_width+2,y+height-1,Highlight_bmp,0,0,1,1,1.0); - DLLrend_SetZBufferState (1); - } - } - - sprintf(buffer,TXT_HUDSCORE,DMFCBase->GetTeamString(team),TeamOwnedRooms[team]); - DMFCBase->ClipString(name_width,buffer,true); - - DLLgrtext_SetAlpha(alpha); - DLLgrtext_SetColor(DMFCBase->GetTeamColor(team)); - DLLgrtext_Printf(name_x,y,buffer); - DLLgrtext_Printf(score_x,y,"[%d]",TeamScore[team]); - - y+=height; - } - DLLgrtext_SetColor(GR_WHITE); - DLLgrtext_Printf(name_x,y,TXT_VIRUSLOAD,DLLInvGetTypeIDCount(DMFCBase->GetPlayerNum(),OBJ_POWERUP,virus_id),(int)(NumberOfKillsSinceLastDeath[DMFCBase->GetPlayerNum()]*VIRUS_PER_KILL)); y+=height; -} - - -// insert sort -#define compGT(a,b) (a < b) -void SortTeamScores(int *sortedindex,int *scores) -{ - int t; - int i, j; - - //copy scores into scoreinfo array - for(i=0;i=0 && compGT(scores[sortedindex[j]],scores[t]); j--) - { - sortedindex[j+1] = sortedindex[j]; - } - - /* insert */ - sortedindex[j+1] = t; - } -} - -void DisplayWelcomeMessage(int player_num) -{ - char name_buffer[64]; - strcpy(name_buffer,(DMFCBase->GetPlayers())[player_num].callsign); - - if(player_num==DMFCBase->GetPlayerNum()) - { - int team = DMFCBase->GetMyTeam(); - if(team==-1) - return; - - DLLAddHUDMessage(TXT_WELCOME,name_buffer); - DLLAddColoredHUDMessage(DMFCBase->GetTeamColor(team),TXT_TEAMJOIN,DMFCBase->GetTeamString(team)); - } - else - { - int team = dPlayers[player_num].team; - if(team==-1) - return; - - DLLAddColoredHUDMessage(DMFCBase->GetTeamColor(team),TXT_JOIN,name_buffer,DMFCBase->GetTeamString(team)); - } -} - - -void OnLabSpewTimer(void) -{ - int max_rooms = DMFCBase->GetHighestRoomIndex() + 1; - int objnum; - int index; - int virus_count; - - for(int r=0;r=MINIMUM_VIRUS_COUNT); - inv_count = MINIMUM_VIRUS_COUNT; - } - - for(int i=0;iflags&flag){ - //we found a lab - return true; - } - if( (rp->flags&ef) && (!found) ){ - found = true; - *newlab = RoomList[r]; - } - if( (rp->flags&rf) && (!found) ){ - found = true; - *newlab = RoomList[r]; - } - } - return false; -} - -bool CompareDistanceTravel(vector *curr_pos,vector *last_pos) -{ - vector result; - float a,b,c,bc,dist; - - result.x = curr_pos->x - last_pos->x; - result.y = curr_pos->y - last_pos->y; - result.z = curr_pos->z - last_pos->z; - - a = fabs(result.x); - b = fabs(result.y); - c = fabs(result.z); - - if (a < b) { - float t=a; a=b; b=t; - } - - if (b < c) { - float t=b; b=c; c=t; - - if (a < b) { - float t=a; a=b; b=t; - } - } - - bc = (b/4) + (c/8); - - dist = a + bc + (bc/2); - - if(dist>5){ - memcpy(last_pos,curr_pos,sizeof(vector)); - return false; - }else{ - return true; - } -} - -bool IsPlayerInEnemy(int pnum) -{ - if(!DMFCBase->CheckPlayerNum(pnum)) - return false; - - if(dObjects[dPlayers[pnum].objnum].type!=OBJ_PLAYER) - return false;//only work with OBJ_PLAYERS...this automatically handles observers,dedicated server - - //first check to see if this player is in a special room - if(ROOMNUM_OUTSIDE(dObjects[dPlayers[pnum].objnum].roomnum)) - return false; - - int team = DMFCBase->GetPlayerTeam(pnum); - room *rp = &dRooms[dObjects[dPlayers[pnum].objnum].roomnum]; - - if(team!=RED_TEAM) - { - if( (rp->flags&RF_SPECIAL1) || (rp->flags&RF_SPECIAL2) || (rp->flags&RF_SPECIAL3) ) - { - return true; - } - } - - if(team!=BLUE_TEAM) - { - if( (rp->flags&RF_SPECIAL4) || (rp->flags&RF_SPECIAL5) || (rp->flags&RF_SPECIAL6) ) - { - return true; - } - } - - return false; -} - -void OnGetTokenString(char *src,char *dest,int dest_size) -{ - if(!stricmp(src,"virus")) - { - int count = DLLInvGetTypeIDCount(DMFCBase->GetPlayerNum(),OBJ_POWERUP,virus_id); - char buffer[100]; - sprintf(buffer,"%d",count); - strncpy(dest,buffer,dest_size-1); - dest[dest_size-1] = '\0'; - return; - } - - DMFCBase->OnGetTokenString(src,dest,dest_size); -} - -void OnPrintScores(int level) -{ - char buffer[256]; - char name[70]; - int t,i; - int pos[6]; - int len[6]; - - netplayer *dNetPlayers = DMFCBase->GetNetPlayers(); - - for(i=0;iGetTeamString(i),TeamScore[i]); - DPrintf(buffer); - } - - memset(buffer,' ',256); - - pos[0] = 0; t = len[0] = 30; //give ample room for pilot name - pos[1] = pos[0] + t + 1; t = len[1] = strlen(TXT_SCORE); - pos[2] = pos[1] + t + 1; t = len[2] = strlen(TXT_KILLS_SHORT); - pos[3] = pos[2] + t + 1; t = len[3] = strlen(TXT_DEATHS_SHORT); - pos[4] = pos[3] + t + 1; t = len[4] = strlen(TXT_SUICIDES_SHORT); - pos[5] = pos[4] + t + 1; t = len[5] = strlen(TXT_PING); - - memcpy(&buffer[pos[0]],TXT_PILOT,strlen(TXT_PILOT)); - memcpy(&buffer[pos[1]],TXT_SCORE,len[1]); - memcpy(&buffer[pos[2]],TXT_KILLS_SHORT,len[2]); - memcpy(&buffer[pos[3]],TXT_DEATHS_SHORT,len[3]); - memcpy(&buffer[pos[4]],TXT_SUICIDES_SHORT,len[4]); - memcpy(&buffer[pos[5]],TXT_PING,len[5]); - buffer[pos[5]+len[5]+1] = '\n'; - buffer[pos[5]+len[5]+2] = '\0'; - DPrintf(buffer); - - int slot; - player_record *pr; - int pcount; - - if(level<0 || level>=MAX_PLAYER_RECORDS) - pcount = MAX_PLAYER_RECORDS; - else - pcount = level; - - int sortedplayers[MAX_PLAYER_RECORDS]; - - DMFCBase->GetSortedPlayerSlots(sortedplayers,MAX_PLAYER_RECORDS); - - for(i=0;iGetPlayerRecord(slot); - if((pr)&&(pr->state!=STATE_EMPTY)){ - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue; //skip dedicated server - - sprintf(name,"%s%s: %.8s",(pr->state==STATE_DISCONNECTED)?"*":"",pr->callsign,DMFCBase->GetTeamString(pr->team)); - name[29] = '\0'; - - tPlayerStat *stat; - stat = (tPlayerStat *)pr->user_info; - - memset(buffer,' ',256); - t = strlen(name); memcpy(&buffer[pos[0]],name,(tScore[DSTAT_LEVEL]:0); - t = strlen(name); memcpy(&buffer[pos[1]],name,(tdstats.kills[DSTAT_LEVEL]); - t = strlen(name); memcpy(&buffer[pos[2]],name,(tdstats.deaths[DSTAT_LEVEL]); - t = strlen(name); memcpy(&buffer[pos[3]],name,(tdstats.suicides[DSTAT_LEVEL]); - t = strlen(name); memcpy(&buffer[pos[4]],name,(tstate==STATE_INGAME) - sprintf(name,"%.0f",dNetPlayers[pr->pnum].ping_time*1000.0f); - else - strcpy(name,"---"); - t = strlen(name); memcpy(&buffer[pos[5]],name,(t -* -* $Log: not supported by cvs2svn $ - * - * 10 5/21/99 10:03a Jeff - * hopefully filled in any remaining gaps related to have more than you - * can carry virus loads - * - * 9 5/12/99 11:04p Jeff - * dmfc and multiplayer games now have endian friendly packets (*whew*) - * - * 8 5/12/99 11:28a Jeff - * added sourcesafe comment block -* -* $NoKeywords: $ -*/ - - - -#include "gamedll_header.h" -#include -#include "idmfc.h" -#include "Entropystr.h" -#include "EntropyAux.h" - -extern IDMFC *DMFCBase; -extern room *dRooms; -extern object *dObjects; - -void SendTakeOverPacket(int newteam,int oldteam,int room,int victor) -{ - int count = 0; - - ubyte data[MAX_GAME_DATA_SIZE]; - DMFCBase->StartPacket(data,SPID_TAKEOVER,&count); - - MultiAddByte(newteam,data,&count); - MultiAddByte(oldteam,data,&count); - MultiAddByte(victor,data,&count); - MultiAddInt(room,data,&count); - - DMFCBase->SendPacket(data,count,SP_ALL); -} - -void ReceiveTakeOverPacket(ubyte *data) -{ - ubyte newteam,oldteam; - int room; - int count = 0; - int victor; - - newteam = MultiGetByte(data,&count); - oldteam = MultiGetByte(data,&count); - victor = MultiGetByte(data,&count); - room = MultiGetInt(data,&count); - TakeOverRoom(newteam,oldteam,room,victor); -} - -void RemoveVirusFromPlayer(int player_num,bool remove_all); - -//Handles when we get a new player packet -void GetGameStartPacket(ubyte *data) -{ - int i,count = 0; - - for(i=0;iStartPacket(data,SPID_NEWPLAYER,&count); - - for(i=0;iCheckPlayerNum(i)) - { - MultiAddByte(1,data,&count); - MultiAddInt(NumberOfKillsSinceLastDeath[i],data,&count); - MultiAddInt(DLLInvGetTypeIDCount(i,OBJ_POWERUP,virus_id),data,&count); - }else - { - MultiAddByte(0,data,&count); - } - } - - for(i=0;iSendPacket(data,count,pnum); - - //send over the rest - SendRoomInfo(pnum); -} - -void SendClientPickupVirus(int player_num) -{ - int start,count = 0; - ubyte data[MAX_GAME_DATA_SIZE]; - DMFCBase->StartPacket(data,SPID_PICKUPVIRUS,&count); - start = count; - - MultiAddByte(player_num,data,&count); - ReceivePickupVirus(&data[start]); - DMFCBase->SendPacket(data,count,SP_ALL); -} - -void ReceivePickupVirus(ubyte *data) -{ - int player_num,count = 0; - player_num = MultiGetByte(data,&count); - - DLLInvAddTypeID(player_num,OBJ_POWERUP,virus_id,-1,-1,0,TXT_VIRUS); - - if(player_num==DMFCBase->GetPlayerNum()) - { - DLLAddHUDMessage(TXT_PICKUPVIRUS); - } -} - -#define RT_REDLAB 0 -#define RT_REDREP 1 -#define RT_REDENG 2 -#define RT_BLULAB 3 -#define RT_BLUREP 4 -#define RT_BLUENG 5 - -void SendRoomInfo(int pnum) -{ - char *room_info; - int flags,r,i; - room_info = (char *)malloc(sizeof(char)*RoomCount); - if(!room_info) - return; - - for(r=0;rStartPacket(data,SPID_ROOMINFO,&count); - - for(i=0;iSendPacket(data,count,pnum); - - free(room_info); -} - -void ReceiveRoomInfo(ubyte *data) -{ - int i,count = 0; - int flag; - char *room_info; - room_info = (char *)malloc(sizeof(char)*RoomCount); - if(!room_info){ - FatalError("Out of Memory"); - return; - } - - for(i=0;iflags &= ~RF_SPECIAL1; - rp->flags &= ~RF_SPECIAL2; - rp->flags &= ~RF_SPECIAL3; - rp->flags &= ~RF_SPECIAL4; - rp->flags &= ~RF_SPECIAL5; - rp->flags &= ~RF_SPECIAL6; - rp->flags |= flag; - rp->room_change_flags |= RCF_GOALSPECIAL_FLAGS; - } - free(room_info); - - for(i=0;iStartPacket(data,SPID_VIRUSCREATE,&count); - start = count; - - int objnum = obj-dObjects; - MultiAddInt(objnum,data,&count); - DoVirusCreate(&data[start]); - DMFCBase->SendPacket(data,count,SP_ALL); -} - -void DoVirusCreate(ubyte *data) -{ - int s_objnum,l_objnum,count=0; - - s_objnum = MultiGetInt(data,&count); - - l_objnum = DMFCBase->ConvertServerToLocalObjnum(s_objnum); - - if(l_objnum!=-1) - { - DLLCreateRandomSparks(rand()%150+100,&dObjects[l_objnum].pos,dObjects[l_objnum].roomnum,HOT_SPARK_INDEX,(rand()%3)+2); - } -} \ No newline at end of file diff --git a/entropy/EntropyRoom.cpp b/entropy/EntropyRoom.cpp deleted file mode 100644 index 86d14e65..00000000 --- a/entropy/EntropyRoom.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/* -* $Logfile: /DescentIII/Main/entropy/EntropyRoom.cpp $ -* $Revision: 1.1.1.1 $ -* $Date: 2003-08-26 03:57:41 $ -* $Author: kevinb $ -* -* -* -* $Log: not supported by cvs2svn $ - * - * 15 10/21/99 9:28p Jeff - * B.A. Macintosh code merge - * - * 14 5/19/99 3:24p Jason - * fixed wrong ordering of InitObjectScripts and MultiSendObject - * - * 13 5/19/99 2:42a Jeff - * call correct NewUIGameWindow functions - * - * 12 5/12/99 11:28a Jeff - * added sourcesafe comment block -* -* $NoKeywords: $ -*/ - - - -#include "gamedll_header.h" -#include -#include -#include -#include -#include -#include "idmfc.h" -#include "Entropystr.h" -#include "EntropyAux.h" - -extern IDMFC *DMFCBase; -extern room *dRooms; -extern object *dObjects; - -#ifdef MACINTOSH -#pragma export on -#endif - -bool PaintRoomWithTexture(int text,int roomnum) -{ - if(ROOMNUM_OUTSIDE(roomnum)) - { - Int3(); - return false; - } - - ASSERT( (roomnum>=0) && (roomnum<=DMFCBase->GetHighestRoomIndex()) ); - if( (roomnum<0) || (roomnum>DMFCBase->GetHighestRoomIndex()) ) - return false; - - if(dRooms[roomnum].flags&RF_EXTERNAL) - return false; - - bool has_goalfaces=false; - int t; - for (t=0;tGetGameTextures(); - dRooms[roomnum].room_change_flags |= RCF_TEXTURE; - - for (t=0;tflags & TF_ALPHA)) && texp->r<.01 && texp->g<.01 && texp->b<.01) - { - if (!has_goalfaces || (dRooms[roomnum].faces[t].flags & FF_GOALFACE)) - { - dRooms[roomnum].faces[t].tmap=text; - dRooms[roomnum].faces[t].flags |= FF_TEXTURE_CHANGED; - } - } - } - return true; -} - -int SpewObjectInRoom(int type,int id,int roomnum) -{ - if(DMFCBase->GetLocalRole()!=LR_SERVER) - return -1; - - vector vpos; - int objnum; - - DLLComputeRoomCenter(&vpos,&dRooms[roomnum]); - objnum = DLLObjCreate(type,id,roomnum,&vpos,NULL); - if(objnum==-1) - return -1; - - object *obj=&dObjects[objnum]; - - ASSERT(obj->movement_type == MT_PHYSICS); - if(obj->movement_type!=MT_PHYSICS) - return -1; - - //Set random velocity for powerups - obj->mtype.phys_info.velocity.x = ((float) rand() / RAND_MAX) * 20.0; - obj->mtype.phys_info.velocity.z = ((float) rand() / RAND_MAX) * 20.0; - obj->mtype.phys_info.velocity.y = ((float) rand() / RAND_MAX) * 20.0; - - DLLMultiSendObject(obj,0); - - DLLInitObjectScripts (obj,true); - - SendVirusCreate(obj); - - return objnum; -} - -void DoServerConfigureDialog(void) -{ - if(DMFCBase->GetLocalRole()!=LR_SERVER) - return; - - char tempbuffer[20]; - bool exit_menu = false; - - void *start_game_text_off= DLLCreateNewUITextItem(TXT_STARTGAME,GR_WHITE); - void *start_game_text_on= DLLCreateNewUITextItem(TXT_STARTGAME,GR_RED); - void *virus_pk_text = DLLCreateNewUITextItem(TXT_VIRUSCREDIT,GR_WHITE); - - void *main_wnd = DLLNewUIGameWindowCreate(0,0,256,256,UIF_PROCESS_ALL|UIF_CENTER); - - int cury = 20; - void *virus_pk_edit = DLLEditCreate(main_wnd,13,40,cury,80,15,0); cury+=35; - void *start_game_hs = DLLHotSpotCreate(main_wnd,UID_OK,K_ENTER,start_game_text_off,start_game_text_on,40,cury,130,15,0); cury+=20; - - sprintf(tempbuffer,"%d",2); - DLLEditSetText(virus_pk_edit,tempbuffer); - - DLLNewUIGameWindowOpen(main_wnd); - - while (!exit_menu) - { - int res; - res = DLLPollUI(); - - if(res==-1) - continue; - - // handle all UI results. - switch(res) - { - case NEWUIRES_FORCEQUIT: - exit_menu = true; - break; - case 13: //virus_pk edit - break; - case UID_OK: //start game - exit_menu = true; - DLLEditGetText(virus_pk_edit,tempbuffer,20); - int newpk = atoi(tempbuffer); - DLLmprintf((0,"New Virus/Kill = %d\n",newpk)); - break; - }; - } - DLLNewUIGameWindowClose(main_wnd); - DLLNewUIGameWindowDestroy(main_wnd); - - DLLRemoveUITextItem(start_game_text_on); - DLLRemoveUITextItem(start_game_text_off); - DLLRemoveUITextItem(virus_pk_text); - - DLLDeleteUIItem(main_wnd); - DLLDeleteUIItem(virus_pk_edit); - DLLDeleteUIItem(start_game_hs); -} -#ifdef MACINTOSH -#pragma export off -#endif diff --git a/entropy/Entropystr.h b/entropy/Entropystr.h deleted file mode 100644 index a81c2213..00000000 --- a/entropy/Entropystr.h +++ /dev/null @@ -1,50 +0,0 @@ -//Defines for indexes into the string table for in-code strings - -#ifndef __STRING_TABLE____ -#define __STRING_TABLE____ - -#define TXT(index) GetStringFromTable(index) - -//Returns a pointer to the string at the index location from the string table -//if it is a bad index given, then the pointer to the error string "ERROR MISSING STRING" is given - -char *GetStringFromTable(int index); - -#define TXT_GAMENAME TXT(0) //"Entropy" -#define TXT_KILLA TXT(1) //"%s was killed by %s" -#define TXT_SUICIDEA TXT(2) //"%s killed himself" -#define TXT_PILOT TXT(3) //"Pilot" -#define TXT_SCORE TXT(4) //"Score" -#define TXT_KILLS TXT(5) //"Kills" -#define TXT_DEATHS TXT(6) //"Deaths" -#define TXT_SUICIDES TXT(7) //"Suicides" -#define TXT_PING TXT(8) //"Ping" -#define TXT_CANTCARRY TXT(9) //"You can't carry this virus yet" -#define TXT_VIRUSDESTROYED TXT(10) //"Virus Destroyed" -#define TXT_CANTKILLVIRUS TXT(11) //"You can't kill this virus" -#define TXT_TAKEOVER TXT(12) //"%s Took Over A %s Team's %s Room" -#define TXT_NONAME TXT(13) //"Someone" -#define TXT_HUDDISPLAY TXT(14) //"%s Team: %d" -#define TXT_SAVESTATSA TXT(15) //"Entropy\nGame: %s\nLevel: %d\n" -#define TXT_TEAMINFO TXT(16) //"%s Team" -#define TXT_CURRRANKINGS TXT(17) //"Current Level Rankings\n" -#define TXT_SAVESTATSB TXT(18) //"Rank Name Score Kills Deaths Suicides" -#define TXT_SAVESTATSC TXT(19) //"\nIndividual Stats\n" -#define TXT_TIMEINGAME TXT(20) //"Total Time In Game: %s" -#define TXT_SAVESTATSD TXT(21) //"Callsign: Kills: Deaths:" -#define TXT_HUDSCORE TXT(22) //"%s Team(%d)" -#define TXT_VIRUSLOAD TXT(23) //"Virus Load: %d/%d" -#define TXT_WELCOME TXT(24) //"Welcome To Entropy, %s" -#define TXT_TEAMJOIN TXT(25) //"You're on the %s Team" -#define TXT_JOIN TXT(26) //"%s Has Joined The %s Team" -#define TXT_SAVED TXT(27) //"Stats saved" -#define TXT_STARTGAME TXT(28) //"Start Game" -#define TXT_VIRUSCREDIT TXT(29) //"Virus Credit/Kill" -#define TXT_STATSGAMENAME TXT(30) //"Entropy" -#define TXT_VIRUS TXT(31) //"Virus" -#define TXT_PICKUPVIRUS TXT(32) //"You picked up a virus" -#define TXT_KILLS_SHORT TXT(33) //"K" -#define TXT_DEATHS_SHORT TXT(34) //"D" -#define TXT_SUICIDES_SHORT TXT(35) //"S" - -#endif diff --git a/entropy/Makefile b/entropy/Makefile deleted file mode 100644 index 11baffb4..00000000 --- a/entropy/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -include ../../default.mak - -OBJS = EntropyBase.o EntropyPackets.o EntropyRoom.o -REFS = EntropyBase.cpp EntropyPackets.cpp EntropyRoom.cpp -LIBNAME = ../../netgames/entropy.d3m - -CDLFLAGS = $(CFLAGS) -fPIC -LDLFLAGS = -shared -ldl -lm - -all: depall $(OBJS) - gcc $(LDLFLAGS) -o $(LIBNAME) $(OBJS) /usr/lib/dmfc.so - -depall: - $(CC) -E -M $(CFLAGS) $(DEFINES) $(REFS) > .depend - -clean: - rm -f $(OBJS) *~ $(LIBNAME) core - -%.o: %.cpp - $(CC) $(CDLFLAGS) $(DEFINES) -c $< -o $@ - -ifeq (.depend,$(wildcard .depend)) -include .depend -endif diff --git a/hoard/Hoard.h b/hoard/Hoard.h deleted file mode 100644 index 8e80281f..00000000 --- a/hoard/Hoard.h +++ /dev/null @@ -1,144 +0,0 @@ -#ifndef __HOARD_APP_H_ -#define __HOARD_APP_H_ - -#include "osiris_share.h" -#include "d3events.h" - -void HoardGameInit(int teams); - -//!!!!!!!ADD YOUR EVENT HANDLER OVERRIDES HERE!!!!!!!!!!! -void OnInterval(void); -void OnHUDInterval(void); -void OnKeypress(int key); -void OnServerGameCreated(void); -void OnClientLevelStart(void); -void OnClientLevelEnd(void); -void OnGameStateRequest(int player_num); -void OnPlayerConnect(int player_num); -void OnServerPlayerChangeSegment(int player_num,int newseg,int oldseg); -void OnClientPlayerChangeSegment(int player_num,int newseg,int oldseg); -void OnServerCollide(object *me_obj,object *it_obj); -void OnClientCollide(object *me_obj,object *it_obj); -void OnClientPlayerKilled(object *killer_obj,int victim_pnum); -void OnPLRInterval(void); -void OnPrintScores(int level); -void OnPLRInit(void); -void OnSaveStatsToFile(void); -void OnClientShowUI(int id,void *user_data); -void OnDisconnectSaveStatsToFile(void); -void OnLevelEndSaveStatsToFile(void); -extern IDMFC *DMFCBase; - -/************************************************************************************************* - *The following functions and declaration are needed to connect the DLL to the game. These must * - *stay here and must call the functions that are in them. You can not delete from here, but you * - *can add to it no problem * - ************************************************************************************************* -*/ -// These next two function prototypes MUST appear in the extern "C" block if called -// from a CPP file. -#ifdef __cplusplus -extern "C" -{ -#endif - DLLEXPORT void DLLFUNCCALL DLLGameInit (int *api_func,ubyte *all_ok,int num_teams_to_use); - DLLEXPORT void DLLFUNCCALL DLLGameCall (int eventnum,dllinfo *data); - DLLEXPORT void DLLFUNCCALL DLLGameClose (); - DLLEXPORT void DLLFUNCCALL DLLGetGameInfo (tDLLOptions *options); - DLLEXPORT int DLLFUNCCALL GetGOScriptID(char *name,ubyte isdoor); - DLLEXPORT void DLLFUNCCALLPTR CreateInstance(int id); - DLLEXPORT void DLLFUNCCALL DestroyInstance(int id,void *ptr); - DLLEXPORT short DLLFUNCCALL CallInstanceEvent(int id,void *ptr,int event,tOSIRISEventInfo *data); - DLLEXPORT int DLLFUNCCALL SaveRestoreState( void *file_ptr, ubyte saving_state ); -#ifdef __cplusplus -} -#endif - -#ifdef MACINTOSH -#pragma export on -#endif - -// The main entry point where the game calls the dll -void DLLFUNCCALL DLLGameCall (int eventnum,dllinfo *data) -{ - if((eventnumGetLocalRole()!=LR_SERVER)){ - return; - } - - DMFCBase->TranslateEvent(eventnum,data); -} - -// GetGOScriptID -// Purpose: -// Given the name of the object (from it's pagename), this function will search through it's -// list of General Object Scripts for a script with a matching name (to see if there is a script -// for that type/id of object within this DLL). If a matching scriptname is found, a UNIQUE ID -// is to be returned back to Descent 3. This ID will be used from here on out for all future -// interaction with the DLL. Since doors are not part of the generic object's, it's possible -// for a door to have the same name as a generic object (OBJ_POWERUP, OBJ_BUILDING, OBJ_CLUTTER -// or OBJ_ROBOT), therefore, a 1 is passed in for isdoor if the given object name refers to a -// door, else it is a 0. The return value is the unique identifier, else -1 if the script -// does not exist in the DLL. -int DLLFUNCCALL GetGOScriptID(char *name,ubyte isdoor) -{ - return -1; -} - -// CreateInstance -// Purpose: -// Given an ID from a call to GetGOScriptID(), this function will create a new instance for that -// particular script (by allocating and initializing memory, etc.). A pointer to this instance -// is to be returned back to Descent 3. This pointer will be passed around, along with the ID -// for CallInstanceEvent() and DestroyInstance(). Return NULL if there was an error. -void DLLFUNCCALLPTR CreateInstance(int id) -{ - return NULL; -} - -// DestroyInstance -// Purpose: -// Given an ID, and a pointer to a particular instance of a script, this function will delete and -// destruct all information associated with that script, so it will no longer exist. -void DLLFUNCCALL DestroyInstance(int id,void *ptr) -{ -} - -// CallInstanceEvent -// Purpose: -// Given an ID, a pointer to a script instance, an event and a pointer to the struct of -// information about the event, this function will translate who this event belongs to and -// passes the event to that instance of the script to be handled. Return a combination of -// CONTINUE_CHAIN and CONTINUE_DEFAULT, to give instructions on what to do based on the -// event. CONTINUE_CHAIN means to continue through the chain of scripts (custom script, level -// script, mission script, and finally default script). If CONTINUE_CHAIN is not specified, -// than the chain is broken and those scripts of lower priority will never get the event. Return -// CONTINUE_DEFAULT in order to tell D3 if you want process the normal action that is built into -// the game for that event. This only pertains to certain events. If the chain continues -// after this script, than the CONTINUE_DEFAULT setting will be overridden by lower priority -// scripts return value. -short DLLFUNCCALL CallInstanceEvent(int id,void *ptr,int event,tOSIRISEventInfo *data) -{ - return CONTINUE_CHAIN|CONTINUE_DEFAULT; -} - -// SaveRestoreState -// Purpose: -// This function is called when Descent 3 is saving or restoring the game state. In this function -// you should save/restore any global data that you want preserved through load/save (which includes -// demos). You must be very careful with this function, corrupting the file (reading or writing too -// much or too little) may be hazardous to the game (possibly making it impossible to restore the -// state). It would be best to use version information to keep older versions of saved states still -// able to be used. IT IS VERY IMPORTANT WHEN SAVING THE STATE TO RETURN THE NUMBER OF _BYTES_ WROTE -// TO THE FILE. When restoring the data, the return value is ignored. saving_state is 1 when you should -// write data to the file_ptr, 0 when you should read in the data. -int DLLFUNCCALL SaveRestoreState( void *file_ptr, ubyte saving_state ) -{ - return 0; -} - -#ifdef MACINTOSH -#pragma export off -#endif - - -#endif diff --git a/hoard/Makefile b/hoard/Makefile deleted file mode 100644 index 55a98599..00000000 --- a/hoard/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -include ../../default.mak - -OBJS = hoard.o hoard_ui.o -REFS = hoard.cpp hoard_ui.cpp -LIBNAME = ../../netgames/hoard.d3m - -CDLFLAGS = $(CFLAGS) -fPIC -LDLFLAGS = -shared -ldl -lm - -all: depall $(OBJS) - gcc $(LDLFLAGS) -o $(LIBNAME) $(OBJS) /usr/lib/dmfc.so - -depall: - $(CC) -E -M $(CFLAGS) $(DEFINES) $(REFS) > .depend - -clean: - rm -f $(OBJS) *~ $(LIBNAME) core - -%.o: %.cpp - $(CC) $(CDLFLAGS) $(DEFINES) -c $< -o $@ - -ifeq (.depend,$(wildcard .depend)) -include .depend -endif diff --git a/hoard/hoard.cpp b/hoard/hoard.cpp deleted file mode 100644 index 24496c29..00000000 --- a/hoard/hoard.cpp +++ /dev/null @@ -1,1553 +0,0 @@ -/* -* $Logfile: /DescentIII/Main/hoard/hoard.cpp $ -* $Revision: 1.1.1.1 $ -* $Date: 2003-08-26 03:57:53 $ -* $Author: kevinb $ -* -* -* -* $Log: not supported by cvs2svn $ - * - * 91 10/21/99 9:27p Jeff - * B.A. Macintosh code merge - * - * 90 8/11/99 6:37p Jeff - * added input command for min count to score - * - * 89 7/12/99 1:22p Jeff - * updated for new netflags - * - * 88 7/12/99 1:16p Jeff - * fixed bug when a player dies they sometimes pickup their orb - * - * 87 7/11/99 6:44p Jeff - * cleaner plr if the list is too long - * - * 86 5/23/99 3:08a Jeff - * fixed stats display - * - * 85 5/23/99 3:04a Jason - * fixed bug with player rankings not being updated correctly - * - * 84 5/20/99 9:40p Jeff - * fixed hardlock for a client just joining the game if someone has a - * hoard orb - * - * 83 5/12/99 11:04p Jeff - * dmfc and multiplayer games now have endian friendly packets (*whew*) - * - * 82 5/12/99 11:28a Jeff - * added sourcesafe comment block -* -* $NoKeywords: $ -*/ - - - -#include "gamedll_header.h" -#include -#include "idmfc.h" -#include "Hoard.h" -#include "hoardstr.h" -#include "hoardaux.h" - -IDMFC *DMFCBase = NULL; -IDmfcStats *dstat = NULL; -IMenuItem *OSMenuSave = NULL; -object *dObjects = NULL; -player *dPlayers = NULL; - -#define SPID_INVINFO 1 //packet for hoard inventory info -#define SPID_GAMECONFIG 2 - -#define HOARD_CONFIG_DLG 1234 -#define HCM_PLAYERCOLOR 0 -#define HCM_NORMAL 1 - -typedef struct{ - int Score[2]; - int HighestScore[2]; -}tPlayerStat; -int pack_pstat(tPlayerStat *user_info,ubyte *data) -{ - int count = 0; - MultiAddInt(user_info->Score[0],data,&count); - MultiAddInt(user_info->Score[1],data,&count); - MultiAddInt(user_info->HighestScore[0],data,&count); - MultiAddInt(user_info->HighestScore[1],data,&count); - return count; -} - -int unpack_pstat(tPlayerStat *user_info,ubyte *data) -{ - int count = 0; - user_info->Score[0] = MultiGetInt(data,&count); - user_info->Score[1] = MultiGetInt(data,&count); - user_info->HighestScore[0] = MultiGetInt(data,&count); - user_info->HighestScore[1] = MultiGetInt(data,&count); - return count; -} - - -tGameConfig config; - -int SortedPlayers[MAX_PLAYER_RECORDS]; //sorted player nums -bool DisplayScoreScreen; -int HoardID = 0; -int HoardOrbIcon = BAD_BITMAP_HANDLE; -bool DisplayBlink = true; -int WhoJustScored = -1; -int WhoJustScoredTimer = -1; -ubyte HUD_color_model = HCM_PLAYERCOLOR; -int Highlight_bmp = -1; -bool display_my_welcome = false; - -void OnTimer(void); -void OnTimerKill(void); -void DisplayWelcomeMessage(int player_num); -void DisplayHUDScores(struct tHUDItem *hitem); -void SortPlayerScores(int *sortedindex,int size); -void DisplayWelcomeMessage(int player_num); -void DoBallsEffect(int i,int count); -void ReceiveHoardInv(ubyte *data); -void SendHoardInv(int playernum); -void SaveStatsToFile(char *filename); -void ReceiveGameConfig(ubyte *data); -void OnClientPlayerEntersGame(int player_num); - -// Displays the Hoard game configuration dialog (Server) -void DisplayHoardConfigDialog(tGameConfig *); -bool Config_displayed = false; - -/////////////////////////////////////////////// -//localization info -char **StringTable; -int StringTableSize = 0; -char *_ErrorString = "Missing String"; -char *GetStringFromTable(int d){if( (d<0) || (d>=StringTableSize) ) return _ErrorString; else return StringTable[d];} -/////////////////////////////////////////////// - -#ifdef MACINTOSH -#pragma export on -#endif - -// This function gets called by the game when it wants to learn some info about the game -void DLLFUNCCALL DLLGetGameInfo (tDLLOptions *options) -{ - options->flags = DOF_MAXTEAMS; - options->max_teams = 1; - strcpy(options->game_name,TXT_GAMENAME); - strcpy(options->requirements,"MINGOALS1"); -} - -void DetermineScore(int precord_num,int column_num,char *buffer,int buffer_size) -{ - player_record *pr = DMFCBase->GetPlayerRecord(precord_num); - if(!pr || pr->state==STATE_EMPTY){ - buffer[0] = '\0'; - return; - } - tPlayerStat *stat = (tPlayerStat *)pr->user_info; - - if(column_num==2){ - //Score - sprintf(buffer,"%d[%d]", stat->Score[DSTAT_LEVEL],stat->Score[DSTAT_OVERALL]); - }else{ - //Highest Score - sprintf(buffer,"%d[%d]", stat->HighestScore[DSTAT_LEVEL],stat->HighestScore[DSTAT_OVERALL]); - } -} - -void ShowStatBitmap(int precord_num,int column_num,int x,int y,int w,int h,ubyte alpha_to_use) -{ - player_record *pr = DMFCBase->GetPlayerRecord(precord_num); - float ratio = DEFAULT_HUD_WIDTH / ((float)DMFCBase->GetGameWindowW()); - - if(pr && pr->state==STATE_INGAME){ - DLLRenderHUDText(GR_GREY,alpha_to_use,0,x,y,"%d",DLLInvGetTypeIDCount(pr->pnum,OBJ_POWERUP,HoardID)); - x += ( ratio * ((float)DLLgrtext_GetTextLineWidth("12")) ) + 1; - DLLRenderHUDQuad(x,y,10,10,0,0,1,1,HoardOrbIcon,alpha_to_use); - } -} - -bool StringParseWord(char *string,char *word,int size,char **newpos) -{ - *newpos = string; - word[0] = '\0'; - - //get through all the whitespace - while( *string && *string==' ') string++; - if(!(*string)){ - //nothing is left in the string - *newpos = string; - return false; - } - - //we're at the beginning of a word - while( *string && *string!=' '){ - if(size>1){ - *word = *string; - size--; - } - - word++; - string++; - } - - //tack on an ending \0 - *word = '\0'; - - *newpos = string; - return true; -} - -bool StringParseNumber(char *string,int *number,char **newpos) -{ - char temp[10]; - bool ret = StringParseWord(string,temp,10,newpos); - if(!ret){ - *number = 0; - return false; - } - - *number = atoi(temp); - return true; -} - -void DMFCInputCommand_MinCount(char *input_string) -{ - if(DMFCBase->GetLocalRole()!=LR_SERVER) - return; - if(!DMFCBase->IAmDedicatedServer()) - return; - - char s[20]; - - //parse "$mincount" - if(!StringParseWord(input_string,s,20,&input_string)){ - DMFCBase->DisplayInputCommandHelp("mincount"); - return; - } - - - //parse count - int count; - if(!StringParseNumber(input_string,&count,&input_string)){ - DMFCBase->DisplayInputCommandHelp("mincount"); - return; - } - - if(count<1) - count = 1; - if(count>12) - count = 12; - - config.min_hoard = count; - DLLAddHUDMessage("Hoard Orb Score Minimum Count Set To %d",count); -} - -// Initializes the game function pointers -void DLLFUNCCALL DLLGameInit (int *api_func,ubyte *all_ok,int num_teams_to_use) -{ - *all_ok = 1; - DMFCBase = CreateDMFC(); - if(!DMFCBase) - { - *all_ok = 0; - return; - } - - dstat = CreateDmfcStats(); - if(!dstat) - { - *all_ok = 0; - return; - } - - DMFCBase->LoadFunctions(api_func); - - //Setup event handlers - DMFCBase->Set_OnInterval(OnInterval); - DMFCBase->Set_OnHUDInterval(OnHUDInterval); - DMFCBase->Set_OnKeypress(OnKeypress); - DMFCBase->Set_OnServerGameCreated(OnServerGameCreated); - DMFCBase->Set_OnClientLevelStart(OnClientLevelStart); - DMFCBase->Set_OnClientLevelEnd(OnClientLevelEnd); - DMFCBase->Set_OnGameStateRequest(OnGameStateRequest); - DMFCBase->Set_OnPlayerConnect(OnPlayerConnect); - DMFCBase->Set_OnServerPlayerChangeSegment(OnServerPlayerChangeSegment); - DMFCBase->Set_OnClientPlayerChangeSegment(OnClientPlayerChangeSegment); - DMFCBase->Set_OnServerCollide(OnServerCollide); - DMFCBase->Set_OnClientCollide(OnClientCollide); - DMFCBase->Set_OnClientPlayerKilled(OnClientPlayerKilled); - DMFCBase->Set_OnPLRInterval(OnPLRInterval); - DMFCBase->Set_OnPrintScores(OnPrintScores); - DMFCBase->Set_OnPLRInit(OnPLRInit); - DMFCBase->Set_OnSaveStatsToFile(OnSaveStatsToFile); - DMFCBase->Set_OnClientShowUI(OnClientShowUI); - DMFCBase->Set_OnDisconnectSaveStatsToFile(OnDisconnectSaveStatsToFile); - DMFCBase->Set_OnLevelEndSaveStatsToFile(OnLevelEndSaveStatsToFile); - DMFCBase->Set_OnClientPlayerEntersGame(OnClientPlayerEntersGame); - - // Setup arrays for easier to read code - dObjects = DMFCBase->GetObjects(); - dPlayers = DMFCBase->GetPlayers(); - - DLLCreateStringTable("Hoard.str",&StringTable,&StringTableSize); - DLLmprintf((0,"%d strings loaded from string table\n",StringTableSize)); - if(!StringTableSize){ - *all_ok = 0; - return; - } - - //setup default config - config.min_hoard = 1; - - if(DMFCBase->AddInputCommand("mincount","[Dedicated Server Only]\nSets the minimum number of hoard orbs needed to score.\n",DMFCInputCommand_MinCount,true)<1) - mprintf((0,"Hoard Warning: Error Adding Input Command\n")); - - HoardGameInit(1); - - //add the death and suicide messages - DMFCBase->AddDeathMessage(TXT_DEATH1,true); - DMFCBase->AddDeathMessage(TXT_DEATH2,true); - DMFCBase->AddDeathMessage(TXT_DEATH3,false); - DMFCBase->AddDeathMessage(TXT_DEATH4,false); - DMFCBase->AddDeathMessage(TXT_DEATH5,true); - DMFCBase->AddDeathMessage(TXT_DEATH6,true); - DMFCBase->AddDeathMessage(TXT_DEATH7,false); - DMFCBase->AddDeathMessage(TXT_DEATH8,true); - DMFCBase->AddDeathMessage(TXT_DEATH9,true); - DMFCBase->AddDeathMessage(TXT_DEATH10,true); - - DMFCBase->AddSuicideMessage(TXT_SUICIDE1); - DMFCBase->AddSuicideMessage(TXT_SUICIDE2); - DMFCBase->AddSuicideMessage(TXT_SUICIDE3); - DMFCBase->AddSuicideMessage(TXT_SUICIDE4); - DMFCBase->AddSuicideMessage(TXT_SUICIDE5); - DMFCBase->AddSuicideMessage(TXT_SUICIDE6); - - HoardID = DLLFindObjectIDName("Hoardorb"); - if(HoardID==-1){ - DLLmprintf((0,"HOARD: BIG WARNING, COULDN'T FIND HOARD ORB ID...YOUR GAME IS IN JEOPARDY!\n")); - *all_ok = 0; - return; - } - - DMFCBase->SetupPlayerRecord(sizeof(tPlayerStat),(int (*)(void *,ubyte *))pack_pstat,(int (*)(void *,ubyte *))unpack_pstat); - - DMFCBase->RegisterPacketReceiver(SPID_INVINFO,ReceiveHoardInv); - DMFCBase->RegisterPacketReceiver(SPID_GAMECONFIG,ReceiveGameConfig); - - DMFCBase->SetNumberOfTeams(1); - (DMFCBase->GetNetgameInfo())->flags |= (NF_DAMAGE_FRIENDLY|NF_TRACK_RANK); - - DMFCBase->AddHUDItemCallback(HI_TEXT,DisplayHUDScores); - - DisplayScoreScreen = false; - - HoardOrbIcon = DLLbm_AllocLoadFileBitmap("HoardICON.ogf",0); - if(HoardOrbIcon==-1){ - *all_ok = 0; - return; - } - - Highlight_bmp = DLLbm_AllocBitmap(32,32,0); - if(Highlight_bmp>BAD_BITMAP_HANDLE){ - ushort *data = DLLbm_data(Highlight_bmp,0); - if(!data){ - //bail on out of here - *all_ok = 0; - return; - } - for(int x=0;x<32*32;x++){ - data[x] = GR_RGB16(50,50,50)|OPAQUE_FLAG; - } - } - - // Initialize the Stats Manager - // ---------------------------- - tDmfcStatsInit tsi; - tDmfcStatsColumnInfo pl_col[8]; - char gname[20]; - strcpy(gname,TXT_STATGAMENAME); - - tsi.flags = DSIF_SHOW_PIC|DSIF_SHOW_OBSERVERICON; - tsi.cColumnCountDetailed = 0; - tsi.cColumnCountPlayerList = 8; - tsi.clbDetailedColumn = NULL; - tsi.clbDetailedColumnBMP = NULL; - tsi.clbPlayerColumn = DetermineScore; - tsi.clbPlayerColumnBMP = ShowStatBitmap; - tsi.DetailedColumns = NULL; - tsi.GameName = gname; - tsi.MaxNumberDisplayed = NULL; - tsi.PlayerListColumns = pl_col; - tsi.SortedPlayerRecords = SortedPlayers; - - pl_col[0].color_type = DSCOLOR_TEAM; - pl_col[0].title[0] = '\0'; - pl_col[0].type = DSCOL_BMP; - pl_col[0].width = 27; - - pl_col[1].color_type = DSCOLOR_SHIPCOLOR; - strcpy(pl_col[1].title,TXT_PILOT); - pl_col[1].type = DSCOL_PILOT_NAME; - pl_col[1].width = 84; - - pl_col[2].color_type = DSCOLOR_SHIPCOLOR; - strcpy(pl_col[2].title,TXT_SCORE); - pl_col[2].type = DSCOL_CUSTOM; - pl_col[2].width = 49; - - pl_col[3].color_type = DSCOLOR_SHIPCOLOR; - strcpy(pl_col[3].title,TXT_HIGHEST); - pl_col[3].type = DSCOL_CUSTOM; - pl_col[3].width = 65; - - pl_col[4].color_type = DSCOLOR_SHIPCOLOR; - strcpy(pl_col[4].title,TXT_KILLS_SHORT); - pl_col[4].type = DSCOL_KILLS_LEVEL; - pl_col[4].width = 40; - - pl_col[5].color_type = DSCOLOR_SHIPCOLOR; - strcpy(pl_col[5].title,TXT_DEATHS_SHORT); - pl_col[5].type = DSCOL_DEATHS_LEVEL; - pl_col[5].width = 40; - - pl_col[6].color_type = DSCOLOR_SHIPCOLOR; - strcpy(pl_col[6].title,TXT_SUICIDES_SHORT); - pl_col[6].type = DSCOL_SUICIDES_LEVEL; - pl_col[6].width = 40; - - pl_col[7].color_type = DSCOLOR_SHIPCOLOR; - strcpy(pl_col[7].title,TXT_PING); - pl_col[7].type = DSCOL_PING; - pl_col[7].width = 40; - - dstat->Initialize(&tsi); -} - -// Called when the DLL is shutdown -void DLLFUNCCALL DLLGameClose () -{ - if(Highlight_bmp>BAD_BITMAP_HANDLE) - DLLbm_FreeBitmap(Highlight_bmp); - - DLLDestroyStringTable(StringTable,StringTableSize); - if(HoardOrbIcon>BAD_BITMAP_HANDLE) - DLLbm_FreeBitmap(HoardOrbIcon); - - if(dstat) - { - dstat->DestroyPointer(); - dstat = NULL; - } - - if(DMFCBase) - { - DMFCBase->GameClose(); - DMFCBase->DestroyPointer(); - DMFCBase = NULL; - } -} - -// DMFCApp::GameInit -// -// Sets up all the DLL functions and pointers and preps the class for use. This ABSOLUTLY must be -// called, so if you override DMFCApp::GameInit, make sure that you put a call to this somewhere in -// the override. -void ShowGameConfigDialog(int i); -void SwitchHUDColor(int i); -void HoardGameInit(int teams) -{ - IMenuItem *lev1,*lev2; - lev1 = CreateMenuItemWArgs(TXT_GAMENAME,MIT_NORMAL,0,NULL); - - lev2 = CreateMenuItemWArgs(TXT_HUDSCORECOLORS,MIT_STATE,0,SwitchHUDColor); - lev2->SetStateItemList(2,TXT_PLAYERCOLORS,TXT_NORMAL); - lev2->SetState(HUD_color_model); - lev1->AddSubMenu(lev2); - - //lev2 = CreateMenuItemWArgs(TXT_GAMECONFIG,MIT_NORMAL,0,ShowGameConfigDialog); - //lev1->AddSubMenu(lev2); - - IMenuItem *MainMenu = DMFCBase->GetOnScreenMenu(); - MainMenu->AddSubMenu(lev1); - - DMFCBase->GameInit(teams); -} - -void OnPrintScores(int level) -{ - char buffer[256]; - char name[50]; - memset(buffer,' ',256); - - int t; - int pos[6]; - int len[6]; - pos[0] = 0; t = len[0] = 20; //give ample room for pilot name - pos[1] = pos[0] + t + 1; t = len[1] = strlen(TXT_POINTS); - pos[2] = pos[1] + t + 1; t = len[2] = strlen(TXT_KILLS); - pos[3] = pos[2] + t + 1; t = len[3] = strlen(TXT_DEATHS); - pos[4] = pos[3] + t + 1; t = len[4] = strlen(TXT_SUICIDES); - pos[5] = pos[4] + t + 1; t = len[5] = strlen(TXT_PING); - - memcpy(&buffer[pos[0]],TXT_PILOT,strlen(TXT_PILOT)); - memcpy(&buffer[pos[1]],TXT_POINTS,len[1]); - memcpy(&buffer[pos[2]],TXT_KILLS,len[2]); - memcpy(&buffer[pos[3]],TXT_DEATHS,len[3]); - memcpy(&buffer[pos[4]],TXT_SUICIDES,len[4]); - memcpy(&buffer[pos[5]],TXT_PING,len[5]); - buffer[pos[5]+len[5]+1] = '\n'; - buffer[pos[5]+len[5]+2] = '\0'; - DPrintf(buffer); - - int slot; - player_record *pr; - int pcount; - - if(level<0 || level>=MAX_PLAYER_RECORDS) - pcount = MAX_PLAYER_RECORDS; - else - pcount = level; - - int sortedplayers[MAX_PLAYER_RECORDS]; - DMFCBase->GetSortedPlayerSlots(sortedplayers,MAX_PLAYER_RECORDS); - - for(int i=0;iGetPlayerRecord(slot); - if((pr)&&(pr->state!=STATE_EMPTY)){ - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue; //skip dedicated server - - sprintf(name,"%s%s:",(pr->state==STATE_DISCONNECTED)?"*":"",pr->callsign); - name[19] = '\0'; - - tPlayerStat *stat = (tPlayerStat *)pr->user_info; - - memset(buffer,' ',256); - t = strlen(name); memcpy(&buffer[pos[0]],name,(tScore[DSTAT_LEVEL]:0,(stat)?stat->Score[DSTAT_OVERALL]:0); - t = strlen(name); memcpy(&buffer[pos[1]],name,(tdstats.kills[DSTAT_LEVEL],pr->dstats.kills[DSTAT_OVERALL]); - t = strlen(name); memcpy(&buffer[pos[2]],name,(tdstats.deaths[DSTAT_LEVEL],pr->dstats.deaths[DSTAT_OVERALL]); - t = strlen(name); memcpy(&buffer[pos[3]],name,(tdstats.suicides[DSTAT_LEVEL],pr->dstats.suicides[DSTAT_OVERALL]); - t = strlen(name); memcpy(&buffer[pos[4]],name,(tstate==STATE_INGAME) - sprintf(name,"%.0f",(DMFCBase->GetNetPlayers())[pr->pnum].ping_time*1000.0f); - else - strcpy(name,"---"); - t = strlen(name); memcpy(&buffer[pos[5]],name,(tDoFrame(); - DMFCBase->DisplayOutrageLogo(); - - DMFCBase->OnHUDInterval(); -} - -void OnInterval(void) -{ - SortPlayerScores(SortedPlayers,MAX_PLAYER_RECORDS); - DMFCBase->OnInterval(); -} - -void OnKeypress(int key) -{ - dllinfo *Data = DMFCBase->GetDLLInfoCallData(); - - switch(key){ - case K_F7: - DisplayScoreScreen = !DisplayScoreScreen; - DMFCBase->EnableOnScreenMenu(false); - dstat->Enable(DisplayScoreScreen); - break; - case K_PAGEDOWN: - if(DisplayScoreScreen){ - dstat->ScrollDown(); - Data->iRet = 1; - } - break; - case K_PAGEUP: - if(DisplayScoreScreen){ - dstat->ScrollUp(); - Data->iRet = 1; - } - break; - case K_F6: - DisplayScoreScreen = false; - dstat->Enable(false); - break; - case K_ESC: - if(DisplayScoreScreen){ - dstat->Enable(false); - DisplayScoreScreen = false; - Data->iRet = 1; - } - break; - } - - DMFCBase->OnKeypress(key); -} - -// The server has just started, so clear out all the stats and game info -void OnServerGameCreated(void) -{ - DMFCBase->OnServerGameCreated(); - player_record *pr; - tPlayerStat *stat; - for(int i=0;iGetPlayerRecord(i); - if(pr) - stat = (tPlayerStat *) pr->user_info; - else - stat = NULL; - if(stat){ - stat->Score[DSTAT_LEVEL] = 0; - stat->Score[DSTAT_OVERALL] = 0; - stat->HighestScore[DSTAT_LEVEL] = 0; - stat->HighestScore[DSTAT_OVERALL] = 0; - } - } -} - -// The server has started a new level, so clear out level scores -void OnClientLevelStart(void) -{ - DMFCBase->OnClientLevelStart(); - player_record *pr; - tPlayerStat *stat; - for(int i=0;iGetPlayerRecord(i); - if(pr) - stat = (tPlayerStat *)pr->user_info; - else - stat = NULL; - - if(stat){ - stat->Score[DSTAT_LEVEL] = 0; - stat->HighestScore[DSTAT_LEVEL] = 0; - } - } - DMFCBase->RequestGameState(); - int grooms[4]; - grooms[0] = grooms[1] = grooms[2] = grooms[3] = DLLFindTextureName("GreenBase"); - DLLMultiPaintGoalRooms(grooms); - - // display the config dialog - if( !Config_displayed && DMFCBase->GetLocalRole()==LR_SERVER){ - DMFCBase->StartUIWindow(HOARD_CONFIG_DLG,&config); - Config_displayed = true; - } -} - -void OnClientShowUI(int id,void *user_data) -{ - if(id==HOARD_CONFIG_DLG) - DisplayHoardConfigDialog((tGameConfig *)user_data); - - if(id==0xEEE1) - { - //block off wait for players dialog - DisplayHoardConfigDialog(&config); - return; - } - - DMFCBase->OnClientShowUI(id,user_data); -} - -void OnClientLevelEnd(void) -{ - DMFCBase->OnClientLevelEnd(); -} - -// We need to send all the inventory info out to the new player -void OnGameStateRequest(int player_num) -{ - SendHoardInv(player_num); - DMFCBase->OnGameStateRequest(player_num); -} - -// A new player has entered the game, zero there stats out -void OnPlayerConnect(int player_num) -{ - DMFCBase->OnPlayerConnect(player_num); - - tPlayerStat *stat = (tPlayerStat *)DMFCBase->GetPlayerRecordData(player_num); - if(stat){ - stat->Score[DSTAT_LEVEL] = 0; - stat->Score[DSTAT_OVERALL] = 0; - stat->HighestScore[DSTAT_LEVEL] = 0; - stat->HighestScore[DSTAT_OVERALL] = 0; - } -} - -void OnServerPlayerChangeSegment(int player_num,int newseg,int oldseg) -{ - int g1,g2,g3,g4; - g1 = DLLGetGoalRoomForTeam(0); - g2 = DLLGetGoalRoomForTeam(1); - g3 = DLLGetGoalRoomForTeam(2); - g4 = DLLGetGoalRoomForTeam(3); - - int count = DLLInvCheckItem(player_num,OBJ_POWERUP,HoardID); - - if( (count) && ((newseg==g1)||(newseg==g2)||(newseg==g3)||(newseg==g4)) ) - { - - DMFCBase->CallClientEvent(EVT_CLIENT_GAMEPLAYERCHANGESEG,DMFCBase->GetMeObjNum(),DMFCBase->GetItObjNum(),-1); - DMFCBase->CallOnClientPlayerChangeSegment(player_num,newseg,oldseg); - } - DMFCBase->OnServerPlayerChangeSegment(player_num,newseg,oldseg); -} - -void OnClientPlayerChangeSegment(int player_num,int newseg,int oldseg) -{ - int score,count,i; - - count = DLLInvGetTypeIDCount(player_num,OBJ_POWERUP,HoardID); - score = count; - - if(countGetPlayerNum()) - DLLAddHUDMessage(TXT_NEEDMOREOBS,config.min_hoard); - return; - } - - for(i=0;iGetPlayerRecordData(player_num); - - if(stat){ - //increment scores - stat->Score[DSTAT_LEVEL]+=score; - stat->Score[DSTAT_OVERALL]+=score; - if(stat->HighestScore[DSTAT_LEVEL]HighestScore[DSTAT_LEVEL]=score; - if(stat->HighestScore[DSTAT_OVERALL]HighestScore[DSTAT_OVERALL]=score; - } - - char buffer[100]; - if(score==1) - sprintf(buffer,TXT_SCOREONE,dPlayers[player_num].callsign,(stat)?stat->Score[DSTAT_LEVEL]:0); - else - sprintf(buffer,TXT_SCOREMULTI,dPlayers[player_num].callsign,score,(stat)?stat->Score[DSTAT_LEVEL]:0); - int sound=DLLFindSoundName("PwrHoardScore"); - if(sound!=-1) - DLLPlay3dSound(sound,&dObjects[dPlayers[DMFCBase->GetPlayerNum()].objnum]); - - //Set a Timer to display - if(WhoJustScoredTimer!=-1) - DMFCBase->KillTimer(WhoJustScoredTimer); - WhoJustScoredTimer = DMFCBase->SetTimerInterval(OnTimer,0.5f,5.0f,OnTimerKill); - WhoJustScored = player_num; - - //remove the balls - DLLPlayerSetRotatingBall(player_num,0,0,NULL,NULL,NULL); - - DLLAddHUDMessage(buffer); - - if(DMFCBase->GetLocalRole()==LR_SERVER){ - //check the score to see if we hit the limit - if(DMFCBase->GetScoreLimit(&score)){ - if(score <= ((stat)?stat->Score[DSTAT_LEVEL]:0)) - { - DLLmprintf((0,"Score limit reached\n")); - DMFCBase->EndLevel(); - } - } - } - DMFCBase->OnClientPlayerChangeSegment(player_num,newseg,oldseg); -} - -// A new player has entered the game, zero there stats out -void OnClientPlayerEntersGame(int player_num) -{ - DMFCBase->OnClientPlayerEntersGame(player_num); - if(player_num!=DMFCBase->GetPlayerNum()) - DisplayWelcomeMessage(player_num); - else - display_my_welcome = true; -} - - -void OnServerCollide(object *me_obj,object *it_obj) -{ - //see if we need to send this event to the clients - //only if me==player it==hoard powerup - - if( !me_obj || !it_obj ) - { - DMFCBase->OnServerCollide(me_obj,it_obj); - return; - } - - if( (me_obj->type==OBJ_PLAYER) && (it_obj->type==OBJ_POWERUP) && (it_obj->id==HoardID) ) - { - //check to make sure the player isn't dying or dead - player *plyr_ptr = &dPlayers[me_obj->id]; - if( (plyr_ptr->flags&PLAYER_FLAGS_DYING) || (plyr_ptr->flags&PLAYER_FLAGS_DEAD) ) - { - //this player is dying or dead...ignore it - DMFCBase->OnServerCollide(me_obj,it_obj); - return; - } - - - DMFCBase->CallClientEvent(EVT_CLIENT_GAMECOLLIDE,DMFCBase->GetMeObjNum(),DMFCBase->GetItObjNum(),-1); - DMFCBase->CallOnClientCollide(me_obj,it_obj); - - //test to see if they are in a goal room, if so score - int current_room = me_obj->roomnum; - int g1,g2,g3,g4; - g1 = DLLGetGoalRoomForTeam(0); - g2 = DLLGetGoalRoomForTeam(1); - g3 = DLLGetGoalRoomForTeam(2); - g4 = DLLGetGoalRoomForTeam(3); - - if( (current_room==g1)||(current_room==g2)||(current_room==g3)||(current_room==g4) ) - { - DMFCBase->CallClientEvent(EVT_CLIENT_GAMEPLAYERCHANGESEG,DMFCBase->GetMeObjNum(),DMFCBase->GetItObjNum(),-1); - DMFCBase->CallOnClientPlayerChangeSegment(me_obj->id,current_room,current_room); - } - } - DMFCBase->OnServerCollide(me_obj,it_obj); -} - -void OnClientCollide(object *me_obj,object *it_obj) -{ - int playernum = me_obj->id; - int count = DLLInvGetTypeIDCount(playernum,OBJ_POWERUP,HoardID); - - if(count<12) - { - if(DMFCBase->GetPlayerNum()==playernum) - { - DLLAddHUDMessage(TXT_GOTHOARD); - } - int sound=DLLFindSoundName("PwrHoardPickup"); - if(sound!=-1) - DLLPlay3dSound(sound,me_obj); - if(it_obj->type==OBJ_POWERUP){ - DLLInvAddTypeID(playernum,it_obj->type,it_obj->id); - if(DMFCBase->GetLocalRole()==LR_SERVER){ - DLLSetObjectDeadFlag(it_obj,true,false); - } - }else - DLLmprintf((0,"HOARD BIG WARNING: TRYING TO ADD NONPOWERUP TO INVENTORY! (%d)\n",it_obj->type)); - - //add rotating balls if necessary - DoBallsEffect(playernum,count+1); - } - else - { - //they have max orbs - if(DMFCBase->GetPlayerNum()==playernum) - { - DLLAddHUDMessage(TXT_MAXHOARDS); - } - } - DMFCBase->OnClientCollide(me_obj,it_obj); -} - -//used for the clients when a player dies, to print out a message and other stuff -void OnClientPlayerKilled(object *killer_obj,int victim_pnum) -{ - int kpnum = -1; - - if(killer_obj){ - if((killer_obj->type==OBJ_PLAYER)||(killer_obj->type==OBJ_GHOST)) - kpnum = killer_obj->id; - else if(killer_obj->type==OBJ_ROBOT){ - //countermeasure kill - kpnum = DMFCBase->GetCounterMeasureOwner(killer_obj); - }else{ - kpnum = -1; - } - }else - kpnum = -1; - - //add an extra hoard to the inventory if they didn't kill themselves - if(kpnum!=victim_pnum){ - DLLInvAddTypeID(victim_pnum,OBJ_POWERUP,HoardID); - } - - //remove the balls - DLLPlayerSetRotatingBall(victim_pnum,0,0,NULL,NULL,NULL); - - DMFCBase->OnClientPlayerKilled(killer_obj,victim_pnum); -} - -bool compare_slots(int a,int b) -{ - int ascore,bscore; - player_record *apr,*bpr; - tPlayerStat *astat,*bstat; - - apr = DMFCBase->GetPlayerRecord(a); - bpr = DMFCBase->GetPlayerRecord(b); - if( !apr ) - return true; - if( !bpr ) - return false; - if( apr->state==STATE_EMPTY ) - return true; - if( bpr->state==STATE_EMPTY ) - return false; - astat = (tPlayerStat *)apr->user_info; - bstat = (tPlayerStat *)bpr->user_info; - - if( (apr->state==STATE_INGAME) && (bpr->state==STATE_INGAME) ){ - //both players were in the game - ascore = (astat)?astat->Score[DSTAT_LEVEL]:0; - bscore = (bstat)?bstat->Score[DSTAT_LEVEL]:0; - return (ascorestate==STATE_INGAME) && (bpr->state==STATE_DISCONNECTED) ){ - //apr gets priority since he was in the game on exit - return false; - } - if( (apr->state==STATE_DISCONNECTED) && (bpr->state==STATE_INGAME) ){ - //bpr gets priority since he was in the game on exit - return true; - } - //if we got here then both players were disconnected - ascore = (astat)?astat->Score[DSTAT_LEVEL]:0; - bscore = (bstat)?bstat->Score[DSTAT_LEVEL]:0; - return (ascore=0 && compare_slots(SortedPlayers[j],t); j--){ - SortedPlayers[j+1] = SortedPlayers[j]; - } - // insert - SortedPlayers[j+1] = t; - } - - DMFCBase->OnPLRInit(); -} - -void OnPLRInterval(void) -{ -#define PLAYERS_COL 100 -#define SCORE_COL 200 -#define HIGH_COL 260 -#define KILLS_COL 320 -#define DEATHS_COL 380 -#define SUICIDES_COL 440 - - DMFCBase->OnPLRInterval(); - - int y = 40; - int height = DLLgrfont_GetHeight((DMFCBase->GetGameFontTranslateArray())[SMALL_UI_FONT_INDEX]) + 1; - - DLLgrtext_SetFont((DMFCBase->GetGameFontTranslateArray())[SMALL_UI_FONT_INDEX]); - - //print out header - DLLgrtext_SetColor(GR_RGB(255,255,150)); - DLLgrtext_Printf(PLAYERS_COL,y,TXT_PILOT); - DLLgrtext_Printf(SCORE_COL,y,TXT_LEVEL); - DLLgrtext_Printf(SCORE_COL,y+height,TXT_POINTS); - DLLgrtext_Printf(HIGH_COL,y,TXT_HIGH); - DLLgrtext_Printf(HIGH_COL,y+height,TXT_GOAL); - DLLgrtext_Printf(KILLS_COL,y,TXT_KILLS); - DLLgrtext_Printf(DEATHS_COL,y,TXT_DEATHS); - DLLgrtext_Printf(SUICIDES_COL,y,TXT_SUICIDES); - y+=(2*height); - - //print out player stats - int rank = 1; - int slot; - player_record *pr; - tPlayerStat *stat; - - for(int i=0;iGetPlayerRecord(slot); - if(pr && pr->state!=STATE_EMPTY){ - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue;//skip dedicated server - - int pnum=DMFCBase->WasPlayerInGameAtLevelEnd(slot); - if(pnum!=-1) - { - DLLgrtext_SetColor((DMFCBase->GetPlayerColors())[pnum]); - }else - { - DLLgrtext_SetColor(GR_RGB(128,128,128)); - } - - stat = (tPlayerStat *)pr->user_info; - - DLLgrtext_Printf(PLAYERS_COL,y,"%d)%s",rank,pr->callsign); - DLLgrtext_Printf(SCORE_COL,y,"%d[%d]",(stat)?stat->Score[DSTAT_LEVEL]:0,(stat)?stat->Score[DSTAT_OVERALL]:0); - DLLgrtext_Printf(HIGH_COL,y,"%d[%d]",(stat)?stat->HighestScore[DSTAT_LEVEL]:0,(stat)?stat->HighestScore[DSTAT_OVERALL]:0); - DLLgrtext_Printf(KILLS_COL,y,"%d[%d]",pr->dstats.kills[DSTAT_LEVEL],pr->dstats.kills[DSTAT_OVERALL]); - DLLgrtext_Printf(DEATHS_COL,y,"%d[%d]",pr->dstats.deaths[DSTAT_LEVEL],pr->dstats.deaths[DSTAT_OVERALL]); - DLLgrtext_Printf(SUICIDES_COL,y,"%d[%d]",pr->dstats.suicides[DSTAT_LEVEL],pr->dstats.suicides[DSTAT_OVERALL]); - - y+=height; - rank++; - - if(y>=440) - goto quick_exit; - - } - } - -quick_exit:; -} - -void SaveStatsToFile(char *filename) -{ - CFILE *file; - DLLOpenCFILE(&file,filename,"wt"); - if(!file){ - DLLmprintf((0,"Unable to open output file\n")); - return; - } - - //write out game stats - #define BUFSIZE 150 - char buffer[BUFSIZE]; - char tempbuffer[25]; - int sortedslots[MAX_PLAYER_RECORDS]; - player_record *pr,*dpr; - tPInfoStat stat; - tPlayerStat *ps; - int count,length,p; - - //sort the stats - SortPlayerScores(sortedslots,MAX_PLAYER_RECORDS); - count = 1; - - sprintf(buffer,TXT_STATSSAVEA,(DMFCBase->GetNetgameInfo())->name,(DMFCBase->GetCurrentMission())->cur_level); - DLLcf_WriteString(file,buffer); - - sprintf(buffer,TXT_SAVESTATSB); - DLLcf_WriteString(file,buffer); - - sprintf(buffer,TXT_SAVESTATSC); - DLLcf_WriteString(file,buffer); - sprintf(buffer,"-------------------------------------------------------------------------------------------------------------"); - DLLcf_WriteString(file,buffer); - - - for(p=0;pGetPlayerRecord(sortedslots[p]); - if( pr && pr->state!=STATE_EMPTY) { - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue;//skip dedicated server - - memset(buffer,' ',BUFSIZE); - - ps = (tPlayerStat *)pr->user_info; - - sprintf(tempbuffer,"%d)",count); - memcpy(&buffer[0],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%s%s",(pr->state==STATE_INGAME)?"":"*",pr->callsign); - memcpy(&buffer[7],tempbuffer,strlen(tempbuffer)); - - if(ps){ - sprintf(tempbuffer,"%d[%d]",ps->Score[DSTAT_LEVEL],ps->Score[DSTAT_OVERALL]); - memcpy(&buffer[35],tempbuffer,strlen(tempbuffer)); - } - - sprintf(tempbuffer,"%d[%d]",pr->dstats.kills[DSTAT_LEVEL],pr->dstats.kills[DSTAT_OVERALL]); - memcpy(&buffer[47],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d[%d]",pr->dstats.deaths[DSTAT_LEVEL],pr->dstats.deaths[DSTAT_OVERALL]); - memcpy(&buffer[59],tempbuffer,strlen(tempbuffer)); - - int pos; - - sprintf(tempbuffer,"%d[%d]",pr->dstats.suicides[DSTAT_LEVEL],pr->dstats.suicides[DSTAT_OVERALL]); - memcpy(&buffer[70],tempbuffer,strlen(tempbuffer)); - - if(ps){ - sprintf(tempbuffer,"%d[%d]",ps->HighestScore[DSTAT_LEVEL],ps->HighestScore[DSTAT_OVERALL]); - memcpy(&buffer[81],tempbuffer,strlen(tempbuffer)); - } - - sprintf(tempbuffer,"%s",DMFCBase->GetTimeString(DMFCBase->GetTimeInGame(sortedslots[p]))); - memcpy(&buffer[96],tempbuffer,strlen(tempbuffer)); - - pos = 96 + strlen(tempbuffer) + 1; - - if(posGetPlayerRecord(p); - if( pr && pr->state!=STATE_EMPTY) { - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue;//skip dedicated server - - //Write out header - sprintf(buffer,"%d) %s%s",count,(pr->state==STATE_INGAME)?"":"*",pr->callsign); - DLLcf_WriteString(file,buffer); - length = strlen(buffer); - memset(buffer,'=',length); - buffer[length] = '\0'; - DLLcf_WriteString(file,buffer); - - //time in game - sprintf(buffer,TXT_TIMEINGAME,DMFCBase->GetTimeString(DMFCBase->GetTimeInGame(p))); - DLLcf_WriteString(file,buffer); - - if(DMFCBase->FindPInfoStatFirst(p,&stat)){ - sprintf(buffer,TXT_SAVESTATSE); - DLLcf_WriteString(file,buffer); - - if(stat.slot!=p){ - memset(buffer,' ',BUFSIZE); - dpr = DMFCBase->GetPlayerRecord(stat.slot); - int pos; - - if(dpr) - { - sprintf(tempbuffer,"%s",dpr->callsign); - memcpy(buffer,tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d",stat.kills); - memcpy(&buffer[30],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d",stat.deaths); - memcpy(&buffer[40],tempbuffer,strlen(tempbuffer)); - - pos = 40 + strlen(tempbuffer) + 1; - if(posFindPInfoStatNext(&stat)){ - if(stat.slot!=p){ - int pos; - memset(buffer,' ',BUFSIZE); - dpr = DMFCBase->GetPlayerRecord(stat.slot); - if(dpr) - { - sprintf(tempbuffer,"%s",dpr->callsign); - memcpy(buffer,tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d",stat.kills); - memcpy(&buffer[30],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d",stat.deaths); - memcpy(&buffer[40],tempbuffer,strlen(tempbuffer)); - - pos = 40 + strlen(tempbuffer) + 1; - if(posFindPInfoStatClose(); - DLLcf_WriteString(file,""); //skip a line - count++; - } - } - - //done writing stats - DLLcfclose(file); - DLLAddHUDMessage(TXT_STATSSAVED); -} - -#define ROOTFILENAME "Hoard" -void OnSaveStatsToFile(void) -{ - char filename[256]; - DMFCBase->GenerateStatFilename(filename,ROOTFILENAME,false); - SaveStatsToFile(filename); -} - -void OnLevelEndSaveStatsToFile(void) -{ - char filename[256]; - DMFCBase->GenerateStatFilename(filename,ROOTFILENAME,true); - SaveStatsToFile(filename); -} - -void OnDisconnectSaveStatsToFile(void) -{ - char filename[256]; - DMFCBase->GenerateStatFilename(filename,ROOTFILENAME,false); - SaveStatsToFile(filename); -} - - -//handles a hoard inventory packet -void ReceiveHoardInv(ubyte *data) -{ - int x,i,count = 0; - int size; - - for(x=0;xCheckPlayerNum(x)) - { - //we have a valid player, add orbs - ASSERT(size>=0); - DoBallsEffect(x,size); - for(i=0;iStartPacket(data,SPID_INVINFO,&count); - - for(i = 0;iCheckPlayerNum(i)){ - MultiAddByte(DLLInvGetTypeIDCount(i,OBJ_POWERUP,HoardID),data,&count); - } - else - { - MultiAddByte(0,data,&count); - } - } - - DMFCBase->SendPacket(data,count,playernum); - - SendGameConfig(playernum); -} - - -void DisplayHUDScores(struct tHUDItem *hitem) -{ - if(display_my_welcome) - { - DisplayWelcomeMessage(DMFCBase->GetPlayerNum()); - display_my_welcome = false; - } - - if(DisplayScoreScreen) - return; - - int x = 520; - int height = DLLgrfont_GetHeight((DMFCBase->GetGameFontTranslateArray())[HUD_FONT_INDEX]) + 3; - ubyte alpha = DMFCBase->ConvertHUDAlpha((ubyte)((DisplayScoreScreen)?128:255)); - int y = (DMFCBase->GetGameWindowH()/2) - ((height*5)/2); - int rank = 1; - ddgr_color color; - - char name[50]; - player_record *pr; - tPlayerStat *stat; - - //determine coordinates to use here - //we'll use a virtual width of 85 pixels on a 640x480 screen - //so first determine the new width - int name_width = 85.0f * DMFCBase->GetHudAspectX(); - int score_width = DLLgrtext_GetTextLineWidth("888"); - int name_x = DMFCBase->GetGameWindowW() - name_width - score_width - 10; - int score_x = DMFCBase->GetGameWindowW() - score_width - 5; - DLLgrtext_SetAlpha(alpha); - - - for(int i=0;iGetPlayerRecord(slot); - if( pr && pr->state!=STATE_EMPTY){ - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue;//skip dedicated server - - if( (pr->state==STATE_DISCONNECTED) || (pr->state==STATE_INGAME && !DMFCBase->IsPlayerObserver(pr->pnum)) ){ - - stat = (tPlayerStat *)pr->user_info; - strcpy(name,pr->callsign); - DMFCBase->ClipString(name_width,name,true); - - if(pr->state==STATE_INGAME && pr->pnum==DMFCBase->GetPlayerNum()){ - - switch(HUD_color_model){ - case HCM_PLAYERCOLOR: - color = (DMFCBase->GetPlayerColors())[pr->pnum]; - break; - case HCM_NORMAL: - color = GR_RGB(40,255,40); - break; - }; - - if(Highlight_bmp>BAD_BITMAP_HANDLE){ - //draw the highlight bar in the background - DLLrend_SetAlphaValue(alpha*0.50f); - DLLrend_SetZBufferState (0); - DLLrend_SetTextureType (TT_LINEAR); - DLLrend_SetLighting (LS_NONE); - DLLrend_SetAlphaType (AT_CONSTANT_TEXTURE); - - DLLrend_DrawScaledBitmap(name_x-2,y-2,score_x+score_width+2,y+height-1,Highlight_bmp,0,0,1,1,1.0f); - DLLrend_SetZBufferState (1); - } - - if( (WhoJustScored!=pr->pnum) || (DisplayBlink) ){ - DLLgrtext_SetColor(color); - DLLgrtext_Printf(name_x,y,name); - DLLgrtext_Printf(score_x,y,"%d",(stat)?stat->Score[DSTAT_LEVEL]:0); - } - y+=height; - }else - if(rank<6){ - if(pr->state==STATE_DISCONNECTED){ - color = GR_GREY; - }else{ - switch(HUD_color_model){ - case HCM_PLAYERCOLOR: - color = (DMFCBase->GetPlayerColors())[pr->pnum]; - break; - case HCM_NORMAL: - color = GR_RGB(40,255,40); - break; - }; - } - - if( (pr->state==STATE_DISCONNECTED) || (WhoJustScored!=pr->pnum) || (DisplayBlink) ){ - DLLgrtext_SetColor(color); - DLLgrtext_Printf(name_x,y,name); - DLLgrtext_Printf(score_x,y,"%d",(stat)?stat->Score[DSTAT_LEVEL]:0); - } - y+=height; - } - rank++; - } - } - } - - //draw the hoard orb count - int w = DLLbm_w(HoardOrbIcon,0); - char buffer[4]; - sprintf(buffer,"%d",DLLInvGetTypeIDCount(DMFCBase->GetPlayerNum(),OBJ_POWERUP,HoardID)); - int x1,x2,y1,y2; - x1 = DMFCBase->GetGameWindowW()-5-DLLbm_w(HoardOrbIcon,0); - y1 = 25; - x2 = x1+DLLbm_w(HoardOrbIcon,0); - y2 = y1+DLLbm_h(HoardOrbIcon,0); - - DLLrend_SetAlphaValue(alpha); - DLLrend_SetZBufferState (0); - DLLrend_SetTextureType (TT_LINEAR); - DLLrend_SetLighting (LS_NONE); - DLLrend_SetAlphaType (AT_CONSTANT_TEXTURE); - DLLrend_DrawScaledBitmap(x1,y1,x2,y2,HoardOrbIcon,0,0,1,1,1.0f); - DLLrend_SetZBufferState (1); - - x1 += w/2; - y1 += DLLbm_h(HoardOrbIcon,0)/2; - x1 -= ((float)DLLgrtext_GetTextLineWidth(buffer))/2.0f; - y1 -= ((height-3)/2.0); - - DLLgrtext_SetColor(GR_RGB(128,128,128)); - DLLgrtext_SetAlpha(min(alpha+30,255)); - DLLgrtext_Printf(x1,y1,buffer); -} - -void SortPlayerScores(int *sortedindex,int size) -{ - int tempsort[MAX_PLAYER_RECORDS]; - int i,t,j; - - for(i=0;i=0 && compare_slots(tempsort[j],t); j--){ - tempsort[j+1] = tempsort[j]; - } - // insert - tempsort[j+1] = t; - } - - //copy the array over - memcpy(sortedindex,tempsort,((size>MAX_PLAYER_RECORDS)?MAX_PLAYER_RECORDS:size) *sizeof(int)); -} - -void DisplayWelcomeMessage(int player_num) -{ - char name_buffer[64]; - strcpy(name_buffer,(DMFCBase->GetPlayers())[player_num].callsign); - - if(player_num==DMFCBase->GetPlayerNum()) - { - DLLAddHUDMessage(TXT_WELCOME,name_buffer); - } - else - { - DLLAddHUDMessage(TXT_JOINED,name_buffer); - } -} - -void DoBallsEffect(int i,int count) -{ - float redb[4]; - float greenb[4]; - float blueb[4]; - - for(int x=0;x<4;x++){ - redb[x] = blueb[x] = 0; - greenb[x] = 1; - } - - switch(count) - { - case 0: - DLLPlayerSetRotatingBall(i,0,0,redb,greenb,blueb); - break; - case 1: - DLLPlayerSetRotatingBall(i,1,4,redb,greenb,blueb); - break; - case 2: - DLLPlayerSetRotatingBall(i,1,3,redb,greenb,blueb); - break; - case 3: - DLLPlayerSetRotatingBall(i,1,2,redb,greenb,blueb); - break; - case 4: - DLLPlayerSetRotatingBall(i,1,1,redb,greenb,blueb); - break; - case 5: - DLLPlayerSetRotatingBall(i,2,4,redb,greenb,blueb); - break; - case 6: - DLLPlayerSetRotatingBall(i,2,3,redb,greenb,blueb); - break; - case 7: - DLLPlayerSetRotatingBall(i,2,2,redb,greenb,blueb); - break; - case 8: - DLLPlayerSetRotatingBall(i,2,1,redb,greenb,blueb); - break; - case 9: - DLLPlayerSetRotatingBall(i,3,4,redb,greenb,blueb); - break; - case 10: - DLLPlayerSetRotatingBall(i,3,3,redb,greenb,blueb); - break; - case 11: - DLLPlayerSetRotatingBall(i,3,2,redb,greenb,blueb); - break; - case 12: - DLLPlayerSetRotatingBall(i,3,1,redb,greenb,blueb); - break; - } -} - -///////////////////////////////// -//Timer event handlers -void OnTimer(void) -{ - DisplayBlink = !DisplayBlink; -} -void OnTimerKill(void) -{ - DisplayBlink = true; - WhoJustScored = WhoJustScoredTimer = -1; -} - -//game config send/receive -void SendGameConfig(int towho) -{ - ubyte data[MAX_GAME_DATA_SIZE]; - int count = 0; - - DMFCBase->StartPacket(data,SPID_GAMECONFIG,&count); - - MultiAddByte(config.min_hoard,data,&count); - - DMFCBase->SendPacket(data,count,towho); -} - -void ReceiveGameConfig(ubyte *data) -{ - int count = 0; - config.min_hoard = MultiGetByte(data,&count); -} - -void ShowGameConfigDialog(int i) -{ - DMFCBase->EnableOnScreenMenu(false); - DMFCBase->StartUIWindow(HOARD_CONFIG_DLG,&config); -} - -void SwitchHUDColor(int i) -{ - HUD_color_model = i; -} - -#ifdef MACINTOSH -#pragma export off -#endif diff --git a/hoard/hoard_ui.cpp b/hoard/hoard_ui.cpp deleted file mode 100644 index cf96d63c..00000000 --- a/hoard/hoard_ui.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/* -* $Logfile: /DescentIII/Main/hoard/hoard_ui.cpp $ -* $Revision: 1.1.1.1 $ -* $Date: 2003-08-26 03:57:53 $ -* $Author: kevinb $ -* -* Hoard UI Dialogs -* -* $Log: not supported by cvs2svn $ - * - * 10 5/19/99 2:42a Jeff - * call correct NewUIGameWindow functions - * - * 9 4/24/99 11:13p Jeff - * added flags for creating a newui window for a title bar - * - * 8 4/14/99 1:17a Jeff - * fixed case mismatched #includes - * - * 7 4/03/99 9:26p Jeff - * changed dialogs that weren't using UID_OK and UID_CANCEL to use and - * handle them properly - * - * 6 3/17/99 12:23p Jeff - * converted DMFC to be COM interface - * - * 5 2/11/99 3:54p Jeff - * localized - * - * 4 2/07/99 1:18a Jeff - * peppered UI dialogs that were missing NEWUIRES_FORCEQUIT to handle it - * - * 3 11/20/98 5:52p Jeff - * updated hyper anarchy and hoard a little - * - * 2 11/19/98 5:56p Jeff - * added slider exported and improved Hoard -* -* $NoKeywords: $ -*/ - -#include "gamedll_header.h" -#include -#include "idmfc.h" -#include "hoardstr.h" -#include "hoardaux.h" -extern IDMFC *DMFCBase; - -// Displays the Hoard game configuration dialog (Server) -void DisplayHoardConfigDialog(tGameConfig *config) -{ -#define WINDOW_H 152 -#define WINDOW_W 352 - - if(DMFCBase->GetLocalRole()!=LR_SERVER) - return; - - if(DMFCBase->IAmDedicatedServer()) - return; - - if(config->min_hoard<1) config->min_hoard = 1; - if(config->min_hoard>12) config->min_hoard = 12; - - //DMFCBase->MakeClientsWait(true); - - // variable declarations - // --------------------- - bool exit_menu = false; - char buffer[10]; - sprintf(buffer,"%d",config->min_hoard); - - // text items - // ---------- - void *start_game_text_off = DLLCreateNewUITextItem(TXT_RETURNTOGAME,UICOL_HOTSPOT_LO); - void *start_game_text_on = DLLCreateNewUITextItem(TXT_RETURNTOGAME,UICOL_HOTSPOT_HI); - void *window_title = DLLCreateNewUITextItem(TXT_GAMECONFIG,UICOL_WINDOW_TITLE); - void *min_count_label_ti = DLLCreateNewUITextItem(TXT_MINIMUMORBS,UICOL_TEXT_NORMAL); - void *slider_val_ti = DLLCreateNewUITextItem(buffer,UICOL_TEXT_NORMAL); - - // main window - // ----------- - void *main_wnd = DLLNewUIGameWindowCreate(0,0,WINDOW_W,WINDOW_H,UIF_PROCESS_ALL|UIF_CENTER|NUWF_TITLEMED); - - // item placement - // -------------- - int cury = 35; - int left_x_col = 20; - - void *start_game_hs = DLLHotSpotCreate(main_wnd,UID_OK,K_ENTER,start_game_text_off,start_game_text_on,40,WINDOW_H - OKCANCEL_YOFFSET,130,15,UIF_CENTER); - void *window_title_text = DLLTextCreate(main_wnd,window_title,0,7,UIF_CENTER|UIF_FIT); - void *min_count_label = DLLTextCreate(main_wnd,min_count_label_ti,left_x_col,cury,UIF_FIT|UIF_CENTER); cury+=15; - void *count_slider = DLLSliderCreate(main_wnd,31,0,cury,UIF_CENTER|UIF_FIT); cury+=30; - DLLSliderSetRange(count_slider,11); - DLLSliderSetPos(count_slider,config->min_hoard-1); - void *slider_val = DLLTextCreate(main_wnd,slider_val_ti,left_x_col,cury,UIF_FIT|UIF_CENTER); - - // show window - // ----------- - DLLNewUIGameWindowOpen(main_wnd); - - // process - // ------- - while (!exit_menu) - { - int res; - res = DLLPollUI(); - - if(res==-1) - continue; - - switch(res){ - case NEWUIRES_FORCEQUIT: - exit_menu = true; - break; - case UID_OK: - exit_menu = true; - break; - case 31: - {//update slider - DLLRemoveUITextItem(slider_val_ti); - char buff[10]; - int val = DLLSliderGetPos(count_slider); - sprintf(buff,"%d",val+1); - slider_val_ti = DLLCreateNewUITextItem(buff,UICOL_TEXT_NORMAL); - DLLTextSetTitle(slider_val,slider_val_ti); - }break; - } - } - - config->min_hoard = DLLSliderGetPos(count_slider) + 1; - - // close window - // ------------ - DLLNewUIGameWindowClose(main_wnd); - - // free up resources - // ----------------- - DLLNewUIGameWindowDestroy(main_wnd); - - DLLRemoveUITextItem(start_game_text_on); - DLLRemoveUITextItem(start_game_text_off); - DLLRemoveUITextItem(window_title); - DLLRemoveUITextItem(min_count_label_ti); - DLLRemoveUITextItem(slider_val_ti); - - DLLDeleteUIItem(main_wnd); - DLLDeleteUIItem(start_game_hs); - DLLDeleteUIItem(window_title_text); - DLLDeleteUIItem(min_count_label); - DLLDeleteUIItem(count_slider); - DLLDeleteUIItem(slider_val); - - // we're done - // ---------- - //DMFCBase->MakeClientsWait(false); - - SendGameConfig(SP_ALL); -} \ No newline at end of file diff --git a/hoard/hoardaux.h b/hoard/hoardaux.h deleted file mode 100644 index 46e8f025..00000000 --- a/hoard/hoardaux.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __HOARD_AUX_H_ -#define __HOARD_AUX_H_ - -typedef struct{ - int min_hoard; -}tGameConfig; - -//game config send/receive -void SendGameConfig(int towho); - - -#endif \ No newline at end of file diff --git a/hoard/hoardstr.h b/hoard/hoardstr.h deleted file mode 100644 index 91805d37..00000000 --- a/hoard/hoardstr.h +++ /dev/null @@ -1,66 +0,0 @@ -//Defines for indexes into the string table for in-code strings - -#ifndef __STRING_TABLE____ -#define __STRING_TABLE____ - -#define TXT(index) GetStringFromTable(index) - -//Returns a pointer to the string at the index location from the string table -//if it is a bad index given, then the pointer to the error string "ERROR MISSING STRING" is given - -char *GetStringFromTable(int index); - -#define TXT_DEATH1 TXT(0) //"%s got blasted by %s" -#define TXT_DEATH2 TXT(1) //"%s knows %s is his god" -#define TXT_DEATH3 TXT(2) //"%s sucks %s's milk" -#define TXT_DEATH4 TXT(3) //"%s realizes %s's power" -#define TXT_DEATH5 TXT(4) //"%s got killed by %s" -#define TXT_DEATH6 TXT(5) //"%s begs for %s's mercy" -#define TXT_DEATH7 TXT(6) //"%s realizes %s is a better player" -#define TXT_DEATH8 TXT(7) //"%s was no match for %s" -#define TXT_DEATH9 TXT(8) //"%s wishes he was as good as %s" -#define TXT_DEATH10 TXT(9) //"%s got messed up by %s" -#define TXT_SUICIDE1 TXT(10) //"%s blasts himself" -#define TXT_SUICIDE2 TXT(11) //"%s Bursts his own bubble" -#define TXT_SUICIDE3 TXT(12) //"%s doesn't know his own strength" -#define TXT_SUICIDE4 TXT(13) //"No prize for %s" -#define TXT_SUICIDE5 TXT(14) //"%s doesn't wish to live anymore" -#define TXT_SUICIDE6 TXT(15) //"%s SUCKS!" -#define TXT_SCOREONE TXT(16) //"%s scores 1 point [%d]" -#define TXT_SCOREMULTI TXT(17) //"%s scores %d points [%d]" -#define TXT_GOTHOARD TXT(18) //"You got a hoard orb" -#define TXT_MAXHOARDS TXT(19) //"You've got all the orbs you can handle" -#define TXT_PILOT TXT(20) //"Pilot" -#define TXT_LEVEL TXT(21) //"Level" -#define TXT_POINTS TXT(22) //"Points" -#define TXT_HIGH TXT(23) //"High" -#define TXT_GOAL TXT(24) //"Goal" -#define TXT_KILLS TXT(25) //"Kills" -#define TXT_DEATHS TXT(26) //"Deaths" -#define TXT_SUICIDES TXT(27) //"Suicides" -#define TXT_WELCOME TXT(28) //"Welcome to the Hoard %s!" -#define TXT_JOINED TXT(29) //"%s has joined the Hoard" -#define TXT_STATS TXT(30) //"Stats" -#define TXT_GAMENAME TXT(31) //"Hoard" -#define TXT_SCORE TXT(32) //"Score" -#define TXT_HIGHEST TXT(33) //"Highest" -#define TXT_PING TXT(34) //"Ping" -#define TXT_HUDSCORECOLORS TXT(35) //"HUD Score Colors" -#define TXT_PLAYERCOLORS TXT(36) //"Player Colors" -#define TXT_NORMAL TXT(37) //"Normal" -#define TXT_GAMECONFIG TXT(38) //"Game Configuration" -#define TXT_NEEDMOREOBS TXT(39) //"You need at least %d orbs to score" -#define TXT_STATSSAVEA TXT(40) //"Hoard\r\nGame: %s\r\nLevel: %d\r\n" -#define TXT_SAVESTATSB TXT(41) //"Current Level Rankings\r\n" -#define TXT_SAVESTATSC TXT(42) //"[Rank] [Name] [Score] [Kills] [Deaths] [Suicides] [Highest Goal] [Time In Game]" -#define TXT_SAVESTATSD TXT(43) //"\r\nIndividual Stats\r\n" -#define TXT_TIMEINGAME TXT(44) //"Total Time In Game: %s" -#define TXT_SAVESTATSE TXT(45) //"Callsign: Kills: Deaths:" -#define TXT_STATSSAVED TXT(46) //"Stats saved to file" -#define TXT_STATGAMENAME TXT(47) //"Hoard" -#define TXT_RETURNTOGAME TXT(48) //"Back to Game" -#define TXT_MINIMUMORBS TXT(49) //"Minimum Hoard Orbs To Score" -#define TXT_KILLS_SHORT TXT(50) //"K" -#define TXT_DEATHS_SHORT TXT(51) //"D" -#define TXT_SUICIDES_SHORT TXT(52) //"S" -#endif diff --git a/D3Launch/3D_detect.cpp b/legacy/D3Launch/3D_detect.cpp similarity index 100% rename from D3Launch/3D_detect.cpp rename to legacy/D3Launch/3D_detect.cpp diff --git a/D3Launch/3D_detect.h b/legacy/D3Launch/3D_detect.h similarity index 100% rename from D3Launch/3D_detect.h rename to legacy/D3Launch/3D_detect.h diff --git a/D3Launch/AudioTab.cpp b/legacy/D3Launch/AudioTab.cpp similarity index 100% rename from D3Launch/AudioTab.cpp rename to legacy/D3Launch/AudioTab.cpp diff --git a/D3Launch/AudioTab.h b/legacy/D3Launch/AudioTab.h similarity index 100% rename from D3Launch/AudioTab.h rename to legacy/D3Launch/AudioTab.h diff --git a/D3Launch/BitmapButtonEx.cpp b/legacy/D3Launch/BitmapButtonEx.cpp similarity index 100% rename from D3Launch/BitmapButtonEx.cpp rename to legacy/D3Launch/BitmapButtonEx.cpp diff --git a/D3Launch/BitmapButtonEx.h b/legacy/D3Launch/BitmapButtonEx.h similarity index 100% rename from D3Launch/BitmapButtonEx.h rename to legacy/D3Launch/BitmapButtonEx.h diff --git a/D3Launch/D3Launch.cpp b/legacy/D3Launch/D3Launch.cpp similarity index 100% rename from D3Launch/D3Launch.cpp rename to legacy/D3Launch/D3Launch.cpp diff --git a/D3Launch/D3Launch.h b/legacy/D3Launch/D3Launch.h similarity index 100% rename from D3Launch/D3Launch.h rename to legacy/D3Launch/D3Launch.h diff --git a/D3Launch/D3Launch.rc b/legacy/D3Launch/D3Launch.rc similarity index 100% rename from D3Launch/D3Launch.rc rename to legacy/D3Launch/D3Launch.rc diff --git a/D3Launch/D3LaunchDlg.cpp b/legacy/D3Launch/D3LaunchDlg.cpp similarity index 100% rename from D3Launch/D3LaunchDlg.cpp rename to legacy/D3Launch/D3LaunchDlg.cpp diff --git a/D3Launch/D3LaunchDlg.h b/legacy/D3Launch/D3LaunchDlg.h similarity index 100% rename from D3Launch/D3LaunchDlg.h rename to legacy/D3Launch/D3LaunchDlg.h diff --git a/D3Launch/DirectXTab.cpp b/legacy/D3Launch/DirectXTab.cpp similarity index 100% rename from D3Launch/DirectXTab.cpp rename to legacy/D3Launch/DirectXTab.cpp diff --git a/D3Launch/DirectXTab.h b/legacy/D3Launch/DirectXTab.h similarity index 100% rename from D3Launch/DirectXTab.h rename to legacy/D3Launch/DirectXTab.h diff --git a/D3Launch/DriversDlg.cpp b/legacy/D3Launch/DriversDlg.cpp similarity index 100% rename from D3Launch/DriversDlg.cpp rename to legacy/D3Launch/DriversDlg.cpp diff --git a/D3Launch/DriversDlg.h b/legacy/D3Launch/DriversDlg.h similarity index 100% rename from D3Launch/DriversDlg.h rename to legacy/D3Launch/DriversDlg.h diff --git a/D3Launch/FindFastDlg.cpp b/legacy/D3Launch/FindFastDlg.cpp similarity index 100% rename from D3Launch/FindFastDlg.cpp rename to legacy/D3Launch/FindFastDlg.cpp diff --git a/D3Launch/FindFastDlg.h b/legacy/D3Launch/FindFastDlg.h similarity index 100% rename from D3Launch/FindFastDlg.h rename to legacy/D3Launch/FindFastDlg.h diff --git a/D3Launch/GLSetupDlg.cpp b/legacy/D3Launch/GLSetupDlg.cpp similarity index 100% rename from D3Launch/GLSetupDlg.cpp rename to legacy/D3Launch/GLSetupDlg.cpp diff --git a/D3Launch/GLSetupDlg.h b/legacy/D3Launch/GLSetupDlg.h similarity index 100% rename from D3Launch/GLSetupDlg.h rename to legacy/D3Launch/GLSetupDlg.h diff --git a/D3Launch/Ia3dutil.h b/legacy/D3Launch/Ia3dutil.h similarity index 100% rename from D3Launch/Ia3dutil.h rename to legacy/D3Launch/Ia3dutil.h diff --git a/D3Launch/JoystickTab.cpp b/legacy/D3Launch/JoystickTab.cpp similarity index 100% rename from D3Launch/JoystickTab.cpp rename to legacy/D3Launch/JoystickTab.cpp diff --git a/D3Launch/JoystickTab.h b/legacy/D3Launch/JoystickTab.h similarity index 100% rename from D3Launch/JoystickTab.h rename to legacy/D3Launch/JoystickTab.h diff --git a/D3Launch/KeyboardTab.cpp b/legacy/D3Launch/KeyboardTab.cpp similarity index 100% rename from D3Launch/KeyboardTab.cpp rename to legacy/D3Launch/KeyboardTab.cpp diff --git a/D3Launch/KeyboardTab.h b/legacy/D3Launch/KeyboardTab.h similarity index 100% rename from D3Launch/KeyboardTab.h rename to legacy/D3Launch/KeyboardTab.h diff --git a/D3Launch/Label.cpp b/legacy/D3Launch/Label.cpp similarity index 100% rename from D3Launch/Label.cpp rename to legacy/D3Launch/Label.cpp diff --git a/D3Launch/Label.h b/legacy/D3Launch/Label.h similarity index 100% rename from D3Launch/Label.h rename to legacy/D3Launch/Label.h diff --git a/D3Launch/LaunchNames.h b/legacy/D3Launch/LaunchNames.h similarity index 100% rename from D3Launch/LaunchNames.h rename to legacy/D3Launch/LaunchNames.h diff --git a/D3Launch/ListCtrlEx.cpp b/legacy/D3Launch/ListCtrlEx.cpp similarity index 100% rename from D3Launch/ListCtrlEx.cpp rename to legacy/D3Launch/ListCtrlEx.cpp diff --git a/D3Launch/ListCtrlEx.h b/legacy/D3Launch/ListCtrlEx.h similarity index 100% rename from D3Launch/ListCtrlEx.h rename to legacy/D3Launch/ListCtrlEx.h diff --git a/D3Launch/MOTDDlg.cpp b/legacy/D3Launch/MOTDDlg.cpp similarity index 100% rename from D3Launch/MOTDDlg.cpp rename to legacy/D3Launch/MOTDDlg.cpp diff --git a/D3Launch/MOTDDlg.h b/legacy/D3Launch/MOTDDlg.h similarity index 100% rename from D3Launch/MOTDDlg.h rename to legacy/D3Launch/MOTDDlg.h diff --git a/D3Launch/MakeHelp.bat b/legacy/D3Launch/MakeHelp.bat similarity index 100% rename from D3Launch/MakeHelp.bat rename to legacy/D3Launch/MakeHelp.bat diff --git a/D3Launch/MessageWindowDlg.cpp b/legacy/D3Launch/MessageWindowDlg.cpp similarity index 100% rename from D3Launch/MessageWindowDlg.cpp rename to legacy/D3Launch/MessageWindowDlg.cpp diff --git a/D3Launch/MessageWindowDlg.h b/legacy/D3Launch/MessageWindowDlg.h similarity index 100% rename from D3Launch/MessageWindowDlg.h rename to legacy/D3Launch/MessageWindowDlg.h diff --git a/D3Launch/MsgDlg.cpp b/legacy/D3Launch/MsgDlg.cpp similarity index 100% rename from D3Launch/MsgDlg.cpp rename to legacy/D3Launch/MsgDlg.cpp diff --git a/D3Launch/MsgDlg.h b/legacy/D3Launch/MsgDlg.h similarity index 100% rename from D3Launch/MsgDlg.h rename to legacy/D3Launch/MsgDlg.h diff --git a/D3Launch/NetworkTab.cpp b/legacy/D3Launch/NetworkTab.cpp similarity index 100% rename from D3Launch/NetworkTab.cpp rename to legacy/D3Launch/NetworkTab.cpp diff --git a/D3Launch/NetworkTab.h b/legacy/D3Launch/NetworkTab.h similarity index 100% rename from D3Launch/NetworkTab.h rename to legacy/D3Launch/NetworkTab.h diff --git a/D3Launch/OS_Config.cpp b/legacy/D3Launch/OS_Config.cpp similarity index 100% rename from D3Launch/OS_Config.cpp rename to legacy/D3Launch/OS_Config.cpp diff --git a/D3Launch/OS_Config.h b/legacy/D3Launch/OS_Config.h similarity index 100% rename from D3Launch/OS_Config.h rename to legacy/D3Launch/OS_Config.h diff --git a/D3Launch/ReadMe.txt b/legacy/D3Launch/ReadMe.txt similarity index 100% rename from D3Launch/ReadMe.txt rename to legacy/D3Launch/ReadMe.txt diff --git a/D3Launch/SetupPropSheet.cpp b/legacy/D3Launch/SetupPropSheet.cpp similarity index 100% rename from D3Launch/SetupPropSheet.cpp rename to legacy/D3Launch/SetupPropSheet.cpp diff --git a/D3Launch/SetupPropSheet.h b/legacy/D3Launch/SetupPropSheet.h similarity index 100% rename from D3Launch/SetupPropSheet.h rename to legacy/D3Launch/SetupPropSheet.h diff --git a/D3Launch/SiteSelectDlg.cpp b/legacy/D3Launch/SiteSelectDlg.cpp similarity index 100% rename from D3Launch/SiteSelectDlg.cpp rename to legacy/D3Launch/SiteSelectDlg.cpp diff --git a/D3Launch/SiteSelectDlg.h b/legacy/D3Launch/SiteSelectDlg.h similarity index 100% rename from D3Launch/SiteSelectDlg.h rename to legacy/D3Launch/SiteSelectDlg.h diff --git a/D3Launch/SpeedTab.cpp b/legacy/D3Launch/SpeedTab.cpp similarity index 100% rename from D3Launch/SpeedTab.cpp rename to legacy/D3Launch/SpeedTab.cpp diff --git a/D3Launch/SpeedTab.h b/legacy/D3Launch/SpeedTab.h similarity index 100% rename from D3Launch/SpeedTab.h rename to legacy/D3Launch/SpeedTab.h diff --git a/D3Launch/StdAfx.cpp b/legacy/D3Launch/StdAfx.cpp similarity index 100% rename from D3Launch/StdAfx.cpp rename to legacy/D3Launch/StdAfx.cpp diff --git a/D3Launch/StdAfx.h b/legacy/D3Launch/StdAfx.h similarity index 100% rename from D3Launch/StdAfx.h rename to legacy/D3Launch/StdAfx.h diff --git a/D3Launch/TitleTip.cpp b/legacy/D3Launch/TitleTip.cpp similarity index 100% rename from D3Launch/TitleTip.cpp rename to legacy/D3Launch/TitleTip.cpp diff --git a/D3Launch/TitleTip.h b/legacy/D3Launch/TitleTip.h similarity index 100% rename from D3Launch/TitleTip.h rename to legacy/D3Launch/TitleTip.h diff --git a/D3Launch/UpdateDlg.cpp b/legacy/D3Launch/UpdateDlg.cpp similarity index 100% rename from D3Launch/UpdateDlg.cpp rename to legacy/D3Launch/UpdateDlg.cpp diff --git a/D3Launch/UpdateDlg.h b/legacy/D3Launch/UpdateDlg.h similarity index 100% rename from D3Launch/UpdateDlg.h rename to legacy/D3Launch/UpdateDlg.h diff --git a/D3Launch/VerifyA3D.h b/legacy/D3Launch/VerifyA3D.h similarity index 100% rename from D3Launch/VerifyA3D.h rename to legacy/D3Launch/VerifyA3D.h diff --git a/D3Launch/VideoDetectDlg.cpp b/legacy/D3Launch/VideoDetectDlg.cpp similarity index 100% rename from D3Launch/VideoDetectDlg.cpp rename to legacy/D3Launch/VideoDetectDlg.cpp diff --git a/D3Launch/VideoDetectDlg.h b/legacy/D3Launch/VideoDetectDlg.h similarity index 100% rename from D3Launch/VideoDetectDlg.h rename to legacy/D3Launch/VideoDetectDlg.h diff --git a/D3Launch/VideoTab.cpp b/legacy/D3Launch/VideoTab.cpp similarity index 100% rename from D3Launch/VideoTab.cpp rename to legacy/D3Launch/VideoTab.cpp diff --git a/D3Launch/VideoTab.h b/legacy/D3Launch/VideoTab.h similarity index 100% rename from D3Launch/VideoTab.h rename to legacy/D3Launch/VideoTab.h diff --git a/D3Launch/eax.h b/legacy/D3Launch/eax.h similarity index 100% rename from D3Launch/eax.h rename to legacy/D3Launch/eax.h diff --git a/D3Launch/hlp/AfxDlg.rtf b/legacy/D3Launch/hlp/AfxDlg.rtf similarity index 100% rename from D3Launch/hlp/AfxDlg.rtf rename to legacy/D3Launch/hlp/AfxDlg.rtf diff --git a/D3Launch/hlp/D3L_hlp1.htm b/legacy/D3Launch/hlp/D3L_hlp1.htm similarity index 100% rename from D3Launch/hlp/D3L_hlp1.htm rename to legacy/D3Launch/hlp/D3L_hlp1.htm diff --git a/D3Launch/hlp/D3L_hlp2.htm b/legacy/D3Launch/hlp/D3L_hlp2.htm similarity index 100% rename from D3Launch/hlp/D3L_hlp2.htm rename to legacy/D3Launch/hlp/D3L_hlp2.htm diff --git a/D3Launch/hlp/D3L_hlp3.htm b/legacy/D3Launch/hlp/D3L_hlp3.htm similarity index 100% rename from D3Launch/hlp/D3L_hlp3.htm rename to legacy/D3Launch/hlp/D3L_hlp3.htm diff --git a/D3Launch/hlp/D3L_hlp4.htm b/legacy/D3Launch/hlp/D3L_hlp4.htm similarity index 100% rename from D3Launch/hlp/D3L_hlp4.htm rename to legacy/D3Launch/hlp/D3L_hlp4.htm diff --git a/D3Launch/hlp/D3L_hlp5.htm b/legacy/D3Launch/hlp/D3L_hlp5.htm similarity index 100% rename from D3Launch/hlp/D3L_hlp5.htm rename to legacy/D3Launch/hlp/D3L_hlp5.htm diff --git a/D3Launch/hlp/D3L_hlp6.htm b/legacy/D3Launch/hlp/D3L_hlp6.htm similarity index 100% rename from D3Launch/hlp/D3L_hlp6.htm rename to legacy/D3Launch/hlp/D3L_hlp6.htm diff --git a/D3Launch/hlp/D3L_hlp7.htm b/legacy/D3Launch/hlp/D3L_hlp7.htm similarity index 100% rename from D3Launch/hlp/D3L_hlp7.htm rename to legacy/D3Launch/hlp/D3L_hlp7.htm diff --git a/D3Launch/hlp/D3L_hlp8.htm b/legacy/D3Launch/hlp/D3L_hlp8.htm similarity index 100% rename from D3Launch/hlp/D3L_hlp8.htm rename to legacy/D3Launch/hlp/D3L_hlp8.htm diff --git a/D3Launch/hlp/D3L_hlp9.htm b/legacy/D3Launch/hlp/D3L_hlp9.htm similarity index 100% rename from D3Launch/hlp/D3L_hlp9.htm rename to legacy/D3Launch/hlp/D3L_hlp9.htm diff --git a/D3Launch/hlp/D3Launch.cnt b/legacy/D3Launch/hlp/D3Launch.cnt similarity index 100% rename from D3Launch/hlp/D3Launch.cnt rename to legacy/D3Launch/hlp/D3Launch.cnt diff --git a/D3Launch/hlp/D3Launch.hpj b/legacy/D3Launch/hlp/D3Launch.hpj similarity index 100% rename from D3Launch/hlp/D3Launch.hpj rename to legacy/D3Launch/hlp/D3Launch.hpj diff --git a/D3Launch/ia3dapi.h b/legacy/D3Launch/ia3dapi.h similarity index 100% rename from D3Launch/ia3dapi.h rename to legacy/D3Launch/ia3dapi.h diff --git a/D3Launch/res/Anim0.BMP b/legacy/D3Launch/res/Anim0.BMP similarity index 100% rename from D3Launch/res/Anim0.BMP rename to legacy/D3Launch/res/Anim0.BMP diff --git a/D3Launch/res/Anim1.BMP b/legacy/D3Launch/res/Anim1.BMP similarity index 100% rename from D3Launch/res/Anim1.BMP rename to legacy/D3Launch/res/Anim1.BMP diff --git a/D3Launch/res/Anim2.BMP b/legacy/D3Launch/res/Anim2.BMP similarity index 100% rename from D3Launch/res/Anim2.BMP rename to legacy/D3Launch/res/Anim2.BMP diff --git a/D3Launch/res/Anim3.BMP b/legacy/D3Launch/res/Anim3.BMP similarity index 100% rename from D3Launch/res/Anim3.BMP rename to legacy/D3Launch/res/Anim3.BMP diff --git a/D3Launch/res/Anim4.bmp b/legacy/D3Launch/res/Anim4.bmp similarity index 100% rename from D3Launch/res/Anim4.bmp rename to legacy/D3Launch/res/Anim4.bmp diff --git a/D3Launch/res/Anim5.bmp b/legacy/D3Launch/res/Anim5.bmp similarity index 100% rename from D3Launch/res/Anim5.bmp rename to legacy/D3Launch/res/Anim5.bmp diff --git a/D3Launch/res/Anim6.bmp b/legacy/D3Launch/res/Anim6.bmp similarity index 100% rename from D3Launch/res/Anim6.bmp rename to legacy/D3Launch/res/Anim6.bmp diff --git a/D3Launch/res/Anim7.bmp b/legacy/D3Launch/res/Anim7.bmp similarity index 100% rename from D3Launch/res/Anim7.bmp rename to legacy/D3Launch/res/Anim7.bmp diff --git a/D3Launch/res/Anim8.bmp b/legacy/D3Launch/res/Anim8.bmp similarity index 100% rename from D3Launch/res/Anim8.bmp rename to legacy/D3Launch/res/Anim8.bmp diff --git a/D3Launch/res/D3Launch.ico b/legacy/D3Launch/res/D3Launch.ico similarity index 100% rename from D3Launch/res/D3Launch.ico rename to legacy/D3Launch/res/D3Launch.ico diff --git a/D3Launch/res/D3Launch.rc2 b/legacy/D3Launch/res/D3Launch.rc2 similarity index 100% rename from D3Launch/res/D3Launch.rc2 rename to legacy/D3Launch/res/D3Launch.rc2 diff --git a/D3Launch/res/DirectxD.bmp b/legacy/D3Launch/res/DirectxD.bmp similarity index 100% rename from D3Launch/res/DirectxD.bmp rename to legacy/D3Launch/res/DirectxD.bmp diff --git a/D3Launch/res/DirectxM.bmp b/legacy/D3Launch/res/DirectxM.bmp similarity index 100% rename from D3Launch/res/DirectxM.bmp rename to legacy/D3Launch/res/DirectxM.bmp diff --git a/D3Launch/res/DirectxU.bmp b/legacy/D3Launch/res/DirectxU.bmp similarity index 100% rename from D3Launch/res/DirectxU.bmp rename to legacy/D3Launch/res/DirectxU.bmp diff --git a/D3Launch/res/DirectxX.bmp b/legacy/D3Launch/res/DirectxX.bmp similarity index 100% rename from D3Launch/res/DirectxX.bmp rename to legacy/D3Launch/res/DirectxX.bmp diff --git a/D3Launch/res/HelpD.bmp b/legacy/D3Launch/res/HelpD.bmp similarity index 100% rename from D3Launch/res/HelpD.bmp rename to legacy/D3Launch/res/HelpD.bmp diff --git a/D3Launch/res/HelpM.bmp b/legacy/D3Launch/res/HelpM.bmp similarity index 100% rename from D3Launch/res/HelpM.bmp rename to legacy/D3Launch/res/HelpM.bmp diff --git a/D3Launch/res/HelpU.bmp b/legacy/D3Launch/res/HelpU.bmp similarity index 100% rename from D3Launch/res/HelpU.bmp rename to legacy/D3Launch/res/HelpU.bmp diff --git a/D3Launch/res/LightD.BMP b/legacy/D3Launch/res/LightD.BMP similarity index 100% rename from D3Launch/res/LightD.BMP rename to legacy/D3Launch/res/LightD.BMP diff --git a/D3Launch/res/LightM.BMP b/legacy/D3Launch/res/LightM.BMP similarity index 100% rename from D3Launch/res/LightM.BMP rename to legacy/D3Launch/res/LightM.BMP diff --git a/D3Launch/res/LightU.BMP b/legacy/D3Launch/res/LightU.BMP similarity index 100% rename from D3Launch/res/LightU.BMP rename to legacy/D3Launch/res/LightU.BMP diff --git a/D3Launch/res/OutrageD.BMP b/legacy/D3Launch/res/OutrageD.BMP similarity index 100% rename from D3Launch/res/OutrageD.BMP rename to legacy/D3Launch/res/OutrageD.BMP diff --git a/D3Launch/res/OutrageM.BMP b/legacy/D3Launch/res/OutrageM.BMP similarity index 100% rename from D3Launch/res/OutrageM.BMP rename to legacy/D3Launch/res/OutrageM.BMP diff --git a/D3Launch/res/OutrageU.BMP b/legacy/D3Launch/res/OutrageU.BMP similarity index 100% rename from D3Launch/res/OutrageU.BMP rename to legacy/D3Launch/res/OutrageU.BMP diff --git a/D3Launch/res/Play.bmp b/legacy/D3Launch/res/Play.bmp similarity index 100% rename from D3Launch/res/Play.bmp rename to legacy/D3Launch/res/Play.bmp diff --git a/D3Launch/res/PlayD.bmp b/legacy/D3Launch/res/PlayD.bmp similarity index 100% rename from D3Launch/res/PlayD.bmp rename to legacy/D3Launch/res/PlayD.bmp diff --git a/D3Launch/res/PlayM.bmp b/legacy/D3Launch/res/PlayM.bmp similarity index 100% rename from D3Launch/res/PlayM.bmp rename to legacy/D3Launch/res/PlayM.bmp diff --git a/D3Launch/res/PlayX.BMP b/legacy/D3Launch/res/PlayX.BMP similarity index 100% rename from D3Launch/res/PlayX.BMP rename to legacy/D3Launch/res/PlayX.BMP diff --git a/D3Launch/res/Pxod.bmp b/legacy/D3Launch/res/Pxod.bmp similarity index 100% rename from D3Launch/res/Pxod.bmp rename to legacy/D3Launch/res/Pxod.bmp diff --git a/D3Launch/res/Pxom.bmp b/legacy/D3Launch/res/Pxom.bmp similarity index 100% rename from D3Launch/res/Pxom.bmp rename to legacy/D3Launch/res/Pxom.bmp diff --git a/D3Launch/res/Pxou.bmp b/legacy/D3Launch/res/Pxou.bmp similarity index 100% rename from D3Launch/res/Pxou.bmp rename to legacy/D3Launch/res/Pxou.bmp diff --git a/D3Launch/res/QuitD.bmp b/legacy/D3Launch/res/QuitD.bmp similarity index 100% rename from D3Launch/res/QuitD.bmp rename to legacy/D3Launch/res/QuitD.bmp diff --git a/D3Launch/res/QuitM.bmp b/legacy/D3Launch/res/QuitM.bmp similarity index 100% rename from D3Launch/res/QuitM.bmp rename to legacy/D3Launch/res/QuitM.bmp diff --git a/D3Launch/res/QuitU.bmp b/legacy/D3Launch/res/QuitU.bmp similarity index 100% rename from D3Launch/res/QuitU.bmp rename to legacy/D3Launch/res/QuitU.bmp diff --git a/D3Launch/res/ReadMeD.BMP b/legacy/D3Launch/res/ReadMeD.BMP similarity index 100% rename from D3Launch/res/ReadMeD.BMP rename to legacy/D3Launch/res/ReadMeD.BMP diff --git a/D3Launch/res/ReadMeM.BMP b/legacy/D3Launch/res/ReadMeM.BMP similarity index 100% rename from D3Launch/res/ReadMeM.BMP rename to legacy/D3Launch/res/ReadMeM.BMP diff --git a/D3Launch/res/ReadMeU.BMP b/legacy/D3Launch/res/ReadMeU.BMP similarity index 100% rename from D3Launch/res/ReadMeU.BMP rename to legacy/D3Launch/res/ReadMeU.BMP diff --git a/D3Launch/res/ReadMeX.BMP b/legacy/D3Launch/res/ReadMeX.BMP similarity index 100% rename from D3Launch/res/ReadMeX.BMP rename to legacy/D3Launch/res/ReadMeX.BMP diff --git a/D3Launch/res/SetupD.bmp b/legacy/D3Launch/res/SetupD.bmp similarity index 100% rename from D3Launch/res/SetupD.bmp rename to legacy/D3Launch/res/SetupD.bmp diff --git a/D3Launch/res/SetupM.bmp b/legacy/D3Launch/res/SetupM.bmp similarity index 100% rename from D3Launch/res/SetupM.bmp rename to legacy/D3Launch/res/SetupM.bmp diff --git a/D3Launch/res/SetupU.bmp b/legacy/D3Launch/res/SetupU.bmp similarity index 100% rename from D3Launch/res/SetupU.bmp rename to legacy/D3Launch/res/SetupU.bmp diff --git a/D3Launch/res/SetupX.bmp b/legacy/D3Launch/res/SetupX.bmp similarity index 100% rename from D3Launch/res/SetupX.bmp rename to legacy/D3Launch/res/SetupX.bmp diff --git a/D3Launch/res/UninstallD.bmp b/legacy/D3Launch/res/UninstallD.bmp similarity index 100% rename from D3Launch/res/UninstallD.bmp rename to legacy/D3Launch/res/UninstallD.bmp diff --git a/D3Launch/res/UninstallM.bmp b/legacy/D3Launch/res/UninstallM.bmp similarity index 100% rename from D3Launch/res/UninstallM.bmp rename to legacy/D3Launch/res/UninstallM.bmp diff --git a/D3Launch/res/UninstallU.bmp b/legacy/D3Launch/res/UninstallU.bmp similarity index 100% rename from D3Launch/res/UninstallU.bmp rename to legacy/D3Launch/res/UninstallU.bmp diff --git a/D3Launch/res/UninstallX.bmp b/legacy/D3Launch/res/UninstallX.bmp similarity index 100% rename from D3Launch/res/UninstallX.bmp rename to legacy/D3Launch/res/UninstallX.bmp diff --git a/D3Launch/res/UpdateD.bmp b/legacy/D3Launch/res/UpdateD.bmp similarity index 100% rename from D3Launch/res/UpdateD.bmp rename to legacy/D3Launch/res/UpdateD.bmp diff --git a/D3Launch/res/UpdateM.bmp b/legacy/D3Launch/res/UpdateM.bmp similarity index 100% rename from D3Launch/res/UpdateM.bmp rename to legacy/D3Launch/res/UpdateM.bmp diff --git a/D3Launch/res/UpdateU.bmp b/legacy/D3Launch/res/UpdateU.bmp similarity index 100% rename from D3Launch/res/UpdateU.bmp rename to legacy/D3Launch/res/UpdateU.bmp diff --git a/D3Launch/res/UpdateX.bmp b/legacy/D3Launch/res/UpdateX.bmp similarity index 100% rename from D3Launch/res/UpdateX.bmp rename to legacy/D3Launch/res/UpdateX.bmp diff --git a/D3Launch/res/bitmap1.bmp b/legacy/D3Launch/res/bitmap1.bmp similarity index 100% rename from D3Launch/res/bitmap1.bmp rename to legacy/D3Launch/res/bitmap1.bmp diff --git a/D3Launch/res/breath.wav b/legacy/D3Launch/res/breath.wav similarity index 100% rename from D3Launch/res/breath.wav rename to legacy/D3Launch/res/breath.wav diff --git a/D3Launch/res/briefingtype1.wav b/legacy/D3Launch/res/briefingtype1.wav similarity index 100% rename from D3Launch/res/briefingtype1.wav rename to legacy/D3Launch/res/briefingtype1.wav diff --git a/D3Launch/res/bulbstc.wav b/legacy/D3Launch/res/bulbstc.wav similarity index 100% rename from D3Launch/res/bulbstc.wav rename to legacy/D3Launch/res/bulbstc.wav diff --git a/D3Launch/res/fanE.wav b/legacy/D3Launch/res/fanE.wav similarity index 100% rename from D3Launch/res/fanE.wav rename to legacy/D3Launch/res/fanE.wav diff --git a/D3Launch/res/palette.bmp b/legacy/D3Launch/res/palette.bmp similarity index 100% rename from D3Launch/res/palette.bmp rename to legacy/D3Launch/res/palette.bmp diff --git a/D3Launch/res/running.wav b/legacy/D3Launch/res/running.wav similarity index 100% rename from D3Launch/res/running.wav rename to legacy/D3Launch/res/running.wav diff --git a/D3Launch/resource.h b/legacy/D3Launch/resource.h similarity index 100% rename from D3Launch/resource.h rename to legacy/D3Launch/resource.h diff --git a/FontEditor/Args.h b/legacy/FontEditor/Args.h similarity index 100% rename from FontEditor/Args.h rename to legacy/FontEditor/Args.h diff --git a/FontEditor/FontCreate.cpp b/legacy/FontEditor/FontCreate.cpp similarity index 100% rename from FontEditor/FontCreate.cpp rename to legacy/FontEditor/FontCreate.cpp diff --git a/FontEditor/FontEditor.cpp b/legacy/FontEditor/FontEditor.cpp similarity index 100% rename from FontEditor/FontEditor.cpp rename to legacy/FontEditor/FontEditor.cpp diff --git a/FontEditor/FontEditor.h b/legacy/FontEditor/FontEditor.h similarity index 100% rename from FontEditor/FontEditor.h rename to legacy/FontEditor/FontEditor.h diff --git a/FontEditor/FontKern.cpp b/legacy/FontEditor/FontKern.cpp similarity index 100% rename from FontEditor/FontKern.cpp rename to legacy/FontEditor/FontKern.cpp diff --git a/FontEditor/StdAfx.cpp b/legacy/FontEditor/StdAfx.cpp similarity index 100% rename from FontEditor/StdAfx.cpp rename to legacy/FontEditor/StdAfx.cpp diff --git a/FontEditor/StdAfx.h b/legacy/FontEditor/StdAfx.h similarity index 100% rename from FontEditor/StdAfx.h rename to legacy/FontEditor/StdAfx.h diff --git a/FontEditor/args.cpp b/legacy/FontEditor/args.cpp similarity index 100% rename from FontEditor/args.cpp rename to legacy/FontEditor/args.cpp diff --git a/FontEditor/libvars.cpp b/legacy/FontEditor/libvars.cpp similarity index 100% rename from FontEditor/libvars.cpp rename to legacy/FontEditor/libvars.cpp diff --git a/briefinglocalizer/StdAfx.cpp b/legacy/briefinglocalizer/StdAfx.cpp similarity index 100% rename from briefinglocalizer/StdAfx.cpp rename to legacy/briefinglocalizer/StdAfx.cpp diff --git a/briefinglocalizer/StdAfx.h b/legacy/briefinglocalizer/StdAfx.h similarity index 100% rename from briefinglocalizer/StdAfx.h rename to legacy/briefinglocalizer/StdAfx.h diff --git a/briefinglocalizer/briefinglocalizer.cpp b/legacy/briefinglocalizer/briefinglocalizer.cpp similarity index 100% rename from briefinglocalizer/briefinglocalizer.cpp rename to legacy/briefinglocalizer/briefinglocalizer.cpp diff --git a/briefinglocalizer/briefinglocalizer.h b/legacy/briefinglocalizer/briefinglocalizer.h similarity index 100% rename from briefinglocalizer/briefinglocalizer.h rename to legacy/briefinglocalizer/briefinglocalizer.h diff --git a/briefinglocalizer/briefinglocalizer.rc b/legacy/briefinglocalizer/briefinglocalizer.rc similarity index 100% rename from briefinglocalizer/briefinglocalizer.rc rename to legacy/briefinglocalizer/briefinglocalizer.rc diff --git a/briefinglocalizer/briefinglocalizerDlg.cpp b/legacy/briefinglocalizer/briefinglocalizerDlg.cpp similarity index 100% rename from briefinglocalizer/briefinglocalizerDlg.cpp rename to legacy/briefinglocalizer/briefinglocalizerDlg.cpp diff --git a/briefinglocalizer/briefinglocalizerDlg.h b/legacy/briefinglocalizer/briefinglocalizerDlg.h similarity index 100% rename from briefinglocalizer/briefinglocalizerDlg.h rename to legacy/briefinglocalizer/briefinglocalizerDlg.h diff --git a/briefinglocalizer/res/briefinglocalizer.ico b/legacy/briefinglocalizer/res/briefinglocalizer.ico similarity index 100% rename from briefinglocalizer/res/briefinglocalizer.ico rename to legacy/briefinglocalizer/res/briefinglocalizer.ico diff --git a/briefinglocalizer/res/briefinglocalizer.rc2 b/legacy/briefinglocalizer/res/briefinglocalizer.rc2 similarity index 100% rename from briefinglocalizer/res/briefinglocalizer.rc2 rename to legacy/briefinglocalizer/res/briefinglocalizer.rc2 diff --git a/briefinglocalizer/resource.h b/legacy/briefinglocalizer/resource.h similarity index 100% rename from briefinglocalizer/resource.h rename to legacy/briefinglocalizer/resource.h diff --git a/editor/AISettingsDlg.cpp b/legacy/editor/AISettingsDlg.cpp similarity index 100% rename from editor/AISettingsDlg.cpp rename to legacy/editor/AISettingsDlg.cpp diff --git a/editor/AISettingsDlg.h b/legacy/editor/AISettingsDlg.h similarity index 100% rename from editor/AISettingsDlg.h rename to legacy/editor/AISettingsDlg.h diff --git a/editor/AddScriptDialog.cpp b/legacy/editor/AddScriptDialog.cpp similarity index 100% rename from editor/AddScriptDialog.cpp rename to legacy/editor/AddScriptDialog.cpp diff --git a/editor/AddScriptDialog.h b/legacy/editor/AddScriptDialog.h similarity index 100% rename from editor/AddScriptDialog.h rename to legacy/editor/AddScriptDialog.h diff --git a/editor/AmbientSoundElement.cpp b/legacy/editor/AmbientSoundElement.cpp similarity index 100% rename from editor/AmbientSoundElement.cpp rename to legacy/editor/AmbientSoundElement.cpp diff --git a/editor/AmbientSoundElement.h b/legacy/editor/AmbientSoundElement.h similarity index 100% rename from editor/AmbientSoundElement.h rename to legacy/editor/AmbientSoundElement.h diff --git a/editor/AmbientSoundPattern.cpp b/legacy/editor/AmbientSoundPattern.cpp similarity index 100% rename from editor/AmbientSoundPattern.cpp rename to legacy/editor/AmbientSoundPattern.cpp diff --git a/editor/AmbientSoundPattern.h b/legacy/editor/AmbientSoundPattern.h similarity index 100% rename from editor/AmbientSoundPattern.h rename to legacy/editor/AmbientSoundPattern.h diff --git a/editor/AnimStatesDialog.cpp b/legacy/editor/AnimStatesDialog.cpp similarity index 100% rename from editor/AnimStatesDialog.cpp rename to legacy/editor/AnimStatesDialog.cpp diff --git a/editor/AnimStatesDialog.h b/legacy/editor/AnimStatesDialog.h similarity index 100% rename from editor/AnimStatesDialog.h rename to legacy/editor/AnimStatesDialog.h diff --git a/editor/BriefBitmapEdit.cpp b/legacy/editor/BriefBitmapEdit.cpp similarity index 100% rename from editor/BriefBitmapEdit.cpp rename to legacy/editor/BriefBitmapEdit.cpp diff --git a/editor/BriefBitmapEdit.h b/legacy/editor/BriefBitmapEdit.h similarity index 100% rename from editor/BriefBitmapEdit.h rename to legacy/editor/BriefBitmapEdit.h diff --git a/editor/BriefButtonEdit.cpp b/legacy/editor/BriefButtonEdit.cpp similarity index 100% rename from editor/BriefButtonEdit.cpp rename to legacy/editor/BriefButtonEdit.cpp diff --git a/editor/BriefButtonEdit.h b/legacy/editor/BriefButtonEdit.h similarity index 100% rename from editor/BriefButtonEdit.h rename to legacy/editor/BriefButtonEdit.h diff --git a/editor/BriefEdit.cpp b/legacy/editor/BriefEdit.cpp similarity index 100% rename from editor/BriefEdit.cpp rename to legacy/editor/BriefEdit.cpp diff --git a/editor/BriefEdit.h b/legacy/editor/BriefEdit.h similarity index 100% rename from editor/BriefEdit.h rename to legacy/editor/BriefEdit.h diff --git a/editor/BriefManage.cpp b/legacy/editor/BriefManage.cpp similarity index 100% rename from editor/BriefManage.cpp rename to legacy/editor/BriefManage.cpp diff --git a/editor/BriefManage.h b/legacy/editor/BriefManage.h similarity index 100% rename from editor/BriefManage.h rename to legacy/editor/BriefManage.h diff --git a/editor/BriefMissionFlagsDlg.cpp b/legacy/editor/BriefMissionFlagsDlg.cpp similarity index 100% rename from editor/BriefMissionFlagsDlg.cpp rename to legacy/editor/BriefMissionFlagsDlg.cpp diff --git a/editor/BriefMissionFlagsDlg.h b/legacy/editor/BriefMissionFlagsDlg.h similarity index 100% rename from editor/BriefMissionFlagsDlg.h rename to legacy/editor/BriefMissionFlagsDlg.h diff --git a/editor/BriefMovieEdit.cpp b/legacy/editor/BriefMovieEdit.cpp similarity index 100% rename from editor/BriefMovieEdit.cpp rename to legacy/editor/BriefMovieEdit.cpp diff --git a/editor/BriefMovieEdit.h b/legacy/editor/BriefMovieEdit.h similarity index 100% rename from editor/BriefMovieEdit.h rename to legacy/editor/BriefMovieEdit.h diff --git a/editor/BriefScreenEdit.cpp b/legacy/editor/BriefScreenEdit.cpp similarity index 100% rename from editor/BriefScreenEdit.cpp rename to legacy/editor/BriefScreenEdit.cpp diff --git a/editor/BriefScreenEdit.h b/legacy/editor/BriefScreenEdit.h similarity index 100% rename from editor/BriefScreenEdit.h rename to legacy/editor/BriefScreenEdit.h diff --git a/editor/BriefSoundEdit.cpp b/legacy/editor/BriefSoundEdit.cpp similarity index 100% rename from editor/BriefSoundEdit.cpp rename to legacy/editor/BriefSoundEdit.cpp diff --git a/editor/BriefSoundEdit.h b/legacy/editor/BriefSoundEdit.h similarity index 100% rename from editor/BriefSoundEdit.h rename to legacy/editor/BriefSoundEdit.h diff --git a/editor/BriefTextEdit.cpp b/legacy/editor/BriefTextEdit.cpp similarity index 100% rename from editor/BriefTextEdit.cpp rename to legacy/editor/BriefTextEdit.cpp diff --git a/editor/BriefTextEdit.h b/legacy/editor/BriefTextEdit.h similarity index 100% rename from editor/BriefTextEdit.h rename to legacy/editor/BriefTextEdit.h diff --git a/editor/CreateNewScriptDlg.cpp b/legacy/editor/CreateNewScriptDlg.cpp similarity index 100% rename from editor/CreateNewScriptDlg.cpp rename to legacy/editor/CreateNewScriptDlg.cpp diff --git a/editor/CreateNewScriptDlg.h b/legacy/editor/CreateNewScriptDlg.h similarity index 100% rename from editor/CreateNewScriptDlg.h rename to legacy/editor/CreateNewScriptDlg.h diff --git a/editor/CustDefaultScriptSelect.cpp b/legacy/editor/CustDefaultScriptSelect.cpp similarity index 100% rename from editor/CustDefaultScriptSelect.cpp rename to legacy/editor/CustDefaultScriptSelect.cpp diff --git a/editor/CustDefaultScriptSelect.h b/legacy/editor/CustDefaultScriptSelect.h similarity index 100% rename from editor/CustDefaultScriptSelect.h rename to legacy/editor/CustDefaultScriptSelect.h diff --git a/editor/CustomObjectDialog.cpp b/legacy/editor/CustomObjectDialog.cpp similarity index 100% rename from editor/CustomObjectDialog.cpp rename to legacy/editor/CustomObjectDialog.cpp diff --git a/editor/CustomObjectDialog.h b/legacy/editor/CustomObjectDialog.h similarity index 100% rename from editor/CustomObjectDialog.h rename to legacy/editor/CustomObjectDialog.h diff --git a/editor/D3Splash.cpp b/legacy/editor/D3Splash.cpp similarity index 100% rename from editor/D3Splash.cpp rename to legacy/editor/D3Splash.cpp diff --git a/editor/D3Splash.h b/legacy/editor/D3Splash.h similarity index 100% rename from editor/D3Splash.h rename to legacy/editor/D3Splash.h diff --git a/editor/D3XStringEditor.cpp b/legacy/editor/D3XStringEditor.cpp similarity index 100% rename from editor/D3XStringEditor.cpp rename to legacy/editor/D3XStringEditor.cpp diff --git a/editor/D3XStringEditor.h b/legacy/editor/D3XStringEditor.h similarity index 100% rename from editor/D3XStringEditor.h rename to legacy/editor/D3XStringEditor.h diff --git a/editor/DallasFlagDlg.cpp b/legacy/editor/DallasFlagDlg.cpp similarity index 100% rename from editor/DallasFlagDlg.cpp rename to legacy/editor/DallasFlagDlg.cpp diff --git a/editor/DallasFlagDlg.h b/legacy/editor/DallasFlagDlg.h similarity index 100% rename from editor/DallasFlagDlg.h rename to legacy/editor/DallasFlagDlg.h diff --git a/editor/DallasGenericPromptDlg.cpp b/legacy/editor/DallasGenericPromptDlg.cpp similarity index 100% rename from editor/DallasGenericPromptDlg.cpp rename to legacy/editor/DallasGenericPromptDlg.cpp diff --git a/editor/DallasGenericPromptDlg.h b/legacy/editor/DallasGenericPromptDlg.h similarity index 100% rename from editor/DallasGenericPromptDlg.h rename to legacy/editor/DallasGenericPromptDlg.h diff --git a/editor/DallasImportDlg.cpp b/legacy/editor/DallasImportDlg.cpp similarity index 100% rename from editor/DallasImportDlg.cpp rename to legacy/editor/DallasImportDlg.cpp diff --git a/editor/DallasImportDlg.h b/legacy/editor/DallasImportDlg.h similarity index 100% rename from editor/DallasImportDlg.h rename to legacy/editor/DallasImportDlg.h diff --git a/editor/DallasMainDlg.cpp b/legacy/editor/DallasMainDlg.cpp similarity index 100% rename from editor/DallasMainDlg.cpp rename to legacy/editor/DallasMainDlg.cpp diff --git a/editor/DallasMainDlg.h b/legacy/editor/DallasMainDlg.h similarity index 100% rename from editor/DallasMainDlg.h rename to legacy/editor/DallasMainDlg.h diff --git a/editor/DallasSoundDlg.cpp b/legacy/editor/DallasSoundDlg.cpp similarity index 100% rename from editor/DallasSoundDlg.cpp rename to legacy/editor/DallasSoundDlg.cpp diff --git a/editor/DallasSoundDlg.h b/legacy/editor/DallasSoundDlg.h similarity index 100% rename from editor/DallasSoundDlg.h rename to legacy/editor/DallasSoundDlg.h diff --git a/editor/DallasStrmAudioDlg.cpp b/legacy/editor/DallasStrmAudioDlg.cpp similarity index 100% rename from editor/DallasStrmAudioDlg.cpp rename to legacy/editor/DallasStrmAudioDlg.cpp diff --git a/editor/DallasStrmAudioDlg.h b/legacy/editor/DallasStrmAudioDlg.h similarity index 100% rename from editor/DallasStrmAudioDlg.h rename to legacy/editor/DallasStrmAudioDlg.h diff --git a/editor/DallasTextureDlg.cpp b/legacy/editor/DallasTextureDlg.cpp similarity index 100% rename from editor/DallasTextureDlg.cpp rename to legacy/editor/DallasTextureDlg.cpp diff --git a/editor/DallasTextureDlg.h b/legacy/editor/DallasTextureDlg.h similarity index 100% rename from editor/DallasTextureDlg.h rename to legacy/editor/DallasTextureDlg.h diff --git a/editor/DallasUserTypesDlg.cpp b/legacy/editor/DallasUserTypesDlg.cpp similarity index 100% rename from editor/DallasUserTypesDlg.cpp rename to legacy/editor/DallasUserTypesDlg.cpp diff --git a/editor/DallasUserTypesDlg.h b/legacy/editor/DallasUserTypesDlg.h similarity index 100% rename from editor/DallasUserTypesDlg.h rename to legacy/editor/DallasUserTypesDlg.h diff --git a/editor/DallasUtilities.cpp b/legacy/editor/DallasUtilities.cpp similarity index 100% rename from editor/DallasUtilities.cpp rename to legacy/editor/DallasUtilities.cpp diff --git a/editor/DallasUtilities.h b/legacy/editor/DallasUtilities.h similarity index 100% rename from editor/DallasUtilities.h rename to legacy/editor/DallasUtilities.h diff --git a/editor/DallasVectorPromptDialog.cpp b/legacy/editor/DallasVectorPromptDialog.cpp similarity index 100% rename from editor/DallasVectorPromptDialog.cpp rename to legacy/editor/DallasVectorPromptDialog.cpp diff --git a/editor/DallasVectorPromptDialog.h b/legacy/editor/DallasVectorPromptDialog.h similarity index 100% rename from editor/DallasVectorPromptDialog.h rename to legacy/editor/DallasVectorPromptDialog.h diff --git a/editor/DeathDialog.cpp b/legacy/editor/DeathDialog.cpp similarity index 100% rename from editor/DeathDialog.cpp rename to legacy/editor/DeathDialog.cpp diff --git a/editor/DeathDialog.h b/legacy/editor/DeathDialog.h similarity index 100% rename from editor/DeathDialog.h rename to legacy/editor/DeathDialog.h diff --git a/editor/DoorwayDialog.cpp b/legacy/editor/DoorwayDialog.cpp similarity index 100% rename from editor/DoorwayDialog.cpp rename to legacy/editor/DoorwayDialog.cpp diff --git a/editor/DoorwayDialog.h b/legacy/editor/DoorwayDialog.h similarity index 100% rename from editor/DoorwayDialog.h rename to legacy/editor/DoorwayDialog.h diff --git a/editor/EDVARS.cpp b/legacy/editor/EDVARS.cpp similarity index 100% rename from editor/EDVARS.cpp rename to legacy/editor/EDVARS.cpp diff --git a/editor/EPath.cpp b/legacy/editor/EPath.cpp similarity index 100% rename from editor/EPath.cpp rename to legacy/editor/EPath.cpp diff --git a/editor/EPath.h b/legacy/editor/EPath.h similarity index 100% rename from editor/EPath.h rename to legacy/editor/EPath.h diff --git a/editor/EditLineDialog.cpp b/legacy/editor/EditLineDialog.cpp similarity index 100% rename from editor/EditLineDialog.cpp rename to legacy/editor/EditLineDialog.cpp diff --git a/editor/EditLineDialog.h b/legacy/editor/EditLineDialog.h similarity index 100% rename from editor/EditLineDialog.h rename to legacy/editor/EditLineDialog.h diff --git a/editor/Erooms.cpp b/legacy/editor/Erooms.cpp similarity index 100% rename from editor/Erooms.cpp rename to legacy/editor/Erooms.cpp diff --git a/editor/Erooms.h b/legacy/editor/Erooms.h similarity index 100% rename from editor/Erooms.h rename to legacy/editor/Erooms.h diff --git a/editor/FilePageAddDlg.cpp b/legacy/editor/FilePageAddDlg.cpp similarity index 100% rename from editor/FilePageAddDlg.cpp rename to legacy/editor/FilePageAddDlg.cpp diff --git a/editor/FilePageAddDlg.h b/legacy/editor/FilePageAddDlg.h similarity index 100% rename from editor/FilePageAddDlg.h rename to legacy/editor/FilePageAddDlg.h diff --git a/editor/FilePageDialog.cpp b/legacy/editor/FilePageDialog.cpp similarity index 100% rename from editor/FilePageDialog.cpp rename to legacy/editor/FilePageDialog.cpp diff --git a/editor/FilePageDialog.h b/legacy/editor/FilePageDialog.h similarity index 100% rename from editor/FilePageDialog.h rename to legacy/editor/FilePageDialog.h diff --git a/editor/FloatingKeypadDialog.cpp b/legacy/editor/FloatingKeypadDialog.cpp similarity index 100% rename from editor/FloatingKeypadDialog.cpp rename to legacy/editor/FloatingKeypadDialog.cpp diff --git a/editor/FloatingKeypadDialog.h b/legacy/editor/FloatingKeypadDialog.h similarity index 100% rename from editor/FloatingKeypadDialog.h rename to legacy/editor/FloatingKeypadDialog.h diff --git a/editor/GenericDeathDialog.cpp b/legacy/editor/GenericDeathDialog.cpp similarity index 100% rename from editor/GenericDeathDialog.cpp rename to legacy/editor/GenericDeathDialog.cpp diff --git a/editor/GenericDeathDialog.h b/legacy/editor/GenericDeathDialog.h similarity index 100% rename from editor/GenericDeathDialog.h rename to legacy/editor/GenericDeathDialog.h diff --git a/editor/GenericLightDialog.cpp b/legacy/editor/GenericLightDialog.cpp similarity index 100% rename from editor/GenericLightDialog.cpp rename to legacy/editor/GenericLightDialog.cpp diff --git a/editor/GenericLightDialog.h b/legacy/editor/GenericLightDialog.h similarity index 100% rename from editor/GenericLightDialog.h rename to legacy/editor/GenericLightDialog.h diff --git a/editor/GrFontDialog.cpp b/legacy/editor/GrFontDialog.cpp similarity index 100% rename from editor/GrFontDialog.cpp rename to legacy/editor/GrFontDialog.cpp diff --git a/editor/GrFontDialog.h b/legacy/editor/GrFontDialog.h similarity index 100% rename from editor/GrFontDialog.h rename to legacy/editor/GrFontDialog.h diff --git a/editor/GrListBox.cpp b/legacy/editor/GrListBox.cpp similarity index 100% rename from editor/GrListBox.cpp rename to legacy/editor/GrListBox.cpp diff --git a/editor/GrListBox.h b/legacy/editor/GrListBox.h similarity index 100% rename from editor/GrListBox.h rename to legacy/editor/GrListBox.h diff --git a/editor/GrWnd.cpp b/legacy/editor/GrWnd.cpp similarity index 100% rename from editor/GrWnd.cpp rename to legacy/editor/GrWnd.cpp diff --git a/editor/GrWnd.h b/legacy/editor/GrWnd.h similarity index 100% rename from editor/GrWnd.h rename to legacy/editor/GrWnd.h diff --git a/editor/Group.cpp b/legacy/editor/Group.cpp similarity index 100% rename from editor/Group.cpp rename to legacy/editor/Group.cpp diff --git a/editor/HFile.cpp b/legacy/editor/HFile.cpp similarity index 100% rename from editor/HFile.cpp rename to legacy/editor/HFile.cpp diff --git a/editor/HFile.h b/legacy/editor/HFile.h similarity index 100% rename from editor/HFile.h rename to legacy/editor/HFile.h diff --git a/editor/HObject.cpp b/legacy/editor/HObject.cpp similarity index 100% rename from editor/HObject.cpp rename to legacy/editor/HObject.cpp diff --git a/editor/HObject.h b/legacy/editor/HObject.h similarity index 100% rename from editor/HObject.h rename to legacy/editor/HObject.h diff --git a/editor/HRoom.cpp b/legacy/editor/HRoom.cpp similarity index 100% rename from editor/HRoom.cpp rename to legacy/editor/HRoom.cpp diff --git a/editor/HRoom.h b/legacy/editor/HRoom.h similarity index 100% rename from editor/HRoom.h rename to legacy/editor/HRoom.h diff --git a/editor/HTexture.cpp b/legacy/editor/HTexture.cpp similarity index 100% rename from editor/HTexture.cpp rename to legacy/editor/HTexture.cpp diff --git a/editor/HTexture.h b/legacy/editor/HTexture.h similarity index 100% rename from editor/HTexture.h rename to legacy/editor/HTexture.h diff --git a/editor/HView.cpp b/legacy/editor/HView.cpp similarity index 100% rename from editor/HView.cpp rename to legacy/editor/HView.cpp diff --git a/editor/HView.h b/legacy/editor/HView.h similarity index 100% rename from editor/HView.h rename to legacy/editor/HView.h diff --git a/editor/HogDialog.cpp b/legacy/editor/HogDialog.cpp similarity index 100% rename from editor/HogDialog.cpp rename to legacy/editor/HogDialog.cpp diff --git a/editor/HogDialog.h b/legacy/editor/HogDialog.h similarity index 100% rename from editor/HogDialog.h rename to legacy/editor/HogDialog.h diff --git a/editor/IpFrame.cpp b/legacy/editor/IpFrame.cpp similarity index 100% rename from editor/IpFrame.cpp rename to legacy/editor/IpFrame.cpp diff --git a/editor/IpFrame.h b/legacy/editor/IpFrame.h similarity index 100% rename from editor/IpFrame.h rename to legacy/editor/IpFrame.h diff --git a/editor/KeypadDialog.cpp b/legacy/editor/KeypadDialog.cpp similarity index 100% rename from editor/KeypadDialog.cpp rename to legacy/editor/KeypadDialog.cpp diff --git a/editor/KeypadDialog.h b/legacy/editor/KeypadDialog.h similarity index 100% rename from editor/KeypadDialog.h rename to legacy/editor/KeypadDialog.h diff --git a/editor/LevelDialog.cpp b/legacy/editor/LevelDialog.cpp similarity index 100% rename from editor/LevelDialog.cpp rename to legacy/editor/LevelDialog.cpp diff --git a/editor/LevelDialog.h b/legacy/editor/LevelDialog.h similarity index 100% rename from editor/LevelDialog.h rename to legacy/editor/LevelDialog.h diff --git a/editor/LevelInfoDialog.cpp b/legacy/editor/LevelInfoDialog.cpp similarity index 100% rename from editor/LevelInfoDialog.cpp rename to legacy/editor/LevelInfoDialog.cpp diff --git a/editor/LevelInfoDialog.h b/legacy/editor/LevelInfoDialog.h similarity index 100% rename from editor/LevelInfoDialog.h rename to legacy/editor/LevelInfoDialog.h diff --git a/editor/LightingDialog.cpp b/legacy/editor/LightingDialog.cpp similarity index 100% rename from editor/LightingDialog.cpp rename to legacy/editor/LightingDialog.cpp diff --git a/editor/LightingDialog.h b/legacy/editor/LightingDialog.h similarity index 100% rename from editor/LightingDialog.h rename to legacy/editor/LightingDialog.h diff --git a/editor/LightingStatus.cpp b/legacy/editor/LightingStatus.cpp similarity index 100% rename from editor/LightingStatus.cpp rename to legacy/editor/LightingStatus.cpp diff --git a/editor/LightingStatus.h b/legacy/editor/LightingStatus.h similarity index 100% rename from editor/LightingStatus.h rename to legacy/editor/LightingStatus.h diff --git a/editor/MainFrm.cpp b/legacy/editor/MainFrm.cpp similarity index 100% rename from editor/MainFrm.cpp rename to legacy/editor/MainFrm.cpp diff --git a/editor/MainFrm.h b/legacy/editor/MainFrm.h similarity index 100% rename from editor/MainFrm.h rename to legacy/editor/MainFrm.h diff --git a/editor/ManageCheckin.cpp b/legacy/editor/ManageCheckin.cpp similarity index 100% rename from editor/ManageCheckin.cpp rename to legacy/editor/ManageCheckin.cpp diff --git a/editor/ManageCheckin.h b/legacy/editor/ManageCheckin.h similarity index 100% rename from editor/ManageCheckin.h rename to legacy/editor/ManageCheckin.h diff --git a/editor/MegacellDialog.cpp b/legacy/editor/MegacellDialog.cpp similarity index 100% rename from editor/MegacellDialog.cpp rename to legacy/editor/MegacellDialog.cpp diff --git a/editor/MegacellDialog.h b/legacy/editor/MegacellDialog.h similarity index 100% rename from editor/MegacellDialog.h rename to legacy/editor/MegacellDialog.h diff --git a/editor/MegacellKeypad.cpp b/legacy/editor/MegacellKeypad.cpp similarity index 100% rename from editor/MegacellKeypad.cpp rename to legacy/editor/MegacellKeypad.cpp diff --git a/editor/MegacellKeypad.h b/legacy/editor/MegacellKeypad.h similarity index 100% rename from editor/MegacellKeypad.h rename to legacy/editor/MegacellKeypad.h diff --git a/editor/ObjCScript.cpp b/legacy/editor/ObjCScript.cpp similarity index 100% rename from editor/ObjCScript.cpp rename to legacy/editor/ObjCScript.cpp diff --git a/editor/ObjCScript.h b/legacy/editor/ObjCScript.h similarity index 100% rename from editor/ObjCScript.h rename to legacy/editor/ObjCScript.h diff --git a/editor/ObjMoveManager.cpp b/legacy/editor/ObjMoveManager.cpp similarity index 100% rename from editor/ObjMoveManager.cpp rename to legacy/editor/ObjMoveManager.cpp diff --git a/editor/ObjMoveManager.h b/legacy/editor/ObjMoveManager.h similarity index 100% rename from editor/ObjMoveManager.h rename to legacy/editor/ObjMoveManager.h diff --git a/editor/ObjectClipboard.cpp b/legacy/editor/ObjectClipboard.cpp similarity index 100% rename from editor/ObjectClipboard.cpp rename to legacy/editor/ObjectClipboard.cpp diff --git a/editor/ObjectClipboard.h b/legacy/editor/ObjectClipboard.h similarity index 100% rename from editor/ObjectClipboard.h rename to legacy/editor/ObjectClipboard.h diff --git a/editor/ObjectDialog.cpp b/legacy/editor/ObjectDialog.cpp similarity index 100% rename from editor/ObjectDialog.cpp rename to legacy/editor/ObjectDialog.cpp diff --git a/editor/ObjectDialog.h b/legacy/editor/ObjectDialog.h similarity index 100% rename from editor/ObjectDialog.h rename to legacy/editor/ObjectDialog.h diff --git a/editor/ObjectListCombo.cpp b/legacy/editor/ObjectListCombo.cpp similarity index 100% rename from editor/ObjectListCombo.cpp rename to legacy/editor/ObjectListCombo.cpp diff --git a/editor/ObjectListCombo.h b/legacy/editor/ObjectListCombo.h similarity index 100% rename from editor/ObjectListCombo.h rename to legacy/editor/ObjectListCombo.h diff --git a/editor/ObjectListDialog.cpp b/legacy/editor/ObjectListDialog.cpp similarity index 100% rename from editor/ObjectListDialog.cpp rename to legacy/editor/ObjectListDialog.cpp diff --git a/editor/ObjectListDialog.h b/legacy/editor/ObjectListDialog.h similarity index 100% rename from editor/ObjectListDialog.h rename to legacy/editor/ObjectListDialog.h diff --git a/editor/ObjectPropertiesDialog.cpp b/legacy/editor/ObjectPropertiesDialog.cpp similarity index 100% rename from editor/ObjectPropertiesDialog.cpp rename to legacy/editor/ObjectPropertiesDialog.cpp diff --git a/editor/ObjectPropertiesDialog.h b/legacy/editor/ObjectPropertiesDialog.h similarity index 100% rename from editor/ObjectPropertiesDialog.h rename to legacy/editor/ObjectPropertiesDialog.h diff --git a/editor/OrphanRemoveDlg.cpp b/legacy/editor/OrphanRemoveDlg.cpp similarity index 100% rename from editor/OrphanRemoveDlg.cpp rename to legacy/editor/OrphanRemoveDlg.cpp diff --git a/editor/OrphanRemoveDlg.h b/legacy/editor/OrphanRemoveDlg.h similarity index 100% rename from editor/OrphanRemoveDlg.h rename to legacy/editor/OrphanRemoveDlg.h diff --git a/editor/OsirisStatusDlg.cpp b/legacy/editor/OsirisStatusDlg.cpp similarity index 100% rename from editor/OsirisStatusDlg.cpp rename to legacy/editor/OsirisStatusDlg.cpp diff --git a/editor/OsirisStatusDlg.h b/legacy/editor/OsirisStatusDlg.h similarity index 100% rename from editor/OsirisStatusDlg.h rename to legacy/editor/OsirisStatusDlg.h diff --git a/editor/PathPadDialog.cpp b/legacy/editor/PathPadDialog.cpp similarity index 100% rename from editor/PathPadDialog.cpp rename to legacy/editor/PathPadDialog.cpp diff --git a/editor/PathPadDialog.h b/legacy/editor/PathPadDialog.h similarity index 100% rename from editor/PathPadDialog.h rename to legacy/editor/PathPadDialog.h diff --git a/editor/PhysicsDlg.cpp b/legacy/editor/PhysicsDlg.cpp similarity index 100% rename from editor/PhysicsDlg.cpp rename to legacy/editor/PhysicsDlg.cpp diff --git a/editor/PhysicsDlg.h b/legacy/editor/PhysicsDlg.h similarity index 100% rename from editor/PhysicsDlg.h rename to legacy/editor/PhysicsDlg.h diff --git a/editor/PictListBox.cpp b/legacy/editor/PictListBox.cpp similarity index 100% rename from editor/PictListBox.cpp rename to legacy/editor/PictListBox.cpp diff --git a/editor/PictListBox.h b/legacy/editor/PictListBox.h similarity index 100% rename from editor/PictListBox.h rename to legacy/editor/PictListBox.h diff --git a/editor/PlayerWeaponsDialog.cpp b/legacy/editor/PlayerWeaponsDialog.cpp similarity index 100% rename from editor/PlayerWeaponsDialog.cpp rename to legacy/editor/PlayerWeaponsDialog.cpp diff --git a/editor/PlayerWeaponsDialog.h b/legacy/editor/PlayerWeaponsDialog.h similarity index 100% rename from editor/PlayerWeaponsDialog.h rename to legacy/editor/PlayerWeaponsDialog.h diff --git a/editor/PowerupPropDialog.cpp b/legacy/editor/PowerupPropDialog.cpp similarity index 100% rename from editor/PowerupPropDialog.cpp rename to legacy/editor/PowerupPropDialog.cpp diff --git a/editor/PowerupPropDialog.h b/legacy/editor/PowerupPropDialog.h similarity index 100% rename from editor/PowerupPropDialog.h rename to legacy/editor/PowerupPropDialog.h diff --git a/editor/PreferencesDialog.cpp b/legacy/editor/PreferencesDialog.cpp similarity index 100% rename from editor/PreferencesDialog.cpp rename to legacy/editor/PreferencesDialog.cpp diff --git a/editor/PreferencesDialog.h b/legacy/editor/PreferencesDialog.h similarity index 100% rename from editor/PreferencesDialog.h rename to legacy/editor/PreferencesDialog.h diff --git a/editor/ProceduralDialog.cpp b/legacy/editor/ProceduralDialog.cpp similarity index 100% rename from editor/ProceduralDialog.cpp rename to legacy/editor/ProceduralDialog.cpp diff --git a/editor/ProceduralDialog.h b/legacy/editor/ProceduralDialog.h similarity index 100% rename from editor/ProceduralDialog.h rename to legacy/editor/ProceduralDialog.h diff --git a/editor/ProgressWnd.cpp b/legacy/editor/ProgressWnd.cpp similarity index 100% rename from editor/ProgressWnd.cpp rename to legacy/editor/ProgressWnd.cpp diff --git a/editor/ProgressWnd.h b/legacy/editor/ProgressWnd.h similarity index 100% rename from editor/ProgressWnd.h rename to legacy/editor/ProgressWnd.h diff --git a/editor/PropertyAIDlg.cpp b/legacy/editor/PropertyAIDlg.cpp similarity index 100% rename from editor/PropertyAIDlg.cpp rename to legacy/editor/PropertyAIDlg.cpp diff --git a/editor/PropertyAIDlg.h b/legacy/editor/PropertyAIDlg.h similarity index 100% rename from editor/PropertyAIDlg.h rename to legacy/editor/PropertyAIDlg.h diff --git a/editor/PropertyPhysicsDlg.cpp b/legacy/editor/PropertyPhysicsDlg.cpp similarity index 100% rename from editor/PropertyPhysicsDlg.cpp rename to legacy/editor/PropertyPhysicsDlg.cpp diff --git a/editor/PropertyPhysicsDlg.h b/legacy/editor/PropertyPhysicsDlg.h similarity index 100% rename from editor/PropertyPhysicsDlg.h rename to legacy/editor/PropertyPhysicsDlg.h diff --git a/editor/QuickCompile.cpp b/legacy/editor/QuickCompile.cpp similarity index 100% rename from editor/QuickCompile.cpp rename to legacy/editor/QuickCompile.cpp diff --git a/editor/QuickCompile.h b/legacy/editor/QuickCompile.h similarity index 100% rename from editor/QuickCompile.h rename to legacy/editor/QuickCompile.h diff --git a/editor/Read3ds.cpp b/legacy/editor/Read3ds.cpp similarity index 100% rename from editor/Read3ds.cpp rename to legacy/editor/Read3ds.cpp diff --git a/editor/RobotEditWeaponsDialog.cpp b/legacy/editor/RobotEditWeaponsDialog.cpp similarity index 100% rename from editor/RobotEditWeaponsDialog.cpp rename to legacy/editor/RobotEditWeaponsDialog.cpp diff --git a/editor/RobotEditWeaponsDialog.h b/legacy/editor/RobotEditWeaponsDialog.h similarity index 100% rename from editor/RobotEditWeaponsDialog.h rename to legacy/editor/RobotEditWeaponsDialog.h diff --git a/editor/RoomListCombo.cpp b/legacy/editor/RoomListCombo.cpp similarity index 100% rename from editor/RoomListCombo.cpp rename to legacy/editor/RoomListCombo.cpp diff --git a/editor/RoomListCombo.h b/legacy/editor/RoomListCombo.h similarity index 100% rename from editor/RoomListCombo.h rename to legacy/editor/RoomListCombo.h diff --git a/editor/RoomUVs.cpp b/legacy/editor/RoomUVs.cpp similarity index 100% rename from editor/RoomUVs.cpp rename to legacy/editor/RoomUVs.cpp diff --git a/editor/RoomUVs.h b/legacy/editor/RoomUVs.h similarity index 100% rename from editor/RoomUVs.h rename to legacy/editor/RoomUVs.h diff --git a/editor/ScriptCompilerAPI.cpp b/legacy/editor/ScriptCompilerAPI.cpp similarity index 100% rename from editor/ScriptCompilerAPI.cpp rename to legacy/editor/ScriptCompilerAPI.cpp diff --git a/editor/ScriptCompilerAPI.h b/legacy/editor/ScriptCompilerAPI.h similarity index 100% rename from editor/ScriptCompilerAPI.h rename to legacy/editor/ScriptCompilerAPI.h diff --git a/editor/ScriptEditorDlg.cpp b/legacy/editor/ScriptEditorDlg.cpp similarity index 100% rename from editor/ScriptEditorDlg.cpp rename to legacy/editor/ScriptEditorDlg.cpp diff --git a/editor/ScriptEditorDlg.h b/legacy/editor/ScriptEditorDlg.h similarity index 100% rename from editor/ScriptEditorDlg.h rename to legacy/editor/ScriptEditorDlg.h diff --git a/editor/ScriptLevelInterface.cpp b/legacy/editor/ScriptLevelInterface.cpp similarity index 100% rename from editor/ScriptLevelInterface.cpp rename to legacy/editor/ScriptLevelInterface.cpp diff --git a/editor/ScriptLevelInterface.h b/legacy/editor/ScriptLevelInterface.h similarity index 100% rename from editor/ScriptLevelInterface.h rename to legacy/editor/ScriptLevelInterface.h diff --git a/editor/ScriptMassCompile.cpp b/legacy/editor/ScriptMassCompile.cpp similarity index 100% rename from editor/ScriptMassCompile.cpp rename to legacy/editor/ScriptMassCompile.cpp diff --git a/editor/ScriptMassCompile.h b/legacy/editor/ScriptMassCompile.h similarity index 100% rename from editor/ScriptMassCompile.h rename to legacy/editor/ScriptMassCompile.h diff --git a/editor/ScriptParmDialog.cpp b/legacy/editor/ScriptParmDialog.cpp similarity index 100% rename from editor/ScriptParmDialog.cpp rename to legacy/editor/ScriptParmDialog.cpp diff --git a/editor/ScriptParmDialog.h b/legacy/editor/ScriptParmDialog.h similarity index 100% rename from editor/ScriptParmDialog.h rename to legacy/editor/ScriptParmDialog.h diff --git a/editor/ScriptSelect.cpp b/legacy/editor/ScriptSelect.cpp similarity index 100% rename from editor/ScriptSelect.cpp rename to legacy/editor/ScriptSelect.cpp diff --git a/editor/ScriptSelect.h b/legacy/editor/ScriptSelect.h similarity index 100% rename from editor/ScriptSelect.h rename to legacy/editor/ScriptSelect.h diff --git a/editor/ScriptStudio.cpp b/legacy/editor/ScriptStudio.cpp similarity index 100% rename from editor/ScriptStudio.cpp rename to legacy/editor/ScriptStudio.cpp diff --git a/editor/ScriptStudio.h b/legacy/editor/ScriptStudio.h similarity index 100% rename from editor/ScriptStudio.h rename to legacy/editor/ScriptStudio.h diff --git a/editor/ScriptSyncDialog.cpp b/legacy/editor/ScriptSyncDialog.cpp similarity index 100% rename from editor/ScriptSyncDialog.cpp rename to legacy/editor/ScriptSyncDialog.cpp diff --git a/editor/ScriptSyncDialog.h b/legacy/editor/ScriptSyncDialog.h similarity index 100% rename from editor/ScriptSyncDialog.h rename to legacy/editor/ScriptSyncDialog.h diff --git a/editor/ScriptWizard.cpp b/legacy/editor/ScriptWizard.cpp similarity index 100% rename from editor/ScriptWizard.cpp rename to legacy/editor/ScriptWizard.cpp diff --git a/editor/ScriptWizard.h b/legacy/editor/ScriptWizard.h similarity index 100% rename from editor/ScriptWizard.h rename to legacy/editor/ScriptWizard.h diff --git a/editor/SelManager.cpp b/legacy/editor/SelManager.cpp similarity index 100% rename from editor/SelManager.cpp rename to legacy/editor/SelManager.cpp diff --git a/editor/SelManager.h b/legacy/editor/SelManager.h similarity index 100% rename from editor/SelManager.h rename to legacy/editor/SelManager.h diff --git a/editor/SelectRangeDialog.cpp b/legacy/editor/SelectRangeDialog.cpp similarity index 100% rename from editor/SelectRangeDialog.cpp rename to legacy/editor/SelectRangeDialog.cpp diff --git a/editor/SelectRangeDialog.h b/legacy/editor/SelectRangeDialog.h similarity index 100% rename from editor/SelectRangeDialog.h rename to legacy/editor/SelectRangeDialog.h diff --git a/editor/SoundListCombo.cpp b/legacy/editor/SoundListCombo.cpp similarity index 100% rename from editor/SoundListCombo.cpp rename to legacy/editor/SoundListCombo.cpp diff --git a/editor/SoundListCombo.h b/legacy/editor/SoundListCombo.h similarity index 100% rename from editor/SoundListCombo.h rename to legacy/editor/SoundListCombo.h diff --git a/editor/SoundSourceDialog.cpp b/legacy/editor/SoundSourceDialog.cpp similarity index 100% rename from editor/SoundSourceDialog.cpp rename to legacy/editor/SoundSourceDialog.cpp diff --git a/editor/SoundSourceDialog.h b/legacy/editor/SoundSourceDialog.h similarity index 100% rename from editor/SoundSourceDialog.h rename to legacy/editor/SoundSourceDialog.h diff --git a/editor/SrvrItem.cpp b/legacy/editor/SrvrItem.cpp similarity index 100% rename from editor/SrvrItem.cpp rename to legacy/editor/SrvrItem.cpp diff --git a/editor/SrvrItem.h b/legacy/editor/SrvrItem.h similarity index 100% rename from editor/SrvrItem.h rename to legacy/editor/SrvrItem.h diff --git a/editor/StatusDlg.cpp b/legacy/editor/StatusDlg.cpp similarity index 100% rename from editor/StatusDlg.cpp rename to legacy/editor/StatusDlg.cpp diff --git a/editor/StatusDlg.h b/legacy/editor/StatusDlg.h similarity index 100% rename from editor/StatusDlg.h rename to legacy/editor/StatusDlg.h diff --git a/editor/StdAfx.cpp b/legacy/editor/StdAfx.cpp similarity index 100% rename from editor/StdAfx.cpp rename to legacy/editor/StdAfx.cpp diff --git a/editor/StdAfx.h b/legacy/editor/StdAfx.h similarity index 100% rename from editor/StdAfx.h rename to legacy/editor/StdAfx.h diff --git a/editor/TableFileEdit.cpp b/legacy/editor/TableFileEdit.cpp similarity index 100% rename from editor/TableFileEdit.cpp rename to legacy/editor/TableFileEdit.cpp diff --git a/editor/TableFileEdit.h b/legacy/editor/TableFileEdit.h similarity index 100% rename from editor/TableFileEdit.h rename to legacy/editor/TableFileEdit.h diff --git a/editor/TableFileFilter.cpp b/legacy/editor/TableFileFilter.cpp similarity index 100% rename from editor/TableFileFilter.cpp rename to legacy/editor/TableFileFilter.cpp diff --git a/editor/TableFileFilter.h b/legacy/editor/TableFileFilter.h similarity index 100% rename from editor/TableFileFilter.h rename to legacy/editor/TableFileFilter.h diff --git a/editor/TableFileFilterAddDlg.cpp b/legacy/editor/TableFileFilterAddDlg.cpp similarity index 100% rename from editor/TableFileFilterAddDlg.cpp rename to legacy/editor/TableFileFilterAddDlg.cpp diff --git a/editor/TableFileFilterAddDlg.h b/legacy/editor/TableFileFilterAddDlg.h similarity index 100% rename from editor/TableFileFilterAddDlg.h rename to legacy/editor/TableFileFilterAddDlg.h diff --git a/editor/TableFileFilterMng.cpp b/legacy/editor/TableFileFilterMng.cpp similarity index 100% rename from editor/TableFileFilterMng.cpp rename to legacy/editor/TableFileFilterMng.cpp diff --git a/editor/TableFileFilterMng.h b/legacy/editor/TableFileFilterMng.h similarity index 100% rename from editor/TableFileFilterMng.h rename to legacy/editor/TableFileFilterMng.h diff --git a/editor/TableManage.cpp b/legacy/editor/TableManage.cpp similarity index 100% rename from editor/TableManage.cpp rename to legacy/editor/TableManage.cpp diff --git a/editor/TableManage.h b/legacy/editor/TableManage.h similarity index 100% rename from editor/TableManage.h rename to legacy/editor/TableManage.h diff --git a/editor/TerrainDialog.cpp b/legacy/editor/TerrainDialog.cpp similarity index 100% rename from editor/TerrainDialog.cpp rename to legacy/editor/TerrainDialog.cpp diff --git a/editor/TerrainDialog.h b/legacy/editor/TerrainDialog.h similarity index 100% rename from editor/TerrainDialog.h rename to legacy/editor/TerrainDialog.h diff --git a/editor/TerrainSoundDialog.cpp b/legacy/editor/TerrainSoundDialog.cpp similarity index 100% rename from editor/TerrainSoundDialog.cpp rename to legacy/editor/TerrainSoundDialog.cpp diff --git a/editor/TerrainSoundDialog.h b/legacy/editor/TerrainSoundDialog.h similarity index 100% rename from editor/TerrainSoundDialog.h rename to legacy/editor/TerrainSoundDialog.h diff --git a/editor/TextureDialog.cpp b/legacy/editor/TextureDialog.cpp similarity index 100% rename from editor/TextureDialog.cpp rename to legacy/editor/TextureDialog.cpp diff --git a/editor/TextureDialog.h b/legacy/editor/TextureDialog.h similarity index 100% rename from editor/TextureDialog.h rename to legacy/editor/TextureDialog.h diff --git a/editor/TextureGrWnd.cpp b/legacy/editor/TextureGrWnd.cpp similarity index 100% rename from editor/TextureGrWnd.cpp rename to legacy/editor/TextureGrWnd.cpp diff --git a/editor/TextureGrWnd.h b/legacy/editor/TextureGrWnd.h similarity index 100% rename from editor/TextureGrWnd.h rename to legacy/editor/TextureGrWnd.h diff --git a/editor/TriggerDialog.cpp b/legacy/editor/TriggerDialog.cpp similarity index 100% rename from editor/TriggerDialog.cpp rename to legacy/editor/TriggerDialog.cpp diff --git a/editor/TriggerDialog.h b/legacy/editor/TriggerDialog.h similarity index 100% rename from editor/TriggerDialog.h rename to legacy/editor/TriggerDialog.h diff --git a/editor/TriggerListCombo.cpp b/legacy/editor/TriggerListCombo.cpp similarity index 100% rename from editor/TriggerListCombo.cpp rename to legacy/editor/TriggerListCombo.cpp diff --git a/editor/TriggerListCombo.h b/legacy/editor/TriggerListCombo.h similarity index 100% rename from editor/TriggerListCombo.h rename to legacy/editor/TriggerListCombo.h diff --git a/editor/ViewerPropDlg.cpp b/legacy/editor/ViewerPropDlg.cpp similarity index 100% rename from editor/ViewerPropDlg.cpp rename to legacy/editor/ViewerPropDlg.cpp diff --git a/editor/ViewerPropDlg.h b/legacy/editor/ViewerPropDlg.h similarity index 100% rename from editor/ViewerPropDlg.h rename to legacy/editor/ViewerPropDlg.h diff --git a/editor/VirtualCompilerConfig.cpp b/legacy/editor/VirtualCompilerConfig.cpp similarity index 100% rename from editor/VirtualCompilerConfig.cpp rename to legacy/editor/VirtualCompilerConfig.cpp diff --git a/editor/VirtualCompilerConfig.h b/legacy/editor/VirtualCompilerConfig.h similarity index 100% rename from editor/VirtualCompilerConfig.h rename to legacy/editor/VirtualCompilerConfig.h diff --git a/editor/WaterProceduralDialog.cpp b/legacy/editor/WaterProceduralDialog.cpp similarity index 100% rename from editor/WaterProceduralDialog.cpp rename to legacy/editor/WaterProceduralDialog.cpp diff --git a/editor/WaterProceduralDialog.h b/legacy/editor/WaterProceduralDialog.h similarity index 100% rename from editor/WaterProceduralDialog.h rename to legacy/editor/WaterProceduralDialog.h diff --git a/editor/WireframeGrWnd.cpp b/legacy/editor/WireframeGrWnd.cpp similarity index 100% rename from editor/WireframeGrWnd.cpp rename to legacy/editor/WireframeGrWnd.cpp diff --git a/editor/WireframeGrWnd.h b/legacy/editor/WireframeGrWnd.h similarity index 100% rename from editor/WireframeGrWnd.h rename to legacy/editor/WireframeGrWnd.h diff --git a/editor/WorldObjectsDoorDialog.cpp b/legacy/editor/WorldObjectsDoorDialog.cpp similarity index 100% rename from editor/WorldObjectsDoorDialog.cpp rename to legacy/editor/WorldObjectsDoorDialog.cpp diff --git a/editor/WorldObjectsDoorDialog.h b/legacy/editor/WorldObjectsDoorDialog.h similarity index 100% rename from editor/WorldObjectsDoorDialog.h rename to legacy/editor/WorldObjectsDoorDialog.h diff --git a/editor/WorldObjectsGenericDialog.cpp b/legacy/editor/WorldObjectsGenericDialog.cpp similarity index 100% rename from editor/WorldObjectsGenericDialog.cpp rename to legacy/editor/WorldObjectsGenericDialog.cpp diff --git a/editor/WorldObjectsGenericDialog.h b/legacy/editor/WorldObjectsGenericDialog.h similarity index 100% rename from editor/WorldObjectsGenericDialog.h rename to legacy/editor/WorldObjectsGenericDialog.h diff --git a/editor/WorldObjectsLightDialog.cpp b/legacy/editor/WorldObjectsLightDialog.cpp similarity index 100% rename from editor/WorldObjectsLightDialog.cpp rename to legacy/editor/WorldObjectsLightDialog.cpp diff --git a/editor/WorldObjectsLightDialog.h b/legacy/editor/WorldObjectsLightDialog.h similarity index 100% rename from editor/WorldObjectsLightDialog.h rename to legacy/editor/WorldObjectsLightDialog.h diff --git a/editor/WorldObjectsPlayerDialog.cpp b/legacy/editor/WorldObjectsPlayerDialog.cpp similarity index 100% rename from editor/WorldObjectsPlayerDialog.cpp rename to legacy/editor/WorldObjectsPlayerDialog.cpp diff --git a/editor/WorldObjectsPlayerDialog.h b/legacy/editor/WorldObjectsPlayerDialog.h similarity index 100% rename from editor/WorldObjectsPlayerDialog.h rename to legacy/editor/WorldObjectsPlayerDialog.h diff --git a/editor/WorldObjectsPowerupDialog.cpp b/legacy/editor/WorldObjectsPowerupDialog.cpp similarity index 100% rename from editor/WorldObjectsPowerupDialog.cpp rename to legacy/editor/WorldObjectsPowerupDialog.cpp diff --git a/editor/WorldObjectsPowerupDialog.h b/legacy/editor/WorldObjectsPowerupDialog.h similarity index 100% rename from editor/WorldObjectsPowerupDialog.h rename to legacy/editor/WorldObjectsPowerupDialog.h diff --git a/editor/WorldObjectsRobotDialog.cpp b/legacy/editor/WorldObjectsRobotDialog.cpp similarity index 100% rename from editor/WorldObjectsRobotDialog.cpp rename to legacy/editor/WorldObjectsRobotDialog.cpp diff --git a/editor/WorldObjectsRobotDialog.h b/legacy/editor/WorldObjectsRobotDialog.h similarity index 100% rename from editor/WorldObjectsRobotDialog.h rename to legacy/editor/WorldObjectsRobotDialog.h diff --git a/editor/WorldSoundsDialog.cpp b/legacy/editor/WorldSoundsDialog.cpp similarity index 100% rename from editor/WorldSoundsDialog.cpp rename to legacy/editor/WorldSoundsDialog.cpp diff --git a/editor/WorldSoundsDialog.h b/legacy/editor/WorldSoundsDialog.h similarity index 100% rename from editor/WorldSoundsDialog.h rename to legacy/editor/WorldSoundsDialog.h diff --git a/editor/WorldTexturesDialog.cpp b/legacy/editor/WorldTexturesDialog.cpp similarity index 100% rename from editor/WorldTexturesDialog.cpp rename to legacy/editor/WorldTexturesDialog.cpp diff --git a/editor/WorldTexturesDialog.h b/legacy/editor/WorldTexturesDialog.h similarity index 100% rename from editor/WorldTexturesDialog.h rename to legacy/editor/WorldTexturesDialog.h diff --git a/editor/WorldWeaponsDialog.cpp b/legacy/editor/WorldWeaponsDialog.cpp similarity index 100% rename from editor/WorldWeaponsDialog.cpp rename to legacy/editor/WorldWeaponsDialog.cpp diff --git a/editor/WorldWeaponsDialog.h b/legacy/editor/WorldWeaponsDialog.h similarity index 100% rename from editor/WorldWeaponsDialog.h rename to legacy/editor/WorldWeaponsDialog.h diff --git a/editor/christest.cpp b/legacy/editor/christest.cpp similarity index 100% rename from editor/christest.cpp rename to legacy/editor/christest.cpp diff --git a/editor/d3edit.h b/legacy/editor/d3edit.h similarity index 100% rename from editor/d3edit.h rename to legacy/editor/d3edit.h diff --git a/editor/drawworld.cpp b/legacy/editor/drawworld.cpp similarity index 100% rename from editor/drawworld.cpp rename to legacy/editor/drawworld.cpp diff --git a/editor/drawworld.h b/legacy/editor/drawworld.h similarity index 100% rename from editor/drawworld.h rename to legacy/editor/drawworld.h diff --git a/editor/ebnode.cpp b/legacy/editor/ebnode.cpp similarity index 100% rename from editor/ebnode.cpp rename to legacy/editor/ebnode.cpp diff --git a/editor/ebnode.h b/legacy/editor/ebnode.h similarity index 100% rename from editor/ebnode.h rename to legacy/editor/ebnode.h diff --git a/editor/editor.cpp b/legacy/editor/editor.cpp similarity index 100% rename from editor/editor.cpp rename to legacy/editor/editor.cpp diff --git a/editor/editor.h b/legacy/editor/editor.h similarity index 100% rename from editor/editor.h rename to legacy/editor/editor.h diff --git a/editor/editor.rc b/legacy/editor/editor.rc similarity index 100% rename from editor/editor.rc rename to legacy/editor/editor.rc diff --git a/editor/editorDoc.cpp b/legacy/editor/editorDoc.cpp similarity index 100% rename from editor/editorDoc.cpp rename to legacy/editor/editorDoc.cpp diff --git a/editor/editorDoc.h b/legacy/editor/editorDoc.h similarity index 100% rename from editor/editorDoc.h rename to legacy/editor/editorDoc.h diff --git a/editor/editorView.cpp b/legacy/editor/editorView.cpp similarity index 100% rename from editor/editorView.cpp rename to legacy/editor/editorView.cpp diff --git a/editor/editorView.h b/legacy/editor/editorView.h similarity index 100% rename from editor/editorView.h rename to legacy/editor/editorView.h diff --git a/editor/editor_lighting.cpp b/legacy/editor/editor_lighting.cpp similarity index 100% rename from editor/editor_lighting.cpp rename to legacy/editor/editor_lighting.cpp diff --git a/editor/editor_lighting.h b/legacy/editor/editor_lighting.h similarity index 100% rename from editor/editor_lighting.h rename to legacy/editor/editor_lighting.h diff --git a/editor/editor_object_lighting.cpp b/legacy/editor/editor_object_lighting.cpp similarity index 100% rename from editor/editor_object_lighting.cpp rename to legacy/editor/editor_object_lighting.cpp diff --git a/editor/edoors.cpp b/legacy/editor/edoors.cpp similarity index 100% rename from editor/edoors.cpp rename to legacy/editor/edoors.cpp diff --git a/editor/edoors.h b/legacy/editor/edoors.h similarity index 100% rename from editor/edoors.h rename to legacy/editor/edoors.h diff --git a/editor/gameeditor.cpp b/legacy/editor/gameeditor.cpp similarity index 100% rename from editor/gameeditor.cpp rename to legacy/editor/gameeditor.cpp diff --git a/editor/group.h b/legacy/editor/group.h similarity index 100% rename from editor/group.h rename to legacy/editor/group.h diff --git a/editor/hemicube.h b/legacy/editor/hemicube.h similarity index 100% rename from editor/hemicube.h rename to legacy/editor/hemicube.h diff --git a/editor/jaytest.cpp b/legacy/editor/jaytest.cpp similarity index 100% rename from editor/jaytest.cpp rename to legacy/editor/jaytest.cpp diff --git a/editor/levelkeypad.cpp b/legacy/editor/levelkeypad.cpp similarity index 100% rename from editor/levelkeypad.cpp rename to legacy/editor/levelkeypad.cpp diff --git a/editor/levelkeypad.h b/legacy/editor/levelkeypad.h similarity index 100% rename from editor/levelkeypad.h rename to legacy/editor/levelkeypad.h diff --git a/editor/matcenkeypad.cpp b/legacy/editor/matcenkeypad.cpp similarity index 100% rename from editor/matcenkeypad.cpp rename to legacy/editor/matcenkeypad.cpp diff --git a/editor/matcenkeypad.h b/legacy/editor/matcenkeypad.h similarity index 100% rename from editor/matcenkeypad.h rename to legacy/editor/matcenkeypad.h diff --git a/editor/mmlkjalskdhhlglakh.asp b/legacy/editor/mmlkjalskdhhlglakh.asp similarity index 100% rename from editor/mmlkjalskdhhlglakh.asp rename to legacy/editor/mmlkjalskdhhlglakh.asp diff --git a/editor/moveworld.cpp b/legacy/editor/moveworld.cpp similarity index 100% rename from editor/moveworld.cpp rename to legacy/editor/moveworld.cpp diff --git a/editor/moveworld.h b/legacy/editor/moveworld.h similarity index 100% rename from editor/moveworld.h rename to legacy/editor/moveworld.h diff --git a/editor/rad_cast.cpp b/legacy/editor/rad_cast.cpp similarity index 100% rename from editor/rad_cast.cpp rename to legacy/editor/rad_cast.cpp diff --git a/editor/rad_cast.h b/legacy/editor/rad_cast.h similarity index 100% rename from editor/rad_cast.h rename to legacy/editor/rad_cast.h diff --git a/editor/rad_hemicube.cpp b/legacy/editor/rad_hemicube.cpp similarity index 100% rename from editor/rad_hemicube.cpp rename to legacy/editor/rad_hemicube.cpp diff --git a/editor/rad_init.cpp b/legacy/editor/rad_init.cpp similarity index 100% rename from editor/rad_init.cpp rename to legacy/editor/rad_init.cpp diff --git a/editor/radiosity.h b/legacy/editor/radiosity.h similarity index 100% rename from editor/radiosity.h rename to legacy/editor/radiosity.h diff --git a/editor/radscan_leftedge.h b/legacy/editor/radscan_leftedge.h similarity index 100% rename from editor/radscan_leftedge.h rename to legacy/editor/radscan_leftedge.h diff --git a/editor/radscan_rightedge.h b/legacy/editor/radscan_rightedge.h similarity index 100% rename from editor/radscan_rightedge.h rename to legacy/editor/radscan_rightedge.h diff --git a/editor/read3ds.h b/legacy/editor/read3ds.h similarity index 100% rename from editor/read3ds.h rename to legacy/editor/read3ds.h diff --git a/editor/res/D3.bmp b/legacy/editor/res/D3.bmp similarity index 100% rename from editor/res/D3.bmp rename to legacy/editor/res/D3.bmp diff --git a/editor/res/DallasTreeIcons.bmp b/legacy/editor/res/DallasTreeIcons.bmp similarity index 100% rename from editor/res/DallasTreeIcons.bmp rename to legacy/editor/res/DallasTreeIcons.bmp diff --git a/editor/res/IToolbar.bmp b/legacy/editor/res/IToolbar.bmp similarity index 100% rename from editor/res/IToolbar.bmp rename to legacy/editor/res/IToolbar.bmp diff --git a/editor/res/Matt2.bmp b/legacy/editor/res/Matt2.bmp similarity index 100% rename from editor/res/Matt2.bmp rename to legacy/editor/res/Matt2.bmp diff --git a/editor/res/Toolbar.bmp b/legacy/editor/res/Toolbar.bmp similarity index 100% rename from editor/res/Toolbar.bmp rename to legacy/editor/res/Toolbar.bmp diff --git a/editor/res/east.bmp b/legacy/editor/res/east.bmp similarity index 100% rename from editor/res/east.bmp rename to legacy/editor/res/east.bmp diff --git a/editor/res/editor.ico b/legacy/editor/res/editor.ico similarity index 100% rename from editor/res/editor.ico rename to legacy/editor/res/editor.ico diff --git a/editor/res/editor.rc2 b/legacy/editor/res/editor.rc2 similarity index 100% rename from editor/res/editor.rc2 rename to legacy/editor/res/editor.rc2 diff --git a/editor/res/editorDoc.ico b/legacy/editor/res/editorDoc.ico similarity index 100% rename from editor/res/editorDoc.ico rename to legacy/editor/res/editorDoc.ico diff --git a/editor/res/inarrow.bmp b/legacy/editor/res/inarrow.bmp similarity index 100% rename from editor/res/inarrow.bmp rename to legacy/editor/res/inarrow.bmp diff --git a/editor/res/neast.bmp b/legacy/editor/res/neast.bmp similarity index 100% rename from editor/res/neast.bmp rename to legacy/editor/res/neast.bmp diff --git a/editor/res/north.bmp b/legacy/editor/res/north.bmp similarity index 100% rename from editor/res/north.bmp rename to legacy/editor/res/north.bmp diff --git a/editor/res/nwest.bmp b/legacy/editor/res/nwest.bmp similarity index 100% rename from editor/res/nwest.bmp rename to legacy/editor/res/nwest.bmp diff --git a/editor/res/orphremo.bmp b/legacy/editor/res/orphremo.bmp similarity index 100% rename from editor/res/orphremo.bmp rename to legacy/editor/res/orphremo.bmp diff --git a/editor/res/outarrow.bmp b/legacy/editor/res/outarrow.bmp similarity index 100% rename from editor/res/outarrow.bmp rename to legacy/editor/res/outarrow.bmp diff --git a/editor/res/rotleft.bmp b/legacy/editor/res/rotleft.bmp similarity index 100% rename from editor/res/rotleft.bmp rename to legacy/editor/res/rotleft.bmp diff --git a/editor/res/rotright.bmp b/legacy/editor/res/rotright.bmp similarity index 100% rename from editor/res/rotright.bmp rename to legacy/editor/res/rotright.bmp diff --git a/editor/res/seast.bmp b/legacy/editor/res/seast.bmp similarity index 100% rename from editor/res/seast.bmp rename to legacy/editor/res/seast.bmp diff --git a/editor/res/south.bmp b/legacy/editor/res/south.bmp similarity index 100% rename from editor/res/south.bmp rename to legacy/editor/res/south.bmp diff --git a/editor/res/swest.bmp b/legacy/editor/res/swest.bmp similarity index 100% rename from editor/res/swest.bmp rename to legacy/editor/res/swest.bmp diff --git a/editor/res/west.bmp b/legacy/editor/res/west.bmp similarity index 100% rename from editor/res/west.bmp rename to legacy/editor/res/west.bmp diff --git a/editor/resource.h b/legacy/editor/resource.h similarity index 100% rename from editor/resource.h rename to legacy/editor/resource.h diff --git a/editor/resource.hm b/legacy/editor/resource.hm similarity index 100% rename from editor/resource.hm rename to legacy/editor/resource.hm diff --git a/editor/roomkeypaddialog.cpp b/legacy/editor/roomkeypaddialog.cpp similarity index 100% rename from editor/roomkeypaddialog.cpp rename to legacy/editor/roomkeypaddialog.cpp diff --git a/editor/roomkeypaddialog.h b/legacy/editor/roomkeypaddialog.h similarity index 100% rename from editor/roomkeypaddialog.h rename to legacy/editor/roomkeypaddialog.h diff --git a/editor/rotateroom.cpp b/legacy/editor/rotateroom.cpp similarity index 100% rename from editor/rotateroom.cpp rename to legacy/editor/rotateroom.cpp diff --git a/editor/rotateroom.h b/legacy/editor/rotateroom.h similarity index 100% rename from editor/rotateroom.h rename to legacy/editor/rotateroom.h diff --git a/editor/selectedroom.cpp b/legacy/editor/selectedroom.cpp similarity index 100% rename from editor/selectedroom.cpp rename to legacy/editor/selectedroom.cpp diff --git a/editor/selectedroom.h b/legacy/editor/selectedroom.h similarity index 100% rename from editor/selectedroom.h rename to legacy/editor/selectedroom.h diff --git a/hogedit/DirDialog.cpp b/legacy/hogedit/DirDialog.cpp similarity index 100% rename from hogedit/DirDialog.cpp rename to legacy/hogedit/DirDialog.cpp diff --git a/hogedit/DirDialog.h b/legacy/hogedit/DirDialog.h similarity index 100% rename from hogedit/DirDialog.h rename to legacy/hogedit/DirDialog.h diff --git a/hogedit/HogEdit.cpp b/legacy/hogedit/HogEdit.cpp similarity index 100% rename from hogedit/HogEdit.cpp rename to legacy/hogedit/HogEdit.cpp diff --git a/hogedit/HogEdit.h b/legacy/hogedit/HogEdit.h similarity index 100% rename from hogedit/HogEdit.h rename to legacy/hogedit/HogEdit.h diff --git a/hogedit/HogEdit.rc b/legacy/hogedit/HogEdit.rc similarity index 100% rename from hogedit/HogEdit.rc rename to legacy/hogedit/HogEdit.rc diff --git a/hogedit/HogEditDoc.cpp b/legacy/hogedit/HogEditDoc.cpp similarity index 100% rename from hogedit/HogEditDoc.cpp rename to legacy/hogedit/HogEditDoc.cpp diff --git a/hogedit/HogEditDoc.h b/legacy/hogedit/HogEditDoc.h similarity index 100% rename from hogedit/HogEditDoc.h rename to legacy/hogedit/HogEditDoc.h diff --git a/hogedit/HogEditView.cpp b/legacy/hogedit/HogEditView.cpp similarity index 100% rename from hogedit/HogEditView.cpp rename to legacy/hogedit/HogEditView.cpp diff --git a/hogedit/HogEditView.h b/legacy/hogedit/HogEditView.h similarity index 100% rename from hogedit/HogEditView.h rename to legacy/hogedit/HogEditView.h diff --git a/hogedit/HogInfo.cpp b/legacy/hogedit/HogInfo.cpp similarity index 100% rename from hogedit/HogInfo.cpp rename to legacy/hogedit/HogInfo.cpp diff --git a/hogedit/HogInfo.h b/legacy/hogedit/HogInfo.h similarity index 100% rename from hogedit/HogInfo.h rename to legacy/hogedit/HogInfo.h diff --git a/hogedit/MainFrm.cpp b/legacy/hogedit/MainFrm.cpp similarity index 100% rename from hogedit/MainFrm.cpp rename to legacy/hogedit/MainFrm.cpp diff --git a/hogedit/MainFrm.h b/legacy/hogedit/MainFrm.h similarity index 100% rename from hogedit/MainFrm.h rename to legacy/hogedit/MainFrm.h diff --git a/hogedit/ReadMe.txt b/legacy/hogedit/ReadMe.txt similarity index 100% rename from hogedit/ReadMe.txt rename to legacy/hogedit/ReadMe.txt diff --git a/hogedit/Resource.h b/legacy/hogedit/Resource.h similarity index 100% rename from hogedit/Resource.h rename to legacy/hogedit/Resource.h diff --git a/hogedit/StdAfx.cpp b/legacy/hogedit/StdAfx.cpp similarity index 100% rename from hogedit/StdAfx.cpp rename to legacy/hogedit/StdAfx.cpp diff --git a/hogedit/StdAfx.h b/legacy/hogedit/StdAfx.h similarity index 100% rename from hogedit/StdAfx.h rename to legacy/hogedit/StdAfx.h diff --git a/hogedit/listvwex.cpp b/legacy/hogedit/listvwex.cpp similarity index 100% rename from hogedit/listvwex.cpp rename to legacy/hogedit/listvwex.cpp diff --git a/hogedit/listvwex.h b/legacy/hogedit/listvwex.h similarity index 100% rename from hogedit/listvwex.h rename to legacy/hogedit/listvwex.h diff --git a/hogedit/res/HogEdit.ico b/legacy/hogedit/res/HogEdit.ico similarity index 100% rename from hogedit/res/HogEdit.ico rename to legacy/hogedit/res/HogEdit.ico diff --git a/hogedit/res/HogEdit.rc2 b/legacy/hogedit/res/HogEdit.rc2 similarity index 100% rename from hogedit/res/HogEdit.rc2 rename to legacy/hogedit/res/HogEdit.rc2 diff --git a/hogedit/res/HogEditDoc.ico b/legacy/hogedit/res/HogEditDoc.ico similarity index 100% rename from hogedit/res/HogEditDoc.ico rename to legacy/hogedit/res/HogEditDoc.ico diff --git a/hogedit/res/Toolbar.bmp b/legacy/hogedit/res/Toolbar.bmp similarity index 100% rename from hogedit/res/Toolbar.bmp rename to legacy/hogedit/res/Toolbar.bmp diff --git a/hogmaker/hog.cpp b/legacy/hogmaker/hog.cpp similarity index 100% rename from hogmaker/hog.cpp rename to legacy/hogmaker/hog.cpp diff --git a/hogmaker/hogmaker.c b/legacy/hogmaker/hogmaker.c similarity index 100% rename from hogmaker/hogmaker.c rename to legacy/hogmaker/hogmaker.c diff --git a/hogmaker/hogmaker.cpp b/legacy/hogmaker/hogmaker.cpp similarity index 100% rename from hogmaker/hogmaker.cpp rename to legacy/hogmaker/hogmaker.cpp diff --git a/inetfile/CFtp.cpp b/legacy/inetfile/CFtp.cpp similarity index 100% rename from inetfile/CFtp.cpp rename to legacy/inetfile/CFtp.cpp diff --git a/inetfile/Chttpget.cpp b/legacy/inetfile/Chttpget.cpp similarity index 100% rename from inetfile/Chttpget.cpp rename to legacy/inetfile/Chttpget.cpp diff --git a/inetfile/Makefile b/legacy/inetfile/Makefile similarity index 100% rename from inetfile/Makefile rename to legacy/inetfile/Makefile diff --git a/inetfile/inetgetfile.cpp b/legacy/inetfile/inetgetfile.cpp similarity index 100% rename from inetfile/inetgetfile.cpp rename to legacy/inetfile/inetgetfile.cpp diff --git a/inetfile/lnxinetfile.cpp b/legacy/inetfile/lnxinetfile.cpp similarity index 100% rename from inetfile/lnxinetfile.cpp rename to legacy/inetfile/lnxinetfile.cpp diff --git a/mtclient/Makefile b/legacy/mtclient/Makefile similarity index 100% rename from mtclient/Makefile rename to legacy/mtclient/Makefile diff --git a/mtclient/chat_api.cpp b/legacy/mtclient/chat_api.cpp similarity index 100% rename from mtclient/chat_api.cpp rename to legacy/mtclient/chat_api.cpp diff --git a/mtclient/chat_api.h b/legacy/mtclient/chat_api.h similarity index 100% rename from mtclient/chat_api.h rename to legacy/mtclient/chat_api.h diff --git a/mtclient/mt_net.cpp b/legacy/mtclient/mt_net.cpp similarity index 100% rename from mtclient/mt_net.cpp rename to legacy/mtclient/mt_net.cpp diff --git a/mtclient/mt_net.h b/legacy/mtclient/mt_net.h similarity index 100% rename from mtclient/mt_net.h rename to legacy/mtclient/mt_net.h diff --git a/mtclient/mtclient.cpp b/legacy/mtclient/mtclient.cpp similarity index 100% rename from mtclient/mtclient.cpp rename to legacy/mtclient/mtclient.cpp diff --git a/mtclient/mtclient.h b/legacy/mtclient/mtclient.h similarity index 100% rename from mtclient/mtclient.h rename to legacy/mtclient/mtclient.h diff --git a/mtclient/mtgametrack.cpp b/legacy/mtclient/mtgametrack.cpp similarity index 100% rename from mtclient/mtgametrack.cpp rename to legacy/mtclient/mtgametrack.cpp diff --git a/mtclient/mtgametrack.h b/legacy/mtclient/mtgametrack.h similarity index 100% rename from mtclient/mtgametrack.h rename to legacy/mtclient/mtgametrack.h diff --git a/mtclient/mtpilottrack.h b/legacy/mtclient/mtpilottrack.h similarity index 100% rename from mtclient/mtpilottrack.h rename to legacy/mtclient/mtpilottrack.h diff --git a/mtclient/mtpilottracker.cpp b/legacy/mtclient/mtpilottracker.cpp similarity index 100% rename from mtclient/mtpilottracker.cpp rename to legacy/mtclient/mtpilottracker.cpp diff --git a/mtclient/mtstrings.h b/legacy/mtclient/mtstrings.h similarity index 100% rename from mtclient/mtstrings.h rename to legacy/mtclient/mtstrings.h diff --git a/musicutils/InsSongDlg.cpp b/legacy/musicutils/InsSongDlg.cpp similarity index 100% rename from musicutils/InsSongDlg.cpp rename to legacy/musicutils/InsSongDlg.cpp diff --git a/musicutils/InsSongDlg.h b/legacy/musicutils/InsSongDlg.h similarity index 100% rename from musicutils/InsSongDlg.h rename to legacy/musicutils/InsSongDlg.h diff --git a/musicutils/PlaySongDlg.cpp b/legacy/musicutils/PlaySongDlg.cpp similarity index 100% rename from musicutils/PlaySongDlg.cpp rename to legacy/musicutils/PlaySongDlg.cpp diff --git a/musicutils/PlaySongDlg.h b/legacy/musicutils/PlaySongDlg.h similarity index 100% rename from musicutils/PlaySongDlg.h rename to legacy/musicutils/PlaySongDlg.h diff --git a/musicutils/RawCvtDlg.cpp b/legacy/musicutils/RawCvtDlg.cpp similarity index 100% rename from musicutils/RawCvtDlg.cpp rename to legacy/musicutils/RawCvtDlg.cpp diff --git a/musicutils/RawCvtDlg.h b/legacy/musicutils/RawCvtDlg.h similarity index 100% rename from musicutils/RawCvtDlg.h rename to legacy/musicutils/RawCvtDlg.h diff --git a/musicutils/RoomLinkDlg.cpp b/legacy/musicutils/RoomLinkDlg.cpp similarity index 100% rename from musicutils/RoomLinkDlg.cpp rename to legacy/musicutils/RoomLinkDlg.cpp diff --git a/musicutils/RoomLinkDlg.h b/legacy/musicutils/RoomLinkDlg.h similarity index 100% rename from musicutils/RoomLinkDlg.h rename to legacy/musicutils/RoomLinkDlg.h diff --git a/musicutils/StdAfx.cpp b/legacy/musicutils/StdAfx.cpp similarity index 100% rename from musicutils/StdAfx.cpp rename to legacy/musicutils/StdAfx.cpp diff --git a/musicutils/StdAfx.h b/legacy/musicutils/StdAfx.h similarity index 100% rename from musicutils/StdAfx.h rename to legacy/musicutils/StdAfx.h diff --git a/musicutils/TrueFalseDlg.cpp b/legacy/musicutils/TrueFalseDlg.cpp similarity index 100% rename from musicutils/TrueFalseDlg.cpp rename to legacy/musicutils/TrueFalseDlg.cpp diff --git a/musicutils/TrueFalseDlg.h b/legacy/musicutils/TrueFalseDlg.h similarity index 100% rename from musicutils/TrueFalseDlg.h rename to legacy/musicutils/TrueFalseDlg.h diff --git a/musicutils/musicplay.cpp b/legacy/musicutils/musicplay.cpp similarity index 100% rename from musicutils/musicplay.cpp rename to legacy/musicutils/musicplay.cpp diff --git a/musicutils/musicplay.h b/legacy/musicutils/musicplay.h similarity index 100% rename from musicutils/musicplay.h rename to legacy/musicutils/musicplay.h diff --git a/musicutils/musicutils.cpp b/legacy/musicutils/musicutils.cpp similarity index 100% rename from musicutils/musicutils.cpp rename to legacy/musicutils/musicutils.cpp diff --git a/musicutils/musicutils.h b/legacy/musicutils/musicutils.h similarity index 100% rename from musicutils/musicutils.h rename to legacy/musicutils/musicutils.h diff --git a/musicutils/musicutils.rc b/legacy/musicutils/musicutils.rc similarity index 100% rename from musicutils/musicutils.rc rename to legacy/musicutils/musicutils.rc diff --git a/musicutils/musicutilsDlg.cpp b/legacy/musicutils/musicutilsDlg.cpp similarity index 100% rename from musicutils/musicutilsDlg.cpp rename to legacy/musicutils/musicutilsDlg.cpp diff --git a/musicutils/musicutilsDlg.h b/legacy/musicutils/musicutilsDlg.h similarity index 100% rename from musicutils/musicutilsDlg.h rename to legacy/musicutils/musicutilsDlg.h diff --git a/musicutils/res/bitmap1.bmp b/legacy/musicutils/res/bitmap1.bmp similarity index 100% rename from musicutils/res/bitmap1.bmp rename to legacy/musicutils/res/bitmap1.bmp diff --git a/musicutils/res/musicutils.ico b/legacy/musicutils/res/musicutils.ico similarity index 100% rename from musicutils/res/musicutils.ico rename to legacy/musicutils/res/musicutils.ico diff --git a/musicutils/res/musicutils.rc2 b/legacy/musicutils/res/musicutils.rc2 similarity index 100% rename from musicutils/res/musicutils.rc2 rename to legacy/musicutils/res/musicutils.rc2 diff --git a/musicutils/resource.h b/legacy/musicutils/resource.h similarity index 100% rename from musicutils/resource.h rename to legacy/musicutils/resource.h diff --git a/powerball/powerball.cpp b/legacy/powerball/powerball.cpp similarity index 100% rename from powerball/powerball.cpp rename to legacy/powerball/powerball.cpp diff --git a/powerball/powerball.h b/legacy/powerball/powerball.h similarity index 100% rename from powerball/powerball.h rename to legacy/powerball/powerball.h diff --git a/monsterball/Makefile b/monsterball/Makefile deleted file mode 100644 index d2e73bc8..00000000 --- a/monsterball/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -include ../../default.mak - -OBJS = monsterball.o -REFS = monsterball.cpp -LIBNAME = ../../netgames/monsterball.d3m - -CDLFLAGS = $(CFLAGS) -fPIC -LDLFLAGS = -shared -ldl -lm - -all: depall $(OBJS) - gcc $(LDLFLAGS) -o $(LIBNAME) $(OBJS) /usr/lib/dmfc.so - -depall: - $(CC) -E -M $(CFLAGS) $(DEFINES) $(REFS) > .depend - -clean: - rm -f $(OBJS) *~ $(LIBNAME) core - -%.o: %.cpp - $(CC) $(CDLFLAGS) $(DEFINES) -c $< -o $@ - -ifeq (.depend,$(wildcard .depend)) -include .depend -endif diff --git a/monsterball/monsterball.cpp b/monsterball/monsterball.cpp deleted file mode 100644 index 8f7658a7..00000000 --- a/monsterball/monsterball.cpp +++ /dev/null @@ -1,2268 +0,0 @@ -/* -* $Logfile: /DescentIII/Main/monsterball/monsterball.cpp $ -* $Revision: 1.1.1.1 $ -* $Date: 2003-08-26 03:58:29 $ -* $Author: kevinb $ -* -* Monmsterball Multiplayer game -* -* $Log: not supported by cvs2svn $ - * - * 43 9/24/01 3:17p Matt - * Only show results for two teams, since there are always only two teams. - * - * 42 9/24/01 2:28p Matt - * Allowed room for longer team name on results screen. - * - * 41 9/13/01 5:30p Matt - * Added a team member list to the stats display. - * - * 40 10/21/99 2:46p Kevin - * Macintosh merge! - * - * 39 8/17/99 5:53p Jeff - * track ranks on PXO - * - * 38 7/15/99 1:18a Jeff - * fixed up $scores - * - * 37 7/12/99 2:27p Jeff - * fixed PLR to only display the team label for the disconnected list if - * there are people in the list - * - * 36 7/11/99 6:55p Jeff - * fixed PLR so it doesn't go off the screen on long lists and active - * players in the game are shown first - * - * 35 5/23/99 3:04a Jason - * fixed bug with player rankings not being updated correctly - * - * 34 5/13/99 5:08p Ardussi - * changes for compiling on the Mac - * - * 33 5/12/99 11:04p Jeff - * dmfc and multiplayer games now have endian friendly packets (*whew*) - * - * 32 5/12/99 11:29a Jeff - * changed for loop variable for sanity... - * - * 31 5/09/99 6:20a Jeff - * improved Entropy (added sounds, max virii per room). Fixed rendering - * bugs for other multiplayer dlls. - * - * 30 5/08/99 3:54p Jeff - * fixed Post level results screen. Fixed welcome messages. Fixed save - * stats to file generation - * - * 29 5/08/99 5:07a Jeff - * a little touch ups on PLR (needs work) - * - * 28 5/07/99 1:45p Jeff - * don't count dedicated server in team size count - * - * 27 4/30/99 7:37p Jeff - * cool effects when you score - * - * 26 4/28/99 4:24a Jeff - * added safety checks to prevent crashes - * - * 25 4/27/99 3:44p Jeff - * fixed requirement keywords - * - * 24 4/23/99 6:15p Jeff - * fixed double calls to GameClose - * - * 23 4/23/99 12:43p Jeff - * forgot to call CloseGame - * - * 22 4/22/99 7:15p Jeff - * changed requirement strings - * - * 21 4/21/99 5:34p Jeff - * added requirements - * - * 20 4/19/99 6:23p Jeff - * Linux compile - * - * 19 3/31/99 5:49p Jeff - * fixed bug of displaying icon accidently - * - * 18 3/27/99 4:53p Jeff - * player rankings in multiplayer games implemented. Fixed join message - * so it doesn't get cut off - * - * 17 3/19/99 5:42p Jeff - * high res font fixups - * - * 16 3/19/99 12:54p Jeff - * base support for requesting the number of teams for a multiplayer game - * - * 15 3/17/99 12:23p Jeff - * converted DMFC to be COM interface - * - * 14 2/11/99 6:09p Jeff - * localized - * - * 13 2/11/99 12:49a Jeff - * changed names of exported variables - * - * 12 2/10/99 1:48p Matt - * Changed object handle symbolic constants - * - * 11 2/09/99 3:32p Jeff - * table file parser takes quotes strings for force keywords - * - * 10 2/05/99 7:03p Jeff - * table file parsing macros put in - * - * 9 1/31/99 7:26p Matt - * Renamed a bunch of functions to have HUD capitalized - * - * 8 1/24/99 8:32p Jeff - * a bunch of updates to get 100% up to date, added individual scoring. - * - * 7 1/21/99 11:16p Jeff - * exported vecmat functions - * - * 6 1/20/99 8:05p Jeff - * fixed some bugs - * - * 5 1/20/99 2:28p Jeff - * - * 4 1/19/99 9:54p Jeff - * improvements added...very complete - * - * 3 1/19/99 5:34p Jeff - * updated monsterball - * - * 2 1/18/99 12:06a Jeff - * updated to get 90% of base functionality in -* -* $NoKeywords: $ -*/ - -#include "gamedll_header.h" -#include "idmfc.h" -#include "monsterball.h" -#include -#include "monsterstr.h" - -#ifdef MACINTOSH -#include -#endif - -IDMFC *DMFCBase = NULL; -IDmfcStats *dstat = NULL; -room *dRooms; -object *dObjects; -player *dPlayers; -vis_effect *dVisEffects; -////////////////////////////////// -// defines -#define SPID_NEWPLAYER 0 -#define SPID_HITINFO 1 - -#define MONSTERBALL_ID_NAME "Monsterball" -#define MONSTERBALL_SND_SCORE "Extra life" -#define MONSTERBALL_SND_PICKUP "IGotIt" -#define MONSTERBALL_SND_HIT "Monsterball Hit" -#define MONSTERBALL_LOSE "Drop unknown " -/* -$$TABLE_SOUND "Extra life" -$$TABLE_GENERIC "Monsterball" -$$TABLE_SOUND "IGotIt" -$$TABLE_SOUND "Monsterball Hit" -$$TABLE_SOUND "Drop unknown " -*/ - -#define SCORE_DRAGIN 3 -#define SCORE_HITIN 1 - -#define MAX_MONSTERBALL_VEL 120.0f - -////////////////////////////////// -// Structs - -typedef struct{ - int Score[2]; - int BadScore[2]; -}tPlayerStat; - -int pack_pstat(tPlayerStat *user_info,ubyte *data) -{ - int count = 0; - MultiAddInt(user_info->Score[0],data,&count); - MultiAddInt(user_info->Score[1],data,&count); - MultiAddInt(user_info->BadScore[0],data,&count); - MultiAddInt(user_info->BadScore[1],data,&count); - return count; -} - -int unpack_pstat(tPlayerStat *user_info,ubyte *data) -{ - int count = 0; - user_info->Score[0] = MultiGetInt(data,&count); - user_info->Score[1] = MultiGetInt(data,&count); - user_info->BadScore[0] = MultiGetInt(data,&count); - user_info->BadScore[1] = MultiGetInt(data,&count); - return count; -} - - -typedef struct{ - vector rotvel; - vector velocity; - vector pos; - matrix orient; - float mass; - float size; -}weapon_collide_info; - -struct{ - int id,room; - int objhandle; - int owner_handle; - int icon; - vector pos; -}Monsterball_info; - -////////////////////////////////// -// Globals - -int SortedPLRPlayers[DLLMAX_TEAMS][MAX_PLAYER_RECORDS]; -int TeamScores[DLLMAX_TEAMS]; -int SortedTeams[DLLMAX_TEAMS]; -int SortedPlayers[MAX_PLAYER_RECORDS]; - -int NumOfTeams = 2; -int WhoJustScored = -1,WhoJustScoredTimer=-1; -int GoalRooms[DLLMAX_TEAMS]; -int Highlight_bmp; -int LastHitPnum = -1; - -bool players_sorted = false; //the Sorted*[] have been sorted -bool DisplayPowerBBlink = true; -bool DisplayScoreBlink = true; -bool DisplayScoreScreen = false; -bool display_my_welcome = false; -bool monsterball_info_set = false; - -/////////////////////////////////////////////// -//localization info -char **StringTable; -int StringTableSize = 0; -char *_ErrorString = "Missing String"; -char *GetStringFromTable(int d){if( (d<0) || (d>=StringTableSize) ) return _ErrorString; else return StringTable[d];} -/////////////////////////////////////////////// - -////////////////////////////////// -// Prototypes -void DisplayHUDScores(struct tHUDItem *hitem); -void DisplayStats(void); -void GetGameStartPacket(ubyte *data); -void SendGameStartPacket(int pnum); -bool GetMonsterballInfo(int id); -void SortTeams(void); -void DisplayWelcomeMessage(int player_num); -void OnTimerScore(void); -void OnTimer(void); -void OnTimerScoreKill(void); -void OnTimerKill(void); -void OnTimerRegen(void); -void OnTimerRegenKill(void); -void SaveStatsToFile(char *filename); -void SortPlayerSlots(int *sorted_list,int count); -void SendLastHitInfo(void); -void GetLastHitInfo(ubyte *data); - -void HandlePickupPowerball(object *owner); -void HandleLosePowerball(bool play_sound); -void HandleMonsterballCollideWithObject(object *ball,object *player,vector *point,vector *normal); -void HandleMonsterballCollideWithWeapon(object *ball,weapon_collide_info *winfo,vector *point,vector *normal); -void bump_object(object *object0, vector *rotvel, vector *velocity, vector *pos, matrix *orient, float mass, float size,vector *collision_point,vector *collision_normal,float rot_scale,float vel_scale); -void DoMonsterballScoreEffect(void); -void OnClientPlayerEntersGame(int player_num); - -bool ValidateOwner(int *pnum,object **obj); - -void DetermineScore(int precord_num,int column_num,char *buffer,int buffer_size) -{ - player_record *pr = DMFCBase->GetPlayerRecord(precord_num); - if(!pr || pr->state==STATE_EMPTY){ - buffer[0] = '\0'; - return; - } - - tPlayerStat *stat = (tPlayerStat *)pr->user_info; - - if(column_num==2){ - sprintf(buffer,"%d",(stat)?stat->Score[DSTAT_LEVEL]:0); - }else{ - sprintf(buffer,"%d",(stat)?stat->BadScore[DSTAT_LEVEL]:0); - } -} - -void TeamScoreCallback(int team,char *buffer,int buffer_size) -{ - ASSERT(team>=0 && teamGetPlayerRecord(precord_num); - - if(!pr || pr->state!=STATE_INGAME) - return; - - int pnum; - object *owner; - - if(!ValidateOwner(&pnum,&owner)) - return; - - //the owner is still valid - if(pnum == pr->pnum){ - DLLRenderHUDQuad(x+2,y,10,10,0,0,1,1,Monsterball_info.icon,alpha_to_use); - } -} - -#ifdef MACINTOSH -#pragma export on -#endif - -#define NUM_TEAMS 2 - -// This function gets called by the game when it wants to learn some info about the game -void DLLFUNCCALL DLLGetGameInfo (tDLLOptions *options) -{ - options->flags = DOF_MAXTEAMS|DOF_MINTEAMS; - options->max_teams = NUM_TEAMS; - options->min_teams = NUM_TEAMS; - strcpy(options->game_name,TXT_GAMENAME); - strcpy(options->requirements,"MINGOALS2,GOALPERTEAM,SPEC1"); -} - -// Initializes the game function pointers -void DLLFUNCCALL DLLGameInit (int *api_func,ubyte *all_ok,int num_teams_to_use) -{ - *all_ok = 1; - DMFCBase = CreateDMFC(); - if(!DMFCBase) - { - *all_ok = 0; - return; - } - - dstat = CreateDmfcStats(); - if(!dstat) - { - *all_ok = 0; - return; - } - - DMFCBase->LoadFunctions(api_func); - - //Setup event handlers - DMFCBase->Set_OnCanChangeTeam(OnCanChangeTeam); - DMFCBase->Set_OnClientPlayerDisconnect(OnClientPlayerDisconnect); - DMFCBase->Set_OnPlayerEntersObserver(OnPlayerEntersObserver); - DMFCBase->Set_OnClientPlayerKilled(OnClientPlayerKilled); - DMFCBase->Set_OnServerObjectShieldsChanged(OnServerObjectShieldsChanged); - DMFCBase->Set_OnGameStateRequest(OnGameStateRequest); - DMFCBase->Set_OnServerGameCreated(OnServerGameCreated); - DMFCBase->Set_OnClientLevelStart(OnClientLevelStart); - DMFCBase->Set_OnPlayerConnect(OnPlayerConnect); - DMFCBase->Set_OnInterval(OnInterval); - DMFCBase->Set_OnHUDInterval(OnHUDInterval); - DMFCBase->Set_OnKeypress(OnKeypress); - DMFCBase->Set_OnServerCollide(OnServerCollide); - DMFCBase->Set_OnClientCollide(OnClientCollide); - DMFCBase->Set_OnServerPlayerChangeSegment(OnServerPlayerChangeSegment); - DMFCBase->Set_OnClientPlayerChangeSegment(OnClientPlayerChangeSegment); - DMFCBase->Set_OnServerObjectChangeSegment(OnServerObjectChangeSegment); - DMFCBase->Set_OnClientObjectChangeSegment(OnClientObjectChangeSegment); - DMFCBase->Set_OnSaveStatsToFile(OnSaveStatsToFile); - DMFCBase->Set_OnLevelEndSaveStatsToFile(OnLevelEndSaveStatsToFile); - DMFCBase->Set_OnDisconnectSaveStatsToFile(OnDisconnectSaveStatsToFile); - DMFCBase->Set_OnPLRInterval(OnPLRInterval); - DMFCBase->Set_OnPLRInit(OnPLRInit); - DMFCBase->Set_OnPrintScores(OnPrintScores); - DMFCBase->Set_OnClientPlayerEntersGame(OnClientPlayerEntersGame); - - //setup arrays - dRooms = DMFCBase->GetRooms(); - dObjects = DMFCBase->GetObjects(); - dPlayers = DMFCBase->GetPlayers(); - dVisEffects = DMFCBase->GetVisEffectArray(); - - netgame_info *Netgame = DMFCBase->GetNetgameInfo(); - Netgame->flags |= (NF_TRACK_RANK); - - DMFCBase->GameInit(NumOfTeams); - DLLCreateStringTable("monster.str",&StringTable,&StringTableSize); - DLLmprintf((0,"%d strings loaded from string table\n",StringTableSize)); - - //add the death and suicide messages - DMFCBase->AddDeathMessage(TXT_KILLEDA,true); - DMFCBase->AddSuicideMessage(TXT_SUICIDEA); - - //setup the Playerstats struct so DMFC can handle it automatically when a new player enters the game - DMFCBase->SetupPlayerRecord(sizeof(tPlayerStat),(int (*)(void *,ubyte *))pack_pstat,(int (*)(void *,ubyte *))unpack_pstat); - - //register special packet receivers - DMFCBase->RegisterPacketReceiver(SPID_NEWPLAYER,GetGameStartPacket); - DMFCBase->RegisterPacketReceiver(SPID_HITINFO,GetLastHitInfo); - - DMFCBase->SetNumberOfTeams(NumOfTeams); - - DMFCBase->AddHUDItemCallback(HI_TEXT,DisplayHUDScores); - - Monsterball_info.icon = DLLbm_AllocLoadFileBitmap("PowerballIcon.ogf",0); - if(Monsterball_info.icon==-1) - Monsterball_info.icon = BAD_BITMAP_HANDLE; - - DisplayScoreScreen = false; - - //TableFileAdd("Monsterball.Gam"); - - - Highlight_bmp = DLLbm_AllocBitmap(32,32,0); - if(Highlight_bmp>BAD_BITMAP_HANDLE){ - ushort *data = DLLbm_data(Highlight_bmp,0); - if(!data){ - //bail on out of here - *all_ok = 0; - return; - } - for(int x=0;x<32*32;x++){ - data[x] = GR_RGB16(50,50,50)|OPAQUE_FLAG; - } - } - - // Initialize the Stats Manager - // ---------------------------- - tDmfcStatsInit tsi; - tDmfcStatsColumnInfo pl_col[8]; - char gname[20]; - strcpy(gname,TXT_STATGAMENAME); - - tsi.flags = DSIF_SHOW_PIC|DSIF_SHOW_OBSERVERICON|DSIF_SEPERATE_BY_TEAM; - tsi.cColumnCountDetailed = 0; - tsi.cColumnCountPlayerList = 8; - tsi.clbDetailedColumnBMP = NULL; - tsi.clbDetailedColumn = NULL; - tsi.clbPlayerColumn = DetermineScore; - tsi.clbPlayerColumnBMP = ShowStatBitmap; - tsi.DetailedColumns = NULL; - tsi.GameName = gname; - tsi.MaxNumberDisplayed = NULL; - tsi.PlayerListColumns = pl_col; - tsi.SortedPlayerRecords = SortedPlayers; - tsi.clTeamLine = TeamScoreCallback; - - pl_col[0].color_type = DSCOLOR_TEAM; - pl_col[0].title[0] = '\0'; - pl_col[0].type = DSCOL_BMP; - pl_col[0].width = 15; - - pl_col[1].color_type = DSCOLOR_TEAM; - strcpy(pl_col[1].title,TXT_PILOT); - pl_col[1].type = DSCOL_PILOT_NAME; - pl_col[1].width = 110; - - pl_col[2].color_type = DSCOLOR_TEAM; - strcpy(pl_col[2].title,TXT_POINTS); - pl_col[2].type = DSCOL_CUSTOM; - pl_col[2].width = 51; - - pl_col[3].color_type = DSCOLOR_TEAM; - strcpy(pl_col[3].title,TXT_BLUNDERS); - pl_col[3].type = DSCOL_CUSTOM; - pl_col[3].width = 64; - - pl_col[4].color_type = DSCOLOR_TEAM; - strcpy(pl_col[4].title,TXT_KILLSSHORT); - pl_col[4].type = DSCOL_KILLS_LEVEL; - pl_col[4].width = 41; - - pl_col[5].color_type = DSCOLOR_TEAM; - strcpy(pl_col[5].title,TXT_DEATHSSHORT); - pl_col[5].type = DSCOL_DEATHS_LEVEL; - pl_col[5].width = 41; - - pl_col[6].color_type = DSCOLOR_TEAM; - strcpy(pl_col[6].title,TXT_SUICIDESSHORT); - pl_col[6].type = DSCOL_SUICIDES_LEVEL; - pl_col[6].width = 41; - - pl_col[7].color_type = DSCOLOR_TEAM; - strcpy(pl_col[7].title,TXT_PING); - pl_col[7].type = DSCOL_PING; - pl_col[7].width = 40; - - dstat->Initialize(&tsi); -} - -// Called when the DLL is shutdown -void DLLFUNCCALL DLLGameClose () -{ - if(Monsterball_info.icon>BAD_BITMAP_HANDLE) - DLLbm_FreeBitmap(Monsterball_info.icon); - - DLLDestroyStringTable(StringTable,StringTableSize); - - if(dstat) - { - dstat->DestroyPointer(); - dstat = NULL; - } - - if(DMFCBase) - { - DMFCBase->GameClose(); - DMFCBase->DestroyPointer(); - DMFCBase = NULL; - } -} - -bool OnCanChangeTeam(int pnum,int newteam) -{ - if(!DMFCBase->OnCanChangeTeam(pnum,newteam)) - return false; - - int p; - if(!ValidateOwner(&p,NULL)) - return true; - - if(p == pnum) - return false; - - return true; -} - -void OnHUDInterval(void) -{ - dstat->DoFrame(); - DMFCBase->DisplayOutrageLogo(); - - DMFCBase->OnHUDInterval(); -} - -void OnInterval(void) -{ - SortPlayerSlots(SortedPlayers,MAX_PLAYER_RECORDS); - players_sorted = true; - SortTeams(); - - if(DMFCBase->GetLocalRole()==LR_SERVER){ - //make sure velocity of the ball isn't more than MAX_MONSTERBALL_VEL - object *ball; - if(!DLLObjGet(Monsterball_info.objhandle,&ball)){ - //blah! - FatalError("MONSTERBALL IS MISSING\n"); - } - - float mag = DLLvm_GetMagnitudeFast(&ball->mtype.phys_info.velocity); - if(mag>MAX_MONSTERBALL_VEL){ - ball->mtype.phys_info.velocity /= mag; - ball->mtype.phys_info.velocity *= MAX_MONSTERBALL_VEL; - } - } - - DMFCBase->OnInterval(); -} - -void OnKeypress(int key) -{ - dllinfo *Data = DMFCBase->GetDLLInfoCallData(); - switch(key){ - case K_F7: - DisplayScoreScreen = !DisplayScoreScreen; - DMFCBase->EnableOnScreenMenu(false); - dstat->Enable(DisplayScoreScreen); - break; - case K_PAGEDOWN: - if(DisplayScoreScreen){ - dstat->ScrollDown(); - Data->iRet = 1; - } - break; - case K_PAGEUP: - if(DisplayScoreScreen){ - dstat->ScrollUp(); - Data->iRet = 1; - } - break; - case K_F6: - DisplayScoreScreen = false; - dstat->Enable(false); - break; - case K_ESC: - if(DisplayScoreScreen){ - dstat->Enable(false); - DisplayScoreScreen = false; - Data->iRet = 1; - } - break; - } - - DMFCBase->OnKeypress(key); -} - -// The server has just started, so clear out all the stats and game info -void OnServerGameCreated(void) -{ - DMFCBase->OnServerGameCreated(); - tPlayerStat *stat; - player_record *pr; - int i; - - for(i=0;iGetPlayerRecord(i); - if(!pr) - continue; - - stat = (tPlayerStat *)pr->user_info; - if(stat){ - stat->Score[DSTAT_LEVEL] = stat->Score[DSTAT_OVERALL] = 0; - stat->BadScore[DSTAT_LEVEL] = stat->BadScore[DSTAT_OVERALL] = 0; - } - } - - for(i=0;iOnServerCollide(me_obj,it_obj,point,normal); - return; - } - - // check to see if the collision was with the Monsterball - if(me_obj->handle==Monsterball_info.objhandle){ - - LastHitPnum = -1; - - switch(it_obj->type){ - case OBJ_PLAYER: - { - if(DMFCBase->IsPlayerAlive(it_obj->id)){ - LastHitPnum = it_obj->id; - - //call the event on the client so they can do any physics sim - DMFCBase->CallClientEvent(EVT_CLIENT_GAMECOLLIDE,DMFCBase->GetMeObjNum(),DMFCBase->GetItObjNum(),-1,true); - DMFCBase->CallOnClientCollide(me_obj,it_obj,point,normal); - } - }break; - case OBJ_WEAPON: - { - object *parent; - DLLGetUltimateParentForObject(&parent,it_obj); - if(parent->type == OBJ_PLAYER){ - LastHitPnum = parent->id; - } - - weapon_collide_info winfo; - winfo.rotvel.x = it_obj->mtype.phys_info.rotvel.x; - winfo.rotvel.y = it_obj->mtype.phys_info.rotvel.y; - winfo.rotvel.z = it_obj->mtype.phys_info.rotvel.z; - winfo.velocity.x = it_obj->mtype.phys_info.velocity.x; - winfo.velocity.y = it_obj->mtype.phys_info.velocity.y; - winfo.velocity.z = it_obj->mtype.phys_info.velocity.z; - winfo.pos.x = it_obj->pos.x; - winfo.pos.y = it_obj->pos.y; - winfo.pos.z = it_obj->pos.z; - winfo.orient.fvec.x = it_obj->orient.fvec.x; - winfo.orient.fvec.y = it_obj->orient.fvec.y; - winfo.orient.fvec.z = it_obj->orient.fvec.z; - winfo.orient.uvec.x = it_obj->orient.uvec.x; - winfo.orient.uvec.y = it_obj->orient.uvec.y; - winfo.orient.uvec.z = it_obj->orient.uvec.z; - winfo.orient.rvec.x = it_obj->orient.rvec.x; - winfo.orient.rvec.y = it_obj->orient.rvec.y; - winfo.orient.rvec.z = it_obj->orient.rvec.z; - winfo.mass = it_obj->mtype.phys_info.mass; - winfo.size = it_obj->size; - HandleMonsterballCollideWithWeapon(me_obj,&winfo,point,normal); - }break; - } - } - - //check to see if the collision was between a player and another player, who has the powerball - if(me_obj->type == OBJ_PLAYER && (it_obj->type==OBJ_PLAYER||it_obj->type==OBJ_WEAPON)){ - if(it_obj->type==OBJ_PLAYER && !DMFCBase->IsPlayerAlive(it_obj->id) ){ - //the collided player isn't alive - }else{ - int p; - if(ValidateOwner(&p,NULL)){ - if(p==me_obj->id){ - //the player has the powerball - DMFCBase->CallClientEvent(EVT_CLIENT_GAMECOLLIDE,DMFCBase->GetMeObjNum(),DMFCBase->GetItObjNum(),-1,true); - DMFCBase->CallOnClientCollide(me_obj,it_obj,point,normal); - } - } - } - } - - DMFCBase->OnServerCollide(me_obj,it_obj,point,normal); -} - -void OnClientPlayerDisconnect(int player_num) -{ - int p; - if(ValidateOwner(&p,NULL)){ - if(p==player_num){ - HandleLosePowerball(true); - } - } - DMFCBase->OnClientPlayerDisconnect(player_num); -} - -void OnPlayerEntersObserver(int pnum,object *piggy) -{ - int p; - if(ValidateOwner(&p,NULL)){ - if(p==pnum){ - HandleLosePowerball(true); - } - } - - DMFCBase->OnPlayerEntersObserver(pnum,piggy); -} - -void OnClientPlayerKilled(object *killer_obj,int victim_pnum) -{ - int p; - if(ValidateOwner(&p,NULL)){ - if(p==victim_pnum){ - HandleLosePowerball(true); - } - } - - DMFCBase->OnClientPlayerKilled(killer_obj,victim_pnum); -} - -void HandleLosePowerball(bool play_sound) -{ - static int sound = -1; - - object *owner; - if(!ValidateOwner(NULL,&owner)) - return; - - object *ball; - if(!DLLObjGet(Monsterball_info.objhandle,&ball)){ - //blah! - FatalError("MONSTERBALL IS MISSING\n"); - } - - if(play_sound){ - if(sound==-1) - sound=DLLFindSoundName(IGNORE_TABLE(MONSTERBALL_LOSE)); - if(sound!=-1) - DLLPlay2dSound(sound); - } - - if(DMFCBase->GetLocalRole()==LR_SERVER) - DLLUnattachFromParent(ball); - - Monsterball_info.owner_handle = OBJECT_HANDLE_NONE; -} - -void HandlePickupPowerball(object *owner) -{ - static int sound = -1; - - if(sound==-1) - sound=DLLFindSoundName(IGNORE_TABLE(MONSTERBALL_SND_PICKUP)); - if(sound!=-1) - DLLPlay2dSound(sound); - - - if(DMFCBase->GetLocalRole()==LR_SERVER){ - //if it was a player, attach the ball to the player - object *bobj; - if(!DLLObjGet(Monsterball_info.objhandle,&bobj)){ - FatalError("Monster Ball not found\n"); - } - - bool ret = DLLAttachObject(owner,0,bobj,0,true); - if(!ret){ - //blah! - mprintf((0,"COULDN'T ATTACH MONSTERBALL TO PLAYER!!!!!!\n")); - } - } - - Monsterball_info.owner_handle = owner->handle; -} - -void OnClientCollide(object *me_obj,object *it_obj,vector *point,vector *normal) -{ - //three things can happen in here - // 1) The collision is between the ball (with no owner) and a player - // 2) The collision is between the owner and another player or weapon - // 3) The collision is between the ball and a robot - - if( me_obj && me_obj->type==OBJ_PLAYER){ - //case 2: me_obj = owner - //Result: The owner is to lose the monsterball - HandleLosePowerball(true); - DMFCBase->OnClientCollide(me_obj,it_obj,point,normal); - return; - } - - if( me_obj && me_obj->type==OBJ_ROBOT){ - - if(it_obj->type==OBJ_ROBOT){ - //case 3: me_obj = monsterball it_obj = robot - if(DMFCBase->GetLocalRole()==LR_SERVER){ - //do the physics on the Monsterball - HandleMonsterballCollideWithObject(me_obj,it_obj,point,normal); - } - } - - if(it_obj->type==OBJ_PLAYER){ - //case 1: me_obj = monsterball it_obj = player - //Result: The player is to pickup the monsterball (as long as it has no owner) - int p; - if(!ValidateOwner(&p,NULL) && p!=it_obj->id){ - ASSERT(it_obj->type==OBJ_PLAYER); - //HandlePickupPowerball(it_obj); - HandleMonsterballCollideWithObject(me_obj,it_obj,point,normal); - } - } - - DMFCBase->OnClientCollide(me_obj,it_obj,point,normal); - return; - } - - DMFCBase->OnClientCollide(me_obj,it_obj,point,normal); -} - -void OnServerObjectShieldsChanged(object *obj,float amount) -{ - if(!obj) - return; - if(obj->handle == Monsterball_info.objhandle){ - obj->shields += amount; - } -} - -void OnServerObjectChangeSegment(object *obj,int newseg,int oldseg) -{ - if(!obj){ - DMFCBase->OnServerObjectChangeSegment(obj,newseg,oldseg); - return; - } - - if(obj->type==OBJ_ROBOT && obj->handle==Monsterball_info.objhandle){ - //this is the monster ball, see if it's going into a goal room - bool is_goal = false; - for(int i=0;iCallClientEvent(EVT_CLIENT_GAMEOBJCHANGESEG,DMFCBase->GetMeObjNum(),DMFCBase->GetItObjNum(),-1,true); - DMFCBase->CallOnClientObjectChangeSegment(obj,newseg,oldseg); - } - } - - DMFCBase->OnServerObjectChangeSegment(obj,newseg,oldseg); -} - -void OnClientObjectChangeSegment(object *obj,int newseg,int oldseg) -{ - static int sound = -1; - - if(!obj){ - DMFCBase->OnClientObjectChangeSegment(obj,newseg,oldseg); - FatalError ("INVALID OBJECT PASSED INTO OnClientObjectChangeSegment()"); - return; - } - int team = -1; - - for(int i=0;i=NumOfTeams){ - FatalError ("NOT A GOAL ROOM\n"); - return; - } - - if(sound==-1) - sound=DLLFindSoundName(IGNORE_TABLE(MONSTERBALL_SND_SCORE)); - if(sound!=-1) - DLLPlay2dSound(sound,MAX_GAME_VOLUME*0.66f); - - DoMonsterballScoreEffect(); - - DLLvm_MakeVectorZero(&obj->mtype.phys_info.velocity); - DLLvm_MakeIdentity(&obj->orient); - DLLObjSetPos(obj,&Monsterball_info.pos,Monsterball_info.room,NULL,false); - - if(!DMFCBase->CheckPlayerNum(LastHitPnum)){ - if(SCORE_HITIN==1){ - DLLAddHUDMessage(TXT_SCOREONE,DMFCBase->GetTeamString(team)); - }else{ - DLLAddHUDMessage(TXT_SCOREMULTI,DMFCBase->GetTeamString(team),SCORE_HITIN); - } - }else{ - int last_hit_team = dPlayers[LastHitPnum].team; - char *callsign = dPlayers[LastHitPnum].callsign; - tPlayerStat *stat = (tPlayerStat *)DMFCBase->GetPlayerRecordData(LastHitPnum); - - if(last_hit_team!=team){ - //he scored for the other team!!! - - if(SCORE_HITIN==1){ - DLLAddHUDMessage(TXT_BLUNDERSCORE,callsign,DMFCBase->GetTeamString(team)); - }else{ - DLLAddHUDMessage(TXT_BLUNDERMULTISCORE,callsign,SCORE_HITIN,DMFCBase->GetTeamString(team)); - } - - if(stat){ - stat->BadScore[DSTAT_LEVEL]++; - stat->BadScore[DSTAT_OVERALL]++; - } - }else{ - //good score! - if(SCORE_HITIN==1){ - DLLAddHUDMessage(TXT_PLAYERSCORE,callsign,DMFCBase->GetTeamString(team)); - }else{ - DLLAddHUDMessage(TXT_PLAYERMULTISCORE,callsign,DMFCBase->GetTeamString(team),SCORE_HITIN); - } - - if(stat){ - stat->Score[DSTAT_LEVEL]++; - stat->Score[DSTAT_OVERALL]++; - } - } - } - - TeamScores[team]+= SCORE_HITIN; - - //do killgoal check - int goal; - if((DMFCBase->GetScoreLimit(&goal))&&(DMFCBase->GetLocalRole()==LR_SERVER)){ - if(TeamScores[team]>=goal) - DMFCBase->EndLevel(); - } - - //Set a Timer to display - if(WhoJustScoredTimer!=-1) - DMFCBase->KillTimer(WhoJustScoredTimer); - WhoJustScoredTimer = DMFCBase->SetTimerInterval(OnTimerScore,0.5f,5.0f,OnTimerScoreKill); - WhoJustScored = team; - - - DMFCBase->OnClientObjectChangeSegment(obj,newseg,oldseg); -} - -void OnServerPlayerChangeSegment(int player_num,int newseg,int oldseg) -{ - if(player_num==-1) - return; - if(newseg==GoalRooms[DMFCBase->GetPlayerTeam(player_num)]){ - //check to see if a player dragged the ball into the goal - int p; - if(ValidateOwner(&p,NULL)){ - // a player currently has the monsterball - if(p==player_num){ - //it's this player - DMFCBase->CallClientEvent(EVT_CLIENT_GAMEPLAYERCHANGESEG,DMFCBase->GetMeObjNum(),DMFCBase->GetItObjNum(),-1); - DMFCBase->CallOnClientPlayerChangeSegment(player_num,newseg,oldseg); - } - } - } - DMFCBase->OnServerPlayerChangeSegment(player_num,newseg,oldseg); -} - -void OnClientPlayerChangeSegment(int player_num,int newseg,int oldseg) -{ - // If we get here, than a player dragged the powerball into their goal - static int sound = -1; - object *bobj; - int p; - - //if we got here than the player with the Monsterball has entered his team's goal! - - if(DMFCBase->IsPlayerDedicatedServer(player_num)) - return; //dedicated server - - if( !ValidateOwner(&p,NULL) ){ - return; - } - if(p!=player_num) - return; - - HandleLosePowerball(false); - - if(!DLLObjGet(Monsterball_info.objhandle,&bobj)){ - FatalError("MonsterBall Is Missing!\n"); - } - - DLLObjSetPos(bobj,&Monsterball_info.pos,Monsterball_info.room,NULL,false); - - if(SCORE_DRAGIN==1) - DLLAddHUDMessage(TXT_SCOREONE,DMFCBase->GetTeamString(dPlayers[player_num].team)); - else - DLLAddHUDMessage(TXT_SCOREMULTI,DMFCBase->GetTeamString(dPlayers[player_num].team),SCORE_DRAGIN); - - TeamScores[dPlayers[player_num].team]+= SCORE_DRAGIN; - - if(sound==-1) - sound=DLLFindSoundName(IGNORE_TABLE(MONSTERBALL_SND_SCORE)); - if(sound!=-1) - DLLPlay2dSound(sound); - - //do killgoal check - int goal; - if((DMFCBase->GetScoreLimit(&goal))&&(DMFCBase->GetLocalRole()==LR_SERVER)){ - if(TeamScores[dPlayers[player_num].team]>=goal) - DMFCBase->EndLevel(); - } - - //Set a Timer to display - if(WhoJustScoredTimer!=-1) - DMFCBase->KillTimer(WhoJustScoredTimer); - WhoJustScoredTimer = DMFCBase->SetTimerInterval(OnTimerScore,0.5f,5.0f,OnTimerScoreKill); - WhoJustScored = dPlayers[player_num].team; -} - - -// The server has started a new level, so clear out any scores needed to be reset -void OnClientLevelStart(void) -{ - DMFCBase->OnClientLevelStart(); - - tPlayerStat *stat; - int i; - player_record *pr; - - for(i=0;iGetPlayerRecord(i); - if(pr) - stat = (tPlayerStat *)pr->user_info; - else - stat = NULL; - if(stat){ - stat->Score[DSTAT_LEVEL] = 0; - stat->BadScore[DSTAT_LEVEL] = 0; - } - - } - - for(i=0;iGetLocalRole()==LR_SERVER){ - int objnum = DLLObjCreate(OBJ_ROBOT,Monsterball_info.id,Monsterball_info.room,&Monsterball_info.pos,NULL); - if(objnum==-1) - FatalError("Unable to create Monsterball"); - - dObjects[objnum].mtype.phys_info.rotdrag = 5.0f; - - DLLMultiSendObject(&dObjects[objnum],1); - Monsterball_info.objhandle = dObjects[objnum].handle; - Monsterball_info.owner_handle = OBJECT_HANDLE_NONE; - monsterball_info_set = true; - }else{ - DMFCBase->RequestGameState(); - } - players_sorted = false; -} - -// A New Player has entered the game, so we want to send him a game status packet that -// has information about the game -void OnGameStateRequest(int player_num) -{ - SendGameStartPacket(player_num); - DMFCBase->OnGameStateRequest(player_num); -} - - -// A new player has entered the game, zero their stats out -void OnPlayerConnect(int player_num) -{ - tPlayerStat *stat = (tPlayerStat *)DMFCBase->GetPlayerRecordData(player_num); - if(stat){ - stat->Score[DSTAT_LEVEL] = 0; - stat->Score[DSTAT_OVERALL] = 0; - stat->BadScore[DSTAT_LEVEL] = 0; - stat->BadScore[DSTAT_OVERALL] = 0; - } - - DMFCBase->OnPlayerConnect(player_num); -} - -// A new player has entered the game, zero there stats out -void OnClientPlayerEntersGame(int player_num) -{ - DMFCBase->OnClientPlayerEntersGame(player_num); - if(player_num!=DMFCBase->GetPlayerNum()) - DisplayWelcomeMessage(player_num); - else - display_my_welcome = true; -} - - -bool compare_slots(int a,int b) -{ - int ascore,bscore; - player_record *apr,*bpr; - tPlayerStat *astat,*bstat; - - apr = DMFCBase->GetPlayerRecord(a); - bpr = DMFCBase->GetPlayerRecord(b); - if( !apr ) - return true; - if( !bpr ) - return false; - if( apr->state==STATE_EMPTY ) - return true; - if( bpr->state==STATE_EMPTY ) - return false; - astat = (tPlayerStat *)apr->user_info; - bstat = (tPlayerStat *)bpr->user_info; - - if( (apr->state==STATE_INGAME) && (bpr->state==STATE_INGAME) ){ - //both players were in the game - ascore = (astat)?astat->Score[DSTAT_LEVEL]:0; - bscore = (bstat)?bstat->Score[DSTAT_LEVEL]:0; - return (ascorestate==STATE_INGAME) && (bpr->state==STATE_DISCONNECTED) ){ - //apr gets priority since he was in the game on exit - return false; - } - if( (apr->state==STATE_DISCONNECTED) && (bpr->state==STATE_INGAME) ){ - //bpr gets priority since he was in the game on exit - return true; - } - //if we got here then both players were disconnected - ascore = (astat)?astat->Score[DSTAT_LEVEL]:0; - bscore = (bstat)?bstat->Score[DSTAT_LEVEL]:0; - return (ascore=0 && compare_slots(tempsort[j],t); j--){ - tempsort[j+1] = tempsort[j]; - } - // insert - tempsort[j+1] = t; - } - - //copy the array over - memcpy(sorted_list,tempsort,count*sizeof(int)); -} - -void OnPLRInit(void) -{ - monsterball_info_set = false; //for the next level - - SortPlayerSlots(SortedPlayers,MAX_PLAYER_RECORDS); - - //Now fill in the final structure of sorted names - int TeamCount[DLLMAX_TEAMS]; - player_record *pr; - int team,i; - - for(i=0;iGetPlayerRecord(slot); - if(pr->state!=STATE_EMPTY){ - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue;//skip dedicated server - - team = (pr->state==STATE_INGAME)?dPlayers[pr->pnum].team:pr->team; - - if(team>=NumOfTeams) - team = 0; - SortedPLRPlayers[team][TeamCount[team]] = slot; - TeamCount[team]++; - } - } - for(i=0;iOnPLRInit(); -} - -void OnPLRInterval(void) -{ - DMFCBase->OnPLRInterval(); - - int TeamCol = 35; - int NameCol = 190; - int PointCol = 280; - int BlunderCol = 340; - int KillsCol = 410; - int DeathsCol = 450; - int SuicidesCol = 490; - int y = 40; - int slot; - player_record *pr; - tPlayerStat *stat; - - DLLgrtext_SetFont((DMFCBase->GetGameFontTranslateArray())[SMALL_UI_FONT_INDEX]); - int height = DLLgrfont_GetHeight((DMFCBase->GetGameFontTranslateArray())[SMALL_UI_FONT_INDEX]) + 1; - - //print out header - DLLgrtext_SetColor(GR_RGB(255,255,150)); - DLLgrtext_Printf(NameCol,y,TXT_PILOT); - DLLgrtext_Printf(PointCol,y,TXT_POINTS); - DLLgrtext_Printf(BlunderCol,y,TXT_BLUNDERS); - DLLgrtext_Printf(KillsCol,y,TXT_KILLSSHORT); - DLLgrtext_Printf(DeathsCol,y,TXT_DEATHSSHORT); - DLLgrtext_Printf(SuicidesCol,y,TXT_SUICIDESSHORT); - y+=height; - bool has_members; - bool doing_connected = true; -do_disconnected_folk: - - for(int team=0;teamWasPlayerInGameAtLevelEnd(SortedPLRPlayers[team][temp_idx]); - if(pnum==-1) - { - show_team_label = true; - break; - } - temp_idx++; - } - }else - { - show_team_label = true; - } - - if(show_team_label){ - //is there anyone on this team? - DLLgrtext_SetColor(DMFCBase->GetTeamColor(team)); - DLLgrtext_Printf(TeamCol,y,TXT_HUDDISPLAY,DMFCBase->GetTeamString(team),TeamScores[team]); - } - has_members = false; - - for(int index=0;indexGetPlayerRecord(slot); - if(pr && pr->state!=STATE_EMPTY){ - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue;//skip dedicated server - - int pnum=DMFCBase->WasPlayerInGameAtLevelEnd(slot); - - if( (doing_connected && pnum==-1) || - (!doing_connected && pnum!=-1) ) - continue;//we're not handling them right now - - if(pnum!=-1) - { - DLLgrtext_SetColor(DMFCBase->GetTeamColor(team)); - }else - { - DLLgrtext_SetColor(GR_RGB(128,128,128)); - } - - char tempbuffer[40]; - strcpy(tempbuffer,pr->callsign); - DMFCBase->ClipString(PointCol - NameCol - 10,tempbuffer,true); - - //valid player - stat = (tPlayerStat *)pr->user_info; - DLLgrtext_Printf(NameCol,y,"%s",tempbuffer); - DLLgrtext_Printf(PointCol,y,"%d",(stat)?stat->Score[DSTAT_LEVEL]:0); - DLLgrtext_Printf(BlunderCol,y,"%d",(stat)?stat->BadScore[DSTAT_LEVEL]:0); - DLLgrtext_Printf(KillsCol,y,"%d",pr->dstats.kills[DSTAT_LEVEL]); - DLLgrtext_Printf(DeathsCol,y,"%d",pr->dstats.deaths[DSTAT_LEVEL]); - DLLgrtext_Printf(SuicidesCol,y,"%d",pr->dstats.suicides[DSTAT_LEVEL]); - y+=height; - has_members = true; - - if(y>=440) - goto quick_exit; - } - }//end for - //on to the next team - - if(!has_members) - y+=height; //on to the next line - - if(y>=440) - goto quick_exit; - }//end for - - if(doing_connected) - { - doing_connected = false; - goto do_disconnected_folk; - } - -quick_exit:; - -} - - -void OnPrintScores(int level) -{ - char buffer[256]; - char name[50]; - int t,i; - int pos[7]; - int len[7]; - - for(i=0;iGetTeamString(i),TeamScores[i]); - DPrintf(buffer); - } - - memset(buffer,' ',256); - pos[0] = 0; t = len[0] = 20; //give ample room for pilot name - pos[1] = pos[0] + t + 1; t = len[1] = strlen(TXT_POINTS); - pos[2] = pos[1] + t + 1; t = len[2] = strlen(TXT_BLUNDERS); - pos[3] = pos[1] + t + 1; t = len[3] = strlen(TXT_KILLS); - pos[4] = pos[2] + t + 1; t = len[4] = strlen(TXT_DEATHS); - pos[5] = pos[3] + t + 1; t = len[5] = strlen(TXT_SUICIDES); - pos[6] = pos[4] + t + 1; t = len[6] = strlen(TXT_PING); - - memcpy(&buffer[pos[0]],TXT_PILOT,strlen(TXT_PILOT)); - memcpy(&buffer[pos[1]],TXT_POINTS,len[1]); - memcpy(&buffer[pos[2]],TXT_BLUNDERS,len[2]); - memcpy(&buffer[pos[3]],TXT_KILLS,len[3]); - memcpy(&buffer[pos[4]],TXT_DEATHS,len[4]); - memcpy(&buffer[pos[5]],TXT_SUICIDES,len[5]); - memcpy(&buffer[pos[6]],TXT_PING,len[6]); - buffer[pos[6]+len[6]+1] = '\n'; - buffer[pos[6]+len[6]+2] = '\0'; - DPrintf(buffer); - - int slot; - player_record *pr; - int pcount; - - if(level<0 || level>=MAX_PLAYER_RECORDS) - pcount = MAX_PLAYER_RECORDS; - else - pcount = level; - - int sortedplayers[MAX_PLAYER_RECORDS]; - DMFCBase->GetSortedPlayerSlots(sortedplayers,MAX_PLAYER_RECORDS); - - for(i=0;iGetPlayerRecord(slot); - tPlayerStat *stat; - if((pr)&&(pr->state!=STATE_EMPTY)){ - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue; //skip dedicated server - - sprintf(name,"%s%s:",(pr->state==STATE_DISCONNECTED)?"*":"",pr->callsign); - name[19] = '\0'; - - stat = (tPlayerStat *)pr->user_info; - - memset(buffer,' ',256); - t = strlen(name); memcpy(&buffer[pos[0]],name,(tScore[DSTAT_LEVEL]:0); - t = strlen(name); memcpy(&buffer[pos[1]],name,(tBadScore[DSTAT_LEVEL]:0); - t = strlen(name); memcpy(&buffer[pos[2]],name,(tdstats.kills[DSTAT_LEVEL]); - t = strlen(name); memcpy(&buffer[pos[3]],name,(tdstats.deaths[DSTAT_LEVEL]); - t = strlen(name); memcpy(&buffer[pos[4]],name,(tdstats.suicides[DSTAT_LEVEL]); - t = strlen(name); memcpy(&buffer[pos[5]],name,(tstate==STATE_INGAME) - sprintf(name,"%.0f",(DMFCBase->GetNetPlayers())[pr->pnum].ping_time*1000.0f); - else - strcpy(name,"---"); - t = strlen(name); memcpy(&buffer[pos[6]],name,(tGetSortedPlayerSlots(sortedslots,MAX_PLAYER_RECORDS); - SortTeams(); - count = 1; - - sprintf(buffer,TXT_SAVESTATSA,(DMFCBase->GetNetgameInfo())->name,(DMFCBase->GetCurrentMission())->cur_level); - DLLcf_WriteString(file,buffer); - - for(p=0;pGetTeamString(team_i)); - memcpy(&buffer[0],tempbuffer,strlen(tempbuffer)); - sprintf(tempbuffer,"[%d]",TeamScores[team_i]); - memcpy(&buffer[20],tempbuffer,strlen(tempbuffer)); - buffer[20 + strlen(tempbuffer)] = '\0'; - DLLcf_WriteString(file,buffer); - } - - //Write team members - DLLcf_WriteString(file,""); //blank line - for(int t=0;tGetTeamString(team_i)); - strcat(buffer,":"); - DLLcf_WriteString(file,buffer); - - for(p=0;pGetPlayerRecord(sortedslots[p]); - if( pr && pr->state!=STATE_EMPTY) { - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue;//skip dedicated server - - if (pr->team == team_i) { //Check if current team - sprintf(buffer," %s",pr->callsign); - DLLcf_WriteString(file,buffer); - } - } - } - } - DLLcf_WriteString(file,""); //blank line - - sprintf(buffer,TXT_SAVESTATSB); - DLLcf_WriteString(file,buffer); - - sprintf(buffer,TXT_SAVESTATSC); - DLLcf_WriteString(file,buffer); - sprintf(buffer,"--------------------------------------------------------------------------------------"); - DLLcf_WriteString(file,buffer); - - - for(p=0;pGetPlayerRecord(sortedslots[p]); - if( pr && pr->state!=STATE_EMPTY) { - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue;//skip dedicated server - - st = (tPlayerStat *)pr->user_info; - memset(buffer,' ',BUFSIZE); - - sprintf(tempbuffer,"%d)",count); - memcpy(&buffer[0],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%s%s",(pr->state==STATE_INGAME)?"":"*",pr->callsign); - memcpy(&buffer[5],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d[%d]",(st)?st->Score[DSTAT_LEVEL]:0,(st)?st->Score[DSTAT_OVERALL]:0); - memcpy(&buffer[34],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d[%d]",(st)?st->BadScore[DSTAT_LEVEL]:0,(st)?st->BadScore[DSTAT_OVERALL]:0); - memcpy(&buffer[42],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d[%d]",pr->dstats.kills[DSTAT_LEVEL],pr->dstats.kills[DSTAT_OVERALL]); - memcpy(&buffer[55],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d[%d]",pr->dstats.deaths[DSTAT_LEVEL],pr->dstats.deaths[DSTAT_OVERALL]); - memcpy(&buffer[67],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d[%d]",pr->dstats.suicides[DSTAT_LEVEL],pr->dstats.suicides[DSTAT_OVERALL]); - memcpy(&buffer[78],tempbuffer,strlen(tempbuffer)); - - int pos; - pos = 78 + strlen(tempbuffer) + 1; - if(posGetPlayerRecord(p); - if( pr && pr->state!=STATE_EMPTY) { - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue;//skip dedicated server - - //Write out header - sprintf(buffer,"%d) %s%s (%s)",count,(pr->state==STATE_INGAME)?"":"*",pr->callsign,DMFCBase->GetTeamString(pr->team)); - DLLcf_WriteString(file,buffer); - length = strlen(buffer); - memset(buffer,'=',length); - buffer[length] = '\0'; - DLLcf_WriteString(file,buffer); - - //time in game - sprintf(buffer,TXT_TIMEINGAME,DMFCBase->GetTimeString(DMFCBase->GetTimeInGame(p))); - DLLcf_WriteString(file,buffer); - - if(DMFCBase->FindPInfoStatFirst(p,&stat)){ - sprintf(buffer,TXT_SAVESTATSE); - DLLcf_WriteString(file,buffer); - - if(stat.slot!=p){ - memset(buffer,' ',BUFSIZE); - dpr = DMFCBase->GetPlayerRecord(stat.slot); - - if(dpr) - { - int pos; - - sprintf(tempbuffer,"%s",DMFCBase->GetTeamString(dpr->team)); - memcpy(buffer,tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%s",dpr->callsign); - memcpy(&buffer[6],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d",stat.kills); - memcpy(&buffer[36],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d",stat.deaths); - memcpy(&buffer[46],tempbuffer,strlen(tempbuffer)); - - pos = 46 + strlen(tempbuffer) + 1; - if(posFindPInfoStatNext(&stat)){ - if(stat.slot!=p){ - int pos; - memset(buffer,' ',BUFSIZE); - dpr = DMFCBase->GetPlayerRecord(stat.slot); - if(dpr) - { - sprintf(tempbuffer,"%s",dpr->callsign); - memcpy(buffer,tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d",stat.kills); - memcpy(&buffer[30],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d",stat.deaths); - memcpy(&buffer[40],tempbuffer,strlen(tempbuffer)); - - pos = 40 + strlen(tempbuffer) + 1; - if(posFindPInfoStatClose(); - DLLcf_WriteString(file,""); //skip a line - count++; - } - } - - //done writing stats - DLLcfclose(file); - DLLAddHUDMessage(TXT_STATSSAVED); -} - -#define ROOTFILENAME "MonsterBall" -void OnSaveStatsToFile(void) -{ - char filename[256]; - DMFCBase->GenerateStatFilename(filename,ROOTFILENAME,false); - SaveStatsToFile(filename); -} - -void OnLevelEndSaveStatsToFile(void) -{ - char filename[256]; - DMFCBase->GenerateStatFilename(filename,ROOTFILENAME,true); - SaveStatsToFile(filename); -} - -void OnDisconnectSaveStatsToFile(void) -{ - char filename[256]; - DMFCBase->GenerateStatFilename(filename,ROOTFILENAME,false); - SaveStatsToFile(filename); -} - - -////////////////////////////////////////////// -// NON-DMFC Functions -////////////////////////////////////////////// -void DisplayHUDScores(struct tHUDItem *hitem) -{ - if(display_my_welcome) - { - DisplayWelcomeMessage(DMFCBase->GetPlayerNum()); - display_my_welcome = false; - } - - if(!monsterball_info_set || !players_sorted || DisplayScoreScreen) //interval hasn't been called yet or we are display the stats - return; - - int height = DLLgrfont_GetHeight((DMFCBase->GetGameFontTranslateArray())[HUD_FONT_INDEX]) + 3; - int y,x,team,p; - - ubyte alpha = DMFCBase->ConvertHUDAlpha((ubyte)255); - - if(!ValidateOwner(&p,NULL)){ - p = -1; - } - - y = (DMFCBase->GetGameWindowH()/2) - ((height*2)/2); - x = 510; - - team = DMFCBase->GetMyTeam(); - DLLRenderHUDText(DMFCBase->GetTeamColor(team),255,0,x,0,TXT_SAVESTATSTEAM,DMFCBase->GetTeamString(team)); - - int powerteam = -1; - if(p!=-1) - powerteam = DMFCBase->GetPlayerTeam(p); - - - int myteam = DMFCBase->GetMyTeam(); - int team_count; - - //determine coordinates to use here - //we'll use a virtual width of 85 pixels on a 640x480 screen - //so first determine the new width - int name_width = 100.0f * DMFCBase->GetHudAspectX(); - int score_width = DLLgrtext_GetTextLineWidth("888"); - int name_x = DMFCBase->GetGameWindowW() - name_width - score_width - 10; - int score_x = DMFCBase->GetGameWindowW() - score_width - 5; - int icon_size = height-3; - int icon_x = name_x - icon_size - 3; - DLLgrtext_SetAlpha(alpha); - char name[256]; - - for(int i=0;iBAD_BITMAP_HANDLE){ - //draw the highlite bar in the background - DLLrend_SetAlphaValue(alpha*0.50f); - DLLrend_SetZBufferState (0); - DLLrend_SetTextureType (TT_LINEAR); - DLLrend_SetLighting (LS_NONE); - DLLrend_SetAlphaType (AT_CONSTANT_TEXTURE); - DLLrend_DrawScaledBitmap(name_x-2,y-2,score_x+score_width+2,y+height-1,Highlight_bmp,0,0,1,1,1.0); - DLLrend_SetZBufferState (1); - } - - team_count = 0; - for(int q=0;qCheckPlayerNum(q) && dPlayers[q].team==team && !DMFCBase->IsPlayerDedicatedServer(q)) - team_count++; - } - - DLLgrtext_SetColor(DMFCBase->GetTeamColor(team)); - - sprintf(name,TXT_HUDSCORE,team_count,DMFCBase->GetTeamString(team)); - DMFCBase->ClipString(name_width,name,true); - - DLLgrtext_Printf(name_x,y,name); - DLLgrtext_Printf(score_x,y,"[%d]",TeamScores[team]); - } - y+=height; - } -} - -void GetLastHitInfo(ubyte *data) -{ - int size = 0; - - LastHitPnum = (sbyte)MultiGetByte(data,&size); -} -void SendLastHitInfo(void) -{ - int size = 0; - ubyte data[MAX_GAME_DATA_SIZE]; - - DMFCBase->StartPacket(data,SPID_HITINFO,&size); - - MultiAddByte(LastHitPnum,data,&size); - - DMFCBase->SendPacket(data,size,SP_ALL); -} - -void GetGameStartPacket(ubyte *data) -{ - int i,count = 0; - - //team scores - for(i=0;iCheckPlayerNum(temp)) - Monsterball_info.owner_handle = dObjects[dPlayers[temp].objnum].handle; - else - Monsterball_info.owner_handle = OBJECT_HANDLE_NONE; - } - - monsterball_info_set = true; - - temp = (sbyte)MultiGetByte(data,&count); - NumOfTeams = temp; - - //we need to find the objnum of the Monsterball...its there somewhere - DLLmprintf((0,"Looking for Monsterball in level\n")); - int objnum = -1; - - for(i=0;iStartPacket(data,SPID_NEWPLAYER,&count); - - //add the team scores - for(i=0;iSendPacket(data,count,pnum); -} - -bool GetMonsterballInfo(int id) -{ - if(id==-1) - return false; - - Monsterball_info.id = id; - - //find the room with the RF_SPECIAL1 - for(int i=0;i<=DMFCBase->GetHighestRoomIndex();i++){ - if(dRooms[i].flags&RF_SPECIAL1){ - //here's the Monsterball! - Monsterball_info.room = i; - DLLComputeRoomCenter(&Monsterball_info.pos,&dRooms[i]); - return true; - } - } - return false; -} - -#define compGT(a,b) (a < b) -// insert sort -void SortTeams(void) -{ - int t; - int i, j; - - //copy scores into scoreinfo array - for(i=0;i=0 && compGT(TeamScores[SortedTeams[j]],TeamScores[t]); j--) - { - SortedTeams[j+1] = SortedTeams[j]; - } - - // insert - SortedTeams[j+1] = t; - } -} - -void DisplayWelcomeMessage(int player_num) -{ - char name_buffer[64]; - strcpy(name_buffer,(DMFCBase->GetPlayers())[player_num].callsign); - - if(player_num==DMFCBase->GetPlayerNum()) - { - int team = DMFCBase->GetMyTeam(); - if(team==-1) - return; - - DLLAddHUDMessage(TXT_WELCOME,name_buffer); - DLLAddColoredHUDMessage(DMFCBase->GetTeamColor(team),TXT_ONTEAM,DMFCBase->GetTeamString(team)); - } - else - { - int team = dPlayers[player_num].team; - if(team==-1) - return; - - DLLAddColoredHUDMessage(DMFCBase->GetTeamColor(team),TXT_JOINED,name_buffer,DMFCBase->GetTeamString(team)); - } -} - -void OnTimerScore(void) -{ - DisplayScoreBlink = !DisplayScoreBlink; -} -void OnTimerScoreKill(void) -{ - DisplayScoreBlink = true; - WhoJustScored = WhoJustScoredTimer = -1; -} - -// ------------------------------------------------------------------------- - -void HandleMonsterballCollideWithObject(object *ball,object *player,vector *point,vector *normal) -{ - static int sound = -1; - if(sound==-1) - sound = DLLFindSoundName(IGNORE_TABLE(MONSTERBALL_SND_HIT)); - if(sound!=-1) - DLLPlay3dSound(sound,ball,MAX_GAME_VOLUME/3); - - //bump_object(ball,&player->mtype.phys_info.rotvel,&player->mtype.phys_info.velocity, - // &player->pos, &player->orient, player->mtype.phys_info.mass, player->size,point,normal,1.0f,1.0f); -} - -void HandleMonsterballCollideWithWeapon(object *ball,weapon_collide_info *winfo,vector *point,vector *normal) -{ - static int sound = -1; - if(sound==-1) - sound = DLLFindSoundName(IGNORE_TABLE(MONSTERBALL_SND_HIT)); - if(sound!=-1) - DLLPlay3dSound(sound,ball); - - bump_object(ball,&winfo->rotvel,&winfo->velocity,&winfo->pos,&winfo->orient,winfo->mass, - winfo->size,point,normal,-0.3f,5.0f); -} - -void bump_object(object *object0, vector *rotvel, vector *velocity, vector *pos, matrix *orient, float mass, float size,vector *collision_point,vector *collision_normal,float rot_scalar,float vel_scalar) -{ - object *t = NULL; - object *other = NULL; - - ASSERT(_finite(rotvel->x) != 0); - ASSERT(_finite(rotvel->y) != 0); - ASSERT(_finite(rotvel->z) != 0); - ASSERT(_finite(object0->mtype.phys_info.rotvel.x) != 0); - ASSERT(_finite(object0->mtype.phys_info.rotvel.y) != 0); - ASSERT(_finite(object0->mtype.phys_info.rotvel.z) != 0); - ASSERT(_finite(velocity->x) != 0); - ASSERT(_finite(velocity->y) != 0); - ASSERT(_finite(velocity->z) != 0); - ASSERT(_finite(object0->mtype.phys_info.velocity.x) != 0); - ASSERT(_finite(object0->mtype.phys_info.velocity.y) != 0); - ASSERT(_finite(object0->mtype.phys_info.velocity.z) != 0); - - vector r1 = *collision_point - object0->pos; - vector r2 = *collision_point - (*pos); - vector w1; - vector w2; - vector n1; - vector n2; - float temp1; - float temp2; - - float j; - - matrix o_t1 = object0->orient; - matrix o_t2 = *orient; - - DLLvm_TransposeMatrix(&o_t1); - DLLvm_TransposeMatrix(&o_t2); - - vector cmp1 = object0->mtype.phys_info.rotvel * o_t1; - vector cmp2 = (*rotvel) * o_t2; - - DLLConvertEulerToAxisAmount(&cmp1, &n1, &temp1); - DLLConvertEulerToAxisAmount(&cmp2, &n2, &temp2); - - n1 *= temp1; - n2 *= temp2; - - if(temp1 != 0.0f){ - DLLvm_CrossProduct(&w1, &n1, &r1); - }else{ - w1.x = 0; - w1.y = 0; - w1.z = 0; - } - - if(temp2 != 0.0f){ - DLLvm_CrossProduct(&w2, &n2, &r2); - }else{ - w2.x = 0; - w2.y = 0; - w2.z = 0; - } - - vector p1 = object0->mtype.phys_info.velocity + w1; - vector p2 = (*velocity) + w2; - float v_rel; - - float m1 = object0->mtype.phys_info.mass; - float m2 = mass; - - ASSERT(m1 != 0.0f && m2 != 0.0f); - - v_rel = *collision_normal * (p1 - p2); - - float e; - e = vel_scalar; - - vector c1; - vector c2; - vector cc1; - vector cc2; - float cv1; - float cv2; - - float i1 = (2.0f/5.0f)*m1*object0->size*object0->size; - float i2 = (2.0f/5.0f)*m2*size; - - if(i1 < .0000001) - i1 = .0000001f; - if(i2 < .0000001) - i2 = .0000001f; - - DLLvm_CrossProduct(&c1, &r1, collision_normal); - DLLvm_CrossProduct(&c2, &r2, collision_normal); - - c1 = c1/i1; - c2 = c2/i2; - - DLLvm_CrossProduct(&cc1, &c1, &r1); - DLLvm_CrossProduct(&cc2, &c2, &r2); - - cv1 = (*collision_normal)*c1; - cv2 = (*collision_normal)*c2; - - j = (-(1.0f + e))*v_rel; - j /= (1/m1 + 1/m2 + cv1 + cv2); - - //apply the force to the player - vector new_vel; - new_vel = ((j*(*collision_normal))/m1); - - //make sure the velocity falls within a valid range - float mag = DLLvm_GetMagnitudeFast(&new_vel); - - new_vel/=mag; - - mag=min(mag,20); - mag=max(mag,10); - - new_vel*=mag; - - object0->mtype.phys_info.velocity += new_vel; - - vector jcn = j * (*collision_normal); - - DLLvm_CrossProduct(&c1, &r1, &jcn); - - n1 = (c1)/i1; - - temp1 = DLLvm_NormalizeVector(&n1); - - vector txx1; - DLLConvertAxisAmountToEuler(&n1, &temp1, &txx1); - - float rotscale1; - rotscale1 = rot_scalar; - - //change the player's rotational velocity - object0->mtype.phys_info.rotvel += (txx1*object0->orient) * rotscale1; - - ASSERT(_finite(object0->mtype.phys_info.rotvel.x) != 0); - ASSERT(_finite(object0->mtype.phys_info.rotvel.y) != 0); - ASSERT(_finite(object0->mtype.phys_info.rotvel.z) != 0); - ASSERT(_finite(object0->mtype.phys_info.velocity.x) != 0); - ASSERT(_finite(object0->mtype.phys_info.velocity.y) != 0); - ASSERT(_finite(object0->mtype.phys_info.velocity.z) != 0); -} - -bool ValidateOwner(int *pnum,object **obj) -{ - if(Monsterball_info.owner_handle==OBJECT_HANDLE_NONE) - return false; - - object *owner; - if(!DLLObjGet(Monsterball_info.owner_handle,&owner)){ - //the object no longer exists - Monsterball_info.owner_handle = OBJECT_HANDLE_NONE; - return false; - } - - if(owner->type!=OBJ_PLAYER || (dPlayers[owner->id].flags&(PLAYER_FLAGS_DYING|PLAYER_FLAGS_DEAD)) ){ - //the owner isn't a player playing - Monsterball_info.owner_handle = OBJECT_HANDLE_NONE; - return false; - } - - if(pnum) - *pnum = owner->id; - if(obj) - *obj = owner; - return true; -} - -void DoMonsterballScoreEffect(void) -{ - object *Monsterball; - if(!DLLObjGet(Monsterball_info.objhandle,&Monsterball)) - return; - - vector start_pos,end_pos; - int start_room,end_room; - bool doing_start = false; - - vector m_pos,i_pos; - int m_room,i_room; - - m_pos = Monsterball->pos; - m_room = Monsterball->roomnum; - i_pos = Monsterball_info.pos; - i_room = Monsterball_info.room; - - ////////////////////////////////////// - float lifetime = 4.0f; - float thickness = 17.5f; - float slidetime = 0.3f; - ushort color = GR_RGB16(30,255,30); - int numtiles = 1; - bool autotile = true; - int sat_count = 2; - int texture_id = DLLFindTextureName("ThickLineLightning"); - ////////////////////////////////////// - - for(int q=0;q<2;q++) - { - //////////////////////////////// - vector check_pos; - fvi_query fq; - fvi_info hit_data; - int hit_type; - - fq.p0 = (doing_start)?&m_pos:&i_pos; - fq.p1 = &check_pos; - fq.startroom = (doing_start)?m_room:i_room; - fq.rad = 3.0f; - fq.flags = FQ_CHECK_OBJS|FQ_IGNORE_NON_LIGHTMAP_OBJECTS; - fq.thisobjnum = Monsterball - dObjects; - fq.ignore_obj_list = NULL; - - //find top of room - check_pos = (doing_start)?m_pos:i_pos; - check_pos.y *= 50000; - hit_type = DLLfvi_FindIntersection(&fq,&hit_data); - - if(hit_type==HIT_NONE) - return; - - start_room = hit_data.hit_room; - start_pos = hit_data.hit_pnt; - - check_pos = (doing_start)?m_pos:i_pos; - check_pos.y *= -50000; - hit_type = DLLfvi_FindIntersection(&fq,&hit_data); - - if(hit_type==HIT_NONE) - return; - - end_room = hit_data.hit_room; - end_pos = hit_data.hit_pnt; - - int visnum=DLLVisEffectCreate (VIS_FIREBALL,THICK_LIGHTNING_INDEX,start_room,&start_pos); - if (visnum>=0) - { - vis_effect *vis=&dVisEffects[visnum]; - vis->lifeleft=lifetime; - vis->lifetime=lifetime; - vis->end_pos=end_pos; - - vis->custom_handle=texture_id; - - vis->lighting_color=color; - vis->billboard_info.width=thickness; - vis->billboard_info.texture=autotile; - vis->velocity.x=sat_count; - vis->velocity.y=slidetime; - vis->velocity.z=numtiles; - - vis->flags=VF_USES_LIFELEFT|VF_WINDSHIELD_EFFECT|VF_LINK_TO_VIEWER|VF_EXPAND; - vis->size=DLLvm_VectorDistanceQuick(&vis->pos,&vis->end_pos); - } - - color=GR_RGB16(100,255,150); - visnum=DLLVisEffectCreate (VIS_FIREBALL,SUN_CORONA_INDEX,start_room,&start_pos); - if (visnum>=0) - { - vis_effect *vis=&dVisEffects[visnum]; - vis->lifeleft=lifetime; - vis->lifetime=lifetime; - - vis->lighting_color=color; - - vis->flags=VF_USES_LIFELEFT|VF_WINDSHIELD_EFFECT|VF_LINK_TO_VIEWER; - vis->size=4; - } - visnum=DLLVisEffectCreate (VIS_FIREBALL,SUN_CORONA_INDEX,end_room,&end_pos); - if (visnum>=0) - { - vis_effect *vis=&dVisEffects[visnum]; - vis->lifeleft=lifetime; - vis->lifetime=lifetime; - - vis->lighting_color=color; - - vis->flags=VF_USES_LIFELEFT|VF_WINDSHIELD_EFFECT|VF_LINK_TO_VIEWER; - vis->size=4; - } - - - DLLCreateRandomSparks(rand()%200 + 50,(doing_start)?&m_pos:&i_pos,(doing_start)?m_room:i_room,HOT_SPARK_INDEX,(rand()%3)+2); - - doing_start = !doing_start; - } - - if(Monsterball->effect_info) - { - Monsterball->effect_info->type_flags&=~EF_CLOAKED; - Monsterball->effect_info->type_flags|=EF_FADING_IN; - Monsterball->effect_info->fade_time=4.0f; - Monsterball->effect_info->cloak_time = 0; - Monsterball->effect_info->fade_max_time = 4.0f; - } -} - -#ifdef MACINTOSH -#pragma export off -#endif diff --git a/monsterball/monsterball.h b/monsterball/monsterball.h deleted file mode 100644 index a916a6e3..00000000 --- a/monsterball/monsterball.h +++ /dev/null @@ -1,164 +0,0 @@ -/* -* $Logfile: /DescentIII/Main/monsterball/monsterball.h $ -* $Revision: 1.1.1.1 $ -* $Date: 2003-08-26 03:58:29 $ -* $Author: kevinb $ -* -* Monsterball multiplayer game -* -* $Log: not supported by cvs2svn $ - * - * 7 10/21/99 2:46p Kevin - * Macintosh merge! - * - * 6 3/22/99 5:51p Matt - * Removed some includes from one file and added some to other files, to - * reduce the amount of rebuilding when headers change. - * - * 5 3/19/99 12:54p Jeff - * base support for requesting the number of teams for a multiplayer game - * - * 4 3/17/99 12:23p Jeff - * converted DMFC to be COM interface - * - * 3 1/24/99 8:32p Jeff - * a bunch of updates to get 100% up to date, added individual scoring. -* -* $NoKeywords: $ -*/ - -#ifndef __DMFC_APP_H_ -#define __DMFC_APP_H_ - -#include "osiris_share.h" -#include "d3events.h" - - //!!!!!!!ADD YOUR EVENT HANDLER OVERRIDES HERE!!!!!!!!!!! -bool OnCanChangeTeam(int pnum,int newteam); -void OnClientPlayerDisconnect(int player_num); -void OnPlayerEntersObserver(int pnum,object *piggy); -void OnClientPlayerKilled(object *killer_obj,int victim_pnum); - -void OnServerObjectShieldsChanged(object *obj,float amount); -void OnGameStateRequest(int pnum); -void OnServerGameCreated(void); -void OnClientLevelStart(void); -void OnPlayerConnect(int player_num); -void OnInterval(void); -void OnHUDInterval(void); -void OnKeypress(int key); -void OnServerCollide(object *me_obj,object *it_obj,vector *point,vector *normal); -void OnClientCollide(object *me_obj,object *it_obj,vector *point,vector *normal); -void OnServerPlayerChangeSegment(int player_num,int newseg,int oldseg); -void OnClientPlayerChangeSegment(int player_num,int newseg,int oldseg); -void OnServerObjectChangeSegment(object *obj,int newseg,int oldseg); -void OnClientObjectChangeSegment(object *obj,int newseg,int oldseg); -void OnSaveStatsToFile(void); -void OnLevelEndSaveStatsToFile(void); -void OnDisconnectSaveStatsToFile(void); -void OnPLRInterval(void); -void OnPLRInit(void); -void OnPrintScores(int level); -extern IDMFC *DMFCBase; - - -// These next two function prototypes MUST appear in the extern "C" block if called -// from a CPP file. -extern "C" -{ - DLLEXPORT void DLLFUNCCALL DLLGameInit (int *api_func,ubyte *all_ok,int num_teams_to_use); - DLLEXPORT void DLLFUNCCALL DLLGameCall (int eventnum,dllinfo *data); - DLLEXPORT void DLLFUNCCALL DLLGameClose (); - DLLEXPORT void DLLFUNCCALL DLLGetGameInfo (tDLLOptions *options); - DLLEXPORT int DLLFUNCCALL GetGOScriptID(char *name,ubyte isdoor); - DLLEXPORT void DLLFUNCCALLPTR CreateInstance(int id); - DLLEXPORT void DLLFUNCCALL DestroyInstance(int id,void *ptr); - DLLEXPORT short DLLFUNCCALL CallInstanceEvent(int id,void *ptr,int event,tOSIRISEventInfo *data); - DLLEXPORT int DLLFUNCCALL SaveRestoreState( void *file_ptr, ubyte saving_state ); -} - -#ifdef MACINTOSH -#pragma export on -#endif -// The main entry point where the game calls the dll -void DLLFUNCCALL DLLGameCall (int eventnum,dllinfo *data) -{ - if((eventnumGetLocalRole()!=LR_SERVER)){ - return; - } - - DMFCBase->TranslateEvent(eventnum,data); -} - -// GetGOScriptID -// Purpose: -// Given the name of the object (from it's pagename), this function will search through it's -// list of General Object Scripts for a script with a matching name (to see if there is a script -// for that type/id of object within this DLL). If a matching scriptname is found, a UNIQUE ID -// is to be returned back to Descent 3. This ID will be used from here on out for all future -// interaction with the DLL. Since doors are not part of the generic object's, it's possible -// for a door to have the same name as a generic object (OBJ_POWERUP, OBJ_BUILDING, OBJ_CLUTTER -// or OBJ_ROBOT), therefore, a 1 is passed in for isdoor if the given object name refers to a -// door, else it is a 0. The return value is the unique identifier, else -1 if the script -// does not exist in the DLL. -int DLLFUNCCALL GetGOScriptID(char *name,ubyte isdoor) -{ - return -1; -} - -// CreateInstance -// Purpose: -// Given an ID from a call to GetGOScriptID(), this function will create a new instance for that -// particular script (by allocating and initializing memory, etc.). A pointer to this instance -// is to be returned back to Descent 3. This pointer will be passed around, along with the ID -// for CallInstanceEvent() and DestroyInstance(). Return NULL if there was an error. -void DLLFUNCCALLPTR CreateInstance(int id) -{ - return NULL; -} - -// DestroyInstance -// Purpose: -// Given an ID, and a pointer to a particular instance of a script, this function will delete and -// destruct all information associated with that script, so it will no longer exist. -void DLLFUNCCALL DestroyInstance(int id,void *ptr) -{ -} - -// CallInstanceEvent -// Purpose: -// Given an ID, a pointer to a script instance, an event and a pointer to the struct of -// information about the event, this function will translate who this event belongs to and -// passes the event to that instance of the script to be handled. Return a combination of -// CONTINUE_CHAIN and CONTINUE_DEFAULT, to give instructions on what to do based on the -// event. CONTINUE_CHAIN means to continue through the chain of scripts (custom script, level -// script, mission script, and finally default script). If CONTINUE_CHAIN is not specified, -// than the chain is broken and those scripts of lower priority will never get the event. Return -// CONTINUE_DEFAULT in order to tell D3 if you want process the normal action that is built into -// the game for that event. This only pertains to certain events. If the chain continues -// after this script, than the CONTINUE_DEFAULT setting will be overridden by lower priority -// scripts return value. -short DLLFUNCCALL CallInstanceEvent(int id,void *ptr,int event,tOSIRISEventInfo *data) -{ - return CONTINUE_CHAIN|CONTINUE_DEFAULT; -} - -// SaveRestoreState -// Purpose: -// This function is called when Descent 3 is saving or restoring the game state. In this function -// you should save/restore any global data that you want preserved through load/save (which includes -// demos). You must be very careful with this function, corrupting the file (reading or writing too -// much or too little) may be hazardous to the game (possibly making it impossible to restore the -// state). It would be best to use version information to keep older versions of saved states still -// able to be used. IT IS VERY IMPORTANT WHEN SAVING THE STATE TO RETURN THE NUMBER OF _BYTES_ WROTE -// TO THE FILE. When restoring the data, the return value is ignored. saving_state is 1 when you should -// write data to the file_ptr, 0 when you should read in the data. -int DLLFUNCCALL SaveRestoreState( void *file_ptr, ubyte saving_state ) -{ - return 0; -} -#ifdef MACINTOSH -#pragma export off -#endif - -#endif diff --git a/monsterball/monsterstr.h b/monsterball/monsterstr.h deleted file mode 100644 index 4cc3ee0e..00000000 --- a/monsterball/monsterstr.h +++ /dev/null @@ -1,46 +0,0 @@ -//Defines for indexes into the string table for in-code strings - -#ifndef __STRING_TABLE____ -#define __STRING_TABLE____ - -#define TXT(index) GetStringFromTable(index) - -//Returns a pointer to the string at the index location from the string table -//if it is a bad index given, then the pointer to the error string "ERROR MISSING STRING" is given - -char *GetStringFromTable(int index); - -#define TXT_GAMENAME TXT(0) //"Monsterball" -#define TXT_KILLEDA TXT(1) //"%s was killed by %s" -#define TXT_SUICIDEA TXT(2) //"%s lost control" -#define TXT_PILOT TXT(3) //"Pilot" -#define TXT_POINTS TXT(4) //"Points" -#define TXT_BLUNDERS TXT(5) //"Blunders" -#define TXT_KILLSSHORT TXT(6) //"K" -#define TXT_DEATHSSHORT TXT(7) //"D" -#define TXT_SUICIDESSHORT TXT(8) //"S" -#define TXT_PING TXT(9) //"Ping" -#define TXT_SCOREONE TXT(10) //"%s Team Scores 1 point!" -#define TXT_SCOREMULTI TXT(11) //"%s Team Scores %d points!!" -#define TXT_BLUNDERSCORE TXT(12) //"%s accidently scores a point for the %s team!" -#define TXT_BLUNDERMULTISCORE TXT(13) //"%s accidently scores %d points for the %s team!" -#define TXT_PLAYERSCORE TXT(14) //"%s (%s) knocks the ball in for a point!" -#define TXT_PLAYERMULTISCORE TXT(15) //"%s (%s) knocks the ball in for %d points!" -#define TXT_HUDDISPLAY TXT(16) //"%s Team: %d" -#define TXT_KILLS TXT(17) //"Kills" -#define TXT_DEATHS TXT(18) //"Deaths" -#define TXT_SUICIDES TXT(19) //"Suicides" -#define TXT_SAVESTATSA TXT(20) //"Monsterball\r\nGame: %s\nLevel: %d" -#define TXT_SAVESTATSTEAM TXT(21) //"%s Team" -#define TXT_SAVESTATSB TXT(22) //"Current Level Rankings\r\n" -#define TXT_SAVESTATSC TXT(23) //"Rank Name Points Blunders Kills Deaths Suicides" -#define TXT_SAVESTATSD TXT(24) //"\r\nIndividual Stats\r\n" -#define TXT_TIMEINGAME TXT(25) //"Total Time In Game: %s" -#define TXT_SAVESTATSE TXT(26) //"Team: Callsign: Kills: Deaths:" -#define TXT_STATSSAVED TXT(27) //"Stats saved to file" -#define TXT_HUDSCORE TXT(28) //"[%d]%s Team" -#define TXT_WELCOME TXT(29) //"Welcome To Monsterball %s" -#define TXT_ONTEAM TXT(30) //"You're On The %s Team" -#define TXT_JOINED TXT(31) //"%s Has Joined The %s Team" -#define TXT_STATGAMENAME TXT(32) //"Monsterball" -#endif diff --git a/roboanarchy/Makefile b/roboanarchy/Makefile deleted file mode 100644 index cd6d782b..00000000 --- a/roboanarchy/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -include ../../default.mak - -OBJS = roboanarchy.o -REFS = roboanarchy.cpp -LIBNAME = ../../netgames/robo-anarchy.d3m - -CDLFLAGS = $(CFLAGS) -fPIC -LDLFLAGS = -shared -ldl -lm - -all: depall $(OBJS) - gcc $(LDLFLAGS) -o $(LIBNAME) $(OBJS) /usr/lib/dmfc.so - -depall: - $(CC) -E -M $(CFLAGS) $(DEFINES) $(REFS) > .depend - -clean: - rm -f $(OBJS) *~ $(LIBNAME) core - -%.o: %.cpp - $(CC) $(CDLFLAGS) $(DEFINES) -c $< -o $@ - -ifeq (.depend,$(wildcard .depend)) -include .depend -endif diff --git a/roboanarchy/roboAnarchy.h b/roboanarchy/roboAnarchy.h deleted file mode 100644 index fdea54df..00000000 --- a/roboanarchy/roboAnarchy.h +++ /dev/null @@ -1,161 +0,0 @@ -/* -* $Logfile: /DescentIII/Main/roboanarchy/roboAnarchy.h $ -* $Revision: 1.1.1.1 $ -* $Date: 2003-08-26 03:59:03 $ -* $Author: kevinb $ -* -* -* -* $Log: not supported by cvs2svn $ - * - * 28 10/21/99 3:20p Kevin - * Macintosh merge - * - * 27 5/12/99 11:28a Jeff - * added sourcesafe comment block -* -* $NoKeywords: $ -*/ - - - -#ifndef __DMFC_APP_H_ -#define __DMFC_APP_H_ - -#include "osiris_share.h" -#include "d3events.h" - -//Setup and processing functions -void AnarchyGameInit(int teams); -void AnarchyGameClose(void); - -void OnKeypress(int key); -void OnHUDInterval(void); -void OnInterval(void); -void OnClientPlayerKilled(object *killer_obj,int victim_pnum); -void OnClientPlayerEntersGame(int player_num); -void OnClientLevelStart(void); -void OnClientLevelEnd(void); -void OnServerGameCreated(void); -void OnPLRInterval(void); -void OnPLRInit(void); -void OnSaveStatsToFile(void); -void OnLevelEndSaveStatsToFile(void); -void OnDisconnectSaveStatsToFile(void); -void OnPrintScores(int level); -extern IDMFC *DMFCBase; - - - -/************************************************************************************************* - *The following functions and declaration are needed to connect the DLL to the game. These must * - *stay here and must call the functions that are in them. You can not delete from here, but you * - *can add to it no problem * - ************************************************************************************************* -*/ -// These next two function prototypes MUST appear in the extern "C" block if called -// from a CPP file. -#ifdef __cplusplus -extern "C" -{ -#endif - DLLEXPORT void DLLFUNCCALL DLLGameInit (int *api_func,ubyte *all_ok,int num_teams_to_use); - DLLEXPORT void DLLFUNCCALL DLLGameCall (int eventnum,dllinfo *data); - DLLEXPORT void DLLFUNCCALL DLLGameClose (); - DLLEXPORT void DLLFUNCCALL DLLGetGameInfo (tDLLOptions *options); - DLLEXPORT int DLLFUNCCALL GetGOScriptID(char *name,ubyte isdoor); - DLLEXPORT void DLLFUNCCALLPTR CreateInstance(int id); - DLLEXPORT void DLLFUNCCALL DestroyInstance(int id,void *ptr); - DLLEXPORT short DLLFUNCCALL CallInstanceEvent(int id,void *ptr,int event,tOSIRISEventInfo *data); - DLLEXPORT int DLLFUNCCALL SaveRestoreState( void *file_ptr, ubyte saving_state ); -#ifdef __cplusplus -} -#endif - -#ifdef MACINTOSH -#pragma export on -#endif - -// The main entry point where the game calls the dll -void DLLFUNCCALL DLLGameCall (int eventnum,dllinfo *data) -{ - if((eventnumGetLocalRole()!=LR_SERVER)){ - return; - } - - DMFCBase->TranslateEvent(eventnum,data); -} - -// GetGOScriptID -// Purpose: -// Given the name of the object (from it's pagename), this function will search through it's -// list of General Object Scripts for a script with a matching name (to see if there is a script -// for that type/id of object within this DLL). If a matching scriptname is found, a UNIQUE ID -// is to be returned back to Descent 3. This ID will be used from here on out for all future -// interaction with the DLL. Since doors are not part of the generic object's, it's possible -// for a door to have the same name as a generic object (OBJ_POWERUP, OBJ_BUILDING, OBJ_CLUTTER -// or OBJ_ROBOT), therefore, a 1 is passed in for isdoor if the given object name refers to a -// door, else it is a 0. The return value is the unique identifier, else -1 if the script -// does not exist in the DLL. -int DLLFUNCCALL GetGOScriptID(char *name,ubyte isdoor) -{ - return -1; -} - -// CreateInstance -// Purpose: -// Given an ID from a call to GetGOScriptID(), this function will create a new instance for that -// particular script (by allocating and initializing memory, etc.). A pointer to this instance -// is to be returned back to Descent 3. This pointer will be passed around, along with the ID -// for CallInstanceEvent() and DestroyInstance(). Return NULL if there was an error. -void DLLFUNCCALLPTR CreateInstance(int id) -{ - return NULL; -} - -// DestroyInstance -// Purpose: -// Given an ID, and a pointer to a particular instance of a script, this function will delete and -// destruct all information associated with that script, so it will no longer exist. -void DLLFUNCCALL DestroyInstance(int id,void *ptr) -{ -} - -// CallInstanceEvent -// Purpose: -// Given an ID, a pointer to a script instance, an event and a pointer to the struct of -// information about the event, this function will translate who this event belongs to and -// passes the event to that instance of the script to be handled. Return a combination of -// CONTINUE_CHAIN and CONTINUE_DEFAULT, to give instructions on what to do based on the -// event. CONTINUE_CHAIN means to continue through the chain of scripts (custom script, level -// script, mission script, and finally default script). If CONTINUE_CHAIN is not specified, -// than the chain is broken and those scripts of lower priority will never get the event. Return -// CONTINUE_DEFAULT in order to tell D3 if you want process the normal action that is built into -// the game for that event. This only pertains to certain events. If the chain continues -// after this script, than the CONTINUE_DEFAULT setting will be overridden by lower priority -// scripts return value. -short DLLFUNCCALL CallInstanceEvent(int id,void *ptr,int event,tOSIRISEventInfo *data) -{ - return CONTINUE_CHAIN|CONTINUE_DEFAULT; -} - -// SaveRestoreState -// Purpose: -// This function is called when Descent 3 is saving or restoring the game state. In this function -// you should save/restore any global data that you want preserved through load/save (which includes -// demos). You must be very careful with this function, corrupting the file (reading or writing too -// much or too little) may be hazardous to the game (possibly making it impossible to restore the -// state). It would be best to use version information to keep older versions of saved states still -// able to be used. IT IS VERY IMPORTANT WHEN SAVING THE STATE TO RETURN THE NUMBER OF _BYTES_ WROTE -// TO THE FILE. When restoring the data, the return value is ignored. saving_state is 1 when you should -// write data to the file_ptr, 0 when you should read in the data. -int DLLFUNCCALL SaveRestoreState( void *file_ptr, ubyte saving_state ) -{ - return 0; -} -#ifdef MACINTOSH -#pragma export off -#endif - - -#endif diff --git a/roboanarchy/roboanarchy.cpp b/roboanarchy/roboanarchy.cpp deleted file mode 100644 index 0f7cf884..00000000 --- a/roboanarchy/roboanarchy.cpp +++ /dev/null @@ -1,1014 +0,0 @@ -/* -* $Logfile: /DescentIII/Main/roboanarchy/roboanarchy.cpp $ -* $Revision: 1.1.1.1 $ -* $Date: 2003-08-26 03:59:03 $ -* $Author: kevinb $ -* -* -* -* $Log: not supported by cvs2svn $ - * - * 43 10/21/99 3:20p Kevin - * Macintosh merge - * - * 42 7/12/99 1:22p Jeff - * updated for new netflags - * - * 41 7/11/99 6:45p Jeff - * cleaner plr if the list is too long - * - * 40 5/23/99 3:04a Jason - * fixed bug with player rankings not being updated correctly - * - * 39 5/12/99 11:28a Jeff - * added sourcesafe comment block -* -* $NoKeywords: $ -*/ - - -#include -#include -#include -#include "idmfc.h" -#include "roboAnarchy.h" -#include "roboanarchystr.h" -IDMFC *DMFCBase = NULL; -IDmfcStats *dstat = NULL; - -int SortedPlayers[MAX_PLAYER_RECORDS]; //sorted player nums -bool DisplayScoreScreen; -int Highlight_bmp = -1; - -#define AHD_NONE 0 -#define AHD_SCORE 1 -#define AHD_EFFICIENCY 2 -#define ACM_PLAYERCOLOR 0 -#define ACM_NORMAL 1 -ubyte Anarchy_hud_display = AHD_SCORE; -ubyte HUD_color_model = ACM_PLAYERCOLOR; -bool display_my_welcome = false; - -void DisplayHUDScores(struct tHUDItem *hitem); -void DisplayScores(void); -void DisplayWelcomeMessage(int player_num); -void SaveStatsToFile(char *filename); -void SwitchHUDColor(int i); - -/////////////////////////////////////////////// -//localization info -char **StringTable; -int StringTableSize = 0; -char *_ErrorString = "Missing String"; -char *GetString(int d){if( (d<0) || (d>=StringTableSize) ) return _ErrorString; else return StringTable[d];} -/////////////////////////////////////////////// - -void SwitchAnarchyScores(int i) -{ - if(i<0) - i = 0; - if(i>2) - i = 2; - - Anarchy_hud_display = i; - - switch(i){ - case AHD_NONE: - DLLAddHUDMessage(TXT_HUDD_NONE); - break; - case AHD_SCORE: - DLLAddHUDMessage(TXT_HUDD_SCORES); - break; - case AHD_EFFICIENCY: - DLLAddHUDMessage(TXT_HUDD_EFFIC); - break; - }; -} - -#ifdef MACINTOSH -#pragma export on -#endif - -// This function gets called by the game when it wants to learn some info about the game -void DLLFUNCCALL DLLGetGameInfo (tDLLOptions *options) -{ - options->flags = DOF_MAXTEAMS; - options->max_teams = 1; - strcpy(options->game_name,"Anarchy"); - strcpy(options->requirements,"COOP"); -} - -// Initializes the game function pointers -void DLLFUNCCALL DLLGameInit (int *api_func,ubyte *all_ok,int num_teams_to_use) -{ - *all_ok = 1; - DMFCBase = CreateDMFC(); - if(!DMFCBase) - { - *all_ok = 0; - return; - } - - dstat = CreateDmfcStats(); - if(!dstat) - { - *all_ok = 0; - return; - } - - DMFCBase->LoadFunctions(api_func); - - // Setup the event handlers that we handle - DMFCBase->Set_OnKeypress(OnKeypress); - DMFCBase->Set_OnHUDInterval(OnHUDInterval); - DMFCBase->Set_OnInterval(OnInterval); - DMFCBase->Set_OnClientPlayerKilled(OnClientPlayerKilled); - DMFCBase->Set_OnClientPlayerEntersGame(OnClientPlayerEntersGame); - DMFCBase->Set_OnClientLevelStart(OnClientLevelStart); - DMFCBase->Set_OnClientLevelEnd(OnClientLevelEnd); - DMFCBase->Set_OnServerGameCreated(OnServerGameCreated); - DMFCBase->Set_OnPLRInterval(OnPLRInterval); - DMFCBase->Set_OnPLRInit(OnPLRInit); - DMFCBase->Set_OnSaveStatsToFile(OnSaveStatsToFile); - DMFCBase->Set_OnLevelEndSaveStatsToFile(OnLevelEndSaveStatsToFile); - DMFCBase->Set_OnDisconnectSaveStatsToFile(OnDisconnectSaveStatsToFile); - DMFCBase->Set_OnPrintScores(OnPrintScores); - - - DLLCreateStringTable("Anarchy.str",&StringTable,&StringTableSize); - mprintf((0,"%d strings loaded from string table\n",StringTableSize)); - if(!StringTableSize){ - *all_ok = 0; - return; - } - - AnarchyGameInit(1); - - //add the death and suicide messages - DMFCBase->AddDeathMessage(TXT_DEATH1,true); - DMFCBase->AddDeathMessage(TXT_DEATH2,true); - DMFCBase->AddDeathMessage(TXT_DEATH3,false); - DMFCBase->AddDeathMessage(TXT_DEATH4,false); - DMFCBase->AddDeathMessage(TXT_DEATH5,true); - DMFCBase->AddDeathMessage(TXT_DEATH6,true); - DMFCBase->AddDeathMessage(TXT_DEATH7,false); - DMFCBase->AddDeathMessage(TXT_DEATH8,true); - DMFCBase->AddDeathMessage(TXT_DEATH9,true); - DMFCBase->AddDeathMessage(TXT_DEATH10,true); - - DMFCBase->AddSuicideMessage(TXT_SUICIDE1); - DMFCBase->AddSuicideMessage(TXT_SUICIDE2); - DMFCBase->AddSuicideMessage(TXT_SUICIDE3); - DMFCBase->AddSuicideMessage(TXT_SUICIDE4); - DMFCBase->AddSuicideMessage(TXT_SUICIDE5); - DMFCBase->AddSuicideMessage(TXT_SUICIDE6); - - DMFCBase->SetNumberOfTeams(1); - - netgame_info *Netgame = DMFCBase->GetNetgameInfo(); - Netgame->flags |= (NF_DAMAGE_FRIENDLY|NF_USE_ROBOTS|NF_TRACK_RANK); - - Highlight_bmp = DLLbm_AllocBitmap(32,32,0); - if(Highlight_bmp>BAD_BITMAP_HANDLE){ - ushort *data = DLLbm_data(Highlight_bmp,0); - if(!data){ - //bail on out of here - *all_ok = 0; - return; - } - for(int x=0;x<32*32;x++){ - data[x] = GR_RGB16(50,50,50)|OPAQUE_FLAG; - } - } - - DMFCBase->AddHUDItemCallback(HI_TEXT,DisplayHUDScores); - - DisplayScoreScreen = false; - -} -// Called when the DLL is shutdown -void DLLFUNCCALL DLLGameClose () -{ - if(Highlight_bmp>BAD_BITMAP_HANDLE) - DLLbm_FreeBitmap(Highlight_bmp); - - DLLDestroyStringTable(StringTable,StringTableSize); - - if(dstat) - { - dstat->DestroyPointer(); - dstat = NULL; - } - - if(DMFCBase) - { - AnarchyGameClose(); - DMFCBase->GameClose(); - DMFCBase->DestroyPointer(); - DMFCBase = NULL; - } -} - -void DetermineScore(int precord_num,int column_num,char *buffer,int buffer_size) -{ - player_record *pr = DMFCBase->GetPlayerRecord(precord_num); - if(!pr || pr->state==STATE_EMPTY){ - buffer[0] = '\0'; - return; - } - - sprintf(buffer,"%d", pr->dstats.kills[DSTAT_LEVEL]-pr->dstats.suicides[DSTAT_LEVEL]); -} - -void AnarchyGameClose(void) -{ -} - -// DMFCApp::GameInit -// -// Sets up all the DLL functions and pointers and preps the class for use. This ABSOLUTLY must be -// called, so if you override DMFCApp::GameInit, make sure that you put a call to this somewhere in -// the override. -void AnarchyGameInit(int teams) -{ - //add the anarchy menu/submenus - IMenuItem *lev1,*lev2; - - lev1 = CreateMenuItemWArgs("Anarchy",MIT_NORMAL,0,NULL); - - lev2 = CreateMenuItemWArgs(TXT_MNU_HUDSTYLE,MIT_STATE,0,SwitchAnarchyScores); - lev2->SetStateItemList(3,TXT_NONE,TXT_SCOREHD,TXT_EFFICIENCY); - lev2->SetState(1); - lev1->AddSubMenu(lev2); - - lev2 = CreateMenuItemWArgs(TXT_MNU_HUDCOLOR,MIT_STATE,0,SwitchHUDColor); - lev2->SetStateItemList(2,TXT_PLAYERCOLORS,TXT_NORMAL); - lev2->SetState(HUD_color_model); - lev1->AddSubMenu(lev2); - - lev2 = DMFCBase->GetOnScreenMenu(); - lev2->AddSubMenu(lev1); - - DMFCBase->GameInit(teams); - - // Initialize the Stats Manager - // ---------------------------- - - tDmfcStatsInit tsi; - tDmfcStatsColumnInfo pl_col[6]; - char gname[20]; - strcpy(gname,"Anarchy"); - - tsi.flags = DSIF_SHOW_PIC|DSIF_SHOW_OBSERVERICON; - tsi.cColumnCountDetailed = 0; - tsi.cColumnCountPlayerList = 6; - tsi.clbDetailedColumn = NULL; - tsi.clbDetailedColumnBMP = NULL; - tsi.clbPlayerColumn = DetermineScore; - tsi.clbPlayerColumnBMP = NULL; - tsi.DetailedColumns = NULL; - tsi.GameName = gname; - tsi.MaxNumberDisplayed = NULL; - tsi.PlayerListColumns = pl_col; - tsi.SortedPlayerRecords = SortedPlayers; - - pl_col[0].color_type = DSCOLOR_SHIPCOLOR; - strcpy(pl_col[0].title,TXT_PILOT); - pl_col[0].type = DSCOL_PILOT_NAME; - pl_col[0].width = 120; - - pl_col[1].color_type = DSCOLOR_SHIPCOLOR; - strcpy(pl_col[1].title,TXT_SCORE); - pl_col[1].type = DSCOL_CUSTOM; - pl_col[1].width = 50; - - pl_col[2].color_type = DSCOLOR_SHIPCOLOR; - strcpy(pl_col[2].title,TXT_KILLS_SHORT); - pl_col[2].type = DSCOL_KILLS_LEVEL; - pl_col[2].width = 50; - - pl_col[3].color_type = DSCOLOR_SHIPCOLOR; - strcpy(pl_col[3].title,TXT_DEATHS_SHORT); - pl_col[3].type = DSCOL_DEATHS_LEVEL; - pl_col[3].width = 60; - - pl_col[4].color_type = DSCOLOR_SHIPCOLOR; - strcpy(pl_col[4].title,TXT_SUICIDES_SHORT); - pl_col[4].type = DSCOL_SUICIDES_LEVEL; - pl_col[4].width = 65; - - pl_col[5].color_type = DSCOLOR_SHIPCOLOR; - strcpy(pl_col[5].title,TXT_PING); - pl_col[5].type = DSCOL_PING; - pl_col[5].width = 40; - - dstat->Initialize(&tsi); -} - -void OnHUDInterval(void) -{ - dstat->DoFrame(); - DMFCBase->DisplayOutrageLogo(); - DMFCBase->OnHUDInterval(); -} - -void OnInterval(void) -{ - DMFCBase->GetSortedPlayerSlots(SortedPlayers,MAX_PLAYER_RECORDS); - DMFCBase->OnInterval(); -} - -void OnKeypress(int key) -{ - dllinfo *Data = DMFCBase->GetDLLInfoCallData(); - - switch(key){ - case K_F7: - DisplayScoreScreen = !DisplayScoreScreen; - DMFCBase->EnableOnScreenMenu(false); - dstat->Enable(DisplayScoreScreen); - break; - case K_PAGEDOWN: - if(DisplayScoreScreen){ - dstat->ScrollDown(); - Data->iRet = 1; - } - break; - case K_PAGEUP: - if(DisplayScoreScreen){ - dstat->ScrollUp(); - Data->iRet = 1; - } - break; - case K_F6: - DisplayScoreScreen = false; - dstat->Enable(false); - break; - case K_ESC: - if(DisplayScoreScreen){ - dstat->Enable(false); - DisplayScoreScreen = false; - Data->iRet = 1; - } - break; - } - - DMFCBase->OnKeypress(key); -} - -// The server has just started, so clear out all the stats and game info -void OnServerGameCreated(void) -{ - DMFCBase->OnServerGameCreated(); -} - -// The server has started a new level, so clear out any scores needed to be reset -void OnClientLevelStart(void) -{ - for(int i=0;iOnClientLevelStart(); -} - -void OnClientLevelEnd(void) -{ - DMFCBase->OnClientLevelEnd(); -} - -// A new player has entered the game, zero their stats out -void OnClientPlayerEntersGame(int player_num) -{ - DMFCBase->OnClientPlayerEntersGame(player_num); - - if(player_num!=DMFCBase->GetPlayerNum()) - DisplayWelcomeMessage(player_num); - else - display_my_welcome = true; -} - -// We need to adjust the scores -void OnClientPlayerKilled(object *killer_obj,int victim_pnum) -{ - DMFCBase->OnClientPlayerKilled(killer_obj,victim_pnum); - player_record *kpr; - - int kpnum; - - if(killer_obj){ - if((killer_obj->type==OBJ_PLAYER)||(killer_obj->type==OBJ_GHOST)) - kpnum = killer_obj->id; - else if(killer_obj->type==OBJ_ROBOT || killer_obj->type == OBJ_BUILDING){ - //countermeasure kill - kpnum = DMFCBase->GetCounterMeasureOwner(killer_obj); - }else{ - kpnum = -1; - } - }else{ - kpnum = -1; - } - - kpr = DMFCBase->GetPlayerRecordByPnum(kpnum); - if(kpr){ - int goal; - if(DMFCBase->GetScoreLimit(&goal)){ - int score = kpr->dstats.kills[DSTAT_LEVEL] - kpr->dstats.suicides[DSTAT_LEVEL]; - if(score>=goal){ - DMFCBase->EndLevel(); - } - } - } -} - -bool compare_slots(int a,int b) -{ - int ascore,bscore; - player_record *apr,*bpr; - apr = DMFCBase->GetPlayerRecord(a); - bpr = DMFCBase->GetPlayerRecord(b); - if( !apr ) - return true; - if( !bpr ) - return false; - if( apr->state==STATE_EMPTY ) - return true; - if( bpr->state==STATE_EMPTY ) - return false; - if( (apr->state==STATE_INGAME) && (bpr->state==STATE_INGAME) ){ - //both players were in the game - ascore = apr->dstats.kills[DSTAT_LEVEL] - apr->dstats.suicides[DSTAT_LEVEL]; - bscore = bpr->dstats.kills[DSTAT_LEVEL] - bpr->dstats.suicides[DSTAT_LEVEL]; - return (ascorestate==STATE_INGAME) && (bpr->state==STATE_DISCONNECTED) ){ - //apr gets priority since he was in the game on exit - return false; - } - if( (apr->state==STATE_DISCONNECTED) && (bpr->state==STATE_INGAME) ){ - //bpr gets priority since he was in the game on exit - return true; - } - //if we got here then both players were disconnected - ascore = apr->dstats.kills[DSTAT_LEVEL] - apr->dstats.suicides[DSTAT_LEVEL]; - bscore = bpr->dstats.kills[DSTAT_LEVEL] - bpr->dstats.suicides[DSTAT_LEVEL]; - return (ascore=0 && compare_slots(tempsort[j],t); j--){ - tempsort[j+1] = tempsort[j]; - } - // insert - tempsort[j+1] = t; - } - - //copy the array over - memcpy(SortedPlayers,tempsort,DLLMAX_PLAYERS*sizeof(int)); - - DMFCBase->OnPLRInit(); -} - -void OnPLRInterval(void) -{ -#define PLAYERS_COL 130 -#define SCORE_COL 280 -#define DEATHS_COL 330 -#define SUICIDES_COL 390 -#define TOTAL_COL 460 - - DMFCBase->OnPLRInterval(); - - int y = 40; - - int height = DLLgrfont_GetHeight((DMFCBase->GetGameFontTranslateArray())[SMALL_UI_FONT_INDEX]) + 1; - DLLgrtext_SetFont((DMFCBase->GetGameFontTranslateArray())[SMALL_UI_FONT_INDEX]); - - //print out header - DLLgrtext_SetColor(GR_RGB(255,255,150)); - DLLgrtext_Printf(PLAYERS_COL,y,TXT_PILOT); - DLLgrtext_Printf(SCORE_COL,y,TXT_KILLS_SHORT); - DLLgrtext_Printf(DEATHS_COL,y,TXT_DEATHS_SHORT); - DLLgrtext_Printf(SUICIDES_COL,y,TXT_SUICIDES_SHORT); - DLLgrtext_Printf(TOTAL_COL,y,TXT_SCORE); - y+=height; - - //print out player stats - int rank = 1; - int slot,pnum; - player_record *pr; - - for(int i=0;iGetPlayerRecord(slot); - if((pr) && (pr->state!=STATE_EMPTY) ){ - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue;//skip a dedicated server - - pnum=DMFCBase->WasPlayerInGameAtLevelEnd(slot); - if(pnum!=-1) - { - DLLgrtext_SetColor((DMFCBase->GetPlayerColors())[pnum]); - }else - { - DLLgrtext_SetColor(GR_RGB(128,128,128)); - } - - char temp[100]; - sprintf(temp,"%d)%s",rank,pr->callsign); - DMFCBase->ClipString(SCORE_COL - PLAYERS_COL - 10,temp,true); - DLLgrtext_Printf(PLAYERS_COL,y,"%s",temp); - - DLLgrtext_Printf(SCORE_COL,y,"%d",pr->dstats.kills[DSTAT_LEVEL]); - DLLgrtext_Printf(DEATHS_COL,y,"%d",pr->dstats.deaths[DSTAT_LEVEL]); - DLLgrtext_Printf(SUICIDES_COL,y,"%d",pr->dstats.suicides[DSTAT_LEVEL]); - DLLgrtext_Printf(TOTAL_COL,y,"%d",pr->dstats.kills[DSTAT_LEVEL]-pr->dstats.suicides[DSTAT_LEVEL]); - y+=height; - rank++; - - if(y>=440) - goto quick_exit; - - } - } - -quick_exit:; -} - - -void SaveStatsToFile(char *filename) -{ - CFILE *file; - DLLOpenCFILE(&file,filename,"wt"); - if(!file){ - mprintf((0,"Unable to open output file\n")); - return; - } - - //write out game stats - #define BUFSIZE 150 - char buffer[BUFSIZE]; - char tempbuffer[25]; - int sortedslots[MAX_PLAYER_RECORDS]; - player_record *pr,*dpr; - tPInfoStat stat; - int count,length,p; - - //sort the stats - DMFCBase->GetSortedPlayerSlots(sortedslots,MAX_PLAYER_RECORDS); - count = 1; - - sprintf(buffer,TXT_SAVE_HEADER,(DMFCBase->GetNetgameInfo())->name,(DMFCBase->GetCurrentMission())->cur_level); - DLLcf_WriteString(file,buffer); - - sprintf(buffer,TXT_SAVE_HEADERB); - DLLcf_WriteString(file,buffer); - sprintf(buffer,"-----------------------------------------------------------------------------------------------"); - DLLcf_WriteString(file,buffer); - - - for(int s=0;sGetPlayerRecord(p); - if( pr && pr->state!=STATE_EMPTY) { - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue; //skip dedicated server - - memset(buffer,' ',BUFSIZE); - - sprintf(tempbuffer,"%d)",count); - memcpy(&buffer[0],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%s%s",(pr->state==STATE_INGAME)?"":"*",pr->callsign); - memcpy(&buffer[7],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d[%d]",pr->dstats.kills[DSTAT_LEVEL]-pr->dstats.suicides[DSTAT_LEVEL],pr->dstats.kills[DSTAT_OVERALL]-pr->dstats.suicides[DSTAT_OVERALL]); - memcpy(&buffer[36],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d[%d]",pr->dstats.kills[DSTAT_LEVEL],pr->dstats.kills[DSTAT_OVERALL]); - memcpy(&buffer[48],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d[%d]",pr->dstats.deaths[DSTAT_LEVEL],pr->dstats.deaths[DSTAT_OVERALL]); - memcpy(&buffer[60],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d[%d]",pr->dstats.suicides[DSTAT_LEVEL],pr->dstats.suicides[DSTAT_OVERALL]); - memcpy(&buffer[71],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%s",DMFCBase->GetTimeString(DMFCBase->GetTimeInGame(p))); - memcpy(&buffer[82],tempbuffer,strlen(tempbuffer)); - - int pos; - pos = 82 + strlen(tempbuffer) + 1; - if(posGetPlayerRecord(p); - if( pr && pr->state!=STATE_EMPTY) { - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue; //skip dedicated server - - //Write out header - sprintf(buffer,"%d) %s%s",count,(pr->state==STATE_INGAME)?"":"*",pr->callsign); - DLLcf_WriteString(file,buffer); - length = strlen(buffer); - memset(buffer,'=',length); - buffer[length] = '\0'; - DLLcf_WriteString(file,buffer); - - //time in game - sprintf(buffer,TXT_SAVE_TIMEINGAME,DMFCBase->GetTimeString(DMFCBase->GetTimeInGame(p))); - DLLcf_WriteString(file,buffer); - - if(DMFCBase->FindPInfoStatFirst(p,&stat)){ - sprintf(buffer,TXT_SAVE_KILLERLIST); - DLLcf_WriteString(file,buffer); - - if(stat.slot!=p){ - memset(buffer,' ',BUFSIZE); - dpr = DMFCBase->GetPlayerRecord(stat.slot); - int pos; - - ASSERT(dpr!=NULL); - if(dpr){ - sprintf(tempbuffer,"%s",dpr->callsign); - memcpy(buffer,tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d",stat.kills); - memcpy(&buffer[30],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d",stat.deaths); - memcpy(&buffer[40],tempbuffer,strlen(tempbuffer)); - - pos = 40 + strlen(tempbuffer) + 1; - if(posFindPInfoStatNext(&stat)){ - if(stat.slot!=p){ - int pos; - memset(buffer,' ',BUFSIZE); - dpr = DMFCBase->GetPlayerRecord(stat.slot); - - if(dpr) - { - sprintf(tempbuffer,"%s",dpr->callsign); - memcpy(buffer,tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d",stat.kills); - memcpy(&buffer[30],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d",stat.deaths); - memcpy(&buffer[40],tempbuffer,strlen(tempbuffer)); - - pos = 40 + strlen(tempbuffer) + 1; - if(posFindPInfoStatClose(); - DLLcf_WriteString(file,""); //skip a line - count++; - } - } - - //done writing stats - DLLcfclose(file); - DLLAddHUDMessage(TXT_MSG_SAVESTATS); -} - -#define ROOTFILENAME "Anarchy" -void OnSaveStatsToFile(void) -{ - char filename[256]; - DMFCBase->GenerateStatFilename(filename,ROOTFILENAME,false); - SaveStatsToFile(filename); -} - -void OnLevelEndSaveStatsToFile(void) -{ - char filename[256]; - DMFCBase->GenerateStatFilename(filename,ROOTFILENAME,true); - SaveStatsToFile(filename); -} - -void OnDisconnectSaveStatsToFile(void) -{ - char filename[256]; - DMFCBase->GenerateStatFilename(filename,ROOTFILENAME,false); - SaveStatsToFile(filename); -} - -void OnPrintScores(int level) -{ - char buffer[256]; - char name[50]; - memset(buffer,' ',256); - - int t; - int pos[6]; - int len[6]; - pos[0] = 0; t = len[0] = 20; //give ample room for pilot name - pos[1] = pos[0] + t + 1; t = len[1] = strlen(TXT_POINTS); - pos[2] = pos[1] + t + 1; t = len[2] = strlen(TXT_KILLS_SHORT); - pos[3] = pos[2] + t + 1; t = len[3] = strlen(TXT_DEATHS_SHORT); - pos[4] = pos[3] + t + 1; t = len[4] = strlen(TXT_SUICIDES_SHORT); - pos[5] = pos[4] + t + 1; t = len[5] = strlen(TXT_PING); - - memcpy(&buffer[pos[0]],TXT_PILOT,strlen(TXT_PILOT)); - memcpy(&buffer[pos[1]],TXT_POINTS,len[1]); - memcpy(&buffer[pos[2]],TXT_KILLS_SHORT,len[2]); - memcpy(&buffer[pos[3]],TXT_DEATHS_SHORT,len[3]); - memcpy(&buffer[pos[4]],TXT_SUICIDES_SHORT,len[4]); - memcpy(&buffer[pos[5]],TXT_PING,len[5]); - buffer[pos[5]+len[5]+1] = '\n'; - buffer[pos[5]+len[5]+2] = '\0'; - DPrintf(buffer); - - int slot; - player_record *pr; - int pcount; - - if(level<0 || level>=MAX_PLAYER_RECORDS) - pcount = MAX_PLAYER_RECORDS; - else - pcount = level; - - int sortedplayers[MAX_PLAYER_RECORDS]; - DMFCBase->GetSortedPlayerSlots(sortedplayers,MAX_PLAYER_RECORDS); - - for(int i=0;iGetPlayerRecord(slot); - if((pr)&&(pr->state!=STATE_EMPTY)){ - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue; //skip dedicated server - - sprintf(name,"%s%s:",(pr->state==STATE_DISCONNECTED)?"*":"",pr->callsign); - name[19] = '\0'; - - memset(buffer,' ',256); - t = strlen(name); memcpy(&buffer[pos[0]],name,(tdstats.kills[DSTAT_LEVEL]-pr->dstats.suicides[DSTAT_LEVEL]); - t = strlen(name); memcpy(&buffer[pos[1]],name,(tdstats.kills[DSTAT_LEVEL]); - t = strlen(name); memcpy(&buffer[pos[2]],name,(tdstats.deaths[DSTAT_LEVEL]); - t = strlen(name); memcpy(&buffer[pos[3]],name,(tdstats.suicides[DSTAT_LEVEL]); - t = strlen(name); memcpy(&buffer[pos[4]],name,(tstate==STATE_INGAME) - sprintf(name,"%.0f",(DMFCBase->GetNetPlayers())[pr->pnum].ping_time*1000.0f); - else - strcpy(name,"---"); - t = strlen(name); memcpy(&buffer[pos[5]],name,(tGetPlayerNum()); - display_my_welcome = false; - } - - if(DisplayScoreScreen) - return; - - int height = DLLgrfont_GetHeight((DMFCBase->GetGameFontTranslateArray())[HUD_FONT_INDEX]) + 3; - ubyte alpha = DMFCBase->ConvertHUDAlpha((ubyte)((DisplayScoreScreen)?128:255)); - int y = (DMFCBase->GetGameWindowH()/2) - ((height*5)/2); - int x = 520; - ddgr_color color; - - int rank = 1; - player_record *pr; - - //Display your Kills & Deaths on the top corners of the screen - pr = DMFCBase->GetPlayerRecordByPnum(DMFCBase->GetPlayerNum()); - if(pr){ - int y = 25,x; - int lwidth; - char buffer[20]; - - int w_kill,w_death,max_w; - w_kill = DLLgrtext_GetTextLineWidth(TXT_KILLS); - w_death = DLLgrtext_GetTextLineWidth(TXT_DEATHS); - max_w = max(w_kill,w_death); - - x = DMFCBase->GetGameWindowW() - DMFCBase->GetGameWindowW()*0.0078125f; - DLLgrtext_SetColor(GR_GREEN); - DLLgrtext_SetAlpha(alpha); - DLLgrtext_Printf(x-(max_w/2)-(w_kill/2),y,TXT_KILLS); - y+=height; - - sprintf(buffer,"%d",pr->dstats.kills[DSTAT_LEVEL]); - lwidth = DLLgrtext_GetTextLineWidth(buffer); - DLLgrtext_SetColor(GR_GREEN); - DLLgrtext_SetAlpha(alpha); - DLLgrtext_Printf(x-(max_w/2)-(lwidth/2),y,buffer); - y+=height+3; - - DLLgrtext_SetColor(GR_GREEN); - DLLgrtext_SetAlpha(alpha); - DLLgrtext_Printf(x - (max_w/2) - (w_death/2),y,TXT_DEATHS); - y+=height; - - sprintf(buffer,"%d",pr->dstats.deaths[DSTAT_LEVEL]); - lwidth = DLLgrtext_GetTextLineWidth(buffer); - DLLgrtext_SetColor(GR_GREEN); - DLLgrtext_SetAlpha(alpha); - DLLgrtext_Printf(x - (max_w/2) - (lwidth/2),y,buffer); - } - - int ESortedPlayers[DLLMAX_PLAYERS]; - - switch(Anarchy_hud_display){ - case AHD_NONE: - return; - break; - case AHD_EFFICIENCY: - DMFCBase->GetSortedPlayerSlots(ESortedPlayers,DLLMAX_PLAYERS); - break; - } - - char name[30]; - - //determine coordinates to use here - //we'll use a virtual width of 85 pixels on a 640x480 screen - //so first determine the new width - int name_width = 85.0f * DMFCBase->GetHudAspectX(); - int score_width = DLLgrtext_GetTextLineWidth("888"); - int name_x = DMFCBase->GetGameWindowW() - name_width - score_width - 10; - int score_x = DMFCBase->GetGameWindowW() - score_width - 5; - - for(int i=0;iGetPlayerRecord(slot); - - if((pr)&&(pr->state!=STATE_EMPTY)){ - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue; //skip dedicated server - - if( (pr->state==STATE_DISCONNECTED) || (pr->state==STATE_INGAME && !DMFCBase->IsPlayerObserver(pr->pnum)) ){ - - if(pr->pnum==DMFCBase->GetPlayerNum()){ - - switch(HUD_color_model){ - case ACM_PLAYERCOLOR: - color = (DMFCBase->GetPlayerColors())[pr->pnum]; - break; - case ACM_NORMAL: - color = GR_RGB(40,255,40); - break; - }; - - if(Highlight_bmp>BAD_BITMAP_HANDLE){ - //draw the highlite bar in the background - DLLrend_SetAlphaValue(alpha*0.50f); - DLLrend_SetZBufferState (0); - DLLrend_SetTextureType (TT_LINEAR); - DLLrend_SetLighting (LS_NONE); - DLLrend_SetAlphaType (AT_CONSTANT_TEXTURE); - DLLrend_DrawScaledBitmap(name_x-2,y-2,score_x+score_width+2,y+height-1,Highlight_bmp,0,0,1,1,1.0); - DLLrend_SetZBufferState (1); - } - - strcpy(name,pr->callsign); - DMFCBase->ClipString(name_width,name,true); - - DLLgrtext_SetAlpha(alpha); - DLLgrtext_SetColor(color); - DLLgrtext_Printf(name_x,y,"%s",name); - - if(Anarchy_hud_display==AHD_EFFICIENCY){ - float t = pr->dstats.kills[DSTAT_LEVEL]+pr->dstats.suicides[DSTAT_LEVEL]+pr->dstats.deaths[DSTAT_LEVEL]; - float value = (float)(pr->dstats.kills[DSTAT_LEVEL])/((t)?t:0.0000001f); - DLLgrtext_Printf(score_x,y,"%.1f",value); - }else{ - DLLgrtext_Printf(score_x,y,"%d",pr->dstats.kills[DSTAT_LEVEL]-pr->dstats.suicides[DSTAT_LEVEL]); - } - - y+=height; - }else - if(rank<6){ - - if(pr->state==STATE_DISCONNECTED){ - color = GR_GREY; - }else{ - switch(HUD_color_model){ - case ACM_PLAYERCOLOR: - color = (DMFCBase->GetPlayerColors())[pr->pnum]; - break; - case ACM_NORMAL: - color = GR_RGB(40,255,40); - break; - }; - } - strcpy(name,pr->callsign); - DMFCBase->ClipString(name_width,name,true); - - DLLgrtext_SetAlpha(alpha); - DLLgrtext_SetColor(color); - DLLgrtext_Printf(name_x,y,"%s",name); - - if(Anarchy_hud_display==AHD_EFFICIENCY){ - float t = pr->dstats.kills[DSTAT_LEVEL]+pr->dstats.suicides[DSTAT_LEVEL]+pr->dstats.deaths[DSTAT_LEVEL]; - float value = (float)(pr->dstats.kills[DSTAT_LEVEL])/((t)?t:0.0000001f); - DLLgrtext_Printf(score_x,y,"%.1f",value); - }else{ - DLLgrtext_Printf(score_x,y,"%d",pr->dstats.kills[DSTAT_LEVEL]-pr->dstats.suicides[DSTAT_LEVEL]); - } - - y+=height; - } - rank++; - } - } - } -} - -void DisplayWelcomeMessage(int player_num) -{ - char name_buffer[64]; - strcpy(name_buffer,(DMFCBase->GetPlayers())[player_num].callsign); - - if(player_num==DMFCBase->GetPlayerNum()) - { - DLLAddHUDMessage(TXT_WELCOME,name_buffer); - } - else - { - DLLAddHUDMessage(TXT_JOINED,name_buffer); - } -} - -void SwitchHUDColor(int i) -{ - if(i<0 || i>1) - return; - HUD_color_model = i; - - switch(HUD_color_model){ - case ACM_PLAYERCOLOR: - DLLAddHUDMessage(TXT_MSG_COLORPLR); - break; - case ACM_NORMAL: - DLLAddHUDMessage(TXT_MSG_COLORNORM); - break; - }; -} - -#ifdef MACINTOSH -#pragma export off -#endif - diff --git a/roboanarchy/roboanarchystr.h b/roboanarchy/roboanarchystr.h deleted file mode 100644 index 216a7bc7..00000000 --- a/roboanarchy/roboanarchystr.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef __ANARCHY_STRING_TABLE_H_ -#define __ANARCHY_STRING_TABLE_H_ - -#define TXT(d) GetString(d) - - -#define TXT_DEATH1 TXT(0) //"%s got blasted by %s" -#define TXT_DEATH2 TXT(1) //"%s knows %s is his god" -#define TXT_DEATH3 TXT(2) //"%s sucks %s's milk" -#define TXT_DEATH4 TXT(3) //"%s realizes %s's power" -#define TXT_DEATH5 TXT(4) //"%s got killed by %s" -#define TXT_DEATH6 TXT(5) //"%s begs for %s's mercy" -#define TXT_DEATH7 TXT(6) //"%s realizes %s is a better player" -#define TXT_DEATH8 TXT(7) //"%s was no match for %s" -#define TXT_DEATH9 TXT(8) //"%s wishes he was as good as %s" -#define TXT_DEATH10 TXT(9) //"%s got messed up by %s" -#define TXT_SUICIDE1 TXT(10) //"%s blasts himself" -#define TXT_SUICIDE2 TXT(11) //"%s Bursts his own bubble" -#define TXT_SUICIDE3 TXT(12) //"%s doesn't know his own strength" -#define TXT_SUICIDE4 TXT(13) //"No prize for %s" -#define TXT_SUICIDE5 TXT(14) //"%s doesn't wish to live anymore" -#define TXT_SUICIDE6 TXT(15) //"%s SUCKS!" -#define TXT_PILOT TXT(16) //"Pilot" -#define TXT_KILLS TXT(17) //"Kills" -#define TXT_DEATHS TXT(18) //"Deaths" -#define TXT_SUICIDES TXT(19) //"Suicides" -#define TXT_SCORE TXT(20) //"Score" -#define TXT_STATS TXT(21) //"Stats" -#define TXT_WELCOME TXT(22) //"Welcome to the Anarchy %s!" -#define TXT_JOINED TXT(23) //"%s has joined the Anarchy" -#define TXT_POINTS TXT(24) //"Points" -#define TXT_HUDD_NONE TXT(25) //"Anarchy: HUD Display set to None" -#define TXT_HUDD_SCORES TXT(26) //"Anarchy: HUD Display set to Scores" -#define TXT_HUDD_EFFIC TXT(27) //"Anarchy: HUD Display set to Efficiency" -#define TXT_MNU_HUDSTYLE TXT(28) //"HUD Display" -#define TXT_NONE TXT(29) //"None" -#define TXT_SCOREHD TXT(30) //"Score" -#define TXT_EFFICIENCY TXT(31) //"Efficiency" -#define TXT_MNU_HUDCOLOR TXT(32) //"HUD Score Colors" -#define TXT_PLAYERCOLORS TXT(33) //"Player Colors" -#define TXT_NORMAL TXT(34) //"Normal" -#define TXT_PING TXT(35) //"Ping" -#define TXT_SAVE_HEADER TXT(36) //"Anarchy\r\nGame: %s\r\nLevel: %d\r\n" -#define TXT_SAVE_HEADERB TXT(37) //"[Rank] [Name] [Score] [Kills] [Deaths] [Suicides] [Time In Game]" -#define TXT_SAVE_HEADERC TXT(38) //"\r\nIndividual Stats\r\n" -#define TXT_SAVE_TIMEINGAME TXT(39) //"Total Time In Game: %s" -#define TXT_SAVE_KILLERLIST TXT(40) //"Callsign: Kills: Deaths:" -#define TXT_MSG_SAVESTATS TXT(41) //"Stats saved to file" -#define TXT_MSG_COLORPLR TXT(42) //"Anarchy HUD Color Model: Player Colors" -#define TXT_MSG_COLORNORM TXT(43) //"Anarchy HUD Color Model: Normal" -#define TXT_KILLS_SHORT TXT(44) //"K" -#define TXT_DEATHS_SHORT TXT(45) //"D" -#define TXT_SUICIDES_SHORT TXT(46) //"S" - -#endif diff --git a/tanarchy/Makefile b/tanarchy/Makefile deleted file mode 100644 index 2ca63794..00000000 --- a/tanarchy/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -include ../../default.mak - -OBJS = tanarchy.o -REFS = tanarchy.cpp -LIBNAME = ../../netgames/tanarchy.d3m - -CDLFLAGS = $(CFLAGS) -fPIC -LDLFLAGS = -shared -ldl -lm - -all: depall $(OBJS) - gcc $(LDLFLAGS) -o $(LIBNAME) $(OBJS) /usr/lib/dmfc.so - -depall: - $(CC) -E -M $(CFLAGS) $(DEFINES) $(REFS) > .depend - -clean: - rm -f $(OBJS) *~ $(LIBNAME) core - -%.o: %.cpp - $(CC) $(CDLFLAGS) $(DEFINES) -c $< -o $@ - -ifeq (.depend,$(wildcard .depend)) -include .depend -endif diff --git a/tanarchy/tanDMFC.h b/tanarchy/tanDMFC.h deleted file mode 100644 index dc2433d1..00000000 --- a/tanarchy/tanDMFC.h +++ /dev/null @@ -1,123 +0,0 @@ -#ifndef __DMFC_APP_H_ -#define __DMFC_APP_H_ - -#include "osiris_share.h" -#include "d3events.h" - -//!!!!!!!ADD YOUR EVENT HANDLER OVERRIDES HERE!!!!!!!!!!! -void OnGameStateRequest(int pnum); -void OnClientPlayerKilled(object *killer_obj,int victim_pnum); -void OnServerGameCreated(void); -void OnClientLevelStart(void); -void OnClientLevelEnd(void); -void OnClientPlayerEntersGame(int player_num); -void OnInterval(void); -void OnHUDInterval(void); -void OnKeypress(int key); -void OnPLRInterval(void); -void OnPLRInit(void); -void OnSaveStatsToFile(void); -extern IDMFC *DMFCBase; - -// These next two function prototypes MUST appear in the extern "C" block if called -// from a CPP file. -extern "C" -{ - DLLEXPORT void DLLFUNCCALL DLLGameInit (int *api_func,ubyte *all_ok,int num_teams_to_use); - DLLEXPORT void DLLFUNCCALL DLLGameCall (int eventnum,dllinfo *data); - DLLEXPORT void DLLFUNCCALL DLLGameClose (); - DLLEXPORT void DLLFUNCCALL DLLGetGameInfo (tDLLOptions *options); - DLLEXPORT int DLLFUNCCALL GetGOScriptID(char *name,ubyte isdoor); - DLLEXPORT void DLLFUNCCALLPTR CreateInstance(int id); - DLLEXPORT void DLLFUNCCALL DestroyInstance(int id,void *ptr); - DLLEXPORT short DLLFUNCCALL CallInstanceEvent(int id,void *ptr,int event,tOSIRISEventInfo *data); - DLLEXPORT int DLLFUNCCALL SaveRestoreState( void *file_ptr, ubyte saving_state ); -} - -#ifdef MACINTOSH -#pragma export on -#endif - -// The main entry point where the game calls the dll -void DLLFUNCCALL DLLGameCall (int eventnum,dllinfo *data) -{ - if((eventnumGetLocalRole()!=LR_SERVER)){ - return; - } - - DMFCBase->TranslateEvent(eventnum,data); -} - -// GetGOScriptID -// Purpose: -// Given the name of the object (from it's pagename), this function will search through it's -// list of General Object Scripts for a script with a matching name (to see if there is a script -// for that type/id of object within this DLL). If a matching scriptname is found, a UNIQUE ID -// is to be returned back to Descent 3. This ID will be used from here on out for all future -// interaction with the DLL. Since doors are not part of the generic object's, it's possible -// for a door to have the same name as a generic object (OBJ_POWERUP, OBJ_BUILDING, OBJ_CLUTTER -// or OBJ_ROBOT), therefore, a 1 is passed in for isdoor if the given object name refers to a -// door, else it is a 0. The return value is the unique identifier, else -1 if the script -// does not exist in the DLL. -int DLLFUNCCALL GetGOScriptID(char *name,ubyte isdoor) -{ - return -1; -} - -// CreateInstance -// Purpose: -// Given an ID from a call to GetGOScriptID(), this function will create a new instance for that -// particular script (by allocating and initializing memory, etc.). A pointer to this instance -// is to be returned back to Descent 3. This pointer will be passed around, along with the ID -// for CallInstanceEvent() and DestroyInstance(). Return NULL if there was an error. -void DLLFUNCCALLPTR CreateInstance(int id) -{ - return NULL; -} - -// DestroyInstance -// Purpose: -// Given an ID, and a pointer to a particular instance of a script, this function will delete and -// destruct all information associated with that script, so it will no longer exist. -void DLLFUNCCALL DestroyInstance(int id,void *ptr) -{ -} - -// CallInstanceEvent -// Purpose: -// Given an ID, a pointer to a script instance, an event and a pointer to the struct of -// information about the event, this function will translate who this event belongs to and -// passes the event to that instance of the script to be handled. Return a combination of -// CONTINUE_CHAIN and CONTINUE_DEFAULT, to give instructions on what to do based on the -// event. CONTINUE_CHAIN means to continue through the chain of scripts (custom script, level -// script, mission script, and finally default script). If CONTINUE_CHAIN is not specified, -// than the chain is broken and those scripts of lower priority will never get the event. Return -// CONTINUE_DEFAULT in order to tell D3 if you want process the normal action that is built into -// the game for that event. This only pertains to certain events. If the chain continues -// after this script, than the CONTINUE_DEFAULT setting will be overridden by lower priority -// scripts return value. -short DLLFUNCCALL CallInstanceEvent(int id,void *ptr,int event,tOSIRISEventInfo *data) -{ - return CONTINUE_CHAIN|CONTINUE_DEFAULT; -} - -// SaveRestoreState -// Purpose: -// This function is called when Descent 3 is saving or restoring the game state. In this function -// you should save/restore any global data that you want preserved through load/save (which includes -// demos). You must be very careful with this function, corrupting the file (reading or writing too -// much or too little) may be hazardous to the game (possibly making it impossible to restore the -// state). It would be best to use version information to keep older versions of saved states still -// able to be used. IT IS VERY IMPORTANT WHEN SAVING THE STATE TO RETURN THE NUMBER OF _BYTES_ WROTE -// TO THE FILE. When restoring the data, the return value is ignored. saving_state is 1 when you should -// write data to the file_ptr, 0 when you should read in the data. -int DLLFUNCCALL SaveRestoreState( void *file_ptr, ubyte saving_state ) -{ - return 0; -} -#ifdef MACINTOSH -#pragma export off -#endif - - -#endif \ No newline at end of file diff --git a/tanarchy/tanarchy.cpp b/tanarchy/tanarchy.cpp deleted file mode 100644 index 808bd3c3..00000000 --- a/tanarchy/tanarchy.cpp +++ /dev/null @@ -1,1094 +0,0 @@ -/* -* $Logfile: /DescentIII/Main/tanarchy/tanarchy.cpp $ -* $Revision: 1.1.1.1 $ -* $Date: 2003-08-26 03:59:14 $ -* $Author: kevinb $ -* -* -* -* $Log: not supported by cvs2svn $ - * - * 74 10/03/01 1:05p Matt - * Made team_name buffer large enough to hold the team number *plus* the - * number of players on the team. - * - * 73 9/24/01 2:28p Matt - * Allowed room for longer team name on results screen. - * - * 72 9/18/01 6:54p Matt - * Show results for NUM_TEAMS, not MAX_TEAMS. - * Removed some unused code. - * - * 71 9/13/01 5:31p Matt - * Added a team member list to the stats display. - * Fixed a non-terminated string bug. - * - * 70 10/21/99 3:28p Kevin - * Mac merge! - * - * 69 7/15/99 1:18a Jeff - * added $scores - * - * 68 7/12/99 2:27p Jeff - * fixed PLR to only display the team label for the disconnected list if - * there are people in the list - * - * 67 7/12/99 1:22p Jeff - * updated for new netflags - * - * 66 7/11/99 6:55p Jeff - * fixed PLR so it doesn't go off the screen on long lists and active - * players in the game are shown first - * - * 65 5/23/99 5:54p Jeff - * fixed HUD display - * - * 64 5/23/99 3:04a Jason - * fixed bug with player rankings not being updated correctly - * - * 63 5/12/99 11:04p Jeff - * dmfc and multiplayer games now have endian friendly packets (*whew*) - * - * 62 5/12/99 11:28a Jeff - * added sourcesafe comment block -* -* $NoKeywords: $ -*/ - -#include "gamedll_header.h" -#include -#include "idmfc.h" -#include "tanDMFC.h" -#include "tanarchystr.h" -IDMFC *DMFCBase = NULL; -IDmfcStats *dstat = NULL; -player *dPlayers; - -#define SPID_NEWPLAYER 0 -#define NUM_TEAMS 2 - -int SortedPLRPlayers[MAX_TEAMS][MAX_PLAYER_RECORDS]; -int TeamScore[NUM_TEAMS]; -int SortedTeams[NUM_TEAMS]; -int SortedPlayers[MAX_PLAYER_RECORDS]; -bool DisplayScoreScreen; -bool display_my_welcome = false; - -void GetGameStartPacket(ubyte *data); -void SendGameStartPacket(int pnum); -void DisplayScores(void); -void DisplayHUDScores(struct tHUDItem *hitem); -void DisplayWelcomeMessage(int player_num); -void SortTeamScores(int *sortedindex,int *scores); -void OnSaveStatsToFile(void); -void OnLevelEndSaveStatsToFile(void); -void OnDisconnectSaveStatsToFile(void); -void OnPrintScores(int level); - -int Highlight_bmp = -1; - -/////////////////////////////////////////////// -//localization info -char **StringTable; -int StringTableSize = 0; -char *_ErrorString = "Missing String"; -char *GetStringFromTable(int d){if( (d<0) || (d>=StringTableSize) ) return _ErrorString; else return StringTable[d];} -/////////////////////////////////////////////// - -void DetermineScore(int precord_num,int column_num,char *buffer,int buffer_size) -{ - player_record *pr = DMFCBase->GetPlayerRecord(precord_num); - if(!pr || pr->state==STATE_EMPTY){ - buffer[0] = '\0'; - return; - } - - sprintf(buffer,"%d[%d]", pr->dstats.kills[DSTAT_LEVEL]-pr->dstats.suicides[DSTAT_LEVEL], - pr->dstats.kills[DSTAT_OVERALL]-pr->dstats.suicides[DSTAT_OVERALL]); -} - -void TeamScoreCallback(int team,char *buffer,int buffer_size) -{ - ASSERT(team>=0 && teamflags = DOF_MAXTEAMS|DOF_MINTEAMS; - options->max_teams = 2; - options->min_teams = 2; - strcpy(options->game_name,TXT_GAMENAME); - strcpy(options->requirements,""); -} - -// Initializes the game function pointers -void DLLFUNCCALL DLLGameInit (int *api_func,ubyte *all_ok,int num_teams_to_use) -{ - *all_ok = 1; - DMFCBase = CreateDMFC(); - if(!DMFCBase) - { - *all_ok = 0; - return; - } - - dstat = CreateDmfcStats(); - if(!dstat) - { - *all_ok = 0; - return; - } - DMFCBase->LoadFunctions(api_func); - DMFCBase->Set_OnGameStateRequest(OnGameStateRequest); - DMFCBase->Set_OnClientPlayerKilled(OnClientPlayerKilled); - DMFCBase->Set_OnServerGameCreated(OnServerGameCreated); - DMFCBase->Set_OnClientLevelStart(OnClientLevelStart); - DMFCBase->Set_OnClientLevelEnd(OnClientLevelEnd); - DMFCBase->Set_OnClientPlayerEntersGame(OnClientPlayerEntersGame); - DMFCBase->Set_OnInterval(OnInterval); - DMFCBase->Set_OnHUDInterval(OnHUDInterval); - DMFCBase->Set_OnKeypress(OnKeypress); - DMFCBase->Set_OnPLRInterval(OnPLRInterval); - DMFCBase->Set_OnPLRInit(OnPLRInit); - DMFCBase->Set_OnSaveStatsToFile(OnSaveStatsToFile); - DMFCBase->Set_OnLevelEndSaveStatsToFile(OnLevelEndSaveStatsToFile); - DMFCBase->Set_OnDisconnectSaveStatsToFile(OnDisconnectSaveStatsToFile); - DMFCBase->Set_OnPrintScores(OnPrintScores); - - dPlayers = DMFCBase->GetPlayers(); - - DMFCBase->GameInit(NUM_TEAMS); - DLLCreateStringTable("tanarchy.str",&StringTable,&StringTableSize); - DLLmprintf((0,"%d strings loaded from string table\n",StringTableSize)); - if(!StringTableSize){ - *all_ok = 0; - return; - } - - netgame_info *Netgame = DMFCBase->GetNetgameInfo(); - Netgame->flags |= (NF_TRACK_RANK); - - //add the death and suicide messages - DMFCBase->AddDeathMessage(TXT_DEATH1,true); - DMFCBase->AddDeathMessage(TXT_DEATH2,true); - DMFCBase->AddDeathMessage(TXT_DEATH3,false); - DMFCBase->AddDeathMessage(TXT_DEATH4,false); - DMFCBase->AddDeathMessage(TXT_DEATH5,true); - DMFCBase->AddDeathMessage(TXT_DEATH6,true); - DMFCBase->AddDeathMessage(TXT_DEATH7,false); - DMFCBase->AddDeathMessage(TXT_DEATH8,true); - DMFCBase->AddDeathMessage(TXT_DEATH9,true); - DMFCBase->AddDeathMessage(TXT_DEATH10,true); - - DMFCBase->AddSuicideMessage(TXT_SUICIDE1); - DMFCBase->AddSuicideMessage(TXT_SUICIDE2); - DMFCBase->AddSuicideMessage(TXT_SUICIDE3); - DMFCBase->AddSuicideMessage(TXT_SUICIDE4); - DMFCBase->AddSuicideMessage(TXT_SUICIDE5); - DMFCBase->AddSuicideMessage(TXT_SUICIDE6); - - //register special packet receivers - DMFCBase->RegisterPacketReceiver(SPID_NEWPLAYER,GetGameStartPacket); - - DMFCBase->SetNumberOfTeams(NUM_TEAMS); - - DMFCBase->AddHUDItemCallback(HI_TEXT,DisplayHUDScores); - - DisplayScoreScreen = false; - - Highlight_bmp = DLLbm_AllocBitmap(32,32,0); - if(Highlight_bmp>BAD_BITMAP_HANDLE){ - ushort *data = DLLbm_data(Highlight_bmp,0); - if(!data){ - //bail on out of here - *all_ok = 0; - return; - } - for(int x=0;x<32*32;x++){ - data[x] = GR_RGB16(50,50,50)|OPAQUE_FLAG; - } - } - - // Initialize the Stats Manager - // ---------------------------- - - tDmfcStatsInit tsi; - tDmfcStatsColumnInfo pl_col[6]; - char gname[20]; - strcpy(gname,TXT_STATSGAMENAME); - - tsi.flags = DSIF_SHOW_PIC|DSIF_SHOW_OBSERVERICON|DSIF_SEPERATE_BY_TEAM; - tsi.cColumnCountDetailed = 0; - tsi.cColumnCountPlayerList = 6; - tsi.clbDetailedColumnBMP = NULL; - tsi.clbDetailedColumn = NULL; - tsi.clbPlayerColumn = DetermineScore; - tsi.clbPlayerColumnBMP = NULL; - tsi.DetailedColumns = NULL; - tsi.GameName = gname; - tsi.MaxNumberDisplayed = NULL; - tsi.PlayerListColumns = pl_col; - tsi.SortedPlayerRecords = SortedPlayers; - tsi.clTeamLine = TeamScoreCallback; - - pl_col[0].color_type = DSCOLOR_TEAM; - strcpy(pl_col[0].title,TXT_PILOT); - pl_col[0].type = DSCOL_PILOT_NAME; - pl_col[0].width = 120; - - pl_col[1].color_type = DSCOLOR_TEAM; - strcpy(pl_col[1].title,TXT_SCORE); - pl_col[1].type = DSCOL_CUSTOM; - pl_col[1].width = 47; - - pl_col[2].color_type = DSCOLOR_TEAM; - strcpy(pl_col[2].title,TXT_KILLS); - pl_col[2].type = DSCOL_KILLS_LEVEL; - pl_col[2].width = 47; - - pl_col[3].color_type = DSCOLOR_TEAM; - strcpy(pl_col[3].title,TXT_DEATHS); - pl_col[3].type = DSCOL_DEATHS_LEVEL; - pl_col[3].width = 57; - - pl_col[4].color_type = DSCOLOR_TEAM; - strcpy(pl_col[4].title,TXT_SUICIDES); - pl_col[4].type = DSCOL_SUICIDES_LEVEL; - pl_col[4].width = 67; - - pl_col[5].color_type = DSCOLOR_TEAM; - strcpy(pl_col[5].title,TXT_PING); - pl_col[5].type = DSCOL_PING; - pl_col[5].width = 40; - - dstat->Initialize(&tsi); -} -// Called when the DLL is shutdown -void DLLFUNCCALL DLLGameClose () -{ - if(Highlight_bmp>BAD_BITMAP_HANDLE) - DLLbm_FreeBitmap(Highlight_bmp); - - DLLDestroyStringTable(StringTable,StringTableSize); - - if(dstat) - { - dstat->DestroyPointer(); - dstat = NULL; - } - - if(DMFCBase) - { - DMFCBase->GameClose(); - DMFCBase->DestroyPointer(); - DMFCBase = NULL; - } -} - -// The server has just started, so clear out all the stats and game info -void OnServerGameCreated(void) -{ - DMFCBase->OnServerGameCreated(); - - for(int i=0;iOnClientLevelStart(); - for(int i=0;iRequestGameState(); -} - -void OnClientLevelEnd(void) -{ - DMFCBase->OnClientLevelEnd(); -} - - -// A New Player has entered the game, so we want to send him a game status packet that -// has information about the game -void OnGameStateRequest(int player_num) -{ - SendGameStartPacket(player_num); - DMFCBase->OnGameStateRequest(player_num); -} - -// A new player has entered the game, zero there stats out -void OnClientPlayerEntersGame(int player_num) -{ - DMFCBase->OnClientPlayerEntersGame(player_num); - - if(player_num!=DMFCBase->GetPlayerNum()) - DisplayWelcomeMessage(player_num); - else - display_my_welcome = true; -} - -// We need to adjust the scores -void OnClientPlayerKilled(object *killer_obj,int victim_pnum) -{ - int kpnum; - - if(killer_obj){ - if((killer_obj->type==OBJ_PLAYER)||(killer_obj->type==OBJ_GHOST)) - kpnum = killer_obj->id; - else if(killer_obj->type==OBJ_ROBOT || (killer_obj->type == OBJ_BUILDING && killer_obj->ai_info)){ - //countermeasure kill - kpnum = DMFCBase->GetCounterMeasureOwner(killer_obj); - }else{ - kpnum = -1; - } - }else - kpnum = -1; - - if(DMFCBase->IsPlayerDedicatedServer(victim_pnum)) - return;//dedicated server - - if(kpnum==victim_pnum && victim_pnum!=-1) - //subtract from the team score - TeamScore[dPlayers[victim_pnum].team]--; - else - if((kpnum!=-1)&&(dPlayers[kpnum].team!=-1)) - TeamScore[dPlayers[kpnum].team]++; - - DMFCBase->OnClientPlayerKilled(killer_obj,victim_pnum); -} - -void OnHUDInterval(void) -{ - dstat->DoFrame(); - - DMFCBase->DisplayOutrageLogo(); - - DMFCBase->OnHUDInterval(); -} - -void OnInterval(void) -{ - SortTeamScores(SortedTeams,TeamScore); - DMFCBase->GetSortedPlayerSlots(SortedPlayers,MAX_PLAYER_RECORDS); - - //do killgoal check - int goal; - if(DMFCBase->GetScoreLimit(&goal)) - { - for(int i=0;i=goal) - DMFCBase->EndLevel(); - } - } - DMFCBase->OnInterval(); -} - -void OnKeypress(int key) -{ - dllinfo *Data = DMFCBase->GetDLLInfoCallData(); - switch(key){ - case K_F7: - DisplayScoreScreen = !DisplayScoreScreen; - DMFCBase->EnableOnScreenMenu(false); - dstat->Enable(DisplayScoreScreen); - break; - case K_PAGEDOWN: - if(DisplayScoreScreen){ - dstat->ScrollDown(); - Data->iRet = 1; - } - break; - case K_PAGEUP: - if(DisplayScoreScreen){ - dstat->ScrollUp(); - Data->iRet = 1; - } - break; - case K_F6: - DisplayScoreScreen = false; - dstat->Enable(false); - break; - case K_ESC: - if(DisplayScoreScreen){ - dstat->Enable(false); - DisplayScoreScreen = false; - Data->iRet = 1; - } - break; - } - - DMFCBase->OnKeypress(key); -} - -bool compare_slots(int a,int b) -{ - int ascore,bscore; - player_record *apr,*bpr; - apr = DMFCBase->GetPlayerRecord(a); - bpr = DMFCBase->GetPlayerRecord(b); - if( !apr ) - return true; - if( !bpr ) - return false; - if( apr->state==STATE_EMPTY ) - return true; - if( bpr->state==STATE_EMPTY ) - return false; - if( (apr->state==STATE_INGAME) && (bpr->state==STATE_INGAME) ){ - //both players were in the game - ascore = apr->dstats.kills[DSTAT_LEVEL] - apr->dstats.suicides[DSTAT_LEVEL]; - bscore = bpr->dstats.kills[DSTAT_LEVEL] - bpr->dstats.suicides[DSTAT_LEVEL]; - return (ascorestate==STATE_INGAME) && (bpr->state==STATE_DISCONNECTED) ){ - //apr gets priority since he was in the game on exit - return false; - } - if( (apr->state==STATE_DISCONNECTED) && (bpr->state==STATE_INGAME) ){ - //bpr gets priority since he was in the game on exit - return true; - } - //if we got here then both players were disconnected - ascore = apr->dstats.kills[DSTAT_LEVEL] - apr->dstats.suicides[DSTAT_LEVEL]; - bscore = bpr->dstats.kills[DSTAT_LEVEL] - bpr->dstats.suicides[DSTAT_LEVEL]; - return (ascore=0 && compare_slots(SortedPlayers[j],t); j--){ - SortedPlayers[j+1] = SortedPlayers[j]; - } - // insert - SortedPlayers[j+1] = t; - } - - //Now fill in the final structure of sorted names - int TeamCount[MAX_TEAMS]; - int team; - for(i=0;iGetPlayerRecord(slot); - if(pr && pr->state!=STATE_EMPTY){ - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue;//dedicated server - - team = (pr->state==STATE_INGAME)?dPlayers[pr->pnum].team:pr->team; - SortedPLRPlayers[team][TeamCount[team]] = slot; - TeamCount[team]++; - } - } - for(i=0;iOnPLRInit(); -} - -void OnPLRInterval(void) -{ - DMFCBase->OnPLRInterval(); - - int TeamCol = 35; - int NameCol = 190; - int KillsCol = 330; - int DeathsCol = 380; - int SuicidesCol = 430; - int y = 40; - int slot; - player_record *pr; - - DLLgrtext_SetFont((DMFCBase->GetGameFontTranslateArray())[SMALL_UI_FONT_INDEX]); - int height = DLLgrfont_GetHeight((DMFCBase->GetGameFontTranslateArray())[SMALL_UI_FONT_INDEX]) + 1; - - //print out header - DLLgrtext_SetColor(GR_RGB(255,255,150)); - DLLgrtext_Printf(NameCol,y,TXT_PILOT); - DLLgrtext_Printf(KillsCol,y,TXT_KILLS); - DLLgrtext_Printf(DeathsCol,y,TXT_DEATHS); - DLLgrtext_Printf(SuicidesCol,y,TXT_SUICIDES); - y+=height; - bool has_members; - bool doing_connected = true; - -do_disconnected_folk: - - - for(int team=0;teamWasPlayerInGameAtLevelEnd(SortedPLRPlayers[team][temp_idx]); - if(pnum==-1) - { - show_team_label = true; - break; - } - temp_idx++; - } - }else - { - show_team_label = true; - } - - if(show_team_label){ - //is there anyone on this team? - DLLgrtext_SetColor(DMFCBase->GetTeamColor(team)); - DLLgrtext_Printf(TeamCol,y,TXT_TEAMSCORE,DMFCBase->GetTeamString(team),TeamScore[team]); - } - has_members = false; - - for(int index=0;indexGetPlayerRecord(slot); - if(pr && pr->state!=STATE_EMPTY){ - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue;//dedicated server - - int pnum=DMFCBase->WasPlayerInGameAtLevelEnd(slot); - - if( (doing_connected && pnum==-1) || - (!doing_connected && pnum!=-1) ) - continue;//we're not handling them right now - - if(pnum!=-1) - { - DLLgrtext_SetColor(DMFCBase->GetTeamColor(team)); - }else - { - DLLgrtext_SetColor(GR_RGB(128,128,128)); - } - - //valid player - DLLgrtext_Printf(NameCol,y,"%s %d[%d]",pr->callsign,pr->dstats.kills[DSTAT_LEVEL]-pr->dstats.suicides[DSTAT_LEVEL],pr->dstats.kills[DSTAT_OVERALL]-pr->dstats.suicides[DSTAT_OVERALL]); - DLLgrtext_Printf(KillsCol,y,"%d[%d]",pr->dstats.kills[DSTAT_LEVEL],pr->dstats.kills[DSTAT_OVERALL]); - DLLgrtext_Printf(DeathsCol,y,"%d[%d]",pr->dstats.deaths[DSTAT_LEVEL],pr->dstats.deaths[DSTAT_OVERALL]); - DLLgrtext_Printf(SuicidesCol,y,"%d[%d]",pr->dstats.suicides[DSTAT_LEVEL],pr->dstats.suicides[DSTAT_OVERALL]); - y+=height; - has_members = true; - - if(y>=440) - goto quick_exit; - } - }//end for - //on to the next team - if(!has_members) - y+=height; - - if(y>=440) - goto quick_exit; - - }//end for - - if(doing_connected) - { - doing_connected = false; - goto do_disconnected_folk; - } - -quick_exit:; - -} - -void SaveStatsToFile(char *filename) -{ - CFILE *file; - DLLOpenCFILE(&file,filename,"wt"); - if(!file){ - DLLmprintf((0,"Unable to open output file\n")); - return; - } - - //write out game stats - #define BUFSIZE 150 - char buffer[BUFSIZE]; - char tempbuffer[25]; - int sortedslots[MAX_PLAYER_RECORDS]; - player_record *pr,*dpr; - tPInfoStat stat; - int count,length,p; - - //sort the stats - DMFCBase->GetSortedPlayerSlots(sortedslots,MAX_PLAYER_RECORDS); - count = 1; - - sprintf(buffer,TXT_SAVESTATSA,(DMFCBase->GetNetgameInfo())->name,(DMFCBase->GetCurrentMission())->cur_level); - DLLcf_WriteString(file,buffer); - - for(p=0;pGetTeamString(team_i)); - memcpy(&buffer[0],tempbuffer,strlen(tempbuffer)); - sprintf(tempbuffer,"[%d]",TeamScore[team_i]); - memcpy(&buffer[20],tempbuffer,strlen(tempbuffer)); - buffer[20 + strlen(tempbuffer)] = '\0'; - DLLcf_WriteString(file,buffer); - } - - //Write team members - DLLcf_WriteString(file,""); //blank line - for(int t=0;tGetTeamString(team_i)); - strcat(buffer,":"); - DLLcf_WriteString(file,buffer); - - for(p=0;pGetPlayerRecord(sortedslots[p]); - if( pr && pr->state!=STATE_EMPTY) { - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue;//skip dedicated server - - if (pr->team == team_i) { //Check if current team - sprintf(buffer," %s",pr->callsign); - DLLcf_WriteString(file,buffer); - } - } - } - } - DLLcf_WriteString(file,""); //blank line - - sprintf(buffer,TXT_SAVESTATSB); - DLLcf_WriteString(file,buffer); - - sprintf(buffer,TXT_SAVESTATSC); - DLLcf_WriteString(file,buffer); - sprintf(buffer,"-----------------------------------------------------------------------------"); - DLLcf_WriteString(file,buffer); - - - for(p=0;pGetPlayerRecord(sortedslots[p]); - if( pr && pr->state!=STATE_EMPTY) { - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue;//skip dedicated server - - memset(buffer,' ',BUFSIZE); - - sprintf(tempbuffer,"%d)",count); - memcpy(&buffer[0],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%s%s",(pr->state==STATE_INGAME)?"":"*",pr->callsign); - memcpy(&buffer[5],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d[%d]",pr->dstats.kills[DSTAT_LEVEL]-pr->dstats.suicides[DSTAT_LEVEL],pr->dstats.kills[DSTAT_OVERALL]-pr->dstats.suicides[DSTAT_OVERALL]); - memcpy(&buffer[34],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d[%d]",pr->dstats.kills[DSTAT_LEVEL],pr->dstats.kills[DSTAT_OVERALL]); - memcpy(&buffer[46],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d[%d]",pr->dstats.deaths[DSTAT_LEVEL],pr->dstats.deaths[DSTAT_OVERALL]); - memcpy(&buffer[58],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d[%d]",pr->dstats.suicides[DSTAT_LEVEL],pr->dstats.suicides[DSTAT_OVERALL]); - memcpy(&buffer[69],tempbuffer,strlen(tempbuffer)); - - int pos; - pos = 69 + strlen(tempbuffer) + 1; - if(posGetPlayerRecord(p); - if( pr && pr->state!=STATE_EMPTY) { - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue;//skip dedicated server - - //Write out header - sprintf(buffer,"%d) %s%s",count,(pr->state==STATE_INGAME)?"":"*",pr->callsign); - DLLcf_WriteString(file,buffer); - length = strlen(buffer); - memset(buffer,'=',length); - buffer[length] = '\0'; - DLLcf_WriteString(file,buffer); - - //time in game - sprintf(buffer,TXT_TIMEINGAME,DMFCBase->GetTimeString(DMFCBase->GetTimeInGame(p))); - DLLcf_WriteString(file,buffer); - - if(DMFCBase->FindPInfoStatFirst(p,&stat)){ - sprintf(buffer,TXT_SAVESTATSE); - DLLcf_WriteString(file,buffer); - - if(stat.slot!=p){ - memset(buffer,' ',BUFSIZE); - dpr = DMFCBase->GetPlayerRecord(stat.slot); - int pos; - - if(dpr) - { - sprintf(tempbuffer,"%s",dpr->callsign); - memcpy(buffer,tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d",stat.kills); - memcpy(&buffer[30],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d",stat.deaths); - memcpy(&buffer[40],tempbuffer,strlen(tempbuffer)); - - pos = 40 + strlen(tempbuffer) + 1; - if(posFindPInfoStatNext(&stat)){ - if(stat.slot!=p){ - int pos; - memset(buffer,' ',BUFSIZE); - dpr = DMFCBase->GetPlayerRecord(stat.slot); - - if(dpr) - { - sprintf(tempbuffer,"%s",dpr->callsign); - memcpy(buffer,tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d",stat.kills); - memcpy(&buffer[30],tempbuffer,strlen(tempbuffer)); - - sprintf(tempbuffer,"%d",stat.deaths); - memcpy(&buffer[40],tempbuffer,strlen(tempbuffer)); - - pos = 40 + strlen(tempbuffer) + 1; - if(posFindPInfoStatClose(); - DLLcf_WriteString(file,""); //skip a line - count++; - } - } - - //done writing stats - DLLcfclose(file); - DLLAddHUDMessage(TXT_STATSSAVED); -} - -#define ROOTFILENAME "Team Anarchy" -void OnSaveStatsToFile(void) -{ - char filename[256]; - DMFCBase->GenerateStatFilename(filename,ROOTFILENAME,false); - SaveStatsToFile(filename); -} - -void OnLevelEndSaveStatsToFile(void) -{ - char filename[256]; - DMFCBase->GenerateStatFilename(filename,ROOTFILENAME,true); - SaveStatsToFile(filename); -} - -void OnDisconnectSaveStatsToFile(void) -{ - char filename[256]; - DMFCBase->GenerateStatFilename(filename,ROOTFILENAME,false); - SaveStatsToFile(filename); -} - -//Handles when we get a new player packet -void GetGameStartPacket(ubyte *data) -{ - //get the team scores - DLLmprintf((0,"Receiving Team Scores from server\n")); - int count = 0,i; - for(i=0;iStartPacket(data,SPID_NEWPLAYER,&count); - - //add the team scores - int i; - for(i=0;iSendPacket(data,count,pnum); -} - -void DisplayHUDScores(struct tHUDItem *hitem) -{ - if(display_my_welcome) - { - DisplayWelcomeMessage(DMFCBase->GetPlayerNum()); - display_my_welcome = false; - } - - if(DisplayScoreScreen) - return; - - int height = DLLgrfont_GetHeight((DMFCBase->GetGameFontTranslateArray())[HUD_FONT_INDEX]) + 3; - int y = (DMFCBase->GetGameWindowH()/2) - ((height*NUM_TEAMS)/2); - int x = 520; - ubyte alpha = DMFCBase->ConvertHUDAlpha((ubyte)((DisplayScoreScreen)?128:255)); - int team; - -// char name[30]; - - //determine coordinates to use here - //we'll use a virtual width of 85 pixels on a 640x480 screen - //so first determine the new width - int name_width = 100.0f * DMFCBase->GetHudAspectX(); - int score_width = DLLgrtext_GetTextLineWidth("888"); - int name_x = DMFCBase->GetGameWindowW() - name_width - score_width - 10; - int score_x = DMFCBase->GetGameWindowW() - score_width - 5; - - team = DMFCBase->GetMyTeam(); - DLLRenderHUDText(DMFCBase->GetTeamColor(team),255,0,x,0,TXT_TEAM,DMFCBase->GetTeamString(team)); - int num_players = 0; - - for(int i=0;iCheckPlayerNum(q) && dPlayers[q].team==team && !DMFCBase->IsPlayerDedicatedServer(q)) - num_players++; - } - - if(team==DMFCBase->GetMyTeam()) - { - if(Highlight_bmp>BAD_BITMAP_HANDLE){ - //draw the highlite bar in the background - DLLrend_SetAlphaValue(alpha*0.50f); - DLLrend_SetAlphaValue(alpha); - DLLrend_SetZBufferState (0); - DLLrend_SetTextureType (TT_LINEAR); - DLLrend_SetLighting (LS_NONE); - DLLrend_SetAlphaType (AT_CONSTANT_TEXTURE); - - DLLrend_DrawScaledBitmap(name_x-2,y-2,score_x+score_width+2,y+height-1,Highlight_bmp,0,0,1,1,1.0); - DLLrend_SetZBufferState (1); - } - } - - char team_name[MAX_TEAMNAME_LEN+5]; - sprintf(team_name,"[%d]%s",num_players,DMFCBase->GetTeamString(team)); - DMFCBase->ClipString(name_width,team_name,true); - - DLLgrtext_SetAlpha(alpha); - DLLgrtext_SetColor(DMFCBase->GetTeamColor(team)); - DLLgrtext_Printf(name_x,y,team_name); - DLLgrtext_Printf(score_x,y,"%d",TeamScore[team]); - -// sprintf(name,TXT_TEAMSCORE,DMFCBase->GetTeamString(team)); -// DMFCBase->ClipString(name_width,name,true); - - y+=height; - } -} - - -// insert sort -#define compGT(a,b) (a < b) -void SortTeamScores(int *sortedindex,int *scores) -{ - int t; - int i, j; - - //copy scores into scoreinfo array - for(i=0;i=0 && compGT(scores[sortedindex[j]],scores[t]); j--) - { - sortedindex[j+1] = sortedindex[j]; - } - - /* insert */ - sortedindex[j+1] = t; - } -} - -void DisplayWelcomeMessage(int player_num) -{ - char name_buffer[64]; - strcpy(name_buffer,(DMFCBase->GetPlayers())[player_num].callsign); - - if(player_num==DMFCBase->GetPlayerNum()) - { - int team = DMFCBase->GetMyTeam(); - if(team==-1) - return; - - DLLAddHUDMessage(TXT_WELCOME,name_buffer); - DLLAddColoredHUDMessage(DMFCBase->GetTeamColor(team),TXT_TEAMJOINMSG,DMFCBase->GetTeamString(team)); - } - else - { - int team = dPlayers[player_num].team; - if(team==-1) - return; - - DLLAddColoredHUDMessage(DMFCBase->GetTeamColor(team),TXT_JOINED,name_buffer,DMFCBase->GetTeamString(team)); - } -} - -void OnPrintScores(int level) -{ - char buffer[256]; - char name[70]; - int t,i; - int pos[6]; - int len[6]; - - for(i=0;iGetTeamString(i),TeamScore[i]); - DPrintf(buffer); - } - - memset(buffer,' ',256); - pos[0] = 0; t = len[0] = 30; //give ample room for pilot name - pos[1] = pos[0] + t + 1; t = len[1] = strlen(TXT_POINTS); - pos[2] = pos[1] + t + 1; t = len[2] = strlen(TXT_KILLS_SHORT); - pos[3] = pos[2] + t + 1; t = len[3] = strlen(TXT_DEATHS_SHORT); - pos[4] = pos[3] + t + 1; t = len[4] = strlen(TXT_SUICIDES_SHORT); - pos[5] = pos[4] + t + 1; t = len[5] = strlen(TXT_PING); - - memcpy(&buffer[pos[0]],TXT_PILOT,strlen(TXT_PILOT)); - memcpy(&buffer[pos[1]],TXT_POINTS,len[1]); - memcpy(&buffer[pos[2]],TXT_KILLS_SHORT,len[2]); - memcpy(&buffer[pos[3]],TXT_DEATHS_SHORT,len[3]); - memcpy(&buffer[pos[4]],TXT_SUICIDES_SHORT,len[4]); - memcpy(&buffer[pos[5]],TXT_PING,len[5]); - buffer[pos[5]+len[5]+1] = '\n'; - buffer[pos[5]+len[5]+2] = '\0'; - DPrintf(buffer); - - int slot; - player_record *pr; - int pcount; - - if(level<0 || level>=MAX_PLAYER_RECORDS) - pcount = MAX_PLAYER_RECORDS; - else - pcount = level; - - netplayer *dNetPlayers = DMFCBase->GetNetPlayers(); - - int sortedplayers[MAX_PLAYER_RECORDS]; - DMFCBase->GetSortedPlayerSlots(sortedplayers,MAX_PLAYER_RECORDS); - - for(i=0;iGetPlayerRecord(slot); - if((pr)&&(pr->state!=STATE_EMPTY)){ - - if(DMFCBase->IsPlayerDedicatedServer(pr)) - continue; //skip dedicated server - - sprintf(name,"%s%s: %.8s",(pr->state==STATE_DISCONNECTED)?"*":"",pr->callsign,DMFCBase->GetTeamString(pr->team)); - name[29] = '\0'; - - memset(buffer,' ',256); - t = strlen(name); memcpy(&buffer[pos[0]],name,(tdstats.kills[DSTAT_LEVEL]-pr->dstats.suicides[DSTAT_LEVEL]); - t = strlen(name); memcpy(&buffer[pos[1]],name,(tdstats.kills[DSTAT_LEVEL]); - t = strlen(name); memcpy(&buffer[pos[2]],name,(tdstats.deaths[DSTAT_LEVEL]); - t = strlen(name); memcpy(&buffer[pos[3]],name,(tdstats.suicides[DSTAT_LEVEL]); - t = strlen(name); memcpy(&buffer[pos[4]],name,(tstate==STATE_INGAME) - sprintf(name,"%.0f",dNetPlayers[pr->pnum].ping_time*1000.0f); - else - strcpy(name,"---"); - t = strlen(name); memcpy(&buffer[pos[5]],name,(t