diff --git a/game.xcodeproj/project.pbxproj b/game.xcodeproj/project.pbxproj index a37510d..20b7b59 100644 --- a/game.xcodeproj/project.pbxproj +++ b/game.xcodeproj/project.pbxproj @@ -20,6 +20,7 @@ 7489D6131CB000520063AC48 /* HID_Utilities.c in Sources */ = {isa = PBXBuildFile; fileRef = 7489D60D1CB000520063AC48 /* HID_Utilities.c */; settings = {ASSET_TAGS = (); }; }; 7489D61C1CB000F00063AC48 /* ImmrHIDUtilAddOn.c in Sources */ = {isa = PBXBuildFile; fileRef = 7489D61A1CB000F00063AC48 /* ImmrHIDUtilAddOn.c */; settings = {ASSET_TAGS = (); }; }; 7489D6211CB005370063AC48 /* LZRW3-A.C in Sources */ = {isa = PBXBuildFile; fileRef = 7489D61F1CB005370063AC48 /* LZRW3-A.C */; settings = {ASSET_TAGS = (); }; }; + 7489D6271CB016C30063AC48 /* mVertex.c in Sources */ = {isa = PBXBuildFile; fileRef = 7489D6261CB016C30063AC48 /* mVertex.c */; settings = {ASSET_TAGS = (); }; }; 7F06105A0876ED46001EA95C /* ai.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7F060FE50876ED46001EA95C /* ai.cpp */; }; 7F06105D0876ED46001EA95C /* carphysics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7F060FEA0876ED46001EA95C /* carphysics.cpp */; }; 7F06105E0876ED46001EA95C /* carselection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7F060FEC0876ED46001EA95C /* carselection.cpp */; }; @@ -126,6 +127,8 @@ 7489D61E1CB005370063AC48 /* LZRW.H */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = LZRW.H; sourceTree = ""; }; 7489D61F1CB005370063AC48 /* LZRW3-A.C */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "LZRW3-A.C"; sourceTree = ""; }; 7489D6201CB005370063AC48 /* port.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = port.h; sourceTree = ""; }; + 7489D6241CB0152C0063AC48 /* mVertex.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = mVertex.h; sourceTree = ""; }; + 7489D6261CB016C30063AC48 /* mVertex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mVertex.c; sourceTree = ""; }; 7F060FE50876ED46001EA95C /* ai.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ai.cpp; sourceTree = ""; }; 7F060FEA0876ED46001EA95C /* carphysics.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = carphysics.cpp; sourceTree = ""; }; 7F060FEB0876ED46001EA95C /* carphysics.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = carphysics.h; sourceTree = ""; }; @@ -315,6 +318,7 @@ children = ( 7FE52CD00D579B7500F442A1 /* ASW */, 7F0613AC08771244001EA95C /* lzrw */, + 7489D6251CB0160D0063AC48 /* maride */, 7F06136E087703B4001EA95C /* HID */, 7F060FE20876ED46001EA95C /* source */, 20286C2CFDCF999611CA2CEA /* Resources */, @@ -366,6 +370,15 @@ name = "External Frameworks and Libraries"; sourceTree = ""; }; + 7489D6251CB0160D0063AC48 /* maride */ = { + isa = PBXGroup; + children = ( + 7489D6241CB0152C0063AC48 /* mVertex.h */, + 7489D6261CB016C30063AC48 /* mVertex.c */, + ); + name = maride; + sourceTree = ""; + }; 7F060FE20876ED46001EA95C /* source */ = { isa = PBXGroup; children = ( @@ -616,6 +629,7 @@ 7F06105E0876ED46001EA95C /* carselection.cpp in Sources */, 7F0610640876ED46001EA95C /* collision.cpp in Sources */, 7F0610650876ED46001EA95C /* config.cpp in Sources */, + 7489D6271CB016C30063AC48 /* mVertex.c in Sources */, 7F0610660876ED46001EA95C /* controls.cpp in Sources */, 7F0610670876ED46001EA95C /* entities.cpp in Sources */, 7F0610680876ED46001EA95C /* environment.cpp in Sources */, diff --git a/mVertex.c b/mVertex.c new file mode 100644 index 0000000..a81fe2a --- /dev/null +++ b/mVertex.c @@ -0,0 +1,14 @@ +// +// mVertex.c +// game +// +// Created by maride on 02.04.16. +// +// + +#include "mVertex.h" + +void mVertex3fv(tVector3 vertex) { + tVector3 v = *vertex; + glVertex3f(v.x, v.y, v.z); +} \ No newline at end of file diff --git a/mVertex.h b/mVertex.h new file mode 100644 index 0000000..8ced743 --- /dev/null +++ b/mVertex.h @@ -0,0 +1,17 @@ +// +// mVertex.h +// game +// +// Created by maride on 02.04.16. +// +// + +#ifndef mVertex_h +#define mVertex_h + +#include +#include "vectors.h" + +void mVertex3fv(tVector3 vertex); + +#endif /* mVertex_h */ diff --git a/source/models.cpp b/source/models.cpp index a14b128..8b19e88 100755 --- a/source/models.cpp +++ b/source/models.cpp @@ -20,6 +20,8 @@ #include "stencil.h" #include "network.h" +#include "mVertex.h" + //#define __USEDISPLAYLISTS #ifndef __TARGET_TOOLAPP #define __USEVERTEXARRAYS @@ -737,10 +739,10 @@ void ModelShadowPassZFail(tFileRef modelRef,tVector3 shadowVector,char *faceSide if(faces[i].vertices[n].neighbor<=-1) { glBegin(GL_TRIANGLE_STRIP); - glVertex3fv(&(vertices[faces[i].vertices[n].vertex]*gStencilZoom-sw).x); - glVertex3fv(&(vertices[faces[i].vertices[(n+1)%3].vertex]*gStencilZoom-sw).x); - glVertex3fv(&(vertices[faces[i].vertices[n].vertex]*gStencilZoom-shadowVector).x); - glVertex3fv(&(vertices[faces[i].vertices[(n+1)%3].vertex]*gStencilZoom-shadowVector).x); + mVertex3fv((vertices[faces[i].vertices[n].vertex]*gStencilZoom-sw)); + mVertex3fv((vertices[faces[i].vertices[(n+1)%3].vertex]*gStencilZoom-sw)); + mVertex3fv((vertices[faces[i].vertices[n].vertex]*gStencilZoom-shadowVector)); + mVertex3fv((vertices[faces[i].vertices[(n+1)%3].vertex]*gStencilZoom-shadowVector)); glEnd(); #ifdef __POLYCOUNT gPolyCount+=2; @@ -751,20 +753,20 @@ void ModelShadowPassZFail(tFileRef modelRef,tVector3 shadowVector,char *faceSide { glBegin(GL_TRIANGLES); for(int j=2;j>=0;j--) - glVertex3fv(&(vertices[faces[i].vertices[j].vertex]*gStencilZoom-sw).x); + mVertex3fv((vertices[faces[i].vertices[j].vertex]*gStencilZoom-sw)); for(int j=0;j<=2;j++) - glVertex3fv(&(vertices[faces[i].vertices[j].vertex]*gStencilZoom-shadowVector).x); + mVertex3fv((vertices[faces[i].vertices[j].vertex]*gStencilZoom-shadowVector)); glEnd(); } else { glBegin(GL_TRIANGLES); for(int j=2;j>=0;j--) - glVertex3fv(&(vertices[faces[i].vertices[j].vertex]*gStencilZoom-shadowVector).x); + mVertex3fv((vertices[faces[i].vertices[j].vertex]*gStencilZoom-shadowVector)); for(int j=0;j<=2;j++) - glVertex3fv(&(vertices[faces[i].vertices[j].vertex]*gStencilZoom-sw).x); + mVertex3fv((vertices[faces[i].vertices[j].vertex]*gStencilZoom-sw)); glEnd(); } } @@ -777,10 +779,10 @@ void ModelShadowPassZFail(tFileRef modelRef,tVector3 shadowVector,char *faceSide if(faceSide[faces[i].vertices[n].neighbor]!=faceSide[i]) { glBegin(GL_TRIANGLE_STRIP); - glVertex3fv(&(vertices[faces[i].vertices[n].vertex]*(kShadowZoom*gStencilZoom)).x); - glVertex3fv(&(vertices[faces[i].vertices[(n+1)%3].vertex]*(kShadowZoom*gStencilZoom)).x); - glVertex3fv(&(vertices[faces[i].vertices[n].vertex]*(kShadowZoom*gStencilZoom)-shadowVector).x); - glVertex3fv(&(vertices[faces[i].vertices[(n+1)%3].vertex]*(kShadowZoom*gStencilZoom)-shadowVector).x); + mVertex3fv((vertices[faces[i].vertices[n].vertex]*(kShadowZoom*gStencilZoom))); + mVertex3fv((vertices[faces[i].vertices[(n+1)%3].vertex]*(kShadowZoom*gStencilZoom))); + mVertex3fv((vertices[faces[i].vertices[n].vertex]*(kShadowZoom*gStencilZoom)-shadowVector)); + mVertex3fv((vertices[faces[i].vertices[(n+1)%3].vertex]*(kShadowZoom*gStencilZoom)-shadowVector)); glEnd(); #ifdef __POLYCOUNT gPolyCount+=2; @@ -790,14 +792,14 @@ void ModelShadowPassZFail(tFileRef modelRef,tVector3 shadowVector,char *faceSide glBegin(GL_TRIANGLES); for(int j=2;j>=0;j--) - glVertex3fv(&(vertices[faces[i].vertices[j].vertex]*(kShadowZoom*gStencilZoom)).x); + mVertex3fv((vertices[faces[i].vertices[j].vertex]*(kShadowZoom*gStencilZoom))); glEnd(); } else { glBegin(GL_TRIANGLES); for(int j=2;j>=0;j--) - glVertex3fv(&(vertices[faces[i].vertices[j].vertex]*(kShadowZoom*gStencilZoom)-shadowVector).x); + mVertex3fv((vertices[faces[i].vertices[j].vertex]*(kShadowZoom*gStencilZoom)-shadowVector)); glEnd(); } #ifdef __POLYCOUNT @@ -827,10 +829,10 @@ void ModelShadowPassZPass(tFileRef modelRef,tVector3 shadowVector,char *faceSide if(faces[i].vertices[n].neighbor==-1) { glBegin(GL_TRIANGLE_STRIP); - glVertex3fv(&(vertices[faces[i].vertices[n].vertex]*gStencilZoom-sw).x); - glVertex3fv(&(vertices[faces[i].vertices[(n+1)%3].vertex]*gStencilZoom-sw).x); - glVertex3fv(&(vertices[faces[i].vertices[n].vertex]*gStencilZoom-shadowVector).x); - glVertex3fv(&(vertices[faces[i].vertices[(n+1)%3].vertex]*gStencilZoom-shadowVector).x); + mVertex3fv((vertices[faces[i].vertices[n].vertex]*gStencilZoom-sw)); + mVertex3fv((vertices[faces[i].vertices[(n+1)%3].vertex]*gStencilZoom-sw)); + mVertex3fv((vertices[faces[i].vertices[n].vertex]*gStencilZoom-shadowVector)); + mVertex3fv((vertices[faces[i].vertices[(n+1)%3].vertex]*gStencilZoom-shadowVector)); glEnd(); #ifdef __POLYCOUNT gPolyCount+=2; @@ -846,10 +848,10 @@ void ModelShadowPassZPass(tFileRef modelRef,tVector3 shadowVector,char *faceSide if(faceSide[faces[i].vertices[n].neighbor]!=faceSide[i]) { glBegin(GL_TRIANGLE_STRIP); - glVertex3fv(&(vertices[faces[i].vertices[n].vertex]*(kShadowZoom*gStencilZoom)).x); - glVertex3fv(&(vertices[faces[i].vertices[(n+1)%3].vertex]*(kShadowZoom*gStencilZoom)).x); - glVertex3fv(&(vertices[faces[i].vertices[n].vertex]*(kShadowZoom*gStencilZoom)-shadowVector).x); - glVertex3fv(&(vertices[faces[i].vertices[(n+1)%3].vertex]*(kShadowZoom*gStencilZoom)-shadowVector).x); + mVertex3fv((vertices[faces[i].vertices[n].vertex]*(kShadowZoom*gStencilZoom))); + mVertex3fv((vertices[faces[i].vertices[(n+1)%3].vertex]*(kShadowZoom*gStencilZoom))); + mVertex3fv((vertices[faces[i].vertices[n].vertex]*(kShadowZoom*gStencilZoom)-shadowVector)); + mVertex3fv((vertices[faces[i].vertices[(n+1)%3].vertex]*(kShadowZoom*gStencilZoom)-shadowVector)); glEnd(); #ifdef __POLYCOUNT gPolyCount+=2;