From 856c345feca062fdfc0b177e0de25489fb1b0c06 Mon Sep 17 00:00:00 2001 From: "chirs241097@gmail.com" Date: Sat, 15 Mar 2014 02:29:19 +0000 Subject: Extend hge with a 3D Rotation method, it's not tested yet. Fix probable compile errors due to includes. --- hgehelp/hgeanim.cpp | 10 ++++----- hgehelp/hgecolor.cpp | 4 ++-- hgehelp/hgedistort.cpp | 8 +++---- hgehelp/hgefont.cpp | 2 +- hgehelp/hgegui.cpp | 4 ++-- hgehelp/hgeguictrls.cpp | 2 +- hgehelp/hgeparticle.cpp | 6 ++--- hgehelp/hgepmanager.cpp | 2 +- hgehelp/hgerect.cpp | 2 +- hgehelp/hgeresource.cpp | 2 +- hgehelp/hgesprite.cpp | 60 ++++++++++++++++++++++++------------------------- hgehelp/hgestrings.cpp | 6 ++--- hgehelp/hgevector.cpp | 2 +- hgehelp/parser.h | 2 +- hgehelp/resources.cpp | 2 +- hgehelp/resources.h | 2 +- 16 files changed, 58 insertions(+), 58 deletions(-) (limited to 'hgehelp') diff --git a/hgehelp/hgeanim.cpp b/hgehelp/hgeanim.cpp index acc64ef..0e370db 100644 --- a/hgehelp/hgeanim.cpp +++ b/hgehelp/hgeanim.cpp @@ -7,7 +7,7 @@ */ -#include "../../include/hgeanim.h" +#include "hgeanim.h" hgeAnimation::hgeAnimation(HTEXTURE tex, int nframes, float FPS, float x, float y, float w, float h) @@ -27,11 +27,11 @@ hgeAnimation::hgeAnimation(HTEXTURE tex, int nframes, float FPS, float x, float hgeAnimation::hgeAnimation(const hgeAnimation & anim) : hgeSprite(anim) -{ - // Copy hgeAnimation parameters: +{ + // Copy hgeAnimation parameters: this->orig_width = anim.orig_width; - this->bPlaying = anim.bPlaying; - this->fSpeed = anim.fSpeed; + this->bPlaying = anim.bPlaying; + this->fSpeed = anim.fSpeed; this->fSinceLastFrame = anim.fSinceLastFrame; this->Mode = anim.Mode; this->nDelta = anim.nDelta; diff --git a/hgehelp/hgecolor.cpp b/hgehelp/hgecolor.cpp index 5ae512d..561a9cc 100644 --- a/hgehelp/hgecolor.cpp +++ b/hgehelp/hgecolor.cpp @@ -7,7 +7,7 @@ */ -#include "../../include/hgecolor.h" +#include "hgecolor.h" #include #ifndef min @@ -50,7 +50,7 @@ void hgeColorHSV::SetHWColor(DWORD col) if (r == maxv) {h = del_B - del_G;} else if (g == maxv) {h = (1.0f / 3.0f) + del_R - del_B;} else if (b == maxv) {h = (2.0f / 3.0f) + del_G - del_R;} - + if (h < 0) h += 1; if (h > 1) h -= 1; } diff --git a/hgehelp/hgedistort.cpp b/hgehelp/hgedistort.cpp index 276ca05..c7dc821 100644 --- a/hgehelp/hgedistort.cpp +++ b/hgehelp/hgedistort.cpp @@ -6,7 +6,7 @@ ** hgeDistortionMesh helper class implementation */ -#include "../../include/hgedistort.h" +#include "hgedistort.h" HGE *hgeDistortionMesh::hge=0; @@ -15,7 +15,7 @@ HGE *hgeDistortionMesh::hge=0; hgeDistortionMesh::hgeDistortionMesh(int cols, int rows) { int i; - + hge=hgeCreate(HGE_VERSION); nRows=rows; @@ -31,7 +31,7 @@ hgeDistortionMesh::hgeDistortionMesh(int cols, int rows) disp_array[i].y=0.0f; disp_array[i].tx=0.0f; disp_array[i].ty=0.0f; - + disp_array[i].z=0.5f; disp_array[i].col=0xFFFFFFFF; } @@ -81,7 +81,7 @@ hgeDistortionMesh& hgeDistortionMesh::operator= (const hgeDistortionMesh &dm) } return *this; - + } void hgeDistortionMesh::SetTexture(HTEXTURE tex) diff --git a/hgehelp/hgefont.cpp b/hgehelp/hgefont.cpp index 309a773..eb06393 100644 --- a/hgehelp/hgefont.cpp +++ b/hgehelp/hgefont.cpp @@ -7,7 +7,7 @@ */ -#include "../../include/hgefont.h" +#include "hgefont.h" #include #include diff --git a/hgehelp/hgegui.cpp b/hgehelp/hgegui.cpp index 3867d71..2faf24c 100644 --- a/hgehelp/hgegui.cpp +++ b/hgehelp/hgegui.cpp @@ -7,7 +7,7 @@ */ -#include "../../include/hgegui.h" +#include "hgegui.h" HGE *hgeGUI::hge=0; @@ -279,7 +279,7 @@ int hgeGUI::Update(float dt) } } -// Handle keys +// Handle keys key=hge->Input_GetKey(); if(((navmode & HGEGUI_LEFTRIGHT) && key==HGEK_LEFT) || diff --git a/hgehelp/hgeguictrls.cpp b/hgehelp/hgeguictrls.cpp index 20fae4b..a02e18f 100644 --- a/hgehelp/hgeguictrls.cpp +++ b/hgehelp/hgeguictrls.cpp @@ -7,7 +7,7 @@ */ -#include "../../include/hgeguictrls.h" +#include "hgeguictrls.h" #include #include #include diff --git a/hgehelp/hgeparticle.cpp b/hgehelp/hgeparticle.cpp index d6051c1..d0d054d 100644 --- a/hgehelp/hgeparticle.cpp +++ b/hgehelp/hgeparticle.cpp @@ -11,7 +11,7 @@ */ -#include "../../include/hgeparticle.h" +#include "hgeparticle.h" HGE *hgeParticleSystem::hge=0; @@ -242,7 +242,7 @@ void hgeParticleSystem::MoveTo(float x, float y, bool bMoveParticles) { int i; float dx,dy; - + if(bMoveParticles) { dx=x-vecLocation.x; @@ -284,7 +284,7 @@ void hgeParticleSystem::Fire() void hgeParticleSystem::Stop(bool bKillParticles) { fAge=-2.0f; - if(bKillParticles) + if(bKillParticles) { nParticlesAlive=0; rectBoundingBox.Clear(); diff --git a/hgehelp/hgepmanager.cpp b/hgehelp/hgepmanager.cpp index 69e518a..16a0b1d 100644 --- a/hgehelp/hgepmanager.cpp +++ b/hgehelp/hgepmanager.cpp @@ -11,7 +11,7 @@ */ -#include "../../include/hgeparticle.h" +#include "hgeparticle.h" hgeParticleManager::hgeParticleManager(const float fps) diff --git a/hgehelp/hgerect.cpp b/hgehelp/hgerect.cpp index 789a9a4..303286c 100644 --- a/hgehelp/hgerect.cpp +++ b/hgehelp/hgerect.cpp @@ -7,7 +7,7 @@ */ -#include "../../include/hgerect.h" +#include "hgerect.h" #include diff --git a/hgehelp/hgeresource.cpp b/hgehelp/hgeresource.cpp index 9224dd1..e681369 100644 --- a/hgehelp/hgeresource.cpp +++ b/hgehelp/hgeresource.cpp @@ -7,7 +7,7 @@ */ -#include "../../include/hgeresource.h" +#include "hgeresource.h" #include "parser.h" #include "resources.h" diff --git a/hgehelp/hgesprite.cpp b/hgehelp/hgesprite.cpp index 8e61263..3ff926f 100644 --- a/hgehelp/hgesprite.cpp +++ b/hgehelp/hgesprite.cpp @@ -7,7 +7,7 @@ */ -#include "../../include/hgesprite.h" +#include "hgesprite.h" #include @@ -19,7 +19,7 @@ hgeSprite::hgeSprite(HTEXTURE texture, float texx, float texy, float w, float h) float texx1, texy1, texx2, texy2; hge=hgeCreate(HGE_VERSION); - + tx=texx; ty=texy; width=w; height=h; @@ -51,14 +51,14 @@ hgeSprite::hgeSprite(HTEXTURE texture, float texx, float texy, float w, float h) quad.v[2].tx = texx2; quad.v[2].ty = texy2; quad.v[3].tx = texx1; quad.v[3].ty = texy2; - quad.v[0].z = - quad.v[1].z = - quad.v[2].z = + quad.v[0].z = + quad.v[1].z = + quad.v[2].z = quad.v[3].z = 0.5f; - - quad.v[0].col = - quad.v[1].col = - quad.v[2].col = + + quad.v[0].col = + quad.v[1].col = + quad.v[2].col = quad.v[3].col = 0xffffffff; quad.blend=BLEND_DEFAULT; @@ -104,18 +104,18 @@ void hgeSprite::RenderEx(float x, float y, float rot, float hscale, float vscale { cost = cosf(rot); sint = sinf(rot); - + quad.v[0].x = tx1*cost - ty1*sint + x; - quad.v[0].y = tx1*sint + ty1*cost + y; + quad.v[0].y = tx1*sint + ty1*cost + y; quad.v[1].x = tx2*cost - ty1*sint + x; - quad.v[1].y = tx2*sint + ty1*cost + y; + quad.v[1].y = tx2*sint + ty1*cost + y; quad.v[2].x = tx2*cost - ty2*sint + x; - quad.v[2].y = tx2*sint + ty2*cost + y; + quad.v[2].y = tx2*sint + ty2*cost + y; quad.v[3].x = tx1*cost - ty2*sint + x; - quad.v[3].y = tx1*sint + ty2*cost + y; + quad.v[3].y = tx1*sint + ty2*cost + y; } else { @@ -157,7 +157,7 @@ hgeRect* hgeSprite::GetBoundingBoxEx(float x, float y, float rot, float hscale, float sint, cost; rect->Clear(); - + tx1 = -hotX*hscale; ty1 = -hotY*vscale; tx2 = (width-hotX)*hscale; @@ -167,11 +167,11 @@ hgeRect* hgeSprite::GetBoundingBoxEx(float x, float y, float rot, float hscale, { cost = cosf(rot); sint = sinf(rot); - - rect->Encapsulate(tx1*cost - ty1*sint + x, tx1*sint + ty1*cost + y); - rect->Encapsulate(tx2*cost - ty1*sint + x, tx2*sint + ty1*cost + y); - rect->Encapsulate(tx2*cost - ty2*sint + x, tx2*sint + ty2*cost + y); - rect->Encapsulate(tx1*cost - ty2*sint + x, tx1*sint + ty2*cost + y); + + rect->Encapsulate(tx1*cost - ty1*sint + x, tx1*sint + ty1*cost + y); + rect->Encapsulate(tx2*cost - ty1*sint + x, tx2*sint + ty1*cost + y); + rect->Encapsulate(tx2*cost - ty2*sint + x, tx2*sint + ty2*cost + y); + rect->Encapsulate(tx1*cost - ty2*sint + x, tx1*sint + ty2*cost + y); } else { @@ -192,7 +192,7 @@ void hgeSprite::SetFlip(bool bX, bool bY, bool bHotSpot) if(bHSFlip && bYFlip) hotY = height - hotY; bHSFlip = bHotSpot; - + if(bHSFlip && bXFlip) hotX = width - hotX; if(bHSFlip && bYFlip) hotY = height - hotY; @@ -249,10 +249,10 @@ void hgeSprite::SetTexture(HTEXTURE tex) tx1/=tw; ty1/=th; tx2/=tw; ty2/=th; - quad.v[0].tx=tx1; quad.v[0].ty=ty1; - quad.v[1].tx=tx2; quad.v[1].ty=ty1; - quad.v[2].tx=tx2; quad.v[2].ty=ty2; - quad.v[3].tx=tx1; quad.v[3].ty=ty2; + quad.v[0].tx=tx1; quad.v[0].ty=ty1; + quad.v[1].tx=tx2; quad.v[1].ty=ty1; + quad.v[2].tx=tx2; quad.v[2].ty=ty2; + quad.v[3].tx=tx1; quad.v[3].ty=ty2; } } @@ -264,7 +264,7 @@ void hgeSprite::SetTextureRect(float x, float y, float w, float h, bool adjSize) tx=x; ty=y; - + if(adjSize) { width=w; @@ -274,10 +274,10 @@ void hgeSprite::SetTextureRect(float x, float y, float w, float h, bool adjSize) tx1=tx/tex_width; ty1=ty/tex_height; tx2=(tx+w)/tex_width; ty2=(ty+h)/tex_height; - quad.v[0].tx=tx1; quad.v[0].ty=ty1; - quad.v[1].tx=tx2; quad.v[1].ty=ty1; - quad.v[2].tx=tx2; quad.v[2].ty=ty2; - quad.v[3].tx=tx1; quad.v[3].ty=ty2; + quad.v[0].tx=tx1; quad.v[0].ty=ty1; + quad.v[1].tx=tx2; quad.v[1].ty=ty1; + quad.v[2].tx=tx2; quad.v[2].ty=ty2; + quad.v[3].tx=tx1; quad.v[3].ty=ty2; bX=bXFlip; bY=bYFlip; bHS=bHSFlip; bXFlip=false; bYFlip=false; diff --git a/hgehelp/hgestrings.cpp b/hgehelp/hgestrings.cpp index d4c5d2d..6eda71c 100644 --- a/hgehelp/hgestrings.cpp +++ b/hgehelp/hgestrings.cpp @@ -7,7 +7,7 @@ */ -#include "../../include/hgestrings.h" +#include "hgestrings.h" #include const char STRHEADERTAG[]="[HGESTRINGTABLE]"; @@ -26,7 +26,7 @@ hgeStringTable::hgeStringTable(const char *filename) NamedString *str; char str_name[MAXSTRNAMELENGTH]; char *str_value, *pvalue; - + hge=hgeCreate(HGE_VERSION); strings=0; @@ -43,7 +43,7 @@ hgeStringTable::hgeStringTable(const char *filename) if(memcmp(desc, STRHEADERTAG, sizeof(STRHEADERTAG)-1)) { hge->System_Log(STRFORMATERROR, filename); - delete[] desc; + delete[] desc; return; } diff --git a/hgehelp/hgevector.cpp b/hgehelp/hgevector.cpp index e53ad7c..921f7b7 100644 --- a/hgehelp/hgevector.cpp +++ b/hgehelp/hgevector.cpp @@ -7,7 +7,7 @@ */ -#include "../../include/hgevector.h" +#include "hgevector.h" float InvSqrt(float x) { diff --git a/hgehelp/parser.h b/hgehelp/parser.h index 98a5b45..c33ff11 100644 --- a/hgehelp/parser.h +++ b/hgehelp/parser.h @@ -10,7 +10,7 @@ #define HGEPARSER_H -#include "../../include/hge.h" +#include "hge.h" #include #include diff --git a/hgehelp/resources.cpp b/hgehelp/resources.cpp index 0c41495..33afcaa 100644 --- a/hgehelp/resources.cpp +++ b/hgehelp/resources.cpp @@ -7,7 +7,7 @@ */ -#include "../../include/hgeresource.h" +#include "hgeresource.h" #include "parser.h" #include "resources.h" diff --git a/hgehelp/resources.h b/hgehelp/resources.h index 87561d8..8be8384 100644 --- a/hgehelp/resources.h +++ b/hgehelp/resources.h @@ -10,7 +10,7 @@ #define HGERESOURCES_H -#include "../../include/hgeresource.h" +#include "hgeresource.h" #include "parser.h" -- cgit v1.2.3