mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
Ammo colour in AmmoTypes.xml is now set using <red>/<green>/<blue> tags instead of <fontColour>/<grayed>/<offNormal>/<onNormal>.
For more information, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=20659&goto=355255&#msg_355255 git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8627 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -2141,7 +2141,7 @@ INT32 CreateIconAndTextButton( INT32 Image, const STR16 string, UINT32 uiFont,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Strip off any extraneous bits from button type
|
// Strip off any extraneous bits from button type
|
||||||
BType = Type & ( BUTTON_TYPE_MASK | BUTTON_NEWTOGGLE );
|
BType = Type & ( BUTTON_TYPE_MASK | BUTTON_NEWTOGGLE | BUTTON_16BPPCOLOURTEXT );
|
||||||
|
|
||||||
// Is there a QuickButton image in the given image slot?
|
// Is there a QuickButton image in the given image slot?
|
||||||
if(ButtonPictures[Image].vobj == NULL)
|
if(ButtonPictures[Image].vobj == NULL)
|
||||||
@@ -3521,6 +3521,7 @@ void DrawTextOnButton(GUI_BUTTON *b)
|
|||||||
SetFontBackground( FONT_MCOLOR_BLACK );
|
SetFontBackground( FONT_MCOLOR_BLACK );
|
||||||
SetFontForeground( (UINT8)b->sForeColor );
|
SetFontForeground( (UINT8)b->sForeColor );
|
||||||
sForeColor = b->sForeColor;
|
sForeColor = b->sForeColor;
|
||||||
|
|
||||||
if( b->sShadowColor != -1 )
|
if( b->sShadowColor != -1 )
|
||||||
SetFontShadow( (UINT8)b->sShadowColor );
|
SetFontShadow( (UINT8)b->sShadowColor );
|
||||||
//Override the colors if necessary.
|
//Override the colors if necessary.
|
||||||
@@ -3534,6 +3535,7 @@ void DrawTextOnButton(GUI_BUTTON *b)
|
|||||||
SetFontForeground( (UINT8)b->sForeColorDown );
|
SetFontForeground( (UINT8)b->sForeColorDown );
|
||||||
sForeColor = b->sForeColorDown;
|
sForeColor = b->sForeColorDown;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( b->uiFlags & BUTTON_ENABLED && b->Area.uiFlags & MSYS_MOUSE_IN_AREA && b->sShadowColorHilited != -1 )
|
if( b->uiFlags & BUTTON_ENABLED && b->Area.uiFlags & MSYS_MOUSE_IN_AREA && b->sShadowColorHilited != -1 )
|
||||||
{
|
{
|
||||||
SetFontShadow( (UINT8)b->sShadowColorHilited );
|
SetFontShadow( (UINT8)b->sShadowColorHilited );
|
||||||
@@ -3542,6 +3544,14 @@ void DrawTextOnButton(GUI_BUTTON *b)
|
|||||||
{
|
{
|
||||||
SetFontShadow( (UINT8)b->sShadowColorDown );
|
SetFontShadow( (UINT8)b->sShadowColorDown );
|
||||||
}
|
}
|
||||||
|
else if ( b->uiFlags & BUTTON_16BPPCOLOURTEXT )
|
||||||
|
{
|
||||||
|
SetRGBFontForeground( sForeColor );
|
||||||
|
|
||||||
|
if ( b->sShadowColor < 1 )
|
||||||
|
SetRGBFontShadow( 1 );
|
||||||
|
}
|
||||||
|
|
||||||
if( b->uiFlags & BUTTON_CLICKED_ON && b->fShiftText )
|
if( b->uiFlags & BUTTON_CLICKED_ON && b->fShiftText )
|
||||||
{ // Was the button clicked on? if so, move the text slightly for the illusion
|
{ // Was the button clicked on? if so, move the text slightly for the illusion
|
||||||
// that the text moved into the screen.
|
// that the text moved into the screen.
|
||||||
|
|||||||
@@ -70,6 +70,7 @@
|
|||||||
#define BUTTON_NEWTOGGLE 0x00002000
|
#define BUTTON_NEWTOGGLE 0x00002000
|
||||||
#define BUTTON_FORCE_UNDIRTY 0x00004000 // no matter what happens this buttons does NOT get marked dirty
|
#define BUTTON_FORCE_UNDIRTY 0x00004000 // no matter what happens this buttons does NOT get marked dirty
|
||||||
#define BUTTON_IGNORE_CLICKS 0x00008000 // Ignore any clicks on this button
|
#define BUTTON_IGNORE_CLICKS 0x00008000 // Ignore any clicks on this button
|
||||||
|
#define BUTTON_16BPPCOLOURTEXT 0x00010000 // Use 16 bit colours for the text of this button
|
||||||
#define BUTTON_DISABLED_CALLBACK 0x80000000
|
#define BUTTON_DISABLED_CALLBACK 0x80000000
|
||||||
|
|
||||||
#define BUTTON_SOUND_NONE 0x00
|
#define BUTTON_SOUND_NONE 0x00
|
||||||
|
|||||||
@@ -241,6 +241,17 @@ void SetRGBFontShadow( UINT32 uiRed, UINT32 uiGreen, UINT32 uiBlue )
|
|||||||
}
|
}
|
||||||
//end Kris
|
//end Kris
|
||||||
|
|
||||||
|
// Flugente: set 16 bit colour directly
|
||||||
|
void SetRGBFontForeground( UINT16 usFontForeground16 )
|
||||||
|
{
|
||||||
|
FontForeground16 = usFontForeground16;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetRGBFontShadow( UINT16 usFontShadow16 )
|
||||||
|
{
|
||||||
|
FontShadow16 = usFontShadow16;
|
||||||
|
}
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
// ResetFontObjectPalette
|
// ResetFontObjectPalette
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -118,6 +118,10 @@ void SetRGBFontForeground( UINT32 uiRed, UINT32 uiGreen, UINT32 uiBlue );
|
|||||||
void SetRGBFontBackground( UINT32 uiRed, UINT32 uiGreen, UINT32 uiBlue );
|
void SetRGBFontBackground( UINT32 uiRed, UINT32 uiGreen, UINT32 uiBlue );
|
||||||
void SetRGBFontShadow( UINT32 uiRed, UINT32 uiGreen, UINT32 uiBlue );
|
void SetRGBFontShadow( UINT32 uiRed, UINT32 uiGreen, UINT32 uiBlue );
|
||||||
|
|
||||||
|
// Flugente: set 16 bit colour directly
|
||||||
|
void SetRGBFontForeground( UINT16 usFontForeground16 );
|
||||||
|
void SetRGBFontShadow( UINT16 usFontShadow16 );
|
||||||
|
|
||||||
BOOLEAN ResetFontObjectPalette(INT32 iFont);
|
BOOLEAN ResetFontObjectPalette(INT32 iFont);
|
||||||
UINT16 *SetFontObjectPalette8BPP(INT32 iFont, SGPPaletteEntry *pPal8);
|
UINT16 *SetFontObjectPalette8BPP(INT32 iFont, SGPPaletteEntry *pPal8);
|
||||||
UINT16 *SetFontObjectPalette16BPP(INT32 iFont, UINT16 *pPal16);
|
UINT16 *SetFontObjectPalette16BPP(INT32 iFont, UINT16 *pPal16);
|
||||||
|
|||||||
@@ -3891,7 +3891,9 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
|
|||||||
|
|
||||||
if ( pItemShown->usItemClass == IC_GUN && !Item[pObjShown->usItem].rocketlauncher )
|
if ( pItemShown->usItemClass == IC_GUN && !Item[pObjShown->usItem].rocketlauncher )
|
||||||
{
|
{
|
||||||
SetFontForeground ( AmmoTypes[(*pObjShown)[iter]->data.gun.ubGunAmmoType].fontColour );
|
SetRGBFontForeground( AmmoTypes[( *pObjShown )[iter]->data.gun.ubGunAmmoType].red,
|
||||||
|
AmmoTypes[( *pObjShown )[iter]->data.gun.ubGunAmmoType].green,
|
||||||
|
AmmoTypes[( *pObjShown )[iter]->data.gun.ubGunAmmoType].blue );
|
||||||
|
|
||||||
// HEADROCK HAM 3.4: Get estimate of bullets left.
|
// HEADROCK HAM 3.4: Get estimate of bullets left.
|
||||||
if ( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) )
|
if ( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) )
|
||||||
@@ -4359,7 +4361,9 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
|
|||||||
UINT16 usAmmoMagSize = Magazine[usMagIndex].ubMagSize;
|
UINT16 usAmmoMagSize = Magazine[usMagIndex].ubMagSize;
|
||||||
UINT8 usAmmoAmmoType = Magazine[usMagIndex].ubAmmoType;
|
UINT8 usAmmoAmmoType = Magazine[usMagIndex].ubAmmoType;
|
||||||
|
|
||||||
SetFontForeground ( AmmoTypes[usAmmoAmmoType].fontColour );
|
SetRGBFontForeground( AmmoTypes[usAmmoAmmoType].red,
|
||||||
|
AmmoTypes[usAmmoAmmoType].green,
|
||||||
|
AmmoTypes[usAmmoAmmoType].blue );
|
||||||
|
|
||||||
// count the total ammo left
|
// count the total ammo left
|
||||||
UINT16 totalammo = 0;
|
UINT16 totalammo = 0;
|
||||||
@@ -4593,9 +4597,11 @@ void MAPINVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pOb
|
|||||||
|
|
||||||
// Set font properties
|
// Set font properties
|
||||||
SetFont( LARGEFONT1 );
|
SetFont( LARGEFONT1 );
|
||||||
|
|
||||||
// Get color from ammo details
|
// Get color from ammo details
|
||||||
UINT8 ubAmmoColor = AmmoTypes[(*pObject)[0]->data.gun.ubGunAmmoType].fontColour;
|
SetRGBFontForeground( AmmoTypes[( *pObject )[0]->data.gun.ubGunAmmoType].red,
|
||||||
SetFontForeground ( ubAmmoColor );
|
AmmoTypes[( *pObject )[0]->data.gun.ubGunAmmoType].green,
|
||||||
|
AmmoTypes[( *pObject )[0]->data.gun.ubGunAmmoType].blue );
|
||||||
|
|
||||||
sNewX = sX + 5;
|
sNewX = sX + 5;
|
||||||
sNewY = ((sY + sHeight) - GetFontHeight( LARGEFONT1 )) - 2;
|
sNewY = ((sY + sHeight) - GetFontHeight( LARGEFONT1 )) - 2;
|
||||||
@@ -4675,9 +4681,11 @@ void MAPINVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pOb
|
|||||||
|
|
||||||
// Set font properties
|
// Set font properties
|
||||||
SetFont( LARGEFONT1 );
|
SetFont( LARGEFONT1 );
|
||||||
|
|
||||||
// Get color from ammo details
|
// Get color from ammo details
|
||||||
UINT8 ubAmmoColor = AmmoTypes[Magazine[Item[ pObject->usItem ].ubClassIndex].ubAmmoType].fontColour;
|
SetRGBFontForeground( AmmoTypes[Magazine[Item[pObject->usItem].ubClassIndex].ubAmmoType].red,
|
||||||
SetFontForeground ( ubAmmoColor );
|
AmmoTypes[Magazine[Item[pObject->usItem].ubClassIndex].ubAmmoType].green,
|
||||||
|
AmmoTypes[Magazine[Item[pObject->usItem].ubClassIndex].ubAmmoType].blue );
|
||||||
|
|
||||||
sNewX = sX + 5;
|
sNewX = sX + 5;
|
||||||
sNewY = ((sY + sHeight) - GetFontHeight( LARGEFONT1 )) - 2;
|
sNewY = ((sY + sHeight) - GetFontHeight( LARGEFONT1 )) - 2;
|
||||||
@@ -5281,38 +5289,35 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY,
|
|||||||
}
|
}
|
||||||
|
|
||||||
FilenameForBPP("INTERFACE\\infobox.sti", ubString);
|
FilenameForBPP("INTERFACE\\infobox.sti", ubString);
|
||||||
sForeColour = ITEMDESC_AMMO_FORE;
|
|
||||||
|
// Flugente: the bullet icon has a very limited colour choice because its a .sti picture. So we change the display, always use the same default picture but use the colour for the text instead
|
||||||
|
//sForeColour = ITEMDESC_AMMO_FORE;
|
||||||
|
|
||||||
|
sForeColour = (INT16)Get16BPPColor( FROMRGB( AmmoTypes[( *gpItemDescObject )[ubStatusIndex]->data.gun.ubGunAmmoType].red,
|
||||||
|
AmmoTypes[( *gpItemDescObject )[ubStatusIndex]->data.gun.ubGunAmmoType].green,
|
||||||
|
AmmoTypes[( *gpItemDescObject )[ubStatusIndex]->data.gun.ubGunAmmoType].blue ) );
|
||||||
|
|
||||||
// silversurfer: This should never happen but some maps may contain items with invalid ammo types and this leads to graphical glitches
|
// silversurfer: This should never happen but some maps may contain items with invalid ammo types and this leads to graphical glitches
|
||||||
// because the game cannot find the right ammo icon in infobox.sti and then uses index 0. Index 0 is the info box itself.
|
// because the game cannot find the right ammo icon in infobox.sti and then uses index 0. Index 0 is the info box itself.
|
||||||
// Better reset ammo type to 0 which is standard ball ammo.
|
// Better reset ammo type to 0 which is standard ball ammo.
|
||||||
if ( AmmoTypes[(*pObject)[ubStatusIndex]->data.gun.ubGunAmmoType].grayed == 0 || AmmoTypes[(*pObject)[ubStatusIndex]->data.gun.ubGunAmmoType].offNormal == 0 || AmmoTypes[(*pObject)[ubStatusIndex]->data.gun.ubGunAmmoType].onNormal == 0 )
|
if ( ( *pObject )[ubStatusIndex]->data.gun.ubGunAmmoType >= gMAXAMMOTYPES_READ )
|
||||||
(*pObject)[ubStatusIndex]->data.gun.ubGunAmmoType = 0;
|
( *pObject )[ubStatusIndex]->data.gun.ubGunAmmoType = 0;
|
||||||
|
|
||||||
giItemDescAmmoButtonImages = LoadButtonImage(ubString,AmmoTypes[(*pObject)[ubStatusIndex]->data.gun.ubGunAmmoType].grayed,AmmoTypes[(*pObject)[ubStatusIndex]->data.gun.ubGunAmmoType].offNormal,-1,AmmoTypes[(*pObject)[ubStatusIndex]->data.gun.ubGunAmmoType].onNormal,-1 );
|
// fixed pictures
|
||||||
|
giItemDescAmmoButtonImages = LoadButtonImage( ubString,
|
||||||
|
4,// AmmoTypes[( *pObject )[ubStatusIndex]->data.gun.ubGunAmmoType].grayed,
|
||||||
|
1,//AmmoTypes[(*pObject)[ubStatusIndex]->data.gun.ubGunAmmoType].offNormal,
|
||||||
|
-1,
|
||||||
|
3,//AmmoTypes[(*pObject)[ubStatusIndex]->data.gun.ubGunAmmoType].onNormal,
|
||||||
|
-1 );
|
||||||
|
|
||||||
if( guiCurrentItemDescriptionScreen == MAP_SCREEN )
|
giItemDescAmmoButton = CreateIconAndTextButton( giItemDescAmmoButtonImages, pStr, BLOCKFONTNARROW,
|
||||||
{
|
sForeColour, FONT_MCOLOR_BLACK,
|
||||||
// in mapscreen, move over a bit
|
sForeColour, FONT_MCOLOR_BLACK,
|
||||||
giItemDescAmmoButton = CreateIconAndTextButton( giItemDescAmmoButtonImages, pStr, BLOCKFONTNARROW,
|
TEXT_CJUSTIFIED,
|
||||||
sForeColour, FONT_MCOLOR_BLACK,
|
(INT16)( ITEMDESC_AMMO_X ), (INT16)( ITEMDESC_AMMO_Y ), (BUTTON_TOGGLE| BUTTON_16BPPCOLOURTEXT ), MSYS_PRIORITY_HIGHEST,
|
||||||
sForeColour, FONT_MCOLOR_BLACK,
|
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)ItemDescAmmoCallback );
|
||||||
TEXT_CJUSTIFIED,
|
|
||||||
(INT16)(ITEMDESC_AMMO_X), (INT16)(ITEMDESC_AMMO_Y), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
|
|
||||||
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)ItemDescAmmoCallback );
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
// not in mapscreen
|
|
||||||
giItemDescAmmoButton = CreateIconAndTextButton( giItemDescAmmoButtonImages, pStr, BLOCKFONTNARROW,
|
|
||||||
sForeColour, FONT_MCOLOR_BLACK,
|
|
||||||
sForeColour, FONT_MCOLOR_BLACK,
|
|
||||||
TEXT_CJUSTIFIED,
|
|
||||||
(INT16)(ITEMDESC_AMMO_X), (INT16)(ITEMDESC_AMMO_Y), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
|
|
||||||
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)ItemDescAmmoCallback );
|
|
||||||
}
|
|
||||||
//if we are being init from the shop keeper screen and this is a dealer item we are getting info from
|
//if we are being init from the shop keeper screen and this is a dealer item we are getting info from
|
||||||
if( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE && pShopKeeperItemDescObject != NULL )
|
if( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE && pShopKeeperItemDescObject != NULL )
|
||||||
{
|
{
|
||||||
@@ -5322,7 +5327,8 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY,
|
|||||||
DisableButton( giItemDescAmmoButton );
|
DisableButton( giItemDescAmmoButton );
|
||||||
SetButtonFastHelpText( giItemDescAmmoButton, L"\0" );
|
SetButtonFastHelpText( giItemDescAmmoButton, L"\0" );
|
||||||
}
|
}
|
||||||
else{
|
else
|
||||||
|
{
|
||||||
SetButtonFastHelpText( giItemDescAmmoButton, Message[ STR_EJECT_AMMO ] );
|
SetButtonFastHelpText( giItemDescAmmoButton, Message[ STR_EJECT_AMMO ] );
|
||||||
//CHRISL: Include the ubStatusIndex in the region information so we know which object in a stack we're looking at
|
//CHRISL: Include the ubStatusIndex in the region information so we know which object in a stack we're looking at
|
||||||
MSYS_SetBtnUserData( giItemDescAmmoButton, 1, ubStatusIndex );
|
MSYS_SetBtnUserData( giItemDescAmmoButton, 1, ubStatusIndex );
|
||||||
@@ -5333,7 +5339,6 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY,
|
|||||||
SpecifyButtonTextOffsets( giItemDescAmmoButton, (UINT8) usX, (UINT8) usY, TRUE );
|
SpecifyButtonTextOffsets( giItemDescAmmoButton, (UINT8) usX, (UINT8) usY, TRUE );
|
||||||
|
|
||||||
gfItemAmmoDown = FALSE;
|
gfItemAmmoDown = FALSE;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -5466,7 +5471,6 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY,
|
|||||||
(UINT16)(gMoneyButtonLoc.x + gMoneyButtonOffsets[cnt].x), (UINT16)(gMoneyButtonLoc.y + gMoneyButtonOffsets[cnt].y), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST,
|
(UINT16)(gMoneyButtonLoc.x + gMoneyButtonOffsets[cnt].x), (UINT16)(gMoneyButtonLoc.y + gMoneyButtonOffsets[cnt].y), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST,
|
||||||
DEFAULT_MOVE_CALLBACK, BtnMoneyButtonCallback );
|
DEFAULT_MOVE_CALLBACK, BtnMoneyButtonCallback );
|
||||||
MSYS_SetBtnUserData( guiMoneyButtonBtn[cnt], 0, cnt);
|
MSYS_SetBtnUserData( guiMoneyButtonBtn[cnt], 0, cnt);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -5500,7 +5504,6 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// HEADROCK HAM 4: Three UDB tab buttons
|
// HEADROCK HAM 4: Three UDB tab buttons
|
||||||
if (UsingEDBSystem() > 0)
|
if (UsingEDBSystem() > 0)
|
||||||
{
|
{
|
||||||
@@ -5607,7 +5610,6 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY,
|
|||||||
|
|
||||||
fInterfacePanelDirty = DIRTYLEVEL2;
|
fInterfacePanelDirty = DIRTYLEVEL2;
|
||||||
|
|
||||||
|
|
||||||
gfInItemDescBox = TRUE;
|
gfInItemDescBox = TRUE;
|
||||||
|
|
||||||
CHECKF( ReloadItemDesc( ) );
|
CHECKF( ReloadItemDesc( ) );
|
||||||
@@ -5659,8 +5661,6 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY,
|
|||||||
gfItemDescHelpTextOffset = TRUE;
|
gfItemDescHelpTextOffset = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return( TRUE );
|
return( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6046,6 +6046,13 @@ void RenderBulletIcon(OBJECTTYPE *pObject, UINT32 ubStatusIndex)
|
|||||||
swprintf( pStr, L"%d", (*pObject)[ubStatusIndex]->data.gun.ubGunShotsLeft );
|
swprintf( pStr, L"%d", (*pObject)[ubStatusIndex]->data.gun.ubGunShotsLeft );
|
||||||
|
|
||||||
SpecifyButtonText( giItemDescAmmoButton, pStr );
|
SpecifyButtonText( giItemDescAmmoButton, pStr );
|
||||||
|
|
||||||
|
// Flugente: redo the ammo colour, as it might have changed
|
||||||
|
INT16 sForeColour = (INT16)Get16BPPColor( FROMRGB( AmmoTypes[( *pObject )[ubStatusIndex]->data.gun.ubGunAmmoType].red,
|
||||||
|
AmmoTypes[( *pObject )[ubStatusIndex]->data.gun.ubGunAmmoType].green,
|
||||||
|
AmmoTypes[( *pObject )[ubStatusIndex]->data.gun.ubGunAmmoType].blue ) );
|
||||||
|
|
||||||
|
SpecifyButtonUpTextColors( giItemDescAmmoButton, sForeColour, -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemDescAmmoCallback(GUI_BUTTON *btn,INT32 reason)
|
void ItemDescAmmoCallback(GUI_BUTTON *btn,INT32 reason)
|
||||||
|
|||||||
@@ -1692,6 +1692,7 @@ typedef enum
|
|||||||
|
|
||||||
// Flugente: in order not to loop over MAXITEMS items if we only have a few thousand, remember the actual number of items in the xml
|
// Flugente: in order not to loop over MAXITEMS items if we only have a few thousand, remember the actual number of items in the xml
|
||||||
extern UINT32 gMAXITEMS_READ;
|
extern UINT32 gMAXITEMS_READ;
|
||||||
|
extern UINT32 gMAXAMMOTYPES_READ;
|
||||||
|
|
||||||
/* CHRISL: Arrays to track ic group information. These allow us to determine which LBE slots control which pockets and
|
/* CHRISL: Arrays to track ic group information. These allow us to determine which LBE slots control which pockets and
|
||||||
what LBE class the pockets are.*/
|
what LBE class the pockets are.*/
|
||||||
|
|||||||
+4
-6
@@ -207,12 +207,10 @@ typedef struct
|
|||||||
{
|
{
|
||||||
UINT32 uiIndex;
|
UINT32 uiIndex;
|
||||||
|
|
||||||
// on interface
|
// Flugente: fontColour takes RGB values from a sti library. Why not take RGB values directly?
|
||||||
UINT8 fontColour;
|
UINT8 red;
|
||||||
// in detail screen (interface\infobox.sti)
|
UINT8 green;
|
||||||
INT32 grayed;
|
UINT8 blue;
|
||||||
INT32 offNormal;
|
|
||||||
INT32 onNormal;
|
|
||||||
|
|
||||||
// bullet contact with structure
|
// bullet contact with structure
|
||||||
INT32 structureImpactReductionMultiplier;
|
INT32 structureImpactReductionMultiplier;
|
||||||
|
|||||||
+21
-28
@@ -9,6 +9,8 @@
|
|||||||
#include "XML.h"
|
#include "XML.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Flugente: remember how many ammotypes we read
|
||||||
|
UINT32 gMAXAMMOTYPES_READ = 0;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
@@ -49,10 +51,9 @@ ammotypeStartElementHandle(void *userData, const XML_Char *name, const XML_Char
|
|||||||
}
|
}
|
||||||
else if(pData->curElement == ELEMENT &&
|
else if(pData->curElement == ELEMENT &&
|
||||||
(strcmp(name, "uiIndex") == 0 ||
|
(strcmp(name, "uiIndex") == 0 ||
|
||||||
strcmp(name, "fontColour") == 0 ||
|
strcmp(name, "red" ) == 0 ||
|
||||||
strcmp(name, "grayed") == 0 ||
|
strcmp(name, "green" ) == 0 ||
|
||||||
strcmp(name, "offNormal") == 0 ||
|
strcmp(name, "blue" ) == 0 ||
|
||||||
strcmp(name, "onNormal") == 0 ||
|
|
||||||
strcmp(name, "structureImpactReductionMultiplier") == 0 ||
|
strcmp(name, "structureImpactReductionMultiplier") == 0 ||
|
||||||
strcmp(name, "armourImpactReductionMultiplier") == 0 ||
|
strcmp(name, "armourImpactReductionMultiplier") == 0 ||
|
||||||
strcmp(name, "afterArmourDamageMultiplier") == 0 ||
|
strcmp(name, "afterArmourDamageMultiplier") == 0 ||
|
||||||
@@ -132,31 +133,28 @@ ammotypeEndElementHandle(void *userData, const XML_Char *name)
|
|||||||
{
|
{
|
||||||
pData->curArray[pData->curAmmoType.uiIndex] = pData->curAmmoType; //write the ammotype into the table
|
pData->curArray[pData->curAmmoType.uiIndex] = pData->curAmmoType; //write the ammotype into the table
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gMAXAMMOTYPES_READ = pData->curAmmoType.uiIndex;
|
||||||
}
|
}
|
||||||
else if(strcmp(name, "uiIndex") == 0)
|
else if(strcmp(name, "uiIndex") == 0)
|
||||||
{
|
{
|
||||||
pData->curElement = ELEMENT;
|
pData->curElement = ELEMENT;
|
||||||
pData->curAmmoType.uiIndex = (UINT32) strtoul(pData->szCharData, NULL, 0);
|
pData->curAmmoType.uiIndex = (UINT32) strtoul(pData->szCharData, NULL, 0);
|
||||||
}
|
}
|
||||||
else if(strcmp(name, "fontColour") == 0)
|
else if ( strcmp( name, "red" ) == 0 )
|
||||||
{
|
{
|
||||||
pData->curElement = ELEMENT;
|
pData->curElement = ELEMENT;
|
||||||
pData->curAmmoType.fontColour = (UINT8) atol(pData->szCharData);
|
pData->curAmmoType.red = (UINT8)atol( pData->szCharData );
|
||||||
}
|
}
|
||||||
else if(strcmp(name, "grayed") == 0)
|
else if ( strcmp( name, "green" ) == 0 )
|
||||||
{
|
{
|
||||||
pData->curElement = ELEMENT;
|
pData->curElement = ELEMENT;
|
||||||
pData->curAmmoType.grayed = (INT32) atol(pData->szCharData);
|
pData->curAmmoType.green = (UINT8)atol( pData->szCharData );
|
||||||
}
|
}
|
||||||
else if(strcmp(name, "offNormal") == 0)
|
else if ( strcmp( name, "blue" ) == 0 )
|
||||||
{
|
{
|
||||||
pData->curElement = ELEMENT;
|
pData->curElement = ELEMENT;
|
||||||
pData->curAmmoType.offNormal = (INT32) atol(pData->szCharData);
|
pData->curAmmoType.blue = (UINT8)atol( pData->szCharData );
|
||||||
}
|
|
||||||
else if(strcmp(name, "onNormal") == 0)
|
|
||||||
{
|
|
||||||
pData->curElement = ELEMENT;
|
|
||||||
pData->curAmmoType.onNormal = (INT32) atol(pData->szCharData);
|
|
||||||
}
|
}
|
||||||
else if(strcmp(name, "structureImpactReductionMultiplier") == 0)
|
else if(strcmp(name, "structureImpactReductionMultiplier") == 0)
|
||||||
{
|
{
|
||||||
@@ -383,18 +381,15 @@ BOOLEAN ReadInAmmoTypeStats(STR fileName)
|
|||||||
|
|
||||||
FileClose( hFile );
|
FileClose( hFile );
|
||||||
|
|
||||||
|
|
||||||
XML_SetElementHandler(parser, ammotypeStartElementHandle, ammotypeEndElementHandle);
|
XML_SetElementHandler(parser, ammotypeStartElementHandle, ammotypeEndElementHandle);
|
||||||
XML_SetCharacterDataHandler(parser, ammotypeCharacterDataHandle);
|
XML_SetCharacterDataHandler(parser, ammotypeCharacterDataHandle);
|
||||||
|
|
||||||
|
|
||||||
memset(&pData,0,sizeof(pData));
|
memset(&pData,0,sizeof(pData));
|
||||||
pData.curArray = AmmoTypes;
|
pData.curArray = AmmoTypes;
|
||||||
pData.maxArraySize = MAXITEMS;
|
pData.maxArraySize = MAXITEMS;
|
||||||
|
|
||||||
XML_SetUserData(parser, &pData);
|
XML_SetUserData(parser, &pData);
|
||||||
|
|
||||||
|
|
||||||
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
|
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
|
||||||
{
|
{
|
||||||
CHAR8 errorBuf[511];
|
CHAR8 errorBuf[511];
|
||||||
@@ -406,14 +401,16 @@ BOOLEAN ReadInAmmoTypeStats(STR fileName)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
MemFree(lpcBuffer);
|
// entries read were x -> x+1 entries
|
||||||
|
++gMAXAMMOTYPES_READ;
|
||||||
|
|
||||||
|
MemFree(lpcBuffer);
|
||||||
|
|
||||||
XML_ParserFree(parser);
|
XML_ParserFree(parser);
|
||||||
|
|
||||||
|
|
||||||
return( TRUE );
|
return( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN WriteAmmoTypeStats()
|
BOOLEAN WriteAmmoTypeStats()
|
||||||
{
|
{
|
||||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"writeammotypestats");
|
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"writeammotypestats");
|
||||||
@@ -426,19 +423,15 @@ BOOLEAN WriteAmmoTypeStats()
|
|||||||
return( FALSE );
|
return( FALSE );
|
||||||
|
|
||||||
{
|
{
|
||||||
UINT32 cnt;
|
|
||||||
|
|
||||||
FilePrintf(hFile,"<AMMOTYPELIST>\r\n");
|
FilePrintf(hFile,"<AMMOTYPELIST>\r\n");
|
||||||
for(cnt = 0;cnt < MAXITEMS;cnt++)
|
for ( UINT32 cnt = 0;cnt < gMAXAMMOTYPES_READ; ++cnt)
|
||||||
{
|
{
|
||||||
|
|
||||||
FilePrintf(hFile,"\t<AMMOTYPE>\r\n");
|
FilePrintf(hFile,"\t<AMMOTYPE>\r\n");
|
||||||
|
|
||||||
FilePrintf(hFile,"\t\t<uiIndex>%d</uiIndex>\r\n", cnt );
|
FilePrintf(hFile,"\t\t<uiIndex>%d</uiIndex>\r\n", cnt );
|
||||||
FilePrintf(hFile,"\t\t<fontColour>%d</fontColour>\r\n", AmmoTypes[cnt].fontColour );
|
FilePrintf(hFile,"\t\t<red>%d</red>\r\n", AmmoTypes[cnt].red );
|
||||||
FilePrintf(hFile,"\t\t<grayed>%d</grayed>\r\n", AmmoTypes[cnt].grayed );
|
FilePrintf(hFile,"\t\t<green>%d</green>\r\n", AmmoTypes[cnt].green );
|
||||||
FilePrintf(hFile,"\t\t<offNormal>%d</offNormal>\r\n", AmmoTypes[cnt].offNormal );
|
FilePrintf(hFile,"\t\t<blue>%d</blue>\r\n", AmmoTypes[cnt].blue );
|
||||||
FilePrintf(hFile,"\t\t<onNormal>%d</onNormal>\r\n", AmmoTypes[cnt].onNormal );
|
|
||||||
FilePrintf(hFile,"\t\t<structureImpactReductionMultiplier>%d</structureImpactReductionMultiplier>\r\n", AmmoTypes[cnt].structureImpactReductionMultiplier );
|
FilePrintf(hFile,"\t\t<structureImpactReductionMultiplier>%d</structureImpactReductionMultiplier>\r\n", AmmoTypes[cnt].structureImpactReductionMultiplier );
|
||||||
FilePrintf(hFile,"\t\t<structureImpactReductionDivisor>%d</structureImpactReductionDivisor>\r\n", AmmoTypes[cnt].structureImpactReductionDivisor );
|
FilePrintf(hFile,"\t\t<structureImpactReductionDivisor>%d</structureImpactReductionDivisor>\r\n", AmmoTypes[cnt].structureImpactReductionDivisor );
|
||||||
FilePrintf(hFile,"\t\t<armourImpactReductionMultiplier>%d</armourImpactReductionMultiplier>\r\n", AmmoTypes[cnt].armourImpactReductionMultiplier );
|
FilePrintf(hFile,"\t\t<armourImpactReductionMultiplier>%d</armourImpactReductionMultiplier>\r\n", AmmoTypes[cnt].armourImpactReductionMultiplier );
|
||||||
|
|||||||
Reference in New Issue
Block a user