Skip to content

Commit 1c60a86

Browse files
authored
Merge pull request #33 from lr8soft/dev-y
v0.35release
2 parents 143df10 + e22fd59 commit 1c60a86

27 files changed

Lines changed: 236 additions & 222 deletions

.idea/workspace.xml

Lines changed: 12 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PythonSTG/PythonSTG.aps

-6.95 KB
Binary file not shown.

PythonSTG/PythonSTG.rc

-28 Bytes
Binary file not shown.

PythonSTG/PythonSTG.vcxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@
184184
<ClCompile Include="XCCore\XCRender\XCColorBlockHelper.cpp" />
185185
<ClCompile Include="XCCore\Stage\Stage.cpp" />
186186
<ClCompile Include="XCFrameInfo.cpp" />
187+
<ClCompile Include="XCInterpreter\ImageParseHelper.cpp" />
187188
<ClCompile Include="XCInterpreter\ScriptLoader.cpp" />
188189
<ClCompile Include="XCInterpreter\XCInterpreter.cpp" />
189190
<ClCompile Include="XCCore\XCRender\XCImageHelper.cpp" />
@@ -250,6 +251,7 @@
250251
<ClInclude Include="XCCore\XCRender\XCColorBlockHelper.h" />
251252
<ClInclude Include="XCCore\Stage\Stage.h" />
252253
<ClInclude Include="XCFrameInfo.h" />
254+
<ClInclude Include="XCInterpreter\ImageParseHelper.h" />
253255
<ClInclude Include="XCInterpreter\ScriptLoader.h" />
254256
<ClInclude Include="XCInterpreter\XCInterpreter.h" />
255257
<ClInclude Include="XCCore\XCRender\XCImageHelper.h" />

PythonSTG/PythonSTG.vcxproj.filters

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@
217217
<ClCompile Include="XCCore\XCRender\AbsorbParticleHelper.cpp">
218218
<Filter>XCCore\XCRender\ParticleEffect</Filter>
219219
</ClCompile>
220+
<ClCompile Include="XCInterpreter\ImageParseHelper.cpp">
221+
<Filter>XCInterpreter</Filter>
222+
</ClCompile>
220223
</ItemGroup>
221224
<ItemGroup>
222225
<ClInclude Include="util\ConfigManager.h">
@@ -402,6 +405,9 @@
402405
<ClInclude Include="XCCore\XCRender\AbsorbParticleHelper.h">
403406
<Filter>XCCore\XCRender\ParticleEffect</Filter>
404407
</ClInclude>
408+
<ClInclude Include="XCInterpreter\ImageParseHelper.h">
409+
<Filter>XCInterpreter</Filter>
410+
</ClInclude>
405411
</ItemGroup>
406412
<ItemGroup>
407413
<Image Include="..\pystg.ico">

PythonSTG/XCCore/Bullet/BulletHelper.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "OvalTypeBullet.h"
44
#include "RectangleTypeBullet.h"
55
#include "../../XCInterpreter/ScriptLoader.h"
6+
#include "../../XCInterpreter/ImageParseHelper.h"
67
Bullet * BulletHelper::getNewBulletObject(std::string bulletImage,std::string bulletType, glm::vec4 divideInfo, glm::vec3 scaleInfo, glm::vec3 collideSize,
78
glm::vec3 initCoord, float velocity, float acceleration, float angle, float increateAngle, int reboundTime, bool aimPlayer,
89
int particleDensity, float particleFinishTime, float particleVelocity, float particleSize, glm::vec4 particleColor)
@@ -28,18 +29,18 @@ Bullet * BulletHelper::parseBulletObject(PyObject * bulletObject)
2829
Bullet* bullet = nullptr;
2930

