Skip to content

Commit

Permalink
added graphics (plus factorX and factorY in material slices)
Browse files Browse the repository at this point in the history
  • Loading branch information
smealum committed Jan 13, 2013
1 parent 99f31d6 commit b6c360a
Show file tree
Hide file tree
Showing 110 changed files with 55 additions and 190 deletions.
3 changes: 2 additions & 1 deletion arm9/include/editor/material.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ typedef struct
{
mtlImg_struct* img;
u16 id;
s16 factor;
s16 factorX;
s16 factorY;
bool align;
bool used;
}materialSlice_struct;
Expand Down
1 change: 0 additions & 1 deletion arm9/include/game/portals.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
typedef struct portal_struct
{
camera_struct camera;
mtlImg_struct* texture;
vect3D position;
u16 viewPoint[256*192];
u16 color;
Expand Down
29 changes: 21 additions & 8 deletions arm9/source/editor/material.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ void loadMaterialSlice(materialSlice_struct* ms, char* filename)
{
ms->img=createTexture(filename,"textures");
ms->align=false;
ms->factor=1;
ms->factorX=1;
ms->factorY=1;
}
}

Expand All @@ -89,7 +90,19 @@ void loadMaterialSlices(char* filename)
ms->align=(k!=0);
sprintf(key,"slice%d:factor",i);
sscanf(dictionary_get(dic, key, "1"),"%d",&k);
ms->factor=k;
ms->factorX=k;
ms->factorY=k;

{
char def[16];
sprintf(def,"%d",ms->factorX);
sprintf(key,"slice%d:factorx",i);
sscanf(dictionary_get(dic, key, def),"%d",&k);
ms->factorX=k;
sprintf(key,"slice%d:factory",i);
sscanf(dictionary_get(dic, key, def),"%d",&k);
ms->factorY=k;
}

