1022 changed files with 81 additions and 176166 deletions
@ -1,12 +1,54 @@
@@ -1,12 +1,54 @@
|
||||
#include "HelloWorldController.h" |
||||
#include <drogon/drogon.h> |
||||
#include <iostream> |
||||
#include "HelloWorldController.h" |
||||
#include "RuntimeObjectSystem/IObject.h" |
||||
#include "RuntimeObjectSystem/ObjectInterfacePerModule.h" |
||||
|
||||
using namespace drogon; |
||||
// 定义可热更新的接口
|
||||
class IHelloHandler : public IObject |
||||
{ |
||||
public: |
||||
virtual std::string GetResponse() = 0; |
||||
}; |
||||
|
||||
// 默认实现(可被热更新)
|
||||
class HelloHandler_v1 : public TInterface<IID_DEFAULT, IHelloHandler> |
||||
{ |
||||
public: |
||||
std::string GetResponse() override |
||||
{ |
||||
return "Hello from Version 1!"; |
||||
} |
||||
}; |
||||
REGISTERCLASS(HelloHandler_v1); |
||||
|
||||
void HelloWorldController::asyncHandleHttpRequest( |
||||
const HttpRequestPtr &req, |
||||
std::function<void(const HttpResponsePtr &)> &&callback) |
||||
{ |
||||
// 初始化 RCCPP 系统(仅首次)
|
||||
if (!m_pRuntimeSystem) |
||||
{ |
||||
m_pRuntimeSystem = new RuntimeObjectSystem; |
||||
m_pRuntimeSystem->Initialise(new StdioLogSystem(), nullptr); |
||||
|
||||
// 创建初始对象
|
||||
auto pCtor = m_pRuntimeSystem->GetObjectFactorySystem()->GetConstructor("HelloHandler_v1"); |
||||
if (pCtor) |
||||
{ |
||||
m_ObjectId = pCtor->Construct()->GetObjectId(); |
||||
} |
||||
} |
||||
|
||||
// 获取当前实现(可能是热更新后的版本)
|
||||
IHelloHandler *pHandler = nullptr; |
||||
if (auto pObj = m_pRuntimeSystem->GetObjectFactorySystem()->GetObject(m_ObjectId)) |
||||
{ |
||||
pObj->GetInterface(&pHandler); |
||||
} |
||||
|
||||
// 生成响应
|
||||
auto resp = HttpResponse::newHttpResponse(); |
||||
resp->setBody("Hello, World! 欢迎访问 UFT C++ Server 开发 Project!"); |
||||
resp->setBody(pHandler ? pHandler->GetResponse() : "Error: Handler not loaded"); |
||||
callback(resp); |
||||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,32 +0,0 @@
@@ -1,32 +0,0 @@
|
||||
body |
||||
{ |
||||
font-family: Delicious; |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
font-size: 20; |
||||
color: white; |
||||
z-index: -3; |
||||
} |
||||
|
||||
body |
||||
{ |
||||
height: 100%; |
||||
width: 100%; |
||||
} |
||||
|
||||
div#compiling |
||||
{ |
||||
font-size: 16; |
||||
font-weight: bold; |
||||
|
||||
background-color: #303030; |
||||
|
||||
text-align: left; |
||||
|
||||
position:absolute; |
||||
bottom: 9px; |
||||
right: 40px; |
||||
width: 200px; |
||||
} |
||||
|
||||
|
@ -1,10 +0,0 @@
@@ -1,10 +0,0 @@
|
||||
<rml> |
||||
<head> |
||||
<link type="text/rcss" href="default.rcss"/> |
||||
<link type="text/rcss" href="compiling-notification.rcss"/> |
||||
<title>CompilingNotification</title> |
||||
</head> |
||||
<body> |
||||
<div id="compiling"></div> |
||||
</body> |
||||
</rml> |
@ -1,515 +0,0 @@
@@ -1,515 +0,0 @@
|
||||
body |
||||
{ |
||||
font-family: Delicious; |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
font-size: 15pt; |
||||
color: white; |
||||
|
||||
top: 100px; |
||||
left: 30px; |
||||
} |
||||
|
||||
div#title_bar |
||||
{ |
||||
z-index: 2; |
||||
|
||||
position: absolute; |
||||
top: -33px; |
||||
|
||||
text-align: left; |
||||
} |
||||
|
||||
div#title_bar span |
||||
{ |
||||
padding-left: 30px; |
||||
padding-right: 20px; |
||||
padding-top: 12px; |
||||
padding-bottom: 35px; |
||||
|
||||
font-size: 18pt; |
||||
font-weight: bold; |
||||
|
||||
outline-font-effect: outline; |
||||
outline-width: 1px; |
||||
outline-color: black; |
||||
|
||||
background-decorator: tiled-horizontal; |
||||
background-left-image: console.tga 147px 0px 229px 85px; |
||||
background-center-image: console.tga stretch 229px 0px 230px 85px; |
||||
background-right-image: console.tga 231px 0px 246px 85px; |
||||
} |
||||
|
||||
div#window |
||||
{ |
||||
z-index: 2; |
||||
width: 600px; |
||||
height: auto; |
||||
|
||||
background-decorator: tiled-box; |
||||
background-top-left-image: console.tga 0px 0px 133px 15px; |
||||
background-top-right-image: console.tga 136px 0px 146px 15px; |
||||
background-top-image: console.tga stretch 134px 0px 135px 15px; |
||||
background-bottom-left-image: console.tga 0px 16px 11px 31px; |
||||
background-bottom-right-image: console.tga 136px 16px 146px 31px; |
||||
background-bottom-image: console.tga stretch 11px 16px 12px 31px; |
||||
background-left-image: console.tga stretch 0px 15px 10px 16px; |
||||
background-center-image: console.tga stretch 11px 15px 12px 16px; |
||||
} |
||||
|
||||
div#content |
||||
{ |
||||
z-index: 2; |
||||
|
||||
overflow: hidden auto; |
||||
|
||||
text-align: left; |
||||
|
||||
padding-left: 7px; |
||||
padding-right: 7px; |
||||
padding-bottom: 3px; |
||||
} |
||||
|
||||
div#controls |
||||
{ |
||||
z-index: 2; |
||||
|
||||
margin-top: 8px; |
||||
margin-right: 10px; |
||||
text-align: right; |
||||
} |
||||
|
||||
select, |
||||
dataselect |
||||
{ |
||||
margin-left: 20px; |
||||
} |
||||
|
||||
input.text, |
||||
textarea |
||||
{ |
||||
font-family: Anonymous; |
||||
font-size: 16pt; |
||||
} |
||||
|
||||
input.submit |
||||
{ |
||||
margin-left: 7px; |
||||
margin-bottom: 4px; |
||||
} |
||||
|
||||
button, |
||||
input.submit |
||||
{ |
||||
display: inline-block; |
||||
|
||||
width: 80px; |
||||
height: 28px; |
||||
|
||||
padding-top: 5px; |
||||
vertical-align: -18px; |
||||
|
||||
font-size: 14pt; |
||||
font-weight: bold; |
||||
text-align: center; |
||||
tab-index: auto; |
||||
|
||||
background-decorator: image; |
||||
background-image: console.tga 247px 0px 406px 45px; |
||||
} |
||||
|
||||
button:focus, |
||||
input.submit:focus |
||||
{ |
||||
font-weight: bold; |
||||
|
||||
shadow-font-effect: shadow; |
||||
shadow-offset: 1px 1px; |
||||
shadow-color: black; |
||||
} |
||||
|
||||
button:hover, |
||||
input.submit:hover |
||||
{ |
||||
background-image-t: 45px 90px; |
||||
} |
||||
|
||||
button:active, |
||||
input.submit:active |
||||
{ |
||||
background-image-t: 90px 135px; |
||||
} |
||||
|
||||
button:disabled, |
||||
input.submit:disabled |
||||
{ |
||||
background-image-t: 90px 135px; |
||||
color: grey; |
||||
font-weight: normal; |
||||
} |
||||
|
||||
input.text, |
||||
textarea |
||||
{ |
||||
padding: 5px; |
||||
padding-left: 10px; |
||||
padding-top: 10px; |
||||
margin: 5px; |
||||
margin-bottom: 0px; |
||||
|
||||
background-decorator: tiled-box; |
||||
background-top-left-image: console.tga 281px 272px 292px 284px; |
||||
background-top-right-image: console.tga 294px 272px 305px 284px; |
||||
background-top-image: console.tga stretch 292px 272px 293px 284px; |
||||
background-bottom-left-image: console.tga 281px 285px 292px 296px; |
||||
background-bottom-right-image: console.tga 294px 285px 305px 296px; |
||||
background-bottom-image: console.tga stretch 292px 285px 293px 296px; |
||||
background-left-image: console.tga stretch 281px 283px 292px 284px; |
||||
background-center-image: console.tga stretch 292px 283px 293px 284px; |
||||
} |
||||
|
||||
input.text |
||||
{ |
||||
height: 35px; |
||||
width: 677px; |
||||
} |
||||
|
||||
textarea |
||||
{ |
||||
height: 155px; |
||||
width: 677px; |
||||
} |
||||
|
||||
input.text, |
||||
select, |
||||
dataselect, |
||||
textarea |
||||
{ |
||||
color: black; |
||||
font-size: 13pt; |
||||
} |
||||
|
||||
datagrid input.text |
||||
{ |
||||
width: 100%; |
||||
height: auto; |
||||
margin: 0px; |
||||
padding: 0px 2px 0px; |
||||
|
||||
border-width: 1px; |
||||
border-color: black; |
||||
background-color: white; |
||||
|
||||
font-size: 15pt; |
||||
|
||||
background-decorator: none; |
||||
} |
||||
|
||||
|
||||
|
||||
select, |
||||
dataselect |
||||
{ |
||||
width: 175px; |
||||
height: 37px; |
||||
} |
||||
|
||||
select selectvalue, |
||||
dataselect selectvalue |
||||
{ |
||||
width: auto; |
||||
margin-right: 30px; |
||||
|
||||
height: 28px; |
||||
padding: 9px 10px 0px 10px; |
||||
|
||||
background-decorator: image; |
||||
background-image: console.tga 162px 192px 307px 229px; |
||||
} |
||||
|
||||
select selectvalue:hover, |
||||
dataselect selectvalue:hover |
||||
{ |
||||
background-image-t: 230px 267px; |
||||
} |
||||
|
||||
select selectarrow, |
||||
dataselect selectarrow |
||||
{ |
||||
width: 30px; |
||||
height: 37px; |
||||
|
||||
icon-decorator: image; |
||||
icon-image: console.tga 307px 192px 337px 229px; |
||||
} |
||||
|
||||
select selectarrow:hover, |
||||
dataselect selectarrow:hover |
||||
{ |
||||
icon-image-t: 230px 267px; |
||||
} |
||||
|
||||
select selectarrow:active, |
||||
select selectarrow:checked, |
||||
dataselect selectarrow:active, |
||||
dataselect selectarrow:checked |
||||
{ |
||||
icon-image-t: 268px 305px; |
||||
} |
||||
|
||||
select selectbox, |
||||
dataselect selectbox |
||||
{ |
||||
margin-left: 1px; |
||||
margin-top: -7px; |
||||
width: 162px; |
||||
padding: 1px 4px 4px 4px; |
||||
} |
||||
|
||||
select selectbox, |
||||
dataselect selectbox, |
||||
datagrid datagridbody |
||||
{ |
||||
background-decorator: tiled-box; |
||||
background-top-left-image: console.tga 281px 275px 292px 284px; |
||||
background-top-right-image: console.tga 294px 275px 305px 284px; |
||||
background-top-image: console.tga stretch 292px 275px 293px 284px; |
||||
background-bottom-left-image: console.tga 281px 285px 292px 296px; |
||||
background-bottom-right-image: console.tga 294px 285px 305px 296px; |
||||
background-bottom-image: console.tga stretch 292px 285px 293px 296px; |
||||
background-left-image: console.tga stretch 281px 283px 292px 284px; |
||||
background-center-image: console.tga stretch 292px 283px 293px 284px; |
||||
} |
||||
|
||||
select selectbox option, |
||||
dataselect selectbox option |
||||
{ |
||||
width: auto; |
||||
padding-left: 3px; |
||||
} |
||||
|
||||
select selectbox option:nth-child(even), |
||||
dataselect selectbox option:nth-child(even), |
||||
datagrid datagridrow:nth-child(even) |
||||
{ |
||||
background: #FFFFFFA0; |
||||
} |
||||
|
||||
select selectbox option:hover, |
||||
dataselect selectbox option:hover |
||||
{ |
||||
background: #FF5D5D; |
||||
} |
||||
|
||||
|
||||
|
||||
input.radio, |
||||
input.checkbox |
||||
{ |
||||
width: 30px; |
||||
height: 30px; |
||||
|
||||
vertical-align: -11px; |
||||
} |
||||
|
||||
input.radio |
||||
{ |
||||
icon-decorator: image; |
||||
icon-image: console.tga 407px 0px 437px 30px; |
||||
} |
||||
|
||||
input.radio:hover |
||||
{ |
||||
icon-image-s: 437px 467px; |
||||
} |
||||
|
||||
input.radio:active |
||||
{ |
||||
icon-image-s: 467px 497px; |
||||
} |
||||
|
||||
input.radio:checked |
||||
{ |
||||
icon-image-t: 30px 60px; |
||||
} |
||||
|
||||
input.radio:checked:hover |
||||
{ |
||||
icon-image-s: 437px 467px; |
||||
icon-image-t: 30px 60px; |
||||
} |
||||
|
||||
input.radio:checked:active |
||||
{ |
||||
icon-image-s: 467px 497px; |
||||
icon-image-t: 30px 60px; |
||||
} |
||||
|
||||
input.checkbox |
||||
{ |
||||
icon-decorator: image; |
||||
icon-image: console.tga 407px 60px 437px 90px; |
||||
} |
||||
|
||||
input.checkbox:hover |
||||
{ |
||||
icon-image-s: 437px 467px; |
||||
} |
||||
|
||||
input.checkbox:active |
||||
{ |
||||
icon-image-s: 467px 497px; |
||||
} |
||||
|
||||
input.checkbox:checked |
||||
{ |
||||
icon-image-t: 90px 120px; |
||||
} |
||||
|
||||
input.checkbox:checked:hover |
||||
{ |
||||
icon-image-s: 437px 467px; |
||||
icon-image-t: 90px 120px; |
||||
} |
||||
|
||||
input.checkbox:checked:active |
||||
{ |
||||
icon-image-s: 467px 497px; |
||||
icon-image-t: 90px 120px; |
||||
} |
||||
|
||||
|
||||
|
||||
datagrid datagridheader |
||||
{ |
||||
width: auto; |
||||
height: 25px; |
||||
padding: 5px 10px 0px 10px; |
||||
|
||||
background-decorator: tiled-horizontal; |
||||
background-left-image: console.tga 127px 192px 143px 223px; |
||||
background-center-image: console.tga stretch 143px 192px 145px 223px; |
||||
background-right-image: console.tga 145px 192px 160px 223px; |
||||
} |
||||
|
||||
datagrid datagridbody |
||||
{ |
||||
color: black; |
||||
|
||||
margin-left: 4px; |
||||
margin-right: 3px; |
||||
padding: 0px 4px 4px 4px; |
||||
} |
||||
|
||||
|
||||
|
||||
datagridexpand |
||||
{ |
||||
display: block; |
||||
|
||||
margin: 1px 0px 1px 5px; |
||||
height: 17px; |
||||
width: 17px; |
||||
|
||||
icon-decorator: image; |
||||
icon-image: console.tga 3px 232px 20px 249px; |
||||
} |
||||
|
||||
datagridexpand:hover |
||||
{ |
||||
icon-image-s: 21px 38px; |
||||
} |
||||
|
||||
datagridexpand:active |
||||
{ |
||||
icon-image-s: 39px 56px; |
||||
} |
||||
|
||||
datagridexpand.collapsed |
||||
{ |
||||
icon-image-t: 250px 267px; |
||||
} |
||||
|
||||
|
||||
|
||||
scrollbarvertical |
||||
{ |
||||
margin-top: 1px; |
||||
margin-bottom: 3px; |
||||
margin-right: 3px; |
||||
width: 27px; |
||||
} |
||||
|
||||
scrollbarvertical slidertrack |
||||
{ |
||||
background-decorator: tiled-vertical; |
||||
background-top-image: console.tga 70px 199px 97px 201px; |
||||
background-center-image: console.tga stretch 70px 201px 97px 202px; |
||||
background-bottom-image: console.tga 70px 203px 97px 204px; |
||||
} |
||||
|
||||
scrollbarvertical sliderbar |
||||
{ |
||||
margin-left: 4px; |
||||
width: 23px; |
||||
min-height: 46px; |
||||
|
||||
background-decorator: tiled-vertical; |
||||
background-top-image: console.tga 56px 152px 79px 175px; |
||||
background-center-image: console.tga stretch 56px 175px 79px 175px; |
||||
background-bottom-image: console.tga 56px 176px 79px 198px; |
||||
} |
||||
|
||||
scrollbarvertical sliderbar:hover |
||||
{ |
||||
background-top-image-s: 80px 103px; |
||||
background-center-image-s: 80px 103px; |
||||
background-bottom-image-s: 80px 103px; |
||||
} |
||||
|
||||
scrollbarvertical sliderbar:active |
||||
{ |
||||
background-top-image-s: 104px 127px; |
||||
background-center-image-s: 104px 127px; |
||||
background-bottom-image-s: 104px 127px; |
||||
} |
||||
|
||||
scrollbarvertical sliderarrowdec |
||||
{ |
||||
width: 27px; |
||||
height: 24px; |
||||
|
||||
icon-decorator: image; |
||||
icon-image: console.tga 0px 152px 27px 176px; |
||||
} |
||||
|
||||
scrollbarvertical sliderarrowdec:hover, |
||||
scrollbarvertical sliderarrowinc:hover |
||||
{ |
||||
icon-image-t: 177px 201px; |
||||
} |
||||
|
||||
scrollbarvertical sliderarrowdec:active, |
||||
scrollbarvertical sliderarrowinc:active |
||||
{ |
||||
icon-image-t: 202px 226px; |
||||
} |
||||
|
||||
scrollbarvertical sliderarrowinc |
||||
{ |
||||
width: 27px; |
||||
height: 24px; |
||||
|
||||
icon-decorator: image; |
||||
icon-image: console.tga 28px 152px 55px 176px; |
||||
} |
||||
|
||||
|
||||
|
||||
scrollbarhorizontal |
||||
{ |
||||
width: 0px; |
||||
height: 0px; |
||||
} |
||||
|
||||
|
@ -1,28 +0,0 @@
@@ -1,28 +0,0 @@
|
||||
<rml> |
||||
<head> |
||||
<link type="text/rcss" href="default.rcss"/> |
||||
<link type="text/rcss" href="console.rcss"/> |
||||
<title>Title</title> |
||||
</head> |
||||
<body> |
||||
<div id="title_bar"> |
||||
<handle move_target="#document"> |
||||
<span id="title">Console</span> |
||||
</handle> |
||||
</div> |
||||
<div id="window"> |
||||
<div id="controls"> |
||||
<button id="ViewButton">Multi</button> |
||||
<button id="ClearButton">Clear</button> |
||||
<button id="BackButton"><</button> |
||||
<button id="ForwardButton">></button> |
||||
<button id="CloseButton">Close</button> |
||||
</div> |
||||
<div id="content"> |
||||
<input id="SingleLineArea" name="oneline" type="text" maxlength="256"/> |
||||
<textarea id="MultiLineArea" name="multiline" /> |
||||
<button id="ExecuteButton">Execute</button> |
||||
</div> |
||||
</div> |
||||
</body> |
||||
</rml> |
Before Width: | Height: | Size: 1.0 MiB |
@ -1,44 +0,0 @@
@@ -1,44 +0,0 @@
|
||||
/* |
||||
* Default styles for all the basic elements. |
||||
*/ |
||||
|
||||
div |
||||
{ |
||||
display: block; |
||||
} |
||||
|
||||
p |
||||
{ |
||||
display: block; |
||||
} |
||||
|
||||
h1 |
||||
{ |
||||
display: block; |
||||
} |
||||
|
||||
em |
||||
{ |
||||
font-style: italic; |
||||
} |
||||
|
||||
strong |
||||
{ |
||||
font-weight: bold; |
||||
} |
||||
|
||||
datagrid |
||||
{ |
||||
display: block; |
||||
} |
||||
|
||||
select, dataselect, datacombo |
||||
{ |
||||
text-align: left; |
||||
} |
||||
|
||||
tabset tabs |
||||
{ |
||||
display: block; |
||||
} |
||||
|
@ -1,27 +0,0 @@
@@ -1,27 +0,0 @@
|
||||
body |
||||
{ |
||||
font-family: Delicious; |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
font-size: 20; |
||||
color: white; |
||||
} |
||||
|
||||
div#fps |
||||
{ |
||||
font-size: 20; |
||||
font-weight: bold; |
||||
|
||||
outline-font-effect: outline; |
||||
outline-width: 1px; |
||||
outline-color: black; |
||||
|
||||
text-align: right; |
||||
|
||||
position:absolute; |
||||
top: 5px; |
||||
right: 10px; |
||||
width: 100px; |
||||
} |
||||
|
||||
|
@ -1,10 +0,0 @@
@@ -1,10 +0,0 @@
|
||||
<rml> |
||||
<head> |
||||
<link type="text/rcss" href="default.rcss"/> |
||||
<link type="text/rcss" href="fps-counter.rcss"/> |
||||
<title>FPS Counter</title> |
||||
</head> |
||||
<body> |
||||
<div id ="fps"></div> |
||||
</body> |
||||
</rml> |
Before Width: | Height: | Size: 1.0 MiB |
Before Width: | Height: | Size: 1.0 MiB |
@ -1,34 +0,0 @@
@@ -1,34 +0,0 @@
|
||||
body |
||||
{ |
||||
font-family: Delicious; |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
font-size: 20; |
||||
color: white; |
||||
z-index: -2; |
||||
} |
||||
|
||||
textarea#info |
||||
{ |
||||
font-size: 13; |
||||
|
||||
position: absolute; |
||||
width: 220px; |
||||
height: 170px; |
||||
bottom: 0px; |
||||
left: 0px; |
||||
|
||||
color: black; |
||||
|
||||
padding: 12px; |
||||
|
||||
background-decorator: tiled-box; |
||||
background-top-left-image: console.tga 281px 272px 292px 284px; |
||||
background-top-right-image: console.tga 294px 272px 305px 284px; |
||||
background-top-image: console.tga stretch 292px 272px 293px 284px; |
||||
background-bottom-left-image: console.tga 281px 285px 292px 296px; |
||||
background-bottom-right-image: console.tga 294px 285px 305px 296px; |
||||
background-bottom-image: console.tga stretch 292px 285px 293px 296px; |
||||
background-left-image: console.tga stretch 281px 283px 292px 284px; |
||||
background-center-image: console.tga stretch 292px 283px 293px 284px; |
||||
} |
@ -1,11 +0,0 @@
@@ -1,11 +0,0 @@
|
||||
<rml> |
||||
<head> |
||||
<link type="text/rcss" href="default.rcss"/> |
||||
<link type="text/rcss" href="input.rcss"/> |
||||
<title>Input Manager Window</title> |
||||
</head> |
||||
<body> |
||||
<div id="input"></div> |
||||
<textarea id="info" /> |
||||
</body> |
||||
</rml> |
Before Width: | Height: | Size: 1.0 MiB |
@ -1,582 +0,0 @@
@@ -1,582 +0,0 @@
|
||||
body |
||||
{ |
||||
z-index: top; |
||||
font-family: Delicious; |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
font-size: 15; |
||||
color: white; |
||||
|
||||
display: inline; |
||||
height: 0px; |
||||
} |
||||
|
||||
body.window |
||||
{ |
||||
padding-top: 43px; |
||||
padding-bottom: 20px; |
||||
|
||||
min-width: 250px; |
||||
max-width: 800px; |
||||
|
||||
min-height: 135px; |
||||
max-height: 700px; |
||||
} |
||||
|
||||
|
||||
|
||||
div#title_bar |
||||
{ |
||||
z-index: 1; |
||||
|
||||
position: absolute; |
||||
top: 0px; |
||||
left: 0px; |
||||
|
||||
text-align: left; |
||||
} |
||||
|
||||
div#title_bar div#icon |
||||
{ |
||||
position: absolute; |
||||
left: 20px; |
||||
top: 2px; |
||||
|
||||
width: 51px; |
||||
height: 39px; |
||||
|
||||
icon-decorator: image; |
||||
icon-image-src: invader.tga; |
||||
} |
||||
|
||||
div#title_bar span |
||||
{ |
||||
padding-left: 85px; |
||||
padding-right: 25px; |
||||
padding-top: 17px; |
||||
padding-bottom: 48px; |
||||
|
||||
font-size: 22; |
||||
font-weight: bold; |
||||
|
||||
outline-font-effect: outline; |
||||
outline-width: 1px; |
||||
outline-color: black; |
||||
|
||||
background-decorator: tiled-horizontal; |
||||
background-left-image: invader.tga 147px 0px 229px 85px; |
||||
background-center-image: invader.tga stretch 229px 0px 230px 85px; |
||||
background-right-image: invader.tga 231px 0px 246px 85px; |
||||
} |
||||
|
||||
|
||||
|
||||
div.window |
||||
{ |
||||
padding-top: 10px; |
||||
padding-left: 20px; |
||||
padding-bottom: 10px; |
||||
|
||||
margin-left: auto; |
||||
margin-right: auto; |
||||
width: 500px; |
||||
|
||||
background-decorator: tiled-box; |
||||
background-top-left-image: invader.tga 0px 0px 133px 140px; |
||||
background-top-right-image: invader.tga 136px 0px 146px 140px; |
||||
background-top-image: invader.tga stretch 134px 0px 135px 140px; |
||||
background-bottom-left-image: invader.tga 0px 140px 11px 151px; |
||||
background-bottom-right-image: invader.tga 136px 140px 146px 151px; |
||||
background-bottom-image: invader.tga stretch 11px 140px 12px 151px; |
||||
background-left-image: invader.tga stretch 0px 139px 10px 140px; |
||||
background-center-image: invader.tga stretch 11px 139px 12px 140px; |
||||
} |
||||
|
||||
div.options |
||||
{ |
||||
padding-left: 25px; |
||||
} |
||||
|
||||
input.range |
||||
{ |
||||
vertical-align: -3px; |
||||
} |
||||
|
||||
input.range slidertrack |
||||
{ |
||||
width: 150px; |
||||
height: 20px; |
||||
|
||||
background-color: black; |
||||
} |
||||
|
||||
input.range sliderbar |
||||
{ |
||||
width: 20px; |
||||
height: 16px; |
||||
|
||||
background-decorator: image; |
||||
background-image: invader.tga 247px 5px 406px 40px; |
||||
} |
||||
|
||||
div#content |
||||
{ |
||||
z-index: 2; |
||||
|
||||
width: auto; |
||||
height: 100%; |
||||
|
||||
overflow: hidden auto; |
||||
text-align: center; |
||||
} |
||||
|
||||
div#toggle-group |
||||
{ |
||||
display: inline; |
||||
width: auto; |
||||
} |
||||
|
||||
div#menu-group |
||||
{ |
||||
display: inline; |
||||
width: auto; |
||||
} |
||||
|
||||
|
||||
|
||||
p |
||||
{ |
||||
text-align: left; |
||||
margin-bottom: 1em; |
||||
} |
||||
|
||||
h1 |
||||
{ |
||||
margin-left: 0.2em; |
||||
margin-bottom: 0.4em; |
||||
|
||||
text-align: left; |
||||
font-size: 16; |
||||
font-weight: bold; |
||||
|
||||
shadow-font-effect: shadow; |
||||
shadow-offset: 1px 1px; |
||||
shadow-color: black; |
||||
} |
||||
|
||||
|
||||
|
||||
input, |
||||
select, |
||||
dataselect |
||||
{ |
||||
margin-left: 20px; |
||||
} |
||||
|
||||
input.submit |
||||
{ |
||||
margin-left: 0px; |
||||
} |
||||
|
||||
|
||||
|
||||
button, |
||||
input.submit |
||||
{ |
||||
display: inline-block; |
||||
|
||||
height: 37px; |
||||
width: 100px; |
||||
|
||||
padding-top: 8px; |
||||
vertical-align: -18px; |
||||
|
||||
font-size: 18; |
||||
text-align: center; |
||||
tab-index: auto; |
||||
|
||||
background-decorator: image; |
||||
background-image: invader.tga 247px 0px 406px 45px; |
||||
} |
||||
|
||||
button:focus, |
||||
input.submit:focus |
||||
{ |
||||
font-weight: bold; |
||||
|
||||
shadow-font-effect: shadow; |
||||
shadow-offset: 1px 1px; |
||||
shadow-color: black; |
||||
} |
||||
|
||||
button:hover, |
||||
input.submit:hover |
||||
{ |
||||
background-image-t: 45px 90px; |
||||
} |
||||
|
||||
button:active, |
||||
input.submit:active |
||||
{ |
||||
background-image-t: 90px 135px; |
||||
} |
||||
|
||||
|
||||
button.square |
||||
{ |
||||
width: 45px; |
||||
background-decorator: image; |
||||
background-image: invader.tga 454px 188px 499px 233px; |
||||
} |
||||
|
||||
button.square:hover, |
||||
{ |
||||
background-image-t: 233px 278px; |
||||
} |
||||
|
||||
button.square:active, |
||||
{ |
||||
background-image-t: 278px 323px; |
||||
} |
||||
|
||||
|
||||
input.text |
||||
{ |
||||
height: 31px; |
||||
padding: 10px 10px 0px; |
||||
|
||||
background-decorator: tiled-horizontal; |
||||
background-left-image: invader.tga 162px 192px 176px 223px; |
||||
background-center-image: invader.tga stretch 176px 192px 177px 223px; |
||||
} |
||||
|
||||
input.text, |
||||
select, |
||||
dataselect |
||||
{ |
||||
color: black; |
||||
font-size: 13; |
||||
} |
||||
|
||||
datagrid input.text |
||||
{ |
||||
width: 100%; |
||||
height: auto; |
||||
margin: 0px; |
||||
padding: 0px 2px 0px; |
||||
|
||||
border-width: 1px; |
||||
border-color: black; |
||||
background-color: white; |
||||
|
||||
font-size: 15; |
||||
|
||||
background-decorator: none; |
||||
} |
||||
|
||||
|
||||
|
||||
select, |
||||
dataselect |
||||
{ |
||||
width: 175px; |
||||
height: 37px; |
||||
} |
||||
|
||||
select selectvalue, |
||||
dataselect selectvalue |
||||
{ |
||||
width: auto; |
||||
margin-right: 30px; |
||||
|
||||
height: 28px; |
||||
padding: 9px 10px 0px 10px; |
||||
|
||||
background-decorator: image; |
||||
background-image: invader.tga 162px 192px 307px 229px; |
||||
} |
||||
|
||||
select selectvalue:hover, |
||||
dataselect selectvalue:hover |
||||
{ |
||||
background-image-t: 230px 267px; |
||||
} |
||||
|
||||
select selectarrow, |
||||
dataselect selectarrow |
||||
{ |
||||
width: 30px; |
||||
height: 37px; |
||||
|
||||
icon-decorator: image; |
||||
icon-image: invader.tga 307px 192px 337px 229px; |
||||
} |
||||
|
||||
select selectarrow:hover, |
||||
dataselect selectarrow:hover |
||||
{ |
||||
icon-image-t: 230px 267px; |
||||
} |
||||
|
||||
select selectarrow:active, |
||||
select selectarrow:checked, |
||||
dataselect selectarrow:active, |
||||
dataselect selectarrow:checked |
||||
{ |
||||
icon-image-t: 268px 305px; |
||||
} |
||||
|
||||
select selectbox, |
||||
dataselect selectbox |
||||
{ |
||||
margin-left: 1px; |
||||
margin-top: -7px; |
||||
width: 162px; |
||||
padding: 1px 4px 4px 4px; |
||||
} |
||||
|
||||
select selectbox, |
||||
dataselect selectbox, |
||||
datagrid datagridbody |
||||
{ |
||||
background-decorator: tiled-box; |
||||
background-top-left-image: invader.tga 281px 275px 292px 284px; |
||||
background-top-right-image: invader.tga 294px 275px 305px 284px; |
||||
background-top-image: invader.tga stretch 292px 275px 293px 284px; |
||||
background-bottom-left-image: invader.tga 281px 285px 292px 296px; |
||||
background-bottom-right-image: invader.tga 294px 285px 305px 296px; |
||||
background-bottom-image: invader.tga stretch 292px 285px 293px 296px; |
||||
background-left-image: invader.tga stretch 281px 283px 292px 284px; |
||||
background-center-image: invader.tga stretch 292px 283px 293px 284px; |
||||
} |
||||
|
||||
select selectbox option, |
||||
dataselect selectbox option |
||||
{ |
||||
width: auto; |
||||
padding-left: 3px; |
||||
} |
||||
|
||||
select selectbox option:nth-child(even), |
||||
dataselect selectbox option:nth-child(even), |
||||
datagrid datagridrow:nth-child(even) |
||||
{ |
||||
background: #FFFFFFA0; |
||||
} |
||||
|
||||
select selectbox option:hover, |
||||
dataselect selectbox option:hover |
||||
{ |
||||
background: #FF5D5D; |
||||
} |
||||
|
||||
|
||||
|
||||
input.radio, |
||||
input.checkbox |
||||
{ |
||||
width: 30px; |
||||
height: 30px; |
||||
|
||||
vertical-align: -11px; |
||||
} |
||||
|
||||
input.radio |
||||
{ |
||||
icon-decorator: image; |
||||
icon-image: invader.tga 407px 0px 437px 30px; |
||||
} |
||||
|
||||
input.radio:hover |
||||
{ |
||||
icon-image-s: 437px 467px; |
||||
} |
||||
|
||||
input.radio:active |
||||
{ |
||||
icon-image-s: 467px 497px; |
||||
} |
||||
|
||||
input.radio:checked |
||||
{ |
||||
icon-image-t: 30px 60px; |
||||
} |
||||
|
||||
input.radio:checked:hover |
||||
{ |
||||
icon-image-s: 437px 467px; |
||||
icon-image-t: 30px 60px; |
||||
} |
||||
|
||||
input.radio:checked:active |
||||
{ |
||||
icon-image-s: 467px 497px; |
||||
icon-image-t: 30px 60px; |
||||
} |
||||
|
||||
input.checkbox |
||||
{ |
||||
icon-decorator: image; |
||||
icon-image: invader.tga 407px 60px 437px 90px; |
||||
} |
||||
|
||||
input.checkbox:hover |
||||
{ |
||||
icon-image-s: 437px 467px; |
||||
} |
||||
|
||||
input.checkbox:active |
||||
{ |
||||
icon-image-s: 467px 497px; |
||||
} |
||||
|
||||
input.checkbox:checked |
||||
{ |
||||
icon-image-t: 90px 120px; |
||||
} |
||||
|
||||
input.checkbox:checked:hover |
||||
{ |
||||
icon-image-s: 437px 467px; |
||||
icon-image-t: 90px 120px; |
||||
} |
||||
|
||||
input.checkbox:checked:active |
||||
{ |
||||
icon-image-s: 467px 497px; |
||||
icon-image-t: 90px 120px; |
||||
} |
||||
|
||||
|
||||
|
||||
datagrid datagridheader |
||||
{ |
||||
width: auto; |
||||
height: 25px; |
||||
padding: 5px 10px 0px 10px; |
||||
|
||||
background-decorator: tiled-horizontal; |
||||
background-left-image: invader.tga 127px 192px 143px 223px; |
||||
background-center-image: invader.tga stretch 143px 192px 145px 223px; |
||||
background-right-image: invader.tga 145px 192px 160px 223px; |
||||
} |
||||
|
||||
datagrid datagridbody |
||||
{ |
||||
color: black; |
||||
|
||||
margin-left: 4px; |
||||
margin-right: 3px; |
||||
padding: 0px 4px 4px 4px; |
||||
} |
||||
|
||||
|
||||
|
||||
datagridexpand |
||||
{ |
||||
display: block; |
||||
|
||||
margin: 1px 0px 1px 5px; |
||||
height: 17px; |
||||
width: 17px; |
||||
|
||||
icon-decorator: image; |
||||
icon-image: invader.tga 3px 232px 20px 249px; |
||||
} |
||||
|
||||
datagridexpand:hover |
||||
{ |
||||
icon-image-s: 21px 38px; |
||||
} |
||||
|
||||
datagridexpand:active |
||||
{ |
||||
icon-image-s: 39px 56px; |
||||
} |
||||
|
||||
datagridexpand.collapsed |
||||
{ |
||||
icon-image-t: 250px 267px; |
||||
} |
||||
|
||||
|
||||
|
||||
scrollbarvertical |
||||
{ |
||||
margin-top: -6px; |
||||
margin-bottom: -6px; |
||||
margin-right: -11px; |
||||
width: 27px; |
||||
} |
||||
|
||||
scrollbarvertical slidertrack |
||||
{ |
||||
background-decorator: tiled-vertical; |
||||
background-top-image: invader.tga 70px 199px 97px 201px; |
||||
background-center-image: invader.tga stretch 70px 201px 97px 202px; |
||||
background-bottom-image: invader.tga 70px 203px 97px 204px; |
||||
} |
||||
|
||||
scrollbarvertical sliderbar |
||||
{ |
||||
margin-left: 4px; |
||||
width: 23px; |
||||
min-height: 46px; |
||||
|
||||
background-decorator: tiled-vertical; |
||||
background-top-image: invader.tga 56px 152px 79px 175px; |
||||
background-center-image: invader.tga stretch 56px 175px 79px 175px; |
||||
background-bottom-image: invader.tga 56px 176px 79px 198px; |
||||
} |
||||
|
||||
scrollbarvertical sliderbar:hover |
||||
{ |
||||
background-top-image-s: 80px 103px; |
||||
background-center-image-s: 80px 103px; |
||||
background-bottom-image-s: 80px 103px; |
||||
} |
||||
|
||||
scrollbarvertical sliderbar:active |
||||
{ |
||||
background-top-image-s: 104px 127px; |
||||
background-center-image-s: 104px 127px; |
||||
background-bottom-image-s: 104px 127px; |
||||
} |
||||
|
||||
scrollbarvertical sliderarrowdec |
||||
{ |
||||
width: 27px; |
||||
height: 24px; |
||||
|
||||
icon-decorator: image; |
||||
icon-image: invader.tga 0px 152px 27px 176px; |
||||
} |
||||
|
||||
scrollbarvertical sliderarrowdec:hover, |
||||
scrollbarvertical sliderarrowinc:hover |
||||
{ |
||||
icon-image-t: 177px 201px; |
||||
} |
||||
|
||||
scrollbarvertical sliderarrowdec:active, |
||||
scrollbarvertical sliderarrowinc:active |
||||
{ |
||||
icon-image-t: 202px 226px; |
||||
} |
||||
|
||||
scrollbarvertical sliderarrowinc |
||||
{ |
||||
width: 27px; |
||||
height: 24px; |
||||
|
||||
icon-decorator: image; |
||||
icon-image: invader.tga 28px 152px 55px 176px; |
||||
} |
||||
|
||||
|
||||
|
||||
scrollbarhorizontal |
||||
{ |
||||
width: 0px; |
||||
height: 0px; |
||||
} |
@ -1,56 +0,0 @@
@@ -1,56 +0,0 @@
|
||||
<rml> |
||||
<head> |
||||
<link type="text/rcss" href="default.rcss"/> |
||||
<link type="text/rcss" href="menu.rcss"/> |
||||
<title>Title</title> |
||||
</head> |
||||
<body> |
||||
<div id="toggle-group"> |
||||
<button id="ToggleButton" class="square"></button> |
||||
</div> |
||||
<div id="menu-group"> |
||||
<button id="ConsoleButton">Console</button> |
||||
<button id="NewButton">New Game</button> |
||||
<button id="RestartButton">Restart</button> |
||||
<button id="ToggleOptions">Options</button> |
||||
</div> |
||||
|
||||
|
||||
<div id="Options" class="window"> |
||||
<form id="test"> |
||||
|
||||
<div> |
||||
<h1>Runtime Compiler:</h1> |
||||
</div> |
||||
<div class="options"> |
||||
<p> |
||||
Auto Compile:<input type="checkbox" id="autocompilecheckbox" value="checked" checked="y"/> |
||||
Fast Compile:<input type="checkbox" id="fastcompilecheckbox" value="checked"/> |
||||
Optimize for Debug:<input type="checkbox" id="optimizefordebug" value="checked"/> |
||||
</p> |
||||
<p> |
||||
<button id="TestRCCpp">Test RCC++</button> |
||||
Test File Tracking:<input type="checkbox" id="TestFileTracking" value="checked" checked="y"/> |
||||
</p> |
||||
<p>Testing RCC++ will touch each RCC++ file in turn to test compilation. This can take significant time.</p> |
||||
<button id="UndoRCCpp">Undo RCC++</button> |
||||
<button id="RedoRCCpp">Redo RCC++</button> |
||||
</div> |
||||
|
||||
<div> |
||||
<h1>Game:</h1> |
||||
</div> |
||||
<div class="options"> |
||||
<p> |
||||
Speed: <input type="range" id="speedslider" name="speed" value="1" min="0" max="5" step="0.05" /> |
||||
Pause:<input type="checkbox" id="pausecheckbox" value="checked"/> |
||||
</p> |
||||
</div> |
||||
|
||||
</form> |
||||
</div> |
||||
|
||||
|
||||
|
||||
</body> |
||||
</rml> |
@ -1,17 +0,0 @@
@@ -1,17 +0,0 @@
|
||||
body |
||||
{ |
||||
font-family: Delicious; |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
font-size: 20; |
||||
color: white; |
||||
} |
||||
|
||||
img#splash |
||||
{ |
||||
z-index: -1; |
||||
|
||||
position: absolute; |
||||
} |
||||
|
||||
|
@ -1,10 +0,0 @@
@@ -1,10 +0,0 @@
|
||||
<rml> |
||||
<head> |
||||
<link type="text/rcss" href="default.rcss"/> |
||||
<link type="text/rcss" href="splashscreen.rcss"/> |
||||
<title>SplashScreen</title> |
||||
</head> |
||||
<body> |
||||
<img id="splash" src=""/> |
||||
</body> |
||||
</rml> |
Before Width: | Height: | Size: 1.0 MiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,12 +0,0 @@
@@ -1,12 +0,0 @@
|
||||
Following sound files from sources downloaded from freesound.org: |
||||
|
||||
62912_Benboncan_Heartbeat_Mono_shortloop.wav |
||||
Source: 62912_Benboncan_Heartbeat_Mono.wav |
||||
Author: Benboncan |
||||
|
||||
The work is licensed under a Creative Commons Sampling Plus 1.0 License. |
||||
|
||||
http://creativecommons.org/licenses/sampling+/1.0/ |
||||
|
||||
|
||||
|
@ -1,157 +0,0 @@
@@ -1,157 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00 |
||||
# Visual Studio 2010 |
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RuntimeCompiler_VS2010", "RuntimeCompiler\RuntimeCompiler_VS2010.vcxproj", "{790D95ED-C6E6-24E5-345B-37FB1E098082}" |
||||
EndProject |
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimpleTest", "Examples\SimpleTest\SimpleTest.vcxproj", "{D80E22AA-64AF-4542-A583-DC0AE69CC88B}" |
||||
ProjectSection(ProjectDependencies) = postProject |
||||
{1AAC0B29-AEB9-4E3F-8EDF-B46F8949C41B} = {1AAC0B29-AEB9-4E3F-8EDF-B46F8949C41B} |
||||
{1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41A} = {1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41A} |
||||
{1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41B} = {1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41B} |
||||
{BD166836-4A63-47F6-A8A7-A535D99A5F75} = {BD166836-4A63-47F6-A8A7-A535D99A5F75} |
||||
{2947A63C-A245-4853-B4CC-476354188AEE} = {2947A63C-A245-4853-B4CC-476354188AEE} |
||||
{26DDDB96-4A8E-4A1B-997C-970DE0CCCE37} = {26DDDB96-4A8E-4A1B-997C-970DE0CCCE37} |
||||
{790D95ED-C6E6-24E5-345B-37FB1E098082} = {790D95ED-C6E6-24E5-345B-37FB1E098082} |
||||
{FA4E24F1-885C-406B-89A8-436F28D090B2} = {FA4E24F1-885C-406B-89A8-436F28D090B2} |
||||
EndProjectSection |
||||
EndProject |
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Systems", "Systems\Systems.vcxproj", "{BD166836-4A63-47F6-A8A7-A535D99A5F75}" |
||||
ProjectSection(ProjectDependencies) = postProject |
||||
{1AAC0B29-AEB9-4E3F-8EDF-B46F8949C41B} = {1AAC0B29-AEB9-4E3F-8EDF-B46F8949C41B} |
||||
{1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41A} = {1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41A} |
||||
{1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41B} = {1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41B} |
||||
{2947A63C-A245-4853-B4CC-476354188AEE} = {2947A63C-A245-4853-B4CC-476354188AEE} |
||||
{26DDDB96-4A8E-4A1B-997C-970DE0CCCE37} = {26DDDB96-4A8E-4A1B-997C-970DE0CCCE37} |
||||
{790D95ED-C6E6-24E5-345B-37FB1E098082} = {790D95ED-C6E6-24E5-345B-37FB1E098082} |
||||
{FA4E24F1-885C-406B-89A8-436F28D090B2} = {FA4E24F1-885C-406B-89A8-436F28D090B2} |
||||
EndProjectSection |
||||
EndProject |
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Renderer_VS2010", "Renderer\Renderer_VS2010.vcxproj", "{26DDDB96-4A8E-4A1B-997C-970DE0CCCE37}" |
||||
EndProject |
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Common_2010", "Common\Common_2010.vcxproj", "{2947A63C-A245-4853-B4CC-476354188AEE}" |
||||
EndProject |
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RocketCore", "External\libRocket\Build\RocketCore.vcxproj", "{1AAC0B29-AEB9-4E3F-8EDF-B46F8949C41B}" |
||||
EndProject |
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RocketControls", "External\libRocket\Build\RocketControls.vcxproj", "{1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41B}" |
||||
EndProject |
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RocketDebugger", "External\libRocket\Build\RocketDebugger.vcxproj", "{1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41A}" |
||||
ProjectSection(ProjectDependencies) = postProject |
||||
{1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41B} = {1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41B} |
||||
EndProjectSection |
||||
EndProject |
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConsoleExample", "Examples\ConsoleExample\ConsoleExample.vcxproj", "{B95544FF-96D5-4395-8E62-C02A512534D7}" |
||||
ProjectSection(ProjectDependencies) = postProject |
||||
{BD166836-4A63-47F6-A8A7-A535D99A5F75} = {BD166836-4A63-47F6-A8A7-A535D99A5F75} |
||||
{2947A63C-A245-4853-B4CC-476354188AEE} = {2947A63C-A245-4853-B4CC-476354188AEE} |
||||
{790D95ED-C6E6-24E5-345B-37FB1E098082} = {790D95ED-C6E6-24E5-345B-37FB1E098082} |
||||
{FA4E24F1-885C-406B-89A8-436F28D090B2} = {FA4E24F1-885C-406B-89A8-436F28D090B2} |
||||
EndProjectSection |
||||
EndProject |
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RuntimeObjectSystem", "RuntimeObjectSystem\RuntimeObjectSystem.vcxproj", "{FA4E24F1-885C-406B-89A8-436F28D090B2}" |
||||
ProjectSection(ProjectDependencies) = postProject |
||||
{790D95ED-C6E6-24E5-345B-37FB1E098082} = {790D95ED-C6E6-24E5-345B-37FB1E098082} |
||||
EndProjectSection |
||||
EndProject |
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glfw", "External\glfw\projects\glfw.vcxproj", "{C00481F6-9574-41A5-990F-1F1C30B7AD6F}" |
||||
EndProject |
||||
Global |
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
||||
Debug|Win32 = Debug|Win32 |
||||
Debug|x64 = Debug|x64 |
||||
Release|Win32 = Release|Win32 |
||||
Release|x64 = Release|x64 |
||||
EndGlobalSection |
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
||||
{790D95ED-C6E6-24E5-345B-37FB1E098082}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||
{790D95ED-C6E6-24E5-345B-37FB1E098082}.Debug|Win32.Build.0 = Debug|Win32 |
||||
{790D95ED-C6E6-24E5-345B-37FB1E098082}.Debug|x64.ActiveCfg = Debug|x64 |
||||
{790D95ED-C6E6-24E5-345B-37FB1E098082}.Debug|x64.Build.0 = Debug|x64 |
||||
{790D95ED-C6E6-24E5-345B-37FB1E098082}.Release|Win32.ActiveCfg = Release|Win32 |
||||
{790D95ED-C6E6-24E5-345B-37FB1E098082}.Release|Win32.Build.0 = Release|Win32 |
||||
{790D95ED-C6E6-24E5-345B-37FB1E098082}.Release|x64.ActiveCfg = Release|x64 |
||||
{790D95ED-C6E6-24E5-345B-37FB1E098082}.Release|x64.Build.0 = Release|x64 |
||||
{D80E22AA-64AF-4542-A583-DC0AE69CC88B}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||
{D80E22AA-64AF-4542-A583-DC0AE69CC88B}.Debug|Win32.Build.0 = Debug|Win32 |
||||
{D80E22AA-64AF-4542-A583-DC0AE69CC88B}.Debug|x64.ActiveCfg = Debug|x64 |
||||
{D80E22AA-64AF-4542-A583-DC0AE69CC88B}.Debug|x64.Build.0 = Debug|x64 |
||||
{D80E22AA-64AF-4542-A583-DC0AE69CC88B}.Release|Win32.ActiveCfg = Release|Win32 |
||||
{D80E22AA-64AF-4542-A583-DC0AE69CC88B}.Release|Win32.Build.0 = Release|Win32 |
||||
{D80E22AA-64AF-4542-A583-DC0AE69CC88B}.Release|x64.ActiveCfg = Release|x64 |
||||
{D80E22AA-64AF-4542-A583-DC0AE69CC88B}.Release|x64.Build.0 = Release|x64 |
||||
{BD166836-4A63-47F6-A8A7-A535D99A5F75}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||
{BD166836-4A63-47F6-A8A7-A535D99A5F75}.Debug|Win32.Build.0 = Debug|Win32 |
||||
{BD166836-4A63-47F6-A8A7-A535D99A5F75}.Debug|x64.ActiveCfg = Debug|x64 |
||||
{BD166836-4A63-47F6-A8A7-A535D99A5F75}.Debug|x64.Build.0 = Debug|x64 |
||||
{BD166836-4A63-47F6-A8A7-A535D99A5F75}.Release|Win32.ActiveCfg = Release|Win32 |
||||
{BD166836-4A63-47F6-A8A7-A535D99A5F75}.Release|Win32.Build.0 = Release|Win32 |
||||
{BD166836-4A63-47F6-A8A7-A535D99A5F75}.Release|x64.ActiveCfg = Release|x64 |
||||
{BD166836-4A63-47F6-A8A7-A535D99A5F75}.Release|x64.Build.0 = Release|x64 |
||||
{26DDDB96-4A8E-4A1B-997C-970DE0CCCE37}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||
{26DDDB96-4A8E-4A1B-997C-970DE0CCCE37}.Debug|Win32.Build.0 = Debug|Win32 |
||||
{26DDDB96-4A8E-4A1B-997C-970DE0CCCE37}.Debug|x64.ActiveCfg = Debug|x64 |
||||
{26DDDB96-4A8E-4A1B-997C-970DE0CCCE37}.Debug|x64.Build.0 = Debug|x64 |
||||
{26DDDB96-4A8E-4A1B-997C-970DE0CCCE37}.Release|Win32.ActiveCfg = Release|Win32 |
||||
{26DDDB96-4A8E-4A1B-997C-970DE0CCCE37}.Release|Win32.Build.0 = Release|Win32 |
||||
{26DDDB96-4A8E-4A1B-997C-970DE0CCCE37}.Release|x64.ActiveCfg = Release|x64 |
||||
{26DDDB96-4A8E-4A1B-997C-970DE0CCCE37}.Release|x64.Build.0 = Release|x64 |
||||
{2947A63C-A245-4853-B4CC-476354188AEE}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||
{2947A63C-A245-4853-B4CC-476354188AEE}.Debug|Win32.Build.0 = Debug|Win32 |
||||
{2947A63C-A245-4853-B4CC-476354188AEE}.Debug|x64.ActiveCfg = Debug|x64 |
||||
{2947A63C-A245-4853-B4CC-476354188AEE}.Debug|x64.Build.0 = Debug|x64 |
||||
{2947A63C-A245-4853-B4CC-476354188AEE}.Release|Win32.ActiveCfg = Release|Win32 |
||||
{2947A63C-A245-4853-B4CC-476354188AEE}.Release|Win32.Build.0 = Release|Win32 |
||||
{2947A63C-A245-4853-B4CC-476354188AEE}.Release|x64.ActiveCfg = Release|x64 |
||||
{2947A63C-A245-4853-B4CC-476354188AEE}.Release|x64.Build.0 = Release|x64 |
||||
{1AAC0B29-AEB9-4E3F-8EDF-B46F8949C41B}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||
{1AAC0B29-AEB9-4E3F-8EDF-B46F8949C41B}.Debug|Win32.Build.0 = Debug|Win32 |
||||
{1AAC0B29-AEB9-4E3F-8EDF-B46F8949C41B}.Debug|x64.ActiveCfg = Debug|x64 |
||||
{1AAC0B29-AEB9-4E3F-8EDF-B46F8949C41B}.Debug|x64.Build.0 = Debug|x64 |
||||
{1AAC0B29-AEB9-4E3F-8EDF-B46F8949C41B}.Release|Win32.ActiveCfg = Release|Win32 |
||||
{1AAC0B29-AEB9-4E3F-8EDF-B46F8949C41B}.Release|Win32.Build.0 = Release|Win32 |
||||
{1AAC0B29-AEB9-4E3F-8EDF-B46F8949C41B}.Release|x64.ActiveCfg = Release|x64 |
||||
{1AAC0B29-AEB9-4E3F-8EDF-B46F8949C41B}.Release|x64.Build.0 = Release|x64 |
||||
{1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41B}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||
{1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41B}.Debug|Win32.Build.0 = Debug|Win32 |
||||
{1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41B}.Debug|x64.ActiveCfg = Debug|x64 |
||||
{1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41B}.Debug|x64.Build.0 = Debug|x64 |
||||
{1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41B}.Release|Win32.ActiveCfg = Release|Win32 |
||||
{1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41B}.Release|Win32.Build.0 = Release|Win32 |
||||
{1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41B}.Release|x64.ActiveCfg = Release|x64 |
||||
{1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41B}.Release|x64.Build.0 = Release|x64 |
||||
{1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41A}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||
{1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41A}.Debug|Win32.Build.0 = Debug|Win32 |
||||
{1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41A}.Debug|x64.ActiveCfg = Debug|x64 |
||||
{1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41A}.Debug|x64.Build.0 = Debug|x64 |
||||
{1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41A}.Release|Win32.ActiveCfg = Release|Win32 |
||||
{1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41A}.Release|Win32.Build.0 = Release|Win32 |
||||
{1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41A}.Release|x64.ActiveCfg = Release|x64 |
||||
{1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41A}.Release|x64.Build.0 = Release|x64 |
||||
{B95544FF-96D5-4395-8E62-C02A512534D7}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||
{B95544FF-96D5-4395-8E62-C02A512534D7}.Debug|Win32.Build.0 = Debug|Win32 |
||||
{B95544FF-96D5-4395-8E62-C02A512534D7}.Debug|x64.ActiveCfg = Debug|x64 |
||||
{B95544FF-96D5-4395-8E62-C02A512534D7}.Debug|x64.Build.0 = Debug|x64 |
||||
{B95544FF-96D5-4395-8E62-C02A512534D7}.Release|Win32.ActiveCfg = Release|Win32 |
||||
{B95544FF-96D5-4395-8E62-C02A512534D7}.Release|Win32.Build.0 = Release|Win32 |
||||
{B95544FF-96D5-4395-8E62-C02A512534D7}.Release|x64.ActiveCfg = Release|x64 |
||||
{B95544FF-96D5-4395-8E62-C02A512534D7}.Release|x64.Build.0 = Release|x64 |
||||
{FA4E24F1-885C-406B-89A8-436F28D090B2}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||
{FA4E24F1-885C-406B-89A8-436F28D090B2}.Debug|Win32.Build.0 = Debug|Win32 |
||||
{FA4E24F1-885C-406B-89A8-436F28D090B2}.Debug|x64.ActiveCfg = Debug|x64 |
||||
{FA4E24F1-885C-406B-89A8-436F28D090B2}.Debug|x64.Build.0 = Debug|x64 |
||||
{FA4E24F1-885C-406B-89A8-436F28D090B2}.Release|Win32.ActiveCfg = Release|Win32 |
||||
{FA4E24F1-885C-406B-89A8-436F28D090B2}.Release|Win32.Build.0 = Release|Win32 |
||||
{FA4E24F1-885C-406B-89A8-436F28D090B2}.Release|x64.ActiveCfg = Release|x64 |
||||
{FA4E24F1-885C-406B-89A8-436F28D090B2}.Release|x64.Build.0 = Release|x64 |
||||
{C00481F6-9574-41A5-990F-1F1C30B7AD6F}.Debug|Win32.ActiveCfg = Debug|Win32 |
||||
{C00481F6-9574-41A5-990F-1F1C30B7AD6F}.Debug|Win32.Build.0 = Debug|Win32 |
||||
{C00481F6-9574-41A5-990F-1F1C30B7AD6F}.Debug|x64.ActiveCfg = Debug|x64 |
||||
{C00481F6-9574-41A5-990F-1F1C30B7AD6F}.Debug|x64.Build.0 = Debug|x64 |
||||
{C00481F6-9574-41A5-990F-1F1C30B7AD6F}.Release|Win32.ActiveCfg = Release|Win32 |
||||
{C00481F6-9574-41A5-990F-1F1C30B7AD6F}.Release|Win32.Build.0 = Release|Win32 |
||||
{C00481F6-9574-41A5-990F-1F1C30B7AD6F}.Release|x64.ActiveCfg = Release|x64 |
||||
{C00481F6-9574-41A5-990F-1F1C30B7AD6F}.Release|x64.Build.0 = Release|x64 |
||||
EndGlobalSection |
||||
GlobalSection(SolutionProperties) = preSolution |
||||
HideSolutionNode = FALSE |
||||
EndGlobalSection |
||||
EndGlobal |
@ -1,26 +0,0 @@
@@ -1,26 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<ImportGroup Label="PropertySheets" /> |
||||
<PropertyGroup Label="UserMacros" /> |
||||
<PropertyGroup> |
||||
<IncludePath>$(VC_IncludePath);$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;$(WindowsSDK_IncludePath)</IncludePath> |
||||
<LibraryPath>$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSdkDir)lib\x64;$(FrameworkSDKDir)\lib\amd64</LibraryPath> |
||||
</PropertyGroup> |
||||
<ItemDefinitionGroup> |
||||
<Lib> |
||||
<AdditionalDependencies> |
||||
</AdditionalDependencies> |
||||
</Lib> |
||||
</ItemDefinitionGroup> |
||||
<ItemDefinitionGroup> |
||||
<Lib> |
||||
<AdditionalLibraryDirectories> |
||||
</AdditionalLibraryDirectories> |
||||
</Lib> |
||||
<ClCompile> |
||||
<AdditionalIncludeDirectories>$(SolutionDir)\External\libRocket\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> |
||||
</ClCompile> |
||||
</ItemDefinitionGroup> |
||||
<ItemGroup /> |
||||
</Project> |
@ -1,26 +0,0 @@
@@ -1,26 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<ImportGroup Label="PropertySheets" /> |
||||
<PropertyGroup Label="UserMacros" /> |
||||
<PropertyGroup> |
||||
<IncludePath>$(VC_IncludePath);$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;$(WindowsSDK_IncludePath)</IncludePath> |
||||
<LibraryPath>$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib</LibraryPath> |
||||
</PropertyGroup> |
||||
<ItemDefinitionGroup> |
||||
<Lib> |
||||
<AdditionalDependencies> |
||||
</AdditionalDependencies> |
||||
</Lib> |
||||
</ItemDefinitionGroup> |
||||
<ItemDefinitionGroup> |
||||
<Lib> |
||||
<AdditionalLibraryDirectories> |
||||
</AdditionalLibraryDirectories> |
||||
</Lib> |
||||
<ClCompile> |
||||
<AdditionalIncludeDirectories>$(SolutionDir)\External\libRocket\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> |
||||
</ClCompile> |
||||
</ItemDefinitionGroup> |
||||
<ItemGroup /> |
||||
</Project> |
@ -1,179 +0,0 @@
@@ -1,179 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.12) |
||||
|
||||
project( RuntimeCompiledCPlusPlus ) |
||||
# |
||||
# Options |
||||
# |
||||
option(BUILD_EXAMPLES "Build example applications" ON) |
||||
option(GLFW_SYSTEM "Use the operating system glfw library" OFF) |
||||
|
||||
if(UNIX AND NOT APPLE) |
||||
set(BUILD_TYPE SHARED) |
||||
else() |
||||
set(BUILD_TYPE STATIC) |
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) |
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) |
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) |
||||
endif() |
||||
|
||||
include(cmake/ProjectFiles.cmake) |
||||
|
||||
# |
||||
# RuntimeCompiler |
||||
# |
||||
add_library(RuntimeCompiler ${BUILD_TYPE} ${RuntimeCompiler_SRCS}) |
||||
|
||||
# |
||||
# RuntimeObjectSystem |
||||
# |
||||
add_library(RuntimeObjectSystem ${BUILD_TYPE} ${RuntimeObjectSystem_SRCS}) |
||||
target_link_libraries(RuntimeObjectSystem RuntimeCompiler) |
||||
if(UNIX) |
||||
target_link_libraries(RuntimeObjectSystem dl) |
||||
endif() |
||||
|
||||
if(MSVC) |
||||
# ensure the files are compiled with full paths and utf-8 so that __FILE__ macros are in utf-8 encoding |
||||
set_target_properties(RuntimeCompiler RuntimeObjectSystem PROPERTIES COMPILE_FLAGS "/FC /utf-8") |
||||
endif() |
||||
|
||||
# |
||||
# Make Install |
||||
# |
||||
install(DIRECTORY RuntimeObjectSystem/ DESTINATION ${CMAKE_INSTALL_PREFIX}/include/RuntimeObjectSystem |
||||
FILES_MATCHING PATTERN "*.h") |
||||
install(DIRECTORY RuntimeCompiler/ DESTINATION ${CMAKE_INSTALL_PREFIX}/include/RuntimeCompiler |
||||
FILES_MATCHING PATTERN "*.h") |
||||
install(TARGETS RuntimeObjectSystem RuntimeCompiler |
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/) |
||||
|
||||
if(BUILD_EXAMPLES) |
||||
|
||||
|
||||
# |
||||
# ConsoleExample |
||||
# |
||||
|
||||
add_executable(ConsoleExample ${ConsoleExample_SRCS}) |
||||
target_link_libraries(ConsoleExample RuntimeCompiler RuntimeObjectSystem) |
||||
|
||||
|
||||
find_package(OpenGL) |
||||
if(OpenGL_FOUND) |
||||
# |
||||
# Renderer |
||||
# |
||||
|
||||
add_library(Renderer ${BUILD_TYPE} ${Renderer_SRCS}) |
||||
target_link_libraries(Renderer ${OPENGL_LIBRARIES} ${ASSIMP_LIBRARIES}) |
||||
|
||||
# |
||||
# Systems |
||||
# |
||||
|
||||
add_library(Systems ${BUILD_TYPE} ${Systems_SRCS}) |
||||
|
||||
# |
||||
# Freetype WIN32 |
||||
# |
||||
|
||||
if(WIN32) |
||||
set(FREETYPE_INCLUDE_DIR_freetype2 ${CMAKE_SOURCE_DIR}/External/support/freetype/include/freetype) |
||||
set(FREETYPE_INCLUDE_DIR_ft2build ${CMAKE_SOURCE_DIR}/External/support/freetype/include) |
||||
if(${CMAKE_CL_64}) |
||||
set(FREETYPE_LIBRARY ${CMAKE_SOURCE_DIR}/External/support/lib/freetype2410MTx64.lib) |
||||
else() |
||||
set(FREETYPE_LIBRARY ${CMAKE_SOURCE_DIR}/External/support/lib/freetype2410MT.lib) |
||||
endif() |
||||
elseif(APPLE) |
||||
set(FREETYPE_INCLUDE_DIR_freetype2 ${CMAKE_SOURCE_DIR}/External/support/freetype/include/freetype) |
||||
set(FREETYPE_INCLUDE_DIR_ft2build ${CMAKE_SOURCE_DIR}/External/support/freetype/include) |
||||
FIND_LIBRARY(ZLIB_LIBRARY libs) |
||||
MARK_AS_ADVANCED(ZLIB_LIBRARY) |
||||
set(FREETYPE_LIBRARY ${CMAKE_SOURCE_DIR}/External/support/lib/MacOSX/libfreetype.a ${ZLIB_LIBRARY}) |
||||
endif() |
||||
|
||||
# |
||||
# glfw |
||||
# |
||||
if(GLFW_SYSTEM) |
||||
set(GLFW_LIBRARIES glfw) |
||||
else() |
||||
include_directories(External/glfw/include) |
||||
if(WIN32) |
||||
set(GLFW_LIBRARIES glfw winmm) |
||||
add_subdirectory( ${CMAKE_SOURCE_DIR}/External/glfw/projects ) |
||||
else() |
||||
add_library( glfw STATIC IMPORTED ) |
||||
if(APPLE) |
||||
FIND_LIBRARY(COCOA_LIBRARY Cocoa) |
||||
FIND_LIBRARY(IOKIT_LIBRARY IOKit) |
||||
MARK_AS_ADVANCED(COCOA_LIBRARY IOKIT_LIBRARY) |
||||
set_target_properties( glfw PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/External/glfw/libOSX/libglfw.a ) |
||||
set(GLFW_LIBRARIES glfw ${COCOA_LIBRARY} ${IOKIT_LIBRARY}) |
||||
else() |
||||
set_target_properties( glfw PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/External/glfw/libX11/libglfw.a ) |
||||
set(GLFW_LIBRARIES glfw X11 pthread) |
||||
endif() |
||||
endif() |
||||
endif() |
||||
|
||||
# |
||||
# assimp |
||||
# |
||||
|
||||
if(WIN32) |
||||
add_library( assimp STATIC IMPORTED ) |
||||
set(ASSIMP_LIBRARIES assimp) |
||||
if(${CMAKE_CL_64}) |
||||
set_target_properties( assimp PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/External/assimp/lib/assimp_release-dll_x64/assimp.lib ) |
||||
set(ASSIMP_DLL ${CMAKE_SOURCE_DIR}/External/assimp/bin/assimp_release-dll_win32/Assimp64.dll) |
||||
else() |
||||
set_target_properties( assimp PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/External/assimp/lib/assimp_release-dll_win32/assimp.lib ) |
||||
set(ASSIMP_DLL ${CMAKE_SOURCE_DIR}/External/assimp/bin/assimp_release-dll_win32/Assimp32.dll) |
||||
endif() |
||||
if(CMAKE_GENERATOR STREQUAL "NMake Makefiles") |
||||
file(COPY ${ASSIMP_DLL} DESTINATION ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) |
||||
else() |
||||
foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} ) |
||||
file(COPY ${ASSIMP_DLL} DESTINATION ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${OUTPUTCONFIG}) |
||||
endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES ) |
||||
endif() |
||||
endif() |
||||
|
||||
# |
||||
# SimpleTest |
||||
# |
||||
|
||||
add_subdirectory(External/libRocket/Build) |
||||
include_directories( |
||||
${OPENGL_INCLUDE_DIR} |
||||
External/libRocket/Include |
||||
External/assimp/include |
||||
) |
||||
if(WIN32) |
||||
add_executable(SimpleTest WIN32 ${SimpleTest_SRCS}) |
||||
else() |
||||
add_executable(SimpleTest ${SimpleTest_SRCS}) |
||||
endif() |
||||
target_link_libraries(SimpleTest |
||||
RuntimeCompiler |
||||
RuntimeObjectSystem |
||||
Renderer |
||||
Systems |
||||
RocketCore |
||||
RocketControls |
||||
RocketDebugger |
||||
${OPENGL_LIBRARIES} |
||||
${GLFW_LIBRARIES} |
||||
${ASSIMP_LIBRARIES} |
||||
) |
||||
if(MSVC) |
||||
set_target_properties(SimpleTest ConsoleExample PROPERTIES COMPILE_FLAGS "/FC /utf-8") |
||||
else() |
||||
add_compile_definitions(COMPILE_PATH="${CMAKE_BINARY_DIR}") |
||||
endif() |
||||
else() # OpenGL_FOUND |
||||
message(WARNING "OpenGL not found, not creating graphical example") |
||||
endif() # OpenGL_FOUND |
||||
endif() |
@ -1,11 +0,0 @@
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<projectDescription> |
||||
<name>Common</name> |
||||
<comment></comment> |
||||
<projects> |
||||
</projects> |
||||
<buildSpec> |
||||
</buildSpec> |
||||
<natures> |
||||
</natures> |
||||
</projectDescription> |
@ -1,55 +0,0 @@
@@ -1,55 +0,0 @@
|
||||
// |
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks |
||||
// |
||||
// This software is provided 'as-is', without any express or implied |
||||
// warranty. In no event will the authors be held liable for any damages |
||||
// arising from the use of this software. |
||||
// Permission is granted to anyone to use this software for any purpose, |
||||
// including commercial applications, and to alter it and redistribute it |
||||
// freely, subject to the following restrictions: |
||||
// 1. The origin of this software must not be misrepresented; you must not |
||||
// claim that you wrote the original software. If you use this software |
||||
// in a product, an acknowledgment in the product documentation would be |
||||
// appreciated but is not required. |
||||
// 2. Altered source versions must be plainly marked as such, and must not be |
||||
// misrepresented as being the original software. |
||||
// 3. This notice may not be removed or altered from any source distribution. |
||||
|
||||
#pragma once |
||||
#ifndef AUCOLOR_DEF |
||||
#define AUCOLOR_DEF |
||||
|
||||
#include <string.h> // for memcpy on linux |
||||
|
||||
class AUColor |
||||
{ |
||||
public: |
||||
AUColor(float Red = 0.0f, float Green = 0.0f, float Blue = 0.0f, float Alpha = 0.0f) |
||||
{ |
||||
m_Color.r = Red; |
||||
m_Color.g = Green; |
||||
m_Color.b = Blue; |
||||
m_Color.a = Alpha; |
||||
} |
||||
|
||||
AUColor( const float rgba[4] ) |
||||
{ |
||||
memcpy( m_Color.rgba, rgba, sizeof( m_Color.rgba ) ); |
||||
} |
||||
|
||||
union ColorUnion |
||||
{ |
||||
struct |
||||
{ |
||||
float r; |
||||
float g; |
||||
float b; |
||||
float a; |
||||
}; |
||||
float rgba[4]; |
||||
} m_Color; |
||||
|
||||
}; |
||||
|
||||
|
||||
#endif //AUCOLOR_DEF |
@ -1,184 +0,0 @@
@@ -1,184 +0,0 @@
|
||||
// |
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks |
||||
// |
||||
// This software is provided 'as-is', without any express or implied |
||||
// warranty. In no event will the authors be held liable for any damages |
||||
// arising from the use of this software. |
||||
// Permission is granted to anyone to use this software for any purpose, |
||||
// including commercial applications, and to alter it and redistribute it |
||||
// freely, subject to the following restrictions: |
||||
// 1. The origin of this software must not be misrepresented; you must not |
||||
// claim that you wrote the original software. If you use this software |
||||
// in a product, an acknowledgment in the product documentation would be |
||||
// appreciated but is not required. |
||||
// 2. Altered source versions must be plainly marked as such, and must not be |
||||
// misrepresented as being the original software. |
||||
// 3. This notice may not be removed or altered from any source distribution. |
||||
|
||||
#pragma once |
||||
#ifndef AUDORIENTATION3D_DEFINED |
||||
#define AUDORIENTATION3D_DEFINED |
||||
|
||||
#include "AUVec3f.inl" //interface relies on class AUVec3f |
||||
#include <limits> //for numerical limits |
||||
|
||||
|
||||
class AUOrientation3D |
||||
{ |
||||
public: |
||||
AUOrientation3D() : |
||||
m_v3dForwards( 1.0f, 0.0f, 0.0f ), |
||||
m_v3dUp( 0.0f, 1.0f, 0.0f ), |
||||
m_v3dRight( 0.0f, 0.0f, 1.0f ) |
||||
{ |
||||
} |
||||
|
||||
AUOrientation3D( const AUVec3f& v3dForwards_, const AUVec3f& v3dUp_) : |
||||
m_v3dForwards( v3dForwards_ ), |
||||
m_v3dUp( v3dUp_ ) |
||||
{ |
||||
OrthoNormalise(); |
||||
} |
||||
|
||||
//Inspectors |
||||
const AUVec3f& GetForwards() const { return m_v3dForwards; } |
||||
const AUVec3f& GetUp() const { return m_v3dUp; } |
||||
const AUVec3f& GetRight() const { return m_v3dRight; } |
||||
|
||||
void LoadglViewMatrix( float *const fglMatrix_ ) const |
||||
{ |
||||
//note: OpenGL camera defaults to looking down -z, thus orient z with Forwards |
||||
fglMatrix_[0] = m_v3dRight.x; |
||||
fglMatrix_[1] = m_v3dUp.x; |
||||
fglMatrix_[2] = -m_v3dForwards.x; |
||||
fglMatrix_[3] = 0.0f; |
||||
|
||||
fglMatrix_[4] = m_v3dRight.y; |
||||
fglMatrix_[5] = m_v3dUp.y; |
||||
fglMatrix_[6] = -m_v3dForwards.y; |
||||
fglMatrix_[7] = 0.0f; |
||||
|
||||
fglMatrix_[8] = m_v3dRight.z; |
||||
fglMatrix_[9] = m_v3dUp.z; |
||||
fglMatrix_[10] = -m_v3dForwards.z; |
||||
fglMatrix_[11] = 0.0f; |
||||
|
||||
fglMatrix_[12] = 0.0f; |
||||
fglMatrix_[13] = 0.0f; |
||||
fglMatrix_[14] = 0.0f; |
||||
fglMatrix_[15] = 1.0f; |
||||
} |
||||
|
||||
void LoadglObjectMatrix( float *const fglMatrix_ ) const |
||||
{ |
||||
//note: OpenGL camera defaults to looking down -z, thus orient z with Forwards |
||||
fglMatrix_[0] = m_v3dForwards.x; |
||||
fglMatrix_[1] = m_v3dForwards.y; |
||||
fglMatrix_[2] = m_v3dForwards.z; |
||||
fglMatrix_[3] = 0.0f; |
||||
|
||||
fglMatrix_[4] = m_v3dUp.x; |
||||
fglMatrix_[5] = m_v3dUp.y; |
||||
fglMatrix_[6] = m_v3dUp.z; |
||||
fglMatrix_[7] = 0.0f; |
||||
|
||||
fglMatrix_[8] = m_v3dRight.x; |
||||
fglMatrix_[9] = m_v3dRight.y; |
||||
fglMatrix_[10] = m_v3dRight.z; |
||||
fglMatrix_[11] = 0.0f; |
||||
|
||||
fglMatrix_[12] = 0.0f; |
||||
fglMatrix_[13] = 0.0f; |
||||
fglMatrix_[14] = 0.0f; |
||||
fglMatrix_[15] = 1.0f; |
||||
} |
||||
|
||||
//Mutators |
||||
AUVec3f& GetForwards() { return m_v3dForwards; } |
||||
AUVec3f& GetUp() { return m_v3dUp; } |
||||
AUVec3f& GetRight() { return m_v3dRight; } |
||||
|
||||
void Set( const AUVec3f& v3dForwards_, const AUVec3f& v3dUp_) |
||||
{ |
||||
m_v3dForwards = v3dForwards_; |
||||
m_v3dUp = v3dUp_; |
||||
OrthoNormalise(); |
||||
} |
||||
|
||||
void Rotate( const AUVec3f& v3dAxis_, float fTheta_) |
||||
{ |
||||
float fCosTheta = static_cast<float>( cos(fTheta_ ) ); |
||||
float fSinTheta = static_cast<float>( sin(fTheta_ ) ); |
||||
|
||||
AUVec3f v3dtemp = v3dAxis_.Cross( m_v3dForwards ); |
||||
m_v3dForwards += fSinTheta * v3dtemp + |
||||
( fCosTheta - 1.0f ) * v3dAxis_.Cross( v3dtemp ); |
||||
v3dtemp = v3dAxis_.Cross( m_v3dUp ); |
||||
m_v3dUp += fSinTheta * v3dtemp + |
||||
( fCosTheta - 1.0f ) * v3dAxis_.Cross( v3dtemp ); |
||||
|
||||
//orthonormalise coordinate system |
||||
OrthoNormalise(); |
||||
} |
||||
|
||||
protected: |
||||
void OrthoNormalise() |
||||
{ |
||||
if( true == m_v3dForwards.Normalise() ) |
||||
{ |
||||
//have a normalised forwards vector |
||||
m_v3dRight = m_v3dForwards.Cross( m_v3dUp ); |
||||
if( true == m_v3dRight.Normalise() ) |
||||
{ |
||||
//and now have a normalised right vector so safe to generate cross. |
||||
m_v3dUp = m_v3dRight.Cross( m_v3dForwards ); |
||||
} |
||||
else |
||||
{ |
||||
//have a forwards vector only, so generate an arbitary `up'. |
||||
m_v3dUp.SetX( m_v3dForwards.z ); |
||||
m_v3dUp.SetY( m_v3dForwards.x ); |
||||
m_v3dUp.SetZ( m_v3dForwards.y ); |
||||
|
||||
//will now get a 'guaranteed' right from this |
||||
m_v3dRight = m_v3dForwards.Cross( m_v3dUp ); |
||||
|
||||
//and so can generate a true up |
||||
m_v3dUp = m_v3dRight.Cross( m_v3dForwards ); |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
//can't use forwards as our main vector, so try up |
||||
if( true == m_v3dUp.Normalise() ) |
||||
{ |
||||
//have a up vector only, so generate an arbitary `up'. |
||||
m_v3dForwards.SetX( m_v3dUp.z ); |
||||
m_v3dForwards.SetY( m_v3dUp.x ); |
||||
m_v3dForwards.SetZ( m_v3dUp.y ); |
||||
|
||||
//will now get a 'guaranteed' right from this |
||||
m_v3dRight = m_v3dForwards.Cross( m_v3dUp ); |
||||
|
||||
//and so can generate a true forwards |
||||
m_v3dForwards = m_v3dUp.Cross( m_v3dRight ); |
||||
} |
||||
else |
||||
{ |
||||
//have no appropriate starting vectors, so fake it. |
||||
m_v3dForwards.Set( 1.0f, 0.0f, 0.0f ); |
||||
m_v3dUp.Set( 0.0f, 1.0f, 0.0f ); |
||||
m_v3dRight.Set( 0.0f, 0.0f, 1.0f ); |
||||
} |
||||
|
||||
} |
||||
} |
||||
|
||||
private: |
||||
AUVec3f m_v3dForwards; |
||||
AUVec3f m_v3dUp; |
||||
AUVec3f m_v3dRight; |
||||
|
||||
}; |
||||
|
||||
#endif //AUDORIENTATION3D_DEFINED |
@ -1,211 +0,0 @@
@@ -1,211 +0,0 @@
|
||||
// |
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks |
||||
// |
||||
// This software is provided 'as-is', without any express or implied |
||||
// warranty. In no event will the authors be held liable for any damages |
||||
// arising from the use of this software. |
||||
// Permission is granted to anyone to use this software for any purpose, |
||||
// including commercial applications, and to alter it and redistribute it |
||||
// freely, subject to the following restrictions: |
||||
// 1. The origin of this software must not be misrepresented; you must not |
||||
// claim that you wrote the original software. If you use this software |
||||
// in a product, an acknowledgment in the product documentation would be |
||||
// appreciated but is not required. |
||||
// 2. Altered source versions must be plainly marked as such, and must not be |
||||
// misrepresented as being the original software. |
||||
// 3. This notice may not be removed or altered from any source distribution. |
||||
|
||||
#pragma once |
||||
#ifndef AUVEC3F_DEFINED |
||||
#define AUVEC3F_DEFINED |
||||
|
||||
#include <cmath> |
||||
#include <limits> |
||||
|
||||
|
||||
class AUVec3f |
||||
{ |
||||
public: |
||||
AUVec3f(float fX_ = 0.0f, float fY_ = 0.0f, float fZ_ = 0.0f) : |
||||
x( fX_ ), |
||||
y( fY_ ), |
||||
z( fZ_ ) |
||||
{ |
||||
|
||||
} |
||||
|
||||
AUVec3f( const AUVec3f& v3din_ ) : |
||||
x( v3din_.x ), |
||||
y( v3din_.y ), |
||||
z( v3din_.z ) |
||||
{ |
||||
} |
||||
|
||||
//Mutators |
||||
void SetX( float fX_ ) { x = fX_; } |
||||
void SetY( float fY_ ) { y = fY_; } |
||||
void SetZ( float fZ_ ) { z = fZ_; } |
||||
void Set( float fX_, float fY_, float fZ_ ) |
||||
{ |
||||
x = fX_; |
||||
y = fY_; |
||||
z = fZ_; |
||||
} |
||||
|
||||
float Dot( const AUVec3f& V_ ) const |
||||
{ |
||||
return x * V_.x |
||||
+ y * V_.y |
||||
+ z * V_.z; |
||||
} |
||||
|
||||
AUVec3f Cross( const AUVec3f& V_ ) const |
||||
{ |
||||
AUVec3f newV( y * V_.z - z * V_.y, |
||||
z * V_.x - x * V_.z, |
||||
x * V_.y - y * V_.x ); |
||||
|
||||
return newV; |
||||
} |
||||
|
||||
bool Normalise() |
||||
{ |
||||
float fMagnitude = Magnitude(); |
||||
if(fMagnitude != 0.0f) |
||||
{ |
||||
x /= fMagnitude; |
||||
y /= fMagnitude; |
||||
z /= fMagnitude; |
||||
return true; |
||||
} |
||||
else |
||||
{ |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
AUVec3f GetNormalised() const |
||||
{ |
||||
AUVec3f v = *this; |
||||
v.Normalise(); |
||||
return v; |
||||
} |
||||
|
||||
AUVec3f Lerp( const AUVec3f& V_, float t ) const |
||||
{ |
||||
return (*this + (V_ - *this) * t); |
||||
} |
||||
|
||||
bool IsInfinite() const |
||||
{ |
||||
float inf = std::numeric_limits<float>::infinity(); |
||||
return ( x == inf || y == inf || z == inf ); |
||||
} |
||||
|
||||
void SetInfinite() |
||||
{ |
||||
x = y = z = std::numeric_limits<float>::infinity(); |
||||
} |
||||
|
||||
bool IsZero() const |
||||
{ |
||||
return (x == 0.0f && y == 0.0f && z == 0.0f); |
||||
} |
||||
|
||||
//Operators |
||||
AUVec3f& operator+=( const AUVec3f& V_ ) |
||||
{ |
||||
x += V_.x; |
||||
y += V_.y; |
||||
z += V_.z; |
||||
return *this; |
||||
} |
||||
|
||||
AUVec3f& operator-=( const AUVec3f& V_ ) |
||||
{ |
||||
x -= V_.x; |
||||
y -= V_.y; |
||||
z -= V_.z; |
||||
return *this; |
||||
} |
||||
|
||||
AUVec3f& operator*=( const float& fScalar_ ) |
||||
{ |
||||
x *= fScalar_; |
||||
y *= fScalar_; |
||||
z *= fScalar_; |
||||
return *this; |
||||
} |
||||
|
||||
AUVec3f& operator/=( const float& fScalar_ ) |
||||
{ |
||||
x /= fScalar_; |
||||
y /= fScalar_; |
||||
z /= fScalar_; |
||||
return *this; |
||||
} |
||||
|
||||
bool operator==( const AUVec3f& V_ ) const |
||||
{ |
||||
return ( x == V_.x ) && ( y == V_.y ) && ( z == V_.z ); |
||||
} |
||||
|
||||
bool operator!=( const AUVec3f& V_ ) const |
||||
{ |
||||
return !(*this == V_); |
||||
} |
||||
|
||||
float Magnitude() const |
||||
{ |
||||
return static_cast<float>( sqrt( Dot( *this ) ) ); |
||||
} |
||||
|
||||
float MagnitudeSqr() const |
||||
{ |
||||
return static_cast<float>( Dot( *this ) ); |
||||
} |
||||
|
||||
AUVec3f operator+( const AUVec3f& V2_ ) const |
||||
{ |
||||
AUVec3f newV_( *this ); |
||||
return ( newV_ += V2_ ); |
||||
} |
||||
|
||||
AUVec3f operator-( const AUVec3f& V2_ ) const |
||||
{ |
||||
AUVec3f newV_( *this ); |
||||
return ( newV_ -= V2_ ); |
||||
} |
||||
|
||||
AUVec3f operator*( const float& fScalar_ ) const |
||||
{ |
||||
AUVec3f newV_( *this ); |
||||
return ( newV_ *= fScalar_ ); |
||||
} |
||||
|
||||
|
||||
AUVec3f operator/( const float& fScalar_ ) |
||||
{ |
||||
AUVec3f newV_( *this ); |
||||
return ( newV_ /= fScalar_ ); |
||||
} |
||||
|
||||
AUVec3f operator-() |
||||
{ |
||||
AUVec3f newV_( -x, -y, -z ); |
||||
return newV_; |
||||
} |
||||
|
||||
float x; |
||||
float y; |
||||
float z; |
||||
}; |
||||
|
||||
|
||||
//functions which do not have to be members |
||||
inline AUVec3f operator*( const float& fScalar_, const AUVec3f& V1_ ) |
||||
{ |
||||
return V1_ * fScalar_; |
||||
} |
||||
|
||||
#endif //AUVEC3F_DEFINED |
@ -1,146 +0,0 @@
@@ -1,146 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<ItemGroup Label="ProjectConfigurations"> |
||||
<ProjectConfiguration Include="Debug|Win32"> |
||||
<Configuration>Debug</Configuration> |
||||
<Platform>Win32</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Debug|x64"> |
||||
<Configuration>Debug</Configuration> |
||||
<Platform>x64</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Release|Win32"> |
||||
<Configuration>Release</Configuration> |
||||
<Platform>Win32</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Release|x64"> |
||||
<Configuration>Release</Configuration> |
||||
<Platform>x64</Platform> |
||||
</ProjectConfiguration> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<None Include="AUOrientation3D.inl" /> |
||||
<None Include="AUVec3f.inl" /> |
||||
<None Include="Math.inl" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ClInclude Include="AUColor.inl" /> |
||||
</ItemGroup> |
||||
<PropertyGroup Label="Globals"> |
||||
<ProjectGuid>{2947A63C-A245-4853-B4CC-476354188AEE}</ProjectGuid> |
||||
<Keyword>Win32Proj</Keyword> |
||||
<RootNamespace>Common</RootNamespace> |
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> |
||||
</PropertyGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |
||||
<ConfigurationType>StaticLibrary</ConfigurationType> |
||||
<UseDebugLibraries>true</UseDebugLibraries> |
||||
<CharacterSet>Unicode</CharacterSet> |
||||
<PlatformToolset>v140_xp</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> |
||||
<ConfigurationType>StaticLibrary</ConfigurationType> |
||||
<UseDebugLibraries>true</UseDebugLibraries> |
||||
<CharacterSet>Unicode</CharacterSet> |
||||
<PlatformToolset>v140_xp</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |
||||
<ConfigurationType>StaticLibrary</ConfigurationType> |
||||
<UseDebugLibraries>false</UseDebugLibraries> |
||||
<WholeProgramOptimization>true</WholeProgramOptimization> |
||||
<CharacterSet>Unicode</CharacterSet> |
||||
<PlatformToolset>v140_xp</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> |
||||
<ConfigurationType>StaticLibrary</ConfigurationType> |
||||
<UseDebugLibraries>false</UseDebugLibraries> |
||||
<WholeProgramOptimization>true</WholeProgramOptimization> |
||||
<CharacterSet>Unicode</CharacterSet> |
||||
<PlatformToolset>v140_xp</PlatformToolset> |
||||
</PropertyGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
||||
<ImportGroup Label="ExtensionSettings"> |
||||
</ImportGroup> |
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||
</ImportGroup> |
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> |
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||
</ImportGroup> |
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||
</ImportGroup> |
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> |
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||
</ImportGroup> |
||||
<PropertyGroup Label="UserMacros" /> |
||||
<PropertyGroup /> |
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||
<ClCompile> |
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>Disabled</Optimization> |
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<PrecompiledHeaderFile> |
||||
</PrecompiledHeaderFile> |
||||
<PrecompiledHeaderOutputFile> |
||||
</PrecompiledHeaderOutputFile> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Windows</SubSystem> |
||||
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
||||
<ClCompile> |
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>Disabled</Optimization> |
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<PrecompiledHeaderFile> |
||||
</PrecompiledHeaderFile> |
||||
<PrecompiledHeaderOutputFile> |
||||
</PrecompiledHeaderOutputFile> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Windows</SubSystem> |
||||
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||
<ClCompile> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<PrecompiledHeader>Use</PrecompiledHeader> |
||||
<Optimization>MaxSpeed</Optimization> |
||||
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Windows</SubSystem> |
||||
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||
<OptimizeReferences>true</OptimizeReferences> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
||||
<ClCompile> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<PrecompiledHeader>Use</PrecompiledHeader> |
||||
<Optimization>MaxSpeed</Optimization> |
||||
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Windows</SubSystem> |
||||
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||
<OptimizeReferences>true</OptimizeReferences> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
||||
<ImportGroup Label="ExtensionTargets"> |
||||
</ImportGroup> |
||||
</Project> |
@ -1,46 +0,0 @@
@@ -1,46 +0,0 @@
|
||||
// |
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks |
||||
// |
||||
// This software is provided 'as-is', without any express or implied |
||||
// warranty. In no event will the authors be held liable for any damages |
||||
// arising from the use of this software. |
||||
// Permission is granted to anyone to use this software for any purpose, |
||||
// including commercial applications, and to alter it and redistribute it |
||||
// freely, subject to the following restrictions: |
||||
// 1. The origin of this software must not be misrepresented; you must not |
||||
// claim that you wrote the original software. If you use this software |
||||
// in a product, an acknowledgment in the product documentation would be |
||||
// appreciated but is not required. |
||||
// 2. Altered source versions must be plainly marked as such, and must not be |
||||
// misrepresented as being the original software. |
||||
// 3. This notice may not be removed or altered from any source distribution. |
||||
|
||||
#pragma once |
||||
#ifndef AUMATH_DEFINED |
||||
#define AUMATH_DEFINED |
||||
|
||||
#define _USE_MATH_DEFINES |
||||
#include <math.h> |
||||
|
||||
/* Adds some helpful macros and exposes the non-standard constants available in math.h (may not be portable): |
||||
* M_E - e |
||||
* M_LOG2E - log2(e) |
||||
* M_LOG10E - log10(e) |
||||
* M_LN2 - ln(2) |
||||
* M_LN10 - ln(10) |
||||
* M_PI - pi |
||||
* M_PI_2 - pi/2 |
||||
* M_PI_4 - pi/4 |
||||
* M_1_PI - 1/pi |
||||
* M_2_PI - 2/pi |
||||
* M_2_SQRTPI - 2/sqrt(pi) |
||||
* M_SQRT2 - sqrt(2) |
||||
* M_SQRT1_2 - 1/sqrt(2) |
||||
*/ |
||||
|
||||
#define DEG2RAD(deg) ((deg)*((PI)/(180.0))) |
||||
#define RAD2DEG(rad) ((rad)*((180.0)/(PI))) |
||||
#define LERP(a, b, t) ((a) + (t) * ((b) - (a))) |
||||
|
||||
|
||||
#endif // AUMATH_DEFINED |
@ -1,45 +0,0 @@
@@ -1,45 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
// ConsoleExample.cpp : simple example using console command line
|
||||
|
||||
|
||||
#include "ConsoleGame.h" |
||||
#include <iostream> |
||||
#ifdef _WIN32 |
||||
#include <conio.h> |
||||
#endif |
||||
|
||||
|
||||
int main(int argc, char* argv[]) |
||||
{ |
||||
ConsoleGame game; |
||||
if( game.Init() ) |
||||
{ |
||||
while( game.MainLoop() ) |
||||
{ |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
std::cout << "\nFailed Initialisation, press a key to exit.\n"; |
||||
_getche(); |
||||
} |
||||
|
||||
std::cout << "Exiting...\n"; |
||||
return 0; |
||||
} |
@ -1,183 +0,0 @@
@@ -1,183 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<ItemGroup Label="ProjectConfigurations"> |
||||
<ProjectConfiguration Include="Debug|Win32"> |
||||
<Configuration>Debug</Configuration> |
||||
<Platform>Win32</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Debug|x64"> |
||||
<Configuration>Debug</Configuration> |
||||
<Platform>x64</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Release|Win32"> |
||||
<Configuration>Release</Configuration> |
||||
<Platform>Win32</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Release|x64"> |
||||
<Configuration>Release</Configuration> |
||||
<Platform>x64</Platform> |
||||
</ProjectConfiguration> |
||||
</ItemGroup> |
||||
<PropertyGroup Label="Globals"> |
||||
<ProjectGuid>{B95544FF-96D5-4395-8E62-C02A512534D7}</ProjectGuid> |
||||
<Keyword>Win32Proj</Keyword> |
||||
<RootNamespace>ConsoleExample</RootNamespace> |
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> |
||||
</PropertyGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |
||||
<ConfigurationType>Application</ConfigurationType> |
||||
<UseDebugLibraries>true</UseDebugLibraries> |
||||
<CharacterSet>Unicode</CharacterSet> |
||||
<PlatformToolset>v140_xp</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> |
||||
<ConfigurationType>Application</ConfigurationType> |
||||
<UseDebugLibraries>true</UseDebugLibraries> |
||||
<CharacterSet>Unicode</CharacterSet> |
||||
<PlatformToolset>v140_xp</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |
||||
<ConfigurationType>Application</ConfigurationType> |
||||
<UseDebugLibraries>false</UseDebugLibraries> |
||||
<WholeProgramOptimization>true</WholeProgramOptimization> |
||||
<CharacterSet>Unicode</CharacterSet> |
||||
<PlatformToolset>v140_xp</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> |
||||
<ConfigurationType>Application</ConfigurationType> |
||||
<UseDebugLibraries>false</UseDebugLibraries> |
||||
<WholeProgramOptimization>true</WholeProgramOptimization> |
||||
<CharacterSet>Unicode</CharacterSet> |
||||
<PlatformToolset>v140_xp</PlatformToolset> |
||||
</PropertyGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
||||
<ImportGroup Label="ExtensionSettings"> |
||||
</ImportGroup> |
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||
<Import Project="..\..\Aurora_x86.props" /> |
||||
</ImportGroup> |
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> |
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||
<Import Project="..\..\Aurora_x64.props" /> |
||||
</ImportGroup> |
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||
<Import Project="..\..\Aurora_x86.props" /> |
||||
</ImportGroup> |
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> |
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||
<Import Project="..\..\Aurora_x64.props" /> |
||||
</ImportGroup> |
||||
<PropertyGroup Label="UserMacros" /> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||
<LinkIncremental>true</LinkIncremental> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
||||
<LinkIncremental>true</LinkIncremental> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||
<LinkIncremental>false</LinkIncremental> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
||||
<LinkIncremental>false</LinkIncremental> |
||||
</PropertyGroup> |
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||
<ClCompile> |
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>Disabled</Optimization> |
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<PrecompiledHeaderFile> |
||||
</PrecompiledHeaderFile> |
||||
<AdditionalIncludeDirectories> |
||||
</AdditionalIncludeDirectories> |
||||
<UseFullPaths>true</UseFullPaths> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||
<AdditionalDependencies>RuntimeObjectSystem.lib;RuntimeCompiler_VS2010.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies> |
||||
<AdditionalLibraryDirectories>$(SolutionDir)$(Configuration);</AdditionalLibraryDirectories> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
||||
<ClCompile> |
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>Disabled</Optimization> |
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<PrecompiledHeaderFile> |
||||
</PrecompiledHeaderFile> |
||||
<AdditionalIncludeDirectories> |
||||
</AdditionalIncludeDirectories> |
||||
<UseFullPaths>true</UseFullPaths> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||
<AdditionalDependencies>RuntimeObjectSystem.lib;RuntimeCompiler_VS2010.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies> |
||||
<AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration)\</AdditionalLibraryDirectories> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||
<ClCompile> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<PrecompiledHeader> |
||||
</PrecompiledHeader> |
||||
<Optimization>MaxSpeed</Optimization> |
||||
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<AdditionalIncludeDirectories> |
||||
</AdditionalIncludeDirectories> |
||||
<UseFullPaths>true</UseFullPaths> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||
<OptimizeReferences>true</OptimizeReferences> |
||||
<AdditionalDependencies>RuntimeObjectSystem.lib;RuntimeCompiler_VS2010.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies> |
||||
<AdditionalLibraryDirectories>$(SolutionDir)$(Configuration);</AdditionalLibraryDirectories> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
||||
<ClCompile> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<PrecompiledHeader> |
||||
</PrecompiledHeader> |
||||
<Optimization>MaxSpeed</Optimization> |
||||
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<AdditionalIncludeDirectories> |
||||
</AdditionalIncludeDirectories> |
||||
<UseFullPaths>true</UseFullPaths> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||
<OptimizeReferences>true</OptimizeReferences> |
||||
<AdditionalDependencies>RuntimeObjectSystem.lib;RuntimeCompiler_VS2010.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies> |
||||
<AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration)\</AdditionalLibraryDirectories> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
<ItemGroup> |
||||
<ClCompile Include="ConsoleExample.cpp" /> |
||||
<ClCompile Include="ConsoleGame.cpp" /> |
||||
<ClCompile Include="RuntimeObject01.cpp" /> |
||||
<ClCompile Include="StdioLogSystem.cpp" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ClInclude Include="ConsoleGame.h" /> |
||||
<ClInclude Include="InterfaceIds.h" /> |
||||
<ClInclude Include="IUpdateable.h" /> |
||||
<ClInclude Include="StdioLogSystem.h" /> |
||||
</ItemGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
||||
<ImportGroup Label="ExtensionTargets"> |
||||
</ImportGroup> |
||||
</Project> |
@ -1,27 +0,0 @@
@@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<ItemGroup> |
||||
<Filter Include="Resource Files"> |
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> |
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> |
||||
</Filter> |
||||
<Filter Include="Runtime Modifiable"> |
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> |
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> |
||||
</Filter> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ClCompile Include="ConsoleExample.cpp" /> |
||||
<ClCompile Include="RuntimeObject01.cpp"> |
||||
<Filter>Runtime Modifiable</Filter> |
||||
</ClCompile> |
||||
<ClCompile Include="StdioLogSystem.cpp" /> |
||||
<ClCompile Include="ConsoleGame.cpp" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ClInclude Include="StdioLogSystem.h" /> |
||||
<ClInclude Include="ConsoleGame.h" /> |
||||
<ClInclude Include="InterfaceIds.h" /> |
||||
<ClInclude Include="IUpdateable.h" /> |
||||
</ItemGroup> |
||||
</Project> |
@ -1,175 +0,0 @@
@@ -1,175 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#include "ConsoleGame.h" |
||||
|
||||
|
||||
#include "../../RuntimeCompiler/AUArray.h" |
||||
#include "../../RuntimeCompiler/BuildTool.h" |
||||
#include "../../RuntimeCompiler/ICompilerLogger.h" |
||||
#include "../../RuntimeCompiler/FileChangeNotifier.h" |
||||
#include "../../RuntimeObjectSystem/IObjectFactorySystem.h" |
||||
#include "../../RuntimeObjectSystem/ObjectFactorySystem/ObjectFactorySystem.h" |
||||
#include "../../RuntimeObjectSystem/RuntimeObjectSystem.h" |
||||
|
||||
#include "StdioLogSystem.h" |
||||
|
||||
#include "../../RuntimeObjectSystem/IObject.h" |
||||
#include "IUpdateable.h" |
||||
#include "InterfaceIds.h" |
||||
|
||||
#include <iostream> |
||||
#ifdef WIN32 |
||||
#include <conio.h> |
||||
#include <tchar.h> |
||||
#else |
||||
#include <unistd.h> |
||||
int _getche() |
||||
{ |
||||
int ret = getchar(); |
||||
return ret; |
||||
} |
||||
int _kbhit() |
||||
{ |
||||
std::cout << "This port needs a fix, CTRL-C to quit\n"; |
||||
return 0; |
||||
} |
||||
|
||||
int Sleep( int msecs ) |
||||
{ |
||||
return usleep( msecs * 1000); |
||||
} |
||||
#endif |
||||
#include <sstream> |
||||
#include <vector> |
||||
#include <algorithm> |
||||
#include <string> |
||||
#include <stdarg.h> |
||||
|
||||
// Remove windows.h define of GetObject which conflicts with EntitySystem GetObject
|
||||
#if defined _WINDOWS_ && defined GetObject |
||||
#undef GetObject |
||||
#endif |
||||
using FileSystemUtils::Path; |
||||
|
||||
ConsoleGame::ConsoleGame() |
||||
: m_pCompilerLogger(0) |
||||
, m_pRuntimeObjectSystem(0) |
||||
, m_pUpdateable(0) |
||||
{ |
||||
} |
||||
|
||||
ConsoleGame::~ConsoleGame() |
||||
{ |
||||
if( m_pRuntimeObjectSystem ) |
||||
{ |
||||
// clean temp object files
|
||||
m_pRuntimeObjectSystem->CleanObjectFiles(); |
||||
} |
||||
|
||||
if( m_pRuntimeObjectSystem && m_pRuntimeObjectSystem->GetObjectFactorySystem() ) |
||||
{ |
||||
m_pRuntimeObjectSystem->GetObjectFactorySystem()->RemoveListener(this); |
||||
|
||||
// delete object via correct interface
|
||||
IObject* pObj = m_pRuntimeObjectSystem->GetObjectFactorySystem()->GetObject( m_ObjectId ); |
||||
delete pObj; |
||||
} |
||||
|
||||
delete m_pRuntimeObjectSystem; |
||||
delete m_pCompilerLogger; |
||||
} |
||||
|
||||
|
||||
bool ConsoleGame::Init() |
||||
{ |
||||
//Initialise the RuntimeObjectSystem
|
||||
m_pRuntimeObjectSystem = new RuntimeObjectSystem; |
||||
m_pCompilerLogger = new StdioLogSystem(); |
||||
if( !m_pRuntimeObjectSystem->Initialise(m_pCompilerLogger, 0) ) |
||||
{ |
||||
m_pRuntimeObjectSystem = 0; |
||||
return false; |
||||
} |
||||
m_pRuntimeObjectSystem->GetObjectFactorySystem()->AddListener(this); |
||||
|
||||
|
||||
// construct first object
|
||||
IObjectConstructor* pCtor = m_pRuntimeObjectSystem->GetObjectFactorySystem()->GetConstructor( "RuntimeObject01" ); |
||||
if( pCtor ) |
||||
{ |
||||
IObject* pObj = pCtor->Construct(); |
||||
pObj->GetInterface( &m_pUpdateable ); |
||||
if( 0 == m_pUpdateable ) |
||||
{ |
||||
delete pObj; |
||||
m_pCompilerLogger->LogError("Error - no updateable interface found\n"); |
||||
return false; |
||||
} |
||||
m_ObjectId = pObj->GetObjectId(); |
||||
|
||||
} |
||||
|
||||
return true; |
||||
} |
||||
|
||||
void ConsoleGame::OnConstructorsAdded() |
||||
{ |
||||
// This could have resulted in a change of object pointer, so release old and get new one.
|
||||
if( m_pUpdateable ) |
||||
{ |
||||
IObject* pObj = m_pRuntimeObjectSystem->GetObjectFactorySystem()->GetObject( m_ObjectId ); |
||||
pObj->GetInterface( &m_pUpdateable ); |
||||
if( 0 == m_pUpdateable ) |
||||
{ |
||||
delete pObj; |
||||
m_pCompilerLogger->LogError( "Error - no updateable interface found\n"); |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
bool ConsoleGame::MainLoop() |
||||
{ |
||||
//check status of any compile
|
||||
if( m_pRuntimeObjectSystem->GetIsCompiledComplete() ) |
||||
{ |
||||
// load module when compile complete
|
||||
m_pRuntimeObjectSystem->LoadCompiledModule(); |
||||
} |
||||
|
||||
if( !m_pRuntimeObjectSystem->GetIsCompiling() ) |
||||
{ |
||||
static int numUpdates = 0; |
||||
std::cout << "\nMain Loop - press q to quit. Updates every second. Update: " << numUpdates++ << "\n"; |
||||
if( _kbhit() ) |
||||
{ |
||||
int ret = _getche(); |
||||
if( 'q' == ret ) |
||||
{ |
||||
return false; |
||||
} |
||||
} |
||||
const float deltaTime = 1.0f; |
||||
m_pRuntimeObjectSystem->GetFileChangeNotifier()->Update( deltaTime ); |
||||
m_pUpdateable->Update( deltaTime ); |
||||
Sleep(1000); |
||||
} |
||||
|
||||
return true; |
||||
} |
@ -1,64 +0,0 @@
@@ -1,64 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#pragma once |
||||
|
||||
#ifndef CONSOLEGAME_INCLUDED |
||||
#define CONSOLEGAME_INCLUDED |
||||
|
||||
#include "../../RuntimeObjectSystem/IObjectFactorySystem.h" |
||||
#include "../../RuntimeObjectSystem/ObjectInterface.h" |
||||
#include "../../RuntimeCompiler/AUArray.h" |
||||
|
||||
#ifndef _WIN32 |
||||
int _getche(); |
||||
#endif |
||||
|
||||
|
||||
struct IUpdateable; |
||||
struct IRuntimeObjectSystem; |
||||
|
||||
class ConsoleGame : public IObjectFactoryListener |
||||
{ |
||||
public: |
||||
ConsoleGame(); |
||||
virtual ~ConsoleGame(); |
||||
|
||||
bool Init(); |
||||
bool MainLoop(); |
||||
|
||||
|
||||
// IObjectFactoryListener
|
||||
|
||||
virtual void OnConstructorsAdded(); |
||||
|
||||
// ~IObjectFactoryListener
|
||||
|
||||
|
||||
private: |
||||
|
||||
// Runtime Systems
|
||||
ICompilerLogger* m_pCompilerLogger; |
||||
IRuntimeObjectSystem* m_pRuntimeObjectSystem; |
||||
|
||||
// Runtime object
|
||||
IUpdateable* m_pUpdateable; |
||||
ObjectId m_ObjectId; |
||||
|
||||
}; |
||||
|
||||
#endif // CONSOLEGAME_INCLUDED
|
@ -1,30 +0,0 @@
@@ -1,30 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#pragma once |
||||
|
||||
#ifndef IUPDATEABLE_INCLUDED |
||||
#define IUPDATEABLE_INCLUDED |
||||
|
||||
#include "../../RuntimeObjectSystem/IObject.h" |
||||
|
||||
struct IUpdateable : public IObject |
||||
{ |
||||
virtual void Update( float deltaTime ) = 0; |
||||
}; |
||||
|
||||
#endif // IUPDATEABLE_INCLUDED
|
@ -1,41 +0,0 @@
@@ -1,41 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// InterfaceId header file.
|
||||
//
|
||||
// Specifys interface ids for getting hold of interfaces
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once |
||||
|
||||
#ifndef INTERFACEIDS_INCLUDED |
||||
#define INTERFACEIDS_INCLUDED |
||||
|
||||
#include "../../RuntimeObjectSystem/IObject.h" |
||||
|
||||
enum InterfaceIDEnumConsoleExample |
||||
{ |
||||
IID_IUPDATEABLE = IID_ENDInterfaceID, |
||||
|
||||
IID_ENDInterfaceIDEnumConsoleExample |
||||
}; |
||||
|
||||
|
||||
#endif //INTERFACEIDS_INCLUDED
|
@ -1,18 +0,0 @@
@@ -1,18 +0,0 @@
|
||||
#include "../../RuntimeObjectSystem/ObjectInterfacePerModule.h" |
||||
|
||||
#include "../../RuntimeObjectSystem/IObject.h" |
||||
#include "IUpdateable.h" |
||||
#include "InterfaceIds.h" |
||||
#include <iostream> |
||||
|
||||
|
||||
class RuntimeObject01 : public TInterface<IID_IUPDATEABLE,IUpdateable> |
||||
{ |
||||
public: |
||||
virtual void Update( float deltaTime ) |
||||
{ |
||||
std::cout << "Runtime Object 01 update called!\n"; |
||||
} |
||||
}; |
||||
|
||||
REGISTERCLASS(RuntimeObject01); |
@ -1,66 +0,0 @@
@@ -1,66 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#include "StdioLogSystem.h" |
||||
|
||||
// Currently we create the file on first real output, and only close it on shutdown
|
||||
|
||||
#include <stdarg.h> |
||||
#include <assert.h> |
||||
#include <iostream> |
||||
|
||||
#ifdef _WIN32 |
||||
#include "../../RuntimeCompiler/FileSystemUtils.h" |
||||
#include "Windows.h" |
||||
#pragma warning( disable : 4996 4800 ) |
||||
#endif |
||||
|
||||
|
||||
void StdioLogSystem::LogError(const char * format, ...) |
||||
{ |
||||
va_list args; |
||||
va_start(args, format); |
||||
LogInternal(format, args); |
||||
} |
||||
|
||||
void StdioLogSystem::LogWarning(const char * format, ...) |
||||
{ |
||||
va_list args; |
||||
va_start(args, format); |
||||
LogInternal(format, args); |
||||
} |
||||
|
||||
void StdioLogSystem::LogInfo(const char * format, ...) |
||||
{ |
||||
va_list args; |
||||
va_start(args, format); |
||||
LogInternal(format, args); |
||||
} |
||||
void StdioLogSystem::LogInternal(const char * format, va_list args) |
||||
{ |
||||
int result = vsnprintf(m_buff, LOGSYSTEM_MAX_BUFFER-1, format, args); |
||||
// Make sure there's a limit to the amount of rubbish we can output
|
||||
m_buff[LOGSYSTEM_MAX_BUFFER-1] = '\0'; |
||||
|
||||
std::cout << m_buff; |
||||
#ifdef _WIN32 |
||||
std::string temp = m_buff; |
||||
// convert from utf-8 to Wide char
|
||||
std::wstring tempW = FileSystemUtils::_Win32Utf8ToUtf16( temp ); |
||||
OutputDebugStringW( tempW.c_str() ); |
||||
#endif |
||||
} |
@ -1,45 +0,0 @@
@@ -1,45 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#pragma once |
||||
|
||||
#ifndef STDIOLOGSYSTEM_INCLUDED |
||||
#define STDIOLOGSYSTEM_INCLUDED |
||||
|
||||
#include "../../RuntimeCompiler/ICompilerLogger.h" |
||||
|
||||
#include <string> |
||||
#include <stdio.h> |
||||
|
||||
// StdioLogSystem for compiler
|
||||
|
||||
const size_t LOGSYSTEM_MAX_BUFFER = 4096; |
||||
|
||||
class StdioLogSystem : public ICompilerLogger |
||||
{ |
||||
public:
|
||||
virtual void LogError(const char * format, ...); |
||||
virtual void LogWarning(const char * format, ...); |
||||
virtual void LogInfo(const char * format, ...); |
||||
|
||||
protected: |
||||
void LogInternal(const char * format, va_list args); |
||||
char m_buff[LOGSYSTEM_MAX_BUFFER]; |
||||
}; |
||||
|
||||
|
||||
#endif //STDIOLOGSYSTEM_INCLUDED
|
@ -1,3 +0,0 @@
@@ -1,3 +0,0 @@
|
||||
# ignore this specific file because it's a runtime generated temp file |
||||
ConsoleContext.cpp |
||||
consolecontext.cpp |
@ -1,63 +0,0 @@
@@ -1,63 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#pragma once |
||||
|
||||
#ifndef BB_GLOBAL_INCLUDED |
||||
#define BB_GLOBAL_INCLUDED |
||||
|
||||
#include "../../RuntimeObjectSystem/RuntimeInclude.h" |
||||
RUNTIME_MODIFIABLE_INCLUDE; //adds this include to runtime tracking
|
||||
|
||||
#include "IBlackboard.h" |
||||
#include "../../RuntimeObjectSystem/ISimpleSerializer.h" |
||||
#include <assert.h> |
||||
|
||||
struct BB_Global : public IBlackboard |
||||
{ |
||||
BB_Global() |
||||
{ |
||||
gameTimeElapsed = 0.0f; |
||||
immune_count = 0; |
||||
infection_count = 0; |
||||
immune_team_strength = 0; |
||||
infection_team_strength = 0; |
||||
} |
||||
|
||||
virtual void Serialize(ISimpleSerializer *pSerializer) |
||||
{ |
||||
AU_ASSERT(pSerializer); |
||||
SERIALIZE(gameTimeElapsed); |
||||
SERIALIZE(immune_count); |
||||
SERIALIZE(infection_count); |
||||
SERIALIZE(immune_team_strength); |
||||
SERIALIZE(infection_team_strength); |
||||
} |
||||
|
||||
// Members
|
||||
|
||||
float gameTimeElapsed; |
||||
int immune_count; |
||||
int infection_count; |
||||
float immune_team_strength; |
||||
float infection_team_strength; |
||||
}; |
||||
|
||||
// Registered inside BlackboardManager.cpp
|
||||
// REGISTERCLASS(BB_Global);
|
||||
|
||||
#endif // BB_GLOBAL_INCLUDED
|
@ -1,52 +0,0 @@
@@ -1,52 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#pragma once |
||||
|
||||
#ifndef BB_GROUP_INFECTED_INCLUDED |
||||
#define BB_GROUP_INFECTED_INCLUDED |
||||
|
||||
#include "../../RuntimeObjectSystem/RuntimeInclude.h" |
||||
RUNTIME_MODIFIABLE_INCLUDE; //adds this include to runtime tracking
|
||||
|
||||
#include "IBlackboard.h" |
||||
#include "../../RuntimeObjectSystem/ISimpleSerializer.h" |
||||
#include <assert.h> |
||||
|
||||
struct BB_Group_Infected : public IBlackboard |
||||
{ |
||||
BB_Group_Infected() |
||||
{ |
||||
group_size = 0; |
||||
} |
||||
|
||||
virtual void Serialize(ISimpleSerializer *pSerializer) |
||||
{ |
||||
AU_ASSERT(pSerializer); |
||||
SERIALIZE(group_size); |
||||
} |
||||
|
||||
// Members
|
||||
|
||||
int group_size; |
||||
}; |
||||
|
||||
// Registered inside BlackboardManager.cpp
|
||||
// REGISTERCLASS(BB_Group_Infected);
|
||||
|
||||
|
||||
#endif // BB_GROUP_INFECTED_INCLUDED
|
@ -1,52 +0,0 @@
@@ -1,52 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#pragma once |
||||
|
||||
#ifndef BB_GROUP_RBC_INCLUDED |
||||
#define BB_GROUP_RBC_INCLUDED |
||||
|
||||
#include "../../RuntimeObjectSystem/RuntimeInclude.h" |
||||
RUNTIME_MODIFIABLE_INCLUDE; //adds this include to runtime tracking
|
||||
|
||||
#include "IBlackboard.h" |
||||
#include "../../RuntimeObjectSystem/ISimpleSerializer.h" |
||||
#include <assert.h> |
||||
|
||||
struct BB_Group_RBC : public IBlackboard |
||||
{ |
||||
BB_Group_RBC() |
||||
{ |
||||
group_size = 0; |
||||
} |
||||
|
||||
virtual void Serialize(ISimpleSerializer *pSerializer) |
||||
{ |
||||
AU_ASSERT(pSerializer); |
||||
SERIALIZE(group_size); |
||||
} |
||||
|
||||
// Members
|
||||
|
||||
int group_size; |
||||
}; |
||||
|
||||
// Registered inside BlackboardManager.cpp
|
||||
// REGISTERCLASS(BB_Group_RBC);
|
||||
|
||||
|
||||
#endif // BB_GROUP_RBC_INCLUDED
|
@ -1,51 +0,0 @@
@@ -1,51 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#pragma once |
||||
|
||||
#ifndef BB_GROUP_VIRUS_INCLUDED |
||||
#define BB_GROUP_VIRUS_INCLUDED |
||||
|
||||
#include "../../RuntimeObjectSystem/RuntimeInclude.h" |
||||
RUNTIME_MODIFIABLE_INCLUDE; //adds this include to runtime tracking
|
||||
|
||||
#include "IBlackboard.h" |
||||
#include "../../RuntimeObjectSystem/ISimpleSerializer.h" |
||||
#include <assert.h> |
||||
|
||||
struct BB_Group_Virus : public IBlackboard |
||||
{ |
||||
BB_Group_Virus() |
||||
{ |
||||
group_size = 0; |
||||
} |
||||
|
||||
virtual void Serialize(ISimpleSerializer *pSerializer) |
||||
{ |
||||
AU_ASSERT(pSerializer); |
||||
SERIALIZE(group_size); |
||||
} |
||||
|
||||
// Members
|
||||
|
||||
int group_size; |
||||
}; |
||||
|
||||
// Registered inside BlackboardManager.cpp
|
||||
// REGISTERCLASS(BB_Group_Virus);
|
||||
|
||||
#endif // BB_GROUP_VIRUS_INCLUDED
|
@ -1,52 +0,0 @@
@@ -1,52 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#pragma once |
||||
|
||||
#ifndef BB_GROUP_WBC_INCLUDED |
||||
#define BB_GROUP_WBC_INCLUDED |
||||
|
||||
#include "../../RuntimeObjectSystem/RuntimeInclude.h" |
||||
RUNTIME_MODIFIABLE_INCLUDE; //adds this include to runtime tracking
|
||||
|
||||
#include "IBlackboard.h" |
||||
#include "../../RuntimeObjectSystem/ISimpleSerializer.h" |
||||
#include <assert.h> |
||||
|
||||
struct BB_Group_WBC : public IBlackboard |
||||
{ |
||||
BB_Group_WBC() |
||||
{ |
||||
group_size = 0; |
||||
} |
||||
|
||||
virtual void Serialize(ISimpleSerializer *pSerializer) |
||||
{ |
||||
AU_ASSERT(pSerializer); |
||||
SERIALIZE(group_size); |
||||
} |
||||
|
||||
// Members
|
||||
|
||||
int group_size; |
||||
}; |
||||
|
||||
// Registered inside BlackboardManager.cpp
|
||||
// REGISTERCLASS(BB_Group_WBC);
|
||||
|
||||
|
||||
#endif // BB_GROUP_WBC_INCLUDED
|
@ -1,69 +0,0 @@
@@ -1,69 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#pragma once |
||||
|
||||
#ifndef BB_INDIVIDUAL_COMMON_INCLUDED |
||||
#define BB_INDIVIDUAL_COMMON_INCLUDED |
||||
|
||||
#include "../../RuntimeObjectSystem/RuntimeInclude.h" |
||||
RUNTIME_MODIFIABLE_INCLUDE; //adds this include to runtime tracking
|
||||
|
||||
#include "IBlackboard.h" |
||||
#include "../../Common/AUVec3f.inl" |
||||
#include "../../RuntimeObjectSystem/ISimpleSerializer.h" |
||||
#include <assert.h> |
||||
|
||||
|
||||
struct BB_Individual_Common : public IBlackboard |
||||
{ |
||||
BB_Individual_Common() |
||||
{ |
||||
current_health = 0; |
||||
max_speed = 0; |
||||
target_position.SetInfinite(); |
||||
time_to_next_attack = 0.0f; |
||||
} |
||||
|
||||
virtual void Serialize(ISimpleSerializer *pSerializer) |
||||
{ |
||||
AU_ASSERT(pSerializer); |
||||
|
||||
SERIALIZE(current_health); |
||||
SERIALIZE(max_speed); |
||||
SERIALIZE(current_velocity); |
||||
SERIALIZE(current_position); |
||||
SERIALIZE(target_position); |
||||
SERIALIZE(enemy_collision_objectid); |
||||
SERIALIZE(time_to_next_attack); |
||||
} |
||||
|
||||
// Members
|
||||
|
||||
float current_health; |
||||
float max_speed; |
||||
AUVec3f current_velocity; |
||||
AUVec3f current_position; |
||||
AUVec3f target_position; // Infinity if none
|
||||
ObjectId enemy_collision_objectid; // 0 if none
|
||||
float time_to_next_attack; |
||||
}; |
||||
|
||||
// Registered inside BlackboardManager.cpp
|
||||
// REGISTERCLASS(BB_Individual_Common);
|
||||
|
||||
#endif // BB_INDIVIDUAL_COMMON_INCLUDED
|
@ -1,58 +0,0 @@
@@ -1,58 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#pragma once |
||||
|
||||
#ifndef BB_INDIVIDUAL_INFECTED_INCLUDED |
||||
#define BB_INDIVIDUAL_INFECTED_INCLUDED |
||||
|
||||
#include "../../RuntimeObjectSystem/RuntimeInclude.h" |
||||
RUNTIME_MODIFIABLE_INCLUDE; //adds this include to runtime tracking
|
||||
|
||||
#include "IBlackboard.h" |
||||
#include "../../RuntimeObjectSystem/ISimpleSerializer.h" |
||||
#include <assert.h> |
||||
|
||||
|
||||
struct BB_Individual_Infected : public IBlackboard |
||||
{ |
||||
BB_Individual_Infected() |
||||
{ |
||||
patrol_change_frequency = 10.0f; |
||||
} |
||||
|
||||
virtual void Serialize(ISimpleSerializer *pSerializer) |
||||
{ |
||||
AU_ASSERT(pSerializer); |
||||
|
||||
SERIALIZE(visible_wbc); |
||||
SERIALIZE(visible_rbc); |
||||
SERIALIZE(patrol_change_frequency); |
||||
} |
||||
|
||||
// Members
|
||||
|
||||
AUDynArray<ObjectId> visible_wbc; |
||||
AUDynArray<ObjectId> visible_rbc; |
||||
float patrol_change_frequency; |
||||
}; |
||||
|
||||
// Registered inside BlackboardManager.cpp
|
||||
// REGISTERCLASS(BB_Individual_Infected);
|
||||
|
||||
|
||||
#endif // BB_INDIVIDUAL_INFECTED_INCLUDED
|
@ -1,60 +0,0 @@
@@ -1,60 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#pragma once |
||||
|
||||
#ifndef BB_INDIVIDUAL_RBC_INCLUDED |
||||
#define BB_INDIVIDUAL_RBC_INCLUDED |
||||
|
||||
#include "../../RuntimeObjectSystem/RuntimeInclude.h" |
||||
RUNTIME_MODIFIABLE_INCLUDE; //adds this include to runtime tracking
|
||||
|
||||
#include "IBlackboard.h" |
||||
#include "../../RuntimeObjectSystem/ISimpleSerializer.h" |
||||
#include <assert.h> |
||||
|
||||
|
||||
struct BB_Individual_RBC : public IBlackboard |
||||
{ |
||||
BB_Individual_RBC() |
||||
{ |
||||
// Init members here
|
||||
} |
||||
|
||||
virtual void Serialize(ISimpleSerializer *pSerializer) |
||||
{ |
||||
AU_ASSERT(pSerializer); |
||||
|
||||
// Serialize members here
|
||||
//SERIALIZE(visible_dangerous); // Demo [Tutorial03]
|
||||
} |
||||
|
||||
// Members
|
||||
//AUDynArray<ObjectId> visible_dangerous; // Demo [Tutorial03]
|
||||
}; |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Registered inside BlackboardManager.cpp
|
||||
// REGISTERCLASS(BB_Individual_RBC);
|
||||
|
||||
|
||||
|
||||
#endif // BB_INDIVIDUAL_RBC_INCLUDED
|
@ -1,58 +0,0 @@
@@ -1,58 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#pragma once |
||||
|
||||
#ifndef BB_INDIVIDUAL_VIRUS_INCLUDED |
||||
#define BB_INDIVIDUAL_VIRUS_INCLUDED |
||||
|
||||
#include "../../RuntimeObjectSystem/RuntimeInclude.h" |
||||
RUNTIME_MODIFIABLE_INCLUDE; //adds this include to runtime tracking
|
||||
|
||||
#include "IBlackboard.h" |
||||
#include "../../RuntimeObjectSystem/ISimpleSerializer.h" |
||||
#include <assert.h> |
||||
|
||||
|
||||
struct BB_Individual_Virus : public IBlackboard |
||||
{ |
||||
BB_Individual_Virus() |
||||
{ |
||||
patrol_change_frequency = 10.0f; |
||||
} |
||||
|
||||
virtual void Serialize(ISimpleSerializer *pSerializer) |
||||
{ |
||||
AU_ASSERT(pSerializer); |
||||
|
||||
SERIALIZE(visible_wbc); |
||||
SERIALIZE(visible_rbc); |
||||
SERIALIZE(patrol_change_frequency); |
||||
} |
||||
|
||||
// Members
|
||||
|
||||
AUDynArray<ObjectId> visible_wbc; |
||||
AUDynArray<ObjectId> visible_rbc; |
||||
float patrol_change_frequency; |
||||
}; |
||||
|
||||
// Registered inside BlackboardManager.cpp
|
||||
// REGISTERCLASS(BB_Individual_Virus);
|
||||
|
||||
|
||||
#endif // BB_INDIVIDUAL_VIRUS_INCLUDED
|
@ -1,58 +0,0 @@
@@ -1,58 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#pragma once |
||||
|
||||
#ifndef BB_INDIVIDUAL_WBC_INCLUDED |
||||
#define BB_INDIVIDUAL_WBC_INCLUDED |
||||
|
||||
#include "../../RuntimeObjectSystem/RuntimeInclude.h" |
||||
RUNTIME_MODIFIABLE_INCLUDE; //adds this include to runtime tracking
|
||||
|
||||
#include "IBlackboard.h" |
||||
#include "../../RuntimeObjectSystem/ISimpleSerializer.h" |
||||
#include <assert.h> |
||||
|
||||
|
||||
struct BB_Individual_WBC : public IBlackboard |
||||
{ |
||||
BB_Individual_WBC() |
||||
{ |
||||
patrol_change_frequency = 10.0f; |
||||
} |
||||
|
||||
virtual void Serialize(ISimpleSerializer *pSerializer) |
||||
{ |
||||
AU_ASSERT(pSerializer); |
||||
|
||||
SERIALIZE(visible_viruses); |
||||
SERIALIZE(visible_infected); |
||||
SERIALIZE(patrol_change_frequency); |
||||
} |
||||
|
||||
// Members
|
||||
|
||||
AUDynArray<ObjectId> visible_viruses; |
||||
AUDynArray<ObjectId> visible_infected; |
||||
float patrol_change_frequency; |
||||
}; |
||||
|
||||
// Registered inside BlackboardManager.cpp
|
||||
// REGISTERCLASS(BB_Individual_WBC);
|
||||
|
||||
|
||||
#endif // BB_INDIVIDUAL_WBC_INCLUDED
|
@ -1,52 +0,0 @@
@@ -1,52 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#pragma once |
||||
|
||||
#ifndef BB_TEAM_IMMUNE_INCLUDED |
||||
#define BB_TEAM_IMMUNE_INCLUDED |
||||
|
||||
#include "../../RuntimeObjectSystem/RuntimeInclude.h" |
||||
RUNTIME_MODIFIABLE_INCLUDE; //adds this include to runtime tracking
|
||||
|
||||
#include "IBlackboard.h" |
||||
#include "../../RuntimeObjectSystem/ISimpleSerializer.h" |
||||
#include <assert.h> |
||||
|
||||
struct BB_Team_Immune : public IBlackboard |
||||
{ |
||||
BB_Team_Immune() |
||||
{ |
||||
team_size = 0; |
||||
} |
||||
|
||||
virtual void Serialize(ISimpleSerializer *pSerializer) |
||||
{ |
||||
AU_ASSERT(pSerializer); |
||||
SERIALIZE(team_size); |
||||
} |
||||
|
||||
// Members
|
||||
|
||||
int team_size; |
||||
}; |
||||
|
||||
// Registered inside BlackboardManager.cpp
|
||||
// REGISTERCLASS(BB_Team_Immune);
|
||||
|
||||
|
||||
#endif // BB_TEAM_IMMUNE_INCLUDED
|
@ -1,52 +0,0 @@
@@ -1,52 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#pragma once |
||||
|
||||
#ifndef BB_TEAM_INFECTION_INCLUDED |
||||
#define BB_TEAM_INFECTION_INCLUDED |
||||
|
||||
#include "../../RuntimeObjectSystem/RuntimeInclude.h" |
||||
RUNTIME_MODIFIABLE_INCLUDE; //adds this include to runtime tracking
|
||||
|
||||
#include "IBlackboard.h" |
||||
#include "../../RuntimeObjectSystem/ISimpleSerializer.h" |
||||
#include <assert.h> |
||||
|
||||
struct BB_Team_Infection : public IBlackboard |
||||
{ |
||||
BB_Team_Infection() |
||||
{ |
||||
team_size = 0; |
||||
} |
||||
|
||||
virtual void Serialize(ISimpleSerializer *pSerializer) |
||||
{ |
||||
AU_ASSERT(pSerializer); |
||||
SERIALIZE(team_size); |
||||
} |
||||
|
||||
// Members
|
||||
|
||||
int team_size; |
||||
}; |
||||
|
||||
// Registered inside BlackboardManager.cpp
|
||||
// REGISTERCLASS(BB_Team_Infection);
|
||||
|
||||
|
||||
#endif // BB_TEAM_INFECTION_INCLUDED
|
@ -1,213 +0,0 @@
@@ -1,213 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#pragma once |
||||
|
||||
#ifndef BEHAVIORCOMMON_INCLUDED |
||||
#define BEHAVIORCOMMON_INCLUDED |
||||
|
||||
#include "../../RuntimeObjectSystem/RuntimeInclude.h" |
||||
RUNTIME_MODIFIABLE_INCLUDE; //adds this include to runtime tracking
|
||||
|
||||
#include "IBehavior.h" |
||||
#include "IObjectUtils.h" |
||||
#include "IGameObject.h" |
||||
#include "IGameManager.h" |
||||
#include "IPerceptionManager.h" |
||||
#include "IBlackboardManager.h" |
||||
#include "IPhysicsManager.h" |
||||
#include "GlobalParameters.h" |
||||
#include "IObjectUtils.h" |
||||
|
||||
#include "BB_Global.h" |
||||
#include "BB_Individual_Common.h" |
||||
|
||||
#include "../../RuntimeObjectSystem/ObjectInterfacePerModule.h" |
||||
#include "../../Systems/SystemTable.h" |
||||
#include "../../Systems/IEntitySystem.h" |
||||
#include "../../Systems/IAssetSystem.h" |
||||
#include "../../Systems/ILogSystem.h" |
||||
#include "../../RuntimeObjectSystem/ISimpleSerializer.h" |
||||
|
||||
#include <assert.h> |
||||
#include <algorithm> |
||||
|
||||
|
||||
class BehaviorCommon : public IBehavior |
||||
{ |
||||
public: |
||||
BehaviorCommon()
|
||||
: m_pOwner(0) |
||||
, m_pGameManager(0) |
||||
, m_pPerception(0) |
||||
, m_pPhysics(0) |
||||
, m_pGlobalParameters(0) |
||||
, m_pGameObjectParams(0) |
||||
, m_pBBGlobal(0) |
||||
, m_pBBCommon(0) |
||||
{ |
||||
} |
||||
|
||||
// IObject
|
||||
|
||||
virtual void Serialize(ISimpleSerializer *pSerializer) |
||||
{ |
||||
SERIALIZEIOBJPTR(m_pOwner); |
||||
} |
||||
|
||||
virtual void Init( bool isFirstInit ) |
||||
{ |
||||
m_pGameManager = (IGameManager*)IObjectUtils::GetUniqueInterface( "GameManager", IID_IGAMEMANAGER ); |
||||
m_pPerception = (IPerceptionManager*)IObjectUtils::GetUniqueInterface( "PerceptionManager", IID_IPERCEPTIONMANAGER ); |
||||
m_pPhysics = (IPhysicsManager*)IObjectUtils::GetUniqueInterface( "PhysicsManager", IID_IPHYSICSMANAGER ); |
||||
m_pGlobalParameters = m_pGameManager->GetGlobalParameters(); |
||||
|
||||
if (m_pOwner) |
||||
{ |
||||
if (m_pOwner->GetBehavior() != this) |
||||
{ |
||||
// We've become orphaned, so delete ourselves
|
||||
delete this; |
||||
} |
||||
else |
||||
{ |
||||
InitGameObjectSpecificPointers(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
// ~IObject
|
||||
|
||||
// IBehavior
|
||||
|
||||
virtual void StartBehavior() {} |
||||
virtual void EndBehavior() {} |
||||
|
||||
virtual void Update( float timeDelta ) |
||||
{ |
||||
UpdatePerception(timeDelta); |
||||
UpdateBlackboards(timeDelta); |
||||
UpdateBehavior(timeDelta); |
||||
|
||||
AUVec3f desiredPosition = CalculateDesiredPosition(timeDelta); |
||||
UpdatePosition(desiredPosition, timeDelta); |
||||
} |
||||
|
||||
virtual AUVec3f CalculateDesiredPosition( float timeDelta ) |
||||
{ |
||||
return m_pOwner->GetEntity()->GetPosition(); |
||||
} |
||||
|
||||
virtual void OnCollision( IGameObject* pCollider ) |
||||
{ |
||||
if (pCollider->GetGameTeam() != m_pOwner->GetGameTeam()) |
||||
{ |
||||
m_pBBCommon->enemy_collision_objectid = pCollider->GetObjectId(); |
||||
} |
||||
} |
||||
|
||||
virtual float ReceiveDamage( float fAmount ) |
||||
{ |
||||
m_pBBCommon->current_health -= fAmount; |
||||
if ( m_pBBCommon->current_health <= 0.0f ) |
||||
{ |
||||
m_pGameManager->DestroyGameObject( m_pOwner->GetObjectId() ); |
||||
return 0.0f; |
||||
} |
||||
|
||||
return m_pBBCommon->current_health; |
||||
} |
||||
|
||||
virtual void SetGameObject( IGameObject* pOwner ) |
||||
{ |
||||
m_pOwner = pOwner; |
||||
|
||||
if (m_pOwner) |
||||
{ |
||||
InitGameObjectSpecificPointers(); |
||||
} |
||||
} |
||||
|
||||
// ~IBehavior
|
||||
|
||||
|
||||
protected: |
||||
|
||||
virtual void InitGameObjectSpecificPointers() |
||||
{ |
||||
IBlackboardManager* m_pBBManager = (IBlackboardManager*)IObjectUtils::GetUniqueInterface( "BlackboardManager", IID_IBLACKBOARDMANAGER ); |
||||
m_pBBGlobal = (BB_Global*)m_pBBManager->GetBlackboardGlobal(); |
||||
m_pBBCommon = (BB_Individual_Common*)m_pBBManager->GetBlackboardIndividualCommon( m_pOwner ); |
||||
|
||||
m_pGameObjectParams = &(m_pGlobalParameters->go[m_pOwner->GetGameObjectType()]); |
||||
} |
||||
|
||||
void UpdatePosition( const AUVec3f& desiredPosition, float timeDelta ) |
||||
{ |
||||
AUVec3f currentPosition = m_pOwner->GetEntity()->GetPosition(); |
||||
AUVec3f dir = desiredPosition - currentPosition; |
||||
float dist = dir.Magnitude(); |
||||
if (dist > 0.0f) |
||||
{ |
||||
dir /= dist; |
||||
} |
||||
|
||||
dist = std::min( m_pBBCommon->max_speed * timeDelta, dist ); |
||||
|
||||
AUVec3f requestPos = currentPosition + dir * dist; |
||||
m_pPhysics->RequestPositionUpdate( m_pOwner, requestPos, timeDelta ); |
||||
|
||||
const AUVec3f& newPosition = m_pOwner->GetEntity()->GetPosition(); |
||||
m_pBBCommon->current_position = newPosition; |
||||
m_pBBCommon->current_velocity = (newPosition - currentPosition) / timeDelta; |
||||
} |
||||
|
||||
void GetClosestTarget( const AUDynArray<ObjectId>& list, const AUVec3f& refPos, float& dist, IGameObject** pTarget ) |
||||
{ |
||||
for (size_t i=0; i<list.Size(); ++i) |
||||
{ |
||||
IGameObject* pTest = 0; |
||||
IObjectUtils::GetObject( &pTest, list[i] ); |
||||
if (pTest) |
||||
{ |
||||
float testDist = (refPos - pTest->GetEntity()->GetPosition()).MagnitudeSqr(); |
||||
if (testDist < dist) |
||||
{ |
||||
dist = testDist; |
||||
*pTarget = pTest; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
// Protected Members
|
||||
|
||||
IGameObject* m_pOwner; |
||||
IGameManager* m_pGameManager; |
||||
IPerceptionManager* m_pPerception; |
||||
IPhysicsManager* m_pPhysics; |
||||
GlobalParameters* m_pGlobalParameters; |
||||
GameObjectParams* m_pGameObjectParams; |
||||
|
||||
BB_Global* m_pBBGlobal; |
||||
BB_Individual_Common* m_pBBCommon; |
||||
}; |
||||
|
||||
#endif // BEHAVIORCOMMON_INCLUDED
|
||||
|
||||
|
@ -1,138 +0,0 @@
@@ -1,138 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#include "IBehaviorTreeManager.h" |
||||
#include "IBehaviorTree.h" |
||||
#include "IObjectUtils.h" |
||||
|
||||
#include "../../RuntimeObjectSystem/ObjectInterfacePerModule.h" |
||||
#include "../../Systems/SystemTable.h" |
||||
#include "../../Systems/IEntitySystem.h" |
||||
#include "../../Systems/IAssetSystem.h" |
||||
#include "../../Systems/ILogSystem.h" |
||||
#include "../../RuntimeObjectSystem/ISimpleSerializer.h" |
||||
|
||||
#include <assert.h> |
||||
#include <map> |
||||
#include <string> |
||||
|
||||
class BehaviorTreeManager : public IBehaviorTreeManager |
||||
{ |
||||
public: |
||||
BehaviorTreeManager()
|
||||
{ |
||||
|
||||
} |
||||
|
||||
virtual ~BehaviorTreeManager() |
||||
{ |
||||
if( m_pEntity ) |
||||
{ |
||||
m_pEntity->SetUpdateable(NULL); |
||||
} |
||||
|
||||
if (!IsRuntimeDelete()) |
||||
{ |
||||
DestroyAllTrees(); |
||||
} |
||||
} |
||||
|
||||
|
||||
// IEntityObject
|
||||
|
||||
virtual void Serialize(ISimpleSerializer *pSerializer) |
||||
{ |
||||
AU_ASSERT(pSerializer); |
||||
IEntityObject::Serialize(pSerializer); |
||||
SERIALIZE(m_trees); |
||||
} |
||||
|
||||
virtual void Init( bool isFirstInit ) |
||||
{ |
||||
m_pEntity->SetUpdateable( this ); |
||||
} |
||||
|
||||
// ~IEntityObject
|
||||
|
||||
// IAUUpdateable
|
||||
|
||||
virtual void Update( float deltaTime ) |
||||
{ |
||||
// Do nothing for now
|
||||
} |
||||
|
||||
// ~IAUUpdateable
|
||||
|
||||
// IBehaviorTreeManager
|
||||
|
||||
virtual IBehaviorTree* GetTree( const char* name ) |
||||
{ |
||||
IBehaviorTree* pTree = NULL; |
||||
|
||||
TTreeMap::iterator it = m_trees.find(name); |
||||
if (it != m_trees.end()) |
||||
{ |
||||
IObjectUtils::GetObject( &pTree, it->second ); |
||||
} |
||||
else |
||||
{ |
||||
IObject* pObj = IObjectUtils::CreateUniqueObject( name ); |
||||
if (pObj) |
||||
{ |
||||
IObjectUtils::GetObject( &pTree, pObj->GetObjectId() ); |
||||
} |
||||
|
||||
if (pTree) |
||||
{ |
||||
m_trees[name] = pTree->GetObjectId(); |
||||
}
|
||||
} |
||||
|
||||
return pTree; |
||||
} |
||||
|
||||
// ~IBehaviorTreeManager
|
||||
|
||||
|
||||
private: |
||||
|
||||
void DestroyAllTrees() |
||||
{ |
||||
IObjectFactorySystem* pFactory = PerModuleInterface::g_pSystemTable->pObjectFactorySystem; |
||||
TTreeMap::iterator it = m_trees.begin(); |
||||
TTreeMap::iterator itEnd = m_trees.end(); |
||||
while (it != itEnd) |
||||
{ |
||||
IObject* pObj = pFactory->GetObject(it->second); |
||||
delete pObj; |
||||
++it; |
||||
} |
||||
} |
||||
|
||||
|
||||
// Private Members
|
||||
|
||||
typedef std::map<std::string, ObjectId> TTreeMap; |
||||
|
||||
TTreeMap m_trees; |
||||
}; |
||||
|
||||
REGISTERCLASS(BehaviorTreeManager); |
||||
|
||||
|
||||
|
||||
|
@ -1,92 +0,0 @@
@@ -1,92 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#include "IBehaviorTree.h" |
||||
#include "IGameObject.h" |
||||
#include "IBlackboard.h" |
||||
#include "IBlackboardManager.h" |
||||
#include "IObjectUtils.h" |
||||
|
||||
#include "BB_Global.h" |
||||
#include "BB_Team_Infection.h" |
||||
#include "BB_Group_Infected.h" |
||||
#include "BB_Individual_Infected.h" |
||||
#include "BB_Individual_Common.h" |
||||
|
||||
#include "../../RuntimeObjectSystem/ObjectInterfacePerModule.h" |
||||
#include "../../Systems/SystemTable.h" |
||||
#include "../../Systems/IEntitySystem.h" |
||||
#include "../../Systems/IAssetSystem.h" |
||||
#include "../../Systems/ILogSystem.h" |
||||
#include "../../RuntimeObjectSystem/ISimpleSerializer.h" |
||||
|
||||
#include <assert.h> |
||||
|
||||
|
||||
class BehaviorTree_Infected : public IBehaviorTree |
||||
{ |
||||
public: |
||||
|
||||
virtual void Execute( IGameObject* pGameObject ) |
||||
{ |
||||
BB_Global* pBBGlobal = (BB_Global*)m_pBBManager->GetBlackboardGlobal(); |
||||
BB_Group_Infected* pBBGroup = (BB_Group_Infected*)m_pBBManager->GetBlackboardGroup( pGameObject->GetGameObjectType() ); |
||||
BB_Individual_Common* pBBCommon = (BB_Individual_Common*)m_pBBManager->GetBlackboardIndividualCommon( pGameObject ); |
||||
|
||||
if ( pBBCommon->enemy_collision_objectid.IsValid() ) |
||||
{ |
||||
pGameObject->SetBehavior( m_Behavior_Infected_Combat ); |
||||
} |
||||
else if ( !pBBCommon->target_position.IsInfinite() ) |
||||
{ |
||||
pGameObject->SetBehavior( m_Behavior_Infected_Approach ); |
||||
} |
||||
else if ( pBBGlobal->infection_team_strength > pBBGlobal->immune_team_strength * 1.2f && pBBGroup->group_size > 1 ) |
||||
{ |
||||
pGameObject->SetBehavior( m_Behavior_Infected_HuntWBC ); |
||||
} |
||||
else if ( pBBGlobal->immune_count > 0 ) |
||||
{ |
||||
pGameObject->SetBehavior( m_Behavior_Infected_HuntRBC ); |
||||
} |
||||
else |
||||
{ |
||||
pGameObject->SetBehavior( m_Behavior_Infected_Idle ); |
||||
}
|
||||
} |
||||
|
||||
virtual void Init( bool isFirstInit ) |
||||
{ |
||||
m_pBBManager = (IBlackboardManager*)IObjectUtils::GetUniqueInterface( "BlackboardManager", IID_IBLACKBOARDMANAGER ); |
||||
m_Behavior_Infected_Combat = IObjectUtils::GetConstructorId( "Behavior_Infected_Combat" ); |
||||
m_Behavior_Infected_Approach = IObjectUtils::GetConstructorId( "Behavior_Infected_Approach" ); |
||||
m_Behavior_Infected_HuntWBC = IObjectUtils::GetConstructorId( "Behavior_Infected_HuntWBC" ); |
||||
m_Behavior_Infected_HuntRBC = IObjectUtils::GetConstructorId( "Behavior_Infected_HuntRBC" ); |
||||
m_Behavior_Infected_Idle = IObjectUtils::GetConstructorId( "Behavior_Infected_Idle" ); |
||||
} |
||||
|
||||
private: |
||||
|
||||
IBlackboardManager* m_pBBManager; |
||||
ConstructorId m_Behavior_Infected_Combat; |
||||
ConstructorId m_Behavior_Infected_Approach; |
||||
ConstructorId m_Behavior_Infected_HuntWBC; |
||||
ConstructorId m_Behavior_Infected_HuntRBC; |
||||
ConstructorId m_Behavior_Infected_Idle; |
||||
}; |
||||
|
||||
REGISTERCLASS(BehaviorTree_Infected); |
@ -1,87 +0,0 @@
@@ -1,87 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#include "IBehaviorTree.h" |
||||
#include "IGameObject.h" |
||||
#include "IBlackboard.h" |
||||
#include "IBlackboardManager.h" |
||||
#include "IObjectUtils.h" |
||||
|
||||
#include "BB_Global.h" |
||||
#include "BB_Team_Immune.h" |
||||
#include "BB_Group_RBC.h" |
||||
#include "BB_Individual_RBC.h" |
||||
#include "BB_Individual_Common.h" |
||||
|
||||
#include "../../RuntimeObjectSystem/ObjectInterfacePerModule.h" |
||||
#include "../../Systems/SystemTable.h" |
||||
#include "../../Systems/IEntitySystem.h" |
||||
#include "../../Systems/IAssetSystem.h" |
||||
#include "../../Systems/ILogSystem.h" |
||||
#include "../../RuntimeObjectSystem/ISimpleSerializer.h" |
||||
|
||||
#include <assert.h> |
||||
|
||||
|
||||
class BehaviorTree_RBC : public IBehaviorTree |
||||
{ |
||||
public: |
||||
|
||||
virtual void Execute( IGameObject* pGameObject ) |
||||
{ |
||||
BB_Individual_RBC* pBBIndividual = (BB_Individual_RBC*)m_pBBManager->GetBlackboardIndividual( pGameObject ); |
||||
BB_Individual_Common* pBBCommon = (BB_Individual_Common*)m_pBBManager->GetBlackboardIndividualCommon( pGameObject ); |
||||
|
||||
if ( pBBCommon->enemy_collision_objectid.IsValid() ) |
||||
{ |
||||
pGameObject->SetBehavior( m_Behavior_RBC_Combat ); |
||||
} |
||||
else if ( !pBBCommon->target_position.IsInfinite() ) |
||||
{ |
||||
pGameObject->SetBehavior( m_Behavior_RBC_Approach ); |
||||
} |
||||
/* Demo [Tutorial03]
|
||||
else if ( pBBIndividual->visible_dangerous.Size() > 0 ) |
||||
{ |
||||
pGameObject->SetBehavior( m_Behavior_RBC_Evade ); |
||||
}
|
||||
//*/
|
||||
else |
||||
{ |
||||
pGameObject->SetBehavior( m_Behavior_RBC_Idle ); |
||||
}
|
||||
} |
||||
|
||||
virtual void Init( bool isFirstInit ) |
||||
{ |
||||
m_pBBManager = (IBlackboardManager*)IObjectUtils::GetUniqueInterface( "BlackboardManager", IID_IBLACKBOARDMANAGER ); |
||||
m_Behavior_RBC_Combat = IObjectUtils::GetConstructorId( "Behavior_RBC_Combat" ); |
||||
m_Behavior_RBC_Approach = IObjectUtils::GetConstructorId( "Behavior_RBC_Approach" ); |
||||
// m_Behavior_RBC_Evade = IObjectUtils::GetConstructorId( "Behavior_RBC_Evade" ); /// Demo [Tutorial03]
|
||||
m_Behavior_RBC_Idle = IObjectUtils::GetConstructorId( "Behavior_RBC_Idle" ); |
||||
} |
||||
|
||||
private: |
||||
|
||||
IBlackboardManager* m_pBBManager; |
||||
ConstructorId m_Behavior_RBC_Combat; |
||||
ConstructorId m_Behavior_RBC_Approach; |
||||
// ConstructorId m_Behavior_RBC_Evade; /// Demo [Tutorial03]
|
||||
ConstructorId m_Behavior_RBC_Idle; |
||||
}; |
||||
|
||||
REGISTERCLASS(BehaviorTree_RBC); |
@ -1,94 +0,0 @@
@@ -1,94 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#include "IBehaviorTree.h" |
||||
#include "IGameObject.h" |
||||
#include "IBlackboard.h" |
||||
#include "IBlackboardManager.h" |
||||
#include "IObjectUtils.h" |
||||
|
||||
#include "BB_Global.h" |
||||
#include "BB_Team_Infection.h" |
||||
#include "BB_Group_Virus.h" |
||||
#include "BB_Individual_Virus.h" |
||||
#include "BB_Individual_Common.h" |
||||
|
||||
#include "../../RuntimeObjectSystem/ObjectInterfacePerModule.h" |
||||
#include "../../Systems/SystemTable.h" |
||||
#include "../../Systems/IEntitySystem.h" |
||||
#include "../../Systems/IAssetSystem.h" |
||||
#include "../../Systems/ILogSystem.h" |
||||
#include "../../RuntimeObjectSystem/ISimpleSerializer.h" |
||||
|
||||
#include <assert.h> |
||||
|
||||
|
||||
class BehaviorTree_Virus : public IBehaviorTree |
||||
{ |
||||
public: |
||||
|
||||
virtual void Execute( IGameObject* pGameObject ) |
||||
{ |
||||
BB_Global* pBBGlobal = (BB_Global*)m_pBBManager->GetBlackboardGlobal(); |
||||
BB_Team_Infection* pBBTeam = (BB_Team_Infection*)m_pBBManager->GetBlackboardTeam( pGameObject->GetGameTeam() ); |
||||
BB_Group_Virus* pBBGroup = (BB_Group_Virus*)m_pBBManager->GetBlackboardGroup( pGameObject->GetGameObjectType() ); |
||||
BB_Individual_Virus* pBBIndividual = (BB_Individual_Virus*)m_pBBManager->GetBlackboardIndividual( pGameObject ); |
||||
BB_Individual_Common* pBBCommon = (BB_Individual_Common*)m_pBBManager->GetBlackboardIndividualCommon( pGameObject ); |
||||
|
||||
if ( pBBCommon->enemy_collision_objectid.IsValid() ) |
||||
{ |
||||
pGameObject->SetBehavior( m_Behavior_Virus_Combat ); |
||||
} |
||||
else if ( !pBBCommon->target_position.IsInfinite() ) |
||||
{ |
||||
pGameObject->SetBehavior( m_Behavior_Virus_Approach ); |
||||
} |
||||
else if ( pBBGlobal->infection_team_strength > pBBGlobal->immune_team_strength * 1.2f && pBBGlobal->infection_count > 3 ) |
||||
{ |
||||
pGameObject->SetBehavior( m_Behavior_Virus_HuntWBC ); |
||||
} |
||||
else if ( pBBGlobal->immune_count > 0 ) |
||||
{ |
||||
pGameObject->SetBehavior( m_Behavior_Virus_HuntRBC ); |
||||
} |
||||
else |
||||
{ |
||||
pGameObject->SetBehavior( m_Behavior_Virus_Idle ); |
||||
}
|
||||
} |
||||
|
||||
virtual void Init( bool isFirstInit ) |
||||
{ |
||||
m_pBBManager = (IBlackboardManager*)IObjectUtils::GetUniqueInterface( "BlackboardManager", IID_IBLACKBOARDMANAGER ); |
||||
m_Behavior_Virus_Combat = IObjectUtils::GetConstructorId( "Behavior_Virus_Combat" ); |
||||
m_Behavior_Virus_Approach = IObjectUtils::GetConstructorId( "Behavior_Virus_Approach" ); |
||||
m_Behavior_Virus_HuntWBC = IObjectUtils::GetConstructorId( "Behavior_Virus_HuntWBC" ); |
||||
m_Behavior_Virus_HuntRBC = IObjectUtils::GetConstructorId( "Behavior_Virus_HuntRBC" ); |
||||
m_Behavior_Virus_Idle = IObjectUtils::GetConstructorId( "Behavior_Virus_Idle" ); |
||||
} |
||||
|
||||
private: |
||||
|
||||
IBlackboardManager* m_pBBManager; |
||||
ConstructorId m_Behavior_Virus_Combat; |
||||
ConstructorId m_Behavior_Virus_Approach; |
||||
ConstructorId m_Behavior_Virus_HuntWBC; |
||||
ConstructorId m_Behavior_Virus_HuntRBC; |
||||
ConstructorId m_Behavior_Virus_Idle; |
||||
}; |
||||
|
||||
REGISTERCLASS(BehaviorTree_Virus); |
@ -1,92 +0,0 @@
@@ -1,92 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#include "IBehaviorTree.h" |
||||
#include "IGameObject.h" |
||||
#include "IBlackboard.h" |
||||
#include "IBlackboardManager.h" |
||||
#include "IObjectUtils.h" |
||||
|
||||
#include "BB_Global.h" |
||||
#include "BB_Team_Immune.h" |
||||
#include "BB_Group_WBC.h" |
||||
#include "BB_Individual_WBC.h" |
||||
#include "BB_Individual_Common.h" |
||||
|
||||
#include "../../RuntimeObjectSystem/ObjectInterfacePerModule.h" |
||||
#include "../../Systems/SystemTable.h" |
||||
#include "../../Systems/IEntitySystem.h" |
||||
#include "../../Systems/IAssetSystem.h" |
||||
#include "../../Systems/ILogSystem.h" |
||||
#include "../../RuntimeObjectSystem/ISimpleSerializer.h" |
||||
|
||||
#include <assert.h> |
||||
|
||||
|
||||
class BehaviorTree_WBC : public IBehaviorTree |
||||
{ |
||||
public: |
||||
|
||||
virtual void Execute( IGameObject* pGameObject ) |
||||
{ |
||||
BB_Global* pBBGlobal = (BB_Global*)m_pBBManager->GetBlackboardGlobal(); |
||||
BB_Team_Immune* pBBTeam = (BB_Team_Immune*)m_pBBManager->GetBlackboardTeam( pGameObject->GetGameTeam() ); |
||||
BB_Group_WBC* pBBGroup = (BB_Group_WBC*)m_pBBManager->GetBlackboardGroup( pGameObject->GetGameObjectType() ); |
||||
BB_Individual_WBC* pBBIndividual = (BB_Individual_WBC*)m_pBBManager->GetBlackboardIndividual( pGameObject ); |
||||
BB_Individual_Common* pBBCommon = (BB_Individual_Common*)m_pBBManager->GetBlackboardIndividualCommon( pGameObject ); |
||||
|
||||
if ( pBBCommon->enemy_collision_objectid.IsValid() ) |
||||
{ |
||||
pGameObject->SetBehavior( m_Behavior_WBC_Combat ); |
||||
} |
||||
else if ( !pBBCommon->target_position.IsInfinite() ) |
||||
{ |
||||
pGameObject->SetBehavior( m_Behavior_WBC_Approach ); |
||||
} |
||||
else if ( pBBGlobal->infection_count > 0 ) |
||||
{ |
||||
pGameObject->SetBehavior( m_Behavior_WBC_Patrol ); |
||||
} |
||||
else |
||||
{ |
||||
pGameObject->SetBehavior( m_Behavior_WBC_Idle ); |
||||
}
|
||||
} |
||||
|
||||
virtual void Init( bool isFirstInit ) |
||||
{ |
||||
m_pBBManager = (IBlackboardManager*)IObjectUtils::GetUniqueInterface( "BlackboardManager", IID_IBLACKBOARDMANAGER ); |
||||
m_Behavior_WBC_Combat = IObjectUtils::GetConstructorId( "Behavior_WBC_Combat" ); |
||||
m_Behavior_WBC_Approach = IObjectUtils::GetConstructorId( "Behavior_WBC_Approach" ); |
||||
m_Behavior_WBC_Patrol = IObjectUtils::GetConstructorId( "Behavior_WBC_Patrol" ); |
||||
m_Behavior_WBC_Idle = IObjectUtils::GetConstructorId( "Behavior_WBC_Idle" ); |
||||
} |
||||
|
||||
private: |
||||
|
||||
IBlackboardManager* m_pBBManager; |
||||
ConstructorId m_Behavior_WBC_Combat; |
||||
ConstructorId m_Behavior_WBC_Approach; |
||||
ConstructorId m_Behavior_WBC_Patrol; |
||||
ConstructorId m_Behavior_WBC_Idle; |
||||
}; |
||||
|
||||
REGISTERCLASS(BehaviorTree_WBC); |
||||
|
||||
|
||||
|
||||
|
@ -1,60 +0,0 @@
@@ -1,60 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#include "Behavior_Infected_Base.h" |
||||
|
||||
|
||||
class Behavior_Infected_Approach : public Behavior_Infected_Base |
||||
{ |
||||
public: |
||||
|
||||
virtual void EndBehavior() |
||||
{ |
||||
m_pBBCommon->target_position.SetInfinite(); |
||||
} |
||||
|
||||
virtual void UpdateBehavior( float timeDelta ) |
||||
{ |
||||
if ( !m_pBBCommon->target_position.IsInfinite() ) |
||||
{ |
||||
AUVec3f targetVec = m_pBBCommon->target_position - m_pBBCommon->current_position; |
||||
float distSqr = targetVec.MagnitudeSqr(); |
||||
if ( distSqr < 1.0f ) |
||||
{ |
||||
m_pBBCommon->target_position.SetInfinite(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
virtual AUVec3f CalculateDesiredPosition( float timeDelta ) |
||||
{ |
||||
AUVec3f pos = m_pOwner->GetEntity()->GetPosition(); |
||||
|
||||
if ( !m_pBBCommon->target_position.IsInfinite() )
|
||||
{ |
||||
AUVec3f targetVec = m_pBBCommon->target_position - m_pBBCommon->current_position; |
||||
AUVec3f targetDir = targetVec.GetNormalised(); |
||||
float dist = std::min( targetVec.Magnitude(), m_pOwner->GetMaxSpeed() * timeDelta ); |
||||
pos += targetDir * dist; |
||||
} |
||||
|
||||
return pos; |
||||
} |
||||
|
||||
}; |
||||
|
||||
REGISTERCLASS(Behavior_Infected_Approach); |
@ -1,76 +0,0 @@
@@ -1,76 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#pragma once |
||||
|
||||
#ifndef BEHAVIOR_INFECTED_BASE_INCLUDED |
||||
#define BEHAVIOR_INFECTED_BASE_INCLUDED |
||||
|
||||
#include "../../RuntimeObjectSystem/RuntimeInclude.h" |
||||
RUNTIME_MODIFIABLE_INCLUDE; //adds this include to runtime tracking
|
||||
|
||||
#include "BehaviorCommon.h" |
||||
|
||||
#include "BB_Team_Infection.h" |
||||
#include "BB_Group_Infected.h" |
||||
#include "BB_Individual_Infected.h" |
||||
|
||||
|
||||
class Behavior_Infected_Base : public BehaviorCommon |
||||
{ |
||||
public: |
||||
Behavior_Infected_Base()
|
||||
: m_pBBTeam(0) |
||||
, m_pBBGroup(0) |
||||
, m_pBBIndividual(0) |
||||
{ |
||||
} |
||||
|
||||
virtual void UpdatePerception( float timeDelta ) |
||||
{ |
||||
m_pPerception->GetPerceived( m_pOwner, EGO_WBC, m_pBBIndividual->visible_wbc ); |
||||
m_pPerception->GetPerceived( m_pOwner, EGO_RBC, m_pBBIndividual->visible_rbc ); |
||||
} |
||||
|
||||
virtual void UpdateBlackboards( float timeDelta ) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
|
||||
protected: |
||||
|
||||
virtual void InitGameObjectSpecificPointers() |
||||
{ |
||||
BehaviorCommon::InitGameObjectSpecificPointers(); |
||||
|
||||
IBlackboardManager* m_pBBManager = (IBlackboardManager*)IObjectUtils::GetUniqueInterface( "BlackboardManager", IID_IBLACKBOARDMANAGER ); |
||||
m_pBBTeam = (BB_Team_Infection*)m_pBBManager->GetBlackboardTeam( m_pOwner->GetGameTeam() ); |
||||
m_pBBGroup = (BB_Group_Infected*)m_pBBManager->GetBlackboardGroup( m_pOwner->GetGameObjectType() ); |
||||
m_pBBIndividual = (BB_Individual_Infected*)m_pBBManager->GetBlackboardIndividual( m_pOwner ); |
||||
} |
||||
|
||||
// Private Members
|
||||
|
||||
BB_Team_Infection* m_pBBTeam; |
||||
BB_Group_Infected* m_pBBGroup; |
||||
BB_Individual_Infected* m_pBBIndividual; |
||||
}; |
||||
|
||||
#endif // BEHAVIOR_INFECTED_BASE_INCLUDED
|
||||
|
||||
|
@ -1,108 +0,0 @@
@@ -1,108 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#include "Behavior_Infected_Base.h" |
||||
#include "../../Common/Math.inl" |
||||
|
||||
class Behavior_Infected_Combat : public Behavior_Infected_Base |
||||
{ |
||||
public: |
||||
|
||||
virtual void StartBehavior() |
||||
{ |
||||
m_pEntitySystem = PerModuleInterface::g_pSystemTable->pEntitySystem; |
||||
|
||||
m_pBBCommon->time_to_next_attack = m_pGameObjectParams->attack_speed; |
||||
} |
||||
|
||||
virtual void EndBehavior() |
||||
{ |
||||
m_pBBCommon->enemy_collision_objectid.SetInvalid(); |
||||
m_pBBCommon->time_to_next_attack = 0.0f; |
||||
} |
||||
|
||||
virtual void UpdateBehavior( float timeDelta ) |
||||
{ |
||||
IGameObject* pGameObject = 0; |
||||
IObjectUtils::GetObject( &pGameObject, m_pBBCommon->enemy_collision_objectid ); |
||||
|
||||
m_pBBCommon->time_to_next_attack -= timeDelta; |
||||
if ( m_pBBCommon->time_to_next_attack <= 0.0f ) |
||||
{ |
||||
m_pBBCommon->time_to_next_attack += m_pGameObjectParams->attack_speed; |
||||
|
||||
if (pGameObject && pGameObject->GetBehavior()) |
||||
{ |
||||
float enemyHealth = pGameObject->GetBehavior()->ReceiveDamage( m_pGameObjectParams->attack_damage ); |
||||
if ( enemyHealth <= 0.0f && pGameObject->GetGameObjectType() == EGO_RBC ) |
||||
{ |
||||
ConsumeRBC();
|
||||
pGameObject = 0; |
||||
} |
||||
} |
||||
} |
||||
|
||||
if (!pGameObject || pGameObject->GetGameTeam() == EGT_INFECTION) |
||||
{ |
||||
m_pBBCommon->enemy_collision_objectid.SetInvalid(); |
||||
} |
||||
} |
||||
|
||||
void ConsumeRBC() |
||||
{ |
||||
m_pBBCommon->current_health += m_pGlobalParameters->infected_health_gain_from_eating; |
||||
if (m_pBBCommon->current_health >= m_pGlobalParameters->infected_max_health) |
||||
{ |
||||
// Passed max health, so explode and convert into several viruses
|
||||
m_pGameManager->DestroyGameObject( m_pOwner->GetObjectId() ); |
||||
|
||||
float radius = m_pOwner->GetCollisionRadius() * 0.7f; |
||||
int count = m_pGlobalParameters->infected_num_viruses_on_explode; |
||||
for (int i=0; i<count; ++i) |
||||
{ |
||||
AUVec3f pos = m_pBBCommon->current_position + AUVec3f( |
||||
radius * (float)cos( M_PI * 2 * i / count ), |
||||
0.0f, |
||||
radius * (float)sin( M_PI * 2 * i / count )
|
||||
); |
||||
m_pGameManager->SpawnGameObject( EGO_VIRUS, pos ); |
||||
}
|
||||
}
|
||||
} |
||||
|
||||
virtual AUVec3f CalculateDesiredPosition( float timeDelta ) |
||||
{ |
||||
AUVec3f pos = m_pOwner->GetEntity()->GetPosition(); |
||||
|
||||
IGameObject* pGameObject = 0; |
||||
IObjectUtils::GetObject( &pGameObject, m_pBBCommon->enemy_collision_objectid ); |
||||
if (pGameObject) |
||||
{ |
||||
AUVec3f targetVec = pGameObject->GetEntity()->GetPosition() - m_pBBCommon->current_position; |
||||
AUVec3f targetDir = targetVec.GetNormalised(); |
||||
float dist = std::min( targetVec.Magnitude(), m_pOwner->GetMaxSpeed() * timeDelta ); |
||||
pos += targetDir * dist; |
||||
} |
||||
|
||||
return pos; |
||||
} |
||||
|
||||
private: |
||||
IEntitySystem* m_pEntitySystem; |
||||
}; |
||||
|
||||
REGISTERCLASS(Behavior_Infected_Combat); |
@ -1,121 +0,0 @@
@@ -1,121 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#include "Behavior_Infected_Base.h" |
||||
#include <float.h> |
||||
|
||||
class Behavior_Infected_HuntRBC : public Behavior_Infected_Base |
||||
{ |
||||
public: |
||||
|
||||
Behavior_Infected_HuntRBC()
|
||||
: m_pApproachTarget(0) |
||||
, m_pAvoidTarget(0) |
||||
, m_TimeToNextDirChange(0.0f) |
||||
{} |
||||
|
||||
virtual void Serialize(ISimpleSerializer *pSerializer) |
||||
{ |
||||
BehaviorCommon::Serialize(pSerializer); |
||||
|
||||
SERIALIZE(m_TimeToNextDirChange); |
||||
SERIALIZE(m_PatrolDir); |
||||
SERIALIZEIOBJPTR(m_pApproachTarget); |
||||
SERIALIZEIOBJPTR(m_pAvoidTarget); |
||||
} |
||||
|
||||
virtual void UpdateBehavior( float timeDelta ) |
||||
{ |
||||
// Always look for the closest possible target
|
||||
m_pApproachTarget = 0; |
||||
if ( m_pBBIndividual->visible_rbc.Size() > 0 ) |
||||
{ |
||||
GetClosestApproachTarget(); |
||||
} |
||||
|
||||
m_pAvoidTarget = 0; |
||||
if ( m_pBBIndividual->visible_wbc.Size() > 0 ) |
||||
{ |
||||
GetClosestAvoidTarget(); |
||||
} |
||||
|
||||
if (!m_pApproachTarget && !m_pAvoidTarget) |
||||
{ |
||||
bool bBadHeading = m_pPhysics->IsHeadingToGameBounds( m_pBBCommon->current_position, m_pBBCommon->current_velocity ); |
||||
m_TimeToNextDirChange -= timeDelta; |
||||
if ( bBadHeading || m_TimeToNextDirChange <= 0.0f ) |
||||
{ |
||||
m_TimeToNextDirChange = m_pBBIndividual->patrol_change_frequency; |
||||
m_PatrolDir = AUVec3f((float)rand()/RAND_MAX - 0.5f, 0.0f, (float)rand()/RAND_MAX - 0.5f).GetNormalised(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
virtual AUVec3f CalculateDesiredPosition( float timeDelta ) |
||||
{ |
||||
AUVec3f pos = m_pOwner->GetEntity()->GetPosition(); |
||||
AUVec3f targetVec; |
||||
if (m_pAvoidTarget) |
||||
{ |
||||
targetVec = pos -m_pAvoidTarget->GetEntity()->GetPosition(); |
||||
} |
||||
else if (m_pApproachTarget) |
||||
{ |
||||
targetVec = m_pApproachTarget->GetEntity()->GetPosition() - pos; |
||||
} |
||||
else |
||||
{ |
||||
targetVec = m_PatrolDir * m_pOwner->GetMaxSpeed(); |
||||
} |
||||
|
||||
AUVec3f targetDir = targetVec.GetNormalised(); |
||||
float dist = std::min( targetVec.Magnitude(), m_pOwner->GetMaxSpeed() * timeDelta ); |
||||
pos += targetDir * dist; |
||||
|
||||
return pos; |
||||
} |
||||
|
||||
void GetClosestApproachTarget() |
||||
{ |
||||
float dist = FLT_MAX; |
||||
const AUVec3f& refPos = m_pOwner->GetEntity()->GetPosition(); |
||||
|
||||
GetClosestTarget( m_pBBIndividual->visible_rbc, refPos, dist, &m_pApproachTarget ); |
||||
} |
||||
|
||||
void GetClosestAvoidTarget() |
||||
{ |
||||
float dist = FLT_MAX; |
||||
const AUVec3f& refPos = m_pOwner->GetEntity()->GetPosition(); |
||||
|
||||
GetClosestTarget( m_pBBIndividual->visible_wbc, refPos, dist, &m_pAvoidTarget ); |
||||
|
||||
if ( m_pAvoidTarget && m_pAvoidTarget->GetThreatRating() < m_pOwner->GetThreatRating() ) |
||||
{ |
||||
m_pAvoidTarget = 0; |
||||
} |
||||
} |
||||
|
||||
|
||||
private: |
||||
float m_TimeToNextDirChange; |
||||
AUVec3f m_PatrolDir; |
||||
IGameObject* m_pApproachTarget; |
||||
IGameObject* m_pAvoidTarget; |
||||
}; |
||||
|
||||
REGISTERCLASS(Behavior_Infected_HuntRBC); |
@ -1,96 +0,0 @@
@@ -1,96 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#include "Behavior_Infected_Base.h" |
||||
#include <float.h> |
||||
|
||||
class Behavior_Infected_HuntWBC : public Behavior_Infected_Base |
||||
{ |
||||
public: |
||||
|
||||
Behavior_Infected_HuntWBC()
|
||||
: m_pApproachTarget(0) |
||||
, m_TimeToNextDirChange(0.0f) |
||||
{} |
||||
|
||||
virtual void Serialize(ISimpleSerializer *pSerializer) |
||||
{ |
||||
BehaviorCommon::Serialize(pSerializer); |
||||
|
||||
SERIALIZE(m_TimeToNextDirChange); |
||||
SERIALIZE(m_PatrolDir); |
||||
SERIALIZEIOBJPTR(m_pApproachTarget); |
||||
} |
||||
|
||||
virtual void UpdateBehavior( float timeDelta ) |
||||
{ |
||||
// Always look for the closest possible target
|
||||
m_pApproachTarget = 0; |
||||
if ( m_pBBIndividual->visible_wbc.Size() > 0 ) |
||||
{ |
||||
GetClosestApproachTarget(); |
||||
} |
||||
|
||||
if (!m_pApproachTarget) |
||||
{ |
||||
bool bBadHeading = m_pPhysics->IsHeadingToGameBounds( m_pBBCommon->current_position, m_pBBCommon->current_velocity ); |
||||
m_TimeToNextDirChange -= timeDelta; |
||||
if ( bBadHeading || m_TimeToNextDirChange <= 0.0f ) |
||||
{ |
||||
m_TimeToNextDirChange = m_pBBIndividual->patrol_change_frequency; |
||||
m_PatrolDir = AUVec3f((float)rand()/RAND_MAX - 0.5f, 0.0f, (float)rand()/RAND_MAX - 0.5f).GetNormalised(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
virtual AUVec3f CalculateDesiredPosition( float timeDelta ) |
||||
{ |
||||
AUVec3f pos = m_pOwner->GetEntity()->GetPosition(); |
||||
AUVec3f targetPos; |
||||
if (m_pApproachTarget) |
||||
{ |
||||
targetPos = m_pApproachTarget->GetEntity()->GetPosition(); |
||||
} |
||||
else |
||||
{ |
||||
targetPos = pos + m_PatrolDir * m_pOwner->GetMaxSpeed(); |
||||
} |
||||
|
||||
AUVec3f targetVec = targetPos - pos; |
||||
AUVec3f targetDir = targetVec.GetNormalised(); |
||||
float dist = std::min( targetVec.Magnitude(), m_pOwner->GetMaxSpeed() * timeDelta ); |
||||
pos += targetDir * dist; |
||||
|
||||
return pos; |
||||
} |
||||
|
||||
void GetClosestApproachTarget() |
||||
{ |
||||
float dist = FLT_MAX; |
||||
const AUVec3f& refPos = m_pOwner->GetEntity()->GetPosition(); |
||||
|
||||
GetClosestTarget( m_pBBIndividual->visible_wbc, refPos, dist, &m_pApproachTarget ); |
||||
} |
||||
|
||||
|
||||
private: |
||||
float m_TimeToNextDirChange; |
||||
AUVec3f m_PatrolDir; |
||||
IGameObject* m_pApproachTarget; |
||||
}; |
||||
|
||||
REGISTERCLASS(Behavior_Infected_HuntWBC); |
@ -1,31 +0,0 @@
@@ -1,31 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#include "Behavior_Infected_Base.h" |
||||
|
||||
|
||||
class Behavior_Infected_Idle : public Behavior_Infected_Base |
||||
{ |
||||
public: |
||||
|
||||
virtual void UpdateBehavior( float timeDelta ) |
||||
{ |
||||
// Do nothing
|
||||
} |
||||
}; |
||||
|
||||
REGISTERCLASS(Behavior_Infected_Idle); |
@ -1,60 +0,0 @@
@@ -1,60 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#include "Behavior_RBC_Base.h" |
||||
|
||||
|
||||
class Behavior_RBC_Approach : public Behavior_RBC_Base |
||||
{ |
||||
public: |
||||
|
||||
virtual void EndBehavior() |
||||
{ |
||||
m_pBBCommon->target_position.SetInfinite(); |
||||
} |
||||
|
||||
virtual void UpdateBehavior( float timeDelta ) |
||||
{ |
||||
if ( !m_pBBCommon->target_position.IsInfinite() ) |
||||
{ |
||||
AUVec3f targetVec = m_pBBCommon->target_position - m_pBBCommon->current_position; |
||||
float distSqr = targetVec.MagnitudeSqr(); |
||||
if ( distSqr < 1.0f ) |
||||
{ |
||||
m_pBBCommon->target_position.SetInfinite(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
virtual AUVec3f CalculateDesiredPosition( float timeDelta ) |
||||
{ |
||||
AUVec3f pos = m_pOwner->GetEntity()->GetPosition(); |
||||
|
||||
if ( !m_pBBCommon->target_position.IsInfinite() )
|
||||
{ |
||||
AUVec3f targetVec = m_pBBCommon->target_position - m_pBBCommon->current_position; |
||||
AUVec3f targetDir = targetVec.GetNormalised(); |
||||
float dist = std::min( targetVec.Magnitude(), m_pOwner->GetMaxSpeed() * timeDelta ); |
||||
pos += targetDir * dist; |
||||
} |
||||
|
||||
return pos; |
||||
} |
||||
|
||||
}; |
||||
|
||||
REGISTERCLASS(Behavior_RBC_Approach); |
@ -1,78 +0,0 @@
@@ -1,78 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#pragma once |
||||
|
||||
#ifndef BEHAVIOR_RBC_BASE_INCLUDED |
||||
#define BEHAVIOR_RBC_BASE_INCLUDED |
||||
|
||||
#include "../../RuntimeObjectSystem/RuntimeInclude.h" |
||||
RUNTIME_MODIFIABLE_INCLUDE; //adds this include to runtime tracking
|
||||
|
||||
#include "BehaviorCommon.h" |
||||
|
||||
#include "BB_Team_Immune.h" |
||||
#include "BB_Group_RBC.h" |
||||
#include "BB_Individual_RBC.h" |
||||
|
||||
|
||||
class Behavior_RBC_Base : public BehaviorCommon |
||||
{ |
||||
public: |
||||
Behavior_RBC_Base()
|
||||
: m_pBBTeam(0) |
||||
, m_pBBGroup(0) |
||||
, m_pBBIndividual(0) |
||||
{ |
||||
} |
||||
|
||||
virtual void UpdatePerception( float timeDelta ) |
||||
{ |
||||
/* Demo [Tutorial03]
|
||||
m_pPerception->GetPerceived( m_pOwner, EGO_VIRUS, m_pBBIndividual->visible_dangerous ); // Demo [Tutorial03]
|
||||
m_pPerception->AddPerceived( m_pOwner, EGO_INFECTED, m_pBBIndividual->visible_dangerous ); // Demo [Tutorial03]
|
||||
//*/
|
||||
} |
||||
|
||||
virtual void UpdateBlackboards( float timeDelta ) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
|
||||
protected: |
||||
|
||||
virtual void InitGameObjectSpecificPointers() |
||||
{ |
||||
BehaviorCommon::InitGameObjectSpecificPointers(); |
||||
|
||||
IBlackboardManager* m_pBBManager = (IBlackboardManager*)IObjectUtils::GetUniqueInterface( "BlackboardManager", IID_IBLACKBOARDMANAGER ); |
||||
m_pBBTeam = (BB_Team_Immune*)m_pBBManager->GetBlackboardTeam( m_pOwner->GetGameTeam() ); |
||||
m_pBBGroup = (BB_Group_RBC*)m_pBBManager->GetBlackboardGroup( m_pOwner->GetGameObjectType() ); |
||||
m_pBBIndividual = (BB_Individual_RBC*)m_pBBManager->GetBlackboardIndividual( m_pOwner ); |
||||
} |
||||
|
||||
// Private Members
|
||||
|
||||
BB_Team_Immune* m_pBBTeam; |
||||
BB_Group_RBC* m_pBBGroup; |
||||
BB_Individual_RBC* m_pBBIndividual; |
||||
}; |
||||
|
||||
#endif // BEHAVIOR_RBC_BASE_INCLUDED
|
||||
|
||||
|
@ -1,85 +0,0 @@
@@ -1,85 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#include "Behavior_RBC_Base.h" |
||||
|
||||
|
||||
class Behavior_RBC_Combat : public Behavior_RBC_Base |
||||
{ |
||||
public: |
||||
|
||||
virtual void StartBehavior() |
||||
{ |
||||
m_pEntitySystem = PerModuleInterface::g_pSystemTable->pEntitySystem; |
||||
|
||||
m_pBBCommon->time_to_next_attack = m_pGameObjectParams->attack_speed; |
||||
} |
||||
|
||||
virtual void EndBehavior() |
||||
{ |
||||
m_pBBCommon->enemy_collision_objectid.SetInvalid(); |
||||
m_pBBCommon->time_to_next_attack = 0.0f; |
||||
} |
||||
|
||||
virtual void UpdateBehavior( float timeDelta ) |
||||
{ |
||||
IGameObject* pGameObject = 0; |
||||
IObjectUtils::GetObject( &pGameObject, m_pBBCommon->enemy_collision_objectid ); |
||||
|
||||
m_pBBCommon->time_to_next_attack -= timeDelta; |
||||
if ( m_pBBCommon->time_to_next_attack <= 0.0f ) |
||||
{ |
||||
m_pBBCommon->time_to_next_attack += m_pGameObjectParams->attack_speed; |
||||
|
||||
if (pGameObject && pGameObject->GetBehavior()) |
||||
{ |
||||
float enemyHealth = pGameObject->GetBehavior()->ReceiveDamage( m_pGameObjectParams->attack_damage ); |
||||
if (enemyHealth <= 0.0f) |
||||
{ |
||||
pGameObject = 0; |
||||
} |
||||
} |
||||
} |
||||
|
||||
if (!pGameObject) |
||||
{ |
||||
m_pBBCommon->enemy_collision_objectid.SetInvalid(); |
||||
} |
||||
} |
||||
|
||||
virtual AUVec3f CalculateDesiredPosition( float timeDelta ) |
||||
{ |
||||
AUVec3f pos = m_pOwner->GetEntity()->GetPosition(); |
||||
|
||||
IGameObject* pGameObject = 0; |
||||
IObjectUtils::GetObject( &pGameObject, m_pBBCommon->enemy_collision_objectid ); |
||||
if (pGameObject) |
||||
{ |
||||
AUVec3f targetVec = pGameObject->GetEntity()->GetPosition() - m_pBBCommon->current_position; |
||||
AUVec3f targetDir = targetVec.GetNormalised(); |
||||
float dist = std::min( targetVec.Magnitude(), m_pOwner->GetMaxSpeed() * timeDelta ); |
||||
pos += targetDir * dist; |
||||
} |
||||
|
||||
return pos; |
||||
} |
||||
|
||||
private: |
||||
IEntitySystem* m_pEntitySystem; |
||||
}; |
||||
|
||||
REGISTERCLASS(Behavior_RBC_Combat); |
@ -1,78 +0,0 @@
@@ -1,78 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#include "Behavior_RBC_Base.h" |
||||
#include <float.h> |
||||
|
||||
/* Demo [Tutorial03]
|
||||
class Behavior_RBC_Evade : public Behavior_RBC_Base |
||||
{ |
||||
public: |
||||
|
||||
virtual void StartBehavior() |
||||
{ |
||||
} |
||||
|
||||
virtual void EndBehavior() |
||||
{ |
||||
} |
||||
|
||||
virtual void UpdateBehavior( float timeDelta ) |
||||
{ |
||||
} |
||||
|
||||
virtual AUVec3f CalculateDesiredPosition( float timeDelta ) |
||||
{ |
||||
AUVec3f pos = m_pOwner->GetEntity()->GetPosition(); |
||||
float dist = FLT_MAX;
|
||||
IGameObject* pGameObject = 0; |
||||
|
||||
GetClosestTarget( m_pBBIndividual->visible_dangerous, pos, dist, &pGameObject ); |
||||
|
||||
if (pGameObject) |
||||
{ |
||||
AUVec3f targetVec = pGameObject->GetEntity()->GetPosition() - m_pBBCommon->current_position; |
||||
AUVec3f targetDir = targetVec.GetNormalised() * -1.0f; |
||||
float dist = std::min( targetVec.Magnitude(), m_pOwner->GetMaxSpeed() * timeDelta ); |
||||
pos += targetDir * dist; |
||||
} |
||||
|
||||
return pos; |
||||
} |
||||
}; |
||||
|
||||
REGISTERCLASS(Behavior_RBC_Evade); |
||||
|
||||
//*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class CDummy : public IObject |
||||
{ |
||||
virtual void Serialize(ISimpleSerializer *pSerializer) {} |
||||
}; |
||||
|
||||
REGISTERCLASS(CDummy); |
||||
|
@ -1,31 +0,0 @@
@@ -1,31 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#include "Behavior_RBC_Base.h" |
||||
|
||||
|
||||
class Behavior_RBC_Idle : public Behavior_RBC_Base |
||||
{ |
||||
public: |
||||
|
||||
virtual void UpdateBehavior( float timeDelta ) |
||||
{ |
||||
// Do nothing
|
||||
} |
||||
}; |
||||
|
||||
REGISTERCLASS(Behavior_RBC_Idle); |
@ -1,60 +0,0 @@
@@ -1,60 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#include "Behavior_Virus_Base.h" |
||||
|
||||
|
||||
class Behavior_Virus_Approach : public Behavior_Virus_Base |
||||
{ |
||||
public: |
||||
|
||||
virtual void EndBehavior() |
||||
{ |
||||
m_pBBCommon->target_position.SetInfinite(); |
||||
} |
||||
|
||||
virtual void UpdateBehavior( float timeDelta ) |
||||
{ |
||||
if ( !m_pBBCommon->target_position.IsInfinite() ) |
||||
{ |
||||
AUVec3f targetVec = m_pBBCommon->target_position - m_pBBCommon->current_position; |
||||
float distSqr = targetVec.MagnitudeSqr(); |
||||
if ( distSqr < 1.0f ) |
||||
{ |
||||
m_pBBCommon->target_position.SetInfinite(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
virtual AUVec3f CalculateDesiredPosition( float timeDelta ) |
||||
{ |
||||
AUVec3f pos = m_pOwner->GetEntity()->GetPosition(); |
||||
|
||||
if ( !m_pBBCommon->target_position.IsInfinite() )
|
||||
{ |
||||
AUVec3f targetVec = m_pBBCommon->target_position - m_pBBCommon->current_position; |
||||
AUVec3f targetDir = targetVec.GetNormalised(); |
||||
float dist = std::min( targetVec.Magnitude(), m_pOwner->GetMaxSpeed() * timeDelta ); |
||||
pos += targetDir * dist; |
||||
} |
||||
|
||||
return pos; |
||||
} |
||||
|
||||
}; |
||||
|
||||
REGISTERCLASS(Behavior_Virus_Approach); |
@ -1,76 +0,0 @@
@@ -1,76 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#pragma once |
||||
|
||||
#ifndef BEHAVIOR_VIRUS_BASE_INCLUDED |
||||
#define BEHAVIOR_VIRUS_BASE_INCLUDED |
||||
|
||||
#include "../../RuntimeObjectSystem/RuntimeInclude.h" |
||||
RUNTIME_MODIFIABLE_INCLUDE; //adds this include to runtime tracking
|
||||
|
||||
#include "BehaviorCommon.h" |
||||
|
||||
#include "BB_Team_Infection.h" |
||||
#include "BB_Group_Virus.h" |
||||
#include "BB_Individual_Virus.h" |
||||
|
||||
|
||||
class Behavior_Virus_Base : public BehaviorCommon |
||||
{ |
||||
public: |
||||
Behavior_Virus_Base()
|
||||
: m_pBBTeam(0) |
||||
, m_pBBGroup(0) |
||||
, m_pBBIndividual(0) |
||||
{ |
||||
} |
||||
|
||||
virtual void UpdatePerception( float timeDelta ) |
||||
{ |
||||
m_pPerception->GetPerceived( m_pOwner, EGO_WBC, m_pBBIndividual->visible_wbc ); |
||||
m_pPerception->GetPerceived( m_pOwner, EGO_RBC, m_pBBIndividual->visible_rbc ); |
||||
} |
||||
|
||||
virtual void UpdateBlackboards( float timeDelta ) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
|
||||
protected: |
||||
|
||||
virtual void InitGameObjectSpecificPointers() |
||||
{ |
||||
BehaviorCommon::InitGameObjectSpecificPointers(); |
||||
|
||||
IBlackboardManager* m_pBBManager = (IBlackboardManager*)IObjectUtils::GetUniqueInterface( "BlackboardManager", IID_IBLACKBOARDMANAGER ); |
||||
m_pBBTeam = (BB_Team_Infection*)m_pBBManager->GetBlackboardTeam( m_pOwner->GetGameTeam() ); |
||||
m_pBBGroup = (BB_Group_Virus*)m_pBBManager->GetBlackboardGroup( m_pOwner->GetGameObjectType() ); |
||||
m_pBBIndividual = (BB_Individual_Virus*)m_pBBManager->GetBlackboardIndividual( m_pOwner ); |
||||
} |
||||
|
||||
// Private Members
|
||||
|
||||
BB_Team_Infection* m_pBBTeam; |
||||
BB_Group_Virus* m_pBBGroup; |
||||
BB_Individual_Virus* m_pBBIndividual; |
||||
}; |
||||
|
||||
#endif // BEHAVIOR_VIRUS_BASE_INCLUDED
|
||||
|
||||
|
@ -1,88 +0,0 @@
@@ -1,88 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#include "Behavior_Virus_Base.h" |
||||
|
||||
|
||||
class Behavior_Virus_Combat : public Behavior_Virus_Base |
||||
{ |
||||
public: |
||||
|
||||
virtual void StartBehavior() |
||||
{ |
||||
m_pEntitySystem = PerModuleInterface::g_pSystemTable->pEntitySystem; |
||||
|
||||
m_pBBCommon->time_to_next_attack = m_pGameObjectParams->attack_speed; |
||||
} |
||||
|
||||
virtual void EndBehavior() |
||||
{ |
||||
m_pBBCommon->enemy_collision_objectid.SetInvalid(); |
||||
m_pBBCommon->time_to_next_attack = 0.0f; |
||||
} |
||||
|
||||
virtual void UpdateBehavior( float timeDelta ) |
||||
{ |
||||
IGameObject* pGameObject = 0; |
||||
IObjectUtils::GetObject( &pGameObject, m_pBBCommon->enemy_collision_objectid ); |
||||
|
||||
m_pBBCommon->time_to_next_attack -= timeDelta; |
||||
if ( m_pBBCommon->time_to_next_attack <= 0.0f ) |
||||
{ |
||||
m_pBBCommon->time_to_next_attack += m_pGameObjectParams->attack_speed; |
||||
|
||||
if (pGameObject && pGameObject->GetBehavior()) |
||||
{ |
||||
float enemyHealth = pGameObject->GetBehavior()->ReceiveDamage( m_pGameObjectParams->attack_damage ); |
||||
if ( enemyHealth <= 0.0f && pGameObject->GetGameObjectType() == EGO_RBC ) |
||||
{ |
||||
// Just consumed RBC, convert into an infected cell now
|
||||
m_pGameManager->DestroyGameObject( m_pOwner->GetObjectId() ); |
||||
m_pGameManager->SpawnGameObject( EGO_INFECTED, m_pBBCommon->current_position ); |
||||
pGameObject = 0; |
||||
} |
||||
} |
||||
} |
||||
|
||||
if (!pGameObject || pGameObject->GetGameTeam() == EGT_INFECTION) |
||||
{ |
||||
m_pBBCommon->enemy_collision_objectid.SetInvalid(); |
||||
} |
||||
} |
||||
|
||||
virtual AUVec3f CalculateDesiredPosition( float timeDelta ) |
||||
{ |
||||
AUVec3f pos = m_pOwner->GetEntity()->GetPosition(); |
||||
|
||||
IGameObject* pGameObject = 0; |
||||
IObjectUtils::GetObject( &pGameObject, m_pBBCommon->enemy_collision_objectid ); |
||||
if (pGameObject) |
||||
{ |
||||
AUVec3f targetVec = pGameObject->GetEntity()->GetPosition() - m_pBBCommon->current_position; |
||||
AUVec3f targetDir = targetVec.GetNormalised(); |
||||
float dist = std::min( targetVec.Magnitude(), m_pOwner->GetMaxSpeed() * timeDelta ); |
||||
pos += targetDir * dist; |
||||
} |
||||
|
||||
return pos; |
||||
} |
||||
|
||||
private: |
||||
IEntitySystem* m_pEntitySystem; |
||||
}; |
||||
|
||||
REGISTERCLASS(Behavior_Virus_Combat); |
@ -1,121 +0,0 @@
@@ -1,121 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#include "Behavior_Virus_Base.h" |
||||
#include <float.h> |
||||
|
||||
class Behavior_Virus_HuntRBC : public Behavior_Virus_Base |
||||
{ |
||||
public: |
||||
|
||||
Behavior_Virus_HuntRBC()
|
||||
: m_pApproachTarget(0) |
||||
, m_pAvoidTarget(0) |
||||
, m_TimeToNextDirChange(0.0f) |
||||
{} |
||||
|
||||
virtual void Serialize(ISimpleSerializer *pSerializer) |
||||
{ |
||||
BehaviorCommon::Serialize(pSerializer); |
||||
|
||||
SERIALIZE(m_TimeToNextDirChange); |
||||
SERIALIZE(m_PatrolDir); |
||||
SERIALIZEIOBJPTR(m_pApproachTarget); |
||||
SERIALIZEIOBJPTR(m_pAvoidTarget); |
||||
} |
||||
|
||||
virtual void UpdateBehavior( float timeDelta ) |
||||
{ |
||||
// Always look for the closest possible target
|
||||
m_pApproachTarget = 0; |
||||
if ( m_pBBIndividual->visible_rbc.Size() > 0 ) |
||||
{ |
||||
GetClosestApproachTarget(); |
||||
} |
||||
|
||||
m_pAvoidTarget = 0; |
||||
if ( m_pBBIndividual->visible_wbc.Size() > 0 ) |
||||
{ |
||||
GetClosestAvoidTarget(); |
||||
} |
||||
|
||||
if (!m_pApproachTarget && !m_pAvoidTarget) |
||||
{ |
||||
bool bBadHeading = m_pPhysics->IsHeadingToGameBounds( m_pBBCommon->current_position, m_pBBCommon->current_velocity ); |
||||
m_TimeToNextDirChange -= timeDelta; |
||||
if ( bBadHeading || m_TimeToNextDirChange <= 0.0f ) |
||||
{ |
||||
m_TimeToNextDirChange = m_pBBIndividual->patrol_change_frequency; |
||||
m_PatrolDir = AUVec3f((float)rand()/RAND_MAX - 0.5f, 0.0f, (float)rand()/RAND_MAX - 0.5f).GetNormalised(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
virtual AUVec3f CalculateDesiredPosition( float timeDelta ) |
||||
{ |
||||
AUVec3f pos = m_pOwner->GetEntity()->GetPosition(); |
||||
AUVec3f targetVec; |
||||
if (m_pAvoidTarget) |
||||
{ |
||||
targetVec = pos -m_pAvoidTarget->GetEntity()->GetPosition(); |
||||
} |
||||
else if (m_pApproachTarget) |
||||
{ |
||||
targetVec = m_pApproachTarget->GetEntity()->GetPosition() - pos; |
||||
} |
||||
else |
||||
{ |
||||
targetVec = m_PatrolDir * m_pOwner->GetMaxSpeed(); |
||||
} |
||||
|
||||
AUVec3f targetDir = targetVec.GetNormalised(); |
||||
float dist = std::min( targetVec.Magnitude(), m_pOwner->GetMaxSpeed() * timeDelta ); |
||||
pos += targetDir * dist; |
||||
|
||||
return pos; |
||||
} |
||||
|
||||
void GetClosestApproachTarget() |
||||
{ |
||||
float dist = FLT_MAX; |
||||
const AUVec3f& refPos = m_pOwner->GetEntity()->GetPosition(); |
||||
|
||||
GetClosestTarget( m_pBBIndividual->visible_rbc, refPos, dist, &m_pApproachTarget ); |
||||
} |
||||
|
||||
void GetClosestAvoidTarget() |
||||
{ |
||||
float dist = FLT_MAX; |
||||
const AUVec3f& refPos = m_pOwner->GetEntity()->GetPosition(); |
||||
|
||||
GetClosestTarget( m_pBBIndividual->visible_wbc, refPos, dist, &m_pAvoidTarget ); |
||||
|
||||
if ( m_pAvoidTarget && m_pAvoidTarget->GetThreatRating() < m_pOwner->GetThreatRating() ) |
||||
{ |
||||
m_pAvoidTarget = 0; |
||||
} |
||||
} |
||||
|
||||
|
||||
private: |
||||
float m_TimeToNextDirChange; |
||||
AUVec3f m_PatrolDir; |
||||
IGameObject* m_pApproachTarget; |
||||
IGameObject* m_pAvoidTarget; |
||||
}; |
||||
|
||||
REGISTERCLASS(Behavior_Virus_HuntRBC); |
@ -1,96 +0,0 @@
@@ -1,96 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#include "Behavior_Virus_Base.h" |
||||
#include <float.h> |
||||
|
||||
class Behavior_Virus_HuntWBC : public Behavior_Virus_Base |
||||
{ |
||||
public: |
||||
|
||||
Behavior_Virus_HuntWBC()
|
||||
: m_pApproachTarget(0) |
||||
, m_TimeToNextDirChange(0.0f) |
||||
{} |
||||
|
||||
virtual void Serialize(ISimpleSerializer *pSerializer) |
||||
{ |
||||
BehaviorCommon::Serialize(pSerializer); |
||||
|
||||
SERIALIZE(m_TimeToNextDirChange); |
||||
SERIALIZE(m_PatrolDir); |
||||
SERIALIZEIOBJPTR(m_pApproachTarget); |
||||
} |
||||
|
||||
virtual void UpdateBehavior( float timeDelta ) |
||||
{ |
||||
// Always look for the closest possible target
|
||||
m_pApproachTarget = 0; |
||||
if ( m_pBBIndividual->visible_wbc.Size() > 0 ) |
||||
{ |
||||
GetClosestApproachTarget(); |
||||
} |
||||
|
||||
if (!m_pApproachTarget) |
||||
{ |
||||
bool bBadHeading = m_pPhysics->IsHeadingToGameBounds( m_pBBCommon->current_position, m_pBBCommon->current_velocity ); |
||||
m_TimeToNextDirChange -= timeDelta; |
||||
if ( bBadHeading || m_TimeToNextDirChange <= 0.0f ) |
||||
{ |
||||
m_TimeToNextDirChange = m_pBBIndividual->patrol_change_frequency; |
||||
m_PatrolDir = AUVec3f((float)rand()/RAND_MAX - 0.5f, 0.0f, (float)rand()/RAND_MAX - 0.5f).GetNormalised(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
virtual AUVec3f CalculateDesiredPosition( float timeDelta ) |
||||
{ |
||||
AUVec3f pos = m_pOwner->GetEntity()->GetPosition(); |
||||
AUVec3f targetPos; |
||||
if (m_pApproachTarget) |
||||
{ |
||||
targetPos = m_pApproachTarget->GetEntity()->GetPosition(); |
||||
} |
||||
else |
||||
{ |
||||
targetPos = pos + m_PatrolDir * m_pOwner->GetMaxSpeed(); |
||||
} |
||||
|
||||
AUVec3f targetVec = targetPos - pos; |
||||
AUVec3f targetDir = targetVec.GetNormalised(); |
||||
float dist = std::min( targetVec.Magnitude(), m_pOwner->GetMaxSpeed() * timeDelta ); |
||||
pos += targetDir * dist; |
||||
|
||||
return pos; |
||||
} |
||||
|
||||
void GetClosestApproachTarget() |
||||
{ |
||||
float dist = FLT_MAX; |
||||
const AUVec3f& refPos = m_pOwner->GetEntity()->GetPosition(); |
||||
|
||||
GetClosestTarget( m_pBBIndividual->visible_wbc, refPos, dist, &m_pApproachTarget ); |
||||
} |
||||
|
||||
|
||||
private: |
||||
float m_TimeToNextDirChange; |
||||
AUVec3f m_PatrolDir; |
||||
IGameObject* m_pApproachTarget; |
||||
}; |
||||
|
||||
REGISTERCLASS(Behavior_Virus_HuntWBC); |
@ -1,31 +0,0 @@
@@ -1,31 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#include "Behavior_Virus_Base.h" |
||||
|
||||
|
||||
class Behavior_Virus_Idle : public Behavior_Virus_Base |
||||
{ |
||||
public: |
||||
|
||||
virtual void UpdateBehavior( float timeDelta ) |
||||
{ |
||||
// Do nothing
|
||||
} |
||||
}; |
||||
|
||||
REGISTERCLASS(Behavior_Virus_Idle); |
@ -1,60 +0,0 @@
@@ -1,60 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#include "Behavior_WBC_Base.h" |
||||
|
||||
|
||||
class Behavior_WBC_Approach : public Behavior_WBC_Base |
||||
{ |
||||
public: |
||||
|
||||
virtual void EndBehavior() |
||||
{ |
||||
m_pBBCommon->target_position.SetInfinite(); |
||||
} |
||||
|
||||
virtual void UpdateBehavior( float timeDelta ) |
||||
{ |
||||
if ( !m_pBBCommon->target_position.IsInfinite() ) |
||||
{ |
||||
AUVec3f targetVec = m_pBBCommon->target_position - m_pBBCommon->current_position; |
||||
float distSqr = targetVec.MagnitudeSqr(); |
||||
if ( distSqr < 1.0f ) |
||||
{ |
||||
m_pBBCommon->target_position.SetInfinite(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
virtual AUVec3f CalculateDesiredPosition( float timeDelta ) |
||||
{ |
||||
AUVec3f pos = m_pOwner->GetEntity()->GetPosition(); |
||||
|
||||
if ( !m_pBBCommon->target_position.IsInfinite() )
|
||||
{ |
||||
AUVec3f targetVec = m_pBBCommon->target_position - m_pBBCommon->current_position; |
||||
AUVec3f targetDir = targetVec.GetNormalised(); |
||||
float dist = std::min( targetVec.Magnitude(), m_pOwner->GetMaxSpeed() * timeDelta ); |
||||
pos += targetDir * dist; |
||||
} |
||||
|
||||
return pos; |
||||
} |
||||
|
||||
}; |
||||
|
||||
REGISTERCLASS(Behavior_WBC_Approach); |
@ -1,76 +0,0 @@
@@ -1,76 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#pragma once |
||||
|
||||
#ifndef BEHAVIOR_WBC_BASE_INCLUDED |
||||
#define BEHAVIOR_WBC_BASE_INCLUDED |
||||
|
||||
#include "../../RuntimeObjectSystem/RuntimeInclude.h" |
||||
RUNTIME_MODIFIABLE_INCLUDE; //adds this include to runtime tracking
|
||||
|
||||
#include "BehaviorCommon.h" |
||||
|
||||
#include "BB_Team_Immune.h" |
||||
#include "BB_Group_WBC.h" |
||||
#include "BB_Individual_WBC.h" |
||||
|
||||
|
||||
class Behavior_WBC_Base : public BehaviorCommon |
||||
{ |
||||
public: |
||||
Behavior_WBC_Base()
|
||||
: m_pBBTeam(0) |
||||
, m_pBBGroup(0) |
||||
, m_pBBIndividual(0) |
||||
{ |
||||
} |
||||
|
||||
virtual void UpdatePerception( float timeDelta ) |
||||
{ |
||||
m_pPerception->GetPerceived( m_pOwner, EGO_VIRUS, m_pBBIndividual->visible_viruses ); |
||||
m_pPerception->GetPerceived( m_pOwner, EGO_INFECTED, m_pBBIndividual->visible_infected ); |
||||
} |
||||
|
||||
virtual void UpdateBlackboards( float timeDelta ) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
|
||||
protected: |
||||
|
||||
virtual void InitGameObjectSpecificPointers() |
||||
{ |
||||
BehaviorCommon::InitGameObjectSpecificPointers(); |
||||
|
||||
IBlackboardManager* m_pBBManager = (IBlackboardManager*)IObjectUtils::GetUniqueInterface( "BlackboardManager", IID_IBLACKBOARDMANAGER ); |
||||
m_pBBTeam = (BB_Team_Immune*)m_pBBManager->GetBlackboardTeam( m_pOwner->GetGameTeam() ); |
||||
m_pBBGroup = (BB_Group_WBC*)m_pBBManager->GetBlackboardGroup( m_pOwner->GetGameObjectType() ); |
||||
m_pBBIndividual = (BB_Individual_WBC*)m_pBBManager->GetBlackboardIndividual( m_pOwner ); |
||||
} |
||||
|
||||
// Private Members
|
||||
|
||||
BB_Team_Immune* m_pBBTeam; |
||||
BB_Group_WBC* m_pBBGroup; |
||||
BB_Individual_WBC* m_pBBIndividual; |
||||
}; |
||||
|
||||
#endif // BEHAVIOR_WBC_BASE_INCLUDED
|
||||
|
||||
|
@ -1,85 +0,0 @@
@@ -1,85 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#include "Behavior_WBC_Base.h" |
||||
|
||||
|
||||
class Behavior_WBC_Combat : public Behavior_WBC_Base |
||||
{ |
||||
public: |
||||
|
||||
virtual void StartBehavior() |
||||
{ |
||||
m_pEntitySystem = PerModuleInterface::g_pSystemTable->pEntitySystem; |
||||
|
||||
m_pBBCommon->time_to_next_attack = m_pGameObjectParams->attack_speed; |
||||
} |
||||
|
||||
virtual void EndBehavior() |
||||
{ |
||||
m_pBBCommon->enemy_collision_objectid.SetInvalid(); |
||||
m_pBBCommon->time_to_next_attack = 0.0f; |
||||
} |
||||
|
||||
virtual void UpdateBehavior( float timeDelta ) |
||||
{ |
||||
IGameObject* pGameObject = 0; |
||||
IObjectUtils::GetObject( &pGameObject, m_pBBCommon->enemy_collision_objectid ); |
||||
|
||||
m_pBBCommon->time_to_next_attack -= timeDelta; |
||||
if ( m_pBBCommon->time_to_next_attack <= 0.0f ) |
||||
{ |
||||
m_pBBCommon->time_to_next_attack += m_pGameObjectParams->attack_speed; |
||||
|
||||
if (pGameObject && pGameObject->GetBehavior()) |
||||
{ |
||||
float enemyHealth = pGameObject->GetBehavior()->ReceiveDamage( m_pGameObjectParams->attack_damage ); |
||||
if (enemyHealth <= 0.0f) |
||||
{ |
||||
pGameObject = 0; |
||||
} |
||||
} |
||||
} |
||||
|
||||
if (!pGameObject) |
||||
{ |
||||
m_pBBCommon->enemy_collision_objectid.SetInvalid(); |
||||
} |
||||
} |
||||
|
||||
virtual AUVec3f CalculateDesiredPosition( float timeDelta ) |
||||
{ |
||||
AUVec3f pos = m_pOwner->GetEntity()->GetPosition(); |
||||
|
||||
IGameObject* pGameObject = 0; |
||||
IObjectUtils::GetObject( &pGameObject, m_pBBCommon->enemy_collision_objectid ); |
||||
if (pGameObject) |
||||
{ |
||||
AUVec3f targetVec = pGameObject->GetEntity()->GetPosition() - m_pBBCommon->current_position; |
||||
AUVec3f targetDir = targetVec.GetNormalised(); |
||||
float dist = std::min( targetVec.Magnitude(), m_pOwner->GetMaxSpeed() * timeDelta ); |
||||
pos += targetDir * dist; |
||||
} |
||||
|
||||
return pos; |
||||
} |
||||
|
||||
private: |
||||
IEntitySystem* m_pEntitySystem; |
||||
}; |
||||
|
||||
REGISTERCLASS(Behavior_WBC_Combat); |
@ -1,31 +0,0 @@
@@ -1,31 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#include "Behavior_WBC_Base.h" |
||||
|
||||
|
||||
class Behavior_WBC_Idle : public Behavior_WBC_Base |
||||
{ |
||||
public: |
||||
|
||||
virtual void UpdateBehavior( float timeDelta ) |
||||
{ |
||||
// Do nothing
|
||||
} |
||||
}; |
||||
|
||||
REGISTERCLASS(Behavior_WBC_Idle); |
@ -1,97 +0,0 @@
@@ -1,97 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#include "Behavior_WBC_Base.h" |
||||
#include <float.h> |
||||
|
||||
class Behavior_WBC_Patrol : public Behavior_WBC_Base |
||||
{ |
||||
public: |
||||
|
||||
Behavior_WBC_Patrol()
|
||||
: m_pApproachTarget(0) |
||||
, m_TimeToNextDirChange(0.0f) |
||||
{} |
||||
|
||||
virtual void Serialize(ISimpleSerializer *pSerializer) |
||||
{ |
||||
BehaviorCommon::Serialize(pSerializer); |
||||
|
||||
SERIALIZE(m_TimeToNextDirChange); |
||||
SERIALIZE(m_PatrolDir); |
||||
SERIALIZEIOBJPTR(m_pApproachTarget); |
||||
} |
||||
|
||||
virtual void UpdateBehavior( float timeDelta ) |
||||
{ |
||||
// Always look for the closest possible target
|
||||
m_pApproachTarget = 0; |
||||
if ( m_pBBIndividual->visible_infected.Size() > 0 || m_pBBIndividual->visible_viruses.Size() > 0 ) |
||||
{ |
||||
GetClosestApproachTarget(); |
||||
} |
||||
|
||||
if (!m_pApproachTarget) |
||||
{ |
||||
bool bBadHeading = m_pPhysics->IsHeadingToGameBounds( m_pBBCommon->current_position, m_pBBCommon->current_velocity ); |
||||
m_TimeToNextDirChange -= timeDelta; |
||||
if ( bBadHeading || m_TimeToNextDirChange <= 0.0f ) |
||||
{ |
||||
m_TimeToNextDirChange = m_pBBIndividual->patrol_change_frequency; |
||||
m_PatrolDir = AUVec3f((float)rand()/RAND_MAX - 0.5f, 0.0f, (float)rand()/RAND_MAX - 0.5f).GetNormalised(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
virtual AUVec3f CalculateDesiredPosition( float timeDelta ) |
||||
{ |
||||
AUVec3f pos = m_pOwner->GetEntity()->GetPosition(); |
||||
AUVec3f targetPos; |
||||
if (m_pApproachTarget) |
||||
{ |
||||
targetPos = m_pApproachTarget->GetEntity()->GetPosition(); |
||||
} |
||||
else |
||||
{ |
||||
targetPos = pos + m_PatrolDir * m_pOwner->GetMaxSpeed(); |
||||
} |
||||
|
||||
AUVec3f targetVec = targetPos - pos; |
||||
AUVec3f targetDir = targetVec.GetNormalised(); |
||||
float dist = std::min( targetVec.Magnitude(), m_pOwner->GetMaxSpeed() * timeDelta ); |
||||
pos += targetDir * dist; |
||||
|
||||
return pos; |
||||
} |
||||
|
||||
virtual void GetClosestApproachTarget() |
||||
{ |
||||
float dist = FLT_MAX; |
||||
const AUVec3f& refPos = m_pOwner->GetEntity()->GetPosition(); |
||||
|
||||
GetClosestTarget( m_pBBIndividual->visible_infected, refPos, dist, &m_pApproachTarget ); |
||||
GetClosestTarget( m_pBBIndividual->visible_viruses, refPos, dist, &m_pApproachTarget ); |
||||
} |
||||
|
||||
|
||||
private: |
||||
float m_TimeToNextDirChange; |
||||
AUVec3f m_PatrolDir; |
||||
IGameObject* m_pApproachTarget; |
||||
}; |
||||
|
||||
REGISTERCLASS(Behavior_WBC_Patrol); |
@ -1,391 +0,0 @@
@@ -1,391 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#include "IBlackboardManager.h" |
||||
#include "IGameObject.h" |
||||
#include "IGameManager.h" |
||||
#include "IObjectUtils.h" |
||||
#include "GlobalParameters.h" |
||||
#include "IObjectUtils.h" |
||||
|
||||
#include "BB_Individual_WBC.h" |
||||
#include "BB_Individual_RBC.h" |
||||
#include "BB_Individual_Virus.h" |
||||
#include "BB_Individual_Infected.h" |
||||
#include "BB_Individual_Common.h" |
||||
#include "BB_Team_Immune.h" |
||||
#include "BB_Team_Infection.h" |
||||
#include "BB_Group_WBC.h" |
||||
#include "BB_Group_RBC.h" |
||||
#include "BB_Group_Virus.h" |
||||
#include "BB_Group_Infected.h" |
||||
#include "BB_Global.h" |
||||
|
||||
#include "../../RuntimeObjectSystem/ObjectInterfacePerModule.h" |
||||
#include "../../Systems/SystemTable.h" |
||||
#include "../../RuntimeObjectSystem/IObjectFactorySystem.h" |
||||
#include "../../Systems/ILogSystem.h" |
||||
#include "../../RuntimeObjectSystem/ISimpleSerializer.h" |
||||
|
||||
#include <assert.h> |
||||
#include <map> |
||||
#include <vector> |
||||
|
||||
|
||||
class BlackboardManager: public IBlackboardManager, public IGameEventListener |
||||
{ |
||||
public: |
||||
BlackboardManager()
|
||||
{ |
||||
m_pGameManager = 0; |
||||
m_pGlobalParameters = 0; |
||||
m_pBlackboardGlobal = 0; |
||||
m_BlackboardTeam.resize(EGT_COUNT); |
||||
m_BlackboardGroup.resize(EGO_COUNT); |
||||
} |
||||
|
||||
virtual ~BlackboardManager() |
||||
{ |
||||
((IGameManager*)IObjectUtils::GetUniqueInterface( "GameManager", IID_IGAMEMANAGER ))->RemoveListener(this); |
||||
|
||||
if (!IsRuntimeDelete()) |
||||
{ |
||||
DestroyAllBlackboards(); |
||||
} |
||||
} |
||||
|
||||
// IObject
|
||||
|
||||
virtual void Serialize(ISimpleSerializer *pSerializer) |
||||
{ |
||||
SERIALIZEIOBJPTR(m_pBlackboardGlobal); |
||||
SERIALIZE(m_BlackboardTeam); |
||||
SERIALIZE(m_BlackboardGroup); |
||||
SERIALIZE(m_BlackboardIndividual); |
||||
SERIALIZE(m_BlackboardIndividualCommon); |
||||
} |
||||
|
||||
virtual void Init( bool isFirstInit ) |
||||
{ |
||||
IGameManager* pGameManager = (IGameManager*)IObjectUtils::GetUniqueInterface( "GameManager", IID_IGAMEMANAGER ); |
||||
pGameManager->AddListener(this); |
||||
m_pGlobalParameters = pGameManager->GetGlobalParameters(); |
||||
|
||||
if (isFirstInit) |
||||
{ |
||||
CreateSharedBlackboards(); |
||||
} |
||||
} |
||||
|
||||
// ~IObject
|
||||
|
||||
// IGameEventListener
|
||||
|
||||
virtual void OnGameObjectCreated( IGameObject* pGameObject ) |
||||
{ |
||||
EGameTeam team = pGameObject->GetGameTeam(); |
||||
EGameObject type = pGameObject->GetGameObjectType(); |
||||
|
||||
CreateIndividualBlackboards(pGameObject); |
||||
|
||||
// Set/Modify appropriate blackboard values
|
||||
SetInitialCommonValues( pGameObject ); |
||||
ModifyGlobalTeamCount( team, 1 ); |
||||
ModifyTeamCount( team, 1 ); |
||||
ModifyGroupCount( type, 1 ); |
||||
} |
||||
|
||||
virtual void OnGameObjectAboutToDestroy( IGameObject* pGameObject ) |
||||
{ |
||||
EGameTeam team = pGameObject->GetGameTeam(); |
||||
EGameObject type = pGameObject->GetGameObjectType(); |
||||
|
||||
ModifyGlobalTeamCount( team, -1 ); |
||||
ModifyTeamCount( team, -1 );
|
||||
ModifyGroupCount( type, -1 ); |
||||
|
||||
DestroyBlackboardIndividual(pGameObject->GetObjectId()); |
||||
DestroyBlackboardIndividualCommon(pGameObject->GetObjectId()); |
||||
} |
||||
|
||||
// ~IGameEventListener
|
||||
|
||||
// IBlackboardManager
|
||||
|
||||
virtual IBlackboard* GetBlackboardGlobal() const |
||||
{ |
||||
return m_pBlackboardGlobal; |
||||
} |
||||
|
||||
virtual IBlackboard* GetBlackboardTeam( EGameTeam team ) const |
||||
{ |
||||
IBlackboard* pBlackboard = 0; |
||||
|
||||
if (m_BlackboardTeam[team].IsValid()) |
||||
{ |
||||
IObjectUtils::GetObject( &pBlackboard, m_BlackboardTeam[team] ); |
||||
} |
||||
|
||||
return pBlackboard; |
||||
} |
||||
|
||||
virtual IBlackboard* GetBlackboardGroup( EGameObject type ) const |
||||
{ |
||||
IBlackboard* pBlackboard = 0; |
||||
|
||||
if (m_BlackboardGroup[type].IsValid()) |
||||
{ |
||||
IObjectUtils::GetObject( &pBlackboard, m_BlackboardGroup[type] ); |
||||
} |
||||
|
||||
return pBlackboard; |
||||
} |
||||
|
||||
virtual IBlackboard* GetBlackboardIndividual( const IGameObject* pGameObject ) const |
||||
{ |
||||
IBlackboard* pBlackboard = 0; |
||||
|
||||
TIndividualMap::const_iterator it = m_BlackboardIndividual.find( pGameObject->GetObjectId() ); |
||||
if (it != m_BlackboardIndividual.end()) |
||||
{ |
||||
IObjectUtils::GetObject( &pBlackboard, it->second ); |
||||
} |
||||
|
||||
return pBlackboard; |
||||
} |
||||
|
||||
virtual IBlackboard* GetBlackboardIndividualCommon( const IGameObject* pGameObject ) const |
||||
{ |
||||
IBlackboard* pBlackboard = 0; |
||||
|
||||
TIndividualMap::const_iterator it = m_BlackboardIndividualCommon.find( pGameObject->GetObjectId() ); |
||||
if (it != m_BlackboardIndividualCommon.end()) |
||||
{ |
||||
IObjectUtils::GetObject( &pBlackboard, it->second ); |
||||
} |
||||
|
||||
return pBlackboard; |
||||
} |
||||
|
||||
virtual void ResetBlackboards() |
||||
{ |
||||
DestroyAllBlackboards(); |
||||
CreateSharedBlackboards(); |
||||
} |
||||
|
||||
// ~IBlackboardManager
|
||||
|
||||
|
||||
private: |
||||
|
||||
void CreateSharedBlackboards() |
||||
{ |
||||
// Global
|
||||
AU_ASSERT(!m_pBlackboardGlobal); |
||||
IObjectUtils::CreateObject( &m_pBlackboardGlobal, "BB_Global" ); |
||||
|
||||
// Team
|
||||
m_BlackboardTeam[EGT_IMMUNE] = IObjectUtils::CreateObject( "BB_Team_Immune" )->GetObjectId(); |
||||
m_BlackboardTeam[EGT_INFECTION] = IObjectUtils::CreateObject( "BB_Team_Infection" )->GetObjectId(); |
||||
|
||||
// Group
|
||||
m_BlackboardGroup[EGO_WBC] = IObjectUtils::CreateObject( "BB_Group_WBC" )->GetObjectId(); |
||||
m_BlackboardGroup[EGO_RBC] = IObjectUtils::CreateObject( "BB_Group_RBC" )->GetObjectId(); |
||||
m_BlackboardGroup[EGO_VIRUS] = IObjectUtils::CreateObject( "BB_Group_Virus" )->GetObjectId(); |
||||
m_BlackboardGroup[EGO_INFECTED] = IObjectUtils::CreateObject( "BB_Group_Infected" )->GetObjectId(); |
||||
} |
||||
|
||||
void CreateIndividualBlackboards( IGameObject* pGameObject ) |
||||
{ |
||||
ObjectId id = pGameObject->GetObjectId(); |
||||
|
||||
// Individual
|
||||
TIndividualMap::iterator it = m_BlackboardIndividual.find(id); |
||||
AU_ASSERT(it == m_BlackboardIndividual.end()); |
||||
if (it == m_BlackboardIndividual.end()) |
||||
{ |
||||
const char* text = 0; |
||||
switch (pGameObject->GetGameObjectType()) |
||||
{ |
||||
case EGO_WBC: text = "BB_Individual_WBC"; break; |
||||
case EGO_RBC: text = "BB_Individual_RBC"; break; |
||||
case EGO_VIRUS: text = "BB_Individual_Virus"; break; |
||||
case EGO_INFECTED: text = "BB_Individual_Infected"; break; |
||||
default: AU_ASSERT(false); |
||||
} |
||||
|
||||
m_BlackboardIndividual[id] = IObjectUtils::CreateObject( text )->GetObjectId(); |
||||
} |
||||
|
||||
// IndividualCommon
|
||||
it = m_BlackboardIndividualCommon.find(id); |
||||
AU_ASSERT(it == m_BlackboardIndividualCommon.end()); |
||||
if (it == m_BlackboardIndividualCommon.end()) |
||||
{ |
||||
m_BlackboardIndividualCommon[id] = IObjectUtils::CreateObject( "BB_Individual_Common" )->GetObjectId(); |
||||
} |
||||
} |
||||
|
||||
void DestroyBlackboardIndividual( ObjectId id ) |
||||
{ |
||||
TIndividualMap::iterator it = m_BlackboardIndividual.find(id); |
||||
if (it != m_BlackboardIndividual.end()) |
||||
{ |
||||
IObjectFactorySystem* pFactory = PerModuleInterface::g_pSystemTable->pObjectFactorySystem; |
||||
IObject* pObj = pFactory->GetObject(it->second); |
||||
delete pObj; |
||||
|
||||
m_BlackboardIndividual.erase(it); |
||||
} |
||||
} |
||||
|
||||
void DestroyBlackboardIndividualCommon( ObjectId id ) |
||||
{ |
||||
TIndividualMap::iterator it = m_BlackboardIndividualCommon.find(id); |
||||
if (it != m_BlackboardIndividualCommon.end()) |
||||
{ |
||||
IObjectFactorySystem* pFactory = PerModuleInterface::g_pSystemTable->pObjectFactorySystem; |
||||
IObject* pObj = pFactory->GetObject(it->second); |
||||
delete pObj; |
||||
|
||||
m_BlackboardIndividualCommon.erase(it); |
||||
} |
||||
} |
||||
|
||||
void DestroyAllBlackboards() |
||||
{ |
||||
IObjectFactorySystem* pFactory = PerModuleInterface::g_pSystemTable->pObjectFactorySystem; |
||||
IObject* pObj = 0; |
||||
|
||||
delete m_pBlackboardGlobal; |
||||
m_pBlackboardGlobal = 0; |
||||
|
||||
for (int i=0; i<EGT_COUNT; ++i) |
||||
{ |
||||
pObj = pFactory->GetObject(m_BlackboardTeam[i]); |
||||
delete pObj; |
||||
m_BlackboardTeam[i] = ObjectId(); |
||||
} |
||||
|
||||
for (int i=0; i<EGO_COUNT; ++i) |
||||
{
|
||||
pObj = pFactory->GetObject(m_BlackboardGroup[i]); |
||||
delete pObj; |
||||
m_BlackboardGroup[i] = ObjectId(); |
||||
} |
||||
|
||||
TIndividualMap::iterator it = m_BlackboardIndividual.begin(); |
||||
TIndividualMap::iterator itEnd = m_BlackboardIndividual.end(); |
||||
while (it != itEnd) |
||||
{ |
||||
pObj = pFactory->GetObject(it->second); |
||||
delete pObj; |
||||
++it; |
||||
} |
||||
m_BlackboardIndividual.clear(); |
||||
|
||||
it = m_BlackboardIndividualCommon.begin(); |
||||
itEnd = m_BlackboardIndividualCommon.end(); |
||||
while (it != itEnd) |
||||
{ |
||||
pObj = pFactory->GetObject(it->second); |
||||
delete pObj; |
||||
++it; |
||||
} |
||||
m_BlackboardIndividualCommon.clear(); |
||||
} |
||||
|
||||
void ModifyTeamCount( EGameTeam team, int delta ) |
||||
{ |
||||
IBlackboard* pTeam = GetBlackboardTeam(team); |
||||
|
||||
switch (team) |
||||
{ |
||||
case EGT_IMMUNE: ((BB_Team_Immune*)pTeam)->team_size += delta; break; |
||||
case EGT_INFECTION: ((BB_Team_Infection*)pTeam)->team_size += delta; break; |
||||
default: AU_ASSERT(false); |
||||
} |
||||
} |
||||
|
||||
void ModifyGroupCount( EGameObject type, int delta ) |
||||
{ |
||||
IBlackboard* pGroup = GetBlackboardGroup(type); |
||||
|
||||
switch (type) |
||||
{ |
||||
case EGO_WBC: ((BB_Group_WBC*)pGroup)->group_size += delta; break; |
||||
case EGO_RBC: ((BB_Group_RBC*)pGroup)->group_size += delta; break; |
||||
case EGO_VIRUS: ((BB_Group_Virus*)pGroup)->group_size += delta; break; |
||||
case EGO_INFECTED: ((BB_Group_Infected*)pGroup)->group_size += delta; break; |
||||
default: AU_ASSERT(false); |
||||
} |
||||
} |
||||
|
||||
void ModifyGlobalTeamCount( EGameTeam team, int delta ) |
||||
{ |
||||
BB_Global* pBBGlobal = (BB_Global*)GetBlackboardGlobal(); |
||||
if (team == EGT_IMMUNE) |
||||
{ |
||||
pBBGlobal->immune_count += delta; |
||||
} |
||||
else |
||||
{ |
||||
pBBGlobal->infection_count += delta; |
||||
} |
||||
} |
||||
|
||||
void SetInitialCommonValues( IGameObject* pGameObject ) |
||||
{ |
||||
BB_Individual_Common* pCommon = (BB_Individual_Common*)GetBlackboardIndividualCommon( pGameObject ); |
||||
GameObjectParams& params = m_pGlobalParameters->go[pGameObject->GetGameObjectType()]; |
||||
pCommon->current_health = params.initial_health; |
||||
pCommon->max_speed = params.max_speed; |
||||
pCommon->current_position = pGameObject->GetEntity()->GetPosition(); |
||||
} |
||||
|
||||
// Private Members
|
||||
|
||||
typedef std::map<ObjectId, ObjectId> TIndividualMap; |
||||
typedef std::vector<ObjectId> TObjectList; |
||||
|
||||
IGameManager* m_pGameManager; |
||||
GlobalParameters* m_pGlobalParameters; |
||||
IBlackboard* m_pBlackboardGlobal; |
||||
TObjectList m_BlackboardTeam; |
||||
TObjectList m_BlackboardGroup; |
||||
TIndividualMap m_BlackboardIndividual; |
||||
TIndividualMap m_BlackboardIndividualCommon; |
||||
}; |
||||
|
||||
REGISTERCLASS(BlackboardManager); |
||||
|
||||
// Register all blackboard classes here, since they're defined in headers
|
||||
// And we get a link error if they get registered in more than one place
|
||||
|
||||
REGISTERCLASS(BB_Global); |
||||
REGISTERCLASS(BB_Team_Infection); |
||||
REGISTERCLASS(BB_Team_Immune); |
||||
REGISTERCLASS(BB_Group_WBC); |
||||
REGISTERCLASS(BB_Group_Virus); |
||||
REGISTERCLASS(BB_Group_RBC); |
||||
REGISTERCLASS(BB_Group_Infected); |
||||
REGISTERCLASS(BB_Individual_Common); |
||||
REGISTERCLASS(BB_Individual_WBC); |
||||
REGISTERCLASS(BB_Individual_RBC); |
||||
REGISTERCLASS(BB_Individual_Virus); |
||||
REGISTERCLASS(BB_Individual_Infected); |
||||
|
@ -1,177 +0,0 @@
@@ -1,177 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#include "ICameraControl.h" |
||||
|
||||
#include "../../Common/Math.inl" |
||||
#include "../../RuntimeObjectSystem/ObjectInterfacePerModule.h" |
||||
#include "../../Systems/SystemTable.h" |
||||
#include "../../Systems/IEntitySystem.h" |
||||
#include "../../Systems/IAssetSystem.h" |
||||
#include "../../Systems/ILogSystem.h" |
||||
#include "../../RuntimeObjectSystem/ISimpleSerializer.h" |
||||
#include "../../Systems/IGame.h" |
||||
|
||||
#include <cmath> |
||||
#include <assert.h> |
||||
#include <algorithm> |
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// We serialize all the current camera values if any have been changed
|
||||
// via ICameraControl interface, otherwise we reload the initial values
|
||||
// below, allowing them to be experimented with at runtime
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// Initial Values
|
||||
static const AUVec3f initialPos = AUVec3f( 0.0f, -1000.0f, 0.0f ); |
||||
static const float initialMoveSpeed = 10.0f; |
||||
|
||||
|
||||
class CameraControl: public ICameraControl |
||||
{ |
||||
public: |
||||
CameraControl()
|
||||
{ |
||||
m_bModified = false; |
||||
|
||||
m_currentPos = initialPos; |
||||
m_targetPos = initialPos; |
||||
m_fMoveSpeed = initialMoveSpeed; |
||||
|
||||
m_fWindowWidth = 0; |
||||
m_fWindowHeight = 0; |
||||
} |
||||
|
||||
virtual ~CameraControl() |
||||
{ |
||||
if( m_pEntity ) |
||||
{ |
||||
m_pEntity->SetUpdateable(NULL); |
||||
} |
||||
} |
||||
|
||||
|
||||
// IEntityObject
|
||||
|
||||
virtual void Serialize(ISimpleSerializer *pSerializer) |
||||
{ |
||||
AU_ASSERT(pSerializer); |
||||
IEntityObject::Serialize(pSerializer); |
||||
SERIALIZE(m_bModified); |
||||
if (m_bModified) |
||||
{ |
||||
SERIALIZE(m_currentPos); |
||||
SERIALIZE(m_targetPos); |
||||
SERIALIZE(m_fMoveSpeed); |
||||
} |
||||
} |
||||
|
||||
virtual void Init( bool isFirstInit ) |
||||
{ |
||||
m_pEntity->SetUpdateable( this ); |
||||
|
||||
PerModuleInterface::g_pSystemTable->pGame->GetWindowSize( m_fWindowWidth, m_fWindowHeight ); |
||||
} |
||||
|
||||
// ~IEntityObject
|
||||
|
||||
// IAUUpdateable
|
||||
|
||||
virtual void Update( float deltaTime ) |
||||
{ |
||||
if (m_currentPos != m_targetPos) |
||||
{ |
||||
float fDist = (m_targetPos - m_currentPos).Magnitude(); |
||||
float fFrameDist = std::min(fDist, m_fMoveSpeed * deltaTime); |
||||
float fInterp = fFrameDist / fDist; |
||||
m_currentPos = m_currentPos.Lerp(m_targetPos, fInterp); |
||||
} |
||||
} |
||||
|
||||
// ~IAUUpdateable
|
||||
|
||||
// ICameraControl
|
||||
|
||||
virtual AUVec3f GetCurrentPos() const |
||||
{ |
||||
return m_currentPos; |
||||
} |
||||
|
||||
virtual AUVec3f GetTargetPos() const |
||||
{ |
||||
return m_targetPos; |
||||
} |
||||
|
||||
virtual void SetTargetPos(const AUVec3f& pos) |
||||
{ |
||||
m_targetPos = pos; |
||||
m_bModified = true; |
||||
} |
||||
|
||||
virtual float GetMoveSpeed() const |
||||
{ |
||||
return m_fMoveSpeed; |
||||
} |
||||
|
||||
virtual void SetMoveSpeed(float fSpeed) |
||||
{ |
||||
m_fMoveSpeed = std::max(0.f, fSpeed); |
||||
m_bModified = true; |
||||
} |
||||
|
||||
virtual AUVec3f Project( const AUVec3f& worldPos ) const |
||||
{ |
||||
// Camera is simple orthographic, so projection operation is just a translation
|
||||
// and a conversion of +z to -y (due to the flip of world space Z to screen space y)
|
||||
AUVec3f screenPos = AUVec3f( worldPos.x + m_fWindowWidth * 0.5f - m_currentPos.x, |
||||
-( worldPos.z - m_fWindowHeight * 0.5f - m_currentPos.z ), |
||||
0.0f ); |
||||
|
||||
return screenPos; |
||||
} |
||||
|
||||
virtual AUVec3f Unproject( const AUVec3f& screenPos ) const |
||||
{ |
||||
// Camera is simple orthographic, so unprojection operation is just a translation
|
||||
// and a conversion of +y to -z (due to the flip of screen space y to world space Z)
|
||||
AUVec3f worldPos = AUVec3f( screenPos.x - m_fWindowWidth * 0.5f + m_currentPos.x, |
||||
0.0f, |
||||
-( screenPos.y - m_fWindowHeight * 0.5f - m_currentPos.z ) ); |
||||
|
||||
return worldPos; |
||||
} |
||||
|
||||
// ~ICameraControl
|
||||
|
||||
|
||||
private: |
||||
|
||||
bool m_bModified; |
||||
AUVec3f m_currentPos; |
||||
AUVec3f m_targetPos; |
||||
float m_fMoveSpeed; |
||||
|
||||
float m_fWindowWidth; |
||||
float m_fWindowHeight; |
||||
}; |
||||
|
||||
REGISTERCLASS(CameraControl); |
||||
|
||||
|
||||
|
||||
|
@ -1,50 +0,0 @@
@@ -1,50 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#include "CompilerLogger.h" |
||||
#include "Environment.h" |
||||
#include "../../Systems/SystemTable.h" |
||||
#include "../../Systems/ILogSystem.h" |
||||
|
||||
#include <string> |
||||
#include <stdio.h> |
||||
|
||||
#include <stdarg.h> |
||||
|
||||
void CompilerLogger::LogError(const char * format, ...) |
||||
{ |
||||
va_list args; |
||||
va_start(args, format); |
||||
|
||||
m_pEnv->sys->pLogSystem->LogVa(args, eLV_ERRORS, format); |
||||
} |
||||
|
||||
void CompilerLogger::LogWarning(const char * format, ...) |
||||
{ |
||||
va_list args; |
||||
va_start(args, format); |
||||
m_pEnv->sys->pLogSystem->LogVa(args, eLV_WARNINGS, format); |
||||
|
||||
} |
||||
|
||||
void CompilerLogger::LogInfo(const char * format, ...) |
||||
{ |
||||
va_list args; |
||||
va_start(args, format); |
||||
m_pEnv->sys->pLogSystem->LogVa(args, eLV_COMMENTS, format); |
||||
|
||||
} |
@ -1,43 +0,0 @@
@@ -1,43 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#pragma once |
||||
|
||||
#ifndef COMPILERLOGGER_INCLUDED |
||||
#define COMPILERLOGGER_INCLUDED |
||||
|
||||
#include "../../RuntimeCompiler/ICompilerLogger.h" |
||||
#include <assert.h> |
||||
|
||||
class Environment; |
||||
|
||||
|
||||
class CompilerLogger : public ICompilerLogger |
||||
{ |
||||
void LogError(const char * format, ...); |
||||
void LogWarning(const char * format, ...); |
||||
void LogInfo(const char * format, ...); |
||||
public: |
||||
CompilerLogger(Environment* pEnv) : m_pEnv(pEnv) |
||||
{ |
||||
assert(m_pEnv); |
||||
} |
||||
private: |
||||
Environment* m_pEnv; |
||||
}; |
||||
|
||||
#endif // COMPILERLOGGER_INCLUDED
|
@ -1,342 +0,0 @@
@@ -1,342 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
// CompilingNotification.cpp : Defines an IObject that displays when we're compiling
|
||||
//
|
||||
#include "../../RuntimeCompiler/IFileChangeNotifier.h" |
||||
|
||||
#include "../../RuntimeObjectSystem/ObjectInterfacePerModule.h" |
||||
#include "../../RuntimeObjectSystem/IObjectFactorySystem.h" |
||||
#include "../../RuntimeObjectSystem/ISimpleSerializer.h" |
||||
#include "../../RuntimeObjectSystem/IRuntimeObjectSystem.h" |
||||
|
||||
#include "../../Systems/SystemTable.h" |
||||
#include "../../Systems/ILogSystem.h" |
||||
#include "../../Systems/IGUISystem.h" |
||||
#include "../../Systems/IUpdateable.h" |
||||
#include "../../Systems/IEntitySystem.h" |
||||
#include "../../Systems/ITimeSystem.h" |
||||
#include "../../Systems/IAssetSystem.h" |
||||
|
||||
#include "IEntityObject.h" |
||||
#include <stdio.h> |
||||
|
||||
const float UPDATE_INTERVAL = 0.1f; // Update display this often (in seconds)
|
||||
const float SHOW_COMPLETE_INTERVAL = 1.0f; |
||||
const float SHOW_FLASH_INTERVAL = 0.2f; |
||||
|
||||
|
||||
class CompilingNotification: public IEntityObject, public IAUUpdateable, public IFileChangeListener |
||||
{ |
||||
public: |
||||
CompilingNotification() |
||||
{ |
||||
m_pCompilingNotification = NULL; |
||||
m_fTimeToNextUpdate = UPDATE_INTERVAL; |
||||
m_CompilationStatus = NOT_COMPILING; |
||||
} |
||||
|
||||
virtual ~CompilingNotification() |
||||
{ |
||||
if( m_pEntity ) |
||||
{ |
||||
m_pEntity->SetUpdateable(NULL); |
||||
} |
||||
|
||||
if (m_pCompilingNotification) |
||||
{ |
||||
m_pCompilingNotification->RemoveReference(); |
||||
} |
||||
} |
||||
|
||||
virtual void Serialize(ISimpleSerializer *pSerializer)
|
||||
{ |
||||
IEntityObject::Serialize(pSerializer); |
||||
SERIALIZE(m_fTimeToNextUpdate); |
||||
SERIALIZE(m_CompilationStatus); |
||||
} |
||||
|
||||
|
||||
// IEntityObject
|
||||
|
||||
virtual void Init( bool isFirstInit ) |
||||
{ |
||||
m_pEntity->SetUpdateable( this ); |
||||
|
||||
InitWatch(); |
||||
InitDocument(false); |
||||
} |
||||
|
||||
// ~IEntityObject
|
||||
|
||||
// IAUUpdateable
|
||||
|
||||
// copies string which sets a flash with strength denoted by
|
||||
// flashAmount (a 0.0f - 1.0f value);
|
||||
// flashcolour (bool false = red, true = green);
|
||||
void StrCpyFlashDivStartRML( char* text, float flashAmount, bool flashColour ) |
||||
{ |
||||
|
||||
if( flashAmount < 0.0f ) |
||||
{ |
||||
flashAmount = 0.0f; |
||||
} |
||||
|
||||
int red = 0; |
||||
int green = 0; |
||||
int blue = 0; |
||||
if ( !flashColour ) //red
|
||||
{ |
||||
red = 20 + (int)( 235.0f*flashAmount ); |
||||
green = 20 + (int)( 40.0f*flashAmount ); |
||||
blue = 20 + (int)( 40.0f*flashAmount ); |
||||
} |
||||
else //green
|
||||
{ |
||||
red = 20 + (int)( 40.0f*flashAmount ); |
||||
green = 20 + (int)( 235.0f*flashAmount ); |
||||
blue = 20 + (int)( 40.0f*flashAmount ); |
||||
} |
||||
|
||||
char flashdivstart[80]; |
||||
flashdivstart[0] = 0; |
||||
sprintf( flashdivstart, "<div style='background-color: rgb(%d,%d,%d);'>", red, green, blue); |
||||
strcpy( text, flashdivstart ); |
||||
} |
||||
|
||||
|
||||
|
||||
void StrCatCompilingRML( char* text ) |
||||
{ |
||||
static char phrase[] = " Compiling C++ Code "; |
||||
static char dots[6][20] = { "", |
||||
".", |
||||
"..", |
||||
"...", |
||||
" ..", |
||||
" ." }; |
||||
static unsigned int count = 0; |
||||
count = (count+1) % 6; //TODO: this will now change every frame, not every 0.2s (grumble)
|
||||
|
||||
double time = PerModuleInterface::g_pSystemTable->pTimeSystem->GetFrameSessionTime(); |
||||
unsigned int newCount = (int)( time/UPDATE_INTERVAL ) % 6; |
||||
strcat( text, phrase ); |
||||
strcat( text, dots[newCount] ); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
virtual void Update( float deltaTime ) |
||||
{ |
||||
if (m_pCompilingNotification) |
||||
{ |
||||
// Refreshing the content of the counter is not itself free, so we impose some limit
|
||||
// Since deltaTime is game time, which can be paused or slowed down, we update with frame time
|
||||
double fSmoothFrameTime = PerModuleInterface::g_pSystemTable->pTimeSystem->GetSmoothFrameDuration(); |
||||
m_fTimeToNextUpdate -= fSmoothFrameTime; |
||||
|
||||
bool bCompiling = PerModuleInterface::g_pSystemTable->pRuntimeObjectSystem->GetIsCompiling(); |
||||
bool bLoadedModule = PerModuleInterface::g_pSystemTable->pRuntimeObjectSystem->GetLastLoadModuleSuccess(); |
||||
char text[200]; |
||||
|
||||
switch( m_CompilationStatus ) |
||||
{ |
||||
case NOT_COMPILING: |
||||
if( bCompiling ) |
||||
{ |
||||
m_CompilationStatus = COMPILING_INPROGRESS_FLASH; |
||||
m_fTimeToNextUpdate = SHOW_FLASH_INTERVAL; |
||||
} |
||||
else |
||||
{ |
||||
break; |
||||
} |
||||
case COMPILING_INPROGRESS_FLASH: |
||||
m_pCompilingNotification->SetProperty( "display", "block" ); |
||||
StrCpyFlashDivStartRML( text, m_fTimeToNextUpdate/SHOW_FLASH_INTERVAL, true ); |
||||
StrCatCompilingRML( text ); |
||||
strcat( text, "</div>" ); |
||||
m_pCompilingNotification->SetInnerRML( text ); |
||||
if( m_fTimeToNextUpdate <= 0 ) |
||||
{ |
||||
m_CompilationStatus = COMPILING_INPROGRESS; |
||||
m_fTimeToNextUpdate = UPDATE_INTERVAL; |
||||
} |
||||
else |
||||
{ |
||||
break; |
||||
} |
||||
case COMPILING_INPROGRESS: |
||||
text[0] = 0; //sets string to be ""
|
||||
StrCatCompilingRML( text ); |
||||
m_pCompilingNotification->SetInnerRML(text); |
||||
if( !bCompiling ) |
||||
{ |
||||
m_CompilationStatus = COMPILING_COMPLETE_FLASH; |
||||
m_fTimeToNextUpdate = SHOW_FLASH_INTERVAL; |
||||
} |
||||
else |
||||
{ |
||||
break; |
||||
} |
||||
case COMPILING_COMPLETE_FLASH: |
||||
StrCpyFlashDivStartRML( text, m_fTimeToNextUpdate/SHOW_FLASH_INTERVAL, true ); |
||||
strcat( text, " Compile complete" ); |
||||
strcat( text, "</div>" ); |
||||
m_pCompilingNotification->SetInnerRML( text ); |
||||
if( m_fTimeToNextUpdate <= 0 ) |
||||
{ |
||||
m_CompilationStatus = COMPILING_COMPLETE; |
||||
m_fTimeToNextUpdate = SHOW_COMPLETE_INTERVAL; |
||||
m_pCompilingNotification->SetInnerRML( " Compile complete" ); |
||||
} |
||||
else |
||||
{ |
||||
break; |
||||
} |
||||
case COMPILING_COMPLETE: |
||||
if( m_fTimeToNextUpdate <= 0 ) |
||||
{ |
||||
m_CompilationStatus = LOAD_MODULE_STATUS_FLASH; |
||||
m_fTimeToNextUpdate = SHOW_FLASH_INTERVAL; |
||||
} |
||||
else |
||||
{ |
||||
break; |
||||
} |
||||
case LOAD_MODULE_STATUS_FLASH: |
||||
if ( !bLoadedModule ) |
||||
{ |
||||
StrCpyFlashDivStartRML( text, m_fTimeToNextUpdate/SHOW_FLASH_INTERVAL, false ); |
||||
strcat( text, " Module Load Fail" ); |
||||
strcat( text, "</div>" ); |
||||
m_pCompilingNotification->SetInnerRML( text ); |
||||
if( m_fTimeToNextUpdate <= 0 ) |
||||
{ |
||||
m_CompilationStatus = LOAD_MODULE_STATUS; |
||||
m_fTimeToNextUpdate = SHOW_COMPLETE_INTERVAL; |
||||
m_pCompilingNotification->SetInnerRML( " Module Load Fail" ); |
||||
} |
||||
else |
||||
{ |
||||
break; |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
m_CompilationStatus = NOT_COMPILING; |
||||
m_pCompilingNotification->SetProperty( "display", "none" ); |
||||
} |
||||
case LOAD_MODULE_STATUS: |
||||
if( m_fTimeToNextUpdate <= 0 ) |
||||
{ |
||||
m_CompilationStatus = NOT_COMPILING; |
||||
m_pCompilingNotification->SetProperty( "display", "none" ); |
||||
} |
||||
else |
||||
{ |
||||
break; |
||||
}
|
||||
default:; |
||||
} |
||||
} |
||||
} |
||||
|
||||
// ~IAUUpdateable
|
||||
|
||||
// IFileChangeListener
|
||||
|
||||
virtual void OnFileChange(const IAUDynArray<const char*>& filelist)
|
||||
{ |
||||
// Reload RML document and clear RCSS cache
|
||||
InitDocument(true); |
||||
} |
||||
|
||||
// ~IFileChangeListener
|
||||
|
||||
|
||||
private: |
||||
|
||||
void InitWatch() |
||||
{ |
||||
IFileChangeNotifier* pFileChangeNotifier = PerModuleInterface::g_pSystemTable->pFileChangeNotifier; |
||||
|
||||
// Set watches on the data files we rely on for drawing GUI
|
||||
std::string path = PerModuleInterface::g_pSystemTable->pAssetSystem->GetAssetDirectory(); |
||||
path += "/GUI/compiling-notification.rml"; |
||||
pFileChangeNotifier->Watch(path.c_str(), this); |
||||
path = PerModuleInterface::g_pSystemTable->pAssetSystem->GetAssetDirectory(); |
||||
path += "/GUI/compiling-notification.rcss"; |
||||
pFileChangeNotifier->Watch(path.c_str(), this); |
||||
} |
||||
|
||||
void InitDocument(bool forceLoad) |
||||
{ |
||||
// may be serliazing an already initialized object, ensure we handle reference
|
||||
// counting correctly.
|
||||
if (m_pCompilingNotification) |
||||
{ |
||||
m_pCompilingNotification->RemoveReference(); |
||||
m_pCompilingNotification = 0; |
||||
} |
||||
|
||||
// Load the compiling notification rml
|
||||
IGUISystem* pGUI = PerModuleInterface::g_pSystemTable->pGUISystem; |
||||
|
||||
if (forceLoad) |
||||
{ |
||||
// Clear style sheet cache so any changes to RCSS files will be applied
|
||||
pGUI->ClearStyleSheetCache(); |
||||
} |
||||
|
||||
IGUIDocument* pDocument = forceLoad ? NULL : pGUI->GetDocument("CompilingNotification"); |
||||
if (pDocument == NULL) |
||||
{ |
||||
pDocument = pGUI->LoadDocument("/GUI/compiling-notification.rml", "CompilingNotification"); |
||||
} |
||||
|
||||
if (pDocument != NULL) |
||||
{ |
||||
pDocument->Show(); |
||||
m_pCompilingNotification = pDocument->Element()->GetElementById("compiling"); |
||||
|
||||
pDocument->RemoveReference(); |
||||
} |
||||
} |
||||
|
||||
|
||||
// Private Members
|
||||
|
||||
IGUIElement* m_pCompilingNotification; |
||||
float m_fTimeToNextUpdate; |
||||
|
||||
enum CompilationStatus |
||||
{ |
||||
NOT_COMPILING, |
||||
COMPILING_INPROGRESS_FLASH, |
||||
COMPILING_INPROGRESS, |
||||
COMPILING_COMPLETE_FLASH, |
||||
COMPILING_COMPLETE, |
||||
LOAD_MODULE_STATUS_FLASH, |
||||
LOAD_MODULE_STATUS |
||||
} m_CompilationStatus; |
||||
}; |
||||
|
||||
REGISTERCLASS(CompilingNotification); |
||||
|
||||
|
@ -1,663 +0,0 @@
@@ -1,663 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#include "Console.h" |
||||
|
||||
#include "../../RuntimeCompiler/BuildTool.h" |
||||
#include "../../RuntimeCompiler/ICompilerLogger.h" |
||||
#include "../../RuntimeObjectSystem/ObjectInterface.h" |
||||
#include "../../RuntimeObjectSystem/IObjectFactorySystem.h" |
||||
#include "../../RuntimeObjectSystem/IRuntimeObjectSystem.h" |
||||
#include "../../RuntimeObjectSystem/IObject.h" |
||||
#include "../../Systems/ILogSystem.h" |
||||
#include "../../Systems/IEntitySystem.h" |
||||
#include "../../Systems/IGame.h" |
||||
#include "../../Systems/SystemTable.h" |
||||
#include "../../RuntimeObjectSystem/RuntimeProtector.h" |
||||
#include "Environment.h" |
||||
#include "IConsoleContext.h" |
||||
#include "IObjectUtils.h" |
||||
|
||||
#include <assert.h> |
||||
#include <fstream> |
||||
#include <algorithm> |
||||
#ifndef _WIN32 |
||||
#include <string.h> |
||||
int stricmp( const char* pS1, const char* pS2 ) |
||||
{ |
||||
return strcasecmp( pS1, pS2 ); |
||||
} |
||||
#endif |
||||
|
||||
#define CONSOLE_INPUT_FILE "Console.txt" |
||||
#define CONSOLE_CONTEXT_FILE "ConsoleContext.cpp" |
||||
|
||||
// Remove windows.h define of GetObject which conflicts with EntitySystem GetObject
|
||||
#if defined _WINDOWS_ && defined GetObject |
||||
#undef GetObject |
||||
#endif |
||||
|
||||
using FileSystemUtils::Path; |
||||
|
||||
|
||||
static const char* CONTEXT_HEADER =
|
||||
"// Generated/modified by Console.cpp during runtime - safe to delete \n" |
||||
"#include \"../../RuntimeObjectSystem/ObjectInterfacePerModule.h\" \n" |
||||
"#include \"../../Systems/SystemTable.h\" \n" |
||||
"#include \"../../RuntimeObjectSystem/IObjectFactorySystem.h\" \n" |
||||
"#include \"../../Systems/ILogSystem.h\" \n" |
||||
"#include \"ConsoleContext.h\" \n\n" |
||||
"REGISTERCLASS(ConsoleContext); \n\n" |
||||
"void ConsoleContext::Execute(SystemTable* sys) \n" |
||||
"{ \n"; |
||||
|
||||
static const char* CONTEXT_FOOTER = |
||||
"\n}"; |
||||
|
||||
Console::Console(Environment* pEnv, Rocket::Core::Context* pRocketContext)
|
||||
: m_pEnv(pEnv) |
||||
, m_pRocketContext(pRocketContext) |
||||
, m_bWaitingForCompile(false) |
||||
, m_bCurrentContextFromGUI(false) |
||||
, m_bGUIVisible(false) |
||||
, m_bGUIViewMulti(false) |
||||
, m_pDocument(0) |
||||
, m_pViewButton(0) |
||||
, m_pBackButton(0) |
||||
, m_pForwardButton(0) |
||||
, m_pCloseButton(0) |
||||
, m_pExecuteButton(0) |
||||
, m_pSingleLineArea(0) |
||||
, m_pMultiLineArea(0) |
||||
{ |
||||
AU_ASSERT(m_pEnv && m_pRocketContext); |
||||
|
||||
Path basepath = Path(__FILE__).ParentPath(); |
||||
basepath = m_pEnv->sys->pRuntimeObjectSystem->FindFile( basepath ); |
||||
m_inputFile = basepath / Path(CONSOLE_INPUT_FILE); |
||||
m_contextFile = basepath / Path(CONSOLE_CONTEXT_FILE);
|
||||
|
||||
m_contextFile.ToOSCanonicalCase(); |
||||
|
||||
if( CreateConsoleContextFile() ) |
||||
{ |
||||
InitFileChangeNotifier(); |
||||
}
|
||||
|
||||
m_textAreaParams[ETAT_SINGLE].history.push_back(""); |
||||
m_textAreaParams[ETAT_SINGLE].position = 0; |
||||
m_textAreaParams[ETAT_MULTI].history.push_back(""); |
||||
m_textAreaParams[ETAT_MULTI].position = 0; |
||||
|
||||
InitGUI(); |
||||
} |
||||
|
||||
Console::~Console() |
||||
{ |
||||
m_contextFile.Remove(); |
||||
|
||||
// Call just in case it wasn't already called
|
||||
DestroyContext(); |
||||
} |
||||
|
||||
void Console::DestroyContext() |
||||
{ |
||||
if (m_contextId.IsValid()) |
||||
{ |
||||
delete m_pEnv->sys->pObjectFactorySystem->GetObject( m_contextId ); |
||||
m_contextId = ObjectId(); // set to invalid value
|
||||
} |
||||
} |
||||
|
||||
void Console::OnFileChange(const IAUDynArray<const char*>& filelist) |
||||
{ |
||||
if (!stricmp(filelist[0], m_inputFile.c_str())) |
||||
{ |
||||
// This is a console compilation notification
|
||||
|
||||
if (!m_bWaitingForCompile) |
||||
{ |
||||
m_bWaitingForCompile = true; |
||||
m_bCurrentContextFromGUI = false; |
||||
WriteConsoleContext(); |
||||
} |
||||
else |
||||
{ |
||||
m_pEnv->sys->pLogSystem->Log(eLV_WARNINGS, "Received console code while still waiting for last compile to complete\n"); |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
// This is a GUI file change notification
|
||||
|
||||
ReloadGUI(); |
||||
}
|
||||
} |
||||
|
||||
void Console::OnCompileDone(bool bSuccess) |
||||
{ |
||||
if (m_bWaitingForCompile) |
||||
{ |
||||
m_bWaitingForCompile = false; |
||||
|
||||
// Remove temp context file from game runtime file list so it isn't included in full recompiles
|
||||
// This must be done every time ConsoleContext.cpp gets recompiled because it will get registered again
|
||||
m_pEnv->sys->pRuntimeObjectSystem->RemoveFromRuntimeFileList(m_contextFile.c_str()); |
||||
|
||||
if (bSuccess) |
||||
{ |
||||
// Create console context on first compile
|
||||
if (m_contextId.m_PerTypeId == InvalidId) |
||||
{ |
||||
CreateConsoleContext(); |
||||
} |
||||
|
||||
ExecuteConsoleContext();
|
||||
}
|
||||
|
||||
if (m_bCurrentContextFromGUI) |
||||
{ |
||||
if (bSuccess) |
||||
{ |
||||
ApplyGUIClear(); |
||||
} |
||||
|
||||
ApplyGUIFinishExecute(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
void Console::InitFileChangeNotifier() |
||||
{ |
||||
// Make filechangenotifier monitor console code file and notify here
|
||||
m_pEnv->sys->pFileChangeNotifier->Watch(m_inputFile.c_str(), this); |
||||
|
||||
// Make filechangenotifier watch temp context file for changes and notify regular listener for recompile
|
||||
m_pEnv->sys->pRuntimeObjectSystem->AddToRuntimeFileList( m_contextFile.c_str() ); |
||||
//m_pEnv->sys->pFileChangeNotifier->Watch(m_contextFile.string().c_str(), m_pEnv->sys->pRuntimeObjectSystem);
|
||||
|
||||
// Make filechangenotifier watch console RML/RCSS files
|
||||
Path basepath = Path(__FILE__).ParentPath(); |
||||
std::string filename = (basepath / Path("/../../Assets/GUI/console.rml")).m_string; |
||||
m_pEnv->sys->pFileChangeNotifier->Watch(filename.c_str(), this); |
||||
filename = (basepath / Path("/../../Assets/GUI/console.rcss")).m_string; |
||||
m_pEnv->sys->pFileChangeNotifier->Watch(filename.c_str(), this); |
||||
} |
||||
|
||||
void Console::InitGUI() |
||||
{ |
||||
// Load document but don't show it yet
|
||||
Rocket::Core::ElementDocument* pDocument = m_pRocketContext->LoadDocument("/GUI/console.rml"); |
||||
if (pDocument != NULL) |
||||
{ |
||||
pDocument->SetId( "Console" ); |
||||
pDocument->RemoveReference(); |
||||
|
||||
InitGUIReferences(); |
||||
InitGUIEvents(); |
||||
ApplyCurrentGUIState();
|
||||
} |
||||
} |
||||
|
||||
void Console::ReloadGUI() |
||||
{ |
||||
// Clear style sheet cache so any changes to RCSS files will be applied
|
||||
Rocket::Core::Factory::ClearStyleSheetCache(); |
||||
|
||||
Rocket::Core::ElementDocument* pDocument = m_pRocketContext->LoadDocument("/GUI/console.rml"); |
||||
if (pDocument != NULL) |
||||
{ |
||||
pDocument->SetId( "Console" ); |
||||
pDocument->SetOffset(m_pDocument->GetRelativeOffset(), NULL); |
||||
pDocument->RemoveReference(); |
||||
m_pRocketContext->UnloadDocument(m_pDocument); |
||||
|
||||
InitGUIReferences(); |
||||
InitGUIEvents(); |
||||
ApplyCurrentGUIState();
|
||||
} |
||||
} |
||||
|
||||
void Console::InitGUIReferences() |
||||
{ |
||||
m_pDocument = m_pRocketContext->GetDocument("Console"); |
||||
AU_ASSERT(m_pDocument); |
||||
|
||||
m_pViewButton = static_cast<Rocket::Controls::ElementFormControl*>(m_pDocument->GetElementById("ViewButton")); |
||||
m_pClearButton = static_cast<Rocket::Controls::ElementFormControl*>(m_pDocument->GetElementById("ClearButton")); |
||||
m_pBackButton = static_cast<Rocket::Controls::ElementFormControl*>(m_pDocument->GetElementById("BackButton")); |
||||
m_pForwardButton = static_cast<Rocket::Controls::ElementFormControl*>(m_pDocument->GetElementById("ForwardButton")); |
||||
m_pCloseButton = static_cast<Rocket::Controls::ElementFormControl*>(m_pDocument->GetElementById("CloseButton")); |
||||
m_pExecuteButton = static_cast<Rocket::Controls::ElementFormControl*>(m_pDocument->GetElementById("ExecuteButton")); |
||||
m_pSingleLineArea = static_cast<Rocket::Controls::ElementFormControl*>(m_pDocument->GetElementById("SingleLineArea")); |
||||
m_pMultiLineArea = static_cast<Rocket::Controls::ElementFormControl*>(m_pDocument->GetElementById("MultiLineArea")); |
||||
AU_ASSERT(m_pViewButton && m_pBackButton && m_pForwardButton && m_pCloseButton && m_pExecuteButton && m_pSingleLineArea && m_pMultiLineArea); |
||||
|
||||
m_textAreaParams[0].pElement = m_pSingleLineArea; |
||||
m_textAreaParams[1].pElement = m_pMultiLineArea; |
||||
} |
||||
|
||||
void Console::InitGUIEvents() |
||||
{ |
||||
m_pViewButton->AddEventListener("click", this); |
||||
m_pClearButton->AddEventListener("click", this); |
||||
m_pBackButton->AddEventListener("click", this); |
||||
m_pForwardButton->AddEventListener("click", this); |
||||
m_pCloseButton->AddEventListener("click", this); |
||||
m_pExecuteButton->AddEventListener("click", this); |
||||
m_pSingleLineArea->AddEventListener("textinput", this); |
||||
} |
||||
|
||||
void Console::ProcessEvent(Rocket::Core::Event& event) |
||||
{ |
||||
Rocket::Core::Element* pElement = event.GetTargetElement(); |
||||
std::string target = pElement->GetId().CString(); |
||||
|
||||
if (!stricmp(target.c_str(), "SingleLineArea")) |
||||
{ |
||||
// Character added to single line area - execute contents if the enter key was pressed
|
||||
Rocket::Core::word character = event.GetParameter< Rocket::Core::word >("data", 0); |
||||
if (character == '\n') |
||||
{ |
||||
STextAreaParams& params = m_textAreaParams[m_bGUIViewMulti ? ETAT_MULTI : ETAT_SINGLE]; |
||||
params.position = (int)params.history.size() - 1; |
||||
|
||||
StoreGUITextInHistory(); |
||||
ApplyGUIExecute(); |
||||
} |
||||
} |
||||
else if (!stricmp(target.c_str(), "ExecuteButton")) |
||||
{ |
||||
// Execute contents of multi line area
|
||||
if (!m_pExecuteButton->IsDisabled()) |
||||
{ |
||||
STextAreaParams& params = m_textAreaParams[m_bGUIViewMulti ? ETAT_MULTI : ETAT_SINGLE]; |
||||
params.position = (int)params.history.size() - 1; |
||||
|
||||
StoreGUITextInHistory(); |
||||
ApplyGUIExecute(); |
||||
} |
||||
else |
||||
{ |
||||
m_pExecuteButton->Blur(); |
||||
} |
||||
} |
||||
else if (!stricmp(target.c_str(), "ViewButton")) |
||||
{ |
||||
// Toggle between single and multi line views
|
||||
m_bGUIViewMulti = !m_bGUIViewMulti; |
||||
|
||||
STextAreaParams& params = m_textAreaParams[m_bGUIViewMulti ? ETAT_MULTI : ETAT_SINGLE]; |
||||
if (params.position == (int)params.history.size() - 1) |
||||
{ |
||||
StoreGUITextInHistory(); // save text in latest history before changing views so we don't lose it
|
||||
} |
||||
|
||||
ApplyGUIViewType(); |
||||
ApplyGUIHistoryPosition(); // do this to set history buttons appropriately
|
||||
FocusOnTextArea(); |
||||
} |
||||
else if (!stricmp(target.c_str(), "ClearButton")) |
||||
{ |
||||
// Clear current text area
|
||||
ApplyGUIClear(); |
||||
} |
||||
else if (!stricmp(target.c_str(), "CloseButton")) |
||||
{ |
||||
// Close console
|
||||
m_bGUIVisible = false; |
||||
ApplyGUIView(); |
||||
} |
||||
else if (!stricmp(target.c_str(), "BackButton")) |
||||
{ |
||||
// Go one step back in command history
|
||||
if (!m_pBackButton->IsDisabled()) |
||||
{ |
||||
STextAreaParams& params = m_textAreaParams[m_bGUIViewMulti ? ETAT_MULTI : ETAT_SINGLE]; |
||||
if (params.position == params.history.size() - 1) |
||||
{ |
||||
StoreGUITextInHistory(); // save text in latest history before starting to go back so we don't lose it
|
||||
} |
||||
|
||||
params.position--; |
||||
params.position = std::max(0, params.position); |
||||
|
||||
ApplyGUIHistoryPosition(); |
||||
FocusOnTextArea(); |
||||
}
|
||||
else
|
||||
{ |
||||
m_pBackButton->Blur(); |
||||
} |
||||
} |
||||
else if (!stricmp(target.c_str(), "ForwardButton")) |
||||
{ |
||||
// Go one step forward in command history
|
||||
if (!m_pForwardButton->IsDisabled()) |
||||
{ |
||||
STextAreaParams& params = m_textAreaParams[m_bGUIViewMulti ? ETAT_MULTI : ETAT_SINGLE]; |
||||
params.position++; |
||||
params.position = std::min((int)params.history.size(), params.position); |
||||
|
||||
ApplyGUIHistoryPosition(); |
||||
FocusOnTextArea(); |
||||
} |
||||
else
|
||||
{ |
||||
m_pForwardButton->Blur(); |
||||
} |
||||
}
|
||||
} |
||||
|
||||
void Console::StoreGUITextInHistory() |
||||
{ |
||||
STextAreaParams& params = m_textAreaParams[m_bGUIViewMulti ? ETAT_MULTI : ETAT_SINGLE]; |
||||
params.history[params.position] = params.pElement->GetValue().CString(); |
||||
} |
||||
|
||||
void Console::ToggleGUI() |
||||
{ |
||||
m_bGUIVisible = !m_bGUIVisible; |
||||
ApplyGUIView(); |
||||
FocusOnTextArea(); |
||||
} |
||||
|
||||
void Console::FocusOnTextArea() |
||||
{ |
||||
if (m_bGUIViewMulti) |
||||
{ |
||||
m_pMultiLineArea->Focus(); |
||||
} |
||||
else |
||||
{ |
||||
m_pSingleLineArea->Focus(); |
||||
} |
||||
} |
||||
|
||||
void Console::ApplyCurrentGUIState() |
||||
{ |
||||
ApplyGUIView(); |
||||
ApplyGUIViewType(); |
||||
ApplyGUIHistoryPosition(); |
||||
FocusOnTextArea(); |
||||
} |
||||
|
||||
void Console::ApplyGUIView() |
||||
{ |
||||
if (m_bGUIVisible) |
||||
{ |
||||
m_pDocument->Show(); |
||||
} |
||||
else |
||||
{ |
||||
m_pDocument->Hide(); |
||||
} |
||||
} |
||||
|
||||
void Console::ApplyGUIViewType() |
||||
{ |
||||
if (m_bGUIViewMulti) |
||||
{ |
||||
m_pMultiLineArea->SetProperty("display", "block"); |
||||
m_pSingleLineArea->SetProperty("display", "none"); |
||||
m_pExecuteButton->SetProperty("display", "block"); |
||||
m_pViewButton->SetInnerRML("Single"); |
||||
|
||||
m_pMultiLineArea->SetProperty("tab-index", "auto"); |
||||
m_pSingleLineArea->SetProperty("tab-index", "none"); |
||||
m_pExecuteButton->SetProperty("tab-index", "auto"); |
||||
} |
||||
else |
||||
{ |
||||
m_pMultiLineArea->SetProperty("display", "none"); |
||||
m_pSingleLineArea->SetProperty("display", "block"); |
||||
m_pExecuteButton->SetProperty("display", "none"); |
||||
m_pViewButton->SetInnerRML("Multi"); |
||||
|
||||
m_pMultiLineArea->SetProperty("tab-index", "none"); |
||||
m_pSingleLineArea->SetProperty("tab-index", "auto"); |
||||
m_pExecuteButton->SetProperty("tab-index", "none"); |
||||
} |
||||
} |
||||
|
||||
void Console::ApplyGUIClear() |
||||
{ |
||||
STextAreaParams& params = m_textAreaParams[m_bGUIViewMulti ? ETAT_MULTI : ETAT_SINGLE]; |
||||
params.pElement->SetValue(""); |
||||
} |
||||
|
||||
void Console::ApplyGUIHistoryPosition() |
||||
{ |
||||
STextAreaParams& params = m_textAreaParams[m_bGUIViewMulti ? ETAT_MULTI : ETAT_SINGLE]; |
||||
|
||||
params.pElement->SetValue(params.history[params.position].c_str());
|
||||
|
||||
if (params.position == 0) |
||||
{ |
||||
m_pBackButton->SetDisabled(true); |
||||
m_pBackButton->SetProperty("tab-index", "none"); |
||||
m_pBackButton->SetPseudoClass("disabled", true); |
||||
} |
||||
else |
||||
{ |
||||
m_pBackButton->SetDisabled(false); |
||||
m_pBackButton->SetProperty("tab-index", "auto"); |
||||
m_pBackButton->SetPseudoClass("disabled", false); |
||||
} |
||||
|
||||
if (params.position == params.history.size() - 1) |
||||
{ |
||||
m_pForwardButton->SetDisabled(true); |
||||
m_pForwardButton->SetProperty("tab-index", "none"); |
||||
m_pForwardButton->SetPseudoClass("disabled", true); |
||||
} |
||||
else |
||||
{ |
||||
m_pForwardButton->SetDisabled(false); |
||||
m_pForwardButton->SetProperty("tab-index", "auto"); |
||||
m_pForwardButton->SetPseudoClass("disabled", false); |
||||
} |
||||
} |
||||
|
||||
void Console::ApplyGUIExecute() |
||||
{ |
||||
if (!m_bWaitingForCompile) |
||||
{ |
||||
Rocket::Core::String rcText = m_bGUIViewMulti ? m_pMultiLineArea->GetValue() : m_pSingleLineArea->GetValue(); |
||||
const std::string& text = rcText.Append(";").CString(); // Add ; to end to handle common error
|
||||
|
||||
m_bWaitingForCompile = true; |
||||
m_bCurrentContextFromGUI = true; |
||||
WriteConsoleContext(text); |
||||
|
||||
// Disable Execute button and text area
|
||||
m_pExecuteButton->SetDisabled(true); |
||||
m_pMultiLineArea->SetDisabled(true); |
||||
m_pSingleLineArea->SetDisabled(true); |
||||
m_pMultiLineArea->SetProperty("tab-index", "none"); |
||||
m_pSingleLineArea->SetProperty("tab-index", "none"); |
||||
m_pExecuteButton->SetProperty("tab-index", "none"); |
||||
m_pExecuteButton->SetPseudoClass("disabled", true); |
||||
} |
||||
else |
||||
{ |
||||
m_pEnv->sys->pLogSystem->Log(eLV_WARNINGS, "Received console code from GUI while still waiting for last compile to complete\n"); |
||||
} |
||||
} |
||||
|
||||
void Console::ApplyGUIFinishExecute() |
||||
{ |
||||
// Enable Execute button and text area
|
||||
m_pExecuteButton->SetDisabled(false); |
||||
m_pMultiLineArea->SetDisabled(false); |
||||
m_pSingleLineArea->SetDisabled(false); |
||||
m_pMultiLineArea->SetProperty("tab-index", "auto"); |
||||
m_pSingleLineArea->SetProperty("tab-index", "auto"); |
||||
m_pExecuteButton->SetProperty("tab-index", "auto"); |
||||
m_pExecuteButton->SetPseudoClass("disabled", false); |
||||
|
||||
STextAreaParams& params = m_textAreaParams[m_bGUIViewMulti ? ETAT_MULTI : ETAT_SINGLE]; |
||||
params.pElement->Focus(); |
||||
params.history.push_back(""); // add new history element which corresponds to current input
|
||||
params.position = (int)params.history.size() - 1; |
||||
|
||||
ApplyGUIHistoryPosition(); |
||||
} |
||||
|
||||
bool Console::CreateConsoleContextFile() |
||||
{ |
||||
bool bRet = true; |
||||
std::ofstream outFile; |
||||
outFile.open(m_contextFile.c_str(), std::ios::out | std::ios::trunc); |
||||
if (!outFile) |
||||
{ |
||||
bRet = false; |
||||
m_pEnv->sys->pLogSystem->Log(eLV_ERRORS, "Unable to create context file: %s\n", m_contextFile.c_str()); |
||||
} |
||||
|
||||
return bRet; |
||||
} |
||||
|
||||
// Only needs to be called once, on first compile of console context (not at program start)
|
||||
void Console::CreateConsoleContext() |
||||
{ |
||||
IObject *pObj = IObjectUtils::CreateObject( "ConsoleContext" ); |
||||
pObj->GetObjectId( m_contextId ); |
||||
} |
||||
|
||||
void Console::WriteConsoleContext() |
||||
{ |
||||
std::ifstream inFile; |
||||
inFile.open(m_inputFile.c_str(), std::ios::in); |
||||
if (!inFile) |
||||
{ |
||||
m_pEnv->sys->pLogSystem->Log(eLV_ERRORS, "Unable to open console input file for reading: %s\n", m_inputFile.c_str()); |
||||
return; |
||||
} |
||||
|
||||
std::ofstream outFile; |
||||
outFile.open(m_contextFile.c_str(), std::ios::out | std::ios::trunc); |
||||
if (!outFile) |
||||
{ |
||||
m_pEnv->sys->pLogSystem->Log(eLV_ERRORS, "Unable to open context file for writing: %s\n", m_contextFile.c_str()); |
||||
return; |
||||
} |
||||
|
||||
// Write header boilerplate
|
||||
outFile << CONTEXT_HEADER; |
||||
|
||||
// Write console code
|
||||
outFile << inFile.rdbuf(); |
||||
|
||||
// Write footer boilerplate
|
||||
outFile << CONTEXT_FOOTER; |
||||
} |
||||
|
||||
void Console::WriteConsoleContext(const std::string& text) |
||||
{ |
||||
std::ofstream outFile; |
||||
outFile.open(m_contextFile.c_str(), std::ios::out | std::ios::trunc); |
||||
if (!outFile) |
||||
{ |
||||
m_pEnv->sys->pLogSystem->Log(eLV_ERRORS, "Unable to open context file for writing: %s\n", m_contextFile.c_str()); |
||||
return; |
||||
} |
||||
|
||||
// Write header boilerplate
|
||||
outFile << CONTEXT_HEADER; |
||||
|
||||
// Write console code
|
||||
outFile << text; |
||||
|
||||
// Write footer boilerplate
|
||||
outFile << CONTEXT_FOOTER; |
||||
} |
||||
|
||||
// local class for console execution
|
||||
class ConsoleExecuteProtector : public RuntimeProtector |
||||
{ |
||||
public: |
||||
IConsoleContext* pContext; |
||||
SystemTable* pSys; |
||||
private: |
||||
virtual void ProtectedFunc() |
||||
{ |
||||
pContext->Execute( pSys ); |
||||
} |
||||
|
||||
}; |
||||
void Console::ExecuteConsoleContext() |
||||
{ |
||||
ILogSystem *pLog = m_pEnv->sys->pLogSystem; |
||||
|
||||
IConsoleContext* pContext; |
||||
IObjectUtils::GetObject( &pContext, m_contextId ); |
||||
AU_ASSERT(pContext); |
||||
|
||||
if (pContext) |
||||
{ |
||||
pLog->Log(eLV_COMMENTS, "Executing console context...\n"); |
||||
|
||||
// Console should execute Safe-C, but for some things we really do want to return
|
||||
// null pointers on occaision. So lets deal with those simple cases cleanly.
|
||||
ConsoleExecuteProtector consoleProtectedExecutor; |
||||
consoleProtectedExecutor.m_bHintAllowDebug = false; |
||||
consoleProtectedExecutor.pContext = pContext; |
||||
consoleProtectedExecutor.pSys = m_pEnv->sys; |
||||
m_pEnv->sys->pRuntimeObjectSystem->TryProtectedFunction( &consoleProtectedExecutor ); |
||||
|
||||
if( consoleProtectedExecutor.HasHadException() ) |
||||
{ |
||||
switch (consoleProtectedExecutor.ExceptionInfo.Type) |
||||
{ |
||||
case RuntimeProtector::ESE_Unknown: |
||||
pLog->Log(eLV_ERRORS, "Console command caused an unknown error\n"); |
||||
break; |
||||
case RuntimeProtector::ESE_AccessViolation: |
||||
// Note that in practice, writing to pointers it not something that should often be needed in a console command
|
||||
if (consoleProtectedExecutor.ExceptionInfo.Addr == 0) |
||||
pLog->Log(eLV_ERRORS, "Console command tried to access a null pointer\n"); |
||||
else |
||||
pLog->Log(eLV_ERRORS, "Console command tried to access an invalid pointer (address 0x%p)\n", consoleProtectedExecutor.ExceptionInfo.Addr); |
||||
break; |
||||
case RuntimeProtector::ESE_AccessViolationRead: |
||||
if (consoleProtectedExecutor.ExceptionInfo.Addr == 0) |
||||
pLog->Log(eLV_ERRORS, "Console command tried to read from a null pointer\n"); |
||||
else |
||||
pLog->Log(eLV_ERRORS, "Console command tried to read from an invalid pointer (address 0x%p)\n", consoleProtectedExecutor.ExceptionInfo.Addr); |
||||
break; |
||||
case RuntimeProtector::ESE_AccessViolationWrite: |
||||
// Note that in practice, writing to pointers it not something that should often be needed in a console command
|
||||
if (consoleProtectedExecutor.ExceptionInfo.Addr == 0) |
||||
pLog->Log(eLV_ERRORS, "Console command tried to write to a null pointer\n"); |
||||
else |
||||
pLog->Log(eLV_ERRORS, "Console command tried to write to an invalid pointer (address 0x%p)\n", consoleProtectedExecutor.ExceptionInfo.Addr); |
||||
break; |
||||
case RuntimeProtector::ESE_InvalidInstruction: |
||||
pLog->Log(eLV_ERRORS, "Console command tried to execute an invalid instruction at (address 0x%p)\n", consoleProtectedExecutor.ExceptionInfo.Addr); |
||||
break; |
||||
default: |
||||
AU_ASSERT(false); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
pLog->Log(eLV_ERRORS, "Unable to execute console context - no context found\n"); |
||||
} |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue