Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/rhapsody macos compilation #10

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
baseq2/
baseq2-bak/
quake2
1 change: 1 addition & 0 deletions client/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

#include "ref.h"

Expand Down
15 changes: 12 additions & 3 deletions client/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,11 @@ CONTROLS MENU
=======================================================================
*/
static cvar_t *win_noalttab;
extern cvar_t *in_joystick;

// TODO: Implement Cvar_Get inside IN_init for macOS
#ifndef __APPLE__
extern cvar_t *in_joystick;
#endif

static menuframework_s s_options_menu;
static menuaction_s s_options_defaults_action;
Expand Down Expand Up @@ -1099,8 +1103,13 @@ static void ControlsSetMenuItemValues( void )
Cvar_SetValue( "crosshair", ClampCvar( 0, 3, crosshair->value ) );
s_options_crosshair_box.curvalue = crosshair->value;

Cvar_SetValue( "in_joystick", ClampCvar( 0, 1, in_joystick->value ) );
s_options_joystick_box.curvalue = in_joystick->value;
// TODO: Properly implement CVAR system here
// Cvar_SetValue( "in_joystick", ClampCvar( 0, 1, in_joystick->value ) );
// s_options_joystick_box.curvalue = in_joystick->value;

// Added by LT
Cvar_SetValue( "in_joystick", ClampCvar( 0, 1, 0 ) );
s_options_joystick_box.curvalue = 0;

s_options_noalttab_box.curvalue = win_noalttab->value;
}
Expand Down
7 changes: 4 additions & 3 deletions game/g_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -458,9 +458,10 @@ extern spawn_temp_t st;
extern int sm_meat_index;
extern int snd_fry;

extern int jacket_armor_index;
extern int combat_armor_index;
extern int body_armor_index;
// Removed by LT because of compile-error
// extern int jacket_armor_index;
// extern int combat_armor_index;
// extern int body_armor_index;


// means of death
Expand Down
9 changes: 8 additions & 1 deletion game/q_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <stdbool.h>

#if (defined _M_IX86 || defined __i386__) && !defined C_ONLY && !defined __sun__
#define id386 1
Expand All @@ -52,7 +53,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif

typedef unsigned char byte;
typedef enum {false, true} qboolean;

// Foundation.h > CoreFoundation.h > stdbool.h
// This results in a identifier conflict.
// I simply redefinded bool as qboolean.
// Old Defintion:
// typedef enum {false, true} qboolean;
typedef bool qboolean;


#ifndef NULL
Expand Down
78 changes: 12 additions & 66 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

CFLAGS = -Wall -c -g -DNO_PRIVATE
LDFLAGS = -sectcreate __ICON __header rhapsody/QuakeWorld.iconheader -segprot __ICON r r -sectcreate __ICON app rhapsody/QuakeWorld.tiff -framework AppKit -framework Foundation
LDFLAGS = -sectcreate __ICON __header rhapsody/quake2.iconheader -segprot __ICON r r -sectcreate __ICON app rhapsody/quake2.tiff -framework AppKit -framework Foundation
ODIR = rhapsody/output

EXEBASE = QuakeWorld
Expand All @@ -24,20 +24,20 @@ clean:

REF_SOFT_SYSTEM_FILES = $(ODIR)/r_next.o

REF_SOFT_FILES = $(ODIR)/d_polyse.o $(ODIR)/d_scan.o $(ODIR)/draw.o $(ODIR)/model.o $(ODIR)/r_aclip.o $(ODIR)/r_alias.o $(ODIR)/r_bsp.o $(ODIR)/r_draw.o $(ODIR)/r_edge.o $(ODIR)/r_efrag.o $(ODIR)/r_inter.o $(ODIR)/r_light.o $(ODIR)/r_main.o $(ODIR)/r_misc.o $(ODIR)/r_part.o $(ODIR)/r_sky.o $(ODIR)/r_sprite.o $(ODIR)/r_surf.o $(REF_SOFT_SYSTEM_FILES)
REF_SOFT_FILES = $(ODIR)/r_polyse.o $(ODIR)/r_scan.o $(ODIR)/r_model.o $(ODIR)/r_aclip.o $(ODIR)/r_alias.o $(ODIR)/r_bsp.o $(ODIR)/r_draw.o $(ODIR)/r_edge.o $(ODIR)/r_light.o $(ODIR)/r_main.o $(ODIR)/r_misc.o $(ODIR)/r_part.o $(ODIR)/r_sprite.o $(ODIR)/r_surf.o $(REF_SOFT_SYSTEM_FILES)

