Merge branch 'master' of github.com:Allanis/Unuk
Conflicts: src/libUnuk/Engine/NPC.cpp src/libUnuk/LevelGen/LevelGen.h src/libUnuk/LevelGen/MapTile.cpp src/libUnuk/LevelGen/MapTile.h
This commit is contained in:
commit
2e50097502
BIN
Data/Media/Images/Characters/Reniesta.png
Normal file
BIN
Data/Media/Images/Characters/Reniesta.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.0 KiB |
47
README
47
README
@ -1,9 +1,6 @@
|
|||||||
Readme plz!
|
Readme plz!
|
||||||
___________
|
___________
|
||||||
|
|
||||||
I have decided to use Git for SCM of this project.
|
|
||||||
Please see https://github.com/Allanis/Unuk
|
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
|
|
||||||
I am currently working on a series of algorithms to show off
|
I am currently working on a series of algorithms to show off
|
||||||
@ -11,49 +8,15 @@ for a portfolio piece. I will place this under the GPL licence.
|
|||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~Instructions~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
TODO:
|
|
||||||
|
|
||||||
*Menu:
|
Arrow keys/wasd - Move Player.
|
||||||
~~~~~
|
'p' - Show debug information.
|
||||||
- New Game
|
'Space'/'Left Mouse' - Attack.
|
||||||
- SaveGame loading
|
|
||||||
- New screen or make buttons appear on the menu
|
|
||||||
- SaveGame deleting
|
|
||||||
- Game Settings
|
|
||||||
- Keybindings
|
|
||||||
- Fullscreen
|
|
||||||
|
|
||||||
*Fix NPC animation
|
|
||||||
|
|
||||||
*Map Editor:
|
|
||||||
~~~~~~~~~~~~
|
|
||||||
|
|
||||||
- Change the array of tiles into a list of tiles.
|
|
||||||
- Get a tile selection marker and display the current tile info.
|
|
||||||
|
|
||||||
*Proper collision testing.
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
- MapTile objects store a list of character* 's
|
|
||||||
- The character class will add and remove themselves from the list in the MapTile.
|
|
||||||
- When the Character class wants to check for collisions it hands a pointer to
|
|
||||||
itself to the MapTile object, the MapTile will then return true if any
|
|
||||||
Character in it's list collides with the Character* it just recieved.
|
|
||||||
- Create the appropriate methods in the MapTile class
|
|
||||||
- bool CheckCollision(Character *charptr);
|
|
||||||
- void AddCharacter(Character *charptr);
|
|
||||||
- void RemoveCharacter(Character *charptr);
|
|
||||||
|
|
||||||
*A way for entities to store information (Like items).
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
- Sort out how we will read in the information
|
|
||||||
- A list of present objects that can be referenced with a single word in the map file.
|
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
Copyright (C) 2011 SaraCraft
|
Copyright (C) 2011 SaraCraft
|
||||||
allanis@saracraft.net
|
allanis@saracraft.net
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
CONFIG -= qt
|
CONFIG -= qt
|
||||||
|
|
||||||
LIBS += -lGL \
|
LIBS += -lGL \
|
||||||
-lSDL \
|
-lSDL \
|
||||||
-lSDL_ttf \
|
-lSDL_ttf \
|
||||||
@ -7,7 +6,6 @@ LIBS += -lGL \
|
|||||||
-lSDL_gfx \
|
-lSDL_gfx \
|
||||||
-ltinyxml \
|
-ltinyxml \
|
||||||
-lGLU
|
-lGLU
|
||||||
|
|
||||||
HEADERS += ../src/Libs/wglext.h \
|
HEADERS += ../src/Libs/wglext.h \
|
||||||
../src/Libs/glxext.h \
|
../src/Libs/glxext.h \
|
||||||
../src/libUnuk/Engine/WorldManager.h \
|
../src/libUnuk/Engine/WorldManager.h \
|
||||||
@ -47,8 +45,8 @@ HEADERS += ../src/Libs/wglext.h \
|
|||||||
../src/libUnuk/System/Vec2.h \
|
../src/libUnuk/System/Vec2.h \
|
||||||
../src/libUnuk/System/MathBox.h \
|
../src/libUnuk/System/MathBox.h \
|
||||||
../src/libUnuk/Engine/Pathfinding.h \
|
../src/libUnuk/Engine/Pathfinding.h \
|
||||||
../src/libUnuk/UI/SavegameMenu.h
|
../src/libUnuk/UI/SavegameMenu.h \
|
||||||
|
../src/libUnuk/Engine/Spells.h
|
||||||
SOURCES += ../src/libUnuk/Engine/WorldManager.cpp \
|
SOURCES += ../src/libUnuk/Engine/WorldManager.cpp \
|
||||||
../src/libUnuk/Engine/ParticleEmitter.cpp \
|
../src/libUnuk/Engine/ParticleEmitter.cpp \
|
||||||
../src/libUnuk/Engine/NPC.cpp \
|
../src/libUnuk/Engine/NPC.cpp \
|
||||||
@ -82,4 +80,5 @@ SOURCES += ../src/libUnuk/Engine/WorldManager.cpp \
|
|||||||
../src/libUnuk/UI/EventHistory.cpp \
|
../src/libUnuk/UI/EventHistory.cpp \
|
||||||
../src/libUnuk/UI/Bar.cpp \
|
../src/libUnuk/UI/Bar.cpp \
|
||||||
../src/libUnuk/System/Vec2.cpp \
|
../src/libUnuk/System/Vec2.cpp \
|
||||||
../src/libUnuk/UI/SavegameMenu.cpp
|
../src/libUnuk/UI/SavegameMenu.cpp \
|
||||||
|
../src/libUnuk/Engine/Spells.cpp
|
||||||
|
@ -41,7 +41,7 @@ void Game::Load(const string& savegameIDArg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
gameNavVal_t Game::Run(void) {
|
gameNavVal_t Game::Run(void) {
|
||||||
_player->LoadSprites("../Data/Media/Images/Characters/Player.png", 40, 45);
|
_player->LoadSprites("../Data/Media/Images/Characters/Reniesta.png", 40, 45);
|
||||||
|
|
||||||
int fps = 0;
|
int fps = 0;
|
||||||
int frame = 0;
|
int frame = 0;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "Constants.h"
|
#include "Constants.h"
|
||||||
#include "../libUnuk/Engine/Character.h"
|
#include "../libUnuk/Engine/Character.h"
|
||||||
#include "../libUnuk//System/Debug.h"
|
#include "../libUnuk/System/Debug.h"
|
||||||
|
|
||||||
class Player : public Character {
|
class Player : public Character {
|
||||||
public:
|
public:
|
||||||
|
@ -45,21 +45,22 @@ public:
|
|||||||
|
|
||||||
void OnAttack(void);
|
void OnAttack(void);
|
||||||
|
|
||||||
// inline void* operator new(size_t size) {
|
// Overload new and delete operators to utilize MemManager.
|
||||||
// return gMemManager.Allocate(size);
|
inline void* operator new(size_t size) {
|
||||||
// }
|
return gMemManager.Allocate(size);
|
||||||
//
|
}
|
||||||
// inline void operator delete(void* object) {
|
|
||||||
// gMemManager.Free(object);
|
inline void operator delete(void* object) {
|
||||||
// }
|
gMemManager.Free(object);
|
||||||
//
|
}
|
||||||
// inline void* operator new [](size_t size) {
|
|
||||||
// return gMemManager.Allocate(size);
|
inline void* operator new [](size_t size) {
|
||||||
// }
|
return gMemManager.Allocate(size);
|
||||||
//
|
}
|
||||||
// inline void operator delete [](void* object) {
|
|
||||||
// gMemManager.Free(object);
|
inline void operator delete [](void* object) {
|
||||||
// }
|
gMemManager.Free(object);
|
||||||
|
}
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
FACING_UP,
|
FACING_UP,
|
||||||
|
@ -38,7 +38,7 @@ void ParticleEmitter::SetParticleType(string typeArg) {
|
|||||||
SDL_FreeSurface(_particleTexture);
|
SDL_FreeSurface(_particleTexture);
|
||||||
}
|
}
|
||||||
|
|
||||||
string textureFilename = "../Data/Media/Images/Particles/" + typeArg + ".png";
|
string textureFilename = "../../Data/Media/Images/Particles/" + typeArg + ".png";
|
||||||
_particleTexture = LoadImageAlpha(textureFilename.c_str());
|
_particleTexture = LoadImageAlpha(textureFilename.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
17
src/libUnuk/Engine/Spells.cpp
Normal file
17
src/libUnuk/Engine/Spells.cpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include "Spells.h"
|
||||||
|
|
||||||
|
Spells::Spells(void) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Spells::~Spells(void) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Spells::CastSpell() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Spells::Render(void) {
|
||||||
|
//_particle->Render();
|
||||||
|
}
|
22
src/libUnuk/Engine/Spells.h
Normal file
22
src/libUnuk/Engine/Spells.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "../../Unuk/Player.h"
|
||||||
|
#include "../System/Timer.h"
|
||||||
|
#include "ParticleEmitter.h"
|
||||||
|
|
||||||
|
class Spells {
|
||||||
|
public:
|
||||||
|
Spells(void);
|
||||||
|
~Spells(void);
|
||||||
|
|
||||||
|
enum {
|
||||||
|
FIREBALL,
|
||||||
|
ICE
|
||||||
|
};
|
||||||
|
|
||||||
|
void CastSpell(/*Player* player*/);
|
||||||
|
void Render(void);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Timer* _timeBetweenCast;
|
||||||
|
ParticleEmitter* _particle;
|
||||||
|
};
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include "MemClass.h"
|
||||||
class Character;
|
class Character;
|
||||||
class NPC;
|
class NPC;
|
||||||
class Player;
|
class Player;
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "../LevelGen/AStarTile.h"
|
#include "../LevelGen/AStarTile.h"
|
||||||
#include "../System/Debug.h"
|
#include "../System/Debug.h"
|
||||||
#include "../Engine/WorldManager.h"
|
#include "../Engine/WorldManager.h"
|
||||||
|
#include "../Engine/MemClass.h"
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
class Character;
|
class Character;
|
||||||
|
66
src/libUnuk/LevelGen/MapTile.cpp
Normal file
66
src/libUnuk/LevelGen/MapTile.cpp
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
#include "MapTile.h"
|
||||||
|
#include "LevelGen.h"
|
||||||
|
|
||||||
|
MapTile::MapTile(const MapTile& source) {
|
||||||
|
_level = source._level;
|
||||||
|
_tile = source._tile;
|
||||||
|
_entity = source._entity;
|
||||||
|
_zLevel = source._zLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MapTile::IsSameState(MapTile& tile) {
|
||||||
|
return (tile.GetTileX() == _tile.GetX()) && (tile.GetTileY() == _tile.GetY());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MapTile::IsGoal(MapTile& tile) {
|
||||||
|
return IsSameState(tile);
|
||||||
|
}
|
||||||
|
|
||||||
|
float MapTile::GoalDistanceEstimate(MapTile& goal) {
|
||||||
|
Vec2 thisPos(_tile.GetX(), _tile.GetY());
|
||||||
|
Vec2 goalPos(goal.GetTileX(), goal.GetTileY());
|
||||||
|
return fabs(Vec2::DistanceSquared(thisPos, goalPos));
|
||||||
|
}
|
||||||
|
|
||||||
|
float MapTile::GetCost(MapTile& goal) {
|
||||||
|
return 64.0f*64.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MapTile::GetSuccessors(AStarSearch<MapTile>* search, MapTile* parent) {
|
||||||
|
int tileX = _tile.GetX() / TILE_WIDTH;
|
||||||
|
int tileY = _tile.GetY() / TILE_HEIGHT;
|
||||||
|
|
||||||
|
// Add tile to the left if possible.
|
||||||
|
if(tileX > 0) {
|
||||||
|
MapTile& successor = _level->GetTile(tileX - 1, tileY);
|
||||||
|
if(successor.GetTileSolidity() || successor.GetEntitySolitity()) {
|
||||||
|
search->AddSuccessor(successor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add tile to the right if possible
|
||||||
|
if(tileX < TILE_WIDTH) {
|
||||||
|
MapTile& successor = _level->GetTile(tileX + 1, tileY);
|
||||||
|
if(successor.GetTileSolidity() || successor.GetEntitySolitity()) {
|
||||||
|
search->AddSuccessor(successor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add tile to the bottom if possible
|
||||||
|
if(tileY > 0) {
|
||||||
|
MapTile& successor = _level->GetTile(tileX, tileY - 1);
|
||||||
|
if(successor.GetTileSolidity() || successor.GetEntitySolitity()) {
|
||||||
|
search->AddSuccessor(successor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add tile to the top if possible
|
||||||
|
if(tileY < TILE_HEIGHT) {
|
||||||
|
MapTile& successor = _level->GetTile(tileX, tileY + 1);
|
||||||
|
if(successor.GetTileSolidity() || successor.GetEntitySolitity()) {
|
||||||
|
search->AddSuccessor(successor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
@ -29,6 +29,7 @@ public:
|
|||||||
int GetTileX(void) { return _tile.GetX(); }
|
int GetTileX(void) { return _tile.GetX(); }
|
||||||
int GetTileY(void) { return _tile.GetY(); }
|
int GetTileY(void) { return _tile.GetY(); }
|
||||||
|
|
||||||
|
|
||||||
// Entity Mutators.
|
// Entity Mutators.
|
||||||
void SetEntityTexture(SDL_Surface* arg) { _entity.SetTexture(arg); }
|
void SetEntityTexture(SDL_Surface* arg) { _entity.SetTexture(arg); }
|
||||||
void SetEntityTextureName(string path) { _entity.SetTextureName(path); }
|
void SetEntityTextureName(string path) { _entity.SetTextureName(path); }
|
||||||
|
Loading…
Reference in New Issue
Block a user