Browse Source

[WIP] Merge turn-based and revised battle system

Lou Yihua 7 years ago
parent
commit
22556f8ca6
12 changed files with 1504 additions and 1524 deletions
  1. 124 118
      battle.c
  2. 5 7
      battle.h
  3. 946 902
      fight.c
  4. 9 4
      fight.h
  5. 36 43
      global.c
  6. 7 12
      global.h
  7. 3 0
      palcfg.c
  8. 2 0
      palcfg.h
  9. 24 34
      script.c
  10. 4 14
      text.c
  11. 326 365
      uibattle.c
  12. 18 25
      uigame.c

+ 124 - 118
battle.c

@@ -89,9 +89,11 @@ PAL_BattleMakeScene(
    {
       pos = g_Battle.rgEnemy[i].pos;
 
-      if (g_Battle.rgEnemy[i].rgwStatus[kStatusConfused] > 0 &&
-         g_Battle.rgEnemy[i].rgwStatus[kStatusSleep] == 0 &&
-         g_Battle.rgEnemy[i].rgwStatus[kStatusParalyzed] == 0)
+      if (PAL_CheckRoleStatus(
+		  g_Battle.rgEnemy[i].rgwStatus, 3, TRUE, TRUE,
+		  kStatusConfused, TRUE,
+		  kStatusSleep, FALSE,
+		  kStatusParalyzedOrSlow, FALSE))
       {
          //
          // Enemy is confused
@@ -137,9 +139,9 @@ PAL_BattleMakeScene(
       {
          pos = g_Battle.rgPlayer[i].pos;
 
-         if (gpGlobals->rgPlayerStatus[gpGlobals->rgParty[i].wPlayerRole][kStatusConfused] != 0 &&
-            gpGlobals->rgPlayerStatus[gpGlobals->rgParty[i].wPlayerRole][kStatusSleep] == 0 &&
-            gpGlobals->rgPlayerStatus[gpGlobals->rgParty[i].wPlayerRole][kStatusParalyzed] == 0 &&
+         if (PAL_CheckRoleStatus(
+			 gpGlobals->rgPlayerStatus[gpGlobals->rgParty[i].wPlayerRole], 3, TRUE, TRUE,
+			 kStatusConfused, TRUE, kStatusSleep, FALSE, kStatusParalyzedOrSlow, FALSE) &&
             gpGlobals->g.PlayerRoles.rgwHP[gpGlobals->rgParty[i].wPlayerRole] > 0)
          {
             //
@@ -168,9 +170,9 @@ PAL_BattleMakeScene(
       //
       for (i = gpGlobals->wMaxPartyMemberIndex; i >= 0; i--)
       {
-         if (gpGlobals->rgPlayerStatus[gpGlobals->rgParty[i].wPlayerRole][kStatusConfused] != 0 &&
-            gpGlobals->rgPlayerStatus[gpGlobals->rgParty[i].wPlayerRole][kStatusSleep] == 0 &&
-            gpGlobals->rgPlayerStatus[gpGlobals->rgParty[i].wPlayerRole][kStatusParalyzed] == 0 &&
+         if (PAL_CheckRoleStatus(
+			 gpGlobals->rgPlayerStatus[gpGlobals->rgParty[i].wPlayerRole], 3, TRUE, TRUE,
+			 kStatusConfused, TRUE, kStatusSleep, FALSE, kStatusParalyzedOrSlow, FALSE) &&
             gpGlobals->g.PlayerRoles.rgwHP[gpGlobals->rgParty[i].wPlayerRole] > 0)
          {
             //
@@ -367,9 +369,10 @@ PAL_BattleMain(
       g_Battle.BattleResult = kBattleResultOnGoing;
    }
 
-#ifndef PAL_CLASSIC
-   PAL_UpdateTimeChargingUnit();
-#endif
+   if (!PAL_IsClassicBattle())
+   {
+	   PAL_UpdateTimeChargingUnit();
+   }
 
    dwTime = SDL_GetTicks();
 
@@ -1227,102 +1230,103 @@ PAL_StartBattle(
          g_Battle.rgEnemy[i].wScriptOnReady = gpGlobals->g.rgObject[w].enemy.wScriptOnReady;
          g_Battle.rgEnemy[i].iColorShift = 0;
 
-#ifndef PAL_CLASSIC
-         g_Battle.rgEnemy[i].flTimeMeter = 50;
-
-         //
-         // HACK: Otherwise the black thief lady will be too hard to beat
-         //
-         if (g_Battle.rgEnemy[i].e.wDexterity == 164)
-         {
-            g_Battle.rgEnemy[i].e.wDexterity /= ((gpGlobals->wMaxPartyMemberIndex == 0) ? 6 : 3);
-         }
-
-         //
-         // HACK: Heal up automatically for final boss
-         //
-         if (g_Battle.rgEnemy[i].e.wHealth == 32760)
-         {
-            for (w = 0; w < MAX_PLAYER_ROLES; w++)
-            {
-               gpGlobals->g.PlayerRoles.rgwHP[w] = gpGlobals->g.PlayerRoles.rgwMaxHP[w];
-               gpGlobals->g.PlayerRoles.rgwMP[w] = gpGlobals->g.PlayerRoles.rgwMaxMP[w];
-            }
-         }
-
-         //
-         // Yet another HACKs
-         //
-         if ((SHORT)g_Battle.rgEnemy[i].e.wDexterity == -32)
-         {
-            g_Battle.rgEnemy[i].e.wDexterity = 0; // for Grandma Knife
-         }
-         else if (g_Battle.rgEnemy[i].e.wDexterity == 20)
-         {
-            //
-            // for Fox Demon
-            //
-            if (gpGlobals->g.PlayerRoles.rgwLevel[0] < 15)
-            {
-               g_Battle.rgEnemy[i].e.wDexterity = 8;
-            }
-            else if (gpGlobals->g.PlayerRoles.rgwLevel[4] > 28 ||
-               gpGlobals->Exp.rgPrimaryExp[4].wExp > 0)
-            {
-               g_Battle.rgEnemy[i].e.wDexterity = 60;
-            }
-         }
-         else if (g_Battle.rgEnemy[i].e.wExp == 250 &&
-            g_Battle.rgEnemy[i].e.wCash == 1100)
-         {
-            g_Battle.rgEnemy[i].e.wDexterity += 12; // for Snake Demon
-         }
-         else if ((SHORT)g_Battle.rgEnemy[i].e.wDexterity == -60)
-         {
-            g_Battle.rgEnemy[i].e.wDexterity = 15; // for Spider
-         }
-         else if ((SHORT)g_Battle.rgEnemy[i].e.wDexterity == -30)
-         {
-            g_Battle.rgEnemy[i].e.wDexterity = (WORD)-10; // for Stone Head
-         }
-         else if ((SHORT)g_Battle.rgEnemy[i].e.wDexterity == -16)
-         {
-            g_Battle.rgEnemy[i].e.wDexterity = 0; // for Zombie
-         }
-         else if ((SHORT)g_Battle.rgEnemy[i].e.wDexterity == -20)
-         {
-            g_Battle.rgEnemy[i].e.wDexterity = -8; // for Flower Demon
-         }
-         else if (g_Battle.rgEnemy[i].e.wLevel < 20 &&
-            gpGlobals->wNumScene >= 0xD8 && gpGlobals->wNumScene <= 0xE2)
-         {
-            //
-            // for low-level monsters in the Cave of Trial
-            //
-            g_Battle.rgEnemy[i].e.wLevel += 15;
-            g_Battle.rgEnemy[i].e.wDexterity += 25;
-         }
-         else if (gpGlobals->wNumScene == 0x90)
-         {
-            g_Battle.rgEnemy[i].e.wDexterity += 25; // for Tower Dragons
-         }
-         else if (g_Battle.rgEnemy[i].e.wLevel == 2 &&
-            g_Battle.rgEnemy[i].e.wCash == 48)
-         {
-            g_Battle.rgEnemy[i].e.wDexterity += 8; // for Miao Fists
-         }
-         else if (g_Battle.rgEnemy[i].e.wLevel == 4 &&
-            g_Battle.rgEnemy[i].e.wCash == 240)
-         {
-            g_Battle.rgEnemy[i].e.wDexterity += 18; // for Fat Miao
-         }
-         else if (g_Battle.rgEnemy[i].e.wLevel == 16 &&
-            g_Battle.rgEnemy[i].e.wMagicRate == 4 &&
-            g_Battle.rgEnemy[i].e.wAttackEquivItemRate == 4)
-         {
-            g_Battle.rgEnemy[i].e.wDexterity += 50; // for Black Spider
-         }
-#endif
+		 if (!PAL_IsClassicBattle())
+		 {
+			 g_Battle.rgEnemy[i].flTimeMeter = 50;
+
+			 //
+			 // HACK: Otherwise the black thief lady will be too hard to beat
+			 //
+			 if (g_Battle.rgEnemy[i].e.wDexterity == 164)
+			 {
+				 g_Battle.rgEnemy[i].e.wDexterity /= ((gpGlobals->wMaxPartyMemberIndex == 0) ? 6 : 3);
+			 }
+
+			 //
+			 // HACK: Heal up automatically for final boss
+			 //
+			 if (g_Battle.rgEnemy[i].e.wHealth == 32760)
+			 {
+				 for (w = 0; w < MAX_PLAYER_ROLES; w++)
+				 {
+					 gpGlobals->g.PlayerRoles.rgwHP[w] = gpGlobals->g.PlayerRoles.rgwMaxHP[w];
+					 gpGlobals->g.PlayerRoles.rgwMP[w] = gpGlobals->g.PlayerRoles.rgwMaxMP[w];
+				 }
+			 }
+
+			 //
+			 // Yet another HACKs
+			 //
+			 if ((SHORT)g_Battle.rgEnemy[i].e.wDexterity == -32)
+			 {
+				 g_Battle.rgEnemy[i].e.wDexterity = 0; // for Grandma Knife
+			 }
+			 else if (g_Battle.rgEnemy[i].e.wDexterity == 20)
+			 {
+				 //
+				 // for Fox Demon
+				 //
+				 if (gpGlobals->g.PlayerRoles.rgwLevel[0] < 15)
+				 {
+					 g_Battle.rgEnemy[i].e.wDexterity = 8;
+				 }
+				 else if (gpGlobals->g.PlayerRoles.rgwLevel[4] > 28 ||
+					 gpGlobals->Exp.rgPrimaryExp[4].wExp > 0)
+				 {
+					 g_Battle.rgEnemy[i].e.wDexterity = 60;
+				 }
+			 }
+			 else if (g_Battle.rgEnemy[i].e.wExp == 250 &&
+				 g_Battle.rgEnemy[i].e.wCash == 1100)
+			 {
+				 g_Battle.rgEnemy[i].e.wDexterity += 12; // for Snake Demon
+			 }
+			 else if ((SHORT)g_Battle.rgEnemy[i].e.wDexterity == -60)
+			 {
+				 g_Battle.rgEnemy[i].e.wDexterity = 15; // for Spider
+			 }
+			 else if ((SHORT)g_Battle.rgEnemy[i].e.wDexterity == -30)
+			 {
+				 g_Battle.rgEnemy[i].e.wDexterity = (WORD)-10; // for Stone Head
+			 }
+			 else if ((SHORT)g_Battle.rgEnemy[i].e.wDexterity == -16)
+			 {
+				 g_Battle.rgEnemy[i].e.wDexterity = 0; // for Zombie
+			 }
+			 else if ((SHORT)g_Battle.rgEnemy[i].e.wDexterity == -20)
+			 {
+				 g_Battle.rgEnemy[i].e.wDexterity = -8; // for Flower Demon
+			 }
+			 else if (g_Battle.rgEnemy[i].e.wLevel < 20 &&
+				 gpGlobals->wNumScene >= 0xD8 && gpGlobals->wNumScene <= 0xE2)
+			 {
+				 //
+				 // for low-level monsters in the Cave of Trial
+				 //
+				 g_Battle.rgEnemy[i].e.wLevel += 15;
+				 g_Battle.rgEnemy[i].e.wDexterity += 25;
+			 }
+			 else if (gpGlobals->wNumScene == 0x90)
+			 {
+				 g_Battle.rgEnemy[i].e.wDexterity += 25; // for Tower Dragons
+			 }
+			 else if (g_Battle.rgEnemy[i].e.wLevel == 2 &&
+				 g_Battle.rgEnemy[i].e.wCash == 48)
+			 {
+				 g_Battle.rgEnemy[i].e.wDexterity += 8; // for Miao Fists
+			 }
+			 else if (g_Battle.rgEnemy[i].e.wLevel == 4 &&
+				 g_Battle.rgEnemy[i].e.wCash == 240)
+			 {
+				 g_Battle.rgEnemy[i].e.wDexterity += 18; // for Fat Miao
+			 }
+			 else if (g_Battle.rgEnemy[i].e.wLevel == 16 &&
+				 g_Battle.rgEnemy[i].e.wMagicRate == 4 &&
+				 g_Battle.rgEnemy[i].e.wAttackEquivItemRate == 4)
+			 {
+				 g_Battle.rgEnemy[i].e.wDexterity += 50; // for Black Spider
+			 }
+		 }
       }
    }
 
@@ -1334,10 +1338,11 @@ PAL_StartBattle(
    for (i = 0; i <= gpGlobals->wMaxPartyMemberIndex; i++)
    {
       g_Battle.rgPlayer[i].flTimeMeter = 15.0f;
-#ifndef PAL_CLASSIC
-      g_Battle.rgPlayer[i].flTimeSpeedModifier = 2.0f;
-      g_Battle.rgPlayer[i].sTurnOrder = -1;
-#endif
+      if (!PAL_IsClassicBattle())
+      {
+         g_Battle.rgPlayer[i].flTimeSpeedModifier = 2.0f;
+         g_Battle.rgPlayer[i].sTurnOrder = -1;
+      }
       g_Battle.rgPlayer[i].wHidingTime = 0;
       g_Battle.rgPlayer[i].state = kFighterWait;
       g_Battle.rgPlayer[i].action.sTarget = -1;
@@ -1408,12 +1413,13 @@ PAL_StartBattle(
 
    PAL_MKFReadChunk(g_Battle.lpEffectSprite, i, 10, gpGlobals->f.fpDATA);
 
-#ifdef PAL_CLASSIC
-   g_Battle.Phase = kBattlePhaseSelectAction;
-   g_Battle.fRepeat = FALSE;
-   g_Battle.fForce = FALSE;
-   g_Battle.fFlee = FALSE;
-#endif
+   if (PAL_IsClassicBattle())
+   {
+	   g_Battle.Phase = kBattlePhaseSelectAction;
+	   g_Battle.fRepeat = FALSE;
+	   g_Battle.fForce = FALSE;
+	   g_Battle.fFlee = FALSE;
+   }
 
 #ifdef PAL_ALLOW_KEYREPEAT
    SDL_EnableKeyRepeat(120, 75);

+ 5 - 7
battle.h

@@ -114,9 +114,7 @@ typedef struct tagBATTLEPLAYER
    BOOL               fDefending;           // TRUE if player is defending
    WORD               wPrevHP;              // HP value prior to action
    WORD               wPrevMP;              // MP value prior to action
-#ifndef PAL_CLASSIC
-   SHORT              sTurnOrder;           // turn order
-#endif
+   SHORT              sTurnOrder;           // turn order, revised battle only
 } BATTLEPLAYER;
 
 typedef struct tagSUMMON
@@ -128,7 +126,7 @@ typedef struct tagSUMMON
 #define MAX_BATTLE_ACTIONS    256
 #define MAX_KILLED_ENEMIES    256
 
-#ifdef PAL_CLASSIC
+// Classic battle only ---
 
 typedef enum tabBATTLEPHASE
 {
@@ -145,7 +143,7 @@ typedef struct tagACTIONQUEUE
 
 #define MAX_ACTIONQUEUE_ITEMS (MAX_PLAYERS_IN_PARTY + MAX_ENEMIES_IN_TEAM * 2)
 
-#endif
+// Classic battle only ===
 
 typedef struct tagBATTLE
 {
@@ -184,14 +182,14 @@ typedef struct tagBATTLE
 
    int              iBlow;
 
-#ifdef PAL_CLASSIC
+// Classic battle only ---
    BATTLEPHASE      Phase;
    ACTIONQUEUE      ActionQueue[MAX_ACTIONQUEUE_ITEMS];
    int              iCurAction;
    BOOL             fRepeat;              // TRUE if player pressed Repeat
    BOOL             fForce;               // TRUE if player pressed Force
    BOOL             fFlee;                // TRUE if player pressed Flee
-#endif
+// Classic battle only ===
 } BATTLE;
 
 extern BATTLE g_Battle;

File diff suppressed because it is too large
+ 946 - 902
fight.c


+ 9 - 4
fight.h

@@ -32,8 +32,6 @@ PAL_BattleSelectAutoTarget(
    VOID
 );
 
-#ifndef PAL_CLASSIC
-
 VOID
 PAL_UpdateTimeChargingUnit(
    VOID
@@ -44,8 +42,6 @@ PAL_GetTimeChargingSpeed(
    WORD           wDexterity
 );
 
-#endif
-
 VOID
 PAL_BattleUpdateFighters(
    VOID
@@ -102,6 +98,15 @@ PAL_BattleSimulateMagic(
    WORD       wBaseDamage
 );
 
+BOOL
+PAL_CheckRoleStatus(
+	WORD      rgwStatus[],
+	WORD      wNumCondition,
+	BOOL      bSatisfyAll,
+	BOOL      bClassicParalyzed,
+	...
+);
+
 #ifdef __cplusplus
 }
 #endif

+ 36 - 43
global.c

@@ -406,9 +406,7 @@ PAL_LoadDefaultGame(
    gpGlobals->viewport = PAL_XY(0, 0);
    gpGlobals->wLayer = 0;
    gpGlobals->wChaseRange = 1;
-#ifndef PAL_CLASSIC
-   gpGlobals->bBattleSpeed = 2;
-#endif
+   gpGlobals->bBattleSpeed = PAL_IsClassicBattle() ? 0 : 2;
 
    memset(gpGlobals->rgInventory, 0, sizeof(gpGlobals->rgInventory));
    memset(gpGlobals->rgPoisonStatus, 0, sizeof(gpGlobals->rgPoisonStatus));
@@ -543,13 +541,11 @@ PAL_LoadGame_Common(
 	gpGlobals->wChasespeedChangeCycles = s->wChasespeedChangeCycles;
 	gpGlobals->nFollower = s->nFollower;
 	gpGlobals->dwCash = s->dwCash;
-#ifndef PAL_CLASSIC
 	gpGlobals->bBattleSpeed = s->wBattleSpeed;
-	if (gpGlobals->bBattleSpeed > 5 || gpGlobals->bBattleSpeed == 0)
-	{
-		gpGlobals->bBattleSpeed = 2;
-	}
-#endif
+	if (gpGlobals->bBattleSpeed > 5)
+		gpGlobals->bBattleSpeed = PAL_IsClassicBattle() ? 0 : 2;
+	else
+		gConfig.fClassicBattle = (gpGlobals->bBattleSpeed == 0);
 
 	memcpy(gpGlobals->rgParty, s->rgParty, sizeof(gpGlobals->rgParty));
 	memcpy(gpGlobals->rgTrail, s->rgTrail, sizeof(gpGlobals->rgTrail));
@@ -739,11 +735,7 @@ PAL_SaveGame_Common(
 	s->wChasespeedChangeCycles = gpGlobals->wChasespeedChangeCycles;
 	s->nFollower = gpGlobals->nFollower;
 	s->dwCash = gpGlobals->dwCash;
-#ifndef PAL_CLASSIC
 	s->wBattleSpeed = gpGlobals->bBattleSpeed;
-#else
-	s->wBattleSpeed = 2;
-#endif
 
 	memcpy(s->rgParty, gpGlobals->rgParty, sizeof(gpGlobals->rgParty));
 	memcpy(s->rgTrail, gpGlobals->rgTrail, sizeof(gpGlobals->rgTrail));
@@ -1728,11 +1720,7 @@ PAL_GetPlayerDexterity(
 
    w = gpGlobals->g.PlayerRoles.rgwDexterity[wPlayerRole];
 
-#ifdef PAL_CLASSIC
-   for (i = 0; i <= MAX_PLAYER_EQUIPMENTS; i++)
-#else
-   for (i = 0; i <= MAX_PLAYER_EQUIPMENTS - 1; i++)
-#endif
+   for (i = 0; i <= (PAL_IsClassicBattle() ? MAX_PLAYER_EQUIPMENTS : MAX_PLAYER_EQUIPMENTS - 1); i++)
    {
       w += gpGlobals->rgEquipmentEffect[i].rgwDexterity[wPlayerRole];
    }
@@ -2070,38 +2058,35 @@ PAL_SetPlayerStatus(
 
 --*/
 {
-#ifndef PAL_CLASSIC
-   if (wStatusID == kStatusSlow &&
-      gpGlobals->rgPlayerStatus[wPlayerRole][kStatusHaste] > 0)
-   {
-      //
-      // Remove the haste status
-      //
-      PAL_RemovePlayerStatus(wPlayerRole, kStatusHaste);
-      return;
-   }
+	if (!PAL_IsClassicBattle())
+	{
+		if (wStatusID == kStatusParalyzedOrSlow &&
+			gpGlobals->rgPlayerStatus[wPlayerRole][kStatusHaste] > 0)
+		{
+			//
+			// Remove the haste status
+			//
+			PAL_RemovePlayerStatus(wPlayerRole, kStatusHaste);
+			return;
+		}
 
-   if (wStatusID == kStatusHaste &&
-      gpGlobals->rgPlayerStatus[wPlayerRole][kStatusSlow] > 0)
-   {
-      //
-      // Remove the slow status
-      //
-      PAL_RemovePlayerStatus(wPlayerRole, kStatusSlow);
-      return;
-   }
-#endif
+		if (wStatusID == kStatusHaste &&
+			gpGlobals->rgPlayerStatus[wPlayerRole][kStatusParalyzedOrSlow] > 0)
+		{
+			//
+			// Remove the slow status
+			//
+			PAL_RemovePlayerStatus(wPlayerRole, kStatusParalyzedOrSlow);
+			return;
+		}
+	}
 
    switch (wStatusID)
    {
    case kStatusConfused:
    case kStatusSleep:
    case kStatusSilence:
-#ifdef PAL_CLASSIC
-   case kStatusParalyzed:
-#else
-   case kStatusSlow:
-#endif
+   case kStatusParalyzedOrSlow:
       //
       // for "bad" statuses, don't set the status when we already have it
       //
@@ -2274,3 +2259,11 @@ PAL_PlayerLevelUp(
    gpGlobals->Exp.rgPrimaryExp[wPlayerRole].wLevel =
       gpGlobals->g.PlayerRoles.rgwLevel[wPlayerRole];
 }
+
+BOOL
+PAL_IsClassicBattle(
+	VOID
+)
+{
+	return gConfig.fClassicBattle;
+}

+ 7 - 12
global.h

@@ -97,11 +97,7 @@ extern "C"
 typedef enum tagSTATUS
 {
    kStatusConfused = 0,  // attack friends randomly
-#ifdef PAL_CLASSIC
-   kStatusParalyzed,     // paralyzed
-#else
-   kStatusSlow,          // slower
-#endif
+   kStatusParalyzedOrSlow, // paralyzed (classic) or slow (revised)
    kStatusSleep,         // not allowed to move
    kStatusSilence,       // cannot use magic
    kStatusPuppet,        // for dead players only, continue attacking
@@ -112,10 +108,6 @@ typedef enum tagSTATUS
    kStatusAll
 } STATUS;
 
-#ifndef PAL_CLASSIC
-#define kStatusParalyzed kStatusSleep
-#endif
-
 // body parts of equipments
 typedef enum tagBODYPART
 {
@@ -580,9 +572,7 @@ typedef struct tagGLOBALVARS
    BOOL             fNeedToFadeIn;       // TRUE if need to fade in when drawing scene
    BOOL             fInBattle;           // TRUE if in battle
    BOOL             fAutoBattle;         // TRUE if auto-battle
-#ifndef PAL_CLASSIC
-   BYTE             bBattleSpeed;        // Battle Speed (1 = Fastest, 5 = Slowest)
-#endif
+   BYTE             bBattleSpeed;        // Battle Speed (0 = Turn-based, 1 = Fastest, 5 = Slowest)
    WORD             wLastUnequippedItem; // last unequipped item
 
    PLAYERROLES      rgEquipmentEffect[MAX_PLAYER_EQUIPMENTS + 1]; // equipment effects
@@ -619,6 +609,11 @@ typedef struct tagGLOBALVARS
 
 extern GLOBALVARS * const gpGlobals;
 
+BOOL
+PAL_IsClassicBattle(
+	VOID
+);
+
 BOOL
 PAL_IsWINVersion(
    BOOL *pfIsWIN95

+ 3 - 0
palcfg.c

@@ -17,6 +17,7 @@ static const ConfigItem gConfigItems[PALCFG_ALL_MAX] = {
 	{ PALCFG_USEEMBEDDEDFONTS,  PALCFG_BOOLEAN,  "USEEMBEDDEDFONTS",  16, TRUE,  FALSE, TRUE },								// Default for using embedded fonts in DOS version
 	{ PALCFG_USESURROUNDOPL,    PALCFG_BOOLEAN,  "USESURROUNDOPL",    14, TRUE,  FALSE, TRUE },								// Default for using surround opl
 	{ PALCFG_USETOUCHOVERLAY,   PALCFG_BOOLEAN,  "USETOUCHOVERLAY",   15, PAL_HAS_TOUCH, FALSE, TRUE },
+	{ PALCFG_CLASSICBATTLE,     PALCFG_BOOLEAN,  "CLASSICBATTLE",     13, FALSE, FALSE, TRUE },								// Default for using classic battle
 
 	{ PALCFG_SURROUNDOPLOFFSET, PALCFG_INTEGER,  "SURROUNDOPLOFFSET", 17, 384,   INT32_MIN, INT32_MAX },
 
@@ -396,6 +397,7 @@ PAL_LoadConfig(
 	gConfig.fKeepAspectRatio = values[PALCFG_KEEPASPECTRATIO].bValue;
 #endif
 	gConfig.fFullScreen = values[PALCFG_FULLSCREEN].bValue;
+	gConfig.fClassicBattle = values[PALCFG_CLASSICBATTLE].bValue;
 	gConfig.iAudioChannels = values[PALCFG_STEREO].bValue ? 2 : 1;
 
 	gConfig.iSurroundOPLOffset = values[PALCFG_SURROUNDOPLOFFSET].iValue;
@@ -442,6 +444,7 @@ PAL_SaveConfig(
 		sprintf(buf, "%s=%d\n", PAL_ConfigName(PALCFG_USEEMBEDDEDFONTS), gConfig.fUseEmbeddedFonts); fputs(buf, fp);
 		sprintf(buf, "%s=%d\n", PAL_ConfigName(PALCFG_USESURROUNDOPL), gConfig.fUseSurroundOPL); fputs(buf, fp);
 		sprintf(buf, "%s=%d\n", PAL_ConfigName(PALCFG_USETOUCHOVERLAY), gConfig.fUseTouchOverlay); fputs(buf, fp);
+		sprintf(buf, "%s=%d\n", PAL_ConfigName(PALCFG_CLASSICBATTLE), gConfig.fClassicBattle); fputs(buf, fp);
 
 		sprintf(buf, "%s=%d\n", PAL_ConfigName(PALCFG_SURROUNDOPLOFFSET), gConfig.iSurroundOPLOffset); fputs(buf, fp);
 

+ 2 - 0
palcfg.h

@@ -45,6 +45,7 @@ typedef enum tagPALCFG_ITEM
 	PALCFG_USEEMBEDDEDFONTS,
 	PALCFG_USESURROUNDOPL,
 	PALCFG_USETOUCHOVERLAY,
+	PALCFG_CLASSICBATTLE,
 	/* Booleans */
 	PALCFG_BOOLEAN_MAX,
 
@@ -190,6 +191,7 @@ typedef struct tagCONFIGURATION
 	BOOL             fUseCustomScreenLayout;
 	BOOL             fLaunchSetting;
 	BOOL             fUseTouchOverlay;
+	BOOL             fClassicBattle;
 #if USE_RIX_EXTRA_INIT
 	uint32_t        *pExtraFMRegs;
 	uint8_t         *pExtraFMVals;

+ 24 - 34
script.c

@@ -511,10 +511,7 @@ PAL_AdditionalCredits(
    LPCWSTR rgszcps[][CP_MAX] = {
 	   // Traditional Chinese, Simplified Chinese
 	   { L"", L"", /*L""*/ },
-	   { L"         \x7D93\x5178\x7279\x5225\x7BC7   ",
-	     L"         \x7ECF\x5178\x7279\x522B\x7BC7   ",
-	     //L"   \x30AF\x30E9\x30B7\x30C3\x30AF\x7279\x5225\x7DE8  "
-	   },
+	   { L"", L"", /*L""*/ },
 	   { L"", L"", /*L""*/ },
 	   { L"", L"", /*L""*/ },
 	   { L"", L"", /*L""*/ },
@@ -538,11 +535,7 @@ PAL_AdditionalCredits(
 
    LPCWSTR rgszStrings[] = {
       L"  SDLPAL (http://sdlpal.codeplex.com/)",
-#ifdef PAL_CLASSIC
-	  L"%ls(" WIDETEXT(__DATE__) L")",
-#else
 	  L"                        (" WIDETEXT(__DATE__) L")",
-#endif
       L" ",
 	  L"    (c) 2009-2011, Wei Mingzhi",
 	  L"        <whistler_wmz@users.sf.net>.",
@@ -1340,11 +1333,7 @@ PAL_InterpretInstruction(
       //
       w = g_Battle.rgEnemy[wEventObjectID].wObjectID;
 
-#ifdef PAL_CLASSIC
-      i = 9;
-#else
-      i = ((pScript->rgwOperand[0] == kStatusSlow) ? 14 : 9);
-#endif
+      i = (!PAL_IsClassicBattle() && pScript->rgwOperand[0] == kStatusParalyzedOrSlow) ? 14 : 9;
 
       if (RandomLong(0, i) >= gpGlobals->g.rgObject[w].enemy.wResistanceToSorcery &&
          g_Battle.rgEnemy[wEventObjectID].rgwStatus[pScript->rgwOperand[0]] == 0)
@@ -1418,19 +1407,22 @@ PAL_InterpretInstruction(
       {
          WCHAR s[256];
 
-#ifdef PAL_CLASSIC
-         i = RandomLong(1, gpGlobals->wCollectValue);
-         if (i > 9)
-         {
-            i = 9;
-         }
-#else
-         i = RandomLong(1, 9);
-         if (i > gpGlobals->wCollectValue)
-         {
-            i = gpGlobals->wCollectValue;
-         }
-#endif
+		 if (PAL_IsClassicBattle())
+		 {
+			 i = RandomLong(1, gpGlobals->wCollectValue);
+			 if (i > 9)
+			 {
+				 i = 9;
+			 }
+		 }
+		 else
+		 {
+			 i = RandomLong(1, 9);
+			 if (i > gpGlobals->wCollectValue)
+			 {
+				 i = gpGlobals->wCollectValue;
+			 }
+		 }
 
          gpGlobals->wCollectValue -= i;
          i--;
@@ -2800,10 +2792,9 @@ PAL_InterpretInstruction(
          }
       }
 
-      if (x < y || g_Battle.iHidingTime > 0 ||
-         g_Battle.rgEnemy[wEventObjectID].rgwStatus[kStatusSleep] != 0 ||
-         g_Battle.rgEnemy[wEventObjectID].rgwStatus[kStatusParalyzed] != 0 ||
-         g_Battle.rgEnemy[wEventObjectID].rgwStatus[kStatusConfused] != 0)
+      if (x < y || g_Battle.iHidingTime > 0 || PAL_CheckRoleStatus(
+		  g_Battle.rgEnemy[wEventObjectID].rgwStatus, 3, FALSE, TRUE,
+		  kStatusSleep, TRUE, kStatusParalyzedOrSlow, TRUE, kStatusConfused, TRUE))
       {
          if (pScript->rgwOperand[2] != 0)
          {
@@ -2859,10 +2850,9 @@ PAL_InterpretInstruction(
       //
       // Enemy transforms into something else
       //
-      if (g_Battle.iHidingTime <= 0 &&
-         g_Battle.rgEnemy[wEventObjectID].rgwStatus[kStatusSleep] == 0 &&
-         g_Battle.rgEnemy[wEventObjectID].rgwStatus[kStatusParalyzed] == 0 &&
-         g_Battle.rgEnemy[wEventObjectID].rgwStatus[kStatusConfused] == 0)
+      if (g_Battle.iHidingTime <= 0 && PAL_CheckRoleStatus(
+		  g_Battle.rgEnemy[wEventObjectID].rgwStatus, 3, TRUE, TRUE,
+		  kStatusSleep, FALSE, kStatusParalyzedOrSlow, FALSE, kStatusConfused, FALSE))
       {
          w = g_Battle.rgEnemy[wEventObjectID].e.wHealth;
 

+ 4 - 14
text.c

@@ -40,15 +40,13 @@ BOOL      g_fUpdatedInBattle      = FALSE;
 #define INCLUDE_CODEPAGE_H
 #include "codepage.h"
 
-#ifndef PAL_CLASSIC
 # define ATB_WORD_COUNT             6
 static LPWSTR gc_rgszAdditionalWords[CP_MAX][ATB_WORD_COUNT] = {
-   { L"\x6230\x9B25\x901F\x5EA6", L"\x4E00", L"\x4E8C", L"\x4E09", L"\x56DB", L"\x4E94" },
-   { L"\x6218\x6597\x901F\x5EA6", L"\x4E00", L"\x4E8C", L"\x4E09", L"\x56DB", L"\x4E94" },
+   { L"\x6230\x9B25\x901F\x5EA6", L"\xFF11", L"\xFF12", L"\xFF13", L"\xFF14", L"\xFF15" },
+   { L"\x6218\x6597\x901F\x5EA6", L"\xFF11", L"\xFF12", L"\xFF13", L"\xFF14", L"\xFF15" },
    //{ L"\x6226\x95D8\x901F\x5EA6", L"\x4E00", L"\x4E8C", L"\x4E09", L"\x56DB", L"\x4E94" },
 };
 static LPWSTR gc_rgszDefaultAdditionalWords[ATB_WORD_COUNT] = { NULL, L"\xFF11", L"\xFF12", L"\xFF13", L"\xFF14", L"\xFF15" };
-#endif
 
 #define SDLPAL_EXTRA_WORD_COUNT     1
 static LPWSTR gc_rgszSDLPalWords[CP_MAX][SDLPAL_EXTRA_WORD_COUNT] = {
@@ -455,9 +453,8 @@ PAL_ReadMessageFile(
 		//
 		// Move values from linked list to array
 		//
-#ifndef PAL_CLASSIC
 		int i;
-#endif
+
 		if (word_cnt < MINIMAL_WORD_COUNT - 1) word_cnt = MINIMAL_WORD_COUNT - 1;
 		g_TextLib.nWords = (word_cnt += 1);
 		g_TextLib.lpWordBuf = (LPWSTR *)UTIL_calloc(word_cnt, sizeof(LPWSTR));
@@ -467,11 +464,9 @@ PAL_ReadMessageFile(
 			g_TextLib.lpWordBuf[witem->index] = witem->value;
 			free(witem); witem = temp;
 		}
-#ifndef PAL_CLASSIC
 		for (i = 1; i < ATB_WORD_COUNT; i++)
 			if (!g_TextLib.lpWordBuf[i + SYSMENU_LABEL_BATTLEMODE])
 				g_TextLib.lpWordBuf[i + SYSMENU_LABEL_BATTLEMODE] = gc_rgszDefaultAdditionalWords[i];
-#endif
 	}
 
 	fclose(fp);
@@ -688,10 +683,7 @@ PAL_InitText(
 	   g_TextLib.lpIndexBuf = NULL;
 
 	   memcpy(g_TextLib.lpWordBuf + SYSMENU_LABEL_LAUNCHSETTING, gc_rgszSDLPalWords[gConfig.uCodePage], SDLPAL_EXTRA_WORD_COUNT * sizeof(LPCWSTR));
-
-#ifndef PAL_CLASSIC
 	   memcpy(g_TextLib.lpWordBuf + SYSMENU_LABEL_BATTLEMODE, gc_rgszAdditionalWords[gConfig.uCodePage], ATB_WORD_COUNT * sizeof(LPCWSTR));
-#endif
    }
 
    g_TextLib.bCurrentFontColor = FONT_COLOR_DEFAULT;
@@ -1193,13 +1185,11 @@ PAL_ShowDialogText(
       //
       // The text should be shown in a small window at the center of the screen
       //
-#ifndef PAL_CLASSIC
-      if (gpGlobals->fInBattle && g_Battle.BattleResult == kBattleResultOnGoing)
+      if (!PAL_IsClassicBattle() && gpGlobals->fInBattle && g_Battle.BattleResult == kBattleResultOnGoing)
       {
          PAL_BattleUIShowText(lpszText, 1400);
       }
       else
-#endif
       {
          PAL_POS    pos;
          LPBOX      lpBox;

+ 326 - 365
uibattle.c

@@ -162,81 +162,85 @@ PAL_PlayerInfoBox(
          gpScreen, PAL_XY(PAL_X(pos) - 2, PAL_Y(pos) - 4), bPoisonColor, 0);
    }
 
-#ifndef PAL_CLASSIC
-   //
-   // Draw a border for the Time Meter
-   //
-   rect.x = PAL_X(pos) + 31;
-   rect.y = PAL_Y(pos) + 4;
-   rect.w = 1;
-   rect.h = 6;
-   SDL_FillRect(gpScreen, &rect, 0xBD);
-
-   rect.x += 39;
-   SDL_FillRect(gpScreen, &rect, 0xBD);
-
-   rect.x = PAL_X(pos) + 32;
-   rect.y = PAL_Y(pos) + 3;
-   rect.w = 38;
-   rect.h = 1;
-   SDL_FillRect(gpScreen, &rect, 0xBD);
-
-   rect.y += 7;
-   SDL_FillRect(gpScreen, &rect, 0xBD);
+   if (!PAL_IsClassicBattle())
+   {
+	   //
+	   // Draw a border for the Time Meter
+	   //
+	   rect.x = PAL_X(pos) + 31;
+	   rect.y = PAL_Y(pos) + 4;
+	   rect.w = 1;
+	   rect.h = 6;
+	   SDL_FillRect(gpScreen, &rect, 0xBD);
+
+	   rect.x += 39;
+	   SDL_FillRect(gpScreen, &rect, 0xBD);
+
+	   rect.x = PAL_X(pos) + 32;
+	   rect.y = PAL_Y(pos) + 3;
+	   rect.w = 38;
+	   rect.h = 1;
+	   SDL_FillRect(gpScreen, &rect, 0xBD);
+
+	   rect.y += 7;
+	   SDL_FillRect(gpScreen, &rect, 0xBD);
+
+	   //
+	   // Draw the Time meter bar
+	   //
+	   if (iTimeMeter >= 100)
+	   {
+		   rect.x = PAL_X(pos) + 33;
+		   rect.y = PAL_Y(pos) + 6;
+		   rect.w = 36;
+		   rect.h = 2;
+		   SDL_FillRect(gpScreen, &rect, 0x2C);
+	   }
+	   else if (iTimeMeter > 0)
+	   {
+		   rect.x = PAL_X(pos) + 33;
+		   rect.y = PAL_Y(pos) + 5;
+		   rect.w = iTimeMeter * 36 / 100;
+		   rect.h = 4;
+		   SDL_FillRect(gpScreen, &rect, bTimeMeterColor);
+	   }
+   }
 
    //
-   // Draw the Time meter bar
+   // Draw the HP and MP value
    //
-   if (iTimeMeter >= 100)
+   if (PAL_IsClassicBattle())
    {
-      rect.x = PAL_X(pos) + 33;
-      rect.y = PAL_Y(pos) + 6;
-      rect.w = 36;
-      rect.h = 2;
-      SDL_FillRect(gpScreen, &rect, 0x2C);
+	   PAL_RLEBlitToSurface(PAL_SpriteGetFrame(gpSpriteUI, SPRITENUM_SLASH), gpScreen,
+		   PAL_XY(PAL_X(pos) + 49, PAL_Y(pos) + 6));
+	   PAL_DrawNumber(gpGlobals->g.PlayerRoles.rgwMaxHP[wPlayerRole], 4,
+		   PAL_XY(PAL_X(pos) + 47, PAL_Y(pos) + 8), kNumColorYellow, kNumAlignRight);
+	   PAL_DrawNumber(gpGlobals->g.PlayerRoles.rgwHP[wPlayerRole], 4,
+		   PAL_XY(PAL_X(pos) + 26, PAL_Y(pos) + 5), kNumColorYellow, kNumAlignRight);
+
+	   PAL_RLEBlitToSurface(PAL_SpriteGetFrame(gpSpriteUI, SPRITENUM_SLASH), gpScreen,
+		   PAL_XY(PAL_X(pos) + 49, PAL_Y(pos) + 22));
+	   PAL_DrawNumber(gpGlobals->g.PlayerRoles.rgwMaxMP[wPlayerRole], 4,
+		   PAL_XY(PAL_X(pos) + 47, PAL_Y(pos) + 24), kNumColorCyan, kNumAlignRight);
+	   PAL_DrawNumber(gpGlobals->g.PlayerRoles.rgwMP[wPlayerRole], 4,
+		   PAL_XY(PAL_X(pos) + 26, PAL_Y(pos) + 21), kNumColorCyan, kNumAlignRight);
    }
-   else if (iTimeMeter > 0)
+   else
    {
-      rect.x = PAL_X(pos) + 33;
-      rect.y = PAL_Y(pos) + 5;
-      rect.w = iTimeMeter * 36 / 100;
-      rect.h = 4;
-      SDL_FillRect(gpScreen, &rect, bTimeMeterColor);
+	   PAL_RLEBlitToSurface(PAL_SpriteGetFrame(gpSpriteUI, SPRITENUM_SLASH), gpScreen,
+		   PAL_XY(PAL_X(pos) + 49, PAL_Y(pos) + 14));
+	   PAL_DrawNumber(gpGlobals->g.PlayerRoles.rgwMaxHP[wPlayerRole], 4,
+		   PAL_XY(PAL_X(pos) + 47, PAL_Y(pos) + 16), kNumColorYellow, kNumAlignRight);
+	   PAL_DrawNumber(gpGlobals->g.PlayerRoles.rgwHP[wPlayerRole], 4,
+		   PAL_XY(PAL_X(pos) + 26, PAL_Y(pos) + 13), kNumColorYellow, kNumAlignRight);
+
+	   PAL_RLEBlitToSurface(PAL_SpriteGetFrame(gpSpriteUI, SPRITENUM_SLASH), gpScreen,
+		   PAL_XY(PAL_X(pos) + 49, PAL_Y(pos) + 24));
+	   PAL_DrawNumber(gpGlobals->g.PlayerRoles.rgwMaxMP[wPlayerRole], 4,
+		   PAL_XY(PAL_X(pos) + 47, PAL_Y(pos) + 26), kNumColorCyan, kNumAlignRight);
+	   PAL_DrawNumber(gpGlobals->g.PlayerRoles.rgwMP[wPlayerRole], 4,
+		   PAL_XY(PAL_X(pos) + 26, PAL_Y(pos) + 23), kNumColorCyan, kNumAlignRight);
    }
-#endif
-
-   //
-   // Draw the HP and MP value
-   //
-#ifdef PAL_CLASSIC
-   PAL_RLEBlitToSurface(PAL_SpriteGetFrame(gpSpriteUI, SPRITENUM_SLASH), gpScreen,
-      PAL_XY(PAL_X(pos) + 49, PAL_Y(pos) + 6));
-   PAL_DrawNumber(gpGlobals->g.PlayerRoles.rgwMaxHP[wPlayerRole], 4,
-      PAL_XY(PAL_X(pos) + 47, PAL_Y(pos) + 8), kNumColorYellow, kNumAlignRight);
-   PAL_DrawNumber(gpGlobals->g.PlayerRoles.rgwHP[wPlayerRole], 4,
-      PAL_XY(PAL_X(pos) + 26, PAL_Y(pos) + 5), kNumColorYellow, kNumAlignRight);
-
-   PAL_RLEBlitToSurface(PAL_SpriteGetFrame(gpSpriteUI, SPRITENUM_SLASH), gpScreen,
-      PAL_XY(PAL_X(pos) + 49, PAL_Y(pos) + 22));
-   PAL_DrawNumber(gpGlobals->g.PlayerRoles.rgwMaxMP[wPlayerRole], 4,
-      PAL_XY(PAL_X(pos) + 47, PAL_Y(pos) + 24), kNumColorCyan, kNumAlignRight);
-   PAL_DrawNumber(gpGlobals->g.PlayerRoles.rgwMP[wPlayerRole], 4,
-      PAL_XY(PAL_X(pos) + 26, PAL_Y(pos) + 21), kNumColorCyan, kNumAlignRight);
-#else
-   PAL_RLEBlitToSurface(PAL_SpriteGetFrame(gpSpriteUI, SPRITENUM_SLASH), gpScreen,
-      PAL_XY(PAL_X(pos) + 49, PAL_Y(pos) + 14));
-   PAL_DrawNumber(gpGlobals->g.PlayerRoles.rgwMaxHP[wPlayerRole], 4,
-      PAL_XY(PAL_X(pos) + 47, PAL_Y(pos) + 16), kNumColorYellow, kNumAlignRight);
-   PAL_DrawNumber(gpGlobals->g.PlayerRoles.rgwHP[wPlayerRole], 4,
-      PAL_XY(PAL_X(pos) + 26, PAL_Y(pos) + 13), kNumColorYellow, kNumAlignRight);
-
-   PAL_RLEBlitToSurface(PAL_SpriteGetFrame(gpSpriteUI, SPRITENUM_SLASH), gpScreen,
-      PAL_XY(PAL_X(pos) + 49, PAL_Y(pos) + 24));
-   PAL_DrawNumber(gpGlobals->g.PlayerRoles.rgwMaxMP[wPlayerRole], 4,
-      PAL_XY(PAL_X(pos) + 47, PAL_Y(pos) + 26), kNumColorCyan, kNumAlignRight);
-   PAL_DrawNumber(gpGlobals->g.PlayerRoles.rgwMP[wPlayerRole], 4,
-      PAL_XY(PAL_X(pos) + 26, PAL_Y(pos) + 23), kNumColorCyan, kNumAlignRight);
-#endif
 
    //
    // Draw Statuses
@@ -315,19 +319,12 @@ PAL_BattleUIIsActionValid(
       {
          w = gpGlobals->rgParty[i].wPlayerRole;
 
-#ifndef PAL_CLASSIC
          if (gpGlobals->g.PlayerRoles.rgwHP[w] < gpGlobals->g.PlayerRoles.rgwMaxHP[w] / 5 ||
             gpGlobals->rgPlayerStatus[w][kStatusSleep] != 0 ||
             gpGlobals->rgPlayerStatus[w][kStatusConfused] != 0 ||
             gpGlobals->rgPlayerStatus[w][kStatusSilence] != 0 ||
-            g_Battle.rgPlayer[i].flTimeMeter < 100 ||
-            g_Battle.rgPlayer[i].state == kFighterAct)
-#else
-         if (gpGlobals->g.PlayerRoles.rgwHP[w] < gpGlobals->g.PlayerRoles.rgwMaxHP[w] / 5 ||
-            gpGlobals->rgPlayerStatus[w][kStatusSleep] != 0 ||
-            gpGlobals->rgPlayerStatus[w][kStatusConfused] != 0 ||
-            gpGlobals->rgPlayerStatus[w][kStatusSilence] != 0)
-#endif
+			(!PAL_IsClassicBattle() && g_Battle.rgPlayer[i].flTimeMeter < 100) ||
+			(!PAL_IsClassicBattle() && g_Battle.rgPlayer[i].state == kFighterAct))
          {
             return FALSE;
          }
@@ -363,7 +360,6 @@ PAL_BattleUIDrawMiscMenu(
    int           i;
    BYTE          bColor;
 
-#ifdef PAL_CLASSIC
    MENUITEM rgMenuItem[] = {
       // value   label                     enabled   position
       {  0,      BATTLEUI_LABEL_AUTO,      TRUE,     PAL_XY(16, 32)  },
@@ -372,16 +368,6 @@ PAL_BattleUIDrawMiscMenu(
       {  3,      BATTLEUI_LABEL_FLEE,      TRUE,     PAL_XY(16, 86)  },
       {  4,      BATTLEUI_LABEL_STATUS,    TRUE,     PAL_XY(16, 104) }
    };
-#else
-   MENUITEM rgMenuItem[] = {
-      // value   label                   enabled   position
-      {  0,      BATTLEUI_LABEL_ITEM,    TRUE,     PAL_XY(16, 32)  },
-      {  1,      BATTLEUI_LABEL_DEFEND,  TRUE,     PAL_XY(16, 50)  },
-      {  2,      BATTLEUI_LABEL_AUTO,    TRUE,     PAL_XY(16, 68)  },
-      {  3,      BATTLEUI_LABEL_FLEE,    TRUE,     PAL_XY(16, 86)  },
-      {  4,      BATTLEUI_LABEL_STATUS,  TRUE,     PAL_XY(16, 104) }
-   };
-#endif
 
    //
    // Draw the box
@@ -497,11 +483,7 @@ PAL_BattleUIMiscItemSubMenuUpdate(
    //
    // Draw the menu
    //
-#ifdef PAL_CLASSIC
-   PAL_BattleUIDrawMiscMenu(1, TRUE);
-#else
-   PAL_BattleUIDrawMiscMenu(0, TRUE);
-#endif
+   PAL_BattleUIDrawMiscMenu(PAL_IsClassicBattle() ? 1 : 0, TRUE);
    PAL_CreateBox(PAL_XY(30, 50), 1, PAL_MenuTextMaxWidth(rgMenuItem, 2) - 1, 0, FALSE);
 
    //
@@ -595,27 +577,25 @@ PAL_BattleUIPlayerReady(
 
 --*/
 {
-#ifndef PAL_CLASSIC
-   WORD w = gpGlobals->rgParty[wPlayerIndex].wPlayerRole;
-#endif
-
    g_Battle.UI.wCurPlayerIndex = wPlayerIndex;
    g_Battle.UI.state = kBattleUISelectMove;
    g_Battle.UI.wSelectedAction = 0;
    g_Battle.UI.MenuState = kBattleMenuMain;
 
-#ifndef PAL_CLASSIC
-   //
-   // Play a sound which indicates the player is ready
-   //
-   if (gpGlobals->rgPlayerStatus[w][kStatusPuppet] == 0 &&
-      gpGlobals->rgPlayerStatus[w][kStatusSleep] == 0 &&
-      gpGlobals->rgPlayerStatus[w][kStatusConfused] == 0 &&
-      !g_Battle.UI.fAutoAttack && !gpGlobals->fAutoBattle)
+   if (!PAL_IsClassicBattle())
    {
-      AUDIO_PlaySound(78);
+	   WORD w = gpGlobals->rgParty[wPlayerIndex].wPlayerRole;
+	   //
+	   // Play a sound which indicates the player is ready
+	   //
+	   if (gpGlobals->rgPlayerStatus[w][kStatusPuppet] == 0 &&
+		   gpGlobals->rgPlayerStatus[w][kStatusSleep] == 0 &&
+		   gpGlobals->rgPlayerStatus[w][kStatusConfused] == 0 &&
+		   !g_Battle.UI.fAutoAttack && !gpGlobals->fAutoBattle)
+	   {
+		   AUDIO_PlaySound(78);
+	   }
    }
-#endif
 }
 
 static VOID
@@ -654,11 +634,7 @@ PAL_BattleUIUseItem(
          }
          else
          {
-#ifdef PAL_CLASSIC
-            g_Battle.UI.wSelectedIndex = 0;
-#else
-            g_Battle.UI.wSelectedIndex = g_Battle.UI.wCurPlayerIndex;
-#endif
+            g_Battle.UI.wSelectedIndex = PAL_IsClassicBattle() ? 0 : g_Battle.UI.wCurPlayerIndex;
             g_Battle.UI.state = kBattleUISelectTargetPlayer;
          }
       }
@@ -868,14 +844,12 @@ PAL_BattleUIUpdate(
       g_Battle.UI.MenuState = kBattleMenuMain;
    }
 
-#ifdef PAL_CLASSIC
-   if (g_Battle.Phase == kBattlePhasePerformAction)
+   if (PAL_IsClassicBattle() && g_Battle.Phase == kBattlePhasePerformAction)
    {
       goto end;
    }
 
-   if (!g_Battle.UI.fAutoAttack)
-#endif
+   if (!PAL_IsClassicBattle() || !g_Battle.UI.fAutoAttack)
    {
       //
       // Draw the player info boxes.
@@ -887,16 +861,17 @@ PAL_BattleUIUpdate(
 
          j = TIMEMETER_COLOR_DEFAULT;
 
-#ifndef PAL_CLASSIC
-         if (gpGlobals->rgPlayerStatus[wPlayerRole][kStatusHaste] > 0)
-         {
-            j = TIMEMETER_COLOR_HASTE;
-         }
-         else if (gpGlobals->rgPlayerStatus[wPlayerRole][kStatusSlow] > 0)
-         {
-            j = TIMEMETER_COLOR_SLOW;
-         }
-#endif
+		 if (!PAL_IsClassicBattle())
+		 {
+			 if (gpGlobals->rgPlayerStatus[wPlayerRole][kStatusHaste] > 0)
+			 {
+				 j = TIMEMETER_COLOR_HASTE;
+			 }
+			 else if (gpGlobals->rgPlayerStatus[wPlayerRole][kStatusParalyzedOrSlow] > 0)
+			 {
+				 j = TIMEMETER_COLOR_SLOW;
+			 }
+		 }
 
          if (gpGlobals->rgPlayerStatus[wPlayerRole][kStatusSleep] != 0 ||
             gpGlobals->rgPlayerStatus[wPlayerRole][kStatusConfused] != 0 ||
@@ -941,9 +916,9 @@ PAL_BattleUIUpdate(
       //
       // Cancel any actions if player is dead or sleeping.
       //
-      if (gpGlobals->g.PlayerRoles.rgwHP[wPlayerRole] == 0 ||
-         gpGlobals->rgPlayerStatus[wPlayerRole][kStatusSleep] != 0 ||
-         gpGlobals->rgPlayerStatus[wPlayerRole][kStatusParalyzed] != 0)
+      if (gpGlobals->g.PlayerRoles.rgwHP[wPlayerRole] == 0 || PAL_CheckRoleStatus(
+		  gpGlobals->rgPlayerStatus[wPlayerRole], 2, FALSE, TRUE,
+		  kStatusSleep, TRUE, kStatusParalyzedOrSlow, TRUE))
       {
          g_Battle.UI.wActionType = kBattleActionPass;
          PAL_BattleCommitAction(FALSE);
@@ -1135,11 +1110,7 @@ PAL_BattleUIUpdate(
                      }
                      else
                      {
-#ifdef PAL_CLASSIC
-                        g_Battle.UI.wSelectedIndex = 0;
-#else
-                        g_Battle.UI.wSelectedIndex = g_Battle.UI.wCurPlayerIndex;
-#endif
+                        g_Battle.UI.wSelectedIndex = PAL_IsClassicBattle() ? 0 : g_Battle.UI.wCurPlayerIndex;
                         g_Battle.UI.state = kBattleUISelectTargetPlayer;
                      }
                   }
@@ -1212,85 +1183,84 @@ PAL_BattleUIUpdate(
             {
                PAL_BattleCommitAction(TRUE);
             }
-#ifdef PAL_CLASSIC
             else if (g_InputState.dwKeyPress & kKeyMenu)
             {
-               g_Battle.rgPlayer[g_Battle.UI.wCurPlayerIndex].state = kFighterWait;
-               g_Battle.UI.state = kBattleUIWait;
-
-               if (g_Battle.UI.wCurPlayerIndex > 0)
-               {
-                  //
-                  // Revert to the previous player
-                  //
-                  do
-                  {
-                     g_Battle.rgPlayer[--g_Battle.UI.wCurPlayerIndex].state = kFighterWait;
-
-                     if (g_Battle.rgPlayer[g_Battle.UI.wCurPlayerIndex].action.ActionType == kBattleActionThrowItem)
-                     {
-                        for (i = 0; i < MAX_INVENTORY; i++)
-                        {
-                           if (gpGlobals->rgInventory[i].wItem ==
-                              g_Battle.rgPlayer[g_Battle.UI.wCurPlayerIndex].action.wActionID)
-                           {
-                              gpGlobals->rgInventory[i].nAmountInUse--;
-                              break;
-                           }
-                        }
-                     }
-                     else if (g_Battle.rgPlayer[g_Battle.UI.wCurPlayerIndex].action.ActionType == kBattleActionUseItem)
-                     {
-                        if (gpGlobals->g.rgObject[g_Battle.rgPlayer[g_Battle.UI.wCurPlayerIndex].action.wActionID].item.wFlags & kItemFlagConsuming)
-                        {
-                           for (i = 0; i < MAX_INVENTORY; i++)
-                           {
-                              if (gpGlobals->rgInventory[i].wItem ==
-                                 g_Battle.rgPlayer[g_Battle.UI.wCurPlayerIndex].action.wActionID)
-                              {
-                                 gpGlobals->rgInventory[i].nAmountInUse--;
-                                 break;
-                              }
-                           }
-                        }
-                     }
-                  } while (g_Battle.UI.wCurPlayerIndex > 0 &&
-                     (gpGlobals->g.PlayerRoles.rgwHP[gpGlobals->rgParty[g_Battle.UI.wCurPlayerIndex].wPlayerRole] == 0 ||
-                      gpGlobals->rgPlayerStatus[gpGlobals->rgParty[g_Battle.UI.wCurPlayerIndex].wPlayerRole][kStatusConfused] > 0 ||
-                      gpGlobals->rgPlayerStatus[gpGlobals->rgParty[g_Battle.UI.wCurPlayerIndex].wPlayerRole][kStatusSleep] > 0 ||
-                      gpGlobals->rgPlayerStatus[gpGlobals->rgParty[g_Battle.UI.wCurPlayerIndex].wPlayerRole][kStatusParalyzed] > 0));
-               }
-            }
-#else
-            else if (g_InputState.dwKeyPress & kKeyMenu)
-            {
-               float flMin = -1;
-               j = -1;
-
-               for (i = 0; i <= gpGlobals->wMaxPartyMemberIndex; i++)
-               {
-                  if (g_Battle.rgPlayer[i].flTimeMeter >= 100)
-                  {
-                     g_Battle.rgPlayer[i].flTimeMeter += 100; // HACKHACK: Prevent the time meter from going below 100
-
-                     if ((g_Battle.rgPlayer[i].flTimeMeter < flMin || flMin < 0) &&
-                        i != (int)g_Battle.UI.wCurPlayerIndex &&
-                        g_Battle.rgPlayer[i].state == kFighterWait)
-                     {
-                        flMin = g_Battle.rgPlayer[i].flTimeMeter;
-                        j = i;
-                     }
-                  }
-               }
-
-               if (j != -1)
-               {
-                  g_Battle.rgPlayer[g_Battle.UI.wCurPlayerIndex].flTimeMeter = flMin - 99;
-                  g_Battle.rgPlayer[g_Battle.UI.wCurPlayerIndex].state = kFighterWait;
-                  g_Battle.UI.state = kBattleUIWait;
-               }
+				if (PAL_IsClassicBattle())
+				{
+					g_Battle.rgPlayer[g_Battle.UI.wCurPlayerIndex].state = kFighterWait;
+					g_Battle.UI.state = kBattleUIWait;
+
+					if (g_Battle.UI.wCurPlayerIndex > 0)
+					{
+						//
+						// Revert to the previous player
+						//
+						do
+						{
+							g_Battle.rgPlayer[--g_Battle.UI.wCurPlayerIndex].state = kFighterWait;
+
+							if (g_Battle.rgPlayer[g_Battle.UI.wCurPlayerIndex].action.ActionType == kBattleActionThrowItem)
+							{
+								for (i = 0; i < MAX_INVENTORY; i++)
+								{
+									if (gpGlobals->rgInventory[i].wItem ==
+										g_Battle.rgPlayer[g_Battle.UI.wCurPlayerIndex].action.wActionID)
+									{
+										gpGlobals->rgInventory[i].nAmountInUse--;
+										break;
+									}
+								}
+							}
+							else if (g_Battle.rgPlayer[g_Battle.UI.wCurPlayerIndex].action.ActionType == kBattleActionUseItem)
+							{
+								if (gpGlobals->g.rgObject[g_Battle.rgPlayer[g_Battle.UI.wCurPlayerIndex].action.wActionID].item.wFlags & kItemFlagConsuming)
+								{
+									for (i = 0; i < MAX_INVENTORY; i++)
+									{
+										if (gpGlobals->rgInventory[i].wItem ==
+											g_Battle.rgPlayer[g_Battle.UI.wCurPlayerIndex].action.wActionID)
+										{
+											gpGlobals->rgInventory[i].nAmountInUse--;
+											break;
+										}
+									}
+								}
+							}
+						} while (g_Battle.UI.wCurPlayerIndex > 0 &&
+							(gpGlobals->g.PlayerRoles.rgwHP[gpGlobals->rgParty[g_Battle.UI.wCurPlayerIndex].wPlayerRole] == 0 || PAL_CheckRoleStatus(
+								gpGlobals->rgPlayerStatus[gpGlobals->rgParty[g_Battle.UI.wCurPlayerIndex].wPlayerRole], 3, FALSE, TRUE,
+								kStatusConfused, TRUE, kStatusSleep, TRUE, kStatusParalyzedOrSlow, TRUE)));
+					}
+				}
+				else
+				{
+					float flMin = -1;
+					j = -1;
+
+					for (i = 0; i <= gpGlobals->wMaxPartyMemberIndex; i++)
+					{
+						if (g_Battle.rgPlayer[i].flTimeMeter >= 100)
+						{
+							g_Battle.rgPlayer[i].flTimeMeter += 100; // HACKHACK: Prevent the time meter from going below 100
+
+							if ((g_Battle.rgPlayer[i].flTimeMeter < flMin || flMin < 0) &&
+								i != (int)g_Battle.UI.wCurPlayerIndex &&
+								g_Battle.rgPlayer[i].state == kFighterWait)
+							{
+								flMin = g_Battle.rgPlayer[i].flTimeMeter;
+								j = i;
+							}
+						}
+					}
+
+					if (j != -1)
+					{
+						g_Battle.rgPlayer[g_Battle.UI.wCurPlayerIndex].flTimeMeter = flMin - 99;
+						g_Battle.rgPlayer[g_Battle.UI.wCurPlayerIndex].state = kFighterWait;
+						g_Battle.UI.state = kBattleUIWait;
+					}
+				}
             }
-#endif
             break;
 
          case kBattleMenuMagicSelect:
@@ -1325,11 +1295,7 @@ PAL_BattleUIUpdate(
                      }
                      else
                      {
-#ifdef PAL_CLASSIC
-                        g_Battle.UI.wSelectedIndex = 0;
-#else
-                        g_Battle.UI.wSelectedIndex = g_Battle.UI.wCurPlayerIndex;
-#endif
+                        g_Battle.UI.wSelectedIndex = PAL_IsClassicBattle() ? 0 : g_Battle.UI.wCurPlayerIndex;
                         g_Battle.UI.state = kBattleUISelectTargetPlayer;
                      }
                   }
@@ -1354,32 +1320,20 @@ PAL_BattleUIUpdate(
 
                switch (w)
                {
-#ifdef PAL_CLASSIC
+               case 1: // auto
+                  g_Battle.UI.fAutoAttack = TRUE;
+                  break;
+
                case 2: // item
-#else
-               case 1: // item
-#endif
                   g_Battle.UI.MenuState = kBattleMenuMiscItemSubMenu;
                   g_iCurSubMenuItem = 0;
                   break;
 
-#ifdef PAL_CLASSIC
                case 3: // defend
-#else
-               case 2: // defend
-#endif
                   g_Battle.UI.wActionType = kBattleActionDefend;
                   PAL_BattleCommitAction(FALSE);
                   break;
 
-#ifdef PAL_CLASSIC
-               case 1: // auto
-#else
-               case 3: // auto
-#endif
-                  g_Battle.UI.fAutoAttack = TRUE;
-                  break;
-
                case 4: // flee
                   g_Battle.UI.wActionType = kBattleActionFlee;
                   PAL_BattleCommitAction(FALSE);
@@ -1445,17 +1399,16 @@ PAL_BattleUIUpdate(
          }
       }
 
-#ifdef PAL_CLASSIC
       //
       // Don't bother selecting when only 1 enemy left
       //
-      if (y == 1)
+      if (PAL_IsClassicBattle() && y == 1)
       {
          g_Battle.UI.wPrevEnemyTarget = (WORD)x;
          PAL_BattleCommitAction(FALSE);
          break;
       }
-#endif
+
       if (g_Battle.UI.wSelectedIndex > x)
       {
          g_Battle.UI.wSelectedIndex = x;
@@ -1524,16 +1477,17 @@ PAL_BattleUIUpdate(
       break;
 
    case kBattleUISelectTargetPlayer:
-#ifdef PAL_CLASSIC
-      //
-      // Don't bother selecting when only 1 player is in the party
-      //
-      if (gpGlobals->wMaxPartyMemberIndex == 0)
-      {
-         g_Battle.UI.wSelectedIndex = 0;
-         PAL_BattleCommitAction(FALSE);
-      }
-#endif
+	   if (PAL_IsClassicBattle())
+	   {
+		   //
+		   // Don't bother selecting when only 1 player is in the party
+		   //
+		   if (gpGlobals->wMaxPartyMemberIndex == 0)
+		   {
+			   g_Battle.UI.wSelectedIndex = 0;
+			   PAL_BattleCommitAction(FALSE);
+		   }
+	   }
 
       j = SPRITENUM_BATTLE_ARROW_SELECTEDPLAYER;
       if (s_iFrame & 1)
@@ -1583,101 +1537,107 @@ PAL_BattleUIUpdate(
       break;
 
    case kBattleUISelectTargetEnemyAll:
-#ifdef PAL_CLASSIC
-      //
-      // Don't bother selecting
-      //
-      g_Battle.UI.wSelectedIndex = (WORD)-1;
-      PAL_BattleCommitAction(FALSE);
-#else
-      if (g_Battle.UI.wActionType == kBattleActionCoopMagic)
-      {
-         if (!PAL_BattleUIIsActionValid(kBattleActionCoopMagic))
-         {
-            g_Battle.UI.state = kBattleUISelectMove;
-            break;
-         }
-      }
-
-      if (s_iFrame & 1)
-      {
-         //
-         // Highlight all enemies
-         //
-         for (i = g_Battle.wMaxEnemyIndex; i >= 0; i--)
-         {
-            if (g_Battle.rgEnemy[i].wObjectID == 0)
-            {
-               continue;
-            }
-
-            x = PAL_X(g_Battle.rgEnemy[i].pos);
-            y = PAL_Y(g_Battle.rgEnemy[i].pos);
-
-            x -= PAL_RLEGetWidth(PAL_SpriteGetFrame(g_Battle.rgEnemy[i].lpSprite, g_Battle.rgEnemy[i].wCurrentFrame)) / 2;
-            y -= PAL_RLEGetHeight(PAL_SpriteGetFrame(g_Battle.rgEnemy[i].lpSprite, g_Battle.rgEnemy[i].wCurrentFrame));
-
-            PAL_RLEBlitWithColorShift(PAL_SpriteGetFrame(g_Battle.rgEnemy[i].lpSprite, g_Battle.rgEnemy[i].wCurrentFrame),
-               gpScreen, PAL_XY(x, y), 7);
-         }
-      }
-      if (g_InputState.dwKeyPress & kKeyMenu)
-      {
-         g_Battle.UI.state = kBattleUISelectMove;
-      }
-      else if (g_InputState.dwKeyPress & kKeySearch)
-      {
-         g_Battle.UI.wSelectedIndex = (WORD)-1;
-         PAL_BattleCommitAction(FALSE);
-      }
-#endif
+	   if (PAL_IsClassicBattle())
+	   {
+		   //
+		   // Don't bother selecting
+		   //
+		   g_Battle.UI.wSelectedIndex = (WORD)-1;
+		   PAL_BattleCommitAction(FALSE);
+	   }
+	   else
+	   {
+		   if (g_Battle.UI.wActionType == kBattleActionCoopMagic)
+		   {
+			   if (!PAL_BattleUIIsActionValid(kBattleActionCoopMagic))
+			   {
+				   g_Battle.UI.state = kBattleUISelectMove;
+				   break;
+			   }
+		   }
+
+		   if (s_iFrame & 1)
+		   {
+			   //
+			   // Highlight all enemies
+			   //
+			   for (i = g_Battle.wMaxEnemyIndex; i >= 0; i--)
+			   {
+				   if (g_Battle.rgEnemy[i].wObjectID == 0)
+				   {
+					   continue;
+				   }
+
+				   x = PAL_X(g_Battle.rgEnemy[i].pos);
+				   y = PAL_Y(g_Battle.rgEnemy[i].pos);
+
+				   x -= PAL_RLEGetWidth(PAL_SpriteGetFrame(g_Battle.rgEnemy[i].lpSprite, g_Battle.rgEnemy[i].wCurrentFrame)) / 2;
+				   y -= PAL_RLEGetHeight(PAL_SpriteGetFrame(g_Battle.rgEnemy[i].lpSprite, g_Battle.rgEnemy[i].wCurrentFrame));
+
+				   PAL_RLEBlitWithColorShift(PAL_SpriteGetFrame(g_Battle.rgEnemy[i].lpSprite, g_Battle.rgEnemy[i].wCurrentFrame),
+					   gpScreen, PAL_XY(x, y), 7);
+			   }
+		   }
+		   if (g_InputState.dwKeyPress & kKeyMenu)
+		   {
+			   g_Battle.UI.state = kBattleUISelectMove;
+		   }
+		   else if (g_InputState.dwKeyPress & kKeySearch)
+		   {
+			   g_Battle.UI.wSelectedIndex = (WORD)-1;
+			   PAL_BattleCommitAction(FALSE);
+		   }
+	   }
       break;
 
    case kBattleUISelectTargetPlayerAll:
-#ifdef PAL_CLASSIC
-      //
-      // Don't bother selecting
-      //
-      g_Battle.UI.wSelectedIndex = (WORD)-1;
-      PAL_BattleCommitAction(FALSE);
-#else
-      j = SPRITENUM_BATTLE_ARROW_SELECTEDPLAYER;
-      if (s_iFrame & 1)
-      {
-         j = SPRITENUM_BATTLE_ARROW_SELECTEDPLAYER_RED;
-      }
-      for (i = 0; i <= gpGlobals->wMaxPartyMemberIndex; i++)
-      {
-         if (g_Battle.UI.wActionType == kBattleActionMagic)
-         {
-            w = gpGlobals->g.rgObject[g_Battle.UI.wObjectID].magic.wMagicNumber;
-
-            if (gpGlobals->g.lprgMagic[w].wType == kMagicTypeTrance)
-            {
-               if (i != g_Battle.UI.wCurPlayerIndex)
-                  continue;
-            }
-         }
-
-         //
-         // Draw arrows on all players, despite of dead or not
-         //
-         x = g_rgPlayerPos[gpGlobals->wMaxPartyMemberIndex][i][0] - 8;
-         y = g_rgPlayerPos[gpGlobals->wMaxPartyMemberIndex][i][1] - 67;
-
-         PAL_RLEBlitToSurface(PAL_SpriteGetFrame(gpSpriteUI, j), gpScreen, PAL_XY(x, y));
-      }
-
-      if (g_InputState.dwKeyPress & kKeyMenu)
-      {
-         g_Battle.UI.state = kBattleUISelectMove;
-      }
-      else if (g_InputState.dwKeyPress & kKeySearch)
-      {
-         g_Battle.UI.wSelectedIndex = (WORD)-1;
-         PAL_BattleCommitAction(FALSE);
-      }
-#endif
+	   if (PAL_IsClassicBattle())
+	   {
+		   //
+		   // Don't bother selecting
+		   //
+		   g_Battle.UI.wSelectedIndex = (WORD)-1;
+		   PAL_BattleCommitAction(FALSE);
+	   }
+	   else
+	   {
+		   j = SPRITENUM_BATTLE_ARROW_SELECTEDPLAYER;
+		   if (s_iFrame & 1)
+		   {
+			   j = SPRITENUM_BATTLE_ARROW_SELECTEDPLAYER_RED;
+		   }
+		   for (i = 0; i <= gpGlobals->wMaxPartyMemberIndex; i++)
+		   {
+			   if (g_Battle.UI.wActionType == kBattleActionMagic)
+			   {
+				   w = gpGlobals->g.rgObject[g_Battle.UI.wObjectID].magic.wMagicNumber;
+
+				   if (gpGlobals->g.lprgMagic[w].wType == kMagicTypeTrance)
+				   {
+					   if (i != g_Battle.UI.wCurPlayerIndex)
+						   continue;
+				   }
+			   }
+
+			   //
+			   // Draw arrows on all players, despite of dead or not
+			   //
+			   x = g_rgPlayerPos[gpGlobals->wMaxPartyMemberIndex][i][0] - 8;
+			   y = g_rgPlayerPos[gpGlobals->wMaxPartyMemberIndex][i][1] - 67;
+
+			   PAL_RLEBlitToSurface(PAL_SpriteGetFrame(gpSpriteUI, j), gpScreen, PAL_XY(x, y));
+		   }
+
+		   if (g_InputState.dwKeyPress & kKeyMenu)
+		   {
+			   g_Battle.UI.state = kBattleUISelectMove;
+		   }
+		   else if (g_InputState.dwKeyPress & kKeySearch)
+		   {
+			   g_Battle.UI.wSelectedIndex = (WORD)-1;
+			   PAL_BattleCommitAction(FALSE);
+		   }
+	   }
       break;
    }
 
@@ -1685,37 +1645,38 @@ end:
    //
    // Show the text message if there is one.
    //
-#ifndef PAL_CLASSIC
-   if (!SDL_TICKS_PASSED(SDL_GetTicks(), g_Battle.UI.dwMsgShowTime))
-   {
-      //
-      // The text should be shown in a small window at the center of the screen
-      //
-      PAL_POS    pos;
-	  int        i, w = wcslen(g_Battle.UI.szMsg), len = 0;
-
-	  for (i = 0; i < w; i++)
-		  len += PAL_CharWidth(g_Battle.UI.szMsg[i]) >> 3;
-
-      //
-      // Create the window box
-      //
-      pos = PAL_XY(160 - len * 4, 40);
-      PAL_CreateSingleLineBox(pos, (len + 1) / 2, FALSE);
-
-      //
-      // Show the text on the screen
-      //
-      pos = PAL_XY(PAL_X(pos) + 8 + ((len & 1) << 2), PAL_Y(pos) + 10);
-      PAL_DrawText(g_Battle.UI.szMsg, pos, 0, FALSE, FALSE, FALSE);
-   }
-   else if (g_Battle.UI.szNextMsg[0] != '\0')
+   if (!PAL_IsClassicBattle())
    {
-      wcscpy(g_Battle.UI.szMsg, g_Battle.UI.szNextMsg);
-      g_Battle.UI.dwMsgShowTime = SDL_GetTicks() + g_Battle.UI.wNextMsgDuration;
-      g_Battle.UI.szNextMsg[0] = '\0';
+	   if (!SDL_TICKS_PASSED(SDL_GetTicks(), g_Battle.UI.dwMsgShowTime))
+	   {
+		   //
+		   // The text should be shown in a small window at the center of the screen
+		   //
+		   PAL_POS    pos;
+		   int        i, w = wcslen(g_Battle.UI.szMsg), len = 0;
+
+		   for (i = 0; i < w; i++)
+			   len += PAL_CharWidth(g_Battle.UI.szMsg[i]) >> 3;
+
+		   //
+		   // Create the window box
+		   //
+		   pos = PAL_XY(160 - len * 4, 40);
+		   PAL_CreateSingleLineBox(pos, (len + 1) / 2, FALSE);
+
+		   //
+		   // Show the text on the screen
+		   //
+		   pos = PAL_XY(PAL_X(pos) + 8 + ((len & 1) << 2), PAL_Y(pos) + 10);
+		   PAL_DrawText(g_Battle.UI.szMsg, pos, 0, FALSE, FALSE, FALSE);
+	   }
+	   else if (g_Battle.UI.szNextMsg[0] != '\0')
+	   {
+		   wcscpy(g_Battle.UI.szMsg, g_Battle.UI.szNextMsg);
+		   g_Battle.UI.dwMsgShowTime = SDL_GetTicks() + g_Battle.UI.wNextMsgDuration;
+		   g_Battle.UI.szNextMsg[0] = '\0';
+	   }
    }
-#endif
 
    //
    // Draw the numbers

+ 18 - 25
uigame.c

@@ -386,8 +386,6 @@ PAL_SwitchMenu(
    return (wReturnValue == MENUITEM_VALUE_CANCELLED) ? fEnabled : ((wReturnValue == 0) ? FALSE : TRUE);
 }
 
-#ifndef PAL_CLASSIC
-
 static VOID
 PAL_BattleSpeedMenu(
    VOID
@@ -409,27 +407,27 @@ PAL_BattleSpeedMenu(
 {
    LPBOX           lpBox;
    WORD            wReturnValue;
-   const SDL_Rect  rect = {131, 100, 165, 50};
-
-   MENUITEM        rgMenuItem[5] = {
-      { 1,   BATTLESPEEDMENU_LABEL_1,       TRUE,   PAL_XY(145, 110) },
-      { 2,   BATTLESPEEDMENU_LABEL_2,       TRUE,   PAL_XY(170, 110) },
-      { 3,   BATTLESPEEDMENU_LABEL_3,       TRUE,   PAL_XY(195, 110) },
-      { 4,   BATTLESPEEDMENU_LABEL_4,       TRUE,   PAL_XY(220, 110) },
-      { 5,   BATTLESPEEDMENU_LABEL_5,       TRUE,   PAL_XY(245, 110) },
+   const SDL_Rect  rect = {131, 100, 190, 50};
+
+   MENUITEM        rgMenuItem[6] = {
+      { 0,   SWITCHMENU_LABEL_DISABLE,      TRUE,   PAL_XY(140, 110) },
+      { 1,   BATTLESPEEDMENU_LABEL_1,       TRUE,   PAL_XY(165, 110) },
+      { 2,   BATTLESPEEDMENU_LABEL_2,       TRUE,   PAL_XY(190, 110) },
+      { 3,   BATTLESPEEDMENU_LABEL_3,       TRUE,   PAL_XY(215, 110) },
+      { 4,   BATTLESPEEDMENU_LABEL_4,       TRUE,   PAL_XY(240, 110) },
+      { 5,   BATTLESPEEDMENU_LABEL_5,       TRUE,   PAL_XY(265, 110) },
    };
 
    //
    // Create the boxes
    //
-   lpBox = PAL_CreateSingleLineBox(PAL_XY(131, 100), 8, TRUE);
+   lpBox = PAL_CreateSingleLineBox(PAL_XY(131, 100), 9, TRUE);
    VIDEO_UpdateScreen(&rect);
 
    //
    // Activate the menu
    //
-   wReturnValue = PAL_ReadMenu(NULL, rgMenuItem, 5, gpGlobals->bBattleSpeed - 1,
-      MENUITEM_COLOR);
+   wReturnValue = PAL_ReadMenu(NULL, rgMenuItem, 6, gpGlobals->bBattleSpeed, MENUITEM_COLOR);
 
    //
    // Delete the boxes
@@ -441,11 +439,10 @@ PAL_BattleSpeedMenu(
    if (wReturnValue != MENUITEM_VALUE_CANCELLED)
    {
       gpGlobals->bBattleSpeed = wReturnValue;
+	  gConfig.fClassicBattle = (gpGlobals->bBattleSpeed == 0);
    }
 }
 
-#endif
-
 LPBOX
 PAL_ShowCash(
    DWORD      dwCash
@@ -546,10 +543,8 @@ PAL_SystemMenu(
       { 2,      SYSMENU_LABEL_LOAD,          TRUE,     PAL_XY(53, 72 + 18) },
       { 3,      SYSMENU_LABEL_MUSIC,         TRUE,     PAL_XY(53, 72 + 36) },
       { 4,      SYSMENU_LABEL_SOUND,         TRUE,     PAL_XY(53, 72 + 54) },
-      { 5,      SYSMENU_LABEL_QUIT,          TRUE,     PAL_XY(53, 72 + 72) },
-#if !defined(PAL_CLASSIC)
-      { 6,      SYSMENU_LABEL_BATTLEMODE,    TRUE,     PAL_XY(53, 72 + 90) },
-#endif
+      { 5,      SYSMENU_LABEL_BATTLEMODE,    TRUE,     PAL_XY(53, 72 + 72) },
+      { 6,      SYSMENU_LABEL_QUIT,          TRUE,     PAL_XY(53, 72 + 90) },
    };
    const int           nSystemMenuItem = sizeof(rgSystemMenuItem) / sizeof(MENUITEM);
 
@@ -639,19 +634,17 @@ PAL_SystemMenu(
 
    case 5:
       //
-      // Quit
+      // Battle Mode
       //
-      PAL_QuitGame();
+      PAL_BattleSpeedMenu();
       break;
 
-#if !defined(PAL_CLASSIC)
    case 6:
       //
-      // Battle Mode
+      // Quit
       //
-      PAL_BattleSpeedMenu();
+      PAL_QuitGame();
       break;
-#endif
    }
 
    PAL_DeleteBox(lpMenuBox);