updated exit conditions
This commit is contained in:
parent
9d8b2bea9a
commit
c47b598a48
|
|
@ -244,12 +244,13 @@ pub const PhysicsRuntime = struct {
|
|||
physChar.deinit();
|
||||
}
|
||||
{
|
||||
// var iterator = self.shapes.iterator();
|
||||
// while (iterator.next()) |n| {
|
||||
// n.value_ptr.shape.release();
|
||||
// }
|
||||
var iterator = self.shapes.iterator();
|
||||
while (iterator.next()) |n| {
|
||||
n.value_ptr.shape.release();
|
||||
}
|
||||
}
|
||||
|
||||
self.system.update(0.01, .{}) catch {};
|
||||
{
|
||||
const interface = self.system.getBodyInterfaceMut();
|
||||
|
||||
|
|
|
|||
|
|
@ -44,12 +44,17 @@ pub const TBMap = struct {
|
|||
mesh.setTexture(textureName);
|
||||
|
||||
if (!rend.textureExists(textureName)) {
|
||||
var textureRef = builder.materialName.utf8();
|
||||
if (std.mem.eql(u8, textureRef, "__TB_empty")) {
|
||||
textureRef = "texture_sample";
|
||||
}
|
||||
|
||||
try assets.load(
|
||||
assets.MakeImportRefOptions(
|
||||
"Texture",
|
||||
textureName,
|
||||
// TODO don't hardcode the root path
|
||||
.{ .path = try std.fmt.bufPrint(&fmtBuf2, "textures/{s}.png", .{builder.materialName.utf8()}) },
|
||||
.{ .path = try std.fmt.bufPrint(&fmtBuf2, "textures/{s}.png", .{textureRef}) },
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
@ -134,9 +139,12 @@ pub const TBMap = struct {
|
|||
}
|
||||
self.colliderSpecs.deinit(self.allocator);
|
||||
|
||||
for (self.shapes.items) |*shapeName| {
|
||||
physics.removeShape(shapeName);
|
||||
}
|
||||
physics.context().system.update(0.001, .{}) catch {};
|
||||
|
||||
// for (self.shapes.items) |*shapeName| {
|
||||
// //_ = shapeName;
|
||||
// physics.removeShape(shapeName);
|
||||
// }
|
||||
|
||||
self.shapes.deinit(self.allocator);
|
||||
self.root.destroy();
|
||||
|
|
@ -246,6 +254,8 @@ pub const MeshBuilder = struct {
|
|||
}
|
||||
};
|
||||
|
||||
var tbMapDefaultName: core.Name = core.DefineName("__TB_empty");
|
||||
|
||||
pub fn LoadTrenchbroomMap(baseAllocator: std.mem.Allocator, settings: Settings) !*TBMap {
|
||||
var err: QuakeMap.ErrorInfo = undefined;
|
||||
const fileMapping = try core.fs().loadFile(settings.mapName);
|
||||
|
|
@ -268,7 +278,9 @@ pub fn LoadTrenchbroomMap(baseAllocator: std.mem.Allocator, settings: Settings)
|
|||
var name = core.MakeName(face.texture_name);
|
||||
|
||||
if (!builders.contains(name.handle())) {
|
||||
const meshName = try std.fmt.allocPrint(alloc, "map/m_{s}", .{face.texture_name});
|
||||
var meshName: []u8 = undefined;
|
||||
meshName = try std.fmt.allocPrint(alloc, "map/m_{s}", .{face.texture_name});
|
||||
|
||||
try builders.put(alloc, name.handle(), .{
|
||||
.materialName = name,
|
||||
.meshName = core.MakeName(meshName),
|
||||
|
|
@ -288,7 +300,6 @@ pub fn LoadTrenchbroomMap(baseAllocator: std.mem.Allocator, settings: Settings)
|
|||
try builder.addFace(face, settings);
|
||||
}
|
||||
}
|
||||
|
||||
// loop over every vertex in quakeMap and push vertices and indices.
|
||||
const tbMap = try TBMap.create(baseAllocator);
|
||||
|
||||
|
|
@ -303,6 +314,7 @@ pub fn LoadTrenchbroomMap(baseAllocator: std.mem.Allocator, settings: Settings)
|
|||
try tbMap.addPhysicsShape(solid, settings);
|
||||
}
|
||||
|
||||
physics.context().system.update(0.001, .{}) catch {};
|
||||
// loop over all point entities look for info_player_start
|
||||
return tbMap;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -626,12 +626,12 @@
|
|||
}
|
||||
// brush 69
|
||||
{
|
||||
( -1160 -864 192 ) ( -1160 -863 192 ) ( -1160 -864 193 ) mapping_defaults/ProtoGrey 16 -128 0 1 1
|
||||
( -1148 -816 296 ) ( -1136 -816 288 ) ( -1136 -688 288 ) mapping_defaults/ProtoGrey 64 -16 0 1 1
|
||||
( -1064 -864 192 ) ( -1064 -864 193 ) ( -1063 -864 192 ) mapping_defaults/ProtoGrey 64 -128 0 1 1
|
||||
( -1064 -864 192 ) ( -1063 -864 192 ) ( -1064 -863 192 ) mapping_defaults/ProtoGrey 64 -16 0 1 1
|
||||
( -936 -816 196 ) ( -935 -816 196 ) ( -936 -816 197 ) mapping_defaults/ProtoGrey 64 -128 0 1 1
|
||||
( -1160 -844 312 ) ( -1148 -716 304 ) ( -1148 -844 304 ) mapping_defaults/ProtoGrey 64 -16 0 1 1
|
||||
( -1160 -816 312 ) ( -1160 -864 312 ) ( -1160 -864 304 ) mapping_defaults/ProtoGrey 16 -128 0 1 1
|
||||
( -992 -864 192 ) ( -992 -816 192 ) ( -1160 -816 304 ) mapping_defaults/ProtoGrey 64 -16 0 1 1
|
||||
( -1160 -864 312 ) ( -980 -864 192 ) ( -992 -864 192 ) mapping_defaults/ProtoGrey 64 -128 0 1 1
|
||||
( -980 -864 192 ) ( -980 -816 192 ) ( -992 -816 192 ) mapping_defaults/ProtoGrey 64 -16 0 1 1
|
||||
( -992 -816 192 ) ( -980 -816 192 ) ( -1160 -816 312 ) mapping_defaults/ProtoGrey 64 -128 0 1 1
|
||||
( -1160 -816 312 ) ( -980 -816 192 ) ( -980 -864 192 ) mapping_defaults/ProtoGrey 64 -16 0 1 1
|
||||
}
|
||||
// brush 70
|
||||
{
|
||||
|
|
@ -1172,6 +1172,15 @@
|
|||
( -1532 -672 64 ) ( -1404 -672 80 ) ( -1532 -672 80 ) mapping_defaults/ProtoWhite 64 -128 0 1 1
|
||||
( -1532 -536 84 ) ( -1532 -536 85 ) ( -1532 -535 84 ) mapping_defaults/ProtoWhite 16 -128 0 1 1
|
||||
}
|
||||
// brush 130
|
||||
{
|
||||
( -208 -592 192 ) ( -208 -591 192 ) ( -208 -592 193 ) mapping_defaults/ProtoGreen 0 0 0 0.25 0.25
|
||||
( -208 -592 192 ) ( -208 -592 193 ) ( -207 -592 192 ) mapping_defaults/ProtoGreen 0 0 0 0.25 0.25
|
||||
( -208 -592 192 ) ( -207 -592 192 ) ( -208 -591 192 ) mapping_defaults/ProtoGreen 0 0 0 0.25 0.25
|
||||
( -96 -352 400 ) ( -96 -351 400 ) ( -95 -352 400 ) mapping_defaults/ProtoGreen 0 0 0 0.25 0.25
|
||||
( -96 -352 208 ) ( -95 -352 208 ) ( -96 -352 209 ) mapping_defaults/ProtoGreen 0 0 0 0.25 0.25
|
||||
( -96 -352 208 ) ( -96 -352 209 ) ( -96 -351 208 ) mapping_defaults/ProtoGreen 0 0 0 0.25 0.25
|
||||
}
|
||||
}
|
||||
// entity 1
|
||||
{
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ pub const ExternGameObject = struct {
|
|||
const self: *@This() = @ptrCast(@alignCast(ctx));
|
||||
|
||||
if (platform.context().isCursorEnabled()) {
|
||||
core.engine_logs("moving light ");
|
||||
core.engine_logs("moving light");
|
||||
const ray = rend.context().activeCamera.?.getNormalRayFromScreen(platform.getCursorPosition());
|
||||
if (physics.traceLine(ray.start, ray.dir.fmul(10000), .{ .bodyFilter = &self.fireTraceFilter, .getNormalsSlow = true })) |r| {
|
||||
if (r.normal) |n| {
|
||||
|
|
@ -170,7 +170,7 @@ pub const ExternGameObject = struct {
|
|||
if (ig.begin("meh", null, .{})) {
|
||||
// if (ig.checkbox("move lights ", null)) {}
|
||||
|
||||
ig.textFmt("info: - WASD to move, mouse to look,\n- Q and E to go up and down", .{}) catch return;
|
||||
ig.textFmt("info: - WASD to move, mouse to look,\n- Q and E to go up and down lol", .{}) catch return;
|
||||
ig.textFmt("- shift to slow down camera speed", .{}) catch return;
|
||||
ig.textFmt("- T to enable/disable mouse cursor", .{}) catch return;
|
||||
ig.textFmt("- f2 to route all inputs to the doom player", .{}) catch return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue