ref: ee35eec9bac04ce55e5fe1ae1eeb5428b47d91a8
parent: 15a890dd25b44d41aeee5ef02e40dc57d643b479
author: Jacob Moody <moody@posixcafe.org>
date: Thu Feb 9 23:26:53 EST 2023
compiles
--- a/src/HashTable.c
+++ b/src/HashTable.c
@@ -120,4 +120,4 @@
}
return hashTable->table[index]->data;
-}
\ No newline at end of file
+}
--- a/src/dosutil.c
+++ b/src/dosutil.c
@@ -26,6 +26,39 @@
int _argc;
char **_argv;
+#if defined(__plan9__)
+
+long filelength(int handle)
+{
+ Dir *d;
+ long x;
+
+ d = dirfstat(handle);
+ assert(d != nil);
+ x = d->length;
+ free(d);
+ return x;
+}
+
+char *ultoa(unsigned long value, char *string, int radix)
+{
+ switch (radix) {
+ case 10:
+ sprintf(string, "%lu", value);
+ break;
+ case 16:
+ sprintf(string, "%lux", value);
+ break;
+ default:
+ STUB_FUNCTION;
+ break;
+ }
+
+ return string;
+}
+
+#endif
+
#if PLATFORM_UNIX
long filelength(int handle)
{
@@ -232,7 +265,7 @@
printf ("\033[m");
}
-#if !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__ANDROID__)
+#if !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__ANDROID__) && !defined(__plan9__)
#include <execinfo.h>
void print_stack (int level)
--- a/src/dukemusc.c
+++ b/src/dukemusc.c
@@ -268,17 +268,17 @@
int MUSIC_StopSong(void)
{
//if (!fx_initialized)
- if (!Mix_QuerySpec(NULL, NULL, NULL))
- {
+ //if (!Mix_QuerySpec(NULL, NULL, NULL))
+ // {
setErrorMessage("Need FX system initialized, too. Sorry.");
return(MUSIC_Error);
- } // if
+ // } // if
if ( (Mix_PlayingMusic()) || (Mix_PausedMusic()) )
Mix_HaltMusic();
- if (music_musicchunk)
- Mix_FreeMusic(music_musicchunk);
+ // if (music_musicchunk)
+ // Mix_FreeMusic(music_musicchunk);
music_songdata = NULL;
music_musicchunk = NULL;
@@ -398,10 +398,10 @@
music_songdata = song;
// finally, we can load it with SDL_mixer
- music_musicchunk = Mix_LoadMUS(filename);
- if (music_musicchunk == NULL) {
+ // music_musicchunk = Mix_LoadMUS(filename);
+ //if (music_musicchunk == NULL) {
return MUSIC_Error;
- }
+ //}
Mix_PlayMusic(music_musicchunk, (loopflag == MUSIC_PlayOnce) ? 0 : -1);
@@ -455,7 +455,7 @@
int MUSIC_FadeVolume(int tovolume, int milliseconds)
{
- Mix_FadeOutMusic(milliseconds);
+// Mix_FadeOutMusic(milliseconds);
return(MUSIC_Ok);
} // MUSIC_FadeVolume
@@ -462,7 +462,8 @@
int MUSIC_FadeActive(void)
{
- return((Mix_FadingMusic() == MIX_FADING_OUT) ? __FX_TRUE : __FX_FALSE);
+ //return((Mix_FadingMusic() == MIX_FADING_OUT) ? __FX_TRUE : __FX_FALSE);
+ return 0;
} // MUSIC_FadeActive
--- /dev/null
+++ b/src/mkfile
@@ -1,0 +1,163 @@
+</$objtype/mkfile
+
+CFLAGS=-Fpw -I/sys/include/npe -I/sys/include/npe/SDL2 -D__plan9__ -D__${objtype}__ -DUSE_SDL
+TARG=games/rott
+
+LIB=\
+ ../../duke3d/Game/src/audiolib/libaudio.a\
+
+
+OFILES=\
+ HashTable.$O \
+ byteordr.$O \
+ cin_actr.$O \
+ cin_efct.$O \
+ cin_evnt.$O \
+ cin_glob.$O \
+ cin_main.$O \
+ cin_util.$O \
+ dosutil.$O \
+ dukemusc.$O \
+ engine.$O \
+ isr.$O \
+ modexlib.$O \
+ queue.$O \
+ rt_actor.$O \
+ rt_battl.$O \
+ rt_build.$O \
+ rt_cfg.$O \
+ rt_com.$O \
+ rt_crc.$O \
+ rt_debug.$O \
+ rt_dmand.$O \
+ rt_door.$O \
+ rt_draw.$O \
+ rt_err.$O \
+ rt_floor.$O \
+ rt_game.$O \
+ rt_in.$O \
+ rt_main.$O \
+ rt_map.$O \
+ rt_menu.$O \
+ rt_msg.$O \
+ rt_net.$O \
+ rt_playr.$O \
+ rt_rand.$O \
+ rt_scale.$O \
+ rt_sound.$O \
+ rt_sqrt.$O \
+ rt_stat.$O \
+ rt_state.$O \
+ rt_str.$O \
+ rt_ted.$O \
+ rt_util.$O \
+ rt_vid.$O \
+ rt_view.$O \
+ scriplib.$O \
+ w_wad.$O \
+ watcom.$O \
+ winrott.$O \
+ z_zone.$O \
+
+HFILES=\
+ HashTable.h \
+ WinRott.h \
+ _engine.h \
+ _isr.h \
+ _rt_acto.h \
+ _rt_buil.h \
+ _rt_com.h \
+ _rt_dman.h \
+ _rt_door.h \
+ _rt_draw.h \
+ _rt_floo.h \
+ _rt_game.h \
+ _rt_in.h \
+ _rt_main.h \
+ _rt_map.h \
+ _rt_menu.h \
+ _rt_msg.h \
+ _rt_net.h \
+ _rt_play.h \
+ _rt_rand.h \
+ _rt_scal.h \
+ _rt_soun.h \
+ _rt_stat.h \
+ _rt_str.h \
+ _rt_ted.h \
+ _rt_util.h \
+ _rt_vid.h \
+ _w_wad.h \
+ _z_zone.h \
+ byteordr.h \
+ cin_actr.h \
+ cin_def.h \
+ cin_efct.h \
+ cin_evnt.h \
+ cin_glob.h \
+ cin_main.h \
+ cin_util.h \
+ develop.h \
+ engine.h \
+ f_scale.h \
+ fx_man.h \
+ gmove.h \
+ isr.h \
+ keyb.h \
+ lumpy.h \
+ modexlib.h \
+ music.h \
+ myprint.h \
+ profile.h \
+ queue.h \
+ rottnet.h \
+ rt_actor.h \
+ rt_battl.h \
+ rt_build.h \
+ rt_cfg.h \
+ rt_com.h \
+ rt_crc.h \
+ rt_debug.h \
+ rt_def.h \
+ rt_dmand.h \
+ rt_door.h \
+ rt_dr_a.h \
+ rt_draw.h \
+ rt_error.h \
+ rt_fc_a.h \
+ rt_floor.h \
+ rt_game.h \
+ rt_in.h \
+ rt_main.h \
+ rt_map.h \
+ rt_menu.h \
+ rt_msg.h \
+ rt_net.h \
+ rt_playr.h \
+ rt_rand.h \
+ rt_sc_a.h \
+ rt_scale.h \
+ rt_sound.h \
+ rt_sqrt.h \
+ rt_stat.h \
+ rt_str.h \
+ rt_table.h \
+ rt_ted.h \
+ rt_util.h \
+ rt_vh_a.h \
+ rt_vid.h \
+ rt_view.h \
+ scriplib.h \
+ snd_reg.h \
+ snd_shar.h \
+ sndcards.h \
+ sprites.h \
+ states.h \
+ task_man.h \
+ version.h \
+ w_wad.h \
+ watcom.h \
+ z_zone.h \
+
+</sys/src/cmd/mkone
+
--- a/src/modexlib.c
+++ b/src/modexlib.c
@@ -24,7 +24,7 @@
#include <ctype.h>
#include <stdlib.h>
#include <sys/stat.h>
-#include <SDL2/SDL_video.h>
+#include <SDL2/SDL.h>
#include "modexlib.h"
#include "rt_util.h"
#include "rt_net.h" // for GamePaused
@@ -36,7 +36,7 @@
//#include <SDL2/SDL_image.h>
-static void StretchMemPicture ();
+static void StretchMemPicture (void);
// GLOBAL VARIABLES
boolean StretchScreen=0;//bn�++
@@ -76,7 +76,7 @@
char *bufofsTopLimit;
char *bufofsBottomLimit;
-void DrawCenterAim ();
+void DrawCenterAim (void);
#ifndef STUB_FUNCTION
@@ -120,7 +120,7 @@
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
- sdl_texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ABGR8888,
+ sdl_texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888,
SDL_TEXTUREACCESS_STREAMING, iGLOBAL_SCREENWIDTH,
iGLOBAL_SCREENHEIGHT);
@@ -143,6 +143,7 @@
*/
void SetTextMode ( void )
{
+/*
if (SDL_WasInit(SDL_INIT_VIDEO) == SDL_INIT_VIDEO) {
if (sdl_surface != NULL) {
SDL_FreeSurface(sdl_surface);
@@ -149,9 +150,10 @@
sdl_surface = NULL;
}
+*/
SDL_QuitSubSystem (SDL_INIT_VIDEO);
- }
+// }
}
/*
@@ -270,9 +272,11 @@
memset (sdl_surface->pixels, color, iGLOBAL_SCREENWIDTH*iGLOBAL_SCREENHEIGHT);
}
+/*
void RescaleAreaOfTexture(SDL_Renderer* renderer, SDL_Texture * source, SDL_Rect src, SDL_Rect dest)
{
- SDL_Texture * sourceToResize = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, src.w, src.h);
+ SDL_Texture * sourceToResize = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, src.w, src.h);
+ SDL_
SDL_SetRenderTarget(renderer, sourceToResize);
SDL_RenderCopy(renderer, source, &src, NULL);
// the folowing line should reset the target to default(the screen)
@@ -281,6 +285,7 @@
SDL_RenderCopy(renderer, sourceToResize, NULL, &dest);
SDL_DestroyTexture(sourceToResize);
}
+*/
int hudRescaleFactor = 1;
@@ -298,6 +303,7 @@
SDL_RenderCopy(renderer, newTex, NULL, NULL);
+/*
if (!StretchScreen && hudRescaleFactor > 1 && doRescaling)
{
if(SHOW_TOP_STATUS_BAR())
@@ -308,6 +314,7 @@
(SDL_Rect) {(iGLOBAL_SCREENWIDTH - (320* hudRescaleFactor)) >> 1, iGLOBAL_SCREENHEIGHT - 16*hudRescaleFactor, 320*hudRescaleFactor, 16*hudRescaleFactor}); //Bottom Bar
}
+*/
SDL_RenderPresent(renderer);
@@ -320,11 +327,11 @@
void VH_UpdateScreen (void)
{
- if (StretchScreen) { //bna++
- StretchMemPicture ();
- } else {
+// if (StretchScreen) { //bna++
+// StretchMemPicture ();
+// } else {
DrawCenterAim ();
- }
+// }
RenderSurface();
@@ -341,11 +348,11 @@
void XFlipPage ( void )
{
- if (StretchScreen) { //bna++
- StretchMemPicture ();
- } else {
+// if (StretchScreen) { //bna++
+// StretchMemPicture ();
+// } else {
DrawCenterAim ();
- }
+// }
RenderSurface();
}
@@ -398,7 +405,7 @@
}
// bna section -------------------------------------------
-static void StretchMemPicture ()
+static void StretchMemPicture (void)
{
SDL_Rect src;
SDL_Rect dest;
@@ -412,7 +419,7 @@
dest.y = 0;
dest.w = iGLOBAL_SCREENWIDTH;
dest.h = iGLOBAL_SCREENHEIGHT;
- SDL_SoftStretch(unstretch_sdl_surface, &src, sdl_surface, &dest);
+ //SDL_SoftStretch(unstretch_sdl_surface, &src, sdl_surface, &dest);
SDL_RenderSetLogicalSize(renderer, 320, 200); //help keep aspect ratio of menus so that the game doesn't look stretched
}
@@ -422,7 +429,7 @@
extern exit_t playstate;
int iG_playerTilt;
-void DrawCenterAim ()
+void DrawCenterAim (void)
{
int x;
@@ -525,7 +532,8 @@
output.y = (iGLOBAL_SCREENHEIGHT - output.h)>>1;
- SDL_RenderCopyEx(renderer, tex, NULL, &output, angle, NULL, SDL_FLIP_NONE);
+ //SDL_RenderCopyEx(renderer, tex, NULL, &output, angle, NULL, SDL_FLIP_NONE);
+ SDL_RenderCopy(renderer, tex, NULL, NULL);
SDL_RenderPresent(renderer);
--- a/src/rt_cfg.c
+++ b/src/rt_cfg.c
@@ -1454,7 +1454,7 @@
}
GetPathFromEnvironment( filename, ApogeePath, SoundName );
- file = open( filename, O_RDWR | O_TEXT | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR );
+ file = open( filename, O_RDWR | O_TEXT | O_CREAT | O_TRUNC);
//file = open ( filename, O_RDWR | O_TEXT | O_CREAT | O_TRUNC );
@@ -1570,7 +1570,7 @@
GetPathFromEnvironment( filename, ApogeePath, ConfigName );
- file = open( filename, O_RDWR | O_TEXT | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR );
+ file = open( filename, O_RDWR | O_TEXT | O_CREAT | O_TRUNC);
//file = open( filename,O_RDWR | O_TEXT | O_CREAT | O_TRUNC );
--- a/src/rt_def.h
+++ b/src/rt_def.h
@@ -26,7 +26,7 @@
#include "develop.h"
#define SAVE_SCREEN 1
-#if PLATFORM_UNIX
+#if PLATFORM_UNIX || defined(__plan9__)
#include <unistd.h>
#include <sys/types.h>
#include <limits.h>
@@ -44,6 +44,8 @@
#define F_OK 0
#elif (defined __GNUC__)
#define __int64 long long
+#elif (defined __plan9__)
+#define __int64 vlong
#else
#error please define your platform.
#endif
@@ -51,7 +53,7 @@
#if PLATFORM_WIN32
#define PATH_SEP_CHAR '\\'
#define PATH_SEP_STR "\\"
-#elif PLATFORM_UNIX
+#elif PLATFORM_UNIX || defined(__plan9__)
#define PATH_SEP_CHAR '/'
#define PATH_SEP_STR "/"
#define ROOTDIR "/"
@@ -116,7 +118,7 @@
#if PLATFORM_WIN32
#define strcmpi(x, y) stricmp(x, y)
#define _fstricmp(x, y) stricmp(x, y)
-#elif PLATFORM_UNIX
+#elif PLATFORM_UNIX || defined(__plan9__)
#ifndef strcmpi
#define strcmpi(x, y) strcasecmp(x, y)
#endif
@@ -139,7 +141,14 @@
#error please define for your platform.
#endif
+#ifdef __plan9__
+#define STUB_FUNCTION fprintf(stderr, "STUB")
+#define O_CREAT OTRUNC
+#define O_APPEND 0
+#define lseek seek
+#else
#define STUB_FUNCTION fprintf(stderr,"STUB: %s at " __FILE__ ", line %d, thread %d\n",__FUNCTION__,__LINE__,getpid())
+#endif
#define far
#define cdecl
--- a/src/rt_dmand.c
+++ b/src/rt_dmand.c
@@ -105,9 +105,9 @@
PlayingPointer = -1;
PlaybackPointer = 0;
- Playingvoice = FX_StartDemandFeedPlayback ( SD_UpdatePlaybackSound,
- RECORDINGSAMPLERATE,
- 0, 255, 255, 255, 255, -1);
+ //Playingvoice = FX_StartDemandFeedPlayback ( SD_UpdatePlaybackSound,
+ // RECORDINGSAMPLERATE,
+ // 0, 255, 255, 255, 255, -1);
if (Playingvoice==0)
{
SafeFree(PlaybackBuffer);
@@ -248,7 +248,8 @@
FeederPointer = -1;
RecordingPointer = 0;
- status=FX_StartRecording( RECORDINGSAMPLERATE, SD_UpdateRecordingSound);
+ //status=FX_StartRecording( RECORDINGSAMPLERATE, SD_UpdateRecordingSound);
+ status = -1;
if (status!=FX_Ok)
{
@@ -272,7 +273,7 @@
return;
if (Recording == true)
{
- FX_StopRecord();
+ // FX_StopRecord();
Recording=false;
}
}
--- a/src/rt_in.c
+++ b/src/rt_in.c
@@ -18,14 +18,15 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <SDL2/SDL_scancode.h>
-#include <SDL2/SDL_keycode.h>
-#include <SDL2/SDL_mouse.h>
#if USE_SDL
#include "SDL2/SDL.h"
#endif
+#include <SDL2/SDL_scancode.h>
+#include <SDL2/SDL_keycode.h>
+#include <SDL2/SDL_events.h>
+
#include "rt_main.h"
#include "rt_def.h"
#include "rt_in.h"
@@ -678,6 +679,11 @@
{
word x,y;
+
+#ifdef __plan9__
+ return(false);
+#else
+
#if USE_SDL
if (!SDL_WasInit(SDL_INIT_JOYSTICK))
{
@@ -713,6 +719,7 @@
IN_SetupJoy (joy, 0, x * 2, 0, y * 2);
return (true);
}
+#endif
}
--- a/src/rt_main.c
+++ b/src/rt_main.c
@@ -151,6 +151,12 @@
extern int CountDigits(const int number);
+/* FIXME plan9 hacks */
+u32int sounddebugDeallocateSoundCalls;
+u32int sounddebugActiveSounds;
+int g_CV_CubicInterpolation;
+u32int sounddebugAllocateSoundCalls;
+
int main (int argc, char *argv[])
{
extern char *BATTMAPS;
@@ -178,7 +184,7 @@
}
#endif
- signal (11, crash_print);
+// signal (11, crash_print);
if (setup_homedir() == -1) return 1;
@@ -919,7 +925,7 @@
#if (SHAREWARE)
newargs [argnum++] = DATADIR "HUNTBGIN.WAD";
#else
- newargs [argnum++] = DATADIR "DARKWAR.WAD";
+ newargs [argnum++] = DATADIR "darkwar.wad";
#endif
// newargs [argnum++] = "credits.wad";
@@ -940,7 +946,7 @@
}
else
{
- newargs [argnum++] = DATADIR "REMOTE1.RTS";
+ newargs [argnum++] = DATADIR "remote1.rts";
}
if (tempstr)
--- a/src/rt_main.h
+++ b/src/rt_main.h
@@ -30,8 +30,8 @@
#include "rt_battl.h"
#if (SHAREWARE==0)
-#define STANDARDGAMELEVELS (DATADIR "DARKWAR.RTL")
-#define STANDARDBATTLELEVELS (DATADIR "DARKWAR.RTC")
+#define STANDARDGAMELEVELS (DATADIR "darkwar.rtl")
+#define STANDARDBATTLELEVELS (DATADIR "darkwar.rtc")
#define SUPERROTTBATTLELEVELS (DATADIR "ROTTCD.RTC")
#define SITELICENSEBATTLELEVELS (DATADIR "ROTTSITE.RTC")
#else
--- a/src/rt_menu.c
+++ b/src/rt_menu.c
@@ -1515,7 +1515,7 @@
//
//******************************************************************************
-void ScanForSavedGames ()
+void ScanForSavedGames (void)
{
struct find_t f;
char filename[256];
@@ -5315,7 +5315,10 @@
snprintf(ScreenResolutions[i] , 64, "%dx%d", AvailableResolutions[i].width, AvailableResolutions[i].height);
// Populate items
- ScreenResolutionMenu[i] = (CP_itemtype){CP_Active, "", ' ', NULL};
+ ScreenResolutionMenu[i].active = CP_Active;
+ ScreenResolutionMenu[i].texture[0] = 0;
+ ScreenResolutionMenu[i].letter = ' ';
+ ScreenResolutionMenu[i].routine = NULL;
}
// Set item info
--- a/src/rt_sound.c
+++ b/src/rt_sound.c
@@ -139,7 +139,8 @@
card = fxnums[ FXMode ];
if (card==-1) // Check if it is off
return (0);
- status=FX_SetupCard( card, &device );
+ //status=FX_SetupCard( card, &device );
+ status=FX_Ok;
if ( status == FX_Ok )
{
*numvoices=device.MaxVoices;
@@ -516,9 +517,9 @@
if (SD_Started==false)
return;
- FX_SetPitch( sndnum, pitch );
+ //FX_SetPitch( sndnum, pitch );
- if (!FX_SoundActive(sndnum))
+ // if (!FX_SoundActive(sndnum))
return;
}
@@ -539,7 +540,7 @@
if (SD_Started==false)
return;
- if (!FX_SoundActive(handle))
+ //if (!FX_SoundActive(handle))
return;
dx=(x-player->x);
@@ -573,7 +574,7 @@
if (SD_Started==false)
return;
- if (!FX_SoundActive(handle))
+ //if (!FX_SoundActive(handle))
return;
}
@@ -594,7 +595,7 @@
if (SD_Started==false)
return;
- if (!FX_SoundActive(handle))
+ //if (!FX_SoundActive(handle))
return;
dx=(x-px);
@@ -662,7 +663,7 @@
}
else
{
- return (FX_SoundActive(handle));
+ return false; //(FX_SoundActive(handle));
}
}
@@ -676,14 +677,15 @@
int time;
IN_ClearKeysDown();
+ return;
- while (FX_SoundActive(handle)!=0)
- {
- time=GetTicCount()+1;
- while (time>GetTicCount()) {}
- if ((LastScan) || IN_GetMouseButtons())
- break;
- }
+ //while (FX_SoundActive(handle)!=0)
+ //{
+ // time=GetTicCount()+1;
+ // while (time>GetTicCount()) {}
+ // if ((LastScan) || IN_GetMouseButtons())
+ // break;
+ //}
}
--- a/src/rt_ted.c
+++ b/src/rt_ted.c
@@ -5303,7 +5303,7 @@
//Queue enemiesToRes;
Queue * enemiesToRes[8]; //8 "Organic enemy Types"
-void SetupZomROTTStuff()
+void SetupZomROTTStuff(void)
{
int x;
for (x = 0; x < 8; x++)
--- a/src/rt_util.c
+++ b/src/rt_util.c
@@ -31,7 +31,7 @@
#include <stdlib.h>
#include <sys/stat.h>
#include <time.h>
-#include <SDL2/SDL_render.h>
+//#include <SDL2/SDL_render.h>
#include "watcom.h"
#include "_rt_util.h"
#include "rt_util.h"
@@ -547,7 +547,7 @@
filename[sizeof (filename) - 1] = '\0';
FixFilePath(filename);
- handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR );
+ handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_APPEND);
if (handle == -1)
Error ("Error opening for append %s: %s",filename,strerror(errno));
@@ -563,7 +563,7 @@
filename[sizeof (filename) - 1] = '\0';
FixFilePath(filename);
- handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR );
+ handle = create(filename,ORDWR, 0666);
//handle = open(filename,O_RDWR | O_BINARY | O_CREAT | O_TRUNC );
@@ -814,7 +814,7 @@
return(0);
}
-#elif PLATFORM_UNIX
+#elif PLATFORM_UNIX || defined(__plan9__)
int _dos_findfirst(char *filename, int x, struct find_t *f)
{
char *ptr;
@@ -1395,8 +1395,8 @@
//
//******************************************************************************
-typedef int (*PFI)(); /* pointer to a function returning int */
-typedef void (*PFV)(); /* pointer to a function returning int */
+typedef int (*PFI)(char*,char*); /* pointer to a function returning int */
+typedef void (*PFV)(char*,char*); /* pointer to a function returning int */
static PFI Comp; /* pointer to comparison routine */
static PFV Switch; /* pointer to comparison routine */
static int Width; /* width of an object in bytes */
@@ -1403,8 +1403,9 @@
static char *Base; /* pointer to element [-1] of array */
-static void newsift_down(L,U) int L,U;
-{ int c;
+static void newsift_down(int L,int U)
+{
+ int c;
while(1)
{ c=L+L;
--- a/src/rt_util.h
+++ b/src/rt_util.h
@@ -115,7 +115,7 @@
int _dos_findfirst(char *filename, int x, struct find_t *f);
int _dos_findnext(struct find_t *f);
-#elif PLATFORM_UNIX
+#elif PLATFORM_UNIX || defined(__plan9__)
struct find_t
{
DIR *dir;
--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -123,7 +123,7 @@
header.numlumps = IntelLong(LONG(header.numlumps));
header.infotableofs = IntelLong(LONG(header.infotableofs));
length = header.numlumps*sizeof(filelump_t);
- fileinfo = alloca (length);
+ fileinfo = malloc (length);
if (!fileinfo)
Error ("Wad file could not allocate header info on stack");
lseek (handle, header.infotableofs, SEEK_SET);
--- a/src/watcom.c
+++ b/src/watcom.c
@@ -19,7 +19,7 @@
__int64 y = b;
__int64 z = x * y;
- return (((unsigned __int64)z) >> shift) & 0xffffffff;
+ return (((uvlong)z) >> shift) & 0xffffffff;
}
fixed FixedDiv2(fixed a, fixed b)