-
Notifications
You must be signed in to change notification settings - Fork 59
/
engine.cpp
93 lines (73 loc) · 2.57 KB
/
engine.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
87
88
89
90
91
92
93
#include "global.h"
/*
================================================================================
Represents the main fighting engine in which
all fighters are represented and the stages
================================================================================
*/
CEngine::CEngine()
{
}
CEngine::~CEngine()
{
delete m_pVMp1;
delete m_pVMp2;
}
/*
================================================================================
Init the engine clall the function once at the start
of OpenMugen
================================================================================
*/
void CEngine::InitEngine(CMemManager *m,CVideoSystem *v,CGameTimer *t)
{
//Set All pinter to CEngine class
m_pMemManager=m;
m_pVideoSystem=v;
m_pTimer=t;
//Set all needed pointer to need class by class player
player1.SetPointers(v,m->GetAllocater(P1),t);
strcpy(player1.myPlayerConst.PlayerData.szPlayerName, "player1");
player2.SetPointers(v,m->GetAllocater(P2),t);
strcpy(player2.myPlayerConst.PlayerData.szPlayerName, "player2");
player3.SetPointers(v,m->GetAllocater(P3),t);
strcpy(player3.myPlayerConst.PlayerData.szPlayerName, "player3");
player4.SetPointers(v,m->GetAllocater(P4),t);
strcpy(player4.myPlayerConst.PlayerData.szPlayerName, "player4");
//get the virtual machines
m_pVMp1 = new CVirtualMachine;
m_pVMp2 = new CVirtualMachine;
//Set players to the VM
m_pVMp1->SetPlayers(&player1,&player2);
m_pVMp2->SetPlayers(&player2,&player1);
//now set the VM to the player
player1.SetVM(m_pVMp1);
player2.SetVM(m_pVMp2);
/*Set the gournd limit of the player
This value should be read out the stage def*/
player1.SetGroundValue(220);
player2.SetGroundValue(220);
//this values also should read out of the stage def
player1.SetPos(70,220);
player2.SetPos(240,220);
player1.LoadPlayer("");
player2.LoadPlayer("");
player1.SetKeyBoard(P1);
player2.SetKeyBoard(P2);
player2.FaceLeft();
player1.SetDebug(true);
// player1.VelSetY(-2.4f);
}
/*
================================================================================
Upates all the engine members and draw them to the screen
Handels also AI and player movement
================================================================================
*/
void CEngine::RunEngine()
{
player1.UpDatePlayer();
player2.UpDatePlayer();
player1.DrawPlayer();
player2.DrawPlayer();
}