33#include " OvalTypeBullet.h"
44#include " RectangleTypeBullet.h"
55#include " ../../XCInterpreter/ScriptLoader.h"
6+ #include " ../../XCInterpreter/ImageParseHelper.h"
67Bullet * 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, ÷Info[0 ], ÷Info[1 ], ÷Info[2 ], ÷Info[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 ) {
0 commit comments