Fix errors for Mac OS 9, Mac OS X 'd1x' target builds again

This commit is contained in:
Chris Taylor 2010-10-16 18:53:05 +08:00
commit 541e422611
11 changed files with 101 additions and 72 deletions

View file

@ -3,6 +3,7 @@ D1X-Rebirth Changelog
20101016
--------
main/custom.c, main/gameseq.c: Finished support for custom textures and robots, fixed some bugs, reformatted code and placed function calls to properly work for designated mission/level
D1X.make, arch/sdl/jukebox.c, d1x-rebirth.xcodeproj/project.pbxproj, include/pstypes.h, main/hud.c, main/menu.c, main/newdemo.c, main/titles.c, misc/args.c, misc/physfsx.c: Fix errors for Mac OS 9, Mac OS X 'd1x' target builds again
20101014
--------

View file

@ -9,12 +9,12 @@ MAKEFILE = D1X.make
ObjDir = ":obj:"
Includes = ¶
-i :arch:carbon: ś
-i :arch:include: ś
-i :include: ¶
-i :arch:include: ¶
-i "{CIncludes}SDL:" ¶
-i :arch:carbon: ¶
-i "{CIncludes}" ¶
-i :main: ś
-i :main:
Sym-PPC = -sym on
@ -69,6 +69,7 @@ SrcFiles =
:arch:sdl:mouse.c ¶
:arch:sdl:rbaudio.c ¶
:arch:sdl:timer.c ¶
:arch:sdl:window.c ¶
:iff:iff.c ¶
:main:ai.c ¶
:main:aipath.c ¶
@ -90,8 +91,10 @@ SrcFiles =
:main:fuelcen.c ¶
:main:fvi.c ¶
:main:game.c ¶
:main:gamecntl.c ¶
:main:gamefont.c ¶
:main:gamemine.c ¶
:main:gamerend.c ¶
:main:gamesave.c ¶
:main:gameseg.c ¶
:main:gameseq.c ¶
@ -110,7 +113,6 @@ SrcFiles =
:main:morph.c ¶
:main:multi.c ¶
:main:multibot.c ¶
:main:multipow.c ś
:main:net_ipx.c ¶
:main:net_udp.c ¶
:main:newdemo.c ¶
@ -119,6 +121,7 @@ SrcFiles =
:main:paging.c ¶
:main:physics.c ¶
:main:piggy.c ¶
:main:player.c ¶
:main:playsave.c ¶
:main:polyobj.c ¶
:main:powerup.c ¶
@ -143,11 +146,11 @@ SrcFiles =
:maths:vecmat.c ¶
:mem:mem.c ¶
:misc:args.c ¶
:misc:compare.c ś
:misc:dl_list.c ¶
:misc:error.c ¶
:misc:hmp2mid.c ś
:misc:hmp.c ¶
:misc:ignorecase.c ¶
:misc:physfsx.c ¶
:misc:strio.c ¶
:misc:strutil.c ¶
:texmap:ntmap.c ¶
@ -206,6 +209,7 @@ GeneralObjects =
{ObjDir}mouse.c.x ¶
{ObjDir}rbaudio.c.x ¶
{ObjDir}timer.c.x ¶
{ObjDir}window.c.x ¶
{ObjDir}iff.c.x ¶
{ObjDir}ai.c.x ¶
{ObjDir}aipath.c.x ¶
@ -227,8 +231,10 @@ GeneralObjects =
{ObjDir}fuelcen.c.x ¶
{ObjDir}fvi.c.x ¶
{ObjDir}game.c.x ¶
{ObjDir}gamecntl.c.x ¶
{ObjDir}gamefont.c.x ¶
{ObjDir}gamemine.c.x ¶
{ObjDir}gamerend.c.x ¶
{ObjDir}gamesave.c.x ¶
{ObjDir}gameseg.c.x ¶
{ObjDir}gameseq.c.x ¶
@ -245,9 +251,8 @@ GeneralObjects =
{ObjDir}mglobal.c.x ¶
{ObjDir}mission.c.x ¶
{ObjDir}morph.c.x ¶
{ObjDir}multi.c.x ś
{ObjDir}multibot.c.x ś
{ObjDir}multipow.c.x ś
# {ObjDir}multi.c.x ¶
# {ObjDir}multibot.c.x ¶
{ObjDir}net_ipx.c.x ¶
{ObjDir}net_udp.c.x ¶
{ObjDir}newdemo.c.x ¶
@ -256,6 +261,7 @@ GeneralObjects =
{ObjDir}paging.c.x ¶
{ObjDir}physics.c.x ¶
{ObjDir}piggy.c.x ¶
{ObjDir}player.c.x ¶
{ObjDir}playsave.c.x ¶
{ObjDir}polyobj.c.x ¶
{ObjDir}powerup.c.x ¶
@ -280,11 +286,11 @@ GeneralObjects =
{ObjDir}vecmat.c.x ¶
{ObjDir}mem.c.x ¶
{ObjDir}args.c.x ¶
{ObjDir}compare.c.x ś
{ObjDir}dl_list.c.x ¶
{ObjDir}error.c.x ¶
{ObjDir}hmp2mid.c.x ś
{ObjDir}hmp.c.x ¶
{ObjDir}ignorecase.c.x ¶
{ObjDir}physfsx.c.x ¶
{ObjDir}strio.c.x ¶
{ObjDir}strutil.c.x ¶
{ObjDir}ntmap.c.x ¶
@ -384,7 +390,7 @@ directories
{ObjDir}digi_mixer.c.x Ä :arch:sdl:digi_mixer.c
{ObjDir}digi_mixer_music.c.x Ä :arch:sdl:digi_mixer_music.c
{ObjDir}event.c.x Ä :arch:sdl:event.c
{ObjDir}gr.c.x Ä :arch:sdl:gr.c
{ObjDir}SDL:gr.c.x Ä :arch:sdl:gr.c
{ObjDir}init.c.x Ä :arch:sdl:init.c
{ObjDir}joy.c.x Ä :arch:sdl:joy.c
{ObjDir}jukebox.c.x Ä :arch:sdl:jukebox.c
@ -392,6 +398,7 @@ directories
{ObjDir}mouse.c.x Ä :arch:sdl:mouse.c
{ObjDir}rbaudio.c.x Ä :arch:sdl:rbaudio.c
{ObjDir}timer.c.x Ä :arch:sdl:timer.c
{ObjDir}window.c.x Ä :arch:sdl:window.c
{ObjDir}iff.c.x Ä :iff:iff.c
{ObjDir}ai.c.x Ä :main:ai.c
{ObjDir}aipath.c.x Ä :main:aipath.c
@ -413,8 +420,10 @@ directories
{ObjDir}fuelcen.c.x Ä :main:fuelcen.c
{ObjDir}fvi.c.x Ä :main:fvi.c
{ObjDir}game.c.x Ä :main:game.c
{ObjDir}gamecntl.c.x Ä :main:gamecntl.c
{ObjDir}gamefont.c.x Ä :main:gamefont.c
{ObjDir}gamemine.c.x Ä :main:gamemine.c
{ObjDir}gamerend.c.x Ä :main:gamerend.c
{ObjDir}gamesave.c.x Ä :main:gamesave.c
{ObjDir}gameseg.c.x Ä :main:gameseg.c
{ObjDir}gameseq.c.x Ä :main:gameseq.c
@ -433,7 +442,6 @@ directories
{ObjDir}morph.c.x Ä :main:morph.c
{ObjDir}multi.c.x Ä :main:multi.c
{ObjDir}multibot.c.x Ä :main:multibot.c
{ObjDir}multipow.c.x Ä :main:multipow.c
{ObjDir}net_ipx.c.x Ä :main:net_ipx.c
{ObjDir}net_udp.c.x Ä :main:net_udp.c
{ObjDir}newdemo.c.x Ä :main:newdemo.c
@ -442,6 +450,7 @@ directories
{ObjDir}paging.c.x Ä :main:paging.c
{ObjDir}physics.c.x Ä :main:physics.c
{ObjDir}piggy.c.x Ä :main:piggy.c
{ObjDir}player.c.x Ä :main:player.c
{ObjDir}playsave.c.x Ä :main:playsave.c
{ObjDir}polyobj.c.x Ä :main:polyobj.c
{ObjDir}powerup.c.x Ä :main:powerup.c
@ -466,11 +475,11 @@ directories
{ObjDir}vecmat.c.x Ä :maths:vecmat.c
{ObjDir}mem.c.x Ä :mem:mem.c
{ObjDir}args.c.x Ä :misc:args.c
{ObjDir}compare.c.x Ä :misc:compare.c
{ObjDir}dl_list.c.x Ä :misc:dl_list.c
{ObjDir}error.c.x Ä :misc:error.c
{ObjDir}hmp2mid.c.x Ä :misc:hmp2mid.c
{ObjDir}hmp.c.x Ä :misc:hmp.c
{ObjDir}ignorecase.c.x Ä :misc:ignorecase.c
{ObjDir}physfsx.c.x Ä :misc:physfsx.c
{ObjDir}strio.c.x Ä :misc:strio.c
{ObjDir}strutil.c.x Ä :misc:strutil.c
{ObjDir}ntmap.c.x Ä :texmap:ntmap.c