CLIENT_SYSTEM_FILES = $(ODIR)/in_next.o $(ODIR)/cd_null.o $(ODIR)/snd_next.o $(ODIR)/vid_null.o
CLIENT_SYSTEM_FILES = $(ODIR)/in_next.o
SOUND_FILES = $(ODIR)/snd_dma.o $(ODIR)/snd_mix.o $(ODIR)/snd_mem.o
CLIENT_FILES = $(ODIR)/cl_demo.o $(ODIR)/cl_ents.o $(ODIR)/cl_input.o $(ODIR)/cl_main.o $(ODIR)/cl_parse.o $(ODIR)/cl_pred.o $(ODIR)/cl_tent.o $(ODIR)/console.o $(ODIR)/keys.o $(ODIR)/menu.o $(ODIR)/sbar.o $(ODIR)/screen.o $(ODIR)/view.o $(SOUND_FILES) $(CLIENT_SYSTEM_FILES) $(REF_SOFT_FILES)
CLIENT_FILES = $(ODIR)/cl_ents.o $(ODIR)/cl_input.o $(ODIR)/cl_main.o $(ODIR)/cl_parse.o $(ODIR)/cl_pred.o $(ODIR)/cl_tent.o $(ODIR)/console.o $(ODIR)/keys.o $(ODIR)/menu.o $(SOUND_FILES) $(CLIENT_SYSTEM_FILES) $(REF_SOFT_FILES)
#CLIENT_FILES = $(ODIR)/cl_null.o


SERVER_FILES = $(ODIR)/pr_cmds.o $(ODIR)/pr_edict.o $(ODIR)/pr_exec.o $(ODIR)/sv_ccmds.o $(ODIR)/sv_ents.o $(ODIR)/sv_init.o $(ODIR)/sv_main.o $(ODIR)/sv_move.o $(ODIR)/sv_phys.o $(ODIR)/sv_send.o $(ODIR)/sv_user.o $(ODIR)/world.o
SERVER_FILES = $(ODIR)/sv_ccmds.o $(ODIR)/sv_ents.o $(ODIR)/sv_init.o $(ODIR)/sv_main.o $(ODIR)/sv_send.o $(ODIR)/sv_user.o $(ODIR)/sv_world.o
#SERVER_FILES = $(ODIR)/sv_null.o


QCOMMON_SYSTEM_FILES = $(ODIR)/net_udp.o $(ODIR)/sys_next.o
QCOMMON_FILES = $(ODIR)/cmd.o $(ODIR)/cmodel.o $(ODIR)/common.o $(ODIR)/crc.o $(ODIR)/cvar.o $(ODIR)/files.o $(ODIR)/mathlib.o $(ODIR)/net_chan.o $(ODIR)/pmove.o $(QCOMMON_SYSTEM_FILES)
# QCOMMON_SYSTEM_FILES = $(ODIR)/sys_next.o
QCOMMON_FILES = $(ODIR)/cmd.o $(ODIR)/cmodel.o $(ODIR)/common.o $(ODIR)/crc.o $(ODIR)/cvar.o $(ODIR)/files.o $(ODIR)/net_chan.o $(ODIR)/pmove.o $(QCOMMON_SYSTEM_FILES)

$(EXE): $(CLIENT_FILES) $(SERVER_FILES) $(QCOMMON_FILES)
cc -o $(EXE) $(CLIENT_FILES) $(SERVER_FILES) $(QCOMMON_FILES) $(LDFLAGS)
Expand All @@ -48,9 +48,6 @@ $(ODIR)/cl_null.o : client/cl_null.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i

