├── makemsc.bat ├── rsrc ├── game.bmp ├── game.png ├── build.bmp ├── build.png ├── game_icon.ico ├── build_icon.ico ├── startgtk_game.gresource.xml ├── startgtk_build.gresource.xml ├── game-x86.manifest ├── game.manifest ├── build-x86.manifest └── build.manifest ├── src ├── common.h ├── version.h ├── version.c ├── colormap.h ├── actor.h ├── startwin.h ├── track.h ├── osdfuncs.h ├── trigger.h ├── _config.h ├── vis.h ├── anim.h ├── jnames.h ├── GameListSource.h ├── warp.h ├── slidor.h ├── cache.h ├── ninja.h ├── quake.h ├── mclip.h ├── gameres.h ├── reserve.h ├── parse.h ├── interp.h ├── saveable.h ├── inv.h ├── break.h ├── grpscan.h ├── text.h ├── osdfuncs.c ├── sw_strs.h ├── light.h ├── parent.h ├── mfile.h ├── settings.h ├── GameListSource.m ├── demo.h ├── _rts.h ├── lists.h ├── names.h ├── sector.h ├── function.h ├── sprite.h ├── jsector.h ├── rts.h ├── interp.c ├── jtags.h ├── buildres.rc ├── interpsh.c ├── bots.h ├── keys.h ├── saveable.c ├── config.h ├── pal.h ├── osdcmds.c ├── gamedefs.h ├── player.h ├── ai.h ├── vis.c ├── jbhlp.c ├── gameres.rc ├── net.h ├── wallmove.c └── damage.h ├── xcode ├── Images.xcassets │ ├── Contents.json │ ├── AppIcon.appiconset │ │ ├── game.png │ │ └── Contents.json │ └── EditorAppIcon.appiconset │ │ ├── build.png │ │ └── Contents.json ├── startwin.game.nib │ └── keyedobjects.nib ├── Version.xcconfig.sample ├── startwin.editor.nib │ └── keyedobjects.nib ├── Signing.xcconfig.sample ├── JFShadowWarrior.entitlements ├── Build Editor for JFShadowWarrior.entitlements ├── Common.xcconfig ├── Build Editor-Info.plist └── JFShadowWarrior-Info.plist ├── .gitmodules ├── tools ├── generateversion.cmd ├── package-win.ps1 └── package-macos.sh ├── .gitignore ├── .github └── workflows │ └── ci.yml ├── README.md ├── installer └── jfsw.nsi └── Makefile.msvc /makemsc.bat: -------------------------------------------------------------------------------- 1 | nmake /nologo /f Makefile.msvc %1 %2 %3 %4 %5 2 | -------------------------------------------------------------------------------- /rsrc/game.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonof/jfsw/HEAD/rsrc/game.bmp -------------------------------------------------------------------------------- /rsrc/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonof/jfsw/HEAD/rsrc/game.png -------------------------------------------------------------------------------- /src/common.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonof/jfsw/HEAD/src/common.h -------------------------------------------------------------------------------- /rsrc/build.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonof/jfsw/HEAD/rsrc/build.bmp -------------------------------------------------------------------------------- /rsrc/build.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonof/jfsw/HEAD/rsrc/build.png -------------------------------------------------------------------------------- /rsrc/game_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonof/jfsw/HEAD/rsrc/game_icon.ico -------------------------------------------------------------------------------- /rsrc/build_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonof/jfsw/HEAD/rsrc/build_icon.ico -------------------------------------------------------------------------------- /src/version.h: -------------------------------------------------------------------------------- 1 | extern const char *game_version; 2 | extern const char *game_date; 3 | extern const char *game_time; 4 | -------------------------------------------------------------------------------- /xcode/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /xcode/startwin.game.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonof/jfsw/HEAD/xcode/startwin.game.nib/keyedobjects.nib -------------------------------------------------------------------------------- /src/version.c: -------------------------------------------------------------------------------- 1 | const char *game_version = "(not set)"; 2 | const char *game_date = __DATE__; 3 | const char *game_time = __TIME__; 4 | -------------------------------------------------------------------------------- /xcode/Version.xcconfig.sample: -------------------------------------------------------------------------------- 1 | // Sample Xcode configuration with versioning information. 2 | CURRENT_PROJECT_VERSION = 20200101 3 | -------------------------------------------------------------------------------- /xcode/startwin.editor.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonof/jfsw/HEAD/xcode/startwin.editor.nib/keyedobjects.nib -------------------------------------------------------------------------------- /xcode/Images.xcassets/AppIcon.appiconset/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonof/jfsw/HEAD/xcode/Images.xcassets/AppIcon.appiconset/game.png -------------------------------------------------------------------------------- /xcode/Images.xcassets/EditorAppIcon.appiconset/build.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonof/jfsw/HEAD/xcode/Images.xcassets/EditorAppIcon.appiconset/build.png -------------------------------------------------------------------------------- /xcode/Signing.xcconfig.sample: -------------------------------------------------------------------------------- 1 | // Sample Xcode configuration with JonoF's signing settings. 2 | CODE_SIGN_IDENTITY = Developer ID Application 3 | CODE_SIGN_STYLE = Manual 4 | DEVELOPMENT_TEAM = S7U4E54CHC 5 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "jfmact"] 2 | path = jfmact 3 | url = ../jfmact.git 4 | [submodule "jfaudiolib"] 5 | path = jfaudiolib 6 | url = ../jfaudiolib.git 7 | [submodule "jfbuild"] 8 | path = jfbuild 9 | url = ../jfbuild.git 10 | -------------------------------------------------------------------------------- /src/colormap.h: -------------------------------------------------------------------------------- 1 | void MapColors(short num,COLOR_MAP cm,short create); 2 | void InitPalette(void ); 3 | void SetPaletteToVESA(unsigned char *pal); 4 | void set_pal(unsigned char *pal); 5 | void GetPaletteFromVESA(unsigned char *pal); 6 | void InitPalette(void ); 7 | -------------------------------------------------------------------------------- /rsrc/startgtk_game.gresource.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | game.png 5 | startgtk_game.glade 6 | 7 | 8 | -------------------------------------------------------------------------------- /rsrc/startgtk_build.gresource.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | build.png 5 | startgtk_build.glade 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/actor.h: -------------------------------------------------------------------------------- 1 | int DoBeginJump(short SpriteNum); 2 | int DoJump(short SpriteNum); 3 | int DoBeginFall(short SpriteNum); 4 | int DoFall(short SpriteNum); 5 | void KeepActorOnFloor(short SpriteNum); 6 | int DoActorSlide(short SpriteNum); 7 | int DoActorSectorDamage(short SpriteNum); 8 | int DoScaleSprite(short SpriteNum); 9 | -------------------------------------------------------------------------------- /xcode/JFShadowWarrior.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.cs.disable-library-validation 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /xcode/Build Editor for JFShadowWarrior.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.cs.disable-library-validation 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/startwin.h: -------------------------------------------------------------------------------- 1 | #include "grpscan.h" 2 | 3 | struct startwin_settings { 4 | int fullscreen; 5 | int xdim3d, ydim3d, bpp3d; 6 | int forcesetup; 7 | int usemouse, usejoy; 8 | int samplerate, bitspersample, channels; 9 | 10 | struct grpfile const *selectedgrp; 11 | 12 | int numplayers; 13 | char *joinhost; 14 | int netoverride; 15 | }; 16 | -------------------------------------------------------------------------------- /tools/generateversion.cmd: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | REM Generator for version-auto.c on Windows 3 | 4 | git.exe --version >NUL 2>&1 5 | IF %ERRORLEVEL% EQU 0 ( 6 | FOR /F %%G IN ('git.exe describe --always') DO ECHO const char *game_version = "%%G"; 7 | ) ELSE ( 8 | ECHO const char *game_version = "git error"; 9 | ) 10 | ECHO const char *game_date = __DATE__; 11 | ECHO const char *game_time = __TIME__; 12 | 13 | EXIT /B 0 14 | -------------------------------------------------------------------------------- /xcode/Common.xcconfig: -------------------------------------------------------------------------------- 1 | // By default the binary is signed to run locally. 2 | CODE_SIGN_IDENTITY = - 3 | CURRENT_PROJECT_VERSION = 1.0 4 | 5 | // Copy xcode/Signing.xcconfig.sample to xcode/Signing.xcconfig 6 | // and then update the signing settings to personalise. 7 | #include? "Signing.xcconfig" 8 | 9 | // Copy xcode/Version.xcconfig.sample to xcode/Version.xcconfig 10 | // to set version properties. 11 | #include? "Version.xcconfig" 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.obj 3 | *.a 4 | *.res 5 | *.exe 6 | *.map 7 | *.log 8 | *.grp 9 | *.cfg 10 | *.swp 11 | *~ 12 | *.pdb 13 | *.dll 14 | /src/version-auto.c 15 | 16 | /xcode/*.xcodeproj/*.mode1v3 17 | /xcode/*.xcodeproj/*.pbxuser 18 | /xcode/*.xcodeproj/project.xcworkspace 19 | /xcode/*.xcodeproj/xcuserdata 20 | /xcode/Version.xcconfig 21 | /xcode/Signing.xcconfig 22 | 23 | /xcode/build 24 | /.vs 25 | /Makefile.*user 26 | 27 | /sw 28 | /build 29 | /grpfiles.cache 30 | -------------------------------------------------------------------------------- /src/track.h: -------------------------------------------------------------------------------- 1 | int ActorFollowTrack(short SpriteNum,short locktics); 2 | void ActorLeaveTrack(short SpriteNum); 3 | void RefreshPoints(SECTOR_OBJECTp sop,int nx,int ny,BOOL dynamic); 4 | void TrackSetup(void ); 5 | void PlaceSectorObject(SECTOR_OBJECTp sop,short newang,int newx,int newy); 6 | void PlaceSectorObjectsOnTracks(void ); 7 | void PlaceActorsOnTracks(void ); 8 | void SetupSectorObject(short sectnum,short tag); 9 | void PostSetupSectorObject(void ); 10 | void VehicleSetSmoke(SECTOR_OBJECTp sop,ANIMATORp animator); 11 | void CollapseSectorObject(SECTOR_OBJECTp sop,int nx,int ny); 12 | void KillSectorObjectSprites(SECTOR_OBJECTp sop); 13 | void MoveSectorObjects(SECTOR_OBJECTp sop,short locktics); 14 | -------------------------------------------------------------------------------- /rsrc/game-x86.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | JFShadowWarrior 10 | 11 | 12 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /rsrc/game.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | JFShadowWarrior 10 | 11 | 12 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /rsrc/build-x86.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | Build Editor for JFShadowWarrior 10 | 11 | 12 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /rsrc/build.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | Build Editor for JFShadowWarrior 10 | 11 | 12 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/osdfuncs.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Shadow Warrior is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU General Public License 5 | as published by the Free Software Foundation; either version 2 6 | of the License, or (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | 12 | See the GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | */ 18 | //------------------------------------------------------------------------- 19 | 20 | void osdfunc_onshowosd(int shown); 21 | void osdfunc_clearbackground(int c, int r); 22 | -------------------------------------------------------------------------------- /xcode/Build Editor-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | LSMinimumSystemVersionByArchitecture 6 | 7 | x86_64 8 | ${MACOSX_DEPLOYMENT_TARGET}.0 9 | 10 | NSHighResolutionCapable 11 | 12 | CFBundleDevelopmentRegion 13 | English 14 | CFBundleExecutable 15 | $(EXECUTABLE_NAME) 16 | CFBundleIdentifier 17 | au.id.jonof.jfsw.build 18 | CFBundleInfoDictionaryVersion 19 | 6.0 20 | CFBundlePackageType 21 | APPL 22 | CFBundleSignature 23 | ???? 24 | CFBundleShortVersionString 25 | $(CURRENT_PROJECT_VERSION) 26 | CFBundleVersion 27 | $(CURRENT_PROJECT_VERSION) 28 | NSPrincipalClass 29 | NSApplication 30 | 31 | 32 | -------------------------------------------------------------------------------- /xcode/JFShadowWarrior-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSHumanReadableCopyright 6 | See GPL.TXT for license terms. 7 | NSHighResolutionCapable 8 | 9 | LSMinimumSystemVersionByArchitecture 10 | 11 | x86_64 12 | ${MACOSX_DEPLOYMENT_TARGET}.0 13 | 14 | CFBundleDevelopmentRegion 15 | English 16 | CFBundleExecutable 17 | $(EXECUTABLE_NAME) 18 | CFBundleIdentifier 19 | au.id.jonof.jfsw 20 | CFBundleInfoDictionaryVersion 21 | 6.0 22 | CFBundlePackageType 23 | APPL 24 | CFBundleSignature 25 | ???? 26 | CFBundleShortVersionString 27 | $(CURRENT_PROJECT_VERSION) 28 | CFBundleVersion 29 | $(CURRENT_PROJECT_VERSION) 30 | NSPrincipalClass 31 | NSApplication 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/trigger.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | enum TriggerType {TRIGGER_TYPE_REMOTE_SO}; 28 | -------------------------------------------------------------------------------- /xcode/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "size" : "128x128", 25 | "idiom" : "mac", 26 | "filename" : "game.png", 27 | "scale" : "1x" 28 | }, 29 | { 30 | "idiom" : "mac", 31 | "size" : "128x128", 32 | "scale" : "2x" 33 | }, 34 | { 35 | "idiom" : "mac", 36 | "size" : "256x256", 37 | "scale" : "1x" 38 | }, 39 | { 40 | "idiom" : "mac", 41 | "size" : "256x256", 42 | "scale" : "2x" 43 | }, 44 | { 45 | "idiom" : "mac", 46 | "size" : "512x512", 47 | "scale" : "1x" 48 | }, 49 | { 50 | "idiom" : "mac", 51 | "size" : "512x512", 52 | "scale" : "2x" 53 | } 54 | ], 55 | "info" : { 56 | "version" : 1, 57 | "author" : "xcode" 58 | } 59 | } -------------------------------------------------------------------------------- /xcode/Images.xcassets/EditorAppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "size" : "128x128", 25 | "idiom" : "mac", 26 | "filename" : "build.png", 27 | "scale" : "1x" 28 | }, 29 | { 30 | "idiom" : "mac", 31 | "size" : "128x128", 32 | "scale" : "2x" 33 | }, 34 | { 35 | "idiom" : "mac", 36 | "size" : "256x256", 37 | "scale" : "1x" 38 | }, 39 | { 40 | "idiom" : "mac", 41 | "size" : "256x256", 42 | "scale" : "2x" 43 | }, 44 | { 45 | "idiom" : "mac", 46 | "size" : "512x512", 47 | "scale" : "1x" 48 | }, 49 | { 50 | "idiom" : "mac", 51 | "size" : "512x512", 52 | "scale" : "2x" 53 | } 54 | ], 55 | "info" : { 56 | "version" : 1, 57 | "author" : "xcode" 58 | } 59 | } -------------------------------------------------------------------------------- /src/_config.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | #ifndef _config_private 28 | #define _config_private 29 | 30 | //#define SETUPFILENAME "SW.CFG" 31 | 32 | #endif 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/vis.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | void ProcessVisOn(void); 28 | void VisViewChange(PLAYERp pp, int *vis); 29 | int SpawnVis(short Parent, short sectnum, int x, int y, int z, int amt); 30 | -------------------------------------------------------------------------------- /src/anim.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | #define ANIM_INTRO 0 28 | #define ANIM_SERP 1 29 | #define ANIM_SUMO 2 30 | #define ANIM_ZILLA 3 31 | 32 | unsigned char * LoadAnm(short anim_num); 33 | void playanm(short anim_num); 34 | -------------------------------------------------------------------------------- /src/jnames.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | // My pic names file 28 | 29 | #ifndef JNAMES_H 30 | #define JNAMES_H 31 | 32 | #define MIRROR 340 33 | #define FLOORMIRROR 341 34 | #define CAMSPRITE 3830 35 | 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /src/GameListSource.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 2013 Jonathon Fowler 4 | 5 | This file is part of JFShadowWarrior 6 | 7 | Duke Nukem 3D is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | */ 22 | //------------------------------------------------------------------------- 23 | 24 | @interface GameListSource : NSObject 25 | { 26 | } 27 | - (id)tableView:(NSTableView *)aTableView 28 | objectValueForTableColumn:(NSTableColumn *)aTableColumn 29 | row:(NSInteger)rowIndex; 30 | - (int)numberOfRowsInTableView:(NSTableView *)aTableView; 31 | - (int)indexForGrp:(struct grpfile const *)grpFile; 32 | @end 33 | 34 | -------------------------------------------------------------------------------- /src/warp.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | BOOL WarpPlaneSectorInfo(short sectnum, SPRITEp *sp_ceiling, SPRITEp *sp_floor); 28 | SPRITEp WarpPlane(LONGp x, LONGp y, LONGp z, SHORTp sectnum); 29 | SPRITEp WarpToArea(SPRITEp sp_from, LONGp x, LONGp y, LONGp z, SHORTp sectnum); 30 | BOOL WarpSectorInfo(short sectnum, SPRITEp *sp_warp); 31 | SPRITEp Warp(LONGp x, LONGp y, LONGp z, SHORTp sectnum); 32 | -------------------------------------------------------------------------------- /src/slidor.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | #ifndef _SLIDOR_PUBLIC 28 | #define _SLIDOR_PUBLIC 29 | 30 | short DoSlidorMatch(PLAYERp pp, short match, BOOL); 31 | BOOL TestSlidorMatchActive(short match); 32 | VOID InterpSectorSprites(short sectnum, BOOL state); 33 | 34 | typedef void INTERP_FUNC(int *); 35 | typedef INTERP_FUNC *INTERP_FUNCp; 36 | 37 | void SetSlidorActive(short SpriteNum); 38 | void DoSlidorInterp(short, INTERP_FUNCp); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/cache.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | #define CACHE_NONE 0 // don't use this - this is for ken 28 | #define CACHE_LOCK_MAX 255 29 | #define CACHE_LOCK_START 200 30 | #define CACHE_UNLOCK_START 1 31 | #define CACHE_UNLOCK_MAX 199 32 | 33 | #define CACHE_SOUND_PRECACHE 0 34 | #define CACHE_SOUND_PLAY 1 35 | 36 | void SetupPreCache(void); 37 | void PreCacheRange(short start_pic, short end_pic); 38 | void DoTheCache(void); 39 | void precache(void); 40 | 41 | -------------------------------------------------------------------------------- /src/ninja.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | #ifndef NINJA_H 28 | #define NINJA_H 29 | 30 | #define NINJA_NORMAL_SPEED 60 31 | #define NINJA_RUN_AWAY_SPEED 130 32 | #define NINJA_FIND_PLAYER_SPEED 100 33 | #define NINJA_CRAWL_SPEED 50 34 | #define NINJA_SWIM_SPEED 50 35 | 36 | void InitPlayerSprite(PLAYERp pp); 37 | void InitAllPlayerSprites(void ); 38 | void PlayerPanelSetup(void ); 39 | void PlayerDeathReset(PLAYERp pp); 40 | void SpawnPlayerUnderSprite(PLAYERp pp); 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/quake.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | void DoQuakeMatch(short match); 28 | void ProcessQuakeOn(void); 29 | void ProcessQuakeSpot(void); 30 | void QuakeViewChange(PLAYERp pp, int *z_diff, int *x_diff, int *y_diff, short *ang_diff); 31 | void DoQuake(PLAYERp pp); 32 | BOOL SetQuake(PLAYERp pp, short tics, short amt); 33 | int SetExpQuake(SHORT Weapon); 34 | int SetGunQuake(SHORT SpriteNum); 35 | int SetPlayerQuake(PLAYERp mpp); 36 | int SetNuclearQuake(SHORT Weapon); 37 | int SetSumoQuake(SHORT SpriteNum); 38 | int SetSumoFartQuake(SHORT SpriteNum); 39 | 40 | -------------------------------------------------------------------------------- /src/mclip.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | #define RECT_CLIP 1 28 | 29 | int MultiClipMove(PLAYERp pp, int z, int floor_dist); 30 | short MultiClipTurn(PLAYERp pp, short new_ang, int z, int floor_dist); 31 | int testquadinsect(int *point_num, int *qx, int *qy, short sectnum); 32 | int RectClipMove(PLAYERp pp, int *qx, int *qy); 33 | int testpointinquad(int x, int y, int *qx, int *qy); 34 | //short RectClipTurn(PLAYERp pp, short new_ang, int z, int floor_dist, int *qx, int *qy); 35 | short RectClipTurn(PLAYERp pp, short new_ang, int *qx, int *qy, int *ox, int *oy); 36 | -------------------------------------------------------------------------------- /src/gameres.h: -------------------------------------------------------------------------------- 1 | // resource ids 2 | #define IDD_STARTWIN 1000 3 | #define IDC_STARTWIN_TABCTL 1001 4 | #define IDC_STARTWIN_BITMAP 1002 5 | #define IDC_ALWAYSSHOW 1003 6 | #define IDC_STARTWIN_APPTITLE 1004 7 | #define IDC_STARTWIN_APPLINK 1005 8 | #define IDC_STARTWIN_APPVERSION 1006 9 | 10 | #define IDD_PAGE_CONFIG 1100 11 | #define IDC_FULLSCREEN 1101 12 | #define IDC_VMODE3D 1102 13 | #define IDC_SINGLEPLAYER 1103 14 | #define IDC_JOINMULTIPLAYER 1104 15 | #define IDC_HOSTMULTIPLAYER 1105 16 | #define IDC_HOSTFIELD 1106 17 | #define IDC_NUMPLAYERS 1107 18 | #define IDC_NUMPLAYERSUD 1108 19 | #define IDC_SOUNDQUALITY 1109 20 | #define IDC_USEMOUSE 1110 21 | #define IDC_USEJOYSTICK 1111 22 | 23 | #define IDD_PAGE_MESSAGES 1200 24 | #define IDC_MESSAGES 1201 25 | 26 | #define IDD_PAGE_GAME 1300 27 | #define IDC_GAMELIST 1301 28 | #define IDC_CHOOSEIMPORT 1302 29 | #define IDC_IMPORTINFO 1303 30 | 31 | #define IDD_IMPORTINFO 1400 32 | #define IDC_IMPORTINFO_HEADER 1401 33 | #define IDC_IMPORTINFO_TEXT 1402 34 | 35 | #define IDD_IMPORTSTATUS 1500 36 | #define IDC_IMPORTSTATUS_TEXT 1501 37 | 38 | #define IDI_ICON 100 39 | #define IDB_BMP 200 40 | 41 | #ifndef IDC_STATIC 42 | #define IDC_STATIC (-1) 43 | #endif 44 | 45 | #ifdef RC_INVOKED 46 | #ifndef __DATE__ 47 | #define __DATE__ "0000-00-00" 48 | #endif 49 | #ifndef __TIME__ 50 | #define __TIME__ "00:00:00" 51 | #endif 52 | #endif 53 | -------------------------------------------------------------------------------- /src/reserve.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | #ifndef RESERVE_H 28 | #define RESERVE_H 29 | 30 | // This header is used for reserving tile space for programatic purposes 31 | // MAXTILES is currently at 6144 in size - anything under this is ok 32 | 33 | #define MAXMIRRORS 8 34 | // This is just some, high, blank tile number not used 35 | // by real graphics to put the MAXMIRRORS mirrors in 36 | #define MIRRORLABEL 6000 37 | 38 | #define TILT_TILE 6016 39 | 40 | // save screen and tilt tile stuff 41 | #define SAVE_SCREEN_TILE 6017 42 | #define SAVE_SCREEN_XSIZE 160L 43 | #define SAVE_SCREEN_YSIZE 100L 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /src/parse.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | // scriplib.h 28 | 29 | #define MAXTOKEN 255 30 | 31 | extern char token[MAXTOKEN]; 32 | extern char *scriptbuffer,*script_p,*scriptend_p; 33 | extern int grabbed; 34 | extern int scriptline; 35 | extern BOOL endofscript; 36 | 37 | 38 | BOOL LoadScriptFile (char *filename); 39 | void GetToken (BOOL crossline); 40 | void UnGetToken (void); 41 | BOOL TokenAvailable (void); 42 | 43 | void DefaultExtension (char *path, char *extension); 44 | void DefaultPath (char *path, char *basepath); 45 | void StripFilename (char *path); 46 | void ExtractFileBase (char *path, char *dest); 47 | 48 | int ParseNum (char *str); 49 | 50 | -------------------------------------------------------------------------------- /src/interp.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | #define SHORT_MAXINTERPOLATIONS 256 28 | extern short short_numinterpolations, short_startofdynamicinterpolations; 29 | extern short short_oldipos[SHORT_MAXINTERPOLATIONS]; 30 | extern short short_bakipos[SHORT_MAXINTERPOLATIONS]; 31 | extern short *short_curipos[SHORT_MAXINTERPOLATIONS]; 32 | 33 | #define MAXINTERPOLATIONS 1024 34 | extern int numinterpolations, startofdynamicinterpolations; 35 | extern int oldipos[MAXINTERPOLATIONS]; 36 | extern int bakipos[MAXINTERPOLATIONS]; 37 | extern int *curipos[MAXINTERPOLATIONS]; 38 | 39 | void setinterpolation(int *posptr); 40 | void stopinterpolation(int *posptr); 41 | void updateinterpolations(void); 42 | void dointerpolations(int smoothratio); 43 | void restoreinterpolations(void); 44 | -------------------------------------------------------------------------------- /src/saveable.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 2005 Jonathon Fowler 4 | 5 | This file is part of JFShadowWarrior 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | */ 22 | //------------------------------------------------------------------------- 23 | 24 | #ifndef SAVEABLE_H 25 | #define SAVEABLE_H 26 | 27 | typedef void (* saveable_code)(void); 28 | 29 | typedef struct { 30 | void *base; 31 | unsigned int size; 32 | } saveable_data; 33 | 34 | typedef struct { 35 | saveable_code *code; 36 | unsigned int numcode; 37 | 38 | saveable_data *data; 39 | unsigned int numdata; 40 | } saveable_module; 41 | 42 | #define SAVE_CODE(s) (saveable_code)s 43 | #define SAVE_DATA(s) { (void*)&s, sizeof(s) } 44 | 45 | #define NUM_SAVEABLE_ITEMS(x) (sizeof(x)/sizeof(x[0])) 46 | 47 | typedef struct { 48 | unsigned int module; 49 | unsigned int index; 50 | } savedcodesym; 51 | 52 | typedef struct { 53 | unsigned int module; 54 | unsigned int index; 55 | unsigned int offset; 56 | } saveddatasym; 57 | 58 | void Saveable_Init(void); 59 | 60 | int Saveable_FindCodeSym(saveable_code ptr, savedcodesym *sym); 61 | int Saveable_FindDataSym(void *ptr, saveddatasym *sym); 62 | 63 | int Saveable_RestoreCodeSym(savedcodesym *sym, void (**ptr)(void)); 64 | int Saveable_RestoreDataSym(saveddatasym *sym, void **ptr); 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /src/inv.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | enum InventoryNames 28 | { 29 | INVENTORY_MEDKIT, 30 | INVENTORY_REPAIR_KIT, 31 | INVENTORY_CLOAK, // de-cloak when firing 32 | INVENTORY_NIGHT_VISION, 33 | INVENTORY_CHEMBOMB, 34 | INVENTORY_FLASHBOMB, 35 | INVENTORY_CALTROPS, 36 | MAX_INVENTORY 37 | }; 38 | 39 | typedef struct 40 | { 41 | char *Name; 42 | VOID (*Init)(PLAYERp); 43 | VOID (*Stop)(PLAYERp, short); 44 | PANEL_STATEp State; 45 | short DecPerSec; 46 | short MaxInv; 47 | int Scale; 48 | short Flags; 49 | } INVENTORY_DATA, *INVENTORY_DATAp; 50 | 51 | extern INVENTORY_DATA InventoryData[MAX_INVENTORY+1]; 52 | 53 | #define INVF_AUTO_USE (BIT(0)) 54 | #define INVF_TIMED (BIT(1)) 55 | #define INVF_COUNT (BIT(2)) 56 | 57 | void PlayerUpdateInventory(PLAYERp pp,short InventoryNum); 58 | void UpdateMiniBar(PLAYERp pp); 59 | void InventoryKeys(PLAYERp pp); 60 | void UseInventoryRepairKit(PLAYERp pp); 61 | void InventoryTimer(PLAYERp pp); 62 | -------------------------------------------------------------------------------- /src/break.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | #ifndef _BREAK_PUBLIC_ 28 | #define _BREAK_PUBLIC_ 29 | 30 | #define BF_TOUGH (BIT(0)) 31 | #define BF_KILL (BIT(1)) 32 | #define BF_BURN (BIT(2)) 33 | #define BF_OVERRIDE_BLOCK (BIT(3)) 34 | #define BF_FIRE_FALL (BIT(4)) 35 | #define BF_LEAVE_BREAK (BIT(5)) 36 | 37 | typedef struct 38 | { 39 | short picnum, breaknum, shrap_type; 40 | short flags, shrap_amt; 41 | }BREAK_INFO, *BREAK_INFOp; 42 | 43 | BREAK_INFOp FindWallBreakInfo(short picnum); 44 | BREAK_INFOp FindSpriteBreakInfo(short picnum); 45 | void SortBreakInfo(void); 46 | BREAK_INFOp SetupWallForBreak(WALLp wallp); 47 | BREAK_INFOp SetupSpriteForBreak(SPRITEp sp); 48 | short FindBreakSpriteMatch(short match); 49 | BOOL HitBreakWall(WALLp wp, int, int, int, short ang, short type); 50 | int HitBreakSprite(short BreakSprite, short type); 51 | BOOL CheckBreakToughness(BREAK_INFOp break_info, short ID); 52 | int WallBreakPosition(short hitwall, short *sectnum, int *x, int *y, int *z, short *ang); 53 | void SortBreakInfo(void ); 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/grpscan.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 2007 Jonathon Fowler 4 | 5 | This file is part of JFShadowWarrior 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | */ 22 | //------------------------------------------------------------------------- 23 | 24 | #ifndef __grpscan_h__ 25 | #define __grpscan_h__ 26 | 27 | // List of internally-known GRP files 28 | struct grpfile { 29 | const char *name; 30 | unsigned int crcval; 31 | int size; 32 | int game; 33 | const char *importname; // The filename to store as when importing. 34 | const struct grpfile *ref; // For foundgrps items, is the grpfiles[] entry matched. 35 | struct grpfile *next; 36 | }; 37 | extern struct grpfile grpfiles[]; 38 | 39 | struct importgroupsmeta { 40 | void *data; 41 | void (*progress)(void *data, const char *path); 42 | int (*cancelled)(void *data); 43 | }; 44 | 45 | enum { 46 | IMPORTGROUP_COPIED = 2, // A file was imported. 47 | IMPORTGROUP_SKIPPED = 1, // Identified, but passed over. 48 | IMPORTGROUP_OK = 0, // Nothing good nor bad. 49 | IMPORTGROUP_ERROR = -1, 50 | }; 51 | 52 | int ScanGroups(void); 53 | struct grpfile const * IdentifyGroup(const char *grpfilename); 54 | struct grpfile const * GroupsFound(void); 55 | void FreeGroups(void); 56 | int ImportGroupsFromPath(const char *path, struct importgroupsmeta *cbs); 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /src/text.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | #define TEXT_INFO_TIME (3) 28 | #define TEXT_INFO_X (16) 29 | //#define TEXT_INFO_Y (20) 30 | #define TEXT_INFO_Y (40) 31 | #define TEXT_INFO_YOFF (10) 32 | #define TEXT_INFO_LINE(line) (TEXT_INFO_Y + ((line) * TEXT_INFO_YOFF)) 33 | //#define TEXT_INFO_LINE(line) (TEXT_INFO_Y + ((line) * TEXT_INFO_YOFF) + GlobalInfoLineOffset) 34 | 35 | VOID DisplayFragNames(PLAYERp pp); 36 | VOID DisplayMiniBarSmString(PLAYERp pp,short xs,short ys, short pal, const char *buffer); 37 | VOID DisplaySmString(PLAYERp pp, short xs, short ys, short pal, const char *buffer); 38 | VOID DisplayMiniBarNumber(PLAYERp pp,short xs,short ys,int number); 39 | void DisplaySummaryString(PLAYERp pp,short xs,short ys,short color,short shade,const char *buffer); 40 | void DisplayPanelNumber(PLAYERp pp,short xs,short ys,int number); 41 | VOID PutStringInfo(PLAYERp pp, const char *string); 42 | VOID PutStringInfoLine(PLAYERp pp, const char *string); 43 | VOID PutStringInfoLine2(PLAYERp pp, const char *string); 44 | void pClearTextLine(PLAYERp pp,long y); 45 | void pMenuClearTextLine(PLAYERp pp); 46 | -------------------------------------------------------------------------------- /tools/package-win.ps1: -------------------------------------------------------------------------------- 1 | $ErrorActionPreference = "Stop" 2 | 3 | $PRODUCT = "jfsw" 4 | $VERSION = Get-Date -UFormat "%Y%m%d" 5 | 6 | $VCVARSALL = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" 7 | 8 | if ($Args.Length -lt 2) { 9 | Write-Output "package-win.ps1 (amd64|x86) (build|finish)*" 10 | exit 11 | } 12 | 13 | if ($Args[0] -eq "amd64") { 14 | $ARCH = "amd64" 15 | $DIRARCH = "win" 16 | } elseif ($Args[0] -eq "x86") { 17 | $ARCH = "x86" 18 | $DIRARCH = "win32" 19 | } else { 20 | Write-Warning ("Unknown arch type {0}" -f $Args[0]) 21 | exit 22 | } 23 | 24 | for ($arg = 1; $arg -lt $Args.Length; $arg++) { 25 | if ($Args[$arg] -eq "build") { 26 | Remove-Item "Makefile.msvcuser" -ErrorAction SilentlyContinue 27 | Remove-Item "jfbuild\Makefile.msvcuser" -ErrorAction SilentlyContinue 28 | & cmd.exe /c "$VCVARSALL" $ARCH 8.1 "&&" nmake /f Makefile.msvc clean all 29 | 30 | } elseif ($Args[$arg] -eq "finish") { 31 | Remove-Item "$PRODUCT-$VERSION-$DIRARCH" -Recurse -ErrorAction SilentlyContinue 32 | Remove-Item "$PRODUCT-$VERSION-$DIRARCH.zip" -ErrorAction SilentlyContinue 33 | 34 | $workDir = New-Item "$PRODUCT-$VERSION-$DIRARCH" -ItemType Directory 35 | Copy-Item "sw.exe" $workDir 36 | Copy-Item "build.exe" $workDir 37 | Copy-Item "jfbuild\buildlic.txt" $workDir 38 | Copy-Item "GPL.TXT" $workDir 39 | Set-Content "$workDir\readme.html" (Get-Content "releasenotes.html" ` 40 | -Encoding UTF8 -Raw).Replace('$VERSION', $VERSION) 41 | 42 | $vcredist = (New-Object -ComObject "WScript.Shell").CreateShortcut("$workDir\Microsoft Visual C++ Redistributable.url") 43 | if ($ARCH -eq "amd64") { 44 | $vcredist.TargetPath = "https://aka.ms/vs/16/release/vc_redist.x64.exe" 45 | } else { 46 | $vcredist.TargetPath = "https://aka.ms/vs/16/release/vc_redist.x86.exe" 47 | } 48 | $vcredist.Save() 49 | 50 | Compress-Archive "$PRODUCT-$VERSION-$DIRARCH" "$PRODUCT-$VERSION-$DIRARCH.zip" -CompressionLevel Optimal 51 | } else { 52 | Write-Warning ("Unknown action {0}" -f $Args[$arg]) 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/osdfuncs.c: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Shadow Warrior is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU General Public License 5 | as published by the Free Software Foundation; either version 2 6 | of the License, or (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | 12 | See the GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | */ 18 | //------------------------------------------------------------------------- 19 | 20 | #include "build.h" 21 | #include "mytypes.h" 22 | #include "keyboard.h" 23 | #include "osdfuncs.h" 24 | 25 | void osdfunc_onshowosd(int shown) 26 | { 27 | extern BOOL GamePaused; 28 | if (!shown ^ !GamePaused) 29 | KB_KeyDown[sc_Pause] = 1; 30 | } 31 | 32 | #define BGTILE 4930 33 | #define BGSHADE 12 34 | #define BORDTILE 83 // BORDER_TILE 35 | #define BORDSHADE 0 36 | #define BITSTH 1+32+8+16 // high translucency 37 | #define BITSTL 1+8+16 // low translucency 38 | #define BITS 8+16+64 // solid 39 | #define PALETTE 0 40 | void osdfunc_clearbackground(int c, int r) 41 | { 42 | int x, y, xsiz, ysiz, tx2, ty2; 43 | int daydim, bits; 44 | (void)c; 45 | 46 | if (!POLYMOST_RENDERMODE_POLYGL()) bits = BITS; else bits = BITSTL; 47 | 48 | daydim = r*14+4; 49 | 50 | xsiz = tilesizx[BGTILE]; tx2 = xdim/xsiz; 51 | ysiz = tilesizy[BGTILE]; ty2 = daydim/ysiz; 52 | 53 | for(x=0;x<=tx2;x++) 54 | for(y=0;y<=ty2;y++) 55 | rotatesprite(x*xsiz<<16,y*ysiz<<16,65536L,0,BGTILE,BGSHADE,PALETTE,bits,0,0,xdim,daydim); 56 | 57 | xsiz = tilesizy[BORDTILE]; tx2 = xdim/xsiz; 58 | ysiz = tilesizx[BORDTILE]; 59 | 60 | for(x=0;x<=tx2;x++) 61 | rotatesprite(x*xsiz<<16,(daydim+ysiz+1)<<16,65536L,1536,BORDTILE,BORDSHADE,PALETTE,BITS,0,0,xdim,daydim+ysiz+1); 62 | } 63 | -------------------------------------------------------------------------------- /src/sw_strs.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | #define S_INAGAME "YOU ARE IN A GAME!" 28 | #define S_PRESSKEY "PRESS ANY KEY WHEN READY" 29 | #define S_MESSAGEON "GAME MESSAGES ARE NOW ON" 30 | #define S_MESSAGEOFF "GAME MESSAGES ARE NOW OFF" 31 | 32 | #define S_QUITYN "PRESS (Y) TO QUIT, (N) TO FIGHT ON." 33 | #define S_QUIT1 "CONFUCIOUS SAY, 'HE WHO QUITS," 34 | #define S_QUIT1A "TOTALLY SUCKS!'" 35 | #define S_QUIT2 "GO AHEAD, LEAVE, BUT WHILE YOU'RE" 36 | #define S_QUIT2A "GONE, EVIL WILL BE TAKING OVER!" 37 | #define S_QUIT3 "ALL OF JAPAN IS COUNTING ON YOU!" 38 | #define S_QUIT3A "ONLY A LOSER COULD LET THEM DOWN." 39 | #define S_QUIT4 "THIS IS TOO MUCH! NOW WHERE" 40 | #define S_QUIT4A "DID I PUT THOSE CHEAT CODES?" 41 | #define S_QUIT5 "PRESS (Y) TO RUN HOME TO MOMMY," 42 | #define S_QUIT5A "(N) TO BE A MAN." 43 | #define S_QUIT6 "YOU DO KNOW, THAT WHILE YOU'RE" 44 | #define S_QUIT6A "AWAY, WE'LL BE RESTOCKING MT. FUJI" 45 | #define S_QUIT6B "WITH A MILLION NEW MONSTERS?" 46 | #define S_QUIT7 "COME BACK ANY TIME, WE ARE ALWAYS" 47 | #define S_QUIT7A "LOOKING FOR A SACK OF RIPPER CHOW!" 48 | #define S_QUIT8 "LET'S MAKE A STEALTHY EXIT TO DOS!" 49 | 50 | -------------------------------------------------------------------------------- /src/light.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | 28 | void SectorLightShade(SPRITEp sp, short intensity); 29 | VOID DiffuseLighting(SPRITEp sp); 30 | VOID DoLightingMatch(short match, short state); 31 | VOID InitLighting(VOID); 32 | VOID DoLighting(VOID); 33 | 34 | // Descriptive Light variables mapped from other variables 35 | 36 | #define LIGHT_Match(sp) (SP_TAG2((sp))) 37 | #define LIGHT_Type(sp) (SP_TAG3((sp))) 38 | #define LIGHT_MaxTics(sp) (SP_TAG4((sp))) 39 | #define LIGHT_MaxBright(sp) (SP_TAG5((sp))) 40 | #define LIGHT_MaxDark(sp) (SP_TAG6((sp))) 41 | #define LIGHT_ShadeInc(sp) (SP_TAG7((sp))) 42 | 43 | #define LIGHT_Dir(sp) (!!(TEST((sp)->extra, SPRX_BOOL10))) 44 | #define LIGHT_DirChange(sp) (FLIP((sp)->extra, SPRX_BOOL10)) 45 | 46 | #define LIGHT_Shade(sp) ((sp)->shade) 47 | #define LIGHT_FloorShade(sp) ((sp)->xoffset) 48 | #define LIGHT_CeilingShade(sp) ((sp)->yoffset) 49 | #define LIGHT_Tics(sp) ((sp)->z) 50 | 51 | #define LIGHT_DiffuseNum(sp) (SP_TAG3((sp))) 52 | #define LIGHT_DiffuseMult(sp) (SP_TAG4((sp))) 53 | 54 | enum LightTypes {LIGHT_CONSTANT, LIGHT_FLICKER, LIGHT_FADE, LIGHT_FLICKER_ON, LIGHT_FADE_TO_ON_OFF}; 55 | -------------------------------------------------------------------------------- /src/parent.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | #ifndef _PARENT_PUBLIC_ 28 | #define _PARENT_PUBLIC_ 29 | 30 | #define INVISTILE 6145 31 | 32 | typedef struct TILE_INFO_TYPE { 33 | short Voxel; // Voxel Number to replace sprites with 34 | short Parental; // Tile offset to replace adult tiles with when locked out 35 | // 0 = Invisible 36 | } ParentalStruct; 37 | 38 | struct ORG_TILE; 39 | typedef struct ORG_TILE OrgTile, *OrgTileP; 40 | struct ORG_TILE_LIST; 41 | typedef struct ORG_TILE_LIST OrgTileList, *OrgTileListP; 42 | 43 | void JS_InitLockouts (void); 44 | void JS_UnitInitLockouts (void); 45 | void JS_ToggleLockouts(void); 46 | 47 | struct ORG_TILE 48 | { 49 | OrgTileP Next, Prev; 50 | short index; 51 | short orgpicnum; 52 | }; 53 | 54 | struct ORG_TILE_LIST 55 | { 56 | OrgTileP Next, Prev; 57 | }; 58 | 59 | extern OrgTileList orgwalllist; // The list containing orginal wall 60 | // pics 61 | extern OrgTileList orgwalloverlist; // The list containing orginal wall 62 | // over pics 63 | extern OrgTileList orgsectorceilinglist; // The list containing orginal sector 64 | // ceiling pics 65 | extern OrgTileList orgsectorfloorlist; // The list containing orginal sector 66 | // floor pics 67 | #endif 68 | -------------------------------------------------------------------------------- /tools/package-macos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | APPLEID=appledev@jonof.id.au 4 | KEYCHAINPROFILE=default 5 | PRODUCT=jfsw 6 | BUNDLEID=au.id.jonof.$PRODUCT 7 | VERSION=$(date +%Y%m%d) 8 | 9 | if [ "$1" = "build" ]; then 10 | set -xe 11 | 12 | # Clean everything including JFAudioLib's ogg/vorbis builds. 13 | (cd xcode && xcrun xcodebuild -target all clean) 14 | rm -rf jfaudiolib/third-party/osx/out 15 | 16 | # Configure code signing. 17 | cat >xcode/Signing.xcconfig <xcode/Version.xcconfig < $PRODUCT-$VERSION-mac/readme.html 66 | 67 | # Staple notary tickets to the applications. 68 | find $PRODUCT-$VERSION-mac -maxdepth 1 -name '*.app' -print0 | xargs -t -0 -I% xcrun stapler staple -v % 69 | 70 | # Zip it all up. 71 | ditto -c -k --sequesterRsrc --keepParent $PRODUCT-$VERSION-mac $PRODUCT-$VERSION-mac.zip 72 | 73 | else 74 | echo package-macos.sh build 75 | echo package-macos.sh notarise 76 | echo package-macos.sh notarystatus '[uuid]' 77 | echo package-macos.sh finish 78 | fi 79 | -------------------------------------------------------------------------------- /src/mfile.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | #define FILE_ANSI_STD 0 28 | #define FILE_KEN 1 29 | #define FILE_DOS 2 30 | 31 | //#define FILE_TYPE FILE_ANSI_STD 32 | #define FILE_TYPE FILE_KEN 33 | 34 | #if FILE_TYPE == FILE_ANSI_STD 35 | typedef FILE *MFILE; 36 | #define MREAD(ptr, size, num,handle) fread((ptr),(size),(num),(handle)) 37 | #define MWRITE(ptr, size, num,handle) fwrite((ptr),(size),(num),(handle)) 38 | #define MOPEN_WRITE(name) fopen(name,"wb") 39 | #define MOPEN_READ(name) fopen(name,"rb") 40 | #define MCLOSE(handle) fclose(handle) 41 | #define MF_ERR 0 42 | #endif 43 | 44 | #if FILE_TYPE == FILE_KEN 45 | typedef FILE *MFILE; 46 | size_t dfread( void *, size_t, size_t, FILE * ); 47 | size_t dfwrite( void *, size_t, size_t, FILE * ); 48 | #define MREAD(ptr, size, num,handle) dfread((ptr),(size),(num),(handle)) 49 | #define MWRITE(ptr, size, num,handle) dfwrite((ptr),(size),(num),(handle)) 50 | #define MOPEN_WRITE(name) fopen(name,"wb") 51 | #define MOPEN_READ(name) fopen(name,"rb") 52 | #define MCLOSE(handle) fclose(handle) 53 | #define MF_ERR 0 54 | #endif 55 | 56 | #if FILE_TYPE == FILE_DOS 57 | typedef long MFILE; 58 | #define MREAD(ptr, size, num,handle) read((handle),(ptr),(size)*(num)) 59 | #define MWRITE(ptr, size, num,handle) write((handle),(ptr),(size)*(num)) 60 | #define MOPEN_WRITE(name) open(name,O_BINARY|O_TRUNC|O_CREAT|O_WRONLY,S_IREAD|S_IWRITE) 61 | #define MOPEN_READ(name) open(name,O_BINARY|O_RDWR,S_IREAD) 62 | #define MCLOSE(handle) close(handle) 63 | #define MF_ERR -1 64 | #endif 65 | -------------------------------------------------------------------------------- /src/settings.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | #include "mytypes.h" 27 | #include "gamedefs.h" 28 | // Only ad to the end. These currently have to be in this order because of the 29 | // way they are initilized. 30 | 31 | typedef struct 32 | { 33 | int MouseSpeed; 34 | int MusicVolume; 35 | int SoundVolume; 36 | CHAR BorderNum; 37 | CHAR Brightness; 38 | CHAR BorderTile; 39 | BOOL MouseAimingType; 40 | BOOL MouseLook; 41 | BOOL MouseInvert; 42 | BOOL Bobbing; 43 | BOOL Tilting; 44 | BOOL Shadows; 45 | BOOL AutoRun; 46 | BOOL Crosshair; 47 | BOOL AutoAim; 48 | BOOL Messages; 49 | BOOL FxOn; 50 | BOOL MusicOn; 51 | BOOL Talking; 52 | BOOL Ambient; 53 | BOOL FlipStereo; 54 | // Net Options from Menus 55 | BYTE NetGameType; // 0=DeathMatch [spawn], 1=Cooperative 2=DeathMatch [no spawn] 56 | BYTE NetLevel; // 1-28 57 | BYTE NetMonsters; // Cycle skill levels 58 | BOOL NetHurtTeammate; // Allow friendly kills 59 | BOOL NetSpawnMarkers; // Respawn markers on/off 60 | BOOL NetTeamPlay; // Team play 61 | BYTE NetKillLimit; // Number of frags at which game ends 62 | BYTE NetTimeLimit; // Limit time of game 63 | BYTE NetColor; // Chosen color for player 64 | BYTE ParentalLock; // Parental Lock on/off 65 | char Password[20]; // Parental Lock password 66 | BOOL NetNuke; 67 | BOOL Voxels; 68 | BOOL Stats; 69 | BOOL MouseAimingOn; // whether it was on or off - NOT the type of mouse aiming 70 | BOOL PlayCD; 71 | char OggTrackName[MAXOGGTRACKLENGTH]; 72 | int PanelScale; 73 | }GAME_SET, *GAME_SETp; 74 | 75 | extern const GAME_SET gs_defaults; 76 | extern GAME_SET gs; 77 | 78 | -------------------------------------------------------------------------------- /src/GameListSource.m: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 2013 Jonathon Fowler 4 | 5 | This file is part of JFShadowWarrior 6 | 7 | Duke Nukem 3D is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | */ 22 | //------------------------------------------------------------------------- 23 | 24 | #import 25 | 26 | #include "grpscan.h" 27 | #import "GameListSource.h" 28 | 29 | @implementation GameListSource 30 | - (id)tableView:(NSTableView *)aTableView 31 | objectValueForTableColumn:(NSTableColumn *)aTableColumn 32 | row:(NSInteger)rowIndex 33 | { 34 | int row; 35 | struct grpfile const *fg = GroupsFound(); 36 | 37 | for (row = 0; row < rowIndex && fg; fg = fg->next) { 38 | if (fg->ref) row++; 39 | } 40 | if (!fg) { 41 | return nil; 42 | } 43 | switch ([[aTableColumn identifier] intValue]) { 44 | case 0: // name column 45 | if (fg->ref) { 46 | return [NSString stringWithUTF8String: fg->ref->name]; 47 | } else { 48 | return @"Unknown game"; 49 | } 50 | case 1: // grp column 51 | return [NSString stringWithUTF8String: fg->name]; 52 | case 2: // hidden column pointing to the grpfile entry. 53 | return [NSValue valueWithPointer: fg]; 54 | default: 55 | return nil; 56 | } 57 | } 58 | 59 | - (int)numberOfRowsInTableView:(NSTableView *)aTableView 60 | { 61 | int count = 0; 62 | struct grpfile const *fg = GroupsFound(); 63 | 64 | for (count = 0; fg; fg = fg->next) { 65 | if (fg->ref) count++; 66 | } 67 | return count; 68 | } 69 | 70 | - (int)indexForGrp:(struct grpfile const *)grpFile 71 | { 72 | int index; 73 | struct grpfile const *fg = GroupsFound(); 74 | 75 | for (index = 0; fg; fg = fg->next) { 76 | if (fg == grpFile) return index; 77 | if (fg->ref) index++; 78 | } 79 | return -1; 80 | } 81 | @end 82 | 83 | -------------------------------------------------------------------------------- /src/demo.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | extern FILE *DemoFile; 28 | extern BOOL DemoPlaying; 29 | extern BOOL DemoRecording; 30 | extern BOOL DemoEdit; 31 | extern BOOL DemoMode; 32 | extern BOOL DemoOverride; 33 | extern char DemoFileName[16]; 34 | extern char DemoLevelName[16]; 35 | 36 | extern FILE *DemoSyncFile; 37 | extern BOOL DemoSyncTest; 38 | extern BOOL DemoSyncRecord; 39 | extern char DemoTmpName[16]; 40 | 41 | extern BOOL DemoDebugMode; 42 | extern BOOL DemoInitOnce; 43 | extern short DemoDebugBufferMax; 44 | 45 | #define DEMO_BUFFER_MAX 2048 46 | extern SW_PACKET DemoBuffer[DEMO_BUFFER_MAX]; 47 | extern int DemoRecCnt; // Can only record 1-player game 48 | 49 | #define DEMO_FILE_GROUP 0 50 | #define DEMO_FILE_STD 1 51 | #define DEMO_FILE_TYPE DEMO_FILE_GROUP 52 | 53 | // Demo File - reading from group 54 | #if DEMO_FILE_TYPE == DEMO_FILE_GROUP 55 | typedef int DFILE; 56 | #define DREAD(ptr, size, num, handle) kread((handle),(ptr),(size)*(num)) 57 | #define DOPEN_READ(name) kopen4load(name,0) 58 | #define DCLOSE(handle) kclose(handle) 59 | #define DF_ERR -1 60 | #else 61 | typedef FILE *DFILE; 62 | #define DREAD(ptr, size, num,handle) fread((ptr),(size),(num),(handle)) 63 | #define DWRITE(ptr, size, num,handle) fwrite((ptr),(size),(num),(handle)) 64 | #define DOPEN_WRITE(name) fopen(name,"wb") 65 | #define DOPEN_READ(name) fopen(name,"rb") 66 | #define DCLOSE(handle) fclose(handle) 67 | #define DF_ERR NULL 68 | #endif 69 | 70 | void DemoTerm(void ); 71 | void DemoPlaySetup(void ); 72 | void DemoPlayBack(void ); 73 | void ScenePlayBack(void ); 74 | void DemoRecordSetup(void ); 75 | void DemoDebugWrite(void ); 76 | void DemoWriteBuffer(void ); 77 | -------------------------------------------------------------------------------- /src/_rts.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 23 | */ 24 | //------------------------------------------------------------------------- 25 | 26 | //------------------------------------------------------------------------- 27 | /* 28 | Copyright (C) 1996, 2003 - 3D Realms Entertainment 29 | 30 | This file is part of Duke Nukem 3D version 1.5 - Atomic Edition 31 | 32 | Duke Nukem 3D is free software; you can redistribute it and/or 33 | modify it under the terms of the GNU General Public License 34 | as published by the Free Software Foundation; either version 2 35 | of the License, or (at your option) any later version. 36 | 37 | This program is distributed in the hope that it will be useful, 38 | but WITHOUT ANY WARRANTY; without even the implied warranty of 39 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 40 | 41 | See the GNU General Public License for more details. 42 | 43 | You should have received a copy of the GNU General Public License 44 | along with this program; if not, write to the Free Software 45 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 46 | 47 | Original Source: 1996 - Todd Replogle 48 | Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms 49 | */ 50 | //------------------------------------------------------------------------- 51 | 52 | #ifndef __rts_private__ 53 | #define __rts_private__ 54 | 55 | //=============== 56 | // TYPES 57 | //=============== 58 | 59 | typedef struct 60 | { 61 | char name[8]; 62 | int32 handle,position,size; 63 | } lumpinfo_t; 64 | 65 | typedef struct 66 | { 67 | char identification[4]; // should be IWAD 68 | int32 numlumps; 69 | int32 infotableofs; 70 | } wadinfo_t; 71 | 72 | typedef struct 73 | { 74 | int32 filepos; 75 | int32 size; 76 | char name[8]; 77 | } filelump_t; 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: [ push, pull_request, workflow_dispatch ] 3 | 4 | jobs: 5 | build-linux: 6 | name: Linux polymost=${{ matrix.use_polymost }} gl=${{ matrix.use_opengl }} nogtk=${{ matrix.without_gtk || 1 }} 7 | runs-on: ubuntu-latest 8 | strategy: 9 | fail-fast: false 10 | matrix: 11 | use_polymost: [ 0, 1 ] 12 | use_opengl: [ 0, 1 ] 13 | exclude: 14 | - use_polymost: 1 15 | use_opengl: 0 16 | include: 17 | - use_polymost: 1 18 | use_opengl: 3 19 | - use_polymost: 1 20 | use_opengl: 'USE_GLES2' 21 | without_gtk: '0' 22 | 23 | steps: 24 | - name: Checkout code 25 | uses: actions/checkout@v4 26 | with: 27 | submodules: true 28 | - name: Install dependencies 29 | run: | 30 | sudo apt-get update 31 | sudo apt-get install -y libsdl2-dev libgtk-3-dev libfluidsynth-dev 32 | - name: Make 33 | run: | 34 | cd "$GITHUB_WORKSPACE" 35 | make USE_POLYMOST=${{ matrix.use_polymost }} \ 36 | USE_OPENGL=${{ matrix.use_opengl }} \ 37 | WITHOUT_GTK=${{ matrix.without_gtk || 1 }} \ 38 | USE_ASM=0 \ 39 | all 40 | 41 | build-windows: 42 | name: Windows polymost=${{ matrix.use_polymost }} gl=${{ matrix.use_opengl }} 43 | runs-on: windows-latest 44 | strategy: 45 | fail-fast: false 46 | matrix: 47 | use_polymost: [ 0, 1 ] 48 | use_opengl: [ 0, 1 ] 49 | exclude: 50 | - use_polymost: 1 51 | use_opengl: 0 52 | include: 53 | - use_polymost: 1 54 | use_opengl: 3 55 | 56 | steps: 57 | - name: Checkout code 58 | uses: actions/checkout@v4 59 | with: 60 | submodules: true 61 | - name: Setup MSVC 62 | uses: ilammy/msvc-dev-cmd@v1 63 | with: 64 | sdk: 10.0.26100.0 65 | - name: Add XAudio2 redistributable 66 | run: vcpkg install xaudio2redist:x64-windows 67 | - name: Make 68 | shell: cmd 69 | run: | 70 | echo USE_POLYMOST=${{ matrix.use_polymost }} > Makefile.msvcuser 71 | echo USE_OPENGL=${{ matrix.use_opengl }} >> Makefile.msvcuser 72 | echo VCPKG_ROOT=%VCPKG_INSTALLATION_ROOT% > jfaudiolib/Makefile.msvcuser 73 | nmake /f Makefile.msvc all 74 | 75 | build-macos: 76 | name: macOS 77 | runs-on: macos-latest 78 | 79 | steps: 80 | - name: Checkout code 81 | uses: actions/checkout@v4 82 | with: 83 | submodules: true 84 | - name: Build 85 | run: | 86 | set -xe 87 | cd $GITHUB_WORKSPACE/xcode 88 | xcodebuild -project sw.xcodeproj -target all 89 | -------------------------------------------------------------------------------- /src/lists.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | #ifndef LISTS_H 28 | 29 | #define LISTS_H 30 | 31 | /********************************************************************/ 32 | 33 | typedef 34 | struct List { 35 | struct List *Next; 36 | struct List *Prev; 37 | } LISTHEAD, *LIST; 38 | 39 | #define FIRST(list) (list->Next) 40 | #define LAST(list) (list->Prev) 41 | 42 | 43 | #define INITLIST(list) ( ((LIST) list)->Prev = ((LIST) list)->Next = (LIST) list) 44 | 45 | 46 | #define INSERT(list, nodep) ( ((LIST) nodep)->Prev = (LIST) list, \ 47 | ((LIST) nodep)->Next = ((LIST) list)->Next, \ 48 | ((LIST) list)->Next = (LIST) nodep, \ 49 | ((LIST) nodep)->Next->Prev = (LIST) nodep) 50 | 51 | #define INSERT_TAIL(list, nodep) ( ((LIST) nodep)->Next = (LIST) list, \ 52 | ((LIST) nodep)->Prev = ((LIST) list)->Prev, \ 53 | ((LIST) list)->Prev = (LIST) nodep, \ 54 | ((LIST) nodep)->Prev->Next = (LIST) nodep) 55 | 56 | #define DELETE(nodep) ( ((LIST) nodep)->Prev->Next = ((LIST) nodep)->Next, \ 57 | ((LIST) nodep)->Next->Prev = ((LIST) nodep)->Prev) 58 | 59 | 60 | #define TRAVERSE(l, o, n) ASSERT(((LIST)l)->Next && ((LIST)l)->Prev); for (o = (void*)(((LIST)l)->Next); \ 61 | n = o->Next, (LIST) o != (LIST) l; \ 62 | o = n) 63 | 64 | #define EMPTY(list) (((LIST) list)->Next == (LIST) list) 65 | 66 | #endif 67 | 68 | 69 | -------------------------------------------------------------------------------- /src/names.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | //Be careful when changing this file - it is parsed by Editart and Build. 28 | #define ALPHABET 85 29 | #define MENU_MAIN 295 30 | #define MENU_OPTION 296 31 | #define MENU_WHICH 297 32 | #define MENU_CURSOR 298 33 | #define DART1 2000 34 | #define DART2 2001 35 | #define DART3 2002 36 | #define DART4 2003 37 | #define DART 2004 38 | #define FIRE1 2005 39 | #define FIRE2 2006 40 | #define FIRE3 2007 41 | #define FIRE4 2008 42 | #define FIRE5 2009 43 | #define FIREBALL1 2010 44 | #define FIREBALL2 2011 45 | #define FIREBALL3 2012 46 | #define FIREBALL4 2013 47 | #define FLAMES1 2014 48 | #define FLAMES2 2015 49 | #define FLAMES3 2016 50 | #define FLAMES4 2017 51 | #define FLAMES5 2018 52 | #define GAS1 2019 53 | #define GAS2 2020 54 | #define GAS3 2021 55 | #define GAS4 2022 56 | #define GAS5 2023 57 | #define GAS6 2024 58 | #define GAS7 2025 59 | #define GASCLOUD1 2026 60 | #define GASCLOUD2 2027 61 | #define GASCLOUD3 2028 62 | #define GASCLOUD4 2029 63 | #define GASCLOUD5 2030 64 | #define GASCLOUD6 2031 65 | #define GASCLOUD7 2032 66 | #define GASCLOUD8 2033 67 | #define GASCLOUD9 2034 68 | #define LIGHT1 2035 69 | #define LIGHT2 2036 70 | #define LIGHT3 2037 71 | #define LIGHT4 2038 72 | #define LIGHT5 2039 73 | #define LIGHT6 2040 74 | #define ELECTRO1 2041 75 | #define ELECTRO2 2042 76 | #define ELECTRO3 2043 77 | #define RIFLE1 2044 78 | #define RIFLE2 2045 79 | #define RIFLE3 2046 80 | #define DONTUSE_EXTRA 2047 81 | #define RIFLE4 2048 82 | #define CARTRIGE3 2053 83 | #define STATUE1 2054 84 | #define STATUE2 2055 85 | #define STATUE3 2056 86 | #define STATUE4 2057 87 | #define SWORD3 2065 88 | #define SWORD4 2066 89 | #define SWORD1 2067 90 | #define SWORD2 2068 91 | #define SWORD5 2069 92 | #define BLACK___ 2306 93 | #define FragBarErase 2375 94 | #define FragBarErase2 2376 95 | -------------------------------------------------------------------------------- /src/sector.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | #ifndef SECTOR_H 27 | 28 | #define SECTOR_H 29 | 30 | 31 | VOID SectorSetup(VOID); 32 | DOOR_AUTO_CLOSEp SetDoorAutoClose(short SectorNum, short Type); 33 | VOID DoDragging(VOID); 34 | int MoveDoorVert(short door_sector, short dir, short door_speed); 35 | int MoveDoorUp(short door_sector, short auto_close, short door_speed); 36 | int MoveDoorDown(short door_sector, short dir, short door_speed); 37 | int MoveDoorHoriz(short door_sector, short dir, short door_speed); 38 | VOID DoDoorsClose(VOID); 39 | short Switch(short SwitchSector); 40 | VOID PlayerOperateEnv(PLAYERp pp); 41 | int TeleportToSector(PLAYERp pp, int newsector); 42 | int OperateSector(short sectnum,short player_is_operating); 43 | int OperateSprite(short SpriteNum, short player_is_operating); 44 | int OperateWall(short wallnum, short player_is_operating); 45 | void OperateTripTrigger(PLAYERp pp); 46 | 47 | enum SO_SCALE_TYPE 48 | { 49 | SO_SCALE_NONE, 50 | SO_SCALE_HOLD, 51 | SO_SCALE_DEST, 52 | SO_SCALE_RANDOM, 53 | SO_SCALE_CYCLE, 54 | SO_SCALE_RANDOM_POINT 55 | }; 56 | 57 | #define SCALE_POINT_SPEED (4 + RANDOM_RANGE(8)) 58 | 59 | typedef struct 60 | { 61 | int dist; 62 | short sectnum, wallnum, spritenum; 63 | }NEAR_TAG_INFO, *NEAR_TAG_INFOp; 64 | extern short nti_cnt; 65 | 66 | VOID DoSpawnSpotsForKill(short match); 67 | VOID DoSpawnSpotsForDamage(short match); 68 | VOID DoMatchEverything(PLAYERp pp, short match, short state); 69 | BOOL ComboSwitchTest(short combo_type,short match); 70 | void DoSoundSpotStopSound(short match); 71 | void DoSector(void ); 72 | short AnimateSwitch(SPRITEp sp,short tgt_value); 73 | void ShootableSwitch(short SpriteNum,short Weapon); 74 | BOOL TestKillSectorObject(SECTOR_OBJECTp sop); 75 | void WeaponExplodeSectorInRange(short weapon); 76 | 77 | void initlava(void ); 78 | void movelava(char *dapic); 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /src/function.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | // function.h 28 | 29 | // file created by makehead.exe 30 | // these headers contain default key assignments, as well as 31 | // default button assignments and game function names 32 | // axis defaults are also included 33 | 34 | 35 | #ifndef _function_public_ 36 | #define _function_public_ 37 | 38 | #define NUMGAMEFUNCTIONS 51 39 | 40 | extern char * gamefunctions[]; 41 | 42 | enum 43 | { 44 | gamefunc_Move_Forward, 45 | gamefunc_Move_Backward, 46 | gamefunc_Turn_Left, 47 | gamefunc_Turn_Right, 48 | gamefunc_Strafe, 49 | gamefunc_Fire, 50 | gamefunc_Open, 51 | gamefunc_Run, 52 | gamefunc_AutoRun, 53 | gamefunc_Jump, 54 | gamefunc_Crouch, 55 | gamefunc_Look_Up, 56 | gamefunc_Look_Down, 57 | gamefunc_Strafe_Left, 58 | gamefunc_Strafe_Right, 59 | gamefunc_Aim_Up, 60 | gamefunc_Aim_Down, 61 | gamefunc_Weapon_1, 62 | gamefunc_Weapon_2, 63 | gamefunc_Weapon_3, 64 | gamefunc_Weapon_4, 65 | gamefunc_Weapon_5, 66 | gamefunc_Weapon_6, 67 | gamefunc_Weapon_7, 68 | gamefunc_Weapon_8, 69 | gamefunc_Weapon_9, 70 | gamefunc_Weapon_10, 71 | gamefunc_Inventory, 72 | gamefunc_Inventory_Left, 73 | gamefunc_Inventory_Right, 74 | gamefunc_Med_Kit, 75 | gamefunc_Smoke_Bomb, 76 | gamefunc_Night_Vision, 77 | gamefunc_Gas_Bomb, 78 | gamefunc_Flash_Bomb, 79 | gamefunc_Caltrops, 80 | gamefunc_TurnAround, 81 | gamefunc_SendMessage, 82 | gamefunc_Map, 83 | gamefunc_Shrink_Screen, 84 | gamefunc_Enlarge_Screen, 85 | gamefunc_Center_View, 86 | gamefunc_Holster_Weapon, 87 | gamefunc_Map_Follow_Mode, 88 | gamefunc_See_Co_Op_View, 89 | gamefunc_Mouse_Aiming, 90 | gamefunc_Toggle_Crosshair, 91 | gamefunc_Next_Weapon, 92 | gamefunc_Previous_Weapon, 93 | gamefunc_Show_Menu, 94 | gamefunc_Show_Console, 95 | }; 96 | #endif 97 | -------------------------------------------------------------------------------- /src/sprite.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | #ifndef SPRITE_H 28 | 29 | #define SPRITE_H 30 | 31 | VOID KillSprite(SHORT SpriteNum); 32 | SHORT SpawnSprite(short stat, short id, STATEp state, short sectnum, int x, int y, int z, int ang, int vel); 33 | VOID SpriteSetup(VOID); 34 | int move_actor(short SpriteNum, int xchange, int ychange, int zchange); 35 | short GetSpriteDir(short sn); 36 | short GetDirToPlayer(short sn); 37 | short PlayerInVision(short sn, short view_deg); 38 | short PlayerVisible(short sn); 39 | short SpriteLookSector(short SpriteNum, short range); 40 | short SpriteCanGoForward(short SpriteNum, short range); 41 | void SpriteFindNewDirection(short SpriteNum, short range); 42 | int DoWalk(short SpriteNum); 43 | int DoBody(short SpriteNum); 44 | BOOL CanMoveHere(SHORT spritenum); 45 | BOOL SpriteOverlap(SHORT spritenum_a, SHORT spritenum_b); 46 | int DoActorDie(short SpriteNum, short weapon); 47 | int DoGet(short SpriteNum); 48 | VOID SpriteControl(VOID); 49 | VOID SetEnemyInactive(short SpriteNum); 50 | VOID DoActorZrange(short SpriteNum); 51 | void PreMapCombineFloors(void ); 52 | void SpriteSetupPost(void ); 53 | int ActorCoughItem(short SpriteNum); 54 | BOOL ActorSpawn(SPRITEp sp); 55 | int SpawnItemsMatch(short match); 56 | void PicAnimOff(short picnum); 57 | int MissileWaterAdjust(short SpriteNum); 58 | BOOL SpriteOverlapZ(SHORT spritenum_a,SHORT spritenum_b,int z_overlap); 59 | 60 | enum { 61 | InvDecl_Armor, // ie. +50 armour 62 | InvDecl_Kevlar, // ie. +100 armour 63 | InvDecl_SmMedkit, 64 | InvDecl_Booster, // ie. fortune cookie 65 | InvDecl_Medkit, 66 | InvDecl_ChemBomb, // ie. gas bomb 67 | InvDecl_FlashBomb, 68 | InvDecl_Caltrops, 69 | InvDecl_NightVision, 70 | InvDecl_RepairKit, 71 | InvDecl_Cloak, 72 | InvDecl_TOTAL 73 | }; 74 | 75 | struct InventoryDecl_t { 76 | char *name; 77 | int amount; 78 | }; 79 | extern struct InventoryDecl_t InventoryDecls[InvDecl_TOTAL]; 80 | 81 | #endif 82 | 83 | -------------------------------------------------------------------------------- /src/jsector.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | #ifndef JSECTOR_H 28 | #define JSECTOR_H 29 | 30 | #include "reserve.h" 31 | 32 | #define MAXMIRRORDIST 3300 // At this distance, or less, the magic mirrors activate. 33 | #define MAXMIRRORMONSTERS 4 // Max monsters any one magic mirror can spawn 34 | 35 | typedef enum 36 | { 37 | m_normal, m_viewon, m_pissed 38 | } MIRRORSTATE; 39 | 40 | typedef struct 41 | { 42 | short mirrorwall; // Wall number containing the mirror 43 | // tile 44 | short mirrorsector; // nextsector used internally to draw 45 | // mirror rooms 46 | short camera; // Contains number of ST1 sprite used 47 | // as a camera 48 | short camsprite; // sprite pointing to campic 49 | short campic; // Editart tile number to draw a 50 | // screen to 51 | short numspawnspots; // Number of spawnspots used 52 | short spawnspots[MAXMIRRORMONSTERS];// One spot for each possible skill 53 | // level for a 54 | // max of up to 4 coolie ghosts to spawn. 55 | BOOL ismagic; // Is this a magic mirror? 56 | MIRRORSTATE mstate; // What state the mirror is currently 57 | // in 58 | int maxtics; // Tic count used to time mirror 59 | // events 60 | int tics; // How much viewing time has been 61 | // used on mirror? 62 | } MIRRORTYPE, *MIRRORTYPEp; 63 | 64 | extern MIRRORTYPE mirror[MAXMIRRORS]; 65 | 66 | extern short mirrorcnt, floormirrorcnt; 67 | extern short floormirrorsector[MAXMIRRORS]; 68 | extern BOOL mirrorinview; 69 | extern short NormalVisibility; 70 | 71 | void JAnalyzeSprites(SPRITEp tspr); 72 | void JS_DrawMirrors(PLAYERp pp,int tx,int ty,int tz,short tpang,int tphoriz); 73 | void JS_InitMirrors(void ); 74 | void JS_InitLockouts(void ); 75 | void JS_ToggleLockouts(void ); 76 | void JS_UnInitLockouts(void ); 77 | void JS_ProcessEchoSpot(void); 78 | void JS_SpriteSetup(void ); 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /src/rts.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 23 | */ 24 | //------------------------------------------------------------------------- 25 | 26 | //------------------------------------------------------------------------- 27 | /* 28 | Copyright (C) 1996, 2003 - 3D Realms Entertainment 29 | 30 | This file is part of Duke Nukem 3D version 1.5 - Atomic Edition 31 | 32 | Duke Nukem 3D is free software; you can redistribute it and/or 33 | modify it under the terms of the GNU General Public License 34 | as published by the Free Software Foundation; either version 2 35 | of the License, or (at your option) any later version. 36 | 37 | This program is distributed in the hope that it will be useful, 38 | but WITHOUT ANY WARRANTY; without even the implied warranty of 39 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 40 | 41 | See the GNU General Public License for more details. 42 | 43 | You should have received a copy of the GNU General Public License 44 | along with this program; if not, write to the Free Software 45 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 46 | 47 | Original Source: 1996 - Todd Replogle 48 | Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms 49 | */ 50 | //------------------------------------------------------------------------- 51 | 52 | //*************************************************************************** 53 | // 54 | // RTS.H 55 | // 56 | //*************************************************************************** 57 | 58 | #ifndef __rts_public__ 59 | #define __rts_public__ 60 | 61 | /* 62 | ==================== 63 | = 64 | = RTS_Init 65 | = 66 | = Files with a .rts extension are idlink files with multiple lumps 67 | = 68 | ==================== 69 | */ 70 | 71 | void RTS_Init (char *filename); 72 | void RTS_Shutdown ( void ); 73 | 74 | /* 75 | ==================== 76 | = 77 | = RTS_NumSounds 78 | = 79 | ==================== 80 | */ 81 | 82 | int32 RTS_NumSounds (void); 83 | /* 84 | ==================== 85 | = 86 | = RTS_SoundLength 87 | = 88 | = Returns the buffer size needed to load the given lump 89 | = 90 | ==================== 91 | */ 92 | 93 | int32 RTS_SoundLength (int32 lump); 94 | /* 95 | ==================== 96 | = 97 | = RTS_GetSoundName 98 | = 99 | ==================== 100 | */ 101 | 102 | char * RTS_GetSoundName (int32 i); 103 | /* 104 | ==================== 105 | = 106 | = RTS_GetSound 107 | = 108 | ==================== 109 | */ 110 | void *RTS_GetSound (int32 lump); 111 | #endif 112 | -------------------------------------------------------------------------------- /src/interp.c: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | #include "compat.h" 28 | #include "pragmas.h" 29 | 30 | #include "interp.h" 31 | 32 | #define MAXINTERPOLATIONS 1024 33 | int numinterpolations = 0, startofdynamicinterpolations = 0; 34 | int oldipos[MAXINTERPOLATIONS]; 35 | int bakipos[MAXINTERPOLATIONS]; 36 | int *curipos[MAXINTERPOLATIONS]; 37 | 38 | void setinterpolation(int *posptr) 39 | { 40 | int i; 41 | 42 | if (numinterpolations >= MAXINTERPOLATIONS) 43 | return; 44 | 45 | for (i = numinterpolations - 1; i >= 0; i--) 46 | { 47 | if (curipos[i] == posptr) 48 | return; 49 | } 50 | 51 | curipos[numinterpolations] = posptr; 52 | oldipos[numinterpolations] = *posptr; 53 | numinterpolations++; 54 | } 55 | 56 | void stopinterpolation(int *posptr) 57 | { 58 | int i; 59 | 60 | for (i = numinterpolations - 1; i >= startofdynamicinterpolations; i--) 61 | { 62 | if (curipos[i] == posptr) 63 | { 64 | numinterpolations--; 65 | oldipos[i] = oldipos[numinterpolations]; 66 | bakipos[i] = bakipos[numinterpolations]; 67 | curipos[i] = curipos[numinterpolations]; 68 | } 69 | } 70 | } 71 | 72 | void updateinterpolations(void) // Stick at beginning of domovethings 73 | { 74 | int i; 75 | 76 | for (i = numinterpolations - 1; i >= 0; i--) 77 | oldipos[i] = *curipos[i]; 78 | } 79 | 80 | // must call restore for every do interpolations 81 | // make sure you don't exit 82 | void dointerpolations(int smoothratio) // Stick at beginning of drawscreen 83 | { 84 | int i, j, odelta, ndelta; 85 | 86 | ndelta = 0; 87 | j = 0; 88 | 89 | for (i = numinterpolations - 1; i >= 0; i--) 90 | { 91 | bakipos[i] = *curipos[i]; 92 | 93 | odelta = ndelta; 94 | ndelta = (*curipos[i]) - oldipos[i]; 95 | 96 | if (odelta != ndelta) 97 | j = mulscale16(ndelta, smoothratio); 98 | 99 | *curipos[i] = oldipos[i] + j; 100 | } 101 | } 102 | 103 | void restoreinterpolations(void) // Stick at end of drawscreen 104 | { 105 | int i; 106 | 107 | for (i = numinterpolations - 1; i >= 0; i--) 108 | *curipos[i] = bakipos[i]; 109 | } 110 | -------------------------------------------------------------------------------- /src/jtags.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | #ifndef JTAGS_H 28 | #define JTAGS_H 29 | 30 | ////////////////////////////////////////////////////////////////////////////////////////// 31 | // 32 | // SPRITE TAGS (TAG THE SPRITES'S HITAG) ST1 tags 33 | // 34 | ////////////////////////////////////////////////////////////////////////////////////////// 35 | #define AI_NORMAL 0 36 | #define AI_EVASIVE 1 37 | #define AI_SNIPER 2 38 | #define AI_GUNGHO 3 39 | 40 | #define SWITCH_LOCKED 29 41 | 42 | // My sprite sprite tags start at 1000 to be separate from Frank's 43 | 44 | //* Magic mirror cameras 45 | //* LOTAG is the unique camera number 46 | #define MIRROR_CAM 1000 47 | //* These are spots at which a pissed off mirror will spawn a coolie ghost 48 | //* Make sure to set the skill levels on these sprites too. 49 | #define MIRROR_SPAWNSPOT 1001 50 | 51 | //* Ambient Sounds 52 | //* LOTAG is the enumerated sound num to play 53 | #define AMBIENT_SOUND 1002 54 | #define TAG_NORESPAWN_FLAG 1003 55 | #define TAG_GET_STAR 1004 56 | #define TAG_ECHO_SOUND 1005 57 | #define TAG_DRIPGEN 1006 58 | #define TAG_BUBBLEGEN 1007 59 | #define TAG_SWARMSPOT 1008 60 | 61 | #define TAG_PACHINKOLIGHT 9997 62 | #define TAG_INVISONINJA 9998 63 | #define LUMINOUS 9999 64 | 65 | ////////////////////////////////////////////////////////////////////////////////////////// 66 | // 67 | // WALL TAGS (TAG THE WALL'S LOTAG) 68 | // 69 | ////////////////////////////////////////////////////////////////////////////////////////// 70 | 71 | //* Turns a regular mirror into a magic mirror that shows a room containing ST1 sprite at 72 | //* sprite's angle and z height. 73 | //* HITAG is unique camera sprite number matching the ST1 camera sprite 74 | #define TAG_WALL_MAGIC_MIRROR 306 75 | 76 | 77 | ////////////////////////////////////////////////////////////////////////////////////////// 78 | // 79 | // LIGHTING TAGS (TAG THE SECTOR'S LOTAG) 80 | // 81 | ////////////////////////////////////////////////////////////////////////////////////////// 82 | 83 | //* Fade effect. Fades in and out smoothly. 84 | //* Ceiling is minimum darkness. 85 | //* Floor is maximum darkness. 86 | //* High byte is speed of flicker. 87 | //* The lower the number the faster. Default is 3. I recommend 8. 88 | //* Use TAG_LIGHT_FADE_DIFFUSE tags around the initial torch sector just like light fade. 89 | //* A good value to use for torches, is a 2 in high tag of TAG_LIGHT_FADE_DIFFUSE 90 | 91 | #define TAG_LIGHT_TORCH_FADE 305 92 | 93 | 94 | 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /src/buildres.rc: -------------------------------------------------------------------------------- 1 | // Generated by ResEdit 1.6.6 2 | // Copyright (C) 2006-2015 3 | // http://www.resedit.net 4 | 5 | #include 6 | #include 7 | #include 8 | #include "buildres.h" 9 | 10 | 11 | 12 | 13 | // 14 | // Bitmap resources 15 | // 16 | LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL 17 | IDB_BMP BITMAP "rsrc/build.bmp" 18 | 19 | 20 | 21 | // 22 | // Dialog resources 23 | // 24 | LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL 25 | IDD_STARTWIN DIALOGEX 20, 40, 351, 220 26 | STYLE DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_SYSMENU 27 | CAPTION "Startup" 28 | FONT 8, "MS Shell Dlg", 0, 0, 1 29 | { 30 | DEFPUSHBUTTON "&Start", IDOK, 229, 198, 55, 15, 0, WS_EX_LEFT 31 | PUSHBUTTON "&Cancel", IDCANCEL, 289, 198, 55, 15, 0, WS_EX_LEFT 32 | CONTROL "", IDC_STARTWIN_TABCTL, WC_TABCONTROL, WS_TABSTOP | WS_CLIPSIBLINGS, 87, 7, 257, 180, WS_EX_LEFT | WS_EX_CONTROLPARENT 33 | AUTOCHECKBOX "&Always show configuration on start", IDC_ALWAYSSHOW, 12, 202, 140, 8, WS_TABSTOP, WS_EX_LEFT 34 | CONTROL IDB_BMP, IDC_STATIC, WC_STATIC, SS_BITMAP, 22, 7, 43, 39, WS_EX_LEFT 35 | CTEXT "Build Editor\nfor JFShadowWarrior", IDC_STATIC, 12, 52, 65, 30, SS_CENTER, WS_EX_LEFT 36 | } 37 | 38 | 39 | 40 | LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL 41 | IDD_PAGE_CONFIG DIALOGEX 0, 0, 252, 164 42 | STYLE DS_CONTROL | DS_SHELLFONT | WS_CHILDWINDOW 43 | FONT 8, "MS Shell Dlg", 0, 0, 1 44 | { 45 | LTEXT "&2D Video mode:", IDC_STATIC, 7, 9, 52, 9, NOT WS_GROUP | SS_LEFT, WS_EX_LEFT 46 | COMBOBOX IDC_VMODE2D, 75, 7, 95, 99, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWNLIST, WS_EX_LEFT 47 | AUTOCHECKBOX "&Fullscreen", IDC_FULLSCREEN, 179, 8, 49, 10, WS_TABSTOP, WS_EX_LEFT 48 | LTEXT "&3D Video mode:", IDC_STATIC, 7, 27, 52, 9, NOT WS_GROUP | SS_LEFT, WS_EX_LEFT 49 | COMBOBOX IDC_VMODE3D, 75, 25, 95, 99, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWNLIST, WS_EX_LEFT 50 | } 51 | 52 | 53 | 54 | LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL 55 | IDD_PAGE_MESSAGES DIALOGEX 0, 0, 252, 164 56 | STYLE DS_CONTROL | DS_SHELLFONT | WS_CHILDWINDOW 57 | FONT 8, "MS Shell Dlg", 0, 0, 1 58 | { 59 | EDITTEXT IDC_MESSAGES, 0, 0, 252, 164, WS_VSCROLL | NOT WS_BORDER | NOT WS_TABSTOP | ES_MULTILINE | ES_READONLY, WS_EX_LEFT 60 | } 61 | 62 | 63 | 64 | // 65 | // Icon resources 66 | // 67 | LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL 68 | IDI_ICON ICON "rsrc/build_icon.ico" 69 | 70 | 71 | #ifdef _M_AMD64 72 | CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "rsrc/build.manifest" 73 | #else 74 | CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "rsrc/build-x86.manifest" 75 | #endif 76 | 77 | VS_VERSION_INFO VERSIONINFO 78 | FILEVERSION 0,0,0,0 79 | PRODUCTVERSION 0,0,0,0 80 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 81 | FILEFLAGS 0 82 | FILEOS VOS__WINDOWS32 83 | FILETYPE VFT_APP 84 | FILESUBTYPE VFT2_UNKNOWN 85 | { 86 | BLOCK "StringFileInfo" 87 | { 88 | BLOCK "080904e4" 89 | { 90 | VALUE "CompanyName", "http://jonof.id.au" 91 | VALUE "FileDescription", "Build Editor for JFShadowWarrior" 92 | VALUE "FileVersion", __DATE__ " " __TIME__ 93 | VALUE "InternalName", "build.exe" 94 | VALUE "OriginalFilename", "build.exe" 95 | VALUE "ProductName", "Build engine by Ken Silverman" 96 | VALUE "ProductVersion", __DATE__ " " __TIME__ 97 | VALUE "LegalCopyright", "See BUILDLIC.TXT for terms" 98 | } 99 | } 100 | BLOCK "VarFileInfo" 101 | { 102 | VALUE "Translation", 0x809, 1252 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/interpsh.c: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | #include "compat.h" 28 | #include "pragmas.h" 29 | 30 | #include "interp.h" 31 | 32 | #define SHORT_MAXINTERPOLATIONS 256 33 | short short_numinterpolations = 0, short_startofdynamicinterpolations = 0; 34 | short short_oldipos[SHORT_MAXINTERPOLATIONS]; 35 | short short_bakipos[SHORT_MAXINTERPOLATIONS]; 36 | short *short_curipos[SHORT_MAXINTERPOLATIONS]; 37 | 38 | void short_setinterpolation(short *posptr) 39 | { 40 | int i; 41 | 42 | if (short_numinterpolations >= SHORT_MAXINTERPOLATIONS) 43 | return; 44 | 45 | for (i = short_numinterpolations - 1; i >= 0; i--) 46 | { 47 | if (short_curipos[i] == posptr) 48 | return; 49 | } 50 | 51 | short_curipos[short_numinterpolations] = posptr; 52 | short_oldipos[short_numinterpolations] = *posptr; 53 | short_numinterpolations++; 54 | } 55 | 56 | void short_stopinterpolation(short *posptr) 57 | { 58 | int i; 59 | 60 | for (i = short_numinterpolations - 1; i >= short_startofdynamicinterpolations; i--) 61 | { 62 | if (short_curipos[i] == posptr) 63 | { 64 | short_numinterpolations--; 65 | short_oldipos[i] = short_oldipos[short_numinterpolations]; 66 | short_bakipos[i] = short_bakipos[short_numinterpolations]; 67 | short_curipos[i] = short_curipos[short_numinterpolations]; 68 | } 69 | } 70 | } 71 | 72 | void short_updateinterpolations(void) // Stick at beginning of domovethings 73 | { 74 | int i; 75 | 76 | for (i = short_numinterpolations - 1; i >= 0; i--) 77 | short_oldipos[i] = *short_curipos[i]; 78 | } 79 | 80 | // must call restore for every do interpolations 81 | // make sure you don't exit 82 | void short_dointerpolations(int smoothratio) // Stick at beginning of drawscreen 83 | { 84 | int i, j, odelta, ndelta; 85 | 86 | ndelta = 0; 87 | j = 0; 88 | 89 | for (i = short_numinterpolations - 1; i >= 0; i--) 90 | { 91 | short_bakipos[i] = *short_curipos[i]; 92 | 93 | odelta = ndelta; 94 | ndelta = (*short_curipos[i]) - short_oldipos[i]; 95 | 96 | if (odelta != ndelta) 97 | j = mulscale16(ndelta, smoothratio); 98 | 99 | *short_curipos[i] = short_oldipos[i] + j; 100 | } 101 | } 102 | 103 | void short_restoreinterpolations(void) // Stick at end of drawscreen 104 | { 105 | int i; 106 | 107 | for (i = short_numinterpolations - 1; i >= 0; i--) 108 | *short_curipos[i] = short_bakipos[i]; 109 | } 110 | -------------------------------------------------------------------------------- /src/bots.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | // BOTS.H 28 | // Contains useful header information for bot creation 29 | 30 | #ifndef BOTS_H 31 | #define BOTS_H 32 | 33 | 34 | // BOT DEFINITIONS AND STRUCTURES 35 | 36 | typedef enum 37 | { 38 | BOTstand, BOThide, BOTrun, BOTduck, BOTjump, BOTstrafe, BOTshoot, BOTuseinv, 39 | BOTopen, BOTswimup, BOTswimdown, BOTturn, BOTuserts 40 | } BOT_Actions; 41 | 42 | // Linked lists containing node trees that are chosen based on desired actions 43 | struct NODEstruct; 44 | typedef struct NODEstruct NODE, *NODEp; 45 | 46 | struct NODEstruct 47 | { 48 | NODEp p, l, r; // Pointers to tree nodes 49 | int goalx, goaly, goalz; // x,y,z point bot wants to get to 50 | BOT_Actions action; // Action to take if this node is reached 51 | int tics; // Optionally stay in this node for x tics. 52 | }; 53 | 54 | struct NODETREEstruct; 55 | typedef struct NODETREEstruct NODETREE, *NODETREEp; 56 | 57 | struct NODETREEstruct 58 | { 59 | short SpriteNum; // Sprite number in sprite array of goal item 60 | NODEp tree; // This is the node tree used to navigate to goal 61 | BOOL Locked; // If list is locked, a bot is using/modifying it and 62 | // other bots cannot modify it while it's locked 63 | }; 64 | 65 | // Bots main action variables 66 | typedef struct BOT_BRAIN 67 | { 68 | short tgt_inv; // Inventory item it wants to use 69 | short tgt_weapon; // Weapon in wants to activate and use 70 | short tgt_enemy; // Enemy it wants to kill 71 | short tgt_sprite; // Sprite it wants to pickup or operate 72 | short tgt_sector; // Sector it wants to get to 73 | short tgt_wall; // Wall it wants to touch 74 | BOT_Actions action; // Bot's current action 75 | } BotBrain, *BotBrain_p; 76 | 77 | // NOTE: 78 | // The following arrays should be saved off with save games! 79 | 80 | // 0 = Item not accessible, no item of type was found 81 | // 1 = Shuriken 82 | // 3 = Caltrops 83 | // 4 = Gas Bomb 84 | // 5 = Flash Bomb 85 | // 6 = Uzi Ammo 86 | // 7 = Shotgun Ammo 87 | // 8 = Rocket Ammo 88 | // 9 = 40mm Ammo 89 | // 10 = Sticky Bombs 90 | // 11 = Rail Ammo 91 | // 12 = Head Ammo 92 | // 13 = Heart Ammo 93 | // 14 = Uzi 94 | // 15 = Shotgun 95 | // 16 = Rocket Launcher 96 | // 17 = 40mm Launcher 97 | // 18 = Rail Gun 98 | // 19 = Head 99 | // 20 = Heart 100 | // 21 = MedKit 101 | // 22 = Armor 102 | // 23 = Big Armor 103 | // 24 = Portable MedKit 104 | // 25 = Fortune Cookie 105 | //////////////////////// 106 | extern NODETREE BOT_TREELIST[25][50]; // There can be up to 50 of each item 107 | // with a cooresponding search tree for each 108 | 109 | #endif 110 | -------------------------------------------------------------------------------- /src/keys.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | #ifndef KEYS_H 28 | 29 | #define KEYS_H 30 | 31 | #include "mytypes.h" 32 | 33 | #define NUM_CODES 128 34 | 35 | #define ESC 0x1B 36 | #define ENTER 0x0D 37 | 38 | #define KEYSC_ESC 1 39 | #define KEYSC_1 2 40 | #define KEYSC_2 3 41 | #define KEYSC_3 4 42 | #define KEYSC_4 5 43 | #define KEYSC_5 6 44 | #define KEYSC_6 7 45 | #define KEYSC_7 8 46 | #define KEYSC_8 9 47 | #define KEYSC_9 10 48 | #define KEYSC_0 11 49 | #define KEYSC_DASH 12 50 | #define KEYSC_EQUAL 13 51 | 52 | #define KEYSC_BS 14 53 | #define KEYSC_TAB 15 54 | #define KEYSC_Q 16 55 | #define KEYSC_W 17 56 | #define KEYSC_E 18 57 | #define KEYSC_R 19 58 | #define KEYSC_T 20 59 | #define KEYSC_Y 21 60 | #define KEYSC_U 22 61 | #define KEYSC_I 23 62 | #define KEYSC_O 24 63 | #define KEYSC_P 25 64 | #define KEYSC_LBRACK 26 65 | #define KEYSC_RBRACK 27 66 | #define KEYSC_ENTER 28 67 | 68 | #define KEYSC_CTRL 29 69 | #define KEYSC_A 30 70 | #define KEYSC_S 31 71 | #define KEYSC_D 32 72 | #define KEYSC_F 33 73 | #define KEYSC_G 34 74 | #define KEYSC_H 35 75 | #define KEYSC_J 36 76 | #define KEYSC_K 37 77 | #define KEYSC_L 38 78 | #define KEYSC_SEMI 39 79 | #define KEYSC_QUOTE 40 80 | #define KEYSC_BQUOTE 41 81 | #define KEYSC_TILDE 41 82 | 83 | #define KEYSC_LSHIFT 42 84 | #define KEYSC_BSLASH 43 85 | #define KEYSC_Z 44 86 | #define KEYSC_X 45 87 | #define KEYSC_C 46 88 | #define KEYSC_V 47 89 | #define KEYSC_B 48 90 | #define KEYSC_N 49 91 | #define KEYSC_M 50 92 | #define KEYSC_COMMA 51 93 | #define KEYSC_PERIOD 52 94 | #define KEYSC_SLASH 53 95 | #define KEYSC_RSHIFT 54 96 | #define KEYSC_STAR 55 97 | 98 | #define KEYSC_ALT 56 99 | #define KEYSC_SPACE 57 100 | #define KEYSC_CAPS 58 101 | 102 | #define KEYSC_F1 59 103 | #define KEYSC_F2 60 104 | #define KEYSC_F3 61 105 | #define KEYSC_F4 62 106 | #define KEYSC_F5 63 107 | #define KEYSC_F6 64 108 | #define KEYSC_F7 65 109 | #define KEYSC_F8 66 110 | #define KEYSC_F9 67 111 | #define KEYSC_F10 68 112 | 113 | #define KEYSC_F11 0x57 114 | #define KEYSC_F12 0x58 115 | 116 | #define KEYSC_NUM 69 117 | #define KEYSC_SCROLL 70 118 | 119 | #define KEYSC_HOME 71 120 | #define KEYSC_UP 72 121 | #define KEYSC_PGUP 73 122 | #define KEYSC_GMINUS 74 123 | #define KEYSC_LEFT 75 124 | #define KEYSC_KP5 76 125 | #define KEYSC_RIGHT 77 126 | #define KEYSC_GPLUS 78 127 | #define KEYSC_END 79 128 | #define KEYSC_DOWN 80 129 | #define KEYSC_PGDN 81 130 | #define KEYSC_INS 82 131 | #define KEYSC_DEL 83 132 | 133 | #define asc_Esc 27 134 | #define asc_Enter 13 135 | #define asc_Space 32 136 | 137 | #endif 138 | -------------------------------------------------------------------------------- /src/saveable.c: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 2005 Jonathon Fowler 4 | 5 | This file is part of JFShadowWarrior 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | */ 22 | //------------------------------------------------------------------------- 23 | 24 | #include "compat.h" 25 | #include "saveable.h" 26 | #include 27 | 28 | #define maxModules 35 29 | 30 | static saveable_module *saveablemodules[maxModules]; 31 | static unsigned nummodules = 0; 32 | 33 | void Saveable_Init(void) 34 | { 35 | if (nummodules > 0) return; 36 | 37 | #define MODULE(x) { \ 38 | extern saveable_module saveable_ ##x ; \ 39 | saveablemodules[nummodules++] = &saveable_ ##x ; \ 40 | } 41 | 42 | MODULE(actor) 43 | MODULE(ai) 44 | MODULE(build) 45 | MODULE(bunny) 46 | MODULE(coolg) 47 | MODULE(coolie) 48 | MODULE(eel) 49 | MODULE(girlninj) 50 | MODULE(goro) 51 | MODULE(hornet) 52 | MODULE(jweapon) 53 | MODULE(lava) 54 | MODULE(miscactr) 55 | MODULE(morph) 56 | MODULE(ninja) 57 | MODULE(panel) 58 | MODULE(player) 59 | MODULE(quake) 60 | MODULE(ripper) 61 | MODULE(ripper2) 62 | MODULE(rotator) 63 | MODULE(serp) 64 | MODULE(skel) 65 | MODULE(skull) 66 | MODULE(slidor) 67 | MODULE(spike) 68 | MODULE(sprite) 69 | MODULE(sumo) 70 | MODULE(track) 71 | MODULE(vator) 72 | MODULE(wallmove) 73 | MODULE(weapon) 74 | MODULE(zilla) 75 | MODULE(zombie) 76 | 77 | MODULE(sector) 78 | } 79 | 80 | int Saveable_FindCodeSym(saveable_code ptr, savedcodesym *sym) 81 | { 82 | unsigned m,i; 83 | 84 | if (!ptr) { 85 | sym->module = 0; // module 0 is the "null module" for null pointers 86 | sym->index = 0; 87 | return 0; 88 | } 89 | 90 | for (m=0; mnumcode; i++) { 92 | if (ptr != saveablemodules[m]->code[i]) continue; 93 | 94 | sym->module = 1+m; 95 | sym->index = i; 96 | 97 | return 0; 98 | } 99 | } 100 | 101 | return -1; 102 | } 103 | 104 | int Saveable_FindDataSym(void *ptr, saveddatasym *sym) 105 | { 106 | unsigned m,i; 107 | 108 | if (!ptr) { 109 | sym->module = 0; 110 | sym->index = 0; 111 | sym->offset = 0; 112 | return 0; 113 | } 114 | 115 | for (m=0; mnumdata; i++) { 117 | if (ptr < saveablemodules[m]->data[i].base) continue; 118 | if (ptr >= (void*)((intptr_t)saveablemodules[m]->data[i].base + 119 | saveablemodules[m]->data[i].size)) continue; 120 | 121 | sym->module = 1+m; 122 | sym->index = i; 123 | sym->offset = (unsigned)((intptr_t)ptr - (intptr_t)saveablemodules[m]->data[i].base); 124 | 125 | return 0; 126 | } 127 | } 128 | return -1; 129 | } 130 | 131 | int Saveable_RestoreCodeSym(savedcodesym *sym, void (**ptr)(void)) 132 | { 133 | if (sym->module == 0) { 134 | *ptr = NULL; 135 | return 0; 136 | } 137 | 138 | if (sym->module > nummodules) return -1; 139 | if (sym->index >= saveablemodules[ sym->module-1 ]->numcode) return -1; 140 | 141 | *ptr = saveablemodules[ sym->module-1 ]->code[ sym->index ]; 142 | 143 | return 0; 144 | } 145 | 146 | int Saveable_RestoreDataSym(saveddatasym *sym, void **ptr) 147 | { 148 | if (sym->module == 0) { 149 | *ptr = NULL; 150 | return 0; 151 | } 152 | 153 | if (sym->module > nummodules) return -1; 154 | if (sym->index >= saveablemodules[ sym->module-1 ]->numdata) return -1; 155 | if (sym->offset >= saveablemodules[ sym->module-1 ]->data[ sym->index ].size) return -1; 156 | 157 | *ptr = (void*)((intptr_t)saveablemodules[ sym->module-1 ]->data[ sym->index ].base + sym->offset); 158 | 159 | return 0; 160 | } 161 | -------------------------------------------------------------------------------- /src/config.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | #ifndef _config_public 28 | #define _config_public 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | #include "function.h" 34 | 35 | #define SETUPNAMEPARM "SETUPFILE" 36 | 37 | // screen externs 38 | extern int32 ScreenMode; // Screen mode 39 | extern int32 ScreenWidth; 40 | extern int32 ScreenHeight; 41 | extern int32 ScreenBPP; 42 | extern int32 ScreenBufferMode; 43 | extern int32 VesaBufferMode; 44 | extern int32 ForceSetup; 45 | 46 | // sound externs 47 | extern int32 FXDevice; // Sound FX Card number 48 | extern int32 MusicDevice; // Music Card number 49 | extern int32 FXVolume; // FX Volume 50 | extern int32 MusicVolume; // Music Volume 51 | extern int32 NumVoices; // Number of voices 52 | extern int32 NumChannels; // Number of channels 53 | extern int32 NumBits; // Number of bits 54 | extern int32 MixRate; // Mixing rate 55 | extern int32 MidiPort; // Midi Port 56 | extern int32 ReverseStereo; // Reverse Stereo Channels 57 | extern char MusicParams[]; 58 | 59 | // comm externs 60 | extern int32 SocketNumber; 61 | extern char CommbatMacro[MAXMACROS][MAXMACROLENGTH]; 62 | extern int32 NumberPlayers; 63 | extern int32 ConnectType; 64 | extern char CommPlayerName[MAXPLAYERNAMELENGTH]; 65 | extern char RTSName[MAXRTSNAMELENGTH]; 66 | extern char UserLevel[MAXUSERLEVELNAMELENGTH]; 67 | extern char RTSPath[MAXRTSPATHLENGTH]; 68 | extern char UserPath[MAXUSERLEVELPATHLENGTH]; 69 | 70 | // controller externs 71 | extern int32 UseMouse, UseJoystick; 72 | extern int32 JoystickPort; 73 | extern int32 MouseSensitivity; 74 | extern int32 MouseAiming; 75 | extern int32 MouseAimingFlipped; 76 | 77 | extern byte KeyboardKeys[NUMGAMEFUNCTIONS][2]; 78 | 79 | extern int32 MouseButtons[MAXMOUSEBUTTONS]; 80 | extern int32 MouseButtonsClicked[MAXMOUSEBUTTONS]; 81 | 82 | extern int32 JoystickButtons[MAXJOYBUTTONS]; 83 | extern int32 JoystickButtonsClicked[MAXJOYBUTTONS]; 84 | 85 | extern int32 MouseAnalogAxes[MAXMOUSEAXES]; 86 | extern int32 JoystickAnalogAxes[MAXJOYAXES]; 87 | extern int32 MouseAnalogScale[MAXMOUSEAXES]; 88 | extern int32 JoystickAnalogScale[MAXJOYAXES]; 89 | extern int32 JoystickAnalogDead[MAXJOYAXES]; 90 | extern int32 JoystickAnalogSaturate[MAXJOYAXES]; 91 | 92 | extern int32 EnableRudder; 93 | 94 | extern int32 MouseDigitalAxes[MAXMOUSEAXES][2]; 95 | extern int32 JoystickDigitalAxes[MAXJOYAXES][2]; 96 | 97 | extern char setupfilename[64]; 98 | extern char ExternalControlFilename[64]; 99 | 100 | enum { 101 | CONFIG_DEFAULTS_CLASSIC, 102 | CONFIG_DEFAULTS_MODERN 103 | }; 104 | void CONFIG_SetMouseDefaults(int style); 105 | void CONFIG_SetJoystickDefaults(int style); 106 | void CONFIG_SetDefaultKeyDefinitions(int style); 107 | 108 | int32 CONFIG_ReadSetup( void ); 109 | void CONFIG_SetupMouse( void ); 110 | void CONFIG_SetupJoystick( void ); 111 | void CONFIG_WriteSetup( void ); 112 | void WriteCommitFile( int32 gametype ); 113 | void CONFIG_GetSetupFilename( void ); 114 | 115 | const char * CONFIG_FunctionNumToName( int32 func ); 116 | int32 CONFIG_FunctionNameToNum( const char * func ); 117 | const char * CONFIG_AnalogNumToName( int32 func ); 118 | int32 CONFIG_AnalogNameToNum( const char * func ); 119 | 120 | #ifdef __cplusplus 121 | }; 122 | #endif 123 | #endif 124 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | JonoF's Shadow Warrior Port 2 | =========================== 3 | by Jonathon Fowler, with contributions by Ken Silverman and others 4 | 5 | * First Release: 2 April 2005 6 | * Email: jf@jonof.id.au 7 | * Website: http://www.jonof.id.au/jfsw 8 | * Source code: https://github.com/jonof/jfsw 9 | 10 | This is the source code for my port of [3D Realms' Shadow 11 | Warrior](http://legacy.3drealms.com/sw/index.html) using [my port of 12 | Ken Silverman's Build game engine](https://github.com/jonof/jfbuild). 13 | 14 | Minimum system requirements 15 | --------------------------- 16 | 17 | * 32 or 64-bit CPU. These have been tried first-hand: 18 | * Intel x86, x86_64 19 | * PowerPC 32-bit (big-endian) 20 | * ARM 32-bit hard-float, 64-bit 21 | * A modern operating system: 22 | * Linux, BSD, possibly other systems supported by [SDL 2.0](http://libsdl.org/). 23 | * macOS 10.15+ 24 | * Windows Vista, 7, 8/10+ 25 | * Optional: 3D acceleration with OpenGL 2.0 or OpenGL ES 2.0 capable hardware. 26 | 27 | You will require game data from an original release of Shadow Warrior. Refer to [the 28 | documentation on my website](https://www.jonof.id.au/jfsw/readme.html) on what 29 | releases are suitable and where to locate their game files. 30 | 31 | Compilation 32 | ----------- 33 | 34 | Before you begin, clone this repository or unpack the source archive. If you cloned using 35 | Git, be sure to initialise the submodules of this repository (i.e. `git submodule update --init`). 36 | 37 | Now, based on your chosen OS and compiler: 38 | 39 | ### Linux and BSD 40 | 41 | 1. Install the compiler toolchain and SDL2 development packages, e.g. 42 | * Debian 9: `sudo apt-get install build-essential libsdl2-dev` 43 | * FreeBSD 11: `sudo pkg install gmake sdl2 pkgconf` 44 | 2. Install optional sound support development packages. 45 | * Debian 9: `sudo apt-get install libvorbis-dev libfluidsynth-dev` 46 | * FreeBSD 11: `sudo pkg install libvorbis fluidsynth` 47 | 3. Install GTK+ 3 development packages if you want launch windows and editor file choosers, e.g. 48 | * Debian 9: `sudo apt-get install libgtk-3-dev` 49 | * FreeBSD 11: `sudo pkg install gtk3` 50 | 4. Open a terminal, change into the source code directory, and compile the game with: `make` or `gmake` (BSD) 51 | 5. Assuming that was successful, run the game with: `./sw` 52 | 53 | ### macOS 54 | 55 | 1. [Install Xcode from the Mac App Store](https://itunes.apple.com/au/app/xcode/id497799835?mt=12). 56 | 2. Open _sw.xcodeproj_ from within the JFShadowWarrior source code's _xcode_ folder. 57 | 3. Select the 'JFShadowWarrior' target and then from the Product menu choose Run. 58 | 59 | The _jfbuild_ submodule will automatically download the SDL2 framework upon first build. 60 | 61 | ### Windows using Microsoft Visual C++ 2015 (or newer) and NMAKE 62 | 63 | 1. If needed, [install Visual Studio Community 2017 for free from 64 | Microsoft](https://docs.microsoft.com/en-us/visualstudio/install/install-visual-studio). 65 | Terms and conditions apply. Install at minimum these components: 66 | * VC++ 2015.3 v140 toolset for desktop (x86,x64) 67 | * Windows Universal CRT SDK 68 | * Windows 8.1 SDK 69 | 2. Open the command-line build prompt. e.g. _VS2015 x64 Native Tools Command Prompt_ 70 | or _VS2015 x86 Native Tools Command Prompt_. 71 | 3. Change into the JFShadowWarrior source code folder, then compile the game with: `nmake /f Makefile.msvc` 72 | 5. Assuming success, run the game with: `sw` 73 | 74 | Compilation options 75 | ------------------- 76 | 77 | Some engine features may be enabled or disabled at compile time. These can be passed 78 | to the MAKE tool, or written to a Makefile.user (Makefile.msvcuser for MSVC) file in 79 | the source directory. 80 | 81 | These options are available: 82 | 83 | * `RELEASE=1` – build with optimisations for release. 84 | * `RELEASE=0` – build for debugging. 85 | * `USE_POLYMOST=1` – enable the true 3D renderer. 86 | * `USE_POLYMOST=0` – disable the true 3D renderer. 87 | * `USE_OPENGL=1` – enable use of OpenGL 2.x acceleration. 88 | * `USE_OPENGL=3` – enable use of OpenGL 3.x acceleration. 89 | * `USE_OPENGL=USE_GL2` – enable use of OpenGL 2.x acceleration. (Not a valid setting for MSVC.) 90 | * `USE_OPENGL=USE_GL3` – enable use of OpenGL 3.x acceleration. (Not a valid setting for MSVC.) 91 | * `USE_OPENGL=USE_GLES2` – enable use of OpenGL ES 2.0 acceleration. (Not a valid setting for MSVC.) 92 | * `USE_OPENGL=0` – disable use of OpenGL acceleration. 93 | * `WITHOUT_GTK=1` – disable use of GTK+ to provide launch windows and load/save file choosers. 94 | 95 | Warnings 96 | -------- 97 | 98 | 1. You should exercise caution if you choose to use multiplayer features over 99 | untrustworthy networks with untrustworthy players. 100 | 2. 3D Realms and Apogee do not support this port. Contact me instead. 101 | 102 | 103 | Enjoy! 104 | 105 | Jonathon Fowler 106 | 107 | 108 | -------------------------------------------------------------------------------- /src/pal.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | //// 28 | // 29 | // Misc Defines 30 | // 31 | //// 32 | 33 | #define LT_GREY (16 * 0 + 1) 34 | #define DK_GREY (16 * 1) 35 | #define LT_BROWN (16 * 2) 36 | #define DK_BROWN (16 * 3) 37 | #define LT_TAN (16 * 4) 38 | #define DK_TAN (16 * 5) 39 | #define RUST_RED (16 * 6) 40 | #define RED (16 * 7) 41 | #define YELLOW (16 * 8) 42 | #define BRIGHT_GREEN (16 * 9) 43 | #define DK_GREEN (16 * 10) 44 | #define GREEN (16 * 11) 45 | #define LT_BLUE (16 * 12) 46 | #define DK_BLUE (16 * 13) 47 | #define PURPLE (16 * 14) 48 | #define FIRE (16 * 15) 49 | 50 | // 51 | // Palette numbers and meanings 52 | // 53 | 54 | #define PALETTE_DEFAULT 0 55 | #define PALETTE_FOG 1 56 | // blue sword blade test 57 | #define PALETTE_MENU_HIGHLIGHT 2 58 | // used for the elector gore pieces 59 | #define PALETTE_ELECTRO_GORE 3 60 | // turns ninjas belt and headband red 61 | #define PALETTE_BASIC_NINJA 4 62 | // diving in lava 63 | #define PALETTE_DIVE_LAVA 5 64 | // turns ninjas belt and headband red 65 | #define PALETTE_RED_NINJA 6 66 | // used for the mother ripper - she is bigger/stronger/brown 67 | #define PALETTE_BROWN_RIPPER 7 68 | // turns ninjas belt and headband red 69 | #define PALETTE_GREEN_NINJA 8 70 | // reserved diving palette this is copied over the default palette 71 | // when needed - NOTE: could move this to a normal memory buffer if palette 72 | // slot is needed. 73 | #define PALETTE_DIVE 9 74 | #define PALETTE_SKEL_GORE 10 75 | // turns ALL colors to shades of GREEN/BLUE/RED 76 | #define PALETTE_GREEN_LIGHTING 11 77 | #define PALETTE_BLUE_LIGHTING 13 78 | #define PALETTE_RED_LIGHTING 14 79 | 80 | // for brown bubbling sludge 81 | #define PALETTE_SLUDGE 15 82 | 83 | 84 | 85 | 86 | // Player 0 uses default palette - others use these 87 | // turns ninja's vests (when we get them) into different color ranges 88 | #define PALETTE_PLAYER0 16 89 | #define PAL_XLAT_BROWN 16 90 | #define PALETTE_PLAYER1 17 91 | #define PAL_XLAT_LT_GREY 17 92 | #define PALETTE_PLAYER2 18 93 | #define PAL_XLAT_PURPLE 18 94 | #define PALETTE_PLAYER3 19 95 | #define PAL_XLAT_RUST_RED 19 96 | #define PALETTE_PLAYER4 20 97 | #define PAL_XLAT_YELLOW 20 98 | #define PALETTE_PLAYER5 21 99 | #define PAL_XLAT_DK_GREEN 21 100 | #define PALETTE_PLAYER6 22 101 | #define PAL_XLAT_GREEN 22 102 | #define PALETTE_PLAYER7 23 103 | #define PAL_XLAT_LT_BLUE 23 104 | #define PALETTE_PLAYER8 24 105 | #define PAL_XLAT_LT_TAN 24 106 | #define PALETTE_PLAYER9 25 107 | #define PAL_XLAT_RED 25 108 | #define PALETTE_PLAYER10 26 109 | #define PAL_XLAT_DK_GREY 26 110 | #define PALETTE_PLAYER11 27 111 | #define PAL_XLAT_BRIGHT_GREEN 27 112 | #define PALETTE_PLAYER12 28 113 | #define PAL_XLAT_DK_BLUE 28 114 | #define PALETTE_PLAYER13 29 115 | #define PAL_XLAT_FIRE 29 116 | #define PALETTE_PLAYER14 30 117 | #define PALETTE_PLAYER15 31 118 | 119 | #define PALETTE_ILLUMINATE 32 // Used to make sprites bright green in night vision 120 | 121 | 122 | -------------------------------------------------------------------------------- /src/osdcmds.c: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Shadow Warrior is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU General Public License 5 | as published by the Free Software Foundation; either version 2 6 | of the License, or (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | 12 | See the GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | */ 18 | //------------------------------------------------------------------------- 19 | 20 | #include "build.h" 21 | #include "osd.h" 22 | #include "cache1d.h" 23 | #include "game.h" 24 | #include "demo.h" 25 | #include "menus.h" 26 | 27 | static int 28 | osdcmd_restartvid(const osdfuncparm_t *parm) 29 | { 30 | extern BOOL RestartVideo; 31 | extern VMODE NewVideoMode; 32 | 33 | (void)parm; 34 | 35 | RestartVideo = TRUE; 36 | NewVideoMode.x = xdim; 37 | NewVideoMode.y = ydim; 38 | NewVideoMode.bpp = bpp; 39 | NewVideoMode.fs = fullscreen; 40 | 41 | return OSDCMD_OK; 42 | } 43 | 44 | static int 45 | osdcmd_vidmode(const osdfuncparm_t *parm) 46 | { 47 | extern BOOL RestartVideo; 48 | extern VMODE NewVideoMode; 49 | 50 | int newx = xdim, newy = ydim, newbpp = bpp, newfullscreen = fullscreen; 51 | 52 | if (parm->numparms < 1 || parm->numparms > 4) return OSDCMD_SHOWHELP; 53 | 54 | switch (parm->numparms) 55 | { 56 | case 1: // bpp switch 57 | newbpp = atoi(parm->parms[0]); 58 | break; 59 | case 2: // res switch 60 | newx = atoi(parm->parms[0]); 61 | newy = atoi(parm->parms[1]); 62 | break; 63 | case 3: // res & bpp switch 64 | case 4: 65 | newx = atoi(parm->parms[0]); 66 | newy = atoi(parm->parms[1]); 67 | newbpp = atoi(parm->parms[2]); 68 | if (parm->numparms == 4) 69 | newfullscreen = (atoi(parm->parms[3]) != 0); 70 | break; 71 | } 72 | 73 | if (checkvideomode(&newx, &newy, newbpp, newfullscreen, 0) >= 0) 74 | { 75 | RestartVideo = TRUE; 76 | NewVideoMode.x = newx; 77 | NewVideoMode.y = newy; 78 | NewVideoMode.bpp = newbpp; 79 | NewVideoMode.fs = newfullscreen; 80 | } 81 | 82 | return OSDCMD_OK; 83 | } 84 | 85 | static int 86 | osdcmd_map(const osdfuncparm_t *parm) 87 | { 88 | int i; 89 | char filename[BMAX_PATH]; 90 | 91 | if (parm->numparms != 1) return OSDCMD_SHOWHELP; 92 | 93 | strcpy(filename, parm->parms[0]); 94 | if(strchr(filename,'.') == NULL) 95 | strcat(filename, ".map"); 96 | 97 | if ((i = kopen4load(filename,0)) < 0) 98 | { 99 | buildprintf("map: file \"%s\" does not exist.\n", filename); 100 | return OSDCMD_OK; 101 | } 102 | kclose(i); 103 | 104 | if (DemoRecording || CommPlayers > 1) 105 | { 106 | buildprintf("map: no changing map in multiplayer.\n"); 107 | return OSDCMD_OK; 108 | } 109 | else 110 | if (strlen(filename) > sizeof(UserMapName)-1) 111 | { 112 | buildprintf("map: filename is too long.\n"); 113 | return OSDCMD_OK; 114 | } 115 | 116 | strcpy(UserMapName, filename); 117 | ExitLevel = TRUE; 118 | 119 | return OSDCMD_OK; 120 | } 121 | 122 | static int 123 | osdcmd_quit(const osdfuncparm_t *parm) 124 | { 125 | (void)parm; 126 | 127 | if (CommPlayers > 1) 128 | MultiPlayQuitFlag = TRUE; 129 | else 130 | QuitFlag = TRUE; 131 | 132 | return OSDCMD_OK; 133 | } 134 | 135 | static int 136 | osdcmd_showfps(const osdfuncparm_t *parm) 137 | { 138 | extern CHAR LocationInfo; // Actually BOOL, but CHAR is the same size. 139 | 140 | if (parm->numparms < 1) 141 | LocationInfo = !(LocationInfo > 0); 142 | else 143 | LocationInfo = max(0, min(2, atoi(parm->parms[0]))); 144 | return OSDCMD_OK; 145 | } 146 | 147 | void SetupOSDCommands(void) 148 | { 149 | OSD_RegisterFunction("restartvid", "restartvid: reinitialise the video mode", osdcmd_restartvid); 150 | OSD_RegisterFunction("vidmode", "vidmode [xdim ydim] [bpp] [fullscreen]: change the video mode", osdcmd_vidmode); 151 | OSD_RegisterFunction("quit", "quit: exit the game immediately", osdcmd_quit); 152 | OSD_RegisterFunction("showfps", "showfps: show frame rate", osdcmd_showfps); 153 | 154 | if (SW_REGISTERED) 155 | { 156 | OSD_RegisterFunction("map","map : loads the given user map", osdcmd_map); 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /installer/jfsw.nsi: -------------------------------------------------------------------------------- 1 | !define PRODUCT_NAME "JFShadowWarrior" 2 | !define PRODUCT_VERSION "20051009" 3 | !define PRODUCT_PUBLISHER "JonoF" 4 | !define PRODUCT_WEB_SITE "http://www.jonof.id.au/jfsw" 5 | !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\${PRODUCT_NAME}" 6 | !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" 7 | !define PRODUCT_UNINST_ROOT_KEY "HKLM" 8 | !define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir" 9 | 10 | SetCompressor lzma 11 | Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" 12 | OutFile "jfsw-${PRODUCT_VERSION}-setup.exe" 13 | InstallDir "$PROGRAMFILES\${PRODUCT_NAME}" 14 | InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" 15 | ShowInstDetails show 16 | ShowUnInstDetails show 17 | RequestExecutionLevel user 18 | LicenseData "..\GNU.TXT" 19 | XPStyle on 20 | 21 | Page license 22 | Page components 23 | Page directory 24 | Page instfiles 25 | 26 | UninstPage uninstConfirm 27 | UninstPage instfiles 28 | 29 | Section "!Game (required)" 30 | SectionIn RO 31 | SetOutPath $INSTDIR 32 | 33 | File "..\sw.exe" 34 | File "..\setup.bat" 35 | File "..\GNU.TXT" 36 | File "..\readme.txt" 37 | File "..\releasenotes.html" 38 | #File "E:\ports\datainst\datainst.exe" 39 | 40 | CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}" 41 | CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\JFShadowWarrior.lnk" "$INSTDIR\sw.exe" 42 | CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\JFShadowWarrior Setup.lnk" "$INSTDIR\sw.exe" "-setup" 43 | CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Game Data Installer.lnk" "$INSTDIR\datainst.exe" 44 | SectionEnd 45 | 46 | Section /o "Map editor" 47 | SetOutPath $INSTDIR 48 | 49 | File "..\build.exe" 50 | File "..\build-setup.bat" 51 | 52 | CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}" 53 | CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Build Editor.lnk" "$INSTDIR\build.exe" 54 | CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Build Editor Setup.lnk" "$INSTDIR\build.exe" "-setup" 55 | SectionEnd 56 | 57 | Section "Per-user profiles (recommended)" 58 | ClearErrors 59 | FileOpen $0 $INSTDIR\user_profiles_enabled w 60 | IfErrors done 61 | FileWrite $0 "User profile data is stored in C:\Documents and Settings\\Application Data\${PRODUCT_NAME}" 62 | FileClose $0 63 | done: 64 | SectionEnd 65 | 66 | Section -AdditionalIcons 67 | WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}" 68 | 69 | CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\JFShadowWarrior Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url" 70 | CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\uninst.exe" 71 | SectionEnd 72 | 73 | Section -Post 74 | WriteUninstaller "$INSTDIR\uninst.exe" 75 | 76 | WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\sw.exe" 77 | WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)" 78 | WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe" 79 | WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\sw.exe" 80 | WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" 81 | WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "${PRODUCT_STARTMENU_REGVAL}" "${PRODUCT_NAME}" 82 | WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}" 83 | WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}" 84 | WriteRegDWORD ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "NoModify" 1 85 | WriteRegDWORD ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "NoRepair" 1 86 | SectionEnd 87 | 88 | Section "Run data installer when done" 89 | SetOutPath $INSTDIR 90 | Exec '"$INSTDIR\datainst.exe"' 91 | SectionEnd 92 | 93 | Section Uninstall 94 | Delete "$INSTDIR\sw.exe" 95 | Delete "$INSTDIR\setup.bat" 96 | Delete "$INSTDIR\GNU.TXT" 97 | Delete "$INSTDIR\readme.txt" 98 | Delete "$INSTDIR\releasenotes.html" 99 | Delete "$INSTDIR\datainst.exe" 100 | 101 | Delete "$INSTDIR\build.exe" 102 | Delete "$INSTDIR\build-setup.bat" 103 | 104 | Delete "$SMPROGRAMS\${PRODUCT_NAME}\JFShadowWarrior.lnk" 105 | Delete "$SMPROGRAMS\${PRODUCT_NAME}\JFShadowWarrior Setup.lnk" 106 | Delete "$SMPROGRAMS\${PRODUCT_NAME}\Game Data Installer.lnk" 107 | 108 | Delete "$SMPROGRAMS\${PRODUCT_NAME}\Build Editor.lnk" 109 | Delete "$SMPROGRAMS\${PRODUCT_NAME}\Build Editor Setup.lnk" 110 | 111 | Delete "$INSTDIR\${PRODUCT_NAME}.url" 112 | Delete "$SMPROGRAMS\${PRODUCT_NAME}\JFShadowWarrior Website.lnk" 113 | Delete "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" 114 | 115 | Delete "$INSTDIR\sw.grp" 116 | Delete "$INSTDIR\sw.cfg" 117 | Delete "$INSTDIR\build.cfg" 118 | Delete "$INSTDIR\user_profiles_enabled" 119 | 120 | Delete "$INSTDIR\uninst.exe" 121 | 122 | RMDir "$SMPROGRAMS\${PRODUCT_NAME}" 123 | RMDir "$INSTDIR" 124 | 125 | DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" 126 | DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}" 127 | SetAutoClose true 128 | SectionEnd 129 | 130 | -------------------------------------------------------------------------------- /src/gamedefs.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | //**************************************************************************** 28 | // 29 | // gamedefs.h 30 | // 31 | // common defines between the game and the setup program 32 | // 33 | //**************************************************************************** 34 | 35 | #ifndef _gamedefs_public_ 36 | #define _gamedefs_public_ 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | //**************************************************************************** 42 | // 43 | // DEFINES 44 | // 45 | //**************************************************************************** 46 | 47 | //#define SHARE 1 48 | 49 | // 50 | // Setup program defines 51 | // 52 | 53 | // Max number of players 54 | 55 | //#ifdef SHARE 56 | //#define MAXPLAYERS 4 57 | //#else 58 | //#define MAXPLAYERS 8 59 | //#endif 60 | 61 | // Number of Mouse buttons 62 | 63 | #define MAXMOUSEBUTTONS 6 64 | 65 | // Number of JOY buttons 66 | 67 | #define MAXJOYBUTTONS 32 68 | 69 | // Number of EXTERNAL buttons 70 | 71 | //#define MAXEXTERNALBUTTONS 6 72 | 73 | // max path+track length for OGG music files 74 | #define MAXOGGTRACKLENGTH 256 75 | 76 | // 77 | // modem string defines 78 | // 79 | 80 | #define MAXMODEMSTRING 50 81 | 82 | // MACRO defines 83 | 84 | #define MAXMACROS 10 85 | #define MAXMACROLENGTH 34 86 | 87 | // Phone list defines 88 | 89 | #define PHONENUMBERLENGTH 28 90 | #define PHONENAMELENGTH 16 91 | #define MAXPHONEENTRIES 16 92 | 93 | // length of program functions 94 | 95 | #define MAXFUNCTIONLENGTH 30 96 | 97 | // length of axis functions 98 | 99 | #define MAXAXISFUNCTIONLENGTH 30 100 | 101 | // Max Player Name length 102 | 103 | #define MAXPLAYERNAMELENGTH 32 104 | 105 | // Max RTS Name length 106 | 107 | #define MAXRTSNAMELENGTH 15 108 | 109 | // Max User Level Name length 110 | 111 | #define MAXUSERLEVELNAMELENGTH 15 112 | 113 | 114 | // Max RTS Path length 115 | 116 | #define MAXRTSPATHLENGTH 48 117 | 118 | // Max User Level Path length 119 | 120 | #define MAXUSERLEVELPATHLENGTH 48 121 | 122 | // Number of Mouse Axes 123 | 124 | #define MAXMOUSEAXES 2 125 | 126 | // Number of JOY axes 127 | 128 | #define MAXJOYAXES 12 129 | 130 | // Number of GAMEPAD axes 131 | 132 | #define MAXGAMEPADAXES 2 133 | 134 | #ifdef __FLAT__ 135 | #define CONTROLSHIFT 0 136 | #else 137 | #define CONTROLSHIFT 4 138 | #endif 139 | // MIN/MAX scale value for controller scales 140 | 141 | #define MAXCONTROLSCALEVALUE (1<<(18-CONTROLSHIFT)) 142 | 143 | // DEFAULT scale value for controller scales 144 | 145 | #define DEFAULTCONTROLSCALEVALUE (1<<(16-CONTROLSHIFT)) 146 | 147 | // base value for controller scales 148 | 149 | #define BASECONTROLSCALEVALUE (1<<(16-CONTROLSHIFT)) 150 | 151 | // MAX mouse sensitivity scale 152 | 153 | #define MAXMOUSESENSITIVITY (1<<(17-CONTROLSHIFT)) 154 | 155 | // mouse sensitivity base 156 | 157 | #define MOUSECONTROLBASE ((1<<(15-CONTROLSHIFT))-1) 158 | 159 | // DEFAULT mouse sensitivity scale 160 | 161 | #define DEFAULTMOUSESENSITIVITY (1<<(15-CONTROLSHIFT)) 162 | 163 | enum 164 | { 165 | gametype_network=3, 166 | gametype_serial=1, 167 | gametype_modem=2 168 | }; 169 | 170 | enum 171 | { 172 | connecttype_dialing=0, 173 | connecttype_answer=1, 174 | connecttype_alreadyconnected=2 175 | }; 176 | 177 | enum 178 | { 179 | screenbuffer_320x200, 180 | screenbuffer_640x400, 181 | screenbuffer_640x480, 182 | screenbuffer_800x600, 183 | screenbuffer_1024x768, 184 | screenbuffer_1280x1024, 185 | screenbuffer_1600x1200 186 | }; 187 | 188 | enum 189 | { 190 | vesa_320x200, 191 | vesa_360x200, 192 | vesa_320x240, 193 | vesa_360x240, 194 | vesa_320x400, 195 | vesa_360x400, 196 | vesa_640x350, 197 | vesa_640x400, 198 | vesa_640x480, 199 | vesa_800x600, 200 | vesa_1024x768, 201 | vesa_1280x1024, 202 | vesa_1600x1200 203 | }; 204 | 205 | enum 206 | { 207 | screenmode_chained, 208 | screenmode_vesa, 209 | screenmode_buffered, 210 | screenmode_tseng, 211 | screenmode_paradise, 212 | screenmode_s3, 213 | screenmode_crystal, 214 | screenmode_redblue, 215 | }; 216 | 217 | 218 | #ifdef __cplusplus 219 | }; 220 | #endif 221 | #endif 222 | 223 | -------------------------------------------------------------------------------- /src/player.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | #ifndef PLAYER_H 28 | 29 | #define PLAYER_H 30 | 31 | #define PLAYER_HORIZ_MAX 299 // !JIM! was 199 and 5 32 | #define PLAYER_HORIZ_MIN -99 // Had to make plax sky pan up/down like in Duke 33 | // But this is MUCH better! 34 | 35 | #define MIN_SWIM_DEPTH 15 36 | 37 | // Player view height 38 | #define PLAYER_HEIGHT Z(58) 39 | #define PLAYER_CRAWL_HEIGHT Z(36) 40 | #define PLAYER_SWIM_HEIGHT Z(26) 41 | #define PLAYER_DIVE_HEIGHT Z(26) 42 | #define PLAYER_DIE_DOWN_HEIGHT Z(4) 43 | #define PLAYER_DIE_UP_HEIGHT Z(8) 44 | 45 | // step heights - effects floor_dist's 46 | #define PLAYER_STEP_HEIGHT Z(30) 47 | //#define PLAYER_STEP_HEIGHT Z(34) 48 | //#define PLAYER_STEP_HEIGHT Z(38) 49 | 50 | #define PLAYER_CRAWL_STEP_HEIGHT Z(8) 51 | #define PLAYER_SWIM_STEP_HEIGHT Z(8) 52 | #define PLAYER_DIVE_STEP_HEIGHT Z(8) 53 | 54 | //#define PLAYER_JUMP_STEP_HEIGHT Z(16) 55 | //#define PLAYER_FALL_STEP_HEIGHT Z(16) 56 | 57 | //#define PLAYER_JUMP_STEP_HEIGHT Z(34) 58 | //#define PLAYER_FALL_STEP_HEIGHT Z(24) 59 | 60 | #define PLAYER_JUMP_STEP_HEIGHT Z(48) 61 | #define PLAYER_FALL_STEP_HEIGHT Z(24) 62 | 63 | // FLOOR_DIST variables are the difference in the Players view and the sector floor. 64 | // Must be at LEAST this distance or you cannot move onto sector. 65 | #define PLAYER_RUN_FLOOR_DIST (PLAYER_HEIGHT - PLAYER_STEP_HEIGHT) 66 | #define PLAYER_CRAWL_FLOOR_DIST (PLAYER_CRAWL_HEIGHT - PLAYER_CRAWL_STEP_HEIGHT) 67 | #define PLAYER_WADE_FLOOR_DIST (PLAYER_HEIGHT - PLAYER_STEP_HEIGHT) 68 | #define PLAYER_JUMP_FLOOR_DIST (PLAYER_HEIGHT - PLAYER_JUMP_STEP_HEIGHT) 69 | #define PLAYER_FALL_FLOOR_DIST (PLAYER_HEIGHT - PLAYER_FALL_STEP_HEIGHT) 70 | #define PLAYER_SWIM_FLOOR_DIST (PLAYER_SWIM_HEIGHT - PLAYER_SWIM_STEP_HEIGHT) 71 | #define PLAYER_DIVE_FLOOR_DIST (PLAYER_DIVE_HEIGHT - PLAYER_DIVE_STEP_HEIGHT) 72 | 73 | 74 | // FLOOR_DIST variables are the difference in the Players view and the sector floor. 75 | // Must be at LEAST this distance or you cannot move onto sector. 76 | #define PLAYER_RUN_CEILING_DIST Z(10) 77 | #define PLAYER_SWIM_CEILING_DIST (Z(12)) 78 | #define PLAYER_DIVE_CEILING_DIST (Z(22)) 79 | #define PLAYER_CRAWL_CEILING_DIST (Z(12)) 80 | #define PLAYER_JUMP_CEILING_DIST Z(4) 81 | #define PLAYER_FALL_CEILING_DIST Z(4) 82 | #define PLAYER_WADE_CEILING_DIST Z(4) 83 | 84 | // 85 | // DIVE 86 | // 87 | 88 | #define PLAYER_DIVE_MAX_SPEED (1700) 89 | #define PLAYER_DIVE_INC (600) 90 | #define PLAYER_DIVE_BOB_AMT (Z(8)) 91 | 92 | #define PLAYER_DIVE_TIME (12*120) // time before damage is taken 93 | #define PLAYER_DIVE_DAMAGE_AMOUNT (-1) // amount of damage accessed 94 | #define PLAYER_DIVE_DAMAGE_TIME (50) // time between damage accessment 95 | 96 | // 97 | // FLY 98 | // 99 | 100 | #define PLAYER_FLY_MAX_SPEED (2560) 101 | #define PLAYER_FLY_INC (1000) 102 | #define PLAYER_FLY_BOB_AMT (Z(12)) 103 | 104 | // Height from which Player will actually call DoPlayerBeginFall() 105 | //#define PLAYER_FALL_HEIGHT Z(16) 106 | #define PLAYER_FALL_HEIGHT Z(28) 107 | #define PLAYER_FALL_DAMAGE_AMOUNT (10) 108 | 109 | // 110 | // DEATH 111 | // 112 | 113 | // dead head height - used in DeathFall 114 | #define PLAYER_DEATH_HEIGHT (Z(16)) 115 | #define PLAYER_DEAD_HEAD_FLOORZ_OFFSET (Z(7)) 116 | 117 | //#define PLAYER_NINJA_XREPEAT (56) 118 | //#define PLAYER_NINJA_YREPEAT (56) 119 | #define PLAYER_NINJA_XREPEAT (47) 120 | #define PLAYER_NINJA_YREPEAT (33) 121 | 122 | int SetVisHigh(void); 123 | int SetVisNorm(void); 124 | VOID DoWeapon(VOID); 125 | VOID HeadBobStateControl(VOID); 126 | int DoPickTarget(SPRITEp sp, WORD max_delta_ang, BOOL skip_targets); 127 | VOID DoPlayer(VOID); 128 | void domovethings(void ); 129 | void InitAllPlayers(void ); 130 | void InitMultiPlayerInfo(void ); 131 | void MoveScrollMode2D(PLAYERp pp); 132 | void DoPlayerDivePalette(PLAYERp pp); 133 | void DoPlayerNightVisionPalette(PLAYERp pp); 134 | void DoPlayerStopDiveNoWarp(PLAYERp pp); 135 | void DoPlayerResetMovement(PLAYERp pp); 136 | void DoPlayerZrange(PLAYERp pp); 137 | void DoPlayerSpriteThrow(PLAYERp pp); 138 | int DoPlayerWadeSuperJump(PLAYERp pp); 139 | void DoPlayerWarpTeleporter(PLAYERp pp); 140 | void UpdatePlayerSprite(PLAYERp pp); 141 | void PlaySOsound(short sectnum,short sound_num); 142 | VOID DoSpawnTeleporterEffectPlace(SPRITEp sp); 143 | void FindMainSector(SECTOR_OBJECTp sop); 144 | 145 | #endif 146 | -------------------------------------------------------------------------------- /src/ai.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | #ifndef AI_H 28 | 29 | #define AI_H 30 | 31 | // Call functions based on a random range value 32 | typedef struct 33 | { 34 | short range; 35 | ANIMATORp action; 36 | } DECISION, *DECISIONp; 37 | 38 | // Personality structure 39 | struct PERSONALITYstruct 40 | { 41 | DECISIONp Battle; 42 | DECISIONp Offense; 43 | DECISIONp Broadcast; 44 | DECISIONp Surprised; 45 | DECISIONp Evasive; 46 | DECISIONp LostTarget; 47 | DECISIONp CloseRange; 48 | DECISIONp TouchTarget; 49 | }; 50 | 51 | enum ActorStates { SLOW_SPEED, NORM_SPEED, MID_SPEED, FAST_SPEED, MAX_SPEED}; 52 | 53 | #define MAXATTRIBSNDS 11 54 | typedef enum { 55 | attr_ambient, attr_alert, attr_attack, attr_pain, attr_die, 56 | attr_extra1, attr_extra2, attr_extra3,attr_extra4,attr_extra5, 57 | attr_extra6 58 | } ATTRIB_SNDS; 59 | 60 | struct ATTRIBUTEstruct 61 | { 62 | short Speed[MAX_SPEED]; 63 | CHAR TicAdjust[MAX_SPEED]; 64 | BYTE MaxWeapons; 65 | /*ATTRIB_SNDS*/ int Sounds[MAXATTRIBSNDS]; // JBF: ATTRIB_SNDS? Somehow I don't think this is what was intended... 66 | }; 67 | 68 | extern ATTRIBUTE DefaultAttrib; 69 | 70 | // AI.C functions 71 | void DebugMoveHit(short SpriteNum); 72 | BOOL ActorMoveHitReact(short SpriteNum); 73 | BOOL ActorFlaming(short SpriteNum); 74 | void DoActorSetSpeed(short SpriteNum,BYTE speed); 75 | short ChooseActionNumber(short decision[]); 76 | int DoActorNoise(ANIMATORp Action,short SpriteNum); 77 | int CanSeePlayer(short SpriteNum); 78 | int CanHitPlayer(short SpriteNum); 79 | int DoActorPickClosePlayer(short SpriteNum); 80 | int CloseRangeDist(SPRITEp sp1,SPRITEp sp2); 81 | int InitActorDecide(short SpriteNum); 82 | int DoActorDecide(short SpriteNum); 83 | int InitActorAlertNoise(short SpriteNum); 84 | int InitActorAmbientNoise(short SpriteNum); 85 | int InitActorAttackNoise(short SpriteNum); 86 | int InitActorPainNoise(short SpriteNum); 87 | int InitActorDieNoise(short SpriteNum); 88 | int InitActorExtra1Noise(short SpriteNum); 89 | int InitActorExtra2Noise(short SpriteNum); 90 | int InitActorExtra3Noise(short SpriteNum); 91 | int InitActorExtra4Noise(short SpriteNum); 92 | int InitActorExtra5Noise(short SpriteNum); 93 | int InitActorExtra6Noise(short SpriteNum); 94 | int InitActorMoveCloser(short SpriteNum); 95 | int DoActorCantMoveCloser(short SpriteNum); 96 | int DoActorMoveCloser(short SpriteNum); 97 | short FindTrackToPlayer(USERp u); 98 | short FindTrackAwayFromPlayer(USERp u); 99 | short FindWanderTrack(USERp u); 100 | int InitActorRunAway(short SpriteNum); 101 | int InitActorRunToward(short SpriteNum); 102 | int InitActorAttack(short SpriteNum); 103 | int DoActorAttack(short SpriteNum); 104 | int InitActorEvade(short SpriteNum); 105 | int InitActorWanderAround(short SpriteNum); 106 | int InitActorFindPlayer(short SpriteNum); 107 | int InitActorDuck(short SpriteNum); 108 | int DoActorDuck(short SpriteNum); 109 | int DoActorMoveJump(short SpriteNum); 110 | int move_scan(short SpriteNum,short ang,int dist,int *stopx,int *stopy,int *stopz,short *stopsect); 111 | int FindNewAngle(short SpriteNum,signed char dir,int DistToMove); 112 | int InitActorReposition(short SpriteNum); 113 | int DoActorReposition(short SpriteNum); 114 | int InitActorPause(short SpriteNum); 115 | int DoActorPause(short SpriteNum); 116 | 117 | /* 118 | ANIMATOR 119 | InitActorDecide, 120 | InitActorMoveCloser, 121 | InitActorAttack, 122 | InitActorRunAway, 123 | InitActorEvade, 124 | InitActorWanderAround, 125 | InitActorFindPlayer, 126 | InitActorReposition, 127 | InitActorPause, 128 | InitActorDuck, 129 | InitActorAmbientNoise, 130 | InitActorAlertNoise, 131 | InitActorAttackNoise, 132 | InitActorPainNoise, 133 | InitActorDieNoise, 134 | InitActorExtra1Noise, 135 | InitActorExtra2Noise, 136 | InitActorExtra3Noise, 137 | InitActorExtra4Noise, 138 | InitActorExtra5Noise, 139 | InitActorExtra6Noise; 140 | 141 | ANIMATOR 142 | DoActorDecide, 143 | DoActorMoveCloser, 144 | DoActorAttack, 145 | DoActorRunAway, 146 | DoActorWanderAround, 147 | DoActorReposition, 148 | DoActorPause, 149 | DoActorDuck, 150 | DoActorAmbientNoise, 151 | DoActorAlertNoise, 152 | DoActorAttackNoise, 153 | DoActorPainNoise, 154 | DoActorDieNoise, 155 | DoActorExtra1Noise, 156 | DoActorExtra2Noise, 157 | DoActorExtra3Noise, 158 | DoActorExtra4Noise, 159 | DoActorExtra5Noise, 160 | DoActorExtra6Noise; 161 | */ 162 | 163 | VOID DoActorSetSpeed(short SpriteNum, BYTE speed); 164 | 165 | #endif 166 | -------------------------------------------------------------------------------- /src/vis.c: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | #include "build.h" 27 | 28 | #include "names2.h" 29 | #include "game.h" 30 | #include "tags.h" 31 | #include "mathutil.h" 32 | #include "break.h" 33 | #include "quake.h" 34 | #include "pal.h" 35 | #include "sprite.h" 36 | 37 | extern short NormalVisibility; // player.c 38 | extern BOOL GamePaused; 39 | 40 | #define VIS_VisCur(sp) (SP_TAG2(sp)) 41 | #define VIS_VisDir(sp) (SP_TAG3(sp)) 42 | #define VIS_VisGoal(sp) (SP_TAG4(sp)) 43 | 44 | void ProcessVisOn(void) 45 | { 46 | short i, nexti; 47 | SPRITEp sp; 48 | 49 | TRAVERSE_SPRITE_STAT(headspritestat[STAT_VIS_ON], i, nexti) 50 | { 51 | sp = &sprite[i]; 52 | 53 | if (VIS_VisDir(sp)) 54 | { 55 | // get brighter 56 | VIS_VisCur(sp) >>= 1; 57 | //VIS_VisCur(sp) -= 16; 58 | if (VIS_VisCur(sp) <= VIS_VisGoal(sp)) 59 | { 60 | VIS_VisCur(sp) = VIS_VisGoal(sp); 61 | VIS_VisDir(sp) ^= 1; 62 | } 63 | } 64 | else 65 | { 66 | // get darker 67 | VIS_VisCur(sp) <<= 1; 68 | VIS_VisCur(sp) += 1; 69 | //VIS_VisCur(sp) += 16; 70 | if (VIS_VisCur(sp) >= NormalVisibility) 71 | { 72 | VIS_VisCur(sp) = NormalVisibility; 73 | if (sp->owner >= 0) 74 | { 75 | ASSERT(User[sp->owner]); 76 | RESET(User[sp->owner]->Flags2, SPR2_VIS_SHADING); 77 | } 78 | KillSprite(i); 79 | } 80 | } 81 | } 82 | } 83 | 84 | void VisViewChange(PLAYERp pp, int *vis) 85 | { 86 | short i, nexti; 87 | SPRITEp sp; 88 | short BrightestVis = NormalVisibility; 89 | int x,y,z; 90 | short sectnum; 91 | 92 | if (GamePaused) 93 | return; 94 | 95 | // find the closest quake - should be a strength value 96 | TRAVERSE_SPRITE_STAT(headspritestat[STAT_VIS_ON], i, nexti) 97 | { 98 | sp = &sprite[i]; 99 | 100 | if (sp->owner >= 0) 101 | { 102 | x = sprite[sp->owner].x; 103 | y = sprite[sp->owner].y; 104 | z = sprite[sp->owner].z; 105 | sectnum = sprite[sp->owner].sectnum; 106 | } 107 | else 108 | { 109 | x = sp->x; 110 | y = sp->y; 111 | z = sp->z; 112 | sectnum = sp->sectnum; 113 | } 114 | 115 | // save off the brightest vis that you can see 116 | if (FAFcansee(pp->posx, pp->posy, pp->posz, pp->cursectnum, x, y, z, sectnum)) 117 | { 118 | if (VIS_VisCur(sp) < BrightestVis) 119 | BrightestVis = VIS_VisCur(sp); 120 | } 121 | } 122 | 123 | *vis = BrightestVis; 124 | } 125 | 126 | int SpawnVis(short Parent, short sectnum, int x, int y, int z, int amt) 127 | { 128 | short SpriteNum; 129 | SPRITEp sp; 130 | short i,nexti; 131 | 132 | if (Parent >= 0) 133 | { 134 | if (sector[sprite[Parent].sectnum].floorpal == PALETTE_FOG) 135 | return(-1); 136 | 137 | if (sector[sprite[Parent].sectnum].floorpal == PALETTE_DIVE_LAVA) 138 | return(-1); 139 | 140 | // kill any others with the same parent 141 | TRAVERSE_SPRITE_STAT(headspritestat[STAT_VIS_ON], i, nexti) 142 | { 143 | sp = &sprite[i]; 144 | if (sp->owner == Parent) 145 | { 146 | KillSprite(i); 147 | } 148 | } 149 | 150 | SpriteNum = COVERinsertsprite(sprite[Parent].sectnum, STAT_VIS_ON); 151 | sp = &sprite[SpriteNum]; 152 | 153 | sp->owner = Parent; 154 | 155 | ASSERT(User[Parent]); 156 | SET(User[Parent]->Flags2, SPR2_CHILDREN); 157 | 158 | sp->x = sprite[Parent].x; 159 | sp->y = sprite[Parent].y; 160 | sp->z = sprite[Parent].z; 161 | 162 | SET(User[Parent]->Flags2, SPR2_VIS_SHADING); 163 | } 164 | else 165 | { 166 | if (sector[sectnum].floorpal == PALETTE_FOG) 167 | return(-1); 168 | 169 | SpriteNum = COVERinsertsprite(sectnum, STAT_VIS_ON); 170 | sp = &sprite[SpriteNum]; 171 | 172 | sp->x = x; 173 | sp->y = y; 174 | sp->z = z - Z(20); 175 | sp->owner = -1; 176 | } 177 | 178 | sp->cstat = 0; 179 | sp->extra = 0; 180 | 181 | VIS_VisDir(sp) = 1; 182 | VIS_VisCur(sp) = NormalVisibility; 183 | VIS_VisGoal(sp) = amt; 184 | 185 | return(SpriteNum); 186 | } 187 | 188 | -------------------------------------------------------------------------------- /src/jbhlp.c: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1996, 2005 - 3D Realms Entertainment 4 | 5 | This file is NOT part of Shadow Warrior version 1.2 6 | However, it is either an older version of a file that is, or is 7 | some test code written during the development of Shadow Warrior. 8 | This file is provided purely for educational interest. 9 | 10 | Shadow Warrior is free software; you can redistribute it and/or 11 | modify it under the terms of the GNU General Public License 12 | as published by the Free Software Foundation; either version 2 13 | of the License, or (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | See the GNU General Public License for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with this program; if not, write to the Free Software 23 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 24 | 25 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 26 | */ 27 | //------------------------------------------------------------------------- 28 | 29 | #include "build.h" 30 | #include "editor.h" 31 | #include "cache1d.h" 32 | 33 | #include "keys.h" 34 | #include "names2.h" 35 | #include "game.h" 36 | 37 | 38 | #define M_RED 12 39 | #define M_BLUE 9 40 | 41 | 42 | // Globals 43 | 44 | static char tempbuf[256]; 45 | 46 | 47 | // Prototypes 48 | 49 | void Message(char *string, char color); 50 | int GetAToken(char *name, char *tc, int length); 51 | BYTEp BKeyPressed(VOID); 52 | VOID ResetKeys(VOID); 53 | 54 | 55 | // Functions 56 | 57 | void Msg(char *string, char color) 58 | { 59 | clearmidstatbar16(); 60 | 61 | printext16(1*4,4*8,color,-1,string,1); 62 | 63 | } 64 | 65 | 66 | // @ symbol precedes a tag name target 67 | // # symbol precedes a comment in the help file 68 | int GetAToken(char *name, char *tc, int length) 69 | { 70 | int x=0; 71 | char t,*tmp,tokenfound=0; 72 | char token[10]; 73 | int count=0; 74 | 75 | do{ 76 | 77 | // Find the token symbol 78 | do { 79 | t = *tc; 80 | tc++; 81 | count++; 82 | } while(t!='@' && count < length); 83 | 84 | 85 | if(t=='@') 86 | { 87 | tmp = token; 88 | x=1; 89 | 90 | do { 91 | // Read in the token 92 | *tmp = t; 93 | tmp++; 94 | t = *tc; 95 | tc++; 96 | x++; 97 | count++; 98 | } while(t>=48 && t!='@' && x < 9 && count < length); 99 | 100 | *tmp = 0; 101 | 102 | if(!Bstrcasecmp(name,token)) 103 | tokenfound = 1; 104 | } 105 | } while(!tokenfound && count < length); 106 | 107 | 108 | if(!tokenfound) count=0; 109 | return(count); 110 | 111 | } 112 | 113 | void ContextHelp(short spritenum) 114 | { 115 | int fp,x=0,y=4; 116 | char t,*tc; 117 | char name[20]; 118 | char *filebuffer; 119 | SPRITEp sp; 120 | short hitag=0; 121 | int size=0,tokresult=0; 122 | 123 | 124 | sp = &sprite[spritenum]; 125 | 126 | clearmidstatbar16(); 127 | 128 | if((fp=kopen4load("swbhelp.hlp",0)) == -1) 129 | { 130 | Msg("ERROR: Help file not found.",M_RED); 131 | return; 132 | } 133 | 134 | // Read in whole file 135 | size = kfilelength(fp); 136 | filebuffer = (char *)malloc(size); 137 | if (filebuffer == NULL) 138 | { 139 | Msg("Not enough memory to load swhelp.hlp",M_RED); 140 | return; 141 | } 142 | 143 | if (kread(fp, filebuffer, size) != size) 144 | { 145 | Msg("Unexpected end of file while reading swhelp.hlp",M_RED); 146 | kclose(fp); 147 | return; 148 | } 149 | 150 | // close the file 151 | kclose(fp); 152 | 153 | // Conver filebuffer to all upper case 154 | //strupr(filebuffer); 155 | 156 | // Assign a token name to search for based on the sprite being pointed to. 157 | 158 | // Make the token 159 | // Make sure 500-600 SOBJ bounding tags all say the same thing. 160 | hitag = sp->hitag; 161 | if(hitag > 500 && hitag <= 600 ) hitag = 500; 162 | // Give help summary for unknown sprites. 163 | if((hitag == 0 || hitag > 1006) && sp->lotag == 0) hitag = 999; 164 | 165 | sprintf(name,"@TAG%d",hitag); 166 | 167 | tc = filebuffer; 168 | 169 | if(!(tokresult = GetAToken(name,tc,size))) 170 | { 171 | // This message should never happen unless something is real wrong! 172 | Msg("No help available.",M_RED); 173 | return; 174 | } 175 | 176 | tc += tokresult; 177 | 178 | do { 179 | tc++; 180 | t = *tc; 181 | while(t!='\n' && t!='@' && t!='#' && x<128) 182 | { 183 | tempbuf[x]=t; 184 | tc++; 185 | t = *tc; 186 | x++; 187 | if(x >= 128) break; 188 | } 189 | tempbuf[x]=0; 190 | x=0; 191 | printext16(x*4,(y*6)+2,11,-1,tempbuf,1); 192 | y++; 193 | 194 | if(y>16) 195 | { 196 | y=18; 197 | printext16(x*4,(y*6)+2,11,-1,"Hit any key to continue or Q to quit....",1); 198 | showframe(); 199 | while (BKeyPressed() == NULL) handleevents(); 200 | if (keystatus[KEYSC_Q]) 201 | { 202 | clearmidstatbar16(); 203 | return; 204 | } 205 | ResetKeys(); 206 | clearmidstatbar16(); 207 | 208 | y=6; 209 | } 210 | 211 | } while(t!='@' && t!='#'); 212 | } 213 | 214 | 215 | -------------------------------------------------------------------------------- /Makefile.msvc: -------------------------------------------------------------------------------- 1 | # Shadow Warrior Makefile for Microsoft Make 2 | 3 | # Engine options 4 | # USE_POLYMOST - enables Polymost renderer 5 | # USE_OPENGL - enables OpenGL support in Polymost 6 | # Define as 0 to disable OpenGL 7 | # Define as 1 (or 2) for GL 2.0/2.1 profile 8 | # Define as 3 for GL 3.2 Core profile 9 | # USE_ASM - enables the use of assembly code if supported 10 | USE_POLYMOST=1 11 | USE_OPENGL=1 12 | USE_ASM=1 13 | 14 | RELEASE=1 15 | 16 | # Create Makefile.msvcuser yourself to provide your own overrides 17 | # for configurable values 18 | !if EXIST(Makefile.msvcuser) 19 | !include Makefile.msvcuser 20 | !endif 21 | 22 | ENGINEROOT=jfbuild 23 | ENGINEINC=$(ENGINEROOT)\include 24 | SRC=src 25 | RSRC=rsrc 26 | MACTROOT=jfmact 27 | AUDIOLIBROOT=jfaudiolib 28 | 29 | CC=cl 30 | RC=rc 31 | LINK=link 32 | 33 | OURCFLAGS=/nologo /MD /Zl 34 | OURCXXFLAGS=/nologo /MD /Zl /EHsc 35 | OURCPPFLAGS=/I$(SRC) /I$(ENGINEINC) /I$(MACTROOT) /I$(AUDIOLIBROOT)\include 36 | OURLINKFLAGS=/opt:ref /nologo 37 | OURRFLAGS=/nologo /i$(SRC) /i$(ENGINEINC) 38 | OURLIBS=msvcrt.lib ole32.lib 39 | 40 | !if $(RELEASE) 41 | # release options 42 | OURCFLAGS=$(OURCFLAGS) /Ox 43 | OURCXXFLAGS=$(OURCXXFLAGS) /Ox 44 | OURLINKFLAGS=$(OURLINKFLAGS) /RELEASE 45 | !else 46 | # debugging options 47 | OURCFLAGS=$(OURCFLAGS) /Ot /Z7 48 | OURCXXFLAGS=$(OURXXCFLAGS) /Ot /Z7 49 | OURLINKFLAGS=$(OURLINKFLAGS) /DEBUG 50 | !endif 51 | 52 | o=obj 53 | res=res 54 | 55 | !include $(ENGINEROOT)/Makefile.msvcshared 56 | 57 | OURCFLAGS=$(OURCFLAGS) $(BUILDCFLAGS) 58 | OURCXXFLAGS=$(OURCXXFLAGS) $(BUILDCXXFLAGS) 59 | OURCPPFLAGS=$(OURCPPFLAGS) $(BUILDCPPFLAGS) 60 | OURLIBS=$(OURLIBS) $(BUILDLIBS) 61 | OURRFLAGS=$(OURRFLAGS) $(BUILDRFLAGS) 62 | 63 | !include $(AUDIOLIBROOT)/Makefile.msvcshared 64 | 65 | OURLINKFLAGS=$(OURLINKFLAGS) /LIBPATH:$(AUDIOLIBROOT)\third-party\msvc\lib$(PLATFORM) 66 | 67 | GAMEOBJS=$(SRC)\actor.$o \ 68 | $(SRC)\ai.$o \ 69 | $(SRC)\anim.$o \ 70 | $(SRC)\border.$o \ 71 | $(SRC)\break.$o \ 72 | $(SRC)\bunny.$o \ 73 | $(SRC)\cache.$o \ 74 | $(SRC)\cheats.$o \ 75 | $(SRC)\colormap.$o \ 76 | $(SRC)\config.$o \ 77 | $(SRC)\console.$o \ 78 | $(SRC)\coolg.$o \ 79 | $(SRC)\coolie.$o \ 80 | $(SRC)\copysect.$o \ 81 | $(SRC)\demo.$o \ 82 | $(SRC)\draw.$o \ 83 | $(SRC)\eel.$o \ 84 | $(SRC)\game.$o \ 85 | $(SRC)\girlninj.$o \ 86 | $(SRC)\goro.$o \ 87 | $(SRC)\grpscan.$o \ 88 | $(SRC)\hornet.$o \ 89 | $(SRC)\interp.$o \ 90 | $(SRC)\interpsh.$o \ 91 | $(SRC)\inv.$o \ 92 | $(SRC)\jplayer.$o \ 93 | $(SRC)\jsector.$o \ 94 | $(SRC)\jweapon.$o \ 95 | $(SRC)\lava.$o \ 96 | $(SRC)\light.$o \ 97 | $(SRC)\mclip.$o \ 98 | $(SRC)\menus.$o \ 99 | $(SRC)\miscactr.$o \ 100 | $(SRC)\morph.$o \ 101 | $(SRC)\net.$o \ 102 | $(SRC)\ninja.$o \ 103 | $(SRC)\osdcmds.$o \ 104 | $(SRC)\osdfuncs.$o \ 105 | $(SRC)\panel.$o \ 106 | $(SRC)\player.$o \ 107 | $(SRC)\predict.$o \ 108 | $(SRC)\quake.$o \ 109 | $(SRC)\ripper.$o \ 110 | $(SRC)\ripper2.$o \ 111 | $(SRC)\rooms.$o \ 112 | $(SRC)\rotator.$o \ 113 | $(SRC)\rts.$o \ 114 | $(SRC)\save.$o \ 115 | $(SRC)\scrip2.$o \ 116 | $(SRC)\sector.$o \ 117 | $(SRC)\serp.$o \ 118 | $(SRC)\setup.$o \ 119 | $(SRC)\skel.$o \ 120 | $(SRC)\skull.$o \ 121 | $(SRC)\slidor.$o \ 122 | $(SRC)\sounds.$o \ 123 | $(SRC)\spike.$o \ 124 | $(SRC)\sprite.$o \ 125 | $(SRC)\sumo.$o \ 126 | $(SRC)\swconfig.$o \ 127 | $(SRC)\sync.$o \ 128 | $(SRC)\text.$o \ 129 | $(SRC)\track.$o \ 130 | $(SRC)\vator.$o \ 131 | $(SRC)\vis.$o \ 132 | $(SRC)\wallmove.$o \ 133 | $(SRC)\warp.$o \ 134 | $(SRC)\weapon.$o \ 135 | $(SRC)\zilla.$o \ 136 | $(SRC)\zombie.$o \ 137 | $(SRC)\saveable.$o \ 138 | $(SRC)\gameres.$(res) \ 139 | $(SRC)\startwin_game.$o 140 | 141 | GAMEOBJS=$(GAMEOBJS) \ 142 | $(MACTROOT)\util_lib.$o \ 143 | $(MACTROOT)\file_lib.$o \ 144 | $(MACTROOT)\control.$o \ 145 | $(MACTROOT)\keyboard.$o \ 146 | $(MACTROOT)\mouse.$o \ 147 | $(MACTROOT)\mathutil.$o \ 148 | $(MACTROOT)\scriplib.$o \ 149 | $(MACTROOT)\animlib.$o 150 | 151 | EDITOROBJS=$(SRC)\jnstub.$o \ 152 | $(SRC)\brooms.$o \ 153 | $(SRC)\bldscript.$o \ 154 | $(SRC)\jbhlp.$o \ 155 | $(SRC)\colormap.$o \ 156 | $(SRC)\buildres.$(res) 157 | 158 | # Source-control version stamping 159 | !if [git --version >nul] == 0 160 | GAMEOBJS=$(GAMEOBJS) $(SRC)\version-auto.$o 161 | EDITOROBJS=$(EDITOROBJS) $(SRC)\version-auto.$o 162 | !else 163 | GAMEOBJS=$(GAMEOBJS) $(SRC)\version.$o 164 | EDITOROBJS=$(EDITOROBJS) $(SRC)\version.$o 165 | !endif 166 | 167 | # RULES 168 | {$(SRC)}.c{$(SRC)}.$o: 169 | $(CC) /TC /c $(CPPFLAGS) $(OURCPPFLAGS) $(CFLAGS) $(OURCFLAGS) /Fo$@ $< 170 | 171 | {$(SRC)}.rc{$(SRC)}.$(res): 172 | $(RC) $(OURRFLAGS) /fo$@ /r $< 173 | 174 | {$(MACTROOT)}.c{$(MACTROOT)}.$o: 175 | $(CC) /TC /c $(CPPFLAGS) $(OURCPPFLAGS) $(CFLAGS) $(OURCFLAGS) /Fo$@ $< 176 | 177 | # TARGETS 178 | all: sw$(EXESUFFIX) build$(EXESUFFIX) ; 179 | 180 | sw$(EXESUFFIX): $(GAMEOBJS) $(ENGINEROOT)\$(ENGINELIB) $(AUDIOLIBROOT)\$(JFAUDIOLIB) 181 | $(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS $(LINKFLAGS) $(OURLINKFLAGS) $** $(JFAUDIOLIB_LINKFLAGS) $(OURLIBS) 182 | !if DEFINED(XAUDIO2REDIST) 183 | copy $(XAUDIO2REDIST)\bin\xaudio2_9redist.dll . 184 | !endif 185 | 186 | build$(EXESUFFIX): $(EDITOROBJS) $(ENGINEROOT)\$(ENGINELIB) $(ENGINEROOT)\$(EDITORLIB) 187 | $(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS $(LINKFLAGS) $(OURLINKFLAGS) $** $(OURLIBS) 188 | 189 | $(ENGINEROOT)\$(ENGINELIB) $(ENGINEROOT)\$(EDITORLIB): ALWAYSBUILD 190 | cd "$(@D)" 191 | $(MAKE) /nologo /f Makefile.msvc /$(MAKEFLAGS) USE_POLYMOST=$(USE_POLYMOST) USE_OPENGL=$(USE_OPENGL) USE_ASM=$(USE_ASM) RELEASE=$(RELEASE) $(@F) 192 | cd "$(MAKEDIR)" 193 | 194 | $(AUDIOLIBROOT)\$(JFAUDIOLIB): ALWAYSBUILD 195 | cd "$(@D)" 196 | $(MAKE) /nologo /f Makefile.msvc /$(MAKEFLAGS) RELEASE=$(RELEASE) $(@F) 197 | cd "$(MAKEDIR)" 198 | 199 | $(SRC)\version-auto.c: ALWAYSBUILD 200 | cmd /c tools\generateversion.cmd > $@ 201 | 202 | ALWAYSBUILD: ; 203 | 204 | # DEPENDENCIES 205 | !include Makefile.deps 206 | 207 | # PHONIES 208 | clean:: 209 | -del /q $(GAMEOBJS) $(EDITOROBJS) 210 | veryclean:: clean 211 | -del /q sw$(EXESUFFIX) build$(EXESUFFIX) 212 | 213 | clean veryclean:: 214 | cd "$(ENGINEROOT)" 215 | -$(MAKE) /nologo /f Makefile.msvc $@ 216 | cd "$(MAKEDIR)" 217 | 218 | clean:: 219 | cd "$(AUDIOLIBROOT)" 220 | -$(MAKE) /nologo /f Makefile.msvc $@ 221 | cd "$(MAKEDIR)" 222 | -------------------------------------------------------------------------------- /src/gameres.rc: -------------------------------------------------------------------------------- 1 | // Generated by ResEdit 1.6.6 2 | // Copyright (C) 2006-2015 3 | // http://www.resedit.net 4 | 5 | #include 6 | #include 7 | #include 8 | #include "gameres.h" 9 | #include "version.h" 10 | 11 | 12 | 13 | // 14 | // Bitmap resources 15 | // 16 | LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL 17 | IDB_BMP BITMAP "rsrc/game.bmp" 18 | 19 | 20 | 21 | // 22 | // Dialog resources 23 | // 24 | LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL 25 | IDD_STARTWIN DIALOGEX 20, 40, 351, 220 26 | STYLE DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_SYSMENU 27 | CAPTION "Startup" 28 | FONT 8, "MS Shell Dlg", 0, 0, 1 29 | { 30 | DEFPUSHBUTTON "&Start", IDOK, 229, 198, 55, 15, 0, WS_EX_LEFT 31 | PUSHBUTTON "&Cancel", IDCANCEL, 289, 198, 55, 15, 0, WS_EX_LEFT 32 | CONTROL "", IDC_STARTWIN_TABCTL, WC_TABCONTROL, WS_TABSTOP | WS_CLIPSIBLINGS, 87, 7, 257, 180, WS_EX_LEFT | WS_EX_CONTROLPARENT 33 | AUTOCHECKBOX "&Always show configuration on start", IDC_ALWAYSSHOW, 12, 202, 140, 8, WS_TABSTOP, WS_EX_LEFT 34 | CONTROL IDB_BMP, IDC_STATIC, WC_STATIC, SS_BITMAP, 22, 7, 43, 39, WS_EX_LEFT 35 | CTEXT "JFShadowWarrior", IDC_STARTWIN_APPTITLE, 12, 52, 65, 15, SS_CENTER, WS_EX_LEFT 36 | LTEXT "Version xxxxxxx\nDate", IDC_STARTWIN_APPVERSION, 12, 150, 65, 18, 0, WS_EX_LEFT 37 | CONTROL "Website", IDC_STARTWIN_APPLINK, WC_LINK, WS_TABSTOP, 12, 175, 65, 15, WS_EX_LEFT 38 | } 39 | 40 | 41 | 42 | LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL 43 | IDD_PAGE_CONFIG DIALOGEX 0, 0, 252, 164 44 | STYLE DS_CONTROL | DS_SHELLFONT | WS_CHILDWINDOW 45 | FONT 8, "MS Shell Dlg", 0, 0, 1 46 | { 47 | LTEXT "&Video mode:", IDC_STATIC, 7, 9, 52, 9, NOT WS_GROUP | SS_LEFT, WS_EX_LEFT 48 | COMBOBOX IDC_VMODE3D, 75, 7, 95, 99, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWNLIST, WS_EX_LEFT 49 | AUTOCHECKBOX "&Fullscreen", IDC_FULLSCREEN, 179, 8, 49, 10, WS_TABSTOP, WS_EX_LEFT 50 | LTEXT "S&ound quality:", IDC_STATIC, 7, 27, 52, 9, NOT WS_GROUP | SS_LEFT, WS_EX_LEFT 51 | COMBOBOX IDC_SOUNDQUALITY, 75, 25, 95, 99, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWNLIST, WS_EX_LEFT 52 | LTEXT "Input devices:", IDC_STATIC, 7, 45, 52, 9, WS_CHILD | WS_VISIBLE, WS_EX_LEFT 53 | AUTOCHECKBOX "Mo&use", IDC_USEMOUSE, 75, 45, 40, 8, WS_TABSTOP, WS_EX_LEFT 54 | AUTOCHECKBOX "Cont&roller", IDC_USEJOYSTICK, 115, 45, 46, 8, WS_TABSTOP, WS_EX_LEFT 55 | AUTORADIOBUTTON "Sin&gle player game", IDC_SINGLEPLAYER, 12, 80, 95, 8, WS_GROUP | WS_TABSTOP, WS_EX_LEFT 56 | AUTORADIOBUTTON "Joi&n multi-player game", IDC_JOINMULTIPLAYER, 12, 95, 95, 8, 0, WS_EX_LEFT 57 | AUTORADIOBUTTON "Hos&t multi-player game", IDC_HOSTMULTIPLAYER, 12, 125, 95, 8, 0, WS_EX_LEFT 58 | LTEXT "Host a&ddress:", IDC_STATIC, 27, 110, 70, 9, SS_LEFT, WS_EX_LEFT 59 | EDITTEXT IDC_HOSTFIELD, 82, 108, 115, 14, WS_TABSTOP | ES_MULTILINE, WS_EX_LEFT 60 | LTEXT "&Players:", IDC_STATIC, 27, 140, 30, 9, NOT WS_GROUP | SS_LEFT, WS_EX_LEFT 61 | EDITTEXT IDC_NUMPLAYERS, 62, 138, 25, 14, WS_TABSTOP | ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER, WS_EX_LEFT 62 | CONTROL "", IDC_NUMPLAYERSUD, UPDOWN_CLASS, UDS_ARROWKEYS | UDS_SETBUDDYINT, 87, 138, 11, 14, WS_EX_LEFT 63 | } 64 | 65 | 66 | 67 | LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL 68 | IDD_PAGE_GAME DIALOGEX 0, 0, 252, 164 69 | STYLE DS_CONTROL | DS_SHELLFONT | WS_CHILDWINDOW 70 | FONT 8, "MS Shell Dlg", 0, 0, 1 71 | { 72 | CONTROL "", IDC_GAMELIST, WC_LISTVIEW, LVS_REPORT | LVS_NOSORTHEADER | LVS_SHOWSELALWAYS | LVS_SINGLESEL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 252, 145 73 | LTEXT "Import game data:", IDC_STATIC, 5, 152, 100, 9, NOT WS_GROUP | SS_LEFT, WS_EX_LEFT 74 | PUSHBUTTON "C&hoose a location...", IDC_CHOOSEIMPORT, 115, 148, 75, 15, 0, WS_EX_LEFT 75 | PUSHBUTTON "&More info", IDC_IMPORTINFO, 195, 148, 55, 15, 0, WS_EX_LEFT 76 | } 77 | 78 | 79 | 80 | LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL 81 | IDD_PAGE_MESSAGES DIALOGEX 0, 0, 252, 164 82 | STYLE DS_CONTROL | DS_SHELLFONT | WS_CHILDWINDOW 83 | FONT 8, "MS Shell Dlg", 0, 0, 1 84 | { 85 | EDITTEXT IDC_MESSAGES, 0, 0, 252, 164, WS_VSCROLL | NOT WS_BORDER | NOT WS_TABSTOP | ES_MULTILINE | ES_READONLY, WS_EX_LEFT 86 | } 87 | 88 | 89 | 90 | LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL 91 | IDD_IMPORTINFO DIALOGEX 20, 40, 300, 150 92 | STYLE DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP 93 | CAPTION "More information" 94 | FONT 8, "MS Shell Dlg", 0, 0, 1 95 | { 96 | DEFPUSHBUTTON "&Close", IDOK, 240, 130, 55, 15, 0, WS_EX_LEFT 97 | PUSHBUTTON "&Download Shareware", IDCONTINUE, 5, 130, 80, 15, 0, WS_EX_LEFT 98 | LTEXT "", IDC_IMPORTINFO_HEADER, 12, 12, 276, 18, 0, WS_EX_LEFT 99 | LTEXT "", IDC_IMPORTINFO_TEXT, 12, 36, 276, 92, 0, WS_EX_LEFT 100 | } 101 | 102 | 103 | 104 | LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL 105 | IDD_IMPORTSTATUS DIALOGEX 20, 40, 330, 25 106 | STYLE DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP 107 | CAPTION "Importing" 108 | FONT 8, "MS Shell Dlg", 0, 0, 1 109 | { 110 | LTEXT "Scanning:", IDC_STATIC, 7, 9, 55, 9, NOT WS_GROUP | SS_LEFT, WS_EX_LEFT 111 | LTEXT "...", IDC_IMPORTSTATUS_TEXT, 67, 9, 198, 9, NOT WS_GROUP | SS_LEFT, WS_EX_LEFT 112 | DEFPUSHBUTTON "&Cancel", IDCANCEL, 270, 5, 55, 15, 0, WS_EX_LEFT 113 | } 114 | 115 | 116 | // 117 | // Icon resources 118 | // 119 | LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL 120 | IDI_ICON ICON "rsrc/game_icon.ico" 121 | 122 | 123 | #ifdef _M_AMD64 124 | CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "rsrc/game.manifest" 125 | #else 126 | CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "rsrc/game-x86.manifest" 127 | #endif 128 | 129 | VS_VERSION_INFO VERSIONINFO 130 | FILEVERSION 0,0,0,0 131 | PRODUCTVERSION 0,0,0,0 132 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 133 | FILEFLAGS 0 134 | FILEOS VOS__WINDOWS32 135 | FILETYPE VFT_APP 136 | FILESUBTYPE VFT2_UNKNOWN 137 | { 138 | BLOCK "StringFileInfo" 139 | { 140 | BLOCK "080904e4" 141 | { 142 | VALUE "CompanyName", "http://jonof.id.au" 143 | VALUE "FileDescription", "JFShadowWarrior" 144 | VALUE "FileVersion", __DATE__ " " __TIME__ 145 | VALUE "InternalName", "sw.exe" 146 | VALUE "OriginalFilename", "sw.exe" 147 | VALUE "ProductName", "JFShadowWarrior" 148 | VALUE "ProductVersion", __DATE__ " " __TIME__ 149 | VALUE "LegalCopyright", "See GPL.TXT for terms" 150 | } 151 | } 152 | BLOCK "VarFileInfo" 153 | { 154 | VALUE "Translation", 0x809, 1252 155 | } 156 | } 157 | -------------------------------------------------------------------------------- /src/net.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | #define PACKET_TYPE_MASTER_TO_SLAVE 0 28 | #define PACKET_TYPE_SLAVE_TO_MASTER 1 29 | //#define PACKET_TYPE_PLAYER_NAME 3 30 | #define PACKET_TYPE_MESSAGE 4 31 | //#define PACKET_TYPE_GAME_INFO 8 32 | #define PACKET_TYPE_BROADCAST 17 33 | #define SERVER_GENERATED_BROADCAST 18 34 | #define PACKET_TYPE_PROXY 19 35 | 36 | #define PACKET_TYPE_NEW_GAME 30 37 | //#define PACKET_TYPE_NEW_LEVEL 31 38 | #define PACKET_TYPE_PLAYER_OPTIONS 32 39 | #define PACKET_TYPE_RTS 33 40 | #define PACKET_TYPE_DUMMY 34 41 | #define PACKET_TYPE_MENU_LEVEL_QUIT 35 42 | #define PACKET_TYPE_NAME_CHANGE 36 43 | #define PACKET_TYPE_VERSION 38 44 | 45 | #define PACKET_TYPE_NULL_PACKET 127 46 | #define PACKET_TYPE_PLAYER_READY 250 47 | #define PACKET_TYPE_DONT_USE 255 // old logoff 48 | 49 | #define BIT_CODEC TRUE 50 | #define SYNC_TEST TRUE 51 | #define MAXSYNCBYTES 16 52 | 53 | #ifdef __GNUC__ 54 | # if __GNUC__ == 4 && __GNUC_MINOR__ >= 7 55 | # define PACKED __attribute__ ((packed, gcc_struct)) 56 | # else 57 | # define PACKED __attribute__ ((packed)) 58 | # endif 59 | #else 60 | # define PACKED 61 | # ifdef _MSC_VER 62 | # pragma pack(1) 63 | # endif 64 | # ifdef __WATCOMC__ 65 | # pragma pack(push,1); 66 | # endif 67 | #endif 68 | 69 | // Slave->Master: PlayerIndex = who to send the packet to (-1 = all) 70 | // Master->Slave: PlayerIndex = who sent the packet originally 71 | typedef struct PACKED 72 | { 73 | BYTE PacketType; // first byte is always packet type 74 | BYTE PlayerIndex; 75 | } PACKET_PROXY,*PACKET_PROXYp; 76 | 77 | typedef struct PACKED 78 | { 79 | BYTE PacketType; // first byte is always packet type 80 | BYTE FirstPlayerIndex; 81 | BOOL AutoAim; 82 | BYTE Level; 83 | BYTE Episode; 84 | CHAR Skill; 85 | BYTE GameType; 86 | BOOL HurtTeammate; 87 | BOOL SpawnMarkers; 88 | BOOL TeamPlay; 89 | BYTE KillLimit; 90 | BYTE TimeLimit; 91 | BOOL Nuke; 92 | }PACKET_NEW_GAME,*PACKET_NEW_GAMEp; 93 | 94 | typedef struct PACKED 95 | { 96 | BYTE PacketType; // first byte is always packet type 97 | BOOL AutoRun; 98 | BOOL MouseAimingOn; 99 | BYTE Color; 100 | char PlayerName[32]; 101 | }PACKET_OPTIONS,*PACKET_OPTIONSp; 102 | 103 | typedef struct PACKED 104 | { 105 | BYTE PacketType; // first byte is always packet type 106 | BYTE Color; 107 | char PlayerName[32]; 108 | }PACKET_NAME_CHANGE,*PACKET_NAME_CHANGEp; 109 | 110 | typedef struct PACKED 111 | { 112 | BYTE PacketType; // first byte is always packet type 113 | BYTE RTSnum; 114 | }PACKET_RTS,*PACKET_RTSp; 115 | 116 | typedef struct PACKED 117 | { 118 | BYTE PacketType; // first byte is always packet type 119 | int Version; 120 | }PACKET_VERSION,*PACKET_VERSIONp; 121 | 122 | #undef PACKED 123 | #ifdef _MSC_VER 124 | # pragma pack() 125 | #endif 126 | #ifdef __WATCOMC__ 127 | # pragma pack(pop); 128 | #endif 129 | 130 | extern BYTE syncstat[MAXSYNCBYTES]; 131 | extern BOOL PredictionOn; 132 | extern PLAYER PredictPlayer; 133 | extern PLAYERp ppp; 134 | extern short predictangpos[MOVEFIFOSIZ]; 135 | extern int predictmovefifoplc; 136 | extern BOOL Prediction; 137 | extern short NumSyncBytes; 138 | 139 | void InitPrediction(PLAYERp pp); 140 | void DoPrediction(PLAYERp ppp); 141 | void CorrectPrediction(int actualfifoplc); 142 | 143 | //TENSW: safe packet senders 144 | void netsendpacket(int ind, BYTEp buf, int len); 145 | void netbroadcastpacket(BYTEp buf, int len); 146 | int netgetpacket(int *ind, BYTEp buf); 147 | 148 | 149 | enum MultiGameTypes 150 | { 151 | MULTI_GAME_NONE, 152 | MULTI_GAME_COMMBAT, 153 | MULTI_GAME_COMMBAT_NO_RESPAWN, // JUST a place holder for menus. DO NOT USE!!! 154 | MULTI_GAME_COOPERATIVE, 155 | MULTI_GAME_AI_BOTS 156 | }; 157 | 158 | //extern SHORT MultiGameType; // defaults to NONE 159 | 160 | // global net vars 161 | // not saved in .CFG file 162 | // used for current game 163 | typedef struct 164 | { 165 | LONG KillLimit; 166 | LONG TimeLimit; 167 | LONG TimeLimitClock; 168 | SHORT MultiGameType; // used to be a stand alone global 169 | BOOL TeamPlay; 170 | BOOL HurtTeammate; 171 | BOOL SpawnMarkers; 172 | BOOL AutoAim; 173 | BOOL NoRespawn; // for commbat type games 174 | BOOL Nuke; 175 | }gNET,*gNETp; 176 | 177 | extern gNET gNet; 178 | 179 | typedef struct 180 | { 181 | int Rules, 182 | Level, 183 | Enemy, 184 | Markers, 185 | Team, 186 | HurtTeam, 187 | Kill, 188 | Time, 189 | Color, 190 | Nuke; 191 | }AUTO_NET, *AUTO_NETp; 192 | 193 | extern AUTO_NET Auto; 194 | extern BOOL AutoNet; 195 | 196 | VOID getpackets(VOID); 197 | VOID SendMulitNameChange(char *new_name, int new_color); 198 | VOID InitNetVars(void ); 199 | VOID InitTimingVars(void ); 200 | VOID PauseAction(void ); 201 | VOID ResumeAction(void ); 202 | void ErrorCorrectionQuit(void ); 203 | void Connect(void ); 204 | void waitforeverybody(void ); 205 | BOOL MenuCommPlayerQuit(short quit_player); 206 | VOID SendVersion(int version); 207 | VOID InitNetPlayerOptions(void ); 208 | VOID CheckVersion(int GameVersion); 209 | VOID SendMessage(short pnum,char *text); 210 | void PauseGame(void ); 211 | void ResumeGame(void ); 212 | 213 | -------------------------------------------------------------------------------- /src/wallmove.c: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | #include "build.h" 27 | 28 | //#include "keys.h" 29 | #include "names2.h" 30 | //#include "panel.h" 31 | #include "game.h" 32 | #include "tags.h" 33 | #include "mathutil.h" 34 | #include "weapon.h" 35 | #include "sprite.h" 36 | 37 | //#include "ai.h" 38 | 39 | SECTOR_OBJECTp DetectSectorObjectByWall(WALLp); 40 | 41 | void SOwallmove(SECTOR_OBJECTp sop, SPRITEp sp, WALLp find_wallp, int dist, int *nx, int *ny) 42 | { 43 | int j,k,wallcount; 44 | WALLp wp; 45 | short startwall,endwall; 46 | SECTORp *sectp; 47 | 48 | if (TEST(sop->flags, SOBJ_SPRITE_OBJ)) 49 | return; 50 | 51 | wallcount = 0; 52 | for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++) 53 | { 54 | startwall = (*sectp)->wallptr; 55 | endwall = startwall + (*sectp)->wallnum - 1; 56 | 57 | // move all walls in sectors back to the original position 58 | for (wp = &wall[startwall], k = startwall; k <= endwall; wp++, k++) 59 | { 60 | // find the one wall we want to adjust 61 | if (wp == find_wallp) 62 | { 63 | short ang; 64 | // move orig x and y in saved angle 65 | ASSERT(User[sp - sprite]); 66 | ang = User[sp - sprite]->sang; 67 | 68 | *nx = ((dist * sintable[NORM_ANGLE(ang + 512)])>>14); 69 | *ny = ((dist * sintable[ang])>>14); 70 | 71 | sop->xorig[wallcount] -= *nx; 72 | sop->yorig[wallcount] -= *ny; 73 | 74 | SET(sop->flags, SOBJ_UPDATE_ONCE); 75 | return; 76 | } 77 | 78 | wallcount++; 79 | } 80 | } 81 | } 82 | 83 | int DoWallMove(SPRITEp sp) 84 | { 85 | int dist,nx,ny; 86 | short shade1,shade2,ang,picnum1,picnum2; 87 | WALLp wallp; 88 | short prev_wall; 89 | BOOL found = FALSE; 90 | short dang; 91 | BOOL SOsprite = FALSE; 92 | 93 | dist = SP_TAG13(sp); 94 | ang = SP_TAG4(sp); 95 | picnum1 = SP_TAG5(sp); 96 | picnum2 = SP_TAG6(sp); 97 | shade1 = SP_TAG7(sp); 98 | shade2 = SP_TAG8(sp); 99 | dang = ((int)SP_TAG10(sp)) << 3; 100 | 101 | if (dang) 102 | ang = NORM_ANGLE(ang + (RANDOM_RANGE(dang) - dang/2)); 103 | 104 | nx = (dist * sintable[NORM_ANGLE(ang + 512)])>>14; 105 | ny = (dist * sintable[ang])>>14; 106 | 107 | for (wallp = wall; wallp < &wall[numwalls]; wallp++) 108 | { 109 | if (wallp->x == sp->x && wallp->y == sp->y) 110 | { 111 | found = TRUE; 112 | 113 | if (TEST(wallp->extra, WALLFX_SECTOR_OBJECT)) 114 | { 115 | SECTOR_OBJECTp sop; 116 | sop = DetectSectorObjectByWall(wallp); 117 | ASSERT(sop); 118 | SOwallmove(sop, sp, wallp, dist, &nx, &ny); 119 | 120 | SOsprite = TRUE; 121 | } 122 | else 123 | { 124 | wallp->x = sp->x + nx; 125 | wallp->y = sp->y + ny; 126 | } 127 | 128 | if (shade1) 129 | wallp->shade = shade1; 130 | if (picnum1) 131 | wallp->picnum = picnum1; 132 | 133 | // find the previous wall 134 | prev_wall = PrevWall(wallp - wall); 135 | if (shade2) 136 | wall[prev_wall].shade = shade2; 137 | if (picnum2) 138 | wall[prev_wall].picnum = picnum2; 139 | } 140 | } 141 | 142 | SP_TAG9(sp)--; 143 | if ((signed char)SP_TAG9(sp) <= 0) 144 | { 145 | KillSprite(sp - sprite); 146 | } 147 | else 148 | { 149 | if (SOsprite) 150 | { 151 | // move the sprite offset from center 152 | User[sp - sprite]->sx -= nx; 153 | User[sp - sprite]->sy -= ny; 154 | } 155 | else 156 | { 157 | sp->x += nx; 158 | sp->y += ny; 159 | } 160 | } 161 | 162 | return(found); 163 | } 164 | 165 | BOOL CanSeeWallMove(SPRITEp wp, short match) 166 | { 167 | short i,nexti; 168 | BOOL found = FALSE; 169 | SPRITEp sp; 170 | 171 | TRAVERSE_SPRITE_STAT(headspritestat[STAT_WALL_MOVE_CANSEE], i, nexti) 172 | { 173 | sp = &sprite[i]; 174 | 175 | if (SP_TAG2(sp) == match) 176 | { 177 | found = TRUE; 178 | 179 | if (cansee(wp->x,wp->y,wp->z,wp->sectnum,sp->x,sp->y,sp->z,sp->sectnum)) 180 | { 181 | return(TRUE); 182 | } 183 | } 184 | } 185 | 186 | if (found) 187 | return(FALSE); 188 | else 189 | return(TRUE); 190 | } 191 | 192 | int DoWallMoveMatch(short match) 193 | { 194 | SPRITEp sp; 195 | short i,nexti; 196 | BOOL found = FALSE; 197 | 198 | // just all with the same matching tags 199 | TRAVERSE_SPRITE_STAT(headspritestat[STAT_WALL_MOVE], i, nexti) 200 | { 201 | sp = &sprite[i]; 202 | 203 | if (SP_TAG2(sp) == match) 204 | { 205 | found = TRUE; 206 | DoWallMove(sp); 207 | } 208 | } 209 | 210 | return(found); 211 | } 212 | 213 | 214 | #include "saveable.h" 215 | 216 | static saveable_code saveable_wallmove_code[] = { 217 | SAVE_CODE(DoWallMove), 218 | SAVE_CODE(CanSeeWallMove), 219 | SAVE_CODE(DoWallMoveMatch), 220 | }; 221 | 222 | saveable_module saveable_wallmove = { 223 | // code 224 | saveable_wallmove_code, 225 | SIZ(saveable_wallmove_code), 226 | 227 | // data 228 | NULL,0 229 | }; 230 | -------------------------------------------------------------------------------- /src/damage.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1997, 2005 - 3D Realms Entertainment 4 | 5 | This file is part of Shadow Warrior version 1.2 6 | 7 | Shadow Warrior is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1997 - Frank Maddin and Jim Norwood 23 | Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | #ifdef DAMAGE_TABLE 28 | #define DAMAGE_ENTRY(id, init_func, damage_lo, damage_hi, radius, max_ammo, min_ammo, with_weapon) \ 29 | { init_func, damage_lo, damage_hi, radius, max_ammo, min_ammo, with_weapon, NULL, NULL, -1, -1 }, 30 | #define DAMAGE_ENTRY_WPN(id, init_func, damage_lo, damage_hi, radius, max_ammo, min_ammo, with_weapon, weapon_name, ammo_name, weapon_pickup, ammo_pickup ) \ 31 | { init_func, damage_lo, damage_hi, radius, max_ammo, min_ammo, with_weapon, weapon_name, ammo_name, weapon_pickup, ammo_pickup }, 32 | #endif 33 | 34 | #ifdef DAMAGE_ENUM 35 | #define DAMAGE_ENTRY(id, init_func, damage_lo, damage_hi, radius, max_ammo, min_ammo, with_weapon) \ 36 | id, 37 | #define DAMAGE_ENTRY_WPN(id, init_func, damage_lo, damage_hi, radius, max_ammo, min_ammo, with_weapon, weapon_name, ammo_name, weapon_pickup, ammo_pickup ) \ 38 | id, 39 | #endif 40 | 41 | // DAMAGES //////////////////////////////////////////////////////////////////// 42 | 43 | // weapon 44 | DAMAGE_ENTRY(WPN_FIST, InitWeaponFist, 10, 40, 0, -1, -1, -1 ) 45 | DAMAGE_ENTRY_WPN(WPN_STAR, InitWeaponStar, 5, 10, 0, 99, 3, -1, "Shurikens", NULL, 9, -1 ) 46 | DAMAGE_ENTRY_WPN(WPN_SHOTGUN, InitWeaponShotgun, 4, 4, 0, 52, 1, -1, "Riot Gun", "Shotshells", 8, 24 ) 47 | DAMAGE_ENTRY_WPN(WPN_UZI, InitWeaponUzi, 5, 7, 0, 200, 1, -1, "UZI Submachine Gun", "UZI Clip", 50, 50 ) 48 | DAMAGE_ENTRY_WPN(WPN_MICRO, InitWeaponMicro, 15, 30, 0, 50, 1, -1, "Missile Launcher", "Missiles", 5, 5 ) 49 | DAMAGE_ENTRY_WPN(WPN_GRENADE, InitWeaponGrenade, 15, 30, 0, 50, 1, -1, "Grenade Launcher", "Grenade Shells", 6, 8 ) 50 | DAMAGE_ENTRY_WPN(WPN_MINE, InitWeaponMine, 5, 10, 0, 20, 1, -1, "Sticky Bombs", NULL, 5, -1 ) 51 | DAMAGE_ENTRY_WPN(WPN_RAIL, InitWeaponRail, 40, 60, 0, 20, 1, -1, "Rail Gun", "Rail Gun Rods", 10, 10 ) 52 | DAMAGE_ENTRY_WPN(WPN_HOTHEAD, InitWeaponHothead, 10, 25, 0, 80, 1, -1, "Guardian Head", "Firebursts", 30, 60 ) 53 | DAMAGE_ENTRY_WPN(WPN_HEART, InitWeaponHeart, 75, 100, 0, 5, 1, -1, "Ripper Heart", "Deathcoils", 1, 6 ) 54 | 55 | DAMAGE_ENTRY(WPN_NAPALM, InitWeaponHothead, 50, 100, 0, 100, 40, WPN_HOTHEAD ) 56 | DAMAGE_ENTRY(WPN_RING, InitWeaponHothead, 15, 50, 0, 100, 20, WPN_HOTHEAD ) 57 | DAMAGE_ENTRY(WPN_ROCKET, InitWeaponMicro, 30, 60, 0, 100, 1, WPN_MICRO ) 58 | DAMAGE_ENTRY(WPN_SWORD, InitWeaponSword, 50, 80, 0, -1, -1, -1 ) 59 | 60 | // extra weapons connected to other 61 | 62 | // spell 63 | DAMAGE_ENTRY(DMG_NAPALM, NULL, 90, 150, 0, -1, -1, -1 ) 64 | DAMAGE_ENTRY(DMG_MIRV_METEOR, NULL, 35, 65, 0, -1, -1, -1 ) 65 | DAMAGE_ENTRY(DMG_SERP_METEOR, NULL, 7, 15, 0, -1, -1, -1 ) 66 | 67 | // radius damage 68 | DAMAGE_ENTRY(DMG_ELECTRO_SHARD, NULL, 2, 6, 0, -1, -1, -1 ) 69 | DAMAGE_ENTRY(DMG_SECTOR_EXP, NULL, 50, 100, 3200, -1, -1, -1 ) 70 | DAMAGE_ENTRY(DMG_BOLT_EXP, NULL, 80, 160, 3200, -1, -1, -1 ) 71 | DAMAGE_ENTRY(DMG_TANK_SHELL_EXP, NULL, 80, 200, 4500, -1, -1, -1 ) 72 | DAMAGE_ENTRY(DMG_FIREBALL_EXP, NULL, -1, -1, 1000, -1, -1, -1 ) 73 | DAMAGE_ENTRY(DMG_NAPALM_EXP, NULL, 60, 90, 3200, -1, -1, -1 ) 74 | DAMAGE_ENTRY(DMG_SKULL_EXP, NULL, 40, 75, 4500, -1, -1, -1 ) 75 | DAMAGE_ENTRY(DMG_BASIC_EXP, NULL, 10, 25, 1000, -1, -1, -1 ) 76 | DAMAGE_ENTRY(DMG_GRENADE_EXP, NULL, 70, 140, 6500, -1, -1, -1 ) 77 | DAMAGE_ENTRY(DMG_MINE_EXP, NULL, 85, 115, 6500, -1, -1, -1 ) 78 | DAMAGE_ENTRY(DMG_MINE_SHRAP, NULL, 15, 30, 0, -1, -1, -1 ) 79 | DAMAGE_ENTRY(DMG_MICRO_EXP, NULL, 50, 100, 4500, -1, -1, -1 ) 80 | DAMAGE_ENTRY_WPN(DMG_NUCLEAR_EXP, NULL, 0, 800, 30000, -1, -1, -1, "Nuclear Warhead", "Heat Seeker Card", 1, 5 ) 81 | DAMAGE_ENTRY(DMG_RADIATION_CLOUD, NULL, 2, 6, 5000, -1, -1, -1 ) 82 | DAMAGE_ENTRY(DMG_FLASHBOMB, NULL, 100, 150, 16384, -1, -1, -1 ) 83 | 84 | DAMAGE_ENTRY(DMG_FIREBALL_FLAMES, NULL, 2, 6, 300, -1, -1, -1 ) 85 | 86 | // actor 87 | DAMAGE_ENTRY(DMG_RIPPER_SLASH, NULL, 10, 30, 0, -1, -1, -1 ) 88 | DAMAGE_ENTRY(DMG_SKEL_SLASH, NULL, 10, 20, 0, -1, -1, -1 ) 89 | DAMAGE_ENTRY(DMG_COOLG_BASH, NULL, 10, 20, 0, -1, -1, -1 ) 90 | DAMAGE_ENTRY(DMG_COOLG_FIRE, NULL, 15, 30, 0, -1, -1, -1 ) 91 | DAMAGE_ENTRY(DMG_GORO_CHOP, NULL, 20, 40, 0, -1, -1, -1 ) 92 | DAMAGE_ENTRY(DMG_GORO_FIREBALL, NULL, 5, 20, 0, -1, -1, -1 ) 93 | DAMAGE_ENTRY(DMG_SERP_SLASH, NULL, 75, 75, 0, -1, -1, -1 ) 94 | DAMAGE_ENTRY(DMG_LAVA_BOULDER, NULL, 100, 100, 0, -1, -1, -1 ) 95 | DAMAGE_ENTRY(DMG_LAVA_SHARD, NULL, 25, 25, 0, -1, -1, -1 ) 96 | DAMAGE_ENTRY(DMG_HORNET_STING, NULL, 5, 10, 0, -1, -1, -1 ) 97 | DAMAGE_ENTRY(DMG_EEL_ELECTRO, NULL, 10, 40, 3400, -1, -1, -1 ) 98 | 99 | // misc 100 | DAMAGE_ENTRY(DMG_SPEAR_TRAP, NULL, 15, 20, 0, -1, -1, -1 ) 101 | DAMAGE_ENTRY(DMG_VOMIT, NULL, 5, 15, 0, -1, -1, -1 ) 102 | 103 | // inanimate objects 104 | DAMAGE_ENTRY(DMG_BLADE, NULL, 10, 20, 0, -1, -1, -1 ) 105 | DAMAGE_ENTRY(MAX_WEAPONS, NULL, 10, 20, 0, -1, -1, -1 ) 106 | 107 | #undef DAMAGE_ENTRY 108 | #undef DAMAGE_ENTRY_WPN 109 | --------------------------------------------------------------------------------