Use default constructors instead of memset for W_INIT (widget init) derivatives.

Accidentally fixed 5 memsets of W_FORMINIT, which were incorrectly using sizeof(W_BUTINIT). (The sizeof() was smaller than the object, so it didn't overflow, at least.)

And removed an ugly memset of a DROID.
master
Cyp 2010-12-22 15:02:14 +01:00
parent a2665e12f7
commit 76430c583f
31 changed files with 343 additions and 650 deletions

View File

@ -30,6 +30,21 @@
#include "lib/ivis_common/pieblitfunc.h"
#include "lib/ivis_common/piepalette.h"
W_BARINIT::W_BARINIT()
: orientation(WBAR_LEFT)
, size(0)
, minorSize(0)
, iRange(100)
, denominator(1)
, precision(0)
//sCol
//sMinorCol
, pTip(NULL)
{
sCol.rgba = 0;
sMinorCol.rgba = 0;
}
W_BARGRAPH::W_BARGRAPH(W_BARINIT const *init)
: WIDGET(init, WIDG_BARGRAPH)
, barPos(init->orientation)

View File

@ -30,7 +30,7 @@ struct W_BARGRAPH : public WIDGET
{
W_BARGRAPH(W_BARINIT const *init);
UWORD barPos; // Orientation of the bar on the widget
WBAR_ORIENTATION barPos; // Orientation of the bar on the widget
UWORD majorSize; // Percentage of the main bar that is filled
UWORD minorSize; // Percentage of the minor bar if there is one
UWORD iRange; // Maximum range

View File

@ -38,6 +38,12 @@ BOOL buttonStartUp(void)
return true;
}
W_BUTINIT::W_BUTINIT()
: pText(NULL)
, pTip(NULL)
, FontID(font_regular)
{}
W_BUTTON::W_BUTTON(W_BUTINIT const *init)
: WIDGET(init, WIDG_BUTTON)
, pText(init->pText)

View File

@ -53,6 +53,13 @@
#define WEDB_CHARJUMP 6
W_EDBINIT::W_EDBINIT()
: pText(NULL)
, FontID(font_regular)
, pBoxDisplay(NULL)
, pFontDisplay(NULL)
{}
W_EDITBOX::W_EDITBOX(W_EDBINIT const *init)
: WIDGET(init, WIDG_EDITBOX)
, FontID(init->FontID)

View File

@ -46,6 +46,33 @@ struct TAB_POS
SDWORD TabMultiplier; //Added to keep track of tab scroll
};
W_FORMINIT::W_FORMINIT()
: disableChildren(false)
, majorPos(0), minorPos(0)
, majorSize(0), minorSize(0)
, majorOffset(0), minorOffset(0)
, tabVertOffset(0)
, tabHorzOffset(0)
, tabMajorThickness(0)
, tabMinorThickness(0)
, tabMajorGap(0)
, tabMinorGap(0)
, numStats(0)
, numButtons(0)
, numMajor(0)
// aNumMinors
, TabMultiplier(0)
, pTip(NULL)
// apMajorTips
// apMinorTips
, pTabDisplay(NULL)
, pFormDisplay(NULL)
{
memset(aNumMinors, 0, sizeof(aNumMinors));
memset(apMajorTips, 0, sizeof(apMajorTips));
memset(apMinorTips, 0, sizeof(apMinorTips));
}
W_FORM::W_FORM(W_FORMINIT const *init)
: WIDGET(init, WIDG_FORM)
, disableChildren(init->disableChildren)

View File

@ -30,6 +30,12 @@
// FIXME Direct iVis implementation include!
#include "lib/ivis_common/textdraw.h"
W_LABINIT::W_LABINIT()
: pText(NULL)
, pTip(NULL)
, FontID(font_regular)
{}
W_LABEL::W_LABEL(W_LABINIT const *init)
: WIDGET(init, WIDG_LABEL)
, FontID(init->FontID)

View File

@ -34,6 +34,14 @@ void sliderEnableDrag(BOOL Enable)
DragEnabled = Enable;
}
W_SLDINIT::W_SLDINIT()
: orientation(WSLD_LEFT)
, numStops(0)
, barSize(0)
, pos(0)
, pTip(NULL)
{}
W_SLIDER::W_SLIDER(W_SLDINIT const *init)
: WIDGET(init, WIDG_SLIDER)
, orientation(init->orientation)

View File

@ -40,7 +40,7 @@ struct W_SLIDER : public WIDGET
void clicked(W_CONTEXT *context, WIDGET_KEY) { sliderClicked(this, context); }
UWORD orientation; // The orientation of the slider
WSLD_ORIENTATION orientation; // The orientation of the slider
UWORD numStops; // Number of stop positions on the slider
UWORD barSize; // Thickness of slider bar
UWORD pos; // Current stop position of the slider

View File

