Added support for "clear selected ship" in Super-Melee

Delete or Keypad-. are the default keys for this.


git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1025 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
mcmartin
2003-07-06 00:09:06 +00:00
parent dfe0f8a599
commit 81855180d0
3 changed files with 55 additions and 41 deletions
+1
View File
@@ -1,4 +1,5 @@
Changes towards version 0.3:
- Added a Menu-Delete key for the Super-Melee menu (#123) - Michael
- Added support for positional (stereo) sound effects, currently
works only with OpenAL -Mika
- Fixed screen transitions from homeworld conversations (bug #348) -Michael
+2
View File
@@ -23,6 +23,7 @@ Menu-Zoom-In: key PageUp
Menu-Zoom-Out: key PageDown
Menu-Select: key Return
Menu-Cancel: key Space
Menu-Delete: key Delete
# ... and the number pad. Note that zoom controls on the starmap are
# different from the paging controls in Super Melee.
@@ -36,6 +37,7 @@ Menu-Zoom-In: key Keypad-+
Menu-Zoom-Out: key Keypad--
Menu-Select: key Keypad-Enter
Menu-Cancel: key Keypad-0
Menu-Delete: key Keypad-.
# Player 1's flight controls. This is the bottom player in Super
# Melee and the player in the full game. Again, the player has the
+52 -41
View File
@@ -997,10 +997,7 @@ DoTextEntry (PMELEE_STATE pMS)
right = TRUE;
break;
default:
/* This really should use isprint, but for some
* ungodly reason some machines refuse to accept
* anything as printable */
if ((ch >= 32) && (ch < 127) && (len + pStr - pBaseStr < (int)(max_chars)))
if (isprint (ch) && (len + pStr - pBaseStr < (int)(max_chars)))
{
memmove (pStr + 1, pStr, (len + 1) * sizeof (*pStr));
*pStr++ = ch;
@@ -1134,6 +1131,49 @@ RetrySave:
return (save_fp != 0);
}
static void
DeleteCurrentShip (PMELEE_STATE pMS)
{
RECT r;
HSTARSHIP hStarShip;
STARSHIPPTR StarShipPtr;
int CurIndex;
CurIndex = pMS->TeamImage[pMS->side].ShipList[pMS->row][pMS->col];
hStarShip = GetStarShipFromIndex (&master_q, CurIndex);
StarShipPtr = LockStarShip (&master_q, hStarShip);
if (StarShipPtr)
{
pMS->star_bucks[pMS->side] -=
StarShipPtr->RaceDescPtr->ship_info.ship_cost;
UnlockStarShip (&master_q, hStarShip);
pMS->TeamImage[pMS->side].ShipList[pMS->row][pMS->col] = (BYTE)~0;
SetSemaphore (GraphicsSem);
GetShipBox (&r, pMS->side, pMS->row, pMS->col);
RepairMeleeFrame (&r);
DrawTeamString (pMS, 4);
ClearSemaphore (GraphicsSem);
}
}
static void
AdvanceCursor (PMELEE_STATE pMS)
{
if (++pMS->col == NUM_MELEE_COLUMNS)
{
if (++pMS->row < NUM_MELEE_ROWS)
pMS->col = 0;
else
{
pMS->col = NUM_MELEE_COLUMNS - 1;
pMS->row = NUM_MELEE_ROWS - 1;
}
}
}
static BOOLEAN
DoEdit (PMELEE_STATE pMS)
{
@@ -1170,6 +1210,11 @@ DoEdit (PMELEE_STATE pMS)
TFB_ResetControls ();
DoPickShip (pMS);
}
else if (pMS->row < NUM_MELEE_ROWS && CurrentMenuState.del)
{
DeleteCurrentShip (pMS);
AdvanceCursor (pMS);
}
else
{
COUNT side, row, col;
@@ -1284,23 +1329,7 @@ DoPickShip (PMELEE_STATE pMS)
pMS->CurIndex = 0;
else if (pMS->CurIndex != (BYTE)~0)
{
RECT r;
HSTARSHIP hStarShip;
hStarShip = GetStarShipFromIndex (&master_q, pMS->CurIndex);
StarShipPtr = LockStarShip (&master_q, hStarShip);
pMS->star_bucks[pMS->side] -=
StarShipPtr->RaceDescPtr->ship_info.ship_cost;
UnlockStarShip (&master_q, hStarShip);
pMS->TeamImage[pMS->side].ShipList[pMS->row][pMS->col] = (BYTE)~0;
SetSemaphore (GraphicsSem);
GetShipBox (&r, pMS->side, pMS->row, pMS->col);
RepairMeleeFrame (&r);
DrawTeamString (pMS, 4);
ClearSemaphore (GraphicsSem);
DeleteCurrentShip (pMS);
}
if (pMS->Initialized == 0)
@@ -1317,16 +1346,7 @@ DoPickShip (PMELEE_STATE pMS)
SetSemaphore (GraphicsSem);
Deselect (EDIT_MELEE);
pMS->Initialized = TRUE;
if (++pMS->col == NUM_MELEE_COLUMNS)
{
if (++pMS->row < NUM_MELEE_ROWS)
pMS->col = 0;
else
{
pMS->col = NUM_MELEE_COLUMNS - 1;
pMS->row = NUM_MELEE_ROWS - 1;
}
}
AdvanceCursor (pMS);
pMS->CurIndex = pMS->TeamImage[pMS->side].ShipList[pMS->row][pMS->col];
ClearSemaphore (GraphicsSem);
@@ -1352,16 +1372,7 @@ DoPickShip (PMELEE_STATE pMS)
DrawTeamString (pMS, 4);
DrawShipBox (pMS, FALSE);
ClearSemaphore (GraphicsSem);
if (++pMS->col == NUM_MELEE_COLUMNS)
{
if (++pMS->row < NUM_MELEE_ROWS)
pMS->col = 0;
else
{
pMS->col = NUM_MELEE_COLUMNS - 1;
pMS->row = NUM_MELEE_ROWS - 1;
}
}
AdvanceCursor (pMS);
}
{