X-Git-Url: https://deadsoftware.ru/gitweb?p=flatwaifu.git;a=blobdiff_plain;f=src%2Fswitch.c;h=886bee934096b71df73538dbd69580096c898988;hp=cc418b8bc5287bf7291fe8612e680fe2ff9e6e83;hb=ef16dea09f87b15fc6d58fae0aa0832e0648c00e;hpb=8fb3d3f767b8e5d094e8bcbee350f4d16ab17c5a diff --git a/src/switch.c b/src/switch.c index cc418b8..886bee9 100644 --- a/src/switch.c +++ b/src/switch.c @@ -1,24 +1,19 @@ -/* - Copyright (C) Prikol Software 1996-1997 - Copyright (C) Aleksey Volynskov 1996-1997 - Copyright (C) 2011 - - This file is part of the Doom2D:Rembo project. - - Doom2D:Rembo is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 as - published by the Free Software Foundation. - - Doom2D:Rembo is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see or - write to the Free Software Foundation, Inc., - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ +/* Copyright (C) 1996-1997 Aleksey Volynskov + * Copyright (C) 2011 Rambo + * Copyright (C) 2020 SovietPony + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3 of the License ONLY. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "glob.h" #include @@ -28,59 +23,20 @@ #include "player.h" #include "misc.h" #include "map.h" - -#define MAXSW 100 - -extern map_block_t blk; - -#pragma pack(1) -typedef struct{ - byte x,y; - byte t,tm; - byte a,b,c,d; - byte f; -}sw_t; -#pragma pack() - -static sw_t sw[MAXSW]; - -static void *sndswn,*sndswx,*sndnoway,*sndbdo,*sndbdc,*sndnotele; -static int swsnd; +#include "files.h" +#include "game.h" +#include "my.h" +#include "monster.h" +#include "render.h" int sw_secrets; +sw_t sw[MAXSW]; -void SW_savegame(FILE* h) { - int n; - - for(n=MAXSW;--n;) if(sw[n].t) break; - ++n;myfwrite(&n,1,4,h);myfwrite(sw,1,n*sizeof(sw[0]),h); - myfwrite(&sw_secrets,1,4,h); -} - -void SW_loadgame(FILE* h) { - int n; - - myfread(&n,1,4,h);myfread(sw,1,n*sizeof(sw[0]),h); - myfread(&sw_secrets,1,4,h); -} - -int SW_load(FILE* h) { - int i; - - switch(blk.t) { - case MB_SWITCH2: - sw_secrets=0; - for(i=0;i0;++i,blk.sz-=sizeof(sw_t)) { - myfread(sw+i,1,sizeof(sw_t),h); - sw[i].tm=0;sw[i].d=0; - sw[i].f|=0x80; - if(sw[i].t==SW_SECRET) ++sw_secrets; - } - return 1; - }return 0; -} +static void *sndswn, *sndswx, *sndnoway, *sndbdo, *sndbdc, *sndnotele; +static int swsnd; +static byte cht, chto, chf, f_ch; -void SW_alloc(void) { +void SW_alloc (void) { sndswn=Z_getsnd("SWTCHN"); sndswx=Z_getsnd("SWTCHX"); sndnoway=Z_getsnd("NOWAY"); @@ -89,15 +45,14 @@ void SW_alloc(void) { sndnotele=Z_getsnd("NOTELE"); } -void SW_init(void) { +void SW_init (void) { int i; - - for(i=0;iy)>=FLDH*CELH+o->h) return; @@ -131,7 +86,7 @@ void Z_water_trap(obj_t *o) { } } -void Z_untrap(byte t) { +void Z_untrap (byte t) { byte *p; word n; @@ -170,7 +125,7 @@ static int shutdoor(int i) { return 1; } -void SW_act(void) { +void SW_act (void) { int i; if(swsnd) --swsnd; @@ -198,7 +153,7 @@ static int doortime(int t) { return 0; } -void SW_cheat_open(void) { +void SW_cheat_open (void) { int i; for(i=0;i