├── .gitignore ├── LICENSE.md ├── README.md ├── README_Images ├── Game_Install_Guide_00.jpg ├── Game_Install_Guide_00_0.jpg ├── Game_Install_Guide_00_A.jpg ├── Game_Install_Guide_00_B.jpg ├── Game_Install_Guide_00_C.jpg ├── Game_Install_Guide_00_D.jpg ├── Game_Install_Guide_00_E.jpg ├── Game_Install_Guide_00_F.jpg ├── Game_Install_Guide_01.jpg ├── Game_Install_Guide_01_A.jpg ├── Game_Install_Guide_02.jpg ├── Game_Install_Guide_03.jpg ├── Game_Install_Guide_04.jpg ├── Game_Install_Guide_05A.jpg ├── Game_Install_Guide_05AB.jpg ├── Game_Install_Guide_05B.jpg ├── Game_Install_Guide_06.jpg ├── Game_Install_Guide_06A.jpg ├── Game_Install_Guide_07.jpg ├── Game_Install_Guide_08.jpg ├── In_Game_Controls.jpg ├── Menu_Controls.jpg ├── Music_Install_Guide_00.jpg ├── Music_Install_Guide_00A.jpg ├── Music_Install_Guide_01.jpg ├── Music_Install_Guide_02.jpg ├── Music_Install_Guide_03.jpg ├── Simulator_0.png ├── Simulator_1.png ├── WQ2_Photo_1.jpg ├── WQ2_Photo_2.jpg ├── WQ2_Photo_3.jpg ├── WQ2_Photo_4.jpg ├── WQ2_Photo_5.jpg ├── Watch_1.png ├── Watch_Quake2_Logo_01.png ├── Watch_Quake2_demo1_00.gif └── wquake2_ico_00.png ├── WatchQuake2 Watch App ├── Assets.xcassets │ ├── AccentColor.colorset │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ └── wquake2_ico_1024x1024.png │ └── Contents.json ├── ContentView.swift ├── Preview Content │ └── Preview Assets.xcassets │ │ └── Contents.json ├── Resources │ ├── baseq2 │ │ ├── config.cfg │ │ ├── music │ │ │ └── music_files_here.txt │ │ ├── pak3.pak │ │ └── video │ │ │ └── video_files_here.txt │ └── mapselect │ │ ├── base1.gif │ │ ├── base2.gif │ │ ├── base3.gif │ │ ├── biggun.gif │ │ ├── boss1.gif │ │ ├── boss2.gif │ │ ├── bunk1.gif │ │ ├── city1.gif │ │ ├── city2.gif │ │ ├── city3.gif │ │ ├── command.gif │ │ ├── cool1.gif │ │ ├── fact1.gif │ │ ├── fact2.gif │ │ ├── fact3.gif │ │ ├── hangar1.gif │ │ ├── hangar2.gif │ │ ├── jail1.gif │ │ ├── jail2.gif │ │ ├── jail3.gif │ │ ├── jail4.gif │ │ ├── jail5.gif │ │ ├── lab.gif │ │ ├── mine1.gif │ │ ├── mine2.gif │ │ ├── mine3.gif │ │ ├── mine4.gif │ │ ├── mintro.gif │ │ ├── power1.gif │ │ ├── power2.gif │ │ ├── security.gif │ │ ├── space.gif │ │ ├── strike.gif │ │ ├── train.gif │ │ ├── ware1.gif │ │ ├── ware2.gif │ │ ├── waste1.gif │ │ ├── waste2.gif │ │ └── waste3.gif ├── TouchEventModifier.swift ├── WQuake2 │ ├── Quake2Wrapper.h │ ├── Quake2Wrapper.m │ ├── Threading.c │ ├── Threading.cpp │ ├── Threading.h │ ├── Threading.hpp │ ├── WQ2Common.c │ ├── WQ2Common.h │ ├── WQ2SoundCallback.c │ ├── WQ2SoundCallback.h │ ├── WatchQuake2 Watch App-Bridging-Header.h │ ├── cd_watch.c │ ├── cd_watch.h │ ├── in_watch.c │ ├── net_watch.c │ ├── sound_watch.c │ ├── sw_watch.c │ ├── sw_watch.h │ ├── sys_watch.c │ ├── sys_watch.h │ └── vid_watch.c ├── WatchQuake2App.swift └── id2 │ ├── client │ ├── adivtab.h │ ├── anorms.h │ ├── cdaudio.h │ ├── cl_cin.c │ ├── cl_ents.c │ ├── cl_fx.c │ ├── cl_input.c │ ├── cl_inv.c │ ├── cl_main.c │ ├── cl_newfx.c │ ├── cl_parse.c │ ├── cl_pred.c │ ├── cl_scrn.c │ ├── cl_tent.c │ ├── cl_view.c │ ├── client.h │ ├── console.c │ ├── console.h │ ├── input.h │ ├── keys.c │ ├── keys.h │ ├── menu.c │ ├── qmenu.c │ ├── qmenu.h │ ├── ref.h │ ├── screen.h │ ├── snd_dma.c │ ├── snd_loc.h │ ├── snd_mem.c │ ├── snd_mix.c │ ├── sound.h │ └── vid.h │ ├── game │ ├── g_ai.c │ ├── g_chase.c │ ├── g_cmds.c │ ├── g_combat.c │ ├── g_func.c │ ├── g_func_list.h │ ├── g_items.c │ ├── g_local.h │ ├── g_main.c │ ├── g_main.h │ ├── g_misc.c │ ├── g_monster.c │ ├── g_move_list.h │ ├── g_phys.c │ ├── g_save.c │ ├── g_save_common.c │ ├── g_save_common.h │ ├── g_spawn.c │ ├── g_svcmds.c │ ├── g_target.c │ ├── g_tbl_funcs.c │ ├── g_tbl_funcs.h │ ├── g_tbl_movs.c │ ├── g_tbl_movs.h │ ├── g_trigger.c │ ├── g_turret.c │ ├── g_utils.c │ ├── g_weapon.c │ ├── game.h │ ├── local_lib.h │ ├── m_actor.c │ ├── m_actor.h │ ├── m_berserk.c │ ├── m_berserk.h │ ├── m_boss2.c │ ├── m_boss2.h │ ├── m_boss3.c │ ├── m_boss31.c │ ├── m_boss31.h │ ├── m_boss32.c │ ├── m_boss32.h │ ├── m_brain.c │ ├── m_brain.h │ ├── m_chick.c │ ├── m_chick.h │ ├── m_flash.c │ ├── m_flipper.c │ ├── m_flipper.h │ ├── m_float.c │ ├── m_float.h │ ├── m_flyer.c │ ├── m_flyer.h │ ├── m_gladiator.c │ ├── m_gladiator.h │ ├── m_gunner.c │ ├── m_gunner.h │ ├── m_hover.c │ ├── m_hover.h │ ├── m_infantry.c │ ├── m_infantry.h │ ├── m_insane.c │ ├── m_insane.h │ ├── m_medic.c │ ├── m_medic.h │ ├── m_move.c │ ├── m_mutant.c │ ├── m_mutant.h │ ├── m_parasite.c │ ├── m_parasite.h │ ├── m_player.h │ ├── m_rider.h │ ├── m_soldier.c │ ├── m_soldier.h │ ├── m_supertank.c │ ├── m_supertank.h │ ├── m_tank.c │ ├── m_tank.h │ ├── p_client.c │ ├── p_hud.c │ ├── p_trail.c │ ├── p_view.c │ ├── p_weapon.c │ ├── q_shared.c │ └── q_shared.h │ ├── null │ ├── cd_null.c │ ├── cl_null.c │ ├── snddma_null.c │ ├── swimp_null.c │ └── vid_null.c │ ├── qcommon │ ├── cmd.c │ ├── cmodel.c │ ├── common.c │ ├── crc.c │ ├── crc.h │ ├── cvar.c │ ├── files.c │ ├── md4.c │ ├── net_chan.c │ ├── pmove.c │ ├── qcommon.h │ └── qfiles.h │ ├── ref_soft │ ├── adivtab.h │ ├── anorms.h │ ├── r_aclip.c │ ├── r_alias.c │ ├── r_bsp.c │ ├── r_draw.c │ ├── r_edge.c │ ├── r_image.c │ ├── r_light.c │ ├── r_local.h │ ├── r_main.c │ ├── r_misc.c │ ├── r_model.c │ ├── r_model.h │ ├── r_part.c │ ├── r_poly.c │ ├── r_polyse.c │ ├── r_rast.c │ ├── r_scan.c │ ├── r_sprite.c │ ├── r_surf.c │ └── rand1k.h │ └── server │ ├── server.h │ ├── sv_ccmds.c │ ├── sv_ents.c │ ├── sv_game.c │ ├── sv_init.c │ ├── sv_main.c │ ├── sv_null.c │ ├── sv_send.c │ ├── sv_user.c │ └── sv_world.c └── WatchQuake2.xcodeproj ├── project.pbxproj └── xcshareddata └── xcschemes ├── WatchQuake2 Debug.xcscheme └── WatchQuake2 Release.xcscheme /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.xcuserstate 3 | project.xcworkspace/ 4 | xcuserdata/ -------------------------------------------------------------------------------- /README_Images/Game_Install_Guide_00.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Game_Install_Guide_00.jpg -------------------------------------------------------------------------------- /README_Images/Game_Install_Guide_00_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Game_Install_Guide_00_0.jpg -------------------------------------------------------------------------------- /README_Images/Game_Install_Guide_00_A.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Game_Install_Guide_00_A.jpg -------------------------------------------------------------------------------- /README_Images/Game_Install_Guide_00_B.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Game_Install_Guide_00_B.jpg -------------------------------------------------------------------------------- /README_Images/Game_Install_Guide_00_C.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Game_Install_Guide_00_C.jpg -------------------------------------------------------------------------------- /README_Images/Game_Install_Guide_00_D.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Game_Install_Guide_00_D.jpg -------------------------------------------------------------------------------- /README_Images/Game_Install_Guide_00_E.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Game_Install_Guide_00_E.jpg -------------------------------------------------------------------------------- /README_Images/Game_Install_Guide_00_F.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Game_Install_Guide_00_F.jpg -------------------------------------------------------------------------------- /README_Images/Game_Install_Guide_01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Game_Install_Guide_01.jpg -------------------------------------------------------------------------------- /README_Images/Game_Install_Guide_01_A.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Game_Install_Guide_01_A.jpg -------------------------------------------------------------------------------- /README_Images/Game_Install_Guide_02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Game_Install_Guide_02.jpg -------------------------------------------------------------------------------- /README_Images/Game_Install_Guide_03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Game_Install_Guide_03.jpg -------------------------------------------------------------------------------- /README_Images/Game_Install_Guide_04.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Game_Install_Guide_04.jpg -------------------------------------------------------------------------------- /README_Images/Game_Install_Guide_05A.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Game_Install_Guide_05A.jpg -------------------------------------------------------------------------------- /README_Images/Game_Install_Guide_05AB.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Game_Install_Guide_05AB.jpg -------------------------------------------------------------------------------- /README_Images/Game_Install_Guide_05B.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Game_Install_Guide_05B.jpg -------------------------------------------------------------------------------- /README_Images/Game_Install_Guide_06.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Game_Install_Guide_06.jpg -------------------------------------------------------------------------------- /README_Images/Game_Install_Guide_06A.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Game_Install_Guide_06A.jpg -------------------------------------------------------------------------------- /README_Images/Game_Install_Guide_07.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Game_Install_Guide_07.jpg -------------------------------------------------------------------------------- /README_Images/Game_Install_Guide_08.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Game_Install_Guide_08.jpg -------------------------------------------------------------------------------- /README_Images/In_Game_Controls.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/In_Game_Controls.jpg -------------------------------------------------------------------------------- /README_Images/Menu_Controls.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Menu_Controls.jpg -------------------------------------------------------------------------------- /README_Images/Music_Install_Guide_00.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Music_Install_Guide_00.jpg -------------------------------------------------------------------------------- /README_Images/Music_Install_Guide_00A.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Music_Install_Guide_00A.jpg -------------------------------------------------------------------------------- /README_Images/Music_Install_Guide_01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Music_Install_Guide_01.jpg -------------------------------------------------------------------------------- /README_Images/Music_Install_Guide_02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Music_Install_Guide_02.jpg -------------------------------------------------------------------------------- /README_Images/Music_Install_Guide_03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Music_Install_Guide_03.jpg -------------------------------------------------------------------------------- /README_Images/Simulator_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Simulator_0.png -------------------------------------------------------------------------------- /README_Images/Simulator_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Simulator_1.png -------------------------------------------------------------------------------- /README_Images/WQ2_Photo_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/WQ2_Photo_1.jpg -------------------------------------------------------------------------------- /README_Images/WQ2_Photo_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/WQ2_Photo_2.jpg -------------------------------------------------------------------------------- /README_Images/WQ2_Photo_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/WQ2_Photo_3.jpg -------------------------------------------------------------------------------- /README_Images/WQ2_Photo_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/WQ2_Photo_4.jpg -------------------------------------------------------------------------------- /README_Images/WQ2_Photo_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/WQ2_Photo_5.jpg -------------------------------------------------------------------------------- /README_Images/Watch_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Watch_1.png -------------------------------------------------------------------------------- /README_Images/Watch_Quake2_Logo_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Watch_Quake2_Logo_01.png -------------------------------------------------------------------------------- /README_Images/Watch_Quake2_demo1_00.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/Watch_Quake2_demo1_00.gif -------------------------------------------------------------------------------- /README_Images/wquake2_ico_00.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/README_Images/wquake2_ico_00.png -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "wquake2_ico_1024x1024.png", 5 | "idiom" : "universal", 6 | "platform" : "watchos", 7 | "size" : "1024x1024" 8 | } 9 | ], 10 | "info" : { 11 | "author" : "xcode", 12 | "version" : 1 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Assets.xcassets/AppIcon.appiconset/wquake2_ico_1024x1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Assets.xcassets/AppIcon.appiconset/wquake2_ico_1024x1024.png -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // WatchQuake2 Watch App 4 | // 5 | // Created by ByteOverlord on 26.11.2022. 6 | // 7 | 8 | import SwiftUI 9 | import UIKit 10 | 11 | class Model : ObservableObject { 12 | @Published var mapTxt : String! 13 | @Published var txt = String("") 14 | @Published var benchmarkTxt = String("") 15 | @Published var img : CGImage! 16 | init() { 17 | mapTxt = nil 18 | img = nil 19 | txt = String("") 20 | benchmarkTxt = String("") 21 | } 22 | } 23 | 24 | let myModel = Model() 25 | 26 | @_cdecl("refresh_screen") 27 | func refreshScreen(ptr: UnsafeRawPointer) -> () { 28 | myModel.img = WQCreateGameImage()!.takeRetainedValue() 29 | myModel.benchmarkTxt = String(cString: WQGetBenchmarkString()) 30 | if (WQShowFPS() != 0) 31 | { 32 | myModel.txt = String(cString: WQGetStatsString()) 33 | } 34 | else 35 | { 36 | myModel.txt = String("") 37 | } 38 | } 39 | 40 | @_cdecl("refresh_mapselect") 41 | func refreshMapselect(ptr: UnsafeRawPointer) -> () { 42 | let mapName = WQGetSelectedMapName() 43 | if mapName == nil { 44 | myModel.mapTxt = nil 45 | } 46 | else { 47 | myModel.mapTxt = String(cString: mapName!) 48 | } 49 | } 50 | 51 | struct ImageOverlay: View { 52 | @ObservedObject var model: Model 53 | init() { 54 | model = myModel 55 | } 56 | var body: some View { 57 | Text(model.txt).font(.system(size: 6)).fixedSize().padding(Edge.Set(Edge.top), Double(-8.0)) 58 | Text(model.benchmarkTxt).font(.system(size: 6)).fixedSize().padding(Edge.Set(Edge.top), Double(8.0)) 59 | } 60 | } 61 | 62 | struct MapsOverlay: View { 63 | @ObservedObject var model: Model 64 | init() { 65 | model = myModel 66 | } 67 | var body: some View { 68 | if model.mapTxt != nil 69 | { 70 | let stats = WQGetStats() 71 | let gif = UIImage(named: String("mapselect/") + model.mapTxt + String(".gif"), in: Bundle.main, with: nil) 72 | if gif != nil { 73 | let scaleX = 256.0 / Double(stats.devPixelsPerDot) 74 | let scaleY = 246.0 / Double(stats.devPixelsPerDot) 75 | let offsetY = Double(8.0 / stats.devPixelsPerDot) 76 | Image.init(uiImage: gif!).resizable().scaledToFit().frame(width: scaleX, height: scaleY).padding(Edge.Set(Edge.bottom), offsetY) 77 | } 78 | } 79 | } 80 | } 81 | 82 | struct NullView: View { 83 | init() { 84 | } 85 | var body: some View { 86 | Text("").frame(width: 0, height: 0) 87 | } 88 | } 89 | 90 | struct ContentView: View { 91 | @State var isTapped = false 92 | @ObservedObject var model: Model 93 | init() 94 | { 95 | model = myModel 96 | } 97 | var body: some View { 98 | let stats = WQGetStats() 99 | //let scaleX = (Float(stats.width) / Float(stats.devWidth)) 100 | //let scaleY = (Float(stats.height) / Float(stats.devHeight)) 101 | let scale = stats.devPixelsPerDot//scaleY > scaleX ? scaleY : scaleX 102 | if (model.img != nil) 103 | { 104 | //let offset = CGSize(width: 0.0, height: 128.0) 105 | Image.init(model.img, scale: Double(scale), label: Text("Game")) 106 | //.scaledToFit() 107 | .overlay(MapsOverlay(), alignment: .bottom) 108 | .overlay(ImageOverlay(), alignment: .top) 109 | } 110 | } 111 | } 112 | 113 | /*struct ContentView_Previews: PreviewProvider { 114 | static var previews: some View { 115 | ContentView() 116 | } 117 | }*/ 118 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/baseq2/config.cfg: -------------------------------------------------------------------------------- 1 | // generated by quake, do not modify 2 | set gl_3dlabs_broken "1" 3 | set gl_swapinterval "1" 4 | set gl_ext_compiled_vertex_array "1" 5 | set gl_ext_pointparameters "1" 6 | set gl_ext_multitexture "1" 7 | set gl_ext_palettedtexture "1" 8 | set gl_ext_swapinterval "1" 9 | set gl_vertex_arrays "0" 10 | set gl_texturesolidmode "default" 11 | set gl_texturealphamode "default" 12 | set gl_texturemode "GL_LINEAR_MIPMAP_NEAREST" 13 | set gl_driver "opengl32" 14 | set gl_finish "0" 15 | set gl_shadows "0" 16 | set gl_mode "3" 17 | set gl_modulate "1" 18 | set gl_particle_att_c "0.01" 19 | set gl_particle_att_b "0.0" 20 | set gl_particle_att_a "0.01" 21 | set gl_particle_size "40" 22 | set gl_particle_max_size "40" 23 | set gl_particle_min_size "2" 24 | set g_select_empty "0" 25 | set in_joystick "0" 26 | set in_mouse "0" 27 | set cl_vwep "0" 28 | set gender_auto "1" 29 | set gender "male" 30 | set fov "90" 31 | set msg "1" 32 | set rate "25000" 33 | set freelook "0" 34 | set cl_stereo_separation "0.4" 35 | set adr8 "" 36 | set adr7 "" 37 | set adr6 "" 38 | set adr5 "" 39 | set adr4 "" 40 | set adr3 "" 41 | set adr2 "" 42 | set adr1 "" 43 | set adr0 "" 44 | set cd_nocd "0" 45 | set s_primary "0" 46 | set s_mixahead "0.2" 47 | set s_loadas8bit "1" 48 | set s_khz "11" 49 | set s_volume "0.2" 50 | set bgm_volume "0.2" 51 | set cin_volume "0.2" 52 | set sw_mode "0" 53 | set sw_stipplealpha "0" 54 | set sw_allow_modex "1" 55 | set vid_gamma "0.5" 56 | set vid_ypos "32" 57 | set vid_xpos "115" 58 | set vid_ref "gl" 59 | set sv_reconnect_limit "3" 60 | set allow_download_maps "1" 61 | set allow_download_sounds "1" 62 | set allow_download_models "1" 63 | set allow_download_players "0" 64 | set allow_download "0" 65 | set hostname "noname" 66 | set skin "male/grunt" 67 | set name "hook" 68 | set lookstrafe "0" 69 | set lookspring "0" 70 | set m_pitch "0.022000" 71 | set hand "0" 72 | set cl_run "0" 73 | set crosshair "1" 74 | set sensitivity "4" 75 | set joy_forwardsensitivity "1.7" 76 | set joy_sidesensitivity "1.7" 77 | set movement_friction "1" 78 | set cl_jumpandcrouch "1" 79 | set win_noalttab "0" 80 | set vid_fullscreen "0" 81 | set viewsize "100" 82 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/baseq2/music/music_files_here.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/baseq2/music/music_files_here.txt -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/baseq2/pak3.pak: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/baseq2/pak3.pak -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/baseq2/video/video_files_here.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/baseq2/video/video_files_here.txt -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/base1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/base1.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/base2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/base2.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/base3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/base3.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/biggun.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/biggun.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/boss1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/boss1.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/boss2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/boss2.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/bunk1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/bunk1.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/city1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/city1.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/city2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/city2.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/city3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/city3.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/command.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/command.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/cool1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/cool1.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/fact1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/fact1.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/fact2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/fact2.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/fact3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/fact3.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/hangar1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/hangar1.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/hangar2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/hangar2.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/jail1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/jail1.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/jail2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/jail2.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/jail3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/jail3.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/jail4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/jail4.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/jail5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/jail5.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/lab.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/lab.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/mine1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/mine1.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/mine2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/mine2.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/mine3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/mine3.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/mine4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/mine4.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/mintro.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/mintro.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/power1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/power1.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/power2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/power2.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/security.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/security.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/space.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/space.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/strike.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/strike.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/train.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/train.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/ware1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/ware1.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/ware2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/ware2.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/waste1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/waste1.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/waste2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/waste2.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/Resources/mapselect/waste3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/Resources/mapselect/waste3.gif -------------------------------------------------------------------------------- /WatchQuake2 Watch App/TouchEventModifier.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TouchEventModifier.swift 3 | // WatchQuake Watch App 4 | // 5 | // Created by ByteOverlord on 30.10.2022. 6 | // 7 | 8 | import Foundation 9 | import SwiftUI 10 | 11 | extension View { 12 | func onTouchDownAndPanGesture(callback: @escaping (CGPoint,Int) -> Void) -> some View { 13 | modifier(TouchDownAndPanEventModifier(callback: callback)) 14 | } 15 | } 16 | 17 | struct TouchDownAndPanEventModifier: ViewModifier { 18 | @GestureState private var touchState = false 19 | @State private var tapped = false 20 | @State private var time = UInt64(0) 21 | let callback: (CGPoint,Int) -> Void 22 | func body(content: Content) -> some View { 23 | content 24 | .simultaneousGesture( 25 | DragGesture(minimumDistance: 0.0) 26 | .updating($touchState) {(value, gestureState, transaction) in 27 | gestureState = true 28 | } 29 | .onChanged { value in 30 | if !self.tapped { 31 | self.tapped = true 32 | self.time = GetTimeNanoSeconds()// thread safe? 33 | } 34 | self.callback(value.location,1)// pan changed 35 | } 36 | .onEnded { value in 37 | var called = false 38 | if self.tapped { 39 | var curTime = GetTimeNanoSeconds()// thread safe? 40 | var delta = GetDeltaTime(curTime - self.time) 41 | var diffX = value.startLocation.x - value.location.x 42 | var diffY = value.startLocation.y - value.location.y 43 | var distSq = diffX * diffX + diffY * diffY 44 | if (delta < 0.2 && distSq < 4.0) { 45 | self.callback(value.location,2)// tap and pan 46 | called = true 47 | } 48 | } 49 | if !called { 50 | self.callback(value.location,0)// pan end 51 | } 52 | self.tapped = false 53 | } 54 | ).onChange(of: touchState) { _ in 55 | // gesture cancelled 56 | if touchState == false && self.tapped { 57 | self.callback(CGPoint(x: 0.0, y: 0.0),-1)// pan cancel 58 | self.tapped = false 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/WQuake2/Quake2Wrapper.h: -------------------------------------------------------------------------------- 1 | // 2 | // Quake2Wrapper.h 3 | // WatchQuake2 4 | // 5 | // Created by ByteOverlord on 26.11.2022. 6 | // 7 | 8 | #ifndef Quake2Wrapper_h 9 | #define Quake2Wrapper_h 10 | 11 | #import 12 | 13 | #define WQ_STATE_EXIT -1 14 | #define WQ_STATE_PAUSE 0 15 | #define WQ_STATE_PLAY 1 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | #include "WQ2Common.h" 22 | 23 | extern float g_WQForwardSpeed; 24 | extern float g_WQTurnX; 25 | extern float g_WQTurnY; 26 | extern u32 g_WQCrouchState; 27 | 28 | #define WQ_INPUT_FIRE (u16)(0x0001) 29 | #define WQ_INPUT_PREVWEAPON (u16)(0x0002) 30 | #define WQ_INPUT_NEXTWEAPON (u16)(0x0004) 31 | #define WQ_INPUT_JUMP (u16)(0x0008) 32 | 33 | #define WQ_INPUT_MENU_ESCAPE (u16)(0x0010) 34 | #define WQ_INPUT_MENU_ENTER (u16)(0x0020) 35 | #define WQ_INPUT_MENU_LEFT (u16)(0x0040) 36 | #define WQ_INPUT_MENU_RIGHT (u16)(0x0080) 37 | 38 | #define WQ_INPUT_MENU_UP (u16)(0x0100) 39 | #define WQ_INPUT_MENU_DOWN (u16)(0x0200) 40 | #define WQ_INPUT_CHEAT (u16)(0x0400) 41 | #define WQ_INPUT_INV_PREV (u16)(0x0800) 42 | 43 | #define WQ_INPUT_CROUCH (u16)(0x1000) 44 | #define WQ_INPUT_INV_NEXT (u16)(0x2000) 45 | #define WQ_INPUT_INV_USE (u16)(0x4000) 46 | #define WQ_INPUT_HELP (u16)(0x8000) 47 | 48 | typedef struct 49 | { 50 | i32 frameCounter; 51 | float meanFrameTime; 52 | i32 width; 53 | i32 height; 54 | i32 devWidth; 55 | i32 devHeight; 56 | float devPixelsPerDot; 57 | } WQGameStats_t; 58 | 59 | int WQRequestState(int); 60 | void WQNotifyActive(int isActive); 61 | void WQNotifyHeadphoneState(int isActive, int Hz, uint bits, int channels, int interleaved, int type); 62 | void WQSetScreenSize(int width, int height, float pixelsPerDot); 63 | CGImageRef WQCreateGameImage(void); 64 | void WQInit(void); 65 | void WQSetLoop(void); 66 | void WQFree(void); 67 | int WQGetFrame(void); 68 | WQGameStats_t WQGetStats(void); 69 | const char* WQGetStatsString(void); 70 | const char* WQGetBenchmarkString(void); 71 | int WQShowFPS(void); 72 | void WQEndFrame(void); 73 | 74 | void WQInputTapAndPan(CGPoint point, int type); 75 | void WQInputLongPress(void); 76 | void WQInputCrownRotate(float f, float delta); 77 | 78 | int WQGetFrameBufferLength(void); 79 | void WQSetAudioFormat(int Hz, uint bits, int channels, int interleaved, int type); 80 | 81 | const char* WQGetSelectedMapName(void); 82 | 83 | #endif /* Quake2Wrapper_h */ 84 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/WQuake2/Threading.c: -------------------------------------------------------------------------------- 1 | // 2 | // Threading.c 3 | // WatchQuake Watch App 4 | // 5 | // Created by ByteOverlord on 29.10.2022. 6 | // 7 | 8 | #include "Threading.h" 9 | 10 | #include "WQ2Common.h" 11 | 12 | #include 13 | 14 | #include 15 | 16 | dispatch_queue_t gameQueue; 17 | dispatch_source_t gameTimer; 18 | dispatch_source_t mixerTimer; 19 | 20 | void SetGameUpdateTasks(ThreadingFunction gameLoopFunc, ThreadingFunction mixerLoopFunc, const char* name) 21 | { 22 | //dispatch_get_main_queue()); // serial queue 23 | dispatch_queue_attr_t qosAttribute = dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_CONCURRENT,QOS_CLASS_USER_INTERACTIVE,0); 24 | gameQueue = dispatch_queue_create(name,qosAttribute); 25 | 26 | gameTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER,0,0,gameQueue); 27 | { 28 | u64 leeaway = (1.0 / 480.0) * 1000000000.0; 29 | u64 interval = (1.0 / 60.0) * 1000000000.0; 30 | dispatch_source_set_timer(gameTimer,dispatch_walltime(NULL,0),interval,leeaway); 31 | dispatch_source_set_event_handler_f(gameTimer,(dispatch_function_t)gameLoopFunc); 32 | } 33 | 34 | mixerTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER,0,0,gameQueue); 35 | { 36 | u64 leeaway = (1.0 / 120.0) * 1000000000.0; 37 | u64 interval = (1.0 / 20.0) * 1000000000.0; 38 | dispatch_source_set_timer(mixerTimer,dispatch_walltime(NULL,0),interval,leeaway); 39 | dispatch_source_set_event_handler_f(mixerTimer,(dispatch_function_t)mixerLoopFunc); 40 | } 41 | } 42 | 43 | void SetGameLoopState(int i) 44 | { 45 | printf("game "); 46 | if (i) 47 | { 48 | printf("resume\n"); 49 | dispatch_resume(gameTimer); 50 | dispatch_resume(mixerTimer); 51 | } 52 | else 53 | { 54 | printf("suspend\n"); 55 | dispatch_suspend(gameTimer); 56 | dispatch_suspend(mixerTimer); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/WQuake2/Threading.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Threading.cpp 3 | // WatchQuake Watch App 4 | // 5 | // Created by ByteOverlord on 29.10.2022. 6 | // 7 | 8 | #include "Threading.hpp" 9 | 10 | #include 11 | #include 12 | 13 | int GetHardwareConcurrency(void) 14 | { 15 | return std::thread::hardware_concurrency(); 16 | } 17 | 18 | void SleepFor(int milliseconds) 19 | { 20 | std::this_thread::sleep_for(std::chrono::milliseconds(milliseconds)); 21 | } 22 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/WQuake2/Threading.h: -------------------------------------------------------------------------------- 1 | // 2 | // Threading.h 3 | // WatchQuake Watch App 4 | // 5 | // Created by ByteOverlord on 29.10.2022. 6 | // 7 | 8 | #ifndef Threading_h 9 | #define Threading_h 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | typedef void* (*ThreadingFunction)(void*); 16 | 17 | void SetGameUpdateTasks(ThreadingFunction gameLoop, ThreadingFunction mixerLoop, const char* name); 18 | void SetGameLoopState(int i); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | 24 | #endif /* Threading_h */ 25 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/WQuake2/Threading.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Threading.hpp 3 | // WatchQuake Watch App 4 | // 5 | // Created by ByteOverlord on 29.10.2022. 6 | // 7 | 8 | #ifndef Threading_hpp 9 | #define Threading_hpp 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | int GetHardwareConcurrency(void); 16 | void SleepFor(int milliseconds); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | 22 | #endif /* Threading_hpp */ 23 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/WQuake2/WQ2Common.c: -------------------------------------------------------------------------------- 1 | // 2 | // WQ2Common.c 3 | // WatchQuake2 Watch App 4 | // 5 | // Created by ByteOverlord on 26.11.2022. 6 | // 7 | 8 | #include "WQ2Common.h" 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | void* AlignedMalloc(size_t size, size_t alignment) 18 | { 19 | alignment -= 1; 20 | uintptr_t r = (uintptr_t)malloc(size + alignment + sizeof(uintptr_t)); 21 | if (!r) return NULL; 22 | 23 | uintptr_t t = r + sizeof(uintptr_t); 24 | uintptr_t o = (t + alignment) & ~(uintptr_t)alignment; 25 | ((uintptr_t*)o)[-1] = r; 26 | return (void*)o; 27 | } 28 | 29 | void AlignedFree(void* p) 30 | { 31 | if (!p) return; 32 | free((void*)(((uintptr_t*)p)[-1])); 33 | } 34 | 35 | int AlignedCheck(void* p, int alignment) 36 | { 37 | assert(alignment != 0); 38 | 39 | return ((uintptr_t)p % alignment) == 0; 40 | } 41 | 42 | u64 GetTimeNanoSeconds(void) 43 | { 44 | static mach_timebase_info_data_t sTimebaseInfo; 45 | uint64_t time = mach_absolute_time(); 46 | uint64_t nanos; 47 | 48 | if (sTimebaseInfo.denom == 0) 49 | { 50 | (void) mach_timebase_info(&sTimebaseInfo); 51 | } 52 | //printf("numer %i denom %i\n",sTimebaseInfo.numer,sTimebaseInfo.denom); 53 | nanos = (u64)(time) * (u64)(sTimebaseInfo.numer) / sTimebaseInfo.denom; 54 | return nanos; 55 | } 56 | 57 | double GetDeltaTime(u64 dt) 58 | { 59 | return (double)(dt) / 1000000000.0; 60 | } 61 | 62 | void TimeStepAccumulator_Set(TimeStepAccumulator_t* t, u64 freq, u64 limit) 63 | { 64 | t->accumulation = 0; 65 | t->frequency = freq; 66 | t->stepSize = 1000000000 / freq; 67 | t->accLimit = limit * t->stepSize; 68 | } 69 | void TimeStepAccumulator_Reset(TimeStepAccumulator_t* t) 70 | { 71 | t->accumulation = 0; 72 | } 73 | double TimeStepAccumulator_GetStepSize(TimeStepAccumulator_t* t) 74 | { 75 | return 1.0 / (double)(t->frequency); 76 | } 77 | double TimeStepAccumulator_GetDeltaTime(TimeStepAccumulator_t* t) 78 | { 79 | u64 tmp = (t->accumulation > t->stepSize) ? t->stepSize : t->accumulation; 80 | return (double)(tmp) / 1000000000.0; 81 | } 82 | double TimeStepAccumulator_GetDeltaTimeAccumulated(TimeStepAccumulator_t* t) 83 | { 84 | u64 tmp = t->accumulation; 85 | return (double)(tmp) / 1000000000.0; 86 | } 87 | int TimeStepAccumulator_Update(TimeStepAccumulator_t* t, u64 dt) 88 | { 89 | t->accumulation += dt; 90 | if (t->accumulation > t->accLimit) 91 | { 92 | t->accumulation = t->accLimit; 93 | } 94 | return t->accumulation >= t->stepSize; 95 | } 96 | int TimeStepAccumulator_Tick(TimeStepAccumulator_t* t) 97 | { 98 | int b = t->accumulation >= t->stepSize; 99 | if (b) 100 | { 101 | t->accumulation -= t->stepSize; 102 | } 103 | return b; 104 | } 105 | double TimeStepAccumulator_GetAlpha(TimeStepAccumulator_t* t) 106 | { 107 | return TimeStepAccumulator_GetDeltaTimeAccumulated(t) / TimeStepAccumulator_GetStepSize(t); 108 | } 109 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/WQuake2/WQ2Common.h: -------------------------------------------------------------------------------- 1 | // 2 | // WQ2Common.h 3 | // WatchQuake2 Watch App 4 | // 5 | // Created by ByteOverlord on 26.11.2022. 6 | // 7 | 8 | #ifndef WQ2Common_h 9 | #define WQ2Common_h 10 | 11 | #include 12 | 13 | typedef uint8_t byte; 14 | 15 | typedef uint8_t u8; 16 | typedef uint16_t u16; 17 | typedef uint32_t u32; 18 | typedef uint64_t u64; 19 | 20 | typedef int8_t i8; 21 | typedef int16_t i16; 22 | typedef int32_t i32; 23 | typedef int64_t i64; 24 | 25 | #define WQ_BLITTER_BLOCK64 26 | #define WQ_AUDIO_BLOCK64 27 | 28 | #define WQ_AUDIO_UNDERWATER_FILTER 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | typedef struct TimeStepAccumulator_s 35 | { 36 | u64 accumulation; 37 | u64 frequency; 38 | u64 stepSize; 39 | u64 accLimit; 40 | } TimeStepAccumulator_t; 41 | 42 | u64 GetTimeNanoSeconds(void); 43 | double GetDeltaTime(u64 dt); 44 | 45 | void* AlignedMalloc(size_t size, size_t alignment); 46 | void AlignedFree(void* p); 47 | int AlignedCheck(void* p, int alignment); 48 | 49 | void TimeStepAccumulator_Set(TimeStepAccumulator_t* t, u64 freq, u64 limit); 50 | void TimeStepAccumulator_Reset(TimeStepAccumulator_t* t); 51 | double TimeStepAccumulator_GetStepSize(TimeStepAccumulator_t* t); 52 | double TimeStepAccumulator_GetDeltaTime(TimeStepAccumulator_t* t); 53 | double TimeStepAccumulator_GetDeltaTimeAccumulated(TimeStepAccumulator_t* t); 54 | int TimeStepAccumulator_Update(TimeStepAccumulator_t* t, u64 dt); 55 | int TimeStepAccumulator_Tick(TimeStepAccumulator_t* t); 56 | double TimeStepAccumulator_GetAlpha(TimeStepAccumulator_t* t); 57 | 58 | #ifdef __cplusplus 59 | } 60 | #endif 61 | 62 | #endif /* WQ2Common_h */ 63 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/WQuake2/WQ2SoundCallback.c: -------------------------------------------------------------------------------- 1 | // 2 | // WQ2SoundCallback.c 3 | // WatchQuake2 Watch App 4 | // 5 | // Created by ByteOverlord on 7.12.2022. 6 | // 7 | 8 | #include "WQ2SoundCallback.h" 9 | 10 | #include "qcommon.h" 11 | #include "sound.h" 12 | #include "snd_loc.h" 13 | 14 | #include 15 | extern pthread_mutex_t snd_lock; 16 | 17 | void* WQAudioMixerLoop(void* p) 18 | { 19 | SND_LOCK 20 | S_MixerUpdate(); 21 | unlock: 22 | SND_UNLOCK 23 | return NULL; 24 | } 25 | 26 | extern int sndBufferSize; 27 | extern int sndDesiredSamples; 28 | 29 | #include 30 | #include 31 | 32 | void CheckAudioValue(float f) 33 | { 34 | if (isnan(f) || isinf(f)) 35 | { 36 | assert(0); 37 | } 38 | if (f < -1.1f) 39 | { 40 | assert(0); 41 | } 42 | if (f > 1.1f) 43 | { 44 | assert(0); 45 | } 46 | } 47 | 48 | #include 49 | 50 | void WQAudioCallback(void *const *channelData, uint frameCount, uint channelCount, uint bits) 51 | { 52 | unsigned char* ch0 = (unsigned char*)channelData[0]; 53 | unsigned char* ch1 = (unsigned char*)channelData[1]; 54 | 55 | int cached_samplepos = dma->samplepos; 56 | int cached_samplebits = dma->samplebits; 57 | int cached_bufferSize = sndBufferSize; 58 | unsigned char* srcBuffer = dma->buffer; 59 | 60 | int framebufferLength = frameCount;// sndDesiredSamples; 61 | 62 | int pos = cached_samplepos * (cached_samplebits / 8); 63 | if (pos >= cached_bufferSize) 64 | { 65 | dma->samplepos = cached_samplepos = pos = 0; 66 | } 67 | int toBuffend = cached_bufferSize - pos; 68 | int len = framebufferLength * (cached_samplebits / 8); 69 | int len1 = len; 70 | int len2 = 0; 71 | if (len1 > toBuffend) 72 | { 73 | len1 = toBuffend; 74 | len2 = len - len1; 75 | } 76 | float* src = __builtin_assume_aligned((float*)(srcBuffer + pos),16); 77 | #ifdef DEBUG 78 | assert(AlignedCheck(src,16)); 79 | if (dma->flags & DMA_FLAG_IS_FLOAT) 80 | { 81 | int len1Samples = len1 / (bits / 8); 82 | for (int i=0; isamplepos += len1 / (dma->samplebits / 8); 102 | } 103 | else 104 | { 105 | src = __builtin_assume_aligned((float*)(srcBuffer),16); 106 | #ifdef DEBUG 107 | assert(AlignedCheck(src,16)); 108 | if (dma->flags & DMA_FLAG_IS_FLOAT) 109 | { 110 | int len2Samples = len2 / (bits / 8); 111 | for (int i=0; isamplepos = len2 / (dma->samplebits / 8); 127 | } 128 | if (dma->samplepos * (dma->samplebits / 8) >= cached_bufferSize) 129 | { 130 | dma->samplepos = 0; 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/WQuake2/WQ2SoundCallback.h: -------------------------------------------------------------------------------- 1 | // 2 | // WQ2SoundCallback.h 3 | // WatchQuake2 Watch App 4 | // 5 | // Created by ByteOverlord on 7.12.2022. 6 | // 7 | 8 | #ifndef WQ2SoundCallback_h 9 | #define WQ2SoundCallback_h 10 | 11 | #include "WQ2Common.h" 12 | 13 | void* WQAudioMixerLoop(void* p); 14 | void WQAudioCallback(void *const *channelData, uint frameCount, uint channelCount, uint bits); 15 | 16 | #endif /* WQ2SoundCallback_h */ 17 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/WQuake2/WatchQuake2 Watch App-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | #include "WQ2Common.h" 6 | #include "Quake2Wrapper.h" 7 | #include "WQ2SoundCallback.h" 8 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/WQuake2/cd_watch.h: -------------------------------------------------------------------------------- 1 | // 2 | // cd_watch.h 3 | // WatchQuake Watch App 4 | // 5 | // Created by ByteOverlord on 4.11.2022. 6 | // 7 | 8 | #ifndef cd_watch_h 9 | #define cd_watch_h 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | #include "WQ2Common.h" 16 | 17 | void CDAudio_SetPath(const char* path); 18 | 19 | void CDAudio_SetMixerSamplerate(u32 sampleRate); 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | 25 | #endif /* cd_watch_h */ 26 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/WQuake2/sound_watch.c: -------------------------------------------------------------------------------- 1 | // 2 | // sound_watch.c 3 | // WatchQuake2 Watch App 4 | // 5 | // Created by ByteOverlord on 7.12.2022. 6 | // 7 | 8 | #include "client.h" 9 | #include "snd_loc.h" 10 | 11 | #include "WQ2Common.h" 12 | 13 | #include 14 | pthread_mutex_t snd_lock; 15 | 16 | int sndBufferSize = 0; 17 | int sndDesiredSamples = 0; 18 | 19 | int g_WQAudio_freq = 0;//48000; 20 | int g_WQAudio_bits = 0;//32; 21 | int g_WQAudio_channels = 0;//1; 22 | int g_WQAudio_interleaved = 0; 23 | int g_WQAudio_type = 0; 24 | 25 | extern volatile dma_t* dma; 26 | 27 | qboolean SNDDMA_Init(void) 28 | { 29 | pthread_mutex_init(&snd_lock, NULL); 30 | pthread_mutex_lock(&snd_lock); 31 | 32 | // currently only handling mono sound 33 | uint samples = 0; 34 | uint freq = g_WQAudio_freq; 35 | uint channels = 1;//g_WQAudio_channels; 36 | // 11025 -> 256 samples 37 | // 22050 -> 512 samples 38 | // 44100 -> 1024 samples 39 | // 48000 -> 2048 samples 40 | // 96000 -> 4096 samples 41 | if (freq <= 11025) 42 | { 43 | samples = 256; 44 | } 45 | else if (freq <= 22050) 46 | { 47 | samples = 512; 48 | } 49 | else if (freq <= 44100) 50 | { 51 | samples = 1024; 52 | } 53 | else if (freq <= 56000) 54 | { 55 | samples = 2048;// 48 kHz 56 | } 57 | else 58 | { 59 | samples = 4096;// 96 kHz 60 | } 61 | 62 | uint tmp = samples * channels * 10; 63 | if (tmp & (tmp - 1)) 64 | { 65 | // make it a power of two 66 | uint val = 1; 67 | while (val < tmp) 68 | { 69 | val <<= 1; 70 | } 71 | tmp = val; 72 | } 73 | 74 | dma = malloc(sizeof(dma_t)); 75 | dma->samplebits = g_WQAudio_bits; 76 | dma->speed = freq; 77 | dma->channels = channels; 78 | dma->samples = tmp;// mono samples in buffer 79 | dma->samplepos = 0; 80 | dma->flags = 0; 81 | if (g_WQAudio_interleaved) 82 | { 83 | dma->flags |= DMA_FLAG_IS_INTERLEAVED; 84 | } 85 | if (g_WQAudio_type) 86 | { 87 | dma->flags |= DMA_FLAG_IS_FLOAT; 88 | } 89 | dma->submission_chunk = 1; 90 | sndDesiredSamples = samples; 91 | while ((sndDesiredSamples % 16) != 0) 92 | { 93 | sndDesiredSamples++; 94 | } 95 | sndBufferSize = dma->samples * (dma->samplebits / 8); 96 | dma->buffer = AlignedMalloc(sndBufferSize,16); 97 | memset(dma->buffer,0,sndBufferSize); 98 | 99 | pthread_mutex_unlock(&snd_lock); 100 | 101 | return qTrue; 102 | } 103 | 104 | int SNDDMA_GetDMAPos(void) 105 | { 106 | return dma->samplepos; 107 | } 108 | 109 | void SNDDMA_Shutdown(void) 110 | { 111 | AlignedFree(dma->buffer); 112 | } 113 | 114 | void SNDDMA_BeginPainting (void) 115 | { 116 | } 117 | 118 | void SNDDMA_Submit(void) 119 | { 120 | } 121 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/WQuake2/sw_watch.c: -------------------------------------------------------------------------------- 1 | // 2 | // vid_watch.c 3 | // WatchQuake2 Watch App 4 | // 5 | // Created by ByteOverlord on 26.11.2022. 6 | // 7 | 8 | #include "sw_watch.h" 9 | 10 | #include "r_local.h" 11 | 12 | #include "WQ2Common.h" 13 | 14 | extern viddef_t viddef; 15 | extern viddef_t vid; 16 | 17 | unsigned char* g_DataImages[3]; 18 | u32* g_8to32tables[3]; 19 | 20 | u32 framebufferWriteIndex = 0; 21 | qboolean paletteSet = qFalse; 22 | 23 | extern uint g_WQVidScreenWidth; 24 | extern uint g_WQVidScreenHeight; 25 | 26 | #include "Quake2Wrapper.h" 27 | 28 | void SWimp_BeginFrame( float camera_separation ) 29 | { 30 | } 31 | 32 | void SWimp_EndFrame (void) 33 | { 34 | u32 prevIndex = framebufferWriteIndex; 35 | framebufferWriteIndex++; 36 | framebufferWriteIndex %= 3; 37 | 38 | vid.buffer = g_DataImages[framebufferWriteIndex]; 39 | memcpy(&viddef,&vid,sizeof(viddef)); 40 | 41 | if (!paletteSet) 42 | { 43 | int prevPrevIndex = prevIndex - 1; 44 | if (prevPrevIndex < 0) 45 | { 46 | prevPrevIndex = 2; 47 | } 48 | memcpy(g_8to32tables[prevIndex],g_8to32tables[prevPrevIndex],256 * 4); 49 | } 50 | paletteSet = qFalse; 51 | WQEndFrame(); 52 | } 53 | 54 | int SWimp_Init( void *hInstance, void *wndProc ) 55 | { 56 | int maxSize = 1600 * 1200; 57 | int paletteSize = 256; 58 | 59 | g_DataImages[0] = AlignedMalloc(maxSize * 3,16); 60 | g_DataImages[1] = g_DataImages[0] + maxSize; 61 | g_DataImages[2] = g_DataImages[1] + maxSize; 62 | 63 | memset(g_DataImages[0],0,maxSize * 3); 64 | 65 | g_8to32tables[0] = AlignedMalloc(paletteSize * 4 * 3,16); 66 | g_8to32tables[1] = g_8to32tables[0] + paletteSize; 67 | g_8to32tables[2] = g_8to32tables[1] + paletteSize; 68 | 69 | memset(g_8to32tables[0],0,paletteSize * 4 * 3); 70 | 71 | vid.buffer = g_DataImages[0]; 72 | vid.rowbytes = g_WQVidScreenWidth; 73 | vid.width = g_WQVidScreenWidth; 74 | vid.height = g_WQVidScreenHeight; 75 | //vid.colormap 76 | //vic.alphamap 77 | memcpy(&viddef,&vid,sizeof(viddef)); 78 | 79 | return 0; 80 | } 81 | 82 | void SWimp_SetPalette( const unsigned char *palette) 83 | { 84 | if (palette) 85 | { 86 | memcpy(g_8to32tables[framebufferWriteIndex],palette,256 * 4); 87 | paletteSet = qTrue; 88 | } 89 | } 90 | 91 | void SWimp_Shutdown( void ) 92 | { 93 | AlignedFree(vid.buffer); 94 | } 95 | 96 | rserr_t SWimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen ) 97 | { 98 | *pwidth = g_WQVidScreenWidth; 99 | *pheight = g_WQVidScreenHeight; 100 | return rserr_ok; 101 | } 102 | 103 | void SWimp_AppActivate( qboolean active ) 104 | { 105 | } 106 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/WQuake2/sw_watch.h: -------------------------------------------------------------------------------- 1 | // 2 | // vid_watch.h 3 | // WatchQuake2 Watch App 4 | // 5 | // Created by ByteOverlord on 26.11.2022. 6 | // 7 | 8 | #ifndef vid_watch_h 9 | #define vid_watch_h 10 | 11 | #endif /* vid_watch_h */ 12 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/WQuake2/sys_watch.h: -------------------------------------------------------------------------------- 1 | // 2 | // sys_watch.h 3 | // WatchQuake2 Watch App 4 | // 5 | // Created by ByteOverlord on 26.11.2022. 6 | // 7 | 8 | #ifndef sys_watch_h 9 | #define sys_watch_h 10 | 11 | void Sys_SetPaths(const char* resourcesDir, const char* documentsDir, const char* saveDir, const char* commandLine); 12 | 13 | void Sys_Init(void); 14 | 15 | #endif /* sys_watch_h */ 16 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/WQuake2/vid_watch.c: -------------------------------------------------------------------------------- 1 | // 2 | // vid_watch.c 3 | // WatchQuake2 Watch App 4 | // 5 | // Created by ByteOverlord on 26.11.2022. 6 | // 7 | 8 | #include "client.h" 9 | 10 | //extern viddef_t vid; 11 | viddef_t viddef; // global video state 12 | 13 | refexport_t re; 14 | 15 | refexport_t GetRefAPI (refimport_t rimp); 16 | 17 | extern uint g_WQVidScreenWidth; 18 | extern uint g_WQVidScreenHeight; 19 | 20 | /* 21 | ========================================================================== 22 | 23 | DIRECT LINK GLUE 24 | 25 | ========================================================================== 26 | */ 27 | 28 | #define MAXPRINTMSG 4096 29 | void VID_Printf (int print_level, char *fmt, ...) 30 | { 31 | va_list argptr; 32 | char msg[MAXPRINTMSG]; 33 | 34 | va_start (argptr,fmt); 35 | vsprintf (msg,fmt,argptr); 36 | va_end (argptr); 37 | 38 | if (print_level == PRINT_ALL) 39 | Com_Printf ("%s", msg); 40 | else 41 | Com_DPrintf ("%s", msg); 42 | } 43 | 44 | void VID_Error (int err_level, char *fmt, ...) 45 | { 46 | va_list argptr; 47 | char msg[MAXPRINTMSG]; 48 | 49 | va_start (argptr,fmt); 50 | vsprintf (msg,fmt,argptr); 51 | va_end (argptr); 52 | 53 | Com_Error (err_level, "%s", msg); 54 | } 55 | 56 | void VID_NewWindow (int width, int height) 57 | { 58 | viddef.width = width; 59 | viddef.height = height; 60 | } 61 | 62 | /* 63 | ** VID_GetModeInfo 64 | */ 65 | typedef struct vidmode_s 66 | { 67 | const char *description; 68 | int width, height; 69 | int mode; 70 | } vidmode_t; 71 | 72 | vidmode_t vid_modes[] = 73 | { 74 | { "Mode 0: 320x240", 320, 240, 0 }, 75 | { "Mode 1: 400x300", 400, 300, 1 }, 76 | { "Mode 2: 512x384", 512, 384, 2 }, 77 | { "Mode 3: 640x480", 640, 480, 3 }, 78 | { "Mode 4: 800x600", 800, 600, 4 }, 79 | { "Mode 5: 960x720", 960, 720, 5 }, 80 | { "Mode 6: 1024x768", 1024, 768, 6 }, 81 | { "Mode 7: 1152x864", 1152, 864, 7 }, 82 | { "Mode 8: 1280x960", 1280, 960, 8 }, 83 | { "Mode 9: 1600x1200", 1600, 1200, 9 } 84 | }; 85 | #define VID_NUM_MODES ( sizeof( vid_modes ) / sizeof( vid_modes[0] ) ) 86 | 87 | qboolean VID_GetModeInfo( int *width, int *height, int mode ) 88 | { 89 | if ( mode < 0 || mode >= VID_NUM_MODES ) 90 | return qFalse; 91 | 92 | *width = vid_modes[mode].width; 93 | *height = vid_modes[mode].height; 94 | 95 | return qTrue; 96 | } 97 | 98 | 99 | void VID_Init (void) 100 | { 101 | refimport_t ri; 102 | 103 | viddef.width = g_WQVidScreenWidth; 104 | viddef.height = g_WQVidScreenHeight; 105 | viddef.rowbytes = viddef.width; 106 | 107 | ri.Cmd_AddCommand = Cmd_AddCommand; 108 | ri.Cmd_RemoveCommand = Cmd_RemoveCommand; 109 | ri.Cmd_Argc = Cmd_Argc; 110 | ri.Cmd_Argv = Cmd_Argv; 111 | ri.Cmd_ExecuteText = Cbuf_ExecuteText; 112 | ri.Con_Printf = VID_Printf; 113 | ri.Sys_Error = VID_Error; 114 | ri.FS_LoadFile = FS_LoadFile; 115 | ri.FS_FreeFile = FS_FreeFile; 116 | ri.FS_Gamedir = FS_Gamedir; 117 | ri.Vid_NewWindow = VID_NewWindow; 118 | ri.Cvar_Get = Cvar_Get; 119 | ri.Cvar_Set = Cvar_Set; 120 | ri.Cvar_SetValue = Cvar_SetValue; 121 | ri.Vid_GetModeInfo = VID_GetModeInfo; 122 | ri.Vid_MenuInit = NULL; 123 | 124 | re = GetRefAPI(ri); 125 | 126 | if (re.api_version != API_VERSION) 127 | Com_Error (ERR_FATAL, "Re has incompatible api_version"); 128 | 129 | // call the init function 130 | if (re.Init (NULL, NULL) == -1) 131 | Com_Error (ERR_FATAL, "Couldn't start refresh"); 132 | } 133 | 134 | void VID_Shutdown (void) 135 | { 136 | if (re.Shutdown) 137 | re.Shutdown (); 138 | } 139 | 140 | void VID_CheckChanges (void) 141 | { 142 | } 143 | 144 | void VID_MenuInit (void) 145 | { 146 | } 147 | 148 | void VID_MenuDraw (void) 149 | { 150 | } 151 | 152 | const char *VID_MenuKey( int k) 153 | { 154 | return NULL; 155 | } 156 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/client/anorms.h: -------------------------------------------------------------------------------- 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 | {-0.525731, 0.000000, 0.850651}, 21 | {-0.442863, 0.238856, 0.864188}, 22 | {-0.295242, 0.000000, 0.955423}, 23 | {-0.309017, 0.500000, 0.809017}, 24 | {-0.162460, 0.262866, 0.951056}, 25 | {0.000000, 0.000000, 1.000000}, 26 | {0.000000, 0.850651, 0.525731}, 27 | {-0.147621, 0.716567, 0.681718}, 28 | {0.147621, 0.716567, 0.681718}, 29 | {0.000000, 0.525731, 0.850651}, 30 | {0.309017, 0.500000, 0.809017}, 31 | {0.525731, 0.000000, 0.850651}, 32 | {0.295242, 0.000000, 0.955423}, 33 | {0.442863, 0.238856, 0.864188}, 34 | {0.162460, 0.262866, 0.951056}, 35 | {-0.681718, 0.147621, 0.716567}, 36 | {-0.809017, 0.309017, 0.500000}, 37 | {-0.587785, 0.425325, 0.688191}, 38 | {-0.850651, 0.525731, 0.000000}, 39 | {-0.864188, 0.442863, 0.238856}, 40 | {-0.716567, 0.681718, 0.147621}, 41 | {-0.688191, 0.587785, 0.425325}, 42 | {-0.500000, 0.809017, 0.309017}, 43 | {-0.238856, 0.864188, 0.442863}, 44 | {-0.425325, 0.688191, 0.587785}, 45 | {-0.716567, 0.681718, -0.147621}, 46 | {-0.500000, 0.809017, -0.309017}, 47 | {-0.525731, 0.850651, 0.000000}, 48 | {0.000000, 0.850651, -0.525731}, 49 | {-0.238856, 0.864188, -0.442863}, 50 | {0.000000, 0.955423, -0.295242}, 51 | {-0.262866, 0.951056, -0.162460}, 52 | {0.000000, 1.000000, 0.000000}, 53 | {0.000000, 0.955423, 0.295242}, 54 | {-0.262866, 0.951056, 0.162460}, 55 | {0.238856, 0.864188, 0.442863}, 56 | {0.262866, 0.951056, 0.162460}, 57 | {0.500000, 0.809017, 0.309017}, 58 | {0.238856, 0.864188, -0.442863}, 59 | {0.262866, 0.951056, -0.162460}, 60 | {0.500000, 0.809017, -0.309017}, 61 | {0.850651, 0.525731, 0.000000}, 62 | {0.716567, 0.681718, 0.147621}, 63 | {0.716567, 0.681718, -0.147621}, 64 | {0.525731, 0.850651, 0.000000}, 65 | {0.425325, 0.688191, 0.587785}, 66 | {0.864188, 0.442863, 0.238856}, 67 | {0.688191, 0.587785, 0.425325}, 68 | {0.809017, 0.309017, 0.500000}, 69 | {0.681718, 0.147621, 0.716567}, 70 | {0.587785, 0.425325, 0.688191}, 71 | {0.955423, 0.295242, 0.000000}, 72 | {1.000000, 0.000000, 0.000000}, 73 | {0.951056, 0.162460, 0.262866}, 74 | {0.850651, -0.525731, 0.000000}, 75 | {0.955423, -0.295242, 0.000000}, 76 | {0.864188, -0.442863, 0.238856}, 77 | {0.951056, -0.162460, 0.262866}, 78 | {0.809017, -0.309017, 0.500000}, 79 | {0.681718, -0.147621, 0.716567}, 80 | {0.850651, 0.000000, 0.525731}, 81 | {0.864188, 0.442863, -0.238856}, 82 | {0.809017, 0.309017, -0.500000}, 83 | {0.951056, 0.162460, -0.262866}, 84 | {0.525731, 0.000000, -0.850651}, 85 | {0.681718, 0.147621, -0.716567}, 86 | {0.681718, -0.147621, -0.716567}, 87 | {0.850651, 0.000000, -0.525731}, 88 | {0.809017, -0.309017, -0.500000}, 89 | {0.864188, -0.442863, -0.238856}, 90 | {0.951056, -0.162460, -0.262866}, 91 | {0.147621, 0.716567, -0.681718}, 92 | {0.309017, 0.500000, -0.809017}, 93 | {0.425325, 0.688191, -0.587785}, 94 | {0.442863, 0.238856, -0.864188}, 95 | {0.587785, 0.425325, -0.688191}, 96 | {0.688191, 0.587785, -0.425325}, 97 | {-0.147621, 0.716567, -0.681718}, 98 | {-0.309017, 0.500000, -0.809017}, 99 | {0.000000, 0.525731, -0.850651}, 100 | {-0.525731, 0.000000, -0.850651}, 101 | {-0.442863, 0.238856, -0.864188}, 102 | {-0.295242, 0.000000, -0.955423}, 103 | {-0.162460, 0.262866, -0.951056}, 104 | {0.000000, 0.000000, -1.000000}, 105 | {0.295242, 0.000000, -0.955423}, 106 | {0.162460, 0.262866, -0.951056}, 107 | {-0.442863, -0.238856, -0.864188}, 108 | {-0.309017, -0.500000, -0.809017}, 109 | {-0.162460, -0.262866, -0.951056}, 110 | {0.000000, -0.850651, -0.525731}, 111 | {-0.147621, -0.716567, -0.681718}, 112 | {0.147621, -0.716567, -0.681718}, 113 | {0.000000, -0.525731, -0.850651}, 114 | {0.309017, -0.500000, -0.809017}, 115 | {0.442863, -0.238856, -0.864188}, 116 | {0.162460, -0.262866, -0.951056}, 117 | {0.238856, -0.864188, -0.442863}, 118 | {0.500000, -0.809017, -0.309017}, 119 | {0.425325, -0.688191, -0.587785}, 120 | {0.716567, -0.681718, -0.147621}, 121 | {0.688191, -0.587785, -0.425325}, 122 | {0.587785, -0.425325, -0.688191}, 123 | {0.000000, -0.955423, -0.295242}, 124 | {0.000000, -1.000000, 0.000000}, 125 | {0.262866, -0.951056, -0.162460}, 126 | {0.000000, -0.850651, 0.525731}, 127 | {0.000000, -0.955423, 0.295242}, 128 | {0.238856, -0.864188, 0.442863}, 129 | {0.262866, -0.951056, 0.162460}, 130 | {0.500000, -0.809017, 0.309017}, 131 | {0.716567, -0.681718, 0.147621}, 132 | {0.525731, -0.850651, 0.000000}, 133 | {-0.238856, -0.864188, -0.442863}, 134 | {-0.500000, -0.809017, -0.309017}, 135 | {-0.262866, -0.951056, -0.162460}, 136 | {-0.850651, -0.525731, 0.000000}, 137 | {-0.716567, -0.681718, -0.147621}, 138 | {-0.716567, -0.681718, 0.147621}, 139 | {-0.525731, -0.850651, 0.000000}, 140 | {-0.500000, -0.809017, 0.309017}, 141 | {-0.238856, -0.864188, 0.442863}, 142 | {-0.262866, -0.951056, 0.162460}, 143 | {-0.864188, -0.442863, 0.238856}, 144 | {-0.809017, -0.309017, 0.500000}, 145 | {-0.688191, -0.587785, 0.425325}, 146 | {-0.681718, -0.147621, 0.716567}, 147 | {-0.442863, -0.238856, 0.864188}, 148 | {-0.587785, -0.425325, 0.688191}, 149 | {-0.309017, -0.500000, 0.809017}, 150 | {-0.147621, -0.716567, 0.681718}, 151 | {-0.425325, -0.688191, 0.587785}, 152 | {-0.162460, -0.262866, 0.951056}, 153 | {0.442863, -0.238856, 0.864188}, 154 | {0.162460, -0.262866, 0.951056}, 155 | {0.309017, -0.500000, 0.809017}, 156 | {0.147621, -0.716567, 0.681718}, 157 | {0.000000, -0.525731, 0.850651}, 158 | {0.425325, -0.688191, 0.587785}, 159 | {0.587785, -0.425325, 0.688191}, 160 | {0.688191, -0.587785, 0.425325}, 161 | {-0.955423, 0.295242, 0.000000}, 162 | {-0.951056, 0.162460, 0.262866}, 163 | {-1.000000, 0.000000, 0.000000}, 164 | {-0.850651, 0.000000, 0.525731}, 165 | {-0.955423, -0.295242, 0.000000}, 166 | {-0.951056, -0.162460, 0.262866}, 167 | {-0.864188, 0.442863, -0.238856}, 168 | {-0.951056, 0.162460, -0.262866}, 169 | {-0.809017, 0.309017, -0.500000}, 170 | {-0.864188, -0.442863, -0.238856}, 171 | {-0.951056, -0.162460, -0.262866}, 172 | {-0.809017, -0.309017, -0.500000}, 173 | {-0.681718, 0.147621, -0.716567}, 174 | {-0.681718, -0.147621, -0.716567}, 175 | {-0.850651, 0.000000, -0.525731}, 176 | {-0.688191, 0.587785, -0.425325}, 177 | {-0.587785, 0.425325, -0.688191}, 178 | {-0.425325, 0.688191, -0.587785}, 179 | {-0.425325, -0.688191, -0.587785}, 180 | {-0.587785, -0.425325, -0.688191}, 181 | {-0.688191, -0.587785, -0.425325}, 182 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/client/cdaudio.h: -------------------------------------------------------------------------------- 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 | #include "snd_loc.h" 22 | 23 | int CDAudio_Init(void); 24 | void CDAudio_Shutdown(void); 25 | void CDAudio_Play(int track, qboolean looping); 26 | void CDAudio_Stop(void); 27 | void CDAudio_Update(void); 28 | void CDAudio_MixSamples(portable_samplepair_t* pb, int count, int volume); 29 | void CDAudio_Activate (qboolean active); 30 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/client/cl_inv.c: -------------------------------------------------------------------------------- 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 | // cl_inv.c -- client inventory screen 21 | 22 | #include "client.h" 23 | 24 | /* 25 | ================ 26 | CL_ParseInventory 27 | ================ 28 | */ 29 | void CL_ParseInventory (void) 30 | { 31 | int i; 32 | 33 | for (i=0 ; ivalue || (cl.frame.playerstate.pmove.pm_flags & PMF_NO_PREDICTION)) 37 | return; 38 | 39 | // calculate the last usercmd_t we sent that the server has processed 40 | frame = cls.netchan.incoming_acknowledged; 41 | frame &= (CMD_BACKUP-1); 42 | 43 | // compare what the server returned with what we had predicted it to be 44 | VectorSubtract (cl.frame.playerstate.pmove.origin, cl.predicted_origins[frame], delta); 45 | 46 | // save the prediction error for interpolation 47 | len = abs(delta[0]) + abs(delta[1]) + abs(delta[2]); 48 | if (len > 640) // 80 world units 49 | { // a teleport or something 50 | VectorClear (cl.prediction_error); 51 | } 52 | else 53 | { 54 | if (cl_showmiss->value && (delta[0] || delta[1] || delta[2]) ) 55 | Com_Printf ("prediction miss on %i: %i\n", cl.frame.serverframe, 56 | delta[0] + delta[1] + delta[2]); 57 | 58 | VectorCopy (cl.frame.playerstate.pmove.origin, cl.predicted_origins[frame]); 59 | 60 | // save for error itnerpolation 61 | for (i=0 ; i<3 ; i++) 62 | cl.prediction_error[i] = delta[i]*0.125; 63 | } 64 | } 65 | 66 | 67 | /* 68 | ==================== 69 | CL_ClipMoveToEntities 70 | 71 | ==================== 72 | */ 73 | void CL_ClipMoveToEntities ( vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, trace_t *tr ) 74 | { 75 | int i, x, zd, zu; 76 | trace_t trace; 77 | int headnode; 78 | float *angles; 79 | entity_state_t *ent; 80 | int num; 81 | cmodel_t *cmodel; 82 | vec3_t bmins, bmaxs; 83 | 84 | for (i=0 ; isolid) 90 | continue; 91 | 92 | if (ent->number == cl.playernum+1) 93 | continue; 94 | 95 | if (ent->solid == 31) 96 | { // special value for bmodel 97 | cmodel = cl.model_clip[ent->modelindex]; 98 | if (!cmodel) 99 | continue; 100 | headnode = cmodel->headnode; 101 | angles = ent->angles; 102 | } 103 | else 104 | { // encoded bbox 105 | x = 8*(ent->solid & 31); 106 | zd = 8*((ent->solid>>5) & 31); 107 | zu = 8*((ent->solid>>10) & 63) - 32; 108 | 109 | bmins[0] = bmins[1] = -x; 110 | bmaxs[0] = bmaxs[1] = x; 111 | bmins[2] = -zd; 112 | bmaxs[2] = zu; 113 | 114 | headnode = CM_HeadnodeForBox (bmins, bmaxs); 115 | angles = vec3_origin; // boxes don't rotate 116 | } 117 | 118 | if (tr->allsolid) 119 | return; 120 | 121 | trace = CM_TransformedBoxTrace (start, end, 122 | mins, maxs, headnode, MASK_PLAYERSOLID, 123 | ent->origin, angles); 124 | 125 | if (trace.allsolid || trace.startsolid || 126 | trace.fraction < tr->fraction) 127 | { 128 | trace.ent = (struct edict_s *)ent; 129 | if (tr->startsolid) 130 | { 131 | *tr = trace; 132 | tr->startsolid = qTrue; 133 | } 134 | else 135 | *tr = trace; 136 | } 137 | else if (trace.startsolid) 138 | tr->startsolid = qTrue; 139 | } 140 | } 141 | 142 | 143 | /* 144 | ================ 145 | CL_PMTrace 146 | ================ 147 | */ 148 | trace_t CL_PMTrace (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end) 149 | { 150 | trace_t t; 151 | 152 | // check against world 153 | t = CM_BoxTrace (start, end, mins, maxs, 0, MASK_PLAYERSOLID); 154 | if (t.fraction < 1.0) 155 | t.ent = (struct edict_s *)1; 156 | 157 | // check all other solid models 158 | CL_ClipMoveToEntities (start, mins, maxs, end, &t); 159 | 160 | return t; 161 | } 162 | 163 | int CL_PMpointcontents (vec3_t point) 164 | { 165 | int i; 166 | entity_state_t *ent; 167 | int num; 168 | cmodel_t *cmodel; 169 | int contents; 170 | 171 | contents = CM_PointContents (point, 0); 172 | 173 | for (i=0 ; isolid != 31) // special value for bmodel 179 | continue; 180 | 181 | cmodel = cl.model_clip[ent->modelindex]; 182 | if (!cmodel) 183 | continue; 184 | 185 | contents |= CM_TransformedPointContents (point, cmodel->headnode, ent->origin, ent->angles); 186 | } 187 | 188 | return contents; 189 | } 190 | 191 | 192 | /* 193 | ================= 194 | CL_PredictMovement 195 | 196 | Sets cl.predicted_origin and cl.predicted_angles 197 | ================= 198 | */ 199 | void CL_PredictMovement (void) 200 | { 201 | int ack, current; 202 | int frame; 203 | int oldframe; 204 | usercmd_t *cmd; 205 | pmove_t pm; 206 | int i; 207 | int step; 208 | int oldz; 209 | 210 | if (cls.state != ca_active) 211 | return; 212 | 213 | if (cl_paused->value) 214 | return; 215 | 216 | if (!cl_predict->value || (cl.frame.playerstate.pmove.pm_flags & PMF_NO_PREDICTION)) 217 | { // just set angles 218 | for (i=0 ; i<3 ; i++) 219 | { 220 | cl.predicted_angles[i] = cl.viewangles[i] + SHORT2ANGLE(cl.frame.playerstate.pmove.delta_angles[i]); 221 | } 222 | return; 223 | } 224 | 225 | ack = cls.netchan.incoming_acknowledged; 226 | current = cls.netchan.outgoing_sequence; 227 | 228 | // if we are too far out of date, just freeze 229 | if (current - ack >= CMD_BACKUP) 230 | { 231 | if (cl_showmiss->value) 232 | Com_Printf ("exceeded CMD_BACKUP\n"); 233 | return; 234 | } 235 | 236 | // copy current state to pmove 237 | memset (&pm, 0, sizeof(pm)); 238 | pm.trace = CL_PMTrace; 239 | pm.pointcontents = CL_PMpointcontents; 240 | 241 | pm_airaccelerate = atof(cl.configstrings[CS_AIRACCEL]); 242 | 243 | pm.s = cl.frame.playerstate.pmove; 244 | 245 | // SCR_DebugGraph (current - ack - 1, 0); 246 | 247 | frame = 0; 248 | 249 | // run frames 250 | while (++ack < current) 251 | { 252 | frame = ack & (CMD_BACKUP-1); 253 | cmd = &cl.cmds[frame]; 254 | 255 | pm.cmd = *cmd; 256 | Pmove (&pm); 257 | 258 | // save for debug checking 259 | VectorCopy (pm.s.origin, cl.predicted_origins[frame]); 260 | } 261 | 262 | oldframe = (ack-2) & (CMD_BACKUP-1); 263 | oldz = cl.predicted_origins[oldframe][2]; 264 | step = pm.s.origin[2] - oldz; 265 | if (step > 63 && step < 160 && (pm.s.pm_flags & PMF_ON_GROUND) ) 266 | { 267 | cl.predicted_step = step * 0.125; 268 | cl.predicted_step_time = cls.realtime - cls.frametime * 500; 269 | } 270 | 271 | 272 | // copy results out for rendering 273 | cl.predicted_origin[0] = pm.s.origin[0]*0.125; 274 | cl.predicted_origin[1] = pm.s.origin[1]*0.125; 275 | cl.predicted_origin[2] = pm.s.origin[2]*0.125; 276 | 277 | VectorCopy (pm.viewangles, cl.predicted_angles); 278 | } 279 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/client/console.h: -------------------------------------------------------------------------------- 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 | // 22 | // console 23 | // 24 | 25 | #define NOTIFY_Y_OFFSET (viddef.height / 14) 26 | #define NOTIFY_X_OFFSET (viddef.width / 16) 27 | 28 | #define NUM_CON_TIMES 4 29 | 30 | #define CON_TEXTSIZE 32768 31 | typedef struct 32 | { 33 | qboolean initialized; 34 | 35 | char text[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[NUM_CON_TIMES]; // cls.realtime time the line was generated 50 | // for transparent notify lines 51 | } console_t; 52 | 53 | extern console_t con; 54 | 55 | void Con_DrawCharacter (int cx, int line, int num); 56 | 57 | void Con_CheckResize (void); 58 | void Con_Init (void); 59 | void Con_DrawConsole (float frac); 60 | void Con_Print (char *txt); 61 | void Con_CenteredPrint (char *text); 62 | void Con_Clear_f (void); 63 | void Con_DrawNotify (void); 64 | void Con_ClearNotify (void); 65 | void Con_ToggleConsole_f (void); 66 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/client/input.h: -------------------------------------------------------------------------------- 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 | // input.h -- external (non-keyboard) input devices 21 | 22 | void IN_Init (void); 23 | 24 | void IN_Shutdown (void); 25 | 26 | void IN_Commands (void); 27 | // oportunity for devices to stick commands on the script buffer 28 | 29 | void IN_Frame (void); 30 | 31 | void IN_Move (usercmd_t *cmd); 32 | // add additional movement on top of the keyboard move cmd 33 | 34 | void IN_Activate (qboolean active); 35 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/client/keys.h: -------------------------------------------------------------------------------- 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 | // 22 | // these are the key numbers that should be passed to Key_Event 23 | // 24 | #define K_TAB 9 25 | #define K_ENTER 13 26 | #define K_ESCAPE 27 27 | #define K_SPACE 32 28 | 29 | // normal keys should be passed as lowercased ascii 30 | 31 | #define K_BACKSPACE 127 32 | #define K_UPARROW 128 33 | #define K_DOWNARROW 129 34 | #define K_LEFTARROW 130 35 | #define K_RIGHTARROW 131 36 | 37 | #define K_ALT 132 38 | #define K_CTRL 133 39 | #define K_SHIFT 134 40 | #define K_F1 135 41 | #define K_F2 136 42 | #define K_F3 137 43 | #define K_F4 138 44 | #define K_F5 139 45 | #define K_F6 140 46 | #define K_F7 141 47 | #define K_F8 142 48 | #define K_F9 143 49 | #define K_F10 144 50 | #define K_F11 145 51 | #define K_F12 146 52 | #define K_INS 147 53 | #define K_DEL 148 54 | #define K_PGDN 149 55 | #define K_PGUP 150 56 | #define K_HOME 151 57 | #define K_END 152 58 | 59 | #define K_KP_HOME 160 60 | #define K_KP_UPARROW 161 61 | #define K_KP_PGUP 162 62 | #define K_KP_LEFTARROW 163 63 | #define K_KP_5 164 64 | #define K_KP_RIGHTARROW 165 65 | #define K_KP_END 166 66 | #define K_KP_DOWNARROW 167 67 | #define K_KP_PGDN 168 68 | #define K_KP_ENTER 169 69 | #define K_KP_INS 170 70 | #define K_KP_DEL 171 71 | #define K_KP_SLASH 172 72 | #define K_KP_MINUS 173 73 | #define K_KP_PLUS 174 74 | 75 | #define K_PAUSE 255 76 | 77 | // 78 | // mouse buttons generate virtual keys 79 | // 80 | #define K_MOUSE1 200 81 | #define K_MOUSE2 201 82 | #define K_MOUSE3 202 83 | 84 | // 85 | // joystick buttons 86 | // 87 | #define K_JOY1 203 88 | #define K_JOY2 204 89 | #define K_JOY3 205 90 | #define K_JOY4 206 91 | 92 | // 93 | // aux keys are for multi-buttoned joysticks to generate so they can use 94 | // the normal binding process 95 | // 96 | #define K_AUX1 207 97 | #define K_AUX2 208 98 | #define K_AUX3 209 99 | #define K_AUX4 210 100 | #define K_AUX5 211 101 | #define K_AUX6 212 102 | #define K_AUX7 213 103 | #define K_AUX8 214 104 | #define K_AUX9 215 105 | #define K_AUX10 216 106 | #define K_AUX11 217 107 | #define K_AUX12 218 108 | #define K_AUX13 219 109 | #define K_AUX14 220 110 | #define K_AUX15 221 111 | #define K_AUX16 222 112 | #define K_AUX17 223 113 | #define K_AUX18 224 114 | #define K_AUX19 225 115 | #define K_AUX20 226 116 | #define K_AUX21 227 117 | #define K_AUX22 228 118 | #define K_AUX23 229 119 | #define K_AUX24 230 120 | #define K_AUX25 231 121 | #define K_AUX26 232 122 | #define K_AUX27 233 123 | #define K_AUX28 234 124 | #define K_AUX29 235 125 | #define K_AUX30 236 126 | #define K_AUX31 237 127 | #define K_AUX32 238 128 | 129 | #define K_MWHEELDOWN 239 130 | #define K_MWHEELUP 240 131 | 132 | extern char *keybindings[256]; 133 | extern int key_repeats[256]; 134 | 135 | extern int anykeydown; 136 | extern char chat_buffer[]; 137 | extern int chat_bufferlen; 138 | extern qboolean chat_team; 139 | 140 | void Key_Event (int key, qboolean down, unsigned time); 141 | void Key_Init (void); 142 | void Key_WriteBindings (FILE *f); 143 | void Key_SetBinding (int keynum, char *binding); 144 | void Key_ClearStates (void); 145 | int Key_GetKey (void); 146 | 147 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/client/qmenu.h: -------------------------------------------------------------------------------- 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 | #ifndef __QMENU_H__ 21 | #define __QMENU_H__ 22 | 23 | #define MAXMENUITEMS 64 24 | 25 | #define MTYPE_SLIDER 0 26 | #define MTYPE_LIST 1 27 | #define MTYPE_ACTION 2 28 | #define MTYPE_SPINCONTROL 3 29 | #define MTYPE_SEPARATOR 4 30 | #define MTYPE_FIELD 5 31 | 32 | #define K_TAB 9 33 | #define K_ENTER 13 34 | #define K_ESCAPE 27 35 | #define K_SPACE 32 36 | 37 | // normal keys should be passed as lowercased ascii 38 | 39 | #define K_BACKSPACE 127 40 | #define K_UPARROW 128 41 | #define K_DOWNARROW 129 42 | #define K_LEFTARROW 130 43 | #define K_RIGHTARROW 131 44 | 45 | #define QMF_LEFT_JUSTIFY 0x00000001 46 | #define QMF_GRAYED 0x00000002 47 | #define QMF_NUMBERSONLY 0x00000004 48 | 49 | typedef struct _tag_menuframework 50 | { 51 | int x, y; 52 | int cursor; 53 | 54 | int nitems; 55 | int nslots; 56 | void *items[64]; 57 | 58 | const char *statusbar; 59 | 60 | void (*cursordraw)( struct _tag_menuframework *m ); 61 | 62 | } menuframework_s; 63 | 64 | typedef struct 65 | { 66 | int type; 67 | const char *name; 68 | int x, y; 69 | menuframework_s *parent; 70 | int cursor_offset; 71 | int localdata[4]; 72 | unsigned flags; 73 | 74 | const char *statusbar; 75 | 76 | void (*callback)( void *self ); 77 | void (*statusbarfunc)( void *self ); 78 | void (*ownerdraw)( void *self ); 79 | void (*cursordraw)( void *self ); 80 | } menucommon_s; 81 | 82 | typedef struct 83 | { 84 | menucommon_s generic; 85 | 86 | char buffer[80]; 87 | int cursor; 88 | int length; 89 | int visible_length; 90 | int visible_offset; 91 | } menufield_s; 92 | 93 | typedef struct 94 | { 95 | menucommon_s generic; 96 | 97 | float minvalue; 98 | float maxvalue; 99 | float curvalue; 100 | 101 | float range; 102 | } menuslider_s; 103 | 104 | typedef struct 105 | { 106 | menucommon_s generic; 107 | 108 | int curvalue; 109 | 110 | const char **itemnames; 111 | } menulist_s; 112 | 113 | typedef struct 114 | { 115 | menucommon_s generic; 116 | } menuaction_s; 117 | 118 | typedef struct 119 | { 120 | menucommon_s generic; 121 | } menuseparator_s; 122 | 123 | qboolean Field_Key( menufield_s *field, int key ); 124 | 125 | void Menu_AddItem( menuframework_s *menu, void *item ); 126 | void Menu_AdjustCursor( menuframework_s *menu, int dir ); 127 | void Menu_Center( menuframework_s *menu ); 128 | void Menu_Draw( menuframework_s *menu ); 129 | void *Menu_ItemAtCursor( menuframework_s *m ); 130 | qboolean Menu_SelectItem( menuframework_s *s ); 131 | void Menu_SetStatusBar( menuframework_s *s, const char *string ); 132 | void Menu_SlideItem( menuframework_s *s, int dir ); 133 | int Menu_TallySlots( menuframework_s *menu ); 134 | 135 | void Menu_DrawString( int, int, const char * ); 136 | void Menu_DrawStringDark( int, int, const char * ); 137 | void Menu_DrawStringR2L( int, int, const char * ); 138 | void Menu_DrawStringR2LDark( int, int, const char * ); 139 | 140 | #endif 141 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/client/ref.h: -------------------------------------------------------------------------------- 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 | #include "../qcommon/qcommon.h" 22 | 23 | #define MAX_DLIGHTS 32 24 | #define MAX_ENTITIES 128 25 | #define MAX_PARTICLES 4096 26 | #define MAX_LIGHTSTYLES 256 27 | 28 | #define POWERSUIT_SCALE 4.0F 29 | 30 | #define SHELL_RED_COLOR 0xF2 31 | #define SHELL_GREEN_COLOR 0xD0 32 | #define SHELL_BLUE_COLOR 0xF3 33 | 34 | #define SHELL_RG_COLOR 0xDC 35 | //#define SHELL_RB_COLOR 0x86 36 | #define SHELL_RB_COLOR 0x68 37 | #define SHELL_BG_COLOR 0x78 38 | 39 | //ROGUE 40 | #define SHELL_DOUBLE_COLOR 0xDF // 223 41 | #define SHELL_HALF_DAM_COLOR 0x90 42 | #define SHELL_CYAN_COLOR 0x72 43 | //ROGUE 44 | 45 | #define SHELL_WHITE_COLOR 0xD7 46 | 47 | typedef struct entity_s 48 | { 49 | struct model_s *model; // opaque type outside refresh 50 | float angles[3]; 51 | 52 | /* 53 | ** most recent data 54 | */ 55 | float origin[3]; // also used as RF_BEAM's "from" 56 | int frame; // also used as RF_BEAM's diameter 57 | 58 | /* 59 | ** previous data for lerping 60 | */ 61 | float oldorigin[3]; // also used as RF_BEAM's "to" 62 | int oldframe; 63 | 64 | /* 65 | ** misc 66 | */ 67 | float backlerp; // 0.0 = current, 1.0 = old 68 | int skinnum; // also used as RF_BEAM's palette index 69 | 70 | int lightstyle; // for flashing entities 71 | float alpha; // ignore if RF_TRANSLUCENT isn't set 72 | 73 | struct image_s *skin; // NULL for inline skin 74 | int flags; 75 | 76 | } entity_t; 77 | 78 | #define ENTITY_FLAGS 68 79 | 80 | typedef struct 81 | { 82 | vec3_t origin; 83 | vec3_t color; 84 | float intensity; 85 | } dlight_t; 86 | 87 | typedef struct 88 | { 89 | vec3_t origin; 90 | int color; 91 | float alpha; 92 | } particle_t; 93 | 94 | typedef struct 95 | { 96 | float rgb[3]; // 0.0 - 2.0 97 | float white; // highest of rgb 98 | } lightstyle_t; 99 | 100 | typedef struct 101 | { 102 | int x, y, width, height;// in virtual screen coordinates 103 | float fov_x, fov_y; 104 | float vieworg[3]; 105 | float viewangles[3]; 106 | float blend[4]; // rgba 0-1 full screen blend 107 | float time; // time is uesed to auto animate 108 | int rdflags; // RDF_UNDERWATER, etc 109 | 110 | byte *areabits; // if not NULL, only areas with set bits will be drawn 111 | 112 | lightstyle_t *lightstyles; // [MAX_LIGHTSTYLES] 113 | 114 | int num_entities; 115 | entity_t *entities; 116 | 117 | int num_dlights; 118 | dlight_t *dlights; 119 | 120 | int num_particles; 121 | particle_t *particles; 122 | } refdef_t; 123 | 124 | 125 | 126 | #define API_VERSION 3 127 | 128 | // 129 | // these are the functions exported by the refresh module 130 | // 131 | typedef struct 132 | { 133 | // if api_version is different, the dll cannot be used 134 | int api_version; 135 | 136 | // called when the library is loaded 137 | qboolean (*Init) ( void *hinstance, void *wndproc ); 138 | 139 | // called before the library is unloaded 140 | void (*Shutdown) (void); 141 | 142 | // All data that will be used in a level should be 143 | // registered before rendering any frames to prevent disk hits, 144 | // but they can still be registered at a later time 145 | // if necessary. 146 | // 147 | // EndRegistration will free any remaining data that wasn't registered. 148 | // Any model_s or skin_s pointers from before the BeginRegistration 149 | // are no longer valid after EndRegistration. 150 | // 151 | // Skins and images need to be differentiated, because skins 152 | // are flood filled to eliminate mip map edge errors, and pics have 153 | // an implicit "pics/" prepended to the name. (a pic name that starts with a 154 | // slash will not use the "pics/" prefix or the ".pcx" postfix) 155 | void (*BeginRegistration) (char *map); 156 | struct model_s *(*RegisterModel) (char *name); 157 | struct image_s *(*RegisterSkin) (char *name); 158 | struct image_s *(*RegisterPic) (char *name); 159 | void (*SetSky) (char *name, float rotate, vec3_t axis); 160 | void (*EndRegistration) (void); 161 | 162 | void (*RenderFrame) (refdef_t *fd); 163 | 164 | void (*DrawGetPicSize) (int *w, int *h, char *name); // will return 0 0 if not found 165 | void (*DrawPic) (int x, int y, char *name); 166 | void (*DrawStretchPic) (int x, int y, int w, int h, char *name); 167 | void (*DrawChar) (int x, int y, int c); 168 | void (*DrawTileClear) (int x, int y, int w, int h, char *name); 169 | void (*DrawFill) (int x, int y, int w, int h, int c); 170 | void (*DrawFadeScreen) (void); 171 | 172 | // Draw images for cinematic rendering (which can have a different palette). Note that calls 173 | void (*DrawStretchRaw) (int x, int y, int w, int h, int cols, int rows, byte *data); 174 | 175 | /* 176 | ** video mode and refresh state management entry points 177 | */ 178 | void (*CinematicSetPalette)( const unsigned char *palette); // NULL = game palette 179 | void (*BeginFrame)( float camera_separation ); 180 | void (*EndFrame) (void); 181 | 182 | void (*AppActivate)( qboolean activate ); 183 | 184 | } refexport_t; 185 | 186 | // 187 | // these are the functions imported by the refresh module 188 | // 189 | typedef struct 190 | { 191 | void (*Sys_Error) (int err_level, char *str, ...); 192 | 193 | void (*Cmd_AddCommand) (char *name, void(*cmd)(void)); 194 | void (*Cmd_RemoveCommand) (char *name); 195 | int (*Cmd_Argc) (void); 196 | char *(*Cmd_Argv) (int i); 197 | void (*Cmd_ExecuteText) (int exec_when, char *text); 198 | 199 | void (*Con_Printf) (int print_level, char *str, ...); 200 | 201 | // files will be memory mapped read only 202 | // the returned buffer may be part of a larger pak file, 203 | // or a discrete file from anywhere in the quake search path 204 | // a -1 return means the file does not exist 205 | // NULL can be passed for buf to just determine existance 206 | int (*FS_LoadFile) (char *name, void **buf); 207 | void (*FS_FreeFile) (void *buf); 208 | 209 | // gamedir will be the current directory that generated 210 | // files should be stored to, ie: "f:\quake\id1" 211 | char *(*FS_Gamedir) (void); 212 | 213 | cvar_t *(*Cvar_Get) (char *name, char *value, int flags); 214 | cvar_t *(*Cvar_Set)( char *name, char *value ); 215 | void (*Cvar_SetValue)( char *name, float value ); 216 | 217 | qboolean (*Vid_GetModeInfo)( int *width, int *height, int mode ); 218 | void (*Vid_MenuInit)( void ); 219 | void (*Vid_NewWindow)( int width, int height ); 220 | } refimport_t; 221 | 222 | 223 | // this is the only function actually exported at the linker level 224 | typedef refexport_t (*GetRefAPI_t) (refimport_t); 225 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/client/screen.h: -------------------------------------------------------------------------------- 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 | // screen.h 21 | 22 | void SCR_Init (void); 23 | 24 | void SCR_UpdateScreen (void); 25 | 26 | void SCR_SizeUp (void); 27 | void SCR_SizeDown (void); 28 | void SCR_CenterPrint (char *str); 29 | void SCR_BeginLoadingPlaque (void); 30 | void SCR_EndLoadingPlaque (void); 31 | 32 | void SCR_DebugGraph (float value, int color); 33 | 34 | void SCR_TouchPics (void); 35 | 36 | void SCR_RunConsole (void); 37 | 38 | extern float scr_con_current; 39 | extern float scr_conlines; // lines of console to display 40 | 41 | extern int sb_lines; 42 | 43 | extern cvar_t *scr_viewsize; 44 | extern cvar_t *crosshair; 45 | 46 | extern vrect_t scr_vrect; // position of render window 47 | 48 | extern char crosshair_pic[MAX_QPATH]; 49 | extern int crosshair_width, crosshair_height; 50 | 51 | void SCR_AddDirtyPoint (int x, int y); 52 | void SCR_DirtyScreen (void); 53 | 54 | // 55 | // scr_cin.c 56 | // 57 | void SCR_PlayCinematic (char *name); 58 | qboolean SCR_DrawCinematic (void); 59 | void SCR_RunCinematic (void); 60 | void SCR_StopCinematic (void); 61 | void SCR_FinishCinematic (void); 62 | 63 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/client/snd_loc.h: -------------------------------------------------------------------------------- 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 | // snd_loc.h -- private sound functions 21 | 22 | #ifndef SND_LOC_H 23 | #define SND_LOC_H 24 | 25 | // !!! if this is changed, the asm code must change !!! 26 | typedef struct 27 | { 28 | int left; 29 | int right; 30 | } portable_samplepair_t; 31 | 32 | typedef struct 33 | { 34 | float intensity; 35 | float alpha; 36 | float accum[2]; 37 | } underwater_t; 38 | 39 | extern underwater_t underwater; 40 | 41 | typedef struct 42 | { 43 | int length; 44 | int loopstart; 45 | int speed; // not needed, because converted on load? 46 | int width; 47 | int stereo; 48 | byte data[1]; // variable sized 49 | } sfxcache_t; 50 | 51 | typedef uint32_t u32; 52 | 53 | typedef struct sfx_s 54 | { 55 | char name[MAX_QPATH]; 56 | int registration_sequence; 57 | sfxcache_t *cache; 58 | char *truename; 59 | //u32 cacheHandle; 60 | } sfx_t; 61 | 62 | #define SNDCALL_TYPE_NULL 0 63 | #define SNDCALL_TYPE_PLAY 1 64 | #define SNDCALL_TYPE_STOP 2 65 | #define SNDCALL_FLAG_ORIGIN 0x01 66 | // S_StartSound vec3_t origin, int entnum, int entchannel, struct sfx_s *sfx, float fvol, float attenuation, float timeofs 67 | typedef struct sndcall_s 68 | { 69 | int type; 70 | int flags; 71 | // play, stop 72 | int entnum; 73 | int entchannel; 74 | // play 75 | sfx_t *sfx; 76 | vec3_t origin; 77 | float fvol; 78 | float attenuation; 79 | float timeofs; 80 | } sndcall_t; 81 | 82 | // a playsound_t will be generated by each call to S_StartSound, 83 | // when the mixer reaches playsound->begin, the playsound will 84 | // be assigned to a channel 85 | typedef struct playsound_s 86 | { 87 | struct playsound_s *prev, *next; 88 | sfx_t *sfx; 89 | float volume; 90 | float attenuation; 91 | int entnum; 92 | int entchannel; 93 | qboolean fixed_origin; // use origin field instead of entnum's origin 94 | vec3_t origin; 95 | unsigned begin; // begin on this sample 96 | } playsound_t; 97 | 98 | typedef struct 99 | { 100 | int channels; 101 | int samples; // mono samples in buffer 102 | int submission_chunk; // don't mix less than this # 103 | int samplepos; // in mono samples 104 | int samplebits; 105 | int speed; 106 | int flags; 107 | byte *buffer; 108 | } dma_t; 109 | 110 | // !!! if this is changed, the asm code must change !!! 111 | typedef struct 112 | { 113 | sfx_t *sfx; // sfx number 114 | int leftvol; // 0-255 volume 115 | int rightvol; // 0-255 volume 116 | int end; // end time in global paintsamples 117 | int pos; // sample position in sfx 118 | int looping; // where to loop, -1 = no looping OBSOLETE? 119 | int entnum; // to allow overriding a specific sound 120 | int entchannel; // 121 | vec3_t origin; // only use if fixed_origin is set 122 | vec_t dist_mult; // distance multiplier (attenuation/clipK) 123 | int master_vol; // 0-255 master volume 124 | qboolean fixed_origin; // use origin instead of fetching entnum's origin 125 | qboolean autosound; // from an entity->sound, cleared each frame 126 | } channel_t; 127 | 128 | typedef struct 129 | { 130 | int rate; 131 | int width; 132 | int channels; 133 | int loopstart; 134 | int samples; 135 | int dataofs; // chunk starts this many bytes from file start 136 | } wavinfo_t; 137 | 138 | 139 | /* 140 | ==================================================================== 141 | 142 | SYSTEM SPECIFIC FUNCTIONS 143 | 144 | ==================================================================== 145 | */ 146 | 147 | // initializes cycling through a DMA buffer and returns information on it 148 | qboolean SNDDMA_Init(void); 149 | 150 | // gets the current DMA position 151 | int SNDDMA_GetDMAPos(void); 152 | 153 | // shutdown the DMA xfer. 154 | void SNDDMA_Shutdown(void); 155 | 156 | void SNDDMA_BeginPainting (void); 157 | 158 | void SNDDMA_Submit(void); 159 | 160 | //==================================================================== 161 | 162 | #define SFX_VOLUME_MULTIPLIER 0.5 163 | #define MAX_CHANNELS 32 164 | extern channel_t channels[MAX_CHANNELS]; 165 | 166 | extern int paintedtime; 167 | extern int s_rawend; 168 | extern vec3_t listener_origin; 169 | extern vec3_t listener_forward; 170 | extern vec3_t listener_right; 171 | extern vec3_t listener_up; 172 | extern volatile dma_t* dma; 173 | extern playsound_t s_pendingplays; 174 | 175 | #define MAX_RAW_SAMPLES (8192*2) //8192 176 | extern portable_samplepair_t s_rawsamples[MAX_RAW_SAMPLES]; 177 | 178 | extern cvar_t *s_volume; 179 | extern cvar_t *s_nosound; 180 | extern cvar_t *s_loadas8bit; 181 | extern cvar_t *s_khz; 182 | extern cvar_t *s_show; 183 | extern cvar_t *s_mixahead; 184 | extern cvar_t *s_testsound; 185 | extern cvar_t *s_primary; 186 | 187 | extern cvar_t *bgm_volume; 188 | extern cvar_t *cin_volume; 189 | 190 | wavinfo_t GetWavinfo (char *name, byte *wav, int wavlength); 191 | 192 | void S_InitScaletable (void); 193 | 194 | sfxcache_t *S_LoadSound (sfx_t *s); 195 | 196 | void S_IssuePlaysound (playsound_t *ps); 197 | 198 | void S_SetUnderwaterIntensity(float); 199 | 200 | void S_PaintChannels(int endtime); 201 | 202 | // picks a channel based on priorities, empty slots, number of channels 203 | channel_t *S_PickChannel(int entnum, int entchannel); 204 | 205 | // spatializes a channel 206 | void S_Spatialize(channel_t *ch); 207 | 208 | #endif // SND_LOC_H 209 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/client/sound.h: -------------------------------------------------------------------------------- 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 | #define SND_LOCK pthread_mutex_lock(&snd_lock); 22 | #define SND_UNLOCK pthread_mutex_unlock(&snd_lock); 23 | #define SND_TRYLOCK pthread_mutex_trylock(&snd_lock) 24 | 25 | #define DMA_FLAG_IS_INTERLEAVED 0x01 26 | #define DMA_FLAG_IS_FLOAT 0x02 27 | 28 | struct sfx_s; 29 | 30 | void S_Init (void); 31 | void S_Shutdown (void); 32 | 33 | // if origin is NULL, the sound will be dynamically sourced from the entity 34 | void S_StartSound (vec3_t origin, int entnum, int entchannel, struct sfx_s *sfx, float fvol, float attenuation, float timeofs); 35 | void S_StartLocalSound (char *s); 36 | 37 | void S_RawSamples (int samples, int rate, int width, int channels, byte *data); 38 | 39 | void S_StopAllSounds(void); 40 | void S_Update (vec3_t origin, vec3_t v_forward, vec3_t v_right, vec3_t v_up, int flags); 41 | void S_MixerUpdate(void); 42 | 43 | void S_Activate (qboolean active); 44 | 45 | void S_BeginRegistration (void); 46 | struct sfx_s *S_RegisterSound (char *sample); 47 | void S_EndRegistration (void); 48 | 49 | struct sfx_s *S_FindName (char *name, qboolean create); 50 | 51 | // the sound code makes callbacks to the client for entitiy position 52 | // information, so entities can be dynamically re-spatialized 53 | void CL_GetEntitySoundOrigin (int ent, vec3_t org); 54 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/client/vid.h: -------------------------------------------------------------------------------- 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 | // vid.h -- video driver defs 21 | 22 | #ifndef VID_H 23 | #define VID_H 24 | 25 | typedef struct vrect_s 26 | { 27 | int x,y,width,height; 28 | } vrect_t; 29 | 30 | typedef uint8_t pixel_t; 31 | 32 | typedef struct 33 | { 34 | // from r_local 35 | pixel_t *buffer; // invisible buffer 36 | pixel_t *colormap; // 256 * VID_GRADES size 37 | pixel_t *alphamap; // 256 * 256 translucency map 38 | int rowbytes; // may be > width if displayed in a window 39 | // original 40 | int width; 41 | int height; 42 | } viddef_t; 43 | 44 | extern viddef_t viddef; // global video state 45 | 46 | // Video module initialisation etc 47 | void VID_Init (void); 48 | void VID_Shutdown (void); 49 | void VID_CheckChanges (void); 50 | 51 | void VID_MenuInit( void ); 52 | void VID_MenuDraw( void ); 53 | const char *VID_MenuKey( int ); 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/game/g_chase.c: -------------------------------------------------------------------------------- 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 | #include "g_local.h" 21 | 22 | void UpdateChaseCam(edict_t *ent) 23 | { 24 | vec3_t o, ownerv, goal; 25 | edict_t *targ; 26 | vec3_t forward, right; 27 | trace_t trace; 28 | int i; 29 | vec3_t oldgoal; 30 | vec3_t angles; 31 | 32 | // is our chase target gone? 33 | if (!ent->client->chase_target->inuse 34 | || ent->client->chase_target->client->resp.spectator) { 35 | edict_t *old = ent->client->chase_target; 36 | ChaseNext(ent); 37 | if (ent->client->chase_target == old) { 38 | ent->client->chase_target = NULL; 39 | ent->client->ps.pmove.pm_flags &= ~PMF_NO_PREDICTION; 40 | return; 41 | } 42 | } 43 | 44 | targ = ent->client->chase_target; 45 | 46 | VectorCopy(targ->s.origin, ownerv); 47 | VectorCopy(ent->s.origin, oldgoal); 48 | 49 | ownerv[2] += targ->viewheight; 50 | 51 | VectorCopy(targ->client->v_angle, angles); 52 | if (angles[PITCH] > 56) 53 | angles[PITCH] = 56; 54 | AngleVectors (angles, forward, right, NULL); 55 | VectorNormalize(forward); 56 | VectorMA(ownerv, -30, forward, o); 57 | 58 | if (o[2] < targ->s.origin[2] + 20) 59 | o[2] = targ->s.origin[2] + 20; 60 | 61 | // jump animation lifts 62 | if (!targ->groundentity) 63 | o[2] += 16; 64 | 65 | trace = gi.trace(ownerv, vec3_origin, vec3_origin, o, targ, MASK_SOLID); 66 | 67 | VectorCopy(trace.endpos, goal); 68 | 69 | VectorMA(goal, 2, forward, goal); 70 | 71 | // pad for floors and ceilings 72 | VectorCopy(goal, o); 73 | o[2] += 6; 74 | trace = gi.trace(goal, vec3_origin, vec3_origin, o, targ, MASK_SOLID); 75 | if (trace.fraction < 1) { 76 | VectorCopy(trace.endpos, goal); 77 | goal[2] -= 6; 78 | } 79 | 80 | VectorCopy(goal, o); 81 | o[2] -= 6; 82 | trace = gi.trace(goal, vec3_origin, vec3_origin, o, targ, MASK_SOLID); 83 | if (trace.fraction < 1) { 84 | VectorCopy(trace.endpos, goal); 85 | goal[2] += 6; 86 | } 87 | 88 | if (targ->deadflag) 89 | ent->client->ps.pmove.pm_type = PM_DEAD; 90 | else 91 | ent->client->ps.pmove.pm_type = PM_FREEZE; 92 | 93 | VectorCopy(goal, ent->s.origin); 94 | for (i=0 ; i<3 ; i++) 95 | ent->client->ps.pmove.delta_angles[i] = ANGLE2SHORT(targ->client->v_angle[i] - ent->client->resp.cmd_angles[i]); 96 | 97 | if (targ->deadflag) { 98 | ent->client->ps.viewangles[ROLL] = 40; 99 | ent->client->ps.viewangles[PITCH] = -15; 100 | ent->client->ps.viewangles[YAW] = targ->client->killer_yaw; 101 | } else { 102 | VectorCopy(targ->client->v_angle, ent->client->ps.viewangles); 103 | VectorCopy(targ->client->v_angle, ent->client->v_angle); 104 | } 105 | 106 | ent->viewheight = 0; 107 | ent->client->ps.pmove.pm_flags |= PMF_NO_PREDICTION; 108 | gi.linkentity(ent); 109 | } 110 | 111 | void ChaseNext(edict_t *ent) 112 | { 113 | int i; 114 | edict_t *e; 115 | 116 | if (!ent->client->chase_target) 117 | return; 118 | 119 | i = ent->client->chase_target - g_edicts; 120 | do { 121 | i++; 122 | if (i > maxclients->value) 123 | i = 1; 124 | e = g_edicts + i; 125 | if (!e->inuse) 126 | continue; 127 | if (!e->client->resp.spectator) 128 | break; 129 | } while (e != ent->client->chase_target); 130 | 131 | ent->client->chase_target = e; 132 | ent->client->update_chase = qTrue; 133 | } 134 | 135 | void ChasePrev(edict_t *ent) 136 | { 137 | int i; 138 | edict_t *e; 139 | 140 | if (!ent->client->chase_target) 141 | return; 142 | 143 | i = ent->client->chase_target - g_edicts; 144 | do { 145 | i--; 146 | if (i < 1) 147 | i = maxclients->value; 148 | e = g_edicts + i; 149 | if (!e->inuse) 150 | continue; 151 | if (!e->client->resp.spectator) 152 | break; 153 | } while (e != ent->client->chase_target); 154 | 155 | ent->client->chase_target = e; 156 | ent->client->update_chase = qTrue; 157 | } 158 | 159 | void GetChaseTarget(edict_t *ent) 160 | { 161 | int i; 162 | edict_t *other; 163 | 164 | for (i = 1; i <= maxclients->value; i++) { 165 | other = g_edicts + i; 166 | if (other->inuse && !other->client->resp.spectator) { 167 | ent->client->chase_target = other; 168 | ent->client->update_chase = qTrue; 169 | UpdateChaseCam(ent); 170 | return; 171 | } 172 | } 173 | gi.centerprintf(ent, "No other players to chase."); 174 | } 175 | 176 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/game/g_main.h: -------------------------------------------------------------------------------- 1 | // 2 | // g_main.h 3 | // WatchQuake2 4 | // 5 | // Created by ByteOverlord on 26.11.2022. 6 | // 7 | 8 | #ifndef g_main_h 9 | #define g_main_h 10 | 11 | #include "g_local.h" 12 | 13 | game_export_t *GetGameAPI (game_import_t *import); 14 | 15 | #endif /* g_main_h */ 16 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/game/g_save_common.c: -------------------------------------------------------------------------------- 1 | // 2 | // g_save_common.c 3 | // WatchQuake2 Watch App 4 | // 5 | // Created by ByteOverlord on 2.9.2023. 6 | // 7 | 8 | #include "g_save_common.h" 9 | 10 | uint32_t StringHash(const char* str) 11 | { 12 | uint32_t h = 5381; 13 | const char* s = str; 14 | while(*s) 15 | { 16 | h += *s; 17 | h = (h << 5) + h; 18 | s++; 19 | } 20 | return h; 21 | } 22 | 23 | void InitAddressTable(saveaddr_t* tbl_sav) 24 | { 25 | for (int i=0; tbl_sav[i].ptr != NULL; i++) 26 | { 27 | tbl_sav[i].hash = StringHash(tbl_sav[i].name); 28 | } 29 | for (int i=0; tbl_sav[i].ptr != NULL; i++) 30 | { 31 | uint32_t hash0 = tbl_sav[i].hash; 32 | if (hash0 == 0) 33 | { 34 | printf("null hash = %s\n",tbl_sav[i].name); 35 | } 36 | for (int j=i+1; tbl_sav[j].ptr != NULL; j++) 37 | { 38 | uint32_t hash1 = tbl_sav[j].hash; 39 | if (tbl_sav[i].ptr == tbl_sav[j].ptr) 40 | { 41 | printf("dublicate reference, %i %i -> %s %s\n",i,j,tbl_sav[i].name,tbl_sav[j].name); 42 | } 43 | else if (hash0 == hash1) 44 | { 45 | printf("hash collision, %s == %s\n",tbl_sav[i].name,tbl_sav[j].name); 46 | } 47 | } 48 | } 49 | } 50 | 51 | byte* GetAddressByHash(saveaddr_t* tbl_sav, uint32_t hash) 52 | { 53 | for (int i=0; tbl_sav[i].ptr != NULL; i++) 54 | { 55 | saveaddr_t* savfunc = &tbl_sav[i]; 56 | if (savfunc->hash == hash) 57 | { 58 | return savfunc->ptr; 59 | } 60 | } 61 | return NULL; 62 | } 63 | 64 | uint32_t GetHashByAddress(saveaddr_t* tbl_sav, byte* addr) 65 | { 66 | for (int i=0; tbl_sav[i].ptr != NULL; i++) 67 | { 68 | saveaddr_t* savfunc = &tbl_sav[i]; 69 | if (savfunc->ptr == addr) 70 | { 71 | return savfunc->hash; 72 | } 73 | } 74 | return 0; 75 | } 76 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/game/g_save_common.h: -------------------------------------------------------------------------------- 1 | // 2 | // g_save_common.h 3 | // WatchQuake2 Watch App 4 | // 5 | // Created by ByteOverlord on 2.9.2023. 6 | // 7 | 8 | #ifndef g_save_common_h 9 | #define g_save_common_h 10 | 11 | #include "q_shared.h" 12 | 13 | uint32_t StringHash(const char* str); 14 | 15 | typedef struct 16 | { 17 | byte* ptr; 18 | const char* name; 19 | uint32_t hash; 20 | } saveaddr_t; 21 | 22 | void InitAddressTable(saveaddr_t* tbl_sav); 23 | byte* GetAddressByHash(saveaddr_t* tbl_sav, uint32_t hash); 24 | uint32_t GetHashByAddress(saveaddr_t* tbl_sav, byte* addr); 25 | 26 | #endif /* g_save_common_h */ 27 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/game/g_svcmds.c: -------------------------------------------------------------------------------- 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 | #include "g_local.h" 22 | 23 | 24 | void Svcmd_Test_f (void) 25 | { 26 | gi.cprintf (NULL, PRINT_HIGH, "Svcmd_Test_f()\n"); 27 | } 28 | 29 | /* 30 | ============================================================================== 31 | 32 | PACKET FILTERING 33 | 34 | 35 | You can add or remove addresses from the filter list with: 36 | 37 | addip 38 | removeip 39 | 40 | The ip address is specified in dot format, and any unspecified digits will match any value, so you can specify an entire class C network with "addip 192.246.40". 41 | 42 | Removeip will only remove an address specified exactly the same way. You cannot addip a subnet, then removeip a single host. 43 | 44 | listip 45 | Prints the current list of filters. 46 | 47 | writeip 48 | Dumps "addip " commands to listip.cfg so it can be execed at a later date. The filter lists are not saved and restored by default, because I beleive it would cause too much confusion. 49 | 50 | filterban <0 or 1> 51 | 52 | If 1 (the default), then ip addresses matching the current list will be prohibited from entering the game. This is the default setting. 53 | 54 | If 0, then only addresses matching the list will be allowed. This lets you easily set up a private game, or a game that only allows players from your local network. 55 | 56 | 57 | ============================================================================== 58 | */ 59 | 60 | typedef struct 61 | { 62 | unsigned mask; 63 | unsigned compare; 64 | } ipfilter_t; 65 | 66 | #define MAX_IPFILTERS 1024 67 | 68 | ipfilter_t ipfilters[MAX_IPFILTERS]; 69 | int numipfilters; 70 | 71 | /* 72 | ================= 73 | StringToFilter 74 | ================= 75 | */ 76 | static qboolean StringToFilter (char *s, ipfilter_t *f) 77 | { 78 | char num[128]; 79 | int i, j; 80 | byte b[4]; 81 | byte m[4]; 82 | 83 | for (i=0 ; i<4 ; i++) 84 | { 85 | b[i] = 0; 86 | m[i] = 0; 87 | } 88 | 89 | for (i=0 ; i<4 ; i++) 90 | { 91 | if (*s < '0' || *s > '9') 92 | { 93 | gi.cprintf(NULL, PRINT_HIGH, "Bad filter address: %s\n", s); 94 | return qFalse; 95 | } 96 | 97 | j = 0; 98 | while (*s >= '0' && *s <= '9') 99 | { 100 | num[j++] = *s++; 101 | } 102 | num[j] = 0; 103 | b[i] = atoi(num); 104 | if (b[i] != 0) 105 | m[i] = 255; 106 | 107 | if (!*s) 108 | break; 109 | s++; 110 | } 111 | 112 | f->mask = *(unsigned *)m; 113 | f->compare = *(unsigned *)b; 114 | 115 | return qTrue; 116 | } 117 | 118 | /* 119 | ================= 120 | SV_FilterPacket 121 | ================= 122 | */ 123 | qboolean SV_FilterPacket (char *from) 124 | { 125 | int i; 126 | unsigned in; 127 | byte m[4]; 128 | char *p; 129 | 130 | i = 0; 131 | p = from; 132 | while (*p && i < 4) { 133 | m[i] = 0; 134 | while (*p >= '0' && *p <= '9') { 135 | m[i] = m[i]*10 + (*p - '0'); 136 | p++; 137 | } 138 | if (!*p || *p == ':') 139 | break; 140 | i++; 141 | p++; 142 | } 143 | 144 | in = *(unsigned *)m; 145 | 146 | for (i=0 ; ivalue; 149 | 150 | return (int)!filterban->value; 151 | } 152 | 153 | 154 | /* 155 | ================= 156 | SV_AddIP_f 157 | ================= 158 | */ 159 | void SVCmd_AddIP_f (void) 160 | { 161 | int i; 162 | 163 | if (gi.argc() < 3) { 164 | gi.cprintf(NULL, PRINT_HIGH, "Usage: addip \n"); 165 | return; 166 | } 167 | 168 | for (i=0 ; i\n"); 197 | return; 198 | } 199 | 200 | if (!StringToFilter (gi.argv(2), &f)) 201 | return; 202 | 203 | for (i=0 ; istring) 250 | sprintf (name, "%s/listip.cfg", GAMEVERSION); 251 | else 252 | sprintf (name, "%s/listip.cfg", game->string); 253 | 254 | gi.cprintf (NULL, PRINT_HIGH, "Writing %s.\n", name); 255 | 256 | f = fopen (name, "wb"); 257 | if (!f) 258 | { 259 | gi.cprintf (NULL, PRINT_HIGH, "Couldn't open %s\n", name); 260 | return; 261 | } 262 | 263 | fprintf(f, "set filterban %d\n", (int)filterban->value); 264 | 265 | for (i=0 ; is.origin); 36 | gi.multicast (ent->s.origin, MULTICAST_PVS); 37 | G_FreeEdict (ent); 38 | } 39 | 40 | void Think_Boss3Stand (edict_t *ent) 41 | { 42 | if (ent->s.frame == FRAME_stand260) 43 | ent->s.frame = FRAME_stand201; 44 | else 45 | ent->s.frame++; 46 | ent->nextthink = level.time + FRAMETIME; 47 | } 48 | 49 | /*QUAKED monster_boss3_stand (1 .5 0) (-32 -32 0) (32 32 90) 50 | 51 | Just stands and cycles in one place until targeted, then teleports away. 52 | */ 53 | void SP_monster_boss3_stand (edict_t *self) 54 | { 55 | if (deathmatch->value) 56 | { 57 | G_FreeEdict (self); 58 | return; 59 | } 60 | 61 | self->movetype = MOVETYPE_STEP; 62 | self->solid = SOLID_BBOX; 63 | self->model = "models/monsters/boss3/rider/tris.md2"; 64 | self->s.modelindex = gi.modelindex (self->model); 65 | self->s.frame = FRAME_stand201; 66 | 67 | gi.soundindex ("misc/bigtele.wav"); 68 | 69 | VectorSet (self->mins, -32, -32, 0); 70 | VectorSet (self->maxs, 32, 32, 90); 71 | 72 | self->use = Use_Boss3; 73 | self->think = Think_Boss3Stand; 74 | self->nextthink = level.time + FRAMETIME; 75 | gi.linkentity (self); 76 | } 77 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/game/m_flipper.h: -------------------------------------------------------------------------------- 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 | // G:\quake2\baseq2\models/monsters/flipper 21 | 22 | // This file generated by ModelGen - Do NOT Modify 23 | 24 | #define FRAME_flpbit01 0 25 | #define FRAME_flpbit02 1 26 | #define FRAME_flpbit03 2 27 | #define FRAME_flpbit04 3 28 | #define FRAME_flpbit05 4 29 | #define FRAME_flpbit06 5 30 | #define FRAME_flpbit07 6 31 | #define FRAME_flpbit08 7 32 | #define FRAME_flpbit09 8 33 | #define FRAME_flpbit10 9 34 | #define FRAME_flpbit11 10 35 | #define FRAME_flpbit12 11 36 | #define FRAME_flpbit13 12 37 | #define FRAME_flpbit14 13 38 | #define FRAME_flpbit15 14 39 | #define FRAME_flpbit16 15 40 | #define FRAME_flpbit17 16 41 | #define FRAME_flpbit18 17 42 | #define FRAME_flpbit19 18 43 | #define FRAME_flpbit20 19 44 | #define FRAME_flptal01 20 45 | #define FRAME_flptal02 21 46 | #define FRAME_flptal03 22 47 | #define FRAME_flptal04 23 48 | #define FRAME_flptal05 24 49 | #define FRAME_flptal06 25 50 | #define FRAME_flptal07 26 51 | #define FRAME_flptal08 27 52 | #define FRAME_flptal09 28 53 | #define FRAME_flptal10 29 54 | #define FRAME_flptal11 30 55 | #define FRAME_flptal12 31 56 | #define FRAME_flptal13 32 57 | #define FRAME_flptal14 33 58 | #define FRAME_flptal15 34 59 | #define FRAME_flptal16 35 60 | #define FRAME_flptal17 36 61 | #define FRAME_flptal18 37 62 | #define FRAME_flptal19 38 63 | #define FRAME_flptal20 39 64 | #define FRAME_flptal21 40 65 | #define FRAME_flphor01 41 66 | #define FRAME_flphor02 42 67 | #define FRAME_flphor03 43 68 | #define FRAME_flphor04 44 69 | #define FRAME_flphor05 45 70 | #define FRAME_flphor06 46 71 | #define FRAME_flphor07 47 72 | #define FRAME_flphor08 48 73 | #define FRAME_flphor09 49 74 | #define FRAME_flphor10 50 75 | #define FRAME_flphor11 51 76 | #define FRAME_flphor12 52 77 | #define FRAME_flphor13 53 78 | #define FRAME_flphor14 54 79 | #define FRAME_flphor15 55 80 | #define FRAME_flphor16 56 81 | #define FRAME_flphor17 57 82 | #define FRAME_flphor18 58 83 | #define FRAME_flphor19 59 84 | #define FRAME_flphor20 60 85 | #define FRAME_flphor21 61 86 | #define FRAME_flphor22 62 87 | #define FRAME_flphor23 63 88 | #define FRAME_flphor24 64 89 | #define FRAME_flpver01 65 90 | #define FRAME_flpver02 66 91 | #define FRAME_flpver03 67 92 | #define FRAME_flpver04 68 93 | #define FRAME_flpver05 69 94 | #define FRAME_flpver06 70 95 | #define FRAME_flpver07 71 96 | #define FRAME_flpver08 72 97 | #define FRAME_flpver09 73 98 | #define FRAME_flpver10 74 99 | #define FRAME_flpver11 75 100 | #define FRAME_flpver12 76 101 | #define FRAME_flpver13 77 102 | #define FRAME_flpver14 78 103 | #define FRAME_flpver15 79 104 | #define FRAME_flpver16 80 105 | #define FRAME_flpver17 81 106 | #define FRAME_flpver18 82 107 | #define FRAME_flpver19 83 108 | #define FRAME_flpver20 84 109 | #define FRAME_flpver21 85 110 | #define FRAME_flpver22 86 111 | #define FRAME_flpver23 87 112 | #define FRAME_flpver24 88 113 | #define FRAME_flpver25 89 114 | #define FRAME_flpver26 90 115 | #define FRAME_flpver27 91 116 | #define FRAME_flpver28 92 117 | #define FRAME_flpver29 93 118 | #define FRAME_flppn101 94 119 | #define FRAME_flppn102 95 120 | #define FRAME_flppn103 96 121 | #define FRAME_flppn104 97 122 | #define FRAME_flppn105 98 123 | #define FRAME_flppn201 99 124 | #define FRAME_flppn202 100 125 | #define FRAME_flppn203 101 126 | #define FRAME_flppn204 102 127 | #define FRAME_flppn205 103 128 | #define FRAME_flpdth01 104 129 | #define FRAME_flpdth02 105 130 | #define FRAME_flpdth03 106 131 | #define FRAME_flpdth04 107 132 | #define FRAME_flpdth05 108 133 | #define FRAME_flpdth06 109 134 | #define FRAME_flpdth07 110 135 | #define FRAME_flpdth08 111 136 | #define FRAME_flpdth09 112 137 | #define FRAME_flpdth10 113 138 | #define FRAME_flpdth11 114 139 | #define FRAME_flpdth12 115 140 | #define FRAME_flpdth13 116 141 | #define FRAME_flpdth14 117 142 | #define FRAME_flpdth15 118 143 | #define FRAME_flpdth16 119 144 | #define FRAME_flpdth17 120 145 | #define FRAME_flpdth18 121 146 | #define FRAME_flpdth19 122 147 | #define FRAME_flpdth20 123 148 | #define FRAME_flpdth21 124 149 | #define FRAME_flpdth22 125 150 | #define FRAME_flpdth23 126 151 | #define FRAME_flpdth24 127 152 | #define FRAME_flpdth25 128 153 | #define FRAME_flpdth26 129 154 | #define FRAME_flpdth27 130 155 | #define FRAME_flpdth28 131 156 | #define FRAME_flpdth29 132 157 | #define FRAME_flpdth30 133 158 | #define FRAME_flpdth31 134 159 | #define FRAME_flpdth32 135 160 | #define FRAME_flpdth33 136 161 | #define FRAME_flpdth34 137 162 | #define FRAME_flpdth35 138 163 | #define FRAME_flpdth36 139 164 | #define FRAME_flpdth37 140 165 | #define FRAME_flpdth38 141 166 | #define FRAME_flpdth39 142 167 | #define FRAME_flpdth40 143 168 | #define FRAME_flpdth41 144 169 | #define FRAME_flpdth42 145 170 | #define FRAME_flpdth43 146 171 | #define FRAME_flpdth44 147 172 | #define FRAME_flpdth45 148 173 | #define FRAME_flpdth46 149 174 | #define FRAME_flpdth47 150 175 | #define FRAME_flpdth48 151 176 | #define FRAME_flpdth49 152 177 | #define FRAME_flpdth50 153 178 | #define FRAME_flpdth51 154 179 | #define FRAME_flpdth52 155 180 | #define FRAME_flpdth53 156 181 | #define FRAME_flpdth54 157 182 | #define FRAME_flpdth55 158 183 | #define FRAME_flpdth56 159 184 | 185 | #define MODEL_SCALE 1.000000 186 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/game/m_flyer.h: -------------------------------------------------------------------------------- 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 | // G:\quake2\baseq2\models/monsters/flyer 21 | 22 | // This file generated by ModelGen - Do NOT Modify 23 | 24 | #define ACTION_nothing 0 25 | #define ACTION_attack1 1 26 | #define ACTION_attack2 2 27 | #define ACTION_run 3 28 | #define ACTION_walk 4 29 | 30 | #define FRAME_start01 0 31 | #define FRAME_start02 1 32 | #define FRAME_start03 2 33 | #define FRAME_start04 3 34 | #define FRAME_start05 4 35 | #define FRAME_start06 5 36 | #define FRAME_stop01 6 37 | #define FRAME_stop02 7 38 | #define FRAME_stop03 8 39 | #define FRAME_stop04 9 40 | #define FRAME_stop05 10 41 | #define FRAME_stop06 11 42 | #define FRAME_stop07 12 43 | #define FRAME_stand01 13 44 | #define FRAME_stand02 14 45 | #define FRAME_stand03 15 46 | #define FRAME_stand04 16 47 | #define FRAME_stand05 17 48 | #define FRAME_stand06 18 49 | #define FRAME_stand07 19 50 | #define FRAME_stand08 20 51 | #define FRAME_stand09 21 52 | #define FRAME_stand10 22 53 | #define FRAME_stand11 23 54 | #define FRAME_stand12 24 55 | #define FRAME_stand13 25 56 | #define FRAME_stand14 26 57 | #define FRAME_stand15 27 58 | #define FRAME_stand16 28 59 | #define FRAME_stand17 29 60 | #define FRAME_stand18 30 61 | #define FRAME_stand19 31 62 | #define FRAME_stand20 32 63 | #define FRAME_stand21 33 64 | #define FRAME_stand22 34 65 | #define FRAME_stand23 35 66 | #define FRAME_stand24 36 67 | #define FRAME_stand25 37 68 | #define FRAME_stand26 38 69 | #define FRAME_stand27 39 70 | #define FRAME_stand28 40 71 | #define FRAME_stand29 41 72 | #define FRAME_stand30 42 73 | #define FRAME_stand31 43 74 | #define FRAME_stand32 44 75 | #define FRAME_stand33 45 76 | #define FRAME_stand34 46 77 | #define FRAME_stand35 47 78 | #define FRAME_stand36 48 79 | #define FRAME_stand37 49 80 | #define FRAME_stand38 50 81 | #define FRAME_stand39 51 82 | #define FRAME_stand40 52 83 | #define FRAME_stand41 53 84 | #define FRAME_stand42 54 85 | #define FRAME_stand43 55 86 | #define FRAME_stand44 56 87 | #define FRAME_stand45 57 88 | #define FRAME_attak101 58 89 | #define FRAME_attak102 59 90 | #define FRAME_attak103 60 91 | #define FRAME_attak104 61 92 | #define FRAME_attak105 62 93 | #define FRAME_attak106 63 94 | #define FRAME_attak107 64 95 | #define FRAME_attak108 65 96 | #define FRAME_attak109 66 97 | #define FRAME_attak110 67 98 | #define FRAME_attak111 68 99 | #define FRAME_attak112 69 100 | #define FRAME_attak113 70 101 | #define FRAME_attak114 71 102 | #define FRAME_attak115 72 103 | #define FRAME_attak116 73 104 | #define FRAME_attak117 74 105 | #define FRAME_attak118 75 106 | #define FRAME_attak119 76 107 | #define FRAME_attak120 77 108 | #define FRAME_attak121 78 109 | #define FRAME_attak201 79 110 | #define FRAME_attak202 80 111 | #define FRAME_attak203 81 112 | #define FRAME_attak204 82 113 | #define FRAME_attak205 83 114 | #define FRAME_attak206 84 115 | #define FRAME_attak207 85 116 | #define FRAME_attak208 86 117 | #define FRAME_attak209 87 118 | #define FRAME_attak210 88 119 | #define FRAME_attak211 89 120 | #define FRAME_attak212 90 121 | #define FRAME_attak213 91 122 | #define FRAME_attak214 92 123 | #define FRAME_attak215 93 124 | #define FRAME_attak216 94 125 | #define FRAME_attak217 95 126 | #define FRAME_bankl01 96 127 | #define FRAME_bankl02 97 128 | #define FRAME_bankl03 98 129 | #define FRAME_bankl04 99 130 | #define FRAME_bankl05 100 131 | #define FRAME_bankl06 101 132 | #define FRAME_bankl07 102 133 | #define FRAME_bankr01 103 134 | #define FRAME_bankr02 104 135 | #define FRAME_bankr03 105 136 | #define FRAME_bankr04 106 137 | #define FRAME_bankr05 107 138 | #define FRAME_bankr06 108 139 | #define FRAME_bankr07 109 140 | #define FRAME_rollf01 110 141 | #define FRAME_rollf02 111 142 | #define FRAME_rollf03 112 143 | #define FRAME_rollf04 113 144 | #define FRAME_rollf05 114 145 | #define FRAME_rollf06 115 146 | #define FRAME_rollf07 116 147 | #define FRAME_rollf08 117 148 | #define FRAME_rollf09 118 149 | #define FRAME_rollr01 119 150 | #define FRAME_rollr02 120 151 | #define FRAME_rollr03 121 152 | #define FRAME_rollr04 122 153 | #define FRAME_rollr05 123 154 | #define FRAME_rollr06 124 155 | #define FRAME_rollr07 125 156 | #define FRAME_rollr08 126 157 | #define FRAME_rollr09 127 158 | #define FRAME_defens01 128 159 | #define FRAME_defens02 129 160 | #define FRAME_defens03 130 161 | #define FRAME_defens04 131 162 | #define FRAME_defens05 132 163 | #define FRAME_defens06 133 164 | #define FRAME_pain101 134 165 | #define FRAME_pain102 135 166 | #define FRAME_pain103 136 167 | #define FRAME_pain104 137 168 | #define FRAME_pain105 138 169 | #define FRAME_pain106 139 170 | #define FRAME_pain107 140 171 | #define FRAME_pain108 141 172 | #define FRAME_pain109 142 173 | #define FRAME_pain201 143 174 | #define FRAME_pain202 144 175 | #define FRAME_pain203 145 176 | #define FRAME_pain204 146 177 | #define FRAME_pain301 147 178 | #define FRAME_pain302 148 179 | #define FRAME_pain303 149 180 | #define FRAME_pain304 150 181 | 182 | #define MODEL_SCALE 1.000000 183 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/game/m_gladiator.h: -------------------------------------------------------------------------------- 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 | // G:\quake2\baseq2\models/monsters/gladiatr 21 | 22 | // This file generated by ModelGen - Do NOT Modify 23 | 24 | #define FRAME_stand1 0 25 | #define FRAME_stand2 1 26 | #define FRAME_stand3 2 27 | #define FRAME_stand4 3 28 | #define FRAME_stand5 4 29 | #define FRAME_stand6 5 30 | #define FRAME_stand7 6 31 | #define FRAME_walk1 7 32 | #define FRAME_walk2 8 33 | #define FRAME_walk3 9 34 | #define FRAME_walk4 10 35 | #define FRAME_walk5 11 36 | #define FRAME_walk6 12 37 | #define FRAME_walk7 13 38 | #define FRAME_walk8 14 39 | #define FRAME_walk9 15 40 | #define FRAME_walk10 16 41 | #define FRAME_walk11 17 42 | #define FRAME_walk12 18 43 | #define FRAME_walk13 19 44 | #define FRAME_walk14 20 45 | #define FRAME_walk15 21 46 | #define FRAME_walk16 22 47 | #define FRAME_run1 23 48 | #define FRAME_run2 24 49 | #define FRAME_run3 25 50 | #define FRAME_run4 26 51 | #define FRAME_run5 27 52 | #define FRAME_run6 28 53 | #define FRAME_melee1 29 54 | #define FRAME_melee2 30 55 | #define FRAME_melee3 31 56 | #define FRAME_melee4 32 57 | #define FRAME_melee5 33 58 | #define FRAME_melee6 34 59 | #define FRAME_melee7 35 60 | #define FRAME_melee8 36 61 | #define FRAME_melee9 37 62 | #define FRAME_melee10 38 63 | #define FRAME_melee11 39 64 | #define FRAME_melee12 40 65 | #define FRAME_melee13 41 66 | #define FRAME_melee14 42 67 | #define FRAME_melee15 43 68 | #define FRAME_melee16 44 69 | #define FRAME_melee17 45 70 | #define FRAME_attack1 46 71 | #define FRAME_attack2 47 72 | #define FRAME_attack3 48 73 | #define FRAME_attack4 49 74 | #define FRAME_attack5 50 75 | #define FRAME_attack6 51 76 | #define FRAME_attack7 52 77 | #define FRAME_attack8 53 78 | #define FRAME_attack9 54 79 | #define FRAME_pain1 55 80 | #define FRAME_pain2 56 81 | #define FRAME_pain3 57 82 | #define FRAME_pain4 58 83 | #define FRAME_pain5 59 84 | #define FRAME_pain6 60 85 | #define FRAME_death1 61 86 | #define FRAME_death2 62 87 | #define FRAME_death3 63 88 | #define FRAME_death4 64 89 | #define FRAME_death5 65 90 | #define FRAME_death6 66 91 | #define FRAME_death7 67 92 | #define FRAME_death8 68 93 | #define FRAME_death9 69 94 | #define FRAME_death10 70 95 | #define FRAME_death11 71 96 | #define FRAME_death12 72 97 | #define FRAME_death13 73 98 | #define FRAME_death14 74 99 | #define FRAME_death15 75 100 | #define FRAME_death16 76 101 | #define FRAME_death17 77 102 | #define FRAME_death18 78 103 | #define FRAME_death19 79 104 | #define FRAME_death20 80 105 | #define FRAME_death21 81 106 | #define FRAME_death22 82 107 | #define FRAME_painup1 83 108 | #define FRAME_painup2 84 109 | #define FRAME_painup3 85 110 | #define FRAME_painup4 86 111 | #define FRAME_painup5 87 112 | #define FRAME_painup6 88 113 | #define FRAME_painup7 89 114 | 115 | #define MODEL_SCALE 1.000000 116 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/game/m_mutant.h: -------------------------------------------------------------------------------- 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 | // G:\quake2\baseq2\models/monsters/mutant 21 | 22 | // This file generated by ModelGen - Do NOT Modify 23 | 24 | #define FRAME_attack01 0 25 | #define FRAME_attack02 1 26 | #define FRAME_attack03 2 27 | #define FRAME_attack04 3 28 | #define FRAME_attack05 4 29 | #define FRAME_attack06 5 30 | #define FRAME_attack07 6 31 | #define FRAME_attack08 7 32 | #define FRAME_attack09 8 33 | #define FRAME_attack10 9 34 | #define FRAME_attack11 10 35 | #define FRAME_attack12 11 36 | #define FRAME_attack13 12 37 | #define FRAME_attack14 13 38 | #define FRAME_attack15 14 39 | #define FRAME_death101 15 40 | #define FRAME_death102 16 41 | #define FRAME_death103 17 42 | #define FRAME_death104 18 43 | #define FRAME_death105 19 44 | #define FRAME_death106 20 45 | #define FRAME_death107 21 46 | #define FRAME_death108 22 47 | #define FRAME_death109 23 48 | #define FRAME_death201 24 49 | #define FRAME_death202 25 50 | #define FRAME_death203 26 51 | #define FRAME_death204 27 52 | #define FRAME_death205 28 53 | #define FRAME_death206 29 54 | #define FRAME_death207 30 55 | #define FRAME_death208 31 56 | #define FRAME_death209 32 57 | #define FRAME_death210 33 58 | #define FRAME_pain101 34 59 | #define FRAME_pain102 35 60 | #define FRAME_pain103 36 61 | #define FRAME_pain104 37 62 | #define FRAME_pain105 38 63 | #define FRAME_pain201 39 64 | #define FRAME_pain202 40 65 | #define FRAME_pain203 41 66 | #define FRAME_pain204 42 67 | #define FRAME_pain205 43 68 | #define FRAME_pain206 44 69 | #define FRAME_pain301 45 70 | #define FRAME_pain302 46 71 | #define FRAME_pain303 47 72 | #define FRAME_pain304 48 73 | #define FRAME_pain305 49 74 | #define FRAME_pain306 50 75 | #define FRAME_pain307 51 76 | #define FRAME_pain308 52 77 | #define FRAME_pain309 53 78 | #define FRAME_pain310 54 79 | #define FRAME_pain311 55 80 | #define FRAME_run03 56 81 | #define FRAME_run04 57 82 | #define FRAME_run05 58 83 | #define FRAME_run06 59 84 | #define FRAME_run07 60 85 | #define FRAME_run08 61 86 | #define FRAME_stand101 62 87 | #define FRAME_stand102 63 88 | #define FRAME_stand103 64 89 | #define FRAME_stand104 65 90 | #define FRAME_stand105 66 91 | #define FRAME_stand106 67 92 | #define FRAME_stand107 68 93 | #define FRAME_stand108 69 94 | #define FRAME_stand109 70 95 | #define FRAME_stand110 71 96 | #define FRAME_stand111 72 97 | #define FRAME_stand112 73 98 | #define FRAME_stand113 74 99 | #define FRAME_stand114 75 100 | #define FRAME_stand115 76 101 | #define FRAME_stand116 77 102 | #define FRAME_stand117 78 103 | #define FRAME_stand118 79 104 | #define FRAME_stand119 80 105 | #define FRAME_stand120 81 106 | #define FRAME_stand121 82 107 | #define FRAME_stand122 83 108 | #define FRAME_stand123 84 109 | #define FRAME_stand124 85 110 | #define FRAME_stand125 86 111 | #define FRAME_stand126 87 112 | #define FRAME_stand127 88 113 | #define FRAME_stand128 89 114 | #define FRAME_stand129 90 115 | #define FRAME_stand130 91 116 | #define FRAME_stand131 92 117 | #define FRAME_stand132 93 118 | #define FRAME_stand133 94 119 | #define FRAME_stand134 95 120 | #define FRAME_stand135 96 121 | #define FRAME_stand136 97 122 | #define FRAME_stand137 98 123 | #define FRAME_stand138 99 124 | #define FRAME_stand139 100 125 | #define FRAME_stand140 101 126 | #define FRAME_stand141 102 127 | #define FRAME_stand142 103 128 | #define FRAME_stand143 104 129 | #define FRAME_stand144 105 130 | #define FRAME_stand145 106 131 | #define FRAME_stand146 107 132 | #define FRAME_stand147 108 133 | #define FRAME_stand148 109 134 | #define FRAME_stand149 110 135 | #define FRAME_stand150 111 136 | #define FRAME_stand151 112 137 | #define FRAME_stand152 113 138 | #define FRAME_stand153 114 139 | #define FRAME_stand154 115 140 | #define FRAME_stand155 116 141 | #define FRAME_stand156 117 142 | #define FRAME_stand157 118 143 | #define FRAME_stand158 119 144 | #define FRAME_stand159 120 145 | #define FRAME_stand160 121 146 | #define FRAME_stand161 122 147 | #define FRAME_stand162 123 148 | #define FRAME_stand163 124 149 | #define FRAME_stand164 125 150 | #define FRAME_walk01 126 151 | #define FRAME_walk02 127 152 | #define FRAME_walk03 128 153 | #define FRAME_walk04 129 154 | #define FRAME_walk05 130 155 | #define FRAME_walk06 131 156 | #define FRAME_walk07 132 157 | #define FRAME_walk08 133 158 | #define FRAME_walk09 134 159 | #define FRAME_walk10 135 160 | #define FRAME_walk11 136 161 | #define FRAME_walk12 137 162 | #define FRAME_walk13 138 163 | #define FRAME_walk14 139 164 | #define FRAME_walk15 140 165 | #define FRAME_walk16 141 166 | #define FRAME_walk17 142 167 | #define FRAME_walk18 143 168 | #define FRAME_walk19 144 169 | #define FRAME_walk20 145 170 | #define FRAME_walk21 146 171 | #define FRAME_walk22 147 172 | #define FRAME_walk23 148 173 | 174 | #define MODEL_SCALE 1.000000 175 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/game/m_parasite.h: -------------------------------------------------------------------------------- 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 | // G:\quake2\baseq2\models/monsters/parasite 21 | 22 | // This file generated by ModelGen - Do NOT Modify 23 | 24 | #define FRAME_break01 0 25 | #define FRAME_break02 1 26 | #define FRAME_break03 2 27 | #define FRAME_break04 3 28 | #define FRAME_break05 4 29 | #define FRAME_break06 5 30 | #define FRAME_break07 6 31 | #define FRAME_break08 7 32 | #define FRAME_break09 8 33 | #define FRAME_break10 9 34 | #define FRAME_break11 10 35 | #define FRAME_break12 11 36 | #define FRAME_break13 12 37 | #define FRAME_break14 13 38 | #define FRAME_break15 14 39 | #define FRAME_break16 15 40 | #define FRAME_break17 16 41 | #define FRAME_break18 17 42 | #define FRAME_break19 18 43 | #define FRAME_break20 19 44 | #define FRAME_break21 20 45 | #define FRAME_break22 21 46 | #define FRAME_break23 22 47 | #define FRAME_break24 23 48 | #define FRAME_break25 24 49 | #define FRAME_break26 25 50 | #define FRAME_break27 26 51 | #define FRAME_break28 27 52 | #define FRAME_break29 28 53 | #define FRAME_break30 29 54 | #define FRAME_break31 30 55 | #define FRAME_break32 31 56 | #define FRAME_death101 32 57 | #define FRAME_death102 33 58 | #define FRAME_death103 34 59 | #define FRAME_death104 35 60 | #define FRAME_death105 36 61 | #define FRAME_death106 37 62 | #define FRAME_death107 38 63 | #define FRAME_drain01 39 64 | #define FRAME_drain02 40 65 | #define FRAME_drain03 41 66 | #define FRAME_drain04 42 67 | #define FRAME_drain05 43 68 | #define FRAME_drain06 44 69 | #define FRAME_drain07 45 70 | #define FRAME_drain08 46 71 | #define FRAME_drain09 47 72 | #define FRAME_drain10 48 73 | #define FRAME_drain11 49 74 | #define FRAME_drain12 50 75 | #define FRAME_drain13 51 76 | #define FRAME_drain14 52 77 | #define FRAME_drain15 53 78 | #define FRAME_drain16 54 79 | #define FRAME_drain17 55 80 | #define FRAME_drain18 56 81 | #define FRAME_pain101 57 82 | #define FRAME_pain102 58 83 | #define FRAME_pain103 59 84 | #define FRAME_pain104 60 85 | #define FRAME_pain105 61 86 | #define FRAME_pain106 62 87 | #define FRAME_pain107 63 88 | #define FRAME_pain108 64 89 | #define FRAME_pain109 65 90 | #define FRAME_pain110 66 91 | #define FRAME_pain111 67 92 | #define FRAME_run01 68 93 | #define FRAME_run02 69 94 | #define FRAME_run03 70 95 | #define FRAME_run04 71 96 | #define FRAME_run05 72 97 | #define FRAME_run06 73 98 | #define FRAME_run07 74 99 | #define FRAME_run08 75 100 | #define FRAME_run09 76 101 | #define FRAME_run10 77 102 | #define FRAME_run11 78 103 | #define FRAME_run12 79 104 | #define FRAME_run13 80 105 | #define FRAME_run14 81 106 | #define FRAME_run15 82 107 | #define FRAME_stand01 83 108 | #define FRAME_stand02 84 109 | #define FRAME_stand03 85 110 | #define FRAME_stand04 86 111 | #define FRAME_stand05 87 112 | #define FRAME_stand06 88 113 | #define FRAME_stand07 89 114 | #define FRAME_stand08 90 115 | #define FRAME_stand09 91 116 | #define FRAME_stand10 92 117 | #define FRAME_stand11 93 118 | #define FRAME_stand12 94 119 | #define FRAME_stand13 95 120 | #define FRAME_stand14 96 121 | #define FRAME_stand15 97 122 | #define FRAME_stand16 98 123 | #define FRAME_stand17 99 124 | #define FRAME_stand18 100 125 | #define FRAME_stand19 101 126 | #define FRAME_stand20 102 127 | #define FRAME_stand21 103 128 | #define FRAME_stand22 104 129 | #define FRAME_stand23 105 130 | #define FRAME_stand24 106 131 | #define FRAME_stand25 107 132 | #define FRAME_stand26 108 133 | #define FRAME_stand27 109 134 | #define FRAME_stand28 110 135 | #define FRAME_stand29 111 136 | #define FRAME_stand30 112 137 | #define FRAME_stand31 113 138 | #define FRAME_stand32 114 139 | #define FRAME_stand33 115 140 | #define FRAME_stand34 116 141 | #define FRAME_stand35 117 142 | 143 | #define MODEL_SCALE 1.000000 144 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/game/m_rider.h: -------------------------------------------------------------------------------- 1 | // G:\quake2\baseq2\models/monsters/boss3/rider 2 | 3 | // This file generated by ModelGen - Do NOT Modify 4 | 5 | #define FRAME_stand201 0 6 | #define FRAME_stand202 1 7 | #define FRAME_stand203 2 8 | #define FRAME_stand204 3 9 | #define FRAME_stand205 4 10 | #define FRAME_stand206 5 11 | #define FRAME_stand207 6 12 | #define FRAME_stand208 7 13 | #define FRAME_stand209 8 14 | #define FRAME_stand210 9 15 | #define FRAME_stand211 10 16 | #define FRAME_stand212 11 17 | #define FRAME_stand213 12 18 | #define FRAME_stand214 13 19 | #define FRAME_stand215 14 20 | #define FRAME_stand216 15 21 | #define FRAME_stand217 16 22 | #define FRAME_stand218 17 23 | #define FRAME_stand219 18 24 | #define FRAME_stand220 19 25 | #define FRAME_stand221 20 26 | #define FRAME_stand222 21 27 | #define FRAME_stand223 22 28 | #define FRAME_stand224 23 29 | #define FRAME_stand225 24 30 | #define FRAME_stand226 25 31 | #define FRAME_stand227 26 32 | #define FRAME_stand228 27 33 | #define FRAME_stand229 28 34 | #define FRAME_stand230 29 35 | #define FRAME_stand231 30 36 | #define FRAME_stand232 31 37 | #define FRAME_stand233 32 38 | #define FRAME_stand234 33 39 | #define FRAME_stand235 34 40 | #define FRAME_stand236 35 41 | #define FRAME_stand237 36 42 | #define FRAME_stand238 37 43 | #define FRAME_stand239 38 44 | #define FRAME_stand240 39 45 | #define FRAME_stand241 40 46 | #define FRAME_stand242 41 47 | #define FRAME_stand243 42 48 | #define FRAME_stand244 43 49 | #define FRAME_stand245 44 50 | #define FRAME_stand246 45 51 | #define FRAME_stand247 46 52 | #define FRAME_stand248 47 53 | #define FRAME_stand249 48 54 | #define FRAME_stand250 49 55 | #define FRAME_stand251 50 56 | #define FRAME_stand252 51 57 | #define FRAME_stand253 52 58 | #define FRAME_stand254 53 59 | #define FRAME_stand255 54 60 | #define FRAME_stand256 55 61 | #define FRAME_stand257 56 62 | #define FRAME_stand258 57 63 | #define FRAME_stand259 58 64 | #define FRAME_stand260 59 65 | 66 | #define MODEL_SCALE 1.000000 67 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/game/p_trail.c: -------------------------------------------------------------------------------- 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 | #include "g_local.h" 21 | 22 | 23 | /* 24 | ============================================================================== 25 | 26 | PLAYER TRAIL 27 | 28 | ============================================================================== 29 | 30 | This is a circular list containing the a list of points of where 31 | the player has been recently. It is used by monsters for pursuit. 32 | 33 | .origin the spot 34 | .owner forward link 35 | .aiment backward link 36 | */ 37 | 38 | 39 | #define TRAIL_LENGTH 8 40 | 41 | edict_t *trail[TRAIL_LENGTH]; 42 | int trail_head; 43 | qboolean trail_active = qFalse; 44 | 45 | #define NEXT(n) (((n) + 1) & (TRAIL_LENGTH - 1)) 46 | #define PREV(n) (((n) - 1) & (TRAIL_LENGTH - 1)) 47 | 48 | 49 | void PlayerTrail_Init (void) 50 | { 51 | int n; 52 | 53 | if (deathmatch->value /* FIXME || coop */) 54 | return; 55 | 56 | for (n = 0; n < TRAIL_LENGTH; n++) 57 | { 58 | trail[n] = G_Spawn(); 59 | trail[n]->classname = "player_trail"; 60 | } 61 | 62 | trail_head = 0; 63 | trail_active = qTrue; 64 | } 65 | 66 | 67 | void PlayerTrail_Add (vec3_t spot) 68 | { 69 | vec3_t temp; 70 | 71 | if (!trail_active) 72 | return; 73 | 74 | VectorCopy (spot, trail[trail_head]->s.origin); 75 | 76 | trail[trail_head]->timestamp = level.time; 77 | 78 | VectorSubtract (spot, trail[PREV(trail_head)]->s.origin, temp); 79 | trail[trail_head]->s.angles[1] = vectoyaw (temp); 80 | 81 | trail_head = NEXT(trail_head); 82 | } 83 | 84 | 85 | void PlayerTrail_New (vec3_t spot) 86 | { 87 | if (!trail_active) 88 | return; 89 | 90 | PlayerTrail_Init (); 91 | PlayerTrail_Add (spot); 92 | } 93 | 94 | 95 | edict_t *PlayerTrail_PickFirst (edict_t *self) 96 | { 97 | int marker; 98 | int n; 99 | 100 | if (!trail_active) 101 | return NULL; 102 | 103 | for (marker = trail_head, n = TRAIL_LENGTH; n; n--) 104 | { 105 | if(trail[marker]->timestamp <= self->monsterinfo.trail_time) 106 | marker = NEXT(marker); 107 | else 108 | break; 109 | } 110 | 111 | if (visible(self, trail[marker])) 112 | { 113 | return trail[marker]; 114 | } 115 | 116 | if (visible(self, trail[PREV(marker)])) 117 | { 118 | return trail[PREV(marker)]; 119 | } 120 | 121 | return trail[marker]; 122 | } 123 | 124 | edict_t *PlayerTrail_PickNext (edict_t *self) 125 | { 126 | int marker; 127 | int n; 128 | 129 | if (!trail_active) 130 | return NULL; 131 | 132 | for (marker = trail_head, n = TRAIL_LENGTH; n; n--) 133 | { 134 | if(trail[marker]->timestamp <= self->monsterinfo.trail_time) 135 | marker = NEXT(marker); 136 | else 137 | break; 138 | } 139 | 140 | return trail[marker]; 141 | } 142 | 143 | edict_t *PlayerTrail_LastSpot (void) 144 | { 145 | return trail[PREV(trail_head)]; 146 | } 147 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/null/cd_null.c: -------------------------------------------------------------------------------- 1 | #include "../client/client.h" 2 | 3 | /*void CDAudio_Play(int track, qboolean looping) 4 | { 5 | } 6 | 7 | 8 | void CDAudio_Stop(void) 9 | { 10 | } 11 | 12 | 13 | void CDAudio_Resume(void) 14 | { 15 | } 16 | 17 | 18 | void CDAudio_Update(void) 19 | { 20 | } 21 | 22 | 23 | int CDAudio_Init(void) 24 | { 25 | return 0; 26 | } 27 | 28 | 29 | void CDAudio_Shutdown(void) 30 | { 31 | } 32 | */ 33 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/null/cl_null.c: -------------------------------------------------------------------------------- 1 | 2 | // cl_null.c -- this file can stub out the entire client system 3 | // for pure dedicated servers 4 | /* 5 | #include "../qcommon/qcommon.h" 6 | 7 | void Key_Bind_Null_f(void) 8 | { 9 | } 10 | 11 | void CL_Init (void) 12 | { 13 | } 14 | 15 | void CL_Drop (void) 16 | { 17 | } 18 | 19 | void CL_Shutdown (void) 20 | { 21 | } 22 | 23 | void CL_Frame (int msec) 24 | { 25 | } 26 | 27 | void Con_Print (char *text) 28 | { 29 | } 30 | 31 | void Cmd_ForwardToServer (void) 32 | { 33 | char *cmd; 34 | 35 | cmd = Cmd_Argv(0); 36 | Com_Printf ("Unknown command \"%s\"\n", cmd); 37 | } 38 | 39 | void SCR_DebugGraph (float value, int color) 40 | { 41 | } 42 | 43 | void SCR_BeginLoadingPlaque (void) 44 | { 45 | } 46 | 47 | void SCR_EndLoadingPlaque (void) 48 | { 49 | } 50 | 51 | void Key_Init (void) 52 | { 53 | Cmd_AddCommand ("bind", Key_Bind_Null_f); 54 | } 55 | 56 | */ 57 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/null/snddma_null.c: -------------------------------------------------------------------------------- 1 | 2 | // snddma_null.c 3 | // all other sound mixing is portable 4 | 5 | #include "../client/client.h" 6 | #include "../client/snd_loc.h" 7 | 8 | /*qboolean SNDDMA_Init(void) 9 | { 10 | return qFalse; 11 | } 12 | 13 | int SNDDMA_GetDMAPos(void) 14 | { 15 | return 0; 16 | } 17 | 18 | void SNDDMA_Shutdown(void) 19 | { 20 | } 21 | 22 | void SNDDMA_BeginPainting (void) 23 | { 24 | } 25 | 26 | void SNDDMA_Submit(void) 27 | { 28 | }*/ 29 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/null/swimp_null.c: -------------------------------------------------------------------------------- 1 | /*#include "../ref_soft/r_local.h" 2 | 3 | void SWimp_BeginFrame( float camera_separation ) 4 | { 5 | } 6 | 7 | void SWimp_EndFrame (void) 8 | { 9 | } 10 | 11 | int SWimp_Init( void *hInstance, void *wndProc ) 12 | { 13 | return 0; 14 | } 15 | 16 | void SWimp_SetPalette( const unsigned char *palette) 17 | { 18 | } 19 | 20 | void SWimp_Shutdown( void ) 21 | { 22 | } 23 | 24 | rserr_t SWimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen ) 25 | { 26 | *pwidth = 320; 27 | *pheight = 240; 28 | rserr_t r; 29 | memset(&r,0,sizeof(rserr_t)); 30 | return r; 31 | } 32 | 33 | void SWimp_AppActivate( qboolean active ) 34 | { 35 | } 36 | 37 | */ 38 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/null/vid_null.c: -------------------------------------------------------------------------------- 1 | // vid_null.c -- null video driver to aid porting efforts 2 | // this assumes that one of the refs is statically linked to the executable 3 | /* 4 | #include "../client/client.h" 5 | 6 | viddef_t viddef; // global video state 7 | 8 | refexport_t re; 9 | 10 | refexport_t GetRefAPI (refimport_t rimp);*/ 11 | 12 | /* 13 | ========================================================================== 14 | 15 | DIRECT LINK GLUE 16 | 17 | ========================================================================== 18 | */ 19 | /* 20 | #define MAXPRINTMSG 4096 21 | void VID_Printf (int print_level, char *fmt, ...) 22 | { 23 | va_list argptr; 24 | char msg[MAXPRINTMSG]; 25 | 26 | va_start (argptr,fmt); 27 | vsprintf (msg,fmt,argptr); 28 | va_end (argptr); 29 | 30 | if (print_level == PRINT_ALL) 31 | Com_Printf ("%s", msg); 32 | else 33 | Com_DPrintf ("%s", msg); 34 | } 35 | 36 | void VID_Error (int err_level, char *fmt, ...) 37 | { 38 | va_list argptr; 39 | char msg[MAXPRINTMSG]; 40 | 41 | va_start (argptr,fmt); 42 | vsprintf (msg,fmt,argptr); 43 | va_end (argptr); 44 | 45 | Com_Error (err_level, "%s", msg); 46 | } 47 | 48 | void VID_NewWindow (int width, int height) 49 | { 50 | viddef.width = width; 51 | viddef.height = height; 52 | }*/ 53 | 54 | /* 55 | ** VID_GetModeInfo 56 | */ 57 | /*typedef struct vidmode_s 58 | { 59 | const char *description; 60 | int width, height; 61 | int mode; 62 | } vidmode_t; 63 | 64 | vidmode_t vid_modes[] = 65 | { 66 | { "Mode 0: 320x240", 320, 240, 0 }, 67 | { "Mode 1: 400x300", 400, 300, 1 }, 68 | { "Mode 2: 512x384", 512, 384, 2 }, 69 | { "Mode 3: 640x480", 640, 480, 3 }, 70 | { "Mode 4: 800x600", 800, 600, 4 }, 71 | { "Mode 5: 960x720", 960, 720, 5 }, 72 | { "Mode 6: 1024x768", 1024, 768, 6 }, 73 | { "Mode 7: 1152x864", 1152, 864, 7 }, 74 | { "Mode 8: 1280x960", 1280, 960, 8 }, 75 | { "Mode 9: 1600x1200", 1600, 1200, 9 } 76 | }; 77 | #define VID_NUM_MODES ( sizeof( vid_modes ) / sizeof( vid_modes[0] ) ) 78 | 79 | qboolean VID_GetModeInfo( int *width, int *height, int mode ) 80 | { 81 | if ( mode < 0 || mode >= VID_NUM_MODES ) 82 | return qFalse; 83 | 84 | *width = vid_modes[mode].width; 85 | *height = vid_modes[mode].height; 86 | 87 | return qTrue; 88 | } 89 | 90 | 91 | void VID_Init (void) 92 | { 93 | refimport_t ri; 94 | 95 | viddef.width = 320; 96 | viddef.height = 240; 97 | 98 | ri.Cmd_AddCommand = Cmd_AddCommand; 99 | ri.Cmd_RemoveCommand = Cmd_RemoveCommand; 100 | ri.Cmd_Argc = Cmd_Argc; 101 | ri.Cmd_Argv = Cmd_Argv; 102 | ri.Cmd_ExecuteText = Cbuf_ExecuteText; 103 | ri.Con_Printf = VID_Printf; 104 | ri.Sys_Error = VID_Error; 105 | ri.FS_LoadFile = FS_LoadFile; 106 | ri.FS_FreeFile = FS_FreeFile; 107 | ri.FS_Gamedir = FS_Gamedir; 108 | ri.Vid_NewWindow = VID_NewWindow; 109 | ri.Cvar_Get = Cvar_Get; 110 | ri.Cvar_Set = Cvar_Set; 111 | ri.Cvar_SetValue = Cvar_SetValue; 112 | ri.Vid_GetModeInfo = VID_GetModeInfo; 113 | 114 | re = GetRefAPI(ri); 115 | 116 | if (re.api_version != API_VERSION) 117 | Com_Error (ERR_FATAL, "Re has incompatible api_version"); 118 | 119 | // call the init function 120 | if (re.Init (NULL, NULL) == -1) 121 | Com_Error (ERR_FATAL, "Couldn't start refresh"); 122 | } 123 | 124 | void VID_Shutdown (void) 125 | { 126 | if (re.Shutdown) 127 | re.Shutdown (); 128 | } 129 | 130 | void VID_CheckChanges (void) 131 | { 132 | } 133 | 134 | void VID_MenuInit (void) 135 | { 136 | } 137 | 138 | void VID_MenuDraw (void) 139 | { 140 | } 141 | 142 | const char *VID_MenuKey( int k) 143 | { 144 | return NULL; 145 | } 146 | */ 147 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/qcommon/crc.c: -------------------------------------------------------------------------------- 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 | /* crc.c */ 21 | 22 | #include "qcommon.h" 23 | 24 | // this is a 16 bit, non-reflected CRC using the polynomial 0x1021 25 | // and the initial and final xor values shown below... in other words, the 26 | // CCITT standard CRC used by XMODEM 27 | 28 | #define CRC_INIT_VALUE 0xffff 29 | #define CRC_XOR_VALUE 0x0000 30 | 31 | static unsigned short crctable[256] = 32 | { 33 | 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 34 | 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 35 | 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, 36 | 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, 37 | 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, 38 | 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, 39 | 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, 40 | 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 41 | 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, 42 | 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, 43 | 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, 44 | 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, 45 | 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, 46 | 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, 47 | 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, 48 | 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, 49 | 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, 50 | 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, 51 | 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, 52 | 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, 53 | 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, 54 | 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 55 | 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, 56 | 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, 57 | 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 58 | 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, 59 | 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 60 | 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, 61 | 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 62 | 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, 63 | 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, 64 | 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 65 | }; 66 | 67 | void CRC_Init(unsigned short *crcvalue) 68 | { 69 | *crcvalue = CRC_INIT_VALUE; 70 | } 71 | 72 | void CRC_ProcessByte(unsigned short *crcvalue, byte data) 73 | { 74 | *crcvalue = (*crcvalue << 8) ^ crctable[(*crcvalue >> 8) ^ data]; 75 | } 76 | 77 | unsigned short CRC_Value(unsigned short crcvalue) 78 | { 79 | return crcvalue ^ CRC_XOR_VALUE; 80 | } 81 | 82 | unsigned short CRC_Block (byte *start, int count) 83 | { 84 | unsigned short crc; 85 | 86 | CRC_Init (&crc); 87 | while (count--) 88 | crc = (crc << 8) ^ crctable[(crc >> 8) ^ *start++]; 89 | 90 | return crc; 91 | } 92 | 93 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/qcommon/crc.h: -------------------------------------------------------------------------------- 1 | /* crc.h */ 2 | 3 | void CRC_Init(unsigned short *crcvalue); 4 | void CRC_ProcessByte(unsigned short *crcvalue, byte data); 5 | unsigned short CRC_Value(unsigned short crcvalue); 6 | unsigned short CRC_Block (byte *start, int count); 7 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/qcommon/md4.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ByteOverlord/Watch_Quake2/65d3472efe597d210b63df59bdff28698c8f7209/WatchQuake2 Watch App/id2/qcommon/md4.c -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/ref_soft/anorms.h: -------------------------------------------------------------------------------- 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 | {-0.525731, 0.000000, 0.850651}, 21 | {-0.442863, 0.238856, 0.864188}, 22 | {-0.295242, 0.000000, 0.955423}, 23 | {-0.309017, 0.500000, 0.809017}, 24 | {-0.162460, 0.262866, 0.951056}, 25 | {0.000000, 0.000000, 1.000000}, 26 | {0.000000, 0.850651, 0.525731}, 27 | {-0.147621, 0.716567, 0.681718}, 28 | {0.147621, 0.716567, 0.681718}, 29 | {0.000000, 0.525731, 0.850651}, 30 | {0.309017, 0.500000, 0.809017}, 31 | {0.525731, 0.000000, 0.850651}, 32 | {0.295242, 0.000000, 0.955423}, 33 | {0.442863, 0.238856, 0.864188}, 34 | {0.162460, 0.262866, 0.951056}, 35 | {-0.681718, 0.147621, 0.716567}, 36 | {-0.809017, 0.309017, 0.500000}, 37 | {-0.587785, 0.425325, 0.688191}, 38 | {-0.850651, 0.525731, 0.000000}, 39 | {-0.864188, 0.442863, 0.238856}, 40 | {-0.716567, 0.681718, 0.147621}, 41 | {-0.688191, 0.587785, 0.425325}, 42 | {-0.500000, 0.809017, 0.309017}, 43 | {-0.238856, 0.864188, 0.442863}, 44 | {-0.425325, 0.688191, 0.587785}, 45 | {-0.716567, 0.681718, -0.147621}, 46 | {-0.500000, 0.809017, -0.309017}, 47 | {-0.525731, 0.850651, 0.000000}, 48 | {0.000000, 0.850651, -0.525731}, 49 | {-0.238856, 0.864188, -0.442863}, 50 | {0.000000, 0.955423, -0.295242}, 51 | {-0.262866, 0.951056, -0.162460}, 52 | {0.000000, 1.000000, 0.000000}, 53 | {0.000000, 0.955423, 0.295242}, 54 | {-0.262866, 0.951056, 0.162460}, 55 | {0.238856, 0.864188, 0.442863}, 56 | {0.262866, 0.951056, 0.162460}, 57 | {0.500000, 0.809017, 0.309017}, 58 | {0.238856, 0.864188, -0.442863}, 59 | {0.262866, 0.951056, -0.162460}, 60 | {0.500000, 0.809017, -0.309017}, 61 | {0.850651, 0.525731, 0.000000}, 62 | {0.716567, 0.681718, 0.147621}, 63 | {0.716567, 0.681718, -0.147621}, 64 | {0.525731, 0.850651, 0.000000}, 65 | {0.425325, 0.688191, 0.587785}, 66 | {0.864188, 0.442863, 0.238856}, 67 | {0.688191, 0.587785, 0.425325}, 68 | {0.809017, 0.309017, 0.500000}, 69 | {0.681718, 0.147621, 0.716567}, 70 | {0.587785, 0.425325, 0.688191}, 71 | {0.955423, 0.295242, 0.000000}, 72 | {1.000000, 0.000000, 0.000000}, 73 | {0.951056, 0.162460, 0.262866}, 74 | {0.850651, -0.525731, 0.000000}, 75 | {0.955423, -0.295242, 0.000000}, 76 | {0.864188, -0.442863, 0.238856}, 77 | {0.951056, -0.162460, 0.262866}, 78 | {0.809017, -0.309017, 0.500000}, 79 | {0.681718, -0.147621, 0.716567}, 80 | {0.850651, 0.000000, 0.525731}, 81 | {0.864188, 0.442863, -0.238856}, 82 | {0.809017, 0.309017, -0.500000}, 83 | {0.951056, 0.162460, -0.262866}, 84 | {0.525731, 0.000000, -0.850651}, 85 | {0.681718, 0.147621, -0.716567}, 86 | {0.681718, -0.147621, -0.716567}, 87 | {0.850651, 0.000000, -0.525731}, 88 | {0.809017, -0.309017, -0.500000}, 89 | {0.864188, -0.442863, -0.238856}, 90 | {0.951056, -0.162460, -0.262866}, 91 | {0.147621, 0.716567, -0.681718}, 92 | {0.309017, 0.500000, -0.809017}, 93 | {0.425325, 0.688191, -0.587785}, 94 | {0.442863, 0.238856, -0.864188}, 95 | {0.587785, 0.425325, -0.688191}, 96 | {0.688191, 0.587785, -0.425325}, 97 | {-0.147621, 0.716567, -0.681718}, 98 | {-0.309017, 0.500000, -0.809017}, 99 | {0.000000, 0.525731, -0.850651}, 100 | {-0.525731, 0.000000, -0.850651}, 101 | {-0.442863, 0.238856, -0.864188}, 102 | {-0.295242, 0.000000, -0.955423}, 103 | {-0.162460, 0.262866, -0.951056}, 104 | {0.000000, 0.000000, -1.000000}, 105 | {0.295242, 0.000000, -0.955423}, 106 | {0.162460, 0.262866, -0.951056}, 107 | {-0.442863, -0.238856, -0.864188}, 108 | {-0.309017, -0.500000, -0.809017}, 109 | {-0.162460, -0.262866, -0.951056}, 110 | {0.000000, -0.850651, -0.525731}, 111 | {-0.147621, -0.716567, -0.681718}, 112 | {0.147621, -0.716567, -0.681718}, 113 | {0.000000, -0.525731, -0.850651}, 114 | {0.309017, -0.500000, -0.809017}, 115 | {0.442863, -0.238856, -0.864188}, 116 | {0.162460, -0.262866, -0.951056}, 117 | {0.238856, -0.864188, -0.442863}, 118 | {0.500000, -0.809017, -0.309017}, 119 | {0.425325, -0.688191, -0.587785}, 120 | {0.716567, -0.681718, -0.147621}, 121 | {0.688191, -0.587785, -0.425325}, 122 | {0.587785, -0.425325, -0.688191}, 123 | {0.000000, -0.955423, -0.295242}, 124 | {0.000000, -1.000000, 0.000000}, 125 | {0.262866, -0.951056, -0.162460}, 126 | {0.000000, -0.850651, 0.525731}, 127 | {0.000000, -0.955423, 0.295242}, 128 | {0.238856, -0.864188, 0.442863}, 129 | {0.262866, -0.951056, 0.162460}, 130 | {0.500000, -0.809017, 0.309017}, 131 | {0.716567, -0.681718, 0.147621}, 132 | {0.525731, -0.850651, 0.000000}, 133 | {-0.238856, -0.864188, -0.442863}, 134 | {-0.500000, -0.809017, -0.309017}, 135 | {-0.262866, -0.951056, -0.162460}, 136 | {-0.850651, -0.525731, 0.000000}, 137 | {-0.716567, -0.681718, -0.147621}, 138 | {-0.716567, -0.681718, 0.147621}, 139 | {-0.525731, -0.850651, 0.000000}, 140 | {-0.500000, -0.809017, 0.309017}, 141 | {-0.238856, -0.864188, 0.442863}, 142 | {-0.262866, -0.951056, 0.162460}, 143 | {-0.864188, -0.442863, 0.238856}, 144 | {-0.809017, -0.309017, 0.500000}, 145 | {-0.688191, -0.587785, 0.425325}, 146 | {-0.681718, -0.147621, 0.716567}, 147 | {-0.442863, -0.238856, 0.864188}, 148 | {-0.587785, -0.425325, 0.688191}, 149 | {-0.309017, -0.500000, 0.809017}, 150 | {-0.147621, -0.716567, 0.681718}, 151 | {-0.425325, -0.688191, 0.587785}, 152 | {-0.162460, -0.262866, 0.951056}, 153 | {0.442863, -0.238856, 0.864188}, 154 | {0.162460, -0.262866, 0.951056}, 155 | {0.309017, -0.500000, 0.809017}, 156 | {0.147621, -0.716567, 0.681718}, 157 | {0.000000, -0.525731, 0.850651}, 158 | {0.425325, -0.688191, 0.587785}, 159 | {0.587785, -0.425325, 0.688191}, 160 | {0.688191, -0.587785, 0.425325}, 161 | {-0.955423, 0.295242, 0.000000}, 162 | {-0.951056, 0.162460, 0.262866}, 163 | {-1.000000, 0.000000, 0.000000}, 164 | {-0.850651, 0.000000, 0.525731}, 165 | {-0.955423, -0.295242, 0.000000}, 166 | {-0.951056, -0.162460, 0.262866}, 167 | {-0.864188, 0.442863, -0.238856}, 168 | {-0.951056, 0.162460, -0.262866}, 169 | {-0.809017, 0.309017, -0.500000}, 170 | {-0.864188, -0.442863, -0.238856}, 171 | {-0.951056, -0.162460, -0.262866}, 172 | {-0.809017, -0.309017, -0.500000}, 173 | {-0.681718, 0.147621, -0.716567}, 174 | {-0.681718, -0.147621, -0.716567}, 175 | {-0.850651, 0.000000, -0.525731}, 176 | {-0.688191, 0.587785, -0.425325}, 177 | {-0.587785, 0.425325, -0.688191}, 178 | {-0.425325, 0.688191, -0.587785}, 179 | {-0.425325, -0.688191, -0.587785}, 180 | {-0.587785, -0.425325, -0.688191}, 181 | {-0.688191, -0.587785, -0.425325}, 182 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/ref_soft/r_model.h: -------------------------------------------------------------------------------- 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 | #ifndef __MODEL__ 22 | #define __MODEL__ 23 | 24 | /* 25 | 26 | d*_t structures are on-disk representations 27 | m*_t structures are in-memory 28 | 29 | */ 30 | 31 | 32 | /* 33 | ============================================================================== 34 | 35 | BRUSH MODELS 36 | 37 | ============================================================================== 38 | */ 39 | 40 | 41 | // 42 | // in memory representation 43 | // 44 | // !!! if this is changed, it must be changed in asm_draw.h too !!! 45 | typedef struct 46 | { 47 | vec3_t position; 48 | } mvertex_t; 49 | 50 | #define SIDE_FRONT 0 51 | #define SIDE_BACK 1 52 | #define SIDE_ON 2 53 | 54 | 55 | // plane_t structure 56 | // !!! if this is changed, it must be changed in asm_i386.h too !!! 57 | typedef struct mplane_s 58 | { 59 | vec3_t normal; 60 | float dist; 61 | byte type; // for texture axis selection and fast side tests 62 | byte signbits; // signx + signy<<1 + signz<<1 63 | byte pad[2]; 64 | } mplane_t; 65 | 66 | 67 | // FIXME: differentiate from texinfo SURF_ flags 68 | #define SURF_PLANEBACK 2 69 | #define SURF_DRAWSKY 4 // sky brush face 70 | #define SURF_DRAWTURB 0x10 71 | #define SURF_DRAWBACKGROUND 0x40 72 | #define SURF_DRAWSKYBOX 0x80 // sky box 73 | 74 | #define SURF_FLOW 0x100 //PGM 75 | 76 | // !!! if this is changed, it must be changed in asm_draw.h too !!! 77 | typedef struct 78 | { 79 | unsigned short v[2]; 80 | unsigned int cachededgeoffset; 81 | } medge_t; 82 | 83 | typedef struct mtexinfo_s 84 | { 85 | float vecs[2][4]; 86 | float mipadjust; 87 | image_t *image; 88 | int flags; 89 | int numframes; 90 | struct mtexinfo_s *next; // animation chain 91 | } mtexinfo_t; 92 | 93 | typedef struct msurface_s 94 | { 95 | int visframe; // should be drawn when node is crossed 96 | 97 | int dlightframe; 98 | int dlightbits; 99 | 100 | mplane_t *plane; 101 | int flags; 102 | 103 | int firstedge; // look up in model->surfedges[], negative numbers 104 | int numedges; // are backwards edges 105 | 106 | // surface generation data 107 | struct surfcache_s *cachespots[MIPLEVELS]; 108 | 109 | short texturemins[2]; 110 | short extents[2]; 111 | 112 | mtexinfo_t *texinfo; 113 | 114 | // lighting info 115 | byte styles[MAXLIGHTMAPS]; 116 | byte *samples; // [numstyles*surfsize] 117 | 118 | struct msurface_s *nextalphasurface; 119 | } msurface_t; 120 | 121 | 122 | #define CONTENTS_NODE -1 123 | typedef struct mnode_s 124 | { 125 | // common with leaf 126 | int contents; // CONTENTS_NODE, to differentiate from leafs 127 | int visframe; // node needs to be traversed if current 128 | 129 | short minmaxs[6]; // for bounding box culling 130 | 131 | struct mnode_s *parent; 132 | 133 | // node specific 134 | mplane_t *plane; 135 | struct mnode_s *children[2]; 136 | 137 | unsigned short firstsurface; 138 | unsigned short numsurfaces; 139 | } mnode_t; 140 | 141 | 142 | 143 | typedef struct mleaf_s 144 | { 145 | // common with node 146 | int contents; // wil be something other than CONTENTS_NODE 147 | int visframe; // node needs to be traversed if current 148 | 149 | short minmaxs[6]; // for bounding box culling 150 | 151 | struct mnode_s *parent; 152 | 153 | // leaf specific 154 | int cluster; 155 | int area; 156 | 157 | msurface_t **firstmarksurface; 158 | int nummarksurfaces; 159 | int key; // BSP sequence number for leaf's contents 160 | } mleaf_t; 161 | 162 | 163 | //=================================================================== 164 | 165 | // 166 | // Whole model 167 | // 168 | 169 | typedef enum {mod_bad, mod_brush, mod_sprite, mod_alias } modtype_t; 170 | 171 | typedef struct model_s 172 | { 173 | char name[MAX_QPATH]; 174 | 175 | int registration_sequence; 176 | 177 | modtype_t type; 178 | int numframes; 179 | 180 | int flags; 181 | 182 | // 183 | // volume occupied by the model graphics 184 | // 185 | vec3_t mins, maxs; 186 | 187 | // 188 | // solid volume for clipping (sent from server) 189 | // 190 | qboolean clipbox; 191 | vec3_t clipmins, clipmaxs; 192 | 193 | // 194 | // brush model 195 | // 196 | int firstmodelsurface, nummodelsurfaces; 197 | 198 | int numsubmodels; 199 | dmodel_t *submodels; 200 | 201 | int numplanes; 202 | mplane_t *planes; 203 | 204 | int numleafs; // number of visible leafs, not counting 0 205 | mleaf_t *leafs; 206 | 207 | int numvertexes; 208 | mvertex_t *vertexes; 209 | 210 | int numedges; 211 | medge_t *edges; 212 | 213 | int numnodes; 214 | int firstnode; 215 | mnode_t *nodes; 216 | 217 | int numtexinfo; 218 | mtexinfo_t *texinfo; 219 | 220 | int numsurfaces; 221 | msurface_t *surfaces; 222 | 223 | int numsurfedges; 224 | int *surfedges; 225 | 226 | int nummarksurfaces; 227 | msurface_t **marksurfaces; 228 | 229 | dvis_t *vis; 230 | 231 | byte *lightdata; 232 | 233 | // for alias models and sprites 234 | image_t *skins[MAX_MD2SKINS]; 235 | void *extradata; 236 | int extradatasize; 237 | } model_t; 238 | 239 | //============================================================================ 240 | 241 | void Mod_Init (void); 242 | void Mod_ClearAll (void); 243 | model_t *Mod_ForName (char *name, qboolean crash); 244 | void *Mod_Extradata (model_t *mod); // handles caching 245 | void Mod_TouchModel (char *name); 246 | 247 | mleaf_t *Mod_PointInLeaf (float *p, model_t *model); 248 | byte *Mod_ClusterPVS (int cluster, model_t *model); 249 | 250 | void Mod_Modellist_f (void); 251 | void Mod_FreeAll (void); 252 | void Mod_Free (model_t *mod); 253 | 254 | extern int registration_sequence; 255 | 256 | #endif // __MODEL__ 257 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/ref_soft/r_sprite.c: -------------------------------------------------------------------------------- 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 | // r_sprite.c 21 | #include "r_local.h" 22 | 23 | extern polydesc_t r_polydesc; 24 | 25 | void R_BuildPolygonFromSurface(msurface_t *fa); 26 | void R_PolygonCalculateGradients (void); 27 | 28 | extern void R_PolyChooseSpanletRoutine( float alpha, qboolean isturbulent ); 29 | 30 | extern vec5_t r_clip_verts[2][MAXWORKINGVERTS+2]; 31 | 32 | extern void R_ClipAndDrawPoly( float alpha, qboolean isturbulent, qboolean textured ); 33 | 34 | /* 35 | ** R_DrawSprite 36 | ** 37 | ** Draw currententity / currentmodel as a single texture 38 | ** mapped polygon 39 | */ 40 | void R_DrawSprite (void) 41 | { 42 | vec5_t *pverts; 43 | vec3_t left, up, right, down; 44 | dsprite_t *s_psprite; 45 | dsprframe_t *s_psprframe; 46 | 47 | 48 | s_psprite = (dsprite_t *)currentmodel->extradata; 49 | #if 0 50 | if (currententity->frame >= s_psprite->numframes 51 | || currententity->frame < 0) 52 | { 53 | ri.Con_Printf (PRINT_ALL, "No such sprite frame %i\n", 54 | currententity->frame); 55 | currententity->frame = 0; 56 | } 57 | #endif 58 | currententity->frame %= s_psprite->numframes; 59 | 60 | s_psprframe = &s_psprite->frames[currententity->frame]; 61 | 62 | r_polydesc.pixels = currentmodel->skins[currententity->frame]->pixels[0]; 63 | r_polydesc.pixel_width = s_psprframe->width; 64 | r_polydesc.pixel_height = s_psprframe->height; 65 | r_polydesc.dist = 0; 66 | 67 | // generate the sprite's axes, completely parallel to the viewplane. 68 | VectorCopy (vup, r_polydesc.vup); 69 | VectorCopy (vright, r_polydesc.vright); 70 | VectorCopy (vpn, r_polydesc.vpn); 71 | 72 | // build the sprite poster in worldspace 73 | VectorScale (r_polydesc.vright, 74 | s_psprframe->width - s_psprframe->origin_x, right); 75 | VectorScale (r_polydesc.vup, 76 | s_psprframe->height - s_psprframe->origin_y, up); 77 | VectorScale (r_polydesc.vright, 78 | -s_psprframe->origin_x, left); 79 | VectorScale (r_polydesc.vup, 80 | -s_psprframe->origin_y, down); 81 | 82 | // invert UP vector for sprites 83 | VectorInverse( r_polydesc.vup ); 84 | 85 | pverts = r_clip_verts[0]; 86 | 87 | pverts[0][0] = r_entorigin[0] + up[0] + left[0]; 88 | pverts[0][1] = r_entorigin[1] + up[1] + left[1]; 89 | pverts[0][2] = r_entorigin[2] + up[2] + left[2]; 90 | pverts[0][3] = 0; 91 | pverts[0][4] = 0; 92 | 93 | pverts[1][0] = r_entorigin[0] + up[0] + right[0]; 94 | pverts[1][1] = r_entorigin[1] + up[1] + right[1]; 95 | pverts[1][2] = r_entorigin[2] + up[2] + right[2]; 96 | pverts[1][3] = s_psprframe->width; 97 | pverts[1][4] = 0; 98 | 99 | pverts[2][0] = r_entorigin[0] + down[0] + right[0]; 100 | pverts[2][1] = r_entorigin[1] + down[1] + right[1]; 101 | pverts[2][2] = r_entorigin[2] + down[2] + right[2]; 102 | pverts[2][3] = s_psprframe->width; 103 | pverts[2][4] = s_psprframe->height; 104 | 105 | pverts[3][0] = r_entorigin[0] + down[0] + left[0]; 106 | pverts[3][1] = r_entorigin[1] + down[1] + left[1]; 107 | pverts[3][2] = r_entorigin[2] + down[2] + left[2]; 108 | pverts[3][3] = 0; 109 | pverts[3][4] = s_psprframe->height; 110 | 111 | r_polydesc.nump = 4; 112 | r_polydesc.s_offset = ( r_polydesc.pixel_width >> 1); 113 | r_polydesc.t_offset = ( r_polydesc.pixel_height >> 1); 114 | VectorCopy( modelorg, r_polydesc.viewer_position ); 115 | 116 | r_polydesc.stipple_parity = 1; 117 | if ( currententity->flags & RF_TRANSLUCENT ) 118 | R_ClipAndDrawPoly ( currententity->alpha, qFalse, qTrue ); 119 | else 120 | R_ClipAndDrawPoly ( 1.0F, qFalse, qTrue ); 121 | r_polydesc.stipple_parity = 0; 122 | } 123 | 124 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/ref_soft/rand1k.h: -------------------------------------------------------------------------------- 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 | // 1K random numbers in the range 0-255 21 | 0, 144, 49, 207, 149, 122, 89, 229, 210, 191, 22 | 44, 219, 181, 131, 77, 3, 23, 93, 37, 42, 23 | 253, 114, 30, 1, 2, 96, 136, 146, 154, 155, 24 | 42, 169, 115, 90, 14, 155, 200, 205, 133, 77, 25 | 224, 186, 244, 236, 138, 36, 118, 60, 220, 53, 26 | 199, 215, 255, 255, 156, 100, 68, 76, 215, 6, 27 | 96, 23, 173, 14, 2, 235, 70, 69, 150, 176, 28 | 214, 185, 124, 52, 190, 119, 117, 242, 190, 27, 29 | 153, 98, 188, 155, 146, 92, 38, 57, 108, 205, 30 | 132, 253, 192, 88, 43, 168, 125, 16, 179, 129, 31 | 37, 243, 36, 231, 177, 77, 109, 18, 247, 174, 32 | 39, 224, 210, 149, 48, 45, 209, 121, 39, 129, 33 | 187, 103, 71, 145, 174, 193, 184, 121, 31, 94, 34 | 213, 8, 132, 169, 109, 26, 243, 235, 140, 88, 35 | 120, 95, 216, 81, 116, 69, 251, 76, 189, 145, 36 | 50, 194, 214, 101, 128, 227, 7, 254, 146, 12, 37 | 136, 49, 215, 160, 168, 50, 215, 31, 28, 190, 38 | 80, 240, 73, 86, 35, 187, 213, 181, 153, 191, 39 | 64, 36, 0, 15, 206, 218, 53, 29, 141, 3, 40 | 29, 116, 192, 175, 139, 18, 111, 51, 178, 74, 41 | 111, 59, 147, 136, 160, 41, 129, 246, 178, 236, 42 | 48, 86, 45, 254, 117, 255, 24, 160, 24, 112, 43 | 238, 12, 229, 74, 58, 196, 105, 51, 160, 154, 44 | 115, 119, 153, 162, 218, 212, 159, 184, 144, 96, 45 | 47, 188, 142, 231, 62, 48, 154, 178, 149, 89, 46 | 126, 20, 189, 156, 158, 176, 205, 38, 147, 222, 47 | 233, 157, 186, 11, 170, 249, 80, 145, 78, 44, 48 | 27, 222, 217, 190, 39, 83, 20, 19, 164, 209, 49 | 139, 114, 104, 76, 119, 128, 39, 82, 188, 80, 50 | 211, 245, 223, 185, 76, 241, 32, 16, 200, 134, 51 | 156, 244, 18, 224, 167, 82, 26, 129, 58, 74, 52 | 235, 141, 169, 29, 126, 97, 127, 203, 130, 97, 53 | 176, 136, 155, 101, 1, 181, 25, 159, 220, 125, 54 | 191, 127, 97, 201, 141, 91, 244, 161, 45, 95, 55 | 33, 190, 243, 156, 7, 84, 14, 163, 33, 216, 56 | 221, 152, 184, 218, 3, 32, 181, 157, 55, 16, 57 | 43, 159, 87, 81, 94, 169, 205, 206, 134, 156, 58 | 204, 230, 37, 161, 103, 64, 34, 218, 16, 109, 59 | 146, 77, 140, 57, 79, 28, 206, 34, 72, 201, 60 | 229, 202, 190, 157, 92, 219, 58, 221, 58, 63, 61 | 138, 252, 13, 20, 134, 109, 24, 66, 228, 59, 62 | 37, 32, 238, 20, 12, 15, 86, 234, 102, 110, 63 | 242, 214, 136, 215, 177, 101, 66, 1, 134, 244, 64 | 102, 61, 149, 65, 175, 241, 111, 227, 1, 240, 65 | 153, 201, 147, 36, 56, 98, 1, 106, 21, 168, 66 | 218, 16, 207, 169, 177, 205, 135, 175, 36, 176, 67 | 186, 199, 7, 222, 164, 180, 21, 141, 242, 15, 68 | 70, 37, 251, 158, 74, 236, 94, 177, 55, 39, 69 | 61, 133, 230, 27, 231, 113, 20, 200, 43, 249, 70 | 198, 222, 53, 116, 0, 192, 29, 103, 79, 254, 71 | 9, 64, 48, 63, 39, 158, 226, 240, 50, 199, 72 | 165, 168, 232, 116, 235, 170, 38, 162, 145, 108, 73 | 241, 138, 148, 137, 65, 101, 89, 9, 203, 50, 74 | 17, 99, 151, 18, 50, 39, 164, 116, 154, 178, 75 | 112, 175, 101, 213, 151, 51, 243, 224, 100, 252, 76 | 47, 229, 147, 113, 160, 181, 12, 73, 66, 104, 77 | 229, 181, 186, 229, 100, 101, 231, 79, 99, 146, 78 | 90, 187, 190, 188, 189, 35, 51, 69, 174, 233, 79 | 94, 132, 28, 232, 51, 132, 167, 112, 176, 23, 80 | 20, 19, 7, 90, 78, 178, 36, 101, 17, 172, 81 | 185, 50, 177, 157, 167, 139, 25, 139, 12, 249, 82 | 118, 248, 186, 135, 174, 177, 95, 99, 12, 207, 83 | 43, 15, 79, 200, 54, 82, 124, 2, 112, 130, 84 | 155, 194, 102, 89, 215, 241, 159, 255, 13, 144, 85 | 221, 99, 78, 72, 6, 156, 100, 4, 7, 116, 86 | 219, 239, 102, 186, 156, 206, 224, 149, 152, 20, 87 | 203, 118, 151, 150, 145, 208, 172, 87, 2, 68, 88 | 87, 59, 197, 95, 222, 29, 185, 161, 228, 46, 89 | 137, 230, 199, 247, 50, 230, 204, 244, 217, 227, 90 | 160, 47, 157, 67, 64, 187, 201, 43, 182, 123, 91 | 20, 206, 218, 31, 78, 146, 121, 195, 49, 186, 92 | 254, 3, 165, 177, 44, 18, 70, 173, 214, 142, 93 | 95, 199, 59, 163, 59, 52, 248, 72, 5, 196, 94 | 38, 12, 2, 89, 164, 87, 106, 106, 23, 139, 95 | 179, 86, 168, 224, 137, 145, 13, 119, 66, 109, 96 | 221, 124, 22, 144, 181, 199, 221, 217, 75, 221, 97 | 165, 191, 212, 195, 223, 232, 233, 133, 112, 27, 98 | 90, 210, 109, 43, 0, 168, 198, 16, 22, 98, 99 | 175, 206, 39, 36, 12, 88, 4, 250, 165, 13, 100 | 234, 163, 110, 5, 62, 100, 167, 200, 5, 211, 101 | 35, 162, 140, 251, 118, 54, 76, 200, 87, 123, 102 | 155, 26, 252, 193, 38, 116, 182, 255, 198, 164, 103 | 159, 242, 176, 74, 145, 74, 140, 182, 63, 139, 104 | 126, 243, 171, 195, 159, 114, 204, 190, 253, 52, 105 | 161, 232, 151, 235, 129, 125, 115, 227, 240, 46, 106 | 64, 51, 187, 240, 160, 10, 164, 8, 142, 139, 107 | 114, 15, 254, 32, 153, 12, 44, 169, 85, 80, 108 | 167, 105, 109, 56, 173, 42, 127, 129, 205, 111, 109 | 1, 86, 96, 32, 211, 187, 228, 164, 166, 131, 110 | 187, 188, 245, 119, 92, 28, 231, 210, 116, 27, 111 | 222, 194, 10, 106, 239, 17, 42, 54, 29, 151, 112 | 30, 158, 148, 176, 187, 234, 171, 76, 207, 96, 113 | 255, 197, 52, 43, 99, 46, 148, 50, 245, 48, 114 | 97, 77, 30, 50, 11, 197, 194, 225, 0, 114, 115 | 109, 205, 118, 126, 191, 61, 143, 23, 236, 228, 116 | 219, 15, 125, 161, 191, 193, 65, 232, 202, 51, 117 | 141, 13, 133, 202, 180, 6, 187, 141, 234, 224, 118 | 204, 78, 101, 123, 13, 166, 0, 196, 193, 56, 119 | 39, 14, 171, 8, 88, 178, 204, 111, 251, 162, 120 | 75, 122, 223, 20, 25, 36, 36, 235, 79, 95, 121 | 208, 11, 208, 61, 229, 65, 68, 53, 58, 216, 122 | 223, 227, 216, 155, 10, 44, 47, 91, 115, 47, 123 | 228, 159, 139, 233 124 | -------------------------------------------------------------------------------- /WatchQuake2 Watch App/id2/server/sv_null.c: -------------------------------------------------------------------------------- 1 | // sv_null.c -- this file can stub out the entire server system 2 | // for pure net-only clients 3 | /* 4 | #include "q_shared.h" 5 | 6 | void SV_Init (void) 7 | { 8 | } 9 | 10 | void SV_Shutdown (char *finalmsg, qboolean reconnect) 11 | { 12 | } 13 | 14 | void SV_Frame (float time) 15 | { 16 | } 17 | 18 | */ 19 | -------------------------------------------------------------------------------- /WatchQuake2.xcodeproj/xcshareddata/xcschemes/WatchQuake2 Debug.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 46 | 47 | 57 | 59 | 65 | 66 | 67 | 68 | 74 | 76 | 82 | 83 | 84 | 85 | 87 | 88 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /WatchQuake2.xcodeproj/xcshareddata/xcschemes/WatchQuake2 Release.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 46 | 47 | 59 | 61 | 67 | 68 | 69 | 70 | 76 | 78 | 84 | 85 | 86 | 87 | 89 | 90 | 93 | 94 | 95 | --------------------------------------------------------------------------------