View file

@ -41,30 +41,24 @@ char hud_msg_buf[MUSIC_HUDMSG_MAXLEN+4];
void jukebox_unload()
{
if (JukeboxSongs.list)
d_free(JukeboxSongs.list);
if (JukeboxSongs.list_buf)
{
d_free(JukeboxSongs.list_buf);
if (JukeboxSongs.list)
d_free(JukeboxSongs.list);
}
else if (JukeboxSongs.list)
{
PHYSFS_freeList(JukeboxSongs.list);
JukeboxSongs.list = NULL;
}
JukeboxSongs.num_songs = JukeboxSongs.max_songs = JukeboxSongs.max_buf = 0;
}
char *jukebox_exts[] = { ".mp3", ".ogg", ".wav", ".aif", ".mid", NULL };
void jukebox_add_song(void *data, const char *origdir, const char *fname)
{
char *ext;
char **i = NULL;
ext = strrchr(fname, '.');
if (ext)
for (i = jukebox_exts; *i != NULL && stricmp(ext, *i); i++) {} // see if the file is of a type we want
if ((!strcmp((PHYSFS_getRealDir(fname)==NULL?"":PHYSFS_getRealDir(fname)), GameCfg.CMLevelMusicPath)) && (ext && *i))
string_array_add(&JukeboxSongs.list, &JukeboxSongs.list_buf, &JukeboxSongs.num_songs, &JukeboxSongs.max_songs, &JukeboxSongs.max_buf, fname);
}
void read_m3u(void)
{
FILE *fp;
@ -176,22 +170,17 @@ void jukebox_load()
}
else
{
int i;
// Read directory using PhysicsFS
if (!string_array_new(&JukeboxSongs.list, &JukeboxSongs.list_buf, &JukeboxSongs.num_songs, &JukeboxSongs.max_songs, &JukeboxSongs.max_buf))
// as mountpoints are no option (yet), make sure only files originating from GameCfg.CMLevelMusicPath are aded to the list.
JukeboxSongs.list = PHYSFSX_findabsoluteFiles("", GameCfg.CMLevelMusicPath, jukebox_exts);
if (!JukeboxSongs.list)
return;
// as mountpoints are no option (yet), make sure only files originating from GameCfg.CMLevelMusicPath are aded to the list.
PHYSFS_enumerateFilesCallback("", jukebox_add_song, NULL);
string_array_tidy(&JukeboxSongs.list, &JukeboxSongs.list_buf, &JukeboxSongs.num_songs, &JukeboxSongs.max_songs, &JukeboxSongs.max_buf, 0,
#ifdef __LINUX__
strcmp
#elif defined(_WIN32) || defined(macintosh)
stricmp
#else
strcasecmp
#endif
);
for (i = 0; JukeboxSongs.list[i]; i++) {}
JukeboxSongs.num_songs = i;
}
if (JukeboxSongs.num_songs)

