Differences From Artifact [08d6b30ba2]:
- File src/rendermd2.mm — part of check-in [d2f07d884a] at 2025-03-12 00:16:05 on branch trunk — Be more tolerant of invalid arguments (user: js, size: 3399) [annotate] [blame] [check-ins using]
To Artifact [9b0441a720]:
- File
src/rendermd2.mm
— part of check-in
[489124a92f]
at
2025-03-16 10:11:39
on branch trunk
— Use one autorelease pool per frame
This way, nowhere else autorelease pools need to be managed. (user: js, size: 3155) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
12 13 14 15 16 17 18 | static const int FIRSTMDL = 20; void delayedload(MD2 *m) { if (!m.loaded) { | < | | | | < | | | < | | | | < < | | | | | | | < < < < | | | | | < | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | static const int FIRSTMDL = 20; void delayedload(MD2 *m) { if (!m.loaded) { OFString *path = [OFString stringWithFormat:@"packages/models/%@", m.loadname]; OFIRI *baseIRI = [Cube.sharedInstance.gameDataIRI IRIByAppendingPathComponent:path]; OFIRI *IRI1 = [baseIRI IRIByAppendingPathComponent:@"tris.md2"]; if (![m loadWithIRI:IRI1]) fatal(@"loadmodel: ", IRI1.string); OFIRI *IRI2 = [baseIRI IRIByAppendingPathComponent:@"skin.jpg"]; int xs, ys; installtex(FIRSTMDL + m.mdlnum, IRI2, &xs, &ys, false); m.loaded = true; } } MD2 * loadmodel(OFString *name) { 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 stringByReplacingOccurrencesOfString:@"\\" |
︙ | ︙ |