Update of /cvsroot/qb2c/goengine/src/game
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19117/game
Modified Files:
game.cpp game.h gamefileinput.cpp gamefileinput.h
gameglobals.cpp gameglobals.h goengine.cpp
Log Message:
Committing changes made by syn9 after resolving numerous conflicts throughout
the code.
Index: goengine.cpp
===================================================================
RCS file: /cvsroot/qb2c/goengine/src/game/goengine.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** goengine.cpp 20 Jan 2004 18:19:27 -0000 1.5
--- goengine.cpp 8 Nov 2004 14:17:36 -0000 1.6
***************
*** 33,41 ****
printf("Initializing game data...\n");
! initialize(0, 800, 600);
!
gameinit();
load_file_v1("1");
calcsteps();
--- 33,64 ----
printf("Initializing game data...\n");
! initialize(24, 0, 640, 480);
!
gameinit();
+ updscreen();
+
+ calcsteps();
+ load_triggers_v1();
+
load_file_v1("1");
+ setup_scene();
+
+ playerx = -4;
+ playery = 0;
+ playerz = 2;
+
+ focusofs[0] = playerx;
+ focusofs[1] = playery;
+ focusofs[2] = playerz;
+
+ fightfocus[0] = playerx;
+ fightfocus[1] = playery;
+ fightfocus[2] = playerz;
+
+ camz = 66;
+ camy = 3.5;
+ camrx = 40;
+ camry = 80;
calcsteps();
***************
*** 44,73 ****
printf("Game data initialized, starting main loop...\n");
! globaltime = time(NULL) + 1;
!
!
! calcsteps();
do
{
! poll_keyboard();
! poll_mouse();
!
! start = vdist;
! depth = 0;
calcpoints();
sortpolys();
drawpolys();
drawhud();
! checkkbd();
! updphysics();
! updscreen();
! clear(offscreen);
! } while (!key[KEY_F12]);
deinit();
--- 67,112 ----
printf("Game data initialized, starting main loop...\n");
! updphysics();
+ vdist = viewdist;
+ view_updated = FALSE;
+ zm = 40;
do
{
+ poll_keyboard();
+ if (use_joy) poll_joystick();
! start = vdist;
! depth = 0;
calcpoints();
+ calcsprites();
+
sortpolys();
+
+ checkkbd();
+
+
drawpolys();
drawhud();
!
! process_trigger();
! updphysics();
+ if (!view_updated) updscreen();
+
+ //clear_to_color(offscreen, ambientc);
+ clear_to_color(offscreen, 0);
! cycle = cycle + ripplewash * fpsr;
! while (cycle > 16) { cycle = cycle - 16; }
!
!
! planeinfo[50].zrot = u(planeinfo[50].zrot + 4 * 4 * fpsr);
!
! rotate_plane(50);
!
! } while (!key[KEY_F12] && !key[KEY_ESC]);
deinit();
Index: gamefileinput.h
===================================================================
RCS file: /cvsroot/qb2c/goengine/src/game/gamefileinput.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** gamefileinput.h 4 Jan 2004 13:39:02 -0000 1.2
--- gamefileinput.h 8 Nov 2004 14:17:36 -0000 1.3
***************
*** 14,17 ****
--- 14,24 ----
#define INCLUDED_GAMEFILEINPUT_HEADER
+ void load_triggers_v1();
+
+ void save_file_detailed(char* rfile);
+ void save_file_simple(char* rfile);
+ void load_file_joypad();
+ void save_file_joypad();
+
#endif
Index: game.cpp
===================================================================
RCS file: /cvsroot/qb2c/goengine/src/game/game.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** game.cpp 20 Jan 2004 18:19:27 -0000 1.4
--- game.cpp 8 Nov 2004 14:17:36 -0000 1.5
***************
*** 19,39 ****
#include "game.h"
!
! void applyrot()
! {
! unsigned int i;
! float nsx, nsy, nsz;
!
! for (i = 0; i < pointinfo.size(); i++)
! {
[...1042 lines suppressed...]
polyinfo.push_back(tpoly);
planeinfo[c].npolies++;
+ npolies++;
}
}
***************
*** 321,326 ****
{
! focusofs[0] = focusofs[0] + (fightfocus[0] - focusofs[0]) * .08 * fpsr;
! focusofs[1] = focusofs[1] + (fightfocus[1] - focusofs[1]) * .08 * fpsr;
! focusofs[2] = focusofs[2] + (fightfocus[2] - focusofs[2]) * .08 * fpsr;
}
--- 999,1004 ----
{
! focusofs[0] = focusofs[0] + (fightfocus[0] - focusofs[0]) * .09 * fpsr;
! focusofs[1] = focusofs[1] + (fightfocus[1] - focusofs[1]) * .09 * fpsr;
! focusofs[2] = focusofs[2] + (fightfocus[2] - focusofs[2]) * .09 * fpsr;
}
Index: gameglobals.cpp
===================================================================
RCS file: /cvsroot/qb2c/goengine/src/game/gameglobals.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** gameglobals.cpp 29 Dec 2003 03:31:08 -0000 1.1
--- gameglobals.cpp 8 Nov 2004 14:17:36 -0000 1.2
***************
*** 16,22 ****
short pscx, pscy;
! short npcs, walkdir;
! float curframe;
! short gameflags[10000];
--- 16,30 ----
short pscx, pscy;
! short npcs, walkdir, curstatus;
! float curframe, triggerinfo[10000][9], cycle;
! short gameflags[10000];
!
! int ambientc, nowplaying, joyinfo[10][3];
!
! SAMPLE *bgmusic[3], *attack;
!
! BITMAP *surroundbmp, *surroundcbmp, *triggerbmp;
!
! BITMAP *frames[num_characters][num_animations][4][6];
Index: gameglobals.h
===================================================================
RCS file: /cvsroot/qb2c/goengine/src/game/gameglobals.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** gameglobals.h 29 Dec 2003 03:31:08 -0000 1.1
--- gameglobals.h 8 Nov 2004 14:17:36 -0000 1.2
***************
*** 16,28 ****
// The size of this file is exponentionaly propotional to the need of
// refactoring
!
extern float playerx, playery, playerz, pratio;
extern short pscx, pscy;
! extern short npcs, walkdir;
! extern float curframe;
! extern short gameflags[10000];
#endif
--- 16,43 ----
// The size of this file is exponentionaly propotional to the need of
// refactoring
!
! #include <allegro.h>
!
! #define num_characters 16
! #define num_animations 4
! #define status_standing 0
! #define status_walking 1
! #define status_attacking 0
extern float playerx, playery, playerz, pratio;
extern short pscx, pscy;
! extern short npcs, walkdir, curstatus;
! extern float curframe, triggerinfo[10000][9], cycle;
! extern short gameflags[10000];
!
! extern int ambientc, nowplaying, joyinfo[10][3];
!
! extern SAMPLE *bgmusic[3], *attack;
!
! extern BITMAP *surroundbmp, *surroundcbmp, *triggerbmp;
!
! extern BITMAP *frames[num_characters][num_animations][4][6];
#endif
Index: game.h
===================================================================
RCS file: /cvsroot/qb2c/goengine/src/game/game.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** game.h 20 Jan 2004 02:48:43 -0000 1.2
--- game.h 8 Nov 2004 14:17:36 -0000 1.3
***************
*** 15,25 ****
- void applyrot();
- void checkkbd();
void calcsprites();
void drawhud();
void drawpolys();
void drawsprite(short spritenum);
void gameinit();
void setup_scene();
void updphysics();
--- 15,29 ----
void calcsprites();
+ void checkkbd();
+ void cleanup_scene();
void drawhud();
void drawpolys();
void drawsprite(short spritenum);
+ void fill_surround();
void gameinit();
+ void gui_setkeys();
+ void process_trigger();
+ void rotate_plane(int planenum);
void setup_scene();
void updphysics();
Index: gamefileinput.cpp
===================================================================
RCS file: /cvsroot/qb2c/goengine/src/game/gamefileinput.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** gamefileinput.cpp 4 Jan 2004 13:39:02 -0000 1.2
--- gamefileinput.cpp 8 Nov 2004 14:17:36 -0000 1.3
***************
*** 20,21 ****
--- 20,349 ----
#include "game.h"
+
+ void load_triggers_v1()
+ {
+ FILE *fp;
+ char mapfile[100];
+ int c = 0, d;
+
+
+ sprintf(mapfile, "data/triggers.dat");
+
+ fp = fopen(mapfile, "r");
+
+ for (c = 0; c < 10000; c++)
+ {
+ for (d = 0; d < 9; d++)
+ {
+ fscanf(fp, "%f", &triggerinfo[c][d]);
+ }
+ }
+
+ fclose(fp);
+
+ }
+ void save_file_detailed(char* rfile)
+ {
+
+ FILE *fp;
+ char mapfile[100], tmp[100];
+ int c, d, e;
+
+ sprintf(mapfile, "data/maps/%s.dtl", rfile);
+
+ fp = fopen(mapfile, "w");
+
+ int version = 1;
+
+ fprintf(fp, "%d\n", version);
+
+ fprintf(fp, "endplane\n");
+ fprintf(fp, "%d\n", endplane);
+ fprintf(fp, "%d\n", lastlight);
+
+ fprintf(fp, "plane_info\n");
+
+ int lx, ly, rx, ry, w, h;
+
+ h = ycenter / 5;
+ w = xcenter / 2;
+ lx = xcenter - w / 2;
+ ly = ycenter - h / 2;
+ rx = lx + w - 1;
+ ry = ly + h - 1;
+
+ BITMAP *temppcx;
+
+ win (0, lx, ly, rx + 6, ry);
+
+ updscreen();
+ int greenc = makecol(0, 255, 0);
+
+ for (c = 0; c <= endplane; c++)
+ {
+ rectfill (screen, lx + 4, ly + 4, lx + 4 + (w - 8) * (float)c / endplane, ly + h - 4, greenc);
+ if (planeinfo[c].active) fprintf(fp, "1\n");
+ if (!planeinfo[c].active) fprintf(fp, "0\n");
+ if (planeinfo[c].condensed) fprintf(fp, "1\n");
+ if (!planeinfo[c].condensed) fprintf(fp, "0\n");
+
+ fprintf(fp, "%f\n", planeinfo[c].basex);
+ fprintf(fp, "%f\n", planeinfo[c].basey);
+ fprintf(fp, "%f\n", planeinfo[c].basez);
+
+ fprintf(fp, "%f\n", planeinfo[c].xrot);
+ fprintf(fp, "%f\n", planeinfo[c].yrot);
+ fprintf(fp, "%f\n", planeinfo[c].zrot);
+
+ fprintf(fp, "%f\n", planeinfo[c].endx);
+ fprintf(fp, "%f\n", planeinfo[c].endy);
+ fprintf(fp, "%f\n", planeinfo[c].endz);
+
+ fprintf(fp, "%f\n", planeinfo[c].height);
+
+ fprintf(fp, "%f\n", planeinfo[c].rbx);
+ fprintf(fp, "%f\n", planeinfo[c].rby);
+ fprintf(fp, "%f\n", planeinfo[c].rbz);
+
+ fprintf(fp, "%d\n", planeinfo[c].rows);
+ fprintf(fp, "%d\n", planeinfo[c].cols);
+ fprintf(fp, "%d\n", planeinfo[c].lastpoint);
+ fprintf(fp, "%d\n", planeinfo[c].lastpoly);
+ fprintf(fp, "%d\n", planeinfo[c].npoints);
+ fprintf(fp, "%d\n", planeinfo[c].npolies);
+
+ if (planeinfo[c].active) {
+
+ for (d = 0; d <= planeinfo[c].lastpoint; d++)
+ {
+ for (e = 0; e < 11; e++)
+ {
+ fprintf(fp, "%f\n", planeinfo[c].pointinfo[d][e]);
+ }
+ }
+
+ temppcx = create_system_bitmap((planeinfo[c].lastpoly + 1) * 16, 16);
+ clear(temppcx);
+
+ for (d = 0; d <= planeinfo[c].lastpoly; d++)
+ {
+ for (e = 0; e < 10; e++)
+ {
+ fprintf(fp, "%d\n", planeinfo[c].polyinfo[d][e]);
+ }
+ for (e = 0; e < 6; e++)
+ {
+ fprintf(fp, "%d\n", planeinfo[c].polyvtx[d][e]);
+ }
+
+ e = 0;
+ if (planeinfo[c].radiosity_setup[d] > 0) e = 1;
+ fprintf(fp, "%d\n", e);
+
+
+ if (planeinfo[c].radiosity_setup[d] > 0)
+ {
+ blit(planeinfo[c].radiosity[d], temppcx, 0, 0, d * 16, 0, 16, 16);
+ //sprintf(tmp, "data/maps/shadowmap/i%s_%d_%d.bmp", rfile, c, d);
+ //save_bmp(tmp, planeinfo[c].radiosity[d], pal);
+ }
+ }
+ sprintf(tmp, "data/maps/shadowmap/i%s_%d.bmp", rfile, c);
+ save_bmp(tmp, temppcx, pal);
+
+ destroy_bitmap(temppcx);
+
+ }
+
+ for (d = 0; d < lastlight; d++)
+ {
+ fprintf(fp, "%f\n", lightinfo[d].strength);
+ fprintf(fp, "%d\n", lightinfo[d].lightr);
+ fprintf(fp, "%d\n", lightinfo[d].lightg);
+ fprintf(fp, "%d\n", lightinfo[d].lightb);
+ }
+
+ }
+
+ fclose(fp);
+ }
+
+ void save_file_simple(char* rfile)
+ {
+
+ FILE *fp;
+ char mapfile[100], tmp[100];
+ int c, d, e;
+
+ sprintf(mapfile, "data/maps/%s.smp", rfile);
+
+ fp = fopen(mapfile, "w");
+
+ int version = 1;
+
+ fprintf(fp, "%d\n", version);
+
+ fprintf(fp, "endplane\n");
+ fprintf(fp, "%d\n", endplane);
+ fprintf(fp, "%d\n", lastlight);
+
+ fprintf(fp, "plane_info\n");
+
+ int lx, ly, rx, ry, w, h;
+
+ h = ycenter / 5;
+ w = xcenter / 2;
+ lx = xcenter - w / 2;
+ ly = ycenter - h / 2;
+ rx = lx + w - 1;
+ ry = ly + h - 1;
+
+ BITMAP *temppcx;
+
+ win (0, lx, ly, rx + 6, ry);
+
+ updscreen();
+ int greenc = makecol(0, 255, 0);
+
+ for (c = 0; c <= endplane; c++)
+ {
+ rectfill (screen, lx + 4, ly + 4, lx + 4 + (w - 8) * (float)c / endplane, ly + h - 4, greenc);
+ if (planeinfo[c].active) fprintf(fp, "1\n");
+ if (!planeinfo[c].active) fprintf(fp, "0\n");
+ if (planeinfo[c].condensed) fprintf(fp, "1\n");
+ if (!planeinfo[c].condensed) fprintf(fp, "0\n");
+
+ if (planeinfo[c].active)
+ {
+ fprintf(fp, "%f\n", planeinfo[c].basex);
+ fprintf(fp, "%f\n", planeinfo[c].basey);
+ fprintf(fp, "%f\n", planeinfo[c].basez);
+
+ fprintf(fp, "%f\n", planeinfo[c].xrot);
+ fprintf(fp, "%f\n", planeinfo[c].yrot);
+ fprintf(fp, "%f\n", planeinfo[c].zrot);
+
+ fprintf(fp, "%f\n", planeinfo[c].endx);
+ fprintf(fp, "%f\n", planeinfo[c].endy);
+ fprintf(fp, "%f\n", planeinfo[c].endz);
+
+ fprintf(fp, "%f\n", planeinfo[c].height);
+
+ fprintf(fp, "%f\n", planeinfo[c].rbx);
+ fprintf(fp, "%f\n", planeinfo[c].rby);
+ fprintf(fp, "%f\n", planeinfo[c].rbz);
+
+ fprintf(fp, "%d\n", planeinfo[c].rows);
+ fprintf(fp, "%d\n", planeinfo[c].cols);
+ fprintf(fp, "%d\n", planeinfo[c].lastpoint);
+ fprintf(fp, "%d\n", planeinfo[c].lastpoly);
+ fprintf(fp, "%d\n", planeinfo[c].npoints);
+ fprintf(fp, "%d\n", planeinfo[c].npolies);
+
+
+ for (d = 0; d <= planeinfo[c].lastpoint; d++)
+ {
+ fprintf(fp, "%f\n", planeinfo[c].pointinfo[d][7]);
+
+ if (planeinfo[c].pointinfo[d][7] == 0)
+ {
+ for (e = 0; e < 11; e++)
+ {
+ fprintf(fp, "%f\n", planeinfo[c].pointinfo[d][e]);
+ }
+ }
+ }
+
+ temppcx = create_system_bitmap((planeinfo[c].lastpoly + 1) * 16, 16);
+ clear(temppcx);
+
+ for (d = 0; d <= planeinfo[c].lastpoly; d++)
+ {
+ fprintf(fp, "%d\n", planeinfo[c].polyinfo[d][6]);
+ if (planeinfo[c].polyinfo[d][6] < 2)
+ {
+ for (e = 0; e < 10; e++)
+ {
+ fprintf(fp, "%d\n", planeinfo[c].polyinfo[d][e]);
+ }
+ for (e = 0; e < 6; e++)
+ {
+ fprintf(fp, "%d\n", planeinfo[c].polyvtx[d][e]);
+ }
+
+ e = 0;
+ if (planeinfo[c].radiosity_setup[d] > 0) e = 1;
+ fprintf(fp, "%d\n", e);
+
+
+ if (planeinfo[c].radiosity_setup[d] > 0)
+ {
+ blit(planeinfo[c].radiosity[d], temppcx, 0, 0, d * 16, 0, 16, 16);
+
+ }
+ }
+ }
+
+ sprintf(tmp, "data/maps/shadowmap/i%s_%d.bmp", rfile, c);
+ save_bmp(tmp, temppcx, pal);
+
+ destroy_bitmap(temppcx);
+
+ }
+
+ for (d = 0; d < lastlight; d++)
+ {
+ fprintf(fp, "%f\n", lightinfo[d].strength);
+ fprintf(fp, "%d\n", lightinfo[d].lightr);
+ fprintf(fp, "%d\n", lightinfo[d].lightg);
+ fprintf(fp, "%d\n", lightinfo[d].lightb);
+ }
+
+ }
+
+ fclose(fp);
+ }
+
+
+
+
+ void load_file_joypad()
+ {
+ FILE *fp;
+ int a, b;
+
+ fp = fopen("data/joypad.dat", "r");
+
+ for (a = 0; a < 10; a++)
+ {
+ for (b = 0; b < 3; b++)
+ {
+ fscanf(fp, "%d", &joyinfo[a][b]);
+ }
+ }
+ fclose(fp);
+
+ }
+
+ void save_file_joypad()
+ {
+
+ FILE *fp;
+
+ fp = fopen("data/joypad.dat", "w");
+
+ int a, b;
+
+ for (a = 0; a < 10; a++)
+ {
+ for (b = 0; b < 3; b++)
+ {
+ fprintf(fp, "%d\n", joyinfo[a][b]);
+ }
+ }
+
+
+ fclose(fp);
+ }
+
+
|