51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+/*
#include "glob.h"
#include <stdio.h>
//#include <io.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
-#include "vga.h"
+//#include "vga.h"
#include "keyb.h"
#include "error.h"
#include "files.h"
#include "sound.h"
-
+*/
/*
#define WAIT_SZ 400000
#include <stdlib.h>
#include <string.h>
#include "config.h"
-#include "vga.h"
+//#include "vga.h"
#include "error.h"
#include "sound.h"
#include "files.h"
{"vga","screenshot",&shot_vga,SW_ON,0},
{"sndvol","sound_volume",&snd_vol,WORD,0},
{"musvol","music_volume",&mus_vol,WORD,0},
- {"fullscr","fullscreen",&fullscreen,SW_ON,0},
- {"window",NULL,&fullscreen,SW_OFF,0},
+// {"fullscr","fullscreen",&fullscreen,SW_ON,0},
+// {"window",NULL,&fullscreen,SW_OFF,0},
{NULL,"sky",&w_horiz,SW_ON,0},
{"mon",NULL,&nomon,SW_OFF,0},
- {"gamma","gamma",&gammaa,DWORD,0},
+// {"gamma","gamma",&gammaa,DWORD,0},
{"warp",NULL,&_warp,BYTE,0},
{"width","screen_width",&SCRW,DWORD,0},
{"height","screen_height",&SCRH,DWORD,0},
#include "glob.h"
#include <stdlib.h>
-#include "vga.h"
#include "view.h"
#include "dots.h"
#include "misc.h"
#include <stdlib.h>
#include "keyb.h"
#include "sound.h"
-#include "vga.h"
+#include "render.h"
#include "memory.h"
#include "error.h"
#include "config.h"
-void close_all(void) {
+static void close_all (void) {
S_done();
S_donemusic();
K_done();
- V_done();
+ R_done();
M_shutdown();
}
-void ERR_failinit(char *s,...) {
+void ERR_failinit (char *s, ...) {
va_list ap;
-
close_all();
- va_start(ap,s);
- vprintf(s,ap);
+ va_start(ap, s);
+ vprintf(s, ap);
va_end(ap);
puts("");
exit(1);
void ERR_fatal(char *s,...) {
va_list ap;
-
close_all();
puts("\nКРИТИЧЕСКАЯ ОШИБКА:");
- va_start(ap,s);
- vprintf(s,ap);
+ va_start(ap, s);
+ vprintf(s, ap);
va_end(ap);
puts("");
exit(2);
}
-void ERR_quit(void) {
+void ERR_quit (void) {
void *p;
//V_done();
//if(!(p=malloc(4000)))
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "vga.h"
#include "view.h"
#include "fx.h"
#include "misc.h"
}
void FX_trans1(int t) {
-
+/*
int x,y,u,v;
static unsigned char k;
unsigned p;
else scra[p]=fx_scr1[v*320+u];
}else scra[p]=fx_scr2[p];
}
-
+*/
}
static void init_fx1sin(void) {
#include <string.h>
#include "files.h"
#include "memory.h"
-#include "vga.h"
#include "keyb.h"
#include "sound.h"
#include "view.h"
extern int hit_xv,hit_yv;
-extern vgapal std_pal;
-void setgamma(int);
+//void setgamma(int);
extern int PL_JUMP;
extern map_block_t blk;
-extern byte clrmap[256*12];
-
extern byte cheat;
byte _2pl=0,g_dm=0,g_st=GS_TITLE,g_exit=0,g_map=1,_warp=0;
W_init();
F_loadgame(n);
set_trans(GS_GAME);
- V_setscr((g_trans)?fx_scr2:scrbuf);V_setrect(0,SCRW,0,SCRH);//V_setrect(0,320,0,200);
- V_clr(0,SCRW,0,SCRH,0);//V_clr(0,320,0,200,0);
-// if(_2pl) {w_o=0;Z_clrst();w_o=SCRH/2;Z_clrst();}//if(_2pl) {w_o=0;Z_clrst();w_o=100;Z_clrst();}
-// else {w_o=0;Z_clrst();}//else {w_o=50;Z_clrst();}
- V_setscr(scrbuf);
pl1.drawst=0xFF;
if(_2pl) pl2.drawst=0xFF;
BM_remapfld();
sprintf(s,"MAP%02u",(word)g_map);
F_loadmap(s);
set_trans(GS_GAME);
- V_setscr((g_trans)?fx_scr2:scrbuf);V_setrect(0,SCRW,0,SCRH);//V_setrect(0,320,0,200);
- V_clr(0,SCRW,0,SCRH,0);//V_clr(0,320,0,200,0);
-// if(_2pl) {w_o=0;Z_clrst();w_o=SCRH/2;Z_clrst();}//if(_2pl) {w_o=0;Z_clrst();w_o=100;Z_clrst();}
-// else {w_o=0;Z_clrst();}//else {w_o=50;Z_clrst();}
- V_setscr(scrbuf);
pl1.drawst=0xFF;
if(_2pl) pl2.drawst=0xFF;
g_exit=0;
void logo(const char *,...);
void logo_gas(int,int);
-extern int gammaa;
extern int snd_card;
extern int _cpu;
*/
#include "keyb.h"
-#include "vga.h"
#include "error.h"
#include <SDL.h>
{
SDL_Event event;
while (SDL_PollEvent (&event)) {
+ /*
if (event.type == SDL_KEYDOWN && event.key.keysym.sym == SDLK_RETURN && event.key.keysym.mod & KMOD_LALT) {
V_toggle();
}
- else if (event.type == SDL_KEYDOWN || event.type == SDL_KEYUP) {
+ else */
+ if (event.type == SDL_KEYDOWN || event.type == SDL_KEYUP) {
if (event.type == SDL_KEYDOWN && key_proc!=NULL)
key_proc(event.key.keysym.sym, event.type == SDL_KEYDOWN);
}
#include "memory.h"
#include "keyb.h"
#include "sound.h"
-#include "vga.h"
#include "files.h"
#include "view.h"
#include "menu.h"
#include <SDL.h>
-int gammaa=0;
-
-char main_pal[256][3],std_pal[256][3];
-byte mixmap[256][256];
-byte clrmap[256*12];
-
void logo(const char *s,...) {
va_list ap;
int x,y;
void logo_gas(int cur,int all) {
}
-byte gamcor[5][64]={
- #include "gamma.dat"
-};
-
-void setgamma(int g) {
- int t;
-
- if(g>4) g=4;
- if(g<0) g=0;
- gammaa=g;
- for(t=0;t<256;++t) {
- std_pal[t][0]=gamcor[gammaa][main_pal[t][0]];
- std_pal[t][1]=gamcor[gammaa][main_pal[t][1]];
- std_pal[t][2]=gamcor[gammaa][main_pal[t][2]];
- }
- VP_setall(std_pal);
-}
-
void myrandomize(void);
-byte bright[256];
-
int main(int argc, char *argv[]) {
if (SDL_Init(SDL_INIT_VIDEO)<0) ERR_failinit("Unable to init SDL: %s\n", SDL_GetError());
SDL_WM_SetCaption("Doom 2D v1.351", "Doom 2D");
F_initwads();
M_startup();
F_allocres();
- F_loadres(F_getresid("PLAYPAL"),main_pal,0,768);
- for(i=0;i<256;++i)
- bright[i]=((int)main_pal[i][0]+main_pal[i][1]+main_pal[i][2])*8/(63*3);
- F_loadres(F_getresid("MIXMAP"),mixmap,0,0x10000);
- F_loadres(F_getresid("COLORMAP"),clrmap,0,256*12);
G_init();
- R_alloc();
K_init();
logo("S_init: настройка звука\n");
S_init();
S_initmusic();
- logo("V_init: настройка видео\n");
- if(V_init()!=0) ERR_failinit("Не могу установить видеорежим VGA");
- setgamma(gammaa);
- V_setscr(scrbuf);
+ R_init();
GM_init();
- F_loadmus("MENU");S_startmusic(0);
+ F_loadmus("MENU");
+ S_startmusic(0);
Uint32 ticks = 0;
for(;;) {
G_act();
- G_draw();
+ R_draw();
Uint32 t;
while ((t = SDL_GetTicks())-ticks < DELAY) {
#include <stdlib.h>
#include "files.h"
#include "memory.h"
-#include "vga.h"
#include "error.h"
#include "keyb.h"
#include "sound.h"
static snd_t *voc=NULL;
static int voc_ch=0;
+extern byte shot_vga; // config.c
+
void GMV_stop(void) {
if(voc) {
if(voc_ch) {S_stop(voc_ch);voc_ch=0;}
case CANCEL:
GM_set(NULL);break;
case INTERP:
- fullscreen=!fullscreen;
- V_toggle();
+ R_toggle_fullscreen();
GM_set(mnu);
break;
case MUSIC:
S_volumemusic(mus_vol-8);break;
case MVOLP:
S_volumemusic(mus_vol+8);break;
- case GAMMAM: setgamma(gammaa-1);break;
- case GAMMAP: setgamma(gammaa+1);break;
+ case GAMMAM:
+ R_setgamma(R_getgamma() - 1);
+ break;
+ case GAMMAP:
+ R_setgamma(R_getgamma() + 1);
+ break;
}
}
return 0;
}
-extern vgapal main_pal,std_pal;
-extern byte shot_vga;
-
static void shot(void) {
static int num=1;
char fn[100];//...
#include <stdlib.h>
#include "files.h"
#include "memory.h"
-#include "vga.h"
#include "sound.h"
#include "view.h"
#include "bmap.h"
#include "glob.h"
#include <stdlib.h>
#include <string.h>
-#include "vga.h"
#include "files.h"
#include "view.h"
#include "bmap.h"
#include "glob.h"
#include <stdlib.h>
#include <string.h>
-#include "vga.h"
#include "keyb.h"
#include "view.h"
#include "dots.h"
static int prx = 0, pry = 0;
// menu
static vgaimg *msklh[2], *mbarl, *mbarm, *mbarr, *mbaro, *mslotl, *mslotm, *mslotr;
+// low level
+static int gammaa = 0;
+static char main_pal[256][3];
+static char std_pal[256][3];
+static byte gamcor[5][64]={
+ #include "gamma.dat"
+};
-extern byte clrmap[256*12]; // main.c
+extern byte bright[256]; // vga.c
+extern byte mixmap[256][256]; // vga.c
+extern byte clrmap[256*12]; // vga.c
extern int g_trans; // game.c
extern byte transdraw; // game.c
Z_gotoxy(255, y + 15); Z_printbf("%u.%u", t / 10, t % 10);
}
-void G_draw (void) {
+void R_draw (void) {
int h;
word hr, mn, sc;
if (g_trans && !transdraw) {
void R_alloc (void) {
int i, j, n;
char s[10];
+ logo("R_alloc: загрузка графики\n");
// game
scrnh[0] = V_loadvgaimg("TITLEPIC");
scrnh[1] = V_loadvgaimg("INTERPIC");
mslotm = V_loadvgaimg("M_LSCNTR");
mslotr = V_loadvgaimg("M_LSRGHT");
}
+
+void R_setgamma(int g) {
+ int t;
+ g = g < 0 ? 0 : (g > 4 ? 4 : g);
+ gammaa = g;
+ for (t = 0; t < 256; ++t) {
+ std_pal[t][0]=gamcor[gammaa][main_pal[t][0]];
+ std_pal[t][1]=gamcor[gammaa][main_pal[t][1]];
+ std_pal[t][2]=gamcor[gammaa][main_pal[t][2]];
+ }
+ VP_setall(std_pal);
+}
+
+int R_getgamma (void) {
+ return gammaa;
+}
+
+void R_toggle_fullscreen (void) {
+ fullscreen = !fullscreen;
+ V_toggle();
+}
+
+void R_init () {
+ int i;
+ F_loadres(F_getresid("PLAYPAL"), main_pal, 0, 768);
+ for (i = 0; i < 256; ++i) {
+ bright[i] = ((int) main_pal[i][0] + main_pal[i][1] + main_pal[i][2]) * 8 / (63 * 3);
+ }
+ F_loadres(F_getresid("MIXMAP"), mixmap, 0, 0x10000);
+ F_loadres(F_getresid("COLORMAP"), clrmap, 0, 256*12);
+ logo("V_init: настройка видео\n");
+ if (V_init() != 0) {
+ ERR_failinit("Не могу установить видеорежим VGA");
+ }
+ //R_setgamma(gammaa);
+ V_setrect(0, SCRW, 0, SCRH);
+ V_setscr(scrbuf);
+ V_clr(0, SCRW, 0, SCRH, 0);
+ R_alloc();
+}
+
+void R_done (void) {
+ V_done();
+}
-void G_draw (void);
+void R_draw (void);
void R_alloc (void);
+void R_init (void);
+void R_done (void);
+
+void R_setgamma (int g);
+int R_getgamma (void);
+void R_toggle_fullscreen (void);
#include "glob.h"
#include <stdlib.h>
-#include "vga.h"
#include "view.h"
#include "smoke.h"
#include "fx.h"
static void *burnsnd;
static int burntm=0;
-byte flametab[16]={
-0xBC,0xBA,0xB8,0xB6,0xB4,0xB2,0xB0,0xD5,0xD6,0xD7,0xA1,0xA0,0xE3,0xE2,0xE1,0xE0
-};
-
void SMK_savegame (FILE *h) {
int i, n;
for (i = n = 0; i < MAXSMOK; ++i) {
char fullscreen = OFF;
+byte bright[256];
+byte mixmap[256][256];
+byte clrmap[256*12];
+
+static byte flametab[16] = {
+ 0xBC,0xBA,0xB8,0xB6,0xB4,0xB2,0xB0,0xD5,0xD6,0xD7,0xA1,0xA0,0xE3,0xE2,0xE1,0xE0
+};
+
+extern void *walp[256];
+
#define HQ 2
vgaimg *V_getvgaimg (int id) {
putpixel(x,y,c);
}
-
-extern byte bright[256];
-extern byte flametab[16];
-extern byte mixmap[256][256];
-
void smoke_sprf(int x, int y, byte c)
{
byte t = getpixel(x,y);
mappixel(cx,cy,cmap);
}
-extern void *walp[256];
-extern byte clrmap[256*12];
-
void Z_drawfld (byte *fld, int bg)
{
byte *p = fld;
extern map_block_t blk;
-extern byte clrmap[256*12];
void V_remap_rect(int,int,int,int,byte *);
byte w_horiz=ON;