Overview
Comment: | Remove cvector and ivector |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
5bbd6d8ddd29ca99ebd4b494d11fea53 |
User & Date: | js on 2025-03-06 01:17:59 |
Other Links: | manifest | tags |
Context
2025-03-06
| ||
01:42 | Some cleanups in clientextras.mm check-in: 62d6602900 user: js tags: trunk | |
01:17 | Remove cvector and ivector check-in: 5bbd6d8ddd user: js tags: trunk | |
00:34 | Clean up menus and text drawing check-in: f17992369e user: js tags: trunk | |
Changes
Modified src/client.mm from [b809582588] to [ea465722d3].
︙ | ︙ | |||
181 182 183 184 185 186 187 | COMMAND(echo, ARG_VARI) COMMANDN(say, toserver, ARG_VARI) COMMANDN(connect, connects, ARG_1STR) COMMANDN(disconnect, trydisconnect, ARG_NONE) // collect c2s messages conveniently | | | | > | | > > | | > > > > > > > > > > | 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | COMMAND(echo, ARG_VARI) COMMANDN(say, toserver, ARG_VARI) COMMANDN(connect, connects, ARG_1STR) COMMANDN(disconnect, trydisconnect, ARG_NONE) // collect c2s messages conveniently static OFMutableArray<OFData *> *messages; void addmsg(int rel, int num, int type, ...) { if (demoplayback) return; if (num != msgsizelookup(type)) { fatal([OFString stringWithFormat:@"inconsistant msg size for %d (%d != %d)", type, num, msgsizelookup(type)]); } if (messages.count == 100) { conoutf(@"command flood protection (type %d)", type); return; } OFMutableData *msg = [OFMutableData dataWithItemSize:sizeof(int) capacity:num + 2]; [msg addItem:&num]; [msg addItem:&rel]; [msg addItem:&type]; va_list marker; va_start(marker, type); loopi(num - 1) { int tmp = va_arg(marker, int); [msg addItem:&tmp]; } va_end(marker); [msg makeImmutable]; if (messages == nil) messages = [[OFMutableArray alloc] init]; [messages addObject:msg]; } void server_err() { conoutf(@"server network error, disconnecting..."); disconnect(); |
︙ | ︙ | |||
309 310 311 312 313 314 315 | packet->flags = ENET_PACKET_FLAG_RELIABLE; putint(p, SV_ITEMLIST); if (!m_noitems) putitems(p); putint(p, -1); senditemstoserver = false; serveriteminitdone = true; | < > < > < > > | | < < | > | < > | < < > > | 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | packet->flags = ENET_PACKET_FLAG_RELIABLE; putint(p, SV_ITEMLIST); if (!m_noitems) putitems(p); putint(p, -1); senditemstoserver = false; serveriteminitdone = true; } if (ctext[0]) // player chat, not flood protected for // now { packet->flags = ENET_PACKET_FLAG_RELIABLE; putint(p, SV_TEXT); sendstring(ctext, p); ctext[0] = 0; } if (!c2sinit) // tell other clients who I am { packet->flags = ENET_PACKET_FLAG_RELIABLE; c2sinit = true; putint(p, SV_INITC2S); sendstring(player1->name, p); sendstring(player1->team, p); putint(p, player1->lifesequence); } for (OFData *msg in messages) { // send messages collected during the previous // frames if (*(int *)[msg itemAtIndex:1]) packet->flags = ENET_PACKET_FLAG_RELIABLE; loopi(*(int *)[msg itemAtIndex:0]) putint(p, *(int *)[msg itemAtIndex:i + 2]); } [messages removeAllObjects]; if (lastmillis - lastping > 250) { putint(p, SV_PING); putint(p, lastmillis); lastping = lastmillis; } } *(ushort *)start = ENET_HOST_TO_NET_16(p - start); enet_packet_resize(packet, p - start); incomingdemodata(start, p - start, true); if (clienthost) { enet_host_broadcast(clienthost, 0, packet); enet_host_flush(clienthost); } else |
︙ | ︙ |
Modified src/console.mm from [39120f3a5f] to [979d6ed7fb].
︙ | ︙ | |||
155 156 157 158 159 160 161 | void pasteconsole() { char *cb = SDL_GetClipboardText(); strcat_s(commandbuf, cb); } | | | | > > | 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | void pasteconsole() { char *cb = SDL_GetClipboardText(); strcat_s(commandbuf, cb); } static OFMutableArray<OFString *> *vhistory; int histpos = 0; void history(int n) { static bool rec = false; if (!rec && n >= 0 && n < vhistory.count) { rec = true; OFString *cmd = vhistory[vhistory.count - n - 1]; std::unique_ptr<char> copy(strdup(cmd.UTF8String)); execute(copy.get()); rec = false; } } COMMAND(history, ARG_1INT) void keypress(int code, bool isdown, int cooked) |
︙ | ︙ | |||
188 189 190 191 192 193 194 | case SDLK_BACKSPACE: case SDLK_LEFT: { for (int i = 0; commandbuf[i]; i++) if (!commandbuf[i + 1]) commandbuf[i] = 0; resetcomplete(); break; | < | > | > | | > > > | > | | > > > < < > > > > > > | > > > | | | > | < > > > > | < > < < > > | 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | case SDLK_BACKSPACE: case SDLK_LEFT: { for (int i = 0; commandbuf[i]; i++) if (!commandbuf[i + 1]) commandbuf[i] = 0; resetcomplete(); break; } case SDLK_UP: if (histpos) { @autoreleasepool { strcpy_s(commandbuf, vhistory[--histpos] .UTF8String); } } break; case SDLK_DOWN: if (histpos < vhistory.count) { @autoreleasepool { strcpy_s(commandbuf, vhistory[histpos++] .UTF8String); } } break; case SDLK_TAB: complete(commandbuf); break; case SDLK_v: if (SDL_GetModState() & (KMOD_LCTRL | KMOD_RCTRL)) { pasteconsole(); return; }; default: resetcomplete(); if (cooked) { char add[] = {(char)cooked, 0}; strcat_s(commandbuf, add); } } } else { if (code == SDLK_RETURN) { if (commandbuf[0]) { @autoreleasepool { OFString *cmdbuf = @(commandbuf); if (vhistory == nil) vhistory = [[OFMutableArray alloc] init]; if (vhistory.count == 0 || ![vhistory.lastObject isEqual:cmdbuf]) { // cap this? [vhistory addObject:cmdbuf]; } } histpos = vhistory.count; if (commandbuf[0] == '/') execute(commandbuf, true); else toserver(commandbuf); } saycommand(NULL); } else if (code == SDLK_ESCAPE) { saycommand(NULL); } } } else if (!menukey(code, isdown)) { // keystrokes go to menu for (KeyMapping *mapping in keyMappings) { if (mapping.code == code) { // keystrokes go to game, lookup in keymap and // execute |
︙ | ︙ |
Modified src/cube.h from [10a4604932] to [d285e7fbb6].
︙ | ︙ | |||
278 279 280 281 282 283 284 | struct vertex { float u, v, x, y, z; uchar r, g, b, a; }; typedef vector<dynent *> dvector; | < < | 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | struct vertex { float u, v, x, y, z; uchar r, g, b, a; }; typedef vector<dynent *> dvector; // globals ooh naughty extern sqr *world, *wmip[]; // map data, the mips are sequential 2D arrays in memory extern header hdr; // current map header extern int sfactor, ssize; // ssize = 2^sfactor |
︙ | ︙ |
Modified src/sound.mm from [577f0e91da] to [34f20331ba].
︙ | ︙ | |||
124 125 126 127 128 129 130 | #ifdef USE_MIXER vector<Mix_Chunk *> samples; #else vector<FSOUND_SAMPLE *> samples; #endif | | | > > | > > > > | > > > > > > > | | > | 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | #ifdef USE_MIXER vector<Mix_Chunk *> samples; #else vector<FSOUND_SAMPLE *> samples; #endif static OFMutableArray<OFString *> *snames; int registersound(char *name_) { @autoreleasepool { OFString *name = @(name_); int i = 0; for (OFString *iter in snames) { if ([iter isEqual:name]) return i; i++; } if (snames == nil) snames = [[OFMutableArray alloc] init]; [snames addObject:name]; samples.add(NULL); return samples.length() - 1; } } COMMAND(registersound, ARG_1EST) void cleansound() { if (nosound) |
︙ | ︙ | |||
236 237 238 239 240 241 242 | if (n < 0 || n >= samples.length()) { conoutf(@"unregistered sound: %d", n); return; } if (!samples[n]) { OFString *path = [OFString | | | 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | if (n < 0 || n >= samples.length()) { conoutf(@"unregistered sound: %d", n); return; } if (!samples[n]) { OFString *path = [OFString stringWithFormat:@"packages/sounds/%@.wav", snames[n]]; OFIRI *IRI = [Cube.sharedInstance.gameDataIRI IRIByAppendingPathComponent:path]; #ifdef USE_MIXER samples[n] = Mix_LoadWAV(IRI.fileSystemRepresentation.UTF8String); #else |
︙ | ︙ |