Update of /cvsroot/sc2/sc2/src/sc2code
In directory sc8-pr-cvs1:/tmp/cvs-serv9918/src/sc2code
Modified Files:
comm.c hyper.c sis.c sis.h
Log Message:
Added 'b' option to use PC Menus (text). See TODO for limitations
Index: comm.c
===================================================================
RCS file: /cvsroot/sc2/sc2/src/sc2code/comm.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** comm.c 23 Dec 2002 02:27:06 -0000 1.17
--- comm.c 6 Jan 2003 02:53:43 -0000 1.18
***************
*** 1555,1559 ****
RepairSISBorder ();
ClearSemaphore (GraphicsSem);
! DrawMenuStateStrings ((BYTE)~0, (BYTE)~0);
SetSemaphore (GraphicsSem);
}
--- 1555,1559 ----
RepairSISBorder ();
ClearSemaphore (GraphicsSem);
! DrawMenuStateStrings ((BYTE)~0, 1);
SetSemaphore (GraphicsSem);
}
Index: hyper.c
===================================================================
RCS file: /cvsroot/sc2/sc2/src/sc2code/hyper.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** hyper.c 22 Dec 2002 02:37:36 -0000 1.7
--- hyper.c 6 Jan 2003 02:53:43 -0000 1.8
***************
*** 1561,1565 ****
MenuState.CurState = STARMAP + 1;
! DrawMenuStateStrings (PM_SCAN, STARMAP);
SetSemaphore (GraphicsSem);
SetFlashRect ((PRECT)~0L, (FRAME)0);
--- 1561,1565 ----
MenuState.CurState = STARMAP + 1;
! DrawMenuStateStrings (PM_STARMAP, STARMAP);
SetSemaphore (GraphicsSem);
SetFlashRect ((PRECT)~0L, (FRAME)0);
Index: sis.c
===================================================================
RCS file: /cvsroot/sc2/sc2/src/sc2code/sis.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** sis.c 24 Dec 2002 01:41:40 -0000 1.13
--- sis.c 6 Jan 2003 02:53:43 -0000 1.14
***************
*** 21,24 ****
--- 21,25 ----
#include "libs/graphics/gfx_common.h"
#include "libs/tasklib.h"
+ #include "options.h"
void
***************
*** 74,78 ****
{
ClearSemaphore (GraphicsSem);
! DrawMenuStateStrings ((BYTE)~0, (BYTE)~0);
SetSemaphore (GraphicsSem);
#ifdef NEVER
--- 75,79 ----
{
ClearSemaphore (GraphicsSem);
! DrawMenuStateStrings ((BYTE)~0, 1);
SetSemaphore (GraphicsSem);
#ifdef NEVER
***************
*** 1033,1036 ****
--- 1034,1040 ----
else
{
+ //Don't flash when using the PC menu
+ if (optPCmenu)
+ return;
OldContext = SetContext (StatusContext);
GetContextClipRect (&clip_r);
***************
*** 1090,1095 ****
}
void
! DrawMenuStateStrings (BYTE beg_index, BYTE NewState)
{
BYTE end_index;
--- 1094,1197 ----
}
+ static void
+ DrawPCMenuFrame (RECT *r)
+ {
+ SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x0F, 0x0F, 0x0F), 0x08));
+ DrawRectangle (r);
+ r->corner.x++;
+ r->corner.y++;
+ r->extent.height--;
+ r->extent.width--;
+ SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x06, 0x06, 0x06), 0x08));
+ DrawRectangle (r);
+ r->extent.height--;
+ r->extent.width--;
+ SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x15), 0x08));
+ DrawFilledRectangle (r);
+ }
+
+ static char menu_string[][11] = {
+ "SCAN",
+ "STARMAP",
+ "DEVICES",
+ "CARGO",
+ "ROSTER",
+ "GAME",
+ "NAVIGATE",
+
+ "MINERAL",
+ "ENERGY",
+ "BIOLOGICAL",
+ "EXIT MENU",
+ "AUTO SCAN",
+ "DISPATCH",
+
+ "SAVE GAME",
+ "LOAD GAME",
+ "SETTINGS",
+ "EXIT MENU",
+
+ "CONVERSE",
+ "ATTACK!",
+ "GAME",
+
+ "FUEL",
+ "MODULE",
+ "GAME",
+ "EXIT MENU",
+
+ "CREW",
+ "GAME",
+ "EXIT MENU",
+ };
+
+ static void
+ DrawPCMenu (BYTE beg_index, BYTE end_index, BYTE NewState, BYTE hilite, RECT *r)
+ {
+ #define PC_MENU_HEIGHT 8
+ BYTE pos;
+ COUNT i;
+ int num_items, offset;
+ FONT OldFont;
+ TEXT t;
+ UNICODE buf[40];
+ pos = beg_index + NewState;
+ num_items = 1 + end_index - beg_index;
+ DrawFilledRectangle (r);
+ r->corner.x += 1;
+ r->extent.width -= 1;
+ if (num_items * PC_MENU_HEIGHT > r->extent.height)
+ fprintf (stderr, "Warning, no room for all menu items!\n");
+ else
+ r->corner.y += (r->extent.height - num_items * PC_MENU_HEIGHT) / 2;
+ r->extent.height = num_items * PC_MENU_HEIGHT + 4;
+ DrawPCMenuFrame (r);
+ OldFont = SetContextFont (TinyFont);
+ t.align = ALIGN_LEFT;
+ t.baseline.x = r->corner.x + 3;
+ t.baseline.y = r->corner.y + PC_MENU_HEIGHT -1;
+ t.pStr = buf;
+ t.CharCount = (COUNT)~0;
+ SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x00, 0x15, 0x15), 0x08));
+ for (i = beg_index; i <= end_index; i++)
+ {
+ wsprintf (buf, menu_string[i]);
+ if (hilite && pos == i)
+ {
+ SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x0A, 0x0A, 0x1F), 0x08));
+ r->corner.y = t.baseline.y - PC_MENU_HEIGHT + 1;
+ r->extent.height = PC_MENU_HEIGHT;
+ DrawFilledRectangle (r);
+ SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x0A, 0x1F, 0x1F), 0x08));
+ DrawText (&t);
+ SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x00, 0x15, 0x15), 0x08));
+ }
+ else
+ DrawText (&t);
+ t.baseline.y += PC_MENU_HEIGHT;
+ }
+ }
void
! DrawMenuStateStrings (BYTE beg_index, SWORD NewState)
{
BYTE end_index;
***************
*** 1097,1102 ****
--- 1199,1210 ----
STAMP s;
CONTEXT OldContext;
+ BYTE hilite = 1;
extern FRAME PlayFrame;
+ if (NewState < 0)
+ {
+ NewState = - NewState;
+ hilite = 0;
+ }
switch (beg_index)
{
***************
*** 1104,1107 ****
--- 1212,1219 ----
end_index = PM_NAVIGATE;
break;
+ case PM_STARMAP:
+ NewState--;
+ end_index = PM_NAVIGATE;
+ break;
case PM_MIN_SCAN:
end_index = PM_LAUNCH_LANDER;
***************
*** 1139,1146 ****
r.corner.y = s.origin.y - 11;
r.extent.width = RADAR_WIDTH + 2;
- r.extent.height = 11;
BatchGraphics ();
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0xA, 0xA, 0xA), 0x08));
! DrawFilledRectangle (&r);
if (s.frame)
{
--- 1251,1271 ----
r.corner.y = s.origin.y - 11;
r.extent.width = RADAR_WIDTH + 2;
BatchGraphics ();
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0xA, 0xA, 0xA), 0x08));
! if (s.frame && optPCmenu && beg_index != PM_SOUND_ON)
! {
! if (beg_index == PM_CREW)
! sprintf (menu_string[PM_CREW], "CREW(%d)", GLOBAL (CrewCost));
! if (beg_index == PM_FUEL)
! sprintf (menu_string[PM_FUEL], "FUEL(%d)", GLOBAL (FuelCost));
! r.extent.height = RADAR_HEIGHT + 11;
! DrawPCMenu (beg_index, end_index, (BYTE)NewState, hilite, &r);
! s.frame = 0;
! }
! else
! {
! r.extent.height = 11;
! DrawFilledRectangle (&r);
! }
if (s.frame)
{
Index: sis.h
===================================================================
RCS file: /cvsroot/sc2/sc2/src/sc2code/sis.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** sis.h 3 Sep 2002 00:57:37 -0000 1.1.1.1
--- sis.h 6 Jan 2003 02:53:43 -0000 1.2
***************
*** 244,248 ****
extern DWORD GetFTankCapacity (PPOINT ppt);
extern COUNT CountSISPieces (BYTE piece_type);
! extern void DrawMenuStateStrings (BYTE beg_index, BYTE NewState);
extern void DoMenuOptions (void);
extern void DrawFlagshipName (BOOLEAN InStatusArea);
--- 244,248 ----
extern DWORD GetFTankCapacity (PPOINT ppt);
extern COUNT CountSISPieces (BYTE piece_type);
! extern void DrawMenuStateStrings (BYTE beg_index, SWORD NewState);
extern void DoMenuOptions (void);
extern void DrawFlagshipName (BOOLEAN InStatusArea);
|