View file

@ -284,7 +284,6 @@
EB380D7D0E168B1900EBD9AD /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = EB380D7B0E168B1900EBD9AD /* InfoPlist.strings */; };
EB380D7E0E168B1900EBD9AD /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = EB380D7B0E168B1900EBD9AD /* InfoPlist.strings */; };
EB775A7A105611720036C348 /* extractD1Data.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EB775A79105611720036C348 /* extractD1Data.cpp */; };
EB861343111E9E810097D871 /* net_ipx.c in Sources */ = {isa = PBXBuildFile; fileRef = EBF658990F936A8400CB5C73 /* net_ipx.c */; };
EB8BE84F1071FBE00069486E /* player.c in Sources */ = {isa = PBXBuildFile; fileRef = EB8BE84E1071FBE00069486E /* player.c */; };
EB8BE8501071FBE00069486E /* player.c in Sources */ = {isa = PBXBuildFile; fileRef = EB8BE84E1071FBE00069486E /* player.c */; };
EB91A41012617070009E0095 /* libphysfs.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = EB91A40F12617070009E0095 /* libphysfs.dylib */; };
@ -1733,7 +1732,6 @@
EBE8D8910FDA76D1009D181F /* gamerend.c in Sources */,
EB8BE8501071FBE00069486E /* player.c in Sources */,
17DFA6B110C1A29500674D11 /* net_udp.c in Sources */,
EB861343111E9E810097D871 /* net_ipx.c in Sources */,
179E6E9E11F37B3400175C54 /* hmp.c in Sources */,
EB1405BB12100883002B1CC6 /* physfsx.c in Sources */,
);

