├── .classpath ├── .cvsignore ├── .project ├── .settings ├── org.eclipse.core.resources.prefs ├── org.eclipse.jdt.core.prefs └── org.eclipse.jdt.ui.prefs ├── ChangeLog ├── Jake2.bat ├── Jake2.sh ├── Jake2_Eclipse_Setup.txt ├── LICENSE ├── README ├── README_DE ├── build.bat ├── build.sh ├── build.xml ├── info └── ent_structure.txt ├── install.xml ├── lib ├── ant │ ├── ant-launcher.jar │ └── ant.jar ├── izpack │ └── standalone-compiler.jar ├── joal │ ├── joal.jar │ ├── linux │ │ ├── libjoal_native.so │ │ └── libopenal.so │ ├── osx │ │ └── libjoal_native.jnilib │ └── windows │ │ ├── OpenAL32.dll │ │ ├── joal_native.dll │ │ └── wrap_oal.dll ├── jogl │ ├── jogl.jar │ ├── linux │ │ ├── libjogl.so │ │ └── libjogl_cg.so │ ├── osx │ │ ├── libjogl.jnilib │ │ └── libjogl_cg.jnilib │ └── windows │ │ ├── jogl.dll │ │ └── jogl_cg.dll ├── jsr231 │ ├── gluegen-rt.jar │ ├── jogl.jar │ ├── linux │ │ ├── libgluegen-rt.so │ │ ├── libjogl.so │ │ ├── libjogl_awt.so │ │ └── libjogl_cg.so │ ├── osx │ │ ├── libgluegen-rt.jnilib │ │ ├── libjogl.jnilib │ │ ├── libjogl_awt.jnilib │ │ └── libjogl_cg.jnilib │ └── windows │ │ ├── gluegen-rt.dll │ │ ├── jogl.dll │ │ ├── jogl_awt.dll │ │ └── jogl_cg.dll ├── lwjgl │ ├── linux │ │ ├── liblwjgl.so │ │ ├── liblwjgl64.so │ │ └── libopenal.so │ ├── lwjgl.jar │ ├── lwjgl_util.jar │ ├── osx │ │ ├── liblwjgl.jnilib │ │ └── openal.dylib │ ├── patch │ │ └── org │ │ │ └── lwjgl │ │ │ ├── BufferChecks.java │ │ │ └── opengl │ │ │ ├── GL11.java │ │ │ └── GLChecks.java │ └── windows │ │ ├── OpenAL32.dll │ │ └── lwjgl.dll ├── proguard │ └── proguard.jar └── xerces │ ├── xercesImpl.jar │ └── xml-apis.jar ├── readme.id ├── resources ├── icon-small.png ├── icon.png ├── mirrors └── splash.png ├── scripts ├── Jake2.bat ├── Jake2.sh ├── Jake2_dedicated.bat ├── Jake2_dedicated.sh ├── Jake2_lwjgl.bat ├── Jake2_lwjgl.sh ├── Jake2_mac.sh └── Jake2_mac_lwjgl.sh ├── shortcutSpec.xml ├── src └── jake2 │ ├── CompatibilityApplet.java │ ├── Defines.java │ ├── Globals.java │ ├── Jake2.java │ ├── Jake2Applet.java │ ├── SizeChangeListener.java │ ├── client │ ├── CL.java │ ├── CL_ents.java │ ├── CL_fx.java │ ├── CL_input.java │ ├── CL_inv.java │ ├── CL_newfx.java │ ├── CL_parse.java │ ├── CL_pred.java │ ├── CL_tent.java │ ├── CL_view.java │ ├── Console.java │ ├── Key.java │ ├── LayoutParser.java │ ├── M.java │ ├── Menu.java │ ├── SCR.java │ ├── V.java │ ├── VID.java │ ├── centity_t.java │ ├── cl_sustain_t.java │ ├── client_state_t.java │ ├── client_static_t.java │ ├── clientinfo_t.java │ ├── console_t.java │ ├── cparticle_t.java │ ├── dlight_t.java │ ├── entity_t.java │ ├── frame_t.java │ ├── kbutton_t.java │ ├── lightstyle_t.java │ ├── particle_t.java │ ├── refdef_t.java │ ├── refexport_t.java │ ├── viddef_t.java │ ├── vidmode_t.java │ └── vrect_t.java │ ├── game │ ├── AIAdapter.java │ ├── Cmd.java │ ├── EdictFindFilter.java │ ├── EdictIterator.java │ ├── EndianHandler.java │ ├── EntBlockedAdapter.java │ ├── EntDieAdapter.java │ ├── EntDodgeAdapter.java │ ├── EntInteractAdapter.java │ ├── EntPainAdapter.java │ ├── EntThinkAdapter.java │ ├── EntTouchAdapter.java │ ├── EntUseAdapter.java │ ├── GameAI.java │ ├── GameBase.java │ ├── GameChase.java │ ├── GameCombat.java │ ├── GameFunc.java │ ├── GameItemList.java │ ├── GameItems.java │ ├── GameMisc.java │ ├── GameSVCmds.java │ ├── GameSave.java │ ├── GameSpawn.java │ ├── GameTarget.java │ ├── GameTrigger.java │ ├── GameTurret.java │ ├── GameUtil.java │ ├── GameWeapon.java │ ├── Info.java │ ├── ItemDropAdapter.java │ ├── ItemUseAdapter.java │ ├── Monster.java │ ├── PlayerClient.java │ ├── PlayerHud.java │ ├── PlayerTrail.java │ ├── PlayerView.java │ ├── PlayerWeapon.java │ ├── SuperAdapter.java │ ├── client_persistant_t.java │ ├── client_respawn_t.java │ ├── cmdalias_t.java │ ├── cmodel_t.java │ ├── cplane_t.java │ ├── csurface_t.java │ ├── cvar_t.java │ ├── edict_t.java │ ├── entity_state_t.java │ ├── game_import_t.java │ ├── game_locals_t.java │ ├── gclient_t.java │ ├── gitem_armor_t.java │ ├── gitem_t.java │ ├── level_locals_t.java │ ├── link_t.java │ ├── mapsurface_t.java │ ├── mframe_t.java │ ├── mmove_t.java │ ├── monsterinfo_t.java │ ├── monsters │ │ ├── M_Actor.java │ │ ├── M_Berserk.java │ │ ├── M_Boss2.java │ │ ├── M_Boss3.java │ │ ├── M_Boss31.java │ │ ├── M_Boss32.java │ │ ├── M_Brain.java │ │ ├── M_Chick.java │ │ ├── M_Flash.java │ │ ├── M_Flipper.java │ │ ├── M_Float.java │ │ ├── M_Flyer.java │ │ ├── M_Gladiator.java │ │ ├── M_Gunner.java │ │ ├── M_Hover.java │ │ ├── M_Infantry.java │ │ ├── M_Insane.java │ │ ├── M_Medic.java │ │ ├── M_Mutant.java │ │ ├── M_Parasite.java │ │ ├── M_Player.java │ │ ├── M_Soldier.java │ │ ├── M_Supertank.java │ │ └── M_Tank.java │ ├── moveinfo_t.java │ ├── player_state_t.java │ ├── pmove_state_t.java │ ├── pmove_t.java │ ├── pushed_t.java │ ├── spawn_t.java │ ├── spawn_temp_t.java │ ├── trace_t.java │ └── usercmd_t.java │ ├── qcommon │ ├── CM.java │ ├── CRC.java │ ├── Cbuf.java │ ├── Com.java │ ├── Cvar.java │ ├── FS.java │ ├── MD4.java │ ├── MSG.java │ ├── Netchan.java │ ├── PMove.java │ ├── Q2DataDialog.java │ ├── Qcommon.java │ ├── SZ.java │ ├── cmd_function_t.java │ ├── longjmpException.java │ ├── lump_t.java │ ├── miptex_t.java │ ├── netadr_t.java │ ├── netchan_t.java │ ├── qfiles.java │ ├── sizebuf_t.java │ ├── texinfo_t.java │ └── xcommand_t.java │ ├── render │ ├── Anorms.java │ ├── Base.java │ ├── DummyRenderer.java │ ├── JoglRenderer.java │ ├── Jsr231Renderer.java │ ├── LwjglRenderer.java │ ├── Ref.java │ ├── RenderAPI.java │ ├── Renderer.java │ ├── basic │ │ ├── Draw.java │ │ ├── Image.java │ │ ├── Light.java │ │ ├── Main.java │ │ ├── Mesh.java │ │ ├── Misc.java │ │ ├── Model.java │ │ ├── Polygon.java │ │ ├── Surf.java │ │ └── Warp.java │ ├── extract_gl_functions.sh │ ├── fast │ │ ├── Draw.java │ │ ├── Image.java │ │ ├── Light.java │ │ ├── Main.java │ │ ├── Mesh.java │ │ ├── Misc.java │ │ ├── Model.java │ │ ├── Polygon.java │ │ ├── Surf.java │ │ └── Warp.java │ ├── gl_functions.txt │ ├── glconfig_t.java │ ├── glpoly_t.java │ ├── glstate_t.java │ ├── image_t.java │ ├── medge_t.java │ ├── mleaf_t.java │ ├── mmodel_t.java │ ├── mnode_t.java │ ├── model_t.java │ ├── msurface_t.java │ ├── mtexinfo_t.java │ ├── mvertex_t.java │ └── opengl │ │ ├── CountGL.java │ │ ├── DummyGL.java │ │ ├── GLDriver.java │ │ ├── JoglDriver.java │ │ ├── JoglGL.java │ │ ├── Jsr231Driver.java │ │ ├── Jsr231GL.java │ │ ├── LwjglDriver.java │ │ ├── LwjglGL.java │ │ ├── QGL.java │ │ └── QGLConst.java │ ├── server │ ├── SV.java │ ├── SV_CCMDS.java │ ├── SV_ENTS.java │ ├── SV_GAME.java │ ├── SV_INIT.java │ ├── SV_MAIN.java │ ├── SV_SEND.java │ ├── SV_USER.java │ ├── SV_WORLD.java │ ├── areanode_t.java │ ├── challenge_t.java │ ├── client_frame_t.java │ ├── client_t.java │ ├── moveclip_t.java │ ├── server_static_t.java │ └── server_t.java │ ├── sound │ ├── DummyDriver.java │ ├── S.java │ ├── Sound.java │ ├── WaveLoader.java │ ├── joal │ │ ├── Channel.java │ │ ├── JOALSoundImpl.java │ │ └── PlaySound.java │ ├── jsound │ │ ├── JSoundImpl.java │ │ ├── SND_DMA.java │ │ ├── SND_JAVA.java │ │ └── SND_MIX.java │ ├── lwjgl │ │ ├── Channel.java │ │ ├── LWJGLSoundImpl.java │ │ └── PlaySound.java │ ├── sfx_t.java │ ├── sfxcache_t.java │ ├── soundinfo_t.java │ └── wavinfo_t.java │ ├── sys │ ├── HighPrecisionTimer.java │ ├── IN.java │ ├── InputListener.java │ ├── JOGLKBD.java │ ├── Jake2InputEvent.java │ ├── KBD.java │ ├── LWJGLKBD.java │ ├── NET.java │ ├── NanoTimer.java │ ├── StandardTimer.java │ ├── Sys.java │ └── Timer.java │ └── util │ ├── Lib.java │ ├── Math3D.java │ ├── PrintfFormat.java │ ├── QuakeFile.java │ ├── Vargs.java │ └── Vec3Cache.java ├── test ├── AdapterRegister.java ├── ConvertDefines.java ├── Unpack.java └── jake2 │ ├── client │ ├── CircleListener.java │ └── GhostMouse.java │ ├── qcommon │ ├── TestCMD.java │ ├── TestCOM.java │ ├── TestCvar.java │ ├── TestINFO.java │ ├── TestLoadGame.java │ ├── TestLoadMap.java │ ├── TestMD4.java │ ├── TestMSG.java │ └── TestRotatePointAroundVector.java │ └── render │ ├── DancingQueens.java │ ├── DebugCulling.java │ ├── DisposeBuffer.java │ ├── TestMap.java │ └── TestRenderer.java └── webstart ├── .cvsignore ├── icon.gif ├── jake2_jogl11.jnlp ├── jake2_jsr231.jnlp ├── jake2_lwjgl.jnlp └── jake2_online.jnlp /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.cvsignore: -------------------------------------------------------------------------------- 1 | build 2 | baseq2 3 | dist 4 | *.tar.gz 5 | *.zip 6 | *.jar 7 | *.map 8 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | jake2 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | #Wed Oct 25 00:11:03 CEST 2006 2 | eclipse.preferences.version=1 3 | encoding/=ISO-8859-1 4 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.ui.prefs: -------------------------------------------------------------------------------- 1 | #Sun Mar 02 16:57:03 CET 2008 2 | eclipse.preferences.version=1 3 | formatter_profile=_Jake2 Conventions 4 | formatter_settings_version=11 5 | org.eclipse.jdt.ui.exception.name=e 6 | org.eclipse.jdt.ui.gettersetter.use.is=true 7 | org.eclipse.jdt.ui.ignorelowercasenames=true 8 | org.eclipse.jdt.ui.importorder=java;javax;org;com; 9 | org.eclipse.jdt.ui.javadoc=false 10 | org.eclipse.jdt.ui.keywordthis=false 11 | org.eclipse.jdt.ui.ondemandthreshold=4 12 | org.eclipse.jdt.ui.overrideannotation=true 13 | org.eclipse.jdt.ui.staticondemandthreshold=4 14 | org.eclipse.jdt.ui.text.custom_code_templates= 15 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | 0.9.5 2 | 3 | - quake video (cinematics) support including sound streaming 4 | - save games are from now on build compatible 5 | - support for arbitrary sound sample rates 6 | - dedicated server mode 7 | - lots of bugfixes 8 | 9 | 0.9.4 2005-05-26 10 | 11 | - multiplayer client and server functionality 12 | - Mac OS X support 13 | - webstart version 14 | - experimental lwjgl driver 15 | - standalone installer 16 | - online installation of Quake2 demo data files 17 | - mouse wheel support 18 | - very fast screenshot function 19 | - memory footprint reduced 20 | - bugfixes 21 | 22 | 0.9.3 2004-09-09 23 | 24 | - savegames 25 | - command line completion in console 26 | - better fullscreen vidmode selection 27 | - memory footprint reduced 28 | - improved performance 29 | - bugfixes 30 | 31 | 0.9.2 2004-06-28 32 | 33 | - joal sound 34 | - new "fastjogl" OpenGL renderer for improved performance 35 | - fullscreen support on windows 36 | - bugfixes 37 | 38 | 0.9.1 2004-05-04 39 | 40 | - use a newer jogl build that works with windows2000 41 | - minor cleanups 42 | 43 | 0.9.0 2004-04-28 44 | 45 | - initial release 46 | - what works so far: 47 | - local single player games 48 | - demos (at least we have the coolest Java benchmark out there) 49 | - console and menus 90% 50 | - todo until 1.0: 51 | - sound support 52 | - save games / load games 53 | - network games 54 | -------------------------------------------------------------------------------- /Jake2.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | REM for lwjgl 4 | REM SET LIB=lib/lwjgl/windows 5 | REM SET CP=build;resources;lib/lwjgl/lwjgl.jar;lib/lwjgl/lwjgl_util.jar 6 | 7 | REM for jogl and joal 8 | SET LIB=lib/jsr231/windows;lib/joal/windows 9 | SET CP=build;resources;lib/jsr231/jogl.jar;lib/joal/joal.jar;lib/jsr231/gluegen-rt.jar 10 | java -Xmx100M -Dsun.java2d.noddraw=true -Djava.library.path=%LIB% -cp %CP% jake2.Jake2 -------------------------------------------------------------------------------- /Jake2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd `dirname $0` 4 | 5 | # for lwjgl 6 | #LIB=lib/lwjgl/linux 7 | #CP=build:resources:lib/lwjgl/lwjgl.jar:lib/lwjgl/lwjgl_util.jar 8 | 9 | # for jogl and joal 10 | LIB=lib/jsr231/linux:lib/joal/linux 11 | CP=build:resources:lib/jsr231/jogl.jar:lib/joal/joal.jar:lib/jsr231/gluegen-rt.jar 12 | 13 | exec java -Xmx100M -Djava.library.path=$LIB -cp $CP jake2.Jake2 $* 14 | -------------------------------------------------------------------------------- /Jake2_Eclipse_Setup.txt: -------------------------------------------------------------------------------- 1 | 1. CVS checkout 2 | 3 | - switch to CVS perspective 4 | - create a new CVS repository with the following parameters: 5 | host: jake2.cvs.sourceforge.net 6 | repository path: /cvsroot/jake2 7 | user: anonymous 8 | password: 9 | connection type: pserver 10 | - browse the repository structure 11 | - rightclick "jake2" below the HEAD entry and choose "Checkout As.." 12 | - confirm the following dialog with "Finish" 13 | 14 | 2. Choose the right JDK 15 | 16 | - switch to Java perspective 17 | - go to Window -> Preferences -> Java -> Installed JREs 18 | - select a JDK1.5 or newer 19 | 20 | 3. Project settings 21 | 22 | - switch to Java perspective 23 | - go to Project->Properties->Java Compiler and select: 24 | - use project settings 25 | - Compliance and Classfiles: 26 | Compiler compliance level: 1.4 27 | Generated .class files compatibility: 1.4 28 | Source compatibility: 1.4 29 | - confirm with OK 30 | - Jake2 should compile now without errors. The warnings can be safely 31 | ignored. 32 | 33 | 4. Running and debugging 34 | 35 | - switch to Java perspective 36 | - right click the file src/jake2/Jake2.java in Package Exlorer 37 | - select Run -> Run... 38 | - choose Java Application; press "New" button 39 | - Arguments tab: 40 | VM arguments: "-Xmx80M -Dsun.java2d.noddraw=true 41 | -Djava.library.path=lib/jogl/windows;lib/joal/windows;lib/lwjgl/windows" 42 | 43 | replace "windows" with "linux" or "osx" and ";" with ":" on linux and 44 | OS X platforms 45 | 46 | - choose Run to test your brand new Jake2 build 47 | 48 | 5. Distribution builds 49 | 50 | - switch to Java perspective 51 | - right click the file build.xm in the project root 52 | - choose Run -> Ant build... 53 | - Tagets tab: 54 | uncheck "usage" target 55 | select "distclean" and "installer" target in that order 56 | - Refresh tab: 57 | select "Refresh resources upon completion" 58 | - "Run" to build the Jake2 installer jake2-cvs-install.jar in 59 | project root dir 60 | 61 | 6. Keep up to date 62 | 63 | - right click project root folder jake2 64 | - select Team -> Update to get latest chages from CVS 65 | - if you have local changes, you want to commit into the Jake2 source tree 66 | select Team -> Create Patch... and send us the patchfile 67 | 68 | 69 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Jake2 README 2 | ============ 3 | 4 | Jake2 is a port of the GPL'd Quake2 engine from id Software to Java. Jake2 is 5 | distributed under the terms of the GPL (see LICENSE). 6 | 7 | The port was done completely in Java. No native libraries are used for the 8 | game functionality. We use the jogl Java OpenGL bindings for graphics rendering 9 | and Java OpenAL (joal) for sound. Since 0.9.4 release, Jake2 comes with an lwjgl driver 10 | as an alternative for the jogl/joal combination. 11 | 12 | Jake2 is still under development. Send bug reports and feedback to 13 | jake2@bytonic.de. 14 | 15 | Currently Jake2 supports Linux, Windows2000/XP and Mac OS X. The Jake2 dedicated 16 | server runs on every Java supported plattform. 17 | 18 | requirements: 19 | 400 MHz CPU 20 | Geforce2 MX or better graphics accelerator 21 | at least JRE 1.4 to run Jake2 22 | at least JDK 1.5 to build Jake2 from source 23 | 24 | Installation 25 | ------------ 26 | 27 | from binary distribution: 28 | - run the installer with "java -jar Jake2-0.9.5-install.jar" 29 | - follow the instructions 30 | - change to the installation directory 31 | - run the game with Jake2.sh or Jake2.bat 32 | - to run Jake2 with the lwjgl OpenGL/OpenAL driver use Jake2_lwjgl.sh 33 | or Jake2_lwjgl.bat 34 | 35 | build from source: 36 | - unpack jake2src-version.tar.gz or jake2-version.zip 37 | - set JAVA_HOME environment variable to Your JDK1.5 installation 38 | - run "build.sh installer" or "build.bat installer" to build the installer 39 | 40 | installation of Quake2 data: 41 | - if Jake2 does not detect the Quake2 files on startup you have the choice 42 | to select a baseq2 directory of a Quake2 installation (demo or full version) 43 | or to download and install the Quake2 demo files 44 | 45 | If you want to have the latest experimental features you can grab the latest 46 | Jake2 sources from CVS. 47 | - "cvs -d:pserver:anonymous@jake2.cvs.sourceforge.net:/cvsroot/jake2 login" 48 | - when askesd for password simply press the Enter key 49 | - "cvs -d:pserver:anonymous@jake2.cvs.sourceforge.net:/cvsroot/jake2 co jake2" 50 | - proceed with the build from source instructions 51 | 52 | 3rd party components 53 | -------------------- 54 | 55 | Jake2 uses: 56 | jogl OpenGL bindings https://jogl.dev.java.net 57 | joal OpenAL bindings https://joal.dev.java.net 58 | lwjgl Light Weight Java Game Library http://www.lwjgl.org 59 | openal Audio library http://www.openal.org 60 | izpack Installer http://www.izforge.com/ 61 | 62 | the source distribution comes with: 63 | ant build tool http://ant.apache.org 64 | xerces XML library http://xml.apache.org 65 | 66 | Use for bug reports and feedback. 67 | 68 | have fun! 69 | 70 | bytonic Software 71 | ---------------- 72 | Holger Zickner 73 | Carsten Weisse 74 | Rene Stoeckel 75 | 76 | Contributors 77 | ------------ 78 | David Sanders lwjgl support 79 | -------------------------------------------------------------------------------- /README_DE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/README_DE -------------------------------------------------------------------------------- /build.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set CP=lib/ant/ant.jar;lib/ant/ant-launcher.jar 4 | set CP=%CP%;lib/xerces/xercesImpl.jar;lib/xerces/xml-apis.jar 5 | set CP=%CP%;lib/proguard/proguard.jar 6 | set CP=%CP%;%JAVA_HOME%/lib/tools.jar 7 | 8 | java -Dant.home=lib/ant -cp %CP% org.apache.tools.ant.Main -buildfile build.xml %1 %2 %3 %4 -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | CP=lib/ant/ant.jar:lib/ant/ant-launcher.jar 4 | CP=$CP:lib/xerces/xercesImpl.jar:lib/xerces/xml-apis.jar 5 | CP=$CP:lib/proguard/proguard.jar 6 | CP=$CP:$JAVA_HOME/lib/tools.jar 7 | 8 | java -Dant.home=lib/ant -cp $CP org.apache.tools.ant.Main -buildfile build.xml $@ -------------------------------------------------------------------------------- /lib/ant/ant-launcher.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/ant/ant-launcher.jar -------------------------------------------------------------------------------- /lib/ant/ant.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/ant/ant.jar -------------------------------------------------------------------------------- /lib/izpack/standalone-compiler.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/izpack/standalone-compiler.jar -------------------------------------------------------------------------------- /lib/joal/joal.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/joal/joal.jar -------------------------------------------------------------------------------- /lib/joal/linux/libjoal_native.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/joal/linux/libjoal_native.so -------------------------------------------------------------------------------- /lib/joal/linux/libopenal.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/joal/linux/libopenal.so -------------------------------------------------------------------------------- /lib/joal/osx/libjoal_native.jnilib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/joal/osx/libjoal_native.jnilib -------------------------------------------------------------------------------- /lib/joal/windows/OpenAL32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/joal/windows/OpenAL32.dll -------------------------------------------------------------------------------- /lib/joal/windows/joal_native.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/joal/windows/joal_native.dll -------------------------------------------------------------------------------- /lib/joal/windows/wrap_oal.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/joal/windows/wrap_oal.dll -------------------------------------------------------------------------------- /lib/jogl/jogl.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/jogl/jogl.jar -------------------------------------------------------------------------------- /lib/jogl/linux/libjogl.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/jogl/linux/libjogl.so -------------------------------------------------------------------------------- /lib/jogl/linux/libjogl_cg.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/jogl/linux/libjogl_cg.so -------------------------------------------------------------------------------- /lib/jogl/osx/libjogl.jnilib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/jogl/osx/libjogl.jnilib -------------------------------------------------------------------------------- /lib/jogl/osx/libjogl_cg.jnilib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/jogl/osx/libjogl_cg.jnilib -------------------------------------------------------------------------------- /lib/jogl/windows/jogl.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/jogl/windows/jogl.dll -------------------------------------------------------------------------------- /lib/jogl/windows/jogl_cg.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/jogl/windows/jogl_cg.dll -------------------------------------------------------------------------------- /lib/jsr231/gluegen-rt.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/jsr231/gluegen-rt.jar -------------------------------------------------------------------------------- /lib/jsr231/jogl.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/jsr231/jogl.jar -------------------------------------------------------------------------------- /lib/jsr231/linux/libgluegen-rt.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/jsr231/linux/libgluegen-rt.so -------------------------------------------------------------------------------- /lib/jsr231/linux/libjogl.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/jsr231/linux/libjogl.so -------------------------------------------------------------------------------- /lib/jsr231/linux/libjogl_awt.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/jsr231/linux/libjogl_awt.so -------------------------------------------------------------------------------- /lib/jsr231/linux/libjogl_cg.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/jsr231/linux/libjogl_cg.so -------------------------------------------------------------------------------- /lib/jsr231/osx/libgluegen-rt.jnilib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/jsr231/osx/libgluegen-rt.jnilib -------------------------------------------------------------------------------- /lib/jsr231/osx/libjogl.jnilib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/jsr231/osx/libjogl.jnilib -------------------------------------------------------------------------------- /lib/jsr231/osx/libjogl_awt.jnilib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/jsr231/osx/libjogl_awt.jnilib -------------------------------------------------------------------------------- /lib/jsr231/osx/libjogl_cg.jnilib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/jsr231/osx/libjogl_cg.jnilib -------------------------------------------------------------------------------- /lib/jsr231/windows/gluegen-rt.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/jsr231/windows/gluegen-rt.dll -------------------------------------------------------------------------------- /lib/jsr231/windows/jogl.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/jsr231/windows/jogl.dll -------------------------------------------------------------------------------- /lib/jsr231/windows/jogl_awt.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/jsr231/windows/jogl_awt.dll -------------------------------------------------------------------------------- /lib/jsr231/windows/jogl_cg.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/jsr231/windows/jogl_cg.dll -------------------------------------------------------------------------------- /lib/lwjgl/linux/liblwjgl.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/lwjgl/linux/liblwjgl.so -------------------------------------------------------------------------------- /lib/lwjgl/linux/liblwjgl64.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/lwjgl/linux/liblwjgl64.so -------------------------------------------------------------------------------- /lib/lwjgl/linux/libopenal.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/lwjgl/linux/libopenal.so -------------------------------------------------------------------------------- /lib/lwjgl/lwjgl.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/lwjgl/lwjgl.jar -------------------------------------------------------------------------------- /lib/lwjgl/lwjgl_util.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/lwjgl/lwjgl_util.jar -------------------------------------------------------------------------------- /lib/lwjgl/osx/liblwjgl.jnilib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/lwjgl/osx/liblwjgl.jnilib -------------------------------------------------------------------------------- /lib/lwjgl/osx/openal.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/lwjgl/osx/openal.dylib -------------------------------------------------------------------------------- /lib/lwjgl/windows/OpenAL32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/lwjgl/windows/OpenAL32.dll -------------------------------------------------------------------------------- /lib/lwjgl/windows/lwjgl.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/lwjgl/windows/lwjgl.dll -------------------------------------------------------------------------------- /lib/proguard/proguard.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/proguard/proguard.jar -------------------------------------------------------------------------------- /lib/xerces/xercesImpl.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/xerces/xercesImpl.jar -------------------------------------------------------------------------------- /lib/xerces/xml-apis.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/lib/xerces/xml-apis.jar -------------------------------------------------------------------------------- /readme.id: -------------------------------------------------------------------------------- 1 | 2 | This is the complete source code for Quake 2, version 3.21, buildable with 3 | visual C++ 6.0. The linux version should be buildable, but we haven't 4 | tested it for the release. 5 | 6 | The code is all licensed under the terms of the GPL (gnu public license). 7 | You should read the entire license, but the gist of it is that you can do 8 | anything you want with the code, including sell your new version. The catch 9 | is that if you distribute new binary versions, you are required to make the 10 | entire source code available for free to everyone. 11 | 12 | The primary intent of this release is for entertainment and educational 13 | purposes, but the GPL does allow commercial exploitation if you obey the 14 | full license. If you want to do something commercial and you just can't bear 15 | to have your source changes released, we could still negotiate a separate 16 | license agreement (for $$$), but I would encourage you to just live with the 17 | GPL. 18 | 19 | All of the Q2 data files remain copyrighted and licensed under the 20 | original terms, so you cannot redistribute data from the original game, but if 21 | you do a true total conversion, you can create a standalone game based on 22 | this code. 23 | 24 | Thanks to Robert Duffy for doing the grunt work of building this release. 25 | 26 | John Carmack 27 | Id Software 28 | 29 | 30 | -------------------------------------------------------------------------------- /resources/icon-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/resources/icon-small.png -------------------------------------------------------------------------------- /resources/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/resources/icon.png -------------------------------------------------------------------------------- /resources/mirrors: -------------------------------------------------------------------------------- 1 | FTP DE ftp.fu-berlin.de 2 | ftp://ftp.fu-berlin.de/pc/msdos/games/idgames/idstuff/quake2/q2-314-demo-x86.exe 3 | FTP DE ftp.cs.tu-berlin.de 4 | ftp://ftp.cs.tu-berlin.de/pub/msdos/mirrors/ftp.idsoftware.com/quake2/q2-314-demo-x86.exe 5 | FTP UK ftp.demon.co.uk 6 | ftp://ftp.demon.co.uk/pub/mirrors/idsoftware/quake2/q2-314-demo-x86.exe 7 | FTP SE ftp.fragzone.se 8 | ftp://ftp.fragzone.se/pub/spel/quake2/q2-314-demo-x86.exe 9 | FTP US ftp.idsoftware.com 10 | ftp://ftp.idsoftware.com/idstuff/quake2/q2-314-demo-x86.exe 11 | FTP US ftp.gamers.org 12 | ftp://ftp.gamers.org/pub/games/idgames2/idstuff/quake2/q2-314-demo-x86.exe -------------------------------------------------------------------------------- /resources/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/resources/splash.png -------------------------------------------------------------------------------- /scripts/Jake2.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | SET PATH=lib\windows;%PATH% 3 | SET CP=lib/jake2.jar;lib/jogl.jar;lib/joal.jar;lib/gluegen-rt.jar 4 | start javaw -Xmx100M -Dsun.java2d.noddraw=true -Djava.library.path=lib/windows -cp %CP% jake2.Jake2 -------------------------------------------------------------------------------- /scripts/Jake2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd `dirname $0` 4 | 5 | export LD_LIBRARY_PATH=lib/linux 6 | CP=lib/jake2.jar:lib/jogl.jar:lib/joal.jar:lib/gluegen-rt.jar 7 | 8 | exec java -Xmx100M -Djava.library.path=lib/linux -cp $CP jake2.Jake2 9 | -------------------------------------------------------------------------------- /scripts/Jake2_dedicated.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | SET CP=lib/jake2.jar 3 | java -Xmx64M -cp %CP% jake2.Jake2 +set dedicated 1 -------------------------------------------------------------------------------- /scripts/Jake2_dedicated.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd `dirname $0` 4 | 5 | CP=lib/jake2.jar 6 | 7 | exec java -Xmx64M -cp $CP jake2.Jake2 +set dedicated 1 8 | -------------------------------------------------------------------------------- /scripts/Jake2_lwjgl.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | SET PATH=lib\windows;%PATH% 3 | SET CP=lib/jake2.jar;lib/lwjgl.jar;lib/lwjgl_util.jar 4 | start javaw -Xmx100M -Dsun.java2d.noddraw=true -Djava.library.path=lib/windows/lwjgl -cp %CP% jake2.Jake2 -------------------------------------------------------------------------------- /scripts/Jake2_lwjgl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd `dirname $0` 4 | 5 | export LD_LIBRARY_PATH=lib/linux/lwjgl 6 | CP=lib/jake2.jar:lib/lwjgl.jar:lib/lwjgl_util.jar 7 | 8 | exec java -Xmx100M -Djava.library.path=lib/linux/lwjgl -cp $CP jake2.Jake2 9 | -------------------------------------------------------------------------------- /scripts/Jake2_mac.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export LD_LIBRARY_PATH=lib/osx 4 | export DYLD_LIBRARY_PATH=lib/osx 5 | CP=lib/jake2.jar:lib/jogl.jar:lib/joal.jar:lib/gluegen-rt.jar 6 | 7 | exec java -Xmx100M -Djava.library.path=lib/osx -cp $CP jake2.Jake2 8 | -------------------------------------------------------------------------------- /scripts/Jake2_mac_lwjgl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export LD_LIBRARY_PATH=lib/osx/lwjgl 4 | export DYLD_LIBRARY_PATH=lib/osx/lwjgl 5 | CP=lib/jake2.jar:lib/lwjgl.jar:lib/lwjgl_util.jar 6 | 7 | exec java -Xmx100M -Djava.library.path=lib/osx/lwjgl -cp $CP jake2.Jake2 8 | -------------------------------------------------------------------------------- /shortcutSpec.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 20 | 21 | 22 | 23 | 24 | 25 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/jake2/Jake2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Jake2.java 3 | * Copyright (C) 2003 4 | * 5 | * $Id: Jake2.java,v 1.9 2005-12-03 19:43:15 salomo Exp $ 6 | */ 7 | /* 8 | Copyright (C) 1997-2001 Id Software, Inc. 9 | 10 | This program 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 | */ 26 | package jake2; 27 | 28 | import jake2.qcommon.*; 29 | import jake2.sys.Timer; 30 | 31 | import java.util.Locale; 32 | 33 | /** 34 | * Jake2 is the main class of Quake2 for Java. 35 | */ 36 | public final class Jake2 { 37 | 38 | public static Q2DataDialog Q2Dialog; 39 | 40 | /** 41 | * main is used to start the game. Quake2 for Java supports the following 42 | * command line arguments: 43 | * 44 | * @param args 45 | */ 46 | public static void main(String[] args) { 47 | 48 | boolean dedicated = false; 49 | 50 | // check if we are in dedicated mode to hide the java dialog. 51 | for (int n = 0; n < args.length; n++) 52 | { 53 | if (args[n].equals("+set")) 54 | { 55 | if (n++ >= args.length) 56 | break; 57 | 58 | if (!args[n].equals("dedicated")) 59 | continue; 60 | 61 | if (n++ >= args.length) 62 | break; 63 | 64 | if (args[n].equals("1") || args[n].equals("\"1\"")) 65 | { 66 | Com.Printf("Starting in dedicated mode.\n"); 67 | dedicated = true; 68 | } 69 | } 70 | } 71 | 72 | // TODO: check if dedicated is set in config file 73 | 74 | Globals.dedicated= Cvar.Get("dedicated", "0", Qcommon.CVAR_NOSET); 75 | 76 | if (dedicated) 77 | Globals.dedicated.value = 1.0f; 78 | 79 | 80 | // open the q2dialog, if we are not in dedicated mode. 81 | if (Globals.dedicated.value != 1.0f) 82 | { 83 | Q2Dialog = new Q2DataDialog(); 84 | Locale.setDefault(Locale.US); 85 | Q2Dialog.setVisible(true); 86 | } 87 | 88 | // in C the first arg is the filename 89 | int argc = (args == null) ? 1 : args.length + 1; 90 | String[] c_args = new String[argc]; 91 | c_args[0] = "Jake2"; 92 | if (argc > 1) { 93 | System.arraycopy(args, 0, c_args, 1, argc - 1); 94 | } 95 | Qcommon.Init(c_args); 96 | 97 | Globals.nostdout = Cvar.Get("nostdout", "0", 0); 98 | 99 | int oldtime = Timer.Milliseconds(); 100 | int newtime; 101 | int time; 102 | while (true) { 103 | // find time spending rendering last frame 104 | newtime = Timer.Milliseconds(); 105 | time = newtime - oldtime; 106 | 107 | if (time > 0) 108 | Qcommon.Frame(time); 109 | oldtime = newtime; 110 | } 111 | } 112 | } -------------------------------------------------------------------------------- /src/jake2/SizeChangeListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SizeChangeListener.java 3 | * Copyright (C) 2008 4 | * 5 | * $Id: SizeChangeListener.java,v 1.1 2008-03-02 20:21:13 kbrussel Exp $ 6 | */ 7 | 8 | package jake2; 9 | 10 | /** Provides a callback when the user changes the video mode of the 11 | game. */ 12 | 13 | public interface SizeChangeListener { 14 | public void sizeChanged(int width, int height); 15 | } 16 | -------------------------------------------------------------------------------- /src/jake2/client/centity_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 27.11.2003 by RST. 22 | // $Id: centity_t.java,v 1.2 2004-07-08 20:56:50 hzi Exp $ 23 | 24 | package jake2.client; 25 | 26 | import jake2.game.entity_state_t; 27 | 28 | public class centity_t { 29 | entity_state_t baseline= new entity_state_t(null); // delta from this if not from a previous frame 30 | public entity_state_t current= new entity_state_t(null); 31 | entity_state_t prev= new entity_state_t(null); // will always be valid, but might just be a copy of current 32 | 33 | int serverframe; // if not current, this ent isn't in the frame 34 | 35 | int trailcount; // for diminishing grenade trails 36 | float[] lerp_origin = { 0, 0, 0 }; // for trails (variable hz) 37 | 38 | int fly_stoptime; 39 | } 40 | -------------------------------------------------------------------------------- /src/jake2/client/cl_sustain_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | * cl_sustain_t.java 3 | * Copyright (C) 2004 4 | * 5 | * $Id: cl_sustain_t.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ 6 | */ 7 | /* 8 | Copyright (C) 1997-2001 Id Software, Inc. 9 | 10 | This program 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 | */ 26 | package jake2.client; 27 | 28 | /** 29 | * cl_sustain_t 30 | */ 31 | public class cl_sustain_t { 32 | static abstract class ThinkAdapter { 33 | abstract void think(cl_sustain_t self); 34 | } 35 | 36 | int id; 37 | int type; 38 | int endtime; 39 | int nextthink; 40 | int thinkinterval; 41 | float[] org = new float[3]; 42 | float[] dir = new float[3]; 43 | int color; 44 | int count; 45 | int magnitude; 46 | 47 | ThinkAdapter think; 48 | 49 | void clear() { 50 | org[0] = org[1] = org[2] = 51 | dir[0] = dir[1] = dir[2] = 52 | id = type = endtime = nextthink = thinkinterval = color = count = magnitude = 0; 53 | think = null; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/jake2/client/client_static_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 27.11.2003 by RST. 22 | // $Id: client_static_t.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ 23 | 24 | 25 | package jake2.client; 26 | 27 | import jake2.qcommon.netchan_t; 28 | import java.io.*; 29 | 30 | public class client_static_t { 31 | 32 | // was enum connstate_t 33 | public int state; 34 | 35 | // was enum keydest_t 36 | public int key_dest; 37 | 38 | public int framecount; 39 | public int realtime; // always increasing, no clamping, etc 40 | public float frametime; // seconds since last frame 41 | 42 | // screen rendering information 43 | public float disable_screen; // showing loading plaque between levels 44 | // or changing rendering dlls 45 | // if time gets > 30 seconds ahead, break it 46 | public int disable_servercount; // when we receive a frame and cl.servercount 47 | // > cls.disable_servercount, clear disable_screen 48 | 49 | // connection information 50 | public String servername = ""; // name of server from original connect 51 | public float connect_time; // for connection retransmits 52 | 53 | int quakePort; // a 16 bit value that allows quake servers 54 | // to work around address translating routers 55 | public netchan_t netchan = new netchan_t(); 56 | public int serverProtocol; // in case we are doing some kind of version hack 57 | 58 | public int challenge; // from the server to use for connecting 59 | 60 | public RandomAccessFile download; // file transfer from server 61 | public String downloadtempname=""; 62 | public String downloadname=""; 63 | public int downloadnumber; 64 | // was enum dltype_t 65 | public int downloadtype; 66 | public int downloadpercent; 67 | 68 | // demo recording info must be here, so it isn't cleared on level change 69 | public boolean demorecording; 70 | public boolean demowaiting; // don't record until a non-delta message is received 71 | public RandomAccessFile demofile; 72 | } 73 | -------------------------------------------------------------------------------- /src/jake2/client/clientinfo_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 28.11.2003 by RST. 22 | //$Id: clientinfo_t.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ 23 | 24 | package jake2.client; 25 | 26 | import jake2.*; 27 | import jake2.render.*; 28 | 29 | public class clientinfo_t { 30 | String name =""; 31 | String cinfo =""; 32 | image_t skin; // ptr 33 | image_t icon; // ptr 34 | String iconname =""; 35 | model_t model; // ptr 36 | model_t weaponmodel[] = new model_t[Defines.MAX_CLIENTWEAPONMODELS]; // arary of references 37 | 38 | // public void reset() 39 | // { 40 | // set(new clientinfo_t()); 41 | // } 42 | 43 | public void set (clientinfo_t from) 44 | { 45 | name = from.name; 46 | cinfo = from.cinfo; 47 | skin = from.skin; 48 | icon = from.icon; 49 | iconname = from.iconname; 50 | model = from.model; 51 | System.arraycopy(from.weaponmodel,0, weaponmodel, 0 , Defines.MAX_CLIENTWEAPONMODELS); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/jake2/client/console_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | * console_t.java 3 | * Copyright (C) 2003 4 | * 5 | * $Id: console_t.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ 6 | */ 7 | /* 8 | Copyright (C) 1997-2001 Id Software, Inc. 9 | 10 | This program 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 | */ 26 | package jake2.client; 27 | 28 | import jake2.Defines; 29 | 30 | /** 31 | * console_t 32 | */ 33 | public final class console_t { 34 | boolean initialized; 35 | byte[] text = new byte[Defines.CON_TEXTSIZE]; 36 | int current; // line where next message will be printed 37 | int x; // offset in current line for next print 38 | int display; // bottom of console displays this line 39 | 40 | int ormask; // high bit mask for colored characters 41 | 42 | int linewidth; // characters across screen 43 | int totallines; // total lines in console scrollback 44 | 45 | float cursorspeed; 46 | 47 | int vislines; 48 | 49 | float[] times = new float[Defines.NUM_CON_TIMES]; // cls.realtime time the line was generated 50 | // for transparent notify lines 51 | } 52 | -------------------------------------------------------------------------------- /src/jake2/client/cparticle_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | * cparticle_t.java 3 | * Copyright (C) 2003 4 | * 5 | * $Id: cparticle_t.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ 6 | */ 7 | /* 8 | Copyright (C) 1997-2001 Id Software, Inc. 9 | 10 | This program 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 | */ 26 | package jake2.client; 27 | 28 | /** 29 | * cparticle_t 30 | * 31 | * @author cwei 32 | */ 33 | public class cparticle_t { 34 | 35 | public cparticle_t next; 36 | public float time; 37 | 38 | public float[] org = {0, 0, 0}; // vec3_t 39 | public float[] vel = {0, 0, 0}; // vec3_t 40 | public float[] accel = {0, 0, 0}; // vec3_t 41 | 42 | public float color; 43 | //public float colorvel; 44 | public float alpha; 45 | public float alphavel; 46 | } 47 | -------------------------------------------------------------------------------- /src/jake2/client/dlight_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 20.11.2003 by RST. 22 | // $Id: dlight_t.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ 23 | 24 | package jake2.client; 25 | 26 | public class dlight_t 27 | { 28 | public float origin[] = { 0, 0, 0 }; 29 | public float color[] = { 0, 0, 0 }; 30 | public float intensity; 31 | } 32 | -------------------------------------------------------------------------------- /src/jake2/client/entity_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 20.11.2003 by RST. 22 | // $Id: entity_t.java,v 1.2 2005-01-16 13:56:49 cawe Exp $ 23 | 24 | package jake2.client; 25 | 26 | import jake2.render.*; 27 | import jake2.util.Math3D; 28 | 29 | // ok! 30 | public class entity_t implements Cloneable{ 31 | //ptr 32 | public model_t model; // opaque type outside refresh 33 | public float angles[] = { 0, 0, 0 }; 34 | 35 | /* 36 | ** most recent data 37 | */ 38 | public float origin[] = { 0, 0, 0 }; // also used as RF_BEAM's "from" 39 | public int frame; // also used as RF_BEAM's diameter 40 | 41 | /* 42 | ** previous data for lerping 43 | */ 44 | public float oldorigin[] = { 0, 0, 0 }; // also used as RF_BEAM's "to" 45 | public int oldframe; 46 | 47 | /* 48 | ** misc 49 | */ 50 | public float backlerp; // 0.0 = current, 1.0 = old 51 | public int skinnum; // also used as RF_BEAM's palette index 52 | 53 | public int lightstyle; // for flashing entities 54 | public float alpha; // ignore if RF_TRANSLUCENT isn't set 55 | 56 | // reference 57 | public image_t skin; // NULL for inline skin 58 | public int flags; 59 | 60 | 61 | public void set(entity_t src) { 62 | this.model = src.model; 63 | Math3D.VectorCopy(src.angles, this.angles); 64 | Math3D.VectorCopy(src.origin, this.origin); 65 | this.frame = src.frame; 66 | Math3D.VectorCopy(src.oldorigin, this.oldorigin); 67 | this.oldframe = src.oldframe; 68 | this.backlerp = src.backlerp; 69 | this.skinnum = src.skinnum; 70 | this.lightstyle = src.lightstyle; 71 | this.alpha = src.alpha; 72 | this.skin = src.skin; 73 | this.flags = src.flags; 74 | } 75 | 76 | public void clear() { 77 | model = null; 78 | Math3D.VectorClear(angles); 79 | Math3D.VectorClear(origin); 80 | frame = 0; 81 | Math3D.VectorClear(oldorigin); 82 | oldframe = 0; 83 | backlerp = 0; 84 | skinnum = 0; 85 | lightstyle = 0; 86 | alpha = 0; 87 | skin = null; 88 | flags = 0; 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /src/jake2/client/frame_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 27.11.2003 by RST. 22 | // $Id: frame_t.java,v 1.3 2004-07-09 06:50:50 hzi Exp $ 23 | 24 | package jake2.client; 25 | 26 | import jake2.game.player_state_t; 27 | 28 | import java.util.Arrays; 29 | 30 | public class frame_t { 31 | 32 | public static final int MAX_MAP_AREAS = 256; 33 | 34 | boolean valid; // cleared if delta parsing was invalid 35 | int serverframe; 36 | public int servertime; // server time the message is valid for (in msec) 37 | int deltaframe; 38 | byte areabits[] = new byte [MAX_MAP_AREAS/8]; // portalarea visibility bits 39 | public player_state_t playerstate = new player_state_t(); // mem 40 | public int num_entities; 41 | public int parse_entities; // non-masked index into cl_parse_entities array 42 | 43 | public void set(frame_t from) { 44 | valid = from.valid; 45 | serverframe = from.serverframe; 46 | deltaframe = from.deltaframe; 47 | num_entities = from.num_entities; 48 | parse_entities = from.parse_entities; 49 | System.arraycopy(from.areabits, 0, areabits, 0, areabits.length); 50 | playerstate.set(from.playerstate); 51 | } 52 | 53 | public void reset() 54 | { 55 | valid = false; 56 | serverframe = servertime = deltaframe = 0; 57 | Arrays.fill(areabits, (byte)0); 58 | playerstate.clear(); 59 | num_entities = parse_entities = 0; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/jake2/client/kbutton_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | * kbutton_t.java 3 | * Copyright (C) 2004 4 | * 5 | * $Id: kbutton_t.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ 6 | */ 7 | /* 8 | Copyright (C) 1997-2001 Id Software, Inc. 9 | 10 | This program 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 | */ 26 | package jake2.client; 27 | 28 | /** 29 | * kbutton_t 30 | */ 31 | public class kbutton_t { 32 | int[] down = new int[2]; // key nums holding it down 33 | long downtime; // msec timestamp 34 | long msec; // msec down this frame 35 | public int state; 36 | } 37 | -------------------------------------------------------------------------------- /src/jake2/client/lightstyle_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 20.11.2003 by RST. 22 | // $Id: lightstyle_t.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ 23 | 24 | package jake2.client; 25 | 26 | public class lightstyle_t 27 | { 28 | public float rgb[] = { 0, 0, 0 }; // 0.0 - 2.0 29 | public float white; // highest of rgb 30 | } 31 | -------------------------------------------------------------------------------- /src/jake2/client/particle_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 20.11.2003 by RST. 22 | // $Id: particle_t.java,v 1.3 2004-12-14 12:48:51 cawe Exp $ 23 | 24 | package jake2.client; 25 | 26 | import jake2.Defines; 27 | import jake2.util.Lib; 28 | 29 | import java.nio.*; 30 | 31 | public class particle_t { 32 | 33 | // lwjgl renderer needs a ByteBuffer 34 | private static ByteBuffer colorByteArray = Lib.newByteBuffer(Defines.MAX_PARTICLES * Lib.SIZEOF_INT, ByteOrder.LITTLE_ENDIAN); 35 | 36 | public static FloatBuffer vertexArray = Lib.newFloatBuffer(Defines.MAX_PARTICLES * 3); 37 | public static int[] colorTable = new int[256]; 38 | public static IntBuffer colorArray = colorByteArray.asIntBuffer(); 39 | 40 | 41 | public static void setColorPalette(int[] palette) { 42 | for (int i=0; i < 256; i++) { 43 | colorTable[i] = palette[i] & 0x00FFFFFF; 44 | } 45 | } 46 | 47 | public static ByteBuffer getColorAsByteBuffer() { 48 | return colorByteArray; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/jake2/client/refdef_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 20.11.2003 by RST. 22 | // $Id: refdef_t.java,v 1.2 2004-07-09 06:50:50 hzi Exp $ 23 | 24 | package jake2.client; 25 | 26 | public class refdef_t { 27 | public int x, y, width, height;// in virtual screen coordinates 28 | public float fov_x, fov_y; 29 | public float vieworg[] ={0,0,0}; 30 | public float viewangles[]={0,0,0}; 31 | public float blend[]={0,0,0,0}; // rgba 0-1 full screen blend 32 | public float time; // time is uesed to auto animate 33 | public int rdflags; // RDF_UNDERWATER, etc 34 | 35 | public byte areabits[]; // if not NULL, only areas with set bits will be drawn 36 | 37 | public lightstyle_t lightstyles[]; // [MAX_LIGHTSTYLES] 38 | 39 | public int num_entities; 40 | public entity_t entities[]; 41 | 42 | public int num_dlights; 43 | public dlight_t dlights[]; 44 | 45 | public int num_particles; 46 | //public particle_t particles[]; 47 | } 48 | -------------------------------------------------------------------------------- /src/jake2/client/viddef_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 20.11.2003 by RST. 22 | package jake2.client; 23 | 24 | public class viddef_t { 25 | private int width; 26 | private int height; 27 | private int newWidth; 28 | private int newHeight; 29 | 30 | /** 31 | * This method hasn't an effect on width and height 32 | * directly. The new values will be active after an update() 33 | * call. 34 | * 35 | * @param width 36 | * the visible render screen width. 37 | * @param height 38 | * the visible render screen height. 39 | */ 40 | public synchronized void setSize(int width, int height) { 41 | newWidth = width; 42 | newHeight = height; 43 | } 44 | 45 | /** 46 | * Updates the buffered width and height. The 47 | * method should be called once at the beginning of a frame. 48 | */ 49 | public synchronized void update() { 50 | width = newWidth; 51 | height = newHeight; 52 | } 53 | 54 | public int getWidth() { 55 | return width; 56 | } 57 | 58 | public int getHeight() { 59 | return height; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/jake2/client/vidmode_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | * vidmode_t.java 3 | * Copyright (C) 2003 4 | * 5 | * $Id: vidmode_t.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ 6 | */ 7 | /* 8 | Copyright (C) 1997-2001 Id Software, Inc. 9 | 10 | This program 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 | */ 26 | package jake2.client; 27 | 28 | /** 29 | * vidmode_t 30 | * 31 | * @author cwei 32 | */ 33 | public class vidmode_t { 34 | String description; 35 | int width, height; 36 | int mode; 37 | 38 | vidmode_t (String description, int width, int height, int mode) { 39 | this.description = description; 40 | this.width = width; 41 | this.height = height; 42 | this.mode = mode; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/jake2/client/vrect_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | * vrect_t.java 3 | * Copyright (C) 2003 4 | * 5 | * $Id: vrect_t.java,v 1.1 2004-07-07 19:58:52 hzi Exp $ 6 | */ 7 | /* 8 | Copyright (C) 1997-2001 Id Software, Inc. 9 | 10 | This program 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 | */ 26 | package jake2.client; 27 | 28 | /** 29 | * vrect_t 30 | * 31 | * @author cwei 32 | */ 33 | public class vrect_t { 34 | public int x; 35 | public int y; 36 | public int width; 37 | public int height; 38 | vrect_t pnext; 39 | } 40 | -------------------------------------------------------------------------------- /src/jake2/game/AIAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 11.11.2003 by RST. 22 | // $Id: AIAdapter.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ 23 | 24 | package jake2.game; 25 | 26 | public abstract class AIAdapter extends SuperAdapter 27 | { 28 | public abstract void ai(edict_t self, float dist); 29 | } 30 | -------------------------------------------------------------------------------- /src/jake2/game/EdictFindFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 07.11.2003 by RST. 22 | // $Id: EdictFindFilter.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ 23 | 24 | package jake2.game; 25 | 26 | /** Helps for filtering the iteration over the gedicts[] array, see GFind(). RST.*/ 27 | 28 | public class EdictFindFilter 29 | { 30 | boolean matches(edict_t e, String s) 31 | { 32 | return false; 33 | }; 34 | } -------------------------------------------------------------------------------- /src/jake2/game/EdictIterator.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 07.11.2003 by RST. 22 | // $Id: EdictIterator.java,v 1.3 2005-02-06 18:55:16 salomo Exp $ 23 | 24 | package jake2.game; 25 | 26 | /** Helps for iterating over the gedicts[] array. RST.*/ 27 | 28 | public class EdictIterator 29 | { 30 | EdictIterator(int i) 31 | { 32 | this.i = i; 33 | } 34 | public edict_t o; 35 | int i; 36 | } -------------------------------------------------------------------------------- /src/jake2/game/EndianHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * AbstractEndianHandler.java 3 | * Copyright (C) 2003 4 | * 5 | * $Id: EndianHandler.java,v 1.2 2004-07-08 15:58:43 hzi Exp $ 6 | */ 7 | /* 8 | Copyright (C) 1997-2001 Id Software, Inc. 9 | 10 | This program 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 | */ 26 | package jake2.game; 27 | 28 | public abstract class EndianHandler 29 | { 30 | private static final int mask = 0xFF; 31 | 32 | abstract public float BigFloat(float f); 33 | abstract public short BigShort(short s); 34 | abstract public int BigLong(int i); 35 | abstract public float LittleFloat(float f); 36 | abstract public short LittleShort(short s); 37 | abstract public int LittleLong(int i); 38 | 39 | public static float swapFloat(float f) 40 | { 41 | int i = Float.floatToRawIntBits(f); 42 | i = swapInt(i); 43 | f = Float.intBitsToFloat(i); 44 | 45 | return f; 46 | } 47 | 48 | public static int swapInt(int i) 49 | { 50 | 51 | int a = i & mask; 52 | i >>>= 8; 53 | 54 | a <<= 24; 55 | 56 | int b = i & mask; 57 | 58 | i >>>= 8; 59 | b <<= 16; 60 | 61 | int c = i & mask; 62 | i >>>= 8; 63 | c <<= 8; 64 | 65 | return i | c | b | a; 66 | } 67 | 68 | public static short swapShort(short s) 69 | { 70 | int a = s & mask; 71 | a <<= 8; 72 | int b = (s >>> 8) & mask; 73 | 74 | return (short) (b | a); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/jake2/game/EntBlockedAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 08.11.2003 by RST. 22 | // $Id: EntBlockedAdapter.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ 23 | 24 | package jake2.game; 25 | 26 | public abstract class EntBlockedAdapter extends SuperAdapter 27 | { 28 | // move to moveinfo? 29 | public abstract void blocked(edict_t self, edict_t other); 30 | } -------------------------------------------------------------------------------- /src/jake2/game/EntDieAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 08.11.2003 by RST. 22 | // $Id: EntDieAdapter.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ 23 | 24 | package jake2.game; 25 | 26 | public abstract class EntDieAdapter extends SuperAdapter 27 | { 28 | public abstract void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point); 29 | } -------------------------------------------------------------------------------- /src/jake2/game/EntDodgeAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 08.11.2003 by RST. 22 | // $Id: EntDodgeAdapter.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ 23 | 24 | package jake2.game; 25 | 26 | public abstract class EntDodgeAdapter extends SuperAdapter 27 | { 28 | public abstract void dodge(edict_t self, edict_t other, float eta); 29 | } 30 | -------------------------------------------------------------------------------- /src/jake2/game/EntInteractAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 08.11.2003 by RST. 22 | // $Id: EntInteractAdapter.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ 23 | 24 | package jake2.game; 25 | 26 | public abstract class EntInteractAdapter extends SuperAdapter 27 | { 28 | public abstract boolean interact(edict_t self, edict_t other); 29 | } -------------------------------------------------------------------------------- /src/jake2/game/EntPainAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 08.11.2003 by RST. 22 | // $Id: EntPainAdapter.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ 23 | 24 | package jake2.game; 25 | 26 | public abstract class EntPainAdapter extends SuperAdapter 27 | { 28 | public abstract void pain(edict_t self, edict_t other, float kick, int damage); 29 | } -------------------------------------------------------------------------------- /src/jake2/game/EntThinkAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 08.11.2003 by RST. 22 | // $Id: EntThinkAdapter.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ 23 | 24 | package jake2.game; 25 | 26 | public abstract class EntThinkAdapter extends SuperAdapter 27 | { 28 | public abstract boolean think(edict_t self); 29 | } -------------------------------------------------------------------------------- /src/jake2/game/EntTouchAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 08.11.2003 by RST. 22 | // $Id: EntTouchAdapter.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ 23 | 24 | package jake2.game; 25 | 26 | public abstract class EntTouchAdapter extends SuperAdapter 27 | { 28 | public abstract void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf); 29 | } -------------------------------------------------------------------------------- /src/jake2/game/EntUseAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 08.11.2003 by RST. 22 | // $Id: EntUseAdapter.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ 23 | 24 | package jake2.game; 25 | 26 | public abstract class EntUseAdapter extends SuperAdapter 27 | { 28 | public abstract void use(edict_t self, edict_t other, edict_t activator); 29 | } -------------------------------------------------------------------------------- /src/jake2/game/ItemDropAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 08.11.2003 by RST. 22 | // $Id: ItemDropAdapter.java,v 1.2 2005-11-20 22:18:33 salomo Exp $ 23 | 24 | package jake2.game; 25 | 26 | public abstract class ItemDropAdapter extends SuperAdapter { 27 | public void drop(edict_t ent, gitem_t item) { 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/jake2/game/ItemUseAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 08.11.2003 by RST. 22 | // $Id: ItemUseAdapter.java,v 1.2 2005-11-20 22:18:33 salomo Exp $ 23 | 24 | package jake2.game; 25 | 26 | public abstract class ItemUseAdapter extends SuperAdapter { 27 | public void use(edict_t ent, gitem_t item) { 28 | } 29 | } -------------------------------------------------------------------------------- /src/jake2/game/SuperAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 09.01.2004 by RST. 22 | 23 | package jake2.game; 24 | 25 | import jake2.qcommon.Com; 26 | 27 | import java.util.Hashtable; 28 | 29 | public abstract class SuperAdapter { 30 | 31 | /** Constructor, does the adapter registration. */ 32 | public SuperAdapter() { 33 | register(this, getID()); 34 | } 35 | 36 | /** Adapter registration. */ 37 | private static void register(SuperAdapter sa, String id) { 38 | adapters.put(id, sa); 39 | } 40 | 41 | /** Adapter repository. */ 42 | private static Hashtable adapters= new Hashtable(); 43 | 44 | /** Returns the adapter from the repository given by its ID. */ 45 | public static SuperAdapter getFromID(String key) { 46 | SuperAdapter sa= (SuperAdapter) adapters.get(key); 47 | 48 | // try to create the adapter 49 | if (sa == null) { 50 | Com.DPrintf("SuperAdapter.getFromID():adapter not found->" + key + "\n"); 51 | } 52 | 53 | return sa; 54 | } 55 | 56 | /** Returns the Adapter-ID. */ 57 | public abstract String getID(); 58 | } 59 | -------------------------------------------------------------------------------- /src/jake2/game/client_respawn_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // Created on 31.10.2003 by RST. 21 | 22 | package jake2.game; 23 | 24 | import jake2.util.Math3D; 25 | import jake2.util.QuakeFile; 26 | 27 | import java.io.IOException; 28 | 29 | /** Client data that stays across deathmatch respawns.*/ 30 | public class client_respawn_t 31 | 32 | { 33 | /** What to set client->pers to on a respawn */ 34 | protected client_persistant_t coop_respawn = new client_persistant_t(); 35 | 36 | /** Level.framenum the client entered the game. */ 37 | protected int enterframe; 38 | 39 | /** frags, etc. */ 40 | protected int score; 41 | 42 | /** angles sent over in the last command. */ 43 | protected float cmd_angles[] = { 0, 0, 0 }; 44 | 45 | /** client is a spectator. */ 46 | protected boolean spectator; 47 | 48 | 49 | /** Copies the client respawn data. */ 50 | public void set(client_respawn_t from) 51 | { 52 | coop_respawn.set(from.coop_respawn); 53 | enterframe = from.enterframe; 54 | score = from.score; 55 | Math3D.VectorCopy(from.cmd_angles, cmd_angles); 56 | spectator = from.spectator; 57 | } 58 | 59 | /** Clears the client reaspawn informations. */ 60 | public void clear() 61 | { 62 | coop_respawn = new client_persistant_t(); 63 | enterframe = 0; 64 | score = 0; 65 | Math3D.VectorClear(cmd_angles); 66 | spectator = false; 67 | } 68 | 69 | /** Reads a client_respawn from a file. */ 70 | public void read(QuakeFile f) throws IOException 71 | { 72 | coop_respawn.read(f); 73 | enterframe = f.readInt(); 74 | score = f.readInt(); 75 | cmd_angles[0] = f.readFloat(); 76 | cmd_angles[1] = f.readFloat(); 77 | cmd_angles[2] = f.readFloat(); 78 | spectator = f.readInt() != 0; 79 | } 80 | 81 | /** Writes a client_respawn to a file. */ 82 | public void write(QuakeFile f) throws IOException 83 | { 84 | coop_respawn.write(f); 85 | f.writeInt(enterframe); 86 | f.writeInt(score); 87 | f.writeFloat(cmd_angles[0]); 88 | f.writeFloat(cmd_angles[1]); 89 | f.writeFloat(cmd_angles[2]); 90 | f.writeInt(spectator?1:0); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /src/jake2/game/cmdalias_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | // Created by HOZ. 21 | // $Id: cmdalias_t.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ 22 | 23 | package jake2.game; 24 | 25 | public final class cmdalias_t 26 | { 27 | public cmdalias_t next; 28 | public String name = ""; 29 | public String value; 30 | } 31 | -------------------------------------------------------------------------------- /src/jake2/game/cmodel_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 28.11.2003 by RST. 22 | // $Id: cmodel_t.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ 23 | 24 | package jake2.game; 25 | 26 | public class cmodel_t 27 | { 28 | public float[] mins = { 0, 0, 0 }; 29 | public float[] maxs = { 0, 0, 0 }; 30 | public float[] origin = { 0, 0, 0 }; // for sounds or lights 31 | public int headnode; 32 | } 33 | -------------------------------------------------------------------------------- /src/jake2/game/cplane_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 31.10.2003 by RST. 22 | 23 | package jake2.game; 24 | 25 | import jake2.util.Math3D; 26 | 27 | public class cplane_t 28 | { 29 | public float normal[] = new float[3]; 30 | public float dist; 31 | /** This is for fast side tests, 0=xplane, 1=yplane, 2=zplane and 3=arbitrary. */ 32 | public byte type; 33 | /** This represents signx + (signy<<1) + (signz << 1). */ 34 | public byte signbits; // signx + (signy<<1) + (signz<<1) 35 | public byte pad[] = { 0, 0 }; 36 | 37 | public void set(cplane_t c) { 38 | Math3D.set(normal, c.normal); 39 | dist = c.dist; 40 | type = c.type; 41 | signbits = c.signbits; 42 | pad[0] = c.pad[0]; 43 | pad[1] = c.pad[1]; 44 | } 45 | 46 | public void clear() { 47 | Math3D.VectorClear(normal); 48 | dist = 0; 49 | type = 0; 50 | signbits = 0; 51 | pad[0] = 0; 52 | pad[1] = 0; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/jake2/game/csurface_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 31.10.2003 by RST. 22 | // $Id: csurface_t.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ 23 | 24 | package jake2.game; 25 | public class csurface_t 26 | { 27 | public String name = ""; 28 | public int flags; 29 | public int value; 30 | } 31 | -------------------------------------------------------------------------------- /src/jake2/game/cvar_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | * cvar_t.java 3 | * Copyright (C) 2003 4 | * 5 | * $Id: cvar_t.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ 6 | */ 7 | /* 8 | Copyright (C) 1997-2001 Id Software, Inc. 9 | 10 | This program 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 | */ 26 | package jake2.game; 27 | 28 | /** 29 | * cvar_t implements the struct cvar_t of the C version 30 | */ 31 | public final class cvar_t 32 | { 33 | public String name; 34 | public String string; 35 | public String latched_string; 36 | public int flags = 0; 37 | public boolean modified = false; 38 | public float value = 0.0f; 39 | public cvar_t next = null; 40 | } 41 | -------------------------------------------------------------------------------- /src/jake2/game/game_locals_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1997-2001 Id Software, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU General Public License as published by the Free Software 6 | * Foundation; either version 2 of the License, or (at your option) any later 7 | * version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | * FOR A PARTICULAR PURPOSE. 12 | * 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place - Suite 330, Boston, MA 02111-1307, USA. 18 | * 19 | */ 20 | 21 | // Created on 31.10.2003 by RST. 22 | 23 | package jake2.game; 24 | 25 | import jake2.Defines; 26 | import jake2.qcommon.Com; 27 | import jake2.util.QuakeFile; 28 | 29 | import java.io.IOException; 30 | import java.util.Date; 31 | 32 | public class game_locals_t { 33 | // 34 | // this structure is left intact through an entire game 35 | // it should be initialized at dll load time, and read/written to 36 | // the server.ssv file for savegames 37 | // 38 | 39 | public String helpmessage1 = ""; 40 | 41 | public String helpmessage2 = ""; 42 | 43 | public int helpchanged; // flash F1 icon if non 0, play sound 44 | 45 | // and increment only if 1, 2, or 3 46 | 47 | public gclient_t clients[] = new gclient_t[Defines.MAX_CLIENTS]; 48 | 49 | // can't store spawnpoint in level, because 50 | // it would get overwritten by the savegame restore 51 | public String spawnpoint = ""; // needed for coop respawns 52 | 53 | // store latched cvars here that we want to get at often 54 | public int maxclients; 55 | 56 | public int maxentities; 57 | 58 | // cross level triggers 59 | public int serverflags; 60 | 61 | // items 62 | public int num_items; 63 | 64 | public boolean autosaved; 65 | 66 | /** Reads the game locals from a file. */ 67 | public void load(QuakeFile f) throws IOException { 68 | String date = f.readString(); 69 | 70 | helpmessage1 = f.readString(); 71 | helpmessage2 = f.readString(); 72 | 73 | helpchanged = f.readInt(); 74 | // gclient_t* 75 | 76 | spawnpoint = f.readString(); 77 | maxclients = f.readInt(); 78 | maxentities = f.readInt(); 79 | serverflags = f.readInt(); 80 | num_items = f.readInt(); 81 | autosaved = f.readInt() != 0; 82 | 83 | // rst's checker :-) 84 | if (f.readInt() != 1928) 85 | Com.DPrintf("error in loading game_locals, 1928\n"); 86 | 87 | } 88 | 89 | /** Writes the game locals to a file. */ 90 | public void write(QuakeFile f) throws IOException { 91 | f.writeString(new Date().toString()); 92 | 93 | f.writeString(helpmessage1); 94 | f.writeString(helpmessage2); 95 | 96 | f.writeInt(helpchanged); 97 | // gclient_t* 98 | 99 | f.writeString(spawnpoint); 100 | f.writeInt(maxclients); 101 | f.writeInt(maxentities); 102 | f.writeInt(serverflags); 103 | f.writeInt(num_items); 104 | f.writeInt(autosaved ? 1 : 0); 105 | // rst's checker :-) 106 | f.writeInt(1928); 107 | } 108 | } -------------------------------------------------------------------------------- /src/jake2/game/gitem_armor_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 07.11.2003 by RST. 22 | // $Id: gitem_armor_t.java,v 1.1 2004-07-07 19:59:25 hzi Exp $ 23 | 24 | package jake2.game; 25 | 26 | public class gitem_armor_t { 27 | 28 | public gitem_armor_t( 29 | int base_count, 30 | int max_count, 31 | float normal_protection, 32 | float energy_protection, 33 | int armor) { 34 | this.base_count= base_count; 35 | this.max_count= max_count; 36 | this.normal_protection= normal_protection; 37 | this.energy_protection= energy_protection; 38 | this.armor= armor; 39 | } 40 | 41 | int base_count; 42 | int max_count; 43 | float normal_protection; 44 | float energy_protection; 45 | int armor; 46 | } 47 | -------------------------------------------------------------------------------- /src/jake2/game/gitem_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1997-2001 Id Software, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU General Public License as published by the Free Software 6 | * Foundation; either version 2 of the License, or (at your option) any later 7 | * version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | * FOR A PARTICULAR PURPOSE. 12 | * 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place - Suite 330, Boston, MA 02111-1307, USA. 18 | * 19 | */ 20 | 21 | // Created on 20.11.2003 by RST. 22 | package jake2.game; 23 | 24 | public class gitem_t { 25 | private static int id = 0; 26 | 27 | public gitem_t(int xxx) { 28 | index = xxx; 29 | } 30 | 31 | public gitem_t(String classname, EntInteractAdapter pickup, 32 | ItemUseAdapter use, ItemDropAdapter drop, 33 | EntThinkAdapter weaponthink) { 34 | } 35 | 36 | public gitem_t(String classname, EntInteractAdapter pickup, 37 | ItemUseAdapter use, ItemDropAdapter drop, 38 | EntThinkAdapter weaponthink, String pickup_sound, 39 | String world_model, int world_model_flags, String view_model, 40 | String icon, String pickup_name, int count_width, int quantity, 41 | String ammo, int flags, int weapmodel, gitem_armor_t info, int tag, 42 | String precaches) { 43 | this.classname = classname; 44 | this.pickup = pickup; 45 | this.use = use; 46 | this.drop = drop; 47 | this.weaponthink = weaponthink; 48 | this.pickup_sound = pickup_sound; 49 | this.world_model = world_model; 50 | this.world_model_flags = world_model_flags; 51 | this.view_model = view_model; 52 | this.icon = icon; 53 | this.pickup_name = pickup_name; 54 | this.count_width = count_width; 55 | this.quantity = quantity; 56 | this.ammo = ammo; 57 | this.flags = flags; 58 | this.weapmodel = weapmodel; 59 | this.info = info; 60 | this.tag = tag; 61 | this.precaches = precaches; 62 | 63 | this.index = id++; 64 | } 65 | 66 | String classname; // spawning name 67 | 68 | EntInteractAdapter pickup; 69 | 70 | ItemUseAdapter use; 71 | 72 | ItemDropAdapter drop; 73 | 74 | EntThinkAdapter weaponthink; 75 | 76 | String pickup_sound; 77 | 78 | String world_model; 79 | 80 | int world_model_flags; 81 | 82 | String view_model; 83 | 84 | // client side info 85 | String icon; 86 | 87 | String pickup_name; // for printing on pickup 88 | 89 | int count_width; // number of digits to display by icon 90 | 91 | int quantity; // for ammo how much, for weapons how much is used per shot 92 | 93 | String ammo; // for weapons 94 | 95 | int flags; // IT_* flags 96 | 97 | int weapmodel; // weapon model index (for weapons) 98 | 99 | gitem_armor_t info; 100 | 101 | int tag; 102 | 103 | String precaches; // string of all models, sounds, and images this item will 104 | // use 105 | 106 | public int index; 107 | } -------------------------------------------------------------------------------- /src/jake2/game/link_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 31.10.2003 by RST 22 | // $Id: link_t.java,v 1.1 2004-07-07 19:59:25 hzi Exp $ 23 | // simple linked structure often used in quake. 24 | 25 | package jake2.game; 26 | 27 | public class link_t { 28 | public link_t(Object o) { 29 | this.o = o; 30 | } 31 | public link_t prev, next; 32 | public Object o; 33 | } 34 | -------------------------------------------------------------------------------- /src/jake2/game/mapsurface_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 02.01.2004 by RST. 22 | // $Id: mapsurface_t.java,v 1.1 2004-07-07 19:59:26 hzi Exp $ 23 | 24 | package jake2.game; 25 | 26 | 27 | // import jake2.*; 28 | // import jake2.client.*; 29 | // import jake2.game.*; 30 | // import jake2.qcommon.*; 31 | // import jake2.render.*; 32 | // import jake2.server.*; 33 | 34 | public class mapsurface_t { 35 | public csurface_t c = new csurface_t(); 36 | public String rname; 37 | } 38 | -------------------------------------------------------------------------------- /src/jake2/game/mframe_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 11.11.2003 by RST. 22 | 23 | package jake2.game; 24 | 25 | import jake2.util.QuakeFile; 26 | 27 | import java.io.IOException; 28 | 29 | public class mframe_t 30 | { 31 | public mframe_t(AIAdapter ai, float dist, EntThinkAdapter think) 32 | { 33 | this.ai= ai; 34 | this.dist= dist; 35 | this.think= think; 36 | } 37 | 38 | /** Empty constructor. */ 39 | public mframe_t() 40 | {} 41 | 42 | public AIAdapter ai; 43 | public float dist; 44 | public EntThinkAdapter think; 45 | 46 | public void write(QuakeFile f) throws IOException 47 | { 48 | f.writeAdapter(ai); 49 | f.writeFloat(dist); 50 | f.writeAdapter(think); 51 | } 52 | 53 | public void read(QuakeFile f) throws IOException 54 | { 55 | ai= (AIAdapter) f.readAdapter(); 56 | dist= f.readFloat(); 57 | think= (EntThinkAdapter) f.readAdapter(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/jake2/game/mmove_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 11.11.2003 by RST. 22 | 23 | package jake2.game; 24 | 25 | import jake2.util.QuakeFile; 26 | 27 | import java.io.IOException; 28 | 29 | public class mmove_t { 30 | public mmove_t(int firstframe, int lastframe, mframe_t frame[], EntThinkAdapter endfunc) { 31 | 32 | this.firstframe= firstframe; 33 | this.lastframe= lastframe; 34 | this.frame= frame; 35 | this.endfunc= endfunc; 36 | } 37 | 38 | public mmove_t() 39 | {} 40 | 41 | public int firstframe; 42 | public int lastframe; 43 | public mframe_t frame[]; //ptr 44 | public EntThinkAdapter endfunc; 45 | 46 | 47 | /** Writes the structure to a random acccess file. */ 48 | public void write(QuakeFile f) throws IOException 49 | { 50 | f.writeInt(firstframe); 51 | f.writeInt(lastframe); 52 | if (frame == null) 53 | f.writeInt(-1); 54 | else 55 | { 56 | f. writeInt(frame.length); 57 | for (int n=0; n < frame.length; n++) 58 | frame[n].write(f); 59 | } 60 | f.writeAdapter(endfunc); 61 | } 62 | 63 | /** Read the mmove_t from the RandomAccessFile. */ 64 | public void read(QuakeFile f) throws IOException 65 | { 66 | firstframe = f.readInt(); 67 | lastframe = f.readInt(); 68 | 69 | int len = f.readInt(); 70 | 71 | frame = new mframe_t[len]; 72 | for (int n=0; n < len ; n++) 73 | { 74 | frame[n] = new mframe_t(); 75 | frame[n].read(f); 76 | } 77 | endfunc = (EntThinkAdapter) f.readAdapter(); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/jake2/game/monsters/M_Boss3.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1997-2001 Id Software, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU General Public License as published by the Free Software 6 | * Foundation; either version 2 of the License, or (at your option) any later 7 | * version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | * FOR A PARTICULAR PURPOSE. 12 | * 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place - Suite 330, Boston, MA 02111-1307, USA. 18 | * 19 | */ 20 | 21 | // Created on 13.11.2003 by RST. 22 | // $Id: M_Boss3.java,v 1.3 2005-11-20 22:18:33 salomo Exp $ 23 | package jake2.game.monsters; 24 | 25 | import jake2.Defines; 26 | import jake2.game.EntThinkAdapter; 27 | import jake2.game.EntUseAdapter; 28 | import jake2.game.GameBase; 29 | import jake2.game.GameUtil; 30 | import jake2.game.edict_t; 31 | import jake2.util.Math3D; 32 | 33 | public class M_Boss3 { 34 | 35 | static EntUseAdapter Use_Boss3 = new EntUseAdapter() { 36 | public String getID() { return "Use_Boss3"; } 37 | public void use(edict_t ent, edict_t other, edict_t activator) { 38 | GameBase.gi.WriteByte(Defines.svc_temp_entity); 39 | GameBase.gi.WriteByte(Defines.TE_BOSSTPORT); 40 | GameBase.gi.WritePosition(ent.s.origin); 41 | GameBase.gi.multicast(ent.s.origin, Defines.MULTICAST_PVS); 42 | GameUtil.G_FreeEdict(ent); 43 | } 44 | }; 45 | 46 | static EntThinkAdapter Think_Boss3Stand = new EntThinkAdapter() { 47 | public String getID() { return "Think_Boss3Stand"; } 48 | public boolean think(edict_t ent) { 49 | if (ent.s.frame == M_Boss32.FRAME_stand260) 50 | ent.s.frame = M_Boss32.FRAME_stand201; 51 | else 52 | ent.s.frame++; 53 | ent.nextthink = GameBase.level.time + Defines.FRAMETIME; 54 | return true; 55 | } 56 | 57 | }; 58 | 59 | /* 60 | * QUAKED monster_boss3_stand (1 .5 0) (-32 -32 0) (32 32 90) 61 | * 62 | * Just stands and cycles in one place until targeted, then teleports away. 63 | */ 64 | public static void SP_monster_boss3_stand(edict_t self) { 65 | if (GameBase.deathmatch.value != 0) { 66 | GameUtil.G_FreeEdict(self); 67 | return; 68 | } 69 | 70 | self.movetype = Defines.MOVETYPE_STEP; 71 | self.solid = Defines.SOLID_BBOX; 72 | self.model = "models/monsters/boss3/rider/tris.md2"; 73 | self.s.modelindex = GameBase.gi.modelindex(self.model); 74 | self.s.frame = M_Boss32.FRAME_stand201; 75 | 76 | GameBase.gi.soundindex("misc/bigtele.wav"); 77 | 78 | Math3D.VectorSet(self.mins, -32, -32, 0); 79 | Math3D.VectorSet(self.maxs, 32, 32, 90); 80 | 81 | self.use = Use_Boss3; 82 | self.think = Think_Boss3Stand; 83 | self.nextthink = GameBase.level.time + Defines.FRAMETIME; 84 | GameBase.gi.linkentity(self); 85 | } 86 | } -------------------------------------------------------------------------------- /src/jake2/game/moveinfo_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 31.10.2003 by RST. 22 | // $Id: moveinfo_t.java,v 1.2 2004-08-20 21:29:58 salomo Exp $ 23 | 24 | package jake2.game; 25 | 26 | import java.io.IOException; 27 | 28 | import jake2.util.QuakeFile; 29 | 30 | public class moveinfo_t { 31 | // fixed data 32 | float[] start_origin= { 0, 0, 0 }; 33 | float[] start_angles= { 0, 0, 0 }; 34 | float[] end_origin= { 0, 0, 0 }; 35 | float[] end_angles= { 0, 0, 0 }; 36 | 37 | int sound_start; 38 | int sound_middle; 39 | int sound_end; 40 | 41 | float accel; 42 | float speed; 43 | float decel; 44 | float distance; 45 | 46 | float wait; 47 | 48 | // state data 49 | int state; 50 | float[] dir= { 0, 0, 0 }; 51 | 52 | float current_speed; 53 | float move_speed; 54 | float next_speed; 55 | float remaining_distance; 56 | float decel_distance; 57 | EntThinkAdapter endfunc; 58 | 59 | /** saves the moveinfo to the file.*/ 60 | public void write(QuakeFile f) throws IOException { 61 | f.writeVector(start_origin); 62 | f.writeVector(start_angles); 63 | f.writeVector(end_origin); 64 | f.writeVector(end_angles); 65 | 66 | f.writeInt(sound_start); 67 | f.writeInt(sound_middle); 68 | f.writeInt(sound_end); 69 | 70 | f.writeFloat(accel); 71 | f.writeFloat(speed); 72 | f.writeFloat(decel); 73 | f.writeFloat(distance); 74 | 75 | f.writeFloat(wait); 76 | 77 | f.writeInt(state); 78 | f.writeVector(dir); 79 | 80 | f.writeFloat(current_speed); 81 | f.writeFloat(move_speed); 82 | f.writeFloat(next_speed); 83 | f.writeFloat(remaining_distance); 84 | f.writeFloat(decel_distance); 85 | f.writeAdapter(endfunc); 86 | } 87 | 88 | /** Reads the moveinfo from a file. */ 89 | public void read(QuakeFile f) throws IOException { 90 | start_origin= f.readVector(); 91 | start_angles= f.readVector(); 92 | end_origin= f.readVector(); 93 | end_angles= f.readVector(); 94 | 95 | sound_start= f.readInt(); 96 | sound_middle= f.readInt(); 97 | sound_end= f.readInt(); 98 | 99 | accel= f.readFloat(); 100 | speed= f.readFloat(); 101 | decel= f.readFloat(); 102 | distance= f.readFloat(); 103 | 104 | wait= f.readFloat(); 105 | 106 | state= f.readInt(); 107 | dir= f.readVector(); 108 | 109 | current_speed= f.readFloat(); 110 | move_speed= f.readFloat(); 111 | next_speed= f.readFloat(); 112 | remaining_distance= f.readFloat(); 113 | decel_distance= f.readFloat(); 114 | endfunc= (EntThinkAdapter) f.readAdapter(); 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /src/jake2/game/pushed_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 31.10.2003 by RST. 22 | // $Id: pushed_t.java,v 1.1 2004-07-07 19:59:26 hzi Exp $ 23 | 24 | package jake2.game; 25 | 26 | public class pushed_t { 27 | public edict_t ent; 28 | public float[] origin= { 0.0f, 0.0f, 0.0f }; 29 | public float[] angles= { 0.0f, 0.0f, 0.0f }; 30 | public float deltayaw; 31 | } 32 | -------------------------------------------------------------------------------- /src/jake2/game/spawn_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 19.11.2003 by RST. 22 | // $Id: spawn_t.java,v 1.1 2004-07-07 19:59:26 hzi Exp $ 23 | 24 | package jake2.game; 25 | 26 | public class spawn_t { 27 | public spawn_t(String name, EntThinkAdapter spawn) { 28 | this.name = name; 29 | this.spawn = spawn; 30 | } 31 | 32 | String name; 33 | EntThinkAdapter spawn; 34 | } 35 | -------------------------------------------------------------------------------- /src/jake2/game/trace_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 31.10.2003 by RST. 22 | // $Id: trace_t.java,v 1.5 2005-01-14 16:09:42 cawe Exp $ 23 | 24 | package jake2.game; 25 | 26 | import jake2.util.Math3D; 27 | 28 | //a trace is returned when a box is swept through the world 29 | public class trace_t { 30 | public boolean allsolid; // if true, plane is not valid 31 | public boolean startsolid; // if true, the initial point was in a solid area 32 | public float fraction; // time completed, 1.0 = didn't hit anything 33 | public float[] endpos = { 0, 0, 0 }; // final position 34 | // memory 35 | public cplane_t plane = new cplane_t(); // surface normal at impact 36 | // pointer 37 | public csurface_t surface; // surface hit 38 | public int contents; // contents on other side of surface hit 39 | // pointer 40 | public edict_t ent; // not set by CM_*() functions 41 | 42 | public void set(trace_t from) { 43 | allsolid = from.allsolid; 44 | startsolid = from.allsolid; 45 | fraction = from.fraction; 46 | Math3D.VectorCopy(from.endpos, endpos); 47 | plane.set(from.plane); 48 | surface = from.surface; 49 | contents = from.contents; 50 | ent = from.ent; 51 | } 52 | 53 | public void clear() { 54 | allsolid = false; 55 | startsolid = false; 56 | fraction = 0; 57 | Math3D.VectorClear(endpos); 58 | plane.clear(); 59 | surface = null; 60 | contents = 0; 61 | ent = null; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/jake2/game/usercmd_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 31.10.2003 by RST. 22 | 23 | package jake2.game; 24 | 25 | 26 | public class usercmd_t implements Cloneable { 27 | public byte msec; 28 | public byte buttons; 29 | public short angles[]= new short[3]; 30 | public short forwardmove, sidemove, upmove; 31 | public byte impulse; // remove? 32 | public byte lightlevel; // light level the player is standing on 33 | 34 | public void clear() { 35 | forwardmove= sidemove= upmove= msec= buttons= impulse= lightlevel= 0; 36 | angles[0] = angles[1] = angles[2] = 0; 37 | } 38 | 39 | public usercmd_t() { 40 | }; 41 | 42 | public usercmd_t(usercmd_t from) { 43 | msec= from.msec; 44 | buttons= from.buttons; 45 | angles[0]= from.angles[0]; 46 | angles[1]= from.angles[1]; 47 | angles[2]= from.angles[2]; 48 | forwardmove= from.forwardmove; 49 | sidemove= from.sidemove; 50 | upmove= from.upmove; 51 | impulse= from.impulse; 52 | lightlevel= from.lightlevel; 53 | } 54 | 55 | public usercmd_t set(usercmd_t from) { 56 | msec= from.msec; 57 | buttons= from.buttons; 58 | angles[0]= from.angles[0]; 59 | angles[1]= from.angles[1]; 60 | angles[2]= from.angles[2]; 61 | forwardmove= from.forwardmove; 62 | sidemove= from.sidemove; 63 | upmove= from.upmove; 64 | impulse= from.impulse; 65 | lightlevel= from.lightlevel; 66 | 67 | return this; 68 | } 69 | } -------------------------------------------------------------------------------- /src/jake2/qcommon/cmd_function_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | * cmd_function_t.java 3 | * Copyright (C) 2003 4 | * 5 | * $Id: cmd_function_t.java,v 1.1 2004-07-07 19:59:34 hzi Exp $ 6 | */ 7 | /* 8 | Copyright (C) 1997-2001 Id Software, Inc. 9 | 10 | This program 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 | */ 26 | package jake2.qcommon; 27 | 28 | /** 29 | * cmd_function_t 30 | */ 31 | public final class cmd_function_t { 32 | public cmd_function_t next = null; 33 | public String name = null; 34 | public xcommand_t function; 35 | } 36 | -------------------------------------------------------------------------------- /src/jake2/qcommon/longjmpException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * longjmpException.java 3 | * Copyright (C) 2003 4 | * 5 | * $Id: longjmpException.java,v 1.1 2004-07-07 19:59:34 hzi Exp $ 6 | */ 7 | /* 8 | Copyright (C) 1997-2001 Id Software, Inc. 9 | 10 | This program 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 | */ 26 | package jake2.qcommon; 27 | 28 | /** 29 | * longjmpException is used to replace the setjmp/longjmp code. 30 | */ 31 | public final class longjmpException extends IllegalStateException { 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/jake2/qcommon/lump_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 02.01.2004 by RST. 22 | // $Id: lump_t.java,v 1.1 2004-07-07 19:59:34 hzi Exp $ 23 | 24 | package jake2.qcommon; 25 | 26 | public class lump_t 27 | { 28 | public lump_t(int offset, int len) 29 | { 30 | this.fileofs = offset; 31 | this.filelen = len; 32 | } 33 | 34 | public int fileofs, filelen; 35 | } 36 | -------------------------------------------------------------------------------- /src/jake2/qcommon/miptex_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 02.01.2004 by RST. 22 | // $Id: miptex_t.java,v 1.1 2004-07-07 19:59:34 hzi Exp $ 23 | 24 | package jake2.qcommon; 25 | 26 | 27 | import jake2.*; 28 | // import jake2.client.*; 29 | // import jake2.game.*; 30 | // import jake2.qcommon.*; 31 | // import jake2.render.*; 32 | // import jake2.server.*; 33 | 34 | public class miptex_t { 35 | //char name[32]; 36 | String name=""; 37 | 38 | int width, height; 39 | 40 | //unsigned offsets[MIPLEVELS]; // four mip maps stored 41 | int offsets[] = new int[Defines.MIPLEVELS]; // four mip maps stored 42 | 43 | //char animname[32]; // next frame in animation chain 44 | String animframe=""; 45 | 46 | int flags; 47 | int contents; 48 | int value; 49 | } 50 | -------------------------------------------------------------------------------- /src/jake2/qcommon/netadr_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1997-2001 Id Software, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU General Public License as published by the Free Software 6 | * Foundation; either version 2 of the License, or (at your option) any later 7 | * version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | * FOR A PARTICULAR PURPOSE. 12 | * 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place - Suite 330, Boston, MA 02111-1307, USA. 18 | * 19 | */ 20 | 21 | // Created on 27.11.2003 by RST. 22 | // $Id: netadr_t.java,v 1.6 2005-10-26 12:37:58 cawe Exp $ 23 | package jake2.qcommon; 24 | 25 | import jake2.Defines; 26 | import jake2.sys.NET; 27 | 28 | import java.net.InetAddress; 29 | import java.net.UnknownHostException; 30 | 31 | public class netadr_t { 32 | 33 | public int type; 34 | 35 | public int port; 36 | 37 | public byte ip[]; 38 | 39 | public netadr_t() { 40 | this.type = Defines.NA_LOOPBACK; 41 | this.port = 0; // any 42 | try { 43 | // localhost / 127.0.0.1 44 | this.ip = InetAddress.getByName(null).getAddress(); 45 | } catch (UnknownHostException e) { 46 | } 47 | } 48 | 49 | public InetAddress getInetAddress() throws UnknownHostException { 50 | switch (type) { 51 | case Defines.NA_BROADCAST: 52 | return InetAddress.getByName("255.255.255.255"); 53 | case Defines.NA_LOOPBACK: 54 | // localhost / 127.0.0.1 55 | return InetAddress.getByName(null); 56 | case Defines.NA_IP: 57 | return InetAddress.getByAddress(ip); 58 | default: 59 | return null; 60 | } 61 | } 62 | 63 | public void set(netadr_t from) { 64 | type = from.type; 65 | port = from.port; 66 | ip[0] = from.ip[0]; 67 | ip[1] = from.ip[1]; 68 | ip[2] = from.ip[2]; 69 | ip[3] = from.ip[3]; 70 | } 71 | 72 | public String toString() { 73 | return (type == Defines.NA_LOOPBACK) ? "loopback" : NET 74 | .AdrToString(this); 75 | } 76 | } -------------------------------------------------------------------------------- /src/jake2/qcommon/netchan_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1997-2001 Id Software, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU General Public License as published by the Free Software 6 | * Foundation; either version 2 of the License, or (at your option) any later 7 | * version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | * FOR A PARTICULAR PURPOSE. 12 | * 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place - Suite 330, Boston, MA 02111-1307, USA. 18 | * 19 | */ 20 | 21 | // Created on 27.11.2003 by RST. 22 | // $Id: netchan_t.java,v 1.2 2004-09-22 19:22:09 salomo Exp $ 23 | package jake2.qcommon; 24 | 25 | import jake2.*; 26 | 27 | public class netchan_t { 28 | 29 | public boolean fatal_error; 30 | 31 | // was enum {NS_CLIENT, NS_SERVER} 32 | public int sock; 33 | 34 | public int dropped; // between last packet and previous 35 | 36 | public int last_received; // for timeouts 37 | 38 | public int last_sent; // for retransmits 39 | 40 | public netadr_t remote_address = new netadr_t(); 41 | 42 | public int qport; // qport value to write when transmitting 43 | 44 | // sequencing variables 45 | public int incoming_sequence; 46 | 47 | public int incoming_acknowledged; 48 | 49 | public int incoming_reliable_acknowledged; // single bit 50 | 51 | public int incoming_reliable_sequence; // single bit, maintained local 52 | 53 | public int outgoing_sequence; 54 | 55 | public int reliable_sequence; // single bit 56 | 57 | public int last_reliable_sequence; // sequence number of last send 58 | 59 | // reliable staging and holding areas 60 | public sizebuf_t message = new sizebuf_t(); // writing buffer to send to 61 | // server 62 | 63 | public byte message_buf[] = new byte[Defines.MAX_MSGLEN - 16]; // leave 64 | // space for 65 | // header 66 | 67 | // message is copied to this buffer when it is first transfered 68 | public int reliable_length; 69 | 70 | public byte reliable_buf[] = new byte[Defines.MAX_MSGLEN - 16]; // unpcked 71 | // reliable 72 | // message 73 | 74 | //ok. 75 | public void clear() { 76 | sock = dropped = last_received = last_sent = 0; 77 | remote_address = new netadr_t(); 78 | qport = incoming_sequence = incoming_acknowledged = incoming_reliable_acknowledged = incoming_reliable_sequence = outgoing_sequence = reliable_sequence = last_reliable_sequence = 0; 79 | message = new sizebuf_t(); 80 | 81 | message_buf = new byte[Defines.MAX_MSGLEN - 16]; 82 | 83 | reliable_length = 0; 84 | reliable_buf = new byte[Defines.MAX_MSGLEN - 16]; 85 | } 86 | 87 | } -------------------------------------------------------------------------------- /src/jake2/qcommon/sizebuf_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | * sizebuf_t.java 3 | * Copyright (C) 2003 4 | * 5 | * $Id: sizebuf_t.java,v 1.1 2004-07-07 19:59:34 hzi Exp $ 6 | */ 7 | /* 8 | Copyright (C) 1997-2001 Id Software, Inc. 9 | 10 | This program 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 | */ 26 | package jake2.qcommon; 27 | 28 | import java.util.Arrays; 29 | 30 | /** 31 | * sizebuf_t 32 | */ 33 | public final class sizebuf_t { 34 | public boolean allowoverflow = false; 35 | public boolean overflowed = false; 36 | public byte[] data = null; 37 | public int maxsize = 0; 38 | public int cursize = 0; 39 | public int readcount = 0; 40 | 41 | public void clear() 42 | { 43 | if (data!=null) 44 | Arrays.fill(data,(byte)0); 45 | cursize = 0; 46 | overflowed = false; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/jake2/qcommon/texinfo_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 02.01.2004 by RST. 22 | // $Id: texinfo_t.java,v 1.2 2004-07-08 15:58:46 hzi Exp $ 23 | 24 | package jake2.qcommon; 25 | 26 | import jake2.util.Lib; 27 | 28 | import java.nio.ByteBuffer; 29 | import java.nio.ByteOrder; 30 | 31 | public class texinfo_t { 32 | 33 | // works fine. 34 | public texinfo_t(byte[] cmod_base, int o, int len) { 35 | this(ByteBuffer.wrap(cmod_base, o, len).order(ByteOrder.LITTLE_ENDIAN)); 36 | } 37 | 38 | public texinfo_t(ByteBuffer bb) { 39 | 40 | byte str[] = new byte[32]; 41 | 42 | vecs[0] = new float[] { bb.getFloat(), bb.getFloat(), bb.getFloat(), bb.getFloat()}; 43 | vecs[1] = new float[] { bb.getFloat(), bb.getFloat(), bb.getFloat(), bb.getFloat()}; 44 | 45 | flags = bb.getInt(); 46 | value = bb.getInt(); 47 | 48 | bb.get(str); 49 | texture = new String(str, 0, Lib.strlen(str)); 50 | nexttexinfo = bb.getInt(); 51 | } 52 | 53 | public static final int SIZE = 32 + 4 + 4 + 32 + 4; 54 | 55 | //float vecs[2][4]; // [s/t][xyz offset] 56 | public float vecs[][] = { 57 | { 0, 0, 0, 0 }, 58 | { 0, 0, 0, 0 } 59 | }; 60 | public int flags; // miptex flags + overrides 61 | public int value; // light emission, etc 62 | //char texture[32]; // texture name (textures/*.wal) 63 | public String texture=""; 64 | public int nexttexinfo; // for animations, -1 = end of chain 65 | } 66 | -------------------------------------------------------------------------------- /src/jake2/qcommon/xcommand_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | * xcommand_t.java 3 | * Copyright (C) 2003 4 | * 5 | * $Id: xcommand_t.java,v 1.1 2004-07-07 19:59:34 hzi Exp $ 6 | */ 7 | /* 8 | Copyright (C) 1997-2001 Id Software, Inc. 9 | 10 | This program 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 | */ 26 | package jake2.qcommon; 27 | 28 | /** 29 | * xcommand_t 30 | */ 31 | public abstract class xcommand_t { 32 | 33 | abstract public void execute(); 34 | } 35 | -------------------------------------------------------------------------------- /src/jake2/render/Ref.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Ref.java 3 | * Copyright (C) 2003 4 | * 5 | * $Id: Ref.java,v 1.3 2006-11-21 00:51:22 cawe Exp $ 6 | */ 7 | /* 8 | Copyright (C) 1997-2001 Id Software, Inc. 9 | 10 | This program 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 | */ 26 | package jake2.render; 27 | 28 | import jake2.client.refexport_t; 29 | 30 | /** 31 | * Ref 32 | * 33 | * @author cwei 34 | */ 35 | public interface Ref { 36 | 37 | refexport_t GetRefAPI(RenderAPI renderer); 38 | String getName(); 39 | } 40 | -------------------------------------------------------------------------------- /src/jake2/render/RenderAPI.java: -------------------------------------------------------------------------------- 1 | package jake2.render; 2 | 3 | import jake2.client.refdef_t; 4 | import jake2.render.opengl.GLDriver; 5 | 6 | import java.awt.Dimension; 7 | 8 | public interface RenderAPI { 9 | 10 | void setGLDriver(GLDriver impl); 11 | 12 | boolean R_Init(int vid_xpos, int vid_ypos); 13 | 14 | boolean R_Init2(); 15 | 16 | void R_Shutdown(); 17 | 18 | void R_BeginRegistration(String map); 19 | 20 | model_t R_RegisterModel(String name); 21 | 22 | image_t R_RegisterSkin(String name); 23 | 24 | image_t Draw_FindPic(String name); 25 | 26 | void R_SetSky(String name, float rotate, float[] axis); 27 | 28 | void R_EndRegistration(); 29 | 30 | void R_RenderFrame(refdef_t fd); 31 | 32 | void Draw_GetPicSize(Dimension dim, String name); 33 | 34 | void Draw_Pic(int x, int y, String name); 35 | 36 | void Draw_StretchPic(int x, int y, int w, int h, String name); 37 | 38 | void Draw_Char(int x, int y, int num); 39 | 40 | void Draw_TileClear(int x, int y, int w, int h, String name); 41 | 42 | void Draw_Fill(int x, int y, int w, int h, int c); 43 | 44 | void Draw_FadeScreen(); 45 | 46 | void Draw_StretchRaw(int x, int y, int w, int h, int cols, int rows, 47 | byte[] data); 48 | 49 | void R_SetPalette(byte[] palette); 50 | 51 | void R_BeginFrame(float camera_separation); 52 | 53 | void GL_ScreenShot_f(); 54 | } 55 | -------------------------------------------------------------------------------- /src/jake2/render/extract_gl_functions.sh: -------------------------------------------------------------------------------- 1 | cat *.java | egrep "\.gl" | grep \( | sed 's/(.*$//g'| grep -v "//" | grep ".gl" | sed 's/^.*\.gl/gl\.gl/g' | sed 's/ //g' | sort | uniq > $1 2 | 3 | -------------------------------------------------------------------------------- /src/jake2/render/gl_functions.txt: -------------------------------------------------------------------------------- 1 | gl.glActiveTexture 2 | gl.glActiveTextureARB 3 | gl.glAlphaFunc 4 | gl.glArrayElement 5 | gl.glBegin 6 | gl.glBindTexture 7 | gl.glBlendFunc 8 | gl.glClear 9 | gl.glClearColor 10 | gl.glClientActiveTextureARB 11 | gl.glColor3f 12 | gl.glColor3ub 13 | gl.glColor4f 14 | gl.glColor4ub 15 | gl.glColorPointer 16 | gl.glColorTable 17 | gl.glColorTableEXT 18 | gl.glCullFace 19 | gl.glDeleteTextures 20 | gl.glDepthFunc 21 | gl.glDepthMask 22 | gl.glDepthRange 23 | gl.glDisable 24 | gl.glDisableClientState 25 | gl.glDrawArrays 26 | gl.glDrawBuffer 27 | gl.glDrawElements 28 | gl.glEnable 29 | gl.glEnableClientState 30 | gl.glEnd 31 | gl.glFinish 32 | gl.glFlush 33 | gl.glFrustum 34 | gl.glGetError 35 | gl.glGetFloat 36 | gl.glGetFloatv 37 | gl.glGetString 38 | gl.glInterleavedArrays 39 | gl.glLoadIdentity 40 | gl.glLoadMatrix 41 | gl.glLoadMatrixf 42 | gl.glLockArraysEXT 43 | gl.glMatrixMode 44 | gl.glMultiTexCoord2fARB 45 | gl.glOrtho 46 | gl.glPixelStorei 47 | gl.glPointParameterEXT 48 | gl.glPointParameterfEXT 49 | gl.glPointParameterfvEXT 50 | gl.glPointSize 51 | gl.glPolygonMode 52 | gl.glPopMatrix 53 | gl.glPushMatrix 54 | gl.glReadPixels 55 | gl.glRotatef 56 | gl.glScalef 57 | gl.glScissor 58 | gl.glShadeModel 59 | gl.glTexCoord2f 60 | gl.glTexCoordPointer 61 | gl.glTexEnvi 62 | gl.glTexImage2D 63 | gl.glTexParameterf 64 | gl.glTexParameteri 65 | gl.glTexSubImage2D 66 | gl.glTranslatef 67 | gl.glUnlockArraysEXT 68 | gl.glutWireCube 69 | gl.glVertex2f 70 | gl.glVertex3f 71 | gl.glVertexPointer 72 | gl.glViewport 73 | -------------------------------------------------------------------------------- /src/jake2/render/glconfig_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 20.11.2003 by RST. 22 | // $Id: glconfig_t.java,v 1.3 2006-11-21 00:51:22 cawe Exp $ 23 | 24 | package jake2.render; 25 | 26 | public class glconfig_t { 27 | 28 | public int renderer; 29 | public String renderer_string; 30 | public String vendor_string; 31 | public String version_string; 32 | public String extensions_string; 33 | 34 | public boolean allow_cds; 35 | 36 | private float version = 1.1f; 37 | 38 | public void parseOpenGLVersion() { 39 | try { 40 | version = Float.parseFloat(version_string.substring(0, 3)); 41 | } catch (Exception e) { 42 | version = 1.1f; 43 | } 44 | } 45 | 46 | public float getOpenGLVersion() { 47 | return version; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/jake2/render/glpoly_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 20.11.2003 by RST. 22 | // $Id: glpoly_t.java,v 1.3 2005-01-09 22:32:10 cawe Exp $ 23 | 24 | package jake2.render; 25 | 26 | import jake2.util.Lib; 27 | 28 | public abstract class glpoly_t { 29 | public final static int STRIDE = 7; 30 | public final static int BYTE_STRIDE = 7 * Lib.SIZEOF_FLOAT; 31 | public final static int MAX_VERTICES = 64; 32 | 33 | public glpoly_t next; 34 | public glpoly_t chain; 35 | public int numverts; 36 | public int flags; // for SURF_UNDERWATER (not needed anymore?) 37 | 38 | // the array position (glDrawArrays) 39 | public int pos = 0; 40 | 41 | protected glpoly_t() { 42 | } 43 | 44 | public abstract float x(int index); 45 | 46 | public abstract void x(int index, float value); 47 | 48 | public abstract float y(int index); 49 | 50 | public abstract void y(int index, float value); 51 | 52 | public abstract float z(int index); 53 | 54 | public abstract void z(int index, float value); 55 | 56 | public abstract float s1(int index); 57 | 58 | public abstract void s1(int index, float value); 59 | 60 | public abstract float t1(int index); 61 | 62 | public abstract void t1(int index, float value); 63 | 64 | public abstract float s2(int index); 65 | 66 | public abstract void s2(int index, float value); 67 | 68 | public abstract float t2(int index); 69 | 70 | public abstract void t2(int index, float value); 71 | 72 | public abstract void beginScrolling(float s1); 73 | 74 | public abstract void endScrolling(); 75 | } -------------------------------------------------------------------------------- /src/jake2/render/glstate_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 20.11.2003 by RST. 22 | // $Id: glstate_t.java,v 1.1 2004-07-07 19:59:35 hzi Exp $ 23 | 24 | package jake2.render; 25 | 26 | public class glstate_t 27 | { 28 | public float inverse_intensity; 29 | public boolean fullscreen; 30 | 31 | public int prev_mode; 32 | 33 | public byte d_16to8table[]; 34 | 35 | public int lightmap_textures; 36 | 37 | public int currenttextures[]= {0,0}; 38 | public int currenttmu; 39 | 40 | public float camera_separation; 41 | public boolean stereo_enabled; 42 | 43 | public byte originalRedGammaTable[]= new byte [256]; 44 | public byte originalGreenGammaTable[]= new byte [256]; 45 | public byte originalBlueGammaTable[]= new byte [256]; 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/jake2/render/image_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 20.11.2003 by RST. 22 | // $Id: image_t.java,v 1.1 2004-07-07 19:59:35 hzi Exp $ 23 | 24 | package jake2.render; 25 | 26 | import jake2.Defines; 27 | 28 | public class image_t { 29 | 30 | public static final int MAX_NAME_SIZE = Defines.MAX_QPATH; 31 | 32 | // used to get the pos in array 33 | // added by cwei 34 | private int id; 35 | 36 | // quake 2 variables 37 | public String name=""; // game path, including extension 38 | // enum imagetype_t 39 | public int type; 40 | public int width, height; // source image 41 | public int upload_width, upload_height; // after power of two and picmip 42 | public int registration_sequence; // 0 = free 43 | public msurface_t texturechain; // for sort-by-texture world drawing 44 | public int texnum; // gl texture binding 45 | public float sl, tl, sh, th; // 0,0 - 1,1 unless part of the scrap 46 | public boolean scrap; 47 | public boolean has_alpha; 48 | 49 | public boolean paletted; 50 | 51 | public image_t(int id) { 52 | this.id = id; 53 | } 54 | 55 | public void clear() { 56 | // don't clear the id 57 | // wichtig !!! 58 | name = ""; 59 | type = 0; 60 | width = height = 0; 61 | upload_width = upload_height = 0; 62 | registration_sequence = 0; // 0 = free 63 | texturechain = null; 64 | texnum = 0; // gl texture binding 65 | sl = tl = sh = th = 0; 66 | scrap = false; 67 | has_alpha = false; 68 | paletted = false; 69 | } 70 | 71 | public int getId() { 72 | return id; 73 | } 74 | 75 | public String toString() { 76 | return name + ":" + texnum; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/jake2/render/medge_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1997-2001 Id Software, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU General Public License as published by the Free Software 6 | * Foundation; either version 2 of the License, or (at your option) any later 7 | * version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | * FOR A PARTICULAR PURPOSE. 12 | * 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place - Suite 330, Boston, MA 02111-1307, USA. 18 | * 19 | */ 20 | 21 | // Created on 20.11.2003 by RST. 22 | // $Id: medge_t.java,v 1.2 2004-09-22 19:22:15 salomo Exp $ 23 | package jake2.render; 24 | 25 | import jake2.Defines; 26 | 27 | import java.nio.ByteBuffer; 28 | 29 | public class medge_t { 30 | 31 | public static final int DISK_SIZE = 2 * Defines.SIZE_OF_SHORT; 32 | 33 | public static final int MEM_SIZE = 3 * Defines.SIZE_OF_INT; 34 | 35 | // unsigned short 36 | public int[] v = new int[2]; 37 | 38 | public int cachededgeoffset; 39 | 40 | public medge_t(ByteBuffer b) { 41 | v[0] = b.getShort() & 0xFFFF; 42 | v[1] = b.getShort() & 0xFFFF; 43 | } 44 | } -------------------------------------------------------------------------------- /src/jake2/render/mleaf_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 20.11.2003 by RST. 22 | // $Id: mleaf_t.java,v 1.1 2004-07-07 19:59:35 hzi Exp $ 23 | 24 | package jake2.render; 25 | 26 | public class mleaf_t extends mnode_t { 27 | 28 | // common with node 29 | /* 30 | public int contents; // wil be a negative contents number 31 | public int visframe; // node needs to be traversed if current 32 | 33 | public float minmaxs[] = new float[6]; // for bounding box culling 34 | 35 | public mnode_t parent; 36 | */ 37 | 38 | // leaf specific 39 | public int cluster; 40 | public int area; 41 | 42 | //public msurface_t firstmarksurface; 43 | public int nummarksurfaces; 44 | 45 | // added by cwei 46 | int markIndex; 47 | msurface_t[] markSurfaces; 48 | 49 | public void setMarkSurface(int markIndex, msurface_t[] markSurfaces) { 50 | this.markIndex = markIndex; 51 | this.markSurfaces = markSurfaces; 52 | } 53 | 54 | public msurface_t getMarkSurface(int index) { 55 | assert (index >= 0 && index <= nummarksurfaces) : "mleaf: markSurface bug (index = " + index +"; num = " + nummarksurfaces + ")"; 56 | // TODO code in Surf.R_RecursiveWorldNode aendern (der Pointer wird wie in C zu weit gezaehlt) 57 | return (index < nummarksurfaces) ? markSurfaces[markIndex + index] : null; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/jake2/render/mmodel_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 20.11.2003 by RST. 22 | // $Id: mmodel_t.java,v 1.2 2006-08-20 21:47:36 salomo Exp $ 23 | 24 | package jake2.render; 25 | 26 | public class mmodel_t 27 | { 28 | public float[] mins = { 0, 0, 0 }; 29 | public float[] maxs = { 0, 0, 0 }; 30 | public float[] origin = { 0, 0, 0 }; // for sounds or lights 31 | public float radius; 32 | public int headnode; 33 | public int visleafs; // not including the solid leaf 0 34 | public int firstface, numfaces; 35 | } 36 | -------------------------------------------------------------------------------- /src/jake2/render/mnode_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 20.11.2003 by RST. 22 | // $Id: mnode_t.java,v 1.1 2004-07-07 19:59:35 hzi Exp $ 23 | 24 | package jake2.render; 25 | 26 | import jake2.game.*; 27 | 28 | public class mnode_t { 29 | // common with leaf 30 | public int contents; // -1, to differentiate from leafs 31 | public int visframe; // node needs to be traversed if current 32 | 33 | //public float minmaxs[] = new float[6]; // for bounding box culling 34 | public float mins[] = new float[3]; // for bounding box culling 35 | public float maxs[] = new float[3]; // for bounding box culling 36 | 37 | public mnode_t parent; 38 | 39 | // node specific 40 | public cplane_t plane; 41 | public mnode_t children[] = new mnode_t[2]; 42 | 43 | // unsigned short 44 | public int firstsurface; 45 | public int numsurfaces; 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/jake2/render/msurface_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 20.11.2003 by RST. 22 | 23 | package jake2.render; 24 | 25 | import jake2.Defines; 26 | import jake2.game.cplane_t; 27 | 28 | import java.nio.ByteBuffer; 29 | 30 | public class msurface_t 31 | { 32 | 33 | public int visframe; // should be drawn when node is crossed 34 | 35 | public cplane_t plane; 36 | public int flags; 37 | 38 | public int firstedge; // look up in model->surfedges[], negative numbers 39 | public int numedges; // are backwards edges 40 | 41 | public short texturemins[] = { 0, 0 }; 42 | public short extents[] = { 0, 0 }; 43 | 44 | public int light_s, light_t; // gl lightmap coordinates 45 | public int dlight_s, dlight_t; 46 | // gl lightmap coordinates for dynamic lightmaps 47 | 48 | public glpoly_t polys; // multiple if warped 49 | public msurface_t texturechain; 50 | public msurface_t lightmapchain; 51 | 52 | // TODO check this 53 | public mtexinfo_t texinfo = new mtexinfo_t(); 54 | 55 | // lighting info 56 | public int dlightframe; 57 | public int dlightbits; 58 | 59 | public int lightmaptexturenum; 60 | public byte styles[] = new byte[Defines.MAXLIGHTMAPS]; 61 | public float cached_light[] = new float[Defines.MAXLIGHTMAPS]; 62 | // values currently used in lightmap 63 | //public byte samples[]; // [numstyles*surfsize] 64 | public ByteBuffer samples; // [numstyles*surfsize] 65 | 66 | public void clear() { 67 | visframe = 0; 68 | plane.clear(); 69 | flags = 0; 70 | 71 | firstedge = 0; 72 | numedges = 0; 73 | 74 | texturemins[0] = texturemins[1] = -1; 75 | extents[0] = extents[1] = 0; 76 | 77 | light_s = light_t = 0; 78 | dlight_s = dlight_t = 0; 79 | 80 | polys = null; 81 | texturechain = null; 82 | lightmapchain = null; 83 | 84 | //texinfo = new mtexinfo_t(); 85 | texinfo.clear(); 86 | 87 | dlightframe = 0; 88 | dlightbits = 0; 89 | 90 | lightmaptexturenum = 0; 91 | 92 | for (int i = 0; i < styles.length; i++) 93 | { 94 | styles[i] = 0; 95 | } 96 | for (int i = 0; i < cached_light.length; i++) 97 | { 98 | cached_light[i] = 0; 99 | } 100 | if (samples != null) samples.clear(); 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /src/jake2/render/mtexinfo_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 20.11.2003 by RST. 22 | // $Id: mtexinfo_t.java,v 1.2 2004-07-09 06:50:47 hzi Exp $ 23 | 24 | package jake2.render; 25 | 26 | import java.util.Arrays; 27 | 28 | public class mtexinfo_t { 29 | // [s/t][xyz offset] 30 | public float vecs[][] = { 31 | { 0, 0, 0, 0 }, 32 | { 0, 0, 0, 0 } 33 | }; 34 | public int flags; 35 | public int numframes; 36 | public mtexinfo_t next; // animation chain 37 | public image_t image; 38 | 39 | public void clear() { 40 | Arrays.fill(vecs[0], 0); 41 | Arrays.fill(vecs[1], 0); 42 | 43 | flags = 0; 44 | numframes = 0; 45 | next = null; 46 | image = null; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/jake2/render/mvertex_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1997-2001 Id Software, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU General Public License as published by the Free Software 6 | * Foundation; either version 2 of the License, or (at your option) any later 7 | * version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | * FOR A PARTICULAR PURPOSE. 12 | * 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place - Suite 330, Boston, MA 02111-1307, USA. 18 | * 19 | */ 20 | 21 | // Created on 20.11.2003 by RST. 22 | // $Id: mvertex_t.java,v 1.2 2004-09-22 19:22:15 salomo Exp $ 23 | package jake2.render; 24 | 25 | import jake2.Defines; 26 | 27 | import java.nio.ByteBuffer; 28 | 29 | public class mvertex_t { 30 | public static final int DISK_SIZE = 3 * Defines.SIZE_OF_FLOAT; 31 | 32 | public static final int MEM_SIZE = 3 * Defines.SIZE_OF_FLOAT; 33 | 34 | public float[] position = { 0, 0, 0 }; 35 | 36 | public mvertex_t(ByteBuffer b) { 37 | position[0] = b.getFloat(); 38 | position[1] = b.getFloat(); 39 | position[2] = b.getFloat(); 40 | } 41 | } -------------------------------------------------------------------------------- /src/jake2/render/opengl/GLDriver.java: -------------------------------------------------------------------------------- 1 | package jake2.render.opengl; 2 | 3 | import jake2.qcommon.xcommand_t; 4 | 5 | import java.awt.Dimension; 6 | 7 | public interface GLDriver { 8 | 9 | boolean init(int xpos, int ypos); 10 | 11 | int setMode(Dimension dim, int mode, boolean fullscreen); 12 | 13 | void shutdown(); 14 | 15 | void beginFrame(float camera_separation); 16 | 17 | void endFrame(); 18 | 19 | void appActivate(boolean activate); 20 | 21 | void enableLogging(boolean enable); 22 | 23 | void logNewFrame(); 24 | 25 | java.awt.DisplayMode[] getModeList(); 26 | 27 | void updateScreen(xcommand_t callback); 28 | 29 | void screenshot(); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/jake2/server/areanode_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 09.12.2003 by RST. 22 | 23 | package jake2.server; 24 | 25 | import jake2.game.link_t; 26 | 27 | public class areanode_t { 28 | int axis; // -1 = leaf node 29 | float dist; 30 | areanode_t children[] = new areanode_t[2]; 31 | link_t trigger_edicts = new link_t(this); 32 | link_t solid_edicts = new link_t(this); 33 | 34 | // used for debugging 35 | // float mins_rst[] = {0,0,0}; 36 | // float maxs_rst[] = {0,0,0}; 37 | } 38 | -------------------------------------------------------------------------------- /src/jake2/server/challenge_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 14.01.2004 by RST. 22 | 23 | package jake2.server; 24 | 25 | import jake2.qcommon.netadr_t; 26 | 27 | public class challenge_t { 28 | //mem 29 | netadr_t adr = new netadr_t(); 30 | int challenge; 31 | int time; 32 | } 33 | -------------------------------------------------------------------------------- /src/jake2/server/client_frame_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 13.01.2004 by RST. 22 | 23 | package jake2.server; 24 | 25 | import jake2.Defines; 26 | import jake2.game.player_state_t; 27 | 28 | public class client_frame_t { 29 | 30 | int areabytes; 31 | byte areabits[] = new byte[Defines.MAX_MAP_AREAS/8]; // portalarea visibility bits 32 | player_state_t ps = new player_state_t(); 33 | int num_entities; 34 | int first_entity; // into the circular sv_packet_entities[] 35 | int senttime; // for ping calculations 36 | } 37 | -------------------------------------------------------------------------------- /src/jake2/server/client_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 13.01.2004 by RST. 22 | 23 | package jake2.server; 24 | 25 | import jake2.Defines; 26 | import jake2.game.edict_t; 27 | import jake2.game.usercmd_t; 28 | import jake2.qcommon.netchan_t; 29 | import jake2.qcommon.sizebuf_t; 30 | 31 | public class client_t { 32 | 33 | public client_t() { 34 | for (int n = 0; n < Defines.UPDATE_BACKUP; n++) { 35 | frames[n] = new client_frame_t(); 36 | } 37 | } 38 | 39 | public static final int LATENCY_COUNTS = 16; 40 | public static final int RATE_MESSAGES = 10; 41 | 42 | int state; 43 | 44 | String userinfo = ""; 45 | 46 | int lastframe; // for delta compression 47 | usercmd_t lastcmd = new usercmd_t(); // for filling in big drops 48 | 49 | int commandMsec; // every seconds this is reset, if user 50 | // commands exhaust it, assume time cheating 51 | 52 | int frame_latency[] = new int[LATENCY_COUNTS]; 53 | int ping; 54 | 55 | int message_size[] = new int[RATE_MESSAGES]; // used to rate drop packets 56 | int rate; 57 | int surpressCount; // number of messages rate supressed 58 | 59 | // pointer 60 | edict_t edict; // EDICT_NUM(clientnum+1) 61 | 62 | //char name[32]; // extracted from userinfo, high bits masked 63 | String name = ""; // extracted from userinfo, high bits masked 64 | 65 | int messagelevel; // for filtering printed messages 66 | 67 | // The datagram is written to by sound calls, prints, temp ents, etc. 68 | // It can be harmlessly overflowed. 69 | sizebuf_t datagram = new sizebuf_t(); 70 | byte datagram_buf[] = new byte[Defines.MAX_MSGLEN]; 71 | 72 | client_frame_t frames[] = new client_frame_t[Defines.UPDATE_BACKUP]; // updates can be delta'd from here 73 | 74 | byte download[]; // file being downloaded 75 | int downloadsize; // total bytes (can't use EOF because of paks) 76 | int downloadcount; // bytes sent 77 | 78 | int lastmessage; // sv.framenum when packet was last received 79 | int lastconnect; 80 | 81 | int challenge; // challenge of this user, randomly generated 82 | 83 | netchan_t netchan = new netchan_t(); 84 | 85 | //this was introduced by rst, since java can't calculate the index out of the address. 86 | int serverindex; 87 | } 88 | -------------------------------------------------------------------------------- /src/jake2/server/moveclip_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 09.12.2003 by RST. 22 | 23 | package jake2.server; 24 | 25 | import jake2.game.edict_t; 26 | import jake2.game.trace_t; 27 | import jake2.util.Math3D; 28 | 29 | public class moveclip_t 30 | { 31 | float [] boxmins={0,0,0}, boxmaxs={0,0,0};// enclose the test object along entire move 32 | float [] mins, maxs; // size of the moving object 33 | float [] mins2={0,0,0}, maxs2={0,0,0}; // size when clipping against mosnters 34 | float [] start, end; 35 | // mem 36 | trace_t trace = new trace_t(); 37 | edict_t passedict; 38 | int contentmask; 39 | 40 | public void clear() { 41 | Math3D.VectorClear(boxmins); 42 | Math3D.VectorClear(boxmaxs); 43 | Math3D.VectorClear(mins); 44 | Math3D.VectorClear(maxs); 45 | Math3D.VectorClear(mins2); 46 | Math3D.VectorClear(maxs2); 47 | start = end = null; 48 | trace.clear(); 49 | passedict = null; 50 | contentmask = 0; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/jake2/server/server_static_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1997-2001 Id Software, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU General Public License as published by the Free Software 6 | * Foundation; either version 2 of the License, or (at your option) any later 7 | * version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | * FOR A PARTICULAR PURPOSE. 12 | * 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place - Suite 330, Boston, MA 02111-1307, USA. 18 | * 19 | */ 20 | 21 | // Created on 14.01.2004 by RST. 22 | // $Id: server_static_t.java,v 1.2 2004-09-22 19:22:12 salomo Exp $ 23 | package jake2.server; 24 | 25 | import jake2.Defines; 26 | import jake2.game.entity_state_t; 27 | import jake2.qcommon.sizebuf_t; 28 | 29 | import java.io.RandomAccessFile; 30 | 31 | public class server_static_t { 32 | public server_static_t() { 33 | for (int n = 0; n < Defines.MAX_CHALLENGES; n++) { 34 | challenges[n] = new challenge_t(); 35 | } 36 | } 37 | 38 | boolean initialized; // sv_init has completed 39 | 40 | int realtime; // always increasing, no clamping, etc 41 | 42 | String mapcmd = ""; // ie: *intro.cin+base 43 | 44 | int spawncount; // incremented each server start 45 | 46 | // used to check late spawns 47 | 48 | client_t clients[]; // [maxclients->value]; 49 | 50 | int num_client_entities; // maxclients->value*UPDATE_BACKUP*MAX_PACKET_ENTITIES 51 | 52 | int next_client_entities; // next client_entity to use 53 | 54 | entity_state_t client_entities[]; // [num_client_entities] 55 | 56 | int last_heartbeat; 57 | 58 | challenge_t challenges[] = new challenge_t[Defines.MAX_CHALLENGES]; // to 59 | // prevent 60 | // invalid 61 | // IPs 62 | // from 63 | // connecting 64 | 65 | // serverrecord values 66 | RandomAccessFile demofile; 67 | 68 | sizebuf_t demo_multicast = new sizebuf_t(); 69 | 70 | byte demo_multicast_buf[] = new byte[Defines.MAX_MSGLEN]; 71 | } -------------------------------------------------------------------------------- /src/jake2/server/server_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1997-2001 Id Software, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU General Public License as published by the Free Software 6 | * Foundation; either version 2 of the License, or (at your option) any later 7 | * version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | * FOR A PARTICULAR PURPOSE. 12 | * 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place - Suite 330, Boston, MA 02111-1307, USA. 18 | * 19 | */ 20 | 21 | // Created on 14.01.2004 by RST. 22 | // $Id: server_t.java,v 1.2 2004-09-22 19:22:12 salomo Exp $ 23 | package jake2.server; 24 | 25 | import jake2.Defines; 26 | import jake2.game.cmodel_t; 27 | import jake2.game.entity_state_t; 28 | import jake2.qcommon.sizebuf_t; 29 | 30 | import java.io.RandomAccessFile; 31 | 32 | public class server_t { 33 | 34 | public server_t() { 35 | models = new cmodel_t[Defines.MAX_MODELS]; 36 | for (int n = 0; n < Defines.MAX_MODELS; n++) 37 | models[n] = new cmodel_t(); 38 | 39 | for (int n = 0; n < Defines.MAX_EDICTS; n++) 40 | baselines[n] = new entity_state_t(null); 41 | } 42 | 43 | int state; // precache commands are only valid during load 44 | 45 | boolean attractloop; // running cinematics and demos for the local system 46 | // only 47 | 48 | boolean loadgame; // client begins should reuse existing entity 49 | 50 | int time; // always sv.framenum * 100 msec 51 | 52 | int framenum; 53 | 54 | String name = ""; // map name, or cinematic name 55 | 56 | cmodel_t models[]; 57 | 58 | String configstrings[] = new String[Defines.MAX_CONFIGSTRINGS]; 59 | 60 | entity_state_t baselines[] = new entity_state_t[Defines.MAX_EDICTS]; 61 | 62 | // the multicast buffer is used to send a message to a set of clients 63 | // it is only used to marshall data until SV_Multicast is called 64 | sizebuf_t multicast = new sizebuf_t(); 65 | 66 | byte multicast_buf[] = new byte[Defines.MAX_MSGLEN]; 67 | 68 | // demo server information 69 | RandomAccessFile demofile; 70 | 71 | boolean timedemo; // don't time sync 72 | } -------------------------------------------------------------------------------- /src/jake2/sound/DummyDriver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Created on Apr 25, 2004 3 | * 4 | * Copyright (C) 2003 5 | * 6 | * $Id: DummyDriver.java,v 1.2 2005-12-04 17:26:33 cawe Exp $ 7 | */ 8 | /* 9 | Copyright (C) 1997-2001 Id Software, Inc. 10 | 11 | This program is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU General Public License 13 | as published by the Free Software Foundation; either version 2 14 | of the License, or (at your option) any later version. 15 | 16 | This program is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 19 | 20 | See the GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with this program; if not, write to the Free Software 24 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 25 | 26 | */ 27 | package jake2.sound; 28 | 29 | import java.nio.ByteBuffer; 30 | 31 | /** 32 | * DummyDriver 33 | * 34 | * @author cwei 35 | */ 36 | public final class DummyDriver implements Sound { 37 | 38 | static { 39 | S.register(new DummyDriver()); 40 | }; 41 | 42 | private DummyDriver() { 43 | } 44 | 45 | /* (non-Javadoc) 46 | * @see jake2.sound.Sound#Init() 47 | */ 48 | public boolean Init() { 49 | return true; 50 | } 51 | 52 | /* (non-Javadoc) 53 | * @see jake2.sound.Sound#Shutdown() 54 | */ 55 | public void Shutdown() { 56 | } 57 | 58 | /* (non-Javadoc) 59 | * @see jake2.sound.Sound#BeginRegistration() 60 | */ 61 | public void BeginRegistration() { 62 | } 63 | 64 | /* (non-Javadoc) 65 | * @see jake2.sound.Sound#RegisterSound(java.lang.String) 66 | */ 67 | public sfx_t RegisterSound(String sample) { 68 | return null; 69 | } 70 | 71 | /* (non-Javadoc) 72 | * @see jake2.sound.Sound#EndRegistration() 73 | */ 74 | public void EndRegistration() { 75 | } 76 | 77 | /* (non-Javadoc) 78 | * @see jake2.sound.Sound#StartLocalSound(java.lang.String) 79 | */ 80 | public void StartLocalSound(String sound) { 81 | } 82 | 83 | /* (non-Javadoc) 84 | * @see jake2.sound.Sound#StartSound(float[], int, int, jake2.sound.sfx_t, float, float, float) 85 | */ 86 | public void StartSound(float[] origin, int entnum, int entchannel, sfx_t sfx, float fvol, float attenuation, float timeofs) { 87 | } 88 | 89 | /* (non-Javadoc) 90 | * @see jake2.sound.Sound#Update(float[], float[], float[], float[]) 91 | */ 92 | public void Update(float[] origin, float[] forward, float[] right, float[] up) { 93 | } 94 | 95 | /* (non-Javadoc) 96 | * @see jake2.sound.Sound#RawSamples(int, int, int, int, byte[]) 97 | */ 98 | public void RawSamples(int samples, int rate, int width, int channels, ByteBuffer data) { 99 | } 100 | 101 | public void disableStreaming() { 102 | } 103 | 104 | /* (non-Javadoc) 105 | * @see jake2.sound.Sound#StopAllSounds() 106 | */ 107 | public void StopAllSounds() { 108 | } 109 | 110 | /* (non-Javadoc) 111 | * @see jake2.sound.Sound#getName() 112 | */ 113 | public String getName() { 114 | return "dummy"; 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /src/jake2/sound/Sound.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Created on Apr 25, 2004 3 | * 4 | * Copyright (C) 2003 5 | * 6 | * $Id: Sound.java,v 1.3 2005-12-04 20:48:28 cawe Exp $ 7 | */ 8 | /* 9 | Copyright (C) 1997-2001 Id Software, Inc. 10 | 11 | This program is free software; you can redistribute it and/or 12 | modify it under the terms of the GNU General Public License 13 | as published by the Free Software Foundation; either version 2 14 | of the License, or (at your option) any later version. 15 | 16 | This program is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 19 | 20 | See the GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with this program; if not, write to the Free Software 24 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 25 | 26 | */ 27 | package jake2.sound; 28 | 29 | import jake2.Defines; 30 | 31 | import java.nio.ByteBuffer; 32 | 33 | /** 34 | * Sound 35 | * 36 | * @author cwei 37 | */ 38 | public interface Sound { 39 | 40 | static final int MAX_SFX = Defines.MAX_SOUNDS * 2; 41 | static final int STREAM_QUEUE = 8; 42 | 43 | String getName(); 44 | 45 | boolean Init(); 46 | void Shutdown(); 47 | 48 | /* 49 | ===================== 50 | S_BeginRegistration 51 | ===================== 52 | */ 53 | void BeginRegistration(); 54 | 55 | /* 56 | ===================== 57 | S_RegisterSound 58 | ===================== 59 | */ 60 | sfx_t RegisterSound(String sample); 61 | 62 | /* 63 | ===================== 64 | S_EndRegistration 65 | ===================== 66 | */ 67 | void EndRegistration(); 68 | 69 | /* 70 | ================== 71 | S_StartLocalSound 72 | ================== 73 | */ 74 | void StartLocalSound(String sound); 75 | 76 | /* 77 | ==================== 78 | S_StartSound 79 | 80 | Validates the parms and ques the sound up 81 | if pos is NULL, the sound will be dynamically sourced from the entity 82 | Entchannel 0 will never override a playing sound 83 | ==================== 84 | */ 85 | void StartSound(float[] origin, int entnum, int entchannel, sfx_t sfx, float fvol, float attenuation, float timeofs); 86 | 87 | /* 88 | ============ 89 | S_Update 90 | 91 | Called once each time through the main loop 92 | ============ 93 | */ 94 | void Update(float[] origin, float[] forward, float[] right, float[] up); 95 | /* 96 | ============ 97 | S_RawSamples 98 | 99 | Cinematic streaming and voice over network 100 | ============ 101 | */ 102 | void RawSamples(int samples, int rate, int width, int channels, ByteBuffer data); 103 | 104 | void disableStreaming(); 105 | /* 106 | ================== 107 | S_StopAllSounds 108 | ================== 109 | */ 110 | void StopAllSounds(); 111 | 112 | } 113 | -------------------------------------------------------------------------------- /src/jake2/sound/jsound/JSoundImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JSoundImpl.java 3 | * Copyright (C) 2004 4 | * 5 | * $Id: JSoundImpl.java,v 1.2 2005-12-04 17:26:55 cawe Exp $ 6 | */ 7 | package jake2.sound.jsound; 8 | 9 | import java.nio.ByteBuffer; 10 | 11 | import jake2.sound.*; 12 | 13 | /** 14 | * JSoundImpl 15 | */ 16 | public class JSoundImpl implements Sound { 17 | 18 | static { 19 | S.register(new JSoundImpl()); 20 | }; 21 | 22 | public boolean Init() { 23 | SND_DMA.Init(); 24 | if (SND_DMA.sound_started) return true; 25 | return false; 26 | } 27 | 28 | /* (non-Javadoc) 29 | * @see jake2.sound.SoundImpl#Shutdown() 30 | */ 31 | public void Shutdown() { 32 | SND_DMA.Shutdown(); 33 | } 34 | 35 | /* (non-Javadoc) 36 | * @see jake2.sound.SoundImpl#StartSound(float[], int, int, jake2.sound.sfx_t, float, float, float) 37 | */ 38 | public void StartSound(float[] origin, int entnum, int entchannel, sfx_t sfx, float fvol, float attenuation, float timeofs) { 39 | SND_DMA.StartSound(origin, entnum, entchannel, sfx, fvol, attenuation, timeofs); 40 | } 41 | 42 | /* (non-Javadoc) 43 | * @see jake2.sound.SoundImpl#StopAllSounds() 44 | */ 45 | public void StopAllSounds() { 46 | SND_DMA.StopAllSounds(); 47 | } 48 | 49 | /* (non-Javadoc) 50 | * @see jake2.sound.SoundImpl#Update(float[], float[], float[], float[]) 51 | */ 52 | public void Update(float[] origin, float[] forward, float[] right, float[] up) { 53 | SND_DMA.Update(origin, forward, right, up); 54 | } 55 | 56 | /* (non-Javadoc) 57 | * @see jake2.sound.Sound#getName() 58 | */ 59 | public String getName() { 60 | return "jsound"; 61 | } 62 | 63 | /* (non-Javadoc) 64 | * @see jake2.sound.Sound#BeginRegistration() 65 | */ 66 | public void BeginRegistration() { 67 | SND_DMA.BeginRegistration(); 68 | } 69 | 70 | /* (non-Javadoc) 71 | * @see jake2.sound.Sound#RegisterSound(java.lang.String) 72 | */ 73 | public sfx_t RegisterSound(String sample) { 74 | return SND_DMA.RegisterSound(sample); 75 | } 76 | 77 | /* (non-Javadoc) 78 | * @see jake2.sound.Sound#EndRegistration() 79 | */ 80 | public void EndRegistration() { 81 | SND_DMA.EndRegistration(); 82 | } 83 | 84 | /* (non-Javadoc) 85 | * @see jake2.sound.Sound#StartLocalSound(java.lang.String) 86 | */ 87 | public void StartLocalSound(String sound) { 88 | SND_DMA.StartLocalSound(sound); 89 | } 90 | 91 | /* (non-Javadoc) 92 | * @see jake2.sound.Sound#RawSamples(int, int, int, int, byte[]) 93 | */ 94 | public void RawSamples(int samples, int rate, int width, int channels, ByteBuffer data) { 95 | SND_DMA.RawSamples(samples, rate, width, channels, data); 96 | } 97 | 98 | public void disableStreaming() { 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /src/jake2/sound/sfx_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | * sfx_t.java 3 | * Copyright (C) 2004 4 | * 5 | * $Id: sfx_t.java,v 1.3 2005-04-26 20:11:03 cawe Exp $ 6 | */ 7 | /* 8 | Copyright (C) 1997-2001 Id Software, Inc. 9 | 10 | This program 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 | */ 26 | 27 | // Created on 28.11.2003 by RST. 28 | 29 | package jake2.sound; 30 | 31 | public class sfx_t { 32 | public String name; 33 | public int registration_sequence; 34 | public sfxcache_t cache; 35 | public String truename; 36 | 37 | // is used for AL buffers 38 | public int bufferId = -1; 39 | public boolean isCached = false; 40 | 41 | public void clear() { 42 | name = truename = null; 43 | cache = null; 44 | registration_sequence = 0; 45 | bufferId = -1; 46 | isCached = false; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/jake2/sound/sfxcache_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 28.11.2003 by RST. 22 | // $Id: sfxcache_t.java,v 1.1 2004-07-08 20:56:49 hzi Exp $ 23 | 24 | package jake2.sound; 25 | 26 | public class sfxcache_t { 27 | public int length; 28 | public int loopstart; 29 | public int speed; // not needed, because converted on load? 30 | public int width; 31 | public int stereo; 32 | public byte data[]; // variable sized 33 | 34 | public sfxcache_t(int size) { 35 | data = new byte[size]; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/jake2/sound/soundinfo_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | * soundinfo_t.java 3 | * Copyright (C) 2004 4 | * 5 | * $Id: soundinfo_t.java,v 1.1 2004-07-08 20:56:49 hzi Exp $ 6 | */ 7 | package jake2.sound; 8 | 9 | /** 10 | * soundinfo_t 11 | */ 12 | public class soundinfo_t { 13 | int channels; 14 | int samples; // mono samples in buffer 15 | int submission_chunk; // don't mix less than this # 16 | int samplepos; // in mono samples 17 | int samplebits; 18 | int speed; 19 | } 20 | -------------------------------------------------------------------------------- /src/jake2/sound/wavinfo_t.java: -------------------------------------------------------------------------------- 1 | /* 2 | * wavinfo_t.java 3 | * Copyright (C) 2004 4 | * 5 | * $Id: wavinfo_t.java,v 1.1 2004-07-08 20:56:49 hzi Exp $ 6 | */ 7 | package jake2.sound; 8 | 9 | /** 10 | * wavinfo_t 11 | */ 12 | public class wavinfo_t { 13 | public int rate; 14 | public int width; 15 | public int channels; 16 | public int loopstart; 17 | public int samples; 18 | public int dataofs; // chunk starts this many bytes from file start 19 | } 20 | -------------------------------------------------------------------------------- /src/jake2/sys/HighPrecisionTimer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * HighPrecisionTimer.java 3 | * Copyright (C) 2005 4 | * 5 | * $Id: HighPrecisionTimer.java,v 1.1 2005-07-01 14:11:00 hzi Exp $ 6 | */ 7 | package jake2.sys; 8 | 9 | import sun.misc.Perf; 10 | 11 | 12 | 13 | 14 | class HighPrecisionTimer extends Timer { 15 | 16 | private Perf perf = Perf.getPerf(); 17 | private double f = 1000.0 / perf.highResFrequency(); 18 | private long base; 19 | 20 | HighPrecisionTimer() { 21 | base = perf.highResCounter(); 22 | } 23 | 24 | public long currentTimeMillis() { 25 | long time = perf.highResCounter(); 26 | long delta = time - base; 27 | if (delta < 0) { 28 | delta += Long.MAX_VALUE + 1; 29 | } 30 | return (long)(delta * f); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/jake2/sys/Jake2InputEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Jake2InputEvent.java 3 | * Copyright (C) 2004 4 | * 5 | * $Id: Jake2InputEvent.java,v 1.2 2004-11-03 08:53:27 hzi Exp $ 6 | */ 7 | /* 8 | Copyright (C) 1997-2001 Id Software, Inc. 9 | 10 | This program 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 | */ 26 | package jake2.sys; 27 | 28 | import java.awt.AWTEvent; 29 | 30 | /** 31 | * Jake2InputEvent 32 | */ 33 | class Jake2InputEvent { 34 | static final int KeyPress = 0; 35 | static final int KeyRelease = 1; 36 | static final int MotionNotify = 2; 37 | static final int ButtonPress = 3; 38 | static final int ButtonRelease = 4; 39 | static final int CreateNotify = 5; 40 | static final int ConfigureNotify = 6; 41 | static final int WheelMoved = 7; 42 | int type; 43 | AWTEvent ev; 44 | 45 | Jake2InputEvent(int type, AWTEvent ev) { 46 | this.type = type; 47 | this.ev = ev; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/jake2/sys/KBD.java: -------------------------------------------------------------------------------- 1 | /* 2 | * KBD.java 3 | * Copyright (C) 2004 4 | * 5 | * $Id: KBD.java,v 1.7 2004-12-16 22:45:55 hzi Exp $ 6 | */ 7 | /* 8 | Copyright (C) 1997-2001 Id Software, Inc. 9 | 10 | This program 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 | */ 26 | package jake2.sys; 27 | 28 | 29 | /** 30 | * KBD 31 | */ 32 | abstract public class KBD { 33 | 34 | static int win_x = 0; 35 | static int win_y = 0; 36 | 37 | // motion values 38 | public static int mx = 0; 39 | public static int my = 0; 40 | 41 | abstract public void Init(); 42 | 43 | abstract public void Update(); 44 | 45 | abstract public void Close(); 46 | abstract public void Do_Key_Event(int key, boolean down); 47 | 48 | abstract public void installGrabs(); 49 | abstract public void uninstallGrabs(); 50 | //abstract public void centerMouse(); 51 | } 52 | 53 | -------------------------------------------------------------------------------- /src/jake2/sys/NanoTimer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * NanoTimer.java 3 | * Copyright (C) 2005 4 | * 5 | * $Id: NanoTimer.java,v 1.1 2005-07-01 14:11:00 hzi Exp $ 6 | */ 7 | package jake2.sys; 8 | 9 | 10 | public class NanoTimer extends Timer { 11 | 12 | private long base; 13 | 14 | NanoTimer() { 15 | base = System.nanoTime(); 16 | } 17 | 18 | public long currentTimeMillis() { 19 | long time = System.nanoTime(); 20 | long delta = time - base; 21 | if (delta < 0) { 22 | delta += Long.MAX_VALUE + 1; 23 | } 24 | return (long)(delta * 0.000001); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/jake2/sys/StandardTimer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * StandardTimer.java 3 | * Copyright (C) 2005 4 | * 5 | * $Id: StandardTimer.java,v 1.1 2005-07-01 14:11:00 hzi Exp $ 6 | */ 7 | package jake2.sys; 8 | 9 | 10 | class StandardTimer extends Timer { 11 | 12 | private long base; 13 | 14 | StandardTimer() { 15 | base = System.currentTimeMillis(); 16 | } 17 | 18 | public long currentTimeMillis() { 19 | long time = System.currentTimeMillis(); 20 | long delta = time - base; 21 | if (delta < 0) { 22 | delta += Long.MAX_VALUE + 1; 23 | } 24 | return delta; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/jake2/sys/Timer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Timer.java 3 | * Copyright (C) 2005 4 | */ 5 | package jake2.sys; 6 | 7 | import jake2.Globals; 8 | import jake2.qcommon.Com; 9 | 10 | 11 | public abstract class Timer { 12 | 13 | abstract public long currentTimeMillis(); 14 | static Timer t; 15 | 16 | static { 17 | try { 18 | t = new NanoTimer(); 19 | } catch (Throwable e) { 20 | try { 21 | t = new HighPrecisionTimer(); 22 | } catch (Throwable e1) { 23 | t = new StandardTimer(); 24 | } 25 | } 26 | Com.Println("using " + t.getClass().getName()); 27 | } 28 | 29 | public static int Milliseconds() { 30 | return Globals.curtime = (int)(t.currentTimeMillis()); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/jake2/util/Vargs.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Vargs.java 3 | * Copyright (C) 2003 4 | * 5 | * $Id: Vargs.java,v 1.1 2004-07-07 19:59:56 hzi Exp $ 6 | */ 7 | /* 8 | Copyright (C) 1997-2001 Id Software, Inc. 9 | 10 | This program 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 | */ 26 | package jake2.util; 27 | 28 | import java.util.Vector; 29 | 30 | /** 31 | * Vargs is a helper class to encapsulate printf arguments. 32 | * 33 | * @author cwei 34 | */ 35 | public class Vargs { 36 | 37 | // initial capacity 38 | static final int SIZE = 5; 39 | 40 | Vector v; 41 | 42 | public Vargs() { 43 | this(SIZE); 44 | } 45 | 46 | public Vargs(int initialSize) { 47 | if (v != null) 48 | v.clear(); // clear previous list for GC 49 | v = new Vector(initialSize); 50 | } 51 | 52 | public Vargs add(boolean value) { 53 | v.add(new Boolean(value)); 54 | return this; 55 | } 56 | 57 | public Vargs add(byte value) { 58 | v.add(new Byte(value)); 59 | return this; 60 | } 61 | 62 | public Vargs add(char value) { 63 | v.add(new Character(value)); 64 | return this; 65 | } 66 | 67 | public Vargs add(short value) { 68 | v.add(new Short(value)); 69 | return this; 70 | } 71 | 72 | public Vargs add(int value) { 73 | v.add(new Integer(value)); 74 | return this; 75 | } 76 | 77 | public Vargs add(long value) { 78 | v.add(new Long(value)); 79 | return this; 80 | } 81 | 82 | public Vargs add(float value) { 83 | v.add(new Float(value)); 84 | return this; 85 | } 86 | 87 | public Vargs add(double value) { 88 | v.add(new Double(value)); 89 | return this; 90 | } 91 | 92 | public Vargs add(String value) { 93 | v.add(value); 94 | return this; 95 | } 96 | 97 | public Vargs add(Object value) { 98 | v.add(value); 99 | return this; 100 | } 101 | 102 | public Vargs clear() { 103 | v.clear(); 104 | return this; 105 | } 106 | 107 | public Vector toVector() { 108 | // Vector tmp = v; 109 | // v = null; 110 | // return tmp; 111 | return (Vector) v.clone(); 112 | } 113 | 114 | public Object[] toArray() { 115 | return v.toArray(); 116 | } 117 | 118 | public int size() { 119 | return v.size(); 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /src/jake2/util/Vec3Cache.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Vec3Cache.java 3 | * Copyright (C) 2003 4 | * 5 | * $Id: Vec3Cache.java,v 1.2 2006-08-20 21:46:40 salomo Exp $ 6 | */ 7 | package jake2.util; 8 | 9 | /** 10 | * Vec3Cache contains float[3] for temporary usage. 11 | * The usage can reduce the garbage at runtime. 12 | * 13 | * @author cwei 14 | */ 15 | public final class Vec3Cache { 16 | 17 | private static final float[][] cache = new float[64][3]; 18 | private static int index = 0; 19 | private static int max = 0; 20 | 21 | public static final float[] get() { 22 | //max = Math.max(index, max); 23 | return cache[index++]; 24 | } 25 | 26 | public static final void release() { 27 | index--; 28 | } 29 | 30 | public static final void release(int count) { 31 | index-=count; 32 | } 33 | 34 | public static final void debug() { 35 | System.err.println("Vec3Cache: max. " + (max + 1) + " vectors used."); 36 | } 37 | } -------------------------------------------------------------------------------- /test/AdapterRegister.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 08.01.2004 by RST. 22 | // $Id: AdapterRegister.java,v 1.1 2004-07-09 06:50:51 hzi Exp $ 23 | // $Log: AdapterRegister.java,v $ 24 | // Revision 1.1 2004-07-09 06:50:51 hzi 25 | // import of Jake2 26 | // 27 | // Revision 1.1 2004/02/25 21:30:15 hoz 28 | // *** empty log message *** 29 | // 30 | // Revision 1.2 2004/02/02 22:19:17 rst 31 | // cosmetic 32 | // 33 | // Revision 1.1 2004/02/02 22:16:05 rst 34 | // cosmetic 35 | // 36 | // Revision 1.2 2004/01/09 18:30:57 rst 37 | // Superadapter replaces function pointers in save games. 38 | // 39 | // Revision 1.1 2004/01/08 23:56:43 rst 40 | // some preisfrage 41 | // 42 | 43 | // import jake2.*; 44 | // import jake2.client.*; 45 | // import jake2.game.*; 46 | // import jake2.qcommon.*; 47 | // import jake2.render.*; 48 | // import jake2.server.*; 49 | 50 | public class AdapterRegister { 51 | 52 | // concept for adapter indexing for function pointers 53 | 54 | 55 | // the counter 56 | static int id =0; 57 | 58 | static class t0 59 | { 60 | // the identificator 61 | public int myid = id++; 62 | 63 | public String test() 64 | { 65 | return ("t0, id = " + myid); 66 | } 67 | 68 | }; 69 | // any stupid adapter 70 | static class t1 extends t0 71 | { 72 | public String test() 73 | { 74 | return ("t1, id = " + myid); 75 | } 76 | }; 77 | // second adapter 78 | static class t2 extends t0 79 | { 80 | public String test(int x) 81 | { 82 | return ("t2, id = " + myid); 83 | } 84 | } 85 | 86 | 87 | // an auto test client 88 | public static void main(String[] args) { 89 | 90 | // program starts 91 | System.out.println("hello world."); 92 | 93 | t1 t1 = new t1(); 94 | t2 t2 = new t2(); 95 | t2 t3 = new t2(); 96 | System.out.println(t1.test()); 97 | System.out.println(t2.test()); 98 | System.out.println(t2.test(5)); 99 | System.out.println(t3.test(5)); 100 | 101 | System.out.println("good bye world."); 102 | // program ends 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /test/jake2/client/CircleListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 07.01.2000 by RST. 22 | 23 | package jake2.client; 24 | 25 | import java.awt.Robot; 26 | import java.awt.event.ActionEvent; 27 | import java.awt.event.ActionListener; 28 | 29 | class CircleListener implements ActionListener { 30 | Robot robot; 31 | public CircleListener(Robot robot) { 32 | this.robot = robot; 33 | } 34 | 35 | public void actionPerformed(ActionEvent evt) { 36 | int originx = (int)GhostMouse.size.getWidth()/2; 37 | int originy = (int)GhostMouse.size.getHeight()/2; 38 | double pi = 3.1457; 39 | 40 | for(double theta = 0; theta < 4*pi; theta=theta+0.1) { 41 | double radius = theta * 20; 42 | double x = Math.cos(theta) * radius + originx; 43 | double y = Math.sin(theta) * radius + originy; 44 | robot.mouseMove((int)x,(int)y); 45 | try{Thread.sleep(25);} catch (Exception ex) { } 46 | } 47 | } 48 | 49 | } 50 | 51 | -------------------------------------------------------------------------------- /test/jake2/client/GhostMouse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1997-2001 Id Software, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU General Public License as published by the Free Software 6 | * Foundation; either version 2 of the License, or (at your option) any later 7 | * version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | * FOR A PARTICULAR PURPOSE. 12 | * 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place - Suite 330, Boston, MA 02111-1307, USA. 18 | * 19 | */ 20 | 21 | // Created on 07.01.2000 by RST. 22 | // $Id: GhostMouse.java,v 1.3 2004-09-15 22:13:36 cawe Exp $ 23 | package jake2.client; 24 | 25 | import java.awt.Dimension; 26 | import java.awt.Robot; 27 | import java.awt.Toolkit; 28 | 29 | import javax.swing.JButton; 30 | import javax.swing.JFrame; 31 | 32 | public class GhostMouse { 33 | public static Dimension size; 34 | 35 | public static void main(String[] args) throws Exception { 36 | Robot robot = new Robot(); 37 | size = Toolkit.getDefaultToolkit().getScreenSize(); 38 | 39 | JFrame frame = new JFrame("Ghost Mouse (tm)!"); 40 | JButton button = new JButton("Gho Ghost"); 41 | frame.getContentPane().add(button); 42 | button.addActionListener(new CircleListener(robot)); 43 | 44 | frame.pack(); 45 | frame.setLocation((int) (size.getWidth() - frame.getWidth()) / 2, 46 | (int) (size.getHeight() - frame.getHeight()) / 2); 47 | frame.setVisible(true); 48 | } 49 | } -------------------------------------------------------------------------------- /test/jake2/qcommon/TestCMD.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 29.12.2003 by RST. 22 | 23 | package jake2.qcommon; 24 | 25 | import jake2.game.Cmd; 26 | 27 | import java.io.BufferedReader; 28 | import java.io.InputStreamReader; 29 | 30 | public class TestCMD { 31 | 32 | public static void main(String args[]) { 33 | try { 34 | Cmd.Init(); 35 | Cmd.RemoveCommand("exec"); 36 | 37 | BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); 38 | System.out.println("Give some commands:"); 39 | 40 | while (true) { 41 | System.out.println("#"); 42 | String line = br.readLine(); 43 | Cmd.ExecuteString(line); 44 | } 45 | } 46 | catch (Exception e) { 47 | e.printStackTrace(); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /test/jake2/qcommon/TestCOM.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 29.12.2003 by RST. 22 | 23 | package jake2.qcommon; 24 | 25 | public class TestCOM { 26 | 27 | public static void main(String args[]) { 28 | String test = "testrene = \"ein mal eins\"; a=3 "; 29 | Com.ParseHelp ph = new Com.ParseHelp(test); 30 | 31 | while (!ph.isEof()) 32 | System.out.println("[" + Com.Parse(ph) + "]"); 33 | 34 | System.out.println("OK!"); 35 | 36 | test = " testrene = \"ein mal eins\"; a=3"; 37 | 38 | ph = new Com.ParseHelp(test); 39 | 40 | while (!ph.isEof()) 41 | System.out.println("[" + Com.Parse(ph) + "]"); 42 | 43 | System.out.println("OK!"); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /test/jake2/qcommon/TestCvar.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 29.12.2003 by RST. 22 | // $Id: TestCvar.java,v 1.1 2004-07-07 19:59:56 hzi Exp $ 23 | 24 | package jake2.qcommon; 25 | 26 | 27 | // import jake2.*; 28 | // import jake2.client.*; 29 | // import jake2.game.*; 30 | // import jake2.qcommon.*; 31 | // import jake2.render.*; 32 | // import jake2.server.*; 33 | 34 | public class TestCvar { 35 | 36 | public static void main(String[] args) { 37 | Cvar.Set("rene", "is cool."); 38 | 39 | Com.Printf("rene:" + Cvar.FindVar("rene").string); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /test/jake2/qcommon/TestINFO.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 29.12.2003 by RST. 22 | 23 | package jake2.qcommon; 24 | 25 | import jake2.game.Info; 26 | 27 | public class TestINFO { 28 | 29 | public static void main(String args[]) { 30 | String test = "\\key1\\value 1\\key 2 \\value2\\key3\\ v a l u e 3\\key4\\val ue 4"; 31 | Info.Print(test); 32 | test = Info.Info_RemoveKey(test, "key1"); 33 | Info.Print(test); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /test/jake2/qcommon/TestLoadGame.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1997-2001 Id Software, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU General Public License as published by the Free Software 6 | * Foundation; either version 2 of the License, or (at your option) any later 7 | * version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | * FOR A PARTICULAR PURPOSE. 12 | * 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place - Suite 330, Boston, MA 02111-1307, USA. 18 | * 19 | */ 20 | 21 | // Created on 02.01.2004 by RST. 22 | // $Id: TestLoadGame.java,v 1.2 2004-09-22 19:22:10 salomo Exp $ 23 | package jake2.qcommon; 24 | 25 | import jake2.game.GameSave; 26 | 27 | public class TestLoadGame { 28 | public static void main(String args[]) { 29 | 30 | Qcommon.Init(args); 31 | 32 | System.out.println("hello!"); 33 | GameSave.InitGame(); 34 | GameSave.ReadGame("test/data/savegames/game.ssv"); 35 | } 36 | } -------------------------------------------------------------------------------- /test/jake2/qcommon/TestLoadMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2001 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | 21 | // Created on 02.01.2004 by RST. 22 | // $Id: TestLoadMap.java,v 1.2 2004-07-09 06:50:51 hzi Exp $ 23 | 24 | package jake2.qcommon; 25 | 26 | public class TestLoadMap { 27 | public static void main(String[] args) { 28 | Com.DPrintf("hello!\n"); 29 | 30 | FS.InitFilesystem(); 31 | 32 | CM.CM_LoadMap("maps/base1.bsp", true, new int[]{0}); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /test/jake2/qcommon/TestMSG.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Created on 30.01.2004 3 | * 4 | * To change this generated comment go to 5 | * Window>Preferences>Java>Code Generation>Code Template 6 | */ 7 | package jake2.qcommon; 8 | 9 | import jake2.Defines; 10 | /** 11 | * @author rst 12 | */ 13 | public class TestMSG extends MSG { 14 | public static void main(String[] args) { 15 | 16 | byte buf_data[] = new byte[Defines.MAX_MSGLEN]; 17 | sizebuf_t buf = new sizebuf_t(); 18 | 19 | SZ.Init(buf, buf_data, Defines.MAX_MSGLEN); 20 | 21 | MSG.WriteInt(buf, 0x80000000); 22 | MSG.WriteInt(buf, 0x12345678); 23 | MSG.WriteInt(buf, 0x7fffffff); 24 | MSG.WriteInt(buf, 0xffffffff); 25 | 26 | 27 | MSG.WriteByte(buf, 1); 28 | MSG.WriteByte(buf, 2); 29 | MSG.WriteByte(buf, 3); 30 | MSG.WriteByte(buf, 4); 31 | SZ.Print(buf, "[einz]\n"); 32 | SZ.Print(buf, "[zwei]..."); 33 | 34 | MSG.WriteByte(buf, 0xfe); 35 | MSG.WriteByte(buf, 4); 36 | 37 | MSG.WriteShort(buf, 32766); 38 | MSG.WriteShort(buf, 16384); 39 | MSG.WriteShort(buf, -32768); 40 | 41 | 42 | 43 | MSG.WriteFloat(buf, (float) Math.PI); 44 | 45 | System.out.println("Read:" + Integer.toHexString(MSG.ReadLong(buf))); 46 | System.out.println("Read:" + Integer.toHexString(MSG.ReadLong(buf))); 47 | System.out.println("Read:" + Integer.toHexString(MSG.ReadLong(buf))); 48 | System.out.println("Read:" + Integer.toHexString(MSG.ReadLong(buf))); 49 | 50 | System.out.println("Read:" + MSG.ReadByte(buf)); 51 | System.out.println("Read:" + MSG.ReadByte(buf)); 52 | System.out.println("Read:" + MSG.ReadByte(buf)); 53 | System.out.println("Read:" + MSG.ReadByte(buf)); 54 | System.out.println("Read:<" + MSG.ReadString(buf) + ">"); 55 | 56 | System.out.println("Read:" + MSG.ReadByte(buf)); 57 | System.out.println("Read:" + MSG.ReadByte(buf)); 58 | 59 | System.out.println("Read:" + MSG.ReadShort(buf)); 60 | System.out.println("Read:" + MSG.ReadShort(buf)); 61 | System.out.println("Read:" + MSG.ReadShort(buf)); 62 | 63 | System.out.println("Read:" + MSG.ReadFloat(buf)); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /test/jake2/render/DisposeBuffer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Created on May 13, 2005 3 | * 4 | */ 5 | package jake2.render; 6 | 7 | import java.nio.Buffer; 8 | import java.nio.ByteBuffer; 9 | 10 | /** 11 | * @author cwei 12 | * 13 | */ 14 | public class DisposeBuffer { 15 | 16 | // 160 MB direct buffers 17 | static int SIZE = 1024 * 1024; 18 | static int COUNT = 160; 19 | 20 | public static void main(String[] args) { 21 | System.out.println("DirectBuffer allocation."); 22 | Buffer[] buf = new Buffer[COUNT]; 23 | Runtime run = Runtime.getRuntime(); 24 | System.gc(); 25 | for (int i = 0; i < COUNT; i++) { 26 | buf[i] = ByteBuffer.allocateDirect(SIZE); 27 | } 28 | System.gc(); 29 | System.out.println((run.totalMemory() / 1024) + "KB heap"); 30 | try { 31 | Thread.sleep(10000); 32 | } catch (InterruptedException e) { 33 | } 34 | System.out.println("DirectBuffer dispose."); 35 | for (int i = 0; i < COUNT; i++) { 36 | buf[i] = null; 37 | } 38 | System.gc(); 39 | System.out.println((run.totalMemory() / 1024) + "KB heap"); 40 | try { 41 | Thread.sleep(20000); 42 | } catch (InterruptedException e) { 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /webstart/.cvsignore: -------------------------------------------------------------------------------- 1 | lib 2 | -------------------------------------------------------------------------------- /webstart/icon.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbien/jake2/0eba8e26ff1426d4fb2b6b58e9825f72def4c8f3/webstart/icon.gif -------------------------------------------------------------------------------- /webstart/jake2_jogl11.jnlp: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | Jake2 8 | Bytonic Software 9 | 10 | Java port of the Quake2 game engine 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | +set 29 | vid_ref 30 | fastjogl 31 | +set 32 | s_impl 33 | joal 34 | +set 35 | adr0 36 | jake2.in-chemnitz.de 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /webstart/jake2_jsr231.jnlp: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | Jake2 8 | Bytonic Software 9 | 10 | Java port of the Quake2 game engine 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | +set 29 | vid_ref 30 | jsr231 31 | +set 32 | s_impl 33 | joal 34 | +set 35 | adr0 36 | jake2.in-chemnitz.de 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /webstart/jake2_lwjgl.jnlp: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | Jake2 8 | Bytonic Software 9 | 10 | Java port of the Quake2 game engine 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | +set 40 | vid_ref 41 | lwjgl 42 | +set 43 | s_impl 44 | lwjgl 45 | +set 46 | adr0 47 | jake2.in-chemnitz.de 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /webstart/jake2_online.jnlp: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | Jake2 8 | Bytonic Software 9 | 10 | Java port of the Quake2 game engine 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | +set 29 | vid_ref 30 | jsr231 31 | +set 32 | s_impl 33 | joal 34 | +set 35 | adr0 36 | jake2.in-chemnitz.de 37 | +set 38 | clientport 39 | 27910 40 | +connect 41 | 88.198.147.212 42 | 43 | 44 | 45 | --------------------------------------------------------------------------------