// if(!ms->img){break;}
i++;
Expand Down Expand Up @@ -155,8 +168,8 @@ void getTextureCoordSlice(materialSlice_struct* ms, rectangle_struct* rec, int32
if(ms->align)p1=vect(inttot16(ms->img->height*rec->position.z-1),inttot16(((ms->img->height*rec->position.y)*HEIGHTUNIT)/(TILESIZE*2)-1),0);
p2=vect(inttot16(ms->img->height*rec->size.z-1),inttot16(((ms->img->height*rec->size.y)*HEIGHTUNIT)/(TILESIZE*2)-1),0);
p2=addVect(p1,p2);
p1=vectDivInt(p1,ms->factor);
p2=vectDivInt(p2,ms->factor);
p1=vect(p1.x/ms->factorX,p1.y/ms->factorY,0);
p2=vect(p2.x/ms->factorX,p2.y/ms->factorY,0);
t[3]=TEXTURE_PACK(p1.x, p1.y);
t[0]=TEXTURE_PACK(p1.x, p2.y);
t[1]=TEXTURE_PACK(p2.x, p2.y);
Expand All @@ -166,8 +179,8 @@ void getTextureCoordSlice(materialSlice_struct* ms, rectangle_struct* rec, int32
if(ms->align)p1=vect(inttot16(ms->img->width*rec->position.x-1),inttot16(ms->img->height*rec->position.z-1),0);
p2=vect(inttot16(ms->img->width*rec->size.x-1),inttot16(ms->img->height*rec->size.z-1),0);
p2=addVect(p1,p2);
p1=vectDivInt(p1,ms->factor);
p2=vectDivInt(p2,ms->factor);
p1=vect(p1.x/ms->factorX,p1.y/ms->factorY,0);
p2=vect(p2.x/ms->factorX,p2.y/ms->factorY,0);
t[0]=TEXTURE_PACK(p1.x, p1.y);
t[1]=TEXTURE_PACK(p1.x, p2.y);
t[2]=TEXTURE_PACK(p2.x, p2.y);
Expand All @@ -177,8 +190,8 @@ void getTextureCoordSlice(materialSlice_struct* ms, rectangle_struct* rec, int32
if(ms->align)p1=vect(inttot16(ms->img->width*rec->size.x-1),inttot16(((ms->img->height*rec->size.y)*HEIGHTUNIT)/(TILESIZE*2)-1),0);
p2=vect(inttot16(ms->img->width*rec->size.x-1),inttot16(((ms->img->height*rec->size.y)*HEIGHTUNIT)/(TILESIZE*2)-1),0);
p2=addVect(p1,p2);
p1=vectDivInt(p1,ms->factor);
p2=vectDivInt(p2,ms->factor);
p1=vect(p1.x/ms->factorX,p1.y/ms->factorY,0);
p2=vect(p2.x/ms->factorX,p2.y/ms->factorY,0);
t[1]=TEXTURE_PACK(p1.x, p1.y);
t[0]=TEXTURE_PACK(p1.x, p2.y);
t[3]=TEXTURE_PACK(p2.x, p2.y);
Expand Down
21 changes: 21 additions & 0 deletions arm9/source/game/game.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ PrintConsole bottomScreen;

extern roomEdit_struct roomEdits[NUMROOMEDITS];

md2Model_struct testTurret, testButton1, testButton2;

void initGame(void)
{
int oldv=getMemFree();
Expand Down Expand Up @@ -84,6 +86,11 @@ void initGame(void)
transferRectangles(&roomEdits[0].data);
makeGrid();

loadMd2Model("turret.md2","turret.pcx",&testTurret); //TEMP
loadMd2Model("button1.md2","button1.pcx",&testButton1); //TEMP
loadMd2Model("button2.md2","button2.pcx",&testButton2); //TEMP
getVramStatus();

startPI();
}

Expand Down Expand Up @@ -137,8 +144,22 @@ static inline void render1(void)

glScalef32(SCALEFACT,SCALEFACT,SCALEFACT);

renderGun(NULL);

transformCamera(NULL);

glPushMatrix();
renderModelFrameInterp(0, 0, 0, &testTurret, POLY_ALPHA(31) | POLY_CULL_FRONT | POLY_FORMAT_LIGHT0);

glPushMatrix();
glTranslate3f32(-TILESIZE*5,0,0);
renderModelFrameInterp(0, 0, 0, &testButton1, POLY_ALPHA(31) | POLY_CULL_FRONT | POLY_FORMAT_LIGHT0);
glPopMatrix(1);

glTranslate3f32(0,0,TILESIZE*2);
renderModelFrameInterp(0, 0, 0, &testButton2, POLY_ALPHA(31) | POLY_CULL_FRONT | POLY_FORMAT_LIGHT0);
glPopMatrix(1);

drawRoomsGame(128);

updateParticles();
Expand Down
2 changes: 1 addition & 1 deletion arm9/source/game/player.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void initPlayer(player_struct* p)
touchRead(&touchCurrent);
touchOld=touchCurrent;
p->life=4;
loadMd2Model("pistol.md2","pistol.pcx",&gun);
loadMd2Model("portalgun.md2","portalgun.pcx",&gun);
initModelInstance(&p->modelInstance,&gun);
crossHair=createTexture("crshair.pcx","textures");
bottomScreen=(struct gl_texture_t *)ReadPCXFile("bottom.pcx","bottom");
Expand Down
30 changes: 2 additions & 28 deletions arm9/source/game/portals.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "game/game_main.h"

mtlImg_struct *portalTexture1, *portalTexture2; //retarded but temp
portal_struct portal1, portal2;
portal_struct* currentPortal;

Expand All @@ -10,9 +9,6 @@ void initPortals(void)
{
initPolygonPool();

portalTexture1=createTexture("portal1.pcx", "textures");
portalTexture2=createTexture("portal2.pcx", "textures");

initPortal(&portal1, vect(256*4,1024*2,0), vect(inttof32(1),0,0), true);
initPortal(&portal2, vect(2048,1024+512,0), vect(0,inttof32(1),0), false);

Expand Down Expand Up @@ -46,8 +42,8 @@ void initPortal(portal_struct* p, vect3D pos, vect3D normal, bool color)
if(!p)return;
p->position=pos;
p->targetPortal=NULL;
if(color){p->color=RGB15(31,31,0);p->texture=portalTexture1;}
else {p->color=RGB15(0,31,31);p->texture=portalTexture2;}
if(color){p->color=RGB15(31,31,0);}
else {p->color=RGB15(0,31,31);}
initCamera(&p->camera);

p->angle=0;
Expand Down Expand Up @@ -107,28 +103,6 @@ void drawPortal(portal_struct* p)
drawPolygon(p->unprojectedPolygon);
glPopMatrix(1);
}

return;

glPushMatrix();
glTranslate3f32(p->position.x,p->position.y,p->position.z);

applyMTL(p->texture);
GFX_COLOR=RGB15(31,31,31);
const vect3D v1=(vectDivInt(p->plane[0],PORTALFRACTIONX)), v2=(vectDivInt(p->plane[1],PORTALFRACTIONY)), v3=vectDivInt(p->normal,128);

glTranslate3f32(v3.x,v3.y,v3.z);

glBegin(GL_QUAD);
GFX_TEX_COORD=TEXTURE_PACK(inttot16(127),inttot16(0));
glVertex3v16(v1.x-v2.x, v1.y-v2.y, v1.z-v2.z);
GFX_TEX_COORD=TEXTURE_PACK(inttot16(0),inttot16(0));
glVertex3v16(v1.x+v2.x, v1.y+v2.y, v1.z+v2.z);
GFX_TEX_COORD=TEXTURE_PACK(inttot16(0),inttot16(127));
glVertex3v16(-v1.x+v2.x, -v1.y+v2.y, -v1.z+v2.z);
GFX_TEX_COORD=TEXTURE_PACK(inttot16(127),inttot16(127));
glVertex3v16(-v1.x-v2.x, -v1.y-v2.y, -v1.z-v2.z);
glPopMatrix(1);
}

void getInvertedNormal(vect3D* n){if(!n->z)*n=vectMultInt(*n,-1);}
Expand Down
Binary file modified logo.bmp
Binary file not shown.
Binary file added nitrofiles/fpsm/button1.md2
Binary file not shown.
Binary file added nitrofiles/fpsm/button2.md2
Binary file not shown.
Binary file modified nitrofiles/fpsm/maps/lalala.map
Binary file not shown.
72 changes: 2 additions & 70 deletions nitrofiles/fpsm/materials.ini
Original file line number Diff line number Diff line change
@@ -1,72 +1,4 @@
[material0]
bottom=0
side=4
top=3

[material1]
bottom=1
side=4
top=3

[material2]
bottom=2
side=4
top=3

[material3]
bottom=0
side=5
top=3

[material4]
bottom=0
side=6
top=3

[material5]
bottom=0
side=7
top=3

[material6]
bottom=0
side=8
top=3

[material7]
bottom=0
side=9
top=3

[material8]
bottom=0
side=10
top=3


[material9]
bottom=11
side=12
top=13

[material10]
bottom=0
side=4
top=14


[material11]
bottom=0
side=6
top=14


[material12]
bottom=0
side=15
top=14

[material13]
bottom=0
side=15
top=3
side=0
top=2
Binary file added nitrofiles/fpsm/portalgun.md2
Binary file not shown.
87 changes: 6 additions & 81 deletions nitrofiles/fpsm/slices.ini
Original file line number Diff line number Diff line change
@@ -1,90 +1,15 @@
[slice0]
texture=t14.pcx
texture=wall1.pcx
align=0
factor=1
factorx=2
factory=4

[slice1]
texture=t2.pcx
align=0
factor=4

[slice2]
texture=t16.pcx
align=0
factor=1

[slice3]
texture=t8.pcx
align=0
factor=1

[slice4]
texture=t1.pcx
align=0
factor=4

[slice5]
texture=t11.pcx
align=0
factor=4

[slice6]
texture=t12.pcx
align=0
factor=4

[slice7]
texture=t3.pcx
align=0
factor=1

[slice8]
texture=t4.pcx
align=0
factor=1

[slice9]
texture=t20.pcx
align=0
factor=1

[slice10]
texture=t17.pcx
align=0
factor=1


[slice10]
texture=t9.pcx
texture=floor3.pcx
align=0
factor=1

[slice11]
texture=t21.pcx
align=0
factor=1


[slice12]
texture=t13.pcx
align=0
factor=1


[slice13]
texture=t7.pcx
align=0
factor=1


[slice14]
texture=t5.pcx
[slice2]
texture=floor8.pcx
align=0
factor=1


[slice15]
texture=t9.pcx
align=0
factor=4

Binary file added nitrofiles/fpsm/textures/button1.pcx
Binary file not shown.
Binary file added nitrofiles/fpsm/textures/button2.pcx
Binary file not shown.
Binary file modified nitrofiles/fpsm/textures/companion.pcx
Binary file not shown.
Binary file added nitrofiles/fpsm/textures/default - Copy.pcx
Binary file not shown.
Binary file modified nitrofiles/fpsm/textures/default.pcx
Binary file not shown.
Binary file added nitrofiles/fpsm/textures/floor1.pcx
Binary file not shown.
Binary file added nitrofiles/fpsm/textures/floor10.pcx
Binary file not shown.
Binary file added nitrofiles/fpsm/textures/floor11.pcx
Binary file not shown.
Binary file added nitrofiles/fpsm/textures/floor12.pcx
Binary file not shown.
Binary file added nitrofiles/fpsm/textures/floor13.pcx
Binary file not shown.
Binary file added nitrofiles/fpsm/textures/floor2.pcx
Binary file not shown.
Binary file added nitrofiles/fpsm/textures/floor3.pcx
Binary file not shown.
Binary file added nitrofiles/fpsm/textures/floor4.pcx
Binary file not shown.
Binary file added nitrofiles/fpsm/textures/floor5.pcx
Binary file not shown.
Binary file added nitrofiles/fpsm/textures/floor6.pcx
Binary file not shown.
Binary file added nitrofiles/fpsm/textures/floor7.pcx
Binary file not shown.
Binary file added nitrofiles/fpsm/textures/floor8.pcx
Binary file not shown.
Binary file added nitrofiles/fpsm/textures/floor9.pcx
Binary file not shown.
Binary file added nitrofiles/fpsm/textures/portalgun.pcx
Binary file not shown.
Binary file removed nitrofiles/fpsm/textures/t1.pcx
Binary file not shown.
Binary file removed nitrofiles/fpsm/textures/t10.pcx
Binary file not shown.
Binary file removed nitrofiles/fpsm/textures/t11.pcx
Binary file not shown.
Binary file removed nitrofiles/fpsm/textures/t12.pcx
Binary file not shown.
Binary file removed nitrofiles/fpsm/textures/t13.pcx
Binary file not shown.
Binary file removed nitrofiles/fpsm/textures/t14.pcx
Binary file not shown.
Binary file removed nitrofiles/fpsm/textures/t15.bmp
Binary file not shown.
Binary file removed nitrofiles/fpsm/textures/t15.pcx
Binary file not shown.
Binary file removed nitrofiles/fpsm/textures/t16.pcx
Binary file not shown.
Binary file removed nitrofiles/fpsm/textures/t17.pcx
Binary file not shown.
Binary file removed nitrofiles/fpsm/textures/t18.pcx
Binary file not shown.
Binary file removed nitrofiles/fpsm/textures/t19.pcx
Binary file not shown.
Binary file removed nitrofiles/fpsm/textures/t2.pcx
Binary file not shown.
Binary file removed nitrofiles/fpsm/textures/t20.pcx
Binary file not shown.
Binary file removed nitrofiles/fpsm/textures/t21.pcx
Binary file not shown.
Binary file removed nitrofiles/fpsm/textures/t3.pcx
Binary file not shown.
Binary file removed nitrofiles/fpsm/textures/t4.pcx
Binary file not shown.
Binary file removed nitrofiles/fpsm/textures/t5.pcx
Binary file not shown.
Binary file removed nitrofiles/fpsm/textures/t6.pcx
Binary file not shown.
Binary file removed nitrofiles/fpsm/textures/t7.pcx
Binary file not shown.
Binary file removed nitrofiles/fpsm/textures/t8.pcx
Binary file not shown.
Binary file removed nitrofiles/fpsm/textures/t9.pcx
Binary file not shown.
Binary file added nitrofiles/fpsm/textures/turret.pcx
Binary file not shown.
Binary file added nitrofiles/fpsm/textures/wall1.pcx
Binary file not shown.
Binary file added nitrofiles/fpsm/turret.md2
Binary file not shown.
Binary file added reference/1301/button1.md2
Binary file not shown.
Binary file added reference/1301/button1_128.pcx
Binary file not shown.
Binary file added reference/1301/button1_256.pcx
Binary file not shown.
Binary file added reference/1301/button2.md2
Binary file not shown.
Binary file added reference/1301/button2_128.pcx
Binary file not shown.
Binary file added reference/1301/button2_256.pcx
Binary file not shown.
Binary file added reference/1301/companioncube.md2
Binary file not shown.
Binary file added reference/1301/companioncube_128.pcx
Binary file not shown.
Binary file added reference/1301/companioncube_256.pcx
Binary file not shown.
Binary file added reference/1301/companioncube_64.pcx
Binary file not shown.
Binary file added reference/1301/floortextures/floor1.pcx
Binary file not shown.
Binary file added reference/1301/floortextures/floor10.pcx
Binary file not shown.
Binary file added reference/1301/floortextures/floor11.pcx
Binary file not shown.
Binary file added reference/1301/floortextures/floor12.pcx
Binary file not shown.
Binary file added reference/1301/floortextures/floor13.pcx
Binary file not shown.
Binary file added reference/1301/floortextures/floor2.pcx
Binary file not shown.
Binary file added reference/1301/floortextures/floor3.pcx
Binary file not shown.
Binary file added reference/1301/floortextures/floor4.pcx
Binary file not shown.
Binary file added reference/1301/floortextures/floor5.pcx
Binary file not shown.
Binary file added reference/1301/floortextures/floor6.pcx
Binary file not shown.
Binary file added reference/1301/floortextures/floor7.pcx
Binary file not shown.
Binary file added reference/1301/floortextures/floor8.pcx
Binary file not shown.
Binary file added reference/1301/floortextures/floor9.pcx
Binary file not shown.
Binary file added reference/1301/pickupgun.md2
Binary file not shown.
Binary file added reference/1301/portalgun.md2
Binary file not shown.
Binary file added reference/1301/portalgun_skin128.pcx
Binary file not shown.
Binary file added reference/1301/portalgun_skin256.pcx
Binary file not shown.
Binary file added reference/1301/portalgun_skin512.pcx
Binary file not shown.
Binary file added reference/1301/portalicon.bmp
Binary file not shown.
Binary file added reference/1301/portalicon.pcx
Binary file not shown.
Binary file added reference/1301/storagecube_128.pcx
Binary file not shown.
Binary file added reference/1301/storagecube_256.pcx
Binary file not shown.
Binary file added reference/1301/storagecube_64.pcx
Binary file not shown.
Binary file added reference/1301/turret.md2
Binary file not shown.
Binary file added reference/1301/turret_128.pcx
Binary file not shown.
Binary file added reference/1301/turret_256.pcx
Binary file not shown.
Binary file added reference/1301/turret_512.pcx
Binary file not shown.
Binary file added reference/1301/walltextures/wall1.pcx
Binary file not shown.
Binary file added reference/1301/walltextures/wall1_128.pcx
Binary file not shown.
Binary file added reference/1301/walltextures/wall2.pcx
Binary file not shown.
Binary file added reference/1301/walltextures/wall2_128.pcx
Binary file not shown.
Binary file added reference/1301/walltextures/wall3.pcx
Binary file not shown.
Binary file added reference/1301/walltextures/wall3_128.pcx
Binary file not shown.
Binary file added reference/1301/walltextures/wall4.pcx
Binary file not shown.
Binary file added reference/1301/walltextures/wall4_128.pcx
Binary file not shown.
Binary file added reference/1301/walltextures/wall5.pcx
Binary file not shown.
Binary file added reference/1301/walltextures/wall5_128.pcx
Binary file not shown.
Binary file added reference/1301/walltextures/wall6.pcx
Binary file not shown.
Binary file added reference/1301/walltextures/wall6_128.pcx
Binary file not shown.
Binary file added reference/1301/walltextures/wall7.pcx
Binary file not shown.
Binary file added reference/1301/walltextures/wall7_128.pcx
Binary file not shown.
Binary file added reference/1301/walltextures/wall8.pcx
Binary file not shown.
Binary file added reference/1301/walltextures/wall8_128.pcx
Binary file not shown.

0 comments on commit b6c360a

Please sign in to comment.