Remove force editor. Nice widget, but nobody knew what to do with it.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2159 4a71c877-e1ca-e34f-864e-861f7616d084
master
Per Inge Mathisen 2007-07-21 17:22:30 +00:00
parent f9a3adeaba
commit d94d7ea9ea
7 changed files with 17 additions and 1166 deletions

View File

@ -234,10 +234,6 @@ void changeTitleMode(tMode mode)
case PROTOCOL:
startConnectionScreen();
break;
case FORCESELECT:
bUsingKeyboard = FALSE;
startForceSelect();
break;
case MULTIOPTION:
bUsingKeyboard = FALSE;
if(oldMode == MULTILIMIT)
@ -564,8 +560,7 @@ BOOL startMultiPlayerMenu(void)
addTextButton(FRONTEND_HOST, FRONTEND_POS2X,FRONTEND_POS2Y, _("Host Game"),FALSE,FALSE);
addTextButton(FRONTEND_JOIN, FRONTEND_POS3X,FRONTEND_POS3Y, _("Join Game"),FALSE,FALSE);
addTextButton(FRONTEND_FORCEEDIT,FRONTEND_POS4X,FRONTEND_POS4Y, _("Force Editor"),FALSE,FALSE);
addTextButton(FRONTEND_SKIRMISH, FRONTEND_POS5X,FRONTEND_POS5Y, _("One Player Skirmish"),FALSE,FALSE);
addTextButton(FRONTEND_SKIRMISH, FRONTEND_POS4X,FRONTEND_POS4Y, _("One Player Skirmish"),FALSE,FALSE);
addMultiBut(psWScreen,FRONTEND_BOTFORM,FRONTEND_QUIT,10,10,30,29, P_("menu", "Return"),IMAGE_RETURN,IMAGE_RETURN_HI,TRUE);
@ -591,40 +586,6 @@ BOOL runMultiPlayerMenu(void)
ingame.bHostSetup = FALSE;
changeTitleMode(PROTOCOL);
break;
case FRONTEND_FORCEEDIT:
if(!bForceEditorLoaded)
{
initLoadingScreen( TRUE );
/* if (!resLoad("wrf/forcedit.wrf", 500,
fileLoadBuffer, FILE_LOAD_BUFFER_SIZE))
//need the object heaps to have been set up before loading
{
return FALSE;
}
*/
if (!resLoad("wrf/piestats.wrf", 501,
fileLoadBuffer, FILE_LOAD_BUFFER_SIZE))
//need the object heaps to have been set up before loading
{
return FALSE;
}
if (!resLoad("wrf/forcedit2.wrf", 502,
fileLoadBuffer, FILE_LOAD_BUFFER_SIZE))
//need the object heaps to have been set up before loading
{
return FALSE;
}
bForceEditorLoaded = TRUE;
closeLoadingScreen();
}
changeTitleMode(FORCESELECT);
return TRUE;//skip draw.
break;
case FRONTEND_SKIRMISH:
ingame.bHostSetup = TRUE;

View File

