Fix: Civ Group popups in map editor weren't working correctly and debugger showed incorrect data for popups

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8683 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
silversurfer
2019-07-27 12:38:39 +00:00
parent a6d7c95abb
commit 548d85319e
4 changed files with 120 additions and 121 deletions
+117 -117
View File
@@ -39,7 +39,7 @@
#include "Item Statistics.h" #include "Item Statistics.h"
#endif #endif
CurrentPopupMenuInformation gPopup; CurrentPopupMenuInformation gPopupData;
MOUSE_REGION popupRegion; MOUSE_REGION popupRegion;
@@ -52,7 +52,7 @@ extern CHAR16 gszScheduleActions[ NUM_SCHEDULE_ACTIONS ][20];
//in different ways in each instance. //in different ways in each instance.
STR16 GetPopupMenuString( UINT8 ubIndex ) STR16 GetPopupMenuString( UINT8 ubIndex )
{ {
switch( gPopup.ubPopupMenuID ) switch( gPopupData.ubPopupMenuID )
{ {
case CHANGETSET_POPUP: //tile sets case CHANGETSET_POPUP: //tile sets
return gTilesets[ ubIndex ].zName; return gTilesets[ ubIndex ].zName;
@@ -101,8 +101,8 @@ void InitPopupMenu( INT32 iButtonID, UINT8 ubPopupMenuID, UINT8 ubDirection )
//calculate the location of the menu based on the button position. //calculate the location of the menu based on the button position.
//This also calculates the menu's direction based on position. //This also calculates the menu's direction based on position.
gPopup.usFont = (UINT16)SMALLFONT1; gPopupData.usFont = (UINT16)SMALLFONT1;
gusEntryHeight = GetFontHeight( gPopup.usFont ); gusEntryHeight = GetFontHeight( gPopupData.usFont );
button = ButtonList[ iButtonID ]; button = ButtonList[ iButtonID ];
MSYS_DisableRegion( &gBottomPanalRegion ); MSYS_DisableRegion( &gBottomPanalRegion );
@@ -134,52 +134,52 @@ void InitPopupMenu( INT32 iButtonID, UINT8 ubPopupMenuID, UINT8 ubDirection )
switch( ubPopupMenuID ) switch( ubPopupMenuID )
{ {
case CHANGETSET_POPUP: //change tileset case CHANGETSET_POPUP: //change tileset
gPopup.ubNumEntries = gubNumSets; gPopupData.ubNumEntries = gubNumSets;
break; break;
case OWNERSHIPGROUP_POPUP: case OWNERSHIPGROUP_POPUP:
case CHANGECIVGROUP_POPUP: case CHANGECIVGROUP_POPUP:
gPopup.ubNumEntries = NUM_CIV_GROUPS; gPopupData.ubNumEntries = NUM_CIV_GROUPS;
break; break;
case SCHEDULEACTION_POPUP: case SCHEDULEACTION_POPUP:
gPopup.ubNumEntries = NUM_SCHEDULE_ACTIONS; gPopupData.ubNumEntries = NUM_SCHEDULE_ACTIONS;
break; break;
case ACTIONITEM_POPUP: case ACTIONITEM_POPUP:
gPopup.ubNumEntries = NUM_ACTIONITEMS; gPopupData.ubNumEntries = NUM_ACTIONITEMS;
break; break;
default: default:
return; return;
} }
gPopup.usFont = (UINT16)SMALLFONT1; gPopupData.usFont = (UINT16)SMALLFONT1;
gusEntryHeight = GetFontHeight( gPopup.usFont ); gusEntryHeight = GetFontHeight( gPopupData.usFont );
button = ButtonList[ iButtonID ]; button = ButtonList[ iButtonID ];
MSYS_DisableRegion( &gBottomPanalRegion ); MSYS_DisableRegion( &gBottomPanalRegion );
gPopup.ubPopupMenuID = ubPopupMenuID; gPopupData.ubPopupMenuID = ubPopupMenuID;
gPopup.ubSelectedIndex = 0; gPopupData.ubSelectedIndex = 0;
gPopup.ubActiveType = POPUP_ACTIVETYPE_NOT_YET_DETERMINED; gPopupData.ubActiveType = POPUP_ACTIVETYPE_NOT_YET_DETERMINED;
gPopup.fActive = TRUE; gPopupData.fActive = TRUE;
fWaitingForLButtonRelease = FALSE; fWaitingForLButtonRelease = FALSE;
gPopup.fUseKeyboardInfoUntilMouseMoves = FALSE; gPopupData.fUseKeyboardInfoUntilMouseMoves = FALSE;
//Initialize the last mouse position to be out of bounds. //Initialize the last mouse position to be out of bounds.
gPopup.usLastMouseX = 1000; gPopupData.usLastMouseX = 1000;
gPopup.usLastMouseY = 1000; gPopupData.usLastMouseY = 1000;
//clear the column widths. //clear the column widths.
for( ubColumn = 0; ubColumn < MAX_COLUMNS; ubColumn++ ) for( ubColumn = 0; ubColumn < MAX_COLUMNS; ubColumn++ )
gPopup.ubColumnWidth[ ubColumn ] = 0; gPopupData.ubColumnWidth[ ubColumn ] = 0;
//1) Calc total entry height of the popup region. //1) Calc total entry height of the popup region.
gPopup.ubColumns = 1; gPopupData.ubColumns = 1;
gPopup.ubMaxEntriesPerColumn = gPopup.ubNumEntries; gPopupData.ubMaxEntriesPerColumn = gPopupData.ubNumEntries;
usMenuHeight = gPopup.ubNumEntries * gusEntryHeight + 3; usMenuHeight = gPopupData.ubNumEntries * gusEntryHeight + 3;
while( usMenuHeight >= usY && ( ubDirection == DIR_UPLEFT || ubDirection == DIR_UPRIGHT ) || while( usMenuHeight >= usY && ( ubDirection == DIR_UPLEFT || ubDirection == DIR_UPRIGHT ) ||
480-usMenuHeight >= usY && ( ubDirection == DIR_DOWNLEFT || ubDirection == DIR_DOWNRIGHT ) ) 480-usMenuHeight >= usY && ( ubDirection == DIR_DOWNLEFT || ubDirection == DIR_DOWNRIGHT ) )
{ //menu has too many entries. Increase the number of columns until the height is { //menu has too many entries. Increase the number of columns until the height is
//less than the max height. //less than the max height.
gPopup.ubMaxEntriesPerColumn = (gPopup.ubNumEntries+gPopup.ubColumns)/(gPopup.ubColumns+1); gPopupData.ubMaxEntriesPerColumn = (gPopupData.ubNumEntries+gPopupData.ubColumns)/(gPopupData.ubColumns+1);
usMenuHeight = gPopup.ubMaxEntriesPerColumn * gusEntryHeight + 3; usMenuHeight = gPopupData.ubMaxEntriesPerColumn * gusEntryHeight + 3;
gPopup.ubColumns++; gPopupData.ubColumns++;
} }
//now we have the number of columns as well as the max number of entries per column, and //now we have the number of columns as well as the max number of entries per column, and
//the total menu height. //the total menu height.
@@ -187,48 +187,48 @@ void InitPopupMenu( INT32 iButtonID, UINT8 ubPopupMenuID, UINT8 ubDirection )
//We now calculate the total width of the menu as well as the max width of each column. //We now calculate the total width of the menu as well as the max width of each column.
ubCounter = 0; ubCounter = 0;
usMenuWidth = 0; usMenuWidth = 0;
for( ubColumn = 0; ubColumn < gPopup.ubColumns; ubColumn++ ) for( ubColumn = 0; ubColumn < gPopupData.ubColumns; ubColumn++ )
{ {
for( ubEntry = 0; ubEntry < gPopup.ubMaxEntriesPerColumn; ubEntry++ ) for( ubEntry = 0; ubEntry < gPopupData.ubMaxEntriesPerColumn; ubEntry++ )
{ {
if( ubCounter >= gPopup.ubNumEntries ) if( ubCounter >= gPopupData.ubNumEntries )
break; //done (don't want to process undefined entries...) break; //done (don't want to process undefined entries...)
usCurrStrWidth = 16 + StringPixLength( GetPopupMenuString( ubCounter ) , gPopup.usFont ); usCurrStrWidth = 16 + StringPixLength( GetPopupMenuString( ubCounter ) , gPopupData.usFont );
if( usCurrStrWidth > gPopup.ubColumnWidth[ ubColumn ] ) if( usCurrStrWidth > gPopupData.ubColumnWidth[ ubColumn ] )
{ {
gPopup.ubColumnWidth[ ubColumn ] = (UINT8)usCurrStrWidth; gPopupData.ubColumnWidth[ ubColumn ] = (UINT8)usCurrStrWidth;
} }
ubCounter++; ubCounter++;
} }
usMenuWidth += gPopup.ubColumnWidth[ ubColumn ]; usMenuWidth += gPopupData.ubColumnWidth[ ubColumn ];
} }
//Calculate popup menu boundaries based on direction from argument point. //Calculate popup menu boundaries based on direction from argument point.
switch( ubDirection ) switch( ubDirection )
{ {
case DIR_UPRIGHT: case DIR_UPRIGHT:
gPopup.usLeft = usX; gPopupData.usLeft = usX;
gPopup.usTop = usY - usMenuHeight - 1; gPopupData.usTop = usY - usMenuHeight - 1;
gPopup.usRight = usX + usMenuWidth; gPopupData.usRight = usX + usMenuWidth;
gPopup.usBottom = usY - 1; gPopupData.usBottom = usY - 1;
break; break;
case DIR_UPLEFT: case DIR_UPLEFT:
gPopup.usLeft = usX - usMenuWidth; gPopupData.usLeft = usX - usMenuWidth;
gPopup.usTop = usY - usMenuHeight - 1; gPopupData.usTop = usY - usMenuHeight - 1;
gPopup.usRight = usX; gPopupData.usRight = usX;
gPopup.usBottom = usY - 1; gPopupData.usBottom = usY - 1;
break; break;
case DIR_DOWNRIGHT: case DIR_DOWNRIGHT:
gPopup.usLeft = usX; gPopupData.usLeft = usX;
gPopup.usTop = usY + 1; gPopupData.usTop = usY + 1;
gPopup.usRight = usX + usMenuWidth; gPopupData.usRight = usX + usMenuWidth;
gPopup.usBottom = usY + usMenuHeight + 1; gPopupData.usBottom = usY + usMenuHeight + 1;
break; break;
case DIR_DOWNLEFT: case DIR_DOWNLEFT:
gPopup.usLeft = usX - usMenuWidth; gPopupData.usLeft = usX - usMenuWidth;
gPopup.usTop = usY + 1; gPopupData.usTop = usY + 1;
gPopup.usRight = usX; gPopupData.usRight = usX;
gPopup.usBottom = usY + usMenuHeight + 1; gPopupData.usBottom = usY + usMenuHeight + 1;
break; break;
} }
MSYS_DefineRegion(&popupRegion, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGHEST, CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK);//dnl ch34 090909 MSYS_DefineRegion(&popupRegion, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGHEST, CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK);//dnl ch34 090909
@@ -247,45 +247,45 @@ void RenderPopupMenu()
//Draw the menu //Draw the menu
ColorFillVideoSurfaceArea(FRAME_BUFFER, ColorFillVideoSurfaceArea(FRAME_BUFFER,
gPopup.usLeft, gPopup.usTop, gPopup.usRight, gPopup.usBottom, gPopupData.usLeft, gPopupData.usTop, gPopupData.usRight, gPopupData.usBottom,
Get16BPPColor(FROMRGB(128, 128, 128) ) ); Get16BPPColor(FROMRGB(128, 128, 128) ) );
pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );
SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, 640, 480 ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, 640, 480 );
usLineColor = Get16BPPColor( FROMRGB( 64, 64, 64 ) ); usLineColor = Get16BPPColor( FROMRGB( 64, 64, 64 ) );
RectangleDraw( TRUE, gPopup.usLeft, gPopup.usTop, gPopup.usRight, gPopup.usBottom, RectangleDraw( TRUE, gPopupData.usLeft, gPopupData.usTop, gPopupData.usRight, gPopupData.usBottom,
usLineColor, pDestBuf ); usLineColor, pDestBuf );
if( gPopup.ubColumns > 1 ) if( gPopupData.ubColumns > 1 )
{ //draw a vertical line between each column { //draw a vertical line between each column
usStart = gPopup.usLeft + gPopup.ubColumnWidth[ 0 ]; usStart = gPopupData.usLeft + gPopupData.ubColumnWidth[ 0 ];
for( ubColumn = 1; ubColumn < gPopup.ubColumns; ubColumn++ ) for( ubColumn = 1; ubColumn < gPopupData.ubColumns; ubColumn++ )
{ {
LineDraw( TRUE, usStart, gPopup.usTop, usStart, gPopup.usBottom, usLineColor, pDestBuf ); LineDraw( TRUE, usStart, gPopupData.usTop, usStart, gPopupData.usBottom, usLineColor, pDestBuf );
} }
usStart += (UINT16)gPopup.ubColumnWidth[ ubColumn ]; usStart += (UINT16)gPopupData.ubColumnWidth[ ubColumn ];
} }
UnLockVideoSurface( FRAME_BUFFER ); UnLockVideoSurface( FRAME_BUFFER );
//Set up the text attributes. //Set up the text attributes.
SetFont( gPopup.usFont); SetFont( gPopupData.usFont);
SetFontBackground( FONT_MCOLOR_BLACK ); SetFontBackground( FONT_MCOLOR_BLACK );
SetFontForeground( FONT_MCOLOR_WHITE ); SetFontForeground( FONT_MCOLOR_WHITE );
usX = gPopup.usLeft + 1; usX = gPopupData.usLeft + 1;
ubCounter = 0; ubCounter = 0;
usStart = gPopup.usLeft; usStart = gPopupData.usLeft;
for( ubColumn = 0; ubColumn < gPopup.ubColumns; ubColumn++ ) for( ubColumn = 0; ubColumn < gPopupData.ubColumns; ubColumn++ )
{ {
for( ubEntry = 0; ubEntry < gPopup.ubMaxEntriesPerColumn; ubEntry++ ) for( ubEntry = 0; ubEntry < gPopupData.ubMaxEntriesPerColumn; ubEntry++ )
{ {
if( ubCounter >= gPopup.ubNumEntries ) if( ubCounter >= gPopupData.ubNumEntries )
return; //done return; //done
//Calc current string's width in pixels. Adding 14 pixels which is the width of //Calc current string's width in pixels. Adding 14 pixels which is the width of
//two padded gPopup.usFont spaces not stored in the string. //two padded gPopupData.usFont spaces not stored in the string.
usStringWidth = 14 + StringPixLength( GetPopupMenuString( ubCounter ), gPopup.usFont ); usStringWidth = 14 + StringPixLength( GetPopupMenuString( ubCounter ), gPopupData.usFont );
//Horizontally center the string inside the popup menu //Horizontally center the string inside the popup menu
usX = usStart + ( gPopup.ubColumnWidth[ ubColumn ] - usStringWidth ) / 2; usX = usStart + ( gPopupData.ubColumnWidth[ ubColumn ] - usStringWidth ) / 2;
usY = gPopup.usTop + 1 + ubEntry * gusEntryHeight; usY = gPopupData.usTop + 1 + ubEntry * gusEntryHeight;
if( ubCounter == gPopup.ubSelectedIndex - 1 ) if( ubCounter == gPopupData.ubSelectedIndex - 1 )
{ {
//This is the highlighted menu entry. //This is the highlighted menu entry.
SetFontForeground( FONT_MCOLOR_LTBLUE ); SetFontForeground( FONT_MCOLOR_LTBLUE );
@@ -298,7 +298,7 @@ void RenderPopupMenu()
} }
ubCounter++; ubCounter++;
} }
usStart += gPopup.ubColumnWidth[ ubColumn ]; usStart += gPopupData.ubColumnWidth[ ubColumn ];
} }
} }
@@ -310,26 +310,26 @@ UINT8 GetPopupIndexFromMousePosition()
UINT8 ubNumEntriesDown; UINT8 ubNumEntriesDown;
UINT16 usRelX; UINT16 usRelX;
UINT8 ubCount; UINT8 ubCount;
if( gusMouseXPos >= gPopup.usLeft if( gusMouseXPos >= gPopupData.usLeft
&& gusMouseXPos <= gPopup.usRight && gusMouseXPos <= gPopupData.usRight
&& gusMouseYPos > gPopup.usTop //one pixel gap on top ignored && gusMouseYPos > gPopupData.usTop //one pixel gap on top ignored
&& gusMouseYPos < gPopup.usBottom - 2 ) //two pixel gap on bottom ignored && gusMouseYPos < gPopupData.usBottom - 2 ) //two pixel gap on bottom ignored
{ {
//subtract the top y coord of the popup region from the mouse's yPos as well //subtract the top y coord of the popup region from the mouse's yPos as well
//as an extra pixel at the top of the region which is ignored in menu selection, //as an extra pixel at the top of the region which is ignored in menu selection,
//divide this number by the height of a menu entry, then add one. This will //divide this number by the height of a menu entry, then add one. This will
//return the menu index from 1 (at the top) to n (at the bottom). //return the menu index from 1 (at the top) to n (at the bottom).
ubNumEntriesDown = (gusMouseYPos - gPopup.usTop - 1) / gusEntryHeight + 1; ubNumEntriesDown = (gusMouseYPos - gPopupData.usTop - 1) / gusEntryHeight + 1;
usRelX = gusMouseXPos - gPopup.usLeft; usRelX = gusMouseXPos - gPopupData.usLeft;
ubCount=0; ubCount=0;
while( usRelX > gPopup.ubColumnWidth[ ubCount ] ) while( usRelX > gPopupData.ubColumnWidth[ ubCount ] )
{ {
usRelX -= gPopup.ubColumnWidth[ ubCount ]; usRelX -= gPopupData.ubColumnWidth[ ubCount ];
ubCount++; ubCount++;
ubNumEntriesDown += gPopup.ubMaxEntriesPerColumn; ubNumEntriesDown += gPopupData.ubMaxEntriesPerColumn;
} }
if( ubNumEntriesDown >= gPopup.ubNumEntries ) if( ubNumEntriesDown >= gPopupData.ubNumEntries )
ubNumEntriesDown = gPopup.ubNumEntries; ubNumEntriesDown = gPopupData.ubNumEntries;
return ubNumEntriesDown; return ubNumEntriesDown;
} }
return 0; //mouse not in valid region. return 0; //mouse not in valid region.
@@ -339,15 +339,15 @@ void PopupMenuHandle()
{ {
InputAtom InputEvent; InputAtom InputEvent;
if( gPopup.ubActiveType == POPUP_ACTIVETYPE_NOT_YET_DETERMINED ) if( gPopupData.ubActiveType == POPUP_ACTIVETYPE_NOT_YET_DETERMINED )
{ {
//Attempt to determine if the menu will be persistant or not. //Attempt to determine if the menu will be persistant or not.
//Determination is made when the mouse's left button is released or if //Determination is made when the mouse's left button is released or if
//the mouse cursor enters the menu region. //the mouse cursor enters the menu region.
if( gusMouseXPos >= gPopup.usLeft if( gusMouseXPos >= gPopupData.usLeft
&& gusMouseXPos <= gPopup.usRight && gusMouseXPos <= gPopupData.usRight
&& gusMouseYPos > gPopup.usTop //one pixel gap on top ignored && gusMouseYPos > gPopupData.usTop //one pixel gap on top ignored
&& gusMouseYPos < gPopup.usBottom - 1 ) //two pixel gap on bottom ignored && gusMouseYPos < gPopupData.usBottom - 1 ) //two pixel gap on bottom ignored
{ {
//mouse cursor has just entered the menu region -- nonpersistant. //mouse cursor has just entered the menu region -- nonpersistant.
@@ -355,42 +355,42 @@ void PopupMenuHandle()
//Disabled this because Linda doesn't like it... (I like it though, and it works) //Disabled this because Linda doesn't like it... (I like it though, and it works)
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//UNCOMMENT IF NONPERSISTANT IS ALLOWED //UNCOMMENT IF NONPERSISTANT IS ALLOWED
//gPopup.ubActiveType = POPUP_ACTIVETYPE_NONPERSISTANT; //gPopupData.ubActiveType = POPUP_ACTIVETYPE_NONPERSISTANT;
return; return;
} }
else if( !gfLeftButtonState ) else if( !gfLeftButtonState )
{ //left button has been released before entering region -- persistant { //left button has been released before entering region -- persistant
gPopup.ubActiveType = POPUP_ACTIVETYPE_PERSISTANT; gPopupData.ubActiveType = POPUP_ACTIVETYPE_PERSISTANT;
return; return;
} }
} }
if( !gPopup.fUseKeyboardInfoUntilMouseMoves ) if( !gPopupData.fUseKeyboardInfoUntilMouseMoves )
{ {
//check menu entry based on mouse position //check menu entry based on mouse position
gPopup.ubSelectedIndex = GetPopupIndexFromMousePosition(); gPopupData.ubSelectedIndex = GetPopupIndexFromMousePosition();
} }
else if( gusMouseXPos != gPopup.usLastMouseX || gusMouseYPos != gPopup.usLastMouseY ) else if( gusMouseXPos != gPopupData.usLastMouseX || gusMouseYPos != gPopupData.usLastMouseY )
{ {
//The keyboard determined the last entry, but the mouse has moved, //The keyboard determined the last entry, but the mouse has moved,
//so use the mouse to determine the new entry. //so use the mouse to determine the new entry.
gPopup.fUseKeyboardInfoUntilMouseMoves = FALSE; gPopupData.fUseKeyboardInfoUntilMouseMoves = FALSE;
gPopup.ubSelectedIndex = GetPopupIndexFromMousePosition(); gPopupData.ubSelectedIndex = GetPopupIndexFromMousePosition();
} }
//Check terminating conditions for persistant states. //Check terminating conditions for persistant states.
if( gfLeftButtonState && gPopup.ubActiveType == POPUP_ACTIVETYPE_PERSISTANT ) if( gfLeftButtonState && gPopupData.ubActiveType == POPUP_ACTIVETYPE_PERSISTANT )
fWaitingForLButtonRelease = TRUE; fWaitingForLButtonRelease = TRUE;
if( gfLeftButtonState && gPopup.ubActiveType == POPUP_ACTIVETYPE_PERSISTANT if( gfLeftButtonState && gPopupData.ubActiveType == POPUP_ACTIVETYPE_PERSISTANT
|| !gfLeftButtonState && gPopup.ubActiveType == POPUP_ACTIVETYPE_NONPERSISTANT ) || !gfLeftButtonState && gPopupData.ubActiveType == POPUP_ACTIVETYPE_NONPERSISTANT )
{ {
//Selection conditions via mouse have been met whether the mouse is in the //Selection conditions via mouse have been met whether the mouse is in the
//menu region or not. //menu region or not.
gPopup.ubSelectedIndex = GetPopupIndexFromMousePosition(); gPopupData.ubSelectedIndex = GetPopupIndexFromMousePosition();
if( gPopup.ubSelectedIndex ) if( gPopupData.ubSelectedIndex )
{ {
ProcessPopupMenuSelection(); ProcessPopupMenuSelection();
} }
gPopup.fActive = FALSE; gPopupData.fActive = FALSE;
MSYS_RemoveRegion( &popupRegion ); MSYS_RemoveRegion( &popupRegion );
gfRenderWorld = TRUE; gfRenderWorld = TRUE;
gfRenderTaskbar = TRUE; gfRenderTaskbar = TRUE;
@@ -406,37 +406,37 @@ void PopupMenuHandle()
switch( InputEvent.usParam ) switch( InputEvent.usParam )
{ {
case DNARROW: case DNARROW:
gPopup.fUseKeyboardInfoUntilMouseMoves = TRUE; gPopupData.fUseKeyboardInfoUntilMouseMoves = TRUE;
gPopup.usLastMouseX = gusMouseXPos; gPopupData.usLastMouseX = gusMouseXPos;
gPopup.usLastMouseY = gusMouseYPos; gPopupData.usLastMouseY = gusMouseYPos;
gPopup.ubSelectedIndex++; gPopupData.ubSelectedIndex++;
if( gPopup.ubSelectedIndex > gPopup.ubNumEntries ) if( gPopupData.ubSelectedIndex > gPopupData.ubNumEntries )
{ {
gPopup.ubSelectedIndex = 1; gPopupData.ubSelectedIndex = 1;
} }
break; break;
case UPARROW: case UPARROW:
gPopup.fUseKeyboardInfoUntilMouseMoves = TRUE; gPopupData.fUseKeyboardInfoUntilMouseMoves = TRUE;
gPopup.usLastMouseX = gusMouseXPos; gPopupData.usLastMouseX = gusMouseXPos;
gPopup.usLastMouseY = gusMouseYPos; gPopupData.usLastMouseY = gusMouseYPos;
if( gPopup.ubSelectedIndex < 2 ) if( gPopupData.ubSelectedIndex < 2 )
{ {
gPopup.ubSelectedIndex = gPopup.ubNumEntries; gPopupData.ubSelectedIndex = gPopupData.ubNumEntries;
} }
else else
{ {
gPopup.ubSelectedIndex--; gPopupData.ubSelectedIndex--;
} }
break; break;
case ESC: case ESC:
gPopup.fActive = FALSE; gPopupData.fActive = FALSE;
MSYS_RemoveRegion( &popupRegion ); MSYS_RemoveRegion( &popupRegion );
gfRenderWorld = TRUE; gfRenderWorld = TRUE;
gfRenderTaskbar = TRUE; gfRenderTaskbar = TRUE;
break; break;
case ENTER: case ENTER:
ProcessPopupMenuSelection(); ProcessPopupMenuSelection();
gPopup.fActive = FALSE; gPopupData.fActive = FALSE;
MSYS_RemoveRegion( &popupRegion ); MSYS_RemoveRegion( &popupRegion );
gfRenderWorld = TRUE; gfRenderWorld = TRUE;
gfRenderTaskbar = TRUE; gfRenderTaskbar = TRUE;
@@ -449,31 +449,31 @@ void PopupMenuHandle()
void ProcessPopupMenuSelection() void ProcessPopupMenuSelection()
{ {
switch( gPopup.ubPopupMenuID ) switch( gPopupData.ubPopupMenuID )
{ {
case CHANGETSET_POPUP: case CHANGETSET_POPUP:
//change the tileset here. //change the tileset here.
ReloadTileset( (UINT8)(gPopup.ubSelectedIndex - 1 ) ); ReloadTileset( (UINT8)(gPopupData.ubSelectedIndex - 1 ) );
InitJA2SelectionWindow( ); InitJA2SelectionWindow( );
break; break;
case CHANGECIVGROUP_POPUP: case CHANGECIVGROUP_POPUP:
ChangeCivGroup( (UINT8)(gPopup.ubSelectedIndex - 1) ); ChangeCivGroup( (UINT8)(gPopupData.ubSelectedIndex - 1) );
break; break;
case SCHEDULEACTION_POPUP: case SCHEDULEACTION_POPUP:
UpdateScheduleAction( (UINT8)(gPopup.ubSelectedIndex - 1) ); UpdateScheduleAction( (UINT8)(gPopupData.ubSelectedIndex - 1) );
break; break;
case ACTIONITEM_POPUP: case ACTIONITEM_POPUP:
UpdateActionItem( (UINT8)(gPopup.ubSelectedIndex - 1) ); UpdateActionItem( (UINT8)(gPopupData.ubSelectedIndex - 1) );
break; break;
case OWNERSHIPGROUP_POPUP: case OWNERSHIPGROUP_POPUP:
SetOwnershipGroup( (UINT8)(gPopup.ubSelectedIndex - 1) ); SetOwnershipGroup( (UINT8)(gPopupData.ubSelectedIndex - 1) );
break; break;
} }
} }
BOOLEAN ProcessPopupMenuIfActive( ) BOOLEAN ProcessPopupMenuIfActive( )
{ {
if( !gPopup.fActive && !fWaitingForLButtonRelease ) if( !gPopupData.fActive && !fWaitingForLButtonRelease )
return FALSE; return FALSE;
if( fWaitingForLButtonRelease ) if( fWaitingForLButtonRelease )
{ {
@@ -486,7 +486,7 @@ BOOLEAN ProcessPopupMenuIfActive( )
} }
PopupMenuHandle(); PopupMenuHandle();
RenderPopupMenu(); RenderPopupMenu();
InvalidateRegion( gPopup.usLeft, gPopup.usTop, gPopup.usRight, gPopup.usBottom ); InvalidateRegion( gPopupData.usLeft, gPopupData.usTop, gPopupData.usRight, gPopupData.usBottom );
ExecuteBaseDirtyRectQueue(); ExecuteBaseDirtyRectQueue();
EndFrameBufferRender( ); EndFrameBufferRender( );
return TRUE; return TRUE;
+1 -1
View File
@@ -84,7 +84,7 @@ typedef struct currentPopupMenuInformation{
}CurrentPopupMenuInformation; }CurrentPopupMenuInformation;
//A global var that keeps the popup menu information. //A global var that keeps the popup menu information.
extern CurrentPopupMenuInformation gPopup; extern CurrentPopupMenuInformation gPopupData;
extern STR16 popupMenuStrings[5]; extern STR16 popupMenuStrings[5];
//These are the two main functions that outside users would call. //These are the two main functions that outside users would call.
+2 -2
View File
@@ -55,8 +55,8 @@
#endif #endif
CHAR8 czVersionNumber[16] = { "Build 19.07.05" }; //YY.MM.DD CHAR8 czVersionNumber[16] = { "Build 19.07.27" }; //YY.MM.DD
CHAR16 zTrackingNumber[16] = { L"Z" }; CHAR16 zTrackingNumber[16] = { L"Z" };
CHAR16 zRevisionNumber[16] = { L"Revision 8682" }; CHAR16 zRevisionNumber[16] = { L"Revision 8683" };
// SAVE_GAME_VERSION is defined in header, change it there // SAVE_GAME_VERSION is defined in header, change it there
-1
View File
@@ -374,7 +374,6 @@ enum
ADMINISTRATIVE_STAFF_GROUP, ADMINISTRATIVE_STAFF_GROUP,
LOYAL_CIV_GROUP, // civil population deeply loyal to the queen LOYAL_CIV_GROUP, // civil population deeply loyal to the queen
BLACKMARKET_GROUP, // black market dealer and bodyguards BLACKMARKET_GROUP, // black market dealer and bodyguards
UNNAMED_CIV_GROUP_34,
UNNAMED_CIV_GROUP_35, UNNAMED_CIV_GROUP_35,
UNNAMED_CIV_GROUP_36, UNNAMED_CIV_GROUP_36,
UNNAMED_CIV_GROUP_37, UNNAMED_CIV_GROUP_37,