@ -82,6 +82,19 @@ void widgShutDown(void)
}
W_INIT::W_INIT()
: formID(0)
, majorID(0), minorID(0)
, id(0)
, style(0)
, x(0), y(0)
, width(0), height(0)
, pDisplay(NULL)
, pCallback(NULL)
, pUserData(NULL)
, UserData(0)
{}
WIDGET::WIDGET(W_INIT const *init, WIDGET_TYPE type)
: formID(init->formID)
, id(init->id)
@ -113,9 +126,6 @@ void CheckpsMouseOverWidget( void *psWidget )
/* Create an empty widget screen */
W_SCREEN* widgCreateScreen()
{
W_FORM *psForm;
W_FORMINIT sInit;
W_SCREEN *psScreen = new W_SCREEN;
if (psScreen == NULL)
{
@ -124,7 +134,7 @@ W_SCREEN* widgCreateScreen()
return NULL;
}
memset(&sInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sInit;
sInit.id = 0;
sInit.style = WFORM_PLAIN | WFORM_INVISIBLE;
sInit.x = 0;
@ -132,7 +142,7 @@ W_SCREEN* widgCreateScreen()
sInit.width = (UWORD)(screenWidth - 1);
sInit.height = (UWORD)(screenHeight - 1);
psForm = formCreate(&sInit);
W_FORM *psForm = formCreate(&sInit);
if (psForm == NULL)
{
delete psScreen;

View File

@ -100,6 +100,8 @@
/** The basic initialisation structure */
struct W_INIT
{
W_INIT();
UDWORD formID; ///< ID number of form to put widget on. ID == 0 specifies the default form for the screen
UWORD majorID, minorID; ///< Which major and minor tab to put the widget on for a tabbed form
UDWORD id; ///< Unique id number (chosen by user)
@ -147,8 +149,10 @@ typedef void (*FONT_DISPLAY)(UDWORD x, UDWORD y, char *String);
/** Form initialisation structure */
struct W_FORMINIT : public W_INIT
{
W_FORMINIT();
/* Data for a tabbed form */
BOOL disableChildren;
bool disableChildren;
UWORD majorPos, minorPos; // Position of the tabs on the form
UWORD majorSize, minorSize; // Size of the tabs (in pixels)
SWORD majorOffset, minorOffset; // Tab start offset.
@ -173,6 +177,8 @@ struct W_FORMINIT : public W_INIT
/** Label initialisation structure */
struct W_LABINIT : public W_INIT
{
W_LABINIT();
const char *pText; ///< label text
const char *pTip; ///< Tool tip for the label.
enum iV_fonts FontID; ///< ID of the IVIS font to use for this widget.
@ -181,6 +187,8 @@ struct W_LABINIT : public W_INIT
/** Button initialisation structure */
struct W_BUTINIT : public W_INIT
{
W_BUTINIT();
const char *pText; ///< Button text
const char *pTip; ///< Tool tip text
enum iV_fonts FontID; //< ID of the IVIS font to use for this widget.
@ -189,6 +197,8 @@ struct W_BUTINIT : public W_INIT
/** Edit box initialisation structure */
struct W_EDBINIT : public W_INIT
{
W_EDBINIT();
const char *pText; ///< initial contents of the edit box
enum iV_fonts FontID; ///< ID of the IVIS font to use for this widget.
WIDGET_DISPLAY pBoxDisplay; ///< Optional callback to display the form.
@ -196,15 +206,20 @@ struct W_EDBINIT : public W_INIT
};
/* Orientation flags for the bar graph */
#define WBAR_LEFT 0x0001 ///< Bar graph fills from left to right
#define WBAR_RIGHT 0x0002 ///< Bar graph fills from right to left
#define WBAR_TOP 0x0003 ///< Bar graph fills from top to bottom
#define WBAR_BOTTOM 0x0004 ///< Bar graph fills from bottom to top
enum WBAR_ORIENTATION
{
WBAR_LEFT = 1, ///< Bar graph fills from left to right
WBAR_RIGHT, ///< Bar graph fills from right to left
WBAR_TOP, ///< Bar graph fills from top to bottom
WBAR_BOTTOM, ///< Bar graph fills from bottom to top
};
/** Bar Graph initialisation structure */
struct W_BARINIT : public W_INIT
{
UWORD orientation; ///< Orientation of the bar on the widget
W_BARINIT();
WBAR_ORIENTATION orientation; ///< Orientation of the bar on the widget
UWORD size; ///< Initial percentage of the graph that is filled
UWORD minorSize; ///< Percentage of second bar graph if there is one
UWORD iRange; ///< Maximum range
@ -217,15 +232,20 @@ struct W_BARINIT : public W_INIT
/* Orientation of the slider */
#define WSLD_LEFT 0x0001 ///< Slider is horizontal and starts at left
#define WSLD_RIGHT 0x0002 ///< Slider is horizontal and starts at the right
#define WSLD_TOP 0x0003 ///< Slider is vertical and starts at the top
#define WSLD_BOTTOM 0x0004 ///< Slider is vertical and starts at the bottom
enum WSLD_ORIENTATION
{
WSLD_LEFT = 1, ///< Slider is horizontal and starts at left
WSLD_RIGHT, ///< Slider is horizontal and starts at the right
WSLD_TOP, ///< Slider is vertical and starts at the top
WSLD_BOTTOM, ///< Slider is vertical and starts at the bottom
};
/** Slider initialisation structure */
struct W_SLDINIT : public W_INIT
{
UWORD orientation; ///< Orientation of the slider
W_SLDINIT();
WSLD_ORIENTATION orientation; ///< Orientation of the slider
UWORD numStops; ///< Number of stops on the slider
UWORD barSize; ///< Size of the bar
UWORD pos; ///< Initial position of the slider bar

View File

@ -82,8 +82,13 @@ SIMPLE_OBJECT::~SIMPLE_OBJECT()
BASE_OBJECT::BASE_OBJECT(OBJECT_TYPE type, uint32_t id, unsigned player)
: SIMPLE_OBJECT(type, id, player)
, selected(false)
, cluster(0)
, numWatchedTiles(0)
, lastEmission(0)
, lastHitWeapon(WSC_NUM_WEAPON_SUBCLASSES) // No such weapon.
, timeLastHit(UDWORD_MAX)
, bTargetted(false)
, watchedTiles(NULL)
{}

View File

@ -121,9 +121,6 @@ bool addChallenges()
{
char sPath[PATH_MAX];
const char *sSearchPath = "challenges";
W_FORMINIT sFormInit;
W_BUTINIT sButInit;
W_LABINIT sLabInit;
UDWORD slotCount;
static char sSlotCaps[totalslots][totalslotspace];
static char sSlotTips[totalslots][totalslotspace];
@ -136,7 +133,7 @@ bool addChallenges()
widgSetTipFont(psRequestScreen, font_regular);
/* add a form to place the tabbed form on */
memset(&sFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
sFormInit.formID = 0; //this adds the blue background, and the "box" behind the buttons -Q
sFormInit.id = CHALLENGE_FORM;
sFormInit.style = WFORM_PLAIN;
@ -163,7 +160,7 @@ bool addChallenges()
widgAddForm(psRequestScreen, &sFormInit);
// Add Banner Label
memset(&sLabInit, 0, sizeof(W_LABINIT));
W_LABINIT sLabInit;
sLabInit.formID = CHALLENGE_BANNER;
sLabInit.id = CHALLENGE_LABEL;
sLabInit.style = WLAB_ALIGNCENTRE;
@ -172,11 +169,10 @@ bool addChallenges()
sLabInit.width = CHALLENGE_W - (2 * CHALLENGE_HGAP); //CHALLENGE_W;
sLabInit.height = CHALLENGE_BANNER_DEPTH; //This looks right -Q
sLabInit.pText = "Challenge";
sLabInit.FontID = font_regular;
widgAddLabel(psRequestScreen, &sLabInit);
// add cancel.
memset(&sButInit, 0, sizeof(W_BUTINIT));
W_BUTINIT sButInit;
sButInit.formID = CHALLENGE_BANNER;
sButInit.x = 8;
sButInit.y = 8;
@ -185,20 +181,16 @@ bool addChallenges()
sButInit.UserData = PACKDWORD_TRI(0, IMAGE_NRUTER , IMAGE_NRUTER);
sButInit.id = CHALLENGE_CANCEL;
sButInit.style = WBUT_PLAIN;
sButInit.pTip = _("Close");
sButInit.FontID = font_regular;
sButInit.pDisplay = intDisplayImageHilight;
widgAddButton(psRequestScreen, &sButInit);
// add slots
memset(&sButInit, 0, sizeof(W_BUTINIT));
sButInit = W_BUTINIT();
sButInit.formID = CHALLENGE_FORM;
sButInit.style = WBUT_PLAIN;
sButInit.width = CHALLENGE_ENTRY_W;
sButInit.height = CHALLENGE_ENTRY_H;
sButInit.pDisplay = displayLoadSlot;
sButInit.FontID = font_regular;
for (slotCount = 0; slotCount < totalslots; slotCount++)
{

View File

@ -955,37 +955,21 @@ static void displayCompObj(DROID *psDroid, BOOL bButton)
//
void displayComponentButtonTemplate(DROID_TEMPLATE *psTemplate, Vector3i *Rotation, Vector3i *Position, BOOL RotXYZ, SDWORD scale)
{
static DROID Droid(0, 0); // Made static to reduce stack usage.
SDWORD difference;
/* init to NULL */
memset( &Droid, 0, sizeof(DROID) );
setMatrix(Position, Rotation, RotXYZ);
pie_MatScale(scale / 100.f);
// Decide how to sort it.
difference = Rotation->y%360;
if((difference>0 && difference <180) || difference<-180)
{
leftFirst = false;
}
else
{
leftFirst = true;
}
// Decide how to sort it.
leftFirst = angleDelta(DEG(Rotation->y)) < 0;
DROID Droid(0, selectedPlayer);
memset(Droid.asBits, 0, sizeof(Droid.asBits));
droidSetBits(psTemplate,&Droid);
Droid.player = (UBYTE)selectedPlayer;
Droid.pos.x = Droid.pos.y = Droid.pos.z = 0;
Droid.pos = Vector3i(0, 0, 0);
//draw multi component object as a button object
displayCompObj(&Droid, true);
unsetMatrix();
}

View File

@ -425,12 +425,6 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
//initialise flags
newTemplate = false;
memset(&sFormInit, 0, sizeof(W_FORMINIT));
memset(&sLabInit, 0, sizeof(W_LABINIT));
memset(&sEdInit, 0, sizeof(W_EDBINIT));
memset(&sButInit, 0, sizeof(W_BUTINIT));
memset(&sBarInit, 0, sizeof(W_BARINIT));
/* Add the main design form */
sFormInit.formID = 0;
sFormInit.id = IDDES_FORM;
@ -448,13 +442,11 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
/* add the edit name box */
sEdInit.formID = IDDES_FORM;
sEdInit.id = IDDES_NAMEBOX;
sEdInit.style = WEDB_PLAIN;
sEdInit.x = DES_NAMEBOXX;
sEdInit.y = DES_NAMEBOXY;
sEdInit.width = DES_NAMEBOXWIDTH;
sEdInit.height = DES_NAMEBOXHEIGHT;
sEdInit.pText = _("New Vehicle");
sEdInit.FontID = font_regular;
sEdInit.pBoxDisplay = intDisplayEditBox;
if (!widgAddEditBox(psWScreen, &sEdInit))
{
@ -466,13 +458,13 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
/* Initialise the current design */
if (psCurrTemplate != NULL)
{
memcpy(&sCurrDesign, psCurrTemplate, sizeof(DROID_TEMPLATE));
sCurrDesign = *psCurrTemplate;
sstrcpy(aCurrName, getStatName(psCurrTemplate));
sstrcpy(sCurrDesign.aName, aCurrName);
}
else
{
memcpy(&sCurrDesign, &sDefaultDesignTemplate, sizeof(DROID_TEMPLATE));
sCurrDesign = sDefaultDesignTemplate;
sCurrDesign.pName = NULL;
sstrcpy(aCurrName, _("New Vehicle"));
sstrcpy(sCurrDesign.aName, aCurrName);
@ -516,13 +508,11 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
// add the body part button
sButInit.formID = IDDES_PARTFORM;
sButInit.id = IDDES_BODYBUTTON;
sButInit.style = WBUT_PLAIN;
sButInit.x = DES_PARTSEPARATIONX;
sButInit.y = DES_PARTSEPARATIONY;
sButInit.width = iV_GetImageWidth(IntImages, IMAGE_DES_BODY);
sButInit.height = iV_GetImageHeight(IntImages, IMAGE_DES_BODY);
sButInit.pTip = _("Vehicle Body");
sButInit.FontID = font_regular;
#ifdef FLASH_BUTTONS
sButInit.pDisplay = intDisplayButtonFlash;
#else
@ -537,14 +527,12 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
// add the propulsion part button
sButInit.formID = IDDES_PARTFORM;
sButInit.id = IDDES_PROPBUTTON;
sButInit.style = WBUT_PLAIN;
sButInit.x = DES_PARTSEPARATIONX;
sButInit.y = (UWORD)(iV_GetImageHeight(IntImages, IMAGE_DES_PROPULSION) +
2 * DES_PARTSEPARATIONY);
sButInit.width = iV_GetImageWidth(IntImages, IMAGE_DES_PROPULSION);
sButInit.height = iV_GetImageHeight(IntImages, IMAGE_DES_PROPULSION);
sButInit.pTip = _("Vehicle Propulsion");
sButInit.FontID = font_regular;
#ifdef FLASH_BUTTONS
sButInit.pDisplay = intDisplayButtonFlash;
#else
@ -559,7 +547,6 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
// add the turret part button
sButInit.formID = IDDES_PARTFORM;
sButInit.id = IDDES_SYSTEMBUTTON;
sButInit.style = WBUT_PLAIN;
sButInit.x = DES_PARTSEPARATIONX;
sButInit.y = (UWORD)(iV_GetImageHeight(IntImages, IMAGE_DES_PROPULSION) +
iV_GetImageHeight(IntImages, IMAGE_DES_BODY) +
@ -567,7 +554,6 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
sButInit.width = iV_GetImageWidth(IntImages, IMAGE_DES_TURRET);
sButInit.height = iV_GetImageHeight(IntImages, IMAGE_DES_TURRET);
sButInit.pTip = _("Vehicle Turret");
sButInit.FontID = font_regular;
#ifdef FLASH_BUTTONS
sButInit.pDisplay = intDisplayButtonFlash;
#else
@ -582,7 +568,6 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
// add the turret_a button
sButInit.formID = IDDES_PARTFORM;
sButInit.id = IDDES_WPABUTTON;
sButInit.style = WBUT_PLAIN;
sButInit.x = DES_PARTSEPARATIONX;
// use BODY height for now
sButInit.y = (UWORD)(iV_GetImageHeight(IntImages, IMAGE_DES_PROPULSION) +
@ -592,7 +577,6 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
sButInit.width = iV_GetImageWidth(IntImages, IMAGE_DES_TURRET);
sButInit.height = iV_GetImageHeight(IntImages, IMAGE_DES_TURRET);
sButInit.pTip = _("Vehicle Turret");
sButInit.FontID = font_regular;
#ifdef FLASH_BUTTONS
sButInit.pDisplay = intDisplayButtonFlash;
#else
@ -607,7 +591,6 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
// add the turret_b button
sButInit.formID = IDDES_PARTFORM;
sButInit.id = IDDES_WPBBUTTON;
sButInit.style = WBUT_PLAIN;
sButInit.x = DES_PARTSEPARATIONX;
//use body height for now
sButInit.y = (UWORD)(iV_GetImageHeight(IntImages, IMAGE_DES_PROPULSION) +
@ -618,7 +601,6 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
sButInit.width = iV_GetImageWidth(IntImages, IMAGE_DES_TURRET);
sButInit.height = iV_GetImageHeight(IntImages, IMAGE_DES_TURRET);
sButInit.pTip = _("Vehicle Turret");
sButInit.FontID = font_regular;
#ifdef FLASH_BUTTONS
sButInit.pDisplay = intDisplayButtonFlash;
#else
@ -633,13 +615,11 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
/* add the delete button */
sButInit.formID = IDDES_PARTFORM;
sButInit.id = IDDES_BIN;
sButInit.style = WBUT_PLAIN;
sButInit.width = iV_GetImageWidth(IntImages, IMAGE_DES_BIN);
sButInit.height = iV_GetImageHeight(IntImages, IMAGE_DES_BIN);
sButInit.x = DES_PARTSEPARATIONX;
sButInit.y = (UWORD)(DES_PARTFORMHEIGHT - sButInit.height - DES_PARTSEPARATIONY);
sButInit.pTip = _("Delete Design");
sButInit.FontID = font_regular;
sButInit.pDisplay = intDisplayButtonHilight;
sButInit.UserData = PACKDWORD_TRI(0,IMAGE_DES_BINH, IMAGE_DES_BIN);
if (!widgAddButton(psWScreen, &sButInit))
@ -678,8 +658,6 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
/* Add the graphs for the Body */
sBarInit.formID = IDDES_BODYFORM;
sBarInit.id = IDDES_BODYARMOUR_K;
sBarInit.style = WBAR_PLAIN;
sBarInit.orientation = WBAR_LEFT;
sBarInit.x = DES_CLICKBARX;
sBarInit.y = DES_STATBAR_Y1; //DES_CLICKBARY;
sBarInit.width = DES_CLICKBARWIDTH;
@ -735,13 +713,11 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
/* Add the labels for the Body */
sLabInit.formID = IDDES_BODYFORM;
sLabInit.id = IDDES_BODYARMOURKLAB;
sLabInit.style = WLAB_PLAIN;
sLabInit.x = DES_CLICKBARNAMEX;
sLabInit.y = DES_CLICKBARY - DES_CLICKBARHEIGHT/3;
sLabInit.width = DES_CLICKBARNAMEWIDTH;
sLabInit.height = DES_CLICKBARHEIGHT;
sLabInit.pTip = _("Kinetic Armour");
sLabInit.FontID = font_regular;
sLabInit.pDisplay = intDisplayImage;
//just to confuse things even more - the graphics were named incorrectly!
sLabInit.UserData = IMAGE_DES_ARMOUR_EXPLOSIVE;//IMAGE_DES_ARMOUR_KINETIC;
@ -789,7 +765,7 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
}
/* add power/points bar subform */
memset(&sFormInit, 0, sizeof(W_FORMINIT));
sFormInit = W_FORMINIT();
sFormInit.formID = IDDES_FORM;
sFormInit.id = IDDES_POWERFORM;
sFormInit.style = WFORM_PLAIN;
@ -819,11 +795,9 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
return true;
}
memset(&sBarInit, 0, sizeof(W_BARINIT));
sBarInit = W_BARINIT();
sBarInit.formID = IDDES_POWERFORM;
sBarInit.id = IDDES_POWERBAR;
sBarInit.style = WBAR_PLAIN;
sBarInit.orientation = WBAR_LEFT;
sBarInit.x = (SWORD)(DES_POWERX + DES_POWERSEPARATIONX +
iV_GetImageWidth(IntImages,IMAGE_DES_BODYPOINTS));
sBarInit.y = DES_POWERY;
@ -852,11 +826,9 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
return true;
}
memset(&sBarInit, 0, sizeof(W_BARINIT));
sBarInit = W_BARINIT();
sBarInit.formID = IDDES_POWERFORM;
sBarInit.id = IDDES_BODYPOINTS;
sBarInit.style = WBAR_PLAIN;
sBarInit.orientation = WBAR_LEFT;
sBarInit.x = (SWORD)(DES_POWERX + DES_POWERSEPARATIONX +
iV_GetImageWidth(IntImages,IMAGE_DES_BODYPOINTS));
sBarInit.y = (SWORD)(DES_POWERY + DES_POWERSEPARATIONY + 4 +
@ -927,7 +899,6 @@ void desSetupDesignTemplates(void)
/* Add the design template form */
static BOOL _intAddTemplateForm(DROID_TEMPLATE *psSelected)
{
W_FORMINIT sFormInit;
UDWORD numButtons, butPerForm;
UDWORD i;
@ -949,7 +920,7 @@ static BOOL _intAddTemplateForm(DROID_TEMPLATE *psSelected)
(DES_TABBUTHEIGHT + DES_TABBUTGAP));
/* add a form to place the tabbed form on */
memset(&sFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = IDDES_TEMPLBASE;
sFormInit.style = WFORM_PLAIN;
@ -964,7 +935,7 @@ static BOOL _intAddTemplateForm(DROID_TEMPLATE *psSelected)
}
/* Add the design templates form */
memset(&sFormInit, 0, sizeof(W_FORMINIT));
sFormInit = W_FORMINIT();
sFormInit.formID = IDDES_TEMPLBASE; //IDDES_FORM;
sFormInit.id = IDDES_TEMPLFORM;
sFormInit.style = WFORM_TABBED;
@ -1022,8 +993,6 @@ BOOL intAddTemplateButtons(UDWORD formID, UDWORD formWidth, UDWORD formHeight,
UDWORD butWidth, UDWORD butHeight, UDWORD gap,
DROID_TEMPLATE *psSelected)
{
W_FORMINIT sButInit;
W_BARINIT sBarInit;
DROID_TEMPLATE *psTempl = NULL;
char aButText[DES_COMPBUTMAXCHAR + 1];
SDWORD BufferID;
@ -1034,9 +1003,9 @@ BOOL intAddTemplateButtons(UDWORD formID, UDWORD formWidth, UDWORD formHeight,
ClearStatBuffers();
memset(aButText, 0, DES_COMPBUTMAXCHAR + 1);
memset(&sButInit, 0, sizeof(W_BUTINIT));
/* Set up the button struct */
W_FORMINIT sButInit;
sButInit.formID = formID;
sButInit.id = IDDES_TEMPLSTART;
sButInit.style = WFORM_CLICKABLE;
@ -1046,10 +1015,8 @@ BOOL intAddTemplateButtons(UDWORD formID, UDWORD formWidth, UDWORD formHeight,
sButInit.height = OBJ_BUTHEIGHT; //DES_TABBUTHEIGHT;
/* Add each button */
memset(&sBarInit, 0, sizeof(W_BARINIT));
W_BARINIT sBarInit;
sBarInit.id = IDDES_BARSTART;
sBarInit.style = WBAR_PLAIN;
sBarInit.orientation = WBAR_LEFT;
sBarInit.x = STAT_TIMEBARX;
sBarInit.y = STAT_TIMEBARY;
sBarInit.width = STAT_PROGBARWIDTH;
@ -1448,15 +1415,8 @@ static void intSetDesignStats( DROID_TEMPLATE *psTemplate )
/* Set up the system clickable form of the design screen given a set of stats */
static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
{
W_FORMINIT sFormInit;
W_BARINIT sBarInit;
W_LABINIT sLabInit;
DES_SYSMODE newSysMode=(DES_SYSMODE)0;
memset(&sFormInit, 0, sizeof(W_FORMINIT));
memset(&sLabInit, 0, sizeof(W_LABINIT));
memset(&sBarInit, 0, sizeof(W_BARINIT));
/* Figure out what the new mode should be */
switch (statType(psStats->ref))
{
@ -1498,6 +1458,7 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
desSysMode = newSysMode;
/* Add the system form */
W_FORMINIT sFormInit;
sFormInit.formID = IDDES_STATSFORM;
sFormInit.id = IDDES_SYSTEMFORM;
sFormInit.style = (WFORM_CLICKABLE | WFORM_NOCLICKMOVE);
@ -1514,9 +1475,9 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
}
/* Initialise the bargraph struct */
W_BARINIT sBarInit;
sBarInit.formID = IDDES_SYSTEMFORM;
sBarInit.style = WBAR_PLAIN;//WBAR_DOUBLE;
sBarInit.orientation = WBAR_LEFT;
//sBarInit.style = WBAR_DOUBLE;
sBarInit.x = DES_CLICKBARX;
sBarInit.y = DES_STATBAR_Y1; //DES_CLICKBARY;
sBarInit.width = DES_CLICKBARWIDTH;
@ -1530,13 +1491,13 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
sBarInit.pDisplay = intDisplayStatsBar;
/* Initialise the label struct */
W_LABINIT sLabInit;
sLabInit.formID = IDDES_SYSTEMFORM;
sLabInit.style = WLAB_PLAIN;
sLabInit.x = DES_CLICKBARNAMEX;
sLabInit.y = DES_CLICKBARY - DES_CLICKBARHEIGHT/3;
sLabInit.width = DES_CLICKBARNAMEWIDTH;
sLabInit.height = DES_CLICKBARHEIGHT;
sLabInit.FontID = font_regular;
sLabInit.pDisplay = intDisplayImage;
/* See what type of system stats we've got */
if (psStats->ref >= REF_SENSOR_START &&
@ -1574,7 +1535,6 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
/* Add the labels */
sLabInit.id = IDDES_SENSORRANGELAB;
sLabInit.pTip = _("Sensor Range");
sLabInit.pDisplay = intDisplayImage;
sLabInit.UserData = IMAGE_DES_RANGE;
if (!widgAddLabel(psWScreen, &sLabInit))
{
@ -1583,7 +1543,6 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
sLabInit.id = IDDES_SENSORPOWERLAB;
sLabInit.y += DES_CLICKBARHEIGHT + DES_CLICKGAP;
sLabInit.pTip = _("Sensor Power");
sLabInit.pDisplay = intDisplayImage;
sLabInit.UserData = IMAGE_DES_POWER;
if (!widgAddLabel(psWScreen, &sLabInit))
{
@ -1592,7 +1551,6 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
sLabInit.id = IDDES_SENSORWEIGHTLAB;
sLabInit.y += DES_CLICKBARHEIGHT + DES_CLICKGAP;
sLabInit.pTip = _("Weight");
sLabInit.pDisplay = intDisplayImage;
sLabInit.UserData = IMAGE_DES_WEIGHT;
if (!widgAddLabel(psWScreen, &sLabInit))
{
@ -1622,7 +1580,6 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
/* Add the labels */
sLabInit.id = IDDES_ECMPOWERLAB;
sLabInit.pTip = _("ECM Power");
sLabInit.pDisplay = intDisplayImage;
sLabInit.UserData = IMAGE_DES_POWER;
if (!widgAddLabel(psWScreen, &sLabInit))
{
@ -1631,7 +1588,6 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
sLabInit.id = IDDES_ECMWEIGHTLAB;
sLabInit.y += DES_CLICKBARHEIGHT + DES_CLICKGAP;
sLabInit.pTip = _("Weight");
sLabInit.pDisplay = intDisplayImage;
sLabInit.UserData = IMAGE_DES_WEIGHT;
if (!widgAddLabel(psWScreen, &sLabInit))
{
@ -1661,7 +1617,6 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
/* Add the labels */
sLabInit.id = IDDES_CONSTPOINTSLAB;
sLabInit.pTip = _("Build Points");
sLabInit.pDisplay = intDisplayImage;
sLabInit.UserData = IMAGE_DES_BUILDRATE;
if (!widgAddLabel(psWScreen, &sLabInit))
{
@ -1670,7 +1625,6 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
sLabInit.id = IDDES_CONSTWEIGHTLAB;
sLabInit.y += DES_CLICKBARHEIGHT + DES_CLICKGAP;
sLabInit.pTip = _("Weight");
sLabInit.pDisplay = intDisplayImage;
sLabInit.UserData = IMAGE_DES_WEIGHT;
if (!widgAddLabel(psWScreen, &sLabInit))
{
@ -1700,7 +1654,6 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
/* Add the labels */
sLabInit.id = IDDES_REPAIRPTLAB;
sLabInit.pTip = _("Build Points");
sLabInit.pDisplay = intDisplayImage;
sLabInit.UserData = IMAGE_DES_BUILDRATE;
if (!widgAddLabel(psWScreen, &sLabInit))
{
@ -1709,7 +1662,6 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
sLabInit.id = IDDES_REPAIRWGTLAB;
sLabInit.y += DES_CLICKBARHEIGHT + DES_CLICKGAP;
sLabInit.pTip = _("Weight");
sLabInit.pDisplay = intDisplayImage;
sLabInit.UserData = IMAGE_DES_WEIGHT;
if (!widgAddLabel(psWScreen, &sLabInit))
{
@ -1729,7 +1681,7 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
{
return false;
}
sBarInit.denominator = 0;
sBarInit.denominator = 1;
sBarInit.precision = 0;
sBarInit.id = IDDES_WEAPDAMAGE;
sBarInit.y = DES_STATBAR_Y2; //+= DES_CLICKBARHEIGHT + DES_CLICKGAP;
@ -1759,7 +1711,6 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
/* Add the labels */
sLabInit.id = IDDES_WEAPRANGELAB;
sLabInit.pTip = _("Range");
sLabInit.pDisplay = intDisplayImage;
sLabInit.UserData = IMAGE_DES_RANGE;
if (!widgAddLabel(psWScreen, &sLabInit))
{
@ -1768,7 +1719,6 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
sLabInit.id = IDDES_WEAPDAMAGELAB;
sLabInit.y += DES_CLICKBARHEIGHT + DES_CLICKGAP;
sLabInit.pTip = _("Damage");
sLabInit.pDisplay = intDisplayImage;
sLabInit.UserData = IMAGE_DES_DAMAGE;
if (!widgAddLabel(psWScreen, &sLabInit))
{
@ -1777,7 +1727,6 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
sLabInit.id = IDDES_WEAPROFLAB;
sLabInit.y += DES_CLICKBARHEIGHT + DES_CLICKGAP;
sLabInit.pTip = _("Rate-of-Fire");
sLabInit.pDisplay = intDisplayImage;
sLabInit.UserData = IMAGE_DES_FIRERATE;
if (!widgAddLabel(psWScreen, &sLabInit))
{
@ -1786,7 +1735,6 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
sLabInit.id = IDDES_WEAPWEIGHTLAB;
sLabInit.y += DES_CLICKBARHEIGHT + DES_CLICKGAP;
sLabInit.pTip = _("Weight");
sLabInit.pDisplay = intDisplayImage;
sLabInit.UserData = IMAGE_DES_WEIGHT;
if (!widgAddLabel(psWScreen, &sLabInit))
{
@ -1827,17 +1775,10 @@ static BOOL _intSetSystemForm(COMPONENT_STATS *psStats)
/* Set up the propulsion clickable form of the design screen given a set of stats */
static BOOL intSetPropulsionForm(PROPULSION_STATS *psStats)
{
W_FORMINIT sFormInit;
W_BARINIT sBarInit;
W_LABINIT sLabInit;
DES_PROPMODE newPropMode=(DES_PROPMODE)0;
ASSERT_OR_RETURN(false, psStats != NULL, "Invalid propulsion stats pointer");
memset(&sFormInit, 0, sizeof(W_FORMINIT));
memset(&sLabInit, 0, sizeof(W_LABINIT));
memset(&sBarInit, 0, sizeof(W_BARINIT));
/* figure out what the new mode should be */
switch (asPropulsionTypes[psStats->propulsionType].travel)
{
@ -1866,6 +1807,7 @@ static BOOL intSetPropulsionForm(PROPULSION_STATS *psStats)
desPropMode = newPropMode;
/* Add the propulsion form */
W_FORMINIT sFormInit;
sFormInit.formID = IDDES_STATSFORM;
sFormInit.id = IDDES_PROPFORM;
sFormInit.style = WFORM_CLICKABLE | WFORM_NOCLICKMOVE;
@ -1881,9 +1823,9 @@ static BOOL intSetPropulsionForm(PROPULSION_STATS *psStats)
}
/* Initialise the bargraph struct */
W_BARINIT sBarInit;
sBarInit.formID = IDDES_PROPFORM;
sBarInit.style = WBAR_PLAIN;//WBAR_DOUBLE;
sBarInit.orientation = WBAR_LEFT;
//sBarInit.style = WBAR_DOUBLE;
sBarInit.x = DES_CLICKBARX;
sBarInit.y = DES_STATBAR_Y1; //DES_CLICKBARY;
sBarInit.width = DES_CLICKBARWIDTH;
@ -1897,13 +1839,13 @@ static BOOL intSetPropulsionForm(PROPULSION_STATS *psStats)
sBarInit.pDisplay = intDisplayStatsBar;
/* Initialise the label struct */
W_LABINIT sLabInit;
sLabInit.formID = IDDES_PROPFORM;
sLabInit.style = WLAB_PLAIN;
sLabInit.x = DES_CLICKBARNAMEX;
sLabInit.y = DES_CLICKBARY - DES_CLICKBARHEIGHT/3;
sLabInit.width = DES_CLICKBARNAMEWIDTH;
sLabInit.height = DES_CLICKBARNAMEHEIGHT; //DES_CLICKBARHEIGHT;
sLabInit.FontID = font_regular;
sLabInit.pDisplay = intDisplayImage;
/* See what type of propulsion we've got */
switch (desPropMode)
@ -1919,7 +1861,7 @@ static BOOL intSetPropulsionForm(PROPULSION_STATS *psStats)
{
return false;
}
sBarInit.denominator = 0;
sBarInit.denominator = 1;
sBarInit.precision = 0;
sBarInit.id = IDDES_PROPWEIGHT;
sBarInit.y = DES_STATBAR_Y2; //+= DES_CLICKBARHEIGHT + DES_CLICKGAP;
@ -1933,7 +1875,6 @@ static BOOL intSetPropulsionForm(PROPULSION_STATS *psStats)
/* Add the labels */
sLabInit.id = IDDES_PROPAIRLAB;
sLabInit.pTip = _("Air Speed");
sLabInit.pDisplay = intDisplayImage;
sLabInit.UserData = IMAGE_DES_HOVER;
if (!widgAddLabel(psWScreen, &sLabInit))
{
@ -1942,7 +1883,6 @@ static BOOL intSetPropulsionForm(PROPULSION_STATS *psStats)
sLabInit.id = IDDES_PROPWEIGHTLAB;
sLabInit.y += DES_CLICKBARHEIGHT + DES_CLICKGAP;
sLabInit.pTip = _("Weight");
sLabInit.pDisplay = intDisplayImage;
sLabInit.UserData = IMAGE_DES_WEIGHT;
if (!widgAddLabel(psWScreen, &sLabInit))
{
@ -1976,7 +1916,7 @@ static BOOL intSetPropulsionForm(PROPULSION_STATS *psStats)
{
return false;
}
sBarInit.denominator = 0;
sBarInit.denominator = 1;
sBarInit.precision = 0;
sBarInit.id = IDDES_PROPWEIGHT;
sBarInit.y = DES_STATBAR_Y4; //+= DES_CLICKBARHEIGHT + DES_CLICKGAP;
@ -1990,7 +1930,6 @@ static BOOL intSetPropulsionForm(PROPULSION_STATS *psStats)
/* Add the labels */
sLabInit.id = IDDES_PROPROADLAB;
sLabInit.pTip = _("Road Speed");
sLabInit.pDisplay = intDisplayImage;
sLabInit.UserData = IMAGE_DES_ROAD;
if (!widgAddLabel(psWScreen, &sLabInit))
{
@ -1999,7 +1938,6 @@ static BOOL intSetPropulsionForm(PROPULSION_STATS *psStats)
sLabInit.id = IDDES_PROPCOUNTRYLAB;
sLabInit.y += DES_CLICKBARHEIGHT + DES_CLICKGAP;
sLabInit.pTip = _("Off-Road Speed");
sLabInit.pDisplay = intDisplayImage;
sLabInit.UserData = IMAGE_DES_CROSSCOUNTRY;
if (!widgAddLabel(psWScreen, &sLabInit))
{
@ -2008,7 +1946,6 @@ static BOOL intSetPropulsionForm(PROPULSION_STATS *psStats)
sLabInit.id = IDDES_PROPWATERLAB;
sLabInit.y += DES_CLICKBARHEIGHT + DES_CLICKGAP;
sLabInit.pTip = _("Water Speed");
sLabInit.pDisplay = intDisplayImage;
sLabInit.UserData = IMAGE_DES_HOVER; //WATER;
if (!widgAddLabel(psWScreen, &sLabInit))
{
@ -2017,7 +1954,6 @@ static BOOL intSetPropulsionForm(PROPULSION_STATS *psStats)
sLabInit.id = IDDES_PROPWEIGHTLAB;
sLabInit.y += DES_CLICKBARHEIGHT + DES_CLICKGAP;
sLabInit.pTip = _("Weight");
sLabInit.pDisplay = intDisplayImage;
sLabInit.UserData = IMAGE_DES_WEIGHT;
if (!widgAddLabel(psWScreen, &sLabInit))
{
@ -2068,14 +2004,12 @@ static UDWORD intNumAvailable(UBYTE *aAvailable, UDWORD numEntries,
/* Add the component tab form to the design screen */
static BOOL intAddComponentForm(UDWORD numButtons)
{
W_FORMINIT sFormInit;
UDWORD i, butPerForm, numFrm;
memset(&sFormInit, 0, sizeof(W_FORMINIT));
butPerForm = DES_BUTSPERFORM;
/* add a form to place the tabbed form on */
memset(&sFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = IDDES_RIGHTBASE;
sFormInit.style = WFORM_PLAIN;
@ -2090,7 +2024,7 @@ static BOOL intAddComponentForm(UDWORD numButtons)
}
//now a single form
memset(&sFormInit, 0, sizeof(W_FORMINIT));
sFormInit = W_FORMINIT();
sFormInit.formID = IDDES_RIGHTBASE;
sFormInit.id = IDDES_COMPFORM;
sFormInit.style = WFORM_TABBED;
@ -2129,20 +2063,15 @@ static BOOL intAddComponentForm(UDWORD numButtons)
/* Add the system buttons (weapons, command droid, etc) to the design screen */
static BOOL intAddSystemButtons(DES_COMPMODE mode)
{
W_BUTINIT sButInit;
memset(&sButInit, 0, sizeof(W_BUTINIT));
// add the weapon button
W_BUTINIT sButInit;
sButInit.formID = IDDES_RIGHTBASE;
sButInit.id = IDDES_WEAPONS;
sButInit.style = WBUT_PLAIN;
sButInit.x = DES_WEAPONBUTTON_X;
sButInit.y = DES_SYSTEMBUTTON_Y;
sButInit.width = iV_GetImageWidth(IntImages, IMAGE_DES_WEAPONS);
sButInit.height = iV_GetImageHeight(IntImages, IMAGE_DES_WEAPONS);
sButInit.pTip = _("Weapons");
sButInit.FontID = font_regular;
sButInit.pDisplay = intDisplayButtonHilight;
sButInit.UserData = PACKDWORD_TRI(0,IMAGE_DES_EXTRAHI , IMAGE_DES_WEAPONS);
if (!widgAddButton(psWScreen, &sButInit))
@ -2158,13 +2087,11 @@ static BOOL intAddSystemButtons(DES_COMPMODE mode)
// add the system button
sButInit.formID = IDDES_RIGHTBASE;
sButInit.id = IDDES_SYSTEMS;
sButInit.style = WBUT_PLAIN;
sButInit.x = DES_SYSTEMBUTTON_X;
sButInit.y = DES_SYSTEMBUTTON_Y;
sButInit.width = iV_GetImageWidth(IntImages, IMAGE_DES_SYSTEMS);
sButInit.height = iV_GetImageHeight(IntImages, IMAGE_DES_SYSTEMS);
sButInit.pTip = _("Systems");
sButInit.FontID = font_regular;
sButInit.pDisplay = intDisplayButtonHilight;
sButInit.UserData = PACKDWORD_TRI(0,IMAGE_DES_EXTRAHI , IMAGE_DES_SYSTEMS);
if (!widgAddButton(psWScreen, &sButInit))
@ -2201,7 +2128,6 @@ static BOOL intAddComponentButtons(COMPONENT_STATS *psStats, UDWORD size,
UBYTE *aAvailable, UDWORD numEntries,
UDWORD compID,UDWORD WhichTab)
{
W_FORMINIT sButInit;
W_TABFORM *psTabForm;
UDWORD i, maxComponents;
COMPONENT_STATS *psCurrStats;
@ -2214,9 +2140,9 @@ static BOOL intAddComponentButtons(COMPONENT_STATS *psStats, UDWORD size,
ClearObjectBuffers();
memset(aButText, 0, DES_COMPBUTMAXCHAR + 1);
memset(&sButInit, 0, sizeof(W_BUTINIT));
/* Set up the button struct */
W_FORMINIT sButInit;
sButInit.formID = IDDES_COMPFORM;
sButInit.majorID = IDES_MAINTAB;
sButInit.minorID = 0;
@ -2413,7 +2339,6 @@ static BOOL intAddExtraSystemButtons(UDWORD sensorIndex, UDWORD ecmIndex,
UDWORD constIndex, UDWORD repairIndex,
UDWORD brainIndex)
{
W_FORMINIT sButInit;
UDWORD i, buttonType, size=0;
UDWORD compIndex=0, numStats=0;
COMPONENT_STATS *psCurrStats=0;
@ -2422,9 +2347,9 @@ static BOOL intAddExtraSystemButtons(UDWORD sensorIndex, UDWORD ecmIndex,
SDWORD BufferID;
memset(aButText, 0, DES_COMPBUTMAXCHAR + 1);
memset(&sButInit, 0, sizeof(W_BUTINIT));
// Set up the button struct
W_FORMINIT sButInit;
sButInit.formID = IDDES_COMPFORM;
sButInit.majorID = 0;
sButInit.minorID = 0;

View File

@ -508,8 +508,6 @@ static void NetworkDisplayImage(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset
static void setupConnectionStatusForm(void)
{
static W_FORMINIT sFormInit;
static W_BUTINIT sButInit;
static unsigned prevStatusMask = 0;
const int separation = 3;
@ -545,7 +543,7 @@ static void setupConnectionStatusForm(void)
{
unsigned n = 0;
// Create the basic form
memset(&sFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = NETWORK_FORM_ID;
sFormInit.style = WFORM_PLAIN;
@ -568,12 +566,11 @@ static void setupConnectionStatusForm(void)
}
//set up default button data
memset(&sButInit, 0, sizeof(W_BUTINIT));
W_BUTINIT sButInit;
sButInit.formID = NETWORK_FORM_ID;
sButInit.id = NETWORK_BUT_ID + i;
sButInit.width = 36;
sButInit.height = 24;
sButInit.FontID = font_regular;
//add button
sButInit.style = WBUT_PLAIN;

View File

@ -289,10 +289,20 @@ DROID::DROID(uint32_t id, unsigned player)
, droidType(DROID_ANY)
, psGroup(NULL)
, psGrpNext(NULL)
, order(DORDER_NONE)
, orderX(0), orderY(0)
, orderX2(0), orderY2(0)
, orderDirection(0)
, psTarget(NULL)
, psTarStats(NULL)
, secondaryOrder(DSS_ARANGE_DEFAULT | DSS_REPLEV_NEVER | DSS_ALEV_ALWAYS | DSS_HALT_GUARD)
, action(DACTION_NONE)
, actionX(0), actionY(0)
, psCurAnim(NULL)
, gameCheckDroid(NULL)
{
sMove.asPath = NULL;
sMove.Status = MOVEINACTIVE;
}
/* DROID::~DROID: release all resources associated with a droid -
@ -2467,34 +2477,8 @@ DROID *reallyBuildDroid(DROID_TEMPLATE *pTemplate, UDWORD x, UDWORD y, UDWORD pl
grpJoin(psGrp, psDroid);
}
psDroid->order = DORDER_NONE;
psDroid->orderX = 0;
psDroid->orderY = 0;
psDroid->orderX2 = 0;
psDroid->orderY2 = 0;
psDroid->secondaryOrder = DSS_ARANGE_DEFAULT | DSS_REPLEV_NEVER | DSS_ALEV_ALWAYS | DSS_HALT_GUARD;
psDroid->action = DACTION_NONE;
psDroid->actionX = 0;
psDroid->actionY = 0;
psDroid->psTarStats = NULL;
psDroid->psTarget = NULL;
psDroid->lastFrustratedTime = -UINT16_MAX; // make sure we do not start the game frustrated
// Is setting asWeaps here needed? The first numWeaps entries are set in droidSetBits, too.)
for(i = 0;i < DROID_MAXWEAPS;i++)
{
psDroid->psActionTarget[i] = NULL;
psDroid->asWeaps[i].lastFired = 0;
psDroid->asWeaps[i].shotsFired = 0;
psDroid->asWeaps[i].nStat = 0;
psDroid->asWeaps[i].ammo = 0;
psDroid->asWeaps[i].recoilValue = 0;
psDroid->asWeaps[i].rot.direction = 0;
psDroid->asWeaps[i].rot.roll = 0;
psDroid->asWeaps[i].rot.pitch = 0;
psDroid->asWeaps[i].prevRot = psDroid->asWeaps[i].rot;
}
psDroid->listSize = 0;
psDroid->listPendingBegin = 0;
@ -2541,12 +2525,6 @@ DROID *reallyBuildDroid(DROID_TEMPLATE *pTemplate, UDWORD x, UDWORD y, UDWORD pl
initDroidMovement(psDroid);
psDroid->selected = false;
psDroid->lastEmission = 0;
psDroid->bTargetted = false;
psDroid->timeLastHit = UDWORD_MAX;
psDroid->lastHitWeapon = WSC_NUM_WEAPON_SUBCLASSES; // no such weapon
// it was never drawn before
psDroid->sDisplay.frameNumber = 0;
@ -2657,8 +2635,6 @@ void initDroidMovement(DROID *psDroid)
// Set the asBits in a DROID structure given it's template.
void droidSetBits(DROID_TEMPLATE *pTemplate,DROID *psDroid)
{
UDWORD inc;
psDroid->droidType = droidTemplateType(pTemplate);
psDroid->rot.direction = 0;
psDroid->rot.pitch = 0;
@ -2671,26 +2647,25 @@ void droidSetBits(DROID_TEMPLATE *pTemplate,DROID *psDroid)
psDroid->prevSpacetime.time = psDroid->time - 1; // -1 for interpolation.
//create the droids weapons
if (pTemplate->numWeaps > 0)
{
for (inc=0; inc < pTemplate->numWeaps; inc++)
{
psDroid->asWeaps[inc].lastFired=0;
psDroid->asWeaps[inc].shotsFired=0;
psDroid->asWeaps[inc].nStat = pTemplate->asWeaps[inc];
psDroid->asWeaps[inc].recoilValue = 0;
psDroid->asWeaps[inc].ammo = (asWeaponStats + psDroid->asWeaps[inc].nStat)->numRounds;
psDroid->asWeaps[inc].rot.direction = 0;
psDroid->asWeaps[inc].rot.pitch = 0;
psDroid->asWeaps[inc].rot.roll = 0;
psDroid->asWeaps[inc].prevRot = psDroid->asWeaps[inc].rot;
}
}
else
for (int inc = 0; inc < DROID_MAXWEAPS; inc++)
{
psDroid->psActionTarget[inc] = NULL;
psDroid->asWeaps[inc].lastFired=0;
psDroid->asWeaps[inc].shotsFired=0;
// no weapon (could be a construction droid for example)
// this is also used to check if a droid has a weapon, so zero it
psDroid->asWeaps[0].nStat = 0;
psDroid->asWeaps[inc].nStat = 0;
psDroid->asWeaps[inc].recoilValue = 0;
psDroid->asWeaps[inc].ammo = 0;
psDroid->asWeaps[inc].rot.direction = 0;
psDroid->asWeaps[inc].rot.pitch = 0;
psDroid->asWeaps[inc].rot.roll = 0;
psDroid->asWeaps[inc].prevRot = psDroid->asWeaps[inc].rot;
if (inc < pTemplate->numWeaps)
{
psDroid->asWeaps[inc].nStat = pTemplate->asWeaps[inc];
psDroid->asWeaps[inc].ammo = (asWeaponStats + psDroid->asWeaps[inc].nStat)->numRounds;
}
}
//allocate the components hit points
psDroid->asBits[COMP_BODY].nStat = (UBYTE)pTemplate->asParts[COMP_BODY];

View File

@ -327,13 +327,9 @@ FEATURE * buildFeature(FEATURE_STATS *psStats, UDWORD x, UDWORD y,BOOL FromSave)
{
psFeature->rot.direction = 0;
}
psFeature->selected = false;
psFeature->body = psStats->body;
objSensorCache((BASE_OBJECT *)psFeature, NULL);
objEcmCache((BASE_OBJECT *)psFeature, NULL);
psFeature->bTargetted = false;
psFeature->timeLastHit = 0;
psFeature->lastHitWeapon = WSC_NUM_WEAPON_SUBCLASSES; // no such weapon
// it has never been drawn
psFeature->sDisplay.frameNumber = 0;

View File

@ -1496,9 +1496,7 @@ void displayTextOption(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, WZ_DECL
void addBackdrop(void)
{
W_FORMINIT sFormInit;
memset(&sFormInit, 0, sizeof(W_FORMINIT)); // Backdrop
W_FORMINIT sFormInit; // Backdrop
sFormInit.formID = 0;
sFormInit.id = FRONTEND_BACKDROP;
sFormInit.style = WFORM_PLAIN;
@ -1513,9 +1511,7 @@ void addBackdrop(void)
// ////////////////////////////////////////////////////////////////////////////
void addTopForm(void)
{
W_FORMINIT sFormInit;
memset(&sFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
sFormInit.formID = FRONTEND_BACKDROP;
sFormInit.id = FRONTEND_TOPFORM;
@ -1552,8 +1548,7 @@ void addTopForm(void)
// ////////////////////////////////////////////////////////////////////////////
void addBottomForm(void)
{
W_FORMINIT sFormInit;
memset(&sFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
sFormInit.formID = FRONTEND_BACKDROP;
sFormInit.id = FRONTEND_BOTFORM;
@ -1572,19 +1567,16 @@ void addBottomForm(void)
// ////////////////////////////////////////////////////////////////////////////
void addTextHint(UDWORD id, UDWORD PosX, UDWORD PosY, const char *txt)
{
W_LABINIT sLabInit;
memset(&sLabInit, 0, sizeof(W_LABINIT));
W_LABINIT sLabInit;
sLabInit.formID = FRONTEND_BOTFORM;
sLabInit.id = id;
sLabInit.x = (short)PosX;
sLabInit.y = (short)PosY;
sLabInit.style = WLAB_PLAIN;
sLabInit.width = MULTIOP_READY_WIDTH;
sLabInit.height = FRONTEND_BUTHEIGHT;
sLabInit.pDisplay = displayText;
sLabInit.FontID = font_regular;
sLabInit.pText = txt;
widgAddLabel(psWScreen, &sLabInit);
}
@ -1592,14 +1584,13 @@ void addTextHint(UDWORD id, UDWORD PosX, UDWORD PosY, const char *txt)
// ////////////////////////////////////////////////////////////////////////////
void addText(UDWORD id, UDWORD PosX, UDWORD PosY, const char *txt, UDWORD formID)
{
W_LABINIT sLabInit;
memset(&sLabInit, 0, sizeof(W_LABINIT));
W_LABINIT sLabInit;
sLabInit.formID = formID;
sLabInit.id = id;
sLabInit.x = (short)PosX;
sLabInit.y = (short)PosY;
sLabInit.style = (WLAB_PLAIN | WLAB_ALIGNCENTRE);
sLabInit.style = WLAB_ALIGNCENTRE;
// Align
sLabInit.width = MULTIOP_READY_WIDTH;
@ -1615,12 +1606,10 @@ void addText(UDWORD id, UDWORD PosX, UDWORD PosY, const char *txt, UDWORD formID
// ////////////////////////////////////////////////////////////////////////////
void addSideText(UDWORD id, UDWORD PosX, UDWORD PosY, const char *txt)
{
W_LABINIT sLabInit;
memset(&sLabInit, 0, sizeof(W_LABINIT));
W_LABINIT sLabInit;
sLabInit.formID = FRONTEND_BACKDROP;
sLabInit.id = id;
sLabInit.style = WLAB_PLAIN;
sLabInit.x = (short) PosX;
sLabInit.y = (short) PosY;
sLabInit.width = 30;
@ -1636,14 +1625,12 @@ void addSideText(UDWORD id, UDWORD PosX, UDWORD PosY, const char *txt)
// ////////////////////////////////////////////////////////////////////////////
void addTextButton(UDWORD id, UDWORD PosX, UDWORD PosY, const char *txt, unsigned int style)
{
W_BUTINIT sButInit;
memset(&sButInit, 0, sizeof(W_BUTINIT));
W_BUTINIT sButInit;
sButInit.formID = FRONTEND_BOTFORM;
sButInit.id = id;
sButInit.x = (short)PosX;
sButInit.y = (short)PosY;
sButInit.style = WBUT_PLAIN;
// Align
if ( !(style & WBUT_TXTCENTRE) )
@ -1681,17 +1668,13 @@ void addTextButton(UDWORD id, UDWORD PosX, UDWORD PosY, const char *txt, unsign
// ////////////////////////////////////////////////////////////////////////////
void addFESlider(UDWORD id, UDWORD parent, UDWORD x, UDWORD y, UDWORD stops, UDWORD pos)
{
W_SLDINIT sSldInit;
memset(&sSldInit, 0, sizeof(W_SLDINIT));
W_SLDINIT sSldInit;
sSldInit.formID = parent;
sSldInit.id = id;
sSldInit.style = WSLD_PLAIN;
sSldInit.x = (short)x;
sSldInit.y = (short)y;
sSldInit.width = iV_GetImageWidth(IntImages,IMAGE_SLIDER_BIG);
sSldInit.height = iV_GetImageHeight(IntImages,IMAGE_SLIDER_BIG);
sSldInit.orientation= WSLD_LEFT;
sSldInit.numStops = (UBYTE) stops;
sSldInit.barSize = iV_GetImageHeight(IntImages,IMAGE_SLIDER_BIG);
sSldInit.pos = (UBYTE) pos;
@ -1702,17 +1685,13 @@ void addFESlider(UDWORD id, UDWORD parent, UDWORD x, UDWORD y, UDWORD stops, UDW
void addFEAISlider(UDWORD id, UDWORD parent, UDWORD x, UDWORD y, UDWORD stops, UDWORD pos)
{
W_SLDINIT sSldInit;
memset(&sSldInit, 0, sizeof(W_SLDINIT));
W_SLDINIT sSldInit;
sSldInit.formID = parent;
sSldInit.id = id;
sSldInit.style = WSLD_PLAIN;
sSldInit.x = (short)x;
sSldInit.y = (short)y;
sSldInit.width = iV_GetImageWidth(IntImages,IMAGE_SLIDER_BIG);
sSldInit.height = iV_GetImageHeight(IntImages,IMAGE_SLIDER_BIG);
sSldInit.orientation= WSLD_LEFT;
sSldInit.numStops = (UBYTE) stops;
sSldInit.barSize = iV_GetImageHeight(IntImages,IMAGE_SLIDER_BIG);
sSldInit.pos = (UBYTE) pos;

View File

@ -917,10 +917,6 @@ static BOOL intAddEdit(void)
W_LABINIT sLabInit;
W_BUTINIT sButInit;
memset(&sFormInit, 0, sizeof(W_FORMINIT));
memset(&sLabInit, 0, sizeof(W_LABINIT));
memset(&sButInit, 0, sizeof(W_BUTINIT));
/* Add the edit form */
sFormInit.formID = 0;
sFormInit.id = IDED_FORM;
@ -937,13 +933,11 @@ static BOOL intAddEdit(void)
/* Add the Option screen label */
sLabInit.formID = IDED_FORM;
sLabInit.id = IDED_LABEL;
sLabInit.style = WLAB_PLAIN;
sLabInit.x = ED_GAP;
sLabInit.y = ED_GAP;
sLabInit.width = ED_WIDTH;
sLabInit.height = ED_BUTHEIGHT;
sLabInit.pText = "Edit";
sLabInit.FontID = font_regular;
if (!widgAddLabel(psWScreen, &sLabInit))
{
return false;
@ -952,12 +946,10 @@ static BOOL intAddEdit(void)
/* Add the close box */
sButInit.formID = IDED_FORM;
sButInit.id = IDED_CLOSE;
sButInit.style = WBUT_PLAIN;
sButInit.x = ED_WIDTH - ED_GAP - CLOSE_SIZE;
sButInit.y = ED_GAP;
sButInit.width = CLOSE_SIZE;
sButInit.height = CLOSE_SIZE;
sButInit.FontID = font_regular;
sButInit.pText = pCloseText;
sButInit.pTip = _("Close");
if (!widgAddButton(psWScreen, &sButInit))
@ -3425,13 +3417,12 @@ UWORD numForms(UDWORD total, UDWORD perForm)
/* Add the reticule widgets to the widget screen */
BOOL intAddReticule(void)
{
if(ReticuleUp == false) {
W_FORMINIT sFormInit;
W_BUTINIT sButInit;
if (!ReticuleUp)
{
/* Create the basic form */
memset(&sFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = IDRET_FORM;
sFormInit.style = WFORM_PLAIN;
@ -3448,18 +3439,17 @@ BOOL intAddReticule(void)
/* Now add the buttons */
//set up default button data
memset(&sButInit, 0, sizeof(W_BUTINIT));
W_BUTINIT sButInit;
sButInit.formID = IDRET_FORM;
sButInit.id = IDRET_COMMAND;
sButInit.width = RET_BUTWIDTH;
sButInit.height = RET_BUTHEIGHT;
sButInit.FontID = font_regular;
//add buttons as required...
//options button
sButInit.style = WBUT_PLAIN;
SetReticuleButPos(RETBUT_COMMAND,&sButInit);
sButInit.style = WBUT_PLAIN;
sButInit.pTip = _("Commanders (F6)");
sButInit.pDisplay = intDisplayReticuleButton;
sButInit.UserData = IMAGE_COMMANDDROID_UP;
@ -3470,7 +3460,7 @@ BOOL intAddReticule(void)
}
/* Intelligence Map button - this needs to respond to RMB as well*/
sButInit.style = WBUT_PLAIN | WFORM_SECONDARY;
sButInit.style = WBUT_SECONDARY;
sButInit.id = IDRET_INTEL_MAP;
SetReticuleButPos(RETBUT_INTELMAP,&sButInit);
sButInit.pTip = _("Intelligence Display (F5)");
@ -3581,16 +3571,13 @@ void togglePowerBar(void)
/* Add the power bars to the screen */
BOOL intAddPower(void)
{
W_BARINIT sBarInit;
memset(&sBarInit, 0, sizeof(W_BARINIT));
W_BARINIT sBarInit;
/* Add the trough bar */
sBarInit.formID = 0; //IDPOW_FORM;
sBarInit.id = IDPOW_POWERBAR_T;
//start the power bar off in view (default)
sBarInit.style = WBAR_TROUGH;
sBarInit.orientation = WBAR_LEFT;
sBarInit.x = (SWORD)POW_X;
sBarInit.y = (SWORD)POW_Y;
sBarInit.width = POW_BARWIDTH;
@ -3628,11 +3615,6 @@ BOOL intAddOptions(void)
UDWORD player;
char aText[WIDG_MAXSTR];
memset(&sFormInit, 0, sizeof(W_FORMINIT));
memset(&sLabInit, 0, sizeof(W_LABINIT));
memset(&sButInit, 0, sizeof(W_BUTINIT));
memset(&sEdInit, 0, sizeof(W_EDBINIT));
/* Add the option form */
sFormInit.formID = 0;
@ -3653,13 +3635,11 @@ BOOL intAddOptions(void)
/* Add the Option screen label */
sLabInit.formID = IDOPT_FORM;
sLabInit.id = IDOPT_LABEL;
sLabInit.style = WLAB_PLAIN;
sLabInit.x = OPT_GAP;
sLabInit.y = OPT_GAP;
sLabInit.width = OPT_BUTWIDTH;
sLabInit.height = OPT_BUTHEIGHT;
sLabInit.pText = _("Options");
sLabInit.FontID = font_regular;
if (!widgAddLabel(psWScreen, &sLabInit))
{
return false;
@ -3668,12 +3648,10 @@ BOOL intAddOptions(void)
/* Add the close box */
sButInit.formID = IDOPT_FORM;
sButInit.id = IDOPT_CLOSE;
sButInit.style = WBUT_PLAIN;
sButInit.x = OPT_WIDTH - OPT_GAP - CLOSE_SIZE;
sButInit.y = OPT_GAP;
sButInit.width = CLOSE_SIZE;
sButInit.height = CLOSE_SIZE;
sButInit.FontID = font_regular;
sButInit.pText = pCloseText;
sButInit.pTip = _("Close");
if (!widgAddButton(psWScreen, &sButInit))
@ -3697,11 +3675,9 @@ BOOL intAddOptions(void)
/* Add the map label */
sLabInit.formID = IDOPT_MAPFORM;
sLabInit.id = IDOPT_MAPLABEL;
sLabInit.style = WLAB_PLAIN;
sLabInit.x = OPT_GAP;
sLabInit.y = OPT_GAP;
sLabInit.pText = _("Map:");
sLabInit.FontID = font_regular;
if (!widgAddLabel(psWScreen, &sLabInit))
{
return false;
@ -3743,14 +3719,12 @@ BOOL intAddOptions(void)
newMapHeight = mapHeight;
sEdInit.formID = IDOPT_MAPFORM;
sEdInit.id = IDOPT_MAPWIDTH;
sEdInit.style = WEDB_PLAIN;
sEdInit.x = OPT_GAP*2 + OPT_BUTWIDTH;
sEdInit.y = OPT_GAP*2 + OPT_BUTHEIGHT;
sEdInit.width = OPT_BUTWIDTH;
sEdInit.height = OPT_BUTHEIGHT;
sEdInit.pText = aText;
sprintf(aText, "%d", mapWidth);
sEdInit.FontID = font_regular;
if (!widgAddEditBox(psWScreen, &sEdInit))
{
return false;
@ -3872,11 +3846,9 @@ BOOL intAddOptions(void)
/* Add the player label */
sLabInit.formID = IDOPT_PLAYERFORM;
sLabInit.id = IDOPT_PLAYERLABEL;
sLabInit.style = WLAB_PLAIN;
sLabInit.x = OPT_GAP;
sLabInit.y = OPT_GAP;
sLabInit.pText = _("Current Player:");
sLabInit.FontID = font_regular;
if (!widgAddLabel(psWScreen, &sLabInit))
{
return false;
@ -3885,12 +3857,10 @@ BOOL intAddOptions(void)
/* Add the player buttons */
sButInit.formID = IDOPT_PLAYERFORM;
sButInit.id = IDOPT_PLAYERSTART;
sButInit.style = WBUT_PLAIN;
sButInit.x = OPT_GAP;
sButInit.y = OPT_BUTHEIGHT + OPT_GAP*2;
sButInit.width = OPT_BUTWIDTH;
sButInit.height = OPT_BUTHEIGHT;
sButInit.FontID = font_regular;
for(player = 0; player < MAX_PLAYERS; player++)
{
sButInit.pText = apPlayerText[player];
@ -3926,11 +3896,9 @@ BOOL intAddOptions(void)
/* Add iViS label */
sLabInit.formID = IDOPT_IVISFORM;
sLabInit.id = IDOPT_IVISLABEL;
sLabInit.style = WLAB_PLAIN;
sLabInit.x = OPT_GAP;
sLabInit.y = OPT_GAP;
sLabInit.pText = "iViS:";
sLabInit.FontID = font_regular;
if (!widgAddLabel(psWScreen, &sLabInit))
{
return false;
@ -3943,7 +3911,6 @@ BOOL intAddOptions(void)
sButInit.y = OPT_GAP;
sButInit.width = OPT_BUTWIDTH;
sButInit.height = OPT_BUTHEIGHT;
sButInit.FontID = font_regular;
sButInit.pText = "Lighting";
sButInit.pTip = "Toggles lighting On/Off.";
if (!widgAddButton(psWScreen, &sButInit))
@ -3970,11 +3937,6 @@ BOOL intAddOptions(void)
*/
static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,BOOL bForceStats)
{
W_FORMINIT sFormInit;
W_FORMINIT sBFormInit,sBFormInit2;
W_BARINIT sBarInit;
W_BARINIT sBarInit2;
W_BUTINIT sButInit;
UDWORD displayForm;
UDWORD i, statID=0;
SDWORD objLoop;
@ -3983,11 +3945,6 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
SDWORD BufferID;
DROID *Droid;
STRUCTURE *Structure;
W_LABINIT sLabInit;
W_LABINIT sLabIntObjText;
W_LABINIT sLabInitCmdExp;
W_LABINIT sLabInitCmdFac;
W_LABINIT sLabInitCmdFac2;
BOOL IsFactory;
BOOL Animate = true;
UWORD FormX,FormY;
@ -4009,11 +3966,6 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
ClearObjectBuffers();
ClearTopicBuffers();
memset(&sFormInit, 0, sizeof(W_FORMINIT));
memset(&sBFormInit, 0, sizeof(W_FORMINIT));
memset(&sBFormInit2, 0, sizeof(W_FORMINIT));
memset(&sBarInit, 0, sizeof(W_BARINIT));
/* See how many objects the player has */
numObjects = 0;
psFirst = NULL;
@ -4134,6 +4086,7 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
/* Create the basic form */
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = IDOBJ_FORM;
sFormInit.style = WFORM_PLAIN;
@ -4157,16 +4110,14 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
}
/* Add the close button */
memset(&sButInit, 0, sizeof(W_BUTINIT));
W_BUTINIT sButInit;
sButInit.formID = IDOBJ_FORM;
sButInit.id = IDOBJ_CLOSE;
sButInit.style = WBUT_PLAIN;
sButInit.x = OBJ_BACKWIDTH - CLOSE_WIDTH;
sButInit.y = 0;
sButInit.width = CLOSE_WIDTH;
sButInit.height = CLOSE_HEIGHT;
sButInit.pTip = _("Close");
sButInit.FontID = font_regular;
sButInit.pDisplay = intDisplayImageHilight;
sButInit.UserData = PACKDWORD_TRI(0,IMAGE_CLOSEHILIGHT , IMAGE_CLOSE);
if (!widgAddButton(psWScreen, &sButInit))
@ -4176,7 +4127,7 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
/*add the tabbed form */
memset(&sFormInit, 0, sizeof(W_FORMINIT));
sFormInit = W_FORMINIT();
sFormInit.formID = IDOBJ_FORM;
sFormInit.id = IDOBJ_TABFORM;
sFormInit.style = WFORM_TABBED;
@ -4219,6 +4170,7 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
objNumTabs = sFormInit.numMajor;
/* Add the object and stats buttons */
W_FORMINIT sBFormInit;
sBFormInit.formID = IDOBJ_TABFORM;
sBFormInit.id = IDOBJ_OBJSTART;
sBFormInit.majorID = 0;
@ -4228,17 +4180,17 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
sBFormInit.y = OBJ_STARTY;
sBFormInit.width = OBJ_BUTWIDTH;
sBFormInit.height = OBJ_BUTHEIGHT;
memcpy(&sBFormInit2,&sBFormInit,sizeof(W_FORMINIT));
W_FORMINIT sBFormInit2 = sBFormInit;
sBFormInit2.id = IDOBJ_STATSTART;
sBFormInit2.y = OBJ_STATSTARTY;
//right click on a Template will put the production on hold
sBFormInit2.style = WFORM_CLICKABLE | WFORM_SECONDARY;
// Action progress bar.
W_BARINIT sBarInit;
sBarInit.formID = IDOBJ_OBJSTART;
sBarInit.id = IDOBJ_PROGBARSTART;
sBarInit.style = WBAR_TROUGH | WIDG_HIDDEN;
sBarInit.orientation = WBAR_LEFT;
sBarInit.x = STAT_PROGBARX;
sBarInit.y = STAT_PROGBARY;
sBarInit.width = STAT_PROGBARWIDTH;
@ -4249,7 +4201,7 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
sBarInit.pTip = _("Progress Bar");
// object output bar ie manuf power o/p, research power o/p
memcpy(&sBarInit2,&sBarInit,sizeof(W_BARINIT));
W_BARINIT sBarInit2 = sBarInit;
sBarInit2.id = IDOBJ_POWERBARSTART;
sBarInit2.style = WBAR_PLAIN;
sBarInit2.x = STAT_POWERBARX;
@ -4258,55 +4210,50 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
// don't set the tip cos we haven't got a suitable text string at this point - 2/2/99
sBarInit2.pTip = NULL;
memset(&sLabInit,0,sizeof(W_LABINIT));
W_LABINIT sLabInit;
sLabInit.id = IDOBJ_COUNTSTART;
sLabInit.style = WLAB_PLAIN | WIDG_HIDDEN;
sLabInit.style = WIDG_HIDDEN;
sLabInit.x = OBJ_TEXTX;
sLabInit.y = OBJ_T1TEXTY;
sLabInit.width = 16;
sLabInit.height = 16;
sLabInit.pText = "BUG! (a)";
sLabInit.FontID = font_regular;
memset(&sLabInitCmdFac,0,sizeof(W_LABINIT));
W_LABINIT sLabInitCmdFac;
sLabInitCmdFac.id = IDOBJ_CMDFACSTART;
sLabInitCmdFac.style = WLAB_PLAIN | WIDG_HIDDEN;
sLabInitCmdFac.style = WIDG_HIDDEN;
sLabInitCmdFac.x = OBJ_TEXTX;
sLabInitCmdFac.y = OBJ_T2TEXTY;
sLabInitCmdFac.width = 16;
sLabInitCmdFac.height = 16;
sLabInitCmdFac.pText = "BUG! (b)";
sLabInitCmdFac.FontID = font_regular;
memset(&sLabInitCmdFac2,0,sizeof(W_LABINIT));
W_LABINIT sLabInitCmdFac2;
sLabInitCmdFac2.id = IDOBJ_CMDVTOLFACSTART;
sLabInitCmdFac2.style = WLAB_PLAIN | WIDG_HIDDEN;
sLabInitCmdFac2.style = WIDG_HIDDEN;
sLabInitCmdFac2.x = OBJ_TEXTX;
sLabInitCmdFac2.y = OBJ_T3TEXTY;
sLabInitCmdFac2.width = 16;
sLabInitCmdFac2.height = 16;
sLabInitCmdFac2.pText = "BUG! (c)";
sLabInitCmdFac2.FontID = font_regular;
memset(&sLabIntObjText,0,sizeof(W_LABINIT));
W_LABINIT sLabIntObjText;
sLabIntObjText.id = IDOBJ_FACTORYSTART;
sLabIntObjText.style = WLAB_PLAIN | WIDG_HIDDEN;
sLabIntObjText.style = WIDG_HIDDEN;
sLabIntObjText.x = OBJ_TEXTX;
sLabIntObjText.y = OBJ_B1TEXTY;
sLabIntObjText.width = 16;
sLabIntObjText.height = 16;
sLabIntObjText.pText = "xxx/xxx - overrun";
sLabIntObjText.FontID = font_regular;
memset(&sLabInitCmdExp,0,sizeof(W_LABINIT));
W_LABINIT sLabInitCmdExp;
sLabInitCmdExp.id = IDOBJ_CMDEXPSTART;
sLabInitCmdExp.style = WLAB_PLAIN | WIDG_HIDDEN;
sLabInitCmdExp.style = WIDG_HIDDEN;
sLabInitCmdExp.x = STAT_POWERBARX;
sLabInitCmdExp.y = STAT_POWERBARY;
sLabInitCmdExp.width = 16;
sLabInitCmdExp.height = 16;
sLabInitCmdExp.pText = "@@@@@ - overrun";
sLabInitCmdExp.FontID = font_regular;
displayForm = 0;
for(i=0; i<(UDWORD)numObjects; i++)
@ -4929,9 +4876,6 @@ static BASE_OBJECT *intGetObject(UDWORD id)
/* Reset the stats button for an object */
static void intSetStats(UDWORD id, BASE_STATS *psStats)
{
W_FORMINIT sFormInit;
W_BARINIT sBarInit;
W_LABINIT sLabInit;
UDWORD butPerForm, butPos;
SDWORD BufferID;
BASE_OBJECT *psObj;
@ -4939,9 +4883,7 @@ static void intSetStats(UDWORD id, BASE_STATS *psStats)
/* Update the button on the object screen */
widgDelete(psWScreen, id);
memset(&sFormInit, 0, sizeof(W_FORMINIT));
memset(&sBarInit, 0, sizeof(W_BARINIT));
W_FORMINIT sFormInit;
sFormInit.formID = IDOBJ_TABFORM;
butPerForm = (OBJ_WIDTH - OBJ_GAP) / (OBJ_BUTWIDTH + OBJ_GAP);
sFormInit.majorID = (UWORD)((id - IDOBJ_STATSTART) / butPerForm);
@ -4955,10 +4897,10 @@ static void intSetStats(UDWORD id, BASE_STATS *psStats)
sFormInit.height = OBJ_BUTHEIGHT;
// Action progress bar.
W_BARINIT sBarInit;
sBarInit.formID = id;
sBarInit.id = (id - IDOBJ_STATSTART) + IDOBJ_PROGBARSTART;
sBarInit.style = WBAR_TROUGH;
sBarInit.orientation = WBAR_LEFT;
sBarInit.x = STAT_PROGBARX;
sBarInit.y = STAT_PROGBARY;
sBarInit.width = STAT_PROGBARWIDTH;
@ -4971,16 +4913,15 @@ static void intSetStats(UDWORD id, BASE_STATS *psStats)
sBarInit.pCallback = intUpdateProgressBar;
sBarInit.pUserData = intGetObject(id);
memset(&sLabInit,0,sizeof(W_LABINIT));
W_LABINIT sLabInit;
sLabInit.formID = id;
sLabInit.id = (id - IDOBJ_STATSTART) + IDOBJ_COUNTSTART;
sLabInit.style = WLAB_PLAIN | WIDG_HIDDEN;
sLabInit.style = WIDG_HIDDEN;
sLabInit.x = OBJ_TEXTX;
sLabInit.y = OBJ_T1TEXTY;
sLabInit.width = 16;
sLabInit.height = 16;
sLabInit.pText = "BUG! (d)";
sLabInit.FontID = font_regular;
if (psStats)
{
@ -5047,15 +4988,10 @@ static void intSetStats(UDWORD id, BASE_STATS *psStats)
static BOOL intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
BASE_STATS *psSelected, BASE_OBJECT *psOwner)
{
W_FORMINIT sFormInit;
W_BUTINIT sButInit;
W_FORMINIT sBFormInit;
W_BARINIT sBarInit;
UDWORD i, butPerForm, statForm;
SDWORD BufferID;
BASE_STATS *Stat;
BOOL Animate = true;
W_LABINIT sLabInit;
FACTORY *psFactory;
// should this ever be called with psOwner == NULL?
@ -5092,7 +5028,7 @@ static BOOL intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
/* Create the basic form */
memset(&sFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = IDSTAT_FORM;
sFormInit.style = WFORM_PLAIN;
@ -5114,20 +5050,21 @@ static BOOL intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
return false;
}
W_LABINIT sLabInit;
// Add the quantity slider ( if it's a factory ).
if(objMode == IOBJ_MANUFACTURE)
{
//add the Factory DP button
memset(&sButInit, 0, sizeof(W_BUTINIT));
W_BUTINIT sButInit;
sButInit.formID = IDSTAT_FORM;
sButInit.id = IDSTAT_DP_BUTTON;
sButInit.style = WBUT_PLAIN | WFORM_SECONDARY;
sButInit.style = WBUT_SECONDARY;
sButInit.x = 4;
sButInit.y = STAT_SLDY;
sButInit.width = iV_GetImageWidth(IntImages,IMAGE_FDP_DOWN);
sButInit.height = iV_GetImageHeight(IntImages,IMAGE_FDP_DOWN);
sButInit.pTip = _("Factory Delivery Point");
sButInit.FontID = font_regular;
sButInit.pDisplay = intDisplayDPButton;
sButInit.pUserData = psOwner;
@ -5137,16 +5074,15 @@ static BOOL intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
}
//add the Factory Loop button!
memset(&sButInit, 0, sizeof(W_BUTINIT));
sButInit = W_BUTINIT();
sButInit.formID = IDSTAT_FORM;
sButInit.id = IDSTAT_LOOP_BUTTON;
sButInit.style = WBUT_PLAIN | WFORM_SECONDARY;
sButInit.style = WBUT_SECONDARY;
sButInit.x = STAT_SLDX + STAT_SLDWIDTH + 2;
sButInit.y = STAT_SLDY;
sButInit.width = iV_GetImageWidth(IntImages,IMAGE_LOOP_DOWN);
sButInit.height = iV_GetImageHeight(IntImages,IMAGE_LOOP_DOWN);
sButInit.pTip = _("Loop Production");
sButInit.FontID = font_regular;
sButInit.pDisplay = intDisplayButtonPressed;
sButInit.UserData = PACKDWORD_TRI(IMAGE_LOOP_DOWN, IMAGE_LOOP_HI, IMAGE_LOOP_UP);
@ -5165,15 +5101,13 @@ static BOOL intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
}
// create a text label for the loop quantity.
memset(&sLabInit,0,sizeof(W_LABINIT));
sLabInit.formID = IDSTAT_FORM;
sLabInit.id = IDSTAT_LOOP_LABEL;
sLabInit.style = WLAB_PLAIN | WIDG_HIDDEN;
sLabInit.style = WIDG_HIDDEN;
sLabInit.x = (UWORD)(sButInit.x - 15);
sLabInit.y = sButInit.y;
sLabInit.width = 12;
sLabInit.height = 15;
sLabInit.FontID = font_regular;
sLabInit.pUserData = psOwner;
sLabInit.pCallback = intAddLoopQuantity;
if (!widgAddLabel(psWScreen, &sLabInit))
@ -5184,31 +5118,28 @@ static BOOL intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
/* store the common values for the text labels for the quantity
to produce (on each button).*/
memset(&sLabInit,0,sizeof(W_LABINIT));
sLabInit = W_LABINIT();
sLabInit.id = IDSTAT_PRODSTART;
sLabInit.style = WLAB_PLAIN | WIDG_HIDDEN;
sLabInit.style = WIDG_HIDDEN;
sLabInit.x = STAT_BUTWIDTH-12;
sLabInit.y = 2;
sLabInit.width = 12;
sLabInit.height = 15;
sLabInit.FontID = font_regular;
sLabInit.pCallback = intAddProdQuantity;
}
/* Add the close button */
memset(&sButInit, 0, sizeof(W_BUTINIT));
W_BUTINIT sButInit;
sButInit.formID = IDSTAT_FORM;
sButInit.id = IDSTAT_CLOSE;
sButInit.style = WBUT_PLAIN;
sButInit.x = STAT_WIDTH - CLOSE_WIDTH;
sButInit.y = 0;
sButInit.width = CLOSE_WIDTH;
sButInit.height = CLOSE_HEIGHT;
sButInit.pTip = _("Close");
sButInit.FontID = font_regular;
sButInit.pDisplay = intDisplayImageHilight;
sButInit.UserData = PACKDWORD_TRI(0,IMAGE_CLOSEHILIGHT , IMAGE_CLOSE);
if (!widgAddButton(psWScreen, &sButInit))
@ -5224,33 +5155,29 @@ static BOOL intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
if (numForms(numStats, butPerForm)> MAX_TAB_SMALL_SHOWN) //only want these buttons when tab count >8
{
// Add the left tab scroll button
memset(&sButInit, 0, sizeof(W_BUTINIT));
sButInit = W_BUTINIT();
sButInit.formID = IDSTAT_FORM;
sButInit.id = IDSTAT_TABSCRL_LEFT;
sButInit.style = WBUT_PLAIN;
sButInit.x = STAT_TABFORMX + 4;
sButInit.y = STAT_TABFORMY;
sButInit.width = TABSCRL_WIDTH;
sButInit.height = TABSCRL_HEIGHT;
sButInit.pTip = _("Tab Scroll left");
sButInit.FontID = font_regular;
sButInit.pDisplay = intDisplayImageHilight;
sButInit.UserData = PACKDWORD_TRI(0, IMAGE_LFTTABD, IMAGE_LFTTAB);
if (!widgAddButton(psWScreen, &sButInit))
{
return false;
return false;
}
// Add the right tab scroll button
memset(&sButInit, 0, sizeof(W_BUTINIT));
sButInit = W_BUTINIT();
sButInit.formID = IDSTAT_FORM;
sButInit.id = IDSTAT_TABSCRL_RIGHT;
sButInit.style = WBUT_PLAIN;
sButInit.x = STAT_WIDTH - 14;
sButInit.y = STAT_TABFORMY;
sButInit.width = TABSCRL_WIDTH;
sButInit.height = TABSCRL_HEIGHT;
sButInit.pTip = _("Tab Scroll right");
sButInit.FontID = font_regular;
sButInit.pDisplay = intDisplayImageHilight;
sButInit.UserData = PACKDWORD_TRI(0, IMAGE_RGTTABD, IMAGE_RGTTAB);
if (!widgAddButton(psWScreen, &sButInit))
@ -5260,7 +5187,7 @@ static BOOL intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
}
//==============buttons before tabbed form!==========================
// Add the tabbed form
memset(&sFormInit, 0, sizeof(W_FORMINIT));
sFormInit = W_FORMINIT();
sFormInit.formID = IDSTAT_FORM;
sFormInit.id = IDSTAT_TABFORM;
sFormInit.style = WFORM_TABBED;
@ -5304,7 +5231,7 @@ static BOOL intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
}
/* Add the stat buttons */
memset(&sBFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sBFormInit;
sBFormInit.formID = IDSTAT_TABFORM;
sBFormInit.majorID = 0;
sBFormInit.minorID = 0;
@ -5315,10 +5242,8 @@ static BOOL intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
sBFormInit.width = STAT_BUTWIDTH;
sBFormInit.height = STAT_BUTHEIGHT;
memset(&sBarInit, 0, sizeof(W_BARINIT));
W_BARINIT sBarInit;
sBarInit.id = IDSTAT_TIMEBARSTART;
sBarInit.style = WBAR_PLAIN;
sBarInit.orientation = WBAR_LEFT;
sBarInit.x = STAT_TIMEBARX;
sBarInit.y = STAT_TIMEBARY;
sBarInit.width = STAT_PROGBARWIDTH;
@ -5413,17 +5338,16 @@ static BOOL intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
Stat->ref < REF_RESEARCH_START + REF_RANGE) // It's a Research topic.
{
//new icon in for groups - AB 12/01/99
memset(&sLabInit,0,sizeof(W_LABINIT));
sLabInit = W_LABINIT();
sLabInit.formID = sBFormInit.id ;
sLabInit.id = IDSTAT_RESICONSTART+(sBFormInit.id - IDSTAT_START);
sLabInit.style = WLAB_PLAIN;
sLabInit.x = STAT_BUTWIDTH - 16;
sLabInit.y = 3;
sLabInit.width = 12;
sLabInit.height = 15;
sLabInit.pUserData = Stat;
sLabInit.pUserData = Stat;
sLabInit.pDisplay = intDisplayResSubGroup;
widgAddLabel(psWScreen, &sLabInit);
@ -5453,10 +5377,9 @@ static BOOL intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
)
{
// add a label.
memset(&sLabInit,0,sizeof(W_LABINIT));
sLabInit = W_LABINIT();
sLabInit.formID = sBFormInit.id ;
sLabInit.id = IDSTAT_ALLYSTART+(sBFormInit.id - IDSTAT_START);
sLabInit.style = WLAB_PLAIN;
sLabInit.x = STAT_BUTWIDTH - 19;
sLabInit.y = STAT_BUTHEIGHT - 19;
sLabInit.width = 12;
@ -6214,11 +6137,10 @@ void forceHidePowerBar(void)
/* Add the Proximity message buttons */
BOOL intAddProximityButton(PROXIMITY_DISPLAY *psProxDisp, UDWORD inc)
{
W_FORMINIT sBFormInit;
PROXIMITY_DISPLAY *psProxDisp2;
UDWORD cnt;
memset(&sBFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sBFormInit;
sBFormInit.formID = 0;
sBFormInit.id = IDPROX_START + inc;
//store the ID so we can detect which one has been clicked on

View File

@ -64,8 +64,6 @@ static BOOL addIGTextButton(UDWORD id, UWORD y, UWORD width, const char *string,
{
W_BUTINIT sButInit;
memset( &sButInit, 0, sizeof(W_BUTINIT) );
//resume
sButInit.formID = INTINGAMEOP;
sButInit.id = id;
@ -77,7 +75,6 @@ static BOOL addIGTextButton(UDWORD id, UWORD y, UWORD width, const char *string,
sButInit.width = width;
sButInit.height = INTINGAMEOP_OP_H;
sButInit.FontID = font_regular;
sButInit.pDisplay = displayTextOption;
sButInit.pText = string;
widgAddButton(psWScreen, &sButInit);
@ -87,9 +84,6 @@ static BOOL addIGTextButton(UDWORD id, UWORD y, UWORD width, const char *string,
static BOOL addQuitOptions(void)
{
W_FORMINIT sFormInit;
W_BUTINIT sButInit;
if (widgGetFromID(psWScreen,INTINGAMEOP))
{
widgDelete(psWScreen, INTINGAMEOP); // get rid of the old stuff.
@ -100,7 +94,7 @@ static BOOL addQuitOptions(void)
widgDelete(psWScreen, INTINGAMEPOPUP); // get rid of the old stuff.
}
memset(&sFormInit,0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
// add form
sFormInit.formID = 0;
sFormInit.id = INTINGAMEOP;
@ -127,10 +121,9 @@ static BOOL addQuitOptions(void)
widgAddForm(psWScreen, &sFormInit);
memset( &sButInit, 0, sizeof(W_BUTINIT) );
W_BUTINIT sButInit;
sButInit.formID = INTINGAMEPOPUP;
sButInit.FontID = font_regular;
sButInit.style = OPALIGN;
sButInit.width = 600;
sButInit.height = 10;
@ -149,14 +142,12 @@ static BOOL addQuitOptions(void)
static BOOL addSlideOptions(void)
{
W_FORMINIT sFormInit;
if (widgGetFromID(psWScreen,INTINGAMEOP))
{
widgDelete(psWScreen, INTINGAMEOP); // get rid of the old stuff.
}
memset(&sFormInit,0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
// add form
sFormInit.formID = 0;
@ -209,10 +200,6 @@ static BOOL addSlideOptions(void)
static BOOL _intAddInGameOptions(void)
{
// UWORD WindowWidth;
W_FORMINIT sFormInit;
audio_StopAll();
//clear out any mission widgets - timers etc that may be on the screen
@ -237,11 +224,7 @@ static BOOL _intAddInGameOptions(void)
kf_TogglePauseMode();
}
memset(&sFormInit,0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
sFormInit.width = INTINGAMEOP_W;
// add form
@ -316,9 +299,6 @@ BOOL intAddInGameOptions(void)
//
void intAddInGamePopup(void)
{
W_FORMINIT sFormInit;
W_BUTINIT sButInit;
//clear out any mission widgets - timers etc that may be on the screen
clearMissionWidgets();
setWidgetsStatus(true);
@ -333,7 +313,7 @@ void intAddInGamePopup(void)
kf_TogglePauseMode(); // Pause the game.
}
memset(&sFormInit,0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = INTINGAMEPOPUP;
@ -348,7 +328,7 @@ void intAddInGamePopup(void)
widgAddForm(psWScreen, &sFormInit);
// add the text "buttons" now
memset( &sButInit, 0, sizeof(W_BUTINIT) );
W_BUTINIT sButInit;
sButInit.formID = INTINGAMEPOPUP;
sButInit.style = OPALIGN;

View File

@ -205,8 +205,6 @@ TEXT_DISPLAY currentTextDisplay;
/* Add the Intelligence Map widgets to the widget screen */
BOOL intAddIntelMap(void)
{
W_FORMINIT sFormInit;
W_LABINIT sLabInit;
BOOL Animate = true;
//check playCurrent with psCurrentMsg
@ -237,16 +235,14 @@ BOOL intAddIntelMap(void)
{
if(widgGetFromID(psWScreen,IDINTMAP_PAUSELABEL) == NULL)
{
memset(&sLabInit,0,sizeof(W_LABINIT));
W_LABINIT sLabInit;
sLabInit.id = IDINTMAP_PAUSELABEL;
sLabInit.formID = 0;
sLabInit.style = WLAB_PLAIN;
sLabInit.x = INTMAP_LABELX;
sLabInit.y = INTMAP_LABELY+PAUSEMESSAGE_YOFFSET;
sLabInit.width = INTMAP_LABELWIDTH;
sLabInit.height = INTMAP_LABELHEIGHT;
sLabInit.pText = _("PAUSED");
sLabInit.FontID = font_regular;
if (!widgAddLabel(psWScreen, &sLabInit))
{
return false;
@ -257,7 +253,7 @@ BOOL intAddIntelMap(void)
//set pause states before putting the interface up
setIntelligencePauseState();
memset(&sFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
// Add the main Intelligence Map form
@ -303,15 +299,13 @@ BOOL intAddIntelMap(void)
/* Add the Message sub form */
static BOOL intAddMessageForm(BOOL playCurrent)
{
W_FORMINIT sFormInit;
W_FORMINIT sBFormInit;
UDWORD numButtons, i;
MESSAGE *psMessage;
RESEARCH *psResearch;
SDWORD BufferID;
/* Add the Message form */
memset(&sFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
sFormInit.formID = IDINTMAP_FORM;
sFormInit.id = IDINTMAP_MSGFORM;
sFormInit.style = WFORM_TABBED;
@ -370,7 +364,7 @@ static BOOL intAddMessageForm(BOOL playCurrent)
/* Add the message buttons */
memset(&sBFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sBFormInit;
sBFormInit.formID = IDINTMAP_MSGFORM;
sBFormInit.id = IDINTMAP_MSGSTART;
sBFormInit.majorID = 0;
@ -487,9 +481,6 @@ static BOOL intAddMessageForm(BOOL playCurrent)
/*Add the 3D world view for the particular message (only research nmessages now) */
BOOL intAddMessageView(MESSAGE * psMessage)
{
W_FORMINIT sFormInit;
W_BUTINIT sButInit;
W_LABINIT sLabInit;
BOOL Animate = true;
RESEARCH *psResearch;
@ -505,7 +496,7 @@ BOOL intAddMessageView(MESSAGE * psMessage)
}
/* Add the base form */
memset(&sFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = IDINTMAP_MSGVIEW;
sFormInit.style = WFORM_PLAIN;
@ -533,10 +524,9 @@ BOOL intAddMessageView(MESSAGE * psMessage)
}
/* Add the close box */
memset(&sButInit, 0, sizeof(W_BUTINIT));
W_BUTINIT sButInit;
sButInit.formID = IDINTMAP_MSGVIEW;
sButInit.id = IDINTMAP_CLOSE;
sButInit.style = WBUT_PLAIN;
sButInit.x = (SWORD)(sFormInit.width - OPT_GAP - CLOSE_SIZE);
sButInit.y = OPT_GAP;
sButInit.width = CLOSE_SIZE;
@ -552,14 +542,13 @@ BOOL intAddMessageView(MESSAGE * psMessage)
if (psMessage->type != MSG_RESEARCH &&
((VIEWDATA*)psMessage->pViewData)->type == VIEW_RPL)
{
W_FORMINIT sTabForm;
VIEW_REPLAY *psViewReplay;
size_t i, cur_seq, cur_seqpage;
psViewReplay = (VIEW_REPLAY *)((VIEWDATA *)psMessage->pViewData)->pData;
/* Add a big tabbed text box for the subtitle text */
memset(&sFormInit, 0, sizeof(W_FORMINIT));
sFormInit = W_FORMINIT();
sFormInit.id = IDINTMAP_SEQTEXT;
sFormInit.formID = IDINTMAP_MSGVIEW;
@ -595,7 +584,7 @@ BOOL intAddMessageView(MESSAGE * psMessage)
return false;
}
memset(&sTabForm, 0, sizeof(W_FORMINIT));
W_FORMINIT sTabForm;
sTabForm.formID = IDINTMAP_SEQTEXT;
sTabForm.id = IDINTMAP_SEQTEXTSTART;
sTabForm.majorID = 0;
@ -622,10 +611,9 @@ BOOL intAddMessageView(MESSAGE * psMessage)
}
/*add the Label for the title box*/
memset(&sLabInit,0,sizeof(W_LABINIT));
W_LABINIT sLabInit;
sLabInit.id = IDINTMAP_TITLELABEL;
sLabInit.formID = IDINTMAP_MSGVIEW;
sLabInit.style = WLAB_PLAIN;
sLabInit.x = INTMAP_TITLEX + TEXT_XINDENT;
sLabInit.y = INTMAP_TITLEY + TEXT_YINDENT;
sLabInit.width = INTMAP_TITLEWIDTH;
@ -649,7 +637,7 @@ BOOL intAddMessageView(MESSAGE * psMessage)
/*Add the PIE box*/
memset(&sFormInit, 0, sizeof(W_FORMINIT));
sFormInit = W_FORMINIT();
sFormInit.formID = IDINTMAP_MSGVIEW;
sFormInit.id = IDINITMAP_PIEVIEW;
sFormInit.style = WFORM_PLAIN;
@ -666,7 +654,7 @@ BOOL intAddMessageView(MESSAGE * psMessage)
#ifndef NO_VIDEO
/*Add the Flic box */
memset(&sFormInit, 0, sizeof(W_FORMINIT));
sFormInit = W_FORMINIT();
sFormInit.formID = IDINTMAP_MSGVIEW;
sFormInit.id = IDINTMAP_FLICVIEW;
sFormInit.style = WFORM_PLAIN;
@ -683,7 +671,7 @@ BOOL intAddMessageView(MESSAGE * psMessage)
#endif
/*Add the text box*/
memset(&sFormInit, 0, sizeof(W_FORMINIT));
sFormInit = W_FORMINIT();
sFormInit.formID = IDINTMAP_MSGVIEW;

View File

@ -643,8 +643,6 @@ static UDWORD GetImageHeight(IMAGEFILE *ImageFile,UDWORD ImageID)
//changed to a BASE_OBJECT to accomodate the factories - AB 21/04/99
BOOL intAddOrder(BASE_OBJECT *psObj)
{
W_FORMINIT sFormInit;
W_BUTINIT sButInit;
BOOL Animate = true;
SECONDARY_STATE State;
UWORD i,j;//,k;
@ -747,7 +745,7 @@ BOOL intAddOrder(BASE_OBJECT *psObj)
/* Create the basic form */
memset(&sFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = IDORDER_FORM;
sFormInit.style = WFORM_PLAIN;
@ -771,16 +769,14 @@ BOOL intAddOrder(BASE_OBJECT *psObj)
// Add the close button.
memset(&sButInit, 0, sizeof(W_BUTINIT));
W_BUTINIT sButInit;
sButInit.formID = IDORDER_FORM;
sButInit.id = IDORDER_CLOSE;
sButInit.style = WBUT_PLAIN;
sButInit.x = ORDER_WIDTH - CLOSE_WIDTH;
sButInit.y = 0;
sButInit.width = CLOSE_WIDTH;
sButInit.height = CLOSE_HEIGHT;
sButInit.pTip = _("Close");
sButInit.FontID = font_regular;
sButInit.pDisplay = intDisplayImageHilight;
sButInit.UserData = PACKDWORD_TRI(0,IMAGE_CLOSEHILIGHT , IMAGE_CLOSE);
if (!widgAddButton(psWScreen, &sButInit))
@ -789,12 +785,10 @@ BOOL intAddOrder(BASE_OBJECT *psObj)
}
memset(&sButInit, 0, sizeof(W_BUTINIT));
sButInit = W_BUTINIT();
sButInit.formID = IDORDER_FORM;
sButInit.id = IDORDER_CLOSE+1;
sButInit.style = WBUT_PLAIN;
sButInit.pDisplay = intDisplayButtonHilight;
sButInit.FontID = font_regular;
sButInit.y = ORDER_BUTY;
Height = 0;

View File

@ -340,8 +340,6 @@ static void displayKeyMap(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, WZ_D
// ////////////////////////////////////////////////////////////////////////////
BOOL startKeyMapEditor(BOOL first)
{
W_BUTINIT sButInit;
W_FORMINIT sFormInit;
KEY_MAPPING *psMapping;
UDWORD i,mapcount =0;
UDWORD bubbleCount;
@ -355,7 +353,7 @@ BOOL startKeyMapEditor(BOOL first)
{
loadKeyMap(); // get the current mappings.
}
memset(&sFormInit, 0, sizeof(W_FORMINIT)); // draw blue form...
W_FORMINIT sFormInit;
sFormInit.formID = FRONTEND_BACKDROP;
sFormInit.id = KM_FORM;
sFormInit.style = WFORM_PLAIN;
@ -400,7 +398,7 @@ BOOL startKeyMapEditor(BOOL first)
}
// add tab form..
memset(&sFormInit, 0, sizeof(W_FORMINIT));
sFormInit = W_FORMINIT();
sFormInit.formID = KM_FORM;
sFormInit.id = KM_FORM_TABS;
sFormInit.style = WFORM_TABBED;
@ -426,9 +424,8 @@ BOOL startKeyMapEditor(BOOL first)
widgAddForm(psWScreen, &sFormInit);
//Put the buttons on it
memset(&sButInit, 0, sizeof(W_BUTINIT));
W_BUTINIT sButInit;
sButInit.formID = KM_FORM_TABS;
sButInit.style = WFORM_PLAIN;
sButInit.width = KM_ENTRYW;
sButInit.height = KM_ENTRYH;
sButInit.pDisplay = displayKeyMap;

View File

@ -151,9 +151,6 @@ BOOL bLoad;
//*****************************************************************************************
static BOOL _addLoadSave(BOOL bLoad, const char *sSearchPath, const char *sExtension, const char *title)
{
W_FORMINIT sFormInit;
W_BUTINIT sButInit;
W_LABINIT sLabInit;
UDWORD slotCount;
// removed hardcoded values! change with the defines above! -Q
static char sSlotCaps[totalslots][totalslotspace];
@ -202,7 +199,7 @@ static BOOL _addLoadSave(BOOL bLoad, const char *sSearchPath, const char *sExten
widgSetTipFont(psRequestScreen,font_regular);
/* add a form to place the tabbed form on */
memset(&sFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
sFormInit.formID = 0; //this adds the blue background, and the "box" behind the buttons -Q
sFormInit.id = LOADSAVE_FORM;
sFormInit.style = WFORM_PLAIN;
@ -230,7 +227,7 @@ static BOOL _addLoadSave(BOOL bLoad, const char *sSearchPath, const char *sExten
// Add Banner Label
memset(&sLabInit, 0, sizeof(W_LABINIT));
W_LABINIT sLabInit;
sLabInit.formID = LOADSAVE_BANNER;
sLabInit.id = LOADSAVE_LABEL;
sLabInit.style = WLAB_ALIGNCENTRE;
@ -239,12 +236,11 @@ static BOOL _addLoadSave(BOOL bLoad, const char *sSearchPath, const char *sExten
sLabInit.width = LOADSAVE_W-(2*LOADSAVE_HGAP); //LOADSAVE_W;
sLabInit.height = LOADSAVE_BANNER_DEPTH; //This looks right -Q
sLabInit.pText = title;
sLabInit.FontID = font_regular;
widgAddLabel(psRequestScreen, &sLabInit);
// add cancel.
memset(&sButInit, 0, sizeof(W_BUTINIT));
W_BUTINIT sButInit;
sButInit.formID = LOADSAVE_BANNER;
sButInit.x = 8;
sButInit.y = 8;
@ -255,18 +251,16 @@ static BOOL _addLoadSave(BOOL bLoad, const char *sSearchPath, const char *sExten
sButInit.id = LOADSAVE_CANCEL;
sButInit.style = WBUT_PLAIN;
sButInit.pTip = _("Close");
sButInit.FontID = font_regular;
sButInit.pDisplay = intDisplayImageHilight;
widgAddButton(psRequestScreen, &sButInit);
// add slots
memset(&sButInit, 0, sizeof(W_BUTINIT));
sButInit = W_BUTINIT();
sButInit.formID = LOADSAVE_FORM;
sButInit.style = WBUT_PLAIN;
sButInit.width = LOADENTRY_W;
sButInit.height = LOADENTRY_H;
sButInit.pDisplay = displayLoadSlot;
sButInit.FontID = font_regular;
for(slotCount = 0; slotCount< totalslots; slotCount++)
{
@ -432,7 +426,6 @@ void deleteSaveGame(char* saveGameName)
BOOL runLoadSave(BOOL bResetMissionWidgets)
{
UDWORD id=0;
W_EDBINIT sEdInit;
static char sDelete[PATH_MAX];
UDWORD i, campaign;
W_CONTEXT context;
@ -470,16 +463,14 @@ BOOL runLoadSave(BOOL bResetMissionWidgets)
if( ! widgGetFromID(psRequestScreen,SAVEENTRY_EDIT))
{
// add blank box.
memset(&sEdInit, 0, sizeof(W_EDBINIT));
W_EDBINIT sEdInit;
sEdInit.formID= LOADSAVE_FORM;
sEdInit.id = SAVEENTRY_EDIT;
sEdInit.style = WEDB_PLAIN;
sEdInit.x = widgGetFromID(psRequestScreen,id)->x;
sEdInit.y = widgGetFromID(psRequestScreen,id)->y;
sEdInit.width = widgGetFromID(psRequestScreen,id)->width;
sEdInit.height= widgGetFromID(psRequestScreen,id)->height;
sEdInit.pText = ((W_BUTTON *)widgGetFromID(psRequestScreen,id))->pText;
sEdInit.FontID= font_regular;
sEdInit.pBoxDisplay = displayLoadSaveEdit;
widgAddEditBox(psRequestScreen, &sEdInit);

View File

@ -2008,9 +2008,6 @@ void missionMoveTransporterOffWorld( DROID *psTransporter )
//add the Mission timer into the top right hand corner of the screen
BOOL intAddMissionTimer(void)
{
W_FORMINIT sFormInit;
W_LABINIT sLabInit;
//check to see if it exists already
if (widgGetFromID(psWScreen,IDTIMER_FORM) != NULL)
{
@ -2018,7 +2015,7 @@ BOOL intAddMissionTimer(void)
}
// Add the background
memset(&sFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = IDTIMER_FORM;
@ -2037,7 +2034,7 @@ BOOL intAddMissionTimer(void)
}
//add labels for the time display
memset(&sLabInit,0,sizeof(W_LABINIT));
W_LABINIT sLabInit;
sLabInit.formID = IDTIMER_FORM;
sLabInit.id = IDTIMER_DISPLAY;
sLabInit.style = WLAB_PLAIN | WIDG_HIDDEN;
@ -2046,7 +2043,6 @@ BOOL intAddMissionTimer(void)
sLabInit.width = sFormInit.width;//TIMER_WIDTH;
sLabInit.height = sFormInit.height;//TIMER_HEIGHT;
sLabInit.pText = "00:00:00";
sLabInit.FontID = font_regular;
sLabInit.pCallback = intUpdateMissionTimer;
if (!widgAddLabel(psWScreen, &sLabInit))
@ -2060,10 +2056,6 @@ BOOL intAddMissionTimer(void)
//add the Transporter timer into the top left hand corner of the screen
BOOL intAddTransporterTimer(void)
{
W_FORMINIT sFormInit;
W_LABINIT sLabInit;
// Make sure that Transporter Launch button isn't up as well
intRemoveTransporterLaunch();
@ -2074,7 +2066,7 @@ BOOL intAddTransporterTimer(void)
}
// Add the button form - clickable
memset(&sFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = IDTRANTIMER_BUTTON;
sFormInit.style = WFORM_CLICKABLE | WFORM_NOCLICKMOVE;
@ -2092,15 +2084,14 @@ BOOL intAddTransporterTimer(void)
}
//add labels for the time display
memset(&sLabInit,0,sizeof(W_LABINIT));
W_LABINIT sLabInit;
sLabInit.formID = IDTRANTIMER_BUTTON;
sLabInit.id = IDTRANTIMER_DISPLAY;
sLabInit.style = WLAB_PLAIN | WIDG_HIDDEN;
sLabInit.style = WIDG_HIDDEN;
sLabInit.x = TRAN_TIMER_X;
sLabInit.y = TRAN_TIMER_Y;
sLabInit.width = TRAN_TIMER_WIDTH;
sLabInit.height = sFormInit.height;
sLabInit.FontID = font_regular;
sLabInit.pCallback = intUpdateTransporterTimer;
if (!widgAddLabel(psWScreen, &sLabInit))
{
@ -2108,16 +2099,14 @@ BOOL intAddTransporterTimer(void)
}
//add the capacity label
memset(&sLabInit,0,sizeof(W_LABINIT));
sLabInit = W_LABINIT();
sLabInit.formID = IDTRANTIMER_BUTTON;
sLabInit.id = IDTRANS_CAPACITY;
sLabInit.style = WLAB_PLAIN;
sLabInit.x = 65;
sLabInit.y = 1;
sLabInit.width = 16;
sLabInit.height = 16;
sLabInit.pText = "00/10";
sLabInit.FontID = font_regular;
sLabInit.pCallback = intUpdateTransCapacity;
if (!widgAddLabel(psWScreen, &sLabInit))
{
@ -2402,13 +2391,9 @@ static void missionResetInGameState( void )
static BOOL _intAddMissionResult(BOOL result, BOOL bPlaySuccess)
{
W_FORMINIT sFormInit;
W_LABINIT sLabInit;
W_BUTINIT sButInit;
missionResetInGameState();
memset(&sFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
// add some funky beats
cdAudio_PlayTrack(SONG_FRONTEND);
@ -2462,10 +2447,10 @@ static BOOL _intAddMissionResult(BOOL result, BOOL bPlaySuccess)
}
// description of success/fail
memset(&sLabInit,0,sizeof(W_LABINIT));
W_LABINIT sLabInit;
sLabInit.formID = IDMISSIONRES_TITLE;
sLabInit.id = IDMISSIONRES_TXT;
sLabInit.style = WLAB_PLAIN | WLAB_ALIGNCENTRE;
sLabInit.style = WLAB_ALIGNCENTRE;
sLabInit.x = 0;
sLabInit.y = 12;
sLabInit.width = MISSIONRES_TITLE_W;
@ -2490,12 +2475,11 @@ static BOOL _intAddMissionResult(BOOL result, BOOL bPlaySuccess)
return false;
}
// options.
memset(&sButInit,0,sizeof(W_BUTINIT));
W_BUTINIT sButInit;
sButInit.formID = IDMISSIONRES_FORM;
sButInit.style = WBUT_PLAIN | WBUT_TXTCENTRE;
sButInit.style = WBUT_TXTCENTRE;
sButInit.width = MISSION_TEXT_W;
sButInit.height = MISSION_TEXT_H;
sButInit.FontID = font_regular;
sButInit.pTip = NULL;
sButInit.pDisplay = displayTextOption;
// If won or in debug mode
@ -2641,8 +2625,6 @@ static void missionContineButtonPressed( void )
void intProcessMissionResult(UDWORD id)
{
W_BUTINIT sButInit;
switch(id)
{
case IDMISSIONRES_LOAD:
@ -2655,13 +2637,11 @@ void intProcessMissionResult(UDWORD id)
if (widgGetFromID(psWScreen, IDMISSIONRES_QUIT) == NULL)
{
//Add Quit Button now save has been pressed
memset(&sButInit,0,sizeof(W_BUTINIT));
W_BUTINIT sButInit;
sButInit.formID = IDMISSIONRES_FORM;
sButInit.style = WBUT_PLAIN | WBUT_TXTCENTRE;
sButInit.style = WBUT_TXTCENTRE;
sButInit.width = MISSION_TEXT_W;
sButInit.height = MISSION_TEXT_H;
sButInit.FontID = font_regular;
sButInit.pTip = NULL;
sButInit.pDisplay = displayTextOption;
sButInit.id = IDMISSIONRES_QUIT;
sButInit.x = MISSION_3_X;

View File

@ -406,15 +406,10 @@ static void decideWRF(void)
static BOOL OptionsInet(void) //internet options
{
W_EDBINIT sEdInit;
W_FORMINIT sFormInit;
W_LABINIT sLabInit;
W_CONTEXT sContext;
psConScreen = widgCreateScreen();
widgSetTipFont(psConScreen,font_regular);
memset(&sFormInit, 0, sizeof(W_FORMINIT)); //Connection Settings
W_FORMINIT sFormInit; //Connection Settings
sFormInit.formID = 0;
sFormInit.id = CON_SETTINGS;
sFormInit.style = WFORM_PLAIN;
@ -431,7 +426,7 @@ static BOOL OptionsInet(void) //internet options
_("Cancel"),IMAGE_NO,IMAGE_NO,true);
//label.
memset(&sLabInit, 0, sizeof(W_LABINIT));
W_LABINIT sLabInit;
sLabInit.formID = CON_SETTINGS;
sLabInit.id = CON_SETTINGS_LABEL;
sLabInit.style = WLAB_ALIGNCENTRE;
@ -440,20 +435,17 @@ static BOOL OptionsInet(void) //internet options
sLabInit.width = CON_SETTINGSWIDTH;
sLabInit.height = 20;
sLabInit.pText = _("IP Address or Machine Name");
sLabInit.FontID = font_regular;
widgAddLabel(psConScreen, &sLabInit);
memset(&sEdInit, 0, sizeof(W_EDBINIT)); // address
W_EDBINIT sEdInit; // address
sEdInit.formID = CON_SETTINGS;
sEdInit.id = CON_IP;
sEdInit.style = WEDB_PLAIN;
sEdInit.x = CON_IPX;
sEdInit.y = CON_IPY;
sEdInit.width = CON_NAMEBOXWIDTH;
sEdInit.height = CON_NAMEBOXHEIGHT;
sEdInit.pText = ""; //_("IP Address or Machine Name");
sEdInit.FontID = font_regular;
// sEdInit.pUserData = (void*)PACKDWORD_TRI(0,IMAGE_DES_EDITBOXLEFTH , IMAGE_DES_EDITBOXLEFT);
// sEdInit.pBoxDisplay = intDisplayButtonHilight;
sEdInit.pBoxDisplay = intDisplayEditBox;
@ -462,6 +454,7 @@ static BOOL OptionsInet(void) //internet options
return false;
}
// auto click in the text box
W_CONTEXT sContext;
sContext.psScreen = psConScreen;
sContext.psForm = (W_FORM *)psConScreen->psForm;
sContext.xOffset = 0;
@ -597,7 +590,6 @@ void setLobbyError (LOBBY_ERROR_TYPES error_type)
static void addGames(void)
{
UDWORD i,gcount=0;
W_BUTINIT sButInit;
static const char *wrongVersionTip = "Your version of Warzone is incompatible with this game.";
static const char *badModTip = "Your loaded mods are incompatible with this game. (Check mods/autoload/?)";
@ -609,12 +601,10 @@ static void addGames(void)
gcount++;
}
}
memset(&sButInit, 0, sizeof(W_BUTINIT));
W_BUTINIT sButInit;
sButInit.formID = FRONTEND_BOTFORM;
sButInit.style = WBUT_PLAIN;
sButInit.width = GAMES_GAMEWIDTH;
sButInit.height = GAMES_GAMEHEIGHT;
sButInit.FontID = font_regular;
sButInit.pDisplay = displayRemoteGame;
// we want the old games deleted, and only list games when we should
@ -723,12 +713,12 @@ static void addGames(void)
// delete old widget if necessary
widgDelete(psWScreen,FRONTEND_NOGAMESAVAILABLE);
memset(&sButInit, 0, sizeof(W_BUTINIT));
sButInit = W_BUTINIT();
sButInit.formID = FRONTEND_BOTFORM;
sButInit.id = FRONTEND_NOGAMESAVAILABLE;
sButInit.x = 70;
sButInit.y = 50;
sButInit.style = WBUT_PLAIN | WBUT_TXTCENTRE;
sButInit.style = WBUT_TXTCENTRE;
sButInit.width = FRONTEND_BUTWIDTH;
sButInit.UserData = 0; // store disable state
sButInit.height = FRONTEND_BUTHEIGHT;
@ -901,14 +891,10 @@ static void showPasswordLabel( WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset,
// This is what starts the lobby screen
void startGameFind(void)
{
W_FORMINIT sFormInit;
W_EDBINIT sEdInit;
W_LABINIT sLabInit;
addBackdrop(); //background image
// draws the background of the games listed
memset(&sFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
sFormInit.formID = FRONTEND_BACKDROP;
sFormInit.id = FRONTEND_BOTFORM;
sFormInit.style = WFORM_PLAIN;
@ -941,7 +927,7 @@ void startGameFind(void)
// Password stuff. Hidden by default.
// password label.
memset(&sLabInit, 0, sizeof(W_LABINIT));
W_LABINIT sLabInit;
sLabInit.formID = FRONTEND_BACKDROP;
sLabInit.id = CON_PASSWORD_LABEL;
sLabInit.style = WLAB_ALIGNCENTRE;
@ -950,21 +936,18 @@ void startGameFind(void)
sLabInit.width = CON_SETTINGSWIDTH;
sLabInit.height = 20;
sLabInit.pText = _("Enter Password:");
sLabInit.FontID = font_regular;
sLabInit.pDisplay = showPasswordLabel;
widgAddLabel(psWScreen, &sLabInit);
// and finally draw the password entry box
memset(&sEdInit, 0, sizeof(W_EDBINIT));
W_EDBINIT sEdInit;
sEdInit.formID = FRONTEND_BACKDROP;
sEdInit.id = CON_PASSWORD;
sEdInit.style = WEDB_PLAIN;
sEdInit.x = 180;
sEdInit.y = 200;
sEdInit.width = 280;
sEdInit.height = 20;
sEdInit.pText = "";
sEdInit.FontID = font_regular;
sEdInit.pBoxDisplay = displayPasswordEditBox;
widgAddEditBox(psWScreen, &sEdInit);
@ -975,7 +958,7 @@ void startGameFind(void)
_("Cancel"),IMAGE_NO,IMAGE_NO,true);
// draws the background of the password box
memset(&sFormInit, 0, sizeof(W_FORMINIT));
sFormInit = W_FORMINIT();
sFormInit.formID = FRONTEND_BACKDROP;
sFormInit.id = FRONTEND_PASSWORDFORM;
sFormInit.style = WFORM_PLAIN;
@ -1051,10 +1034,7 @@ static void showPasswordForm(void)
static void addBlueForm(UDWORD parent,UDWORD id, const char *txt,UDWORD x,UDWORD y,UDWORD w,UDWORD h)
{
W_FORMINIT sFormInit;
W_LABINIT sLabInit;
memset(&sFormInit, 0, sizeof(W_FORMINIT)); // draw options box.
W_FORMINIT sFormInit; // draw options box.
sFormInit.formID= parent;
sFormInit.id = id;
sFormInit.x =(UWORD) x;
@ -1067,17 +1047,15 @@ static void addBlueForm(UDWORD parent,UDWORD id, const char *txt,UDWORD x,UDWORD
if(strlen(txt)>0)
{
memset(&sLabInit, 0, sizeof(W_LABINIT));
W_LABINIT sLabInit;
sLabInit.formID = id;
sLabInit.id = id+1;
sLabInit.style = WLAB_PLAIN;
sLabInit.x = 3;
sLabInit.y = 4;
sLabInit.width = 80;
sLabInit.height = 20;
sLabInit.pText = txt;
// sLabInit.pDisplay = displayFeText;
sLabInit.FontID = font_regular;
widgAddLabel(psWScreen, &sLabInit);
}
return;
@ -1121,14 +1099,12 @@ void updateLimitFlags()
// need to check for side effects.
static void addGameOptions(BOOL bRedo)
{
W_FORMINIT sFormInit;
widgDelete(psWScreen,MULTIOP_OPTIONS); // clear options list
widgDelete(psWScreen,FRONTEND_SIDETEXT3); // del text..
iV_SetFont(font_regular);
memset(&sFormInit, 0, sizeof(W_FORMINIT)); // draw options box.
W_FORMINIT sFormInit; // draw options box.
sFormInit.formID = FRONTEND_BACKDROP;
sFormInit.id = MULTIOP_OPTIONS;
sFormInit.x = MULTIOP_OPTIONSX;
@ -1884,8 +1860,6 @@ static bool canChooseTeamFor(int i)
UDWORD addPlayerBox(BOOL players)
{
W_FORMINIT sFormInit;
W_BUTINIT sButInit;
UDWORD i=0;
// if background isn't there, then return since were not ready to draw the box yet!
@ -1897,7 +1871,7 @@ UDWORD addPlayerBox(BOOL players)
widgDelete(psWScreen,MULTIOP_PLAYERS); // del player window
widgDelete(psWScreen,FRONTEND_SIDETEXT2); // del text too,
memset(&sFormInit, 0, sizeof(W_FORMINIT)); // draw player window
W_FORMINIT sFormInit; // draw player window
sFormInit.formID = FRONTEND_BACKDROP;
sFormInit.id = MULTIOP_PLAYERS;
sFormInit.x = MULTIOP_PLAYERSX;
@ -1952,10 +1926,9 @@ UDWORD addPlayerBox(BOOL players)
if(ingame.localOptionsReceived)
{
//add team chooser
memset(&sButInit, 0, sizeof(W_BUTINIT));
W_BUTINIT sButInit;
sButInit.formID = MULTIOP_PLAYERS;
sButInit.id = MULTIOP_TEAMS_START+i;
sButInit.style = WBUT_PLAIN;
sButInit.x = 7;
sButInit.y = (UWORD)(( (MULTIOP_TEAMSHEIGHT+5)*NetPlay.players[i].position)+4);
sButInit.width = MULTIOP_TEAMSWIDTH;
@ -1968,7 +1941,6 @@ UDWORD addPlayerBox(BOOL players)
{
sButInit.pTip = NULL;
}
sButInit.FontID = font_regular;
sButInit.pDisplay = displayTeamChooser;
sButInit.UserData = i;
@ -1992,10 +1964,9 @@ UDWORD addPlayerBox(BOOL players)
}
// draw player info box
memset(&sButInit, 0, sizeof(W_BUTINIT));
W_BUTINIT sButInit;
sButInit.formID = MULTIOP_PLAYERS;
sButInit.id = MULTIOP_PLAYER_START+i;
sButInit.style = WBUT_PLAIN;
sButInit.x = 7 + MULTIOP_TEAMSWIDTH;
sButInit.y = (UWORD)(( (MULTIOP_PLAYERHEIGHT+5)*NetPlay.players[i].position)+4);
sButInit.width = MULTIOP_PLAYERWIDTH - MULTIOP_TEAMSWIDTH - MULTIOP_READY_WIDTH;
@ -2008,7 +1979,6 @@ UDWORD addPlayerBox(BOOL players)
{
sButInit.pTip = NULL;
}
sButInit.FontID = font_regular;
sButInit.pDisplay = displayPlayer;
sButInit.UserData = i;
@ -2023,7 +1993,7 @@ UDWORD addPlayerBox(BOOL players)
}
else // AI player
{
memset(&sFormInit, 0, sizeof(W_BUTINIT));
sFormInit = W_FORMINIT(); // This used to be an buggy memset using sizeof(W_BUTINIT)...
sFormInit.formID = MULTIOP_PLAYERS;
sFormInit.id = MULTIOP_PLAYER_START+i;
sFormInit.style = WBUT_PLAIN;
@ -2086,9 +2056,6 @@ void kickPlayer(uint32_t player_id, const char *reason, LOBBY_ERROR_TYPES type)
static void addChatBox(void)
{
W_FORMINIT sFormInit;
W_EDBINIT sEdInit;
if(widgGetFromID(psWScreen,FRONTEND_TOPFORM))
{
widgDelete(psWScreen,FRONTEND_TOPFORM);
@ -2099,7 +2066,7 @@ static void addChatBox(void)
return;
}
memset(&sFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
sFormInit.formID = FRONTEND_BACKDROP; // add the form
sFormInit.id = MULTIOP_CHATBOX;
@ -2123,15 +2090,13 @@ static void addChatBox(void)
setConsolePermanence(true,true);
setConsoleLineInfo(5); // use x lines on chat window
memset(&sEdInit, 0, sizeof(W_EDBINIT)); // add the edit box
W_EDBINIT sEdInit; // add the edit box
sEdInit.formID = MULTIOP_CHATBOX;
sEdInit.id = MULTIOP_CHATEDIT;
sEdInit.x = MULTIOP_CHATEDITX;
sEdInit.y = MULTIOP_CHATEDITY;
sEdInit.style = WEDB_PLAIN;
sEdInit.width = MULTIOP_CHATEDITW;
sEdInit.height = MULTIOP_CHATEDITH;
sEdInit.FontID = font_regular;
sEdInit.pUserData = NULL;
sEdInit.pBoxDisplay = displayChatEdit;
@ -3929,18 +3894,14 @@ void displayMultiBut(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT
static BOOL addMultiEditBox(UDWORD formid, UDWORD id, UDWORD x, UDWORD y, char const *tip, char const *tipres, UDWORD icon, UDWORD iconhi, UDWORD iconid)
{
W_EDBINIT sEdInit;
memset(&sEdInit, 0, sizeof(W_EDBINIT)); // editbox
W_EDBINIT sEdInit; // editbox
sEdInit.formID = formid;
sEdInit.id = id;
sEdInit.style = WEDB_PLAIN;
sEdInit.x = (short)x;
sEdInit.y = (short)y;
sEdInit.width = MULTIOP_EDITBOXW;
sEdInit.height = MULTIOP_EDITBOXH;
sEdInit.pText = tipres;
sEdInit.FontID = font_regular;
sEdInit.pBoxDisplay = displayMultiEditBox;
if (!widgAddEditBox(psWScreen, &sEdInit))
{
@ -3955,18 +3916,14 @@ static BOOL addMultiEditBox(UDWORD formid, UDWORD id, UDWORD x, UDWORD y, char c
BOOL addMultiBut(W_SCREEN *screen, UDWORD formid, UDWORD id, UDWORD x, UDWORD y, UDWORD width, UDWORD height, const char* tipres, UDWORD norm, UDWORD down, UDWORD hi)
{
W_BUTINIT sButInit;
memset(&sButInit, 0, sizeof(W_BUTINIT));
W_BUTINIT sButInit;
sButInit.formID = formid;
sButInit.id = id;
sButInit.style = WFORM_PLAIN;
sButInit.x = (short) x;
sButInit.y = (short) y;
sButInit.width = (unsigned short) width;
sButInit.height= (unsigned short) height;
sButInit.pTip = tipres;
sButInit.FontID = font_regular;
sButInit.pDisplay = displayMultiBut;
sButInit.UserData = PACKDWORD_TRI(norm, down, hi);

View File

@ -114,8 +114,6 @@ static inline void freeLimitSet(void)
// ////////////////////////////////////////////////////////////////////////////
BOOL startLimitScreen(void)
{
W_FORMINIT sButInit;
W_FORMINIT sFormInit;
UDWORD numButtons = 0;
UDWORD i;
@ -166,7 +164,7 @@ BOOL startLimitScreen(void)
addSideText(FRONTEND_SIDETEXT1,LIMITSX-2,LIMITSY,"LIMITS"); // draw sidetext...
memset(&sFormInit, 0, sizeof(W_FORMINIT)); // draw blue form...
W_FORMINIT sFormInit;
sFormInit.formID = FRONTEND_BACKDROP;
sFormInit.id = IDLIMITS;
sFormInit.style = WFORM_PLAIN;
@ -205,7 +203,7 @@ BOOL startLimitScreen(void)
if(numButtons >(4*BUTPERFORM)) numButtons =(4*BUTPERFORM);
// add tab form..
memset(&sFormInit, 0, sizeof(W_FORMINIT));
sFormInit = W_FORMINIT();
sFormInit.formID = IDLIMITS;
sFormInit.id = IDLIMITS_TABS;
sFormInit.style = WFORM_TABBED;
@ -231,7 +229,7 @@ BOOL startLimitScreen(void)
widgAddForm(psWScreen, &sFormInit);
//Put the buttons on it
memset(&sButInit, 0, sizeof(W_BUTINIT));
W_FORMINIT sButInit;
sButInit.formID = IDLIMITS_TABS;//IDLIMITS;
sButInit.style = WFORM_PLAIN;
sButInit.width = BARWIDTH;

View File

@ -360,8 +360,6 @@ static unsigned int check_tip_index(unsigned int i) {
*/
void addMultiRequest(const char* searchDir, const char* fileExtension, UDWORD mode, UBYTE mapCam, UBYTE numPlayers)
{
W_FORMINIT sFormInit;
W_BUTINIT sButInit;
UDWORD players;
char** fileList;
char** currFile;
@ -424,7 +422,7 @@ void addMultiRequest(const char* searchDir, const char* fileExtension, UDWORD mo
(R_BUT_H+ 4));
/* add a form to place the tabbed form on */
memset(&sFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = M_REQUEST;
sFormInit.style = WFORM_PLAIN;
@ -437,7 +435,7 @@ void addMultiRequest(const char* searchDir, const char* fileExtension, UDWORD mo
widgAddForm(psRScreen, &sFormInit);
/* Add the tabs */
memset(&sFormInit, 0, sizeof(W_FORMINIT));
sFormInit = W_FORMINIT();
sFormInit.formID = M_REQUEST;
sFormInit.id = M_REQUEST_TAB;
sFormInit.style = WFORM_TABBED;
@ -474,32 +472,28 @@ void addMultiRequest(const char* searchDir, const char* fileExtension, UDWORD mo
widgAddForm(psRScreen, &sFormInit);
// Add the close button.
memset(&sButInit, 0, sizeof(W_BUTINIT));
W_BUTINIT sButInit;
sButInit.formID = M_REQUEST;
sButInit.id = M_REQUEST_CLOSE;
sButInit.style = WBUT_PLAIN;
sButInit.x = M_REQUEST_W - CLOSE_WIDTH - 3;
sButInit.y = 0;
sButInit.width = CLOSE_WIDTH;
sButInit.height = CLOSE_HEIGHT;
sButInit.pTip = _("Close");
sButInit.FontID = font_regular;
sButInit.pDisplay = intDisplayImageHilight;
sButInit.UserData = PACKDWORD_TRI(0,IMAGE_CLOSEHILIGHT , IMAGE_CLOSE);
widgAddButton(psRScreen, &sButInit);
/* Put the buttons on it *//* Set up the button struct */
memset(&sButInit, 0, sizeof(W_BUTINIT));
sButInit = W_BUTINIT();
sButInit.formID = M_REQUEST_TAB;
sButInit.id = M_REQUEST_BUT;
sButInit.style = WBUT_PLAIN;
sButInit.x = buttonsX;
sButInit.y = 4;
sButInit.width = R_BUT_W;
sButInit.height = R_BUT_H;
sButInit.pUserData = NULL;
sButInit.pDisplay = displayRequestOption;
sButInit.FontID = font_regular;
for (currFile = fileList, count = 0; *currFile != NULL && count < (butPerForm * 4); ++currFile)
{
@ -602,16 +596,14 @@ void addMultiRequest(const char* searchDir, const char* fileExtension, UDWORD mo
// if it's map select then add the cam style buttons.
if(mode == MULTIOP_MAP)
{
memset(&sButInit, 0, sizeof(W_BUTINIT));
sButInit = W_BUTINIT();
sButInit.formID = M_REQUEST_TAB;
sButInit.id = M_REQUEST_C1;
sButInit.style = WBUT_PLAIN;
sButInit.x = 1;
sButInit.y = 252;
sButInit.width = 17;
sButInit.height = 17;
sButInit.UserData = 1;
sButInit.FontID = font_regular;
sButInit.pTip = _("Technology level 1");
sButInit.pDisplay = displayCamTypeBut;
@ -1146,13 +1138,11 @@ static void displayChannelState(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset
static void addMultiPlayer(UDWORD player,UDWORD pos)
{
UDWORD y,id;
W_BUTINIT sButInit;
W_FORMINIT sFormInit;
y = MULTIMENU_PLAYER_H*(pos+1); // this is the top of the pos.
id = MULTIMENU_PLAYER+player;
// add the whole thing.
memset(&sFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
sFormInit.formID = MULTIMENU_FORM;
sFormInit.id = id;
sFormInit.style = WFORM_PLAIN;
@ -1170,17 +1160,16 @@ static void addMultiPlayer(UDWORD player,UDWORD pos)
//ping
//ALL DONE IN THE DISPLAY FUNC.
W_BUTINIT sButInit;
// add channel opener.
if(player != selectedPlayer)
{
memset(&sButInit, 0, sizeof(W_BUTINIT));
sButInit.formID = id;
sButInit.style = WBUT_PLAIN;
sButInit.x = MULTIMENU_C0;
sButInit.y = 5;
sButInit.width = 35;
sButInit.height = 24;
sButInit.FontID = font_regular;
sButInit.id = MULTIMENU_CHANNEL + player;
sButInit.pTip = _("Channel");
sButInit.pDisplay = displayChannelState;
@ -1195,7 +1184,6 @@ static void addMultiPlayer(UDWORD player,UDWORD pos)
sButInit.y = 5;
sButInit.width = 35;
sButInit.height = 24;
sButInit.FontID = font_regular;
sButInit.id = MULTIMENU_ALLIANCE_BASE + player;
sButInit.pTip = _("Toggle Alliance State");
sButInit.pDisplay = displayAllianceState;
@ -1278,7 +1266,6 @@ void intCloseDebugMenuNoAnim(void)
*/
BOOL addDebugMenu(BOOL bAdd)
{
W_FORMINIT sFormInit;
UDWORD i,pos = 0,formHeight=0;
/* Close */
@ -1299,7 +1286,7 @@ BOOL addDebugMenu(BOOL bAdd)
}
// add form
memset(&sFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = DEBUGMENU;
sFormInit.style = WFORM_PLAIN;
@ -1322,7 +1309,7 @@ BOOL addDebugMenu(BOOL bAdd)
if(strcmp(debugMenuEntry[i],""))
{
// add form
memset(&sFormInit, 0, sizeof(W_FORMINIT));
sFormInit = W_FORMINIT();
sFormInit.formID = DEBUGMENU;
sFormInit.id = DEBUGMENU_CLOSE + pos + 1;
sFormInit.style = WFORM_PLAIN;
@ -1339,7 +1326,7 @@ BOOL addDebugMenu(BOOL bAdd)
}
// Add the close button.
/* memset(&sButInit, 0, sizeof(W_BUTINIT));
/*
sButInit.formID = DEBUGMENU;
sButInit.id = DEBUGMENU_CLOSE;
sButInit.style = WBUT_PLAIN;
@ -1363,8 +1350,6 @@ BOOL addDebugMenu(BOOL bAdd)
BOOL intAddMultiMenu(void)
{
W_FORMINIT sFormInit;
W_BUTINIT sButInit;
UDWORD i;
//check for already open.
@ -1380,7 +1365,7 @@ BOOL intAddMultiMenu(void)
}
// add form
memset(&sFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = MULTIMENU_FORM;
sFormInit.style = WFORM_PLAIN;
@ -1406,16 +1391,14 @@ BOOL intAddMultiMenu(void)
}
// Add the close button.
memset(&sButInit, 0, sizeof(W_BUTINIT));
W_BUTINIT sButInit;
sButInit.formID = MULTIMENU_FORM;
sButInit.id = MULTIMENU_CLOSE;
sButInit.style = WBUT_PLAIN;
sButInit.x = MULTIMENU_FORM_W - CLOSE_WIDTH;
sButInit.y = 0;
sButInit.width = CLOSE_WIDTH;
sButInit.height = CLOSE_HEIGHT;
sButInit.pTip = _("Close");
sButInit.FontID = font_regular;
sButInit.pDisplay = intDisplayImageHilight;
sButInit.UserData = PACKDWORD_TRI(0,IMAGE_CLOSEHILIGHT , IMAGE_CLOSE);
if (!widgAddButton(psWScreen, &sButInit))

View File

@ -852,7 +852,6 @@ static void proj_InFlightFunc(PROJECTILE *psProj, bool bIndirect)
WEAPON asWeap;
// Determine position to fire a missile at
Vector3i newDest = psProj->src + move * distanceExtensionFactor/100;
memset(&asWeap, 0, sizeof(asWeap));
asWeap.nStat = psStats - asWeaponStats;
ASSERT(distanceExtensionFactor != 0, "Unitialized variable used! distanceExtensionFactor is not initialized.");

View File

@ -1805,21 +1805,14 @@ STRUCTURE* buildStructureDir(STRUCTURE_STATS *pStructureType, UDWORD x, UDWORD y
psBuilding->psTarget[i] = NULL;
psBuilding->targetOrigin[i] = ORIGIN_UNKNOWN;
}
psBuilding->bTargetted = false;
psBuilding->lastEmission = 0;
psBuilding->timeLastHit = 0;
psBuilding->lastHitWeapon = WSC_NUM_WEAPON_SUBCLASSES; // no such weapon
psBuilding->inFire = 0;
psBuilding->burnStart = 0;
psBuilding->burnDamage = 0;
psBuilding->selected = false;
psBuilding->status = SS_BEING_BUILT;
psBuilding->currentBuildPts = 0;
psBuilding->currentPowerAccrued = 0;
psBuilding->cluster = 0;
alignStructure(psBuilding);
@ -2162,9 +2155,6 @@ STRUCTURE *buildBlueprint(STRUCTURE_STATS *psStats, int32_t x, int32_t y, uint16
blueprint->rot.roll = 0;
blueprint->selected = false;
blueprint->timeLastHit = 0;
blueprint->lastHitWeapon = WSC_NUM_WEAPON_SUBCLASSES; // Noone attacked the blueprint. Do not render special effects.
blueprint->numWeaps = 0;
blueprint->asWeaps[0].nStat = 0;

View File

@ -212,8 +212,6 @@ BOOL intAddTransporter(DROID *psSelected, BOOL offWorld)
/*Add the Transporter Interface*/
static BOOL _intAddTransporter(DROID *psSelected, BOOL offWorld)
{
W_FORMINIT sFormInit;
W_BUTINIT sButInit;
BOOL Animate = true;
onMission = offWorld;
@ -243,10 +241,7 @@ static BOOL _intAddTransporter(DROID *psSelected, BOOL offWorld)
Animate = false;
}
memset(&sFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = IDTRANS_FORM;
sFormInit.style = WFORM_PLAIN;
@ -272,16 +267,14 @@ static BOOL _intAddTransporter(DROID *psSelected, BOOL offWorld)
}
/* Add the close button */
memset(&sButInit, 0, sizeof(W_BUTINIT));
W_BUTINIT sButInit;
sButInit.formID = IDTRANS_FORM;
sButInit.id = IDTRANS_CLOSE;
sButInit.style = WBUT_PLAIN;
sButInit.x = TRANS_WIDTH - CLOSE_WIDTH;
sButInit.y = 0;
sButInit.width = CLOSE_WIDTH;
sButInit.height = CLOSE_HEIGHT;
sButInit.pTip = _("Close");
sButInit.FontID = font_regular;
sButInit.pDisplay = intDisplayImageHilight;
sButInit.UserData = PACKDWORD_TRI(0,IMAGE_CLOSEHILIGHT , IMAGE_CLOSE);
if (!widgAddButton(psWScreen, &sButInit))
@ -316,10 +309,6 @@ static BOOL _intAddTransporter(DROID *psSelected, BOOL offWorld)
// Add the main Transporter Contents Interface
BOOL intAddTransporterContents(void)
{
W_FORMINIT sFormInit;
W_BUTINIT sButInit;
W_FORMINIT sButFInit;
W_LABINIT sLabInit;
BOOL Animate = true;
BOOL AlreadyUp = false;
@ -335,8 +324,7 @@ BOOL intAddTransporterContents(void)
Animate = false;
}
memset(&sFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = IDTRANS_CONTENTFORM;
sFormInit.style = WFORM_PLAIN;
@ -362,16 +350,14 @@ BOOL intAddTransporterContents(void)
}
/* Add the close button */
memset(&sButInit, 0, sizeof(W_BUTINIT));
W_BUTINIT sButInit;
sButInit.formID = IDTRANS_CONTENTFORM;
sButInit.id = IDTRANS_CONTCLOSE;
sButInit.style = WBUT_PLAIN;
sButInit.x = STAT_WIDTH - CLOSE_WIDTH;
sButInit.y = 0;
sButInit.width = CLOSE_WIDTH;
sButInit.height = CLOSE_HEIGHT;
sButInit.pTip = _("Close");
sButInit.FontID = font_regular;
sButInit.pDisplay = intDisplayImageHilight;
sButInit.UserData = PACKDWORD_TRI(0,IMAGE_CLOSEHILIGHT , IMAGE_CLOSE);
if (!widgAddButton(psWScreen, &sButInit))
@ -381,16 +367,14 @@ BOOL intAddTransporterContents(void)
if (bMultiPlayer)
{
//add the capacity label
memset(&sLabInit,0,sizeof(W_LABINIT));
W_LABINIT sLabInit;
sLabInit.formID = IDTRANS_CONTENTFORM;
sLabInit.id = IDTRANS_CAPACITY;
sLabInit.style = WLAB_PLAIN;
sLabInit.x = (SWORD)sButInit.x -40;
sLabInit.y = 0;
sLabInit.width = 16;
sLabInit.height = 16;
sLabInit.pText = "00/10";
sLabInit.FontID = font_regular;
sLabInit.pCallback = intUpdateTransCapacity;
if (!widgAddLabel(psWScreen, &sLabInit))
{
@ -400,7 +384,7 @@ BOOL intAddTransporterContents(void)
//add the Launch button if on a mission
if (onMission)
{
memset(&sButFInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sButFInit;
sButFInit.formID = IDTRANS_CONTENTFORM;
sButFInit.id = IDTRANS_LAUNCH;
sButFInit.style = WFORM_CLICKABLE | WFORM_NOCLICKMOVE;
@ -412,7 +396,6 @@ BOOL intAddTransporterContents(void)
sButFInit.height = iV_GetImageHeight(IntImages,IMAGE_LAUNCHUP);
sButFInit.pTip = _("Launch Transport");
//sButInit.pText = "Launch";
// sButFInit.FontID = font_regular;
sButFInit.pDisplay = intDisplayImageHilight;
sButFInit.UserData = PACKDWORD_TRI(0,IMAGE_LAUNCHDOWN,IMAGE_LAUNCHUP);
@ -434,10 +417,6 @@ BOOL intAddTransporterContents(void)
/*This is used to display the transporter button and capacity when at the home base ONLY*/
BOOL intAddTransporterLaunch(DROID *psDroid)
{
//W_BUTINIT sButInit;
W_FORMINIT sButInit; //needs to be a clickable form now
W_LABINIT sLabInit;
UDWORD capacity;
DROID *psCurr, *psNext;
@ -456,7 +435,7 @@ BOOL intAddTransporterLaunch(DROID *psDroid)
return true;
}
memset(&sButInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sButInit; //needs to be a clickable form now
sButInit.formID = 0;
sButInit.id = IDTRANS_LAUNCH;
sButInit.style = WFORM_CLICKABLE | WFORM_NOCLICKMOVE;
@ -473,16 +452,14 @@ BOOL intAddTransporterLaunch(DROID *psDroid)
}
//add the capacity label
memset(&sLabInit,0,sizeof(W_LABINIT));
W_LABINIT sLabInit;
sLabInit.formID = IDTRANS_LAUNCH;
sLabInit.id = IDTRANS_CAPACITY;
sLabInit.style = WLAB_PLAIN;
sLabInit.x = (SWORD)(sButInit.x + 20);
sLabInit.y = 0;
sLabInit.width = 16;
sLabInit.height = 16;
sLabInit.pText = "00/10";
sLabInit.FontID = font_regular;
sLabInit.pCallback = intUpdateTransCapacity;
if (!widgAddLabel(psWScreen, &sLabInit))
{
@ -525,14 +502,12 @@ void intRemoveTransporterLaunch(void)
/* Add the Transporter Button form */
BOOL intAddTransButtonForm(void)
{
W_FORMINIT sFormInit;
W_FORMINIT sBFormInit, sBFormInit2;
UDWORD numButtons, i;
SDWORD BufferID;
DROID *psDroid;
/* Add the button form */
memset(&sFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
sFormInit.formID = IDTRANS_FORM;
sFormInit.id = IDTRANS_TABFORM;
sFormInit.style = WFORM_TABBED;
@ -591,8 +566,7 @@ BOOL intAddTransButtonForm(void)
/* Add the transporter and status buttons */
memset(&sBFormInit, 0, sizeof(W_FORMINIT));
memset(&sBFormInit2, 0, sizeof(W_FORMINIT));
W_FORMINIT sBFormInit;
sBFormInit.formID = IDTRANS_TABFORM;
sBFormInit.id = IDTRANS_START;
sBFormInit.majorID = 0;
@ -603,7 +577,7 @@ BOOL intAddTransButtonForm(void)
sBFormInit.width = OBJ_BUTWIDTH;
sBFormInit.height = OBJ_BUTHEIGHT;
memcpy(&sBFormInit2,&sBFormInit,sizeof(W_FORMINIT));
W_FORMINIT sBFormInit2 = sBFormInit;
sBFormInit2.id = IDTRANS_STATSTART;
sBFormInit2.y = OBJ_STATSTARTY;
@ -685,14 +659,12 @@ BOOL intAddTransButtonForm(void)
/* Add the Transporter Contents form */
BOOL intAddTransContentsForm(void)
{
W_FORMINIT sFormInit;
W_FORMINIT sBFormInit;
UDWORD numButtons, i;
SDWORD BufferID;
DROID *psDroid, *psNext;
/* Add the contents form */
memset(&sFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
sFormInit.formID = IDTRANS_CONTENTFORM;
sFormInit.id = IDTRANS_CONTABFORM;
sFormInit.style = WFORM_TABBED;
@ -734,7 +706,7 @@ BOOL intAddTransContentsForm(void)
/* Add the transporter contents buttons */
memset(&sBFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sBFormInit;
sBFormInit.formID = IDTRANS_CONTABFORM;
sBFormInit.id = IDTRANS_CONTSTART;
sBFormInit.majorID = 0;
@ -792,10 +764,6 @@ BOOL intAddTransContentsForm(void)
/* Add the Droids back at home form */
BOOL intAddDroidsAvailForm(void)
{
W_FORMINIT sFormInit;
W_BUTINIT sButInit;
W_FORMINIT sBFormInit;
W_BARINIT sBarInit;
UDWORD numButtons, i, butPerForm;
SDWORD BufferID;
DROID *psDroid;
@ -815,7 +783,7 @@ BOOL intAddDroidsAvailForm(void)
/* Add the droids available form */
memset(&sFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sFormInit;
sFormInit.formID = 0;
sFormInit.id = IDTRANS_DROIDS;
sFormInit.style = WFORM_PLAIN;
@ -842,19 +810,15 @@ BOOL intAddDroidsAvailForm(void)
}
/* Add the close button */
memset(&sButInit, 0, sizeof(W_BUTINIT));
W_BUTINIT sButInit;
sButInit.formID = IDTRANS_DROIDS;
sButInit.id = IDTRANS_DROIDCLOSE;
sButInit.style = WBUT_PLAIN;
sButInit.x = TRANSDROID_WIDTH - CLOSE_WIDTH;
sButInit.y = 0;
sButInit.width = CLOSE_WIDTH;
sButInit.height = CLOSE_HEIGHT;
sButInit.pTip = _("Close");
sButInit.FontID = font_regular;
sButInit.pDisplay = intDisplayImageHilight;
sButInit.UserData = PACKDWORD_TRI(0,IMAGE_CLOSEHILIGHT , IMAGE_CLOSE);
if (!widgAddButton(psWScreen, &sButInit))
@ -864,7 +828,7 @@ BOOL intAddDroidsAvailForm(void)
//now add the tabbed droids available form
memset(&sFormInit, 0, sizeof(W_FORMINIT));
sFormInit = W_FORMINIT();
sFormInit.formID = IDTRANS_DROIDS;
sFormInit.id = IDTRANS_DROIDTAB;
sFormInit.style = WFORM_TABBED;
@ -930,7 +894,7 @@ BOOL intAddDroidsAvailForm(void)
/* Add the droids available buttons */
memset(&sBFormInit, 0, sizeof(W_FORMINIT));
W_FORMINIT sBFormInit;
sBFormInit.formID = IDTRANS_DROIDTAB;
sBFormInit.id = IDTRANS_DROIDSTART;
sBFormInit.majorID = 0;
@ -944,10 +908,8 @@ BOOL intAddDroidsAvailForm(void)
ClearSystem0Buffers();
/* Add the state of repair bar for each droid*/
memset(&sBarInit, 0, sizeof(W_BARINIT));
W_BARINIT sBarInit;
sBarInit.id = IDTRANS_REPAIRBARSTART;
sBarInit.style = WBAR_PLAIN;
sBarInit.orientation = WBAR_LEFT;
sBarInit.x = STAT_TIMEBARX;
sBarInit.y = STAT_TIMEBARY;
sBarInit.width = STAT_PROGBARWIDTH;