Skip to content

Commit

Permalink
test ragdoll init()
Browse files Browse the repository at this point in the history
  • Loading branch information
no-lex committed Aug 4, 2024
1 parent e133913 commit f778265
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ CLIENT_OBJS= \
testmd5.o \
testocta.o \
testprops.o \
testragdoll.o \
testskel.o \
testshadowatlas.o \
testutils.o \
Expand Down
2 changes: 2 additions & 0 deletions test/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "testgltfloader.h"
#include "testskel.h"
#include "testmd5.h"
#include "testragdoll.h"

int main()
{
Expand All @@ -24,6 +25,7 @@ int main()
test_octa();
test_gltf();
test_md5();
test_ragdoll();
test_skel();
test_geom();
test_geomexts();
Expand Down
52 changes: 52 additions & 0 deletions test/testragdoll.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

#include "../src/libprimis-headers/cube.h"
#include "../src/shared/geomexts.h"

#include <memory>
#include <optional>

#include "../src/engine/interface/console.h"
#include "../src/engine/interface/control.h"

#include "../src/engine/render/rendergl.h"

#include "../src/engine/world/entities.h"
#include "../src/engine/world/octaworld.h"
#include "../src/engine/world/physics.h"
#include "../src/engine/world/bih.h"

#include "../src/engine/model/model.h"
#include "../src/engine/model/ragdoll.h"

void test_init()
{
std::printf("testing ragdoll init\n");
ragdollskel s;
s.verts.push_back({vec(0,0,0), 0, 0});
s.verts.push_back({vec(1,0,0), 0, 0});
ragdolldata r(&s);

dynent d;
d.o = vec(0,0,0);
d.vel = vec(0,0,0);
d.falling = vec(0,0,0);
d.eyeheight = 0;
d.aboveeye = 0;

r.init(&d);

assert(r.center == vec(0.5, 0, 0));
assert(r.radius == 0.5);
}

void test_ragdoll()
{
std::printf(
"===============================================================\n\
testing ragdoll functionality\n\
===============================================================\n"
);

test_init();
}

7 changes: 7 additions & 0 deletions test/testragdoll.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef TEST_RAGDOLL_H_
#define TEST_RAGDOLL_H_

extern void test_ragdoll();

#endif

0 comments on commit f778265

Please sign in to comment.