View file

@ -7,7 +7,10 @@
#ifndef _TYPES_H
#define _TYPES_H
#ifndef macintosh
#include <sys/types.h>
#endif
#include <limits.h>
// define a dboolean

View file

@ -113,9 +113,17 @@ void HUD_render_message_frame()
int HUD_init_message_va(char * format, va_list args)
{
int i, j;
#ifndef macintosh
char message[HUD_MESSAGE_LENGTH+1] = "";
#else
char message[1024] = "";
#endif
#ifndef macintosh
vsnprintf(message, sizeof(char)*HUD_MESSAGE_LENGTH, format, args);
#else
vsprintf(message, format, args);
#endif
// already in list - do not add again
for (i = 0; i < HUD_nmessages; i++)

View file

@ -892,7 +892,7 @@ int options_menuset(newmenu *menu, d_event *event, void *userdata)
break;
}
userdata++; //kill warning
userdata = userdata; //kill warning
return 0;
}
@ -913,8 +913,8 @@ void change_res()
num_presets = gr_list_modes( modes );
{
newmenu_item m[num_presets+8];
char restext[num_presets][12], crestext[12], casptext[12];
newmenu_item m[50+8];
char restext[50][12], crestext[12], casptext[12];
for (i = 0; i <= num_presets-1; i++)
{
@ -1122,8 +1122,7 @@ void do_graphics_menu()
} while( i>-1 );
}
#define CUR_DIRLIST "DirectoryListDXX"
#if PHYSFS_VER_MAJOR >= 2
typedef struct browser
{
char *title; // The title - needed for making another listbox when changing directory
@ -1394,6 +1393,23 @@ int select_file_recursive(char *title, const char *orig_path, char **ext_list, i
return newmenu_listbox1(title, b->num_files, b->list, 1, 0, (int (*)(listbox *, d_event *, void *))select_file_handler, b) >= 0;
}
#define PATH_HEADER_TYPE NM_TYPE_MENU
#define BROWSE_TXT_SHRT " (...)"
#define BROWSE_TXT " (browse...)"
#else
int select_file_recursive(char *title, const char *orig_path, char **ext_list, int select_dir, int (*when_selected)(void *userdata, const char *filename), void *userdata)
{
return 0;
}
#define PATH_HEADER_TYPE NM_TYPE_TEXT
#define BROWSE_TXT_SHRT
#define BROWSE_TXT
#endif
int opt_sm_digivol = -1, opt_sm_musicvol = -1, opt_sm_revstereo = -1, opt_sm_mtype0 = -1, opt_sm_mtype1 = -1, opt_sm_mtype2 = -1, opt_sm_mtype3 = -1, opt_sm_redbook_playorder = -1, opt_sm_mtype3_lmpath = -1, opt_sm_mtype3_lmplayorder1 = -1, opt_sm_mtype3_lmplayorder2 = -1, opt_sm_cm_mtype3_file1_b = -1, opt_sm_cm_mtype3_file1 = -1, opt_sm_cm_mtype3_file2_b = -1, opt_sm_cm_mtype3_file2 = -1, opt_sm_cm_mtype3_file3_b = -1, opt_sm_cm_mtype3_file3 = -1, opt_sm_cm_mtype3_file4_b = -1, opt_sm_cm_mtype3_file4 = -1, opt_sm_cm_mtype3_file5_b = -1, opt_sm_cm_mtype3_file5 = -1;
void set_extmusic_volume(int volume);
@ -1614,7 +1630,7 @@ void do_sound_menu()
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "jukebox options:";
opt_sm_mtype3_lmpath = nitems;
m[nitems].type = NM_TYPE_MENU; m[nitems++].text = "path for level music (browse...)";
m[nitems].type = PATH_HEADER_TYPE; m[nitems++].text = "path for level music" BROWSE_TXT_SHRT;
m[nitems].type = NM_TYPE_INPUT; m[nitems].text = GameCfg.CMLevelMusicPath; m[nitems++].text_len = NM_MAX_TEXT_LEN-1;
@ -1633,31 +1649,31 @@ void do_sound_menu()
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "non-level music:";
opt_sm_cm_mtype3_file1_b = nitems;
m[nitems].type = NM_TYPE_MENU; m[nitems++].text = "main menu (browse...)";
m[nitems].type = PATH_HEADER_TYPE; m[nitems++].text = "main menu" BROWSE_TXT;
opt_sm_cm_mtype3_file1 = nitems;
m[nitems].type = NM_TYPE_INPUT; m[nitems].text = GameCfg.CMMiscMusic[SONG_TITLE]; m[nitems++].text_len = NM_MAX_TEXT_LEN-1;
opt_sm_cm_mtype3_file2_b = nitems;
m[nitems].type = NM_TYPE_MENU; m[nitems++].text = "briefing (browse...)";
m[nitems].type = PATH_HEADER_TYPE; m[nitems++].text = "briefing" BROWSE_TXT;
opt_sm_cm_mtype3_file2 = nitems;
m[nitems].type = NM_TYPE_INPUT; m[nitems].text = GameCfg.CMMiscMusic[SONG_BRIEFING]; m[nitems++].text_len = NM_MAX_TEXT_LEN-1;
opt_sm_cm_mtype3_file3_b = nitems;
m[nitems].type = NM_TYPE_MENU; m[nitems++].text = "credits (browse...)";
m[nitems].type = PATH_HEADER_TYPE; m[nitems++].text = "credits" BROWSE_TXT;
opt_sm_cm_mtype3_file3 = nitems;
m[nitems].type = NM_TYPE_INPUT; m[nitems].text = GameCfg.CMMiscMusic[SONG_CREDITS]; m[nitems++].text_len = NM_MAX_TEXT_LEN-1;
opt_sm_cm_mtype3_file4_b = nitems;
m[nitems].type = NM_TYPE_MENU; m[nitems++].text = "escape sequence (browse...)";
m[nitems].type = PATH_HEADER_TYPE; m[nitems++].text = "escape sequence" BROWSE_TXT;
opt_sm_cm_mtype3_file4 = nitems;
m[nitems].type = NM_TYPE_INPUT; m[nitems].text = GameCfg.CMMiscMusic[SONG_ENDLEVEL]; m[nitems++].text_len = NM_MAX_TEXT_LEN-1;
opt_sm_cm_mtype3_file5_b = nitems;
m[nitems].type = NM_TYPE_MENU; m[nitems++].text = "game ending (browse...)";
m[nitems].type = PATH_HEADER_TYPE; m[nitems++].text = "game ending" BROWSE_TXT;
opt_sm_cm_mtype3_file5 = nitems;
m[nitems].type = NM_TYPE_INPUT; m[nitems].text = GameCfg.CMMiscMusic[SONG_ENDGAME]; m[nitems++].text_len = NM_MAX_TEXT_LEN-1;

View file

@ -445,9 +445,10 @@ static int shareware = 0; // reading shareware demo?
void nd_read_object(object *obj)
{
memset(obj, 0, sizeof(object));
short shortsig = 0;
memset(obj, 0, sizeof(object));
/*
* Do render type first, since with render_type == RT_NONE, we
* blow by all other object information
@ -3310,9 +3311,9 @@ void newdemo_start_playback(char * filename)
{
// Randomly pick a filename
int NumFiles = 0, RandFileNum;
rnd_demo = 1;
char *types[] = { DEMO_EXT, NULL };
rnd_demo = 1;
NumFiles = newdemo_count_demos();
if ( NumFiles == 0 ) {

View file

@ -454,9 +454,10 @@ int check_text_pos(briefing *br)
void put_char_delay(briefing *br, int ch)
{
char str[] = { ch, '\0' };
char str[2];
int w, h, aw;
str[0] = ch; str[1] = '\0';
if (br->delay_count && (timer_get_fixed_seconds() < br->start_time + br->delay_count))
{
br->message--; // Go back to same character

View file

@ -20,13 +20,8 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "u_mem.h"
#include "physfsx.h"
#include "strio.h"
#include "strutil.h"
#include "args.h"
#include "game.h"
#include "gauges.h"
#include <SDL/SDL_stdinc.h>
#ifdef OGL
#if defined(__APPLE__) && defined(__MACH__)
#include <OpenGL/glu.h>
@ -38,6 +33,14 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#endif
#endif
#include "u_mem.h"
#include "physfsx.h"
#include "strio.h"
#include "strutil.h"
#include "args.h"
#include "game.h"
#include "gauges.h"
#define MAX_ARGS 1000
#define INI_FILENAME "d1x.ini"
@ -158,9 +161,9 @@ void ReadCmdArgs(void)
GameArg.CtlMouselook = FindArg("-mouselook");
GameArg.CtlGrabMouse = FindArg("-grabmouse");
if (FindArg("-nostickykeys")) // no GameArg, just an environment variable. Must happen before SDL_Init!
putenv("SDL_DISABLE_LOCK_KEYS=1");
SDL_putenv("SDL_DISABLE_LOCK_KEYS=1");
else
putenv("SDL_DISABLE_LOCK_KEYS=0");
SDL_putenv("SDL_DISABLE_LOCK_KEYS=0");
// Sound Options

View file

@ -23,12 +23,9 @@
// The user directory is searched first.
void PHYSFSX_init(int argc, char *argv[])
{
#if defined (_WIN32)
char fullPath[PATH_MAX + 5];
#endif
#if defined(__unix__)
char *path = NULL;
char fullPath[PATH_MAX + 5];
#endif
#ifdef macintosh // Mac OS 9
char base_dir[PATH_MAX];
@ -361,6 +358,7 @@ void PHYSFSX_addArchiveContent()
PHYSFS_freeList(list);
list = NULL;
#if PHYSFS_VER_MAJOR >= 2
// find files in DEMO_DIR ...
list = PHYSFSX_findFiles(DEMO_DIR, archive_exts);
// if found, add them...
@ -374,6 +372,8 @@ void PHYSFSX_addArchiveContent()
d_free(file[0]);
d_free(file[1]);
}
#endif
PHYSFS_freeList(list);
list = NULL;
}