Skip to content

Commit

Permalink
Compiled on allegro (some texture are missing, fix it yourself)
Browse files Browse the repository at this point in the history
config load/save : some fix on W32
bug fixed
  • Loading branch information
rzr committed Jul 16, 2003
1 parent f7c0055 commit c7a37f5
Show file tree
Hide file tree
Showing 20 changed files with 541 additions and 497 deletions.
26 changes: 13 additions & 13 deletions addon/ColorBehavior.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
//#ident "$Id: ColorBehavior.cpp,v 1.4 2003/07/16 20:02:02 rzr Exp $"
/***************************************************************************
ColorBehavior.cpp - description
-------------------
begin : Tue Feb 15 2000
copyright : (C) 2000 by Henrik Enqvist
email : [email protected]
***************************************************************************/
***************************************************************************/

#include "Private.h"
#include "ColorBehavior.h"
Expand All @@ -18,19 +19,18 @@ ColorBehavior::~ColorBehavior() {
}

void ColorBehavior::onCollision(const Vertex3D &, const Vertex3D &, Group *) {
EmAssert(this->getParent() != NULL, "ColorBehavior::onCollision parent NULL");
EM_COUT("ColorBehavior::onCollision()" << endl, 0);
if (this->getParent() != NULL) {
for (int a=0; a<this->getParent()->getShape3DSize(); a++) {
this->getParent()->getShape3D(a)->setColor(1.0, 1.0, 0.0, 0.0);
}
}
EmAssert(this->getParent() != NULL, "ColorBehavior::onCollision parent NULL");
EM_COUT("ColorBehavior::onCollision()" << endl, 0);
if (this->getParent() != NULL) {
for (int a=0; a<this->getParent()->getShape3DSize(); a++) {
this->getParent()->getShape3D(a)->setColor(1.f, 1.f, 0.f, 0.f);
}
}
}

void ColorBehavior::onTick() {
EmAssert(this->getParent() != NULL, "ColorBehavior::onTick parent NULL");
for (int a=0; a<this->getParent()->getShape3DSize(); a++) {
this->getParent()->getShape3D(a)->setColor(1.0, 0.0, 0.0, 1.0);
}
EmAssert(this->getParent() != NULL, "ColorBehavior::onTick parent NULL");
for (int a=0; a<this->getParent()->getShape3DSize(); a++) {
this->getParent()->getShape3D(a)->setColor(1.f, 0.f, 0.f, 1.f);
}
}

5 changes: 3 additions & 2 deletions base/Config.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//#ident "$Id: Config.cpp,v 1.29 2003/06/13 13:39:44 rzr Exp $"
//#ident "$Id: Config.cpp,v 1.30 2003/07/16 20:02:04 rzr Exp $"
/***************************************************************************
Config.cpp - description
-------------------
Expand Down Expand Up @@ -26,6 +26,7 @@
#endif

#ifdef WIN32
//#include <fcntl.h>
//#include <io.h>
#include <direct.h> // mkdir @ msvc+mingw32
//#define mkdir(name, modes) mkdir(name)
Expand Down Expand Up @@ -457,4 +458,4 @@ void Config::setPaths(char const * const argv0) {
// EM_CERR("- Config::setPath"); // EM_CERR( m_sExeDir); EM_CERR( m_sDataDir);
} //!-rzr

//EOF:$Id: Config.cpp,v 1.29 2003/06/13 13:39:44 rzr Exp $
//EOF:$Id: Config.cpp,v 1.30 2003/07/16 20:02:04 rzr Exp $
5 changes: 4 additions & 1 deletion base/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ Engine * Engine::p_Engine = NULL;
Engine::Engine(int & argc, char *argv[]) {
Config * config = Config::getInstance();
config->loadArgs(argc, argv);

#ifdef RZR_PATHRELATIVE
Config::getInstance()->loadConfig();
#endif

if (!config->useExternGL()) {
#if EM_USE_SDL
SDL_Init(SDL_INIT_TIMER);
Expand Down
6 changes: 3 additions & 3 deletions base/Group.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//#ident "$Id: Group.cpp,v 1.10 2003/06/13 13:39:45 rzr Exp $"
//#ident "$Id: Group.cpp,v 1.11 2003/07/16 20:02:04 rzr Exp $"
/***************************************************************************
Group.cpp - description
-------------------
Expand Down Expand Up @@ -171,7 +171,7 @@ Shape3D * Group::getShape3D(int i) {
return m_vShape3D[i];
}

int Group::getShape3DSize() {
int Group::getShape3DSize() const {
return m_vShape3D.size();
}

Expand Down Expand Up @@ -285,4 +285,4 @@ void Group::unsetPropertyRecursive(int p) {
}
}
//TODO: Compute Bounds //!rzr
//EOF $Id: Group.cpp,v 1.10 2003/06/13 13:39:45 rzr Exp $
//EOF $Id: Group.cpp,v 1.11 2003/07/16 20:02:04 rzr Exp $
29 changes: 15 additions & 14 deletions base/Group.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
//#ident "$Id: Group.h,v 1.10 2003/07/16 20:02:04 rzr Exp $"
/***************************************************************************
Group.h - description
-------------------
begin : Wed Jan 26 2000
copyright : (C) 2000 by Henrik Enqvist
email : [email protected]
***************************************************************************/
***************************************************************************/

