Comment: | Move classes into separate files |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
14861826d4c1f561aca909afe773366a |
User & Date: | js on 2025-03-05 23:18:28 |
Other Links: | manifest | tags |
2025-03-06
| ||
00:34 | Clean up menus and text drawing check-in: f17992369e user: js tags: trunk | |
2025-03-05
| ||
23:18 | Move classes into separate files check-in: 14861826d4 user: js tags: trunk | |
22:42 | More file handling cleanups check-in: c09457f7ad user: js tags: trunk | |
Modified meson.build from [c0a1562e22] to [145d90f49a].
|
| | > | | | | | | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | project('Cube', ['c', 'objc', 'objcpp'], meson_version: '>=1.5.0') foreach lang : ['objc', 'objcpp'] add_global_arguments( [ '-fobjc-arc', '-fobjc-arc-exceptions' ], language: lang) endforeach objfw_dep = dependency('objfw') sdl_dep = dependency('SDL2') sdlimage_dep = dependency('SDL2_image') sdlmixer_dep = dependency('SDL2_mixer') zlib_dep = dependency('zlib') |
︙ | ︙ |
Added src/Ident.h version [e4880063ad].
Added src/Ident.m version [2e1b68d918].
Added src/KeyMapping.h version [791a955c77].
Added src/KeyMapping.m version [c90f999690].
Added src/MD2.h version [4f18777375].
Added src/MD2.mm version [e752e43195].
Added src/MapModelInfo.h version [340f29da11].
Added src/MapModelInfo.m version [a1a57242f0].
Modified src/command.mm from [c9d2804930] to [2baac4db66].
1 2 3 4 5 6 7 | // command.cpp: implements the parsing and execution of a tiny script language // which is largely backwards compatible with the quake console language. #include "cube.h" #include <memory> | < | < < < < < < < < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | // command.cpp: implements the parsing and execution of a tiny script language // which is largely backwards compatible with the quake console language. #include "cube.h" #include <memory> #import "Ident.h" void itoa(char *s, int i) { sprintf_s(s)("%d", i); } |
︙ | ︙ |
Modified src/console.mm from [20418af9a4] to [cf67d004cd].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | // console.cpp: the console buffer, its display, and command line control #include "cube.h" #include <ctype.h> #include <memory> struct cline { char *cref; int outtime; }; vector<cline> conlines; const int ndraw = 5; | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | // console.cpp: the console buffer, its display, and command line control #include "cube.h" #include <ctype.h> #include <memory> #import "KeyMapping.h" struct cline { char *cref; int outtime; }; vector<cline> conlines; const int ndraw = 5; |
︙ | ︙ | |||
89 90 91 92 93 94 95 | draw_text(refs[j], FONTH / 3, (FONTH / 4 * 5) * (nd - j - 1) + FONTH / 3, 2); }; }; // keymap is defined externally in keymap.cfg | < < < < < < < < < < < < < < < < < < < < | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | draw_text(refs[j], FONTH / 3, (FONTH / 4 * 5) * (nd - j - 1) + FONTH / 3, 2); }; }; // keymap is defined externally in keymap.cfg static OFMutableArray<KeyMapping *> *keyMappings = nil; void keymap(OFString *code, OFString *key, OFString *action) { if (keyMappings == nil) keyMappings = [[OFMutableArray alloc] init]; |
︙ | ︙ |
Modified src/cube.h from [a3e2530d8c] to [10a4604932].
︙ | ︙ | |||
111 112 113 114 115 116 117 | ((x) < MINBORD || (y) < MINBORD || (x) >= ssize - MINBORD || \ (y) >= ssize - MINBORD) struct block { int x, y, xs, ys; }; | < < < < < < < < < < < | 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | ((x) < MINBORD || (y) < MINBORD || (x) >= ssize - MINBORD || \ (y) >= ssize - MINBORD) struct block { int x, y, xs, ys; }; enum { GUN_FIST = 0, GUN_SG, GUN_CG, GUN_RL, GUN_RIFLE, GUN_FIREBALL, |
︙ | ︙ |
Modified src/entities.mm from [fa2e7605f2] to [8e9438e362].
1 2 3 4 5 6 7 8 9 10 | // entities.cpp: map entity related functions (pickup etc.) #include "cube.h" vector<entity> ents; static OFString *entmdlnames[] = { @"shells", @"bullets", @"rockets", | > > | 1 2 3 4 5 6 7 8 9 10 11 12 | // entities.cpp: map entity related functions (pickup etc.) #include "cube.h" #import "MapModelInfo.h" vector<entity> ents; static OFString *entmdlnames[] = { @"shells", @"bullets", @"rockets", |
︙ | ︙ |
Modified src/meson.build from [d4e8fbb8fd] to [a339bbfb63].
1 2 3 4 5 6 7 8 9 10 | executable('client', [ 'Cube.mm', 'client.mm', 'clientextras.mm', 'clientgame.mm', 'clients2c.mm', 'command.mm', 'console.mm', 'editing.mm', | > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | executable('client', [ 'Cube.mm', 'Ident.m', 'KeyMapping.m', 'MD2.mm', 'MapModelInfo.m', 'client.mm', 'clientextras.mm', 'clientgame.mm', 'clients2c.mm', 'command.mm', 'console.mm', 'editing.mm', |
︙ | ︙ |
Modified src/physics.mm from [186af48f2c] to [33d03da6be].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | // physics.cpp: no physics books were hurt nor consulted in the construction of // this code. All physics computations and constants were invented on the fly // and simply tweaked until they "felt right", and have no basis in reality. // Collision detection is simplistic but very robust (uses discrete steps at // fixed fps). #include "cube.h" bool plcollide(dynent *d, dynent *o, float &headspace, float &hi, float &lo) // collide with player or monster { if (o->state != CS_ALIVE) return true; | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | // physics.cpp: no physics books were hurt nor consulted in the construction of // this code. All physics computations and constants were invented on the fly // and simply tweaked until they "felt right", and have no basis in reality. // Collision detection is simplistic but very robust (uses discrete steps at // fixed fps). #include "cube.h" #import "MapModelInfo.h" bool plcollide(dynent *d, dynent *o, float &headspace, float &hi, float &lo) // collide with player or monster { if (o->state != CS_ALIVE) return true; |
︙ | ︙ |
Modified src/protos.h from [caa79545eb] to [1a4e5c2dba].
︙ | ︙ | |||
206 207 208 209 210 211 212 213 214 215 216 217 218 219 | extern void initsound(); extern void cleansound(); // rendermd2 extern void rendermodel(OFString *mdl, int frame, int range, int tex, float rad, float x, float y, float z, float yaw, float pitch, bool teammate, float scale, float speed, int snap = 0, int basetime = 0); extern MapModelInfo *getmminfo(int i); // server extern void initserver(bool dedicated, int uprate, const char *sdesc, const char *ip, const char *master, OFString *passwd, int maxcl); extern void cleanupserver(); extern void localconnect(); | > | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | extern void initsound(); extern void cleansound(); // rendermd2 extern void rendermodel(OFString *mdl, int frame, int range, int tex, float rad, float x, float y, float z, float yaw, float pitch, bool teammate, float scale, float speed, int snap = 0, int basetime = 0); @class MapModelInfo; extern MapModelInfo *getmminfo(int i); // server extern void initserver(bool dedicated, int uprate, const char *sdesc, const char *ip, const char *master, OFString *passwd, int maxcl); extern void cleanupserver(); extern void localconnect(); |
︙ | ︙ |
Modified src/rendermd2.mm from [d83bc98847] to [26b0b7264d].
1 2 3 4 | // rendermd2.cpp: loader code adapted from a nehe tutorial #include "cube.h" | < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | // rendermd2.cpp: loader code adapted from a nehe tutorial #include "cube.h" #import "MD2.h" #import "MapModelInfo.h" static OFMutableDictionary<OFString *, MD2 *> *mdllookup = nil; static OFMutableArray<MD2 *> *mapmodels = nil; static const int FIRSTMDL = 20; void delayedload(MD2 *m) { if (!m.loaded) { @autoreleasepool { OFString *path = [OFString |
︙ | ︙ | |||
261 262 263 264 265 266 267 | int xs, ys; installtex(FIRSTMDL + m.mdlnum, IRI2, &xs, &ys, false); m.loaded = true; } } } | < < > > > | | | | | < > > > > > < | | | | | | > > > | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | int xs, ys; installtex(FIRSTMDL + m.mdlnum, IRI2, &xs, &ys, false); m.loaded = true; } } } MD2 * loadmodel(OFString *name) { @autoreleasepool { static int modelnum = 0; MD2 *m = mdllookup[name]; if (m != nil) return m; m = [[MD2 alloc] init]; m.mdlnum = modelnum++; m.mmi = [[MapModelInfo alloc] initWithRad:2 h:2 zoff:0 snap:0 name:@""]; m.loadname = name; if (mdllookup == nil) mdllookup = [[OFMutableDictionary alloc] init]; mdllookup[name] = m; return m; } } void mapmodel( OFString *rad, OFString *h, OFString *zoff, OFString *snap, OFString *name) { MD2 *m = loadmodel(name); m.mmi = [[MapModelInfo alloc] initWithRad:(int)rad.longLongValue h:(int)h.longLongValue zoff:(int)zoff.longLongValue snap:(int)snap.longLongValue name:m.loadname]; if (mapmodels == nil) mapmodels = [[OFMutableArray alloc] init]; [mapmodels addObject:m]; } COMMAND(mapmodel, ARG_5STR) void mapmodelreset() { |
︙ | ︙ | |||
361 362 363 364 365 366 367 | yaw:yaw pitch:pitch scale:scale speed:speed snap:snap basetime:basetime]; } | < < < < < < < < < < < < < < < < < < < < | 137 138 139 140 141 142 143 | yaw:yaw pitch:pitch scale:scale speed:speed snap:snap basetime:basetime]; } |