$(ODIR)/cl_demo.o : client/cl_demo.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
$(ODIR)/cl_ents.o : client/cl_ents.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
Expand Down Expand Up @@ -78,15 +75,6 @@ $(ODIR)/keys.o : client/keys.c
$(ODIR)/menu.o : client/menu.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
$(ODIR)/sbar.o : client/sbar.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
$(ODIR)/screen.o : client/screen.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
$(ODIR)/view.o : client/view.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i

$(ODIR)/snd_dma.o : client/snd_dma.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
Expand All @@ -98,39 +86,23 @@ $(ODIR)/snd_mem.o : client/snd_mem.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i

$(ODIR)/cd_null.o : client/cd_null.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
$(ODIR)/in_null.o : client/in_null.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
$(ODIR)/snd_null.o : client/snd_null.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
$(ODIR)/vid_null.o : client/vid_null.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i

$(ODIR)/in_next.o : rhapsody/in_next.m
cc $(CFLAGS) -o $@ $?
$(ODIR)/snd_next.o : rhapsody/snd_next.m
cc $(CFLAGS) -o $@ $?


#===========================================================================

$(ODIR)/sv_null.o : server/sv_null.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i

$(ODIR)/pr_cmds.o : server/pr_cmds.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
$(ODIR)/pr_edict.o : server/pr_edict.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
$(ODIR)/pr_exec.o : server/pr_exec.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
$(ODIR)/sv_ccmds.o : server/sv_ccmds.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
Expand All @@ -143,34 +115,25 @@ $(ODIR)/sv_init.o : server/sv_init.c
$(ODIR)/sv_main.o : server/sv_main.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
$(ODIR)/sv_move.o : server/sv_move.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
$(ODIR)/sv_phys.o : server/sv_phys.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
$(ODIR)/sv_send.o : server/sv_send.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
$(ODIR)/sv_user.o : server/sv_user.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
$(ODIR)/world.o : server/world.c
$(ODIR)/sv_world.o : server/sv_world.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i

#===========================================================================

$(ODIR)/d_polyse.o : ref_soft/d_polyse.c
$(ODIR)/r_polyse.o : ref_soft/r_polyse.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
$(ODIR)/d_scan.o : ref_soft/d_scan.c
$(ODIR)/r_scan.o : ref_soft/r_scan.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
$(ODIR)/draw.o : ref_soft/draw.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
$(ODIR)/model.o : ref_soft/model.c
$(ODIR)/r_model.o : ref_soft/r_model.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
$(ODIR)/r_aclip.o : ref_soft/r_aclip.c
Expand All @@ -188,12 +151,6 @@ $(ODIR)/r_draw.o : ref_soft/r_draw.c
$(ODIR)/r_edge.o : ref_soft/r_edge.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
$(ODIR)/r_efrag.o : ref_soft/r_efrag.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
$(ODIR)/r_inter.o : ref_soft/r_inter.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
$(ODIR)/r_light.o : ref_soft/r_light.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
Expand All @@ -206,9 +163,6 @@ $(ODIR)/r_misc.o : ref_soft/r_misc.c
$(ODIR)/r_part.o : ref_soft/r_part.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
$(ODIR)/r_sky.o : ref_soft/r_sky.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
$(ODIR)/r_sprite.o : ref_soft/r_sprite.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
Expand Down Expand Up @@ -239,21 +193,13 @@ $(ODIR)/cvar.o : qcommon/cvar.c
$(ODIR)/files.o : qcommon/files.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
$(ODIR)/mathlib.o : qcommon/mathlib.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
$(ODIR)/net_chan.o : qcommon/net_chan.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
$(ODIR)/net_udp.o : qcommon/net_udp.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
$(ODIR)/pmove.o : qcommon/pmove.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i

$(ODIR)/sys_null.o : qcommon/sys_null.c
cc $(CFLAGS) -E $? | tr -d '\015' > /tmp/temp.i
cc $(CFLAGS) -o $@ /tmp/temp.i
$(ODIR)/sys_next.o : rhapsody/sys_next.m
cc $(CFLAGS) -o $@ $?
63 changes: 63 additions & 0 deletions rhapsody/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

