summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 534310c)
raw | patch | inline | side by side (parent: 534310c)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Fri, 13 Mar 2020 08:06:29 +0000 (11:06 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Fri, 13 Mar 2020 08:06:29 +0000 (11:06 +0300) |
18 files changed:
src/a8.c | patch | blob | history | |
src/config.c | patch | blob | history | |
src/dots.c | patch | blob | history | |
src/error.c | patch | blob | history | |
src/fx.c | patch | blob | history | |
src/game.c | patch | blob | history | |
src/glob.h | patch | blob | history | |
src/keyb.c | patch | blob | history | |
src/main.c | patch | blob | history | |
src/menu.c | patch | blob | history | |
src/miscc.c | patch | blob | history | |
src/monster.c | patch | blob | history | |
src/player.c | patch | blob | history | |
src/render.c | patch | blob | history | |
src/render.h | patch | blob | history | |
src/smoke.c | patch | blob | history | |
src/vga.c | patch | blob | history | |
src/view.c | patch | blob | history |
diff --git a/src/a8.c b/src/a8.c
index 889e55048728f90171a3dde788e2ddd2c0e9b7fe..2203b5226ac0fc5e578f840366c5d632e98c7429 100644 (file)
--- a/src/a8.c
+++ b/src/a8.c
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
diff --git a/src/config.c b/src/config.c
index 2bf7f731dfac80c223640c4cbb8faa794be4ba6d..9ad78cb2037bc09deb995d76d6258b07fc9f0ff2 100644 (file)
--- a/src/config.c
+++ b/src/config.c
#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},
diff --git a/src/dots.c b/src/dots.c
index 8b4bb8e2059c559e6b7be6866b0b5cc8454e7068..af54e3a612ad523d940533a34e636635f990164b 100644 (file)
--- a/src/dots.c
+++ b/src/dots.c
#include "glob.h"
#include <stdlib.h>
-#include "vga.h"
#include "view.h"
#include "dots.h"
#include "misc.h"
diff --git a/src/error.c b/src/error.c
index 0e3e2afebbe0c5978cf3bbbc931fd52a1f7e3b72..ef9c388774b7c453b30ffb65dd63be6bb80edfc4 100644 (file)
--- a/src/error.c
+++ b/src/error.c
#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)))
diff --git a/src/fx.c b/src/fx.c
index 2af618046ee74b2a76b8f923ddc749d00d7a5be7..35777aca9371d9abf7ba57965722bcc8181e046b 100644 (file)
--- a/src/fx.c
+++ b/src/fx.c
#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) {
diff --git a/src/game.c b/src/game.c
index a8edfc2a6dc3bd2422c1f61be37b8a81cc0d45ea..8027592605e60c8454e48d4dc2afe1373ac100a6 100644 (file)
--- a/src/game.c
+++ b/src/game.c
#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;
diff --git a/src/glob.h b/src/glob.h
index 771bb419471f6be968a54c7dfe32672dd9e17ebf..b68f4b662457e4c2ad20bf9e55cd0a21c7146c02 100644 (file)
--- a/src/glob.h
+++ b/src/glob.h
void logo(const char *,...);
void logo_gas(int,int);
-extern int gammaa;
extern int snd_card;
extern int _cpu;
diff --git a/src/keyb.c b/src/keyb.c
index b0b245c9af3118760d0ad3c3fb7b03ed601c9a3c..4123c071937eac0ee8baab22982c4c38b065b393 100644 (file)
--- a/src/keyb.c
+++ b/src/keyb.c
*/
#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);
}
diff --git a/src/main.c b/src/main.c
index ceba8877cee66ffcd752e83428c160f18dc918d5..7bd73d4fed4f91cab282c2f9fbaaef67077ee0bb 100644 (file)
--- a/src/main.c
+++ b/src/main.c
#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) {
diff --git a/src/menu.c b/src/menu.c
index 415b68db2cd5be0acaab2c6c7bee7175bd017ef9..a934da7e6e0278ca9ce2de71a8e5b2fadef4f2d3 100644 (file)
--- a/src/menu.c
+++ b/src/menu.c
#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];//...
diff --git a/src/miscc.c b/src/miscc.c
index a174237c69947cfc2cb22e2ec2ce45349399c7e7..7c69aeab6ac4e48e168747732a49982b4a17e05b 100644 (file)
--- a/src/miscc.c
+++ b/src/miscc.c
#include <stdlib.h>
#include "files.h"
#include "memory.h"
-#include "vga.h"
#include "sound.h"
#include "view.h"
#include "bmap.h"
diff --git a/src/monster.c b/src/monster.c
index 935b5c608faaf56cc6e27ddf7031976e27a699e5..1357446b1dd45abbffc46d0ee6709d2fd2c8a467 100644 (file)
--- a/src/monster.c
+++ b/src/monster.c
#include "glob.h"
#include <stdlib.h>
#include <string.h>
-#include "vga.h"
#include "files.h"
#include "view.h"
#include "bmap.h"
diff --git a/src/player.c b/src/player.c
index fe4fe42aa28e7bb9b9a9b0611d8feb029a6bd6e8..7a693ac959eb2829f5bb0166e194f7e452b063da 100644 (file)
--- a/src/player.c
+++ b/src/player.c
#include "glob.h"
#include <stdlib.h>
#include <string.h>
-#include "vga.h"
#include "keyb.h"
#include "view.h"
#include "dots.h"
diff --git a/src/render.c b/src/render.c
index 67cfef4608605a425b8c4c1261017b63f77c6e68..c5494a41757ba3d9fed7ed303a65747528dc8042 100644 (file)
--- a/src/render.c
+++ b/src/render.c
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();
+}
diff --git a/src/render.h b/src/render.h
index 4f16eb3f4c0a3c843f77be9575a7579c80c052ec..8026af7f588f92042dd2e92a2abb820fe6bb95d5 100644 (file)
--- a/src/render.h
+++ b/src/render.h
-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);
diff --git a/src/smoke.c b/src/smoke.c
index 15961599ebbe65185f948a3b331efa06fdbc97e3..6ccb15a11511c6ad9297cd09d67cdd821ce3e927 100644 (file)
--- a/src/smoke.c
+++ b/src/smoke.c
#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) {
diff --git a/src/vga.c b/src/vga.c
index 3b4e06516a2794a295fba2e6f9fe641782123d29..21e8b4c363c99b63bb81b169c79fd59aa9ce8cdb 100644 (file)
--- a/src/vga.c
+++ b/src/vga.c
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;
diff --git a/src/view.c b/src/view.c
index b6b52c88df9a29f0ab3f1d47b00d5b8b58fca44c..0c274fc81103c55d5cdfc8970f22a79177996156 100644 (file)
--- a/src/view.c
+++ b/src/view.c
extern map_block_t blk;
-extern byte clrmap[256*12];
void V_remap_rect(int,int,int,int,byte *);
byte w_horiz=ON;