diff --git a/SoDlib/SoDLib.depend b/SoDlib/SoDLib.depend index cba09a0..6d956ed 100644 --- a/SoDlib/SoDLib.depend +++ b/SoDlib/SoDLib.depend @@ -1,758 +1 @@ # depslib dependency file v1.0 -1378195931 source:d:\git\sod\sodlib\hgeanim.cpp - - -1378195935 d:\git\sod\hge181\include\hgeanim.h - "hgesprite.h" - -1378195935 d:\git\sod\hge181\include\hgesprite.h - "hge.h" - "hgerect.h" - -1378195935 d:\git\sod\hge181\include\hge.h - - -1378195935 d:\git\sod\hge181\include\hgerect.h - -1378195931 source:d:\git\sod\sodlib\hgecolor.cpp - - - -1378195935 d:\git\sod\hge181\include\hgecolor.h - "hge.h" - -1378195931 source:d:\git\sod\sodlib\hgefont.cpp - - - - -1378195935 d:\git\sod\hge181\include\hgefont.h - "hge.h" - "hgesprite.h" - -1378195931 source:d:\git\sod\sodlib\hgegui.cpp - - -1378195935 d:\git\sod\hge181\include\hgegui.h - "hge.h" - "hgesprite.h" - "hgerect.h" - -1378195931 source:d:\git\sod\sodlib\hgeguictrls.cpp - - - - - -1378195935 d:\git\sod\hge181\include\hgeguictrls.h - "hge.h" - "hgesprite.h" - "hgefont.h" - "hgerect.h" - "hgegui.h" - -1378195931 source:d:\git\sod\sodlib\hgerect.cpp - - - -1378195931 source:d:\git\sod\sodlib\hgesprite.cpp - - - -1378195931 source:d:\git\sod\sodlib\src\animation.cpp - "Animation.h" - -1378195931 d:\git\sod\sodlib\include\animation.h - - -1380205572 d:\git\sod\sodlib\include\sodlib.h - - - - - - - - - - - - - - - - - - - - - - - - -1378195931 d:\git\sod\box2d\box2d.h - - - - - - - - - - - - - - - - - - - - - - - - - - - - -1378195931 d:\git\sod\box2d\common\b2settings.h - - - -1378195931 d:\git\sod\box2d\common\b2draw.h - - -1378195931 d:\git\sod\box2d\common\b2math.h - - - - - - -1378195931 d:\git\sod\box2d\common\b2timer.h - - -1378195931 d:\git\sod\box2d\collision\shapes\b2circleshape.h - - -1378195931 d:\git\sod\box2d\collision\shapes\b2shape.h - - - - -1378195931 d:\git\sod\box2d\common\b2blockallocator.h - - -1378195931 d:\git\sod\box2d\collision\b2collision.h - - - -1378195931 d:\git\sod\box2d\collision\shapes\b2edgeshape.h - - -1378195931 d:\git\sod\box2d\collision\shapes\b2chainshape.h - - -1378195931 d:\git\sod\box2d\collision\shapes\b2polygonshape.h - - -1378195931 d:\git\sod\box2d\collision\b2broadphase.h - - - - - -1378195931 d:\git\sod\box2d\collision\b2dynamictree.h - - - -1378195931 d:\git\sod\box2d\common\b2growablestack.h - - - -1378195931 d:\git\sod\box2d\collision\b2distance.h - - -1378195931 d:\git\sod\box2d\collision\b2timeofimpact.h - - - -1378195931 d:\git\sod\box2d\dynamics\b2body.h - - - - -1378195931 d:\git\sod\box2d\dynamics\b2fixture.h - - - - -1378195931 d:\git\sod\box2d\dynamics\b2worldcallbacks.h - - -1378195931 d:\git\sod\box2d\dynamics\b2timestep.h - - -1378195931 d:\git\sod\box2d\dynamics\b2world.h - - - - - - - -1378195931 d:\git\sod\box2d\common\b2stackallocator.h - - -1378195931 d:\git\sod\box2d\dynamics\b2contactmanager.h - - -1378195931 d:\git\sod\box2d\dynamics\contacts\b2contact.h - - - - - -1378195931 d:\git\sod\box2d\dynamics\joints\b2distancejoint.h - - -1378195931 d:\git\sod\box2d\dynamics\joints\b2joint.h - - -1378195931 d:\git\sod\box2d\dynamics\joints\b2frictionjoint.h - - -1378195931 d:\git\sod\box2d\dynamics\joints\b2gearjoint.h - - -1378195931 d:\git\sod\box2d\dynamics\joints\b2wheeljoint.h - - -1378195931 d:\git\sod\box2d\dynamics\joints\b2mousejoint.h - - -1378195931 d:\git\sod\box2d\dynamics\joints\b2prismaticjoint.h - - -1378195931 d:\git\sod\box2d\dynamics\joints\b2pulleyjoint.h - - -1378195931 d:\git\sod\box2d\dynamics\joints\b2revolutejoint.h - - -1378195931 d:\git\sod\box2d\dynamics\joints\b2ropejoint.h - - -1378195931 d:\git\sod\box2d\dynamics\joints\b2weldjoint.h - - -1378195931 d:\git\sod\sodlib\include\tinyxml.h - - - - - - - - - "tinystr.h" - -1378195931 d:\git\sod\sodlib\include\tinystr.h - - - -1378195931 d:\git\sod\sodlib\include\exception.h - - - -1380205000 d:\git\sod\sodlib\include\game.h - - -1378195931 d:\git\sod\sodlib\include\construction.h - - -1378195931 d:\git\sod\sodlib\include\characteractioncause.h - - -1378195931 d:\git\sod\sodlib\include\characteractioneffect.h - - -1378195931 d:\git\sod\sodlib\include\characteraction.h - - -1378195931 d:\git\sod\sodlib\include\characterhotspot.h - - -1378286669 d:\git\sod\sodlib\include\character.h - - -1378195931 d:\git\sod\sodlib\include\nonplayercharacter.h - - -1378195931 d:\git\sod\sodlib\include\playercharacter.h - - -1380185565 d:\git\sod\sodlib\include\groundline.h - - -1378306187 d:\git\sod\sodlib\include\mapanimation.h - - -1378195931 d:\git\sod\sodlib\include\debugdraw.h - - -1378195931 d:\git\sod\sodlib\include\guiwindow.h - - - -1378195931 d:\git\sod\sodlib\include\hgeguimenuitem.h - - -1378195931 source:d:\git\sod\sodlib\src\characteraction.cpp - "CharacterAction.h" - -1378195931 source:d:\git\sod\sodlib\src\characteractioncause.cpp - "CharacterActionCause.h" - -1378195931 source:d:\git\sod\sodlib\src\characteractioneffect.cpp - "CharacterActionEffect.h" - -1378195931 source:d:\git\sod\sodlib\src\characterhotspot.cpp - "CharacterHotSpot.h" - -1378195931 source:d:\git\sod\sodlib\src\construction.cpp - "Construction.h" - -1378195931 source:d:\git\sod\sodlib\src\debugdraw.cpp - "DebugDraw.h" - -1378195931 source:d:\git\sod\sodlib\src\exception.cpp - "Exception.h" - -1380205490 source:d:\git\sod\sodlib\src\game.cpp - "Game.h" - -1380189463 source:d:\git\sod\sodlib\src\groundline.cpp - "GroundLine.h" - -1378195931 source:d:\git\sod\sodlib\src\guiwindow.cpp - "GUIWindow.h" - -1378195931 source:d:\git\sod\sodlib\src\hgeguimenuitem.cpp - "hgeGUIMenuItem.h" - -1378305920 source:d:\git\sod\sodlib\src\mapanimation.cpp - "MapAnimation.h" - -1378195931 source:d:\git\sod\sodlib\src\nonplayercharacter.cpp - "NonPlayerCharacter.h" - -1378195931 source:d:\git\sod\sodlib\src\playercharacter.cpp - "PlayerCharacter.h" - -1378195931 source:d:\git\sod\sodlib\tinystr.cpp - "tinystr.h" - -1378293644 source:d:\git\sod\sodlib\tinyxml.cpp - - - - "tinyxml.h" - -1378195931 source:d:\git\sod\sodlib\tinyxmlerror.cpp - "tinyxml.h" - -1378195931 source:d:\git\sod\sodlib\tinyxmlparser.cpp - - - "tinyxml.h" - - -1380203057 source:d:\git\sod\sodlib\src\character.cpp - "Character.h" - -1342709300 source:d:\work\git\sod\sodlib\hgeanim.cpp - - -1177328880 d:\work\git\sod\hge181\include\hgeanim.h - "hgesprite.h" - -1177592146 d:\work\git\sod\hge181\include\hgesprite.h - "hge.h" - "hgerect.h" - -1202820504 d:\work\git\sod\hge181\include\hge.h - - -1176893286 d:\work\git\sod\hge181\include\hgerect.h - -1353254303 source:d:\work\git\sod\sodlib\hgecolor.cpp - - - -1176893286 d:\work\git\sod\hge181\include\hgecolor.h - "hge.h" - -1340106432 source:d:\work\git\sod\sodlib\hgefont.cpp - - - - -1184932634 d:\work\git\sod\hge181\include\hgefont.h - "hge.h" - "hgesprite.h" - -1347216209 source:d:\work\git\sod\sodlib\hgegui.cpp - - -1198253000 d:\work\git\sod\hge181\include\hgegui.h - "hge.h" - "hgesprite.h" - "hgerect.h" - -1347216223 source:d:\work\git\sod\sodlib\hgeguictrls.cpp - - - - - -1176893286 d:\work\git\sod\hge181\include\hgeguictrls.h - "hge.h" - "hgesprite.h" - "hgefont.h" - "hgerect.h" - "hgegui.h" - -1340106537 source:d:\work\git\sod\sodlib\hgerect.cpp - - - -1340106505 source:d:\work\git\sod\sodlib\hgesprite.cpp - - - -1354471331 source:d:\work\git\sod\sodlib\src\animation.cpp - "Animation.h" - -1354450463 d:\work\git\sod\sodlib\include\animation.h - - -1378318649 d:\work\git\sod\sodlib\include\sodlib.h - - - - - - - - - - - - - - - - - - - - - - - -1314999540 d:\work\git\sod\box2d\box2d.h - - - - - - - - - - - - - - - - - - - - - - - - - - - - -1315003762 d:\work\git\sod\box2d\common\b2settings.h - - - -1301211102 d:\work\git\sod\box2d\common\b2draw.h - - -1315061282 d:\work\git\sod\box2d\common\b2math.h - - - - - - -1315770396 d:\work\git\sod\box2d\common\b2timer.h - - -1300947420 d:\work\git\sod\box2d\collision\shapes\b2circleshape.h - - -1313941794 d:\work\git\sod\box2d\collision\shapes\b2shape.h - - - - -1300947420 d:\work\git\sod\box2d\common\b2blockallocator.h - - -1307265762 d:\work\git\sod\box2d\collision\b2collision.h - - - -1314820388 d:\work\git\sod\box2d\collision\shapes\b2edgeshape.h - - -1314819744 d:\work\git\sod\box2d\collision\shapes\b2chainshape.h - - -1300947420 d:\work\git\sod\box2d\collision\shapes\b2polygonshape.h - - -1301221404 d:\work\git\sod\box2d\collision\b2broadphase.h - - - - - -1308948390 d:\work\git\sod\box2d\collision\b2dynamictree.h - - - -1300947420 d:\work\git\sod\box2d\common\b2growablestack.h - - - -1300947420 d:\work\git\sod\box2d\collision\b2distance.h - - -1300947420 d:\work\git\sod\box2d\collision\b2timeofimpact.h - - - -1315048344 d:\work\git\sod\box2d\dynamics\b2body.h - - - - -1315032742 d:\work\git\sod\box2d\dynamics\b2fixture.h - - - - -1314034002 d:\work\git\sod\box2d\dynamics\b2worldcallbacks.h - - -1315769532 d:\work\git\sod\box2d\dynamics\b2timestep.h - - -1315134398 d:\work\git\sod\box2d\dynamics\b2world.h - - - - - - - -1300947420 d:\work\git\sod\box2d\common\b2stackallocator.h - - -1300947420 d:\work\git\sod\box2d\dynamics\b2contactmanager.h - - -1305747220 d:\work\git\sod\box2d\dynamics\contacts\b2contact.h - - - - - -1315123384 d:\work\git\sod\box2d\dynamics\joints\b2distancejoint.h - - -1315135600 d:\work\git\sod\box2d\dynamics\joints\b2joint.h - - -1315134678 d:\work\git\sod\box2d\dynamics\joints\b2frictionjoint.h - - -1315134934 d:\work\git\sod\box2d\dynamics\joints\b2gearjoint.h - - -1315135552 d:\work\git\sod\box2d\dynamics\joints\b2wheeljoint.h - - -1315135612 d:\work\git\sod\box2d\dynamics\joints\b2mousejoint.h - - -1315326328 d:\work\git\sod\box2d\dynamics\joints\b2prismaticjoint.h - - -1315135320 d:\work\git\sod\box2d\dynamics\joints\b2pulleyjoint.h - - -1315132774 d:\work\git\sod\box2d\dynamics\joints\b2revolutejoint.h - - -1315154614 d:\work\git\sod\box2d\dynamics\joints\b2ropejoint.h - - -1315131064 d:\work\git\sod\box2d\dynamics\joints\b2weldjoint.h - - -1305386698 d:\work\git\sod\sodlib\include\tinyxml.h - - - - - - - - - "tinystr.h" - -1305386698 d:\work\git\sod\sodlib\include\tinystr.h - - - -1341679979 d:\work\git\sod\sodlib\include\exception.h - - - -1380139829 d:\work\git\sod\sodlib\include\game.h - - -1357404989 d:\work\git\sod\sodlib\include\construction.h - - -1364108541 d:\work\git\sod\sodlib\include\characteractioncause.h - - -1364063182 d:\work\git\sod\sodlib\include\characteractioneffect.h - - -1363970119 d:\work\git\sod\sodlib\include\characteraction.h - - -1363631441 d:\work\git\sod\sodlib\include\characterhotspot.h - - -1378235018 d:\work\git\sod\sodlib\include\character.h - - -1364058630 d:\work\git\sod\sodlib\include\nonplayercharacter.h - - -1364063810 d:\work\git\sod\sodlib\include\playercharacter.h - - -1380139584 d:\work\git\sod\sodlib\include\groundline.h - - -1378318649 d:\work\git\sod\sodlib\include\mapanimation.h - - -1363638071 d:\work\git\sod\sodlib\include\debugdraw.h - - -1364326445 d:\work\git\sod\sodlib\include\guiwindow.h - - - -1353419913 d:\work\git\sod\sodlib\include\hgeguimenuitem.h - - -1380135621 source:d:\work\git\sod\sodlib\src\character.cpp - "Character.h" - -1363970124 source:d:\work\git\sod\sodlib\src\characteraction.cpp - "CharacterAction.h" - -1377893052 source:d:\work\git\sod\sodlib\src\characteractioncause.cpp - "CharacterActionCause.h" - -1364069426 source:d:\work\git\sod\sodlib\src\characteractioneffect.cpp - "CharacterActionEffect.h" - -1363634098 source:d:\work\git\sod\sodlib\src\characterhotspot.cpp - "CharacterHotSpot.h" - -1377717553 source:d:\work\git\sod\sodlib\src\construction.cpp - "Construction.h" - -1363640969 source:d:\work\git\sod\sodlib\src\debugdraw.cpp - "DebugDraw.h" - -1341681952 source:d:\work\git\sod\sodlib\src\exception.cpp - "Exception.h" - -1377939083 source:d:\work\git\sod\sodlib\src\guiwindow.cpp - "GUIWindow.h" - -1357574814 source:d:\work\git\sod\sodlib\src\hgeguimenuitem.cpp - "hgeGUIMenuItem.h" - -1378318649 source:d:\work\git\sod\sodlib\src\mapanimation.cpp - "MapAnimation.h" - -1364067025 source:d:\work\git\sod\sodlib\src\nonplayercharacter.cpp - "NonPlayerCharacter.h" - -1364067049 source:d:\work\git\sod\sodlib\src\playercharacter.cpp - "PlayerCharacter.h" - -1305386698 source:d:\work\git\sod\sodlib\tinystr.cpp - "tinystr.h" - -1378318649 source:d:\work\git\sod\sodlib\tinyxml.cpp - - - - "tinyxml.h" - -1305386698 source:d:\work\git\sod\sodlib\tinyxmlerror.cpp - "tinyxml.h" - -1305386698 source:d:\work\git\sod\sodlib\tinyxmlparser.cpp - - - "tinyxml.h" - - -1380137852 source:d:\work\git\sod\sodlib\src\game.cpp - "Game.h" - -1380139809 source:d:\work\git\sod\sodlib\src\groundline.cpp - "GroundLine.h" - -1380205663 d:\git\sod\sodlib\include\platform.h - - -1380205696 source:d:\git\sod\sodlib\src\platform.cpp - "Platform.h" - diff --git a/SoDlib/include/Character.h b/SoDlib/include/Character.h index 515e0a7..3d05cdd 100644 --- a/SoDlib/include/Character.h +++ b/SoDlib/include/Character.h @@ -24,6 +24,7 @@ class Character void turn(); void run(float speed); void jump(b2Vec2 speed); + void move(float dx, float dy); void setAnim(int anim); diff --git a/SoDlib/include/Game.h b/SoDlib/include/Game.h index e93d374..f9b80bc 100644 --- a/SoDlib/include/Game.h +++ b/SoDlib/include/Game.h @@ -52,7 +52,10 @@ class Game Character* getCharacter(int index); int getGroundLinesCount(); - GroundLine* getGroundLine(int index); + GroundLine* getGroundLine(int index); + + int getMapAnimationsCount(); + MapAnimation* getMapAnimation(int index); HGE* getHge(); b2World* getWorld(); diff --git a/SoDlib/include/GroundLine.h b/SoDlib/include/GroundLine.h index 678874f..ad9dc6f 100644 --- a/SoDlib/include/GroundLine.h +++ b/SoDlib/include/GroundLine.h @@ -20,6 +20,7 @@ class GroundLine float horizontalDistanceTo(float x); float distanceTo(float x, float y); void debugDraw(), debugDraw(DWORD color); + void move(float dx, float dy); protected: b2Vec2 startPoint, endPoint; float k, inversedK; diff --git a/SoDlib/include/MapAnimation.h b/SoDlib/include/MapAnimation.h index 7dbec27..93fe0f3 100644 --- a/SoDlib/include/MapAnimation.h +++ b/SoDlib/include/MapAnimation.h @@ -10,6 +10,7 @@ class MapAnimation virtual ~MapAnimation(); void draw(bool schematicMode); + void move(float dx, float dy); protected: float x, y, angle; hgeAnimation* animation; diff --git a/SoDlib/include/Platform.h b/SoDlib/include/Platform.h index 30ffcca..e034edf 100644 --- a/SoDlib/include/Platform.h +++ b/SoDlib/include/Platform.h @@ -8,12 +8,19 @@ class Platform public: Platform(Game* game, TiXmlElement* elem); virtual ~Platform(); + + void update(float dt); + + bool characterOn(int charIndex); protected: Game* game; int groundLinesCount, animationsCount; int* groundLines; int *animations; int spotsCount; - float* spotX; float* spotY; float*spotAngle; float*spotTime; + float* spotX; float* spotY; float* spotAngle; float* spotTime; + + float currentTime; float currentSpotStart; int currentSpot; + float currentX, currentY; private: }; diff --git a/SoDlib/libSoDlib.a b/SoDlib/libSoDlib.a index 6782966..e301d92 100644 Binary files a/SoDlib/libSoDlib.a and b/SoDlib/libSoDlib.a differ diff --git a/SoDlib/src/Character.cpp b/SoDlib/src/Character.cpp index f5e363d..98d89d8 100644 --- a/SoDlib/src/Character.cpp +++ b/SoDlib/src/Character.cpp @@ -481,6 +481,11 @@ void Character::jump(b2Vec2 speed) //speed.y = 6 * speed.y; //position.y -= 2; +} + +void Character::move(float dx, float dy) +{ + position.x += dx; position.y += dy; } void Character::setAnim(int anim) diff --git a/SoDlib/src/Game.cpp b/SoDlib/src/Game.cpp index 51d4c04..cabaa98 100644 --- a/SoDlib/src/Game.cpp +++ b/SoDlib/src/Game.cpp @@ -188,12 +188,15 @@ void Game::updateWorld(float dt) //world->Step(timeStep, velocityIterations, positionIterations); for (int i = 0; i < charactersCount; i++) { characters[i]->update(dt); + } + for (int i = 0; i < platformsCount; i++) { + platforms[i]->update(dt); } cameraPos = characters[0]->getPosition() - b2Vec2(0.5 * screenWidth / pixelsPerMeter, 0.5 * screenHeight / pixelsPerMeter); } bool Game::updateControls() { - // Process keys + /// Process keys if (hge->Input_GetKeyState(HGEK_ESCAPE)) return true; if (hge->Input_KeyDown(HGEK_TAB)) schematicDrawMode = !schematicDrawMode; //if (hge->Input_KeyDown(HGEK_SPACE)) loadConstruction("box.xml", b2Vec2(10 + hge->Random_Float(-1, 1), 0)); @@ -202,12 +205,9 @@ bool Game::updateControls() void Game::startDraw() { - // Begin rendering quads. - // This function must be called - // before any actual rendering. hge->Gfx_BeginScene(); - // Clear screen with skyblue color + /// Clear screen with skyblue color DWORD color = 0x7fc7ff; if (schematicDrawMode) { color = 0; @@ -219,7 +219,7 @@ void Game::endDraw() { gui->Render(); - // End rendering and update the screen + /// End rendering and update the screen hge->Gfx_EndScene(); } @@ -619,6 +619,19 @@ GroundLine* Game::getGroundLine(int index) } else { return NULL; } +} + +int Game::getMapAnimationsCount() +{ + return mapAnimationsCount; +} +MapAnimation* Game::getMapAnimation(int index) +{ + if (index < mapAnimationsCount) { + return mapAnimations[index]; + } else { + return NULL; + } } float Game::worldX(float screenX) diff --git a/SoDlib/src/GroundLine.cpp b/SoDlib/src/GroundLine.cpp index 883adc1..519fa8e 100644 --- a/SoDlib/src/GroundLine.cpp +++ b/SoDlib/src/GroundLine.cpp @@ -159,3 +159,9 @@ float GroundLine::distanceTo(float x, float y) { return distanceToSegment(startPoint.x, startPoint.y, endPoint.x, endPoint.y, x, y); } + +void GroundLine::move(float dx, float dy) +{ + startPoint.x += dx; startPoint.y += dy; + endPoint.x += dx; endPoint.y += dy; +} diff --git a/SoDlib/src/MapAnimation.cpp b/SoDlib/src/MapAnimation.cpp index d3879f8..e16bd31 100644 --- a/SoDlib/src/MapAnimation.cpp +++ b/SoDlib/src/MapAnimation.cpp @@ -24,3 +24,8 @@ void MapAnimation::draw(bool schematicMode) game->getScaleFactor() ); } + +void MapAnimation::move(float dx, float dy) +{ + x += dx; y += dy; +} diff --git a/SoDlib/src/Platform.cpp b/SoDlib/src/Platform.cpp index 184cc5e..98daf90 100644 --- a/SoDlib/src/Platform.cpp +++ b/SoDlib/src/Platform.cpp @@ -41,9 +41,63 @@ Platform::Platform(Game* game, TiXmlElement* element) j++; child = child->NextSiblingElement("spot"); } + + currentSpot = 0; + currentTime = 0.0f; + currentSpotStart = 0.0f; + currentX = 0; + currentY = 0; } Platform::~Platform() { //dtor } + +void Platform::update(float dt) +{ + currentTime += dt; + if (currentTime > currentSpotStart + spotTime[currentSpot]) { + ///Переходим к следующему положению + if (currentSpot == spotsCount - 1) { + currentTime -= (currentSpotStart + spotTime[currentSpot]); + currentSpotStart = 0; + currentSpot = 0; + } else { + currentSpotStart += spotTime[currentSpot]; + currentSpot++; + } + } + float prevX = 0; float prevY = 0; + if (currentSpot > 0) { + prevX = spotX[currentSpot - 1]; + prevY = spotY[currentSpot - 1]; + } + float progress = (currentTime - currentSpotStart) / spotTime[currentSpot]; + float x = prevX + (spotX[currentSpot] - prevX) * progress; + float y = prevY + (spotY[currentSpot] - prevY) * progress; + float dx = x - currentX; float dy = y - currentY; + + for (int i = 0; i < game->getCharactersCount(); i++) { + if (characterOn(i)) { + game->getCharacter(i)->move(dx, dy); + } + } + for (int i = 0; i < groundLinesCount; i++) { + game->getGroundLine(groundLines[i])->move(dx, dy); + } + for (int i = 0; i < animationsCount; i++) { + game->getMapAnimation(animations[i])->move(dx, dy); + } + currentX = x; currentY = y; +} + +bool Platform::characterOn(int charIndex) +{ + Character* character = game->getCharacter(charIndex); + for (int i = 0; i < groundLinesCount; i++) { + if (character->getOnGround() == groundLines[i]) + return true; + } + return false; +} diff --git a/characterEditor/bin/Debug/animations.xml b/characterEditor/bin/Debug/animations.xml index 1b81add..5ad560a 100644 --- a/characterEditor/bin/Debug/animations.xml +++ b/characterEditor/bin/Debug/animations.xml @@ -1,7 +1,8 @@ - - - - - - + + + + + + + diff --git a/characterEditor/bin/Debug/disabled_icon.xml b/characterEditor/bin/Debug/disabled_icon.xml new file mode 100644 index 0000000..b762286 --- /dev/null +++ b/characterEditor/bin/Debug/disabled_icon.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/characterEditor/bin/Debug/icons.png b/characterEditor/bin/Debug/icons.png new file mode 100644 index 0000000..e357131 Binary files /dev/null and b/characterEditor/bin/Debug/icons.png differ diff --git a/characterEditor/bin/Debug/rat.xml b/characterEditor/bin/Debug/rat.xml new file mode 100644 index 0000000..5ad560a --- /dev/null +++ b/characterEditor/bin/Debug/rat.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/characterEditor/bin/Debug/rat/arm.png b/characterEditor/bin/Debug/rat/arm.png new file mode 100644 index 0000000..7501111 Binary files /dev/null and b/characterEditor/bin/Debug/rat/arm.png differ diff --git a/characterEditor/bin/Debug/rat/arm.png.xml b/characterEditor/bin/Debug/rat/arm.png.xml new file mode 100644 index 0000000..20aef12 --- /dev/null +++ b/characterEditor/bin/Debug/rat/arm.png.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/characterEditor/bin/Debug/rat/body.png b/characterEditor/bin/Debug/rat/body.png new file mode 100644 index 0000000..56599c6 Binary files /dev/null and b/characterEditor/bin/Debug/rat/body.png differ diff --git a/characterEditor/bin/Debug/rat/body.png.xml b/characterEditor/bin/Debug/rat/body.png.xml new file mode 100644 index 0000000..a50ae35 --- /dev/null +++ b/characterEditor/bin/Debug/rat/body.png.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/characterEditor/bin/Debug/rat/head.png b/characterEditor/bin/Debug/rat/head.png new file mode 100644 index 0000000..276ccbb Binary files /dev/null and b/characterEditor/bin/Debug/rat/head.png differ diff --git a/characterEditor/bin/Debug/rat/head.png.xml b/characterEditor/bin/Debug/rat/head.png.xml new file mode 100644 index 0000000..3311d40 --- /dev/null +++ b/characterEditor/bin/Debug/rat/head.png.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/characterEditor/bin/Debug/rat/head2.png b/characterEditor/bin/Debug/rat/head2.png new file mode 100644 index 0000000..74701cc Binary files /dev/null and b/characterEditor/bin/Debug/rat/head2.png differ diff --git a/characterEditor/bin/Debug/rat/head2.png.xml b/characterEditor/bin/Debug/rat/head2.png.xml new file mode 100644 index 0000000..5666cd0 --- /dev/null +++ b/characterEditor/bin/Debug/rat/head2.png.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/characterEditor/bin/Debug/rat/leg.png b/characterEditor/bin/Debug/rat/leg.png new file mode 100644 index 0000000..10e597d Binary files /dev/null and b/characterEditor/bin/Debug/rat/leg.png differ diff --git a/characterEditor/bin/Debug/rat/leg.png.xml b/characterEditor/bin/Debug/rat/leg.png.xml new file mode 100644 index 0000000..11b5ead --- /dev/null +++ b/characterEditor/bin/Debug/rat/leg.png.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/characterEditor/bin/Debug/rat/rat.png b/characterEditor/bin/Debug/rat/rat.png new file mode 100644 index 0000000..c07b5da Binary files /dev/null and b/characterEditor/bin/Debug/rat/rat.png differ diff --git a/characterEditor/bin/Debug/rat/tail.png b/characterEditor/bin/Debug/rat/tail.png new file mode 100644 index 0000000..df92af6 Binary files /dev/null and b/characterEditor/bin/Debug/rat/tail.png differ diff --git a/characterEditor/bin/Debug/rat/tail.png.xml b/characterEditor/bin/Debug/rat/tail.png.xml new file mode 100644 index 0000000..3cccfd8 --- /dev/null +++ b/characterEditor/bin/Debug/rat/tail.png.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/characterEditor/bin/Debug/rat/tail2.png b/characterEditor/bin/Debug/rat/tail2.png new file mode 100644 index 0000000..180b8d8 Binary files /dev/null and b/characterEditor/bin/Debug/rat/tail2.png differ diff --git a/characterEditor/bin/Debug/rat/tail2.png.xml b/characterEditor/bin/Debug/rat/tail2.png.xml new file mode 100644 index 0000000..5ac7024 --- /dev/null +++ b/characterEditor/bin/Debug/rat/tail2.png.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/characterEditor/bin/Debug/resize_icon.xml b/characterEditor/bin/Debug/resize_icon.xml new file mode 100644 index 0000000..691b8b6 --- /dev/null +++ b/characterEditor/bin/Debug/resize_icon.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/characterEditor/bin/Debug/test.xml b/characterEditor/bin/Debug/test.xml index 4af223d..c06d55e 100644 --- a/characterEditor/bin/Debug/test.xml +++ b/characterEditor/bin/Debug/test.xml @@ -1,14 +1,12 @@ - - - - - - - - - - + + + + + + + + @@ -17,18 +15,14 @@ - - - - - - - - - - - + + + + + + + @@ -38,39 +32,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + @@ -78,51 +43,23 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - - - - - + + + + + + + + @@ -132,78 +69,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/characterEditor/main.cpp b/characterEditor/main.cpp index dd249b6..8aed048 100644 --- a/characterEditor/main.cpp +++ b/characterEditor/main.cpp @@ -17,6 +17,7 @@ const int MODE_CAMERA_MOVE = 8; const int MODE_ANIM_ROTATE = 9; const int MODE_LAYER_DRAG = 10; const int MODE_ANIM_CONTEXT_MENU = 11; +const int MODE_RESIZE_CHARACTER = 12; const int MODE_PLAYING = 20; @@ -110,6 +111,8 @@ bool drawBoxes = true; HTEXTURE bgTex; hgeFont* fnt; +hgeAnimation* disabledIcon; hgeAnimation* resizeIcon; + hgeQuad grayQuad; void resetMode() @@ -1316,6 +1319,11 @@ bool FrameFunc() mode = MODE_ANGLE_DRAG; } } + + if (sqrt(pow(x - game->screenX(characterWidth * 0.5), 2) + pow(y - game->screenY(-characterHeight * 0.5), 2)) < 5) { + ///Если мышка возле угла прямоугольника, показывающего размер, то будем менять размер + mode = MODE_RESIZE_CHARACTER; + } } if (game->getHge()->Input_KeyDown(HGEK_LBUTTON) && game->getHge()->Input_GetKeyState(HGEK_SHIFT)) { selectedBody = getPointedBody(x, y); @@ -1617,6 +1625,17 @@ bool FrameFunc() resetMode(); } break; + case MODE_RESIZE_CHARACTER: + characterWidth = worldX * 2; + characterHeight = -worldY * 2; + if (characterWidth < 0) + characterWidth = 0; + if (characterHeight < 0) + characterHeight = 0; + if (game->getHge()->Input_KeyUp(HGEK_LBUTTON)) { + resetMode(); + } + break; } return game->update(false); @@ -1635,8 +1654,20 @@ bool RenderFunc() // game->getHge()->Gfx_RenderLine(game->screenX(0.5), game->screenY(-characterHeight), game->screenX(0.5), game->screenY(0), 0x55000000); // game->drawArc(game->screenX(0), game->screenY(0), 50 * game->getScaleFactor(), M_PI, 2 * M_PI, 0x55000000, 0); // game->getHge()->Gfx_RenderLine(game->screenX(-10), game->screenY(0.5), game->screenX(10), game->screenY(0.5), 0x55000000); + ///Положение мышки на экране и в мире + float x, y; + game->getHge()->Input_GetMousePos(&x, &y); + float worldX = game->worldX(x); + float worldY = game->worldY(y); + ///Добавление анимации в пул + float insertX = x; float insertY = y; + if (insertX < 1300) insertX = 1300; if (insertY < 450) insertY = 450; + ///Прямоугольник, показывающий размер персонажа в мире game->drawRect(game->screenX(0), game->screenY(0), characterWidth * 0.5 * game->getFullScale(), characterHeight * 0.5 * game->getFullScale(), 0, 0x55000000, 0); + if (sqrt(pow(x - game->screenX(characterWidth * 0.5), 2) + pow(y - game->screenY(-characterHeight * 0.5), 2)) < 5) { + resizeIcon->Render(x, y);///Нарисуем иконку, если мышка возле правого верхнего угла + } for (int index = 0; index < bodiesCount; index++) { int i = animLayer(index); @@ -1710,13 +1741,6 @@ bool RenderFunc() } } - float x, y; - game->getHge()->Input_GetMousePos(&x, &y); - float worldX = game->worldX(x); - float worldY = game->worldY(y); - float insertX = x; float insertY = y; - if (insertX < 1300) insertX = 1300; if (insertY < 450) insertY = 450; - //game->getHge()->Gfx_RenderLine(game->screenX(0) - 10, game->screenY(0) - 10, game->screenX(0) + 10, game->screenY(0) + 10, 0xFF000000); //game->getHge()->Gfx_RenderLine(game->screenX(0) - 10, game->screenY(0) + 10, game->screenX(0) + 10, game->screenY(0) - 10, 0xFF000000); @@ -2046,6 +2070,9 @@ int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) fnt = new hgeFont("font1.fnt"); + disabledIcon = game->loadAnimation("disabled_icon.xml"); + resizeIcon = game->loadAnimation("resize_icon.xml"); + grayQuad.v[0].x = 1300; grayQuad.v[0].y = 0; grayQuad.v[0].col = 0xFFAAAAAA; grayQuad.v[0].z = 1; grayQuad.v[1].x = 1600; grayQuad.v[1].y = 0; grayQuad.v[1].col = 0xFFAAAAAA; grayQuad.v[1].z = 1; grayQuad.v[2].x = 1600; grayQuad.v[2].y = 900; grayQuad.v[2].col = 0xFFAAAAAA; grayQuad.v[2].z = 1; diff --git a/mapEditor/bin/Debug/map.xml b/mapEditor/bin/Debug/map.xml index 6ac5450..35ec295 100644 --- a/mapEditor/bin/Debug/map.xml +++ b/mapEditor/bin/Debug/map.xml @@ -19,9 +19,9 @@ - + - + diff --git a/plainlandsGame/bin/Debug/rat.xml b/plainlandsGame/bin/Debug/rat.xml new file mode 100644 index 0000000..c06d55e --- /dev/null +++ b/plainlandsGame/bin/Debug/rat.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plainlandsGame/bin/Debug/rat/arm.png b/plainlandsGame/bin/Debug/rat/arm.png new file mode 100644 index 0000000..7501111 Binary files /dev/null and b/plainlandsGame/bin/Debug/rat/arm.png differ diff --git a/plainlandsGame/bin/Debug/rat/arm.png.xml b/plainlandsGame/bin/Debug/rat/arm.png.xml new file mode 100644 index 0000000..20aef12 --- /dev/null +++ b/plainlandsGame/bin/Debug/rat/arm.png.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/plainlandsGame/bin/Debug/rat/body.png b/plainlandsGame/bin/Debug/rat/body.png new file mode 100644 index 0000000..56599c6 Binary files /dev/null and b/plainlandsGame/bin/Debug/rat/body.png differ diff --git a/plainlandsGame/bin/Debug/rat/body.png.xml b/plainlandsGame/bin/Debug/rat/body.png.xml new file mode 100644 index 0000000..a50ae35 --- /dev/null +++ b/plainlandsGame/bin/Debug/rat/body.png.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/plainlandsGame/bin/Debug/rat/head.png b/plainlandsGame/bin/Debug/rat/head.png new file mode 100644 index 0000000..276ccbb Binary files /dev/null and b/plainlandsGame/bin/Debug/rat/head.png differ diff --git a/plainlandsGame/bin/Debug/rat/head.png.xml b/plainlandsGame/bin/Debug/rat/head.png.xml new file mode 100644 index 0000000..3311d40 --- /dev/null +++ b/plainlandsGame/bin/Debug/rat/head.png.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/plainlandsGame/bin/Debug/rat/head2.png b/plainlandsGame/bin/Debug/rat/head2.png new file mode 100644 index 0000000..74701cc Binary files /dev/null and b/plainlandsGame/bin/Debug/rat/head2.png differ diff --git a/plainlandsGame/bin/Debug/rat/head2.png.xml b/plainlandsGame/bin/Debug/rat/head2.png.xml new file mode 100644 index 0000000..5666cd0 --- /dev/null +++ b/plainlandsGame/bin/Debug/rat/head2.png.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/plainlandsGame/bin/Debug/rat/leg.png b/plainlandsGame/bin/Debug/rat/leg.png new file mode 100644 index 0000000..10e597d Binary files /dev/null and b/plainlandsGame/bin/Debug/rat/leg.png differ diff --git a/plainlandsGame/bin/Debug/rat/leg.png.xml b/plainlandsGame/bin/Debug/rat/leg.png.xml new file mode 100644 index 0000000..11b5ead --- /dev/null +++ b/plainlandsGame/bin/Debug/rat/leg.png.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/plainlandsGame/bin/Debug/rat/rat.png b/plainlandsGame/bin/Debug/rat/rat.png new file mode 100644 index 0000000..c07b5da Binary files /dev/null and b/plainlandsGame/bin/Debug/rat/rat.png differ diff --git a/plainlandsGame/bin/Debug/rat/tail.png b/plainlandsGame/bin/Debug/rat/tail.png new file mode 100644 index 0000000..df92af6 Binary files /dev/null and b/plainlandsGame/bin/Debug/rat/tail.png differ diff --git a/plainlandsGame/bin/Debug/rat/tail.png.xml b/plainlandsGame/bin/Debug/rat/tail.png.xml new file mode 100644 index 0000000..3cccfd8 --- /dev/null +++ b/plainlandsGame/bin/Debug/rat/tail.png.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/plainlandsGame/bin/Debug/rat/tail2.png b/plainlandsGame/bin/Debug/rat/tail2.png new file mode 100644 index 0000000..180b8d8 Binary files /dev/null and b/plainlandsGame/bin/Debug/rat/tail2.png differ diff --git a/plainlandsGame/bin/Debug/rat/tail2.png.xml b/plainlandsGame/bin/Debug/rat/tail2.png.xml new file mode 100644 index 0000000..5ac7024 --- /dev/null +++ b/plainlandsGame/bin/Debug/rat/tail2.png.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file