forked from derandark/DungeonViewerAC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Physics.cpp
89 lines (65 loc) · 1.88 KB
/
Physics.cpp
1
2
3
4
5
6
7
8
9
10
11
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include "StdAfx.h"
#include "PhysicsObj.h"
#include "Physics.h"
SmartArray<CPhysicsObj *> CPhysics::static_animating_objects(8);
double PhysicsTimer::curr_time = INVALID_TIME;
double PhysicsGlobals::floor_z = cos(3.437746770784939e3);
double PhysicsGlobals::ceiling_z;
double PhysicsGlobals::gravity = -9.8000002;
CPhysics::CPhysics(CObjectMaint *_ObjMaint, SmartBox *_SmartBox)
{
m_Player = NULL;
m_ObjMaint = _ObjMaint;
m_SmartBox = _SmartBox;
// m_0C = new HashBaseIter<CPhysicsObj *>(m_ObjMaint->m_Objects);
PhysicsTimer::curr_time = Time::GetTimeCurrent(); // Timer::m_timeCurrent
}
CPhysics::~CPhysics()
{
// Missing TexVelGid code here
// delete m_0C;
}
void CPhysics::AddStaticAnimatingObject(CPhysicsObj *pObject)
{
static_animating_objects.RemoveUnOrdered(&pObject);
static_animating_objects.add(&pObject);
}
void CPhysics::RemoveStaticAnimatingObject(CPhysicsObj *pObject)
{
static_animating_objects.RemoveUnOrdered(&pObject);
}
void CPhysics::SetPlayer(CPhysicsObj *Player)
{
m_Player = Player;
}
void CPhysics::UseTime()
{
static const double MinUpdateDelay = 1.0 / 30.0;
static double LastUpdate = 0.0; // dbl_5F1658;
double FrameTime = Time::GetTimeCurrent() - LastUpdate;
if (FrameTime < 0.0)
{
LastUpdate = Time::GetTimeCurrent();
return;
}
if (FrameTime < MinUpdateDelay)
return;
// MISSING CODE HERE
// Update objectmaint objects
LastUpdate = Time::GetTimeCurrent();
/*
for (long i = 0; i < static_animating_objects.num_used; i++)
{
static_animating_objects.array_data[i]->update
}
*/
for (long i = 0; i < static_animating_objects.num_used; i++)
{
static_animating_objects.array_data[i]->animate_static_object();
}
UpdateTexVelocity(FrameTime);
}
void CPhysics::UpdateTexVelocity(float FrameTime)
{
// Missing code here..
}