CFLAGS = -O -g -DGAME_HARD_LINKED -DREF_HARD_LINKED
LDFLAGS = -sectcreate __ICON __header quake2.iconheader -segprot __ICON r r -sectcreate __ICON app quake2.tiff -framework AppKit -framework Foundation
EXE = quake2
TARGETS = $(EXE)

all: $(TARGETS)

#----------------------------------------------------------------------

SERVERFILES = sv_ccmds.o sv_ents.o sv_game.o sv_init.o sv_main.o sv_send.o sv_user.o sv_world.o

GAMEFILES = g_ai.o g_cmds.o g_chase.o g_svcmds.o g_combat.o g_func.o g_items.o g_main.o g_misc.o g_monster.o g_phys.o g_save.o g_spawn.o g_target.o g_trigger.o g_utils.o g_weapon.o g_turret.o m_actor.o m_berserk.o m_boss2.o m_boss3.o m_boss31.o m_boss32.o m_brain.o m_chick.o m_flipper.o m_float.o m_flyer.o m_gladiator.o m_gunner.o m_hover.o m_infantry.o m_insane.o m_medic.o m_move.o m_mutant.o m_parasite.o m_soldier.o m_supertank.o m_tank.o p_client.o p_hud.o p_trail.o p_view.o p_weapon.o

CLIENTFILES = cl_ents.o cl_fx.o cl_input.o cl_inv.o cl_main.o cl_parse.o cl_pred.o cl_scrn.o cl_cin.o cl_tent.o cl_view.o console.o keys.o menu.o qmenu.o snd_dma.o snd_mem.o snd_mix.o cl_newfx.o

# commonfiles are used by both client and server
COMMONFILES = m_flash.o cmd.o cmodel.o common.o cvar.o files.o md4.o net_chan.o net_udp.o pmove.o crc.o

REFGLFILES = gl_draw.o gl_light.o gl_mesh.o gl_model.o gl_rmain.o gl_rmisc.o gl_rsurf.o gl_warp.o gl_image.o

REFSOFTFILES = r_aclip.o r_alias.o r_bsp.o r_draw.o r_edge.o r_image.o r_light.o r_main.o r_misc.o r_model.o r_part.o r_polyse.o r_poly.o r_rast.o r_scan.o r_sprite.o r_surf.o

# sharedfiles are included in EVERY dll
SHAREDFILES = q_shared.o

IRIXFILES = cd_sgi.o glx_imp.o qgl_sgi.o sys_sgi.o vid_sgi.o in_sgi.o snddma_null.o

RHAPFILES = cd_null.o in_null.o snddma_null.o sys_rhap.o vid_null.o swimp_rhap.o

NULLFILES = cd_null.o in_null.o snddma_null.o sys_null.o vid_null.o swimp_null.o

#----------------------------------------------------------------------

FILES = $(SERVERFILES) $(GAMEFILES) $(COMMONFILES) $(CLIENTFILES) $(REFSOFTFILES) $(SHAREDFILES) $(RHAPFILES)

$(EXE) : $(FILES)
cc -o $(EXE) $(FILES) $(LDFLAGS)

clean:
rm -f $(EXE) $(FILES)

#----------------------------------------------------------------------

# gnumake pattern rules are so cool!

%.o : ../game/%.c
cc $(CFLAGS) -c -o $@ $?
%.o : ../qcommon/%.c
cc $(CFLAGS) -c -o $@ $?
%.o : ../client/%.c
cc $(CFLAGS) -c -o $@ $?
%.o : ../server/%.c
cc $(CFLAGS) -c -o $@ $?
%.o : ../ref_soft/%.c
cc $(CFLAGS) -c -o $@ $?
%.o : ../ref_gl/%.c
cc $(CFLAGS) -c -o $@ $?
%.o : ../null/%.c
cc $(CFLAGS) -c -o $@ $?
%.o : ../rhapsody/%.m
cc $(CFLAGS) -c -o $@ $?

Loading