Browse Source

fixed SDL1 compile error.

Wei Mingzhi 9 years ago
parent
commit
877d8a7f35
4 changed files with 26 additions and 7 deletions
  1. 2 2
      ending.c
  2. 5 1
      palcommon.c
  3. 10 2
      sdlpal.dsp
  4. 9 2
      sound.c

+ 2 - 2
ending.c

@@ -413,8 +413,8 @@ PAL_EndingAnimation(
          SDL_SetSurfacePalette(pUpper, gpScreen->format->palette);
          SDL_SetSurfacePalette(pLower, gpScreen->format->palette);
 #else
-         SDL_SetSurfacePalette(pUpper, SDL_LOGPAL | SDL_PHYSPAL, VIDEO_GetPalette(), 0, 256);
-         SDL_SetSurfacePalette(pLower, SDL_LOGPAL | SDL_PHYSPAL, VIDEO_GetPalette(), 0, 256);
+         SDL_SetPalette(pUpper, SDL_LOGPAL | SDL_PHYSPAL, VIDEO_GetPalette(), 0, 256);
+         SDL_SetPalette(pLower, SDL_LOGPAL | SDL_PHYSPAL, VIDEO_GetPalette(), 0, 256);
 #endif
       }
 

+ 5 - 1
palcommon.c

@@ -641,7 +641,11 @@ PAL_SpriteGetFrame(
    // Get the offset of the frame
    //
    iFrameNum <<= 1;
+#ifdef PAL_WIN95
+   offset = ((lpSprite[iFrameNum] | (lpSprite[iFrameNum + 1] << 8)) << 1);
+#else
    offset = (WORD)((lpSprite[iFrameNum] | (lpSprite[iFrameNum + 1] << 8)) << 1);
+#endif
    return &lpSprite[offset];
 }
 
@@ -862,7 +866,7 @@ PAL_MKFGetDecompressedSize(
    //
    fseek(fp, uiOffset, SEEK_SET);
 #ifdef PAL_WIN95
-   fread(buf, sizeof(DWORD), 2, fp);
+   fread(buf, sizeof(DWORD), 1, fp);
    buf[0] = SWAP32(buf[0]);
 
    return (INT)buf[0];

+ 10 - 2
sdlpal.dsp

@@ -70,7 +70,7 @@ LINK32=link.exe
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "d:\sdl\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "d:\sdl\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /YX /FD /GZ /Zm200 /c
 # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
 # ADD BASE RSC /l 0x804 /d "_DEBUG"
@@ -80,7 +80,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib sdl.lib sdlmain.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"d:\sdl\lib"
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib sdl.lib sdlmain.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"d:\sdl\lib\\"
 
 !ENDIF 
 
@@ -221,6 +221,10 @@ SOURCE=.\battle.h
 # End Source File
 # Begin Source File
 
+SOURCE=.\big5font.h
+# End Source File
+# Begin Source File
+
 SOURCE=.\common.h
 # End Source File
 # Begin Source File
@@ -241,6 +245,10 @@ SOURCE=.\game.h
 # End Source File
 # Begin Source File
 
+SOURCE=.\gbfont.h
+# End Source File
+# Begin Source File
+
 SOURCE=.\getopt.h
 # End Source File
 # Begin Source File

+ 9 - 2
sound.c

@@ -617,8 +617,15 @@ SOUND_PlayChannel(
       free(bufdec);
       return;
    }
-   memcpy(wavecvt.buf, bufdec, wavespec.size);
-   free(bufdec);
+   memcpy(wavecvt.buf, bufdec, wavespec.size);
+   if (g_fUseWav)
+   {
+      SDL_FreeWAV(bufdec);
+   }
+   else
+   {
+      free(bufdec);
+   }
 
    //
    // Run the audio converter