ref: 0a1dd162e4643bc032e520a2e88bdf10f71075ca
parent: 4cc3d07dfff2d11b6d3a0a9960a51cf4ca253690
author: qwx <qwx@sciops.net>
date: Mon Mar 9 13:44:23 EDT 2026
initial port
--- a/README.md
+++ b/README.md
@@ -4,6 +4,15 @@
[](https://travis-ci.org/Interrupt/systemshock) [](https://ci.appveyor.com/project/Interrupt/systemshock)
+9front
+======
+
+Requires [npe](http://shithub.us/moody/npe/HEAD/info.html).
+Run with data files in current working directory.
+Missing: MIDI, sound effects.
+Broken: lots of stuff.
+
+
GENERAL NOTES
=============
--- /dev/null
+++ b/mkfile
@@ -1,0 +1,385 @@
+</$objtype/mkfile
+BIN=/$objtype/bin/games
+TARG=sshock
+
+LIB=src/Libraries/libshock.a$O
+HFILES=\
+ src/MusicSrc/MusicDevice.h\
+ src/GameSrc/Headers/FrUtils.h\
+ src/GameSrc/Headers/ai.h\
+ src/GameSrc/Headers/aiflags.h\
+ src/GameSrc/Headers/airupt.h\
+ src/GameSrc/Headers/amap.h\
+ src/GameSrc/Headers/amaploop.h\
+ src/GameSrc/Headers/ammomfd.h\
+ src/GameSrc/Headers/anim.h\
+ src/GameSrc/Headers/archiveformat.h\
+ src/GameSrc/Headers/audiolog.h\
+ src/GameSrc/Headers/automap.h\
+ src/GameSrc/Headers/bark.h\
+ src/GameSrc/Headers/biohelp.h\
+ src/GameSrc/Headers/biotrax.h\
+ src/GameSrc/Headers/canvchek.h\
+ src/GameSrc/Headers/cardmfd.h\
+ src/GameSrc/Headers/cit2d.h\
+ src/GameSrc/Headers/citalog.h\
+ src/GameSrc/Headers/citbark.h\
+ src/GameSrc/Headers/citmat.h\
+ src/GameSrc/Headers/citres.h\
+ src/GameSrc/Headers/colors.h\
+ src/GameSrc/Headers/combat.h\
+ src/GameSrc/Headers/cone.h\
+ src/GameSrc/Headers/criterr.h\
+ src/GameSrc/Headers/cutsloop.h\
+ src/GameSrc/Headers/cyber.h\
+ src/GameSrc/Headers/cybermfd.h\
+ src/GameSrc/Headers/cybmem.h\
+ src/GameSrc/Headers/cybrloop.h\
+ src/GameSrc/Headers/cybrnd.h\
+ src/GameSrc/Headers/cybstrng.h\
+ src/GameSrc/Headers/damage.h\
+ src/GameSrc/Headers/diffq.h\
+ src/GameSrc/Headers/digifx.h\
+ src/GameSrc/Headers/dirac.h\
+ src/GameSrc/Headers/doorparm.h\
+ src/GameSrc/Headers/drugs.h\
+ src/GameSrc/Headers/dynmem.h\
+ src/GameSrc/Headers/effect.h\
+ src/GameSrc/Headers/email.h\
+ src/GameSrc/Headers/emailbit.h\
+ src/GameSrc/Headers/faceobj.h\
+ src/GameSrc/Headers/faketime.h\
+ src/GameSrc/Headers/fatigue.h\
+ src/GameSrc/Headers/fauxrint.h\
+ src/GameSrc/Headers/fixtrmfd.h\
+ src/GameSrc/Headers/fr3d.h\
+ src/GameSrc/Headers/framer8.h\
+ src/GameSrc/Headers/frcamera.h\
+ src/GameSrc/Headers/frcursors.h\
+ src/GameSrc/Headers/fredge.h\
+ src/GameSrc/Headers/frflags.h\
+ src/GameSrc/Headers/frintern.h\
+ src/GameSrc/Headers/froslew.h\
+ src/GameSrc/Headers/frparams.h\
+ src/GameSrc/Headers/frprotox.h\
+ src/GameSrc/Headers/frquad.h\
+ src/GameSrc/Headers/frscreen.h\
+ src/GameSrc/Headers/frshipm.h\
+ src/GameSrc/Headers/frspans.h\
+ src/GameSrc/Headers/frsubclp.h\
+ src/GameSrc/Headers/frtables.h\
+ src/GameSrc/Headers/frtypes.h\
+ src/GameSrc/Headers/frtypesx.h\
+ src/GameSrc/Headers/frworld.h\
+ src/GameSrc/Headers/fullamap.h\
+ src/GameSrc/Headers/fullscrn.h\
+ src/GameSrc/Headers/game_screen.h\
+ src/GameSrc/Headers/gameloop.h\
+ src/GameSrc/Headers/gameobj.h\
+ src/GameSrc/Headers/gamepal.h\
+ src/GameSrc/Headers/gamerend.h\
+ src/GameSrc/Headers/gamescr.h\
+ src/GameSrc/Headers/gamesort.h\
+ src/GameSrc/Headers/gamestrn.h\
+ src/GameSrc/Headers/gamesys.h\
+ src/GameSrc/Headers/gametime.h\
+ src/GameSrc/Headers/gamewrap.h\
+ src/GameSrc/Headers/gearmfd.h\
+ src/GameSrc/Headers/gettmaps.h\
+ src/GameSrc/Headers/gr2ss.h\
+ src/GameSrc/Headers/grenades.h\
+ src/GameSrc/Headers/hand.h\
+ src/GameSrc/Headers/handart.h\
+ src/GameSrc/Headers/hkeyfunc.h\
+ src/GameSrc/Headers/hud.h\
+ src/GameSrc/Headers/hudobj.h\
+ src/GameSrc/Headers/ice.h\
+ src/GameSrc/Headers/init.h\
+ src/GameSrc/Headers/input.h\
+ src/GameSrc/Headers/invdims.h\
+ src/GameSrc/Headers/invent.h\
+ src/GameSrc/Headers/invpages.h\
+ src/GameSrc/Headers/leanmetr.h\
+ src/GameSrc/Headers/loops.h\
+ src/GameSrc/Headers/lvldata.h\
+ src/GameSrc/Headers/mainloop.h\
+ src/GameSrc/Headers/map.h\
+ src/GameSrc/Headers/mapflags.h\
+ src/GameSrc/Headers/mapnorm.h\
+ src/GameSrc/Headers/mfdart.h\
+ src/GameSrc/Headers/mfddims.h\
+ src/GameSrc/Headers/mfdext.h\
+ src/GameSrc/Headers/mfdfunc.h\
+ src/GameSrc/Headers/mfdgadg.h\
+ src/GameSrc/Headers/mfdgames.h\
+ src/GameSrc/Headers/mfdgump.h\
+ src/GameSrc/Headers/mfdint.h\
+ src/GameSrc/Headers/mfdpanel.h\
+ src/GameSrc/Headers/minimax.h\
+ src/GameSrc/Headers/miscqvar.h\
+ src/GameSrc/Headers/mlimbs.h\
+ src/GameSrc/Headers/models.h\
+ src/GameSrc/Headers/modtext.h\
+ src/GameSrc/Headers/mouselook.h\
+ src/GameSrc/Headers/movekeys.h\
+ src/GameSrc/Headers/musicai.h\
+ src/GameSrc/Headers/newmfd.h\
+ src/GameSrc/Headers/obj3d.h\
+ src/GameSrc/Headers/objapp.h\
+ src/GameSrc/Headers/objart.h\
+ src/GameSrc/Headers/objart2.h\
+ src/GameSrc/Headers/objart3.h\
+ src/GameSrc/Headers/objbit.h\
+ src/GameSrc/Headers/objclass.h\
+ src/GameSrc/Headers/objcrit.h\
+ src/GameSrc/Headers/objects.h\
+ src/GameSrc/Headers/objgame.h\
+ src/GameSrc/Headers/objload.h\
+ src/GameSrc/Headers/objmode.h\
+ src/GameSrc/Headers/objprop.h\
+ src/GameSrc/Headers/objsim.h\
+ src/GameSrc/Headers/objstuff.h\
+ src/GameSrc/Headers/objuse.h\
+ src/GameSrc/Headers/objver.h\
+ src/GameSrc/Headers/objwarez.h\
+ src/GameSrc/Headers/objwpn.h\
+ src/GameSrc/Headers/olhext.h\
+ src/GameSrc/Headers/olhint.h\
+ src/GameSrc/Headers/olhscan.h\
+ src/GameSrc/Headers/otrip.h\
+ src/GameSrc/Headers/palfx.h\
+ src/GameSrc/Headers/pathfind.h\
+ src/GameSrc/Headers/physics.h\
+ src/GameSrc/Headers/physunit.h\
+ src/GameSrc/Headers/player.h\
+ src/GameSrc/Headers/playerlayout.h\
+ src/GameSrc/Headers/plotware.h\
+ src/GameSrc/Headers/popups.h\
+ src/GameSrc/Headers/precompiled.h\
+ src/GameSrc/Headers/rcolors.h\
+ src/GameSrc/Headers/refstuf.h\
+ src/GameSrc/Headers/render.h\
+ src/GameSrc/Headers/rendfx.h\
+ src/GameSrc/Headers/rendtool.h\
+ src/GameSrc/Headers/safeedms.h\
+ src/GameSrc/Headers/saveload.h\
+ src/GameSrc/Headers/schedtyp.h\
+ src/GameSrc/Headers/schedule.h\
+ src/GameSrc/Headers/setploop.h\
+ src/GameSrc/Headers/setup.h\
+ src/GameSrc/Headers/sfxlist.h\
+ src/GameSrc/Headers/shockolate_version.h\
+ src/GameSrc/Headers/shodan.h\
+ src/GameSrc/Headers/sideart.h\
+ src/GameSrc/Headers/sideicon.h\
+ src/GameSrc/Headers/sndcall.h\
+ src/GameSrc/Headers/softdef.h\
+ src/GameSrc/Headers/splash.h\
+ src/GameSrc/Headers/splshpal.h\
+ src/GameSrc/Headers/star.h\
+ src/GameSrc/Headers/statics.h\
+ src/GameSrc/Headers/status.h\
+ src/GameSrc/Headers/strwrap.h\
+ src/GameSrc/Headers/svgacurs.h\
+ src/GameSrc/Headers/target.h\
+ src/GameSrc/Headers/textmaps.h\
+ src/GameSrc/Headers/texture.h\
+ src/GameSrc/Headers/tfdirect.h\
+ src/GameSrc/Headers/tickcount.h\
+ src/GameSrc/Headers/tilecam.h\
+ src/GameSrc/Headers/tilemap.h\
+ src/GameSrc/Headers/tilename.h\
+ src/GameSrc/Headers/tools.h\
+ src/GameSrc/Headers/tpolys.h\
+ src/GameSrc/Headers/treasure.h\
+ src/GameSrc/Headers/trigger.h\
+ src/GameSrc/Headers/verify.h\
+ src/GameSrc/Headers/version.h\
+ src/GameSrc/Headers/view360.h\
+ src/GameSrc/Headers/viewhelp.h\
+ src/GameSrc/Headers/visible.h\
+ src/GameSrc/Headers/vitals.h\
+ src/GameSrc/Headers/vmail.h\
+ src/GameSrc/Headers/wares.h\
+ src/GameSrc/Headers/weapons.h\
+ src/GameSrc/Headers/wrapper.h\
+ src/MacSrc/InitMac.h\
+ src/MacSrc/MacTune.h\
+ src/MacSrc/Modding.h\
+ src/MacSrc/OpenGL.h\
+ src/MacSrc/Prefs.h\
+ src/MacSrc/Shock.h\
+ src/MacSrc/ShockBitmap.h\
+ src/MacSrc/Xmi.h\
+
+OFILES=\
+ src/GameSrc/FrUtils.$O\
+ src/GameSrc/ai.$O\
+ src/GameSrc/airupt.$O\
+ src/GameSrc/amap.$O\
+ src/GameSrc/amaploop.$O\
+ src/GameSrc/ammomfd.$O\
+ src/GameSrc/anim.$O\
+ src/GameSrc/archiveformat.$O\
+ src/GameSrc/audiolog.$O\
+ src/GameSrc/automap.$O\
+ src/GameSrc/bark.$O\
+ src/GameSrc/biohelp.$O\
+ src/GameSrc/cardmfd.$O\
+ src/GameSrc/citres.$O\
+ src/GameSrc/combat.$O\
+ src/GameSrc/cone.$O\
+ src/GameSrc/criterr.$O\
+ src/GameSrc/cutsloop.$O\
+ src/GameSrc/cyber.$O\
+ src/GameSrc/cybermfd.$O\
+ src/GameSrc/cybmem.$O\
+ src/GameSrc/cybrnd.$O\
+ src/GameSrc/damage.$O\
+ src/GameSrc/digifx.$O\
+ src/GameSrc/drugs.$O\
+ src/GameSrc/effect.$O\
+ src/GameSrc/email.$O\
+ src/GameSrc/faceobj.$O\
+ src/GameSrc/fixtrmfd.$O\
+ src/GameSrc/frcamera.$O\
+ src/GameSrc/frclip.$O\
+ src/GameSrc/frcompil.$O\
+ src/GameSrc/frmain.$O\
+ src/GameSrc/frobj.$O\
+ src/GameSrc/froslew.$O\
+ src/GameSrc/frpipe.$O\
+ src/GameSrc/frpts.$O\
+ src/GameSrc/frsetup.$O\
+ src/GameSrc/frtables.$O\
+ src/GameSrc/frterr.$O\
+ src/GameSrc/frutil.$O\
+ src/GameSrc/fullamap.$O\
+ src/GameSrc/fullscrn.$O\
+ src/GameSrc/gameloop.$O\
+ src/GameSrc/gameobj.$O\
+ src/GameSrc/gamerend.$O\
+ src/GameSrc/gamesort.$O\
+ src/GameSrc/gamestrn.$O\
+ src/GameSrc/gamesys.$O\
+ src/GameSrc/gametime.$O\
+ src/GameSrc/gamewrap.$O\
+ src/GameSrc/gearmfd.$O\
+ src/GameSrc/gr2ss.$O\
+ src/GameSrc/grenades.$O\
+ src/GameSrc/hand.$O\
+ src/GameSrc/hflip.$O\
+ src/GameSrc/hkeyfunc.$O\
+ src/GameSrc/hud.$O\
+ src/GameSrc/hudobj.$O\
+ src/GameSrc/init.$O\
+ src/GameSrc/input.$O\
+ src/GameSrc/invent.$O\
+ src/GameSrc/leanmetr.$O\
+ src/GameSrc/mainloop.$O\
+ src/GameSrc/map.$O\
+ src/GameSrc/mfdfunc.$O\
+ src/GameSrc/mfdgadg.$O\
+ src/GameSrc/mfdgames.$O\
+ src/GameSrc/mfdgump.$O\
+ src/GameSrc/mfdpanel.$O\
+ src/GameSrc/minimax.$O\
+ src/GameSrc/mlimbs.$O\
+ src/GameSrc/mouselook.$O\
+ src/GameSrc/movekeys.$O\
+ src/GameSrc/musicai.$O\
+ src/GameSrc/newai.$O\
+ src/GameSrc/newmfd.$O\
+ src/GameSrc/objapp.$O\
+ src/GameSrc/objects.$O\
+ src/GameSrc/objload.$O\
+ src/GameSrc/objprop.$O\
+ src/GameSrc/objsim.$O\
+ src/GameSrc/objuse.$O\
+ src/GameSrc/olh.$O\
+ src/GameSrc/olhscan.$O\
+ src/GameSrc/palfx.$O\
+ src/GameSrc/pathfind.$O\
+ src/GameSrc/physics.$O\
+ src/GameSrc/player.$O\
+ src/GameSrc/plotware.$O\
+ src/GameSrc/popups.$O\
+ src/GameSrc/render.$O\
+ src/GameSrc/rendtool.$O\
+ src/GameSrc/saveload.$O\
+ src/GameSrc/schedule.$O\
+ src/GameSrc/screen.$O\
+ src/GameSrc/setup.$O\
+ src/GameSrc/shodan.$O\
+ src/GameSrc/sideicon.$O\
+ src/GameSrc/sndcall.$O\
+ src/GameSrc/star.$O\
+ src/GameSrc/statics.$O\
+ src/GameSrc/status.$O\
+ src/GameSrc/target.$O\
+ src/GameSrc/textmaps.$O\
+ src/GameSrc/tfdirect.$O\
+ src/GameSrc/tfutil.$O\
+ src/GameSrc/tickcount.$O\
+ src/GameSrc/tools.$O\
+ src/GameSrc/trigger.$O\
+ src/GameSrc/view360.$O\
+ src/GameSrc/viewhelp.$O\
+ src/GameSrc/vitals.$O\
+ src/GameSrc/vmail.$O\
+ src/GameSrc/wares.$O\
+ src/GameSrc/weapons.$O\
+ src/GameSrc/wrapper.$O\
+ src/MusicSrc/MusicDevice.$O\
+ src/MacSrc/InitMac.$O\
+ src/MacSrc/MacTune.$O\
+ src/MacSrc/Modding.$O\
+ src/MacSrc/Prefs.$O\
+ src/MacSrc/SDLSound.$O\
+ src/MacSrc/Shock.$O\
+ src/MacSrc/ShockBitmap.$O\
+ src/MacSrc/Xmi.$O\
+
+</sys/src/cmd/mkone
+
+CLEANFILES=$CLEANFILES $OFILES
+
+# -DDEBUGGING_BLIT -DUSE_OPENGL -DUSEFLUIDSYNTH=1 -DSVGA_SUPPORT
+CFLAGS=$CFLAGS -p -D__plan9__ -D__${objtype}__ \+ -DUSE_SDL_MIXER \
+ -I/sys/include/npe \
+ -I/sys/include/npe/SDL2 \
+ -Isrc/GameSrc/Headers \
+ -Isrc/Libraries/H \
+ -Isrc/Libraries/2D/Source \
+ -Isrc/Libraries/2D/Source/GR \
+ -Isrc/Libraries/3D/Source \
+ -Isrc/Libraries/AFILE/Source \
+ -Isrc/Libraries/DSTRUCT/Source \
+ -Isrc/Libraries/FIX/Source \
+ -Isrc/Libraries/EDMS/Source \
+ -Isrc/Libraries/INPUT/Source \
+ -Isrc/Libraries/LG/Source \
+ -Isrc/Libraries/LG/Source/LOG/src \
+ -Isrc/Libraries/PALETTE/Source \
+ -Isrc/Libraries/RND/Source \
+ -Isrc/Libraries/RES/Source \
+ -Isrc/Libraries/SND/Source \
+ -Isrc/Libraries/UI/Source \
+ -Isrc/Libraries/VOX/Source \
+ -Isrc/MusicSrc \
+ -Isrc/MacSrc \
+
+%.$O: %.c
+ $CC $CFLAGS -o $target $stem.c
+
+$LIB: mklib
+
+mklib:
+ cd src/Libraries
+ mk
+
+clean nuke:V:
+ rm -f *.[$OS] [$OS].out $TARG $CLEANFILES
+ cd src/Libraries
+ mk $target
--- a/src/GameSrc/FrUtils.c
+++ b/src/GameSrc/FrUtils.c
@@ -25,6 +25,7 @@
*
*/
+#include "grs.h"
#include "FrUtils.h"
#include "gr2ss.h"
#include "Shock.h"
--- a/src/GameSrc/Headers/anim.h
+++ b/src/GameSrc/Headers/anim.h
@@ -51,7 +51,7 @@
// General prototypes: anim.c
-void AnimRecur(); // update animations in progress
+void AnimRecur(void); // update animations in progress
// Play and control anims: anim.c
--- a/src/GameSrc/Headers/audiolog.h
+++ b/src/GameSrc/Headers/audiolog.h
@@ -26,11 +26,11 @@
//#include "error.h"
//#include "lg.h"
-extern errtype audiolog_init();
+extern errtype audiolog_init(void);
extern errtype audiolog_play(int email_id);
extern errtype audiolog_bark_play(int bark_id);
-extern void audiolog_stop();
-extern errtype audiolog_loop_callback();
+extern void audiolog_stop(void);
+extern errtype audiolog_loop_callback(void);
extern bool audiolog_playing(int email_id);
extern uchar audiolog_setting;
--- a/src/GameSrc/Headers/bark.h
+++ b/src/GameSrc/Headers/bark.h
@@ -52,4 +52,4 @@
void mfd_bark_expose(MFD *mfd, ubyte control);
void long_bark(ObjID speaker_id, uchar mug_id, int string_id, ubyte color);
-#endif
\ No newline at end of file
+#endif
--- a/src/GameSrc/Headers/biohelp.h
+++ b/src/GameSrc/Headers/biohelp.h
@@ -22,7 +22,7 @@
#include "mfdint.h"
-errtype biohelp_load_cursor();
+errtype biohelp_load_cursor(void);
errtype mfd_biohelp_init(MFD_Func *f);
void mfd_biohelp_expose(MFD *mfd, ubyte control);
--- a/src/GameSrc/Headers/cutsloop.h
+++ b/src/GameSrc/Headers/cutsloop.h
@@ -31,4 +31,4 @@
// Globals
-#endif // __CUTSLOOP_H
\ No newline at end of file
+#endif // __CUTSLOOP_H
--- a/src/GameSrc/Headers/cyber.h
+++ b/src/GameSrc/Headers/cyber.h
@@ -18,10 +18,10 @@
*/
#include "player.h"
-errtype exit_cyberspace_stuff();
+errtype exit_cyberspace_stuff(void);
errtype enter_cyberspace_stuff(char dest_level);
-errtype early_exit_cyberspace_stuff();
-errtype check_cspace_death();
+errtype early_exit_cyberspace_stuff(void);
+errtype check_cspace_death(void);
#define NUM_CS_EFFECTS 3
--- a/src/GameSrc/Headers/cybmem.h
+++ b/src/GameSrc/Headers/cybmem.h
@@ -35,8 +35,8 @@
errtype load_dynamic_memory(int mask);
errtype free_dynamic_memory(int mask);
int avail_memory(int debug_src);
-void Memory_Check();
-int slorkatron_memory_check();
+void Memory_Check(void);
+int slorkatron_memory_check(void);
int flush_resource_cache(void);
// If LZW stuff ever gets lots more efficient, may need to raise this up some.
--- a/src/GameSrc/Headers/drugs.h
+++ b/src/GameSrc/Headers/drugs.h
@@ -92,8 +92,8 @@
void drug_use(int type);
void drug_wear_off(int type);
void drug_effect(int type);
-void drugs_update();
-void drugs_init();
+void drugs_update(void);
+void drugs_init(void);
void drug_startup(bool visible);
void drug_closedown(bool visible);
int drug2triple(int type);
--- a/src/GameSrc/Headers/effect.h
+++ b/src/GameSrc/Headers/effect.h
@@ -169,7 +169,7 @@
errtype add_obj_to_animlist(ObjID id, uchar repeat, uchar reverse, uchar cycle, short speed, int cb_id, intptr_t user_data,
short cbtype);
errtype remove_obj_from_animlist(ObjID id);
-errtype animlist_clear();
+errtype animlist_clear(void);
uchar anim_data_from_id(ObjID id, bool *reverse, bool *cycle);
#define MAX_ANIMLIST_SIZE 64
--- a/src/GameSrc/Headers/email.h
+++ b/src/GameSrc/Headers/email.h
@@ -28,7 +28,7 @@
void read_email(Id new_base, int num);
void select_email(int num, uchar scr);
void set_email_flags(int n);
-void update_email_ware();
+void update_email_ware(void);
void email_page_exit(void);
void mfd_emailmug_expose(MFD *mfd, ubyte control);
uchar mfd_emailmug_handler(MFD *m, uiEvent *ev);
--- a/src/GameSrc/Headers/fullscrn.h
+++ b/src/GameSrc/Headers/fullscrn.h
@@ -61,11 +61,11 @@
// Typedefs
// Prototypes
-void change_svga_screen_mode();
+void change_svga_screen_mode(void);
errtype fullscreen_init(void);
-void fullscreen_start();
+void fullscreen_start(void);
void fullscreen_exit(void);
-errtype fullscreen_overlay();
+errtype fullscreen_overlay(void);
errtype full_lower_region(LGRegion *r);
errtype full_raise_region(LGRegion *r);
--- a/src/GameSrc/Headers/init.h
+++ b/src/GameSrc/Headers/init.h
@@ -24,7 +24,7 @@
extern void free_all(void);
extern uchar ppall[]; // pointer to main shadow palette
-extern void shock_alloc_ipal();
+extern void shock_alloc_ipal(void);
errtype load_da_palette(void);
--- a/src/GameSrc/Headers/input.h
+++ b/src/GameSrc/Headers/input.h
@@ -59,7 +59,7 @@
/**
* @deprecated does nothing
*/
-void free_cursor_bitmaps();
+void free_cursor_bitmaps(void);
void input_chk(void);
// uchar main_kb_callback(uiEvent *h, LGRegion *r, intptr_t udata);
--- a/src/GameSrc/Headers/invent.h
+++ b/src/GameSrc/Headers/invent.h
@@ -76,7 +76,7 @@
void inv_change_fullscreen(uchar on);
void inv_update_fullscreen(uchar full);
-errtype inventory_update_screen_mode();
+errtype inventory_update_screen_mode(void);
void push_inventory_cursors(LGCursor *newcurs);
void pop_inventory_cursors(void);
--- a/src/GameSrc/Headers/mainloop.h
+++ b/src/GameSrc/Headers/mainloop.h
@@ -62,7 +62,7 @@
void mainloop(int argc, char *argv[]);
void loopmode_switch(short *cmode);
-errtype static_change_copy();
+errtype static_change_copy(void);
void loopmode_exit(short loopmode);
void loopmode_enter(short loopmode);
--- a/src/GameSrc/Headers/map.h
+++ b/src/GameSrc/Headers/map.h
@@ -155,14 +155,20 @@
//};
uchar param;
struct _lighting {+ /*
uchar floor : 4;
uchar ceil : 4;
+ */
+ uchar fc;
} templight;
union _space { struct _tmaps {+ /*
ushort floor : 5;
ushort ceil : 5;
ushort wall : 6;
+ */
+ ushort fcw;
} real;
struct _cybcolors {uchar floor;
@@ -174,9 +180,12 @@
struct _render_info {uchar sub_clip;
uchar clear;
+ /*
uchar rotflr : 2;
uchar rotceil : 2;
uchar flicker : 4;
+ */
+ uchar rotf;
} rinfo;
} oMapElem;
@@ -190,9 +199,9 @@
} oFullMap;
#define ome_tiletype(me_ptr) ((me_ptr)->tiletype)
-#define ome_tmap_flr(me_ptr) ((me_ptr)->space.real.floor)
-#define ome_tmap_wall(me_ptr) ((me_ptr)->space.real.wall)
-#define ome_tmap_ceil(me_ptr) ((me_ptr)->space.real.ceil)
+#define ome_tmap_flr(me_ptr) ((me_ptr)->space.real.fcw & 31)
+#define ome_tmap_wall(me_ptr) ((me_ptr)->space.real.fcw >> 5 & 31)
+#define ome_tmap_ceil(me_ptr) ((me_ptr)->space.real.fcw >> 10 & 63)
#define ome_tmap(me_ptr, idx) \
(((idx) == TMAP_FLR) ? me_tmap_flr(me_ptr) : (((idx) == TMAP_CEIL) ? me_tmap_ceil(me_ptr) : me_tmap_wall(me_ptr)))
#define ome_objref(me_ptr) ((me_ptr)->objRef)
@@ -203,13 +212,13 @@
#define ome_height(me_ptr,idx) (((idx) == HGT_FLOOR) ? me_height_flr(me_ptr) : me_height_ceil(me_ptr))
#define ome_cybcolor_flr(me_ptr) ((me_ptr)->space.cyber.floor)
#define ome_cybcolor_ceil(me_ptr) ((me_ptr)->space.cyber.ceil)
-#define ome_templight_flr(me_ptr) ((me_ptr)->templight.floor)
-#define ome_templight_ceil(me_ptr) ((me_ptr)->templight.ceil)
+#define ome_templight_flr(me_ptr) ((me_ptr)->templight.fc & 15)
+#define ome_templight_ceil(me_ptr) ((me_ptr)->templight.fc >> 4 & 15)
#define ome_subclip(me_ptr) ((me_ptr)->rinfo.sub_clip)
#define ome_clearsolid(me_ptr) ((me_ptr)->rinfo.clear)
-#define ome_rotflr(me_ptr) ((me_ptr)->rinfo.rotflr)
-#define ome_rotceil(me_ptr) ((me_ptr)->rinfo.rotceil)
-#define ome_flicker(me_ptr) ((me_ptr)->rinfo.flicker)
+#define ome_rotflr(me_ptr) ((me_ptr)->rinfo.rotf & 3)
+#define ome_rotceil(me_ptr) ((me_ptr)->rinfo.rotf >> 2 & 3)
+#define ome_flicker(me_ptr) ((me_ptr)->rinfo.rotf >> 4 & 15)
#endif
typedef struct {--- a/src/GameSrc/Headers/mfdext.h
+++ b/src/GameSrc/Headers/mfdext.h
@@ -114,14 +114,14 @@
// -------
extern void set_inventory_mfd(ubyte l_class, ubyte type, uchar grab);
-extern void init_newmfd();
+extern void init_newmfd(void);
extern void screen_init_mfd(uchar fullscrn);
-extern void screen_init_mfd_draw();
-extern void keyboard_init_mfd();
-extern void mfd_update();
+extern void screen_init_mfd_draw(void);
+extern void keyboard_init_mfd(void);
+extern void mfd_update(void);
extern void mfd_notify_func(ubyte func, ubyte slot, uchar grab, MFD_Status stat, uchar FullRedraw);
extern void mfd_force_update_single(int which_mfd);
-extern void mfd_force_update();
+extern void mfd_force_update(void);
extern int mfd_grab(void);
extern int mfd_grab_func(int my_func, int my_slot);
extern uchar mfd_yield_func(int func, int *mfd_id);
--- a/src/GameSrc/Headers/mfdint.h
+++ b/src/GameSrc/Headers/mfdint.h
@@ -157,13 +157,13 @@
MFDhandler handlers[NUM_MFD_HANDLERS];
} MFD_Func;
-extern void init_mfd_funcs();
+extern void init_mfd_funcs(void);
extern uchar mfd_view_callback_full(uiEvent *e, LGRegion *r, intptr_t udata);
extern uchar mfd_view_callback(uiEvent *e, LGRegion *r, intptr_t udata);
extern uchar mfd_button_callback(uiEvent *e, LGRegion *r, intptr_t udata);
extern uchar mfd_button_callback_kb(ushort keycode, uint32_t context, intptr_t data);
extern uchar mfd_update_current_slot(ubyte mfd_id, ubyte status, ubyte num_steps);
-extern void mfd_init_funcs();
+extern void mfd_init_funcs(void);
extern void mfd_set_cliprect(LGRect *r);
extern void set_mfd_func(int fnum, void *e, void *h, void *initf, ubyte flags);
extern LGPoint mfd_draw_string(char *s, short x, short y, long c, uchar DrawString);
@@ -172,7 +172,7 @@
extern void set_slot_to_func(ubyte snum, ubyte fnum, MFD_Status stat);
extern void mfd_draw_bitmap(grs_bitmap *bmp, short x, short y);
extern void mfd_partial_clear(LGRect *r);
-extern void init_newmfd_button_cursors();
+extern void init_newmfd_button_cursors(void);
extern void mfd_update_display(MFD *m, short x0, short y0, short x1, short y1);
extern void mfd_clear_rects(void);
extern errtype mfd_add_rect(short x, short y, short x1, short y1);
--- a/src/GameSrc/Headers/mfdpanel.h
+++ b/src/GameSrc/Headers/mfdpanel.h
@@ -201,4 +201,4 @@
#define access_primary_mfd (*(((char *)&player_struct.mfd_func_data[MFD_ACCESSPANEL_FUNC][0] + sizeof(int))))
#define grid_primary_mfd (*(((char *)&player_struct.mfd_func_data[MFD_GRIDPANEL_FUNC][0])))
-#endif
\ No newline at end of file
+#endif
--- a/src/GameSrc/Headers/mlimbs.h
+++ b/src/GameSrc/Headers/mlimbs.h
@@ -102,7 +102,7 @@
extern volatile uint default_ramp_time;
extern volatile uchar num_XMIDI_sequences;
extern volatile ulong mlimbs_counter;
-extern volatile void (*mlimbs_AI)();
+extern volatile void (*mlimbs_AI)(void);
extern volatile int mlimbs_master_slot;
/* Function prototypes */
--- a/src/GameSrc/Headers/mouselook.h
+++ b/src/GameSrc/Headers/mouselook.h
@@ -2,12 +2,12 @@
// Prototypes
-void mouse_look_stop();
-void mouse_look_physics();
-void mouse_look_toggle();
-void mouse_look_off();
-void center_mouse();
-void mouse_look_unpause();
+void mouse_look_stop(void);
+void mouse_look_physics(void);
+void mouse_look_toggle(void);
+void mouse_look_off(void);
+void center_mouse(void);
+void mouse_look_unpause(void);
// Globals
--- a/src/GameSrc/Headers/musicai.h
+++ b/src/GameSrc/Headers/musicai.h
@@ -118,15 +118,15 @@
// Initialize the AI portion of the MLIMBS system.
errtype mlimbs_AI_init(void);
void music_ai(void);
-errtype musicai_shutdown();
+errtype musicai_shutdown(void);
errtype musicai_reset(uchar runai);
int gen_monster(int monster_num);
-void musicai_clear();
+void musicai_clear(void);
errtype mai_monster_nearby(int monster_type);
-errtype mai_attack();
-errtype mai_intro();
-errtype mai_monster_defeated();
-errtype mai_player_death();
+errtype mai_attack(void);
+errtype mai_intro(void);
+errtype mai_monster_defeated(void);
+errtype mai_player_death(void);
errtype mai_transition(int new_trans);
errtype make_request(int chunk_num, int piece_ID);
@@ -135,10 +135,10 @@
errtype load_score_for_location(int x, int y);
errtype load_score_from_cfg(char *filename);
void load_score_guts(uint8_t score_playing);
-errtype music_init();
-errtype digifx_init();
-errtype stop_digi_fx();
-void clear_digi_fx();
+errtype music_init(void);
+errtype digifx_init(void);
+errtype stop_digi_fx(void);
+void clear_digi_fx(void);
int play_digi_fx_master(int sfx_code, int num_loops, ObjID id, ushort x, ushort y);
#define play_digi_fx(sfx_code, loops) play_digi_fx_master(sfx_code, loops, OBJ_NULL, 0, 0)
#define play_digi_fx_obj(sfx_code, num_loops, id) play_digi_fx_master(sfx_code, num_loops, id, 0, 0)
--- a/src/GameSrc/Headers/newmfd.h
+++ b/src/GameSrc/Headers/newmfd.h
@@ -39,11 +39,11 @@
void fullscreen_refresh_mfd(ubyte mfd_id);
void mfd_change_fullscreen(uchar on);
int mfd_choose_func(int my_func, int my_slot);
-errtype mfd_clear_all();
+errtype mfd_clear_all(void);
void mfd_draw_button_panel(ubyte mfd_id);
ubyte mfd_get_func(ubyte mfd_id, ubyte s);
uchar mfd_scan_opacity(int mfd_id, LGPoint epos);
-errtype mfd_update_screen_mode();
+errtype mfd_update_screen_mode(void);
void mfd_zoom_rect(LGRect *start, int mfdnum);
void mfd_language_change(void);
--- a/src/GameSrc/Headers/objapp.h
+++ b/src/GameSrc/Headers/objapp.h
@@ -19,7 +19,7 @@
#ifndef __OBJAPP_H
#define __OBJAPP_H
-#pragma pack(push,2)
+#pragma pack on // 2
/*
** $Header: r:/prj/cit/src/inc/RCS/objapp.h 1.25 1994/08/30 07:15:21 xemu Exp $
@@ -155,9 +155,9 @@
#define OBJ_LOC_FINE_X(oloc) ((ushort)((oloc).x & 0xFF00u))
#define OBJ_LOC_FINE_Y(oloc) ((ushort)((oloc).y & 0xFF00u))
#ifdef SAFE_FIX
-#define OBJ_LOC_VAL_TO_FIX(value) (fix_make((value >> 8), ((value & 0xFF00) << 8)))
+#define OBJ_LOC_VAL_TO_FIX(value) (fix_make(((value) >> 8), (((value) & 0xFF00) << 8)))
#else
-#define OBJ_LOC_VAL_TO_FIX(value) (((fix)value) << 8)
+#define OBJ_LOC_VAL_TO_FIX(value) ((fix)(value) << 8)
#endif
typedef struct {@@ -303,6 +303,6 @@
uchar ObjRefStateBinIterator(ObjRefStateBin *bin);
-#pragma pack(pop)
+#pragma pack off
#endif // OBJAPP_H
--- a/src/GameSrc/Headers/objcrit.h
+++ b/src/GameSrc/Headers/objcrit.h
@@ -32,7 +32,7 @@
#include "objsim.h"
#include "objclass.h"
-#pragma pack(push,2)
+#pragma pack on // 2
typedef struct {// COMMON_OBJSPEC_FIELDS;
@@ -264,6 +264,6 @@
#define set_crit_view(osid, newview) \
objCritters[osid].current_posture = (newview << 8) + (objCritters[osid].current_posture & 0xF)
-#pragma pack(pop)
+#pragma pack off
#endif // __OBJCRIT_H
--- a/src/GameSrc/Headers/objects.h
+++ b/src/GameSrc/Headers/objects.h
@@ -64,7 +64,7 @@
#include "objapp.h"
#endif
-#pragma pack(push,2)
+#pragma pack on // 2
// The common data for all objects
typedef struct Obj {@@ -130,13 +130,18 @@
// as appropriate.
typedef struct ObjSpec {+ /*
union { struct {ObjID id : 15; // ID in master list
ushort tile : 1; // look in tiled array?
} bits;
+ */
+ ushort bits;
ObjSpecID headused;
+ /*
};
+ */
union {ObjSpecID next; // next struct in free or used chain
ObjSpecID headfree;
@@ -144,6 +149,9 @@
ObjSpecID prev; // prev struct in used chain
} ObjSpec;
+#define OSBITSID(x) ((x)->bits & (1<<15)-1)
+#define OSBITSTILE(x) ((x)->bits >> 15 & 1)
+
// This macro permutes the ObjSpecID pmo through all of the ObjSpecs in the
// used chain of objspec. "tile" is set to whether it's a tiled object.
// Note that the "tile =" line in the third part refers to the pmo that
@@ -311,6 +319,6 @@
//////////////////////////////
-#pragma pack(pop)
+#pragma pack off
#endif // __OBJECTS_H
--- a/src/GameSrc/Headers/objgame.h
+++ b/src/GameSrc/Headers/objgame.h
@@ -30,7 +30,7 @@
// Includes
#include "objclass.h"
-#pragma pack(push,2)
+#pragma pack on // 2
// Instance Typedefs
typedef struct {@@ -420,6 +420,6 @@
extern ObjContainer default_container;
#endif
-#pragma pack(pop)
+#pragma pack off
#endif // __OBJGAME_H
--- a/src/GameSrc/Headers/objload.h
+++ b/src/GameSrc/Headers/objload.h
@@ -31,7 +31,7 @@
#include "objprop.h"
#include "objapp.h"
-#pragma pack(push,2)
+#pragma pack on // 2
#define NUM_OBJECT_BIT_LEN ((NUM_OBJECT + 7) >> 3)
@@ -67,6 +67,6 @@
extern grs_bitmap *bitmaps_3d[NUM_OBJECT];
#endif
-#pragma pack(pop)
+#pragma pack off
#endif // __OBJLOAD_H
--- a/src/GameSrc/Headers/objprop.h
+++ b/src/GameSrc/Headers/objprop.h
@@ -34,7 +34,7 @@
#include "objgame.h"
#include "objcrit.h"
-#pragma pack(push,2)
+#pragma pack on // 2
// The overall object properties typedef
typedef struct ObjProp {@@ -118,6 +118,6 @@
extern ObjProp ObjProps[NUM_OBJECT];
#endif
-#pragma pack(pop)
+#pragma pack off
#endif // __OBJPROP_H
--- a/src/GameSrc/Headers/objsim.h
+++ b/src/GameSrc/Headers/objsim.h
@@ -96,19 +96,19 @@
grs_bitmap *get_text_bitmap_obj(ObjID cobjid, char dest_type, char *pscale);
// Prototypes
-errtype obj_init();
-errtype obj_shutdown();
+errtype obj_init(void);
+errtype obj_shutdown(void);
ObjID obj_create_base(int triple);
ObjID obj_create_clone(ObjID dna);
errtype obj_move_to_vel(ObjID id, ObjLoc *newloc, uchar phys_tel, fix x_dot, fix y_dot, fix z_dot);
errtype obj_move_to(ObjID id, ObjLoc *newloc, uchar phys_tel);
uchar obj_destroy(ObjID id);
-errtype obj_holocaust();
+errtype obj_holocaust(void);
uchar obj_holocaust_func(short keycode, ulong context, void *data);
-errtype obj_load_properties();
+errtype obj_load_properties(void);
errtype obj_create_player(ObjLoc *plr_loc);
Ref ref_from_critter_data(ObjID oid, int triple, byte posture, short frame, short view);
-errtype obj_zero_unused();
+errtype obj_zero_unused(void);
grs_bitmap *obj_get_model_data(ObjID id, fix *x, fix *y, fix *z, grs_bitmap *bm2, Ref *ref1, Ref *ref2);
errtype obj_model_hack(ObjID id, uchar *hack_x, uchar *hack_y, uchar *hack_z, uchar *hack_type);
uchar obj_combat_destroy(ObjID id);
--- a/src/GameSrc/Headers/objuse.h
+++ b/src/GameSrc/Headers/objuse.h
@@ -91,7 +91,7 @@
void unmulti_anim_callback(ObjID id, intptr_t user_data);
-errtype gear_power_outage();
+errtype gear_power_outage(void);
// Globals
--- a/src/GameSrc/Headers/palfx.h
+++ b/src/GameSrc/Headers/palfx.h
@@ -26,8 +26,8 @@
*/
extern void palfx_fade_up(uchar do_now);
-extern void palfx_fade_down();
-extern void palfx_init();
+extern void palfx_fade_down(void);
+extern void palfx_init(void);
void finish_pal_effect(byte id);
byte palfx_start_fade_up(uchar *new_pal);
--- a/src/GameSrc/Headers/pathfind.h
+++ b/src/GameSrc/Headers/pathfind.h
@@ -24,7 +24,7 @@
errtype check_requests(uchar priority);
errtype delete_path(char path_id);
uchar check_path_cutting(LGPoint new_sq, char path_id);
-errtype reset_pathfinding();
+errtype reset_pathfinding(void);
char compute_next_step(char path_id, LGPoint *pt, char step_num);
uchar pf_check_doors(MapElem *pme, char dir, ObjID *open_door);
uchar pf_obj_doors(MapElem *pme1, MapElem *pme2, char dir, ObjID *open_door);
--- a/src/GameSrc/Headers/player.h
+++ b/src/GameSrc/Headers/player.h
@@ -120,8 +120,7 @@
ubyte misc[NUM_MISC_SOFTS];
} softs_data;
-// FIXME pragma
-#pragma pack(push,1)
+#pragma pack on // 1
typedef struct _Player {// Static Game Data
@@ -278,7 +277,7 @@
uchar pad[9];
} Player;
-#pragma pack(pop)
+#pragma pack off
#define PLAYER_OBJ (player_struct.rep)
#define PLAYER_BIN_X OBJ_LOC_BIN_X(objs[PLAYER_OBJ].loc)
--- a/src/GameSrc/Headers/playerlayout.h
+++ b/src/GameSrc/Headers/playerlayout.h
@@ -14,14 +14,11 @@
// PL_MFD_PUZZLE_SIZE that is set on entry.
#define JOIN(x,y) x ## y
#define STRUCTNAME(x,y) JOIN(x,y)
+#define RESNAME STRUCTNAME(PlayerLayout_M, PL_MFD_PUZZLE_SIZE)
+#define RESFNAME JOIN(RESNAME, f)
// Describe the layout of the player in a resfile.
-const ResLayout STRUCTNAME(PlayerLayout_M, PL_MFD_PUZZLE_SIZE) =
-{- 711 + PL_MFD_PUZZLE_SIZE + 654, // size on disc
- sizeof(Player), // size in memory
- 0, // flags
- {+const ResField RESFNAME[] = { { RFFT_BIN(20), offsetof(Player, name) }, //char [20] { RFFT_UINT8, offsetof(Player, realspace_level) }, //char { RFFT_BIN(4), offsetof(Player, difficulty) }, //byte [4]@@ -174,8 +171,16 @@
{ RFFT_BIN(9), offsetof(Player, pad) }, //uchar [9] { RFFT_END, 0 }- }
};
+const ResLayout RESNAME =
+{+ 711 + PL_MFD_PUZZLE_SIZE + 654, // size on disc
+ sizeof(Player), // size in memory
+ 0, // flags
+ RESFNAME
+};
#undef JOIN
#undef STRUCTNAME
+#undef RESNAME
+#undef RESFNAME
--- a/src/GameSrc/Headers/setup.h
+++ b/src/GameSrc/Headers/setup.h
@@ -75,7 +75,7 @@
void setup_exit(void);
// Displays the intro screen(s)
-errtype setup_intro_draw();
+errtype setup_intro_draw(void);
// Call this when ready to start a new game.
void go_and_start_the_game_already(void);
--- /dev/null
+++ b/src/GameSrc/Headers/shockolate_version.h
@@ -1,0 +1,27 @@
+/*
+
+Copyright (C) 2019 Shockolate Project
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+// This is autgenerated CMake file, don't edit it manually!
+
+#ifndef SHOCKOLATE_SRC_GAMESRC_HEADERS_SHOCOLATE_VERSION_H_
+#define SHOCKOLATE_SRC_GAMESRC_HEADERS_SHOCOLATE_VERSION_H_
+
+#define SHOCKOLATE_VERSION L"⑨Shockolate"
+
+#endif // SHOCKOLATE_SRC_GAMESRC_HEADERS_SHOCOLATE_VERSION_H_
--- a/src/GameSrc/Headers/sideicon.h
+++ b/src/GameSrc/Headers/sideicon.h
@@ -72,13 +72,13 @@
// Prototypes
extern void init_side_icon(ubyte side_icon, int type, int num);
-extern void side_icon_expose_all();
+extern void side_icon_expose_all(void);
extern void side_icon_expose(ubyte side_icon);
-extern void init_all_side_icons();
+extern void init_all_side_icons(void);
void init_side_icon_popups(void);
extern void screen_init_side_icons(LGRegion *root);
-errtype side_icon_load_bitmaps();
-errtype side_icon_free_bitmaps();
+errtype side_icon_load_bitmaps(void);
+errtype side_icon_free_bitmaps(void);
void side_icon_language_change(void);
void zoom_to_side_icon(LGPoint from, int icon);
--- a/src/GameSrc/Headers/softdef.h
+++ b/src/GameSrc/Headers/softdef.h
@@ -48,4 +48,4 @@
#define GAME_15 0b00010000u
#define GAME_TRIPTOE 0b00100000u
#define GAME_GAME6 0b01000000u
-#define GAME_WING0 0b10000000u
\ No newline at end of file
+#define GAME_WING0 0b10000000u
--- a/src/GameSrc/Headers/status.h
+++ b/src/GameSrc/Headers/status.h
@@ -203,10 +203,10 @@
void status_bio_init(void);
void status_bio_start(void);
void status_bio_end(void);
-void status_bio_update_screenmode();
+void status_bio_update_screenmode(void);
void status_bio_draw(void);
-extern void status_vitals_init();
+extern void status_vitals_init(void);
// Add a variable to be tracked by the biorhythm monitor.
// Track the NULL pointer to clear out a track slot.
--- a/src/GameSrc/Headers/target.h
+++ b/src/GameSrc/Headers/target.h
@@ -55,7 +55,7 @@
void select_current_target(ObjID id, uchar force_mfd);
void mfd_target_expose(MFD *m, ubyte control);
uchar mfd_target_handler(MFD *m, uiEvent *e);
-void toggle_current_target();
+void toggle_current_target(void);
void mfd_targetware_expose(MFD *mfd, ubyte control);
uchar mfd_targetware_handler(MFD *m, uiEvent *e);
--- a/src/GameSrc/Headers/textmaps.h
+++ b/src/GameSrc/Headers/textmaps.h
@@ -122,14 +122,14 @@
// Prototypes
void free_textures(void);
-void load_textures();
-errtype load_alternate_textures();
-errtype load_master_texture_properties();
+void load_textures(void);
+errtype load_alternate_textures(void);
+errtype load_master_texture_properties(void);
errtype load_small_texturemaps(void);
errtype bitmap_array_unload(int *num_bitmaps, grs_bitmap *arr[]);
errtype Init_Lighting(void);
-errtype unload_master_texture_properties();
-errtype clear_texture_properties();
+errtype unload_master_texture_properties(void);
+errtype clear_texture_properties(void);
// returns whether or not a given bitmap is, well, empty.
--- a/src/GameSrc/Headers/tools.h
+++ b/src/GameSrc/Headers/tools.h
@@ -93,7 +93,7 @@
// Writes a message to the info LGRegion
errtype string_message_info(int strnum);
errtype message_info(const char *info_text);
-errtype message_clear_check();
+errtype message_clear_check(void);
// Spit up a box asking for confirmation. Returns true or false, accordingly.
uchar confirm_box(char *box_text);
@@ -108,8 +108,8 @@
errtype tight_loop(uchar check_input);
// set / unset "wait" cursor
-errtype begin_wait();
-errtype end_wait();
+errtype begin_wait(void);
+errtype end_wait(void);
// search/replace characters in string
void string_replace_char(char *s, char from, char to);
--- a/src/GameSrc/Headers/trigger.h
+++ b/src/GameSrc/Headers/trigger.h
@@ -70,15 +70,20 @@
uchar x;
uchar y;
union {+ /*
struct {uchar floor : 1;
uchar key : 7;
};
+ */
uchar floor_key;
};
char inuse;
} height_semaphor;
+#define THFLOOR(x) ((x)->floor_key & 1)
+#define THKEY(x) ((x)->floor_key >> 1)
+
typedef struct _EmailSchedEvent {ushort timestamp;
ushort type;
@@ -117,13 +122,13 @@
errtype check_deathwatch_triggers(ObjID id, uchar really_dead);
errtype check_entrance_triggers(uchar old_x, uchar old_y, uchar new_x, uchar new_y);
-errtype do_shodan_triggers();
+errtype do_shodan_triggers(void);
errtype do_multi_stuff(ObjID id);
void animate_callback_func(ObjID id, intptr_t user_data);
uchar comparator_check(int comparator, ObjID obj, uchar *special_code);
-errtype do_level_entry_triggers();
+errtype do_level_entry_triggers(void);
short qdata_get(short qdata);
--- a/src/GameSrc/Headers/vitals.h
+++ b/src/GameSrc/Headers/vitals.h
@@ -20,7 +20,7 @@
#ifndef VITALS_H
#define VITALS_H
-void status_vitals_start();
-void status_vitals_end();
+void status_vitals_start(void);
+void status_vitals_end(void);
#endif
--- a/src/GameSrc/Headers/wares.h
+++ b/src/GameSrc/Headers/wares.h
@@ -99,9 +99,9 @@
ubyte flags; // Do we have a sideicon, etc.
ubyte sideicon; // Which sideicon corresponds
void (*turnon)(uchar visible, uchar real_start); // Function slots for turn on, etc.
- void (*effect)();
+ void (*effect)(void);
void (*turnoff)(uchar visible, uchar real_stop);
- bool (*check)();
+ bool (*check)(void);
} WARE;
typedef struct {@@ -137,10 +137,10 @@
// of a ware in the player's inventory. zero means
// the player doesn't have it.
-void wares_init();
+void wares_init(void);
// sets up the wares system
-void wares_update();
+void wares_update(void);
// called from the game loop
void hardware_closedown(uchar visible);
--- a/src/GameSrc/Headers/weapons.h
+++ b/src/GameSrc/Headers/weapons.h
@@ -108,7 +108,7 @@
void change_selected_weapon(int new_weapon);
// Called at a constant factor to blow off heat on energy weapons
-void cool_off_beam_weapons();
+void cool_off_beam_weapons(void);
// This routine is used to jerk the cursor around, as a result of
// poor accuracy, or ammo recoil
--- a/src/GameSrc/Headers/wrapper.h
+++ b/src/GameSrc/Headers/wrapper.h
@@ -113,8 +113,10 @@
REF_STR_MousInv,
REF_STR_Seqer = 0x20000000,
- REF_STR_ADLMIDI,
REF_STR_NativeMI,
+#ifdef USE_ADLMIDI
+ REF_STR_ADLMIDI,
+#endif
#ifdef USE_FLUIDSYNTH
REF_STR_FluidSyn,
#endif // USE_FLUIDSYNTH
--- a/src/GameSrc/ai.c
+++ b/src/GameSrc/ai.c
@@ -23,6 +23,7 @@
* $Date: 1994/10/18 19:50:51 $
*/
+#include "precompiled.h"
#include <stdlib.h>
#include "ai.h"
--- a/src/GameSrc/airupt.c
+++ b/src/GameSrc/airupt.c
@@ -27,6 +27,7 @@
#include <stdlib.h>
+#include "precompiled.h"
#include "airupt.h"
#include "musicai.h"
#include "map.h"
@@ -127,7 +128,7 @@
uchar mai_semaphor = FALSE;
-void music_ai() {+void music_ai(void) {// mlimbs_semaphore = TRUE;
ai_cycle = TRUE;
// if ((run_asynch_music_ai) && (!mai_semaphor))
--- a/src/GameSrc/amap.c
+++ b/src/GameSrc/amap.c
@@ -43,6 +43,7 @@
#include <string.h>
+#include "precompiled.h"
#include "cit2d.h"
#include "colors.h"
#include "cybstrng.h"
--- a/src/GameSrc/amaploop.c
+++ b/src/GameSrc/amaploop.c
@@ -29,6 +29,7 @@
#include "ShockBitmap.h"
+#include "precompiled.h"
#include "amaploop.h"
#include "audiolog.h"
#include "criterr.h"
--- a/src/GameSrc/ammomfd.c
+++ b/src/GameSrc/ammomfd.c
@@ -62,6 +62,7 @@
#include <string.h>
+#include "precompiled.h"
#include "mfdint.h"
#include "mfdext.h"
#include "mfddims.h"
--- a/src/GameSrc/anim.c
+++ b/src/GameSrc/anim.c
@@ -19,6 +19,7 @@
#include <SDL.h>
+#include "precompiled.h"
#include "Shock.h"
#include "anim.h"
#include "gr2ss.h"
@@ -29,7 +30,7 @@
bool done_playing_anim = false;
// play
-void AnimRecur() {+void AnimRecur(void) {int x, y = 0;
if (done_playing_anim)
--- a/src/GameSrc/archiveformat.c
+++ b/src/GameSrc/archiveformat.c
@@ -17,6 +17,7 @@
*/
+#include "precompiled.h"
#include "archiveformat.h"
#include "effect.h"
#include "lvldata.h"
@@ -33,27 +34,32 @@
#include "textmaps.h"
#include "trigger.h"
+#ifdef RES_FORMAT /* FIXME */
+#undef RES_FORMAT
+#endif
+
#define RES_FORMAT(layout) \
- { ResDecode, ResEncode, (UserDecodeData)&layout, NULL }+ { ResDecode, ResEncode, (UserDecodeData)(&layout), NULL }-const ResLayout U32Layout = {- 4, sizeof(uint32_t), 0, {+const ResField U32Layoutf[] = { { RFFT_UINT32, 0 }, { RFFT_END, 0 }- }
};
+const ResLayout U32Layout = {+ 4, sizeof(uint32_t), 0, U32Layoutf
+};
const ResourceFormat U32Format = RES_FORMAT(U32Layout);
-const ResLayout U16Layout = {- 2, sizeof(uint16_t), 0, {+const ResField U16Layoutf[] = { { RFFT_UINT16, 0 }, { RFFT_END, 0 }- }
};
+const ResLayout U16Layout = {+ 2, sizeof(uint16_t), 0, U16Layoutf
+};
// Schedule layout.
-const ResLayout ScheduleLayout = {- 22, sizeof(Schedule), 0, {+const ResField ScheduleLayoutf[] = { { RFFT_UINT32, offsetof(Schedule, queue.size) }, { RFFT_UINT32, offsetof(Schedule, queue.fullness) }, { RFFT_UINT32, offsetof(Schedule, queue.elemsize) },@@ -62,30 +68,29 @@
{ RFFT_PAD, 4 }, // pointer member { RFFT_PAD, 4 }, // pointer member { RFFT_END, 0 }- }
};
+const ResLayout ScheduleLayout = {+ 22, sizeof(Schedule), 0, ScheduleLayoutf
+};
const ResourceFormat ScheduleFormat = RES_FORMAT(ScheduleLayout);
// Schedule queue element. This has several possible formats which I'm treating
// as plain binary for the time being.
-const ResLayout ScheduleQueueLayout = {- 8, sizeof(SchedEvent), LAYOUT_FLAG_ARRAY, {+const ResField ScheduleQueueLayoutf[] = { { RFFT_UINT16, offsetof(SchedEvent, timestamp) }, { RFFT_UINT16, offsetof(SchedEvent, type) }, { RFFT_BIN(SCHED_DATASIZ), offsetof(SchedEvent, data) }, { RFFT_END, 0 }- }
};
+const ResLayout ScheduleQueueLayout = {+ 8, sizeof(SchedEvent), LAYOUT_FLAG_ARRAY, ScheduleQueueLayoutf
+};
const ResourceFormat ScheduleQueueFormat = RES_FORMAT(ScheduleQueueLayout);
// Describe the layout of the map info structure (FullMap). While technically
// this ends in an array, in practice it only ever has a single entry so just
// treat it as a flat structure.
-const ResLayout FullMapLayout = {- 58, // size on disc
- sizeof(FullMap), // size in memory
- 0, // flags
- {+const ResField FullMapLayoutf[] = { { RFFT_UINT32, offsetof(FullMap, x_size) }, { RFFT_UINT32, offsetof(FullMap, y_size) }, { RFFT_UINT32, offsetof(FullMap, x_shft) },@@ -102,16 +107,17 @@
{ RFFT_UINT8, offsetof(FullMap, sched[0].queue.grow) }, { RFFT_PAD, 12 /* 3 pointers at end */ }, { RFFT_END, 0 }- }
};
+const ResLayout FullMapLayout = {+ 58, // size on disc
+ sizeof(FullMap), // size in memory
+ 0, // flags
+ FullMapLayoutf
+};
const ResourceFormat FullMapFormat = RES_FORMAT(FullMapLayout);
// Describe the layout of a map element (tile; MapElem).
-const ResLayout MapElemLayout = {- 16, // size on disc
- sizeof(MapElem), // size in memory
- LAYOUT_FLAG_ARRAY, // flags
- {+const ResField MapElemLayoutf[] = { { RFFT_UINT8, offsetof(MapElem, tiletype) }, { RFFT_UINT8, offsetof(MapElem, flr_rotnhgt) }, { RFFT_UINT8, offsetof(MapElem, ceil_rotnhgt) },@@ -127,26 +133,28 @@
{ RFFT_UINT8, offsetof(MapElem, flick_qclip) }, { RFFT_UINT8, offsetof(MapElem, templight) }, { RFFT_END, 0 }- }
};
+const ResLayout MapElemLayout = {+ 16, // size on disc
+ sizeof(MapElem), // size in memory
+ LAYOUT_FLAG_ARRAY, // flags
+ MapElemLayoutf
+};
// Describe the layout of level texture info (array of 16-bit texture IDs).
+const ResField TextureInfoLayoutf[] = {+ { RFFT_UINT16, 0 },+ { RFFT_END, 0 }+};
const ResLayout TextureInfoLayout = {2, // size on disc
sizeof(short), // size in memory
LAYOUT_FLAG_ARRAY, // flags
- {- { RFFT_UINT16, 0 },- { RFFT_END, 0 }- }
+ TextureInfoLayoutf
};
// Describe the layout of the objects table in a resfile. (27-byte PC record).
-const ResLayout ObjV11Layout = {- 27, // size on disc
- sizeof(Obj), // size in memory
- LAYOUT_FLAG_ARRAY, // flags
- {+const ResField ObjV11Layoutf[] = { { RFFT_UINT8, offsetof(Obj, active) }, { RFFT_UINT8, offsetof(Obj, obclass) }, { RFFT_UINT8, offsetof(Obj, subclass) },@@ -168,16 +176,17 @@
{ RFFT_UINT8, offsetof(Obj, info.time_remainder) }, { RFFT_UINT8, offsetof(Obj, info.inst_flags) }, { RFFT_END, 0 }- }
};
+const ResLayout ObjV11Layout = {+ 27, // size on disc
+ sizeof(Obj), // size in memory
+ LAYOUT_FLAG_ARRAY, // flags
+ ObjV11Layoutf
+};
// Describe the layout of the objects table in a resfile. ("Easysaves" v12// record; has an extra byte of padding due to 16-bit alignment on Mac).
-const ResLayout ObjV12Layout = {- 28, // size on disc
- sizeof(Obj), // size in memory
- LAYOUT_FLAG_ARRAY, // flags
- {+const ResField ObjV12Layoutf[] = { { RFFT_UINT8, offsetof(Obj, active) }, { RFFT_UINT8, offsetof(Obj, obclass) }, { RFFT_UINT8, offsetof(Obj, subclass) },@@ -200,15 +209,16 @@
{ RFFT_UINT8, offsetof(Obj, info.time_remainder) }, { RFFT_UINT8, offsetof(Obj, info.inst_flags) }, { RFFT_END, 0 }- }
};
+const ResLayout ObjV12Layout = {+ 28, // size on disc
+ sizeof(Obj), // size in memory
+ LAYOUT_FLAG_ARRAY, // flags
+ ObjV12Layoutf
+};
// Describe the layout of the object cross-refs table in a resfile.
-const ResLayout ObjRefLayout = {- 10, // size on disc
- sizeof(ObjRef), // size in memory
- LAYOUT_FLAG_ARRAY, // flags
- {+const ResField ObjRefLayoutf[] = { { RFFT_UINT16, offsetof(ObjRef, state.bin.sq.x) }, { RFFT_UINT16, offsetof(ObjRef, state.bin.sq.y) }, { RFFT_UINT16, offsetof(ObjRef, obj) },@@ -215,15 +225,16 @@
{ RFFT_UINT16, offsetof(ObjRef, next) }, { RFFT_UINT16, offsetof(ObjRef, nextref) }, { RFFT_END, 0 }- }
};
+const ResLayout ObjRefLayout = {+ 10, // size on disc
+ sizeof(ObjRef), // size in memory
+ LAYOUT_FLAG_ARRAY, // flags
+ ObjRefLayoutf,
+};
// Describe the layout of the gun class info in a resfile.
-const ResLayout GunLayout = {- 8, // size on disc
- sizeof(ObjGun), // size in memory
- LAYOUT_FLAG_ARRAY, // flags
- {+const ResField GunLayoutf[] = { { RFFT_UINT16, offsetof(ObjGun, id) }, { RFFT_UINT16, offsetof(ObjGun, next) }, { RFFT_UINT16, offsetof(ObjGun, prev) },@@ -230,28 +241,30 @@
{ RFFT_UINT8, offsetof(ObjGun, ammo_type) }, { RFFT_UINT8, offsetof(ObjGun, ammo_count) }, { RFFT_END, 0 }- }
};
+const ResLayout GunLayout = {+ 8, // size on disc
+ sizeof(ObjGun), // size in memory
+ LAYOUT_FLAG_ARRAY, // flags
+ GunLayoutf
+};
// Describe the layout of the ammo class info in a resfile.
-const ResLayout AmmoLayout = {- 6, // size on disc
- sizeof(ObjAmmo), // size in memory
- LAYOUT_FLAG_ARRAY, // flags
- {+const ResField AmmoLayoutf[] = { { RFFT_UINT16, offsetof(ObjAmmo, id) }, { RFFT_UINT16, offsetof(ObjAmmo, next) }, { RFFT_UINT16, offsetof(ObjAmmo, prev) }, { RFFT_END, 0 }- }
};
+const ResLayout AmmoLayout = {+ 6, // size on disc
+ sizeof(ObjAmmo), // size in memory
+ LAYOUT_FLAG_ARRAY, // flags
+ AmmoLayoutf
+};
// Describe the layout of the physics object class info in a resfile.
-const ResLayout PhysicsLayout = {- 40, // size on disc
- sizeof(ObjPhysics), // size in memory
- LAYOUT_FLAG_ARRAY, // flags
- {+const ResField PhysicsLayoutf[] = { { RFFT_UINT16, offsetof(ObjPhysics, id) }, { RFFT_UINT16, offsetof(ObjPhysics, next) }, { RFFT_UINT16, offsetof(ObjPhysics, prev) },@@ -277,15 +290,16 @@
{ RFFT_UINT8, offsetof(ObjPhysics, p3.h) }, { RFFT_UINT8, offsetof(ObjPhysics, p3.b) }, { RFFT_END, 0 }- }
};
+const ResLayout PhysicsLayout = {+ 40, // size on disc
+ sizeof(ObjPhysics), // size in memory
+ LAYOUT_FLAG_ARRAY, // flags
+ PhysicsLayoutf
+};
// Describe the layout of the grenade class info in a resfile.
-const ResLayout GrenadeLayout = {- 12, // size on disc
- sizeof(ObjGrenade), // size in memory
- LAYOUT_FLAG_ARRAY, // flags
- {+const ResField GrenadeLayoutf[] = { { RFFT_UINT16, offsetof(ObjGrenade, id) }, { RFFT_UINT16, offsetof(ObjGrenade, next) }, { RFFT_UINT16, offsetof(ObjGrenade, prev) },@@ -294,44 +308,47 @@
{ RFFT_UINT16, offsetof(ObjGrenade, flags) }, { RFFT_UINT16, offsetof(ObjGrenade, timestamp) }, { RFFT_END, 0 }- }
};
+const ResLayout GrenadeLayout = {+ 12, // size on disc
+ sizeof(ObjGrenade), // size in memory
+ LAYOUT_FLAG_ARRAY, // flags
+ GrenadeLayoutf
+};
// Describe the layout of the drug class info in a resfile.
-const ResLayout DrugLayout = {- 6, // size on disc
- sizeof(ObjDrug), // size in memory
- LAYOUT_FLAG_ARRAY, // flags
- {+const ResField DrugLayoutf[] = { { RFFT_UINT16, offsetof(ObjDrug, id) }, { RFFT_UINT16, offsetof(ObjDrug, next) }, { RFFT_UINT16, offsetof(ObjDrug, prev) }, { RFFT_END, 0 }- }
};
+const ResLayout DrugLayout = {+ 6, // size on disc
+ sizeof(ObjDrug), // size in memory
+ LAYOUT_FLAG_ARRAY, // flags
+ DrugLayoutf
+};
// Describe the layout of the hardware class info in a resfile (original 7-byte
// v11 struct).
-const ResLayout HardwareV11Layout = {- 7, // size on disc
- sizeof(ObjHardware), // size in memory
- LAYOUT_FLAG_ARRAY, // flags
- {+const ResField HardwareV11Layoutf[] = { { RFFT_UINT16, offsetof(ObjHardware, id) }, { RFFT_UINT16, offsetof(ObjHardware, next) }, { RFFT_UINT16, offsetof(ObjHardware, prev) }, { RFFT_UINT8, offsetof(ObjHardware, version) }, { RFFT_END, 0 }- }
};
+const ResLayout HardwareV11Layout = {+ 7, // size on disc
+ sizeof(ObjHardware), // size in memory
+ LAYOUT_FLAG_ARRAY, // flags
+ HardwareV11Layoutf
+};
// Describe the layout of the hardware class info in a resfile ("easysaves"// 8-byte v12 struct).
-const ResLayout HardwareV12Layout = {- 8, // size on disc
- sizeof(ObjHardware), // size in memory
- LAYOUT_FLAG_ARRAY, // flags
- {+const ResField HardwareV12Layoutf[] = { { RFFT_UINT16, offsetof(ObjHardware, id) }, { RFFT_UINT16, offsetof(ObjHardware, next) }, { RFFT_UINT16, offsetof(ObjHardware, prev) },@@ -338,16 +355,17 @@
{ RFFT_UINT8, offsetof(ObjHardware, version) }, { RFFT_PAD, 1 }, // alignment { RFFT_END, 0 }- }
};
+const ResLayout HardwareV12Layout = {+ 8, // size on disc
+ sizeof(ObjHardware), // size in memory
+ LAYOUT_FLAG_ARRAY, // flags
+ HardwareV12Layoutf
+};
// Describe the layout of the software class info in a resfile (original 9-byte
// v11 struct).
-const ResLayout SoftwareV11Layout = {- 9, // size on disc
- sizeof(ObjSoftware), // size in memory
- LAYOUT_FLAG_ARRAY, // flags
- {+const ResField SoftwareV11Layoutf[] = { { RFFT_UINT16, offsetof(ObjSoftware, id) }, { RFFT_UINT16, offsetof(ObjSoftware, next) }, { RFFT_UINT16, offsetof(ObjSoftware, prev) },@@ -354,16 +372,17 @@
{ RFFT_UINT8, offsetof(ObjSoftware, version) }, { RFFT_UINT16, offsetof(ObjSoftware, data_munge) }, { RFFT_END, 0 }- }
};
+const ResLayout SoftwareV11Layout = {+ 9, // size on disc
+ sizeof(ObjSoftware), // size in memory
+ LAYOUT_FLAG_ARRAY, // flags
+ SoftwareV11Layoutf
+};
// Describe the layout of the software class info in a resfile (10-byte v12
// struct).
-const ResLayout SoftwareV12Layout = {- 10, // size on disc
- sizeof(ObjSoftware), // size in memory
- LAYOUT_FLAG_ARRAY, // flags
- {+const ResField SoftwareV12Layoutf[] = { { RFFT_UINT16, offsetof(ObjSoftware, id) }, { RFFT_UINT16, offsetof(ObjSoftware, next) }, { RFFT_UINT16, offsetof(ObjSoftware, prev) },@@ -371,15 +390,16 @@
{ RFFT_PAD, 1 }, // alignment { RFFT_UINT16, offsetof(ObjSoftware, data_munge) }, { RFFT_END, 0 }- }
};
+const ResLayout SoftwareV12Layout = {+ 10, // size on disc
+ sizeof(ObjSoftware), // size in memory
+ LAYOUT_FLAG_ARRAY, // flags
+ SoftwareV12Layoutf
+};
// Describe the layout of the "bigstuff" class info in a resfile.
-const ResLayout BigStuffLayout = {- 16, // size on disc
- sizeof(ObjBigstuff), // size in memory
- LAYOUT_FLAG_ARRAY, // flags
- {+const ResField BigStuffLayoutf[] = { { RFFT_UINT16, offsetof(ObjBigstuff, id) }, { RFFT_UINT16, offsetof(ObjBigstuff, next) }, { RFFT_UINT16, offsetof(ObjBigstuff, prev) },@@ -387,15 +407,16 @@
{ RFFT_UINT32, offsetof(ObjBigstuff, data1) }, { RFFT_UINT32, offsetof(ObjBigstuff, data2) }, { RFFT_END, 0 }- }
};
+const ResLayout BigStuffLayout = {+ 16, // size on disc
+ sizeof(ObjBigstuff), // size in memory
+ LAYOUT_FLAG_ARRAY, // flags
+ BigStuffLayoutf
+};
// Describe the layout of the "smallstuff" class info in a resfile.
-const ResLayout SmallStuffLayout = {- 16, // size on disc
- sizeof(ObjSmallstuff), // size in memory
- LAYOUT_FLAG_ARRAY, // flags
- {+const ResField SmallStuffLayoutf[] = { { RFFT_UINT16, offsetof(ObjSmallstuff, id) }, { RFFT_UINT16, offsetof(ObjSmallstuff, next) }, { RFFT_UINT16, offsetof(ObjSmallstuff, prev) },@@ -403,15 +424,16 @@
{ RFFT_UINT32, offsetof(ObjSmallstuff, data1) }, { RFFT_UINT32, offsetof(ObjSmallstuff, data2) }, { RFFT_END, 0 }- }
};
+const ResLayout SmallStuffLayout = {+ 16, // size on disc
+ sizeof(ObjSmallstuff), // size in memory
+ LAYOUT_FLAG_ARRAY, // flags
+ SmallStuffLayoutf
+};
// Describe the layout of the fixture class info in a resfile.
-const ResLayout FixtureLayout = {- 30, // size on disc
- sizeof(ObjFixture), // size in memory
- LAYOUT_FLAG_ARRAY, // flags
- {+const ResField FixtureLayoutf[] = { { RFFT_UINT16, offsetof(ObjFixture, id) }, { RFFT_UINT16, offsetof(ObjFixture, next) }, { RFFT_UINT16, offsetof(ObjFixture, prev) },@@ -424,15 +446,16 @@
{ RFFT_UINT32, offsetof(ObjFixture, p4) }, { RFFT_UINT16, offsetof(ObjFixture, access_level) }, { RFFT_END, 0 }- }
};
+const ResLayout FixtureLayout = {+ 30, // size on disc
+ sizeof(ObjFixture), // size in memory
+ LAYOUT_FLAG_ARRAY, // flags
+ FixtureLayoutf
+};
// Describe the layout of the door class info in a resfile.
-const ResLayout DoorLayout = {- 14, // size on disc
- sizeof(ObjDoor), // size in memory
- LAYOUT_FLAG_ARRAY, // flags
- {+const ResField DoorLayoutf[] = { { RFFT_UINT16, offsetof(ObjDoor, id) }, { RFFT_UINT16, offsetof(ObjDoor, next) }, { RFFT_UINT16, offsetof(ObjDoor, prev) },@@ -443,15 +466,16 @@
{ RFFT_UINT8, offsetof(ObjDoor, autoclose_time) }, { RFFT_UINT16, offsetof(ObjDoor, other_half) }, { RFFT_END, 0 }- }
};
+const ResLayout DoorLayout = {+ 14, // size on disc
+ sizeof(ObjDoor), // size in memory
+ LAYOUT_FLAG_ARRAY, // flags
+ DoorLayoutf
+};
// Describe the layout of the animating class info in a resfile.
-const ResLayout AnimatingLayout = {- 10, // size on disc
- sizeof(ObjAnimating), // size in memory
- LAYOUT_FLAG_ARRAY, // flags
- {+const ResField AnimatingLayoutf[] = { { RFFT_UINT16, offsetof(ObjAnimating, id) }, { RFFT_UINT16, offsetof(ObjAnimating, next) }, { RFFT_UINT16, offsetof(ObjAnimating, prev) },@@ -459,15 +483,16 @@
{ RFFT_UINT8, offsetof(ObjAnimating, end_frame) }, { RFFT_UINT16, offsetof(ObjAnimating, owner) }, { RFFT_END, 0 }- }
};
+const ResLayout AnimatingLayout = {+ 10, // size on disc
+ sizeof(ObjAnimating), // size in memory
+ LAYOUT_FLAG_ARRAY, // flags
+ AnimatingLayoutf
+};
// Describe the layout of the trap class info in a resfile.
-const ResLayout TrapLayout = {- 28, // size on disc
- sizeof(ObjTrap), // size in memory
- LAYOUT_FLAG_ARRAY, // flags
- {+const ResField TrapLayoutf[] = { { RFFT_UINT16, offsetof(ObjTrap, id) }, { RFFT_UINT16, offsetof(ObjTrap, next) }, { RFFT_UINT16, offsetof(ObjTrap, prev) },@@ -479,16 +504,17 @@
{ RFFT_UINT32, offsetof(ObjTrap, p3) }, { RFFT_UINT32, offsetof(ObjTrap, p4) }, { RFFT_END, 0 }- }
};
+const ResLayout TrapLayout = {+ 28, // size on disc
+ sizeof(ObjTrap), // size in memory
+ LAYOUT_FLAG_ARRAY, // flags
+ TrapLayoutf
+};
// Describe the layout of the container class info in a resfile (original 21-
// byte struct).
-const ResLayout ContainerV11Layout = {- 21, // size on disc
- sizeof(ObjContainer), // size in memory
- LAYOUT_FLAG_ARRAY, // flags
- {+const ResField ContainerV11Layoutf[] = { { RFFT_UINT16, offsetof(ObjContainer, id) }, { RFFT_UINT16, offsetof(ObjContainer, next) }, { RFFT_UINT16, offsetof(ObjContainer, prev) },@@ -499,16 +525,17 @@
{ RFFT_UINT8, offsetof(ObjContainer, dim_z) }, { RFFT_UINT32, offsetof(ObjContainer, data1) }, { RFFT_END, 0 }- }
};
+const ResLayout ContainerV11Layout = {+ 21, // size on disc
+ sizeof(ObjContainer), // size in memory
+ LAYOUT_FLAG_ARRAY, // flags
+ ContainerV11Layoutf
+};
// Describe the layout of the container class info in a resfile (22-byte v12
// struct).
-const ResLayout ContainerV12Layout = {- 22, // size on disc
- sizeof(ObjContainer), // size in memory
- LAYOUT_FLAG_ARRAY, // flags
- {+const ResField ContainerV12Layoutf[] = { { RFFT_UINT16, offsetof(ObjContainer, id) }, { RFFT_UINT16, offsetof(ObjContainer, next) }, { RFFT_UINT16, offsetof(ObjContainer, prev) },@@ -520,15 +547,16 @@
{ RFFT_PAD, 1 }, // alignment { RFFT_UINT32, offsetof(ObjContainer, data1) }, { RFFT_END, 0 }- }
};
+const ResLayout ContainerV12Layout = {+ 22, // size on disc
+ sizeof(ObjContainer), // size in memory
+ LAYOUT_FLAG_ARRAY, // flags
+ ContainerV12Layoutf
+};
// Describe the layout of the critter class info in a resfile.
-const ResLayout CritterLayout = {- 46, // size on disc
- sizeof(ObjCritter), // size in memory
- LAYOUT_FLAG_ARRAY, // flags
- {+const ResField CritterLayoutf[] = { { RFFT_UINT16, offsetof(ObjCritter, id) }, { RFFT_UINT16, offsetof(ObjCritter, next) }, { RFFT_UINT16, offsetof(ObjCritter, prev) },@@ -554,15 +582,16 @@
{ RFFT_UINT16, offsetof(ObjCritter, loot2) }, { RFFT_UINT32, offsetof(ObjCritter, sidestep) }, { RFFT_END, 0 }- }
};
+const ResLayout CritterLayout = {+ 46, // size on disc
+ sizeof(ObjCritter), // size in memory
+ LAYOUT_FLAG_ARRAY, // flags
+ CritterLayoutf
+};
// Describe the layout of animation textures in a resfile (7-byte v11 struct).
-const ResLayout AnimTextureV11Layout = {- 7, // size on disc
- sizeof(AnimTextureData), // size in memory
- LAYOUT_FLAG_ARRAY, // flags
- {+const ResField AnimTextureV11Layoutf[] = { { RFFT_UINT16, offsetof(AnimTextureData, anim_speed) }, { RFFT_UINT16, offsetof(AnimTextureData, time_remainder) }, { RFFT_UINT8, offsetof(AnimTextureData, current_frame) },@@ -569,15 +598,16 @@
{ RFFT_UINT8, offsetof(AnimTextureData, num_frames) }, { RFFT_UINT8, offsetof(AnimTextureData, flags) }, { RFFT_END, 0 }- }
};
-
-// Describe the layout of animation textures in a resfile (8-byte v12 struct).
-const ResLayout AnimTextureV12Layout = {- 8, // size on disc
+const ResLayout AnimTextureV11Layout = {+ 7, // size on disc
sizeof(AnimTextureData), // size in memory
LAYOUT_FLAG_ARRAY, // flags
- {+ AnimTextureV11Layoutf
+};
+
+// Describe the layout of animation textures in a resfile (8-byte v12 struct).
+const ResField AnimTextureV12Layoutf[] = { { RFFT_UINT16, offsetof(AnimTextureData, anim_speed) }, { RFFT_UINT16, offsetof(AnimTextureData, time_remainder) }, { RFFT_UINT8, offsetof(AnimTextureData, current_frame) },@@ -585,29 +615,31 @@
{ RFFT_UINT8, offsetof(AnimTextureData, flags) }, { RFFT_PAD, 1 }, // alignment { RFFT_END, 0 }- }
};
+const ResLayout AnimTextureV12Layout = {+ 8, // size on disc
+ sizeof(AnimTextureData), // size in memory
+ LAYOUT_FLAG_ARRAY, // flags
+ AnimTextureV12Layoutf
+};
// Describes the layout of the hack cameras / hack surrogates tables. (Each is
// just an array of 16-bit ObjIDs.)
+const ResField HackCameraLayoutf[] = {+ { RFFT_UINT16, 0 },+ { RFFT_END, 0 }+};
const ResLayout HackCameraLayout = {2, // size on disc
sizeof(ObjID), // size in memory
LAYOUT_FLAG_ARRAY, // flags
- {- { RFFT_UINT16, 0 },- { RFFT_END, 0 }- }
+ HackCameraLayoutf
};
// Describe the layout of the level data in a resfile.
// FIXME explicitly copies the 3 automap info structs. Should support sub-
// arrays somehow in the layout table.
-const ResLayout LevelDataV11Layout = {- 94, // size on disc
- sizeof(LevelData), // size in memory
- 0, // flags
- {+const ResField LevelDataV11Layoutf[] = { { RFFT_UINT16, offsetof(LevelData, size) }, { RFFT_UINT8, offsetof(LevelData, mist) }, { RFFT_UINT8, offsetof(LevelData, gravity) },@@ -657,17 +689,18 @@
{ RFFT_UINT8, offsetof(LevelData, auto_maps[2].version_id) }, { RFFT_UINT16, offsetof(LevelData, auto_maps[2].sensor_rad) }, { RFFT_END, 0 }- }
};
+const ResLayout LevelDataV11Layout = {+ 94, // size on disc
+ sizeof(LevelData), // size in memory
+ 0, // flags
+ LevelDataV11Layoutf
+};
// Describe the layout of the level data in a resfile (v12 data structure).
// FIXME explicitly copies the 3 automap info structs. Should support sub-
// arrays somehow in the layout table.
-const ResLayout LevelDataV12Layout = {- 98, // size on disc
- sizeof(LevelData), // size in memory
- 0, // flags
- {+const ResField LevelDataV12Layoutf[] = { { RFFT_UINT16, offsetof(LevelData, size) }, { RFFT_UINT8, offsetof(LevelData, mist) }, { RFFT_UINT8, offsetof(LevelData, gravity) },@@ -721,15 +754,16 @@
{ RFFT_PAD, 1 }, // alignment { RFFT_UINT16, offsetof(LevelData, auto_maps[2].sensor_rad) }, { RFFT_END, 0 }- }
};
+const ResLayout LevelDataV12Layout = {+ 98, // size on disc
+ sizeof(LevelData), // size in memory
+ 0, // flags
+ LevelDataV12Layoutf
+};
// Describe the layout of a path.
-const ResLayout PathLayout = {- 28, // size on disc
- sizeof(Path), // size in memory
- LAYOUT_FLAG_ARRAY, // flags
- {+const ResField PathLayoutf[] = { { RFFT_UINT16, offsetof(Path, source.x) }, { RFFT_UINT16, offsetof(Path, source.y) }, { RFFT_UINT16, offsetof(Path, dest.x) },@@ -740,16 +774,17 @@
{ RFFT_UINT8, offsetof(Path, curr_step) }, { RFFT_BIN(NUM_PATH_STEPS / 4), offsetof(Path, moves) }, { RFFT_END, 0 }- }
};
+const ResLayout PathLayout = {+ 28, // size on disc
+ sizeof(Path), // size in memory
+ LAYOUT_FLAG_ARRAY, // flags
+ PathLayoutf
+};
// Describe the layout of the anims table in a resfile (15-byte version 11
// structure).
-const ResLayout AnimV11Layout = {- 15, // size on disc
- sizeof(AnimListing), // size in memory
- LAYOUT_FLAG_ARRAY, // flags
- {+const ResField AnimV11Layoutf[] = { { RFFT_UINT16, offsetof(AnimListing, id) }, { RFFT_UINT8, offsetof(AnimListing, flags) }, { RFFT_UINT16, offsetof(AnimListing, cbtype) },@@ -757,18 +792,19 @@
{ RFFT_INTPTR, offsetof(AnimListing, user_data) }, { RFFT_UINT16, offsetof(AnimListing, speed) }, { RFFT_END, 0 }- }
};
+const ResLayout AnimV11Layout = {+ 15, // size on disc
+ sizeof(AnimListing), // size in memory
+ LAYOUT_FLAG_ARRAY, // flags
+ AnimV11Layoutf
+};
// Describe the layout of the anims table in a resfile (16-byte version 12
// structure).
// The AnimListing struct wasn't given a specific packing. This is my best
// guess at a 32-bit one. Savefile compatibility may be a bit dodgy.
-const ResLayout AnimV12Layout = {- 20, // size on disc
- sizeof(AnimListing), // size in memory
- LAYOUT_FLAG_ARRAY, // flags
- {+const ResField AnimV12Layoutf[] = { { RFFT_UINT16, offsetof(AnimListing, id) }, { RFFT_UINT8, offsetof(AnimListing, flags) }, { RFFT_PAD, 1 }, // alignment@@ -779,21 +815,27 @@
{ RFFT_UINT16, offsetof(AnimListing, speed) }, { RFFT_PAD, 2 }, // alignment { RFFT_END, 0 }- }
};
+const ResLayout AnimV12Layout = {+ 20, // size on disc
+ sizeof(AnimListing), // size in memory
+ LAYOUT_FLAG_ARRAY, // flags
+ AnimV12Layoutf
+};
// Describe the layout of the height semaphores table in a resfile.
-const ResLayout HeightSemaphoreLayout = {- 4, // size on disc
- sizeof(height_semaphor), // size in memory
- LAYOUT_FLAG_ARRAY, // flags
- {+const ResField HeightSemaphoreLayoutf[] = { { RFFT_UINT8, offsetof(height_semaphor, x) }, { RFFT_UINT8, offsetof(height_semaphor, y) }, { RFFT_UINT8, offsetof(height_semaphor, floor_key) }, { RFFT_UINT8, offsetof(height_semaphor, inuse) }, { RFFT_END, 0 }- }
+};
+const ResLayout HeightSemaphoreLayout = {+ 4, // size on disc
+ sizeof(height_semaphor), // size in memory
+ LAYOUT_FLAG_ARRAY, // flags
+ HeightSemaphoreLayoutf
};
// Version 11 level archives table.
--- a/src/GameSrc/audiolog.c
+++ b/src/GameSrc/audiolog.c
@@ -26,7 +26,9 @@
#include <stdio.h>
#include <SDL.h>
+#include <SDL2/SDL_audio.h>
+#include "precompiled.h"
#include "MacTune.h"
#include "afile.h"
#include "movie.h"
--- a/src/GameSrc/automap.c
+++ b/src/GameSrc/automap.c
@@ -25,6 +25,7 @@
#include <string.h>
+#include "precompiled.h"
#include "amaploop.h"
#include "player.h"
#include "newmfd.h"
--- a/src/GameSrc/bark.c
+++ b/src/GameSrc/bark.c
@@ -28,6 +28,7 @@
// Includes for example mfd.
#include <stdlib.h>
+#include "precompiled.h"
#include "bark.h"
#include "mfdext.h"
#include "mfddims.h"
--- a/src/GameSrc/biohelp.c
+++ b/src/GameSrc/biohelp.c
@@ -24,6 +24,7 @@
*
*/
+#include "precompiled.h"
#include "mfdint.h"
#include "mfdext.h"
#include "mfddims.h"
--- a/src/GameSrc/cardmfd.c
+++ b/src/GameSrc/cardmfd.c
@@ -26,6 +26,7 @@
#include <string.h>
+#include "precompiled.h"
#include "mfdint.h"
#include "mfdext.h"
#include "mfddims.h"
--- a/src/GameSrc/citres.c
+++ b/src/GameSrc/citres.c
@@ -26,6 +26,7 @@
#include <string.h>
+#include "precompiled.h"
#include "citres.h"
#include "criterr.h"
#include "gr2ss.h"
--- a/src/GameSrc/combat.c
+++ b/src/GameSrc/combat.c
@@ -24,6 +24,7 @@
*
*/
+#include "precompiled.h"
#include "combat.h"
#include "objsim.h"
#include "objprop.h"
--- a/src/GameSrc/cone.c
+++ b/src/GameSrc/cone.c
@@ -26,6 +26,7 @@
#include <string.h>
#include <stdlib.h>
+#include "precompiled.h"
#include "cone.h"
#include "map.h"
--- a/src/GameSrc/criterr.c
+++ b/src/GameSrc/criterr.c
@@ -19,6 +19,7 @@
#include <stdio.h>
#include <string.h>
+#include "precompiled.h"
#include "Shock.h"
#include "InitMac.h"
#include "criterr.h"
--- a/src/GameSrc/cutsloop.c
+++ b/src/GameSrc/cutsloop.c
@@ -19,6 +19,7 @@
#include <SDL.h>
+#include "precompiled.h"
#include "Shock.h"
#include "cutsloop.h"
#include "mainloop.h"
@@ -38,10 +39,9 @@
static uint8_t *cutscene_audiobuffer = NULL;
static uint8_t *cutscene_audiobuffer_pos = NULL;
-static int cutscene_audiobuffer_size; //in blocks of MOVIE_DEFAULT_BLOCKLEN
+static int cutscene_audiobuffer_size;
-
static int cutscene_filehandle;
static uiSlab cutscene_slab;
@@ -51,6 +51,7 @@
static Apalette cutscene_pal;
static grs_bitmap movie_bitmap;
static long next_time;
+static int ablk;
static bool is_first_frame;
static bool done_playing_movie;
@@ -177,6 +178,7 @@
void cutscene_loop(void)
{+ int n;
fix time;
long cur_time = SDL_GetTicks();
@@ -190,9 +192,11 @@
{// === adjust volume in buffer here ===
- SDL_AudioStreamPut(cutscene_audiostream, cutscene_audiobuffer_pos, MOVIE_DEFAULT_BLOCKLEN);
- cutscene_audiobuffer_pos += MOVIE_DEFAULT_BLOCKLEN;
- cutscene_audiobuffer_size--;
+ if(cutscene_audiobuffer_size < ablk)
+ ablk = cutscene_audiobuffer_size;
+ SDL_AudioStreamPut(cutscene_audiostream, cutscene_audiobuffer_pos, ablk);
+ cutscene_audiobuffer_pos += ablk;
+ cutscene_audiobuffer_size -= ablk;
}
}
@@ -318,7 +322,8 @@
}
cutscene_audiobuffer_size = AfileAudioLength(amovie);
- cutscene_audiobuffer = (uint8_t *)malloc(cutscene_audiobuffer_size * MOVIE_DEFAULT_BLOCKLEN);
+ cutscene_audiobuffer_size *= MOVIE_DEFAULT_BLOCKLEN;
+ cutscene_audiobuffer = (uint8_t *)malloc(cutscene_audiobuffer_size);
AfileGetAudio(amovie, cutscene_audiobuffer);
AfileReadReset(amovie);
@@ -329,7 +334,7 @@
SDL_Delay(1);
cutscene_audiostream = SDL_NewAudioStream(AUDIO_U8, 1, fix_int(amovie->a.sampleRate), AUDIO_S16SYS, 2, 48000);
-
+ ablk = (int)(fix_int(amovie->a.sampleRate) / (1000. / 16)) + 3 & ~3;
cutscene_audiobuffer_pos = cutscene_audiobuffer;
}
--- a/src/GameSrc/cyber.c
+++ b/src/GameSrc/cyber.c
@@ -18,6 +18,7 @@
*/
#include <string.h>
+#include "precompiled.h"
#include "player.h"
#include "objsim.h"
#include "objects.h"
@@ -62,7 +63,7 @@
uchar cyber_nodie = FALSE;
// FILE *gCyberHdl;
-errtype check_cspace_death() {+errtype check_cspace_death(void) { if (global_fullmap->cyber) {if (player_struct.cspace_hp == 1)
hud_set(HUD_CYBERDANGER);
@@ -180,7 +181,7 @@
return (OK);
}
-errtype early_exit_cyberspace_stuff() {+errtype early_exit_cyberspace_stuff(void) {// Delete the shodan_object, if there is one.
if (shodan_avatar_id != OBJ_NULL) {obj_destroy(shodan_avatar_id);
@@ -189,7 +190,7 @@
return (OK);
}
-errtype exit_cyberspace_stuff() {+errtype exit_cyberspace_stuff(void) {int i;
// Blast away the cspace MFD
--- a/src/GameSrc/cybermfd.c
+++ b/src/GameSrc/cybermfd.c
@@ -25,6 +25,7 @@
*
*/
+#include "precompiled.h"
#include "mfdint.h"
#include "mfdext.h"
#include "mfddims.h"
--- a/src/GameSrc/cybmem.c
+++ b/src/GameSrc/cybmem.c
@@ -28,6 +28,7 @@
// for Cyberia
#define __CYBMEM_SRC
+#include "precompiled.h"
#include "cybmem.h"
#include "tools.h"
#include "textmaps.h"
@@ -133,7 +134,7 @@
#define MAX_PTRS 25
#define MINIMUM_SLORK_SIZE 100000
-int slorkatron_memory_check() {+int slorkatron_memory_check(void) {int retval, size;
int ptr_count, i;
uchar *mem_ptrs[MAX_PTRS];
--- a/src/GameSrc/damage.c
+++ b/src/GameSrc/damage.c
@@ -25,6 +25,7 @@
#include <stdlib.h>
+#include "precompiled.h"
#include "Shock.h"
#include "effect.h"
@@ -79,7 +80,7 @@
int randomize_damage(int damage, uchar attack_on_player);
int armor_absorption(int raw_damage, int obj_triple, ubyte penetrate);
int shield_absorb_damage(int damage, ubyte dtype, byte shield_absorb, ubyte shield_threshold);
-void player_dies();
+void player_dies(void);
ubyte damage_player(int damage, ubyte dtype, ubyte flags);
void critter_hit_effect(ObjID target, ubyte effect, Combat_Pt location, int damage, int max_damage);
@@ -475,9 +476,9 @@
// Something has caused the player to become a fatality
// typically this is damage, but can be delayed-death due to craze
-void player_dies() {- extern void physics_zero_all_controls();
- extern void clear_digi_fx();
+void player_dies(void) {+ extern void physics_zero_all_controls(void);
+ extern void clear_digi_fx(void);
extern short inventory_page;
#ifdef AUDIOLOGS
extern char secret_pending_hack;
--- a/src/GameSrc/digifx.c
+++ b/src/GameSrc/digifx.c
@@ -23,6 +23,7 @@
* $Date: 1994/11/28 08:38:42 $
*/
+#include "precompiled.h"
#include "criterr.h"
#include "objects.h"
#include "player.h"
@@ -51,7 +52,7 @@
//#define ASYNCH_DIGI
int digi_timer_id;
-void start_asynch_digi_fx() {+void start_asynch_digi_fx(void) {#ifdef ASYNCH_DIGI
if (sfx_on)
tm_activate_process(digi_timer_id);
@@ -58,7 +59,7 @@
#endif
}
-void stop_asynch_digi_fx() {+void stop_asynch_digi_fx(void) {#ifdef ASYNCH_DIGI
if (sfx_on)
tm_deactivate_process(digi_timer_id);
@@ -67,7 +68,7 @@
#endif
-errtype stop_digi_fx() {+errtype stop_digi_fx(void) {#ifdef AUDIOLOGS
if (audiolog_setting)
audiolog_stop();
@@ -79,11 +80,11 @@
return (ERR_NOEFFECT);
}
-void clear_digi_fx() { stop_digi_fx(); }+void clear_digi_fx(void) { stop_digi_fx(); }//#define SND_TEST
-errtype digifx_init() {+errtype digifx_init(void) { FILE *fp = fopen_caseless("res/data/digiparm.bin", "rb"); if (fp == NULL) {--- a/src/GameSrc/drugs.c
+++ b/src/GameSrc/drugs.c
@@ -32,6 +32,7 @@
#include <stdlib.h>
#include <string.h>
+#include "precompiled.h"
#include "Prefs.h"
#include "cybstrng.h"
#include "drugs.h"
@@ -75,12 +76,12 @@
typedef struct {uint8_t duration; // Preset duration of given drug
uint8_t flags;
- void (*use)(); // Function slots for take, effect, wear off
- void (*effect)();
- void (*wearoff)();
+ void (*use)(void); // Function slots for take, effect, wear off
+ void (*effect)(void);
+ void (*wearoff)(void);
void (*startup)(void);
void (*closedown)(bool visible);
- void (*after_effect)();
+ void (*after_effect)(void);
} DRUG;
// -------
@@ -92,7 +93,7 @@
// ----------
// Prototypes
// ----------
-void drug_detox_effect();
+void drug_detox_effect(void);
// ===========================================================================
// INFRASTRUCTURE
@@ -178,7 +179,7 @@
// the last time it was called, such that it actually executes only
// once every FREQ game ticks, as defined above
-void drugs_update() {+void drugs_update(void) {int i, decay;
// Only update drugs once every FREQ game ticks
@@ -232,7 +233,7 @@
//
// initialize drug system.
-void drugs_init() {}+void drugs_init(void) {}//---------------------------------------------------------------------------
// drug_startup()
@@ -270,7 +271,7 @@
//
// A dummy function for using drugs.
-void dummy_use_drug() { return; }+void dummy_use_drug(void) { return; }// ---------------------------------------------------------------------------
// dummy_effect_drug()
@@ -277,7 +278,7 @@
//
// A dummy function for continual drug effects
-void dummy_effect_drug() { return; }+void dummy_effect_drug(void) { return; }// ---------------------------------------------------------------------------
// dummy_wearoff_drug()
@@ -284,15 +285,15 @@
//
// A dummy function for drugs wearing off.
-void dummy_wearoff_drug() { return; }+void dummy_wearoff_drug(void) { return; }#endif
// --------------------------------------------------------------------------
// LSD
// --------------------------------------------------------------------------
-void drug_lsd_effect();
+void drug_lsd_effect(void);
void drug_lsd_startup(void);
-void drug_lsd_wearoff();
+void drug_lsd_wearoff(void);
void drug_lsd_closedown(bool visible);
// ---------------------------------------------------------------------------
@@ -300,7 +301,7 @@
//
// Carry out a random palette swap, as an LSD effect.
-void drug_lsd_effect() {+void drug_lsd_effect(void) {int i;
uchar lsd_palette[768];
int lsd_first, lsd_last;
@@ -337,7 +338,7 @@
//
// Uninstall the LSD effect.
-void drug_lsd_wearoff() {+void drug_lsd_wearoff(void) {// Return from palette shift
gr_set_pal(0, 256, ppall);
// KLC gamma_dealfunc(QUESTVAR_GET(GAMMACOR_QVAR));
@@ -352,9 +353,9 @@
// --------------------------------------------------------------------------
// STAMINUP
// --------------------------------------------------------------------------
-void drug_staminup_use();
-void drug_staminup_effect();
-void drug_staminup_wearoff();
+void drug_staminup_use(void);
+void drug_staminup_effect(void);
+void drug_staminup_wearoff(void);
// ---------------------------------------------------------------------------
// drug_staminup_use()
@@ -363,7 +364,7 @@
extern uchar fatigue_warning;
-void drug_staminup_use() {+void drug_staminup_use(void) {player_struct.fatigue = 0;
}
@@ -372,7 +373,7 @@
//
// Continual effects of the staminup drug.
-void drug_staminup_effect() {+void drug_staminup_effect(void) {player_struct.fatigue = 0;
}
@@ -381,7 +382,7 @@
//
// Final effects of the staminup drug.
-void drug_staminup_wearoff() {+void drug_staminup_wearoff(void) {player_struct.fatigue = MAX_FATIGUE;
}
@@ -388,10 +389,10 @@
// --------------------------------------------------------------------------
// SIGHT
// --------------------------------------------------------------------------
-void drug_sight_use();
-void drug_sight_startup();
-void drug_sight_effect();
-void drug_sight_wearoff();
+void drug_sight_use(void);
+void drug_sight_startup(void);
+void drug_sight_effect(void);
+void drug_sight_wearoff(void);
void drug_sight_after_effect(void);
void drug_sight_closedown(bool visible);
@@ -403,13 +404,13 @@
//
// Initial effects of the sight drug.
-void drug_sight_use() {+void drug_sight_use(void) {if (INTENSITY(DRUG_SIGHT) == 0)
set_global_lighting(SIGHT_LIGHT_LEVEL);
INTENSITY(DRUG_SIGHT) = 1;
}
-void drug_sight_startup() {+void drug_sight_startup(void) { if (STATUS(DRUG_SIGHT) > 0) {set_global_lighting(SIGHT_LIGHT_LEVEL);
} else if (STATUS(DRUG_SIGHT) < 0) {@@ -421,7 +422,7 @@
// drug_sight_effect()
//
// Continual effects of the sight drug.
-void drug_sight_effect() {}+void drug_sight_effect(void) {}// ---------------------------------------------------------------------------
// drug_sight_wearoff()
@@ -428,7 +429,7 @@
//
// Final effects of the sight drug.
-void drug_sight_wearoff() {+void drug_sight_wearoff(void) {INTENSITY(DRUG_SIGHT) = 0;
set_global_lighting(-2 * SIGHT_LIGHT_LEVEL);
STATUS(DRUG_SIGHT) = -Drugs[DRUG_SIGHT].duration / 4;
@@ -451,9 +452,9 @@
// --------------------------------------------------------------------------
// MEDIC
// --------------------------------------------------------------------------
-void drug_medic_use();
-void drug_medic_effect();
-void drug_medic_wearoff();
+void drug_medic_use(void);
+void drug_medic_effect(void);
+void drug_medic_wearoff(void);
#define MEDIC_DECAY_RATE 8
#define MEDIC_HEAL_STEPS 10
@@ -466,7 +467,7 @@
//
// Initial effects of the medic drug.
-void drug_medic_use() {+void drug_medic_use(void) {INTENSITY(DRUG_MEDIC) = lg_min(INTENSITY(DRUG_MEDIC) + MEDIC_HEAL_STEPS, MAX_UBYTE);
player_struct.hit_points_regen += MEDIC_HEAL_RATE;
chg_set_flg(VITALS_UPDATE);
@@ -477,7 +478,7 @@
//
// Continual effects of the medic drug.
-void drug_medic_effect() {+void drug_medic_effect(void) {ubyte n = INTENSITY(DRUG_MEDIC);
if (n > 0) {short delta;
@@ -500,7 +501,7 @@
//
// Final effects of the medic drug.
-void drug_medic_wearoff() {+void drug_medic_wearoff(void) {while (INTENSITY(DRUG_MEDIC) > 0)
drug_medic_effect();
@@ -510,9 +511,9 @@
// --------------------------------------------------------------------------
// REFLEX
// --------------------------------------------------------------------------
-void drug_reflex_use();
-void drug_reflex_effect();
-void drug_reflex_wearoff();
+void drug_reflex_use(void);
+void drug_reflex_effect(void);
+void drug_reflex_wearoff(void);
// ---------------------------------------------------------------------------
// drug_reflex_use()
@@ -519,7 +520,7 @@
//
// Initial effects of the reflex drug.
-void drug_reflex_use() {+void drug_reflex_use(void) {extern char reflex_remainder;
reflex_remainder = 0;
}
@@ -529,7 +530,7 @@
//
// Continual effects of the reflex drug.
-void drug_reflex_effect() {}+void drug_reflex_effect(void) {}// ---------------------------------------------------------------------------
// drug_reflex_wearoff()
@@ -536,14 +537,14 @@
//
// Final effects of the reflex drug.
-void drug_reflex_wearoff() {}+void drug_reflex_wearoff(void) {}// --------------------------------------------------------------------------
// GENIUS
// --------------------------------------------------------------------------
-void drug_genius_use();
-void drug_genius_effect();
-void drug_genius_wearoff();
+void drug_genius_use(void);
+void drug_genius_effect(void);
+void drug_genius_wearoff(void);
// ---------------------------------------------------------------------------
// drug_genius_use()
@@ -550,7 +551,7 @@
//
// Initial effects of the genius drug.
-void drug_genius_use() {+void drug_genius_use(void) {void mfd_gridpanel_set_winmove(uchar check);
mfd_gridpanel_set_winmove(true);
@@ -561,7 +562,7 @@
//
// Continual effects of the genius drug.
-void drug_genius_effect() {}+void drug_genius_effect(void) {}// ---------------------------------------------------------------------------
// drug_genius_wearoff()
@@ -568,14 +569,14 @@
//
// Final effects of the genius drug.
-void drug_genius_wearoff() {}+void drug_genius_wearoff(void) {}// --------------------------------------------------------------------------
// DETOX
// --------------------------------------------------------------------------
-void drug_detox_use();
+void drug_detox_use(void);
void wear_off_drug(int i);
-void drug_detox_wearoff();
+void drug_detox_wearoff(void);
uchar detox_drug_order[] = {DRUG_LSD, DRUG_SIGHT, DRUG_GENIUS, DRUG_STAMINUP, DRUG_REFLEX, DRUG_MEDIC,
@@ -588,7 +589,7 @@
//
// Initial effects of the detox drug.
-void drug_detox_use() {+void drug_detox_use(void) {INTENSITY(DRUG_DETOX) += 2;
if (INTENSITY(DRUG_DETOX) == 2)
drug_detox_effect();
@@ -608,7 +609,7 @@
Drugs[i].after_effect();
}
-void drug_detox_effect() {+void drug_detox_effect(void) {int i, stack;
for (stack = 0; stack < INTENSITY(DRUG_DETOX); stack += 2) { for (i = 0; i < NUM_DETOX_DRUGS; i++) {@@ -637,7 +638,7 @@
//
// Final effects of the detox drug.
-void drug_detox_wearoff() {+void drug_detox_wearoff(void) {INTENSITY(DRUG_DETOX) = 0;
}
--- a/src/GameSrc/effect.c
+++ b/src/GameSrc/effect.c
@@ -26,6 +26,7 @@
#include <string.h>
+#include "precompiled.h"
#include "grenades.h"
#include "objgame.h"
#include "objuse.h"
@@ -322,7 +323,7 @@
handart_show = (handart_fire) ? 1 : 2;
}
if ((handart_show != 1) && handart_flash) {- byte light_val;
+ byte light_val = 0;
ubyte slot = player_struct.actives[ACTIVE_WEAPON];
extern byte gun_fire_offset;
@@ -756,7 +757,7 @@
return (ERR_NOEFFECT);
}
-errtype animlist_clear() {+errtype animlist_clear(void) {LG_memset(animlist, 0, sizeof(AnimListing) * MAX_ANIMLIST_SIZE);
anim_counter = 0;
return (OK);
--- a/src/GameSrc/email.c
+++ b/src/GameSrc/email.c
@@ -27,6 +27,7 @@
#include <string.h>
#include <ctype.h>
+#include "precompiled.h"
#include "Prefs.h"
#include "invdims.h"
@@ -624,7 +625,7 @@
char *s;
// char *sfront;
short lastmug = -1;
- uchar esc_param, different;
+ uchar esc_param = 0, different;
char buf[64];
s = buf;
@@ -1084,7 +1085,7 @@
#define FLASH_TIME_INTERVAL 30
-void update_email_ware() {+void update_email_ware(void) {if ((player_struct.game_time >> APPROX_CIT_CYCLE_SHFT) % FLASH_TIME_INTERVAL != 0)
return;
--- a/src/GameSrc/faceobj.c
+++ b/src/GameSrc/faceobj.c
@@ -25,6 +25,7 @@
#include <string.h>
+#include "precompiled.h"
#include "gameobj.h"
#include "fr3d.h"
--- a/src/GameSrc/fixtrmfd.c
+++ b/src/GameSrc/fixtrmfd.c
@@ -25,6 +25,7 @@
*
*/
+#include "precompiled.h"
#include "gamescr.h"
#include "mfdint.h"
#include "mfdext.h"
--- a/src/GameSrc/frcamera.c
+++ b/src/GameSrc/frcamera.c
@@ -85,6 +85,7 @@
#include <string.h>
#include <stdlib.h> // for abs, of course
+#include "precompiled.h"
#include "frcamera.h"
#include "froslew.h" // has objects
#include "map.h"
--- a/src/GameSrc/frclip.c
+++ b/src/GameSrc/frclip.c
@@ -65,6 +65,7 @@
#define __FRCLIP_SRC
+#include "precompiled.h"
#include <stdlib.h>
#include <string.h>
--- a/src/GameSrc/frcompil.c
+++ b/src/GameSrc/frcompil.c
@@ -36,6 +36,7 @@
* Initial revision
*
*/
+#include "precompiled.h"
#define __FRCOMPIL_SRC
#include "frintern.h"
#include "map.h"
--- a/src/GameSrc/frmain.c
+++ b/src/GameSrc/frmain.c
@@ -48,6 +48,8 @@
*
*/
+#include "precompiled.h"
+
#ifdef AUDIOLOGS
#include "audiolog.h"
#endif
--- a/src/GameSrc/frobj.c
+++ b/src/GameSrc/frobj.c
@@ -30,6 +30,7 @@
#include <stdlib.h>
+#include "precompiled.h"
#include "map.h"
#include "objects.h"
#include "refstuf.h"
--- a/src/GameSrc/froslew.c
+++ b/src/GameSrc/froslew.c
@@ -54,6 +54,7 @@
*
*/
+#include "precompiled.h"
#include "fauxrint.h"
#include "froslew.h"
#ifndef __RENDTEST__
--- a/src/GameSrc/frpipe.c
+++ b/src/GameSrc/frpipe.c
@@ -58,6 +58,7 @@
#include <stdlib.h>
#include <string.h>
+#include "precompiled.h"
#include "map.h"
#include "mapflags.h"
#include "frsubclp.h"
--- a/src/GameSrc/frpts.c
+++ b/src/GameSrc/frpts.c
@@ -43,6 +43,7 @@
#include "map.h"
+#include "precompiled.h"
#include "frintern.h"
#include "frparams.h"
#include "frflags.h"
--- a/src/GameSrc/frsetup.c
+++ b/src/GameSrc/frsetup.c
@@ -123,6 +123,7 @@
*/
#include <stdlib.h> // I HATE THIS
+#include "precompiled.h"
#include "frcamera.h"
#include "fr3d.h"
@@ -345,7 +346,7 @@
_fr->viewer_zoom = 1;
if ((unsigned long)_fr->viewer_zoom > 0x7fffffff)
_fr->viewer_zoom = 0x7fffffff;
- if ((long)cam != -1) {+ if ((intptr)cam != -1) {if (cam == NULL)
_fr->camptr = fr_camera_getdef();
else
@@ -452,7 +453,7 @@
return NULL;
}
fr->realCanvasPtr = (char*)p;
- gr_init_canvas(&fr->main_canvas, (uchar *)((ulong)(p + 31) & 0xFFFFFFE0), BMT_FLAT8, wid, hgt);
+ gr_init_canvas(&fr->main_canvas, (uchar *)((uintptr)(p + 31) & 0xFFFFFFE0), BMT_FLAT8, wid, hgt);
fr->main_canvas.bm.row = rowbytes;
} else {// lets pretend we are getting a bitmap instead, eh?
--- a/src/GameSrc/frtables.c
+++ b/src/GameSrc/frtables.c
@@ -36,6 +36,7 @@
*
*/
+#include "precompiled.h"
#include "frintern.h"
#include "frtables.h"
#include "tilename.h"
--- a/src/GameSrc/frterr.c
+++ b/src/GameSrc/frterr.c
@@ -32,6 +32,7 @@
#include <string.h>
#include <stdlib.h>
+#include "precompiled.h"
#include "map.h"
#include "mapflags.h"
#include "frintern.h"
@@ -74,12 +75,12 @@
MapElem *_fdt_mptr; // more implicit parameters
// texture mapping function pointers.
-void (*_fr_lit_floor_func)(int, g3s_phandle *, grs_bitmap *);
-void (*_fr_floor_func)(int, g3s_phandle *, grs_bitmap *);
-void (*_fr_lit_wall_func)(int, g3s_phandle *, grs_bitmap *);
-void (*_fr_wall_func)(int, g3s_phandle *, grs_bitmap *);
-void (*_fr_lit_per_func)(int, g3s_phandle *, grs_bitmap *);
-void (*_fr_per_func)(int, g3s_phandle *, grs_bitmap *);
+int (*_fr_lit_floor_func)(int, g3s_phandle *, grs_bitmap *);
+int (*_fr_floor_func)(int, g3s_phandle *, grs_bitmap *);
+int (*_fr_lit_wall_func)(int, g3s_phandle *, grs_bitmap *);
+int (*_fr_wall_func)(int, g3s_phandle *, grs_bitmap *);
+int (*_fr_lit_per_func)(int, g3s_phandle *, grs_bitmap *);
+int (*_fr_per_func)(int, g3s_phandle *, grs_bitmap *);
#if _fr_defdbg(CURSOR)
int _fr_cursorx, _fr_cursory;
@@ -162,7 +163,7 @@
int _fr_get_anti_gap(fix *face_l, uchar in_fo, uchar *hgts, uchar *mmptr);
void _render_3d_walls(int which, int cnt);
int merge_walls(fix *dst_wall, fix *i_wall, int i_cnt, fix *o_wall, int o_cnt);
-void parse_clip_tile();
+void parse_clip_tile(void);
void fr_terr_cspace_pick(uchar do_wall);
int _fr_tfunc_flr_normal(fix *vec, int *lflg, int fnorm_entry);
int _fr_tfunc_ceil_normal(fix *vec, int *lflg, int fnorm_entry);
@@ -1316,7 +1317,7 @@
static void _fr_parse_wall(int which) {int icnt, fcnt, ocnt, useocnt, are_solid;
MapElem *oth_mptr;
- uchar oth_hgts[3], oth_fo;
+ uchar oth_hgts[3], oth_fo = 0;
oth_mptr = _fdt_mptr + wall_adds[which];
@@ -1412,7 +1413,7 @@
}
// take the mptr, decode it's clip vectors, and set initial wall masks for the tile
-void parse_clip_tile() {}+void parse_clip_tile(void) {}// so, ahh, should have wall bits for floor and ceiling, so we can start clipping
--- a/src/GameSrc/frutil.c
+++ b/src/GameSrc/frutil.c
@@ -27,6 +27,7 @@
#include <string.h>
+#include "precompiled.h"
#include "faketime.h"
#include "frtypes.h"
--- a/src/GameSrc/fullamap.c
+++ b/src/GameSrc/fullamap.c
@@ -24,6 +24,7 @@
*
*/
+#include "precompiled.h"
#include "tools.h"
#include "game_screen.h"
#include "input.h"
@@ -77,7 +78,7 @@
// amap_start()
// This gets called when we actually enter into the amap loop
-void amap_start() {+void amap_start(void) {#ifdef GADGET
_current_root = NULL; /* got rid of pointer type mismatch
* since one was a region and the other a gadget
@@ -102,7 +103,7 @@
// amap_exit()
// This gets called when we leave amap mode
-void amap_exit() {+void amap_exit(void) {fsmap_free();
uiHideMouse(NULL);
gr_set_screen(cit_screen);
--- a/src/GameSrc/fullscrn.c
+++ b/src/GameSrc/fullscrn.c
@@ -24,6 +24,7 @@
*/
+#include "precompiled.h"
#include "ShockBitmap.h"
#include "Prefs.h"
@@ -96,7 +97,7 @@
#define CFG_TIME_VAR "time_passes"
extern void olh_svga_deal(void);
-void change_svga_cursors();
+void change_svga_cursors(void);
LGRegion fullroot_region_data, fullview_region_data;
LGRegion *fullroot_region = &fullroot_region_data; // DUH
@@ -141,7 +142,7 @@
}
// Draw all relevant overlays
-errtype fullscreen_overlay() {+errtype fullscreen_overlay(void) {extern char last_message[128];
extern uchar game_paused;
@@ -170,7 +171,7 @@
// Set all appropriate things to convert us to full screen mode
-void change_svga_cursors() {+void change_svga_cursors(void) {ObjID old_obj;
extern int last_side_icon;
@@ -201,7 +202,7 @@
ss_set_hack_mode(0, &temp);
}
-void change_svga_screen_mode() {+void change_svga_screen_mode(void) {extern uchar redraw_paused;
uchar cur_pal[768];
@@ -334,7 +335,7 @@
redraw_paused = TRUE;
}
-void fullscreen_start() {+void fullscreen_start(void) {extern LGRegion *pagebutton_region;
extern LGRegion *inventory_region;
@@ -392,7 +393,7 @@
// Restore all appropriate things to put us back in normal
// screen mode
-void fullscreen_exit() {+void fullscreen_exit(void) {#ifdef SVGA_SUPPORT
uchar cur_pal[768];
extern grs_screen *cit_screen;
--- a/src/GameSrc/gameloop.c
+++ b/src/GameSrc/gameloop.c
@@ -25,6 +25,7 @@
#include <string.h>
+#include "precompiled.h"
#include "Prefs.h"
#include "cyber.h"
#include "leanmetr.h"
--- a/src/GameSrc/gameobj.c
+++ b/src/GameSrc/gameobj.c
@@ -26,6 +26,7 @@
#include <stdlib.h>
#include <string.h> // for memset
+#include "precompiled.h"
#include "effect.h"
#include "gameobj.h"
--- a/src/GameSrc/gamerend.c
+++ b/src/GameSrc/gamerend.c
@@ -27,6 +27,7 @@
#include <stdlib.h>
+#include "precompiled.h"
#include "tools.h"
#include "cyber.h"
@@ -477,7 +478,7 @@
#else
if (our_seed & 0x300) {*cur_pix = c_base + (our_seed & 0x7);
- our_seed += (long)cur_pix;
+ our_seed += (intptr)cur_pix;
our_seed = ((our_seed >> 5) & 0x07ffffff) | (our_seed << 27); //ror by 5
} else {*cur_pix = 0;
--- a/src/GameSrc/gamesort.c
+++ b/src/GameSrc/gamesort.c
@@ -29,6 +29,7 @@
#include <stdlib.h>
+#include "precompiled.h"
#include "map.h"
#include "objects.h"
#include "objsim.h"
--- a/src/GameSrc/gamestrn.c
+++ b/src/GameSrc/gamestrn.c
@@ -26,6 +26,7 @@
#include <string.h>
+#include "precompiled.h"
#include "Shock.h"
#include "gamestrn.h"
#include "criterr.h"
--- a/src/GameSrc/gamesys.c
+++ b/src/GameSrc/gamesys.c
@@ -27,6 +27,7 @@
#include <stdbool.h>
#include <stdlib.h>
+#include "precompiled.h"
#include "ai.h"
#include "cyber.h"
#include "cybstrng.h"
@@ -155,7 +156,7 @@
#define MONSTER_THEME_PATH_LENGTH 12
-void check_nearby_objects() {+void check_nearby_objects(void) {short x, y;
int dist, best_dist;
ObjRefID oref;
@@ -719,7 +720,7 @@
#define REALSPACE_HUDS \
(HUD_RADPOISON | HUD_BIOPOISON | HUD_FATIGUE | HUD_BIOHAZARD | HUD_RADIATION | HUD_ZEROGRAV | HUD_ENVIROUSE)
-void do_stuff_every_second() {+void do_stuff_every_second(void) {long running_dt = player_struct.game_time - player_struct.last_second_update;
extern int bio_energy_var;
extern int bio_absorb;
--- a/src/GameSrc/gametime.c
+++ b/src/GameSrc/gametime.c
@@ -26,6 +26,7 @@
#include <stdlib.h>
+#include "precompiled.h"
#include "gametime.h"
#include "faketime.h"
#include "player.h"
--- a/src/GameSrc/gamewrap.c
+++ b/src/GameSrc/gamewrap.c
@@ -25,6 +25,7 @@
#include <string.h>
+#include "precompiled.h"
#include "Shock.h"
#include "amap.h"
--- a/src/GameSrc/gearmfd.c
+++ b/src/GameSrc/gearmfd.c
@@ -24,6 +24,7 @@
*
*/
+#include "precompiled.h"
#include "mfdint.h"
#include "mfdext.h"
#include "mfddims.h"
--- a/src/GameSrc/gr2ss.c
+++ b/src/GameSrc/gr2ss.c
@@ -17,6 +17,7 @@
*/
+#include "precompiled.h"
#include "cit2d.h"
#include "gr2ss.h"
#include "frtypes.h"
@@ -25,6 +26,7 @@
#include "gamescr.h"
+#include "precompiled.h"
#ifdef STEREO_SUPPORT
#include <i6dvideo.h>
extern uchar inp6d_stereo_active;
--- a/src/GameSrc/grenades.c
+++ b/src/GameSrc/grenades.c
@@ -24,6 +24,7 @@
*
*/
+#include "precompiled.h"
#include "grenades.h"
#include "effect.h"
#include "objwpn.h"
--- a/src/GameSrc/hand.c
+++ b/src/GameSrc/hand.c
@@ -25,6 +25,7 @@
*/
// Includes
+#include "precompiled.h"
#include "handart.h"
#include "objclass.h"
#include "weapons.h"
--- a/src/GameSrc/hflip.c
+++ b/src/GameSrc/hflip.c
@@ -23,6 +23,7 @@
* $Date: 1994/10/31 22:08:14 $
*/
+#include "precompiled.h"
#include "gr2ss.h"
#include "cybmem.h"
--- a/src/GameSrc/hkeyfunc.c
+++ b/src/GameSrc/hkeyfunc.c
@@ -24,6 +24,8 @@
*/
#include <string.h>
+#include "precompiled.h"
+#include <SDL2/SDL.h>
#include <hkeyfunc.h>
#include "Shock.h"
--- a/src/GameSrc/hud.c
+++ b/src/GameSrc/hud.c
@@ -28,6 +28,7 @@
#include <string.h>
#include <stdio.h>
+#include "precompiled.h"
#include "cyber.h"
#include "hud.h"
#include "hudobj.h"
--- a/src/GameSrc/hudobj.c
+++ b/src/GameSrc/hudobj.c
@@ -16,6 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "precompiled.h"
#include "hudobj.h"
#include "objects.h"
#include "objapp.h"
--- a/src/GameSrc/init.c
+++ b/src/GameSrc/init.c
@@ -26,6 +26,7 @@
#include <string.h>
#include <stdio.h>
+#include "precompiled.h"
#include "Shock.h"
#include "InitMac.h"
#include "ShockBitmap.h"
@@ -121,15 +122,15 @@
//void DrawSplashScreen(short id, Boolean fadeIn);
void PreloadGameResources(void);
-errtype init_gamesys();
+errtype init_gamesys(void);
errtype free_gamesys(void);
-errtype init_load_resources();
-errtype init_3d_objects();
-errtype obj_3d_shutdown();
-void init_popups();
+errtype init_load_resources(void);
+errtype init_3d_objects(void);
+errtype obj_3d_shutdown(void);
+void init_popups(void);
uchar pause_for_input(ulong wait_time);
-errtype init_pal_fx();
+errtype init_pal_fx(void);
void byebyemessage(void);
/*
errtype init_kb();
@@ -329,7 +330,7 @@
// Initialize animation callbacks
{- extern void init_animlist();
+ extern void init_animlist(void);
init_animlist();
}
@@ -596,7 +597,7 @@
#ifdef DUMMY ///Â¥
-errtype init_kb() {+errtype init_kb(void) {// Keyboard frobbing
if (config_get_raw(CHAINING_VAR, NULL, 0))
kb_set_flags(kb_get_flags() | KBF_CHAIN);
@@ -630,7 +631,7 @@
return (OK);
}
-errtype init_pal_fx() {+errtype init_pal_fx(void) {int i;
FILE *ipalHdl;
@@ -705,7 +706,7 @@
return (OK);
}
-void shock_alloc_ipal() {+void shock_alloc_ipal(void) {// CC: Make sure we always allocate an ipal first
gr_alloc_ipal();
@@ -720,7 +721,7 @@
// return(temp);
}
-errtype init_gamesys() {+errtype init_gamesys(void) {// Load data for weapons, drugs, wares
drugs_init();
init_all_side_icons();
@@ -742,17 +743,17 @@
#define MAX_CUSTOMS 30
-errtype init_3d_objects() {+errtype init_3d_objects(void) {vx_init(16);
return (OK);
}
-errtype obj_3d_shutdown() {+errtype obj_3d_shutdown(void) {vx_close();
return (OK);
}
-errtype init_load_resources() {+errtype init_load_resources(void) {// Open the screen resource stuff
if (ResOpenFile("res/data/gamescr.res") < 0)critical_error(CRITERR_RES | 1);
@@ -781,12 +782,12 @@
#ifdef DUMMY // later
-errtype init_debug() {+errtype init_debug(void) {errtype retval = OK;
return (retval);
}
-errtype init_editor_gadgets() { return (OK); }+errtype init_editor_gadgets(void) { return (OK); } void free_all(void) {extern void shutdown_config(void);
--- a/src/GameSrc/input.c
+++ b/src/GameSrc/input.c
@@ -32,6 +32,7 @@
#include <string.h>
#include <limits.h>
+#include "precompiled.h"
#include "Shock.h"
#include "ShockBitmap.h"
#include "InitMac.h"
@@ -2557,7 +2558,7 @@
#define inp_weapon_junk() weap_time = 0
-void inp_use_sidestep_button() {+void inp_use_sidestep_button(void) { if (use_but_time) { // if long enough, go to sidestep.... if (*tmd_ticks > use_but_time + USE_UPPER_BOUND) {inp_sidestep = TRUE;
@@ -2572,7 +2573,7 @@
// and if mouse moves cancelling but otherwise when joyclicking again with
// an obj already on cursor the put it in inventory
-void inp_use_sidestep_junk() {+void inp_use_sidestep_junk(void) { if (use_but_time) {LGPoint pos;
--- a/src/GameSrc/invent.c
+++ b/src/GameSrc/invent.c
@@ -28,6 +28,7 @@
#include <string.h>
+#include "precompiled.h"
#include "email.h"
#include "invent.h"
#include "leanmetr.h"
@@ -1827,7 +1828,7 @@
inv_display *dpy;
int i;
for (i = 0; gen_inv_displays(&i, &dpy); i++) {- ubyte pop;
+ ubyte pop = 0;
if (global_fullmap->cyber && (objs[obj].obclass == CLASS_BIGSTUFF)) {if (!(dpy->add_classes & (1 << CLASS_SOFTWARE)))
continue;
@@ -1961,7 +1962,7 @@
return (OK);
}
-errtype inventory_full_redraw() {+errtype inventory_full_redraw(void) {int i;
inv_last_page = -1;
for (i = 0; i < NUM_PAGE_BUTTONS; i++)
@@ -2507,7 +2508,7 @@
return invreg;
}
-errtype inventory_update_screen_mode() {+errtype inventory_update_screen_mode(void) { if (convert_use_mode) {gr_init_sub_canvas(grd_scr_canv, &inv_norm_canvas, SCONV_X(INVENTORY_PANEL_X), SCONV_Y(INVENTORY_PANEL_Y),
SCONV_X(INVENTORY_PANEL_WIDTH), SCONV_Y(INVENTORY_PANEL_HEIGHT));
--- a/src/GameSrc/leanmetr.c
+++ b/src/GameSrc/leanmetr.c
@@ -24,6 +24,7 @@
*
*/
+#include "precompiled.h"
#include "faketime.h"
#include "citres.h"
#include "physics.h"
--- a/src/GameSrc/mainloop.c
+++ b/src/GameSrc/mainloop.c
@@ -41,6 +41,7 @@
#include <stdio.h>
+#include "precompiled.h"
#include "InitMac.h"
#include "Shock.h"
#include "amaploop.h"
@@ -163,7 +164,7 @@
// hit them atexit's
}
-errtype static_change_copy() {+errtype static_change_copy(void) {if (always_render)
chg_set_sta(_current_3d_flag);
else
--- a/src/GameSrc/map.c
+++ b/src/GameSrc/map.c
@@ -25,6 +25,7 @@
*
*/
+#include "precompiled.h"
#include "map.h"
#include "schedule.h"
#include "statics.h"
--- a/src/GameSrc/mfdfunc.c
+++ b/src/GameSrc/mfdfunc.c
@@ -30,6 +30,7 @@
#include <string.h>
+#include "precompiled.h"
#include "ammomfd.h"
#include "bark.h"
#include "biohelp.h"
@@ -204,7 +205,7 @@
// expose/handler pairs, and also where you set their flags. This is also
// where MFD virtual slots are set to point at their functions.
-void mfd_init_funcs() {+void mfd_init_funcs(void) {int i;
// Define a couple of MFD functions.
for (i = 0; i < MFD_NUM_FUNCS; i++)
@@ -2102,7 +2103,7 @@
//
// Open the space station resource file for animation
-errtype mfd_anim_init() {+errtype mfd_anim_init(void) {#ifdef USING_DORKY_BROKEN_ANIM
if (ResOpenFile("space4.res") < 0)critical_error(CRITERR_RES | 5);
--- a/src/GameSrc/mfdgadg.c
+++ b/src/GameSrc/mfdgadg.c
@@ -43,6 +43,7 @@
#include <stdlib.h>
+#include "precompiled.h"
#include "gr2ss.h"
#include "mfdgadg.h"
--- a/src/GameSrc/mfdgames.c
+++ b/src/GameSrc/mfdgames.c
@@ -28,6 +28,7 @@
#include <stdlib.h>
#include <stdio.h>
+#include "precompiled.h"
#include "faketime.h"
#include "player.h"
#include "newmfd.h"
@@ -975,7 +976,7 @@
void games_run_bots(bots_state *bs) {int rev, guys;
- uint8_t i;
+ int8_t i;
bs->hpos += bs->hspd;
// test if we've scrolled a bot off the left
@@ -1704,7 +1705,7 @@
games_time_diff = 0;
}
-static uchar puzz15_won() {+static uchar puzz15_won(void) {puzzle15_state *st = (puzzle15_state *)GAME_DATA;
int i;
@@ -2158,7 +2159,7 @@
// note that this procedure duplicates a lot of the work done by
// tictactoe_evaluator: we do not consolidate them because we don't
// want to slow down the evaluator.
-void tictactoe_drawwin(ttt_state *st) {+static void tictactoe_drawwin(ttt_state *st) {uchar win, realwin;
int i;
LGPoint p1, p2;
--- a/src/GameSrc/mfdgump.c
+++ b/src/GameSrc/mfdgump.c
@@ -25,6 +25,7 @@
*
*/
+#include "precompiled.h"
#include "mfdint.h"
#include "mfdext.h"
#include "mfdfunc.h"
--- a/src/GameSrc/mfdpanel.c
+++ b/src/GameSrc/mfdpanel.c
@@ -27,6 +27,7 @@
#include <string.h>
#include <limits.h>
+#include "precompiled.h"
#include "mfdpanel.h"
#include "mfdint.h"
#include "mfdext.h"
@@ -515,7 +516,7 @@
mfd_notify_func(MFD_ACCESSPANEL_FUNC, MFD_INFO_SLOT, TRUE, MFD_ACTIVE, TRUE);
}
-uchar mfd_solve_wirepanel() {+uchar mfd_solve_wirepanel(void) {wirePosPuzzle *wppz = (wirePosPuzzle *)&player_struct.mfd_access_puzzles[0];
int wire, swapper, targ, num_wires;
int score;
@@ -999,7 +1000,7 @@
return;
}
-uchar mfd_solve_gridpanel() {+uchar mfd_solve_gridpanel(void) {gridFlowPuzzle *gfpz = (gridFlowPuzzle *)&player_struct.mfd_access_puzzles[0];
gridFlowPuzzle solved;
int search_depth;
--- a/src/GameSrc/minimax.c
+++ b/src/GameSrc/minimax.c
@@ -24,6 +24,7 @@
*
*/
+#include "precompiled.h"
#ifdef LOST_TREASURES_OF_MFD_GAMES
#include <limits.h>
#include <string.h>
--- a/src/GameSrc/mlimbs.c
+++ b/src/GameSrc/mlimbs.c
@@ -25,6 +25,7 @@
#include <string.h>
+#include "precompiled.h"
#include "mlimbs.h"
#define CHANNEL_MAP
--- a/src/GameSrc/mouselook.c
+++ b/src/GameSrc/mouselook.c
@@ -19,6 +19,7 @@
#include <SDL.h>
+#include "precompiled.h"
#include "leanmetr.h"
#include "mouselook.h"
#include "mouse.h"
@@ -44,7 +45,7 @@
int mlook_enabled = FALSE;
-void mouse_look_physics() {
+void mouse_look_physics(void) {
if (game_paused || !global_fullmap || !mlook_enabled)
return;
--- a/src/GameSrc/movekeys.c
+++ b/src/GameSrc/movekeys.c
@@ -26,6 +26,7 @@
#include <stdlib.h>
+#include "precompiled.h"
#include "input.h"
#include "player.h"
#include "physics.h"
--- a/src/GameSrc/musicai.c
+++ b/src/GameSrc/musicai.c
@@ -25,6 +25,7 @@
#include <string.h>
+#include "precompiled.h"
#include "Shock.h"
#include "Prefs.h"
@@ -38,7 +39,7 @@
#include "tickcount.h"
#include "tools.h"
-#include "adlmidi.h"
+//#include "adlmidi.h"
#include "Xmi.h"
#ifdef AUDIOLOGS
@@ -121,7 +122,7 @@
// INTERNAL PROTOTYPES
//------------------
-errtype musicai_shutdown() {+errtype musicai_shutdown(void) {int i;
for (i = 0; i < MLIMBS_MAX_SEQUENCES - 1; i++)
current_request[i].pieceID = 255;
@@ -138,13 +139,13 @@
return (OK);
}
-void musicai_clear() {+void musicai_clear(void) {mai_damage_sum = 0;
last_damage_sum = 0;
mlimbs_combat = 0;
}
-void mlimbs_do_ai() {+void mlimbs_do_ai(void) {// extern uchar mlimbs_semaphore;
extern ObjID damage_sound_id;
extern char damage_sound_fx;
@@ -258,7 +259,7 @@
#ifdef NOT_YET //
-void mlimbs_do_credits_ai() {+void mlimbs_do_credits_ai(void) {extern uchar mlimbs_semaphore;
if (ai_cycle) {ai_cycle = 0;
@@ -270,7 +271,7 @@
#endif // NOT_YET
-errtype mai_attack() {+errtype mai_attack(void) { if (music_on) {mlimbs_combat = player_struct.game_time + mai_combat_length;
}
@@ -277,7 +278,7 @@
return (OK);
}
-errtype mai_intro() {+errtype mai_intro(void) { if (music_on) {if (transition_table[TRANS_INTRO] != 255)
mai_transition(TRANS_INTRO);
@@ -298,7 +299,7 @@
return (OK);
}
-errtype mai_monster_defeated() {+errtype mai_monster_defeated(void) { if (music_on) {mlimbs_combat = 0;
}
@@ -305,7 +306,7 @@
return (OK);
}
-errtype mai_player_death() {+errtype mai_player_death(void) { if (music_on) {mai_transition(TRANS_DEATH);
mlimbs_peril = DEFAULT_PERIL_MIN;
@@ -592,7 +593,7 @@
// For Mac version, the vast majority of the config mess just goes away. But we do check for
// the presence of QuickTime Musical Instruments.
//----------------------------------------------------------------------
-errtype music_init() {+errtype music_init(void) {/* put in later
int i,j;
uchar gm=FALSE;
@@ -600,7 +601,7 @@
char s[64],path[64];
audio_card card_info;
extern uchar curr_sfx_vol;
- extern char curr_vol_lev;
+ extern uchar curr_vol_lev;
#ifdef SECRET_SUPPORT
if ((secret_fp=fopen("secret.ddb","wt"))!=NULL)--- a/src/GameSrc/newai.c
+++ b/src/GameSrc/newai.c
@@ -26,6 +26,7 @@
#include <stdlib.h>
+#include "precompiled.h"
#include "ai.h"
#include "cyber.h"
#include "player.h"
@@ -82,9 +83,9 @@
ulong time_last_seen;
uchar priority_check;
-short compute_base_visibility();
+short compute_base_visibility(void);
errtype run_evil_otto(ObjID id, int dist);
-errtype run_cspace_ice();
+errtype run_cspace_ice(void);
errtype ai_spot_player(ObjID id, uchar *raycast_success);
uchar do_physics_stupidity(ObjID id, int big_dist);
void check_attitude_adjustment(ObjID id, ObjSpecID osid, int big_dist, uchar raycast_success);
@@ -111,7 +112,7 @@
uchar ice_fire_chances[] = {0x40, 0x80, 0xD0, 0xF0};ulong run_ice_time = 0;
-errtype run_cspace_ice() {+errtype run_cspace_ice(void) {int dx, dy, dist;
// Look for hostile ICEs, which closely resemble creatures
// of course, only do so if we be in cspace
@@ -137,9 +138,9 @@
}
// Compute and return the player's basic visibility for this frame
-short compute_base_visibility() {+short compute_base_visibility(void) {MapElem *pme;
- short visibility;
+ short visibility = 0;
// Update detection variables
if (!cspace_decoy_obj) {@@ -874,7 +875,7 @@
#define COMBAT_FRAMES 2
#define DEFAULT_FRAMES 13
-errtype ai_run() {+errtype ai_run(void) {ObjSpecID osid;
ObjID id;
short visibility;
--- a/src/GameSrc/newmfd.c
+++ b/src/GameSrc/newmfd.c
@@ -34,6 +34,7 @@
#include <stdlib.h>
#include <string.h>
+#include "precompiled.h"
#include "game_screen.h" // for the root region
#include "fullscrn.h"
#include "invent.h"
@@ -115,7 +116,7 @@
//
// Initialize the MFD system (called from init_all() in init.c)
-void init_newmfd() {+void init_newmfd(void) {ubyte i;
// Set the default MFD function
@@ -156,7 +157,7 @@
load_string_array(REF_STR_MFDCursor, cursor_strings, cursor_strbuf, sizeof(cursor_strbuf), MFD_NUM_BTTNS);
}
-void init_newmfd_button_cursors() {+void init_newmfd_button_cursors(void) {int i;
mfd_language_change();
for (i = 0; i < NUM_MFDS; i++) {@@ -168,12 +169,12 @@
}
// ---------------------------------------------------------------------------
-// screen_init_mfd_draw()
+// screen_init_mfd_draw(void)
//
// Basically, just draw the friggin' buttons and set mfd's to their
// first slot. (called from screen_start() in screen.c)
-void screen_init_mfd_draw() {+void screen_init_mfd_draw(void) {mfd_set_slot(MFD_LEFT, mfd_index(MFD_LEFT), TRUE);
mfd_set_slot(MFD_RIGHT, mfd_index(MFD_RIGHT), TRUE);
@@ -189,7 +190,7 @@
#endif
// ---------------------------------------------------------------------------
-// screen_init_mfd();
+// screen_init_mfd(void);
//
// Declare the appropriate regions for the MFD's and their button panels.
// (called from screen_start() in screen.c)
@@ -297,7 +298,7 @@
}
#ifdef SVGA_SUPPORT
-errtype mfd_update_screen_mode() {+errtype mfd_update_screen_mode(void) { if (convert_use_mode == 0) {gr_init_canvas(&_offscreen_mfd, mfd_canvas_bits, BMT_FLAT8, MFD_VIEW_WID, MFD_VIEW_HGT);
gr_init_canvas(&_fullscreen_mfd, mfd_background.bits, BMT_FLAT8, MFD_VIEW_WID, MFD_VIEW_HGT);
@@ -324,7 +325,7 @@
return (OK);
}
-errtype mfd_clear_all() {+errtype mfd_clear_all(void) { if (full_game_3d) {gr_push_canvas(&_offscreen_mfd);
gr_clear(0);
@@ -365,7 +366,7 @@
// Tell the function keys that they're supposed to map to our button panels.
// (Called from init_input() in input.c)
-void keyboard_init_mfd() {+void keyboard_init_mfd(void) {/* KLC leave out F-keys and char codes.
hotkey_add(KEY_F1, DEMO_CONTEXT,mfd_button_callback_kb,0);
@@ -1006,7 +1007,7 @@
//
// This is what gets called from the main loop each frame.
-void mfd_update() {+void mfd_update(void) {static uchar LastFlash = FALSE;
ubyte steps_cache[NUM_MFDS] = {0, 0};@@ -1128,7 +1129,7 @@
//
// Forces a redraw of both the button panels and mfd slots
-void mfd_force_update() {+void mfd_force_update(void) {ubyte i;
for (i = 0; i < NUM_MFDS; i++) {mfd_force_update_single(i);
--- a/src/GameSrc/objapp.c
+++ b/src/GameSrc/objapp.c
@@ -21,6 +21,7 @@
*
*/
+#include "precompiled.h"
#include "objects.h"
#include "objwpn.h"
#include "objwarez.h"
--- a/src/GameSrc/objects.c
+++ b/src/GameSrc/objects.c
@@ -61,6 +61,7 @@
#include <string.h>
+#include "precompiled.h"
#include "objects.h"
#include "map.h"
@@ -157,7 +158,7 @@
// set up the free chains for class-specific info
for (c = CLASS_FIRST; c < NUM_CLASSES; c++) {head = &objSpecHeaders[c];
- ((ObjSpec *)(head->data))->bits.id = 0; // really head of used chain
+ ((ObjSpec *)(head->data))->bits &= ~((1<<15)-1); // really head of used chain
for (i = 0; i < head->size - 1; i++) {os = (ObjSpec *)(head->data + i * head->struct_size);
os->next = i + 1;
@@ -198,7 +199,8 @@
objs[*id].obclass = obclass;
objs[*id].specID = *specid;
head = &objSpecHeaders[obclass];
- ((ObjSpec *)(head->data + *specid * head->struct_size))->bits.id = *id;
+ ((ObjSpec *)(head->data + *specid * head->struct_size))->bits &= ~((1<<15)-1);
+ ((ObjSpec *)(head->data + *specid * head->struct_size))->bits |= *id;
// temp
// if (!ObjSysOkay())
@@ -780,7 +782,7 @@
usedObj[cur] = OBJ_FREE;
cur = ((ObjSpec *)(head->data + cur * head->struct_size))->next;
}
- cur = ((ObjSpec *)head->data)->bits.id;
+ cur = OSBITSID((ObjSpec *)head->data);
while (cur) { if (cur < 0 || cur >= head->size) { DEBUG("%s: Invalid ID (cur) in Class (i) used chain", __FUNCTION__);@@ -929,8 +931,8 @@
head = &objSpecHeaders[objs[cur].obclass];
data = head->data;
- if (((ObjSpec *)(data + head->struct_size * objs[cur].specID))->bits.id != cur ||
- ((ObjSpec *)(data + head->struct_size * objs[cur].specID))->bits.tile == TRUE) {+ if (OSBITSID(((ObjSpec *)(data + head->struct_size * objs[cur].specID))) != cur ||
+ OSBITSTILE(((ObjSpec *)(data + head->struct_size * objs[cur].specID))) == TRUE) { DEBUG("%s: Obj (cur) obclass-specific data does not point back to it", __FUNCTION__);return FALSE;
}
--- a/src/GameSrc/objload.c
+++ b/src/GameSrc/objload.c
@@ -18,6 +18,7 @@
*/
#include <string.h>
+#include "precompiled.h"
#include "Shock.h"
#include "criterr.h"
--- a/src/GameSrc/objprop.c
+++ b/src/GameSrc/objprop.c
@@ -97,6 +97,7 @@
*
*/
+#include "precompiled.h"
#include "objclass.h"
#include "objprop.h"
--- a/src/GameSrc/objsim.c
+++ b/src/GameSrc/objsim.c
@@ -29,6 +29,7 @@
#include <string.h>
#include <stdlib.h>
+#include "precompiled.h"
#include "Shock.h"
#include "amap.h"
@@ -113,8 +114,8 @@
// Internal Prototypes
errtype ObjClassInit(ObjID id, ObjSpecID specid, int subclass);
-errtype obj_set_secondary_properties();
-errtype do_ecology_triggers();
+errtype obj_set_secondary_properties(void);
+errtype do_ecology_triggers(void);
grs_bitmap *get_text_bitmap_from_string(int d1, char dest_type, char *s, uchar scroll, int scroll_index);
grs_bitmap *obj_get_model_data(ObjID id, fix *x, fix *y, fix *z, grs_bitmap *bm2, Ref *ref1, Ref *ref2);
void place_obj_at_objloc(ObjID id, ObjLoc *newloc, ushort xsize, ushort ysize);
@@ -171,7 +172,7 @@
int memcount = 0;
-errtype obj_init() {+errtype obj_init(void) {uchar c_class, c_subclass;
int i, j, count, class_count = 0;
Id ids;
@@ -239,7 +240,7 @@
ubyte v, p;
ulong old_ticks;
extern ulong last_real_time;
- Id our_id;
+ Id our_id = 0;
RefTable *prt;
char curr_frames;
uchar load_all_views = TRUE;
@@ -695,7 +696,7 @@
}
// Shutdown the object system and free up memory as appropriate
-errtype obj_shutdown() {+errtype obj_shutdown(void) {// Free the word-buffer bitmap
for (int i = 0; i < NUM_TEXT_BITMAPS; i++) {if (text_bitmap_ptrs[i] != NULL)
@@ -1059,7 +1060,7 @@
EDMS_holistic_teleport(objs[id].info.ph, &new_state);
}
- if (objs[id].loc.x == -1) {+ if (objs[id].loc.x == (ushort)-1) {ObjRefState newref;
ObjPlace(id, newloc);
@@ -1377,7 +1378,7 @@
// ## INSERT NEW CLASS HERE
// ## INSERT NEW SUBCLASS HERE
-errtype obj_load_properties() {+errtype obj_load_properties(void) {// Handle res;
int version, i, j;
char *cp;
@@ -1866,7 +1867,7 @@
return (OK);
}
-errtype obj_set_secondary_properties() {+errtype obj_set_secondary_properties(void) {char i, j;
RefTable *prt;
int fn, fn2;
@@ -1926,7 +1927,7 @@
for (specid = 1; specid < curHead->size;
specid++) { /* find the base of our obj and cast it to a ObjSpec common header struct */ObjSpec *curSpec = (ObjSpec *)(curHead->data + (curHead->struct_size * specid));
- if (!objs[id = curSpec->bits.id].active) /* toast all but the Spec part */
+ if (!objs[id = OSBITSID(curSpec)].active) /* toast all but the Spec part */
LG_memset(((char *)curSpec) + sizeof(ObjSpec), 0, curHead->struct_size - sizeof(ObjSpec));
counters[0][objs[id].active ? 1 : 0]++;
}
@@ -2392,7 +2393,7 @@
550, 450, 30, 60, 250, 250, 150, 400, 60, 750, 400};
#endif
-errtype obj_level_munge() {+errtype obj_level_munge(void) {short count = 0;
#ifdef ELDER_DEMON_EXORCISM
ObjID oid;
@@ -2589,7 +2590,7 @@
#endif
#ifdef TEXTURE_CRUNCH_HACK
- extern errtype texture_crunch_go();
+ extern errtype texture_crunch_go(void);
texture_crunch_go();
#endif
--- a/src/GameSrc/objuse.c
+++ b/src/GameSrc/objuse.c
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <string.h>
+#include "precompiled.h"
#include "ai.h"
#include "amap.h"
#include "audiolog.h"
@@ -88,8 +89,8 @@
uchar obj_keypad_crunch(int p, uchar digits[]);
uchar try_use_epick(ObjID panel, ObjID cursor_obj);
ObjID door_in_square(ObjLoc *loc, uchar usable);
-void regenetron_door_hack();
-errtype elevator_janitor_run();
+void regenetron_door_hack(void);
+errtype elevator_janitor_run(void);
// not in any way the right way to fix this bug, except
// that it is the fastest way. Doug says go. Ask TJS.
@@ -513,7 +514,7 @@
return (OK);
}
-errtype gear_power_outage() {+errtype gear_power_outage(void) {ObjID obj;
char i;
for (i = 0; i < NUM_GENERAL_SLOTS; i++) {@@ -1090,7 +1091,7 @@
return (OBJ_NULL);
}
-void regenetron_door_hack() {+void regenetron_door_hack(void) {ObjID id;
id = door_in_square(&(objs[PLAYER_OBJ].loc), TRUE);
@@ -1102,7 +1103,7 @@
// Collects all the objects already in the elevator that you are going to
// and move them outside the door
#define MAX_JANITOR_OBJS 32
-errtype elevator_janitor_run() {+errtype elevator_janitor_run(void) {short x0, x1, y0, y1, x, y;
int i, j, obj_count = 0;
ObjLoc dump_loc = {0, 0, 0, 0, 0, 0}, newloc;--- a/src/GameSrc/olh.c
+++ b/src/GameSrc/olh.c
@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <string.h>
+#include "precompiled.h"
#include "Prefs.h"
#include "Shock.h"
--- a/src/GameSrc/olhscan.c
+++ b/src/GameSrc/olhscan.c
@@ -26,6 +26,7 @@
#include <stdlib.h>
#include <string.h>
+#include "precompiled.h"
#include "faketime.h"
#include "frtypes.h"
@@ -49,7 +50,7 @@
fauxrend_context *olh_full_context = NULL;
-extern fauxrend_context *svga_render_context;
+extern frc *svga_render_context;
#define FULL_SCAN_WID (FULL_VIEW_WIDTH / SCAN_RATIO)
#define FULL_SCAN_HGT (FULL_VIEW_HEIGHT / SCAN_RATIO)
@@ -84,7 +85,7 @@
y_mul = fix_div(fix_make(200, 0), fix_make(grd_mode_cap.h, 0));
}
-extern int last_real_time;
+extern ulong last_real_time;
ushort olh_scan_objs(void) {int xl, yl;
--- a/src/GameSrc/palfx.c
+++ b/src/GameSrc/palfx.c
@@ -27,6 +27,7 @@
#include <string.h>
#include <SDL.h>
+#include "precompiled.h"
#include "Shock.h"
#include "palfx.h"
#include "sdl_events.h"
@@ -68,7 +69,7 @@
}
//-------------------------------------
-void palfx_fade_down() {+void palfx_fade_down(void) {byte id;
static uchar blackp[768];
static uchar savep[768];
@@ -112,7 +113,7 @@
}
//-------------------------------------
-void palfx_init() {+void palfx_init(void) {palette_initialize(8); // 1 time unit per frame, 8 effects max
palette_set_rate(1);
--- a/src/GameSrc/pathfind.c
+++ b/src/GameSrc/pathfind.c
@@ -28,6 +28,7 @@
#include <assert.h>
#include <string.h>
+#include "precompiled.h"
#include "pathfind.h"
#include "player.h"
#include "faketime.h"
@@ -231,7 +232,7 @@
// Resets appropriate secret pathfinding state not saved
// in the save game
-errtype reset_pathfinding() {+errtype reset_pathfinding(void) {last_pathfind_time = 0;
return (OK);
}
--- a/src/GameSrc/physics.c
+++ b/src/GameSrc/physics.c
@@ -29,6 +29,7 @@
#include <stdlib.h>
#include <string.h>
+#include "precompiled.h"
#include "ai.h"
#include "combat.h"
#include "criterr.h"
@@ -184,7 +185,7 @@
}
}
-void edms_delete_go() {+void edms_delete_go(void) {int i;
for (i = 0; i < curr_edms_del; i++) {if (edms_delete_queue[i] != -1)
@@ -219,7 +220,7 @@
}
}
-void physics_zero_all_controls() { LG_memset(player_controls, 0, sizeof(player_controls)); }+void physics_zero_all_controls(void) { LG_memset(player_controls, 0, sizeof(player_controls)); } errtype physics_set_player_controls(int bank, byte xvel, byte yvel, byte zvel, byte xyrot, byte yzrot, byte xzrot) {if (xvel != CONTROL_NO_CHANGE)
@@ -1182,7 +1183,7 @@
};
#endif // NOT_YET
-errtype physics_init() {+errtype physics_init(void) {EDMS_data init_data;
// Start EDMS
--- a/src/GameSrc/player.c
+++ b/src/GameSrc/player.c
@@ -25,6 +25,7 @@
#include <string.h>
+#include "precompiled.h"
#include "objwpn.h"
#include "player.h"
#include "diffq.h" // for time limit
@@ -217,7 +218,7 @@
#define INITIAL_PLAYER_X 0x1E00
#define INITIAL_PLAYER_Y 0x1620
-errtype player_create_initial() {+errtype player_create_initial(void) {ObjLoc plr_loc;
extern Pelvis standard_pelvis;
--- a/src/GameSrc/plotware.c
+++ b/src/GameSrc/plotware.c
@@ -28,6 +28,7 @@
#include <stdbool.h>
#include <string.h>
+#include "precompiled.h"
#include "mfdint.h"
#include "mfdext.h"
#include "mfdfunc.h"
--- a/src/GameSrc/popups.c
+++ b/src/GameSrc/popups.c
@@ -26,6 +26,7 @@
#include <string.h>
+#include "precompiled.h"
#include "popups.h"
#include "citres.h"
#include "criterr.h"
--- a/src/GameSrc/render.c
+++ b/src/GameSrc/render.c
@@ -25,6 +25,7 @@
#include <string.h>
+#include "precompiled.h"
#include "gamerend.h"
#include "render.h"
#include "frprotox.h"
@@ -112,7 +113,7 @@
typedef int (*frdraw)(void *dstc, void *dstbm, int x, int y, int flg);
-errtype init_hack_cameras() {+errtype init_hack_cameras(void) {int i;
grs_canvas *tmp_cnv;
uchar *tmp_mem;
@@ -153,7 +154,7 @@
return (OK);
}
-errtype shutdown_hack_cameras() {+errtype shutdown_hack_cameras(void) {int i;
for (i = 0; i < MAX_CAMERAS_VISIBLE; i++) {fr_free_view(hack_cam_frcs[i]);
@@ -162,13 +163,13 @@
return (OK);
}
-errtype do_screen_static() {+errtype do_screen_static(void) {if (!screen_static_drawn)
draw_full_static(static_bitmap, GRAY_8_BASE);
return (OK);
}
-errtype render_hack_cameras() {+errtype render_hack_cameras(void) {int i, count;
// efficiency good....
@@ -234,7 +235,7 @@
return (OK);
}
-errtype hack_camera_relinquish() {+errtype hack_camera_relinquish(void) {cams *cam = fr_camera_getdef();
fr_camera_update(cam, (unsigned int)PLAYER_OBJ, 0, 0);
--- a/src/GameSrc/rendtool.c
+++ b/src/GameSrc/rendtool.c
@@ -26,6 +26,7 @@
* support for render functions and tools, such as mouse and so on
*/
+#include "precompiled.h"
#include "map.h"
#include "frintern.h"
#include "fullscrn.h"
--- a/src/GameSrc/saveload.c
+++ b/src/GameSrc/saveload.c
@@ -25,6 +25,7 @@
#include <assert.h>
#include <string.h>
+#include "precompiled.h"
#include "MacTune.h"
#include "saveload.h"
@@ -74,7 +75,7 @@
// INTERNAL PROTOTYPES
// -----------------
-void load_level_data();
+void load_level_data(void);
void store_objects(char **buf, ObjID *obj_array, char obj_count);
void restore_objects(char *buf, ObjID *obj_array, char obj_count);
errtype write_id(Id id_num, short index, uint32_t version, void *ptr, long sz, int fd, short flags);
@@ -707,7 +708,7 @@
}
*/
-void load_level_data() {+void load_level_data(void) {// KLC-removed from here obj_load_art(FALSE);
load_small_texturemaps();
}
--- a/src/GameSrc/schedule.c
+++ b/src/GameSrc/schedule.c
@@ -25,6 +25,7 @@
*
*/
+#include "precompiled.h"
#include "map.h"
#include "player.h"
#include "schedule.h"
@@ -112,24 +113,26 @@
void stop_terrain_elevator_sound(short sem);
uchar register_h_event(uchar x, uchar y, uchar floor, char *sem, char *key, uchar no_sfx) {- int i, fr;
+ int i, k, fr;
fr = -1;
for (i = 0; i < NUM_HEIGHT_SEMAPHORS; i++) {if (h_sems[i].inuse == 0)
fr = i;
- else if (h_sems[i].x == x && h_sems[i].y == y && h_sems[i].floor == floor) {+ else if (h_sems[i].x == x && h_sems[i].y == y && THFLOOR(&h_sems[i]) == floor) {// conflict. Take over the old semaphor.
stop_terrain_elevator_sound(i);
- if (h_sems[i].key < MAX_HSEM_KEY)
- h_sems[i].key++;
- else
- h_sems[i].key = 0;
+ if (THKEY(&h_sems[i]) < MAX_HSEM_KEY){+ k = THKEY(&h_sems[i]) + 1;
+ h_sems[i].floor_key &= 1;
+ h_sems[i].floor_key |= k << 1;
+ }else
+ h_sems[i].floor_key &= 1;
- *key = h_sems[i].key;
+ *key = THKEY(&h_sems[i]);
*sem = i;
if (!no_sfx) {h_sems[i].inuse = 2;
@@ -147,9 +150,8 @@
} else {h_sems[fr].x = x;
h_sems[fr].y = y;
- h_sems[fr].floor = floor;
- h_sems[fr].key = 0;
- *key = h_sems[fr].key;
+ h_sems[fr].floor_key = floor;
+ *key = THKEY(&h_sems[fr]);
*sem = fr;
if (!no_sfx) {h_sems[fr].inuse = 2;
@@ -197,7 +199,7 @@
char ht, sign = (hse.steps_remaining > 0) ? 1 : -1;
// has someone else claimed this square?
- if (h_sems[hse.semaphor].key != hse.key) {+ if (THKEY(&h_sems[hse.semaphor]) != hse.key) {return;
}
x = h_sems[hse.semaphor].x;
--- a/src/GameSrc/screen.c
+++ b/src/GameSrc/screen.c
@@ -25,6 +25,7 @@
// Source code for the Citadel Screen routines
+#include "precompiled.h"
#ifdef SVGA_SUPPORT
#include "fullscrn.h"
#endif
@@ -215,7 +216,7 @@
extern void game_redrop_rad(int rad_mod);
-void screen_start() {+void screen_start(void) {extern LGRegion *pagebutton_region, *inventory_region;
/* Not yet
@@ -249,7 +250,7 @@
SetMotionCursorForMouseXY();
}
-void screen_exit() {+void screen_exit(void) {#ifdef SVGA_SUPPORT
uchar cur_pal[768];
extern grs_screen *cit_screen;
--- a/src/GameSrc/setup.c
+++ b/src/GameSrc/setup.c
@@ -24,6 +24,7 @@
*/
#include <string.h>
+#include "precompiled.h"
#include <SDL.h>
// TODO: extract this into a compatibility header
@@ -109,8 +110,8 @@
extern char which_lang;
extern uchar clear_player_data;
extern char current_cutscene;
-extern char curr_vol_lev;
-extern char curr_sfx_vol;
+extern uchar curr_vol_lev;
+extern uchar curr_sfx_vol;
extern uchar fullscrn_vitals;
extern uchar fullscrn_icons;
extern uchar map_notes_on;
@@ -117,7 +118,7 @@
extern uchar audiolog_setting;
extern uchar mouseLefty;
#ifdef AUDIOLOGS
-extern char curr_alog_vol;
+extern uchar curr_alog_vol;
#endif
errtype draw_difficulty_char(int char_num);
@@ -777,7 +778,7 @@
errtype draw_sg_slot(int slot_num) {char temp[64];
- short sz, x, y;
+ short sz = 0, x, y;
uiHideMouse(NULL);
--- a/src/GameSrc/shodan.c
+++ b/src/GameSrc/shodan.c
@@ -16,6 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "precompiled.h"
#include "shodan.h"
#include "player.h"
#include "objclass.h"
--- a/src/GameSrc/sideicon.c
+++ b/src/GameSrc/sideicon.c
@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <string.h>
+#include "precompiled.h"
#include "sideicon.h"
#include "sideart.h"
#include "popups.h"
@@ -151,7 +152,7 @@
load_string_array(REF_STR_IconCursor, cursor_strings, cursor_strbuf, sizeof(cursor_strbuf), NUM_SIDE_ICONS);
}
-void init_all_side_icons() {+void init_all_side_icons(void) {int i;
// Now, figure out on-screen locations
@@ -372,7 +373,7 @@
//
// Sort of an initial-draw-everything type of routine
-void side_icon_expose_all() {+void side_icon_expose_all(void) {for (uint8_t i = 0; i < NUM_SIDE_ICONS; i++)
side_icon_expose(i);
}
@@ -497,7 +498,7 @@
//
// Load the bitmaps for all side icons and states from the resource system.
-errtype side_icon_load_bitmaps() {+errtype side_icon_load_bitmaps(void) {#ifdef PRELOAD_BITMAPS
RefTable *side_icon_rft;
int i, j, index /*, file_handle */;
@@ -523,7 +524,7 @@
return (OK);
}
-errtype side_icon_free_bitmaps() {+errtype side_icon_free_bitmaps(void) {#ifdef PRELOAD_BITMAPS
int i, j, index;
Free(side_icon_background.bits);
--- a/src/GameSrc/sndcall.c
+++ b/src/GameSrc/sndcall.c
@@ -23,6 +23,7 @@
* $Date: 1994/11/28 08:31:43 $
*/
+#include "precompiled.h"
#include "digifx.h"
#include "musicai.h"
--- a/src/GameSrc/star.c
+++ b/src/GameSrc/star.c
@@ -41,6 +41,7 @@
*/
#include <stdlib.h>
+#include "precompiled.h"
#include "star.h"
#include "OpenGL.h"
--- a/src/GameSrc/statics.c
+++ b/src/GameSrc/statics.c
@@ -38,6 +38,7 @@
// put big buffer here? and have a define after it
+#include "precompiled.h"
#include "textmaps.h"
uchar tmap_static_mem[NUM_STATIC_TMAPS * SIZE_STATIC_TMAP];
#ifdef SVGA_CUTSCENES
--- a/src/GameSrc/status.c
+++ b/src/GameSrc/status.c
@@ -33,6 +33,7 @@
#include <math.h>
+#include "precompiled.h"
#include "status.h"
#include "player.h"
#include "tools.h"
@@ -373,13 +374,13 @@
// Do the init stuff for the biorhythm. 2d should be initialized and
// screen canvas should be unchanged when this is called.
-void status_bio_update_screenmode() { bio_canvas = *grd_screen_canvas; /* make copy for int routine */ }+void status_bio_update_screenmode(void) { bio_canvas = *grd_screen_canvas; /* make copy for int routine */ } void status_bio_init(void) {status_bio_update_screenmode();
#ifndef TIMING_PROCEDURES_OFF
- bio_time_id = tm_add_process((void (*)())status_bio_update, 0, TMD_FREQ / 140);
+ bio_time_id = tm_add_process((void (*)(void))status_bio_update, 0, TMD_FREQ / 140);
#endif
}
@@ -500,7 +501,7 @@
}
}
-errtype clear_bio_tracks() {+errtype clear_bio_tracks(void) {int i;
for (i = 0; i < NUM_BIO_TRACKS; i++)
status_bio_add(NULL, 0, 0, i, 0, 0);
@@ -517,7 +518,7 @@
// status_bio_synchronous()
//
// Does the synchronous blitting of biorhythm canvas
-void status_bio_synchronous() {+void status_bio_synchronous(void) {if (!convert_use_mode)
return;
gr_push_canvas(grd_screen_canvas);
--- a/src/GameSrc/target.c
+++ b/src/GameSrc/target.c
@@ -28,6 +28,7 @@
#include <stdio.h>
#include <string.h>
+#include "precompiled.h"
#include "target.h"
#include "colors.h"
#include "mfdext.h"
@@ -467,7 +468,7 @@
//
// Doofy code to cycle through all extant critters and pop 'em up on targeting
-void toggle_current_target() {+void toggle_current_target(void) {ObjSpecID oldsid, osid;
ObjID old;
--- a/src/GameSrc/textmaps.c
+++ b/src/GameSrc/textmaps.c
@@ -27,6 +27,7 @@
#include <string.h>
+#include "precompiled.h"
#include "textmaps.h"
#include "gettmaps.h"
#include "tools.h"
--- a/src/GameSrc/tfdirect.c
+++ b/src/GameSrc/tfdirect.c
@@ -26,6 +26,7 @@
#include <stdlib.h>
#include <string.h>
+#include "precompiled.h"
// pretty cool set of header files, eh?
#include "tfdirect.h" // ditto, yep yep yep
#include "ss_flet.h" // for everything, basically, constants mostly
--- a/src/GameSrc/tfutil.c
+++ b/src/GameSrc/tfutil.c
@@ -27,6 +27,7 @@
#include <string.h>
+#include "precompiled.h"
#include "tfdirect.h"
// Internal Prototypes
--- a/src/GameSrc/tickcount.c
+++ b/src/GameSrc/tickcount.c
@@ -17,9 +17,10 @@
*/
+#include "precompiled.h"
#include "tickcount.h"
// number of ticks since system start (1 Tick is about 1/60 second)
uint32_t TickCount(void) {return ((SDL_GetTicks() * 100) / 357); // 280 per second;
-}
\ No newline at end of file
+}
--- a/src/GameSrc/tools.c
+++ b/src/GameSrc/tools.c
@@ -29,6 +29,7 @@
#include <ctype.h>
#include <SDL.h>
+#include "precompiled.h"
#include "criterr.h"
#include "gr2ss.h"
#include "tools.h"
@@ -190,8 +191,8 @@
// Note, does no mouse code!
errtype draw_full_res_bm(Ref id, int x, int y, uchar fade_in) {FrameDesc *f;
- short *temp_pall;
- byte pal_id;
+ short *temp_pall = NULL;
+ byte pal_id = 0;
f = RefLock(id);
if (f == NULL)
@@ -470,7 +471,7 @@
uchar message_clear_on = TRUE;
-errtype message_clear_check() {+errtype message_clear_check(void) {// much as I like spews that print every frame.......
// Spew(DSRC_GAMESYS_Messages, ("%d >? %d\n",player_struct.game_time,message_clear_time));if (*tmd_ticks < message_clear_time)
@@ -686,9 +687,9 @@
char wait_count = 0;
-errtype begin_wait() {+errtype begin_wait(void) {extern LGCursor wait_cursor;
- errtype retval;
+ errtype retval = OK;
if (wait_count == 0) {uiHideMouse(NULL);
retval = uiPushGlobalCursor(&wait_cursor);
@@ -718,8 +719,8 @@
}
#endif // NOT_YET
-errtype end_wait() {- errtype retval;
+errtype end_wait(void) {+ errtype retval = OK;
wait_count--;
if (wait_count <= 0) {uiHideMouse(NULL);
--- a/src/GameSrc/trigger.c
+++ b/src/GameSrc/trigger.c
@@ -28,6 +28,7 @@
#include <stdlib.h>
#include <string.h>
+#include "precompiled.h"
#include "Prefs.h"
#include "ai.h"
@@ -122,7 +123,7 @@
#define BIT_SET(val, bit) (((val) & (1 << bit)) == (1 << bit))
#define REACTOR_BOOM_QB 0x14
-errtype do_special_reactor_hack();
+errtype do_special_reactor_hack(void);
errtype do_destroy(int victim_data);
@@ -163,7 +164,7 @@
errtype trap_bark_func(int speaker, int strnum, int color, int hud_bark);
errtype grind_trap(char type, int p1, int p2, int p3, int p4, ubyte *destroy_count_ptr, ObjID id);
-errtype do_ecology_triggers();
+errtype do_ecology_triggers(void);
#define SHODOMETER_QVAR_BASE 0x10
@@ -2028,7 +2029,7 @@
uchar trap_activate(ObjID id, uchar *use_message) {uchar retval = FALSE;
ubyte traptype;
- int comparator;
+ int comparator = 0;
int p1, p2, p3, p4;
ubyte *destroy_count_ptr;
uchar special;
@@ -2170,7 +2171,7 @@
#define REACTOR_BOOM_QB 0x14
-errtype do_special_reactor_hack() {+errtype do_special_reactor_hack(void) {ObjSpecID osid;
if (!qdata_get(REACTOR_BOOM_QB | 0x2000))
@@ -2189,7 +2190,7 @@
return (OK);
}
-errtype do_level_entry_triggers() {+errtype do_level_entry_triggers(void) {ObjSpecID osid;
uchar special;
@@ -2209,7 +2210,7 @@
return (OK);
}
-errtype do_shodan_triggers() {+errtype do_shodan_triggers(void) {ObjSpecID osid;
uchar special;
@@ -2226,7 +2227,7 @@
return (OK);
}
-errtype do_ecology_triggers() {+errtype do_ecology_triggers(void) {ObjSpecID osid, osid2;
ObjClass cl;
char counter = 0, quan;
@@ -2242,11 +2243,11 @@
quan = objTraps[osid].comparator >> 24;
cl = (ObjClass)((objTraps[osid].comparator & 0xFF0000) >> 16);
trip = objTraps[osid].comparator & 0xFFFFFF;
- osid2 = (*(ObjSpec *)objSpecHeaders[cl].data).bits.id;
+ osid2 = OSBITSID((ObjSpec *)objSpecHeaders[cl].data);
counter = 0;
while (osid2 != OBJ_SPEC_NULL) {ospec = *(ObjSpec *)(objSpecHeaders[cl].data + (osid2 * objSpecHeaders[cl].struct_size));
- if (ID2TRIP(ospec.bits.id) == trip)
+ if (ID2TRIP(OSBITSID(&ospec)) == trip)
counter++;
if (counter > quan)
osid2 = OBJ_SPEC_NULL;
--- a/src/GameSrc/view360.c
+++ b/src/GameSrc/view360.c
@@ -25,6 +25,7 @@
#include <string.h>
+#include "precompiled.h"
#include "frprotox.h"
#include "frcamera.h"
#include "frflags.h"
@@ -106,7 +107,7 @@
}
}
-void view360_restore_inventory() {+void view360_restore_inventory(void) { if (_current_loop == GAME_LOOP) {chg_set_flg(INVENTORY_UPDATE);
inv_change_fullscreen(full_game_3d);
@@ -200,7 +201,7 @@
}
}
-void view360_update_screen_mode() {+void view360_update_screen_mode(void) {view360_shutdown();
view360_init();
}
@@ -339,7 +340,7 @@
view360_render_on = view360_message_obscured = FALSE;
}
-bool view360_check() {+bool view360_check(void) {extern uchar hack_takeover;
if (hack_takeover)
return false;
--- a/src/GameSrc/viewhelp.c
+++ b/src/GameSrc/viewhelp.c
@@ -23,6 +23,7 @@
* $Date: 1994/11/20 05:36:11 $
*
*/
+#include "precompiled.h"
#include "mfdint.h"
#include "mfdext.h"
#include "mfddims.h"
--- a/src/GameSrc/vitals.c
+++ b/src/GameSrc/vitals.c
@@ -24,6 +24,7 @@
*
*/
+#include "precompiled.h"
#include "player.h"
#include "status.h"
#include "tools.h"
@@ -130,7 +131,7 @@
#define STATUS_ANGLE_SIZE 5
grs_bitmap status_arrows[NUM_STATUS_ARROWS];
-void status_vitals_init() {+void status_vitals_init(void) {// Draw the background map
// draw_res_bm(STATUS_RES_VITALSID, STATUS_VITALS_X, STATUS_VITALS_Y);
@@ -142,13 +143,13 @@
return;
}
-void status_vitals_start() {+void status_vitals_start(void) {// load in our bitmaps!
for (int i = 0; i < NUM_STATUS_ARROWS; i++)
simple_load_res_bitmap(&status_arrows[i], REF_IMG_bmStatusAngle1 + i);
}
-void status_vitals_end() {+void status_vitals_end(void) {int i;
for (i = 0; i < NUM_STATUS_ARROWS; i++)
free(status_arrows[i].bits);
--- a/src/GameSrc/vmail.c
+++ b/src/GameSrc/vmail.c
@@ -24,6 +24,7 @@
*
*/
+#include "precompiled.h"
#include "Shock.h"
#include "anim.h"
--- a/src/GameSrc/wares.c
+++ b/src/GameSrc/wares.c
@@ -26,6 +26,7 @@
#include <string.h>
+#include "precompiled.h"
#include "wares.h"
#include "hud.h"
#include "player.h"
@@ -149,7 +150,7 @@
void use_ware(int waretype, int num) {ubyte *player_wares, *player_status;
WARE *wares;
- int n, ecost;
+ int n, ecost = 0;
int ware_sfx = SFX_NONE, hnd;
// int i;
@@ -344,7 +345,7 @@
// Called from the main loop, this routine cycles through all active wares
// and sees if any need attention.
-void wares_update() {+void wares_update(void) {ubyte *player_status, *player_wares;
WARE *wares;
int i, j, n;
@@ -392,7 +393,7 @@
//
// Sets the static values for all wares.
-void wares_init() { }+void wares_init(void) { }// CALLBACKS
// =========
--- a/src/GameSrc/weapons.c
+++ b/src/GameSrc/weapons.c
@@ -28,6 +28,7 @@
#include <string.h>
+#include "precompiled.h"
#include "weapons.h"
#include "damage.h"
#include "hand.h"
@@ -1298,7 +1299,7 @@
// returns the triple of the player's currently selected weapon.
// returns -1 if no weapon is currently selected.
-int current_weapon_trip() {+int current_weapon_trip(void) {weapon_slot *ws;
int slot;
--- a/src/GameSrc/wrapper.c
+++ b/src/GameSrc/wrapper.c
@@ -25,6 +25,7 @@
#include <limits.h>
+#include "precompiled.h"
#include "newmfd.h"
#include "wrapper.h"
#include "tools.h"
@@ -355,7 +356,9 @@
case REF_STR_MousInv: return "Inverted";
case REF_STR_Seqer: return "Midi Player";
+#ifdef USE_ADLMIDI
case REF_STR_ADLMIDI: return "ADLMIDI";
+#endif
case REF_STR_NativeMI: return "Native MIDI";
#ifdef USE_FLUIDSYNTH
case REF_STR_FluidSyn: return "FluidSynth";
@@ -1066,7 +1069,7 @@
}
#pragma enable_message(202)
-void clear_obuttons() {+void clear_obuttons(void) {uiCursorStack *cs;
extern uiSlab *uiCurrentSlab;
@@ -1180,7 +1183,7 @@
extern uchar game_paused;
-uchar can_save() {+uchar can_save(void) {uchar gp = game_paused;
if (global_fullmap->cyber) {// spoof the game as not being paused so that the message won't go to the
@@ -1423,7 +1426,7 @@
#pragma enable_message(202)
#define SLIDER_OFFSET_3 0
-void soundopt_screen_init() {+void soundopt_screen_init(void) {LGRect r;
char retkey;
int i = 0;
@@ -1451,7 +1454,11 @@
#endif
standard_button_rect(&r, i, 2, 2, 5);
+#ifdef USE_ADLMIDI
multi_init(i, 'p', REF_STR_Seqer, REF_STR_ADLMIDI, ID_NULL,
+#else
+ multi_init(i, 'p', REF_STR_Seqer, REF_STR_NativeMI, ID_NULL,
+#endif
sizeof(gShockPrefs.soMidiBackend), &gShockPrefs.soMidiBackend, OPT_SEQ_Max, seqer_dealfunc, &r);
i++;
/* standard button is too narrow, so use a slider instead
--- a/src/Libraries/2D/Source/2d.h
+++ b/src/Libraries/2D/Source/2d.h
@@ -28,7 +28,7 @@
extern "C" {#endif // !defined(__cplusplus)
-#pragma pack(push,2)
+#pragma pack on // 2
typedef struct {grs_point3d normal;
@@ -39,7 +39,7 @@
extern grs_sys_info grd_info;
extern grs_drvcap *grd_cap;
extern grs_drvcap grd_mode_cap;
-extern void (**grd_driver_list[])();
+extern void (**grd_driver_list[])(void);
extern int grd_mode;
#define grd_scr_canv grd_screen_canvas
#define grd_vis_canv grd_visible_canvas
@@ -69,10 +69,10 @@
#define grd_int_clip (grd_gc.clip.i)
#define grd_fix_clip (grd_gc.clip.f)
#define grd_clip (grd_int_clip)
-extern void (**grd_pixel_table)();
-extern void (**grd_device_table)();
-extern void (**grd_canvas_table)();
-extern void (**grd_function_table)();
+extern void (**grd_pixel_table)(void);
+extern void (**grd_device_table)(void);
+extern void (**grd_canvas_table)(void);
+extern void (**grd_function_table)(void);
enum {BMT_DEVICE,
BMT_MONO,
@@ -174,7 +174,7 @@
FILL_SOLID,
GRD_FILL_TYPES
};
-typedef void (*grt_function_table[GRD_FILL_TYPES][GRD_FUNCS*REAL_BMT_TYPES])();
+typedef void (*grt_function_table[GRD_FILL_TYPES][GRD_FUNCS*REAL_BMT_TYPES])(void);
extern grt_function_table gen_function_table;
extern grt_function_table flat8_function_table;
extern grt_function_table flat8d_function_table;
@@ -223,9 +223,9 @@
#ifndef GRSTATE_H
#define GRSTATE_H
#define gr_push_state \
- ((int (*)())grd_pixel_table[PUSH_STATE])
+ ((int (*)(void))grd_pixel_table[PUSH_STATE])
#define gr_pop_state \
- ((int (*)())grd_pixel_table[POP_STATE])
+ ((int (*)(void))grd_pixel_table[POP_STATE])
#endif
extern int gr_init (void);
extern int gr_close (void);
@@ -313,7 +313,7 @@
// gri_set_fill_globals implementation is in PixFill.C
extern void gri_set_fill_globals(long *fill_type_ptr, long fill_type,
- void (***function_table_ptr)(), void (**function_table)(),
+ void (***function_table_ptr)(void), void (**function_table)(void),
grt_uline_fill **line_vector_ptr, grt_uline_fill *line_vector);
/*#pragma aux gri_set_fill_globals = \
"mov [edx],eax" \
@@ -522,10 +522,10 @@
((void (*)(fix x,fix y,fix r))grd_canvas_table[FIX_UDISK])
#define gr_fix_disk \
((int (*)(fix x,fix y,fix r))grd_canvas_table[FIX_DISK])
-#define gr_int_urod ((void (*)())grd_canvas_table[INT_UROD])
-#define gr_int_rod ((int (*)())grd_canvas_table[INT_ROD])
-#define gr_fix_urod ((void (*)()grd_canvas_table[FIX_UROD])
-#define gr_fix_rod ((int (*)())grd_canvas_table[FIX_ROD])
+#define gr_int_urod ((void (*)(void))grd_canvas_table[INT_UROD])
+#define gr_int_rod ((int (*)(void))grd_canvas_table[INT_ROD])
+#define gr_fix_urod ((void (*)(void)grd_canvas_table[FIX_UROD])
+#define gr_fix_rod ((int (*)(void))grd_canvas_table[FIX_ROD])
#define gr_ubitmap(bm,x,y) \
((void (*)(grs_bitmap *_bm,short _x,short _y)) \
grd_canvas_table[DRAW_DEVICE_UBITMAP+2*((bm)->type)])(bm,x,y)
@@ -672,7 +672,7 @@
#define gr_set_focus \
((void (*)(short x,short y))grd_device_table[GRT_SET_FOCUS])
#define gr_get_focus \
- ((void (*)())grd_device_table[GRT_GET_FOCUS])
+ ((void (*)(void))grd_device_table[GRT_GET_FOCUS])
#define gr_lit_lin_umap(bm,n,vpl) \
((void (*)(grs_bitmap *_bm,int _n,grs_vertex **_vpl)) \
grd_canvas_table[DEVICE_LIT_LIN_UMAP+2*((bm)->type)])(bm,n,vpl)
@@ -928,7 +928,7 @@
grd_canvas_table[CLUT_SCALE_DEVICE_BITMAP+2*((bm)->type)]) \
(bm,x,y,w,h,cl)
#define gr_roll_ubitmap grd_canvas_table[ROLL_UBITMAP])
-#define gr_roll_bitmap ((int (*)())grd_canvas_table[ROLL_BITMAP])
+#define gr_roll_bitmap ((int (*)(void))grd_canvas_table[ROLL_BITMAP])
#define gr_uspoly \
((void (*)(long c,int n,grs_vertex **vpl))grd_canvas_table[FIX_USPOLY])
#define gr_spoly \
@@ -1430,9 +1430,9 @@
((void (*)(short top,short bot,grs_span *sp))grd_span_table[f])(t,b,s)
extern grs_span span_list[];
extern grs_span int_span_list[];
-extern void (**grd_span_table)();
-extern void (***grd_span_table_list)();
-extern void (***grd_span_table_list_list[])();
+extern void (**grd_span_table)(void);
+extern void (***grd_span_table_list)(void);
+extern void (***grd_span_table_list_list[])(void);
extern void span_upoint (short x, short y);
extern void span_point (short x, short y);
extern void span_uhline (short x0, short y0, short x1);
@@ -1530,9 +1530,9 @@
GRPS_LIT_PER_TRANSTLUC8,
GRPS_FUNCS
};
-extern void (**grd_polyspan_table)();
-extern void (***grd_polyspan_table_list)();
-extern void (***grd_polyspan_table_list_list[])();
+extern void (**grd_polyspan_table)(void);
+extern void (***grd_polyspan_table_list)(void);
+extern void (***grd_polyspan_table_list_list[])(void);
extern void span_upoly_draw(short top, short bottom, grs_span *p, int func);
extern void span_poly_draw(short top, short bottom, grs_span *p, int func);
extern int make_poly_spans(short nverts, grs_span_vertex *vlist, int *top, int *bottom);
@@ -1592,10 +1592,10 @@
#define GR_UNPACK_RSD8_OK 0
#define GR_UNPACK_RSD8_NOBUF 1
#define GR_UNPACK_RSD8_NOTRSD 2
-uchar gr_free_blend(void);
+int gr_free_blend(void);
uchar gr_init_blend(int log_blend_levels);
typedef struct iaaiiaia{- void (*f)();
+ void (*f)(void);
struct iaaiiaia *next;
uchar flags;
} grs_func_chain;
@@ -1604,44 +1604,44 @@
extern uchar chn_flags;
#define CHN_ON 1
#define CHN_GEN 2
-extern grs_func_chain *gr_chain_add_over(int n, void (*f)());
+extern grs_func_chain *gr_chain_add_over(int n, void (*f)(void));
extern grs_func_chain *gr_chain_add_before(int n, void (*f)(void));
extern grs_func_chain *gr_chain_add_after(int n, void (*f)(void));
-extern void (*chain_rest())();
+extern void (*chain_rest())(void);
extern void gr_unchain(int n);
extern void gr_rechain(int n);
-extern void gr_unchain_all();
-extern void gr_rechain_all();
+extern void gr_unchain_all(void);
+extern void gr_rechain_all(void);
#define gr_do_chain (chain_rest())
#define gr_chaining_on() (chn_flags |= CHN_ON)
#define gr_chaining_off() (chn_flags &= ~CHN_ON)
#define gr_chaining_toggle() (chn_flags ^= CHN_ON)
#define gr_generic (chn_flags & CHN_GEN)
-extern void gr_force_generic();
-extern void gr_unforce_generic();
+extern void gr_force_generic(void);
+extern void gr_unforce_generic(void);
#define gr_toggle_generic() (gr_generic? gr_unforce_generic() : gr_force_generic())
-#define gr_start_frame ((void (*)())grd_canvas_table[START_FRAME])
-#define gr_end_frame ((void (*)())grd_canvas_table[END_FRAME])
+#define gr_start_frame ((void (*)(void))grd_canvas_table[START_FRAME])
+#define gr_end_frame ((void (*)(void))grd_canvas_table[END_FRAME])
#define MAX_PPROF_OBJ_CNT (1<<12)
extern unsigned short *pixprof_screen;
-extern uchar pixprof_setup();
-extern void pixprof_report();
+extern uchar pixprof_setup(void);
+extern void pixprof_report(void);
#define install_pixprof_report() (gr_chain_add_before(END_FRAME, &pixprof_report))
#define pixprof_on() (gr_chaining_on(), gr_force_generic())
#define pixprof_off() (gr_chaining_off(), gr_unforce_generic())
#define pixprof_toggle() (gr_chaining_toggle(), gr_toggle_generic())
-extern void start_thing_prof();
-extern void end_thing_prof();
+extern void start_thing_prof(void);
+extern void end_thing_prof(void);
extern unsigned short pixprof_objects;
extern char *fcount_names[GRD_CANVAS_FUNCS];
extern int *fcount_table;
-extern void fcount_increment();
-extern void fcount_start();
-extern void fcount_stop();
-extern void fcount_report();
-extern void fcount_install();
+extern void fcount_increment(void);
+extern void fcount_start(void);
+extern void fcount_stop(void);
+extern void fcount_report(void);
+extern void fcount_install(void);
-#pragma pack(pop)
+#pragma pack off
#if defined(__cplusplus)
}
--- a/src/Libraries/2D/Source/Flat8/FL8OPL.c
+++ b/src/Libraries/2D/Source/Flat8/FL8OPL.c
@@ -272,11 +272,11 @@
extern void gri_per_umap_vscan(grs_bitmap *bm, int n, grs_vertex **vpl, grs_per_setup *ps);
void gri_opaque_per_umap_hscan_init(grs_bitmap *bm, grs_per_setup *ps) {- ps->shell_func = (void (*)())gri_per_umap_hscan;
- ps->scanline_func = (void (*)())gri_opaque_per_umap_hscan_scanline;
+ ps->shell_func = (void (*)(void))gri_per_umap_hscan;
+ ps->scanline_func = (void (*)(void))gri_opaque_per_umap_hscan_scanline;
}
void gri_opaque_per_umap_vscan_init(grs_bitmap *bm, grs_per_setup *ps) {- ps->shell_func = (void (*)())gri_per_umap_vscan;
- ps->scanline_func = (void (*)())gri_opaque_per_umap_vscan_scanline;
+ ps->shell_func = (void (*)(void))gri_per_umap_vscan;
+ ps->scanline_func = (void (*)(void))gri_opaque_per_umap_vscan_scanline;
}
--- a/src/Libraries/2D/Source/Flat8/Fl8F.c
+++ b/src/Libraries/2D/Source/Flat8/Fl8F.c
@@ -235,9 +235,9 @@
tli->vtab = gr_make_vtab(&(tli->bm));
tli->bm.hlog = GRL_TRANS;
}
- tli->loop_func = (void (*)())gri_floor_umap_loop;
- tli->left_edge_func = (void (*)())gri_uvwx_edge;
- tli->right_edge_func = (void (*)())gri_uvwx_edge;
+ tli->loop_func = (void (*)(void))gri_floor_umap_loop;
+ tli->left_edge_func = (void (*)(void))gri_uvwx_edge;
+ tli->right_edge_func = (void (*)(void))gri_uvwx_edge;
}
void gri_opaque_floor_umap_init(grs_tmap_loop_info *tli) {@@ -248,9 +248,9 @@
tli->vtab = gr_make_vtab(&(tli->bm));
tli->bm.hlog = GRL_OPAQUE;
}
- tli->loop_func = (void (*)())gri_floor_umap_loop;
- tli->left_edge_func = (void (*)())gri_uvwx_edge;
- tli->right_edge_func = (void (*)())gri_uvwx_edge;
+ tli->loop_func = (void (*)(void))gri_floor_umap_loop;
+ tli->left_edge_func = (void (*)(void))gri_uvwx_edge;
+ tli->right_edge_func = (void (*)(void))gri_uvwx_edge;
}
void gri_trans_clut_floor_umap_init(grs_tmap_loop_info *tli) {@@ -261,9 +261,9 @@
tli->vtab = gr_make_vtab(&(tli->bm));
tli->bm.hlog = GRL_TRANS | GRL_CLUT;
}
- tli->loop_func = (void (*)())gri_floor_umap_loop;
- tli->left_edge_func = (void (*)())gri_uvwx_edge;
- tli->right_edge_func = (void (*)())gri_uvwx_edge;
+ tli->loop_func = (void (*)(void))gri_floor_umap_loop;
+ tli->left_edge_func = (void (*)(void))gri_uvwx_edge;
+ tli->right_edge_func = (void (*)(void))gri_uvwx_edge;
}
void gri_opaque_clut_floor_umap_init(grs_tmap_loop_info *tli) {@@ -274,7 +274,7 @@
tli->vtab = gr_make_vtab(&(tli->bm));
tli->bm.hlog = GRL_OPAQUE | GRL_CLUT;
}
- tli->loop_func = (void (*)())gri_floor_umap_loop;
- tli->left_edge_func = (void (*)())gri_uvwx_edge;
- tli->right_edge_func = (void (*)())gri_uvwx_edge;
+ tli->loop_func = (void (*)(void))gri_floor_umap_loop;
+ tli->left_edge_func = (void (*)(void))gri_uvwx_edge;
+ tli->right_edge_func = (void (*)(void))gri_uvwx_edge;
}
--- a/src/Libraries/2D/Source/Flat8/fl8clear.c
+++ b/src/Libraries/2D/Source/Flat8/fl8clear.c
@@ -50,7 +50,7 @@
int row;
ushort short_val;
double double_stack, doub_vl;
- uint firstbytes, middoubles, lastbytes, fb, md, lb;
+ uint firstbytes = 0, middoubles, lastbytes, fb, md, lb;
uchar *dst;
double *dst_doub;
uint temp;
--- a/src/Libraries/2D/Source/Flat8/fl8cnv.c
+++ b/src/Libraries/2D/Source/Flat8/fl8cnv.c
@@ -32,9 +32,9 @@
#include "grnull.h"
#include "icanvas.h"
-typedef void (*ptr_type)();
+typedef void (*ptr_type)(void);
-void (*flat8_canvas_table[GRD_CANVAS_FUNCS])() = {+void (*flat8_canvas_table[GRD_CANVAS_FUNCS])(void) = {(ptr_type)flat8_set_upixel, /* 8-bit pixel set/get */
(ptr_type)gen_set_pixel,
(ptr_type)flat8_get_upixel,
--- a/src/Libraries/2D/Source/Flat8/fl8cop.c
+++ b/src/Libraries/2D/Source/Flat8/fl8cop.c
@@ -288,11 +288,11 @@
extern void gri_per_umap_vscan(grs_bitmap *bm, int n, grs_vertex **vpl, grs_per_setup *ps);
void gri_opaque_clut_per_umap_hscan_init(grs_bitmap *bm, grs_per_setup *ps) {- ps->shell_func = (void (*)())gri_per_umap_hscan;
- ps->scanline_func = (void (*)())gri_opaque_clut_per_umap_hscan_scanline;
+ ps->shell_func = (void (*)(void))gri_per_umap_hscan;
+ ps->scanline_func = (void (*)(void))gri_opaque_clut_per_umap_hscan_scanline;
}
void gri_opaque_clut_per_umap_vscan_init(grs_bitmap *bm, grs_per_setup *ps) {- ps->shell_func = (void (*)())gri_per_umap_vscan;
- ps->scanline_func = (void (*)())gri_opaque_clut_per_umap_vscan_scanline;
+ ps->shell_func = (void (*)(void))gri_per_umap_vscan;
+ ps->scanline_func = (void (*)(void))gri_opaque_clut_per_umap_vscan_scanline;
}
--- a/src/Libraries/2D/Source/Flat8/fl8cply.c
+++ b/src/Libraries/2D/Source/Flat8/fl8cply.c
@@ -98,15 +98,15 @@
void gri_cpoly_init(grs_tmap_loop_info *ti) {ti->bm.hlog = GRL_OPAQUE;
ti->d = ti->y * grd_bm.row + grd_bm.bits;
- ti->loop_func = (void (*)())gri_cpoly_loop;
- ti->top_edge_func = (void (*)())gri_rgbx_edge;
- ti->bot_edge_func = (void (*)())gri_rgbx_edge;
+ ti->loop_func = (void (*)(void))gri_cpoly_loop;
+ ti->top_edge_func = (void (*)(void))gri_rgbx_edge;
+ ti->bot_edge_func = (void (*)(void))gri_rgbx_edge;
}
void gri_clut_cpoly_init(grs_tmap_loop_info *ti) {ti->bm.hlog = GRL_CLUT;
ti->d = ti->y * grd_bm.row + grd_bm.bits;
- ti->loop_func = (void (*)())gri_cpoly_loop;
- ti->top_edge_func = (void (*)())gri_rgbx_edge;
- ti->bot_edge_func = (void (*)())gri_rgbx_edge;
+ ti->loop_func = (void (*)(void))gri_cpoly_loop;
+ ti->top_edge_func = (void (*)(void))gri_rgbx_edge;
+ ti->bot_edge_func = (void (*)(void))gri_rgbx_edge;
}
--- a/src/Libraries/2D/Source/Flat8/fl8ctp.c
+++ b/src/Libraries/2D/Source/Flat8/fl8ctp.c
@@ -302,11 +302,11 @@
extern void gri_per_umap_vscan(grs_bitmap *bm, int n, grs_vertex **vpl, grs_per_setup *ps);
void gri_trans_clut_per_umap_hscan_init(grs_bitmap *bm, grs_per_setup *ps) {- ps->shell_func = (void (*)())gri_per_umap_hscan;
- ps->scanline_func = (void (*)())gri_trans_clut_per_umap_hscan_scanline;
+ ps->shell_func = (void (*)(void))gri_per_umap_hscan;
+ ps->scanline_func = (void (*)(void))gri_trans_clut_per_umap_hscan_scanline;
}
void gri_trans_clut_per_umap_vscan_init(grs_bitmap *bm, grs_per_setup *ps) {- ps->shell_func = (void (*)())gri_per_umap_vscan;
- ps->scanline_func = (void (*)())gri_trans_clut_per_umap_vscan_scanline;
+ ps->shell_func = (void (*)(void))gri_per_umap_vscan;
+ ps->scanline_func = (void (*)(void))gri_trans_clut_per_umap_vscan_scanline;
}
--- a/src/Libraries/2D/Source/Flat8/fl8ft.c
+++ b/src/Libraries/2D/Source/Flat8/fl8ft.c
@@ -35,9 +35,9 @@
#include "grnull.h"
#include "ifcn.h"
-typedef void (*ptr_type)();
+typedef void (*ptr_type)(void);
-void (*flat8_function_table[GRD_FILL_TYPES][GRD_FUNCS * REAL_BMT_TYPES])() = {+void (*flat8_function_table[GRD_FILL_TYPES][GRD_FUNCS * REAL_BMT_TYPES])(void) = { {/* normal fill type - from fl8nft.h *//* FILL_NORM */
/* BMT_DEVICE */
--- a/src/Libraries/2D/Source/Flat8/fl8lf.c
+++ b/src/Libraries/2D/Source/Flat8/fl8lf.c
@@ -181,9 +181,9 @@
tli->vtab = gr_make_vtab(&(tli->bm));
tli->bm.hlog = GRL_TRANS;
}
- tli->loop_func = (void (*)())gri_lit_floor_umap_loop;
- tli->left_edge_func = (void (*)())gri_uviwx_edge;
- tli->right_edge_func = (void (*)())gri_uviwx_edge;
+ tli->loop_func = (void (*)(void))gri_lit_floor_umap_loop;
+ tli->left_edge_func = (void (*)(void))gri_uviwx_edge;
+ tli->right_edge_func = (void (*)(void))gri_uviwx_edge;
}
void gri_opaque_lit_floor_umap_init(grs_tmap_loop_info *tli) {@@ -194,7 +194,7 @@
tli->vtab = gr_make_vtab(&(tli->bm));
tli->bm.hlog = GRL_OPAQUE;
}
- tli->loop_func = (void (*)())gri_lit_floor_umap_loop;
- tli->left_edge_func = (void (*)())gri_uviwx_edge;
- tli->right_edge_func = (void (*)())gri_uviwx_edge;
+ tli->loop_func = (void (*)(void))gri_lit_floor_umap_loop;
+ tli->left_edge_func = (void (*)(void))gri_uviwx_edge;
+ tli->right_edge_func = (void (*)(void))gri_uviwx_edge;
}
--- a/src/Libraries/2D/Source/Flat8/fl8ll.c
+++ b/src/Libraries/2D/Source/Flat8/fl8ll.c
@@ -313,9 +313,9 @@
tli->vtab = gr_make_vtab(&(tli->bm));
tli->bm.hlog = GRL_TRANS;
}
- tli->loop_func = (void (*)())gri_lit_lin_umap_loop;
- tli->right_edge_func = (void (*)())gri_uvix_edge;
- tli->left_edge_func = (void (*)())gri_uvix_edge;
+ tli->loop_func = (void (*)(void))gri_lit_lin_umap_loop;
+ tli->right_edge_func = (void (*)(void))gri_uvix_edge;
+ tli->left_edge_func = (void (*)(void))gri_uvix_edge;
}
void gri_opaque_lit_lin_umap_init(grs_tmap_loop_info *tli) {@@ -327,7 +327,7 @@
tli->bm.hlog = GRL_OPAQUE;
}
- tli->loop_func = (void (*)())gri_lit_lin_umap_loop;
- tli->right_edge_func = (void (*)())gri_uvix_edge;
- tli->left_edge_func = (void (*)())gri_uvix_edge;
+ tli->loop_func = (void (*)(void))gri_lit_lin_umap_loop;
+ tli->right_edge_func = (void (*)(void))gri_uvix_edge;
+ tli->left_edge_func = (void (*)(void))gri_uvix_edge;
}
--- a/src/Libraries/2D/Source/Flat8/fl8lnop.c
+++ b/src/Libraries/2D/Source/Flat8/fl8lnop.c
@@ -255,9 +255,9 @@
tli->vtab = gr_make_vtab(&(tli->bm));
tli->bm.hlog = GRL_TRANS;
}
- tli->loop_func = (void (*)())gri_lin_umap_loop;
- tli->right_edge_func = (void (*)())gri_uvx_edge;
- tli->left_edge_func = (void (*)())gri_uvx_edge;
+ tli->loop_func = (void (*)(void))gri_lin_umap_loop;
+ tli->right_edge_func = (void (*)(void))gri_uvx_edge;
+ tli->left_edge_func = (void (*)(void))gri_uvx_edge;
}
void gri_opaque_lin_umap_init(grs_tmap_loop_info *tli) {@@ -268,9 +268,9 @@
tli->vtab = gr_make_vtab(&(tli->bm));
tli->bm.hlog = GRL_OPAQUE;
}
- tli->loop_func = (void (*)())gri_lin_umap_loop;
- tli->right_edge_func = (void (*)())gri_uvx_edge;
- tli->left_edge_func = (void (*)())gri_uvx_edge;
+ tli->loop_func = (void (*)(void))gri_lin_umap_loop;
+ tli->right_edge_func = (void (*)(void))gri_uvx_edge;
+ tli->left_edge_func = (void (*)(void))gri_uvx_edge;
}
void gri_trans_clut_lin_umap_init(grs_tmap_loop_info *tli) {@@ -281,9 +281,9 @@
tli->vtab = gr_make_vtab(&(tli->bm));
tli->bm.hlog = GRL_TRANS | GRL_CLUT;
}
- tli->loop_func = (void (*)())gri_lin_umap_loop;
- tli->right_edge_func = (void (*)())gri_uvx_edge;
- tli->left_edge_func = (void (*)())gri_uvx_edge;
+ tli->loop_func = (void (*)(void))gri_lin_umap_loop;
+ tli->right_edge_func = (void (*)(void))gri_uvx_edge;
+ tli->left_edge_func = (void (*)(void))gri_uvx_edge;
}
void gri_opaque_clut_lin_umap_init(grs_tmap_loop_info *tli) {@@ -294,7 +294,7 @@
tli->vtab = gr_make_vtab(&(tli->bm));
tli->bm.hlog = GRL_OPAQUE | GRL_CLUT;
}
- tli->loop_func = (void (*)())gri_lin_umap_loop;
- tli->right_edge_func = (void (*)())gri_uvx_edge;
- tli->left_edge_func = (void (*)())gri_uvx_edge;
+ tli->loop_func = (void (*)(void))gri_lin_umap_loop;
+ tli->right_edge_func = (void (*)(void))gri_uvx_edge;
+ tli->left_edge_func = (void (*)(void))gri_uvx_edge;
}
--- a/src/Libraries/2D/Source/Flat8/fl8lop.c
+++ b/src/Libraries/2D/Source/Flat8/fl8lop.c
@@ -369,11 +369,11 @@
extern void gri_lit_per_umap_vscan(grs_bitmap *bm, int n, grs_vertex **vpl, grs_per_setup *ps);
void gri_opaque_lit_per_umap_hscan_init(grs_bitmap *bm, grs_per_setup *ps) {- ps->shell_func = (void (*)())gri_lit_per_umap_hscan;
- ps->scanline_func = (void (*)())gri_opaque_lit_per_umap_hscan_scanline;
+ ps->shell_func = (void (*)(void))gri_lit_per_umap_hscan;
+ ps->scanline_func = (void (*)(void))gri_opaque_lit_per_umap_hscan_scanline;
}
void gri_opaque_lit_per_umap_vscan_init(grs_bitmap *bm, grs_per_setup *ps) {- ps->shell_func = (void (*)())gri_lit_per_umap_vscan;
- ps->scanline_func = (void (*)())gri_opaque_lit_per_umap_vscan_scanline;
+ ps->shell_func = (void (*)(void))gri_lit_per_umap_vscan;
+ ps->scanline_func = (void (*)(void))gri_opaque_lit_per_umap_vscan_scanline;
}
--- a/src/Libraries/2D/Source/Flat8/fl8ltp.c
+++ b/src/Libraries/2D/Source/Flat8/fl8ltp.c
@@ -319,11 +319,11 @@
extern void gri_lit_per_umap_vscan(grs_bitmap *bm, int n, grs_vertex **vpl, grs_per_setup *ps);
void gri_trans_lit_per_umap_hscan_init(grs_bitmap *bm, grs_per_setup *ps) {- ps->shell_func = (void (*)())gri_lit_per_umap_hscan;
- ps->scanline_func = (void (*)())gri_trans_lit_per_umap_hscan_scanline;
+ ps->shell_func = (void (*)(void))gri_lit_per_umap_hscan;
+ ps->scanline_func = (void (*)(void))gri_trans_lit_per_umap_hscan_scanline;
}
void gri_trans_lit_per_umap_vscan_init(grs_bitmap *bm, grs_per_setup *ps) {- ps->shell_func = (void (*)())gri_lit_per_umap_vscan;
- ps->scanline_func = (void (*)())gri_trans_lit_per_umap_vscan_scanline;
+ ps->shell_func = (void (*)(void))gri_lit_per_umap_vscan;
+ ps->scanline_func = (void (*)(void))gri_trans_lit_per_umap_vscan_scanline;
}
--- a/src/Libraries/2D/Source/Flat8/fl8lw.c
+++ b/src/Libraries/2D/Source/Flat8/fl8lw.c
@@ -215,9 +215,9 @@
tli->vtab = gr_make_vtab(&(tli->bm));
tli->bm.hlog = GRL_TRANS;
}
- tli->loop_func = (void (*)())gri_lit_wall_umap_loop;
- tli->left_edge_func = (void (*)())gri_uviwy_edge;
- tli->right_edge_func = (void (*)())gri_uviwy_edge;
+ tli->loop_func = (void (*)(void))gri_lit_wall_umap_loop;
+ tli->left_edge_func = (void (*)(void))gri_uviwy_edge;
+ tli->right_edge_func = (void (*)(void))gri_uviwy_edge;
}
void gri_opaque_lit_wall_umap_init(grs_tmap_loop_info *tli) {@@ -228,9 +228,9 @@
tli->vtab = gr_make_vtab(&(tli->bm));
tli->bm.hlog = GRL_OPAQUE;
}
- tli->loop_func = (void (*)())gri_lit_wall_umap_loop;
- tli->left_edge_func = (void (*)())gri_uviwy_edge;
- tli->right_edge_func = (void (*)())gri_uviwy_edge;
+ tli->loop_func = (void (*)(void))gri_lit_wall_umap_loop;
+ tli->left_edge_func = (void (*)(void))gri_uviwy_edge;
+ tli->right_edge_func = (void (*)(void))gri_uviwy_edge;
}
/*extern "C"
@@ -375,7 +375,7 @@
tli->vtab=gr_make_vtab(&(tli->bm));
tli->bm.hlog=GRL_OPAQUE;
}*/
- tli->loop_func = (void (*)())gri_lit_wall_umap_loop_1D;
- tli->left_edge_func = (void (*)())gri_uviwy_edge;
- tli->right_edge_func = (void (*)())gri_uviwy_edge;
+ tli->loop_func = (void (*)(void))gri_lit_wall_umap_loop_1D;
+ tli->left_edge_func = (void (*)(void))gri_uviwy_edge;
+ tli->right_edge_func = (void (*)(void))gri_uviwy_edge;
}
--- a/src/Libraries/2D/Source/Flat8/fl8nl.c
+++ b/src/Libraries/2D/Source/Flat8/fl8nl.c
@@ -189,9 +189,9 @@
tli->bm.hlog = GRL_TRANS;
}
tli->d = grd_bm.bits + grd_bm.row * tli->y;
- tli->loop_func = (void (*)())gri_tluc8_lin_umap_loop;
- tli->right_edge_func = (void (*)())gri_uvx_edge;
- tli->left_edge_func = (void (*)())gri_uvx_edge;
+ tli->loop_func = (void (*)(void))gri_tluc8_lin_umap_loop;
+ tli->right_edge_func = (void (*)(void))gri_uvx_edge;
+ tli->left_edge_func = (void (*)(void))gri_uvx_edge;
}
void gri_tluc8_opaque_lin_umap_init(grs_tmap_loop_info *tli) {@@ -203,9 +203,9 @@
tli->bm.hlog = GRL_OPAQUE;
}
tli->d = grd_bm.bits + grd_bm.row * tli->y;
- tli->loop_func = (void (*)())gri_tluc8_lin_umap_loop;
- tli->right_edge_func = (void (*)())gri_uvx_edge;
- tli->left_edge_func = (void (*)())gri_uvx_edge;
+ tli->loop_func = (void (*)(void))gri_tluc8_lin_umap_loop;
+ tli->right_edge_func = (void (*)(void))gri_uvx_edge;
+ tli->left_edge_func = (void (*)(void))gri_uvx_edge;
}
void gri_tluc8_trans_clut_lin_umap_init(grs_tmap_loop_info *tli) {@@ -217,9 +217,9 @@
tli->bm.hlog = GRL_TRANS | GRL_CLUT;
}
tli->d = grd_bm.bits + grd_bm.row * tli->y;
- tli->loop_func = (void (*)())gri_tluc8_lin_umap_loop;
- tli->right_edge_func = (void (*)())gri_uvx_edge;
- tli->left_edge_func = (void (*)())gri_uvx_edge;
+ tli->loop_func = (void (*)(void))gri_tluc8_lin_umap_loop;
+ tli->right_edge_func = (void (*)(void))gri_uvx_edge;
+ tli->left_edge_func = (void (*)(void))gri_uvx_edge;
}
void gri_tluc8_opaque_clut_lin_umap_init(grs_tmap_loop_info *tli) {@@ -231,7 +231,7 @@
tli->bm.hlog = GRL_OPAQUE | GRL_CLUT;
}
tli->d = grd_bm.bits + grd_bm.row * tli->y;
- tli->loop_func = (void (*)())gri_tluc8_lin_umap_loop;
- tli->right_edge_func = (void (*)())gri_uvx_edge;
- tli->left_edge_func = (void (*)())gri_uvx_edge;
+ tli->loop_func = (void (*)(void))gri_tluc8_lin_umap_loop;
+ tli->right_edge_func = (void (*)(void))gri_uvx_edge;
+ tli->left_edge_func = (void (*)(void))gri_uvx_edge;
}
--- a/src/Libraries/2D/Source/Flat8/fl8ns.c
+++ b/src/Libraries/2D/Source/Flat8/fl8ns.c
@@ -109,31 +109,31 @@
void gri_tluc8_trans_scale_umap_init(grs_tmap_loop_info *tli) {tli->bm.hlog = GRL_TRANS;
tli->d = grd_bm.bits + grd_bm.row * tli->y;
- tli->loop_func = (void (*)())gri_tluc8_scale_umap_loop;
+ tli->loop_func = (void (*)(void))gri_tluc8_scale_umap_loop;
tli->right_edge_func = gr_null;
- tli->left_edge_func = (void (*)())gri_scale_edge;
+ tli->left_edge_func = (void (*)(void))gri_scale_edge;
}
void gri_tluc8_opaque_scale_umap_init(grs_tmap_loop_info *tli) {tli->bm.hlog = GRL_OPAQUE;
tli->d = grd_bm.bits + grd_bm.row * tli->y;
- tli->loop_func = (void (*)())gri_tluc8_scale_umap_loop;
+ tli->loop_func = (void (*)(void))gri_tluc8_scale_umap_loop;
tli->right_edge_func = gr_null;
- tli->left_edge_func = (void (*)())gri_scale_edge;
+ tli->left_edge_func = (void (*)(void))gri_scale_edge;
}
void gri_tluc8_trans_clut_scale_umap_init(grs_tmap_loop_info *tli) {tli->bm.hlog = GRL_TRANS | GRL_CLUT;
tli->d = grd_bm.bits + grd_bm.row * tli->y;
- tli->loop_func = (void (*)())gri_tluc8_scale_umap_loop;
+ tli->loop_func = (void (*)(void))gri_tluc8_scale_umap_loop;
tli->right_edge_func = gr_null;
- tli->left_edge_func = (void (*)())gri_scale_edge;
+ tli->left_edge_func = (void (*)(void))gri_scale_edge;
}
void gri_tluc8_opaque_clut_scale_umap_init(grs_tmap_loop_info *tli) {tli->bm.hlog = GRL_OPAQUE | GRL_CLUT;
tli->d = grd_bm.bits + grd_bm.row * tli->y;
- tli->loop_func = (void (*)())gri_tluc8_scale_umap_loop;
+ tli->loop_func = (void (*)(void))gri_tluc8_scale_umap_loop;
tli->right_edge_func = gr_null;
- tli->left_edge_func = (void (*)())gri_scale_edge;
+ tli->left_edge_func = (void (*)(void))gri_scale_edge;
}
--- a/src/Libraries/2D/Source/Flat8/fl8ply.c
+++ b/src/Libraries/2D/Source/Flat8/fl8ply.c
@@ -93,17 +93,17 @@
ti->bm.bits = ti->clut; /* set fill_parm */
ti->bm.hlog = GRL_OPAQUE;
ti->d = ti->y * grd_bm.row + grd_bm.bits;
- ti->loop_func = (void (*)())gri_poly_loop;
- ti->top_edge_func = (void (*)())gri_x_edge;
- ti->bot_edge_func = (void (*)())gri_x_edge;
+ ti->loop_func = (void (*)(void))gri_poly_loop;
+ ti->top_edge_func = (void (*)(void))gri_x_edge;
+ ti->bot_edge_func = (void (*)(void))gri_x_edge;
}
void gri_poly_init(grs_tmap_loop_info *ti) {ti->bm.hlog = GRL_OPAQUE;
ti->d = ti->y * grd_bm.row + grd_bm.bits;
- ti->loop_func = (void (*)())gri_poly_loop;
- ti->top_edge_func = (void (*)())gri_x_edge;
- ti->bot_edge_func = (void (*)())gri_x_edge;
+ ti->loop_func = (void (*)(void))gri_poly_loop;
+ ti->top_edge_func = (void (*)(void))gri_x_edge;
+ ti->bot_edge_func = (void (*)(void))gri_x_edge;
}
void gri_clut_poly_init(grs_tmap_loop_info *ti) {@@ -110,9 +110,9 @@
ti->bm.bits = (uchar *)(intptr_t)ti->clut[(intptr_t)ti->bm.bits];
ti->bm.hlog = GRL_OPAQUE;
ti->d = ti->y * grd_bm.row + grd_bm.bits;
- ti->loop_func = (void (*)())gri_poly_loop;
- ti->top_edge_func = (void (*)())gri_x_edge;
- ti->bot_edge_func = (void (*)())gri_x_edge;
+ ti->loop_func = (void (*)(void))gri_poly_loop;
+ ti->top_edge_func = (void (*)(void))gri_x_edge;
+ ti->bot_edge_func = (void (*)(void))gri_x_edge;
}
void gri_tpoly_init(grs_tmap_loop_info *ti) {@@ -123,9 +123,9 @@
ti->bm.hlog = GRL_OPAQUE;
}
ti->d = ti->y * grd_bm.row + grd_bm.bits;
- ti->loop_func = (void (*)())gri_poly_loop;
- ti->top_edge_func = (void (*)())gri_x_edge;
- ti->bot_edge_func = (void (*)())gri_x_edge;
+ ti->loop_func = (void (*)(void))gri_poly_loop;
+ ti->top_edge_func = (void (*)(void))gri_x_edge;
+ ti->bot_edge_func = (void (*)(void))gri_x_edge;
}
void gri_clut_tpoly_init(grs_tmap_loop_info *ti) {@@ -138,7 +138,7 @@
ti->bm.hlog = GRL_OPAQUE;
}
ti->d = ti->y * grd_bm.row + grd_bm.bits;
- ti->loop_func = (void (*)())gri_poly_loop;
- ti->top_edge_func = (void (*)())gri_x_edge;
- ti->bot_edge_func = (void (*)())gri_x_edge;
+ ti->loop_func = (void (*)(void))gri_poly_loop;
+ ti->top_edge_func = (void (*)(void))gri_x_edge;
+ ti->bot_edge_func = (void (*)(void))gri_x_edge;
}
--- a/src/Libraries/2D/Source/Flat8/fl8s.c
+++ b/src/Libraries/2D/Source/Flat8/fl8s.c
@@ -63,13 +63,13 @@
// ========================================================================
// opaque solid polygon scaler
int gri_opaque_solid_scale_umap_init(grs_tmap_loop_info *info, grs_vertex **vert) {- info->left_edge_func = (void (*)())gri_scale_edge;
- info->right_edge_func = (void (*)())gr_null;
+ info->left_edge_func = (void (*)(void))gri_scale_edge;
+ info->right_edge_func = (void (*)(void))gr_null;
info->bm.hlog = 0;
info->bm.bits = info->clut;
- info->loop_func = (void (*)())gri_poly_loop;
+ info->loop_func = (void (*)(void))gri_poly_loop;
info->d = ((uchar *)((long)grd_canvas->bm.row * (long)info->y));
- info->d += (long)grd_canvas->bm.bits;
+ info->d += (intptr_t)grd_canvas->bm.bits;
return (0);
}
@@ -80,9 +80,9 @@
// transparent solid polygon scaler
int gri_trans_solid_scale_umap_init(grs_tmap_loop_info *tli, grs_vertex **vert) {tli->bm.hlog = GRL_TRANS | GRL_SOLID;
- tli->loop_func = (void (*)())gri_scale_umap_loop_PPC;
+ tli->loop_func = (void (*)(void))gri_scale_umap_loop_PPC;
tli->right_edge_func = gr_null;
- tli->left_edge_func = (void (*)())gri_scale_edge;
+ tli->left_edge_func = (void (*)(void))gri_scale_edge;
return (0);
}
@@ -90,9 +90,9 @@
// transparent bitmap scaler
int gri_trans_scale_umap_init(grs_tmap_loop_info *tli, grs_vertex **vert) {tli->bm.hlog = GRL_TRANS;
- tli->loop_func = (void (*)())gri_scale_umap_loop_PPC;
+ tli->loop_func = (void (*)(void))gri_scale_umap_loop_PPC;
tli->right_edge_func = gr_null;
- tli->left_edge_func = (void (*)())gri_scale_edge;
+ tli->left_edge_func = (void (*)(void))gri_scale_edge;
return (0);
}
@@ -100,9 +100,9 @@
// opaque bitmap scaler
int gri_opaque_scale_umap_init(grs_tmap_loop_info *tli) {tli->bm.hlog = GRL_OPAQUE;
- tli->loop_func = (void (*)())gri_scale_umap_loop_PPC;
+ tli->loop_func = (void (*)(void))gri_scale_umap_loop_PPC;
tli->right_edge_func = gr_null;
- tli->left_edge_func = (void (*)())gri_scale_edge;
+ tli->left_edge_func = (void (*)(void))gri_scale_edge;
return (0);
}
@@ -110,9 +110,9 @@
// transparent clut bitmap scaler
int gri_trans_clut_scale_umap_init(grs_tmap_loop_info *tli) {tli->bm.hlog = GRL_TRANS | GRL_CLUT;
- tli->loop_func = (void (*)())gri_scale_umap_loop_PPC;
+ tli->loop_func = (void (*)(void))gri_scale_umap_loop_PPC;
tli->right_edge_func = gr_null;
- tli->left_edge_func = (void (*)())gri_scale_edge;
+ tli->left_edge_func = (void (*)(void))gri_scale_edge;
return (0);
}
@@ -120,9 +120,9 @@
// opaque clut bitmap scaler
int gri_opaque_clut_scale_umap_init(grs_tmap_loop_info *tli) {tli->bm.hlog = GRL_OPAQUE | GRL_CLUT;
- tli->loop_func = (void (*)())gri_scale_umap_loop_PPC;
+ tli->loop_func = (void (*)(void))gri_scale_umap_loop_PPC;
tli->right_edge_func = gr_null;
- tli->left_edge_func = (void (*)())gri_scale_edge;
+ tli->left_edge_func = (void (*)(void))gri_scale_edge;
return (0);
}
--- a/src/Libraries/2D/Source/Flat8/fl8sply.c
+++ b/src/Libraries/2D/Source/Flat8/fl8sply.c
@@ -109,17 +109,17 @@
void gri_spoly_init(grs_tmap_loop_info *ti) {ti->bm.hlog = GRL_OPAQUE;
ti->d = ti->y * grd_bm.row + grd_bm.bits;
- ti->loop_func = (void (*)())gri_spoly_loop;
- ti->top_edge_func = (void (*)())gri_ix_edge;
- ti->bot_edge_func = (void (*)())gri_ix_edge;
+ ti->loop_func = (void (*)(void))gri_spoly_loop;
+ ti->top_edge_func = (void (*)(void))gri_ix_edge;
+ ti->bot_edge_func = (void (*)(void))gri_ix_edge;
}
void gri_clut_spoly_init(grs_tmap_loop_info *ti) {ti->bm.hlog = GRL_CLUT;
ti->d = ti->y * grd_bm.row + grd_bm.bits;
- ti->loop_func = (void (*)())gri_spoly_loop;
- ti->top_edge_func = (void (*)())gri_ix_edge;
- ti->bot_edge_func = (void (*)())gri_ix_edge;
+ ti->loop_func = (void (*)(void))gri_spoly_loop;
+ ti->top_edge_func = (void (*)(void))gri_ix_edge;
+ ti->bot_edge_func = (void (*)(void))gri_ix_edge;
}
void gri_stpoly_init(grs_tmap_loop_info *ti) {@@ -128,9 +128,9 @@
else
ti->bm.hlog = GRL_OPAQUE;
ti->d = ti->y * grd_bm.row + grd_bm.bits;
- ti->loop_func = (void (*)())gri_spoly_loop;
- ti->top_edge_func = (void (*)())gri_ix_edge;
- ti->bot_edge_func = (void (*)())gri_ix_edge;
+ ti->loop_func = (void (*)(void))gri_spoly_loop;
+ ti->top_edge_func = (void (*)(void))gri_ix_edge;
+ ti->bot_edge_func = (void (*)(void))gri_ix_edge;
}
void gri_clut_stpoly_init(grs_tmap_loop_info *ti) {@@ -139,7 +139,7 @@
else
ti->bm.hlog = GRL_CLUT;
ti->d = ti->y * grd_bm.row + grd_bm.bits;
- ti->loop_func = (void (*)())gri_spoly_loop;
- ti->top_edge_func = (void (*)())gri_ix_edge;
- ti->bot_edge_func = (void (*)())gri_ix_edge;
+ ti->loop_func = (void (*)(void))gri_spoly_loop;
+ ti->top_edge_func = (void (*)(void))gri_ix_edge;
+ ti->bot_edge_func = (void (*)(void))gri_ix_edge;
}
--- a/src/Libraries/2D/Source/Flat8/fl8tf.h
+++ b/src/Libraries/2D/Source/Flat8/fl8tf.h
@@ -53,8 +53,8 @@
/* inner loop initializers */
/* normal fill: */
extern void gri_trans_blend_clut_lin_umap_init(grs_tmap_loop_info *ti);
-extern void gri_opaque_true_lin_umap_init();
-extern void gri_opaque_clut_true_lin_umap_init();
+extern void gri_opaque_true_lin_umap_init(void);
+extern void gri_opaque_clut_true_lin_umap_init(void);
extern void gri_opaque_lin_umap_init(grs_tmap_loop_info *tli);
extern void gri_trans_lin_umap_init(grs_tmap_loop_info *tli);
@@ -129,8 +129,8 @@
/* translucent bitmaps */
extern void gri_tluc8_opaque_lin_umap_init(grs_tmap_loop_info *tli);
extern void gri_tluc8_trans_lin_umap_init(grs_tmap_loop_info *tli);
-extern void gri_tluc8_opaque_lit_lin_umap_init();
-extern void gri_tluc8_trans_lit_lin_umap_init();
+extern void gri_tluc8_opaque_lit_lin_umap_init(void);
+extern void gri_tluc8_trans_lit_lin_umap_init(void);
extern void gri_tluc8_opaque_clut_lin_umap_init(grs_tmap_loop_info *tli);
extern void gri_tluc8_trans_clut_lin_umap_init(grs_tmap_loop_info *tli);
--- a/src/Libraries/2D/Source/Flat8/fl8tpl.c
+++ b/src/Libraries/2D/Source/Flat8/fl8tpl.c
@@ -295,11 +295,11 @@
extern void gri_per_umap_vscan(grs_bitmap *bm, int n, grs_vertex **vpl, grs_per_setup *ps);
void gri_trans_per_umap_hscan_init(grs_bitmap *bm, grs_per_setup *ps) {- ps->shell_func = (void (*)())gri_per_umap_hscan;
- ps->scanline_func = (void (*)())gri_trans_per_umap_hscan_scanline;
+ ps->shell_func = (void (*)(void))gri_per_umap_hscan;
+ ps->scanline_func = (void (*)(void))gri_trans_per_umap_hscan_scanline;
}
void gri_trans_per_umap_vscan_init(grs_bitmap *bm, grs_per_setup *ps) {- ps->shell_func = (void (*)())gri_per_umap_vscan;
- ps->scanline_func = (void (*)())gri_trans_per_umap_vscan_scanline;
+ ps->shell_func = (void (*)(void))gri_per_umap_vscan;
+ ps->scanline_func = (void (*)(void))gri_trans_per_umap_vscan_scanline;
}
--- a/src/Libraries/2D/Source/Flat8/fl8tsmap.c
+++ b/src/Libraries/2D/Source/Flat8/fl8tsmap.c
@@ -123,9 +123,9 @@
tli->vtab = gr_make_vtab(&(tli->bm));
tli->bm.hlog = GRL_TRANS;
}
- tli->loop_func = (void (*)())gri_trans_solid_lin_umap_loop;
- tli->right_edge_func = (void (*)())gri_uvx_edge;
- tli->left_edge_func = (void (*)())gri_uvx_edge;
+ tli->loop_func = (void (*)(void))gri_trans_solid_lin_umap_loop;
+ tli->right_edge_func = (void (*)(void))gri_uvx_edge;
+ tli->left_edge_func = (void (*)(void))gri_uvx_edge;
}
int gri_trans_solid_floor_umap_loop(grs_tmap_loop_info *tli) {@@ -212,9 +212,9 @@
tli->vtab = gr_make_vtab(&(tli->bm));
tli->bm.hlog = GRL_TRANS;
}
- tli->loop_func = (void (*)())gri_trans_solid_floor_umap_loop;
- tli->left_edge_func = (void (*)())gri_uvwx_edge;
- tli->right_edge_func = (void (*)())gri_uvwx_edge;
+ tli->loop_func = (void (*)(void))gri_trans_solid_floor_umap_loop;
+ tli->left_edge_func = (void (*)(void))gri_uvwx_edge;
+ tli->right_edge_func = (void (*)(void))gri_uvwx_edge;
}
int gri_solid_wall_umap_loop(grs_tmap_loop_info *tli) {@@ -307,9 +307,9 @@
tli->vtab = gr_make_vtab(&(tli->bm));
tli->bm.hlog = GRL_TRANS;
}
- tli->loop_func = (void (*)())gri_solid_wall_umap_loop;
- tli->left_edge_func = (void (*)())gri_uvwy_edge;
- tli->right_edge_func = (void (*)())gri_uvwy_edge;
+ tli->loop_func = (void (*)(void))gri_solid_wall_umap_loop;
+ tli->left_edge_func = (void (*)(void))gri_uvwy_edge;
+ tli->right_edge_func = (void (*)(void))gri_uvwy_edge;
}
void gri_trans_solid_per_umap_hscan_scanline(grs_per_info *pi, grs_bitmap *bm) {@@ -552,11 +552,11 @@
extern void gri_per_umap_vscan(grs_bitmap *bm, int n, grs_vertex **vpl, grs_per_setup *ps);
void gri_trans_solid_per_umap_hscan_init(grs_bitmap *bm, grs_per_setup *ps) {- ps->shell_func = (void (*)())gri_per_umap_hscan;
- ps->scanline_func = (void (*)())gri_trans_solid_per_umap_hscan_scanline;
+ ps->shell_func = (void (*)(void))gri_per_umap_hscan;
+ ps->scanline_func = (void (*)(void))gri_trans_solid_per_umap_hscan_scanline;
}
void gri_trans_solid_per_umap_vscan_init(grs_bitmap *bm, grs_per_setup *ps) {- ps->shell_func = (void (*)())gri_per_umap_vscan;
- ps->scanline_func = (void (*)())gri_trans_solid_per_umap_vscan_scanline;
+ ps->shell_func = (void (*)(void))gri_per_umap_vscan;
+ ps->scanline_func = (void (*)(void))gri_trans_solid_per_umap_vscan_scanline;
}
--- a/src/Libraries/2D/Source/Flat8/fl8w.c
+++ b/src/Libraries/2D/Source/Flat8/fl8w.c
@@ -234,9 +234,9 @@
tli->vtab = gr_make_vtab(&(tli->bm));
tli->bm.hlog = GRL_TRANS;
}
- tli->loop_func = (void (*)())gri_wall_umap_loop;
- tli->left_edge_func = (void (*)())gri_uvwy_edge;
- tli->right_edge_func = (void (*)())gri_uvwy_edge;
+ tli->loop_func = (void (*)(void))gri_wall_umap_loop;
+ tli->left_edge_func = (void (*)(void))gri_uvwy_edge;
+ tli->right_edge_func = (void (*)(void))gri_uvwy_edge;
}
void gri_opaque_wall_umap_init(grs_tmap_loop_info *tli) {@@ -247,9 +247,9 @@
tli->vtab = gr_make_vtab(&(tli->bm));
tli->bm.hlog = GRL_OPAQUE;
}
- tli->loop_func = (void (*)())gri_wall_umap_loop;
- tli->left_edge_func = (void (*)())gri_uvwy_edge;
- tli->right_edge_func = (void (*)())gri_uvwy_edge;
+ tli->loop_func = (void (*)(void))gri_wall_umap_loop;
+ tli->left_edge_func = (void (*)(void))gri_uvwy_edge;
+ tli->right_edge_func = (void (*)(void))gri_uvwy_edge;
}
void gri_trans_clut_wall_umap_init(grs_tmap_loop_info *tli) {@@ -260,9 +260,9 @@
tli->vtab = gr_make_vtab(&(tli->bm));
tli->bm.hlog = GRL_TRANS | GRL_CLUT;
}
- tli->loop_func = (void (*)())gri_wall_umap_loop;
- tli->left_edge_func = (void (*)())gri_uvwy_edge;
- tli->right_edge_func = (void (*)())gri_uvwy_edge;
+ tli->loop_func = (void (*)(void))gri_wall_umap_loop;
+ tli->left_edge_func = (void (*)(void))gri_uvwy_edge;
+ tli->right_edge_func = (void (*)(void))gri_uvwy_edge;
}
void gri_opaque_clut_wall_umap_init(grs_tmap_loop_info *tli) {@@ -273,9 +273,9 @@
tli->vtab = gr_make_vtab(&(tli->bm));
tli->bm.hlog = GRL_OPAQUE | GRL_CLUT;
}
- tli->loop_func = (void (*)())gri_wall_umap_loop;
- tli->left_edge_func = (void (*)())gri_uvwy_edge;
- tli->right_edge_func = (void (*)())gri_uvwy_edge;
+ tli->loop_func = (void (*)(void))gri_wall_umap_loop;
+ tli->left_edge_func = (void (*)(void))gri_uvwy_edge;
+ tli->right_edge_func = (void (*)(void))gri_uvwy_edge;
}
/*extern "C"
@@ -401,7 +401,7 @@
tli->vtab=gr_make_vtab(&(tli->bm));
tli->bm.hlog=GRL_OPAQUE|GRL_CLUT;
}*/
- tli->loop_func = (void (*)())gri_wall_umap_loop_1D;
- tli->left_edge_func = (void (*)())gri_uvwy_edge;
- tli->right_edge_func = (void (*)())gri_uvwy_edge;
+ tli->loop_func = (void (*)(void))gri_wall_umap_loop_1D;
+ tli->left_edge_func = (void (*)(void))gri_uvwy_edge;
+ tli->right_edge_func = (void (*)(void))gri_uvwy_edge;
}
--- a/src/Libraries/2D/Source/GR/grd.c
+++ b/src/Libraries/2D/Source/GR/grd.c
@@ -61,13 +61,13 @@
grs_drvcap *grd_cap = &grd_mode_cap;
/* pointer to start of current device driver's function table. */
-void (**grd_device_table)();
+void (**grd_device_table)(void);
-void (**grd_pixel_table)();
+void (**grd_pixel_table)(void);
/* pointer to start of current bitmap driver's function table for clipped
primitives. */
-void (**grd_canvas_table)();
+void (**grd_canvas_table)(void);
/* currently active graphics mode. -1 means unrecognized mode */
int grd_mode=-1;
--- a/src/Libraries/2D/Source/GR/grd.h
+++ b/src/Libraries/2D/Source/GR/grd.h
@@ -56,7 +56,7 @@
extern grs_sys_info grd_info;
extern grs_drvcap *grd_cap;
extern grs_drvcap grd_mode_cap;
-extern void (**grd_driver_list[])();
+extern void (**grd_driver_list[])(void);
extern int grd_mode;
/* support old-syle dr_ naming for now. */
--- a/src/Libraries/2D/Source/GR/grdev.h
+++ b/src/Libraries/2D/Source/GR/grdev.h
@@ -82,5 +82,5 @@
#define gr_set_focus \
((void (*)(short x,short y))grd_device_table[GRT_SET_FOCUS])
#define gr_get_focus \
- ((void (*)())grd_device_table[GRT_GET_FOCUS])
+ ((void (*)(void))grd_device_table[GRT_GET_FOCUS])
#endif /* !__GRDEV_H */
--- a/src/Libraries/2D/Source/GR/grrend.h
+++ b/src/Libraries/2D/Source/GR/grrend.h
@@ -210,5 +210,5 @@
grd_canvas_table[CLUT_SCALE_DEVICE_BITMAP+2*((bm)->type)]) \
(bm,x,y,w,h,cl)
#define gr_roll_ubitmap grd_canvas_table[ROLL_UBITMAP])
-#define gr_roll_bitmap ((int (*)())grd_canvas_table[ROLL_BITMAP])
+#define gr_roll_bitmap ((int (*)(void))grd_canvas_table[ROLL_BITMAP])
#endif /* !__GRREND_H */
--- a/src/Libraries/2D/Source/GR/grs.h
+++ b/src/Libraries/2D/Source/GR/grs.h
@@ -106,8 +106,7 @@
#include "fix.h"
-// FIXME pragma pack
-#pragma pack(push,2)
+#pragma pack on // 2
/* system information structure. */
typedef struct {@@ -243,6 +242,6 @@
fix x,y,z; /* 3's */
} grs_point3d;
-#pragma pack(pop)
+#pragma pack off
#endif /* !__GRS_H */
--- a/src/Libraries/2D/Source/GR/grstate.h
+++ b/src/Libraries/2D/Source/GR/grstate.h
@@ -43,9 +43,9 @@
#include "tabdat.h"
#define gr_push_state \
- ((int (*)())grd_pixel_table[PUSH_STATE])
+ ((int (*)(void))grd_pixel_table[PUSH_STATE])
#define gr_pop_state \
- ((int (*)())grd_pixel_table[POP_STATE])
+ ((int (*)(void))grd_pixel_table[POP_STATE])
#endif
--- a/src/Libraries/2D/Source/Gen/gencnv.c
+++ b/src/Libraries/2D/Source/Gen/gencnv.c
@@ -32,9 +32,9 @@
#include "general.h"
#include "icanvas.h"
-typedef void (*ptr_type)();
+typedef void (*ptr_type)(void);
-void (*gen_canvas_table[GRD_CANVAS_FUNCS])() = {+void (*gen_canvas_table[GRD_CANVAS_FUNCS])(void) = {gr_null, /* NO generic pixel routines! */
gr_null,
gr_null,
--- a/src/Libraries/2D/Source/Gen/general.c
+++ b/src/Libraries/2D/Source/Gen/general.c
@@ -112,7 +112,7 @@
//void gen_flat24_ubitmap (grs_bitmap *bm, short x, short y)
#ifdef INCLUDE_GEN_FUNC_TABLES
-void (*gen_func[grd_FUNCS])() = {+void (*gen_func[grd_FUNCS])(void) = {gr_null, /* set_upixel */
gr_null, /* set_pixel */
gr_null, /* get_upixel */
--- a/src/Libraries/2D/Source/Gen/general.h
+++ b/src/Libraries/2D/Source/Gen/general.h
@@ -273,7 +273,7 @@
extern void gen_roll_ubitmap
(grs_bitmap *bm, fix angle, short x, short y);
-extern void gen_roll_bitmap ();
+extern void gen_roll_bitmap (void);
extern void gen_flat8_wall_umap
(grs_bitmap *bm, int n, fix **vpl);
--- a/src/Libraries/2D/Source/Gen/gentf.h
+++ b/src/Libraries/2D/Source/Gen/gentf.h
@@ -34,61 +34,61 @@
extern int gen_flat8_bitmap (grs_bitmap *bm, short x, short y);
/* init functions */
-extern void gri_gen_opaque_lin_umap_init();
-extern void gri_gen_trans_lin_umap_init();
-extern void gri_gen_opaque_clut_lin_umap_init();
-extern void gri_gen_trans_clut_lin_umap_init();
-extern void gri_gen_opaque_lit_lin_umap_init();
-extern void gri_gen_trans_lit_lin_umap_init();
+extern void gri_gen_opaque_lin_umap_init(void);
+extern void gri_gen_trans_lin_umap_init(void);
+extern void gri_gen_opaque_clut_lin_umap_init(void);
+extern void gri_gen_trans_clut_lin_umap_init(void);
+extern void gri_gen_opaque_lit_lin_umap_init(void);
+extern void gri_gen_trans_lit_lin_umap_init(void);
-extern void gri_gen_opaque_floor_umap_init();
-extern void gri_gen_trans_floor_umap_init();
-extern void gri_gen_opaque_clut_floor_umap_init();
-extern void gri_gen_trans_clut_floor_umap_init();
-extern void gri_gen_opaque_lit_floor_umap_init();
-extern void gri_gen_trans_lit_floor_umap_init();
+extern void gri_gen_opaque_floor_umap_init(void);
+extern void gri_gen_trans_floor_umap_init(void);
+extern void gri_gen_opaque_clut_floor_umap_init(void);
+extern void gri_gen_trans_clut_floor_umap_init(void);
+extern void gri_gen_opaque_lit_floor_umap_init(void);
+extern void gri_gen_trans_lit_floor_umap_init(void);
-extern void gri_gen_opaque_wall_umap_init();
-extern void gri_gen_trans_wall_umap_init();
-extern void gri_gen_opaque_clut_wall_umap_init();
-extern void gri_gen_trans_clut_wall_umap_init();
-extern void gri_gen_opaque_lit_wall_umap_init();
-extern void gri_gen_trans_lit_wall_umap_init();
+extern void gri_gen_opaque_wall_umap_init(void);
+extern void gri_gen_trans_wall_umap_init(void);
+extern void gri_gen_opaque_clut_wall_umap_init(void);
+extern void gri_gen_trans_clut_wall_umap_init(void);
+extern void gri_gen_opaque_lit_wall_umap_init(void);
+extern void gri_gen_trans_lit_wall_umap_init(void);
-extern void gri_gen_opaque_per_umap_hscan_init();
-extern void gri_gen_trans_per_umap_hscan_init();
-extern void gri_gen_opaque_clut_per_umap_hscan_init();
-extern void gri_gen_trans_clut_per_umap_hscan_init();
-extern void gri_gen_opaque_lit_per_umap_hscan_init();
-extern void gri_gen_trans_lit_per_umap_hscan_init();
+extern void gri_gen_opaque_per_umap_hscan_init(void);
+extern void gri_gen_trans_per_umap_hscan_init(void);
+extern void gri_gen_opaque_clut_per_umap_hscan_init(void);
+extern void gri_gen_trans_clut_per_umap_hscan_init(void);
+extern void gri_gen_opaque_lit_per_umap_hscan_init(void);
+extern void gri_gen_trans_lit_per_umap_hscan_init(void);
-extern void gri_gen_opaque_per_umap_vscan_init();
-extern void gri_gen_trans_per_umap_vscan_init();
-extern void gri_gen_opaque_clut_per_umap_vscan_init();
-extern void gri_gen_trans_clut_per_umap_vscan_init();
-extern void gri_gen_opaque_lit_per_umap_vscan_init();
-extern void gri_gen_trans_lit_per_umap_vscan_init();
+extern void gri_gen_opaque_per_umap_vscan_init(void);
+extern void gri_gen_trans_per_umap_vscan_init(void);
+extern void gri_gen_opaque_clut_per_umap_vscan_init(void);
+extern void gri_gen_trans_clut_per_umap_vscan_init(void);
+extern void gri_gen_opaque_lit_per_umap_vscan_init(void);
+extern void gri_gen_trans_lit_per_umap_vscan_init(void);
-extern void gri_gen_opaque_scale_umap_init();
-extern void gri_gen_trans_scale_umap_init();
-extern void gri_gen_opaque_clut_scale_umap_init();
-extern void gri_gen_trans_clut_scale_umap_init();
-extern void gri_gen_opaque_lit_scale_umap_init();
-extern void gri_gen_trans_lit_scale_umap_init();
-extern void gri_gen_opaque_solid_scale_umap_init();
+extern void gri_gen_opaque_scale_umap_init(void);
+extern void gri_gen_trans_scale_umap_init(void);
+extern void gri_gen_opaque_clut_scale_umap_init(void);
+extern void gri_gen_trans_clut_scale_umap_init(void);
+extern void gri_gen_opaque_lit_scale_umap_init(void);
+extern void gri_gen_trans_lit_scale_umap_init(void);
+extern void gri_gen_opaque_solid_scale_umap_init(void);
-extern void gri_gen_mono_opaque_scale_umap_init();
-extern void gri_gen_mono_trans_scale_umap_init();
-extern void gri_gen_mono_opaque_clut_scale_umap_init();
-extern void gri_gen_mono_trans_clut_scale_umap_init();
-extern void gri_gen_mono_trans_solid_scale_umap_init();
+extern void gri_gen_mono_opaque_scale_umap_init(void);
+extern void gri_gen_mono_trans_scale_umap_init(void);
+extern void gri_gen_mono_opaque_clut_scale_umap_init(void);
+extern void gri_gen_mono_trans_clut_scale_umap_init(void);
+extern void gri_gen_mono_trans_solid_scale_umap_init(void);
/* polys */
-extern void gri_gen_poly_init();
-extern void gri_gen_spoly_init();
-extern void gri_gen_cpoly_init();
-extern void gri_gen_tpoly_init();
-extern void gri_gen_stpoly_init();
+extern void gri_gen_poly_init(void);
+extern void gri_gen_spoly_init(void);
+extern void gri_gen_cpoly_init(void);
+extern void gri_gen_tpoly_init(void);
+extern void gri_gen_stpoly_init(void);
/* rsd8 */
extern void gri_gen_rsd8_ubitmap (grs_bitmap *bm, short x, short y);
@@ -98,14 +98,14 @@
extern void rsd8_pm_init(grs_bitmap *bm, grs_per_setup *ps);
/* translucent */
-extern void gri_gen_tluc8_opaque_lin_umap_init();
-extern void gri_gen_tluc8_trans_lin_umap_init();
-extern void gri_gen_tluc8_opaque_lit_lin_umap_init();
-extern void gri_gen_tluc8_trans_lit_lin_umap_init();
-extern void gri_gen_tluc8_opaque_clut_lin_umap_init();
-extern void gri_gen_tluc8_trans_clut_lin_umap_init();
+extern void gri_gen_tluc8_opaque_lin_umap_init(void);
+extern void gri_gen_tluc8_trans_lin_umap_init(void);
+extern void gri_gen_tluc8_opaque_lit_lin_umap_init(void);
+extern void gri_gen_tluc8_trans_lit_lin_umap_init(void);
+extern void gri_gen_tluc8_opaque_clut_lin_umap_init(void);
+extern void gri_gen_tluc8_trans_clut_lin_umap_init(void);
-extern void gri_gen_tluc8_opaque_scale_umap_init();
-extern void gri_gen_tluc8_trans_scale_umap_init();
-extern void gri_gen_tluc8_opaque_clut_scale_umap_init();
-extern void gri_gen_tluc8_trans_clut_scale_umap_init();
+extern void gri_gen_tluc8_opaque_scale_umap_init(void);
+extern void gri_gen_tluc8_trans_scale_umap_init(void);
+extern void gri_gen_tluc8_opaque_clut_scale_umap_init(void);
+extern void gri_gen_tluc8_trans_clut_scale_umap_init(void);
--- a/src/Libraries/2D/Source/MacDev.c
+++ b/src/Libraries/2D/Source/MacDev.c
@@ -37,10 +37,10 @@
// so its not here.
//
-typedef void (**ptr_type)();
+typedef void (**ptr_type)(void);
// Mac device function table
-void (**mac_device_table[])() = {+void (**mac_device_table[])(void) = {(ptr_type)gr_null, // init device
(ptr_type)gr_null, // close device
(ptr_type)mac_set_mode, // set mode
--- a/src/Libraries/2D/Source/MacDev.h
+++ b/src/Libraries/2D/Source/MacDev.h
@@ -30,7 +30,7 @@
#ifndef __MACDEV_H
#define __MACDEV_H
-extern void (**mac_device_table[])();
+extern void (**mac_device_table[])(void);
extern int mac_set_state(void *buf,int clear);
extern int mac_get_state(void *buf,int flags);
--- a/src/Libraries/2D/Source/blnfcn.h
+++ b/src/Libraries/2D/Source/blnfcn.h
@@ -35,7 +35,7 @@
#ifndef __BLNFCN_H
#define __BLNFCN_H
/* prototypes for blend table maintenance, TRUE means success, FALSE not */
-uchar gr_free_blend(void);
+int gr_free_blend(void);
/* tab_cnt is how many blend steps, note cnt<=0 is equivalent to calling
free blend */
uchar gr_init_blend(int log_blend_levels);
--- a/src/Libraries/2D/Source/chain.h
+++ b/src/Libraries/2D/Source/chain.h
@@ -66,7 +66,7 @@
typedef struct iaaiiaia{- void (*f)();
+ void (*f)(void);
struct iaaiiaia *next;
uchar flags;
} grs_func_chain;
@@ -78,15 +78,15 @@
#define CHN_ON 1
#define CHN_GEN 2
-extern grs_func_chain *gr_chain_add_over(int n, void (*f)());
+extern grs_func_chain *gr_chain_add_over(int n, void (*f)(void));
extern grs_func_chain *gr_chain_add_before(int n, void (*f)(void));
extern grs_func_chain *gr_chain_add_after(int n, void (*f)(void));
-extern void (*chain_rest())();
+extern void (*chain_rest())(void);
extern void gr_unchain(int n);
extern void gr_rechain(int n);
-extern void gr_unchain_all();
-extern void gr_rechain_all();
+extern void gr_unchain_all(void);
+extern void gr_rechain_all(void);
#define gr_do_chain (chain_rest())
#define gr_chaining_on() (chn_flags |= CHN_ON)
@@ -94,11 +94,11 @@
#define gr_chaining_toggle() (chn_flags ^= CHN_ON)
#define gr_generic (chn_flags & CHN_GEN)
-extern void gr_force_generic();
-extern void gr_unforce_generic();
+extern void gr_force_generic(void);
+extern void gr_unforce_generic(void);
#define gr_toggle_generic() (gr_generic? gr_unforce_generic() : gr_force_generic())
-#define gr_start_frame ((void (*)())grd_canvas_table[START_FRAME])
-#define gr_end_frame ((void (*)())grd_canvas_table[END_FRAME])
+#define gr_start_frame ((void (*)(void))grd_canvas_table[START_FRAME])
+#define gr_end_frame ((void (*)(void))grd_canvas_table[END_FRAME])
#endif
--- a/src/Libraries/2D/Source/cnvdrv.h
+++ b/src/Libraries/2D/Source/cnvdrv.h
@@ -40,11 +40,11 @@
#ifndef __CNVDRV_H
#define __CNVDRV_H
-extern void (*flat8_canvas_table[])();
-extern void (*flat8d_canvas_table[])();
-extern void (*modex_canvas_table[])();
-extern void (*bank8_canvas_table[])();
-extern void (*bank24_canvas_table[])();
-extern void (*span_canvas_table[])();
-extern void (*gen_canvas_table[])();
+extern void (*flat8_canvas_table[])(void);
+extern void (*flat8d_canvas_table[])(void);
+extern void (*modex_canvas_table[])(void);
+extern void (*bank8_canvas_table[])(void);
+extern void (*bank24_canvas_table[])(void);
+extern void (*span_canvas_table[])(void);
+extern void (*gen_canvas_table[])(void);
#endif
--- a/src/Libraries/2D/Source/cnvtab.c
+++ b/src/Libraries/2D/Source/cnvtab.c
@@ -31,7 +31,7 @@
#include "cnvdrv.h"
#include <stdlib.h>
-void (**grd_canvas_table_list[])() = {+void (**grd_canvas_table_list[])(void) = {NULL, /* device driver-initialized by gr_set_mode */
NULL, /* monochrome-not supported */
flat8_canvas_table, /* flat 8 canvas */
--- a/src/Libraries/2D/Source/cnvtab.h
+++ b/src/Libraries/2D/Source/cnvtab.h
@@ -34,5 +34,5 @@
#ifndef __CNVTAB_H
#define __CNVTAB_H
-extern void (**grd_canvas_table_list[])();
+extern void (**grd_canvas_table_list[])(void);
#endif /* !__CNVTAB_H */
--- a/src/Libraries/2D/Source/ctxmac.h
+++ b/src/Libraries/2D/Source/ctxmac.h
@@ -79,7 +79,7 @@
of sync when the interrupt tries to restore the canvas. */
// implementation of gri_set_fill_globals is in PixFill.c
extern void gri_set_fill_globals(long *fill_type_ptr, long fill_type,
- void (***function_table_ptr)(), void (**function_table)(),
+ void (***function_table_ptr)(void), void (**function_table)(void),
grt_uline_fill **line_vector_ptr, grt_uline_fill *line_vector);
/*
#pragma aux gri_set_fill_globals = \
--- a/src/Libraries/2D/Source/detect.c
+++ b/src/Libraries/2D/Source/detect.c
@@ -36,7 +36,7 @@
#include "tabdat.h"
// extern
-extern void (**grd_device_table_list[])();
+extern void (**grd_device_table_list[])(void);
// ======================================================================
// Mac version of gr_detect
@@ -53,7 +53,7 @@
info->modes[4] = GRM_1024x768x8;
grd_device_table = grd_device_table_list[info->id_maj];
- grd_canvas_table_list[BMT_DEVICE] = (void (**)())grd_device_table[GRT_CANVAS_TABLE];
+ grd_canvas_table_list[BMT_DEVICE] = (void (**)(void))grd_device_table[GRT_CANVAS_TABLE];
return(0);
}
@@ -147,7 +147,7 @@
if (err==0) {grd_device_table = grd_device_table_list[info->id_maj];
grd_canvas_table_list[BMT_DEVICE] =
- (void (**)())grd_device_table[GRT_CANVAS_TABLE];
+ (void (**)(void))grd_device_table[GRT_CANVAS_TABLE];
}
return err;
}
--- a/src/Libraries/2D/Source/devtab.c
+++ b/src/Libraries/2D/Source/devtab.c
@@ -35,7 +35,7 @@
#include "MacDev.h"
-typedef void (**ptr_type)();
+typedef void (**ptr_type)(void);
-void (**grd_device_table_list[])() = {(ptr_type) mac_device_table};+void (**grd_device_table_list[])(void) = {(ptr_type) mac_device_table};--- a/src/Libraries/2D/Source/devtab.h
+++ b/src/Libraries/2D/Source/devtab.h
@@ -37,7 +37,7 @@
#ifndef __DEVTAB_H
#define __DEVTAB_H
-extern void (*flat8_device_table[])();
-extern void (*vga_device_table[])();
-extern void (*vesa_device_table[])();
+extern void (*flat8_device_table[])(void);
+extern void (*vga_device_table[])(void);
+extern void (*vesa_device_table[])(void);
#endif /* !__DEVTAB_H */
--- a/src/Libraries/2D/Source/fcntab.c
+++ b/src/Libraries/2D/Source/fcntab.c
@@ -29,7 +29,7 @@
#include "tabdrv.h"
-void (**grd_function_table)();
+void (**grd_function_table)(void);
grt_function_table *grd_function_fill_table;
grt_function_table *grd_function_table_list[] = {NULL, /* device driver-initialized by gr_set_mode */
--- a/src/Libraries/2D/Source/pertyp.h
+++ b/src/Libraries/2D/Source/pertyp.h
@@ -60,8 +60,8 @@
/* and its magnitude is always <= 1. */
/*********************************************************/
typedef struct {- void (*scanline_func)(); /* function to do scanline. */
- void (*shell_func)(); /* perspective mapping shell. */
+ void (*scanline_func)(void); /* function to do scanline. */
+ void (*shell_func)(void); /* perspective mapping shell. */
union {uchar *clut; intptr_t fill_parm;};fix scan_slope;
int dp;
--- a/src/Libraries/2D/Source/rgb.c
+++ b/src/Libraries/2D/Source/rgb.c
@@ -33,7 +33,7 @@
#include "scrdat.h"
// prototypes
-static int _redloop();
+static int _redloop(void);
/* Static Globals for his and her pleasure */
static int bcenter, gcenter, rcenter;
@@ -167,7 +167,7 @@
}
/* redloop -- loop up and down from red center. */
-static int _redloop()
+static int _redloop(void)
{int detect, r, first;
long txsqr = xsqr + xsqr;
--- a/src/Libraries/2D/Source/tabdat.h
+++ b/src/Libraries/2D/Source/tabdat.h
@@ -37,8 +37,8 @@
#ifndef __TABDAT_H
#define __TABDAT_H
-extern void (**grd_pixel_table)();
-extern void (**grd_device_table)();
-extern void (**grd_canvas_table)();
-extern void (**grd_function_table)();
+extern void (**grd_pixel_table)(void);
+extern void (**grd_device_table)(void);
+extern void (**grd_canvas_table)(void);
+extern void (**grd_function_table)(void);
#endif /* !__TABDAT_H */
--- a/src/Libraries/2D/Source/tabdrv.h
+++ b/src/Libraries/2D/Source/tabdrv.h
@@ -42,7 +42,7 @@
#include "fill.h"
#include "ifcn.h"
-typedef void (*grt_function_table[GRD_FILL_TYPES][GRD_FUNCS*REAL_BMT_TYPES])();
+typedef void (*grt_function_table[GRD_FILL_TYPES][GRD_FUNCS*REAL_BMT_TYPES])(void);
extern grt_function_table gen_function_table;
extern grt_function_table flat8_function_table;
--- a/src/Libraries/2D/Source/tmapint.h
+++ b/src/Libraries/2D/Source/tmapint.h
@@ -132,10 +132,10 @@
uchar solid;
};
int32_t *vtab; /* for non power of 2 widths */
- void (*scanline_func)(); /* function for individual scanline */
- void (*loop_func)(); /* actually, chunk function */
- union {void (*left_edge_func)(), (*top_edge_func)();};- union {void (*right_edge_func)(),(*bot_edge_func)();};+ void (*scanline_func)(void); /* function for individual scanline */
+ void (*loop_func)(void); /* actually, chunk function */
+ union {void (*left_edge_func)(void), (*top_edge_func)(void);};+ union {void (*right_edge_func)(void),(*bot_edge_func)(void);};} grs_tmap_loop_info;
#define TMS_RIGHT 0
--- a/src/Libraries/3D/Source/3d.h
+++ b/src/Libraries/3D/Source/3d.h
@@ -153,7 +153,7 @@
#include "2d.h"
#include "fix.h"
-#pragma pack(push,2)
+#pragma pack on // 2
// MLA defines
#define SwapFix(x, y) \
@@ -1016,6 +1016,6 @@
parm [ecx] [esi] value [eax] modify [eax ebx ecx edx esi edi];
*/
-#pragma pack(pop)
+#pragma pack off
#endif /* __3D_H */
--- a/src/Libraries/3D/Source/Bitmap.c
+++ b/src/Libraries/3D/Source/Bitmap.c
@@ -404,7 +404,6 @@
}
}
tmap_info.tmap_type = (_g3d_light_flag << 1) + GRC_BILIN;
- extern bool use_opengl();
if (!use_opengl()) {h_map(bm, 4, _g3d_bitmap_poly, &tmap_info);
} else {--- a/src/Libraries/3D/Source/detail.c
+++ b/src/Libraries/3D/Source/detail.c
@@ -26,15 +26,15 @@
#include "3d.h"
-void (*g3_tmap_func)() = (void (*)())g3_draw_tmap;
-void (*g3_lit_tmap_func)() = (void (*)())g3_light_tmap;
+int (*g3_tmap_func)(int, g3s_phandle *, grs_bitmap *) = (int (*)(int, g3s_phandle *, grs_bitmap *))g3_draw_tmap;
+int (*g3_lit_tmap_func)(void) = (int (*)(void))g3_light_tmap;
void g3_set_tmaps_linear(void) {- g3_tmap_func = (void (*)())g3_draw_lmap;
- g3_lit_tmap_func = (void (*)())g3_light_lmap;
+ g3_tmap_func = (int (*)(int, g3s_phandle *, grs_bitmap *))g3_draw_lmap;
+ g3_lit_tmap_func = (int (*)(void))g3_light_lmap;
}
void g3_reset_tmaps(void) {- g3_tmap_func = (void (*)())g3_draw_tmap;
- g3_lit_tmap_func = (void (*)())g3_light_tmap;
+ g3_tmap_func = (int (*)(int, g3s_phandle *, grs_bitmap *))g3_draw_tmap;
+ g3_lit_tmap_func = (int (*)(void))g3_light_tmap;
}
--- a/src/Libraries/3D/Source/interp.c
+++ b/src/Libraries/3D/Source/interp.c
@@ -621,7 +621,7 @@
return opcode + 8;
}
-extern void (*g3_tmap_func)();
+extern int (*g3_tmap_func)(int, g3s_phandle *, grs_bitmap *);
extern int temp_poly(long c, int n, grs_vertex **vpl);
uchar *do_tmap_op(uchar *opcode) {--- a/src/Libraries/AFILE/Source/amov.c
+++ b/src/Libraries/AFILE/Source/amov.c
@@ -52,12 +52,19 @@
#include "draw4x4.h"
#include "huff.h"
+#define PBIT24(p,v) do{(p)[0]=(v);(p)[1]=(v)>>8;(p)[2]=(v)>>16;}while(0)+#define GBIT24(p) (((uchar*)(p))[0]|(((uchar*)(p))[1]<<8)|(((uchar*)(p))[2]<<16))
+#define AMTIME(p) GBIT24((p)->time)
+#define AMTYPE(p) ((p)->cfp & 7)
+#define AMFLAGS(p) ((p)->cfp >> 3 & 15)
+#define AMPLAYED(p) ((p)->cfp >> 7 & 1)
+
// Type-specific information
typedef struct {MovieHeader movieHdr; // movie header
- MovieChunk *pmc; // ptr to movie chunk array
- MovieChunk *pcurrChunk; // current chunk ptr
+ DMovieChunk *pmc; // ptr to movie chunk array
+ DMovieChunk *pcurrChunk; // current chunk ptr
FILE *fpTemp; // temp file for writing
uint8_t pal[768]; // space for palette
uint8_t newPal; // new pal flag
@@ -123,7 +130,7 @@
int32_t AmovReadHeader(Afile *paf) {AmovInfo *pmi;
- MovieChunk *pchunk;
+ DMovieChunk *pchunk;
// Allocate type-specific info
@@ -154,15 +161,15 @@
paf->a.sampleSize = pmi->movieHdr.audioSampleSize;
// Read in chunk offsets
- pmi->pmc = (MovieChunk *)malloc(pmi->movieHdr.sizeChunks);
+ pmi->pmc = (DMovieChunk *)malloc(pmi->movieHdr.sizeChunks);
mfread(pmi->pmc, pmi->movieHdr.sizeChunks, paf->mf);
// Compute # frames
paf->v.numFrames = 0;
- for (pchunk = pmi->pmc; pchunk->chunkType != MOVIE_CHUNK_END; pchunk++) {- if (pchunk->chunkType == MOVIE_CHUNK_VIDEO)
+ for (pchunk = pmi->pmc; AMTYPE(pchunk) != MOVIE_CHUNK_END; pchunk++) {+ if (AMTYPE(pchunk) == MOVIE_CHUNK_VIDEO)
paf->v.numFrames++;
- if (pchunk->chunkType == MOVIE_CHUNK_AUDIO)
+ if (AMTYPE(pchunk) == MOVIE_CHUNK_AUDIO)
paf->a.numSamples++;
}
@@ -202,13 +209,13 @@
NEXT_CHUNK:
- switch (pmi->pcurrChunk->chunkType) {+ switch (AMTYPE(pmi->pcurrChunk)) {case MOVIE_CHUNK_END:
return (-1);
case MOVIE_CHUNK_VIDEO:
DEBUG("MOVIE_CHUNK_VIDEO");- pbm->type = pmi->pcurrChunk->flags & MOVIE_FVIDEO_BMTMASK;
+ pbm->type = AMFLAGS(pmi->pcurrChunk) & MOVIE_FVIDEO_BMTMASK;
if (pbm->type == MOVIE_FVIDEO_BMF_4X4) {mfseek(paf->mf, pmi->pcurrChunk->offset);
len = MovieChunkLength(pmi->pcurrChunk);
@@ -229,7 +236,7 @@
len = MovieChunkLength(pmi->pcurrChunk) - sizeof(LGRect);
mfread(pbm->bits, len, paf->mf);
}
- *ptime = pmi->pcurrChunk->time;
+ *ptime = AMTIME(pmi->pcurrChunk);
pmi->pcurrChunk++;
return (len);
@@ -236,7 +243,7 @@
case MOVIE_CHUNK_TABLE:
DEBUG("MOVIE_CHUNK_TABLE");mfseek(paf->mf, pmi->pcurrChunk->offset);
- switch (pmi->pcurrChunk->flags) {+ switch (AMFLAGS(pmi->pcurrChunk)) {case MOVIE_FTABLE_COLORSET:
if (pColorSet)
free(pColorSet);
@@ -263,12 +270,12 @@
case MOVIE_CHUNK_PALETTE:
DEBUG("MOVIE_CHUNK_PALETTE");- if (pmi->pcurrChunk->flags == MOVIE_FPAL_SET) {+ if (AMFLAGS(pmi->pcurrChunk) == MOVIE_FPAL_SET) {mfseek(paf->mf, pmi->pcurrChunk->offset);
mfread(pmi->pal, 768, paf->mf);
pmi->newPal = TRUE;
}
- else if (pmi->pcurrChunk->flags & MOVIE_FPAL_CLEAR) {+ else if (AMFLAGS(pmi->pcurrChunk) & MOVIE_FPAL_CLEAR) {// Clear the bitmap data prior to decoding an iframe. Setting to 0
// isn't ideal here since it's the transparency colour, but we don't
// have a better candidate without searching the palette (which is
@@ -350,9 +357,9 @@
void *p = (uint8_t *)malloc(MOVIE_DEFAULT_BLOCKLEN);
pmi = (AmovInfo *)paf->pspec;
- while (pmi->pcurrChunk->chunkType != MOVIE_CHUNK_END) {+ while (AMTYPE(pmi->pcurrChunk) != MOVIE_CHUNK_END) {// Got audio chunk
- if (pmi->pcurrChunk->chunkType == MOVIE_CHUNK_AUDIO) {+ if (AMTYPE(pmi->pcurrChunk) == MOVIE_CHUNK_AUDIO) { // TRACE("%s: got audio chunk in 0x%08x offset", __FUNCTION__, pmi->pcurrChunk->offset);mfseek(paf->mf, pmi->pcurrChunk->offset);
size = mfread(p, MOVIE_DEFAULT_BLOCKLEN, paf->mf);
@@ -419,7 +426,7 @@
paf->pspec = calloc(1, sizeof(AmovInfo));
pmi = paf->pspec;
- pmi->pmc = calloc(MAX_MOV_FRAMES, sizeof(MovieChunk));
+ pmi->pmc = calloc(MAX_MOV_FRAMES, sizeof(DMovieChunk));
// Current chunk is first one
pmi->pcurrChunk = pmi->pmc;
@@ -445,6 +452,7 @@
int32_t AmovWriteFrame(Afile *paf, grs_bitmap *pbm, int32_t bmlength, fix time) {AmovInfo *pmi;
LGRect area;
+ ubyte cfp;
pmi = paf->pspec;
@@ -456,9 +464,11 @@
}
// Set current chunk
- pmi->pcurrChunk->time = time;
- pmi->pcurrChunk->chunkType = MOVIE_CHUNK_VIDEO;
- pmi->pcurrChunk->flags = pbm->type;
+ PBIT24(pmi->pcurrChunk->time, time);
+ cfp = (pbm->type & 15) << 3 | MOVIE_CHUNK_VIDEO;
+ //pmi->pcurrChunk->chunkType = MOVIE_CHUNK_VIDEO;
+ //pmi->pcurrChunk->flags = pbm->type;
+ pmi->cfp = cfp;
pmi->pcurrChunk->offset = ftell(pmi->fpTemp);
// Write update area
@@ -484,7 +494,8 @@
AmovInfo *pmi;
int32_t nc, numBlocks, numExtra;
int32_t i;
- MovieChunk *pmc;
+ uint32_t t, t2;
+ DMovieChunk *pmc;
uint8_t buff[2048];
pmi = paf->pspec;
@@ -492,14 +503,19 @@
// Set end chunk
nc = pmi->pcurrChunk - pmi->pmc;
if (nc == 0)
- pmi->pcurrChunk->time = 0;
- else if (nc == 1)
- pmi->pcurrChunk->time = (pmi->pcurrChunk - 1)->time * 2;
- else
- pmi->pcurrChunk->time =
- (pmi->pcurrChunk - 1)->time + ((pmi->pcurrChunk - 1)->time - (pmi->pcurrChunk - 2)->time);
- pmi->pcurrChunk->chunkType = MOVIE_CHUNK_END;
- pmi->pcurrChunk->flags = 0;
+ PBIT24(pmi->pcurrChunk->time, 0);
+ else if (nc == 1){+ t = GBIT24((pmi->pcurrChunk - 1)->time) * 2;
+ PBIT24(pmi->pcurrChunk->time, t);
+ }else{+ t = GBIT24((pmi->pcurrChunk - 1)->time);
+ t2 = GBIT24((pmi->pcurrChunk - 2)->time);
+ t += t - t2;
+ PBIT24(pmi->pcurrChunk->time, t);
+ }
+ //pmi->pcurrChunk->chunkType = MOVIE_CHUNK_END;
+ //pmi->pcurrChunk->flags = 0;
+ pmi->pcurrChunk->cfp = MOVIE_CHUNK_END;
pmi->pcurrChunk->offset = ftell(pmi->fpTemp);
pmi->pcurrChunk++;
@@ -506,7 +522,7 @@
// Set movie header and write out
pmi->movieHdr.magicId = MOVI_MAGIC_ID;
pmi->movieHdr.numChunks = pmi->pcurrChunk - pmi->pmc;
- pmi->movieHdr.sizeChunks = ((pmi->movieHdr.numChunks * sizeof(MovieChunk)) + 1023) & 0xFFFFFC00L;
+ pmi->movieHdr.sizeChunks = ((pmi->movieHdr.numChunks * sizeof(DMovieChunk)) + 1023) & 0xFFFFFC00L;
if ((pmi->movieHdr.sizeChunks & 0x400) == 0)
pmi->movieHdr.sizeChunks += 0x0400; // 1K, 3K, 5K, etc.
pmi->movieHdr.sizeData = ftell(pmi->fpTemp);
@@ -525,7 +541,7 @@
// Adjust offsets
for (pmc = pmi->pmc;; pmc++) {pmc->offset += (sizeof(MovieHeader) + pmi->movieHdr.sizeChunks);
- if (pmc->chunkType == MOVIE_CHUNK_END)
+ if (AMTYPE(pmc) == MOVIE_CHUNK_END)
break;
}
--- a/src/Libraries/AFILE/Source/draw4x4.cpp
+++ b/src/Libraries/AFILE/Source/draw4x4.cpp
@@ -27,39 +27,48 @@
#include "2d.h"
// Holds bitstream information between invocations.
-class BitstreamInfo
+typedef struct BitstreamInfo BitstreamInfo;
+struct BitstreamInfo
{
uint8_t* ptr;
uint32_t word; // working value
int count; // how many bits are available in word
-public:
- explicit BitstreamInfo(uint8_t* p) : ptr(p), word(0), count(0) {}
- inline void reserve(int nbits) {
- while (count < nbits) {
- word = (word << 8) | *ptr++;
- count += 8;
- }
- }
- inline void skip(int nbits) {
- count -= nbits;
- }
- inline uint32_t peek(int nbits) {
- reserve(nbits);
- uint32_t const mask = ~(0xffffffff << nbits);
- return (word >> (count - nbits)) & mask;
- }
- inline uint32_t take(int nbits) {
- uint32_t const value = peek(nbits);
- skip(nbits);
- return value;
- }
};
+
+static inline void
+reserve(BitstreamInfo *b, int nbits)
+{+ while (b->count < nbits) {+ b->word = (b->word << 8) | *b->ptr++;
+ b->count += 8;
+ }
+}
+static inline void
+skip(BitstreamInfo *b, int nbits)
+{+ b->count -= nbits;
+}
+static inline uint32_t
+peek(BitstreamInfo *b, int nbits)
+{+ reserve(b, nbits);
+ uint32_t const mask = ~(0xffffffff << nbits);
+ return (b->word >> (b->count - nbits)) & mask;
+}
+static inline uint32_t
+take(BitstreamInfo *b, int nbits)
+{+ uint32_t const value = peek(b, nbits);
+ skip(b, nbits);
+ return value;
+}
+
static uchar* d4x4_hufftab;
static uchar* d4x4_colorset;
static uchar* Draw4x4_InternalBeta(uint32_t* xtab, int b, uchar* bits, int d, uchar* mask_stream);
-static void Draw4x4_InternalAlpha(uint32_t* xtab, int b, BitstreamInfo& bitstream);
+static void Draw4x4_InternalAlpha(uint32_t* xtab, int b, BitstreamInfo *bitstream);
//============================================================================
// Functions
@@ -68,7 +77,6 @@
// Draw4x4Reset
//
-extern "C" {
void Draw4x4Reset(uchar* colorset, uchar* hufftab)
{
@@ -87,7 +95,9 @@
int cell_column;
int row = grd_canvas->bm.row;
cell_column = width / 4;
- BitstreamInfo bitstream(p+2);
+ BitstreamInfo b;
+ memset(&b, 0, sizeof b);
+ b.ptr = p + 2;
uchar* mask_stream = (p + *((ushort*)(p)));
uchar* bits = grd_canvas->bm.bits;
@@ -95,31 +105,30 @@
int row4 = row * 4;
uint aligned_height = height & ~3;
for (uint y = 0; y < aligned_height; y += 4) {
- Draw4x4_InternalAlpha(xtab, cell_column, bitstream);
+ Draw4x4_InternalAlpha(xtab, cell_column, &b);
mask_stream = Draw4x4_InternalBeta(xtab, cell_column, bits, row, mask_stream);
bits += row4;
}
}
-}
//
// Draw4x4_InternalAlpha
//
-static void Draw4x4_InternalAlpha(uint32_t* xtab, int b, BitstreamInfo& bitstream)
+static void Draw4x4_InternalAlpha(uint32_t* xtab, int b, BitstreamInfo *bi)
{
while (b > 0) {
// Pull 12 bits from the bitstream and use it as an index into the
// hufftable.
- auto const hindex = bitstream.peek(12);
+ uint32_t const hindex = peek(bi, 12);
uint8_t* huffptr = &d4x4_hufftab[hindex * 3];
uint32_t huffword = *((uint32_t*)huffptr) & 0x00FFFFFF;
// Bits 20-23 are the count field.
- auto count = (huffword & 0xf00000) >> 20;
+ uint32_t count = (huffword & 0xf00000) >> 20;
if (count == 0) {
// A count of 0 is a long offset. It always advances the bitpointer
// by 12, since obviously it can't use the count to advance.
- bitstream.skip(12);
+ skip(bi, 12);
while (count == 0) {
// Use the entire (effectively 20-bit) huffword as an index into
@@ -126,7 +135,7 @@
// the hufftable.
huffptr = d4x4_hufftab + huffword * 3;
// Pull 4 bits from the bitstream and add that to the huffindex.
- auto const offset = bitstream.peek(4);
+ uint32_t const offset = peek(bi, 4);
huffptr += offset * 3;
// Check the next count: if it's still zero, go round again.
@@ -136,23 +145,23 @@
{
// If we're going around again, eat the 4 bits of offset.
// Otherwise, let the new control word determine the count.
- bitstream.skip(4);
+ skip(bi, 4);
}
}
}
// Otherwise it is the count of bits to consume. This is not
// necessarily the full 12 bits we just read; fields may overlap.
- bitstream.skip(count);
+ skip(bi, count);
b--;
// Check the control word for special types.
- auto const type = (huffword & 0x000e0000) >> 17;
+ uint32_t const type = (huffword & 0x000e0000) >> 17;
switch (type)
{
case 5:
{
// Type 5: skip. The next 5 bits from the bitstream form the count.
- auto hcnt = bitstream.take(5);
+ uint32_t hcnt = take(bi, 5);
// A count of 31 skips the rest of the row.
if (hcnt == 0x1f) {
hcnt = b;
@@ -186,14 +195,14 @@
uint8_t* tbits; // temp copy of bits
int i; // generic loop index
- auto const end = bits + 4*framesize;
+ uint8_t* end = bits + 4*framesize;
while (bits < end) {
// Read a control word from the decoded xtab and interpret it.
// Bits 0-16 are the 'parameter' field.
// Bits 17-19 are the 'type' field.
// Bits 20-23 are only used by the first-stage decoder.
- auto const xtype = (*xtab >> 17) & 0x07;
- auto const xparam = *xtab & 0x01ffff;
+ uint32_t const xtype = (*xtab >> 17) & 0x07;
+ uint32_t const xparam = *xtab & 0x01ffff;
switch (xtype) {
case 0:
@@ -201,8 +210,8 @@
// Type 0 : direct colour. Bits 0-15 of the control word form a 2-
// pixel block to be replicated 8 times into the tile.
uint8_t ctab[2] = {
- uint8_t(xparam & 0xff),
- uint8_t((xparam & 0xff00) >> 8)
+ (uint8_t)(xparam & 0xff),
+ (uint8_t)((xparam & 0xff00) >> 8)
};
tbits = bits;
for (i = 0; i < 4; ++i) {
@@ -222,10 +231,10 @@
// in the tile accordingly, taking a zero value in the first colour
// table ONLY to be transparent.
uint8_t ctab[2] = {
- uint8_t(xparam & 0xff),
- uint8_t((xparam & 0xff00) >> 8)
+ (uint8_t)(xparam & 0xff),
+ (uint8_t)((xparam & 0xff00) >> 8)
};
- auto mask = *(uint16_t*)mask_stream;
+ uint16_t mask = *(uint16_t*)mask_stream;
mask_stream += 2;
tbits = bits;
if (ctab[0] != 0) {
@@ -259,10 +268,10 @@
// main colour table, taken to point to a 4-byte colour table. Set
// each tile pixel to the colour table indexed by the corresponding
// 2 bits of the mask word.
- auto mask = *(uint32_t*)mask_stream;
+ uint32_t mask = *(uint32_t*)mask_stream;
mask_stream += 4;
tbits = bits;
- auto const ctab = d4x4_colorset + xparam;
+ uchar* const ctab = d4x4_colorset + xparam;
if (ctab[0] != 0) {
// No transparency.
for (i = 0; i < 4; ++i) {
@@ -295,10 +304,10 @@
// code, I think it's more convenient and probably just as efficient
// to let the compiler deal with wide data types, even on a 32-bit
// platform.
- auto mask = *(uint64_t*)mask_stream;
+ uint64_t mask = *(uint64_t*)mask_stream;
mask_stream += 6;
tbits = bits;
- auto const ctab = d4x4_colorset + xparam;
+ uchar* const ctab = d4x4_colorset + xparam;
if (ctab[0] != 0) {
// No transparency.
for (i = 0; i < 4; ++i) {
@@ -326,10 +335,10 @@
{
// Type 4: 4-bit index. Mask word is 64 bits, colour table has 16
// entries.
- auto mask = *(uint64_t*)mask_stream;
+ uint64_t mask = *(uint64_t*)mask_stream;
mask_stream += 8;
tbits = bits;
- auto const ctab = d4x4_colorset + xparam;
+ uchar* const ctab = d4x4_colorset + xparam;
if (ctab[0] != 0) {
// No transparency.
for (i = 0; i < 4; ++i) {
--- a/src/Libraries/AFILE/Source/huffde.cpp
+++ b/src/Libraries/AFILE/Source/huffde.cpp
@@ -35,7 +35,6 @@
//============================================================================
// Includes
-#include <string.h>
#include "lg.h"
@@ -51,7 +50,6 @@
//
// HuffExpandFlashTables() compresses huffman flash-decoder tables.
-extern "C" {
void HuffExpandFlashTables(uchar *pFlashTab, uint lenTab, uint *pc,
int tokSize)
@@ -85,4 +83,3 @@
}
}
-}
--- a/src/Libraries/AFILE/Source/movie.h
+++ b/src/Libraries/AFILE/Source/movie.h
@@ -53,7 +53,7 @@
// 3. Actual chunks, as pointed at in MovieChunk[] array
// Movie chunk format
-#pragma pack(push,1)
+#pragma pack on // 1
// FIXME bitfield and little-endian hell of madness...
/*
typedef struct {@@ -71,7 +71,12 @@
uint32_t played : 1; // has this chunk been clocked out?
uint32_t offset; // int8_t offset to chunk start
} MovieChunk;
-#pragma pack(pop)
+typedef struct {+ ubyte time[3];
+ ubyte cfp;
+ uint32_t offset; // int8_t offset to chunk start
+} DMovieChunk;
+#pragma pack off
// Movie chunk types
@@ -96,7 +101,7 @@
#define MOVIE_FTABLE_HUFFTAB 1 // huffman table (compressed)
// Movie header layout
-#pragma pack(push,1)
+#pragma pack on // 1
typedef struct {uint32_t magicId; // 'MOVI' (MOVI_MAGIC_ID)
int32_t numChunks; // number of chunks in movie
@@ -114,7 +119,7 @@
uint8_t reserved[216]; // so chunk is 1K in size
uint8_t palette[768]; // palette
} MovieHeader;
-#pragma pack(pop)
+#pragma pack off
#ifndef SAMPRATE_11KHZ // also appear in voc.h
#define SAMPRATE_11KHZ fix_make(11127, 0)
@@ -151,7 +156,7 @@
CircBuff cb; // circular data buffer
int32_t blockLen; // # bytes to read in each block
int32_t ovfLen; // # overflow bytes past circular buffer
- MovieChunk *pCurrChunk; // ptr to current chunk to use
+ DMovieChunk *pCurrChunk; // ptr to current chunk to use
int32_t bytesLeft; // bytes left to read
} MovieBuffInfo;
@@ -163,7 +168,7 @@
typedef struct Movie_ {MovieHeader *pmh; // ptr to movie header (read from 1st bytes of movie)
- MovieChunk *pmc; // ptr to movie chunk array
+ DMovieChunk *pmc; // ptr to movie chunk array
int32_t fd; // file being read from
int32_t fileOff; // offset in file to start of movie
grs_canvas *pcanvas; // ptr to canvas being played into
@@ -222,7 +227,7 @@
// 4x4 cleanup routine (frees
-void Draw4x4FreeResources();
+void Draw4x4FreeResources(void);
// Custom functions
int32_t AfilePrepareRes(Id id, Afile *afile);
--- a/src/Libraries/DSTRUCT/Source/pqueue.h
+++ b/src/Libraries/DSTRUCT/Source/pqueue.h
@@ -52,7 +52,7 @@
// Comparson function, works like strcmp
typedef int (*QueueCompare)(void* elem1, void* elem2);
-#pragma pack(push,2)
+#pragma pack on // 2
typedef struct _pqueue
{int32_t size;
@@ -96,6 +96,6 @@
// Globals
-#pragma pack(pop)
+#pragma pack off
#endif // __PQUEUE_H
--- a/src/Libraries/EDMS/Source/MODELS/d_f_2.cc
+++ b/src/Libraries/EDMS/Source/MODELS/d_f_2.cc
@@ -28,36 +28,42 @@
// Utilities...
// ============
-static Q n = 0, r = 0, e = 0, mag = 0, roll_delta = 0, kappa = 0, delta = 0, sin_wheel, cos_wheel;
+static fix n = 0, r = 0, e = 0, mag = 0, roll_delta = 0, kappa = 0, delta = 0, sin_wheel, cos_wheel;
-static Q X[3], XD[3], Z[3], FW[3], D[3];
+static fix X[3], XD[3], Z[3], FW[3], D[3];
int32_t counter, dummy1, dummy2;
// Orientation...
// --------------
-static Q e0, e1, e2, e3, ed0, ed1, ed2, ed3;
+static fix e0, e1, e2, e3, ed0, ed1, ed2, ed3;
// Terrain returns...
// ------------------
-static Q B_C_return[3];
-static Q BC_test = 0;
+static fix B_C_return[3];
+static fix BC_test = 0;
// Go for it, just go for it!
// ==========================
-void dirac_mechanicals(int object, Q F[3], Q T[3]) {+void dirac_mechanicals(int object, fix F[3], fix T[3]) {- void mech_globalize(Q &, Q &, Q &), mech_localize(Q &, Q &, Q &);
+ void mech_globalize(fix *, fix *, fix *), mech_localize(fix *, fix *, fix *);
- void get_boundary_conditions(int32_t object, Q raduis, Q position[3], Q derivitaves[3]);
+ void get_boundary_conditions(int32_t object, fix raduis, fix position[3], fix derivitaves[3]);
- Q kappa, delta, mechanical_drag;
+ fix t, kappa, delta, mechanical_drag;
- Q *sc;
+ fix *sc;
// The points in question, note that the 4th column is steerage...
// ===============================================================
- Q structure[6][4] = {{0, 0, 0, 0}, {0, .1, 0, 0}, {-.1, 0, 0, 0}, {0, -.1, 0, 0}, {0, 0, .1, 0}, {0, 0, -.1, 0}};+ fix structure[6][4];
+ memset(structure, 0, sizeof structure);
+ structure[1][1] = fix_from_float(.1);
+ structure[2][0] = fix_from_float(-.1);
+ structure[3][1] = fix_from_float(-.1);
+ structure[4][2] = fix_from_float(.1);
+ structure[5][2] = fix_from_float(-1.);
// Get the orientation...
// ----------------------
@@ -72,13 +78,16 @@
// From the actual model...
// ------------------------
- Q beta_dot = 2 * (e0 * ed1 + e3 * ed2 - e2 * ed3 - e1 * ed0);
- Q alpha_dot = 2 * (-e3 * ed1 + e0 * ed2 + e1 * ed3 - e2 * ed0);
- Q gamma_dot = 2 * (e2 * ed1 - e1 * ed2 + e0 * ed3 - e3 * ed0);
+ t = fix_mul(e0, ed1) + fix_mul(e3, ed2) - fix_mul(e2, ed3) - fix_mul(e1, ed0);
+ fix beta_dot = fix_mul(fix_make(2, 0), t);
+ t = fix_mul(-e3, ed1) + fix_mul(e0, ed2) + fix_mul(e1, ed3) - fix_mul(e2, ed0);
+ fix alpha_dot = fix_mul(fix_make(2, 0), t);
+ t = fix_mul(e2, ed1) - fix_mul(e1, ed2) + fix_mul(e0, ed3) - fix_mul(e3, ed0);
+ fix gamma_dot = fix_mul(fix_make(2, 0), t);
// Steering...
// -----------
- sincos(0 /*I[object][xxx]*/, &sin_wheel, &cos_wheel);
+ fix_sincos(0 /*I[object][xxx]*/, &sin_wheel, &cos_wheel);
int32_t count = 0;
@@ -124,7 +133,7 @@
FW[1] = B_C_return[1];
FW[2] = B_C_return[2];
- mech_localize(FW[0], FW[1], FW[2]); // now local...
+ mech_localize(&FW[0], &FW[1], &FW[2]); // now local...
// Wheels or drag?
// ---------------
@@ -134,7 +143,7 @@
D[1] = 0; // roll_delta*XD[1];
D[2] = 0; // roll_delta*XD[2]; //Oleo damping...
- mech_localize(D[0], D[1], D[2]);
+ mech_localize(&D[0], &D[1], &D[2]);
// Steerable...
// ------------
@@ -168,20 +177,20 @@
if (!(ss_edms_bcd_flags & SS_BCD_CURR_ON)) { // if ( (EDMS_BCD < 10) || (EDMS_BCD > 27) ) {- if (FW[0] > 10)
- FW[0] = 10;
- if (FW[1] > 10)
- FW[1] = 10;
- if (FW[0] < -10)
- FW[0] = -10;
- if (FW[1] < -10)
- FW[1] = -10;
+ if (FW[0] > fix_make(10,0))
+ FW[0] = fix_make(10,0);
+ if (FW[1] > fix_make(10,0))
+ FW[1] = fix_make(10,0);
+ if (FW[0] < fix_make(-10,0))
+ FW[0] = fix_make(-10,0);
+ if (FW[1] < fix_make(-10,0))
+ FW[1] = fix_make(-10,0);
- T[0] += .6 * FW[0];
- T[0] *= 1 - 2 * (FW[2] <= 0);
+ T[0] += fix_mul(fix_from_float(.6), FW[0]);
+ T[0] *= FIX_UNIT - fix_mul(fix_make(2, 0), fix_make(FW[2] <= 0, 0));
- T[1] += -.5 * FW[1];
- T[1] *= 1 - 2 * (FW[2] <= 0);
+ T[1] += fix_mul(fix_from_float(-.5), FW[1]);
+ T[1] *= FIX_UNIT - fix_mul(fix_make(2, 0), fix_make(FW[2] <= 0, 0));
}
// }
@@ -188,11 +197,11 @@
// Controls...
// -----------
- F[0] += (1 - BC_test) * I[object][0]; // Control inputs...
+ F[0] += fix_mul(FIX_UNIT - BC_test, I[object][0]); // Control inputs...
T[0] += I[object][1]; // - .1*FW[1];
- T[1] += -1.5 * gamma_dot + I[object][3]; // + .1*FW[0];
- T[2] += -.8 * I[object][2];
+ T[1] += fix_mul(fix_from_float(-1.5), gamma_dot) + I[object][3]; // + .1*FW[0];
+ T[2] += fix_mul(fix_from_float(-.8), I[object][2]);
// So be it...
// ===========
@@ -202,39 +211,69 @@
// coordinaates, a simple rotation. The order is left up to this routine
// which MODIFIES ITS ARGUMENTS...
// ===============================
-void mech_globalize(Q &X, Q &Y, Q &Z) {+void mech_globalize(fix *X, fix *Y, fix *Z) {- Q x = X, y = Y, z = Z;
+ fix x = *X, y = *Y, z = *Z, fx, fy, fz;
- X = x * (e0 * e0 + e1 * e1 - e2 * e2 - e3 * e3) + y * (2 * (e1 * e2 - e0 * e3)) + z * (2 * (e1 * e3 + e0 * e2));
+ fx = fix_mul(e0, e0) + fix_mul(e1, e1) - fix_mul(e2, e2) - fix_mul(e3, e3);
+ fy = fix_mul(e1, e2) - fix_mul(e0, e3);
+ fy = fix_mul(fix_make(2, 0), fy);
+ fz = fix_mul(e1, e3) + fix_mul(e0, e2);
+ fz = fix_mul(fix_make(2, 0), fz);
+ *X = fix_mul(x, fx) + fix_mul(y, fy) + fix_mul(z, fz);
- Y = x * (2 * (e1 * e2 + e0 * e3)) + y * (e0 * e0 - e1 * e1 + e2 * e2 - e3 * e3) + z * (2 * (e2 * e3 - e0 * e1));
+ fx = fix_mul(e1, e2) + fix_mul(e0, e3);
+ fx = fix_mul(fix_make(2, 0), fx);
+ fy = fix_mul(e0, e0) - fix_mul(e1, e1) + fix_mul(e2, e2) - fix_mul(e3, e3);
+ fz = fix_mul(e2, e3) - fix_mul(e0, e1);
+ fz = fix_mul(fix_make(2, 0), fz);
+ *Y = fix_mul(x, fx) + fix_mul(y, fy) + fix_mul(z, fz);
- Z = x * (2 * (-e0 * e2 + e1 * e3)) + y * (2 * (e2 * e3 + e0 * e1)) + z * (e0 * e0 - e1 * e1 - e2 * e2 + e3 * e3);
+ fx = fix_mul(-e0, e2) + fix_mul(e1, e3);
+ fx = fix_mul(fix_make(2, 0), fx);
+ fy = fix_mul(e2, e3) + fix_mul(e0, e1);
+ fy = fix_mul(fix_make(2, 0), fy);
+ fz = fix_mul(e0, e0) - fix_mul(e1, e1) - fix_mul(e2, e2) + fix_mul(e3, e3);
+ *Z = fix_mul(x, fx) + fix_mul(y, fy) + fix_mul(z, fz);
}
// We need to transform from local coordinates back to the global coordinates
// for the actual EDMS model...
// ============================
-void mech_localize(Q &X, Q &Y, Q &Z) {+void mech_localize(fix *X, fix *Y, fix *Z) {- Q x = X, y = Y, z = Z;
+ fix x = *X, y = *Y, z = *Z, fx, fy, fz;
- X = x * (e0 * e0 + e1 * e1 - e2 * e2 - e3 * e3) + y * (2 * (e1 * e2 + e0 * e3)) + z * (2 * (e1 * e3 - e0 * e2));
+ fx = fix_mul(e0, e0) + fix_mul(e1, e1) - fix_mul(e2, e2) - fix_mul(e3, e3);
+ fy = fix_mul(e1, e2) + fix_mul(e0, e3);
+ fy = fix_mul(fix_make(2, 0), fy);
+ fz = fix_mul(e1, e3) - fix_mul(e0, e2);
+ fz = fix_mul(fix_make(2, 0), fz);
+ *X = fix_mul(x, fx) + fix_mul(y, fy) + fix_mul(z, fz);
- Y = x * (2 * (e1 * e2 - e0 * e3)) + y * (e0 * e0 - e1 * e1 + e2 * e2 - e3 * e3) + z * (2 * (e2 * e3 + e0 * e1));
+ fx = fix_mul(e1, e2) - fix_mul(e0, e3);
+ fx = fix_mul(fix_make(2, 0), fx);
+ fy = fix_mul(e0, e0) - fix_mul(e1, e1) + fix_mul(e2, e2) - fix_mul(e3, e3);
+ fz = fix_mul(e2, e3) + fix_mul(e0, e1);
+ fz = fix_mul(fix_make(2, 0), fz);
+ *Y = fix_mul(x, fx) + fix_mul(y, fy) + fix_mul(z, fz);
- Z = x * (2 * (e0 * e2 + e1 * e3)) + y * (2 * (e2 * e3 - e0 * e1)) + z * (e0 * e0 - e1 * e1 - e2 * e2 + e3 * e3);
+ fx = fix_mul(e0, e2) + fix_mul(e1, e3);
+ fx = fix_mul(fix_make(2, 0), fx);
+ fy = fix_mul(e2, e3) - fix_mul(e0, e1);
+ fy = fix_mul(fix_make(2, 0), fy);
+ fz = fix_mul(e0, e0) - fix_mul(e1, e1) - fix_mul(e2, e2) + fix_mul(e3, e3);
+ *Z = fix_mul(x, fx) + fix_mul(y, fy) + fix_mul(z, fz);
}
// Get the Real story based on the novella (System shock version), returning
// the result in the B_C_return[3] and BC_test global variables...
// ==============================================================
-void get_boundary_conditions(int object, Q radius, Q position[3], Q derivatives[3]) {+void get_boundary_conditions(int object, fix radius, fix position[3], fix derivatives[3]) {// Schmeck...
// ----------
- Q vec0, vec1, vec2, mul, vv0, vv1, vv2, dmag, kmag;
+ fix vec0, vec1, vec2, mul, vv0, vv1, vv2, dmag, kmag;
// if (position[0] != A[object][0][0] ) mout << position[0] << " : " << A[object][0][0] << "\n";
// if (position[1] != A[object][0][1] ) mout << position[1] << " : " << A[object][1][0] << "\n";
@@ -251,15 +290,15 @@
// Convert-a-tron...
// -----------------
- vec0.fix_to(terrain_info.fx + terrain_info.cx + terrain_info.wx);
- vec1.fix_to(terrain_info.fy + terrain_info.cy + terrain_info.wy);
- vec2.fix_to(terrain_info.fz + terrain_info.cz + terrain_info.wz);
+ vec0 = terrain_info.fx + terrain_info.cx + terrain_info.wx;
+ vec1 = terrain_info.fy + terrain_info.cy + terrain_info.wy;
+ vec2 = terrain_info.fz + terrain_info.cz + terrain_info.wz;
- BC_test = sqrt(vec0 * vec0 + vec1 * vec1 + vec2 * vec2);
+ BC_test = fix_sqrt(fix_mul(vec0, vec0) + fix_mul(vec1, vec1) + fix_mul(vec2, vec2));
if (BC_test > EDMS_DIV_ZERO_TOLERANCE) {- mul = 1 / BC_test; // To get primitive...
- BC_test = 1;
+ mul = fix_div(FIX_UNIT, BC_test); // To get primitive...
+ BC_test = FIX_UNIT;
}
else
@@ -267,26 +306,27 @@
// mout << BC_test << "\n";
- vv0 = mul * vec0; // The primitive V_n...
- vv1 = mul * vec1;
- vv2 = mul * vec2;
+ vv0 = fix_mul(mul, vec0); // The primitive V_n...
+ vv1 = fix_mul(mul, vec1);
+ vv2 = fix_mul(mul, vec2);
// "rate" magnitude to all you aero-astro guys...
// ----------------------------------------------
- dmag = I[object][24] * (derivatives[0] * vv0 // Delta_magnitude...
- + derivatives[1] * vv1 + derivatives[2] * vv2);
+ dmag = fix_mul(I[object][24], (fix_mul(derivatives[0], vv0) // Delta_magnitude...
+ + fix_mul(derivatives[1], vv1)
+ + fix_mul(derivatives[2], vv2)));
// PRINT3D( derivatives );
- B_C_return[0] = -dmag * vv0; // Delta...
- B_C_return[1] = -dmag * vv1;
- B_C_return[2] = -dmag * vv2;
+ B_C_return[0] = -fix_mul(dmag, vv0); // Delta...
+ B_C_return[1] = -fix_mul(dmag, vv1);
+ B_C_return[2] = -fix_mul(dmag, vv2);
kmag = I[object][23];
- B_C_return[0] += kmag * vec0; // Kappa...
- B_C_return[1] += kmag * vec1;
- B_C_return[2] += kmag * vec2;
+ B_C_return[0] += fix_mul(kmag, vec0); // Kappa...
+ B_C_return[1] += fix_mul(kmag, vec1);
+ B_C_return[2] += fix_mul(kmag, vec2);
// PRINT3D( B_C_return )
}
--- a/src/Libraries/EDMS/Source/MODELS/d_f_face.cc
+++ b/src/Libraries/EDMS/Source/MODELS/d_f_face.cc
@@ -57,16 +57,12 @@
// Hack hack hack...
// =================
-static Q size = .3;
+static fix size = fix_from_float(.3);
// Thank God we have only 16 bits of fraction!
// ===========================================
-static Q old_state[7], new_state[7];
+static fix old_state[7], new_state[7];
-// We need to link to c...
-// =======================
-extern "C" {-
// Here are the bridge routines to the models...
// =============================================
@@ -76,43 +72,44 @@
// Variables for tha actual conversion...
// --------------------------------------
- Q params[10], init_state[6][3];
+ fix params[10], init_state[6][3];
- Q mass, hardness, gravity, roughness;
+ fix mass, hardness, gravity, roughness;
int32_t on = 0;
physics_handle ph = 0;
- init_state[0][0].fix_to(s->X);
- init_state[0][1].fix_to(s->X_dot);
- init_state[1][0].fix_to(s->Y);
- init_state[1][1].fix_to(s->Y_dot);
- init_state[2][0].fix_to(s->Z);
- init_state[2][1].fix_to(s->Z_dot);
- init_state[3][0].fix_to(s->alpha);
- init_state[3][1].fix_to(s->alpha_dot);
- init_state[4][0].fix_to(s->beta);
- init_state[4][1].fix_to(s->beta_dot);
- init_state[5][0].fix_to(s->gamma);
- init_state[5][1].fix_to(s->gamma_dot);
+ init_state[0][0] = s->X;
+ init_state[0][1] = s->X_dot;
+ init_state[1][0] = s->Y;
+ init_state[1][1] = s->Y_dot;
+ init_state[2][0] = s->Z;
+ init_state[2][1] = s->Z_dot;
+ init_state[3][0] = s->alpha;
+ init_state[3][1] = s->alpha_dot;
+ init_state[4][0] = s->beta;
+ init_state[4][1] = s->beta_dot;
+ init_state[5][0] = s->gamma;
+ init_state[5][1] = s->gamma_dot;
- mass.fix_to(d->mass);
- roughness.fix_to(d->roughness);
- hardness.fix_to(d->hardness);
- gravity.fix_to(d->gravity);
+ mass = d->mass;
+ roughness = d->roughness;
+ hardness = d->hardness;
+ gravity = d->gravity;
// hardness = hardness*(mass*4/size);
- hardness = hardness * (mass * DIRAC_HARD_FAC / size); // Node Size goes here!!!
+ hardness = fix_mul(hardness, fix_mul_div(mass, DIRAC_HARD_FAC, size)); // Node Size goes here!!!
params[0] = mass;
- params[1] = 1 / mass;
- params[2] = 1 / (.4 * mass * size * size);
+ params[1] = fix_div(FIX_UNIT, mass);
+ params[2] = fix_div(FIX_UNIT,
+ fix_mul(fix_mul(fix_mul(fix_from_float(.4), mass), size), size));
params[3] = hardness;
- params[4] = sqrt(params[3]) * sqrt(mass);
+ params[4] = fix_mul(fix_sqrt(params[3]), fix_sqrt(mass));
// params[4] = 20*sqrt( params[0] * mass );
params[5] = roughness;
- params[6] = .2;
+ params[6] = fix_from_float(.2);
params[7] = 0; // gravity;
params[8] = 0;
params[9] = 0;
@@ -131,17 +128,16 @@
// For getting the new basis...
// ----------------------------
- // void render_globalize( Q &X, Q &Y, Q &Z, int );
- void render_localize(Q & X, Q & Y, Q & Z, int);
+ void render_localize(fix *X, fix *Y, fix *Z, int);
// For Euler angle conversion...
// -----------------------------
- Q dirac_temp[9];
- Q alpha, beta, gamma;
+ fix dirac_temp[9];
+ fix alpha, beta, gamma;
int32_t on = ph2on[ph];
- Q delta = 0;
+ fix delta = 0;
if (I[on][30] == D_FRAME) {@@ -154,15 +150,15 @@
new_state[5] = S[on][5][0];
new_state[6] = S[on][6][0];
- delta = (new_state[0] - old_state[0]) * (new_state[0] - old_state[0]) +
- (new_state[1] - old_state[1]) * (new_state[1] - old_state[1]) +
- (new_state[2] - old_state[2]) * (new_state[2] - old_state[2]) +
- (new_state[3] - old_state[3]) * (new_state[3] - old_state[3]) +
- (new_state[4] - old_state[4]) * (new_state[4] - old_state[4]) +
- (new_state[5] - old_state[5]) * (new_state[5] - old_state[5]) +
- (new_state[6] - old_state[6]) * (new_state[6] - old_state[6]);
+ delta += fix_mul(new_state[0] - old_state[0], new_state[0] - old_state[0]);
+ delta += fix_mul(new_state[1] - old_state[1], new_state[1] - old_state[1]);
+ delta += fix_mul(new_state[2] - old_state[2], new_state[2] - old_state[2]);
+ delta += fix_mul(new_state[3] - old_state[3], new_state[3] - old_state[3]);
+ delta += fix_mul(new_state[4] - old_state[4], new_state[4] - old_state[4]);
+ delta += fix_mul(new_state[5] - old_state[5], new_state[5] - old_state[5]);
+ delta += fix_mul(new_state[6] - old_state[6], new_state[6] - old_state[6]);
- if (delta > .00003) {+ if (delta > fix_from_float(.00003)) {old_state[0] = new_state[0];
old_state[1] = new_state[1];
@@ -174,15 +170,15 @@
old_state[6] = new_state[6];
}
- s->X = old_state[0].to_fix();
- s->Y = old_state[1].to_fix();
- s->Z = old_state[2].to_fix();
+ s->X = old_state[0];
+ s->Y = old_state[1];
+ s->Z = old_state[2];
- EDMS_get_Euler_angles(alpha, beta, gamma, on);
+ EDMS_get_Euler_angles(&alpha, &beta, &gamma, on);
- s->alpha = -gamma.to_fix();
- s->beta = -alpha.to_fix();
- s->gamma = -beta.to_fix();
+ s->alpha = -gamma;
+ s->beta = -alpha;
+ s->gamma = -beta;
// Set up global vectors...
// ------------------------
@@ -189,52 +185,52 @@
dirac_temp[0] = dirac_temp[1] = dirac_temp[2] = dirac_temp[3] = dirac_temp[4] = dirac_temp[5] = dirac_temp[6] =
dirac_temp[7] = dirac_temp[8] = 0;
- dirac_temp[0] = 1;
- dirac_temp[4] = 1;
- dirac_temp[8] = 1;
+ dirac_temp[0] = FIX_UNIT;
+ dirac_temp[4] = FIX_UNIT;
+ dirac_temp[8] = FIX_UNIT;
// Transform to the new basis...
// -----------------------------
- render_localize(dirac_temp[0], dirac_temp[1], dirac_temp[2], on);
- render_localize(dirac_temp[3], dirac_temp[4], dirac_temp[5], on);
- render_localize(dirac_temp[6], dirac_temp[7], dirac_temp[8], on);
+ render_localize(&dirac_temp[0], &dirac_temp[1], &dirac_temp[2], on);
+ render_localize(&dirac_temp[3], &dirac_temp[4], &dirac_temp[5], on);
+ render_localize(&dirac_temp[6], &dirac_temp[7], &dirac_temp[8], on);
// Stuff into Matt's order...
// --------------------------
/*
- Dirac_basis[0] = dirac_temp[0].to_fix();
- Dirac_basis[1] =-dirac_temp[6].to_fix();
- Dirac_basis[2] = dirac_temp[3].to_fix();
- Dirac_basis[3] =-dirac_temp[2].to_fix();
- Dirac_basis[4] = dirac_temp[8].to_fix();
- Dirac_basis[5] =-dirac_temp[5].to_fix();
- Dirac_basis[6] = dirac_temp[1].to_fix();
- Dirac_basis[7] =-dirac_temp[7].to_fix();
- Dirac_basis[8] = dirac_temp[4].to_fix();
+ Dirac_basis[0] = dirac_temp[0];
+ Dirac_basis[1] =-dirac_temp[6];
+ Dirac_basis[2] = dirac_temp[3];
+ Dirac_basis[3] =-dirac_temp[2];
+ Dirac_basis[4] = dirac_temp[8];
+ Dirac_basis[5] =-dirac_temp[5];
+ Dirac_basis[6] = dirac_temp[1];
+ Dirac_basis[7] =-dirac_temp[7];
+ Dirac_basis[8] = dirac_temp[4];
*/
// Almost...
/*
- Dirac_basis[0] = dirac_temp[3].to_fix();
- Dirac_basis[1] =-dirac_temp[6].to_fix();
- Dirac_basis[2] =-dirac_temp[0].to_fix();
- Dirac_basis[3] =-dirac_temp[5].to_fix();
- Dirac_basis[4] = dirac_temp[8].to_fix();
- Dirac_basis[5] = dirac_temp[2].to_fix();
- Dirac_basis[6] = dirac_temp[4].to_fix();
- Dirac_basis[7] =-dirac_temp[7].to_fix();
- Dirac_basis[8] =-dirac_temp[1].to_fix();
+ Dirac_basis[0] = dirac_temp[3];
+ Dirac_basis[1] =-dirac_temp[6];
+ Dirac_basis[2] =-dirac_temp[0];
+ Dirac_basis[3] =-dirac_temp[5];
+ Dirac_basis[4] = dirac_temp[8];
+ Dirac_basis[5] = dirac_temp[2];
+ Dirac_basis[6] = dirac_temp[4];
+ Dirac_basis[7] =-dirac_temp[7];
+ Dirac_basis[8] =-dirac_temp[1];
*/
- Dirac_basis[0] = -dirac_temp[3].to_fix();
- Dirac_basis[1] = -dirac_temp[6].to_fix();
- Dirac_basis[2] = dirac_temp[0].to_fix();
- Dirac_basis[3] = dirac_temp[5].to_fix();
- Dirac_basis[4] = dirac_temp[8].to_fix();
- Dirac_basis[5] = -dirac_temp[2].to_fix();
- Dirac_basis[6] = -dirac_temp[4].to_fix();
- Dirac_basis[7] = -dirac_temp[7].to_fix();
- Dirac_basis[8] = dirac_temp[1].to_fix();
+ Dirac_basis[0] = -dirac_temp[3];
+ Dirac_basis[1] = -dirac_temp[6];
+ Dirac_basis[2] = dirac_temp[0];
+ Dirac_basis[3] = dirac_temp[5];
+ Dirac_basis[4] = dirac_temp[8];
+ Dirac_basis[5] = -dirac_temp[2];
+ Dirac_basis[6] = -dirac_temp[4];
+ Dirac_basis[7] = -dirac_temp[7];
+ Dirac_basis[8] = dirac_temp[1];
} // End of check for Dirac_frame or not...
}
@@ -243,24 +239,25 @@
// ==================================
void EDMS_set_Dirac_frame_parameters(physics_handle ph, Dirac_frame *d) {- Q mass, hardness, roughness, gravity;
+ fix mass, hardness, roughness, gravity;
- mass.fix_to(d->mass);
- hardness.fix_to(d->hardness);
- gravity.fix_to(d->gravity);
- roughness.fix_to(d->roughness);
+ mass = d->mass;
+ hardness = d->hardness;
+ gravity = d->gravity;
+ roughness = d->roughness;
int32_t on = physics_handle_to_object_number(ph);
- hardness = hardness * (mass * DIRAC_HARD_FAC / size);
+ hardness = fix_mul(hardness, fix_mul_div(mass, DIRAC_HARD_FAC, size));
I[on][20] = mass;
- I[on][21] = 1 / mass;
- I[on][22] = 1 / (.4 * mass * size * size);
+ I[on][21] = fix_div(FIX_UNIT, mass);
+ I[on][22] = fix_div(FIX_UNIT,
+ fix_mul(fix_mul(fix_mul(fix_from_float(.4), mass), size), size));
I[on][23] = hardness;
- I[on][24] = sqrt(I[on][23]) * sqrt(mass);
+ I[on][24] = fix_mul(fix_sqrt(I[on][23]), fix_sqrt(mass));
// I[on][24] = 20*sqrt( I[on][20] * mass );
I[on][25] = roughness;
- I[on][26] = .2;
+ I[on][26] = fix_from_float(.2);
I[on][27] = 0; // gravity;
I[on][28] = 0;
I[on][29] = 0;
@@ -274,10 +271,10 @@
void EDMS_get_Dirac_frame_parameters(physics_handle ph, Dirac_frame *d) {int32_t on = physics_handle_to_object_number(ph);
- d->roughness = (I[on][23] / I[on][26]).to_fix();
- d->hardness = (I[on][26] / I[on][20] * DIRAC_HARD_FAC).to_fix();
- d->mass = I[on][20].to_fix();
- d->gravity = I[on][27].to_fix();
+ d->roughness = fix_div(I[on][23], I[on][26]);
+ d->hardness = fix_mul(fix_div(I[on][26], I[on][20]), DIRAC_HARD_FAC);
+ d->mass = I[on][20];
+ d->gravity = I[on][27];
}
void EDMS_control_Dirac_frame(physics_handle ph, fix forward, fix pitch, fix yaw, fix roll) {@@ -284,15 +281,15 @@
int32_t on = ph2on[ph];
- Q F, P, Y, R;
+ fix F, P, Y, R;
- F.fix_to(forward);
+ F = forward;
// System shock angle order, definition...
// =======================================
- R.fix_to(roll);
- P.fix_to(yaw);
- Y.fix_to(pitch);
+ R = roll;
+ P = yaw;
+ Y = pitch;
Y = -Y;
control_dirac_frame(on, F, P, Y, R);
@@ -303,11 +300,11 @@
return Dirac_basis;
}
-void render_localize(Q &X, Q &Y, Q &Z, int32_t object) {+void render_localize(fix *X, fix *Y, fix *Z, int32_t object) {- Q e0, e1, e2, e3;
+ fix e0, e1, e2, e3, fx, fy, fz;
- Q x = X, y = Y, z = Z;
+ fix x = *X, y = *Y, z = *Z;
e0 = S[object][3][0];
e1 = S[object][4][0];
@@ -316,11 +313,24 @@
// Go for it, sonny...
// -------------------
- X = x * (e0 * e0 + e1 * e1 - e2 * e2 - e3 * e3) + y * (2 * (e1 * e2 - e0 * e3)) + z * (2 * (e1 * e3 + e0 * e2));
+ fx = fix_mul(e0, e0) + fix_mul(e1, e1) - fix_mul(e2, e2) - fix_mul(e3, e3);
+ fy = fix_mul(e1, e2) - fix_mul(e0, e3);
+ fy = fix_mul(fix_make(2, 0), fy);
+ fz = fix_mul(e1, e3) + fix_mul(e0, e2);
+ fz = fix_mul(fix_make(2, 0), fz);
+ *X = fix_mul(x, fx) + fix_mul(y, fy) + fix_mul(z, fz);
- Y = x * (2 * (e1 * e2 + e0 * e3)) + y * (e0 * e0 - e1 * e1 + e2 * e2 - e3 * e3) + z * (2 * (e2 * e3 - e0 * e1));
+ fx = fix_mul(e1, e2) + fix_mul(e0, e3);
+ fx = fix_mul(fix_make(2, 0), fx);
+ fy = fix_mul(e0, e0) - fix_mul(e1, e1) + fix_mul(e2, e2) - fix_mul(e3, e3);
+ fz = fix_mul(e2, e3) - fix_mul(e0, e1);
+ fz = fix_mul(fix_make(2, 0), fz);
+ *Y = fix_mul(x, fx) + fix_mul(y, fy) + fix_mul(z, fz);
- Z = x * (2 * (-e0 * e2 + e1 * e3)) + y * (2 * (e2 * e3 + e0 * e1)) + z * (e0 * e0 - e1 * e1 - e2 * e2 + e3 * e3);
+ fx = fix_mul(-e0, e2) + fix_mul(e1, e3);
+ fx = fix_mul(fix_make(2, 0), fx);
+ fy = fix_mul(e2, e3) + fix_mul(e0, e1);
+ fy = fix_mul(fix_make(2, 0), fy);
+ fz = fix_mul(e0, e0) - fix_mul(e1, e1) - fix_mul(e2, e2) + fix_mul(e3, e3);
+ *Z = fix_mul(x, fx) + fix_mul(y, fy) + fix_mul(z, fz);
}
-
-} // End of Extern "C"...
--- a/src/Libraries/EDMS/Source/MODELS/d_frame.cc
+++ b/src/Libraries/EDMS/Source/MODELS/d_frame.cc
@@ -47,12 +47,12 @@
// Here's the real work...
// -----------------------
extern void dirac_mechanicals(int32_t object, Q F[3], Q T[3]);
- extern void shall_we_dance(int32_t object, Q &result0, Q &result1, Q &result2);
+ extern void shall_we_dance(int32_t object, Q *result0, Q *result1, Q *result2);
// For alignment...
// ----------------
- extern void mech_localize(Q &X, Q &Y, Q &Z);
- extern void mech_globalize(Q &X, Q &Y, Q &Z);
+ extern void mech_localize(Q *X, Q *Y, Q *Z);
+ extern void mech_globalize(Q *X, Q *Y, Q *Z);
Q F_T[3];
Q e0, e1, e2, e3, // For speed plus beauty!
@@ -83,7 +83,7 @@
// Are we hitting anything yet?
// ----------------------------
- shall_we_dance(object, collide_x, collide_y, collide_z);
+ shall_we_dance(object, &collide_x, &collide_y, &collide_z);
F[0] += collide_x * I[object][23];
F[1] += collide_y * I[object][23];
F[2] += collide_z * I[object][23];
@@ -121,7 +121,7 @@
// Auto alignment...
// -----------------
- mech_localize(F_T[0], F_T[1], F_T[2]);
+ mech_localize(&F_T[0], &F_T[1], &F_T[2]);
if (I[object][2] == 0)
T[2] += EDMS_CYBER_CURRENT_ALIGN * F_T[1];
if (I[object][1] == 0)
@@ -138,7 +138,7 @@
// Jeeeeeezuz...
// -------------
- mech_globalize(F[0], F[1], F[2]);
+ mech_globalize(&F[0], &F[1], &F[2]);
// mout << F[2] << "\n";
@@ -222,9 +222,9 @@
// Zeros...
// --------
- sincos(.5 * init_state[3][0], &sin_alpha, &cos_alpha);
- sincos(.5 * init_state[4][0], &sin_beta, &cos_beta);
- sincos(.5 * init_state[5][0], &sin_gamma, &cos_gamma);
+ q_sincos(.5 * init_state[3][0], &sin_alpha, &cos_alpha);
+ q_sincos(.5 * init_state[4][0], &sin_beta, &cos_beta);
+ q_sincos(.5 * init_state[5][0], &sin_gamma, &cos_gamma);
S[object_number][3][0] = A[object_number][3][0] =
cos_gamma * cos_alpha * cos_beta + sin_gamma * sin_alpha * sin_beta;
@@ -285,7 +285,7 @@
I[object_number][31] = I[object_number][26];
I[object_number][32] = I[object_number][33] = I[object_number][34] = I[object_number][35] = 0;
I[object_number][36] = I[object_number][26]; // Shrugoff "mass"...
- I[object_number][IDOF_COLLIDE] = -1;
+ I[object_number][IDOF_COLLIDE] = fix_make(-1,0);
I[object_number][IDOF_AUTODESTRUCT] = 0; // No kill I...
// Zero the controls...
--- a/src/Libraries/EDMS/Source/MODELS/d_frame.h
+++ b/src/Libraries/EDMS/Source/MODELS/d_frame.h
@@ -18,5 +18,5 @@
*/
// This seems silly now, but later it will all make sense, sensei...
// =================================================================
-int32_t make_Dirac_frame(Q init_state[6][3], Q params[10]);
-void control_dirac_frame(int32_t object, Q forward, Q pitch, Q yaw, Q roll);
+int32_t make_Dirac_frame(fix init_state[6][3], fix params[10]);
+void control_dirac_frame(int32_t object, fix forward, fix pitch, fix yaw, fix roll);
--- a/src/Libraries/EDMS/Source/MODELS/ftl.cc
+++ b/src/Libraries/EDMS/Source/MODELS/ftl.cc
@@ -44,7 +44,7 @@
extern int32_t alarm_clock[MAX_OBJ];
physics_handle object_check(uint32_t data_word, Q size, Q range, int32_t exclude, int32_t steps,
- Q &dist); // Checks for hits...
+ Q *dist); // Checks for hits...
// Here is the high velocity weapon primitive...
// =============================================
@@ -51,7 +51,7 @@
physics_handle EDMS_cast_projectile(Q *X, Q D[3], Q kick, Q knock, Q size, Q range, int32_t exclude, int32_t shooter) {extern Q PELVIS;
int32_t stepper = 0,
- max_step = (2 * range / size).to_int(), // samples per meter...
+ max_step = q_to_int(2 * range / size), // samples per meter...
victim_on = 0, shooter_on = 0, object_pointer = 0, i = 0;
uint32_t must_check_objects[MAX_OBJ];
@@ -177,7 +177,7 @@
// Now we're done following the ray.
for (i = 0; i < object_pointer; i++) {- victim = object_check(must_check_objects[i], size, range, exclude, stepper, dist);
+ victim = object_check(must_check_objects[i], size, range, exclude, stepper, &dist);
if (victim != -1) {// We hit someone!
@@ -282,7 +282,7 @@
// Here, since we know the line segment we're interested in, we check to make sure that we
// didn't hit any objects, and return the one we did...
// ====================================================
-physics_handle object_check(uint32_t data_word, Q size, Q range, int32_t exclude, int32_t stepper, Q &dist) {+physics_handle object_check(uint32_t data_word, Q size, Q range, int32_t exclude, int32_t stepper, Q *dist) {// General purpose...
// ==================
int32_t object;
@@ -321,7 +321,7 @@
if ((kzdist < .5 * size * stepper) && (kzdist < kzdisto)) {victim = on2ph[object];
kzdisto = kzdist;
- dist = kzdist - I[object][31];
+ *dist = kzdist - I[object][31];
// X[0] = S[object][0][0]; //Provide hit location, naive for
//now... X[1] = S[object][1][0]; X[2] = S[object][2][0];
@@ -342,7 +342,7 @@
Q final_x = 0, final_y = 0;
- sincos(-S[object][3][0], &sin_alpha, &cos_alpha);
+ q_sincos(-S[object][3][0], &sin_alpha, &cos_alpha);
final_x = cos_alpha * offset_x + sin_alpha * offset_y;
final_y = -sin_alpha * offset_x + cos_alpha * offset_y;
@@ -373,7 +373,7 @@
if ((kzdist < .5 * size * stepper) && (kzdist < kzdisto)) {victim = on2ph[object];
kzdisto = kzdist;
- dist = kzdist - I[object][31];
+ *dist = kzdist - I[object][31];
}
}
--- a/src/Libraries/EDMS/Source/MODELS/ftl.h
+++ b/src/Libraries/EDMS/Source/MODELS/ftl.h
@@ -18,4 +18,4 @@
*/
// This seems silly now, but later it will all make sense, sensei...
// =================================================================
-int32_t EDMS_cast_projectile(Q *X, Q D[3], Q kick, Q knock, Q size, Q range, int32_t exclude, physics_handle shooter);
+int32_t EDMS_cast_projectile(fix *X, fix D[3], fix kick, fix knock, fix size, fix range, int32_t exclude, physics_handle shooter);
--- a/src/Libraries/EDMS/Source/MODELS/ftlface.cc
+++ b/src/Libraries/EDMS/Source/MODELS/ftlface.cc
@@ -37,16 +37,12 @@
// Data...
// =======
extern EDMS_Argblock_Pointer A;
-extern Q S[MAX_OBJ][7][4], I[MAX_OBJ][DOF_MAX];
+extern fix S[MAX_OBJ][7][4], I[MAX_OBJ][DOF_MAX];
// Structs...
// ==========
// Nope.
-// We need to link to c...
-// =======================
-extern "C" {-
// Here are the bridge routines to the models...
// =============================================
@@ -60,20 +56,20 @@
physics_handle ph = -1;
int32_t EXCLUDE = 0;
- Q DD[3];
+ fix DD[3];
- Q Kick, Knock, Size, Range;
+ fix Kick, Knock, Size, Range;
- Q *XX = (Q *)&X[0];
+ fix *XX = (fix *)&X[0];
- DD[0].fix_to(D[0]);
- DD[1].fix_to(D[1]);
- DD[2].fix_to(D[2]);
+ DD[0] = D[0];
+ DD[1] = D[1];
+ DD[2] = D[2];
- Kick.fix_to(kick);
- Knock.fix_to(knock);
- Size.fix_to(size);
- Range.fix_to(range);
+ Kick = kick;
+ Knock = knock;
+ Size = size;
+ Range = range;
// Is this a valid physics handle???
// =================================
@@ -83,17 +79,17 @@
// Do it...
// ========
- ph = EDMS_cast_projectile(XX, DD, Kick, Knock, Size, Range, EXCLUDE, shooter);
+ ph = EDMS_cast_projectile(X, D, kick, knock, size, range, EXCLUDE, shooter);
// Convert back to the goofbakk fixpoint system...
// -----------------------------------------------
- X[0] = XX[0].to_fix();
- X[1] = XX[1].to_fix();
- X[2] = XX[2].to_fix();
+ /*
+ X[0] = XX[0];
+ X[1] = XX[1];
+ X[2] = XX[2];
+ */
// Return a physics handle...
// ==========================
return ph;
}
-
-} // End of extern "C" for the &^%$@% compiler...
--- a/src/Libraries/EDMS/Source/MODELS/pelface.cc
+++ b/src/Libraries/EDMS/Source/MODELS/pelface.cc
@@ -37,7 +37,7 @@
// Pointers to skeletons (for bipeds, as it were and will be)...
// =============================================================
-extern Q *utility_pointer[MAX_OBJ];
+extern fix *utility_pointer[MAX_OBJ];
// Pelvis...
// ---------
@@ -51,16 +51,12 @@
// Here we go...
// =============
-#define HARD_FAC 6
+#define HARD_FAC fix_make(6, 0)
// Thatnk God we have only 16 bits of fraction!
// ============================================
-Q old_state[6], new_state[6];
+fix old_state[6], new_state[6];
-// We need to link to c...
-// =======================
-extern "C" {-
// Here are the bridge routines to the models...
// =============================================
@@ -68,36 +64,36 @@
// ==================
physics_handle EDMS_make_pelvis(Pelvis *p, State *s) {- Q params[10], init_state[6][3];
+ fix params[10], init_state[6][3];
- Q mass, pep, hardness, size, gravity, height;
+ fix mass, pep, hardness, size, gravity, height;
int on = 0, cyber_space = 0;
physics_handle ph = 0;
- init_state[0][0].fix_to(s->X);
- init_state[0][1].fix_to(s->X_dot);
- init_state[1][0].fix_to(s->Y);
- init_state[1][1].fix_to(s->Y_dot);
- init_state[2][0].fix_to(s->Z);
- init_state[2][1].fix_to(s->Z_dot);
- init_state[3][0].fix_to(s->alpha);
- init_state[3][1].fix_to(s->alpha_dot);
- init_state[4][0].fix_to(s->beta);
- init_state[4][1].fix_to(s->beta_dot);
- init_state[5][0].fix_to(s->gamma);
- init_state[5][1].fix_to(s->gamma_dot);
+ init_state[0][0] = s->X;
+ init_state[0][1] = s->X_dot;
+ init_state[1][0] = s->Y;
+ init_state[1][1] = s->Y_dot;
+ init_state[2][0] = s->Z;
+ init_state[2][1] = s->Z_dot;
+ init_state[3][0] = s->alpha;
+ init_state[3][1] = s->alpha_dot;
+ init_state[4][0] = s->beta;
+ init_state[4][1] = s->beta_dot;
+ init_state[5][0] = s->gamma;
+ init_state[5][1] = s->gamma_dot;
- mass.fix_to(p->mass);
- size.fix_to(p->size);
+ mass = p->mass;
+ size = p->size;
// if ( size > .45/hash_scale ) size = .45/hash_scale;
- hardness.fix_to(p->hardness);
- pep.fix_to(p->pep);
- gravity.fix_to(p->gravity);
- height.fix_to(p->height);
- if (height > 3 * size)
- height = 3 * size;
+ hardness = p->hardness;
+ pep = p->pep;
+ gravity = p->gravity;
+ height = p->height;
+ if (height > fix_mul(fix_make(3,0), size))
+ height = fix_mul(fix_make(3,0), size);
// mout << "Pelvis: \n";
// mout << " mass: " << mass << "\n";
@@ -108,17 +104,17 @@
// mout << " hght: " << height << "\n";
// hardness = hardness*(mass*4/size);
- hardness = hardness * (mass * HARD_FAC / size);
+ hardness = fix_mul(hardness, fix_mul_div(mass, HARD_FAC, size));
params[0] = hardness;
- params[1] = 3 * sqrt(params[0] * mass);
+ params[1] = fix_mul(fix_make(3,0), fix_sqrt(fix_mul(params[0], mass))); /* FIXME: EINVAL in sqrt */
params[2] = size;
- params[3] = pep * mass;
- params[4] = 1. / mass;
+ params[3] = fix_mul(pep, mass);
+ params[4] = fix_div(fix_from_float(1.), mass);
params[5] = gravity;
params[6] = mass;
- params[7] = 1. / (.4 * mass * size * size);
- params[8] = 5. * (1. / params[7]);
- params[9] = .4 * mass * size * size;
+ params[7] = fix_div(fix_from_float(1.), fix_mul(fix_mul(fix_mul(fix_from_float(.4), mass), size), size));
+ params[8] = fix_mul(fix_from_float(5.), fix_div(fix_from_float(1.), params[7]));
+ params[9] = fix_mul(fix_mul(fix_mul(fix_from_float(.4), mass), size), size);
// mout << "I29 from make! " << params[9] << "\n";
on = make_pelvis(init_state, params);
@@ -126,7 +122,7 @@
// Turn on Cyber Space...
// ----------------------
cyber_space = p->cyber_space;
- if (cyber_space < 0 || cyber_space > 2)
+ if (cyber_space < 0 || cyber_space > fix_make(2,0))
cyber_space = 0; // Hey, why you do that?
I[on][10] = cyber_space;
@@ -142,7 +138,7 @@
void EDMS_control_pelvis(physics_handle ph, fix forward, fix turn, fix sidestep, fix lean, fix jump, int32_t crouch) {// Silly, no?
- Q FF, TT, SS, LL, JJ;
+ fix FF, TT, SS, LL, JJ;
#ifdef EDMS_SHIPPABLE
if (ph < 0)
@@ -149,11 +145,11 @@
mout << "Hey, you are and idiot...";
#endif
- FF.fix_to(forward);
- TT.fix_to(turn);
- SS.fix_to(sidestep);
- LL.fix_to(lean);
- JJ.fix_to(jump);
+ FF = forward;
+ TT = turn;
+ SS = sidestep;
+ LL = lean;
+ JJ = jump;
int32_t on = physics_handle_to_object_number(ph);
@@ -167,24 +163,24 @@
int32_t on = ph2on[ph];
- Q delta = 0;
+ fix delta = 0;
if (I[on][IDOF_MODEL] == PELVIS) {- Q new_neck = I[on][0]; // Rendered height...
+ fix new_neck = I[on][0]; // Rendered height...
- Q offset_x = new_neck * sin(S[on][4][0]), offset_y = -1.5 * new_neck * sin(S[on][5][0]),
- offset_z = new_neck * cos((1) * S[on][4][0]) * cos((1) * S[on][5][0]);
+ fix offset_x = fix_mul(new_neck, fix_sin(fix_to_fang(S[on][4][0]))), offset_y = fix_mul(fix_mul(fix_from_float(-1.5), new_neck), fix_sin(fix_to_fang(S[on][5][0]))),
+ offset_z = fix_mul(fix_mul(new_neck, fix_cos(fix_to_fang(fix_mul(FIX_UNIT, S[on][4][0])))), fix_cos(fix_to_fang(fix_mul(FIX_UNIT, S[on][5][0]))));
// offset_z = new_neck*cos( (.2 + .8*(I[on][10]>0) )*S[on][4][0] )*cos( (.2 + .8*(I[on][10]>0)
//)*S[on][5][0] );
- Q sin_alpha = 0, cos_alpha = 0;
+ fix sin_alpha = 0, cos_alpha = 0;
- Q final_x = 0, final_y = 0;
+ fix final_x = 0, final_y = 0;
- sincos(-S[on][3][0], &sin_alpha, &cos_alpha);
- final_x = cos_alpha * offset_x + sin_alpha * offset_y;
- final_y = -sin_alpha * offset_x + cos_alpha * offset_y;
+ fix_sincos(fix_to_fang(-S[on][3][0]), &sin_alpha, &cos_alpha);
+ final_x = fix_mul(cos_alpha, offset_x) + fix_mul(sin_alpha, offset_y);
+ final_y = fix_mul(-sin_alpha, offset_x) + fix_mul(cos_alpha, offset_y);
new_state[0] = (S[on][0][0] + final_x);
new_state[1] = (S[on][1][0] + final_y);
@@ -191,8 +187,8 @@
new_state[2] = (S[on][2][0] + offset_z);
new_state[3] = S[on][3][0];
- new_state[4] = (.1 /*- .3*(I[on][10]>0)*/) * S[on][4][0];
- new_state[5] = (.03 /*+ 1.6*(I[on][10]>0)*/) * S[on][5][0];
+ new_state[4] = fix_mul((fix_from_float(.1) /*- .3*(I[on][10]>0)*/), S[on][4][0]);
+ new_state[5] = fix_mul((fix_from_float(.03) /*+ 1.6*(I[on][10]>0)*/), S[on][5][0]);
// new_state[3] = S[on][3][0];
// new_state[4] = (.1 - .1*(I[on][10]>0) )*S[on][4][0];
@@ -203,14 +199,14 @@
new_state[5] = S[on][5][0];
}
- delta = (new_state[0] - old_state[0]) * (new_state[0] - old_state[0]) +
- (new_state[1] - old_state[1]) * (new_state[1] - old_state[1]) +
- (new_state[2] - old_state[2]) * (new_state[2] - old_state[2]) +
- (new_state[3] - old_state[3]) * (new_state[3] - old_state[3]) +
- (new_state[4] - old_state[4]) * (new_state[4] - old_state[4]) +
- (new_state[5] - old_state[5]) * (new_state[5] - old_state[5]);
+ delta = fix_mul(new_state[0] - old_state[0], new_state[0] - old_state[0]) +
+ fix_mul(new_state[1] - old_state[1], new_state[1] - old_state[1]) +
+ fix_mul(new_state[2] - old_state[2], new_state[2] - old_state[2]) +
+ fix_mul(new_state[3] - old_state[3], new_state[3] - old_state[3]) +
+ fix_mul(new_state[4] - old_state[4], new_state[4] - old_state[4]) +
+ fix_mul(new_state[5] - old_state[5], new_state[5] - old_state[5]);
- if (delta > .00003) {+ if (delta > fix_from_float(.00003)) {old_state[0] = new_state[0];
old_state[1] = new_state[1];
@@ -221,13 +217,13 @@
old_state[5] = new_state[5];
}
- s->X = old_state[0].to_fix();
- s->Y = old_state[1].to_fix();
- s->Z = old_state[2].to_fix();
+ s->X = old_state[0];
+ s->Y = old_state[1];
+ s->Z = old_state[2];
- s->alpha = old_state[3].to_fix();
- s->beta = old_state[4].to_fix();
- s->gamma = old_state[5].to_fix();
+ s->alpha = old_state[3];
+ s->beta = old_state[4];
+ s->gamma = old_state[5];
// if ( delta > 40 ) {// mout << "Holy cow, batman, delta = " << delta << "\n";
@@ -246,33 +242,33 @@
// Utilities for the weak spirited...
// ==================================
void EDMS_set_pelvis_parameters(physics_handle ph, Pelvis *p) {- Q mass, hardness, size, pep, height, gravity;
+ fix mass, hardness, size, pep, height, gravity;
int32_t cyber_space = 0;
- mass.fix_to(p->mass);
- size.fix_to(p->size);
- hardness.fix_to(p->hardness);
- pep.fix_to(p->pep);
- gravity.fix_to(p->gravity);
- height.fix_to(p->height);
- if (height > 3 * size)
- height = 3 * size;
+ mass = p->mass;
+ size = p->size;
+ hardness = p->hardness;
+ pep = p->pep;
+ gravity = p->gravity;
+ height = p->height;
+ if (height > fix_mul(fix_make(3,0), size))
+ height = fix_mul(fix_make(3,0), size);
int32_t on = physics_handle_to_object_number(ph);
// hardness = hardness*(mass*4/size);
- hardness = hardness * (mass * HARD_FAC / size);
+ hardness = fix_mul(hardness, fix_mul_div(mass, HARD_FAC, size));
I[on][IDOF_PELVIS_K] = hardness;
- I[on][IDOF_PELVIS_D] = 3 * sqrt(I[on][IDOF_PELVIS_K] * mass);
+ I[on][IDOF_PELVIS_D] = fix_mul(fix_make(3,0), fix_sqrt(fix_mul(I[on][IDOF_PELVIS_K], mass)));
I[on][IDOF_PELVIS_RADIUS] = size;
- I[on][IDOF_PELVIS_ROLL_DRAG] = pep * mass;
- I[on][IDOF_PELVIS_MASS_RECIP] = 1. / mass;
+ I[on][IDOF_PELVIS_ROLL_DRAG] = fix_mul(pep, mass);
+ I[on][IDOF_PELVIS_MASS_RECIP] = fix_div(fix_from_float(1.), mass);
I[on][IDOF_PELVIS_GRAVITY] = gravity;
I[on][IDOF_PELVIS_MASS] = mass;
- I[on][IDOF_PELVIS_MOI_RECIP] = 1. / (.4 * mass * size * size);
- I[on][IDOF_PELVIS_ROT_DRAG] = 5. * (1. / I[on][IDOF_PELVIS_MOI_RECIP]);
- I[on][IDOF_PELVIS_MOI] = .4 * mass * size * size;
+ I[on][IDOF_PELVIS_MOI_RECIP] = fix_div(fix_from_float(1.), fix_mul(fix_mul(fix_mul(fix_from_float(.4), mass), size), size));
+ I[on][IDOF_PELVIS_ROT_DRAG] = fix_mul(fix_from_float(5.), (fix_div(fix_from_float(1.), I[on][IDOF_PELVIS_MOI_RECIP])));
+ I[on][IDOF_PELVIS_MOI] = fix_mul(fix_mul(fix_mul(fix_from_float(.4), mass), size), size);
// mout << "I29 from set! " << I[on][29] << "\n";
// if ( I[on][30] != PELVIS ) mout << "!EDMS: You just screwed up the pelvis...\n";
@@ -282,7 +278,7 @@
// ----------------------
cyber_space = p->cyber_space;
I[on][7] = I[on][15] = 0;
- if (cyber_space < 0 || cyber_space > 2)
+ if (cyber_space < 0 || cyber_space > fix_make(2,0))
cyber_space = 0; // Hey, why you do that?
I[on][10] = cyber_space;
@@ -300,14 +296,14 @@
void EDMS_get_pelvis_parameters(physics_handle ph, Pelvis *p) {int32_t on = physics_handle_to_object_number(ph);
- p->pep = (I[on][IDOF_PELVIS_ROLL_DRAG] / I[on][IDOF_PELVIS_MASS]).to_fix();
- p->size = I[on][IDOF_PELVIS_RADIUS].to_fix();
- // p -> hardness = ( I[on][20]*I[on][22]/(I[on][26]*4) ).to_fix();
- p->hardness = (I[on][IDOF_PELVIS_K] * I[on][IDOF_PELVIS_RADIUS] / (I[on][IDOF_PELVIS_MASS] * HARD_FAC)).to_fix();
- p->mass = I[on][IDOF_PELVIS_MASS].to_fix();
- p->gravity = I[on][IDOF_PELVIS_GRAVITY].to_fix();
- p->cyber_space = I[on][10].to_int();
- p->height = (I[on][6] + I[on][IDOF_PELVIS_RADIUS]).to_fix();
+ p->pep = fix_div(I[on][IDOF_PELVIS_ROLL_DRAG], I[on][IDOF_PELVIS_MASS]);
+ p->size = I[on][IDOF_PELVIS_RADIUS];
+ // p -> hardness = ( I[on][20]*I[on][22]/(I[on][26]*4) );
+ p->hardness = fix_mul_div(I[on][IDOF_PELVIS_K], I[on][IDOF_PELVIS_RADIUS], fix_mul(I[on][IDOF_PELVIS_MASS], HARD_FAC));
+ p->mass = I[on][IDOF_PELVIS_MASS];
+ p->gravity = I[on][IDOF_PELVIS_GRAVITY];
+ p->cyber_space = fix_int(I[on][10]);
+ p->height = (I[on][6] + I[on][IDOF_PELVIS_RADIUS]);
}
// And the compression test for terrain "traps..."
@@ -314,7 +310,7 @@
// ===============================================
fix EDMS_get_pelvis_damage(physics_handle ph, fix delta_t) {int32_t object;
- Q worker_bee_buzz_buzz = 0;
+ fix worker_bee_buzz_buzz = 0;
object = ph2on[ph]; // As stupid as it gets...
worker_bee_buzz_buzz = I[object][14];
@@ -322,7 +318,5 @@
// FIXME What going on there?
I[object][14] = 0;
- return fix_mul(delta_t, I[object][14].to_fix());
+ return fix_mul(delta_t, I[object][14]);
}
-
-} // End of extern "C" for the &^%$@% compiler...
--- a/src/Libraries/EDMS/Source/MODELS/pelvis.cc
+++ b/src/Libraries/EDMS/Source/MODELS/pelvis.cc
@@ -26,7 +26,6 @@
// Seamus, Nov 2, 1993...
// ========================
-#include <iostream>
////#include <conio.h>
#include "edms_int.h" //This is the object type library. It is universal.
#include "idof.h"
@@ -37,9 +36,9 @@
#include "ss_flet.h"
-Q EDMS_CYBER_FLOW1X = 100;
-Q EDMS_CYBER_FLOW2X = 200;
-Q EDMS_CYBER_FLOW3X = 270;
+fix EDMS_CYBER_FLOW1X = fix_make(100, 0);
+fix EDMS_CYBER_FLOW2X = fix_make(200, 0);
+fix EDMS_CYBER_FLOW3X = fix_make(270, 0);
int32_t EDMS_BCD = 0;
bool pelvis_is_climbing = false;
@@ -50,16 +49,16 @@
//}
-#define EDMS_DIV_ZERO_TOLERANCE .0005
+#define EDMS_DIV_ZERO_TOLERANCE fix_from_float(.0005)
// For lean-o-meter...
// -------------------
-static Q V_ceiling[3], V_floor[3], V_wall[3];
+static fix V_ceiling[3], V_floor[3], V_wall[3];
// State information and utilities...
// ==================================
extern EDMS_Argblock_Pointer A;
-extern Q S[MAX_OBJ][7][4], I[MAX_OBJ][DOF_MAX];
+extern fix S[MAX_OBJ][7][4], I[MAX_OBJ][DOF_MAX];
extern int32_t no_no_not_me[MAX_OBJ];
// Functions...
@@ -70,28 +69,28 @@
// -----------------------
extern void (*EDMS_wall_contact)(physics_handle caller);
-static Q fix_one = 1., point_five = .5, two_pi = 6.283185;
+static fix fix_one = fix_from_float(1.), point_five = fix_from_float(.5), two_pi = fix_from_float(6.283185);
// Just a thought...
// =================
-static Q object0, object1, object2, object3, object4, // Howzat??
+static fix object0, object1, object2, object3, object4, // Howzat??
object5, object6, object7, object8, object9, object10, object11, object12, object13, object14, object15, object16,
object17, object18, object19, object20, object21, object22;
-static Q sin_alpha = 0, cos_alpha = 0, sin_beta = 0, cos_beta = 0, sin_gamma = 0, cos_gamma = 0, lp_x = 0, lp_y = 0,
+static fix sin_alpha = 0, cos_alpha = 0, sin_beta = 0, cos_beta = 0, sin_gamma = 0, cos_gamma = 0, lp_x = 0, lp_y = 0,
lp_z = 0, Fmxm = 0, Fmym = 0, Fmzm = 0, T_beta = 0, T_gamma = 0;
-static Q io17 = 0, io18 = 0, io19 = 0;
+static fix io17 = 0, io18 = 0, io19 = 0;
-static Q checker = 0, wall_check = 0;
+static fix checker = 0, wall_check = 0;
// Global for head information...
// ==============================
-Q head_delta[3], head_kappa[3], body_delta[3], body_kappa[3];
+fix head_delta[3], head_kappa[3], body_delta[3], body_kappa[3];
// Storage for running feel...
// ===========================
-Q bob_arg = 0;
+fix bob_arg = 0;
#pragma require_prototypes off
@@ -100,8 +99,8 @@
void pelvis_idof(int32_t object) {// attemp to speed up something
- Q *i_object = I[object];
- Q temp_Q;
+ fix *i_object = I[object];
+ fix temp_Q;
// To do the head motion, collisions, and climbing...
// --------------------------------------------------
@@ -109,7 +108,7 @@
// Call me instead of having special code everywhere...
// ====================================================
- extern void shall_we_dance(int32_t object, Q &result0, Q &result1, Q &result2);
+ extern void shall_we_dance(int32_t object, fix *result0, fix *result1, fix *result2);
pelvis_is_climbing = false;
@@ -117,59 +116,61 @@
A[object][1][0], A[object][2][0], i_object[22],
on2ph[object], TFD_FULL);
- V_ceiling[0].fix_to(terrain_info.cx); // Put it in...
- V_ceiling[1].fix_to(terrain_info.cy);
- V_ceiling[2].fix_to(terrain_info.cz);
+ V_ceiling[0] = terrain_info.cx; // Put it in...
+ V_ceiling[1] = terrain_info.cy;
+ V_ceiling[2] = terrain_info.cz;
- V_floor[0].fix_to(terrain_info.fx);
- V_floor[1].fix_to(terrain_info.fy);
- V_floor[2].fix_to(terrain_info.fz);
+ V_floor[0] = terrain_info.fx;
+ V_floor[1] = terrain_info.fy;
+ V_floor[2] = terrain_info.fz;
- Q mag = i_object[18] * i_object[18] + i_object[19] * i_object[19];
- if (mag < .1 && abs(V_floor[0]) < .05 * i_object[22] && abs(V_floor[1]) < .05 * i_object[22]) {- V_floor[1].val = 0; // Turns on SlopeStand(tm)...
- V_floor[0].val = 0;
+ fix mag = fix_mul(i_object[18], i_object[18]) + fix_mul(i_object[19], i_object[19]);
+ if (mag < fix_from_float(.1)
+ && fix_abs(V_floor[0]) < fix_mul(fix_from_float(.05), i_object[22])
+ && fix_abs(V_floor[1]) < fix_mul(fix_from_float(.05), i_object[22])) {+ V_floor[1] = 0; // Turns on SlopeStand(tm)...
+ V_floor[0] = 0;
}
- V_wall[0].fix_to(terrain_info.wx);
- V_wall[1].fix_to(terrain_info.wy);
- V_wall[2].fix_to(terrain_info.wz);
+ V_wall[0] = terrain_info.wx;
+ V_wall[1] = terrain_info.wy;
+ V_wall[2] = terrain_info.wz;
- object0.val = V_wall[0].val + V_floor[0].val + V_ceiling[0].val; // V_raw...
- object1.val = V_wall[1].val + V_floor[1].val + V_ceiling[1].val;
- object2.val = V_wall[2].val + V_floor[2].val + V_ceiling[2].val;
+ object0 = V_wall[0] + V_floor[0] + V_ceiling[0]; // V_raw...
+ object1 = V_wall[1] + V_floor[1] + V_ceiling[1];
+ object2 = V_wall[2] + V_floor[2] + V_ceiling[2];
// checker = sqrt(object0*object0 + object1*object1 + object2*object2);
- checker.val = fix_sqrt(fix_mul(object0.val, object0.val) + fix_mul(object1.val, object1.val) +
- fix_mul(object2.val, object2.val));
+ checker = fix_sqrt(fix_mul(object0, object0) + fix_mul(object1, object1) +
+ fix_mul(object2, object2));
if (checker > EDMS_DIV_ZERO_TOLERANCE) { // To get primitive...- object3.val = fix_div(fix_one.val, checker.val);
- object9.val = fix_make(1, 0); // Are we in the rub???
+ object3 = fix_div(fix_one, checker);
+ object9 = fix_make(1, 0); // Are we in the rub???
} else
- checker.val = object9.val = 0;
+ checker = object9 = 0;
if (i_object[10] == 2)
- object9.val = fix_make(1, 0); // Cyberspace...
+ object9 = fix_make(1, 0); // Cyberspace...
- object4.val = fix_mul(object3.val, object0.val); // The primitive V_n...
- object5.val = fix_mul(object3.val, object1.val);
- object6.val = fix_mul(object3.val, object2.val);
+ object4 = fix_mul(object3, object0); // The primitive V_n...
+ object5 = fix_mul(object3, object1);
+ object6 = fix_mul(object3, object2);
- object7.val = fix_mul(i_object[21].val,
- (fix_mul(A[object][0][1].val, object4.val) // Delta_magnitude...
- + fix_mul(A[object][1][1].val, object5.val) + fix_mul(A[object][2][1].val, object6.val)));
+ object7 = fix_mul(i_object[21],
+ (fix_mul(A[object][0][1], object4) // Delta_magnitude...
+ + fix_mul(A[object][1][1], object5) + fix_mul(A[object][2][1], object6)));
- object8.val = i_object[20].val;
+ object8 = i_object[20];
if (i_object[10] > 0) {- object7.val = fix_mul(object7.val, fix_make(2, 0));
- object8.val = fix_mul(object8.val, fix_make(2, 0));
+ object7 = fix_mul(object7, fix_make(2, 0));
+ object8 = fix_mul(object8, fix_make(2, 0));
}
- object4.val = fix_mul(object7.val, object4.val); // Delta...
- object5.val = fix_mul(object7.val, object5.val);
- object6.val = fix_mul(object7.val, object6.val);
+ object4 = fix_mul(object7, object4); // Delta...
+ object5 = fix_mul(object7, object5);
+ object6 = fix_mul(object7, object6);
// CONTROL...
// ==========
@@ -176,17 +177,17 @@
// Head motion for fucking hacking...
// ----------------------------------
- Q x_ease = A[object][0][0] - S[object][0][0];
- Q y_ease = A[object][1][0] - S[object][1][0];
- Q bob_delta = sqrt(x_ease * x_ease + y_ease * y_ease);
- Q bob_speed = sqrt(A[object][0][1] * A[object][0][1] + A[object][1][1] * A[object][1][1]);
+ fix x_ease = A[object][0][0] - S[object][0][0];
+ fix y_ease = A[object][1][0] - S[object][1][0];
+ fix bob_delta = fix_sqrt(fix_mul(x_ease, x_ease) + fix_mul(y_ease, y_ease));
+ fix bob_speed = fix_sqrt(fix_mul(A[object][0][1], A[object][0][1]) + fix_mul(A[object][1][1], A[object][1][1]));
- bob_arg.val += fix_div(fix_mul(fix_make(5, 0), bob_delta.val), (bob_speed.val + fix_make(1, 0)));
+ bob_arg += fix_div(fix_mul(fix_make(5, 0), bob_delta), (bob_speed + fix_make(1, 0)));
if (bob_arg > two_pi)
- bob_arg.val = bob_arg.val - two_pi.val;
+ bob_arg = bob_arg - two_pi;
- Q bob_fac = bob_speed * abs(sin(bob_arg));
+ fix bob_fac = fix_mul(bob_speed, fix_abs(fix_sin(fix_to_fang(bob_arg))));
#define EDMS_HEAD_BOB_HEIGHT 2
@@ -193,50 +194,50 @@
if (bob_fac > EDMS_HEAD_BOB_HEIGHT)
bob_fac = EDMS_HEAD_BOB_HEIGHT;
- bob_fac.val = fix_make(EDMS_HEAD_BOB_HEIGHT, 0) - fix_mul(0x09999, bob_fac.val); // 0x9999 = .6
+ bob_fac = fix_make(EDMS_HEAD_BOB_HEIGHT, 0) - fix_mul(0x09999, bob_fac); // 0x9999 = .6
if (i_object[10] > 0)
bob_fac = 1;
- io18.val = fix_mul(i_object[18].val, bob_fac.val);
- io19.val = fix_mul(i_object[19].val, bob_fac.val);
- io17.val = i_object[17].val;
+ io18 = fix_mul(i_object[18], bob_fac);
+ io19 = fix_mul(i_object[19], bob_fac);
+ io17 = i_object[17];
// Let's not power through the walls anymore...
// --------------------------------------------
- io18 *= (V_wall[0].val == 0);
- io19 *= (V_wall[1].val == 0);
- io17 *= (V_ceiling[2].val == 0);
- if ((V_floor[2].val == 0) && (io17.val > 0))
- io17.val = 0;
+ io18 *= (V_wall[0] == 0);
+ io19 *= (V_wall[1] == 0);
+ io17 *= (V_ceiling[2] == 0);
+ if ((V_floor[2] == 0) && (io17 > 0))
+ io17 = 0;
// Cyberama...
// -----------
- if ((object9.val == 0) && (io17.val >= 0) && (i_object[25].val > 0x08000)) // 0x08000 = .5
- io18.val = io19.val = io17.val = 0;
+ if ((object9 == 0) && (io17 >= 0) && (i_object[25] > 0x08000)) // 0x08000 = .5
+ io18 = io19 = io17 = 0;
// Here are collisions with other objects...
// =========================================
- shall_we_dance(object, object10, object11, object12);
+ shall_we_dance(object, &object10, &object11, &object12);
- object10.val = fix_mul(object10.val, i_object[20].val); // More general than it was...
- object11.val = fix_mul(object11.val, i_object[20].val);
- object12.val = fix_mul(object12.val, i_object[20].val);
+ object10 = fix_mul(object10, i_object[20]); // More general than it was...
+ object11 = fix_mul(object11, i_object[20]);
+ object12 = fix_mul(object12, i_object[20]);
// Let's not power through the walls anymore...
// --------------------------------------------
- // object10 *= ( (V_wall[0].val< 0x028f) && (V_wall[0].val>-0x028f)); // 0x028f = 0.01
- if (!((V_wall[0].val < 0x028f) && (V_wall[0].val > -0x028f)))
- object10.val = 0;
- // object11 *= ( (V_wall[1].val<0x028f) && (V_wall[1].val>-0x028f));
- if (!((V_wall[1].val < 0x028f) && (V_wall[1].val > -0x028f)))
- object11.val = 0;
+ // object10 *= ( (V_wall[0]< 0x028f) && (V_wall[0]>-0x028f)); // 0x028f = 0.01
+ if (!((V_wall[0] < 0x028f) && (V_wall[0] > -0x028f)))
+ object10 = 0;
+ // object11 *= ( (V_wall[1]<0x028f) && (V_wall[1]>-0x028f));
+ if (!((V_wall[1] < 0x028f) && (V_wall[1] > -0x028f)))
+ object11 = 0;
// Back to business...
// ===================
- sincos(A[object][3][0], &sin_alpha, &cos_alpha); // Positive for local...
- sincos(A[object][4][0], &sin_beta, &cos_beta);
- sincos(A[object][5][0], &sin_gamma, &cos_gamma);
+ fix_sincos(fix_to_fang(A[object][3][0]), &sin_alpha, &cos_alpha); // Positive for local...
+ fix_sincos(fix_to_fang(A[object][4][0]), &sin_beta, &cos_beta);
+ fix_sincos(fix_to_fang(A[object][5][0]), &sin_gamma, &cos_gamma);
// The head...
// ===========
@@ -243,15 +244,15 @@
int32_t edms_ss_bcd_flags_save = ss_edms_bcd_flags; // Save off info for after head call...
int32_t edms_ss_param_save = ss_edms_bcd_param;
- Q head_check_x = 0;
- Q head_check_y = 0;
+ fix head_check_x = 0;
+ fix head_check_y = 0;
get_head_of_death(object);
if (terrain_info.wx == 0)
- head_check_x = 1;
+ head_check_x = FIX_UNIT;
if (terrain_info.wy == 0)
- head_check_y = 1;
+ head_check_y = FIX_UNIT;
// io18 *= head_check_x;
// io19 *= head_check_y;
@@ -265,10 +266,10 @@
get_body_of_death(object);
// io18 *= ( body_kappa[0] == 0 );
// io19 *= ( body_kappa[1] == 0 );
- if (body_kappa[0].val != 0)
- io18.val = 0;
- if (body_kappa[1].val != 0)
- io19.val = 0;
+ if (body_kappa[0] != 0)
+ io18 = 0;
+ if (body_kappa[1] != 0)
+ io19 = 0;
ss_edms_bcd_flags = edms_ss_bcd_flags_save;
ss_edms_bcd_param = edms_ss_param_save;
@@ -280,9 +281,9 @@
// Fateful attempt(Jump)...
// ========================
// object18 = 800*(io17>0)*(object9>0)*( io17 - A[object][2][1] ); //Jump...
- object18.val = 0;
- if (io17.val > 0 && object9.val > 0)
- object18.val = fix_mul(fix_make(800, 0), (io17.val - A[object][2][1].val));
+ object18 = 0;
+ if (io17 > 0 && object9 > 0)
+ object18 = fix_mul(fix_make(800, 0), (io17 - A[object][2][1]));
// Jump jets...
// ------------
@@ -294,35 +295,35 @@
if (ss_edms_bcd_flags & SS_BCD_REPUL_ON) {// Get the speed...
- Q repulsor_speed = 21;
+ fix repulsor_speed = fix_make(21, 0);
if ((ss_edms_bcd_flags & SS_BCD_REPUL_SPD) == SS_BCD_REPUL_NORM)
- repulsor_speed = 7;
+ repulsor_speed = fix_make(7, 0);
// Assume we're going up, unless...
if ((ss_edms_bcd_flags & SS_BCD_REPUL_TYPE) == SS_BCD_REPUL_DOWN)
- repulsor_speed *= -.5;
+ repulsor_speed = fix_mul(repulsor_speed, fix_from_float(-.5));
// The parameter should be the desired height....
- Q repul_height;
- repul_height.fix_to(ss_edms_bcd_param);
+ fix repul_height;
+ repul_height = ss_edms_bcd_param;
- Q nearness_or_something = repul_height - A[object][2][0];
- if (abs(nearness_or_something) <= .333)
- repulsor_speed *= 3 * nearness_or_something;
+ fix nearness_or_something = repul_height - A[object][2][0];
+ if (fix_abs(nearness_or_something) <= fix_from_float(.333))
+ repulsor_speed = fix_mul(repulsor_speed, fix_mul(fix_make(3,0) , nearness_or_something));
io17 = repulsor_speed;
- if ((abs(A[object][2][1] - i_object[17]) > .6 * i_object[17]) && (terrain_info.cz == 0) &&
+ if ((fix_abs(A[object][2][1] - i_object[17]) > .6 * i_object[17]) && (terrain_info.cz == 0) &&
(repulsor_speed >= 0))
- io17 += 50 * i_object[17];
+ io17 += fix_mul(fix_make(50, 0), i_object[17]);
- object18 = i_object[26] * ((io17 - A[object][2][1]) + i_object[25]);
+ object18 = fix_mul(i_object[26], (io17 - A[object][2][1]) + i_object[25]);
- if (abs(io18) < .01)
- io18 = i_object[18] * (V_wall[0] == 0);
- if (abs(io19) < .01)
- io19 = i_object[19] * (V_wall[1] == 0);
+ if (fix_abs(io18) < fix_from_float(.01))
+ io18 = fix_mul(i_object[18], V_wall[0] == 0);
+ if (fix_abs(io19) < fix_from_float(.01))
+ io19 = fix_mul(i_object[19], V_wall[1] == 0);
- object9 = 1;
+ object9 = FIX_UNIT;
}
// Do climbing...
@@ -332,40 +333,40 @@
// Crouch torso bend thang and boogie boogie boogie...
// ===================================================
if ((i_object[7] > 0.0) || (i_object[0] < i_object[6]))
- i_object[0] = i_object[6] * (1 - .636 * abs(S[object][4][0])); // Crouch...
+ i_object[0] = fix_mul(i_object[6], FIX_UNIT - fix_mul(fix_from_float(.636), fix_abs(S[object][4][0]))); // Crouch...
else
i_object[0] = i_object[6];
// Cyberspace for real...
// ======================
- Q drug_addict0 = i_object[IDOF_PELVIS_ROLL_DRAG] * A[object][0][1];
- Q drug_addict1 = i_object[IDOF_PELVIS_ROLL_DRAG] * A[object][1][1];
- if (abs(io18) == 0 && i_object[10] > 0)
- drug_addict0 *= .2; // Skateware drag reduction...
+ fix drug_addict0 = fix_mul(i_object[IDOF_PELVIS_ROLL_DRAG], A[object][0][1]);
+ fix drug_addict1 = fix_mul(i_object[IDOF_PELVIS_ROLL_DRAG], A[object][1][1]);
+ if (fix_abs(io18) == 0 && i_object[10] > 0)
+ drug_addict0 = fix_mul(drug_addict0, fix_from_float(0.2)); // Skateware drag reduction...
if (abs(io19) == 0 && i_object[10] > 0)
- drug_addict1 *= .2;
+ drug_addict1 = fix_mul(drug_addict1, fix_from_float(0.2));
// Pelvis specifics...
// ===================
- object20 = object8 * object0 - object4 + head_kappa[0] - head_delta[0] + io18 + body_kappa[0] -
+ object20 = fix_mul(object8, object0) - object4 + head_kappa[0] - head_delta[0] + io18 + body_kappa[0] -
body_delta[0] // F_mxyz...
- + object9 * (-drug_addict0) + object10;
+ + fix_mul(object9, -drug_addict0) + object10;
- object21 = object8 * object1 - object5 + head_kappa[1] - head_delta[1] + io19 + body_kappa[1] - body_delta[1] +
- object9 * (-drug_addict1) + object11;
+ object21 = fix_mul(object8, object1) - object5 + head_kappa[1] - head_delta[1] + io19 + body_kappa[1] - body_delta[1] +
+ fix_mul(object9, -drug_addict1) + object11;
- object22 = object8 * object2 - (object18 == 0) * object6 + head_kappa[2] - head_delta[2] + object18 +
- body_kappa[2] - body_delta[2] + object9 * (-i_object[23] * A[object][2][1]) + object12;
+ object22 = fix_mul(object8, object2) - fix_mul(object18 == 0, object6) + head_kappa[2] - head_delta[2] + object18 +
+ body_kappa[2] - body_delta[2] + fix_mul(object9, fix_mul(-i_object[23], A[object][2][1])) + object12;
// Damage control...
// =================
- Q dam0 = object8 * object0 - object4 + head_kappa[0] - head_delta[0];
- Q dam1 = object8 * object1 - object5 + head_kappa[1] - head_delta[1];
- Q dam2 = object8 * object2 - (object18 == 0) * object6 + head_kappa[2] - head_delta[2];
+ fix dam0 = fix_mul(object8, object0) - object4 + head_kappa[0] - head_delta[0];
+ fix dam1 = fix_mul(object8, object1) - object5 + head_kappa[1] - head_delta[1];
+ fix dam2 = fix_mul(object8, object2) - fix_mul(object18 == 0, object6) + head_kappa[2] - head_delta[2];
- i_object[14] = abs(dam0) + abs(dam1) + abs(dam2) - 2 * i_object[26] * i_object[25]; // Damage??
+ i_object[14] = abs(dam0) + abs(dam1) + abs(dam2) - fix_mul(fix_mul(fix_make(2,0), i_object[26]), i_object[25]); // Damage??
if (i_object[14] > 0)
- i_object[14] *= i_object[IDOF_PELVIS_MASS_RECIP] * (io17 < .5);
+ i_object[14] = fix_mul(fix_mul(i_object[14], i_object[IDOF_PELVIS_MASS_RECIP]), (io17 < fix_from_float(.5)));
else
i_object[14] = 0;
@@ -375,9 +376,9 @@
// Let's not power through the walls anymore...
// --------------------------------------------
- i_object[32] *= ((V_wall[0] < 0.01) && (V_wall[0] > -0.01));
- i_object[33] *= ((V_wall[1] < 0.01) && (V_wall[1] > -0.01));
- i_object[34] *= ((V_ceiling[2] < 0.01) && (V_ceiling[2] > -0.01));
+ i_object[32] = fix_mul(i_object[32], ((V_wall[0] < 0.01) && (V_wall[0] > -0.01)));
+ i_object[33] = fix_mul(i_object[33], ((V_wall[1] < 0.01) && (V_wall[1] > -0.01)));
+ i_object[34] = fix_mul(i_object[34], ((V_ceiling[2] < 0.01) && (V_ceiling[2] > -0.01)));
object20 += i_object[32];
object21 += i_object[33];
@@ -389,25 +390,25 @@
i_object[34] = 0;
}
- Fmxm = object20 * cos_alpha + object21 * sin_alpha; // Locals...
- Fmym = -object20 * sin_alpha + object21 * cos_alpha;
+ Fmxm = fix_mul(object20, cos_alpha) + fix_mul(object21, sin_alpha); // Locals...
+ Fmym = fix_mul(-object20, sin_alpha) + fix_mul(object21, cos_alpha);
- lp_z = -.1 * i_object[0] * cos_beta * cos_gamma;
+ lp_z = fix_mul(fix_mul(fix_mul(fix_from_float(-.1), i_object[0]), cos_beta), cos_gamma);
- Q Head_tau_beta = -.1 * i_object[0] * sin_beta * (head_kappa[2] - head_delta[2]),
- Head_tau_gamma = -.1 * i_object[0] * sin_gamma * (head_kappa[2] - head_delta[2]);
+ fix Head_tau_beta = fix_mul(fix_mul(fix_mul(fix_from_float(-.1), i_object[0]), sin_beta), head_kappa[2] - head_delta[2]),
+ Head_tau_gamma = fix_mul(fix_mul(fix_mul(fix_from_float(-.1), i_object[0]), sin_gamma), head_kappa[2] - head_delta[2]);
if (((V_wall[1] != 0) && (head_check_y == 0)) || ((V_wall[0] != 0) && (head_check_x == 0)))
i_object[15] = 0;
- T_beta = -(lp_z * Fmxm) + i_object[7] + Head_tau_beta; // Actual torques...
- T_gamma = -(-Fmym * lp_z) + .04 * i_object[16] * +Head_tau_gamma;
+ T_beta = -fix_mul(lp_z, Fmxm) + i_object[7] + Head_tau_beta; // Actual torques...
+ T_gamma = -fix_mul(-Fmym, lp_z) + fix_mul(fix_mul(fix_from_float(.04), i_object[16]), +Head_tau_gamma);
// Kickbacks...
// ============
- if (abs(i_object[8]) > 0) {- T_beta -= cos_alpha * i_object[8] + sin_alpha * i_object[9];
- T_gamma = -sin_alpha * i_object[8] + cos_alpha * i_object[9];
+ if (fix_abs(i_object[8]) > 0) {+ T_beta -= fix_mul(cos_alpha, i_object[8]) + fix_mul(sin_alpha, i_object[9]);
+ T_gamma = fix_mul(-sin_alpha, i_object[8]) + fix_mul(cos_alpha, i_object[9]);
object20 -= i_object[8]; // For zero g...
object21 -= i_object[9];
@@ -415,7 +416,7 @@
i_object[8] = i_object[9] = 0;
}
- object17 = i_object[28] * (1 + 1.2 * (i_object[16] == 0)); // 3 is 2
+ object17 = fix_mul(i_object[28], FIX_UNIT + fix_mul(fix_from_float(1.2), i_object[16] == 0)); // 3 is 2
// Angular play (citadel) ...
// ==========================
@@ -426,16 +427,16 @@
// Try the equations of motion here for grins...
// =============================================
- S[object][0][2] = i_object[IDOF_PELVIS_MASS_RECIP] * (object20);
- S[object][1][2] = i_object[IDOF_PELVIS_MASS_RECIP] * (object21);
- S[object][2][2] = i_object[IDOF_PELVIS_MASS_RECIP] * (object22)-i_object[IDOF_PELVIS_GRAVITY];
- S[object][3][2] = i_object[IDOF_PELVIS_MOI_RECIP] * (i_object[16] - object17 * A[object][3][1]);
- S[object][4][2] = i_object[IDOF_PELVIS_MOI_RECIP] * (T_beta - 1.5 * i_object[1] * A[object][4][0] /**(1-.5*(i_object[10]==1))*/
- - .8 * i_object[2] * A[object][4][1] /**(1-.5*(i_object[10]==1))*/);
+ S[object][0][2] = fix_mul(i_object[IDOF_PELVIS_MASS_RECIP], object20);
+ S[object][1][2] = fix_mul(i_object[IDOF_PELVIS_MASS_RECIP], object21);
+ S[object][2][2] = fix_mul(i_object[IDOF_PELVIS_MASS_RECIP], object22-i_object[IDOF_PELVIS_GRAVITY]);
+ S[object][3][2] = fix_mul(i_object[IDOF_PELVIS_MOI_RECIP], i_object[16] - fix_mul(object17, A[object][3][1]));
+ S[object][4][2] = fix_mul(i_object[IDOF_PELVIS_MOI_RECIP], (T_beta - fix_mul(fix_mul(fix_from_float(1.5), i_object[1]), A[object][4][0]) /**(1-.5*(i_object[10]==1))*/
+ - fix_mul(fix_mul(fix_from_float(.8), i_object[2]), A[object][4][1]) /**(1-.5*(i_object[10]==1))*/));
- S[object][5][2] = i_object[IDOF_PELVIS_MOI_RECIP] * (T_gamma - i_object[1] * A[object][5][0] /**(1-.5*(i_object[10]==1))*/
- - .8 * i_object[2] * A[object][5][1] /**(1-.5*(i_object[10]==1))*/
- + i_object[15]);
+ S[object][5][2] = fix_mul(i_object[IDOF_PELVIS_MOI_RECIP], (T_gamma - fix_mul(i_object[1], A[object][5][0]) /**(1-.5*(i_object[10]==1))*/
+ - fix_mul(fix_mul(fix_from_float(.8), i_object[2]), A[object][5][1]) /**(1-.5*(i_object[10]==1))*/
+ + i_object[15]));
// That's all, folks...
// ====================
@@ -444,79 +445,79 @@
// Here we'll get the head information we all want so badly...
// ===========================================================
void get_head_of_death(int32_t object) {- Q *i_object = I[object];
- Q vec0, vec1, vec2, test, mul, vv0, vv1, vv2, dmag, kmag;
+ fix *i_object = I[object];
+ fix vec0, vec1, vec2, test, mul, vv0, vv1, vv2, dmag, kmag;
- Q offset_x = i_object[0] * sin(A[object][4][0]), offset_y = -1.5 * i_object[0] * sin(A[object][5][0]),
- offset_z = i_object[0] * cos(A[object][4][0]) * cos(A[object][5][0]);
+ fix offset_x = fix_mul(i_object[0], fix_sin(fix_to_fang(A[object][4][0]))), offset_y = fix_mul(fix_mul(fix_from_float(-1.5), i_object[0]), fix_sin(fix_to_fang(A[object][5][0]))),
+ offset_z = fix_mul(fix_mul(i_object[0], fix_cos(fix_to_fang(A[object][4][0]))), fix_cos(fix_to_fang(A[object][5][0])));
- Q sin_alpha = 0, cos_alpha = 0;
+ fix sin_alpha = 0, cos_alpha = 0;
- Q final_x = 0, final_y = 0;
+ fix final_x = 0, final_y = 0;
- sincos(-A[object][3][0], &sin_alpha, &cos_alpha);
- final_x = cos_alpha * offset_x + sin_alpha * offset_y;
- final_y = -sin_alpha * offset_x + cos_alpha * offset_y;
+ fix_sincos(fix_to_fang(-A[object][3][0]), &sin_alpha, &cos_alpha);
+ final_x = fix_mul(cos_alpha, offset_x) + fix_mul(sin_alpha, offset_y);
+ final_y = fix_mul(-sin_alpha, offset_x) + fix_mul(cos_alpha, offset_y);
- indoor_terrain(A[object][0][0] + final_x, A[object][1][0] + final_y, A[object][2][0] + offset_z, .75 * i_object[22],
- -1 /*on2ph[object]*/, TFD_FULL);
+ indoor_terrain(A[object][0][0] + final_x, A[object][1][0] + final_y, A[object][2][0] + offset_z, fix_mul(fix_from_float(.75), i_object[22]),
+ fix_make(-1,0) /*on2ph[object]*/, TFD_FULL);
- Q mag = i_object[18] * i_object[18] + i_object[19] * i_object[19];
- if (mag < .1 && abs(V_floor[0]) < .05 * i_object[22] && abs(V_floor[1]) < .05 * i_object[22]) {+ fix mag = fix_mul(i_object[18], i_object[18]) + fix_mul(i_object[19], i_object[19]);
+ if (mag < fix_from_float(.1) && fix_abs(V_floor[0]) < fix_mul(fix_from_float(.05), i_object[22]) && fix_abs(V_floor[1]) < fix_mul(fix_from_float(.05), i_object[22])) {terrain_info.fx = terrain_info.fy = 0;
}
- vec0.fix_to(terrain_info.fx + terrain_info.cx + terrain_info.wx);
- vec1.fix_to(terrain_info.fy + terrain_info.cy + terrain_info.wy);
- vec2.fix_to(terrain_info.fz + terrain_info.cz + terrain_info.wz);
+ vec0 = terrain_info.fx + terrain_info.cx + terrain_info.wx;
+ vec1 = terrain_info.fy + terrain_info.cy + terrain_info.wy;
+ vec2 = terrain_info.fz + terrain_info.cz + terrain_info.wz;
- test = sqrt(vec0 * vec0 + vec1 * vec1 + vec2 * vec2);
+ test = fix_sqrt(fix_mul(vec0, vec0) + fix_mul(vec1, vec1) + fix_mul(vec2, vec2));
if (test > EDMS_DIV_ZERO_TOLERANCE)
- mul = fix_one / test; // To get primitive...
+ mul = fix_div(fix_one, test); // To get primitive...
else
test = mul = 0;
- vv0 = mul * vec0; // The primitive V_n...
- vv1 = mul * vec1;
- vv2 = mul * vec2;
+ vv0 = fix_mul(mul, vec0); // The primitive V_n...
+ vv1 = fix_mul(mul, vec1);
+ vv2 = fix_mul(mul, vec2);
- dmag = i_object[IDOF_PELVIS_D] * (A[object][0][1] * vv0 // Delta_magnitude...
- + A[object][1][1] * vv1 + A[object][2][1] * vv2);
+ dmag = fix_mul(i_object[IDOF_PELVIS_D], fix_mul(A[object][0][1], vv0) // Delta_magnitude...
+ + fix_mul(A[object][1][1], vv1) + fix_mul(A[object][2][1], vv2));
- head_delta[0] = dmag * vv0; // Delta...
- head_delta[1] = dmag * vv1;
- head_delta[2] = dmag * vv2;
+ head_delta[0] = fix_mul(dmag, vv0); // Delta...
+ head_delta[1] = fix_mul(dmag, vv1);
+ head_delta[2] = fix_mul(dmag, vv2);
// if (test < .5*i_object[22]) kmag = i_object[20]; //Omega_magnitude...
// else kmag = i_object[20]/test;
kmag = i_object[IDOF_PELVIS_K];
- head_kappa[0] = kmag * vec0;
- head_kappa[1] = kmag * vec1;
- head_kappa[2] = kmag * vec2;
+ head_kappa[0] = fix_mul(kmag, vec0);
+ head_kappa[1] = fix_mul(kmag, vec1);
+ head_kappa[2] = fix_mul(kmag, vec2);
}
void get_body_of_death(int32_t object) {- Q *i_object = I[object];
+ fix *i_object = I[object];
- Q vec0, vec1, vec2, test, mul, vv0, vv1, vv2, dmag, kmag;
+ fix vec0, vec1, vec2, test, mul, vv0, vv1, vv2, dmag, kmag;
- Q half_height = .5 * i_object[0];
+ fix half_height = fix_mul(fix_from_float(.5), i_object[0]);
- Q offset_x = half_height * sin(A[object][4][0]), offset_y = -1.5 * half_height * sin(A[object][5][0]),
- offset_z = half_height * cos(A[object][4][0]) * cos(A[object][5][0]);
+ fix offset_x = fix_mul(half_height, fix_sin(fix_to_fang(A[object][4][0]))), offset_y = fix_mul(fix_mul(fix_from_float(-1.5), half_height), fix_sin(fix_to_fang(A[object][5][0]))),
+ offset_z = fix_mul(fix_mul(half_height, fix_cos(fix_to_fang(A[object][4][0]))), fix_cos(fix_to_fang(A[object][5][0])));
- Q sin_alpha = 0, cos_alpha = 0;
+ fix sin_alpha = 0, cos_alpha = 0;
- Q final_x = 0, final_y = 0;
+ fix final_x = 0, final_y = 0;
- sincos(-A[object][3][0], &sin_alpha, &cos_alpha);
- final_x = cos_alpha * offset_x + sin_alpha * offset_y;
- final_y = -sin_alpha * offset_x + cos_alpha * offset_y;
+ fix_sincos(fix_to_fang(-A[object][3][0]), &sin_alpha, &cos_alpha);
+ final_x = fix_mul(cos_alpha, offset_x) + fix_mul(sin_alpha, offset_y);
+ final_y = fix_mul(-sin_alpha, offset_x) + fix_mul(cos_alpha, offset_y);
- indoor_terrain(A[object][0][0] + final_x, A[object][1][0] + final_y, A[object][2][0] + offset_z, .33 * i_object[0],
- -1 /*on2ph[object]*/, TFD_FULL);
+ indoor_terrain(A[object][0][0] + final_x, A[object][1][0] + final_y, A[object][2][0] + offset_z, fix_mul(fix_from_float(.33), i_object[0]),
+ fix_make(-1,0) /*on2ph[object]*/, TFD_FULL);
// Zero result!
// ============
@@ -525,43 +526,43 @@
// Do ANYTHING?
// ------------
- Q abtotal = abs(terrain_info.fx) + abs(terrain_info.fy) + abs(terrain_info.fz);
- abtotal += abs(terrain_info.wx) + abs(terrain_info.wy) + abs(terrain_info.wz);
- abtotal += abs(terrain_info.cx) + abs(terrain_info.cy) + abs(terrain_info.cz);
+ fix abtotal = fix_abs(terrain_info.fx) + fix_abs(terrain_info.fy) + fix_abs(terrain_info.fz);
+ abtotal += fix_abs(terrain_info.wx) + fix_abs(terrain_info.wy) + fix_abs(terrain_info.wz);
+ abtotal += fix_abs(terrain_info.cx) + fix_abs(terrain_info.cy) + fix_abs(terrain_info.cz);
if (abtotal != 0) {- Q mag = i_object[18] * i_object[18] + i_object[19] * i_object[19];
- if (mag < .1 && abs(V_floor[0]) < .05 * i_object[22] && abs(V_floor[1]) < .05 * i_object[22])
+ fix mag = fix_mul(i_object[18], i_object[18]) + fix_mul(i_object[19], i_object[19]);
+ if (mag < fix_from_float(.1) && fix_abs(V_floor[0]) < fix_mul(fix_from_float(.05), i_object[22]) && fix_abs(V_floor[1]) < fix_mul(fix_from_float(.05), i_object[22]))
terrain_info.fx = terrain_info.fy = 0;
- vec0.fix_to(terrain_info.fx + terrain_info.cx + terrain_info.wx);
- vec1.fix_to(terrain_info.fy + terrain_info.cy + terrain_info.wy);
- vec2.fix_to(terrain_info.fz + terrain_info.cz + terrain_info.wz);
+ vec0 = terrain_info.fx + terrain_info.cx + terrain_info.wx;
+ vec1 = terrain_info.fy + terrain_info.cy + terrain_info.wy;
+ vec2 = terrain_info.fz + terrain_info.cz + terrain_info.wz;
- test = sqrt(vec0 * vec0 + vec1 * vec1 + vec2 * vec2);
+ test = fix_sqrt(fix_mul(vec0, vec0) + fix_mul(vec1, vec1) + fix_mul(vec2, vec2));
if (test > EDMS_DIV_ZERO_TOLERANCE)
- mul = fix_one / test; // To get primitive...
+ mul = fix_div(fix_one, test); // To get primitive...
else
test = mul = 0;
- vv0 = mul * vec0; // The primitive V_n...
- vv1 = mul * vec1;
- vv2 = mul * vec2;
+ vv0 = fix_mul(mul, vec0); // The primitive V_n...
+ vv1 = fix_mul(mul, vec1);
+ vv2 = fix_mul(mul, vec2);
vec2 = vv2 = 0;
- dmag = i_object[IDOF_PELVIS_D] * (A[object][0][1] * vv0 // Delta_magnitude...
- + A[object][1][1] * vv1 + A[object][2][1] * vv2);
+ dmag = fix_mul(i_object[IDOF_PELVIS_D], (fix_mul(A[object][0][1], vv0) // Delta_magnitude...
+ + fix_mul(A[object][1][1], vv1) + fix_mul(A[object][2][1], vv2)));
- body_delta[0] = dmag * vv0; // Delta...
- body_delta[1] = dmag * vv1;
- body_delta[2] = dmag * vv2;
+ body_delta[0] = fix_mul(dmag, vv0); // Delta...
+ body_delta[1] = fix_mul(dmag, vv1);
+ body_delta[2] = fix_mul(dmag, vv2);
kmag = i_object[20];
- body_kappa[0] = kmag * vec0;
- body_kappa[1] = kmag * vec1;
- body_kappa[2] = kmag * vec2;
+ body_kappa[0] = fix_mul(kmag, vec0);
+ body_kappa[1] = fix_mul(kmag, vec1);
+ body_kappa[2] = fix_mul(kmag, vec2);
} // Do NOTHING...
}
@@ -569,14 +570,14 @@
// Climbing stuff also removed for speed of compilations...
// ========================================================
void do_climbing(int32_t object) {- Q *i_object = I[object];
+ fix *i_object = I[object];
// Hellishness...
// ==============
if ((i_object[17] > 0) &&
((ss_edms_bcd_flags & SS_BCD_MISC_CLIMB) || (edms_ss_head_bcd_flags & SS_BCD_MISC_CLIMB))) {- Q ass = sqrt((.05 * i_object[18]) * i_object[18] + (.05 * i_object[19]) * i_object[19]);
- Q ratio = i_object[18] * object0 + i_object[19] * object1;
+ fix ass = fix_sqrt(fix_mul(fix_mul(fix_from_float(.05), i_object[18]), i_object[18]) + fix_mul(fix_mul(fix_from_float(.05), i_object[19]), i_object[19]));
+ fix ratio = fix_mul(i_object[18], object0) + fix_mul(i_object[19], object1);
if (ratio > 0)
ass = 0;
@@ -584,16 +585,16 @@
pelvis_is_climbing = true;
if (checker > 0) {- io17 = .02 * ass; // + 100*( .2*i_object[22] - V_[floor][2] );
+ io17 = fix_mul(fix_from_float(.02), ass); // + 100*( .2*i_object[22] - V_[floor][2] );
if ((terrain_info.cz != 0))
io17 = 0;
- io18 = -.4 * i_object[IDOF_PELVIS_RADIUS] * object0 * object8 / checker + .5 * i_object[18];
- io19 = -.4 * i_object[IDOF_PELVIS_RADIUS] * object1 * object8 / checker + .5 * i_object[19];
- i_object[16] *= .5;
+ io18 = fix_mul_div(fix_mul(fix_mul(fix_from_float(-.4), i_object[IDOF_PELVIS_RADIUS]), object0), object8, checker) + fix_mul(fix_from_float(.5), i_object[18]);
+ io19 = fix_mul_div(fix_mul(fix_mul(fix_from_float(-.4), i_object[IDOF_PELVIS_RADIUS]), object1), object8, checker) + fix_mul(fix_from_float(.5), i_object[19]);
+ i_object[16] = fix_mul(i_object[16], fix_from_float(.5));
// Set the mojo...
// ===============
- object18 = 800 * (io17 > 0) * (io17 - A[object][2][1]);
+ object18 = fix_mul(fix_mul(fix_make(800,0), (io17 > 0)), (io17 - A[object][2][1]));
}
}
@@ -600,18 +601,18 @@
// AutoClimbing(tm) is for wussies (is superseeded by climbing)...
// ===============================================================
else if ((ss_edms_bcd_flags & SS_BCD_MISC_STAIR) /*&& (i_object[17] == 0) (io17==0) */) {- if ((checker > 0) && (abs(i_object[18]) + abs(i_object[19]) > .01)) {- Q ratio = (i_object[18] + A[object][0][1]) * object0 + (i_object[19] + A[object][1][1]) * object1;
+ if ((checker > 0) && (fix_abs(i_object[18]) + fix_abs(i_object[19]) > fix_from_float(.01))) {+ Q ratio = fix_mul(i_object[18] + A[object][0][1], object0) + fix_mul(i_object[19] + A[object][1][1], object1);
if (ratio <= 0) {- io17 = .5;
+ io17 = fix_from_float(.5);
- io18 = -.3 * i_object[IDOF_PELVIS_RADIUS] * object0 * object8 / checker + .2 * i_object[18];
- io19 = -.3 * i_object[IDOF_PELVIS_RADIUS] * object1 * object8 / checker + .2 * i_object[19];
+ io18 = fix_mul_div(fix_mul(fix_mul(fix_from_float(-.3), i_object[IDOF_PELVIS_RADIUS]), object0), object8, checker) + fix_mul(fix_from_float(.2), i_object[18]);
+ io19 = fix_mul_div(fix_mul(fix_mul(fix_from_float(-.3), i_object[IDOF_PELVIS_RADIUS]), object1), object8, checker) + fix_mul(fix_from_float(.2), i_object[19]);
// Set the mojo...
// ===============
- object18 = 800 * (io17 > 0) * (io17 - A[object][2][1]);
+ object18 = fix_mul(fix_mul(fix_make(800,0), (io17 > 0)), io17 - A[object][2][1]);
} else {io18 = i_object[18];
io19 = i_object[19];
@@ -623,9 +624,9 @@
// We might for now want to set some external forces on the pelvis...
// ==================================================================
void pelvis_set_control(int32_t pelvis, Q forward, Q turn, Q sidestep, Q lean, Q jump, int32_t crouch) {- const Q pi_by_two = 1.5707; // Yea, flixpoint...
+ const fix pi_by_two = fix_from_float(1.5707); // Yea, flixpoint...
- sincos(S[pelvis][3][0], &object0, &object1);
+ fix_sincos(fix_to_fang(S[pelvis][3][0]), &object0, &object1);
// Get rid of it all...
// --------------------
@@ -633,39 +634,39 @@
// Here's the thrust of the situation...
// -------------------------------------
- I[pelvis][18] = forward * object1 * I[pelvis][IDOF_PELVIS_MASS];
- I[pelvis][19] = forward * object0 * I[pelvis][IDOF_PELVIS_MASS];
+ I[pelvis][18] = fix_mul(fix_mul(forward, object1), I[pelvis][IDOF_PELVIS_MASS]);
+ I[pelvis][19] = fix_mul(fix_mul(forward, object0), I[pelvis][IDOF_PELVIS_MASS]);
// And the sidestep is off by pi/two...
// ------------------------------------
- sincos((S[pelvis][3][0] - pi_by_two), &object0, &object1);
- I[pelvis][18] += sidestep * object1 * I[pelvis][IDOF_PELVIS_MASS];
- I[pelvis][19] += sidestep * object0 * I[pelvis][IDOF_PELVIS_MASS];
+ fix_sincos(fix_to_fang(S[pelvis][3][0] - pi_by_two), &object0, &object1);
+ I[pelvis][18] += fix_mul(fix_mul(sidestep, object1), I[pelvis][IDOF_PELVIS_MASS]);
+ I[pelvis][19] += fix_mul(fix_mul(sidestep, object0), I[pelvis][IDOF_PELVIS_MASS]);
// And the turn of the...
// ----------------------
- I[pelvis][16] = turn * I[pelvis][IDOF_PELVIS_MOI];
+ I[pelvis][16] = fix_mul(turn, I[pelvis][IDOF_PELVIS_MOI]);
// Jump jets of joy...
// -------------------
if (jump > 0)
- I[pelvis][17] = .003 * I[pelvis][IDOF_PELVIS_MASS] * jump;
+ I[pelvis][17] = fix_mul(fix_mul(fix_from_float(.003), I[pelvis][IDOF_PELVIS_MASS]), jump);
if (jump < 0)
- I[pelvis][17] = .0006 * I[pelvis][IDOF_PELVIS_MASS] * jump;
+ I[pelvis][17] = fix_mul(fix_mul(fix_from_float(.0006), I[pelvis][IDOF_PELVIS_MASS]), jump);
// And finally leaning about...
// ----------------------------
- I[pelvis][15] = .04 * lean * I[pelvis][1]; // Exactly the angle!
+ I[pelvis][15] = fix_mul(fix_mul(fix_from_float(.04), lean), I[pelvis][1]); // Exactly the angle!
// Crouching (overpowers jumping )...
// ----------------------------------
if (crouch > 0)
- I[pelvis][7] = .20 * crouch * I[pelvis][1];
+ I[pelvis][7] = fix_mul(fix_mul(fix_from_float(.20), crouch), I[pelvis][1]);
// Wake up...
// ==========
no_no_not_me[pelvis] =
- (abs(I[pelvis][15]) + abs(I[pelvis][16]) + abs(I[pelvis][17]) + abs(I[pelvis][18]) + abs(I[pelvis][19]) > 0) ||
+ (fix_abs(I[pelvis][15]) + fix_abs(I[pelvis][16]) + fix_abs(I[pelvis][17]) + fix_abs(I[pelvis][18]) + fix_abs(I[pelvis][19]) > 0) ||
(no_no_not_me[pelvis] == 1);
}
@@ -721,7 +722,7 @@
I[object_number][31] = I[object_number][IDOF_PELVIS_RADIUS];
I[object_number][32] = I[object_number][33] = I[object_number][34] = I[object_number][35] = 0;
I[object_number][36] = I[object_number][IDOF_PELVIS_MASS_RECIP]; // Shrugoff "mass"...
- I[object_number][IDOF_COLLIDE] = -1;
+ I[object_number][IDOF_COLLIDE] = fix_make(-1,0);
I[object_number][IDOF_AUTODESTRUCT] = 0; // No kill I...
// Zero the control initially...
@@ -770,18 +771,14 @@
// ==========================================
// So there.
-// For mark...
-// -----------
-extern "C" {-
-bool EDMS_pelvis_is_climbing()
+bool EDMS_pelvis_is_climbing(void)
{return pelvis_is_climbing;
}
-void EDMS_lean_o_meter(physics_handle ph, fix &lean, fix &crouch) {+void EDMS_lean_o_meter(physics_handle ph, fix *lean, fix *crouch) {- lean = crouch = 0;
+ *lean = *crouch = 0;
// Are you for real?
// -----------------
@@ -792,8 +789,8 @@
// Are you a pelvis...
// -------------------
if (I[on][IDOF_MODEL] == PELVIS) {- lean = S[on][5][0].to_fix();
- crouch = I[on][0].to_fix() - 3 * V_floor[2].to_fix();
+ *lean = S[on][5][0];
+ *crouch = I[on][0] - fix_mul(fix_make(3,0), V_floor[2]);
} // Pelvis check...
@@ -801,4 +798,3 @@
}
#pragma require_prototypes on
-}
--- a/src/Libraries/EDMS/Source/MODELS/pelvis.h
+++ b/src/Libraries/EDMS/Source/MODELS/pelvis.h
@@ -18,5 +18,5 @@
*/
// This seems silly now, but later it will all make sense, sensei...
// =================================================================
-int32_t make_pelvis(Q init_state[6][3], Q params[10]);
-void pelvis_set_control(int32_t pelvis, Q forward, Q turn, Q sidestep, Q lean, Q jump, int32_t crouch);
+int32_t make_pelvis(fix init_state[6][3], fix params[10]);
+void pelvis_set_control(int32_t pelvis, fix forward, fix turn, fix sidestep, fix lean, fix jump, int32_t crouch);
--- a/src/Libraries/EDMS/Source/MODELS/robot.cc
+++ b/src/Libraries/EDMS/Source/MODELS/robot.cc
@@ -23,7 +23,6 @@
// Seamus, June 29, 1993...
// ========================
-#include <iostream>
//#include <conio.h>
#include "edms_int.h" //This is the object type library. It is universal.
#include "idof.h"
@@ -80,7 +79,7 @@
static Q drug, butt;
-const Q wt_pos = 0.001, wt_neg = -wt_pos;
+const Q wt_pos = 0.001, wt_neg = -0.001;
#pragma require_prototypes off
@@ -90,7 +89,7 @@
// Call me instead of having special code everywhere...
// ====================================================
- extern void shall_we_dance(int object, Q &result0, Q &result1, Q &result2);
+ extern void shall_we_dance(int object, Q *result0, Q *result1, Q *result2);
A00 = A[object][0][0]; // Dereference NOW!
A10 = A[object][1][0];
@@ -117,9 +116,9 @@
// Boy, will this be faster in the new order...
// ============================================
Q w0, w1, w2, w3, w4;
- w0.fix_to(terrain_info.wx);
- w1.fix_to(terrain_info.wy);
- w2.fix_to(terrain_info.wz);
+ w0 = terrain_info.wx;
+ w1 = terrain_info.wy;
+ w2 = terrain_info.wz;
// w3 = sqrt( w0*w0 + w1*w1 + w2*w2 );
// w4 = 2*( w3 - .5*I[object][22] );
@@ -142,9 +141,9 @@
else
check2 = 0;
- object0.fix_to(terrain_info.fx + terrain_info.cx);
- object1.fix_to(terrain_info.fy + terrain_info.cy);
- object2.fix_to(terrain_info.fz + terrain_info.cz);
+ object0 = terrain_info.fx + terrain_info.cx;
+ object1 = terrain_info.fy + terrain_info.cy;
+ object2 = terrain_info.fz + terrain_info.cz;
object0 += w0;
object1 += w1;
@@ -187,7 +186,7 @@
object10 = object11 = object12 = 0;
if (I[object][5] == 0) {- shall_we_dance(object, object10, object11, object12);
+ shall_we_dance(object, &object10, &object11, &object12);
object10 *= I[object][20] * check0; // More general than it was...
object11 *= I[object][20] * check1;
// object12 *= I[object][20]*check2;
@@ -208,7 +207,7 @@
// The parameter should be the desired height....
Q repul_height;
- repul_height.fix_to(ss_edms_bcd_param);
+ repul_height = ss_edms_bcd_param;
Q nearness_or_something = repul_height - A[object][2][0];
if (abs(nearness_or_something) <= .333) {@@ -351,7 +350,7 @@
// ==================================================================
void robot_set_control(int32_t robot, Q thrust_lever, Q attitude_jet, Q jump) {- sincos(S[robot][3][0], &object0, &object1);
+ q_sincos(S[robot][3][0], &object0, &object1);
#ifdef EDMS_SHIPPABLE
if (I[robot][30] != ROBOT)
@@ -375,7 +374,7 @@
// Here is a separate control routine for robots under AI domination...
// ====================================================================
-void robot_set_ai_control(int32_t robot, Q desired_heading, Q desired_speed, Q sidestep, Q urgency, Q &there_yet,
+void robot_set_ai_control(int32_t robot, Q desired_heading, Q desired_speed, Q sidestep, Q urgency, Q *there_yet,
Q distance) {const Q one_by_pi = 0.31830, pi = 3.14159, two_pi = 6.28318;
@@ -400,7 +399,7 @@
Q speed = sqrt(S[robot][0][1] * S[robot][0][1] + S[robot][1][1] * S[robot][1][1]),
direction = desired_heading - S[robot][3][0];
- sincos(S[robot][3][0], &object0, &object1);
+ q_sincos(S[robot][3][0], &object0, &object1);
// Heading...
// ----------
@@ -411,7 +410,7 @@
// Inform the caller if we're on course yet...
// -------------------------------------------
- there_yet = one_by_pi * direction * (1 - 2 * (direction < 0));
+ *there_yet = one_by_pi * direction * (1 - 2 * (direction < 0));
// Set the control...
// ------------------
@@ -419,7 +418,7 @@
// Speed...
// --------
- I[robot][17] = urgency * (1 / (10 * there_yet + 5)) * (desired_speed - speed); // temporary...
+ I[robot][17] = urgency * (1 / (10 * *there_yet + 5)) * (desired_speed - speed); // temporary...
if (I[robot][17] < 0)
I[robot][17] = 0;
@@ -489,7 +488,7 @@
I[object_number][IDOF_RADIUS] = I[object_number][IDOF_ROBOT_RADIUS];
I[object_number][32] = I[object_number][33] = I[object_number][34] = I[object_number][35] = 0;
I[object_number][36] = I[object_number][IDOF_ROBOT_MASS_RECIP]; // Shrugoff "mass"...
- I[object_number][IDOF_COLLIDE] = -1;
+ I[object_number][IDOF_COLLIDE] = fix_make(-1,0);
I[object_number][IDOF_AUTODESTRUCT] = 0; // No kill I...
// Turn ON collisions for this robot...
--- a/src/Libraries/EDMS/Source/MODELS/robot.h
+++ b/src/Libraries/EDMS/Source/MODELS/robot.h
@@ -18,7 +18,7 @@
*/
// This seems silly now, but later it will all make sense, sensei...
// =================================================================
-int32_t make_robot(Q init_state[6][3], Q params[10]);
-void robot_set_control(int32_t robot, Q X, Q Y, Q Z);
-void robot_set_ai_control(int32_t robot, Q desired_heading, Q desired_speed, Q sidestep, Q urgency, Q &there_yet,
- Q distance);
+int32_t make_robot(fix init_state[6][3], fix params[10]);
+void robot_set_control(int32_t robot, fix X, fix Y, fix Z);
+void robot_set_ai_control(int32_t robot, fix desired_heading, fix desired_speed, fix sidestep, fix urgency, fix *there_yet,
+ fix distance);
--- a/src/Libraries/EDMS/Source/collide.cc
+++ b/src/Libraries/EDMS/Source/collide.cc
@@ -54,21 +54,21 @@
void generic_write_object(int32_t object, EDMS_Argblock_Pointer state) {extern void (*EDMS_off_playfield)(physics_handle caller);
- Q q_hash_x = hash_scale * state[object][DOF_X][0];
- Q q_hash_y = hash_scale * state[object][DOF_Y][0];
+ fix q_hash_x = fix_mul(hash_scale, state[object][DOF_X][0]);
+ fix q_hash_y = fix_mul(hash_scale, state[object][DOF_Y][0]);
uint32_t obit = object_bit(object);
- int32_t hash_x = (q_hash_x).to_int(); // The floor should be a function
- int32_t hash_y = (q_hash_y).to_int(); // that returns the edges of the ref. squares...
+ int32_t hash_x = fix_int(q_hash_x); // The floor should be a function
+ int32_t hash_y = fix_int(q_hash_y); // that returns the edges of the ref. squares...
if ((hash_x > 1) && (hash_y > 1) && (hash_x < collision_max) && (hash_y < collision_max)) {// We want to write a 2x2 block. We adjust the upper left corner of it
// appropriately given our location in the square.
- if (q_hash_x - hash_x < DELTA_BY_TWO)
+ if (q_hash_x - fix_make(hash_x,0) < DELTA_BY_TWO)
hash_x--;
- if (q_hash_y - hash_y < DELTA_BY_TWO)
+ if (q_hash_y - fix_make(hash_y,0) < DELTA_BY_TWO)
hash_y--;
write_object_bit(hash_x, hash_y, obit);
@@ -99,13 +99,13 @@
//
void generic_delete_object(int32_t object, EDMS_Argblock_Pointer state) {- Q q_hash_x = hash_scale * state[object][DOF_X][0];
- Q q_hash_y = hash_scale * state[object][DOF_Y][0];
+ fix q_hash_x = fix_mul(hash_scale, state[object][DOF_X][0]);
+ fix q_hash_y = fix_mul(hash_scale, state[object][DOF_Y][0]);
uint32_t obit = object_bit(object);
- int32_t hash_x = (q_hash_x).to_int(); // The floor should be a function
- int32_t hash_y = (q_hash_y).to_int(); // that returns the edges of the ref. squares...
+ int32_t hash_x = fix_int(q_hash_x); // The floor should be a function
+ int32_t hash_y = fix_int(q_hash_y); // that returns the edges of the ref. squares...
// AAAAAhhhhhhhhh...
// mout << "DA" << object << ": (" << hash_x << ", " << hash_y << ")\n";@@ -117,9 +117,9 @@
// We want to delete a 2x2 block. We adjust the upper left corner of it
// appropriately given our location in the square.
- if (q_hash_x - hash_x < DELTA_BY_TWO)
+ if (q_hash_x - fix_make(hash_x,0) < DELTA_BY_TWO)
hash_x--;
- if (q_hash_y - hash_y < DELTA_BY_TWO)
+ if (q_hash_y - fix_make(hash_y,0) < DELTA_BY_TWO)
hash_y--;
delete_object_bit(hash_x, hash_y, obit);
@@ -158,8 +158,8 @@
EDMS_Argblock_Pointer state = (A_is_active && no_no_not_me[object]) ? A : S;
- int32_t my_hx = (hash_scale * state[object][DOF_X][0]).to_int();
- int32_t my_hy = (hash_scale * state[object][DOF_Y][0]).to_int();
+ int32_t my_hx = fix_int(fix_mul(hash_scale, state[object][DOF_X][0]));
+ int32_t my_hy = fix_int(fix_mul(hash_scale, state[object][DOF_Y][0]));
return (abs(my_hx - hx) <= 1 && abs(my_hy - hy) <= 1);
}
@@ -172,9 +172,9 @@
void reset_collisions(int32_t object) {// Are we really inactivated?
// --------------------------
- if (I[object][IDOF_COLLIDE] > -1) {- I[I[object][IDOF_COLLIDE].to_int()][IDOF_COLLIDE] = -1;
- I[object][IDOF_COLLIDE] = -1;
+ if (I[object][IDOF_COLLIDE] > fix_make(-1,0)) {+ I[q_to_int(I[object][IDOF_COLLIDE])][IDOF_COLLIDE] = fix_make(-1,0);
+ I[object][IDOF_COLLIDE] = fix_make(-1,0);
}
}
@@ -183,7 +183,7 @@
void exclude_from_collisions(int32_t guy_1, int32_t guy_2) {// Are we ready?
// -------------
- if ((I[guy_1][IDOF_COLLIDE] > -1) || (I[guy_2][IDOF_COLLIDE] > -1)) {+ if ((I[guy_1][IDOF_COLLIDE] > fix_make(-1,0)) || (I[guy_2][IDOF_COLLIDE] > fix_make(-1,0))) {reset_collisions(guy_1);
reset_collisions(guy_2);
}
@@ -202,7 +202,7 @@
// =================================================================
int32_t are_you_there(int32_t object) {return (test_bitmask =
- data[(hash_scale * A[object][DOF_X][0]).to_int()][(hash_scale * A[object][DOF_Y][0]).to_int()]);
+ data[fix_int(fix_mul(hash_scale, A[object][DOF_X][0]))][fix_int(fix_mul(hash_scale, A[object][DOF_Y][0]))]);
}
//////////////////////////////
--- a/src/Libraries/EDMS/Source/edms.h
+++ b/src/Libraries/EDMS/Source/edms.h
@@ -103,7 +103,7 @@
// Checks integrity of EDMS. Returns EDMS error codes, as seen below.
// -------------------------------------------------------------------
-int32_t EDMS_sanity_check();
+int32_t EDMS_sanity_check(void);
// Here we exclude objects from hitting specific others...
// -------------------------------------------------------
--- a/src/Libraries/EDMS/Source/edms_int.h
+++ b/src/Libraries/EDMS/Source/edms_int.h
@@ -49,11 +49,11 @@
// Actual object types...
// ======================
-extern Q VACUUM, MARBLE, ROBOT, FIELD_POINT, BIPED, PELVIS, DEATH, D_FRAME;
+extern fix VACUUM, MARBLE, ROBOT, FIELD_POINT, BIPED, PELVIS, DEATH, D_FRAME;
// Commands for soliton from the state stream (in the Global.cc file)...
// =====================================================================
-extern Q END;
+extern fix END;
// Max and Minima...
// =================
@@ -85,8 +85,8 @@
// Memory conserving stuff...
// ==========================
-typedef Q EDMS_Argument_Block[MAX_OBJ][DOF][DOF_DERIVS];
-typedef Q (*EDMS_Argblock_Pointer)[DOF][DOF_DERIVS];
+typedef fix EDMS_Argument_Block[MAX_OBJ][DOF][DOF_DERIVS];
+typedef fix (*EDMS_Argblock_Pointer)[DOF][DOF_DERIVS];
// Have some functions...
// ======================
@@ -117,8 +117,6 @@
#define physics_handle_to_object_number(ph) (ph2on[ph])
#define object_number_to_physics_handle(on) (on2ph[on])
-extern "C" {-
void EDMS_init_handles(void);
physics_handle EDMS_bind_object_number(object_number on);
void EDMS_remap_object_number(object_number old, object_number nu);
@@ -125,15 +123,11 @@
physics_handle EDMS_get_free_ph(void);
void EDMS_release_object(physics_handle ph);
-}
-
// Terrain
// =======
-Q terrain(Q X, Q Y, int32_t deriv); // This calls Terrain()
-TerrainHit indoor_terrain(Q X, Q Y, Q Z, Q R, physics_handle ph, TFType type); // Indoor for Citadel, FBO, etc...
+fix terrain(fix X, fix Y, int32_t deriv); // This calls Terrain()
+TerrainHit indoor_terrain(fix X, fix Y, fix Z, fix R, physics_handle ph, TFType type); // Indoor for Citadel, FBO, etc...
-extern "C" {-
fix Terrain(fix X, fix Y, int32_t deriv); // This is provided by the user...
TerrainHit Indoor_Terrain(fix X, fix Y, fix Z, fix R, physics_handle ph, TFType type); // As is this...
@@ -167,10 +161,9 @@
bool FF_terrain(fix X, fix Y, fix Z, uchar fast, terrain_ff *TFF); // From Freefall...
bool FF_raycast(fix x, fix y, fix z, fix *vec, fix range, fix *where_hit, terrain_ff *tff);
-}
-bool ff_terrain(Q X, Q Y, Q Z, uchar fast, terrain_ff *TFF); // For the refined...
-bool ff_raycast(Q x, Q y, Q z, Fixpoint *vec, Q range, Fixpoint *where_hit, terrain_ff *FFT);
+bool ff_terrain(fix X, fix Y, fix Z, uchar fast, terrain_ff *TFF); // For the refined...
+bool ff_raycast(fix x, fix y, fix z, fix *vec, fix range, fix *where_hit, terrain_ff *FFT);
// Motion package functions...
// ===========================
@@ -202,7 +195,7 @@
// Playfield information and scaling...
// ------------------------------------
//#define COLLISION_SIZE 100
-#define DELTA_BY_TWO .5
+#define DELTA_BY_TWO fix_from_float(.5)
#define NUM_OBJECT_BITS 32
@@ -222,9 +215,11 @@
// Check for a given collision...
// ------------------------------
+/*
#define check_object(caller, looker) \
(data[(hash_scale * A[caller][DOF_X][0]).to_int()][(hash_scale * A[caller][DOF_Y][0]).to_int()] & \
object_bit(looker))
+*/
// This used to be a function in collide.cc
// I had to change the name because Seamus had some files locked out.
--- a/src/Libraries/EDMS/Source/edms_mod.h
+++ b/src/Libraries/EDMS/Source/edms_mod.h
@@ -22,7 +22,7 @@
// A girl's gotta have some standards.
// ===================================
-#define EDMS_DIV_ZERO_TOLERANCE .0005
+#define EDMS_DIV_ZERO_TOLERANCE fix_from_float(.0005)
#include <stdint.h>
#include "fix.h"
@@ -30,7 +30,7 @@
// State and args...
// =================
extern EDMS_Argblock_Pointer A;
-extern Q S[MAX_OBJ][7][4], I[MAX_OBJ][DOF_MAX];
+extern fix S[MAX_OBJ][7][4], I[MAX_OBJ][DOF_MAX];
// Functions...
// ============
--- a/src/Libraries/EDMS/Source/externs.h
+++ b/src/Libraries/EDMS/Source/externs.h
@@ -58,16 +58,16 @@
#include "fixpp.h"
// state of each object
-extern Q S[MAX_OBJ][DOF][DOF_DERIVS];
+extern fix S[MAX_OBJ][DOF][DOF_DERIVS];
// This is a copy of S that can be mucked with
extern EDMS_Argblock_Pointer A;
// internal degrees of freedom for each object
-extern Q I[MAX_OBJ][DOF_MAX];
+extern fix I[MAX_OBJ][DOF_MAX];
// expansion coefficients ??
-extern Q k[4][MAX_OBJ][DOF];
+extern fix k[4][MAX_OBJ][DOF];
// 0 if this object is sleeping ??
extern int32_t no_no_not_me[MAX_OBJ];
@@ -76,7 +76,7 @@
extern int32_t min_physics_handle;
// ??
-extern const Q min_scale_slice;
+extern const fix min_scale_slice;
// does A contain the current state of awake objects, instead of S?
extern bool A_is_active;
@@ -101,7 +101,7 @@
////
// multiply by this to go from physics units to collision bin units
-extern Q hash_scale;
+extern fix hash_scale;
// ??
extern int32_t EDMS_robot_global_badness_indicator;
@@ -116,11 +116,11 @@
// Solvers
// =======
-void soliton(Q timestep);
-void soliton_lite(Q timestep);
-void soliton_lite_holistic(Q timestep);
-void soliton_vector(Q timestep);
-void soliton_vector_holistic(Q timestep);
+void soliton(fix timestep);
+void soliton_lite(fix timestep);
+void soliton_lite_holistic(fix timestep);
+void soliton_vector(fix timestep);
+void soliton_vector_holistic(fix timestep);
// Tools
// =====
@@ -127,7 +127,7 @@
int32_t settle_object(int32_t object);
void mprint_state(int32_t object);
void inventory_and_statistics(int32_t show_sleepers);
-int32_t sanity_check();
+int32_t sanity_check(void);
// Collisions
// ==========
@@ -137,12 +137,12 @@
// EDMS internal testbed wireframe...
// ==================================
void draw_object(int32_t);
-void setup_graphics();
-void kill_graphics();
+void setup_graphics(void);
+void kill_graphics(void);
// Get the Euler angles we need from the stuff in the state...
// ===========================================================
-void EDMS_get_Euler_angles(Q &alpha, Q &beta, Q &gamma, int32_t object);
+void EDMS_get_Euler_angles(fix *alpha, fix *beta, fix *gamma, int32_t object);
////////////////////////////// more stuff
--- a/src/Libraries/EDMS/Source/globals.cc
+++ b/src/Libraries/EDMS/Source/globals.cc
@@ -25,7 +25,7 @@
#include "fixpp.h"
-Q END = -9999., VACUUM = 0., MARBLE = 1., FIELD_POINT = 2., ROBOT = 3, BIPED = 4, PELVIS = 5, DEATH = 6, D_FRAME = 7;
+fix END = fix_from_float(-9999.), VACUUM = fix_from_float(0.), MARBLE = fix_from_float(1.), FIELD_POINT = fix_from_float(2.), ROBOT = fix_make(3,0), BIPED = fix_make(4,0), PELVIS = fix_make(5,0), DEATH = fix_make(6,0), D_FRAME = fix_make(7,0);
int32_t min_physics_handle = 0;
--- a/src/Libraries/EDMS/Source/interfac.cc
+++ b/src/Libraries/EDMS/Source/interfac.cc
@@ -72,7 +72,7 @@
// Constants...
// ============
-Q fix_zero = 0.;
+fix fix_zero = fix_from_float(0.);
// Bridge routine to the terrain functions. C++ functions are all lower case, C are Capped...
// ===========================================================================================
@@ -81,8 +81,8 @@
// because it is not called by the user,
// but rather calls the user function Terrain().
// =============================================
-Q terrain(Q X, Q Y, int32_t deriv) {- Q ans;
+fix terrain(fix X, fix Y, int32_t deriv) {+ fix ans = 0;
printf("There is no terrain in space!\n");// ans.fix_to( Terrain( X.to_fix(), Y.to_fix(), deriv ) );
@@ -91,9 +91,9 @@
// Same with Indoors...
// --------------------
-TerrainHit indoor_terrain(Q X, Q Y, Q Z, Q R, physics_handle ph, TFType type) {- if ((X > 1) && (Y > 1) && (X < 64) && (Y < 64)) {- return Indoor_Terrain(X.to_fix(), Y.to_fix(), Z.to_fix(), R.to_fix(), ph, type);
+TerrainHit indoor_terrain(fix X, fix Y, fix Z, fix R, physics_handle ph, TFType type) {+ if ((X > FIX_UNIT) && (Y > FIX_UNIT) && (X < fix_make(64,0)) && (Y < fix_make(64,0))) {+ return Indoor_Terrain(X, Y, Z, R, ph, type);
} else {// EDMS_robot_global_badness_indicator = 1000;
// mout << "!EDMS: integrator = " << EDMS_integrating << " !!\n";
@@ -121,12 +121,12 @@
// And with Freefall...
// --------------------
-bool ff_terrain(Q X, Q Y, Q Z, uchar fast, terrain_ff *FFT) {- return FF_terrain(X.to_fix(), Y.to_fix(), Z.to_fix(), fast, FFT);
+bool ff_terrain(fix X, fix Y, fix Z, uchar fast, terrain_ff *FFT) {+ return FF_terrain(X, Y, Z, fast, FFT);
}
-bool ff_raycast(Q x, Q y, Q z, Fixpoint *vec, Q range, Fixpoint *where_hit, terrain_ff *FFT) {- return FF_raycast(x.to_fix(), y.to_fix(), z.to_fix(), (fix *)vec, range.to_fix(), (fix *)where_hit, FFT);
+bool ff_raycast(fix x, fix y, fix z, fix *vec, fix range, fix *where_hit, terrain_ff *FFT) {+ return FF_raycast(x, y, z, vec, range, where_hit, FFT);
}
bool FF_terrain(fix X, fix Y, fix Z, uchar fast, terrain_ff *TFF) { return (true); }@@ -135,7 +135,6 @@
// We need to link to c...
// =======================
-extern "C" {// Startup the mighty and perilous EDMS engine...
// ==============================================
@@ -220,18 +219,18 @@
int on = physics_handle_to_object_number(ph);
if (on > -1 && on < MAX_OBJ) {- s->X = S[on][0][0].to_fix();
- s->X_dot = S[on][0][1].to_fix();
- s->Y = S[on][1][0].to_fix();
- s->Y_dot = S[on][1][1].to_fix();
- s->Z = S[on][2][0].to_fix();
- s->Z_dot = S[on][2][1].to_fix();
- s->alpha = S[on][3][0].to_fix();
- s->alpha_dot = S[on][3][1].to_fix();
- s->beta = S[on][4][0].to_fix();
- s->beta_dot = S[on][4][1].to_fix();
- s->gamma = S[on][5][0].to_fix();
- s->gamma_dot = S[on][5][1].to_fix();
+ s->X = S[on][0][0];
+ s->X_dot = S[on][0][1];
+ s->Y = S[on][1][0];
+ s->Y_dot = S[on][1][1];
+ s->Z = S[on][2][0];
+ s->Z_dot = S[on][2][1];
+ s->alpha = S[on][3][0];
+ s->alpha_dot = S[on][3][1];
+ s->beta = S[on][4][0];
+ s->beta_dot = S[on][4][1];
+ s->gamma = S[on][5][0];
+ s->gamma_dot = S[on][5][1];
}
#ifdef EDMS_SHIPPABLE
@@ -254,22 +253,22 @@
// Now move the thing...
// =====================
- S[on][0][0].fix_to(s->X);
- S[on][0][1].fix_to(s->X_dot);
- S[on][1][0].fix_to(s->Y);
- S[on][1][1].fix_to(s->Y_dot);
- S[on][2][0].fix_to(s->Z);
- S[on][2][1].fix_to(s->Z_dot);
+ S[on][0][0] = s->X;
+ S[on][0][1] = s->X_dot;
+ S[on][1][0] = s->Y;
+ S[on][1][1] = s->Y_dot;
+ S[on][2][0] = s->Z;
+ S[on][2][1] = s->Z_dot;
if (I[on][30] != D_FRAME) {- S[on][3][0].fix_to(s->alpha);
+ S[on][3][0] = s->alpha;
S[on][3][1] = fix_zero;
- S[on][4][0].fix_to(s->beta);
+ S[on][4][0] = s->beta;
S[on][4][1] = fix_zero;
- S[on][5][0].fix_to(s->gamma);
+ S[on][5][0] = s->gamma;
S[on][5][1] = fix_zero;
} else {- Q alpha, beta, gamma, sin_alpha, cos_alpha, sin_beta, cos_beta, sin_gamma, cos_gamma;
+ fix alpha, beta, gamma, sin_alpha, cos_alpha, sin_beta, cos_beta, sin_gamma, cos_gamma;
// alpha.fix_to( s -> alpha);
// beta.fix_to( s -> beta);
@@ -277,20 +276,20 @@
// For shock...
// ------------
- alpha.fix_to(s->beta);
- beta.fix_to(s->gamma);
- gamma.fix_to(s->alpha);
+ alpha = s->beta;
+ beta = s->gamma;
+ gamma = s->alpha;
alpha = beta = 0;
- sincos(.5 * alpha, &sin_alpha, &cos_alpha);
- sincos(.5 * beta, &sin_beta, &cos_beta);
- sincos(.5 * gamma, &sin_gamma, &cos_gamma);
+ fix_sincos(fix_to_fang(fix_mul(fix_from_float(.5), alpha)), &sin_alpha, &cos_alpha);
+ fix_sincos(fix_to_fang(fix_mul(fix_from_float(.5), beta)), &sin_beta, &cos_beta);
+ fix_sincos(fix_to_fang(fix_mul(fix_from_float(.5), gamma)), &sin_gamma, &cos_gamma);
- S[on][3][0] = cos_gamma * cos_alpha * cos_beta + sin_gamma * sin_alpha * sin_beta;
- S[on][4][0] = cos_gamma * cos_alpha * sin_beta - sin_gamma * sin_alpha * cos_beta;
- S[on][5][0] = cos_gamma * sin_alpha * cos_beta + sin_gamma * cos_alpha * sin_beta;
- S[on][6][0] = -cos_gamma * sin_alpha * sin_beta + sin_gamma * cos_alpha * cos_beta;
+ S[on][3][0] = fix_mul(fix_mul(cos_gamma, cos_alpha), cos_beta) + fix_mul(fix_mul(sin_gamma, sin_alpha), sin_beta);
+ S[on][4][0] = fix_mul(fix_mul(cos_gamma, cos_alpha), sin_beta) - fix_mul(fix_mul(sin_gamma, sin_alpha), cos_beta);
+ S[on][5][0] = fix_mul(fix_mul(cos_gamma, sin_alpha), cos_beta) + fix_mul(fix_mul(sin_gamma, cos_alpha), sin_beta);
+ S[on][6][0] = fix_mul(fix_mul(-cos_gamma, sin_alpha), sin_beta) + fix_mul(fix_mul(sin_gamma, cos_alpha), cos_beta);
// Derivatives
S[on][3][1] = 0;
@@ -312,11 +311,13 @@
int32_t on;
State current_state;
+ fprintf(stderr, "EDMS_mouselook %d %d → ", fix_int(S[on][3][0]), fix_int(S[on][3][1]));
on = physics_handle_to_object_number(ph);
EDMS_get_state(ph, ¤t_state);
- S[on][3][0].fix_to(current_state.alpha + xlook);
+ S[on][3][0] = current_state.alpha + fix_make(xlook, 0);
S[on][3][1] = fix_zero;
+ fprintf(stderr, "%d %d\n", fix_int(S[on][3][0]), fix_int(S[on][3][1]));
}
// Here we exclude objects from hitting each specific others...
@@ -357,7 +358,7 @@
if (ph > -1) {on = ph2on[ph];
if (I[on][30] == ROBOT)
- I[on][5] = -1;
+ I[on][5] = fix_make(-1,0);
} // You suck...
}
@@ -417,7 +418,7 @@
// Hardness scale for robots...
// ----------------------------
-#define ROBOT_HARD_FAC 10
+#define ROBOT_HARD_FAC fix_make(10,0)
// This guy is BROKEN FOR NOW (until we get the params finalized)...
// ------------------------------------------------
@@ -430,12 +431,12 @@
#endif
// mout << "RD: " << I[on][IDOF_ROBOT_ROLL_DRAG] << " : M:" << I[on][IDOF_ROBOT_MASS] << "\n";
- m->pep = (I[on][IDOF_ROBOT_ROLL_DRAG] / (1.5 * I[on][IDOF_ROBOT_MASS])).to_fix();
- m->size = I[on][IDOF_ROBOT_RADIUS].to_fix();
- m->hardness = (I[on][IDOF_ROBOT_K] * I[on][IDOF_ROBOT_RADIUS] / (I[on][IDOF_ROBOT_MASS] * ROBOT_HARD_FAC)).to_fix();
- m->mass = I[on][IDOF_ROBOT_MASS].to_fix();
- m->gravity = I[on][IDOF_ROBOT_GRAVITY].to_fix();
- m->cyber_space = I[on][IDOF_CYBERSPACE].to_int();
+ m->pep = fix_div(I[on][IDOF_ROBOT_ROLL_DRAG], fix_mul(fix_from_float(1.5), I[on][IDOF_ROBOT_MASS]));
+ m->size = I[on][IDOF_ROBOT_RADIUS];
+ m->hardness = fix_mul_div(I[on][IDOF_ROBOT_K], I[on][IDOF_ROBOT_RADIUS], fix_mul(I[on][IDOF_ROBOT_MASS], ROBOT_HARD_FAC));
+ m->mass = I[on][IDOF_ROBOT_MASS];
+ m->gravity = I[on][IDOF_ROBOT_GRAVITY];
+ m->cyber_space = fix_int(I[on][IDOF_CYBERSPACE]);
}
// And the compression test for terrain "traps..."
@@ -444,7 +445,7 @@
int32_t object;
object = ph2on[ph]; // As stupid as it gets...
- return (I[object][14]).to_fix();
+ return I[object][14];
}
// In flux (Thrust, attitude and JumpJets)...
@@ -451,7 +452,7 @@
// ==========================================
void EDMS_control_robot(physics_handle ph, fix T, fix A, fix J) {- Q TT, // thrust
+ fix TT, // thrust
AA, // attitude jets
JJ; // jump jets
@@ -460,9 +461,9 @@
mout << "Hey, you are an idiot...";
#endif
- TT.fix_to(T);
- AA.fix_to(A);
- JJ.fix_to(J);
+ TT = T;
+ AA = A;
+ JJ = J;
int32_t on = physics_handle_to_object_number(ph);
robot_set_control(on, TT, AA, JJ);
@@ -471,7 +472,7 @@
// AI control routines...
// ======================
void EDMS_ai_control_robot(physics_handle ph, fix D_H, fix D_S, fix S_S, fix U, fix *T_Y, fix D) {- Q DH, // desired heading
+ fix DH, // desired heading
DS, // desired speed
SS, // sidestep
UU, // urgency
@@ -483,24 +484,24 @@
mout << "Hey, you are and idiot...";
#endif
- DH.fix_to(D_H);
- DS.fix_to(D_S);
- SS.fix_to(S_S);
- UU.fix_to(U);
- DD.fix_to(D);
+ DH = D_H;
+ DS = D_S;
+ SS = S_S;
+ UU = U;
+ DD = D;
int32_t on = physics_handle_to_object_number(ph);
- robot_set_ai_control(on, DH, DS, SS, UU, TU, DD);
+ robot_set_ai_control(on, DH, DS, SS, UU, &TU, DD);
- *T_Y = TU.to_fix();
+ *T_Y = TU;
}
// These are different parameters than for the marble now...
// ---------------------------------------------------------
physics_handle EDMS_make_robot(Robot *m, State *s) {- Q params[10], init_state[6][3];
+ fix params[10], init_state[6][3];
- Q mass, pep, hardness, size, gravity;
+ fix mass, pep, hardness, size, gravity;
int32_t cyber_space;
@@ -507,64 +508,64 @@
int32_t on = 0;
physics_handle ph = 0;
- init_state[DOF_X][0].fix_to(s->X);
- init_state[DOF_X][1].fix_to(s->X_dot);
- init_state[DOF_Y][0].fix_to(s->Y);
- init_state[DOF_Y][1].fix_to(s->Y_dot);
- init_state[DOF_Z][0].fix_to(s->Z);
- init_state[DOF_Z][1].fix_to(s->Z_dot);
- init_state[DOF_ALPHA][0].fix_to(s->alpha);
- init_state[DOF_ALPHA][1].fix_to(s->alpha_dot);
+ init_state[DOF_X][0] = s->X;
+ init_state[DOF_X][1] = s->X_dot;
+ init_state[DOF_Y][0] = s->Y;
+ init_state[DOF_Y][1] = s->Y_dot;
+ init_state[DOF_Z][0] = s->Z;
+ init_state[DOF_Z][1] = s->Z_dot;
+ init_state[DOF_ALPHA][0] = s->alpha;
+ init_state[DOF_ALPHA][1] = s->alpha_dot;
init_state[DOF_BETA][0] = init_state[DOF_BETA][1] = init_state[DOF_GAMMA][0] = init_state[DOF_GAMMA][1] = END;
- mass.fix_to(m->mass);
- size.fix_to(m->size);
+ mass = m->mass;
+ size = m->size;
// if ( size > .45/hash_scale ) size = .45/hash_scale;
- hardness.fix_to(m->hardness);
- pep.fix_to(m->pep);
- gravity.fix_to(m->gravity);
+ hardness = m->hardness;
+ pep = m->pep;
+ gravity = m->gravity;
cyber_space = m->cyber_space;
// if (hardness > 15) { mout << "Hardness too too too: " << hardness << "\n"; hardness = 15; }- if (mass < 1)
- mass = 1;
- if (mass > 30)
- mass = 30;
+ if (mass < FIX_UNIT)
+ mass = FIX_UNIT;
+ if (mass > fix_make(30,0))
+ mass = fix_make(30,0);
- hardness = hardness * (mass * ROBOT_HARD_FAC / size);
- if (hardness > 4000) {- hardness = 4000;
+ hardness = fix_mul(hardness, fix_mul_div(mass, ROBOT_HARD_FAC, size));
+ if (hardness > fix_make(4000,0)) {+ hardness = fix_make(4000,0);
// mout << "Hard cap!\n";
}
params[OFFSET(IDOF_ROBOT_K)] = hardness;
- params[OFFSET(IDOF_ROBOT_D)] = 1.5 * sqrt(params[OFFSET(IDOF_ROBOT_K)]) * sqrt(mass);
+ params[OFFSET(IDOF_ROBOT_D)] = fix_mul(fix_mul(fix_from_float(1.5), fix_sqrt(params[OFFSET(IDOF_ROBOT_K)])), fix_sqrt(mass));
params[OFFSET(IDOF_ROBOT_RADIUS)] = size;
// mout << params[OFFSET(IDOF_ROBOT_D)] << "\n";
- params[OFFSET(IDOF_ROBOT_ROLL_DRAG)] = 1.5 * pep * mass;
- params[OFFSET(IDOF_ROBOT_MASS_RECIP)] = 1. / mass;
+ params[OFFSET(IDOF_ROBOT_ROLL_DRAG)] = fix_mul(fix_mul(fix_from_float(1.5), pep), mass);
+ params[OFFSET(IDOF_ROBOT_MASS_RECIP)] = fix_div(fix_from_float(1.), mass);
params[OFFSET(IDOF_ROBOT_GRAVITY)] = gravity;
params[OFFSET(IDOF_ROBOT_MASS)] = mass;
// params[7] = 1. / ( .4*mass*size*size );
// params[8] = 5.*(1. / params[7]);
// params[9] = .4*mass*size*size;
- params[OFFSET(IDOF_ROBOT_MOI)] = .4 * mass * size * size;
- params[OFFSET(IDOF_ROBOT_ROT_DRAG)] = 5 * params[OFFSET(IDOF_ROBOT_MOI)];
+ params[OFFSET(IDOF_ROBOT_MOI)] = fix_mul(fix_mul(fix_mul(fix_from_float(.4), mass), size), size);
+ params[OFFSET(IDOF_ROBOT_ROT_DRAG)] = fix_mul(fix_make(5,0), params[OFFSET(IDOF_ROBOT_MOI)]);
if (params[OFFSET(IDOF_ROBOT_MOI)] != 0)
- params[OFFSET(IDOF_ROBOT_MOI_RECIP)] = 1.0 / params[OFFSET(IDOF_ROBOT_MOI)];
+ params[OFFSET(IDOF_ROBOT_MOI_RECIP)] = fix_div(fix_from_float(1.0), params[OFFSET(IDOF_ROBOT_MOI)]);
else
- params[OFFSET(IDOF_ROBOT_MOI_RECIP)] = 0.0;
+ params[OFFSET(IDOF_ROBOT_MOI_RECIP)] = fix_from_float(0.0);
on = make_robot(init_state, params);
// Here is where cyberspace gets turned on...
// ------------------------------------------
- I[on][IDOF_CYBERSPACE] = (cyber_space > 0);
+ I[on][IDOF_CYBERSPACE] = fix_make(cyber_space > 0, 0);
ph = EDMS_bind_object_number(on);
@@ -577,16 +578,16 @@
}
void EDMS_set_robot_parameters(physics_handle ph, Robot *m) {- Q mass, hardness, size, pep, gravity;
+ fix mass, hardness, size, pep, gravity;
int32_t cyber_space;
- mass.fix_to(m->mass);
- size.fix_to(m->size);
+ mass = m->mass;
+ size = m->size;
// if ( size > .45/hash_scale ) size = .45/hash_scale;
- hardness.fix_to(m->hardness);
- pep.fix_to(m->pep);
- gravity.fix_to(m->gravity);
+ hardness = m->hardness;
+ pep = m->pep;
+ gravity = m->gravity;
cyber_space = m->cyber_space;
int32_t on = physics_handle_to_object_number(ph);
@@ -603,30 +604,30 @@
// mout << " pepp: " << pep << "\n";
// mout << " grav: " << gravity << "\n";
- if (mass < 1)
- mass = 1;
- if (mass > 30)
- mass = 30;
+ if (mass < FIX_UNIT)
+ mass = FIX_UNIT;
+ if (mass > fix_make(30,0))
+ mass = fix_make(30,0);
hardness = hardness * (mass * ROBOT_HARD_FAC / size);
// hardness = hardness*(mass*ROBOT_HARD_FAC/size);
- if (hardness > 4000) {- hardness = 4000;
+ if (hardness > fix_make(4000,0)) {+ hardness = fix_make(4000,0);
// mout << "Hard cap!\n";
}
I[on][IDOF_ROBOT_K] = hardness;
- I[on][IDOF_ROBOT_D] = 1.5 * sqrt(I[on][IDOF_ROBOT_K]) * sqrt(mass);
+ I[on][IDOF_ROBOT_D] = fix_mul(fix_mul(fix_from_float(1.5), fix_sqrt(I[on][IDOF_ROBOT_K])), fix_sqrt(mass));
I[on][IDOF_ROBOT_RADIUS] = size;
- I[on][IDOF_ROBOT_ROLL_DRAG] = 1.5 * pep * mass;
- I[on][IDOF_ROBOT_MASS_RECIP] = 1. / mass;
+ I[on][IDOF_ROBOT_ROLL_DRAG] = fix_mul(fix_mul(fix_from_float(1.5), pep), mass);
+ I[on][IDOF_ROBOT_MASS_RECIP] = fix_div(fix_from_float(1.), mass);
I[on][IDOF_ROBOT_GRAVITY] = gravity;
I[on][IDOF_ROBOT_MASS] = mass;
- I[on][IDOF_ROBOT_MOI_RECIP] = 1. / (.4 * mass * size * size);
- I[on][IDOF_ROBOT_ROT_DRAG] = 5. * (1. / I[on][IDOF_ROBOT_MOI_RECIP]);
- I[on][IDOF_ROBOT_MOI] = .4 * mass * size * size;
- I[on][IDOF_CYBERSPACE] = (cyber_space > 0);
+ I[on][IDOF_ROBOT_MOI_RECIP] = fix_div(fix_from_float(1.), fix_mul(fix_mul(fix_mul(fix_from_float(.4), mass), size), size));
+ I[on][IDOF_ROBOT_ROT_DRAG] = fix_mul(fix_from_float(5.), fix_div(fix_from_float(1.), I[on][IDOF_ROBOT_MOI_RECIP]));
+ I[on][IDOF_ROBOT_MOI] = fix_mul(fix_mul(fix_mul(fix_from_float(.4), mass), size), size);
+ I[on][IDOF_CYBERSPACE] = fix_make(cyber_space > 0, 0);
// mout << "Roll: " << I[on][IDOF_ROBOT_ROLL_DRAG] << "\n";
}
@@ -637,8 +638,8 @@
// 4th order and very stable...
// ----------------------------
void EDMS_soliton(fix timestep) {- Q temp;
- temp.fix_to(timestep);
+ fix temp;
+ temp = timestep;
soliton(temp);
}
@@ -645,8 +646,8 @@
// 2nd order and needs some attention...
// -------------------------------------
void EDMS_soliton_lite(fix timestep) {- Q temp;
- temp.fix_to(timestep);
+ fix temp;
+ temp = timestep;
soliton_lite(temp);
}
@@ -653,8 +654,8 @@
// Efficient and unstoppable...
// ----------------------------
void EDMS_soliton_vector(fix timestep) {- Q temp;
- temp.fix_to(timestep);
+ fix temp;
+ temp = timestep;
soliton_vector(temp);
}
@@ -661,8 +662,8 @@
// Won't allow objects to collide w/one another...
// -----------------------------------------------
void EDMS_soliton_vector_holistic(fix timestep) {- Q temp;
- temp.fix_to(timestep);
+ fix temp;
+ temp = timestep;
soliton_vector_holistic(temp);
}
@@ -751,5 +752,3 @@
// Fun...
// ======
}
-
-} // End of extern "C" for the &^%$@% compiler...
--- a/src/Libraries/EDMS/Source/intrsect.cc
+++ b/src/Libraries/EDMS/Source/intrsect.cc
@@ -34,19 +34,19 @@
extern int32_t alarm_clock[MAX_OBJ];
extern int32_t no_no_not_me[MAX_OBJ];
-bool do_work(int32_t object, int32_t other_object, Q my_rad, Q your_rad, Fixpoint *my_pos, Fixpoint *other_pos,
- Q &result0, Q &result1, Q &result2);
+bool do_work(int32_t object, int32_t other_object, fix my_rad, fix your_rad, fix *my_pos, fix *other_pos,
+ fix *result0, fix *result1, fix *result2);
-void shall_we_dance(int32_t object, Q &result0, Q &result1, Q &result2);
+void shall_we_dance(int32_t object, fix *result0, fix *result1, fix *result2);
// Call me instead of having special code everywhere...
// ====================================================
-void shall_we_dance(int32_t object, Q &result0, Q &result1, Q &result2) {+void shall_we_dance(int32_t object, fix *result0, fix *result1, fix *result2) {int32_t other_object;
- Q my_radius, your_radius;
+ fix my_radius, your_radius;
- Q my_position[3], your_position[3];
+ fix my_position[3], your_position[3];
// Collision B/C...
// ----------------
@@ -69,7 +69,7 @@
for (other_object = bit; other_object < MAX_OBJ && S[other_object][0][0] > END;
other_object += NUM_OBJECT_BITS) {- if (other_object != object && I[object][IDOF_COLLIDE].to_int() != other_object) {+ if (other_object != object && fix_int(I[object][IDOF_COLLIDE]) != other_object) {// Okay, now we have a confirmed hash hit...
// -----------------------------------------
@@ -103,16 +103,16 @@
// Are YOU special???
// ------------------
if (I[other_object][IDOF_MODEL] == PELVIS) {- Q offset_x = I[other_object][0] * sin(A[other_object][4][0]),
- offset_y = -1.5 * I[other_object][0] * sin(A[other_object][5][0]),
- offset_z = I[other_object][0] * cos(A[other_object][4][0]) * cos(A[other_object][5][0]);
+ fix offset_x = fix_mul(I[other_object][0], fix_sin(fix_to_fang(A[other_object][4][0]))),
+ offset_y = fix_mul(fix_mul(fix_from_float(-1.5), I[other_object][0]), fix_sin(fix_to_fang(A[other_object][5][0]))),
+ offset_z = fix_mul(fix_mul(I[other_object][0], fix_cos(fix_to_fang(A[other_object][4][0]))), fix_cos(fix_to_fang(A[other_object][5][0])));
- Q sin_alpha = 0, cos_alpha = 0;
+ fix sin_alpha = 0, cos_alpha = 0;
- sincos(-A[other_object][3][0], &sin_alpha, &cos_alpha);
+ fix_sincos(fix_to_fang(-A[other_object][3][0]), &sin_alpha, &cos_alpha);
- Q final_x = cos_alpha * offset_x + sin_alpha * offset_y;
- Q final_y = -sin_alpha * offset_x + cos_alpha * offset_y;
+ fix final_x = fix_mul(cos_alpha, offset_x) + fix_mul(sin_alpha, offset_y);
+ fix final_y = fix_mul(-sin_alpha, offset_x) + fix_mul(cos_alpha, offset_y);
your_position[0] = A[other_object][0][0] + final_x;
your_position[1] = A[other_object][1][0] + final_y;
@@ -119,7 +119,7 @@
your_position[2] = A[other_object][2][0] + offset_z;
my_radius = I[object][IDOF_RADIUS];
- your_radius = .75 * I[other_object][IDOF_PELVIS_RADIUS];
+ your_radius = fix_mul(fix_from_float(.75), I[other_object][IDOF_PELVIS_RADIUS]);
do_work(object, other_object, my_radius, your_radius, my_position, your_position, result0,
result1, result2);
@@ -128,16 +128,16 @@
// Am I special???
// ---------------
if (I[object][IDOF_MODEL] == PELVIS) {- Q offset_x = I[object][0] * sin(A[object][4][0]),
- offset_y = -1.5 * I[object][0] * sin(A[object][5][0]),
- offset_z = I[object][0] * cos(A[object][4][0]) * cos(A[object][5][0]);
+ fix offset_x = fix_mul(I[object][0], fix_sin(fix_to_fang(A[object][4][0]))),
+ offset_y = fix_mul(fix_mul(fix_from_float(-1.5), I[object][0]), fix_sin(fix_to_fang(A[object][5][0]))),
+ offset_z = fix_mul(fix_mul(I[object][0], fix_cos(fix_to_fang(A[object][4][0]))), fix_cos(fix_to_fang(A[object][5][0])));
- Q sin_alpha = 0, cos_alpha = 0;
+ fix sin_alpha = 0, cos_alpha = 0;
- sincos(-A[object][3][0], &sin_alpha, &cos_alpha);
+ fix_sincos(fix_to_fang(-A[object][3][0]), &sin_alpha, &cos_alpha);
- Q final_x = cos_alpha * offset_x + sin_alpha * offset_y;
- Q final_y = -sin_alpha * offset_x + cos_alpha * offset_y;
+ fix final_x = fix_mul(cos_alpha, offset_x) + fix_mul(sin_alpha, offset_y);
+ fix final_y = fix_mul(-sin_alpha, offset_x) + fix_mul(cos_alpha, offset_y);
my_position[0] = A[object][0][0] + final_x;
my_position[1] = A[object][1][0] + final_y;
@@ -155,7 +155,7 @@
your_position[2] = S[other_object][2][0];
}
- my_radius = .75 * I[object][IDOF_PELVIS_RADIUS];
+ my_radius = fix_mul(fix_from_float(.75), I[object][IDOF_PELVIS_RADIUS]);
your_radius = I[other_object][IDOF_RADIUS];
do_work(object, other_object, my_radius, your_radius, my_position, your_position, result0,
@@ -175,9 +175,9 @@
// Here's the meat of the sutuation...
// ===================================
-bool do_work(int32_t object, int32_t other_object, Q my_rad, Q your_rad, Fixpoint *my_pos, Fixpoint *other_pos,
- Q &result0, Q &result1, Q &result2) {- Q cm_radius = (my_rad + your_rad);
+bool do_work(int32_t object, int32_t other_object, fix my_rad, fix your_rad, fix *my_pos, fix *other_pos,
+ fix *result0, fix *result1, fix *result2) {+ fix cm_radius = (my_rad + your_rad);
// First do a preliminary check to avoid overflow.
dx = my_pos[0] - other_pos[0];
@@ -190,47 +190,47 @@
// Test for primary collision...
// =============================
- Q test_radius = sqrt(dx * dx + dy * dy + dz * dz);
+ fix test_radius = fix_sqrt(fix_mul(dx, dx) + fix_mul(dy, dy) + fix_mul(dz, dz));
- if ((test_radius < cm_radius) && (test_radius > 0.0005)) {+ if ((test_radius < cm_radius) && (test_radius > fix_from_float(0.0005))) {// Is there a problem???
// ---------------------
- if (test_radius < .03)
- test_radius = .03;
+ if (test_radius < fix_from_float(.03))
+ test_radius = fix_from_float(.03);
// Callback...
// -----------
physics_handle C = on2ph[object], V = on2ph[other_object];
- int32_t badness = (20 * (1. - test_radius / cm_radius)).to_int();
+ int32_t badness = fix_int(fix_mul(fix_make(20,0), fix_from_float(1.) - fix_div(test_radius, cm_radius)));
fix location[3];
- location[0] = my_pos[0].to_fix();
- location[1] = my_pos[1].to_fix();
- location[2] = my_pos[2].to_fix();
+ location[0] = my_pos[0];
+ location[1] = my_pos[1];
+ location[2] = my_pos[2];
EDMS_object_collision(C, V, badness, 0, 0, location);
- Q Eta = (cm_radius - test_radius); // Eta...
+ fix Eta = (cm_radius - test_radius); // Eta...
- test_radius = 1 / test_radius;
- result0 += Eta * dx * test_radius;
- result1 += Eta * dy * test_radius;
- result2 += Eta * dz * test_radius;
+ test_radius = fix_div(FIX_UNIT, test_radius);
+ *result0 += fix_mul(fix_mul(Eta, dx), test_radius);
+ *result1 += fix_mul(fix_mul(Eta, dy), test_radius);
+ *result2 += fix_mul(fix_mul(Eta, dz), test_radius);
// God save the Queen...
// ---------------------
- if (result0 > my_rad)
- result0 = my_rad;
- if (result0 < -my_rad)
- result0 = -my_rad;
+ if (*result0 > my_rad)
+ *result0 = my_rad;
+ if (*result0 < -my_rad)
+ *result0 = -my_rad;
- if (result1 > my_rad)
- result1 = my_rad;
- if (result1 < -my_rad)
- result1 = -my_rad;
+ if (*result1 > my_rad)
+ *result1 = my_rad;
+ if (*result1 < -my_rad)
+ *result1 = -my_rad;
// Wakeup...
// =========
--- a/src/Libraries/EDMS/Source/phy_tool.cc
+++ b/src/Libraries/EDMS/Source/phy_tool.cc
@@ -27,7 +27,6 @@
// Get on with it then...
// ======================
-#include <iostream>
#include "edms_int.h" //Object types, END conventions, etc.
#include "idof.h"
@@ -40,7 +39,7 @@
// INTERNAL STUFF
// ==============
-void snobby_soliton_lite(Q timestep, int32_t object);
+void snobby_soliton_lite(fix timestep, int32_t object);
extern void (*idof_functions[MAX_OBJ])(int), // Pointers to the appropriate places...
(*equation_of_motion[MAX_OBJ][7])(int); // The integer is the object number...
@@ -47,8 +46,8 @@
// Courtesy of C++ and inline fixpoint and such...
// ===============================================
-static Q one_sixth = .1666666666667, // Overboard?
- point_five = .5, point_one_two_five = .125, two = 2., point_1 = 0.1;
+static fix one_sixth = fix_from_float(.1666666666667), // Overboard?
+ point_five = fix_from_float(.5), point_one_two_five = fix_from_float(.125), two = fix_from_float(2.), point_1 = fix_from_float(0.1);
// Here is a routine that should help in the placement of EDMS objects. 3D+ only!
// ===============================================================================
@@ -55,8 +54,8 @@
int32_t settle_object(int32_t object) {int return_value = -1; // Failure...
- Q nrg = 1000., nrg_min = .1,
- pass_time = .01; // Not meta-stable!
+ fix nrg = fix_from_float(1000.), nrg_min = fix_from_float(.1),
+ pass_time = fix_from_float(.01); // Not meta-stable!
int32_t count = 0, max_count = 1000;
@@ -69,9 +68,9 @@
snobby_soliton_lite(pass_time, object);
- nrg = S[object][DOF_X][1] * S[object][DOF_X][1] +
- S[object][DOF_Y][1] * S[object][DOF_Y][1] // Too dangerous for assumptions...
- + S[object][DOF_Z][1] * S[object][DOF_Z][1]; // Forget the others...
+ nrg = fix_mul(S[object][DOF_X][1], S[object][DOF_X][1]) +
+ fix_mul(S[object][DOF_Y][1], S[object][DOF_Y][1]) // Too dangerous for assumptions...
+ + fix_mul(S[object][DOF_Z][1], S[object][DOF_Z][1]); // Forget the others...
count += 1;
}
@@ -93,7 +92,7 @@
// Here is a version of soliton_lite which runs on only one object. This should be useful for
// settling objects at level starts, placing things exactly on the ground, etc...
// ==============================================================================
-void snobby_soliton_lite(Q timestep, int32_t object) {+void snobby_soliton_lite(fix timestep, int32_t object) {int32_t coord;
// Copy the state vector initially into the argument vector...
@@ -110,13 +109,13 @@
(*idof_functions[object])(object);
for (coord = 0; coord < DOF && S[object][coord][0] > END; coord++) {- k[0][object][coord] = timestep * S[object][coord][2];
+ k[0][object][coord] = fix_mul(timestep, S[object][coord][2]);
}
// Here is a frobbed term...
// -------------------------
for (coord = 0; coord < DOF && S[object][coord][0] > END; coord++) {- A[object][coord][0] = S[object][coord][0] + timestep * S[object][coord][1];
+ A[object][coord][0] = S[object][coord][0] + fix_mul(timestep, S[object][coord][1]);
A[object][coord][1] = S[object][coord][1] + k[0][object][coord];
}
@@ -123,16 +122,16 @@
(*idof_functions[object])(object);
for (coord = 0; coord < DOF && S[object][coord][0] > END; coord++) {- k[1][object][coord] = timestep * S[object][coord][2];
+ k[1][object][coord] = fix_mul(timestep, S[object][coord][2]);
}
// Hey! We're already able to assemble the solution! Wasn't that better than soliton?
// ===--------=======-----------------------------------------------------------------
for (coord = 0; coord < DOF && S[object][coord][0] > END; coord++) {- S[object][coord][0] = S[object][coord][0] + timestep * S[object][coord][1] +
- point_five * (timestep * timestep * k[0][object][coord]);
+ S[object][coord][0] = S[object][coord][0] + fix_mul(timestep, S[object][coord][1]) +
+ fix_mul(point_five, fix_mul(fix_mul(timestep, timestep), k[0][object][coord]));
- S[object][coord][1] = S[object][coord][1] + point_five * (k[0][object][coord] + k[1][object][coord]);
+ S[object][coord][1] = S[object][coord][1] + fix_mul(point_five, k[0][object][coord] + k[1][object][coord]);
}
state_write_object(object); // Put it back in. Note that IT saw EVERYONE else, but they only see IT now!
@@ -191,7 +190,7 @@
// This is EDMS' sanity checker. Call it to see what's wrong. Problems
// will return a nonzero result...
// ===============================
-int sanity_check() {+int sanity_check(void) {// The idof functions...
// =====================
// extern void biped_idof( int ),
@@ -293,8 +292,8 @@
// Get the Euler angles we need from the stuff in the state...
// ===========================================================
-void EDMS_get_Euler_angles(Q &alpha, Q &beta, Q &gamma, int32_t object) {- Q e0, e1, e2, e3;
+void EDMS_get_Euler_angles(fix *alpha, fix *beta, fix *gamma, int32_t object) {+ fix e0, e1, e2, e3;
e0 = S[object][DOF_ALPHA][0];
e1 = S[object][DOF_BETA][0];
@@ -303,10 +302,10 @@
// Get the trig information we need...
// ===================================
- alpha = asin(2 * (e0 * e2 - e1 * e3));
- Q cos_alpha = cos(alpha);
+ *alpha = fix_asin(fix_to_fang(fix_mul(fix_make(2,0), fix_mul(e0, e2) - fix_mul(e1, e3))));
+ fix cos_alpha = fix_cos(fix_to_fang(*alpha));
-#define EDMS_EULER_CONVERSION_TRIG_ZERO .0001
+#define EDMS_EULER_CONVERSION_TRIG_ZERO fix_from_float(.0001)
if (cos_alpha > 0 && cos_alpha < EDMS_EULER_CONVERSION_TRIG_ZERO)
cos_alpha = EDMS_EULER_CONVERSION_TRIG_ZERO;
@@ -313,21 +312,19 @@
if (cos_alpha < 0 && cos_alpha > -EDMS_EULER_CONVERSION_TRIG_ZERO)
cos_alpha = -EDMS_EULER_CONVERSION_TRIG_ZERO;
- gamma = acos((e0 * e0 + e1 * e1 - e2 * e2 - e3 * e3) / cos_alpha);
- if ((e1 * e2 + e0 * e3) < 0)
- gamma *= -1; // sgn...
+ *gamma = fix_acos(fix_to_fang(fix_div(fix_mul(e0, e0) + fix_mul(e1, e1) - fix_mul(e2, e2) - fix_mul(e3, e3), cos_alpha)));
+ if (fix_mul(e1, e2) + fix_mul(e0, e3) < 0)
+ *gamma = fix_mul(*gamma, fix_make(-1,0)); // sgn...
- beta = acos((e0 * e0 - e1 * e1 - e2 * e2 + e3 * e3) / cos_alpha);
- if (e2 * e3 + e0 * e1 < 0)
- beta *= -1;
+ *beta = fix_acos(fix_to_fang(fix_div(fix_mul(e0, e0) - fix_mul(e1, e1) - fix_mul(e2, e2) + fix_mul(e3, e3), cos_alpha)));
+ if (fix_mul(e2, e3) + fix_mul(e0, e1) < 0)
+ *beta = fix_mul(*beta, fix_make(-1,0));
- alpha *= -1;
- beta *= -1;
- gamma *= -1;
+ *alpha = fix_mul(*alpha, fix_make(-1,0));
+ *beta = fix_mul(*beta, fix_make(-1,0));
+ *gamma = fix_mul(*gamma, fix_make(-1,0));
}
-extern "C" {-
#pragma require_prototypes off
// Call this to see if an object is asleep...
@@ -355,5 +352,3 @@
}
#pragma require_prototypes on
-
-} // End of "Extern "C""...
--- a/src/Libraries/EDMS/Source/soliton.cc
+++ b/src/Libraries/EDMS/Source/soliton.cc
@@ -36,7 +36,6 @@
// ===================
// Jon Blackley, Oct. 25, 1991
-//#include <iostream>
#include "edms_int.h" //Object types, END conventions, etc.
#include "idof.h"
#include "physhand.h"
@@ -47,11 +46,9 @@
// For convenience
#define HashSpew(a) Spewpp(DSRC_EDMS_Hash, a)
-Q S[MAX_OBJ][7][4]; // State stream... Accessable to all...
+fix S[MAX_OBJ][7][4]; // State stream... Accessable to all...
-extern "C" {extern void EDMS_kill_object(physics_handle ph);
-}
// ==============
// INTERNAL STUFF
@@ -60,29 +57,27 @@
// Why does this get set to 100 and then immediately reset to .02
// in soliton_lite? - DS
-extern "C" {-Q snooz_threshold = 100;
-}
+fix snooz_threshold = fix_make(100, 0);
int32_t EDMS_integrating = 0;
EDMS_Argblock_Pointer A; // non-vector type arguments for perturbation...
-Q I[MAX_OBJ][DOF_MAX], // Internal degrees of freedom...
+fix I[MAX_OBJ][DOF_MAX], // Internal degrees of freedom...
k[4][MAX_OBJ][7]; // expansion coefficients...
void (*idof_functions[MAX_OBJ])(int32_t), // Pointers to the appropriate places...
(*equation_of_motion[MAX_OBJ][7])(int32_t); // The integer is the object number...
-Q *utility_pointer[MAX_OBJ]; // Biped skeletons, Jello translucencies, etc...
+fix *utility_pointer[MAX_OBJ]; // Biped skeletons, Jello translucencies, etc...
-Q hash_scale = 1.0; // The ratio betwixt coordinate and collision...
+fix hash_scale = fix_from_float(1.0); // The ratio betwixt coordinate and collision...
// Courtesy of C++ and inline fixpoint and such...
// ===============================================
-const Q one_sixth = .1666666666667, // Overboard?
- point_five = .5, point_one_two_five = .125, two = 2., point_1 = 0.1,
- min_scale_slice = .03; // �����.03
+const fix one_sixth = fix_from_float(.1666666666667), // Overboard?
+ point_five = fix_from_float(.5), point_one_two_five = fix_from_float(.125), two = fix_from_float(2.), point_1 = fix_from_float(0.1),
+ min_scale_slice = fix_from_float(.03); // �����.03
// Sleeping...
// -----------
@@ -96,7 +91,7 @@
// *******************HACK*HACK*HACK*HACK*****************************+
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void soliton(Q /*timestep*/) {}+void soliton(fix /*timestep*/) {}// Soliton_Lite (tm)...
// ====================
@@ -111,15 +106,15 @@
// we'll subject to some speed trials. This could be used for certain applications, such as
// out-of scope models or complex aggregate or articulated objects. Well, let's see...
// ====================================================================================
-void soliton_lite(Q timestep) {+void soliton_lite(fix timestep) {extern void robot_idof(int32_t), pelvis_idof(int32_t);
int32_t object = 0;
int32_t coord = 0;
- Q *S_Object;
+ fix *S_Object;
- Q frequency_check;
- Q average_frequency;
+ fix frequency_check;
+ fix average_frequency;
int32_t count = 0;
// Copy the state vector initially into the argument vector...
@@ -126,12 +121,12 @@
// ===========================================================
for (object = 0; S[object][0][0] > END; object++) { if (no_no_not_me[object] == 1) {- S_Object = (Q *)S[object];
+ S_Object = (fix *)S[object];
state_delete_object(object);
for (coord = 0; coord < 7 && S_Object[coord << 2] > END; coord++) {- A[object][coord][0].val = S_Object[coord << 2].val;
- A[object][coord][1].val = S_Object[(coord << 2) + 1].val;
+ A[object][coord][0] = S_Object[coord << 2];
+ A[object][coord][1] = S_Object[(coord << 2) + 1];
}
state_write_object(object); // Here to initialize new models for sure...
}
@@ -144,7 +139,7 @@
for (object = 0; S[object][0][0] > END; object++) { if (no_no_not_me[object] == 1) {- S_Object = (Q *)S[object];
+ S_Object = (fix *)S[object];
// Are we wasting time...
// ----------------------
@@ -154,33 +149,33 @@
(*idof_functions[object])(object);
for (coord = 0; coord < 7 && S_Object[coord << 2] > END; coord++) {- k[0][object][coord].val = fix_mul(timestep.val, S_Object[(coord << 2) + 2].val);
- if (abs(S_Object[(coord << 2) + 2]) > .001) {+ k[0][object][coord] = fix_mul(timestep, S_Object[(coord << 2) + 2]);
+ if (fix_abs(S_Object[(coord << 2) + 2]) > fix_from_float(.001)) {// This check makes the function discontinuous (it goes from 10000 down
// to 1000 when S[object][coord][2] reaches 100)... - DS
- if (abs(S_Object[(coord << 2) + 2]) < 100)
- frequency_check.val += fix_mul(S_Object[(coord << 2) + 2].val, S_Object[(coord << 2) + 2].val);
+ if (fix_abs(S_Object[(coord << 2) + 2]) < fix_make(100,0))
+ frequency_check += fix_mul(S_Object[(coord << 2) + 2], S_Object[(coord << 2) + 2]);
else
- frequency_check.val += fix_make(1000, 0);
+ frequency_check += fix_make(1000, 0);
}
- if (abs(S_Object[(coord << 2) + 1]) > .001) {- if (abs(S_Object[(coord << 2) + 1]) < 50)
- frequency_check.val += fix_div(
- fix_mul(S_Object[(coord << 2) + 1].val, S_Object[(coord << 2) + 1].val), I[object][31].val);
+ if (fix_abs(S_Object[(coord << 2) + 1]) > fix_from_float(.001)) {+ if (fix_abs(S_Object[(coord << 2) + 1]) < fix_make(50,0))
+ frequency_check += fix_div(
+ fix_mul(S_Object[(coord << 2) + 1], S_Object[(coord << 2) + 1]), I[object][31]);
else
- frequency_check.val += fix_make(1000, 0);
+ frequency_check += fix_make(1000, 0);
}
// This is angular velocity I think - DS
if ((I[object][IDOF_MODEL] == ROBOT) && (coord == 3))
- frequency_check += abs(50 * S_Object[(coord << 2) + 2]);
+ frequency_check += fix_abs(fix_mul(fix_make(50,0), S_Object[(coord << 2) + 2]));
}
// Are you in stiff and in need of invariant imbedding?
// ----------------------------------------------------
industrial_strength[object] = 0; // Guilty until...
- if (frequency_check > 15) {+ if (frequency_check > fix_make(15, 0)) {// mout << "-";
industrial_strength[object] = 1;
}
@@ -206,7 +201,7 @@
// Sleeping...
// -----------
- snooz_threshold = .2;
+ snooz_threshold = fix_from_float(.2);
// Here is a frobbed term...
// -------------------------
@@ -215,12 +210,12 @@
for (object = 0; S[object][0][0] > END; object++) { if (no_no_not_me[object] == 1) {- S_Object = (Q *)S[object];
+ S_Object = (fix *)S[object];
state_delete_object(object); // Do collisions...
for (coord = 0; coord < 7 && S_Object[(coord << 2) + 0] > END; coord++) {- A[object][coord][0].val += fix_mul(timestep.val, S_Object[(coord << 2) + 1].val);
- A[object][coord][1].val += k[0][object][coord].val;
+ A[object][coord][0] += fix_mul(timestep, S_Object[(coord << 2) + 1]);
+ A[object][coord][1] += k[0][object][coord];
}
write_object(object); // Do collisions...
}
@@ -234,7 +229,7 @@
// ====================================
for (object = 0; S[object][0][0] > END; object++) { if (no_no_not_me[object] == 1) {- S_Object = (Q *)S[object];
+ S_Object = (fix *)S[object];
// If we've got a hot one, EDMS now becomes industrial strength (note collisions set above)...
// -------------------------------------------------------------------------------------------
@@ -245,12 +240,12 @@
// --------------
delete_object(object);
for (coord = 0; coord < 7 && S_Object[(coord << 2) + 0] > END; coord++) {- A[object][coord][0].val =
- S_Object[(coord << 2) + 0].val +
- fix_mul(fix_mul(point_five.val, timestep.val), S_Object[(coord << 2) + 1].val) +
- fix_mul(fix_mul(point_one_two_five.val, timestep.val), k[0][object][coord].val);
- A[object][coord][1].val =
- S_Object[(coord << 2) + 1].val + fix_mul(point_five.val, k[0][object][coord].val);
+ A[object][coord][0] =
+ S_Object[(coord << 2) + 0] +
+ fix_mul(fix_mul(point_five, timestep), S_Object[(coord << 2) + 1]) +
+ fix_mul(fix_mul(point_one_two_five, timestep), k[0][object][coord]);
+ A[object][coord][1] =
+ S_Object[(coord << 2) + 1] + fix_mul(point_five, k[0][object][coord]);
}
write_object(object);
@@ -259,7 +254,7 @@
(*idof_functions[object])(object);
for (coord = 0; coord < 7 && S_Object[(coord << 2) + 0] > END; coord++) {- k[1][object][coord].val = fix_mul(timestep.val, S_Object[(coord << 2) + 2].val);
+ k[1][object][coord] = fix_mul(timestep, S_Object[(coord << 2) + 2]);
}
// Second order...
@@ -266,12 +261,12 @@
// ---------------
delete_object(object);
for (coord = 0; coord < 7 && S_Object[(coord << 2) + 0] > END; coord++) {- A[object][coord][0].val =
- S_Object[(coord << 2) + 0].val +
- fix_mul(fix_mul(point_five.val, timestep.val), S_Object[(coord << 2) + 1].val) +
- fix_mul(fix_mul(point_one_two_five.val, timestep.val), k[1][object][coord].val);
- A[object][coord][1].val =
- S_Object[(coord << 2) + 1].val + fix_mul(point_five.val, k[1][object][coord].val);
+ A[object][coord][0] =
+ S_Object[(coord << 2) + 0] +
+ fix_mul(fix_mul(point_five, timestep), S_Object[(coord << 2) + 1]) +
+ fix_mul(fix_mul(point_one_two_five, timestep), k[1][object][coord]);
+ A[object][coord][1] =
+ S_Object[(coord << 2) + 1] + fix_mul(point_five, k[1][object][coord]);
}
write_object(object);
@@ -279,7 +274,7 @@
(*idof_functions[object])(object);
for (coord = 0; coord < 7 && S_Object[(coord << 2) + 0] > END; coord++) {- k[2][object][coord].val = fix_mul(timestep.val, S_Object[(coord << 2) + 2].val);
+ k[2][object][coord] = fix_mul(timestep, S_Object[(coord << 2) + 2]);
}
// Third order...
@@ -287,10 +282,10 @@
delete_object(object);
for (coord = 0; coord < 7 && S_Object[(coord << 2) + 0] > END; coord++) {// Different convergence requirement from other terms!
- A[object][coord][0].val = S_Object[(coord << 2) + 0].val +
- fix_mul(timestep.val, S_Object[(coord << 2) + 1].val) +
- fix_mul(fix_mul(point_five.val, timestep.val), k[2][object][coord].val);
- A[object][coord][1].val = S_Object[(coord << 2) + 1].val + k[2][object][coord].val;
+ A[object][coord][0] = S_Object[(coord << 2) + 0] +
+ fix_mul(timestep, S_Object[(coord << 2) + 1]) +
+ fix_mul(fix_mul(point_five, timestep), k[2][object][coord]);
+ A[object][coord][1] = S_Object[(coord << 2) + 1] + k[2][object][coord];
}
write_object(object);
@@ -298,7 +293,7 @@
(*idof_functions[object])(object);
for (coord = 0; coord < 7 && S_Object[(coord << 2) + 0] > END; coord++) {- k[3][object][coord].val = fix_mul(timestep.val, S_Object[(coord << 2) + 2].val);
+ k[3][object][coord] = fix_mul(timestep, S_Object[(coord << 2) + 2]);
}
} // End of stoked...
else {@@ -307,7 +302,7 @@
(*idof_functions[object])(object);
for (coord = 0; coord < 7 && S_Object[(coord << 2) + 0] > END; coord++) {- k[1][object][coord].val = fix_mul(timestep.val, S_Object[(coord << 2) + 2].val);
+ k[1][object][coord] = fix_mul(timestep, S_Object[(coord << 2) + 2]);
}
} // End of else for regular guy...
@@ -329,27 +324,27 @@
for (object = 0; S[object][0][0] > END; object++) { if (no_no_not_me[object] == 1) {total += 1;
- Q anus[7];
+ fix anus[7];
- S_Object = (Q *)S[object];
+ S_Object = (fix *)S[object];
// Calculate the multiplier...
// ---------------------------
if (I[object][IDOF_MODEL] == D_FRAME) {- Q lagrange_multiplier = .5 / timestep;
- Q l_m;
- Q lagrange;
+ fix lagrange_multiplier = fix_div(fix_from_float(.5), timestep);
+ fix l_m;
+ fix lagrange;
- lagrange.val = (1 << 16) - (fix_mul(S_Object[(3 << 2) + 0].val, S_Object[(3 << 2) + 0].val) +
- fix_mul(S_Object[(4 << 2) + 0].val, S_Object[(4 << 2) + 0].val) +
- fix_mul(S_Object[(5 << 2) + 0].val, S_Object[(5 << 2) + 0].val) +
- fix_mul(S_Object[(6 << 2) + 0].val, S_Object[(6 << 2) + 0].val));
- l_m.val = fix_mul(lagrange_multiplier.val, lagrange.val);
- anus[0].val = anus[1].val = anus[2].val = 0;
- anus[3].val = fix_mul(S_Object[(3 << 2) + 0].val, l_m.val);
- anus[4].val = fix_mul(S_Object[(4 << 2) + 0].val, l_m.val);
- anus[5].val = fix_mul(S_Object[(5 << 2) + 0].val, l_m.val);
- anus[6].val = fix_mul(S_Object[(6 << 2) + 0].val, l_m.val);
+ lagrange = (1 << 16) - (fix_mul(S_Object[(3 << 2) + 0], S_Object[(3 << 2) + 0]) +
+ fix_mul(S_Object[(4 << 2) + 0], S_Object[(4 << 2) + 0]) +
+ fix_mul(S_Object[(5 << 2) + 0], S_Object[(5 << 2) + 0]) +
+ fix_mul(S_Object[(6 << 2) + 0], S_Object[(6 << 2) + 0]));
+ l_m = fix_mul(lagrange_multiplier, lagrange);
+ anus[0] = anus[1] = anus[2] = 0;
+ anus[3] = fix_mul(S_Object[(3 << 2) + 0], l_m);
+ anus[4] = fix_mul(S_Object[(4 << 2) + 0], l_m);
+ anus[5] = fix_mul(S_Object[(5 << 2) + 0], l_m);
+ anus[6] = fix_mul(S_Object[(6 << 2) + 0], l_m);
} // End of calculation...
// Lupe over coordinates...
@@ -365,23 +360,23 @@
if (I[object][IDOF_MODEL] == D_FRAME) {// mout << "D";
- S_Object[(coord << 2) + 0].val += fix_mul(
- timestep.val, (S_Object[(coord << 2) + 1].val + anus[coord].val +
- fix_mul(one_sixth.val, (k[0][object][coord].val + k[1][object][coord].val +
- k[2][object][coord].val))));
+ S_Object[(coord << 2) + 0] += fix_mul(
+ timestep, (S_Object[(coord << 2) + 1] + anus[coord] +
+ fix_mul(one_sixth, (k[0][object][coord] + k[1][object][coord] +
+ k[2][object][coord]))));
} else {// mout << "N";
- S_Object[(coord << 2) + 0].val += fix_mul(
- timestep.val, (S_Object[(coord << 2) + 1].val +
- fix_mul(one_sixth.val, (k[0][object][coord].val + k[1][object][coord].val +
- k[2][object][coord].val))));
+ S_Object[(coord << 2) + 0] += fix_mul(
+ timestep, (S_Object[(coord << 2) + 1] +
+ fix_mul(one_sixth, (k[0][object][coord] + k[1][object][coord] +
+ k[2][object][coord]))));
}
- S_Object[(coord << 2) + 1].val +=
- fix_mul(one_sixth.val, (k[0][object][coord].val +
- fix_mul(two.val, (k[1][object][coord].val + k[2][object][coord].val) +
- k[3][object][coord].val)));
+ S_Object[(coord << 2) + 1] +=
+ fix_mul(one_sixth, (k[0][object][coord] +
+ fix_mul(two, (k[1][object][coord] + k[2][object][coord]) +
+ k[3][object][coord])));
} else {// These guys don't...
// ===================
@@ -390,19 +385,19 @@
// Use the multiplier...
// ---------------------
if (I[object][IDOF_MODEL] == D_FRAME) {- S_Object[(coord << 2) + 0].val =
- S_Object[(coord << 2) + 0].val +
- fix_mul(timestep.val, (S_Object[(coord << 2) + 1].val + anus[coord].val)) +
- fix_mul(point_five.val,
- (fix_mul(fix_mul(timestep.val, timestep.val), k[0][object][coord].val)));
+ S_Object[(coord << 2) + 0] =
+ S_Object[(coord << 2) + 0] +
+ fix_mul(timestep, (S_Object[(coord << 2) + 1] + anus[coord])) +
+ fix_mul(point_five,
+ (fix_mul(fix_mul(timestep, timestep), k[0][object][coord])));
} else {- S_Object[(coord << 2) + 0].val += fix_mul(
- timestep.val, (S_Object[(coord << 2) + 1].val +
- fix_mul(fix_mul(point_five.val, timestep.val), k[0][object][coord].val)));
+ S_Object[(coord << 2) + 0] += fix_mul(
+ timestep, (S_Object[(coord << 2) + 1] +
+ fix_mul(fix_mul(point_five, timestep), k[0][object][coord])));
}
- S_Object[(coord << 2) + 1].val +=
- fix_mul(point_five.val, (k[0][object][coord].val + k[1][object][coord].val));
+ S_Object[(coord << 2) + 1] +=
+ fix_mul(point_five, (k[0][object][coord] + k[1][object][coord]));
} // End of else for regular guys...
}
@@ -426,7 +421,7 @@
// efficiency of the integration step, while remaining very stable. Details about its use
// will follow when it proves useful...
// ====================================
-void soliton_vector(Q timestep) {+void soliton_vector(fix timestep) {// Here i yam...
// -------------
EDMS_integrating = 1;
@@ -447,7 +442,7 @@
// Now do the rest...
// ==================
- if (timestep > .01 || count == 0)
+ if (timestep > fix_from_float(.01) || count == 0)
soliton_lite(timestep);
// else mout << "!EDMS: timestep is small, dt = " << timestep << "\n";
@@ -461,11 +456,11 @@
// Here is an integrator that fools the models into not colliding. Hopefully not often used.
// It is a version of Soliton Lite(tm)...
// ======================================
-void soliton_lite_holistic(Q /*timestep*/) {}+void soliton_lite_holistic(fix /*timestep*/) {}// Here is the holistic vector integrator...
// =========================================
-void soliton_vector_holistic(Q /*timestep*/) {}+void soliton_vector_holistic(fix /*timestep*/) {}// Have some utility routines...
// =============================
@@ -476,7 +471,7 @@
void EDMS_initialize(EDMS_data *D) {extern uint32_t data[EDMS_DATA_SIZE][EDMS_DATA_SIZE];
int32_t object = 0, coord = 0, deriv = 0;
- const Q collision_size = EDMS_DATA_SIZE;
+ const fix collision_size = fix_make(EDMS_DATA_SIZE, 0);
// Set the starting physics_handle...
// ==================================
@@ -494,11 +489,11 @@
// Set the scale of the playfield and zero the collision data...
// =============================================================
- hash_scale.fix_to(D->playfield_size);
- hash_scale = collision_size / hash_scale;
+ hash_scale = D->playfield_size;
+ hash_scale = fix_div(collision_size, hash_scale);
- // printf("hash_scale: %f\n", fix_float(hash_scale.to_fix()));- // printf("collision_size: %f\n", fix_float(collision_size.to_fix()));+ // printf("hash_scale: %f\n", fix_float(hash_scale));+ // printf("collision_size: %f\n", fix_float(collision_size)); for (coord = 0; coord < EDMS_DATA_SIZE; coord++) { for (deriv = 0; deriv < EDMS_DATA_SIZE; deriv++) {@@ -576,8 +571,8 @@
// Fix the excluded collision information...
// =========================================
- if (I[(object - 1)][IDOF_COLLIDE] > -1)
- I[I[(object - 1)][IDOF_COLLIDE].to_int()][IDOF_COLLIDE] = object - 1;
+ if (I[(object - 1)][IDOF_COLLIDE] > fix_make(-1,0))
+ I[q_to_int(I[(object - 1)][IDOF_COLLIDE])][IDOF_COLLIDE] = object - 1;
// Utility pointers also need fixing...
// ====================================
@@ -639,13 +634,13 @@
// Collision wakeup...
// ===================
void collision_wakeup(int32_t object) {- Q idof_state[DOF_MAX], state[7][4], arg[7][4];
+ fix idof_state[DOF_MAX], state[7][4], arg[7][4];
int32_t coord = 0, deriv = 0, new_object = 0;
physics_handle ph;
- Q *utility_save;
+ fix *utility_save;
void (*idof_function_save)(int);
extern void inventory_and_statistics();
@@ -719,8 +714,8 @@
// Fix the excluded collision information...
// =========================================
- if (I[new_object][IDOF_COLLIDE] > -1)
- I[I[new_object][IDOF_COLLIDE].to_int()][IDOF_COLLIDE] = new_object;
+ if (I[new_object][IDOF_COLLIDE] > fix_make(-1,0))
+ I[q_to_int(I[new_object][IDOF_COLLIDE])][IDOF_COLLIDE] = new_object;
}
#pragma require_prototypes off
--- a/src/Libraries/FIX/Source/fix.h
+++ b/src/Libraries/FIX/Source/fix.h
@@ -276,6 +276,8 @@
// makes a fixed point from a float.
#define fix_from_float(n) ((fix)(65536.0 * (n)))
+#define fix_to_fang(n) fix_frac(fix_mul((n), fix_from_float(0.159154943)))
+
//========================================
//
// Multiplication and division.
--- a/src/Libraries/FIXPP/Source/fixpp.h
+++ b/src/Libraries/FIXPP/Source/fixpp.h
@@ -29,14 +29,20 @@
#ifndef __FIXPP_H
#define __FIXPP_H
+/*
#include <istream>
#include <cstdio>
#include <cstdlib>
+*/
+#ifdef __cplusplus
extern "C" {+#endif
//#include "mprintf.h"
#include "fix.h" // A big thank you to Dan and Matt.
+#ifdef __cplusplus
}
+#endif
// How many bits to shift an integer up to make it a fixpoint.
// ===========================================================
@@ -64,6 +70,7 @@
// Here is a nice forward declaration.
// ===================================
+#ifdef __cplusplus
class Fixpoint;
#define Q Fixpoint
@@ -698,5 +705,107 @@
void touch(Fixpoint &);
#endif /* FIXDEBUG */
+
+#else
+
+typedef fix Q;
+typedef fix Fixpoint;
+
+static inline int32_t
+q_to_int(Q val)
+{+ return (int32_t)(val >> SHIFTUP);
+}
+
+static inline fix
+to_fix(int32_t val)
+{+ return (fix)val;
+}
+
+#define f2Fixpoint(x) ((fix)((x)*SHIFTMULTIPLIER))
+
+static inline fixang
+q_to_fixang(Q val)
+{+ Q temp = val * f2Fixpoint(0.159154943);
+
+ // for temp, 360 degrees = 1.0.
+ // The lower 16 bits of the internal rep is the fixang.
+
+ return (uint16_t)temp;
+}
+
+static inline void
+q_sincos(Fixpoint ang, Fixpoint *sn, Fixpoint *cs) {+ fix fsn, fcs;
+ fix_sincos(q_to_fixang(ang), &fsn, &fcs);
+ *sn = fsn;
+ *cs = fcs;
+}
+
+/*
+typedef struct Q Q;
+struct Q{+ fix val;
+};
+typedef Q Fixpoint;
+//typedef fix Q;
+
+#define f2Fixpoint(x) ((fix)((x) * SHIFTMULTIPLIER))
+
+static inline Q
+q_from_double(double val)
+{+ Q q;
+
+ q.val = f2Fixpoint(val);
+ return q;
+}
+
+static inline Q
+q_from_int(uint32_t val)
+{+ Q q;
+
+ q.val = val << SHIFTUP;
+ return q;
+}
+
+static inline int32_t
+q_to_int(Q q)
+{+ return q.val >> SHIFTUP;
+}
+
+static inline fix
+q_to_fix(Q q)
+{+ return q.val;
+}
+
+static inline fixang
+q_to_fixang(Q q)
+{+ Q temp;
+
+ temp.val = q.val * f2Fixpoint(0.159154943);
+
+ // for temp, 360 degrees = 1.0.
+ // The lower 16 bits of the internal rep is the fixang.
+
+ return (uint16_t)temp.val;
+}
+
+static inline void
+q_sincos(Q ang, fix *sn, fix *cs) {+ fix fsn, fcs;
+ fix_sincos(q_to_fixang(ang), &fsn, &fcs);
+ *sn = fsn;
+ *cs = fcs;
+}
+*/
+
+#endif /* __cplusplus */
#endif /* !__FIXPP_H */
--- a/src/Libraries/H/2dres.h
+++ b/src/Libraries/H/2dres.h
@@ -49,7 +49,7 @@
#include "../RES/Source/res.h"
#include "../DSTRUCT/Source/rect.h"
-#pragma pack(push,2)
+#pragma pack on // 2
// A Ref in a resource gets you a Frame Descriptor:
@@ -144,6 +144,6 @@
fix uper; // (w - u) / u
} CylBMFrame; // one frame of the cylindrical bm object. Always put the bits after this. S
-#pragma pack(pop)
+#pragma pack off
#endif
--- a/src/Libraries/INPUT/Source/kb.h
+++ b/src/Libraries/INPUT/Source/kb.h
@@ -81,7 +81,7 @@
extern void kb_clear_state(uchar kb_code, uchar bits);
extern void kb_set_state(uchar kb_code, uchar bits);
extern void kb_set_signal(uchar code, uchar int_no);
-extern int kb_get_flags();
+extern int kb_get_flags(void);
extern void kb_set_flags(int flags);
extern void kb_generate(kbs_event e);
// extern void kb_flush_bios(void); // For Mac version
--- a/src/Libraries/INPUT/Source/sdl_events.c
+++ b/src/Libraries/INPUT/Source/sdl_events.c
@@ -34,7 +34,7 @@
bool fullscreenActive = false;
-static void toggleFullScreen() {+static void toggleFullScreen(void) {fullscreenActive = !fullscreenActive;
SDL_SetWindowFullscreen(window, fullscreenActive ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
@@ -477,6 +477,8 @@
0x32 // ~
};
+extern bool gPlayingGame;
+
void pump_events(void) {SDL_Event ev;
@@ -484,7 +486,8 @@
switch (ev.type) {case SDL_QUIT:
// a bit hacky at this place, but this would allow exiting the game via the window's [x] button
- exit(0); // TODO: I guess there is a better way.
+ //exit(0); // TODO: I guess there is a better way.
+ gPlayingGame = false;
break;
// TODO: really also handle key up here? the mac code apparently didn't, but where else do
@@ -736,8 +739,8 @@
opengl_resize(ev.window.data1, ev.window.data2);
break;
+ //case SDL_WINDOWEVENT_RESIZED:
case SDL_WINDOWEVENT_MOVED:
- case SDL_WINDOWEVENT_RESIZED:
break;
case SDL_WINDOWEVENT_FOCUS_GAINED:
--- a/src/Libraries/LG/Source/LOG/src/log.c
+++ b/src/Libraries/LG/Source/LOG/src/log.c
@@ -48,7 +48,7 @@
#endif
-static void lock(void) {+static void _lock(void) { if (L.lock) {L.lock(L.udata, 1);
}
@@ -55,7 +55,7 @@
}
-static void unlock(void) {+static void _unlock(void) { if (L.lock) {L.lock(L.udata, 0);
}
@@ -93,7 +93,7 @@
}
/* Acquire lock */
- lock();
+ _lock();
/* Get current time */
time_t t = time(NULL);
@@ -130,5 +130,5 @@
}
/* Release lock */
- unlock();
+ _unlock();
}
--- a/src/Libraries/LG/Source/dbg.h
+++ b/src/Libraries/LG/Source/dbg.h
@@ -293,7 +293,7 @@
// Set debug config screen to use function for getting keys
-extern int (*f_getch)();
+extern int (*f_getch)(void);
#define DbgInstallGetch(f) (f_getch = (f))
// All logfiles are written to the same directory, which defaults to
@@ -310,7 +310,7 @@
// These are really internal things
uchar DbgOpenLogFile(int index);
-void DbgCloseLogFiles();
+void DbgCloseLogFiles(void);
void DbgHandle(int reportType, ulong src, char *buff);
extern char *dbgTags[];
@@ -328,8 +328,8 @@
// Allows user to configure debug system
-void DbgInit(); // auto-loads settings from "debug.dbg"
-void DbgMonoConfig(); // let operator config on mono screen
+void DbgInit(void); // auto-loads settings from "debug.dbg"
+void DbgMonoConfig(void); // let operator config on mono screen
uchar DbgAddConfigPath(char *path); // add path for finding config files
int DbgLoadConfig(char *fname); // load config file
int DbgSaveConfig(char *fname); // save config file
@@ -391,7 +391,7 @@
void Exit(int errcode, char *msg); // shut down with msg
#define AtExit(func) atexit(func); // add func to atexit list
-void PrintExitMsg(); // prints exit message
+void PrintExitMsg(void); // prints exit message
#define SetExitMsg(str) pExitMsg=str
extern char *pExitMsg;
--- a/src/Libraries/LG/Source/memall.c
+++ b/src/Libraries/LG/Source/memall.c
@@ -140,7 +140,7 @@
//
// Returns: 0 if successful, -1 if allocations stack underflow
-int MemPopAllocator()
+int MemPopAllocator(void)
{MemAllocSet *pmas;
--- a/src/Libraries/LG/Source/memall.h
+++ b/src/Libraries/LG/Source/memall.h
@@ -84,7 +84,7 @@
void MemSetAllocator(void *(*fm)(size_t size),
void *(*fr)(void *p, size_t size), void (*ff)(void *p));
int MemPushAllocator(void *(*fm)(size_t size),
- void *(*fr)(void *p, size_t size), void (*ff)());
+ void *(*fr)(void *p, size_t size), void (*ff)(void));
int MemPopAllocator(void);
// Allocating, reallocating, & freeing memory
@@ -128,8 +128,8 @@
// Heap management (memgrow.c)
int MemGrowHeap(int wantK);
-void MemLockHeap();
-void MemUnlockHeap();
+void MemLockHeap(void);
+void MemUnlockHeap(void);
// Calling previous (underlying) allocators (only from top level!)
--- a/src/Libraries/PALETTE/Source/palette.h
+++ b/src/Libraries/PALETTE/Source/palette.h
@@ -87,7 +87,7 @@
extern void palette_initialize(short table_size);
extern void palette_set_rate(short time_units_per_step);
-extern void palette_shutdown();
+extern void palette_shutdown(void);
extern void palette_init_smap(short first, short last, uchar *from, uchar *to,
short num_steps);
@@ -109,7 +109,7 @@
extern void palette_change_delay(byte id, short delay);
extern void palette_swap_shadow(int s, int n, int d);
-extern void palette_print_table();
+extern void palette_print_table(void);
extern byte num_installed_shifts;
--- a/src/Libraries/RES/Source/lzw.c
+++ b/src/Libraries/RES/Source/lzw.c
@@ -301,7 +301,7 @@
}
int32_t LzwCompress(void (*f_SrcCtrl)(intptr_t srcLoc, LzwCtrl ctrl), // func to control source
- uint8_t (*f_SrcGet)(), // func to get bytes from source
+ uint8_t (*f_SrcGet)(void), // func to get bytes from source
intptr_t srcLoc, // source "location" (ptr, FILE *, etc.)
int32_t srcSize, // size of source in bytes
void (*f_DestCtrl)(intptr_t destLoc, LzwCtrl ctrl), // func to control dest
@@ -423,7 +423,7 @@
LzwE lzwe; // current expand state
-static uint32_t LzwInputCode(uint8_t (*f_SrcGet)()) {+static uint32_t LzwInputCode(uint8_t (*f_SrcGet)(void)) {uint32_t return_value;
while (lzwe.lzwInputBitCount <= 24) {@@ -439,7 +439,7 @@
}
int32_t LzwExpand(void (*f_SrcCtrl)(intptr_t srcLoc, LzwCtrl ctrl), // func to control source
- uint8_t (*f_SrcGet)(), // func to get bytes from source
+ uint8_t (*f_SrcGet)(void), // func to get bytes from source
intptr_t srcLoc, // source "location" (ptr, FILE *, etc.)
void (*f_DestCtrl)(intptr_t destLoc, LzwCtrl ctrl), // func to control dest
void (*f_DestPut)(uint8_t byte), // func to put bytes to dest
--- a/src/Libraries/RES/Source/lzw.h
+++ b/src/Libraries/RES/Source/lzw.h
@@ -60,8 +60,8 @@
// buffer has been set or allocated, one will automatically be allocated).
int32_t LzwSetBuffer(void *buff, int32_t buffSize); // Set buffer for lzw use
-int32_t LzwMallocBuffer(); // Malloc buffer for lzw use
-void LzwFreeBuffer(); // free alloced buffer if any
+int32_t LzwMallocBuffer(void); // Malloc buffer for lzw use
+void LzwFreeBuffer(void); // free alloced buffer if any
// Sizing constants (just needed to define LZW_BUFF_SIZE)
@@ -100,7 +100,7 @@
// The Ginzo compression knife
int32_t LzwCompress(void (*f_SrcCtrl)(intptr_t srcLoc, LzwCtrl ctrl), // func to control source
- uint8_t (*f_SrcGet)(), // func to get bytes from source
+ uint8_t (*f_SrcGet)(void), // func to get bytes from source
intptr_t srcLoc, // source "location" (ptr, FILE *, etc.)
int32_t srcSize, // size of source in bytes
void (*f_DestCtrl)(intptr_t destLoc, LzwCtrl ctrl), // func to control dest
@@ -112,7 +112,7 @@
// And its expansion counterpart, both for $19.95 while supplies last
int32_t LzwExpand(void (*f_SrcCtrl)(intptr_t srcLoc, LzwCtrl ctrl), // func to control source
- uint8_t (*f_SrcGet)(), // func to get bytes from source
+ uint8_t (*f_SrcGet)(void), // func to get bytes from source
intptr_t srcLoc, // source "location" (ptr, FILE *, etc.)
void (*f_DestCtrl)(intptr_t destLoc, LzwCtrl ctrl), // func to control dest
void (*f_DestPut)(uint8_t byte), // func to put bytes to dest
@@ -314,11 +314,11 @@
// Prototypes of standard sources
void LzwBuffSrcCtrl(intptr_t srcLoc, LzwCtrl ctrl);
-uint8_t LzwBuffSrcGet();
+uint8_t LzwBuffSrcGet(void);
void LzwFdSrcCtrl(intptr_t srcLoc, LzwCtrl ctrl);
-uint8_t LzwFdSrcGet();
+uint8_t LzwFdSrcGet(void);
void LzwFpSrcCtrl(intptr_t srcLoc, LzwCtrl ctrl);
-uint8_t LzwFpSrcGet();
+uint8_t LzwFpSrcGet(void);
// Prototypes of standard destinations
--- a/src/Libraries/RES/Source/refacc.c
+++ b/src/Libraries/RES/Source/refacc.c
@@ -166,7 +166,7 @@
// We had better loaded the whole thing and not just the reftable.
assert(prt->raw_data != NULL);
if (!RefIndexValid(prt, index)) {- ERROR("%s: Invalid Index %x", __FUNCTION__, ref);+ ERROR("%s: Invalid Index %x >= %x", __FUNCTION__, ref, prt->numRefs);return (NULL);
}
--- a/src/Libraries/RES/Source/res.c
+++ b/src/Libraries/RES/Source/res.c
@@ -115,7 +115,7 @@
int32_t i;
// Close all open resource files
for (i = 0; i <= MAX_RESFILENUM; i++) {- if (resFile[i].fd >= 0)
+ if (resFile[i].fd != NULL)
ResCloseFile(i);
}
--- a/src/Libraries/RES/Source/res.h
+++ b/src/Libraries/RES/Source/res.h
@@ -79,7 +79,7 @@
#include "resformat.h"
-#pragma pack(push,2)
+#pragma pack on // 2
// ---------------------------------------------------------
// ID AND REF DEFINITIONS AND MACROS
@@ -202,8 +202,8 @@
} ResDesc;
typedef struct {- uint16_t flags : 8; // misc flags (RDF_XXX, see below)
- uint16_t type : 8; // resource type (RTYPE_XXX, see restypes.h)
+ uint8_t flags; // misc flags (RDF_XXX, see below)
+ uint8_t type; // resource type (RTYPE_XXX, see restypes.h)
} ResDesc2;
#define RESDESC(id) (&gResDesc[id]) // convert id to resource desc ptr
@@ -244,8 +244,8 @@
// RESOURCE MANAGER GENERAL ROUTINES (res.c)
// ------------------------------------------------------------
-void ResInit(); // init Res, allocate initial ResDesc[]
-void ResTerm(); // term Res (done auto via atexit)
+void ResInit(void); // init Res, allocate initial ResDesc[]
+void ResTerm(void); // term Res (done auto via atexit)
// ------------------------------------------------------------
// RESOURCE FILE ACCESS (resfile.c)
@@ -334,13 +334,29 @@
typedef struct {Id id; // resource id (if 0, entry is deleted)
+ /*
uint32_t size : 24; // uncompressed size (size in ram)
uint32_t flags : 8; // resource flags (RDF_XXX)
uint32_t csize : 24; // compressed size (size on disk)
// (this size is valid disk size even if not comp.)
uint32_t type : 8; // resource type
+ */
+ uchar size[3]; // uncompressed size (size in ram)
+ uint8_t flags; // resource flags (RDF_XXX)
+ uchar csize[3]; // compressed size (size on disk)
+ // (this size is valid disk size even if not comp.)
+ uint8_t type; // resource type
} ResDirEntry;
+#define GBIT8(p) (((uchar*)(p))[0])
+#define GBIT16(p) (((uchar*)(p))[0]|(((uchar*)(p))[1]<<8))
+#define GBIT24(p) (((uchar*)(p))[0]|(((uchar*)(p))[1]<<8)|(((uchar*)(p))[2]<<16))
+#define PBIT8(p,v) do{(p)[0]=(v);}while(0)+#define PBIT16(p,v) do{(p)[0]=(v);(p)[1]=(v)>>8;}while(0)+#define PBIT24(p,v) do{(p)[0]=(v);(p)[1]=(v)>>8;(p)[2]=(v)>>16;}while(0)+
+ResDirEntry diskResDirEntry(ResDirEntry *);
+
// Active resource file table
typedef struct {@@ -387,6 +403,6 @@
// DG: a case-insensitive fopen()-wrapper (see resfile.c)
extern FILE *fopen_caseless(const char *path, const char *mode);
-#pragma pack(pop)
+#pragma pack off
#endif
--- a/src/Libraries/RES/Source/resbuild.c
+++ b/src/Libraries/RES/Source/resbuild.c
@@ -145,7 +145,7 @@
prd2 = RESDESC2(id);
pDirEntry->flags = prd2->flags;
pDirEntry->type = prd2->type;
- pDirEntry->size = size;
+ PBIT24(pDirEntry->size, size);
TRACE("%s: writing $%x\n", __FUNCTION__, id);@@ -171,7 +171,7 @@
if (compsize < 0) {pDirEntry->flags &= ~RDF_LZW;
} else {- pDirEntry->csize = sizeTable + compsize;
+ PBIT24(pDirEntry->csize, sizeTable + compsize);
fwrite(pcompbuff, compsize, 1, prf->fd);
}
free(pcompbuff);
@@ -179,12 +179,12 @@
// If no compress (or failed to compress well), just write out
if (!(pDirEntry->flags & RDF_LZW)) {- pDirEntry->csize = size;
+ PBIT24(pDirEntry->csize, size);
fwrite(body, size, 1, prf->fd);
}
// Pad to align on data boundary
- padBytes = RES_OFFSET_PADBYTES(pDirEntry->csize);
+ padBytes = RES_OFFSET_PADBYTES(GBIT24(pDirEntry->csize));
if (padBytes)
fwrite(pad, padBytes, 1, prf->fd);
@@ -198,7 +198,7 @@
}
// Advance dir num entries, current data offset
prf->pedit->pdir->numEntries++;
- prf->pedit->currDataOffset = RES_OFFSET_ALIGN(prf->pedit->currDataOffset + pDirEntry->csize);
+ prf->pedit->currDataOffset = RES_OFFSET_ALIGN(prf->pedit->currDataOffset + GBIT24(pDirEntry->csize));
return 0;
}
@@ -274,15 +274,15 @@
for (i = 0; i < prf->pedit->pdir->numEntries; i++) { if (pDirEntry->id == 0) {numReclaimed++;
- sizeReclaimed += pDirEntry->csize;
+ sizeReclaimed += GBIT24(pDirEntry->csize);
} else {if (gResDesc[pDirEntry->id].offset > RES_OFFSET_PENDING)
gResDesc[pDirEntry->id].offset = RES_OFFSET_REAL2DESC(dataWrite);
if (dataRead != dataWrite)
- ResCopyBytes(prf->fd, dataWrite, dataRead, pDirEntry->csize);
- dataWrite = RES_OFFSET_ALIGN(dataWrite + pDirEntry->csize);
+ ResCopyBytes(prf->fd, dataWrite, dataRead, GBIT24(pDirEntry->csize));
+ dataWrite = RES_OFFSET_ALIGN(dataWrite + GBIT24(pDirEntry->csize));
}
- dataRead = RES_OFFSET_ALIGN(dataRead + pDirEntry->csize);
+ dataRead = RES_OFFSET_ALIGN(dataRead + GBIT24(pDirEntry->csize));
pDirEntry++;
}
--- a/src/Libraries/RES/Source/resfile.c
+++ b/src/Libraries/RES/Source/resfile.c
@@ -57,7 +57,7 @@
// Datapath gDatapath;
-int32_t ResFindFreeFilenum();
+int32_t ResFindFreeFilenum(void);
void ResReadDirEntries(int32_t filenum, ResDirHeader *pDirHead);
void ResProcDirEntry(ResDirEntry *pDirEntry, int32_t filenum, int32_t dataOffset);
@@ -69,6 +69,19 @@
void ResWriteDir(int32_t filenum);
void ResWriteHeader(int32_t filenum);
+ResDirEntry
+diskResDirEntry(ResDirEntry *p)
+{+ ResDirEntry d;
+
+ d.id = p->id;
+ memcpy(d.size, p->size, sizeof d.size);
+ d.flags = p->flags;
+ memcpy(d.csize, p->csize, sizeof d.csize);
+ d.type = p->type;
+ return d;
+}
+
// ---------------------------------------------------------
//
// ResAddPath() adds a path to the resource manager's list.
@@ -102,7 +115,7 @@
int32_t ResOpenResFile(const char *fname, ResOpenMode mode, bool auxinfo) {int32_t filenum;
- FILE *fd;
+ FILE *fd = NULL;
ResFile *prf;
ResFileHeader fileHead;
ResDirHeader dirHead;
@@ -251,7 +264,7 @@
//
// ResFindFreeFilenum() finds free file number
-int32_t ResFindFreeFilenum() {+int32_t ResFindFreeFilenum(void) {int32_t filenum;
for (filenum = 1; filenum <= MAX_RESFILENUM; filenum++) {@@ -297,7 +310,7 @@
ResProcDirEntry(pDirEntry, filenum, dataOffset);
// Advance file offset and get next
- dataOffset = RES_OFFSET_ALIGN(dataOffset + pDirEntry->csize);
+ dataOffset = RES_OFFSET_ALIGN(dataOffset + GBIT24(pDirEntry->csize));
pDirEntry++;
}
}
@@ -320,7 +333,7 @@
// Grow table if need to
ResExtendDesc(pDirEntry->id);
- //TRACE("id %x", pDirEntry->id);+ TRACE("ResProcDirEntry id %x [%d %d]", pDirEntry->id, sizeof(ResDesc), sizeof(ResDesc2));// If already a resource at this id, warning
prd = RESDESC(pDirEntry->id);
@@ -332,7 +345,7 @@
// Fill in resource descriptor
prd->ptr = NULL;
- prd->fsize = pDirEntry->size;
+ prd->fsize = GBIT24(pDirEntry->size);
prd->msize = 0; // not decoded yet
prd->filenum = filenum;
prd->lock = 0;
@@ -342,7 +355,7 @@
prd->next = 0;
prd->prev = 0;
- //TRACE("Found id: %x of type %x", pDirEntry->id, pDirEntry->type);+ TRACE("Found id: %x of type %x", pDirEntry->id, pDirEntry->type);// If loadonopen flag set, load resource
@@ -411,7 +424,7 @@
pedit->flags |= RFF_NEEDSPACK;
else
ResProcDirEntry(pDirEntry, filenum, pedit->currDataOffset);
- pedit->currDataOffset = RES_OFFSET_ALIGN(pedit->currDataOffset + pDirEntry->csize);
+ pedit->currDataOffset = RES_OFFSET_ALIGN(pedit->currDataOffset + GBIT24(pDirEntry->csize));
}
// Seek to current data location
--- a/src/Libraries/RES/Source/resformat.c
+++ b/src/Libraries/RES/Source/resformat.c
@@ -22,11 +22,7 @@
#include "grs.h" // grs_font
// Defines the layout of a FrameDesc within a resource file.
-const ResLayout FrameDescLayout = {- 28, // on-disc size
- sizeof(FrameDesc), // in-memory size
- LAYOUT_FLAG_RAW_DATA_FOLLOWS, // flags
- {+const ResField FrameDescLayoutf[] = { { RFFT_PAD, 4 }, // skip placeholder bits pointer { RFFT_UINT8, offsetof(FrameDesc,bm.type) }, { RFFT_UINT8, offsetof(FrameDesc,bm.align) },@@ -43,8 +39,13 @@
{ RFFT_UINT32, offsetof(FrameDesc,pallOff) }, { RFFT_RAW, sizeof(FrameDesc) }, // raw bitmap data follows { RFFT_END, 0 }- }
};
+const ResLayout FrameDescLayout = {+ 28, // on-disc size
+ sizeof(FrameDesc), // in-memory size
+ LAYOUT_FLAG_RAW_DATA_FOLLOWS, // flags
+ FrameDescLayoutf
+};
// Decoder function for frames: decodes using the layout in the normal way and
// then updates the bits pointer.
@@ -58,11 +59,7 @@
// Describe a font.
// FIXME treats the offsets table as raw, should be decoded also.
-const ResLayout FontLayout = {- 84, // size on disc (header only)
- offsetof(grs_font, off_tab), // size in memory (header only)
- LAYOUT_FLAG_RAW_DATA_FOLLOWS, // flags
- {+const ResField FontLayoutf[] = { { RFFT_UINT16, offsetof(grs_font, id) }, { RFFT_PAD, 34 }, // dummy1 { RFFT_UINT16, offsetof(grs_font, min) },@@ -75,7 +72,12 @@
{ RFFT_RAW, offsetof(grs_font, off_tab) }, { RFFT_END, 0 }// offsets table follows, then bitmap data
- }
+};
+const ResLayout FontLayout = {+ 84, // size on disc (header only)
+ offsetof(grs_font, off_tab), // size in memory (header only)
+ LAYOUT_FLAG_RAW_DATA_FOLLOWS, // flags
+ FontLayoutf
};
const ResourceFormat FontFormat = RES_FORMAT(FontLayout);
--- a/src/Libraries/RES/Source/resformat.h
+++ b/src/Libraries/RES/Source/resformat.h
@@ -42,7 +42,7 @@
size_t dsize; // size of resource on disc
size_t msize; // size of resource in memory
uint32_t flags; // misc. info.
- ResField fields[];
+ ResField *fields;
} ResLayout;
// Indicates that multiple records exist within a resource, each of 'dsize'
--- a/src/Libraries/SND/Source/lgsndx.h
+++ b/src/Libraries/SND/Source/lgsndx.h
@@ -28,12 +28,12 @@
#ifndef __LGSNDX_H
#define __LGSNDX_H
-#include <SDL_mixer.h>
-
//#include <QuickTimeComponents.h>
//#include <Sound.h>
-//#include <SDL2/SDL.h>
+#include <SDL2/SDL.h>
+
+#include <SDL_mixer.h>
#include "lg.h"
--- a/src/Libraries/UI/Source/hotkey.h
+++ b/src/Libraries/UI/Source/hotkey.h
@@ -137,7 +137,7 @@
// are more hotkeys to list out. sort_type determines what sorting
// method is used.
-errtype hotkey_list_clear();
+errtype hotkey_list_clear(void);
// Starts hotkey listing at the beginning.
#endif
--- a/src/Libraries/UI/Source/region.c
+++ b/src/Libraries/UI/Source/region.c
@@ -51,7 +51,7 @@
int region_convert_toparent(LGRegion *from_reg, LGRect *orig, LGRect *conv);
uchar is_child(LGRegion *poss_parent, LGRegion *child);
uchar region_obscured_callback(LGRegion *reg, LGRect *r, void *data);
-Region_Sequence_Element *get_rse_from_pool();
+Region_Sequence_Element *get_rse_from_pool(void);
errtype return_rse_to_pool(Region_Sequence_Element *rse);
errtype region_add_sequence_expose(LGRegion *reg, LGRect exp_rect);
@@ -64,9 +64,9 @@
/* API FUNCTIONS */
-errtype init_rse_pool();
+errtype init_rse_pool(void);
-errtype region_init()
+errtype region_init(void)
{region_system_init = TRUE;
slist_init(&sequence_header);
@@ -827,7 +827,7 @@
#define RSE_POOL_SIZE 40
Region_Sequence_Element rse_pool[RSE_POOL_SIZE];
-Region_Sequence_Element *get_rse_from_pool()
+Region_Sequence_Element *get_rse_from_pool(void)
{int i = 0;
while ((i < RSE_POOL_SIZE) && (rse_pool[i].reg != NULL))
@@ -851,7 +851,7 @@
return(ERR_NOEFFECT);
}
-errtype init_rse_pool()
+errtype init_rse_pool(void)
{int i;
for (i=0; i < RSE_POOL_SIZE; i++)
--- a/src/Libraries/UI/Source/region.h
+++ b/src/Libraries/UI/Source/region.h
@@ -73,7 +73,7 @@
// Initialize the region system. Note that this gets called automatically
// the first time you try to create a region, if you haven't done so already.
-errtype region_init();
+errtype region_init(void);
// Register a region with the UI manager, geometry described by r, and as a
// subregion of the parent region. When the passed
@@ -155,7 +155,7 @@
// While a sequence is active, it captures all the expose events, and saves them until the
// sequence has ended, a which point it lets the exposes get through, after filtering out
// all the duplicate exposes.
-errtype region_begin_sequence();
+errtype region_begin_sequence(void);
errtype region_end_sequence(uchar replay);
--- a/src/Libraries/VOX/Source/vox.h
+++ b/src/Libraries/VOX/Source/vox.h
@@ -40,7 +40,7 @@
uchar vx_init(int max_depth);
// Close the voxel system
-void vx_close();
+void vx_close(void);
// Initialize a voxel
// Pass it pointer to the voxel structure
--- a/src/Libraries/adlmidi/include/adlmidi.h
+++ b/src/Libraries/adlmidi/include/adlmidi.h
@@ -171,13 +171,13 @@
* @brief Returns total number of available banks
* @return Total number of available embedded banks
*/
-extern int adl_getBanksCount();
+extern int adl_getBanksCount(void);
/**
* @brief Returns pointer to array of names of every bank
* @return Array of strings containing the name of every embedded bank
*/
-extern const char *const *adl_getBankNames();
+extern const char *const *adl_getBankNames(void);
/**
* @brief Reference to dynamic bank
@@ -592,13 +592,13 @@
* @brief Returns string which contains a version number
* @return String which contains a version of the library
*/
-extern const char *adl_linkedLibraryVersion();
+extern const char *adl_linkedLibraryVersion(void);
/**
* @brief Returns structure which contains a version number of library
* @return Library version context structure which contains version number of the library
*/
-extern const ADL_Version *adl_linkedVersion();
+extern const ADL_Version *adl_linkedVersion(void);
/* ======== Error Info ======== */
@@ -611,7 +611,7 @@
*
* @return String with error message related to library initialization
*/
-extern const char *adl_errorString();
+extern const char *adl_errorString(void);
/**
* @brief Returns string which contains last error message on specific device
--- /dev/null
+++ b/src/Libraries/mkfile
@@ -1,0 +1,433 @@
+</$objtype/mkfile
+LIB=libshock.a$O
+HFILES=\
+ 2D/Source/2d.h\
+ 2D/Source/Clip/clip.h\
+ 2D/Source/Clip/clpcon.h\
+ 2D/Source/Clip/clpfcn.h\
+ 2D/Source/Clip/clpltab.h\
+ 2D/Source/Clip/clpltyp.h\
+ 2D/Source/Flat8/fl8clin.h\
+ 2D/Source/Flat8/fl8lin.h\
+ 2D/Source/Flat8/fl8p.h\
+ 2D/Source/Flat8/fl8slin.h\
+ 2D/Source/Flat8/fl8tf.h\
+ 2D/Source/Flat8/fl8tmapdv.h\
+ 2D/Source/Flat8/fl8wclin.h\
+ 2D/Source/Flat8/flat8.h\
+ 2D/Source/GR/grbm.h\
+ 2D/Source/GR/grcbm.h\
+ 2D/Source/GR/grclhbm.h\
+ 2D/Source/GR/grcply.h\
+ 2D/Source/GR/grd.h\
+ 2D/Source/GR/grdbm.h\
+ 2D/Source/GR/grdev.h\
+ 2D/Source/GR/grgbm.h\
+ 2D/Source/GR/grhbm.h\
+ 2D/Source/GR/grlin.h\
+ 2D/Source/GR/grmalloc.h\
+ 2D/Source/GR/grnull.h\
+ 2D/Source/GR/grp24.h\
+ 2D/Source/GR/grpix.h\
+ 2D/Source/GR/grply.h\
+ 2D/Source/GR/grrect.h\
+ 2D/Source/GR/grrend.h\
+ 2D/Source/GR/grs.h\
+ 2D/Source/GR/grstate.h\
+ 2D/Source/Gen/genel.h\
+ 2D/Source/Gen/general.h\
+ 2D/Source/Gen/genov.h\
+ 2D/Source/Gen/gente.h\
+ 2D/Source/Gen/gentf.h\
+ 2D/Source/MacDev.h\
+ 2D/Source/RSD/rsd.h\
+ 2D/Source/RSD/rsdunpck.h\
+ 2D/Source/bit.h\
+ 2D/Source/bitmap.h\
+ 2D/Source/blend.h\
+ 2D/Source/blncon.h\
+ 2D/Source/blndat.h\
+ 2D/Source/blnfcn.h\
+ 2D/Source/buffer.h\
+ 2D/Source/canvas.h\
+ 2D/Source/chain.h\
+ 2D/Source/close.h\
+ 2D/Source/cnvdat.h\
+ 2D/Source/cnvdrv.h\
+ 2D/Source/cnvtab.h\
+ 2D/Source/context.h\
+ 2D/Source/ctxmac.h\
+ 2D/Source/detect.h\
+ 2D/Source/devtab.h\
+ 2D/Source/fcntab.h\
+ 2D/Source/fill.h\
+ 2D/Source/icanvas.h\
+ 2D/Source/idevice.h\
+ 2D/Source/ifcn.h\
+ 2D/Source/init_2D.h\
+ 2D/Source/initint.h\
+ 2D/Source/line.h\
+ 2D/Source/linfcn.h\
+ 2D/Source/lintab.h\
+ 2D/Source/lintyp.h\
+ 2D/Source/mode.h\
+ 2D/Source/pal.h\
+ 2D/Source/pertol.h\
+ 2D/Source/pertyp.h\
+ 2D/Source/pixfill.h\
+ 2D/Source/pixtab.h\
+ 2D/Source/plytyp.h\
+ 2D/Source/poly.h\
+ 2D/Source/polyint.h\
+ 2D/Source/rgb.h\
+ 2D/Source/scrdat.h\
+ 2D/Source/screen.h\
+ 2D/Source/scrmac.h\
+ 2D/Source/state.h\
+ 2D/Source/status_2D.h\
+ 2D/Source/string/chr.h\
+ 2D/Source/string/str.h\
+ 2D/Source/tabdat.h\
+ 2D/Source/tabdrv.h\
+ 2D/Source/tlucdat.h\
+ 2D/Source/tluctab.h\
+ 2D/Source/tmapfcn.h\
+ 2D/Source/tmapint.h\
+ 2D/Source/tmaps.h\
+ 2D/Source/tmaptab.h\
+ 2D/Source/valloc.h\
+ 2D/Source/vesa.h\
+ 2D/Source/vtab.h\
+ 2D/Source/wire.h\
+ 3D/Source/3d.h\
+ 3D/Source/3dinterp.h\
+ 3D/Source/GlobalV.h\
+ 3D/Source/fauxrend.h\
+ AFILE/Source/afile.h\
+ AFILE/Source/circbuff.h\
+ AFILE/Source/compose.h\
+ AFILE/Source/draw4x4.h\
+ AFILE/Source/huff.h\
+ AFILE/Source/movie.h\
+ DSTRUCT/Source/array.h\
+ DSTRUCT/Source/hash.h\
+ DSTRUCT/Source/pqueue.h\
+ DSTRUCT/Source/rect.h\
+ DSTRUCT/Source/slist.h\
+ EDMS/Source/MODELS/d_frame.h\
+ EDMS/Source/MODELS/ftl.h\
+ EDMS/Source/MODELS/pelvis.h\
+ EDMS/Source/MODELS/robot.h\
+ EDMS/Source/edms.h\
+ EDMS/Source/edms_chk.h\
+ EDMS/Source/edms_int.h\
+ EDMS/Source/edms_mod.h\
+ EDMS/Source/externs.h\
+ EDMS/Source/idof.h\
+ EDMS/Source/physhand.h\
+ EDMS/Source/ss_flet.h\
+ FIX/Source/fix.h\
+ FIX/Source/trigtab.h\
+ FIXPP/Source/fixpp.h\
+ H/2dres.h\
+ H/error.h\
+ H/keydefs.h\
+ H/lg_types.h\
+ INPUT/Source/kb.h\
+ INPUT/Source/kbcook.h\
+ INPUT/Source/mouse.h\
+ INPUT/Source/sdl_events.h\
+ LG/Source/LOG/src/log.h\
+ LG/Source/dbg.h\
+ LG/Source/lg.h\
+ LG/Source/memall.h\
+ LG/Source/tmpalloc.h\
+ PALETTE/Source/palette.h\
+ RES/Source/lzw.h\
+ RES/Source/res.h\
+ RES/Source/res_.h\
+ RES/Source/resformat.h\
+ RES/Source/restypes.h\
+ RND/Source/rnd.h\
+ SND/Source/lgsndx.h\
+ UI/Source/curdat.h\
+ UI/Source/cursors.h\
+ UI/Source/curtyp.h\
+ UI/Source/event.h\
+ UI/Source/hotkey.h\
+ UI/Source/region.h\
+ UI/Source/resgadg.h\
+ UI/Source/slab.h\
+ UI/Source/vmouse.h\
+ VOX/Source/vox.h\
+ ../MacSrc/OpenGL.h\
+ ../GameSrc/Headers/tickcount.h\
+
+OFILES=\
+ 2D/Source/Clip/clpclin.$O\
+ 2D/Source/Clip/clpf24.$O\
+ 2D/Source/Clip/clplin.$O\
+ 2D/Source/Clip/clplin2.$O\
+ 2D/Source/Clip/clpltab.$O\
+ 2D/Source/Clip/clpmono.$O\
+ 2D/Source/Clip/clpply.$O\
+ 2D/Source/Clip/clppoly.$O\
+ 2D/Source/Clip/clprect.$O\
+ 2D/Source/Clip/clpslin.$O\
+ 2D/Source/Flat8/FL8OPL.$O\
+ 2D/Source/Flat8/Fl8F.$O\
+ 2D/Source/Flat8/fl8bl.$O\
+ 2D/Source/Flat8/fl8bldbl.$O\
+ 2D/Source/Flat8/fl8chfl8.$O\
+ 2D/Source/Flat8/fl8clear.$O\
+ 2D/Source/Flat8/fl8clin.$O\
+ 2D/Source/Flat8/fl8cnv.$O\
+ 2D/Source/Flat8/fl8cop.$O\
+ 2D/Source/Flat8/fl8cply.$O\
+ 2D/Source/Flat8/fl8ctp.$O\
+ 2D/Source/Flat8/fl8dbl.$O\
+ 2D/Source/Flat8/fl8fl8.$O\
+ 2D/Source/Flat8/fl8fl8c.$O\
+ 2D/Source/Flat8/fl8fl8m.$O\
+ 2D/Source/Flat8/fl8fltr2.$O\
+ 2D/Source/Flat8/fl8ft.$O\
+ 2D/Source/Flat8/fl8g24.$O\
+ 2D/Source/Flat8/fl8gfl8.$O\
+ 2D/Source/Flat8/fl8gpix.$O\
+ 2D/Source/Flat8/fl8hfl8.$O\
+ 2D/Source/Flat8/fl8hlin.$O\
+ 2D/Source/Flat8/fl8lf.$O\
+ 2D/Source/Flat8/fl8lin.$O\
+ 2D/Source/Flat8/fl8ll.$O\
+ 2D/Source/Flat8/fl8lnop.$O\
+ 2D/Source/Flat8/fl8lop.$O\
+ 2D/Source/Flat8/fl8lp.$O\
+ 2D/Source/Flat8/fl8ltp.$O\
+ 2D/Source/Flat8/fl8lw.$O\
+ 2D/Source/Flat8/fl8mono.$O\
+ 2D/Source/Flat8/fl8mscl.$O\
+ 2D/Source/Flat8/fl8nl.$O\
+ 2D/Source/Flat8/fl8ns.$O\
+ 2D/Source/Flat8/fl8ntrp2.$O\
+ 2D/Source/Flat8/fl8p.$O\
+ 2D/Source/Flat8/fl8p24.$O\
+ 2D/Source/Flat8/fl8pix.$O\
+ 2D/Source/Flat8/fl8ply.$O\
+ 2D/Source/Flat8/fl8pnt.$O\
+ 2D/Source/Flat8/fl8rect.$O\
+ 2D/Source/Flat8/fl8row.$O\
+ 2D/Source/Flat8/fl8rsd8.$O\
+ 2D/Source/Flat8/fl8s.$O\
+ 2D/Source/Flat8/fl8slin.$O\
+ 2D/Source/Flat8/fl8sply.$O\
+ 2D/Source/Flat8/fl8sub.$O\
+ 2D/Source/Flat8/fl8tl8.$O\
+ 2D/Source/Flat8/fl8tpl.$O\
+ 2D/Source/Flat8/fl8tsmap.$O\
+ 2D/Source/Flat8/fl8vlin.$O\
+ 2D/Source/Flat8/fl8w.$O\
+ 2D/Source/Flat8/fl8wclin.$O\
+ 2D/Source/Flat8/fl8wlin.$O\
+ 2D/Source/GR/grd.$O\
+ 2D/Source/GR/grilin.$O\
+ 2D/Source/GR/grmalloc.$O\
+ 2D/Source/GR/grnull.$O\
+ 2D/Source/GR/gruilin.$O\
+ 2D/Source/Gen/genbox.$O\
+ 2D/Source/Gen/genchfl8.$O\
+ 2D/Source/Gen/gencirc.$O\
+ 2D/Source/Gen/genclin.$O\
+ 2D/Source/Gen/gencnv.$O\
+ 2D/Source/Gen/gencwlin.$O\
+ 2D/Source/Gen/gendisk.$O\
+ 2D/Source/Gen/genel.$O\
+ 2D/Source/Gen/general.$O\
+ 2D/Source/Gen/genf24.$O\
+ 2D/Source/Gen/genfl8.$O\
+ 2D/Source/Gen/genfl8c.$O\
+ 2D/Source/Gen/gengfl8.$O\
+ 2D/Source/Gen/genhfl8.$O\
+ 2D/Source/Gen/genhlin.$O\
+ 2D/Source/Gen/genlin.$O\
+ 2D/Source/Gen/genmono.$O\
+ 2D/Source/Gen/genov.$O\
+ 2D/Source/Gen/genpix.$O\
+ 2D/Source/Gen/genrect.$O\
+ 2D/Source/Gen/genrsd8.$O\
+ 2D/Source/Gen/genrsdbm.$O\
+ 2D/Source/Gen/genrsdtm.$O\
+ 2D/Source/Gen/genslin.$O\
+ 2D/Source/Gen/gente.$O\
+ 2D/Source/Gen/gentl8.$O\
+ 2D/Source/Gen/gentm.$O\
+ 2D/Source/Gen/genuclin.$O\
+ 2D/Source/Gen/genuhlin.$O\
+ 2D/Source/Gen/genulin.$O\
+ 2D/Source/Gen/genuslin.$O\
+ 2D/Source/Gen/genuvlin.$O\
+ 2D/Source/Gen/genvcply.$O\
+ 2D/Source/Gen/genvlin.$O\
+ 2D/Source/Gen/genvpoly.$O\
+ 2D/Source/Gen/genvrect.$O\
+ 2D/Source/Gen/genwclin.$O\
+ 2D/Source/Gen/genwlin.$O\
+ 2D/Source/MacDev.$O\
+ 2D/Source/RSD/RSDUnpack.$O\
+ 2D/Source/RSD/rsdcvt.$O\
+ 2D/Source/StateStk.$O\
+ 2D/Source/bit.$O\
+ 2D/Source/bitmap.$O\
+ 2D/Source/blend.$O\
+ 2D/Source/canvas.$O\
+ 2D/Source/close.$O\
+ 2D/Source/cnvtab.$O\
+ 2D/Source/context.$O\
+ 2D/Source/detect.$O\
+ 2D/Source/devtab.$O\
+ 2D/Source/fcntab.$O\
+ 2D/Source/init.$O\
+ 2D/Source/lintab.$O\
+ 2D/Source/mode.$O\
+ 2D/Source/pal.$O\
+ 2D/Source/permap.$O\
+ 2D/Source/persetup.$O\
+ 2D/Source/pertol.$O\
+ 2D/Source/rgb.$O\
+ 2D/Source/screen.$O\
+ 2D/Source/sscrn.$O\
+ 2D/Source/string/chrsiz.$O\
+ 2D/Source/string/genchr.$O\
+ 2D/Source/string/genstr.$O\
+ 2D/Source/string/genuchr.$O\
+ 2D/Source/string/genustr.$O\
+ 2D/Source/string/strnsiz.$O\
+ 2D/Source/string/strscl.$O\
+ 2D/Source/string/strsiz.$O\
+ 2D/Source/string/struscl.$O\
+ 2D/Source/string/strwrap.$O\
+ 2D/Source/svgainit.$O\
+ 2D/Source/tempbm.$O\
+ 2D/Source/temptm.$O\
+ 2D/Source/tlucdat.$O\
+ 2D/Source/tluctab.$O\
+ 2D/Source/valloc.$O\
+ 2D/Source/vtab.$O\
+ 3D/Source/Bitmap.$O\
+ 3D/Source/GlobalV.$O\
+ 3D/Source/alloc.$O\
+ 3D/Source/clip.$O\
+ 3D/Source/detail.$O\
+ 3D/Source/fov.$O\
+ 3D/Source/instance.$O\
+ 3D/Source/interp.$O\
+ 3D/Source/light.$O\
+ 3D/Source/matrix.$O\
+ 3D/Source/points.$O\
+ 3D/Source/polygon.$O\
+ 3D/Source/slew.$O\
+ 3D/Source/tmap.$O\
+ 3D/Source/vector.$O\
+ AFILE/Source/afile.$O\
+ AFILE/Source/amov.$O\
+ AFILE/Source/compose.$O\
+ AFILE/Source/movie.$O\
+ AFILE/Source/draw4x4.$O\
+ AFILE/Source/huffde.$O\
+ DSTRUCT/Source/array.$O\
+ DSTRUCT/Source/hash.$O\
+ DSTRUCT/Source/pqueue.$O\
+ DSTRUCT/Source/rect.$O\
+ EDMS/Source/collide.$O\
+ EDMS/Source/globals.$O\
+ EDMS/Source/interfac.$O\
+ EDMS/Source/intrsect.$O\
+ EDMS/Source/phy_tool.$O\
+ EDMS/Source/soliton.$O\
+ EDMS/Source/MODELS/d_f_2.$O\
+ EDMS/Source/MODELS/d_f_face.$O\
+ EDMS/Source/MODELS/d_frame.$O\
+ EDMS/Source/MODELS/ftl.$O\
+ EDMS/Source/MODELS/ftlface.$O\
+ EDMS/Source/MODELS/pelface.$O\
+ EDMS/Source/MODELS/pelvis.$O\
+ EDMS/Source/MODELS/robot.$O\
+ FIX/Source/MakeTables.$O\
+ FIX/Source/f_exp.$O\
+ FIX/Source/fix.$O\
+ FIX/Source/fix_sqrt.$O\
+ INPUT/Source/kbcook.$O\
+ INPUT/Source/mouse.$O\
+ INPUT/Source/sdl_events.$O\
+ LG/Source/LOG/src/log.$O\
+ LG/Source/memall.$O\
+ LG/Source/stack.$O\
+ LG/Source/tmpalloc.$O\
+ PALETTE/Source/palette.$O\
+ RES/Source/caseless.$O\
+ RES/Source/lzw.$O\
+ RES/Source/refacc.$O\
+ RES/Source/res.$O\
+ RES/Source/resacc.$O\
+ RES/Source/resbuild.$O\
+ RES/Source/resfile.$O\
+ RES/Source/resformat.$O\
+ RES/Source/resload.$O\
+ RES/Source/resmake.$O\
+ RES/Source/restypes.$O\
+ RND/Source/rnd.$O\
+ UI/Source/curdrw.$O\
+ UI/Source/cursors.$O\
+ UI/Source/event.$O\
+ UI/Source/hotkey.$O\
+ UI/Source/region.$O\
+ UI/Source/slab.$O\
+ UI/Source/vmouse.$O\
+ VOX/Source/vox2d.$O\
+ VOX/Source/vox3d.$O\
+ VOX/Source/voxinit.$O\
+
+</sys/src/cmd/mklib
+
+CLEANFILES=$CLEANFILES $OFILES
+
+# -DDEBUGGING_BLIT -DUSE_OPENGL -DUSEFLUIDSYNTH=1 -DSVGA_SUPPORT
+CFLAGS=$CFLAGS -p -D__plan9__ -D__${objtype}__ \+ -DUSE_SDL_MIXER \
+ -I2D/Source \
+ -I2D/Source/GR \
+ -I2D/Source/Clip \
+ -I2D/Source/Flat8 \
+ -I2D/Source/GR \
+ -I2D/Source/Gen \
+ -I2D/Source/RSD \
+ -I2D/Source/string \
+ -I3D/Source \
+ -IAFILE/Source \
+ -IDSTRUCT/Source \
+ -IEDMS/Source \
+ -IEDMS/Source/MODELS \
+ -IFIXPP/Source \
+ -IFIX/Source \
+ -IH \
+ -IINPUT/Source \
+ -ILG/Source \
+ -ILG/Source/LOG/src \
+ -IPALETTE/Source \
+ -IRES/Source \
+ -IRND/Source \
+ -ISND/Source \
+ -IUI/Source \
+ -IVOX/Source \
+ -I../MacSrc \
+ -I../GameSrc/Headers \
+ -I/sys/include/npe \
+ -I/sys/include/npe/SDL2 \
+
+%.$O: %.c
+ $CC $CFLAGS -o $target $stem.c
+
+%.$O: %.cc
+ $CC $CFLAGS -o $target $stem.cc
+
+%.$O: %.cpp
+ $CC $CFLAGS -o $target $stem.cpp
--- a/src/MacSrc/InitMac.c
+++ b/src/MacSrc/InitMac.c
@@ -25,6 +25,7 @@
//--------------------
#include <SDL.h>
+#include "precompiled.h"
#include "InitMac.h"
#include "Shock.h"
#include "ShockBitmap.h"
--- a/src/MacSrc/MacTune.c
+++ b/src/MacSrc/MacTune.c
@@ -26,6 +26,7 @@
#include <stdbool.h>
+#include "precompiled.h"
#include "MacTune.h"
#include "miscqvar.h"
#include "Xmi.h"
--- a/src/MacSrc/Modding.c
+++ b/src/MacSrc/Modding.c
@@ -17,6 +17,7 @@
*/
+#include "precompiled.h"
#include "Modding.h"
#include "lg.h"
--- a/src/MacSrc/OpenGL.h
+++ b/src/MacSrc/OpenGL.h
@@ -10,17 +10,17 @@
#ifdef USE_OPENGL
-int init_opengl();
+int init_opengl(void);
void opengl_cache_wall_texture(int idx, int size, grs_bitmap *bm);
-void opengl_clear_texture_cache();
+void opengl_clear_texture_cache(void);
-bool can_use_opengl();
-bool use_opengl();
-void toggle_opengl();
+bool can_use_opengl(void);
+bool use_opengl(void);
+void toggle_opengl(void);
void opengl_resize(int width, int height);
-bool should_opengl_swap();
+bool should_opengl_swap(void);
void opengl_swap_and_restore(SDL_Surface *ui);
-void opengl_change_palette();
+void opengl_change_palette(void);
void opengl_set_viewport(int x, int y, int width, int height);
int opengl_draw_tmap(int n, g3s_phandle *vp, grs_bitmap *bm);
@@ -28,27 +28,27 @@
int opengl_bitmap(grs_bitmap *bm, int n, grs_vertex **vpl, grs_tmap_info *ti);
int opengl_draw_poly(long c, int n_verts, g3s_phandle *p, char gour_flag);
int opengl_draw_star(fix star_x, fix star_y, int c, bool anti_alias);
-void opengl_begin_stars();
-void opengl_end_stars();
+void opengl_begin_stars(void);
+void opengl_end_stars(void);
void opengl_set_stencil(int v);
-void opengl_start_frame();
-void opengl_end_frame();
+void opengl_start_frame(void);
+void opengl_end_frame(void);
void opengl_begin_sensaround(uchar version);
-void opengl_end_sensaround();
+void opengl_end_sensaround(void);
#else
-static int init_opengl() { return 0; }+static int init_opengl(void) { return 0; } static void opengl_cache_wall_texture(int idx, int size, grs_bitmap *bm) {}-static void opengl_clear_texture_cache(){};+static void opengl_clear_texture_cache(void){};-static bool can_use_opengl() { return false; }-static bool use_opengl() { return false; }-static void toggle_opengl() {}+static bool can_use_opengl(void) { return false; }+static bool use_opengl(void) { return false; }+static void toggle_opengl(void) {} static void opengl_resize(int width, int height) {}-static bool should_opengl_swap() { return false; }+static bool should_opengl_swap(void) { return false; } static void opengl_swap_and_restore(SDL_Surface *ui) {}-static void opengl_change_palette() {}+static void opengl_change_palette(void) {} static void opengl_set_viewport(int x, int y, int width, int height) {} static int opengl_draw_tmap(int n, g3s_phandle *vp, grs_bitmap *bm) { return 0; }@@ -56,13 +56,13 @@
static int opengl_bitmap(grs_bitmap *bm, int n, grs_vertex **vpl, grs_tmap_info *ti) { return 0; } static int opengl_draw_poly(long c, int n_verts, g3s_phandle *p, char gour_flag) { return 0; } static int opengl_draw_star(fix star_x, fix star_y, int c, bool anti_alias) { return 0; }-static void opengl_begin_stars() {}-static void opengl_end_stars() {}+static void opengl_begin_stars(void) {}+static void opengl_end_stars(void) {} static void opengl_set_stencil(int v) {}-static void opengl_start_frame() {}-static void opengl_end_frame() {}+static void opengl_start_frame(void) {}+static void opengl_end_frame(void) {} static void opengl_begin_sensaround(uchar version) {}-static void opengl_end_sensaround() {}+static void opengl_end_sensaround(void) {}#endif
--- a/src/MacSrc/Prefs.c
+++ b/src/MacSrc/Prefs.c
@@ -28,6 +28,7 @@
//--------------------
// Includes
//--------------------
+#include "precompiled.h"
#include "Shock.h"
#include "Prefs.h"
--- a/src/MacSrc/Prefs.h
+++ b/src/MacSrc/Prefs.h
@@ -77,8 +77,10 @@
// Enums
//-------------------
enum OPT_SEQ_ { // Must be in the same order as in wraper.h- OPT_SEQ_ADLMIDI = 0,
- OPT_SEQ_NativeMI,
+ OPT_SEQ_NativeMI = 0,
+#ifdef USE_ADLMIDI
+ OPT_SEQ_ADLMIDI,
+#endif
#ifdef USE_FLUIDSYNTH
OPT_SEQ_FluidSyn,
#endif // USE_FLUIDSYNTH
--- a/src/MacSrc/SDLSound.c
+++ b/src/MacSrc/SDLSound.c
@@ -1,3 +1,5 @@
+#include "precompiled.h"
+#include <SDL2/SDL.h>
#include "Xmi.h"
#include "MusicDevice.h"
--- a/src/MacSrc/Shock.c
+++ b/src/MacSrc/Shock.c
@@ -28,8 +28,10 @@
// Includes
//--------------------
#include <math.h>
-#include <SDL.h>
+#include <SDL2/SDL.h>
+#include <pool.h>
+#include "precompiled.h"
#include "InitMac.h"
#include "Modding.h"
#include "OpenGL.h"
@@ -83,6 +85,9 @@
int main(int argc, char **argv) {// Save the arguments for later
+ //mainmem->flags |= POOL_PARANOIA | POOL_ANTAGONISM;
+ setfcr(getfcr() & ~(FPOVFL|FPUNFL|FPINVAL|FPZDIV)); /* FIXME */
+
num_args = argc;
arg_values = argv;
@@ -159,12 +164,13 @@
return false;
}
-void InitSDL() {+void InitSDL(void) {SDL_SetHint(SDL_HINT_NO_SIGNAL_HANDLERS, "1");
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl");
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_AUDIO) < 0) { DEBUG("%s: Init failed", __FUNCTION__);}
+ SDL_StartTextInput();
// TODO: figure out some universal set of settings that work...
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
@@ -277,7 +283,7 @@
opengl_change_palette();
}
-void SDLDraw() {+void SDLDraw(void) { if (should_opengl_swap()) {// We want the UI background to be transparent!
sdlPalette->colors[255].a = 0x00;
--- a/src/MacSrc/Shock.h
+++ b/src/MacSrc/Shock.h
@@ -32,9 +32,9 @@
//--------------------
int main(int argc, char **argv);
-void InitSDL();
+void InitSDL(void);
void SetSDLPalette(int index, int count, uchar *pal);
-void SDLDraw();
+void SDLDraw(void);
void CaptureMouse(bool capture);
bool CheckArgument(char *name);
--- a/src/MacSrc/ShockBitmap.c
+++ b/src/MacSrc/ShockBitmap.c
@@ -23,6 +23,7 @@
//--------------------
// Includes
//--------------------
+#include "precompiled.h"
#include "InitMac.h"
#include "Shock.h"
#include "ShockBitmap.h"
@@ -83,7 +84,7 @@
// Point the renderer at the screen bytes
gScreenRowbytes = drawSurface->w;
- gScreenAddress = drawSurface->pixels;
+ gScreenAddress = (intptr_t *)drawSurface->pixels;
grd_mode_cap.vbase = gScreenAddress;
}
--- a/src/MacSrc/Xmi.c
+++ b/src/MacSrc/Xmi.c
@@ -1,5 +1,6 @@
#include <SDL.h>
+#include "precompiled.h"
#include "Xmi.h"
#include "MusicDevice.h"
#include "Prefs.h"
@@ -687,10 +688,9 @@
int channel, i;
SDL_Thread *thread;
+ MyMutex = SDL_CreateMutex();
InitDecXMI();
- MyMutex = SDL_CreateMutex();
-
for (channel = 0; channel < 16; channel++) {ChannelThread[channel] = -1;
SDL_AtomicSet(&DeviceChannelVolume[channel], 0);
@@ -722,11 +722,13 @@
int musicrate = 48000;
switch (gShockPrefs.soMidiBackend) {+#ifdef USE_ADLMIDI
case OPT_SEQ_ADLMIDI: // adlmidi
{ INFO("Creating ADLMIDI device");musicdev = CreateMusicDevice(Music_AdlMidi);
} break;
+#endif
case OPT_SEQ_NativeMI: // native midi
{ INFO("Creating native MIDI device");@@ -778,12 +780,14 @@
case Music_None:
deviceTypeMatch = 0;
break;
- case Music_AdlMidi:
- deviceTypeMatch = (gShockPrefs.soMidiBackend == 0);
- break;
case Music_Native:
deviceTypeMatch = (gShockPrefs.soMidiBackend == 1);
break;
+#ifdef USE_ADLMIDI
+ case Music_AdlMidi:
+ deviceTypeMatch = (gShockPrefs.soMidiBackend == 0);
+ break;
+#endif
#ifdef USE_FLUIDSYNTH
case Music_FluidSynth:
deviceTypeMatch = (gShockPrefs.soMidiBackend == 2);
--- a/src/MusicSrc/MusicDevice.c
+++ b/src/MusicSrc/MusicDevice.c
@@ -149,7 +149,7 @@
(void)outputIndex;
}
-static MusicDevice *createNullMidiDevice()
+static MusicDevice *createNullMidiDevice(void)
{MusicDevice *dev = malloc(sizeof(MusicDevice));
dev->init = &NullMidiInit;
@@ -176,6 +176,7 @@
//------------------------------------------------------------------------------
// ADLMIDI player for OPL3
+#ifdef USE_ADLMIDI
#include "adlmidi.h"
typedef struct AdlMidiDevice
@@ -325,7 +326,7 @@
(void)outputIndex;
}
-static MusicDevice *createAdlMidiDevice()
+static MusicDevice *createAdlMidiDevice(void)
{AdlMidiDevice *adev = malloc(sizeof(AdlMidiDevice));
adev->dev.init = &AdlMidiInit;
@@ -348,6 +349,7 @@
adev->dev.musicType = MUSICTYPE_SBLASTER;
return &adev->dev;
}
+#endif
//------------------------------------------------------------------------------
// Native OS MIDI
@@ -969,7 +971,7 @@
(void)dev;
}
-static MusicDevice *createNativeMidiDevice()
+static MusicDevice *createNativeMidiDevice(void)
{NativeMidiDevice *ndev = malloc(sizeof(NativeMidiDevice));
ndev->dev.init = &NativeMidiInit;
@@ -1285,7 +1287,7 @@
(void)outputIndex;
}
-static MusicDevice *createFluidSynthDevice()
+static MusicDevice *createFluidSynthDevice(void)
{FluidMidiDevice *fdev = malloc(sizeof(FluidMidiDevice));
fdev->dev.init = &FluidMidiInit;
@@ -1320,12 +1322,14 @@
case Music_None:
dev = createNullMidiDevice();
break;
- case Music_AdlMidi:
- dev = createAdlMidiDevice();
- break;
case Music_Native:
dev = createNativeMidiDevice();
break;
+#ifdef USE_ADLMIDI
+ case Music_AdlMidi:
+ dev = createAdlMidiDevice();
+ break;
+#endif
#ifdef USE_FLUIDSYNTH
case Music_FluidSynth:
dev = createFluidSynthDevice();
--- a/src/MusicSrc/MusicDevice.h
+++ b/src/MusicSrc/MusicDevice.h
@@ -5,8 +5,10 @@
typedef enum MusicType
{Music_None
- ,Music_AdlMidi
,Music_Native
+#ifdef USE_ADLMIDI
+ ,Music_AdlMidi
+#endif
#ifdef USE_FLUIDSYNTH
,Music_FluidSynth
#endif
--
⑨