@ -88,7 +88,6 @@
// ////////////////////////////////////////////////////////////////////////////
// vars
extern char MultiForcesPath[255];
extern char MultiCustomMapsPath[255];
extern char MultiPlayersPath[255];
@ -126,8 +125,6 @@ static UBYTE curWhite = 0;
static UDWORD hideTime=0;
#define FORCEEDIT_POWER 1200
#define DEFAULTCAMPAIGNMAP "Rush"
#define DEFAULTSKIRMISHMAP "Sk-Rush"
@ -149,7 +146,6 @@ void displayRemoteGame (WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDW
void displayPlayer (WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD *pColours);
void displayTeamChooser (WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD *pColours);
void displayMultiEditBox (WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD *pColours);
void displayForceDroid (WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD *pColours);
void setLockedTeamsMode (void);
// find games
@ -191,10 +187,6 @@ static BOOL safeToUseColour (UDWORD player,UDWORD col);
BOOL chooseColour (UDWORD);
BOOL recvColourRequest (NETMSG *pMsg);
// Force selection functions
static void AvailableForces (void); // draw available templates
static void CurrentForce (void); // draw the current force
// ////////////////////////////////////////////////////////////////////////////
// map previews..
@ -758,11 +750,10 @@ static void addGameOptions(BOOL bRedo)
addMultiEditBox(MULTIOP_OPTIONS,MULTIOP_GNAME,MCOL0,MROW2,_("Select Game Name"), game.name ,IMAGE_EDIT_GAME,MULTIOP_GNAME_ICON);
addMultiEditBox(MULTIOP_OPTIONS,MULTIOP_MAP ,MCOL0,MROW3,_("Select Map"), game.map ,IMAGE_EDIT_MAP,MULTIOP_MAP_ICON);
// buttons.
// game type
addBlueForm(MULTIOP_OPTIONS,MULTIOP_GAMETYPE,_("Game"),MCOL0,MROW5,MULTIOP_BLUEFORMW,27);
addBlueForm(MULTIOP_OPTIONS,MULTIOP_GAMETYPE,_("Game"),MCOL0,MROW4,MULTIOP_BLUEFORMW,27);
addMultiBut(psWScreen,MULTIOP_GAMETYPE,MULTIOP_CAMPAIGN,MCOL1, 2 , MULTIOP_BUTW,MULTIOP_BUTH,
_("Mayhem"), IMAGE_ARENA, IMAGE_ARENA_HI, TRUE); //camp
addMultiBut(psWScreen,MULTIOP_GAMETYPE,MULTIOP_SKIRMISH,MCOL2, 2 , MULTIOP_BUTW,MULTIOP_BUTH,
@ -788,10 +779,9 @@ static void addGameOptions(BOOL bRedo)
//just display the game options.
addMultiEditBox(MULTIOP_OPTIONS,MULTIOP_PNAME,MCOL0,MROW1, _("Select Player Name"),(char*) sPlayer,IMAGE_EDIT_PLAYER,MULTIOP_PNAME_ICON);
addMultiEditBox(MULTIOP_OPTIONS,MULTIOP_FNAME,MCOL0,MROW4, _("Select Force"), sForceName,IMAGE_EDIT_FORCE,MULTIOP_FNAME_ICON);
// Fog type
addBlueForm(MULTIOP_OPTIONS,MULTIOP_FOG,_("Fog"),MCOL0,MROW6,MULTIOP_BLUEFORMW,27);
addBlueForm(MULTIOP_OPTIONS,MULTIOP_FOG,_("Fog"),MCOL0,MROW5,MULTIOP_BLUEFORMW,27);
addMultiBut(psWScreen,MULTIOP_FOG,MULTIOP_FOG_ON ,MCOL1,2,MULTIOP_BUTW,MULTIOP_BUTH, _("Fog Of War"), IMAGE_FOG_OFF, IMAGE_FOG_OFF_HI,TRUE);//black stuff
addMultiBut(psWScreen,MULTIOP_FOG,MULTIOP_FOG_OFF,MCOL2,2,MULTIOP_BUTW,MULTIOP_BUTH, _("Distance Fog"),IMAGE_FOG_ON,IMAGE_FOG_ON_HI,TRUE);
@ -807,7 +797,7 @@ static void addGameOptions(BOOL bRedo)
if (game.type != CAMPAIGN)
{
// alliances
addBlueForm(MULTIOP_OPTIONS, MULTIOP_ALLIANCES, _("Alliances"), MCOL0, MROW8, MULTIOP_BLUEFORMW, 27);
addBlueForm(MULTIOP_OPTIONS, MULTIOP_ALLIANCES, _("Alliances"), MCOL0, MROW6, MULTIOP_BLUEFORMW, 27);
addMultiBut(psWScreen,MULTIOP_ALLIANCES,MULTIOP_ALLIANCE_N,MCOL1,2,MULTIOP_BUTW,MULTIOP_BUTH,
_("No Alliances"),IMAGE_NOALLI,IMAGE_NOALLI_HI,TRUE);
@ -836,22 +826,16 @@ static void addGameOptions(BOOL bRedo)
}
}
if (game.type == SKIRMISH || game.base != CAMP_WALLS )
{
widgSetButtonState(psWScreen, MULTIOP_FNAME,WEDBS_DISABLE); // disable force buts
widgSetButtonState(psWScreen, MULTIOP_FNAME_ICON,WBUT_DISABLE);
}
if(game.type == CAMPAIGN || game.type == SKIRMISH)
{
// pow levels
if (game.type == CAMPAIGN)
{
addBlueForm(MULTIOP_OPTIONS,MULTIOP_POWER,_("Power"),MCOL0,MROW8,MULTIOP_BLUEFORMW,27);
addBlueForm(MULTIOP_OPTIONS,MULTIOP_POWER,_("Power"),MCOL0,MROW6,MULTIOP_BLUEFORMW,27);
}
else
{
addBlueForm(MULTIOP_OPTIONS,MULTIOP_POWER,_("Power"),MCOL0,MROW9,MULTIOP_BLUEFORMW,27);
addBlueForm(MULTIOP_OPTIONS,MULTIOP_POWER,_("Power"),MCOL0,MROW7,MULTIOP_BLUEFORMW,27);
}
addMultiBut(psWScreen,MULTIOP_POWER,MULTIOP_POWLEV_LOW,MCOL1,2,MULTIOP_BUTW,MULTIOP_BUTH,
_("Low Power Levels"),IMAGE_POWLO,IMAGE_POWLO_HI,TRUE);
@ -876,7 +860,14 @@ static void addGameOptions(BOOL bRedo)
}
//type clean/base/defence
addBlueForm(MULTIOP_OPTIONS,MULTIOP_BASETYPE,_("Base"),MCOL0,MROW7,MULTIOP_BLUEFORMW,27);
if (game.type == CAMPAIGN)
{
addBlueForm(MULTIOP_OPTIONS, MULTIOP_BASETYPE, _("Base"), MCOL0, MROW7, MULTIOP_BLUEFORMW, 27);
}
else
{
addBlueForm(MULTIOP_OPTIONS, MULTIOP_BASETYPE, _("Base"), MCOL0, MROW8, MULTIOP_BLUEFORMW, 27);
}
addMultiBut(psWScreen,MULTIOP_BASETYPE,MULTIOP_CLEAN,MCOL1,2,MULTIOP_BUTW,MULTIOP_BUTH,
_("Start with No Bases"), IMAGE_NOBASE,IMAGE_NOBASE_HI,TRUE);
addMultiBut(psWScreen,MULTIOP_BASETYPE,MULTIOP_BASE,MCOL2,2,MULTIOP_BUTW,MULTIOP_BUTH,
@ -1483,13 +1474,6 @@ static void disableMultiButs(void)
widgSetButtonState(psWScreen,MULTIOP_GNAME,WEDBS_DISABLE);
widgSetButtonState(psWScreen,MULTIOP_MAP,WEDBS_DISABLE);
// force choice.
if (game.type == SKIRMISH || game.base != CAMP_WALLS )
{
widgSetButtonState(psWScreen,MULTIOP_FNAME_ICON,WBUT_DISABLE);
widgSetButtonState(psWScreen,MULTIOP_FNAME,WEDBS_DISABLE);
}
if(game.type != CAMPAIGN) widgSetButtonState(psWScreen, MULTIOP_CAMPAIGN, WBUT_DISABLE);
if(game.type != SKIRMISH) widgSetButtonState(psWScreen, MULTIOP_SKIRMISH, WBUT_DISABLE);
@ -1710,39 +1694,6 @@ static void processMultiopWidgets(UDWORD id)
}
break;
/* case MULTIOP_TECH_LOW:
widgSetButtonState(psWScreen, MULTIOP_TECH_LOW,WBUT_LOCK);
widgSetButtonState(psWScreen, MULTIOP_TECH_MED,0);
widgSetButtonState(psWScreen, MULTIOP_TECH_HI ,0);
game.techLevel = 1;
if(bHosted)
{
sendOptions(0,0);
}
break;
case MULTIOP_TECH_MED:
widgSetButtonState(psWScreen, MULTIOP_TECH_LOW,0);
widgSetButtonState(psWScreen, MULTIOP_TECH_MED,WBUT_LOCK);
widgSetButtonState(psWScreen, MULTIOP_TECH_HI ,0);
game.techLevel = 2;
if(bHosted)
{
sendOptions(0,0);
}
break;
case MULTIOP_TECH_HI:
widgSetButtonState(psWScreen, MULTIOP_TECH_LOW,0);
widgSetButtonState(psWScreen, MULTIOP_TECH_MED,0);
widgSetButtonState(psWScreen, MULTIOP_TECH_HI ,WBUT_LOCK);
game.techLevel = 3;
if(bHosted)
{
sendOptions(0,0);
}
break;
*/
case MULTIOP_CLEAN:
game.base = CAMP_CLEAN;
addGameOptions(FALSE);
@ -1893,17 +1844,6 @@ static void processMultiopWidgets(UDWORD id)
changeTitleMode(MULTILIMIT);
break;
case MULTIOP_FNAME:
strcpy(sForceName,widgGetString(psWScreen, MULTIOP_FNAME));
removeWildcards(sForceName);
break;
case MULTIOP_FNAME_ICON:
widgDelete(psWScreen,MULTIOP_PLAYERS);
widgDelete(psWScreen,FRONTEND_SIDETEXT2); // del text too,
addMultiRequest(MultiForcesPath, ".for", MULTIOP_FNAME, 0, 0);
break;
case MULTIOP_PNAME:
strcpy(sPlayer,widgGetString(psWScreen, MULTIOP_PNAME));
@ -1936,16 +1876,11 @@ static void processMultiopWidgets(UDWORD id)
break;
case MULTIOP_HOST:
if(game.type != SKIRMISH)
{
strcpy(sForceName,widgGetString(psWScreen, MULTIOP_FNAME));
}
strcpy((char*)game.name,widgGetString(psWScreen, MULTIOP_GNAME)); // game name
strcpy((char*)sPlayer,widgGetString(psWScreen, MULTIOP_PNAME)); // pname
strcpy((char*)game.map,widgGetString(psWScreen, MULTIOP_MAP)); // add the name
removeWildcards((char*)sPlayer);
removeWildcards(sForceName);
hostCampaign((char*)game.name,(char*)sPlayer);
bHosted = TRUE;
@ -2006,8 +1941,6 @@ static void processMultiopWidgets(UDWORD id)
case CON_OK:
decideWRF(); // set up swrf & game.map
strcpy(sForceName,widgGetString(psWScreen, MULTIOP_FNAME));
removeWildcards(sForceName);
bMultiPlayer = TRUE;
if(NetPlay.bHost)
@ -2256,13 +2189,6 @@ void frontendMultiMessages(void)
{
decideWRF();
if(game.type != SKIRMISH) // force stuff.
{
strcpy(sForceName,widgGetString(psWScreen, MULTIOP_FNAME));
removeWildcards(sForceName);
}
// set the fog correctly..
setRevealStatus(game.fog);
war_SetFog(!game.fog);
@ -2421,10 +2347,6 @@ void runMultiOptions(void)
setMultiStats(NetPlay.dpidPlayer,playerStats,FALSE);
setMultiStats(NetPlay.dpidPlayer,playerStats,TRUE);
break;
case MULTIOP_FNAME:
strcpy(sForceName,sTemp);
widgSetString(psWScreen,MULTIOP_FNAME,sTemp);
break;
case MULTIOP_MAP:
strcpy(game.map,sTemp);
game.maxPlayers =(UBYTE) value;
@ -2558,463 +2480,6 @@ BOOL startMultiOptions(BOOL bReenter)
}
// ////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////
// Force Select Screen.
// ////////////////////////////////////////////////////////////////////////////
static void CurrentForce(void)
{
W_FORMINIT sFormInit;
UDWORD numButtons, butPerForm;
UDWORD i;
FORCE_MEMBER *pF;
W_FORMINIT sButInit;
char aButText[6]; //???
SDWORD BufferID;
widgDelete(psWScreen,FORCE_CURRENT);
widgDelete(psWScreen,FRONTEND_SIDETEXT3);
ClearObjectBuffers();
/* Count the number of minor tabs needed for the template form
* Also need one for the new template button */
numButtons = 0;
for(pF = Force.pMembers; pF; pF= pF->psNext)
{
numButtons++;
}
/* Calculate how many buttons will go on a single form */
butPerForm = ((FORCE_CURRENTWIDTH - 0 - 2) /
(OBJ_BUTWIDTH +2)) *
((FORCE_CURRENTHEIGHT - 0- 2) /
(OBJ_BUTHEIGHT+ 2));
/* add a form to place the tabbed form on */
memset(&sFormInit, 0, sizeof(W_FORMINIT));
sFormInit.formID = FRONTEND_BACKDROP;
sFormInit.id = FORCE_CURRENT;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = FORCE_CURRENTX;
sFormInit.y = FORCE_CURRENTY;
sFormInit.width = FORCE_CURRENTWIDTH;
sFormInit.height = FORCE_CURRENTHEIGHT+4;
sFormInit.pDisplay = intDisplayPlainForm;
widgAddForm(psWScreen, &sFormInit);
addSideText(FRONTEND_SIDETEXT3,FORCE_CURRENTX-1,FORCE_CURRENTY,_("FORCE"));
/* Add the design templates form */
memset(&sFormInit, 0, sizeof(W_FORMINIT));
sFormInit.formID = FORCE_CURRENT;
sFormInit.id = FORCE_CURRENTFORM;
sFormInit.style = WFORM_TABBED;
sFormInit.x = 2;
sFormInit.y = 2;
sFormInit.width = FORCE_CURRENTWIDTH;
sFormInit.height = FORCE_CURRENTHEIGHT;
sFormInit.numMajor = numForms(numButtons, butPerForm);
sFormInit.majorPos = WFORM_TABTOP;
sFormInit.minorPos = WFORM_TABNONE;
sFormInit.majorSize = OBJ_TABWIDTH;
sFormInit.majorOffset = OBJ_TABOFFSET;
sFormInit.tabVertOffset = (OBJ_TABHEIGHT/2); //(DES_TAB_HEIGHT/2)+2;
sFormInit.tabMajorThickness = OBJ_TABHEIGHT;
sFormInit.pFormDisplay = intDisplayObjectForm;
sFormInit.pUserData = (void*)&StandardTab;
sFormInit.pTabDisplay = intDisplayTab;
for (i=0; i< sFormInit.numMajor; i++)
{
sFormInit.aNumMinors[i] = 1;
}
widgAddForm(psWScreen, &sFormInit);
/* Put the buttons on it */
memset(aButText, 0, 6); //??
memset(&sButInit, 0, sizeof(W_BUTINIT));
/* Set up the button struct */
sButInit.formID = FORCE_CURRENTFORM;
sButInit.id = FORCE_FORCE;
sButInit.style = WFORM_CLICKABLE;
sButInit.x = 2;
sButInit.y = 2;
sButInit.width = OBJ_BUTWIDTH;
sButInit.height = OBJ_BUTHEIGHT;
for(pF = Force.pMembers;pF; pF=pF->psNext)
{
/* Set the tip and add the button */
strncpy(aButText, getTemplateName(pF->pTempl), 5);
sButInit.pTip = getTemplateName(pF->pTempl);
BufferID = GetObjectBuffer();
ASSERT( BufferID >= 0,"Unable to aquire Obj Buffer." );
RENDERBUTTON_INUSE(&ObjectBuffers[BufferID]);
ObjectBuffers[BufferID].Data = (void*)pF->pTempl;
sButInit.pUserData = (void*)&ObjectBuffers[BufferID];
sButInit.pDisplay = intDisplayTemplateButton;
widgAddForm(psWScreen, &sButInit);
/* Update the init struct for the next button */
sButInit.id += 1;
sButInit.x = (SWORD)(sButInit.x + OBJ_BUTWIDTH + 2);
if (sButInit.x + OBJ_BUTWIDTH + 2 > FORCE_CURRENTWIDTH)
{
sButInit.x = 2;
sButInit.y = (SWORD)(sButInit.y + OBJ_BUTHEIGHT + 2);
}
if (sButInit.y + OBJ_BUTHEIGHT + 2 > FORCE_CURRENTHEIGHT)
{
sButInit.y = 2;
sButInit.majorID += 1;
}
}
}
//////////////////////////////////
static void AvailableForces(void)
{
W_FORMINIT sFormInit;
DROID_TEMPLATE *psTempl;
UDWORD numButtons, butPerForm;
UDWORD i;
/* init template list */
memset( apsTemplateList, 0, sizeof(DROID_TEMPLATE*) * MAXTEMPLATES );
numButtons = 0;
psTempl = apsDroidTemplates[FORCEEDITPLAYER];
while ((psTempl != NULL) && (numButtons < MAXTEMPLATES))
{
apsTemplateList[numButtons] = psTempl;
/* Count the number of minor tabs needed for the template form */
numButtons++;
/* next template */
psTempl = psTempl->psNext;
}
widgDelete(psWScreen,IDDES_TEMPLBASE);
widgDelete(psWScreen,FRONTEND_SIDETEXT1);
ClearStatBuffers();
/* Calculate how many buttons will go on a single form */
butPerForm = ((FORCE_AVAILABLEWIDTH - 0 - 2) /
(OBJ_BUTWIDTH +2)) *
((FORCE_AVAILABLEHEIGHT - 0- 2) /
(OBJ_BUTHEIGHT+ 2));
/* add a form to place the tabbed form on */
memset(&sFormInit, 0, sizeof(W_FORMINIT));
sFormInit.formID = FRONTEND_BACKDROP;
sFormInit.id = IDDES_TEMPLBASE;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = FORCE_AVAILABLEX;
sFormInit.y = FORCE_AVAILABLEY;
sFormInit.width = FORCE_AVAILABLEWIDTH;
sFormInit.height = FORCE_AVAILABLEHEIGHT+4;
sFormInit.pDisplay = intDisplayPlainForm;
widgAddForm(psWScreen, &sFormInit);
addSideText(FRONTEND_SIDETEXT1,FORCE_AVAILABLEX-1,FORCE_AVAILABLEY,_("TEMPLATES"));
/* Add the design templates form */
memset(&sFormInit, 0, sizeof(W_FORMINIT));
sFormInit.formID = IDDES_TEMPLBASE;
sFormInit.id = IDDES_TEMPLFORM;
sFormInit.style = WFORM_TABBED;
sFormInit.x = 2;
sFormInit.y = 2;
sFormInit.width = FORCE_AVAILABLEWIDTH;
sFormInit.height = FORCE_AVAILABLEHEIGHT;
sFormInit.numMajor = numForms(numButtons, butPerForm);
sFormInit.majorPos = WFORM_TABTOP;
sFormInit.minorPos = WFORM_TABNONE;
sFormInit.majorSize = OBJ_TABWIDTH;
sFormInit.majorOffset = OBJ_TABOFFSET;
sFormInit.tabVertOffset = (OBJ_TABHEIGHT/2);
sFormInit.tabMajorThickness = OBJ_TABHEIGHT;
sFormInit.pFormDisplay = intDisplayObjectForm;
sFormInit.pUserData = (void*)&StandardTab;
sFormInit.pTabDisplay = intDisplayTab;
for (i=0; i< sFormInit.numMajor; i++)
{
sFormInit.aNumMinors[i] = 1;
}
widgAddForm(psWScreen, &sFormInit);
/* Put the buttons on it */
intAddTemplateButtons(IDDES_TEMPLFORM, FORCE_AVAILABLEWIDTH ,
FORCE_AVAILABLEHEIGHT,
OBJ_BUTWIDTH,OBJ_BUTHEIGHT,2,
NULL);
}
// ////////////////////////////////////////////////////////////////////////////
void runForceSelect(void)
{
UDWORD currID,id,i;
DROID_TEMPLATE *psTempl;
UDWORD posx,posy;
FORCE_MEMBER *pF;
char dir[256];
posx = 5;
posy = 5;
processFrontendSnap(FALSE);
if(bLoadSaveUp)
{
if(runLoadSave(FALSE))// check for file name.
{
if(strlen(sRequestResult))
{
debug( LOG_NEVER, "Returned %s", sRequestResult );
if(bRequestLoad)
{
loadForce(sRequestResult);
AvailableForces(); // update force screen..
CurrentForce();
}
else
{
saveForce(sRequestResult,&Force);
AvailableForces(); // update force screen..
CurrentForce();
}
}
}
}
else
{
// MouseOver stuff.
id = widgGetMouseOver(psWScreen);
if (id >=IDDES_TEMPLSTART && id <= IDDES_TEMPLEND)
{
currID = IDDES_TEMPLSTART;
for(psTempl = apsDroidTemplates[selectedPlayer]; psTempl;psTempl = psTempl->psNext)
{
if (currID == id)
{
break;
}
currID ++;
}
intSetShadowPower(calcTemplatePower(psTempl)); //update the power bars
}
else
{
intSetShadowPower(0);
}
id = widgRunScreen(psWScreen); // run the widgets.
if (id >= IDDES_TEMPLSTART && id <= IDDES_TEMPLEND)
{
currID = IDDES_TEMPLSTART;
for(psTempl = apsDroidTemplates[selectedPlayer]; psTempl;psTempl = psTempl->psNext)
{
if (currID == id)
{
break;
}
currID ++;
}
if(!addToForce(psTempl)) // store this droid in force list.
{
widgDisplayScreen(psWScreen);
return;
}
CurrentForce();
}
if((id >= FORCE_FORCE)&&(id <= FORCE_FORCEEND)) // FORCE droid selected
{
pF = Force.pMembers; // dont delete if it's frozen
for(i=0;i<(id-FORCE_FORCE);i++)pF=pF->psNext; // goto that force element;
removeFromForce(id-FORCE_FORCE); //delete it from force.
CurrentForce();
}
switch(id)
{
case CON_CANCEL: // dont continue, return to options
while(Force.pMembers)
{
removeFromForce(0); // delete each force member.
}
selectedPlayer = 0; // just in case.
changeTitleMode(MULTI);
eventReset();
// resReleaseBlockData(500);
resReleaseBlockData(501);
resReleaseBlockData(502);
bForceEditorLoaded = FALSE;
break;
case FORCE_PRESETCLEAR: // clear force
while(Force.pMembers)
{
removeFromForce(0); // delete each force member.
}
AvailableForces(); // update force screen
CurrentForce();
break;
case FORCE_PRESETDEFAULT:
strcpy(dir,"multiplay/forces/default.for");
loadForce(dir);
AvailableForces(); // update force screen
CurrentForce();
break;
case FORCE_LOAD:
addLoadSave(LOAD_FORCE,MultiForcesPath,"for",_("Load Force") );
break;
case FORCE_SAVE:
addLoadSave(SAVE_FORCE,MultiForcesPath,"for",_("Save Force") );
break;
default:
break;
}
}
StartCursorSnap(&InterfaceSnap);
widgDisplayScreen(psWScreen); // show the widgets currently running
if(bLoadSaveUp)
{
displayLoadSave();
}
return;
}
// ////////////////////////////////////////////////////////////////////////////
BOOL startForceSelect(void)
{
W_FORMINIT sFormInit;
W_BARINIT sBarInit;
char dir[256];
DROID_TEMPLATE *psTempl;
copyTemplateSet(DEATHMATCHTEMPLATES,FORCEEDITPLAYER);
initTemplatePoints();
selectedPlayer = FORCEEDITPLAYER;
setPower(selectedPlayer,FORCEEDIT_POWER);
strcpy(dir,"multiplay/forces/default.for"); // start with default force.
if(!loadForce(dir))
{
debug( LOG_NEVER, "Error Loading Force" );
}
addBackdrop();
addTopForm();
// init power profiles.
for(psTempl = apsDroidTemplates[FORCEEDITPLAYER]; psTempl; psTempl = psTempl->psNext)
{
psTempl->powerPoints = calcTemplatePower(psTempl);
}
AvailableForces(); // available forces
CurrentForce(); // current force
memset(&sFormInit, 0, sizeof(W_FORMINIT));
sFormInit.formID = FRONTEND_BACKDROP; // stats box
sFormInit.id = FORCE_STATS;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = FORCE_STATSX;
sFormInit.y = FORCE_STATSY;
sFormInit.width = FORCE_STATSWIDTH;
sFormInit.height = FORCE_STATSHEIGHT;
sFormInit.pDisplay = intDisplayPlainForm;
widgAddForm(psWScreen, &sFormInit);
addSideText(FRONTEND_SIDETEXT2,FORCE_STATSX-1,FORCE_STATSY,_("CONTROL"));
sFormInit.formID = FORCE_STATS; // stats box
sFormInit.id = FORCE_DROID;
sFormInit.style = WFORM_PLAIN;
sFormInit.x = FORCE_DROIDX;
sFormInit.y = FORCE_DROIDY;
sFormInit.width = 100;
sFormInit.height = 100;
sFormInit.pDisplay = displayForceDroid;
// sFormInit.pUserData = (void*)Force->pTempl;
widgAddForm(psWScreen, &sFormInit);
// name/techlevel/powerrequired/powerleft
memset(&sBarInit, 0, sizeof(W_BARINIT)); //power bar
sBarInit.formID = FRONTEND_BACKDROP; //IDPOW_FORM;
sBarInit.id = IDPOW_POWERBAR_T;
sBarInit.style = WBAR_TROUGH;
sBarInit.orientation = WBAR_LEFT;
sBarInit.x = (SWORD)FORCE_POWERX;
sBarInit.y = (SWORD)FORCE_POWERY;
sBarInit.width = POW_BARWIDTH;
sBarInit.height = iV_GetImageHeight(IntImages,IMAGE_PBAR_EMPTY);
sBarInit.sCol.red = POW_CLICKBARMAJORRED;
sBarInit.sCol.green = POW_CLICKBARMAJORGREEN;
sBarInit.sCol.blue = POW_CLICKBARMAJORBLUE;
sBarInit.pDisplay = intDisplayPowerBar;
sBarInit.iRange = POWERBAR_SCALE;
widgAddBarGraph(psWScreen, &sBarInit);
addMultiBut(psWScreen,FORCE_STATS,CON_CANCEL,FORCE_OKX,FORCE_OKY,MULTIOP_OKW,MULTIOP_OKH,
_("Return To Previous Screen"),IMAGE_RETURN,IMAGE_RETURN_HI,FALSE); // cancel
addMultiBut(psWScreen,FORCE_STATS,FORCE_PRESETCLEAR,FORCE_PRESETCLEARX,FORCE_PRESETCLEARY,FORCE_BUTW,FORCE_BUTH,
_("Clear Current Force"),IMAGE_CLEARFORCE,IMAGE_CLEARFORCE,TRUE); // clear.
addMultiBut(psWScreen,FORCE_STATS,FORCE_PRESETDEFAULT,FORCE_PRESETDEFAULTX,FORCE_PRESETDEFAULTY,FORCE_BUTW,FORCE_BUTH,
_("Select Default"),IMAGE_DEFAULTFORCE,IMAGE_DEFAULTFORCE,TRUE); // default.
addMultiBut(psWScreen,FORCE_STATS,FORCE_LOAD,FORCE_LOADX,FORCE_LOADY,FORCE_BUTW,FORCE_BUTH,
_("Load Force"),IMAGE_LOADFORCE,IMAGE_LOADFORCE,TRUE); // load
addMultiBut(psWScreen,FORCE_STATS,FORCE_SAVE,FORCE_SAVEX,FORCE_SAVEY,FORCE_BUTW,FORCE_BUTH,
_("Save Force"),IMAGE_SAVEFORCE,IMAGE_SAVEFORCE,TRUE); // save
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
// whiteboard functions
@ -3788,40 +3253,6 @@ BOOL addMultiBut(W_SCREEN *screen, UDWORD formid, UDWORD id, UDWORD x, UDWORD y,
return widgAddButton(screen, &sButInit);
}
void displayForceDroid(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD *pColours)
{
Vector3i Rotation,Position;
UDWORD x = psWidget->x+xOffset;
UDWORD y = psWidget->y+yOffset;
UDWORD tlx,tly,brx,bry;
tlx = x-58;
tly = y-80;
brx = x+58;
bry = y+23;
pie_BoxFill(tlx, tly, brx, bry, 0x006067a0);
pie_BoxFill(tlx+1, tly+1, brx-1, bry-1, 0x002f3050);
pie_Set2DClip((UWORD)(tlx+1),(UWORD)(tly+1),(UWORD)(brx-1),(UWORD)(bry-1));
pie_SetGeometricOffset( x,y);
Rotation.x = -20;
Rotation.y = ((gameTime2/45)%360); //45
Rotation.z = 0;
Position.x = 0;
Position.y = 0; //above droid.
Position.z = BUTTON_DEPTH;//2500; //scale them to 200% in button render
if(Force.pMembers)
{
displayComponentButtonTemplate(Force.pMembers->pTempl, &Rotation,&Position,TRUE, 2 * DROID_BUT_SCALE);
}
pie_Set2DClip(CLIP_BORDER,CLIP_BORDER,psRendSurface->width-CLIP_BORDER,psRendSurface->height-CLIP_BORDER);
return;
}
/*
* Set skirmish/multiplayer alliance mode to 'Locked teams',
* update GUI accordingly and notify other players

View File

@ -224,8 +224,8 @@ void loadMapPreview(void);
#define MROW1 4
#define MROW2 MROW1+MULTIOP_EDITBOXH+4
#define MROW3 MROW2+MULTIOP_EDITBOXH+4
#define MROW4 MROW3+MULTIOP_EDITBOXH+4
#define MROW5 MROW4+38
#define MROW4 MROW3+38
#define MROW5 MROW4+31
#define MROW6 MROW5+31
#define MROW7 MROW6+31
#define MROW8 MROW7+31

View File

@ -56,7 +56,6 @@
// ////////////////////////////////////////////////////////////////////////////
// External Variables
extern char MultiForcesPath[255];
extern char buildTime[8];
// ////////////////////////////////////////////////////////////////////////////
@ -407,8 +406,6 @@ BOOL sendLeavingMsg(void)
// called in Init.c to shutdown the whole netgame gubbins.
BOOL multiShutdown(void)
{
FORCE_MEMBER *pF;
debug(LOG_MAIN, "shutting down audio capture");
debug(LOG_MAIN, "shutting down audio playback");
@ -417,15 +414,6 @@ BOOL multiShutdown(void)
debug(LOG_MAIN, "shutting down networking");
NETshutdown();
// clear any force we may have.
debug(LOG_MAIN, "free game data (forces)");
while(Force.pMembers)
{
pF = Force.pMembers;
Force.pMembers = pF->psNext;
free(pF);
}
debug(LOG_MAIN, "free game data (structure limits)");
if(ingame.numStructureLimits)
{
@ -443,7 +431,7 @@ BOOL multiShutdown(void)
BOOL addTemplate(UDWORD player, DROID_TEMPLATE *psNew)
{
DROID_TEMPLATE *psTempl = malloc(sizeof(DROID_TEMPLATE));
DROID_TEMPLATE *psTempl = malloc(sizeof(DROID_TEMPLATE));
if (psTempl == NULL)
{
@ -504,19 +492,6 @@ BOOL copyTemplateSet(UDWORD from,UDWORD to)
BOOL multiTemplateSetup(void)
{
UDWORD player, pcPlayer = 0;
char sTemp[256];
if(game.type == CAMPAIGN && game.base == CAMP_WALLS)
{
strcpy(sTemp, MultiForcesPath);
strcat(sTemp, sForceName);
strcat(sTemp,".for");
loadForce(sTemp);
// useTheForce(TRUE);
}
switch (game.type)
{
@ -827,11 +802,6 @@ static BOOL campInit(void)
playerResponding(); // say howdy!
if(game.type == CAMPAIGN && game.base == CAMP_WALLS)
{
useTheForce(TRUE);
}
return TRUE;
}
@ -902,7 +872,6 @@ BOOL multiGameShutdown(void)
NetPlay.bHost = FALSE;
bMultiPlayer = FALSE; //back to single player mode
selectedPlayer = 0; //back to use player 0 (single player friendly)
bForceEditorLoaded = FALSE;
return TRUE;
}

View File

@ -23,7 +23,6 @@
* Alex Lee , pumpkin studios, EIDOS
*
* load / update / store multiplayer statistics for league tables etc...
* Also handle the force save/loads and default teams for each tech level.
*/
#include <stdio.h>
@ -48,493 +47,6 @@
extern char MultiPlayersPath[255];
// ////////////////////////////////////////////////////////////////////////////
// Force defs.
FORCE Force; // the selected force.
// ////////////////////////////////////////////////////////////////////////////
// FORCE SELECT STUFF
// ////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////
// funcs to edit the force.
BOOL addToForce(DROID_TEMPLATE *templ)
{
FORCE_MEMBER *pF;
DROID_TEMPLATE *pT,*psTempl;
if (!usePower(selectedPlayer, templ->powerPoints)) //subtract the power required to build
{
return FALSE; // go no further
}
// add template to list. if it doesn't exist.
for( psTempl = Force.pForceTemplates; // find relevant template
psTempl && (psTempl->ref != templ->ref);
psTempl = psTempl->psNext);
if(!psTempl)
{
pT = (DROID_TEMPLATE*)malloc(sizeof(DROID_TEMPLATE));
if ( !pT)
{
return FALSE;
}
memcpy(pT, templ, sizeof(DROID_TEMPLATE));
// calculate power etc for this template
// initTemplatePoints();
pT->buildPoints = calcTemplateBuild(pT);
pT->powerPoints = calcTemplatePower(pT);
pT->psNext = Force.pForceTemplates;
Force.pForceTemplates=pT;
}
else
{
pT = psTempl; // set up to point to existing template.
}
// add droid.
pF = (FORCE_MEMBER*)malloc(sizeof(FORCE_MEMBER)); // create a slot in the force.
if (!pF)
{
return FALSE;
}
pF->pTempl = pT; // add this droid.
pF->psNext = Force.pMembers;
Force.pMembers = pF;
return TRUE;
}
// ////////////////////////////////////////////////////////////////////////////
BOOL removeFromForce(UDWORD number)
{
UDWORD i,templateid;
FORCE_MEMBER *pF;
FORCE_MEMBER *pF2=NULL;
DROID_TEMPLATE *psCurr,*psPrev;
BOOL inuse;
pF= Force.pMembers;
for(i=0;i<number;i++)pF=pF->psNext; // goto that force element;
addPower(selectedPlayer, pF->pTempl->powerPoints); // return that much power.
if(number==0) // if first remove it,
{
pF = Force.pMembers;
Force.pMembers = pF->psNext;
}
else
{
pF = Force.pMembers; // not first so linked list
for(i=0;i<number;i++) // needs modifying..
{
pF2 = pF;
pF = pF->psNext;
}
pF2->psNext = pF->psNext;
}
templateid = pF->pTempl->ref;
free(pF);
// now check if template is still in use.
inuse = FALSE;
for(pF = Force.pMembers;pF;pF=pF->psNext)
{
if(pF->pTempl->ref == templateid)
{
inuse = TRUE;
}
}
if(!inuse) // remove template, no longer needed.
{
psPrev = NULL;
for(psCurr = Force.pForceTemplates; psCurr;psCurr = psCurr->psNext)
{
if( psCurr->ref == templateid )
{
break;
}
psPrev = psCurr;
}
if (psCurr) // if we found itthen delete it.
{
if(psPrev) // Update list pointers.
{
psPrev->psNext = psCurr->psNext; // It's down the list somewhere
}
else
{
Force.pForceTemplates = psCurr->psNext; // It's at the root
}
free(psCurr); // Delete the template.
}
}
return TRUE;
}
/*
// find a place for the force
static void chooseForceLoc(UDWORD *pX,UDWORD *pY)
{
FEATURE *pFeat;
UDWORD x,y,chose,tcount=0;
// pick a boulder on the arena map
for(pFeat=apsFeatureLists[0];pFeat;pFeat=pFeat->psNext)//count boulders
{
if(pFeat->psStats->subType == FEAT_BOULDER)
{
tcount++;
}
}
if(tcount) // use boulders
{
chose = 0;
while(chose == 0) // dont pick zeroth boulder.
{
chose = (rand()%(tcount+1));
}
tcount= 0;
pFeat=apsFeatureLists[0];
while(pFeat && (tcount!=chose))
{
if(pFeat->psStats->subType == FEAT_BOULDER)
{
tcount++;
}
if(tcount != chose)
{
pFeat = pFeat->psNext;
}
}
x = pFeat->x >>TILE_SHIFT;
y = pFeat->y >>TILE_SHIFT;
}
else //dont use boulders
{
tcount = 0;
x = rand()%mapWidth; //choose an intitial x/y pos.
y = rand()%mapHeight;
}
// set result
*pX = x;
*pY = y;
}
*/
// ////////////////////////////////////////////////////////////////////////////
// place the force on the map.
void useTheForce(BOOL bAddTempl)//Luke
{
DROID *pDr;
DROID_TEMPLATE *pTempl;
Vector3i position;
UDWORD x1,y1,x,y;
DROID_TEMPLATE *psTempl;
if(apsDroidLists[selectedPlayer])
{
//set drop off point to pos of other droids.
x = apsDroidLists[selectedPlayer]->x >>TILE_SHIFT;
y = apsDroidLists[selectedPlayer]->y >>TILE_SHIFT;
// send each of the extra templates used in the force
for(psTempl=Force.pForceTemplates;psTempl;psTempl=psTempl->psNext)
{
sendTemplate(psTempl); // OUCH! REALLY COM HEAVY
}
}
x1 = x; // now we have a coord, place droids
y1 = y;
while(Force.pMembers) // for each force member
{
x = x1;
y = y1;
if (!pickATileGen(&x,&y,LOOK_FOR_EMPTY_TILE,zonedPAT))
{
ASSERT( FALSE, "UseTheForce: Unable to find a free location" );
}
debug( LOG_NEVER, "force droid dropping at :%d,%d\n", x, y );
// copy template
psTempl = NameToTemplate(Force.pMembers->pTempl->aName,selectedPlayer);
if(!psTempl)
{
Force.pMembers->pTempl->ref = REF_TEMPLATE_START;
addTemplate(selectedPlayer, Force.pMembers->pTempl);
}
// end of template copy
pTempl = Force.pMembers->pTempl;
/* if(!psTempl) // already exists.
{
psTempl = malloc(sizeof(DROID_TEMPLATE));
if (psTempl != NULL)
{
memcpy(psTempl, Force.pMembers->pTempl, sizeof(DROID_TEMPLATE));
psTempl->ref = REF_TEMPLATE_START; // templates are the odd one out!
if (apsDroidTemplates[selectedPlayer]) // Add it to the list
{
for(psCurr = apsDroidTemplates[selectedPlayer];
psCurr->psNext != NULL;
psCurr = psCurr->psNext
);
psCurr->psNext = psTempl;
psTempl->psNext = NULL;
}
}
}
else
{
apsDroidTemplates[selectedPlayer]=psTempl;
psTempl->psNext = NULL;
}
*/
// if(usePower(selectedPlayer, pTempl->powerPoints))
// {
pDr= buildDroid(pTempl, x<<TILE_SHIFT, y<<TILE_SHIFT, selectedPlayer, FALSE);
removeFromForce(0); // remove from force (to free power)
if (pDr)
{
addDroid(pDr, apsDroidLists); // add it to the world.
position.x = pDr->x; // Add an effect
position.z = pDr->y;
position.y = pDr->z;
addEffect(&position,EFFECT_EXPLOSION,EXPLOSION_TYPE_DISCOVERY,FALSE,NULL,FALSE);
}
// }
}
}
// ////////////////////////////////////////////////////////////////////////////
// save out force to a file.
// file format is as follows.
// number of templates
// number of droids in force
// templates
// droids
BOOL saveForce(char *name,FORCE *pfForce)
{
char fileName[255]="";
PHYSFS_file *pFileHandle;
DROID_TEMPLATE *pT;
FORCE_MEMBER *pCount,*pMember;
UDWORD count=0;
strcpy(fileName,name);
pFileHandle = PHYSFS_openWrite(fileName); // open the file
if (!pFileHandle)
{
debug(LOG_ERROR, "saveForce: Couldn't open %s: %s", fileName, PHYSFS_getLastError());
return FALSE;
}
// save header for force file.
count =0;
for(pT = pfForce->pForceTemplates;pT;pT=pT->psNext) count++; // count templates
if (PHYSFS_write( pFileHandle, &count, sizeof(UDWORD), 1 ) != 1)
{
debug(LOG_ERROR, "saveForce: Write failed for %s: %s", fileName, PHYSFS_getLastError());
return FALSE;
}
count=0;
for(pCount=pfForce->pMembers;pCount;pCount=pCount->psNext) count++; // count droids
if (PHYSFS_write( pFileHandle, &count, sizeof(UDWORD), 1 ) != 1)
{
debug(LOG_ERROR, "saveForce: Write failed for %s: %s", fileName, PHYSFS_getLastError());
return FALSE;
}
#if 0
// This code (and similar below for loadForce) can probably be removed. Commented out pre-GPL era. - Per
// old method. save whole template
for(pT = pfForce->pForceTemplates;pT;pT=pT->psNext) // save templates
{
if (fwrite(pT, sizeof(DROID_TEMPLATE), 1, pFileHandle) != 1) // template
{
debug( LOG_ERROR, "Write failed for %s", fileName );
abort();
return FALSE;
}
fputc(10,pFileHandle); //seperator.
}
// save force
for(pMember = pfForce->pMembers;pMember;pMember =pMember->psNext)
{
if (fwrite(&(pMember->pTempl->ref) ,sizeof(pMember->pTempl->ref), 1, pFileHandle) != 1)
{
debug( LOG_ERROR, "Write failed for %s", fileName ); // force type
abort();
return FALSE;
}
}
#else
// new method. refs to templates. USED FOR MULITLANG SUPP.
for(pMember = pfForce->pMembers;pMember;pMember =pMember->psNext)
{
if ( PHYSFS_write( pFileHandle, &(pMember->pTempl->multiPlayerID), sizeof(pMember->pTempl->multiPlayerID), 1 ) != 1 )
{
debug(LOG_ERROR, "saveForce: Write failed for %s: %s", fileName, PHYSFS_getLastError());
return FALSE;
}
}
#endif
if (!PHYSFS_close(pFileHandle))
{
debug(LOG_ERROR, "saveForce: Close failed for %s: %s", fileName, PHYSFS_getLastError());
return FALSE;
}
return TRUE;
}
// ////////////////////////////////////////////////////////////////////////////
// load a force from a file.
BOOL loadForce(char *name)
{
char fileName[255]="";
// char tname[255]="";
PHYSFS_file *pFileHandle;
UDWORD tcount,fcount=0,ref;
DROID_TEMPLATE *psTempl;
strcpy(fileName,name);
debug(LOG_WZ, "loadForce: %s", fileName);
pFileHandle = PHYSFS_openRead(fileName); // check file exists
if (pFileHandle == NULL)
{
debug(LOG_ERROR, "loadForce: Failed to open %s: %s", fileName, PHYSFS_getLastError());
return FALSE; // failed
}
while(Force.pMembers) // clear current force
{
removeFromForce(0);
}
// DBERROR(("tem %d : mem %d",Force.pForceTemplates , Force.pMembers));
Force.pForceTemplates = NULL;
Force.pMembers = NULL;
// load in new force.
if ( PHYSFS_read( pFileHandle, &tcount, sizeof(UDWORD), 1 ) != 1 ) // get number of templates
{
debug(LOG_ERROR, "loadForce: Read failed for %s: %s", fileName, PHYSFS_getLastError());
PHYSFS_close(pFileHandle);
return FALSE;
}
if ( PHYSFS_read( pFileHandle, &fcount, sizeof(UDWORD), 1 ) != 1 ) // get number of droids in force
{
debug(LOG_ERROR, "loadForce: read failed for %s: %s", fileName, PHYSFS_getLastError());
PHYSFS_close(pFileHandle);
return FALSE;
}
#if 0
// old method
for(tcount;tcount!=0;tcount--) // get templates
{
psTempl = malloc(sizeof(DROID_TEMPLATE));
if (psTempl == NULL)
{
debug( LOG_ERROR, "Couldn't allocate template for %s", fileName );
abort();
return FALSE;
}
if (fread(psTempl, sizeof(DROID_TEMPLATE), 1, pFileHandle) != 1) // read in a template.
{
debug( LOG_ERROR, "read failed for %s", fileName );
abort();
fclose(pFileHandle);
return FALSE;
}
psTempl->pName = (char*)&psTempl->aName;
fgetc(pFileHandle); // remove the template separator in the force file.
psTempl->psNext = Force.pForceTemplates;
Force.pForceTemplates=psTempl;
}
for(fcount;fcount!=0;fcount--) // get forces.
{
if (fread(&ref, sizeof(ref), 1, pFileHandle) != 1) // read in a template ref code.
{
debug( LOG_ERROR, "read failed for %s", fileName );
abort();
fclose(pFileHandle);
return FALSE;
}
for( psTempl = Force.pForceTemplates; // find relevant template
psTempl && (psTempl->ref != ref);
psTempl = psTempl->psNext);
if(!psTempl)
{
debug( LOG_ERROR, "failed to load. invalid file." );
abort();
fclose(pFileHandle);
return FALSE;
}
addToForce(psTempl); // add it to the force.
}
#else
// new method.
// get forces.
while (fcount > 0)
{
if ( PHYSFS_read( pFileHandle, &ref, sizeof(ref), 1 ) != 1) // read in a template ref code.
{
debug(LOG_ERROR, "loadForce: read failed for %s: %s", fileName, PHYSFS_getLastError());
PHYSFS_close(pFileHandle);
return FALSE;
}
psTempl = IdToTemplate(ref,DEATHMATCHTEMPLATES);
if(psTempl)
{
addToForce(psTempl); // add it to the force.
}
fcount--;
}
#endif
if (!PHYSFS_close(pFileHandle))
{
debug(LOG_ERROR, "loadForce: Close failed for %s: %s", fileName, PHYSFS_getLastError());
return FALSE;
}
return TRUE;
}
// ////////////////////////////////////////////////////////////////////////////
// STATS STUFF
// ////////////////////////////////////////////////////////////////////////////

View File

@ -43,25 +43,6 @@ typedef struct
} PLAYERSTATS;
typedef struct _forcemember {
DROID_TEMPLATE *pTempl; // pointer to template to use for this droid
struct _forcemember *psNext; // Pointer to next template
}FORCE_MEMBER;
typedef struct _force {
DROID_TEMPLATE *pForceTemplates;
FORCE_MEMBER *pMembers;
}FORCE;
extern FORCE Force; // the selected force.
// Force defs.
extern BOOL removeFromForce (UDWORD number); // remove a droid from force
extern BOOL addToForce (DROID_TEMPLATE *templ); // add a droid (templ) to force
extern void useTheForce (BOOL bAddTempl); // place the force in the game
extern BOOL saveForce (char *name,FORCE *pfForce);
extern BOOL loadForce (char *name);
// stat defs
extern BOOL saveMultiStats (const char *sFName, const char *sPlayerName, const PLAYERSTATS *playerStats); // to disk
extern BOOL loadMultiStats (char *sPlayerName, PLAYERSTATS *playerStats); // form disk

View File

@ -171,9 +171,6 @@ TITLECODE titleLoop(void)
case GAMEFIND:
runGameFind();
break;
case FORCESELECT:
runForceSelect();
break;
case MULTI:
runMultiPlayerMenu();
break;