#ifndef GROUP_H
#define GROUP_H
Expand Down Expand Up @@ -68,7 +69,7 @@ class BillBoard;
** Animation -- lwGroup rwGroup -- Animation
** </pre> */
class Group : public Node {
public:
public:
Group();
virtual ~Group();
void setName(const char * name);
Expand All @@ -78,9 +79,9 @@ class Group : public Node {
/** Removes the group from the tree. You must call 'delete group' after
* this function if you wish to deallocate the group. */
void removeGroup(Group * g);
// void addBehavior(Behavior * b, bool signal=true);
// void addBehavior(Behavior * b, bool signal=true);
void setBehavior(Behavior * b, bool signal = true);
// void removeBehavior(Behavior * b);
// void removeBehavior(Behavior * b);
void addShape3D(Shape3D * s);
/** Removes the shape from the tree. You must call 'delete shape' after
* this function if you wish to deallocate the shape. */
Expand All @@ -90,9 +91,9 @@ class Group : public Node {
void setLight(Light * l);
void setCollisionBounds(CollisionBounds * cb);
void setSound(Sound * s);
// int getBehaviorSize();
int getShape3DSize();
// Behavior * getBehavior(int i);
// int getBehaviorSize();
int getShape3DSize() const;
// Behavior * getBehavior(int i);
Behavior * getBehavior();
Group * getGroup(int i);
Shape3D * getShape3D(int i);
Expand All @@ -115,10 +116,10 @@ class Group : public Node {
void unsetPropertyRecursive(int p);
void unsetUserProperty(int p);

inline int getCollisionGroup() { return m_iCollisionGroup; };
inline void setCollisionGroup(int c) { m_iCollisionGroup = c; };
inline int getCollisionGroup() { return m_iCollisionGroup; };
inline void setCollisionGroup(int c) { m_iCollisionGroup = c; };

private:
private:
friend class BehaviorVisitor;
friend class AlignVisitor;
friend class AllegroVisitor;
Expand All @@ -144,16 +145,16 @@ class Group : public Node {
Group* p_Parent;
vector<Group*> m_vChildren;
vector<Shape3D*> m_vShape3D;
// vector<Behavior*> m_vBehavior;
// vector<Behavior*> m_vBehavior;
Behavior * p_Behavior;

char m_Name[256];
char m_Name[256]; //todo: replace with string

int m_iProperties;
int m_iUserProperties;
int m_iCollisionGroup;
int m_iCollisionGroup;

// void propagateSignal(int signal, Group* sender);
// void propagateSignal(int signal, Group* sender);
void setParent(Group* g);
};

Expand Down
1 change: 1 addition & 0 deletions base/Keyboard.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//#ident "$Id: Keyboard.cpp,v 1.4 2003/07/16 20:02:04 rzr Exp $"
/***************************************************************************
Keyboard.cpp - description
-------------------
Expand Down
19 changes: 10 additions & 9 deletions base/Keyboard.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
//#ident "$Id: Keyboard.h,v 1.9 2003/07/16 20:02:04 rzr Exp $"
/***************************************************************************
Keyboard.h - description
-------------------
begin : Thu Feb 1 2001
copyright : (C) 2001 by Henrik Enqvist
email : [email protected]
***************************************************************************/
***************************************************************************/


#ifndef KEYBOARD_H
Expand Down Expand Up @@ -101,14 +102,14 @@
#define SDLK_RCTRL KEY_RCONTROL
#define SDLK_COMPOSE KEY_ALTGR

#define SDLK_F1 KEY_F1
#define SDLK_F1 KEY_F1 //!rzr+ bug fixed
#define SDLK_F2 KEY_F2
#define SDLK_F3 KEY_F3
#define SDLK_F3 KEY_F4
#define SDLK_F1 KEY_F5
#define SDLK_F2 KEY_F6
#define SDLK_F3 KEY_F7
#define SDLK_F3 KEY_F8
#define SDLK_F4 KEY_F4
#define SDLK_F5 KEY_F5
#define SDLK_F6 KEY_F6
#define SDLK_F7 KEY_F7
#define SDLK_F8 KEY_F8 //!rzr-

#endif // EM_USE_ALLEGRO

Expand All @@ -119,15 +120,15 @@
/** @author Henrik Enqvist */

class Keyboard {
public:
public:
Keyboard();
~Keyboard();
static void clear();
static void poll();
static bool isKeyDown(int piKey);
static EMKey waitForKey();
#if EM_USE_SDL
private:
private:
static bool m_abKey[KEY_MAX];
#endif
};
Expand Down
6 changes: 3 additions & 3 deletions base/Private.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//#ident "$Id: Private.h,v 1.17 2003/06/11 13:25:49 rzr Exp $"
//#ident "$Id: Private.h,v 1.18 2003/07/16 20:02:04 rzr Exp $"
/***************************************************************************
Private.h - description
-------------------
Expand Down Expand Up @@ -30,7 +30,7 @@
#define EM_USE_SDL 0
#endif

#ifndef EM_USE_ALLEGRO
#ifndef EM_USE_ALLEGRO //!rzr allegro may conflict when stdc++ headers
#define EM_USE_ALLEGRO 0
#endif

Expand Down Expand Up @@ -115,4 +115,4 @@ bool operator == (const PolygonEdge & peA, const PolygonEdge & peB) {


#endif // PRIVATE_H
//EOF: $Id: Private.h,v 1.17 2003/06/11 13:25:49 rzr Exp $
//EOF: $Id: Private.h,v 1.18 2003/07/16 20:02:04 rzr Exp $
29 changes: 18 additions & 11 deletions base/Shape3D.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//#ident "$Id: Shape3D.h,v 1.14 2003/05/27 11:53:25 rzr Exp $"
//#ident "$Id: Shape3D.h,v 1.15 2003/07/16 20:02:04 rzr Exp $"
/***************************************************************************
Shape3D.h - description
-------------------
begin : Wed Jan 26 2000
copyright : (C) 2000 by Henrik Enqvist
email : [email protected]
***************************************************************************/
***************************************************************************/

#ifndef SHAPE3D_H
#define SHAPE3D_H
Expand All @@ -20,11 +20,13 @@
//#define EM_SHAPE3D_FLAT 16
//#define EM_SHAPE3D_DOUBLE 32


#include <vector>
#include <string>

#include "TextureUtil.h"
#include "EMath.h"
using namespace std;

class Group;
class Polygon3D;
Expand All @@ -35,23 +37,28 @@ class Polygon3D;
* with the 'add(Polygon*)' method. The Shape3D is finished off by calling
* countNormals().
* @see Polygon */
class Shape3D {
public:
class Shape3D
{
public:
Shape3D(int v = 6, int p = 2);
virtual ~Shape3D();
/** Creates a new vertex and returns the index. The index is used when
* creating polygons. @see Polygon */
int add(float x, float y, float z);
int add(float x, float y, float z, float r, float g, float b, float a, float u, float v);
int add(float x, float y, float z, float r, float g, float b, float a=1,
float u=0, float v=0);
int addAt(int index, float x, float y, float z,
float r, float g, float b, float a, float u, float v);
float r=1, float g=1, float b=1 , float a=1,
float u=0, float v=0);
/** Adds a polygon. @see Polygon */
void add(Polygon3D*);
/** Counts the polygon normals used for lightning. This must be called when
* all vertices and polygons are added to the shape. */
void countNormals();
/** Sets the color of all polygons to rgba. */
void setColor(float r, float g, float b, float a);
void setColor(float r, float g, float b, float a=1.);
void setColor(int index, float r, float g, float b, float a=1.);
Color * getColor(int index);
/** Applies a a property to all polygons. See Polygon class for
* properties. @see Polygon */
void setPolygonProperty(int property);
Expand Down Expand Up @@ -82,11 +89,10 @@ class Shape3D {
float getCollisionSize();
void setParent(Group*);
Group * getParent() { return p_Parent; };
Color * getColor(int index);
void setColor(int index, float r, float g, float b, float a);
TexCoord * getTexCoord(int index);
void setTexCoord(int index, float u, float v);


public:
vector<Polygon3D*> m_vPolygon;
vector<Vertex3D> m_vVtxSrc;
vector<Vertex3D> m_vVtxTrans;
Expand All @@ -105,7 +111,8 @@ class Shape3D {
int m_iProperties;
/// used for importing 3ds files //!rzr
string m_sMaterialName;
string m_sName;
};

#endif // SHAPE3D_H
//EOF $Id: Shape3D.h,v 1.14 2003/05/27 11:53:25 rzr Exp $
//EOF $Id: Shape3D.h,v 1.15 2003/07/16 20:02:04 rzr Exp $
7 changes: 4 additions & 3 deletions base/TextureUtil.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//#Ident "$Id: TextureUtil.cpp,v 1.15 2003/06/18 10:43:45 henqvist Exp $"
//#Ident "$Id: TextureUtil.cpp,v 1.16 2003/07/16 20:02:04 rzr Exp $"
/***************************************************************************
TextureUtil.cpp - description
-------------------
Expand Down Expand Up @@ -333,7 +333,8 @@ int TextureUtil::genTexture( char const * const filename,
EmTexture * const texture)
{
//cout<<"+ Texture::genTexture : "<<filename<<endl;
*texture = 0;
if ( ( filename == 0 ) || ( texture == 0 ) ) return -1;
//*texture = 0;

#if EM_USE_SDL
// Load Texture
Expand Down Expand Up @@ -432,4 +433,4 @@ const char * TextureUtil::getTextureName(EmTexture * tex) {
}
*/

//EOF: $Id: TextureUtil.cpp,v 1.15 2003/06/18 10:43:45 henqvist Exp $
//EOF: $Id: TextureUtil.cpp,v 1.16 2003/07/16 20:02:04 rzr Exp $
Loading

0 comments on commit c7a37f5

Please sign in to comment.