3031
if (bulletObject != nullptr) {
31-
PyObject* imageInfo = PyObject_CallMethod(bulletObject, "_cpp_getInitRenderInfo", NULL);
3232
PyObject* bulletGenerateInfo = PyObject_CallMethod(bulletObject, "_cpp_getGenerateInfo", NULL);
3333
PyObject* bulletCoordInfo = PyObject_CallMethod(bulletObject, "_cpp_getInitCoord", NULL);
3434
PyObject* bulletReleaseInfo = PyObject_CallMethod(bulletObject, "_cpp_getReleaseParticleInfo", NULL);
35+
PyObject* bulletTypeInfo = PyObject_CallMethod(bulletObject, "_cpp_getBulletInfo", NULL);
36+
ImageInfo bulletImageInfo = ImageParseHelper::parseImageHelperFromObject(bulletObject);
3537

36-
const char* bulletImage, *bulletType; int divideInfo[4]; float scaleInfo[3], collideSize[3];
37-
PyArg_ParseTuple(imageInfo, "ss(iiii)(fff)(fff)", &bulletImage, &bulletType, &divideInfo[0], &divideInfo[1], &divideInfo[2], &divideInfo[3],
38-
&scaleInfo[0], &scaleInfo[1], &scaleInfo[2], &collideSize[0], &collideSize[1], &collideSize[2]);
38+
const char* bulletType;
39+
PyArg_Parse(bulletTypeInfo, "s", &bulletType);
3940

40-
41-
float velocity, acceleration, angle, increaseAngle; int aimPlayer, reboundTime;
42-
PyArg_ParseTuple(bulletGenerateInfo, "ffffip", &velocity, &acceleration, &angle, &increaseAngle, &reboundTime, &aimPlayer);
41+
float velocity, acceleration, angle, increaseAngle, collideSize[3]; int aimPlayer, reboundTime;
42+
PyArg_ParseTuple(bulletGenerateInfo, "ffffip(fff)", &velocity, &acceleration, &angle, &increaseAngle, &reboundTime, &aimPlayer,
43+
&collideSize[0], &collideSize[1], &collideSize[2]);
4344

4445
float initCoord[3];
4546
PyArg_ParseTuple(bulletCoordInfo, "fff", &initCoord[0], &initCoord[1], &initCoord[2]);
@@ -48,8 +49,9 @@ Bullet * BulletHelper::parseBulletObject(PyObject * bulletObject)
4849
PyArg_ParseTuple(bulletReleaseInfo, "ifff(ffff)", &particleDensity, &lifeTime, &particleVelocity, &particleSize,
4950
&particleColor[0], &particleColor[1], &particleColor[2], &particleColor[3]);
5051

51-
bullet = BulletHelper::getNewBulletObject(bulletImage, bulletType, glm::vec4(divideInfo[0], divideInfo[1], divideInfo[2], divideInfo[3]),
52-
glm::vec3(scaleInfo[0], scaleInfo[1], scaleInfo[2]),glm::vec3(collideSize[0], collideSize[1], collideSize[2]),
52+
bullet = BulletHelper::getNewBulletObject(bulletImageInfo.imagePath, bulletType,
53+
glm::vec4(bulletImageInfo.divideColumn, bulletImageInfo.divideRow, bulletImageInfo.selectX, bulletImageInfo.selectY),
54+
glm::vec3(bulletImageInfo.zoomX, bulletImageInfo.zoomY, 0.1f),glm::vec3(collideSize[0], collideSize[1], collideSize[2]),
5355
glm::vec3(initCoord[0], initCoord[1], initCoord[2]), velocity, acceleration, angle, increaseAngle, reboundTime, aimPlayer,
5456
particleDensity, lifeTime, particleVelocity,particleSize, glm::vec4(particleColor[0], particleColor[1], particleColor[2], particleColor[3]));
5557
if (bullet != nullptr) {

PythonSTG/XCCore/Player/Player.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ void Player::setPlayerDirection(int direction)
278278
{
279279
playerNowState = direction;
280280
if (playerNowState == playerLastState) {
281-
float interval = divideInfo[0] - 0.1f;
281+
float interval = divideInfo[0] - imageSwapTime;
282282
if (playerSameStateTime < interval) {
283283
playerSameStateTime += imageSwapTime;
284284
}

PythonSTG/XCCore/Task/TaskHelper.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "TaskHelper.h"
22
#include "../Bullet/BulletHelper.h"
33
#include "../Item/ItemHelper.h"
4+
#include "../../XCInterpreter/ImageParseHelper.h"
45
#include "TaskEnemy.h"
56
TaskInsideUnit * TaskHelper::parseTaskUnitFromObject(std::string uuid, PyObject * unitObject)
67
{
@@ -77,18 +78,16 @@ Task * TaskHelper::parseTaskFromObject(PyObject * taskObject)
7778
task = new Task(uuid, targetUuid, repeatTime, intervalFrame, waitFrame);
7879
}
7980
else {
80-
auto renderInfo = PyObject_CallMethod(taskObject, "_cpp_getRenderInfo", NULL);
8181
auto enemyInfo = PyObject_CallMethod(taskObject, "_cpp_getEnemyInfo", NULL);
82-
83-
const char* imagePath; int divideInfo[2]; float scaleInfo[3]; int sandByInfo[2]; int walkInfo[2]; int colorType;
84-
PyArg_ParseTuple(renderInfo, "s(ii)(fff)(ii)(ii)i", &imagePath, &divideInfo[0], &divideInfo[1], &scaleInfo[0], &scaleInfo[1], &scaleInfo[2],
85-
&sandByInfo[0], &sandByInfo[1], &walkInfo[0], &walkInfo[1], &colorType);
82+
ImageInfo enemyImageInfo = ImageParseHelper::parseImageHelperFromObject(taskObject);
8683

8784
float position[3], velocity, movingTime,acceleration, angle, angleAcceleration, maxHealth;
8885
PyArg_ParseTuple(enemyInfo, "(fff)ffffff", &position[0], &position[1], &position[2], &velocity, &movingTime, &acceleration, &angle, &angleAcceleration, &maxHealth);
89-
task = new TaskEnemy(uuid, targetUuid, repeatTime, intervalFrame, waitFrame,imagePath, glm::vec2(divideInfo[0], divideInfo[1]),
90-
glm::vec3(scaleInfo[0], scaleInfo[1], scaleInfo[2]), glm::vec2(sandByInfo[0], sandByInfo[1]), glm::vec2(walkInfo[0], walkInfo[1]),
91-
glm::vec3(position[0], position[1], position[2]), velocity, movingTime, acceleration, angle, angleAcceleration, colorType, maxHealth);
86+
task = new TaskEnemy(uuid, targetUuid, repeatTime, intervalFrame, waitFrame,
87+
enemyImageInfo.imagePath, glm::vec2(enemyImageInfo.divideColumn, enemyImageInfo.divideRow),
88+
glm::vec3(enemyImageInfo.zoomX, enemyImageInfo.zoomY, 0.06f),
89+
glm::vec2(enemyImageInfo.specialCol1Start, enemyImageInfo.specialCol1End), glm::vec2(enemyImageInfo.specialCol2Start, enemyImageInfo.specialCol2End),
90+
glm::vec3(position[0], position[1], position[2]), velocity, movingTime, acceleration, angle, angleAcceleration, enemyImageInfo.selectY, maxHealth);
9291

9392
std::vector<DropItem>* itemVector = ItemHelper::getItemDropFromObject(taskObject);
9493
if (itemVector != nullptr) {

PythonSTG/XCFrame.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "util/GameTimer.h"
88
class XCFrame {
99
private:
10-
const char* PythonSTGVersion = "v0.34";
10+
const char* PythonSTGVersion = "v0.35release";
1111
std::atomic_bool isFrameTerminate = false;
1212
GLFWwindow* pscreen = nullptr, *tscreen = nullptr;
1313
static XCFrame* pInstance;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include "ImageParseHelper.h"
2+
#include "../XCCore/XCRender/XCImageHelper.h"
3+
ImageInfo ImageParseHelper::parseImageHelperFromObject(PyObject * object)
4+
{
5+
ImageInfo info;
6+
if (object != nullptr) {
7+
PyObject* imageInfo = PyObject_CallMethod(object, "_cpp_getImageInfo", NULL);
8+
9+
PyArg_ParseTuple(imageInfo, "sf(ii)(ff)(ii)(ff)(ii)(ii)(ii)(iii)",
10+
&info.imagePath, &info.swapSpeed, &info.selectX, &info.selectY,
11+
&info.zoomX, &info.zoomY, &info.divideColumn, &info.divideRow ,&info.offsetX, &info.offsetY,
12+
&info.specialCol1Start, &info.specialCol1End, &info.specialCol2Start, &info.specialCol2End, &info.specialCol3Start, &info.specialCol3End,
13+
&info.specialRow1, &info.specialRow2 ,&info.specialRow3);
14+
15+
}
16+
return info;
17+
}

0 commit comments

Comments
 (0)