X-Git-Url: https://deadsoftware.ru/gitweb?p=flatwaifu.git;a=blobdiff_plain;f=src%2Fmiscc.c;h=b2bbbaf585fc6b082e8350228a3cee7b2405acb0;hp=a174237c69947cfc2cb22e2ec2ce45349399c7e7;hb=ef16dea09f87b15fc6d58fae0aa0832e0648c00e;hpb=534310c1f131bb9a53be865c32d90342ed026734 diff --git a/src/miscc.c b/src/miscc.c index a174237..b2bbbaf 100644 --- a/src/miscc.c +++ b/src/miscc.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 @@ -27,26 +22,23 @@ #include #include "files.h" #include "memory.h" -#include "vga.h" #include "sound.h" #include "view.h" #include "bmap.h" #include "dots.h" #include "monster.h" #include "misc.h" +#include "render.h" //#define WD 200 //#define HT 98 #define MAX_YV 30 -extern dword walf[256]; - -byte z_dot=0; - -extern void *walp[256]; - +byte z_dot; +byte z_mon; static void *bulsnd[2]; +static byte wfront; int Z_sign(int a) { if(a>0) return 1; @@ -63,28 +55,22 @@ int Z_dec(int a,int b) { void *Z_getsnd(char n[6]) { char s[8]; - - //if(snd_type==-1) return NULL; - strncpy(s+2,n,6);s[0]='D'; - s[1]='S'; - - int id = F_getresid(s); - int loaded = M_was_locked(id); - snd_t *snd = M_lock(id); - if (snd != NULL && !loaded) { - snd->len = int2host(snd->len); - snd->rate = int2host(snd->rate); - snd->lstart = int2host(snd->lstart); - snd->llen = int2host(snd->llen); - } - return snd; + s[0] = 'D'; + s[1] = 'S'; + strncpy(&s[2], n, 6); + return S_load(s); } -int Z_sound(void *s,int v) { - //if(snd_type==-1) return 0; - if(!s) return 0; - S_play(s,-1,1024,v); - return F_getreslen(((int*)s)[-1])/605; +int Z_sound (void *s, int v) { + if (s != NULL) { + S_play(s, 0, v); + // TODO ??? + //S_play(s, -1, 1024, v); + //return F_getreslen(((int*)s)[-1])/605; + return 0; + } else { + return 0; + } } #define GAS_START (MN__LAST-MN_DEMON+5) @@ -111,7 +97,7 @@ int Z_canstand(int x,int y,int r) { return 0; } -int Z_hitceil(int x,int y,int r,int h) { +static int Z_hitceil(int x,int y,int r,int h) { int i; i=(x-r)/CELW; @@ -146,7 +132,7 @@ int Z_canfit(int x,int y,int r,int h) { return 1; } -int Z_inlift(int x,int y,int r,int h) { +static int Z_inlift(int x,int y,int r,int h) { int i,j,sx,sy; sx=(x-r)/CELW; @@ -163,7 +149,7 @@ int Z_inlift(int x,int y,int r,int h) { return 0; } -int Z_isblocked(int x,int y,int r,int h,int xv) { +static int Z_isblocked(int x,int y,int r,int h,int xv) { int i,j,sx,sy; sx=(x-r)/CELW; @@ -206,8 +192,6 @@ void Z_set_speed(obj_t *o,int s) { o->xv=o->xv*s/m;o->yv=o->yv*s/m; } -static byte wfront; - int Z_inwater(int x,int y,int r,int h) { int i,j,sx,sy; @@ -271,7 +255,7 @@ int Z_overlap(obj_t *a,obj_t *b) { return 1; } -void Z_kickobj(obj_t *o,int x,int y,int pwr) { +static void Z_kickobj(obj_t *o,int x,int y,int pwr) { int dx,dy,m; dx=o->x-x;dy=o->y-o->h/2-y; @@ -326,8 +310,6 @@ int Z_look(obj_t *a,obj_t *b,int d) { #define wvel(v) if((xv=abs(v)+1)>5) v=Z_dec(v,xv/2-2) -byte z_mon=0; - int Z_moveobj(obj_t *p) { static int x,y,xv,yv,r,h,lx,ly,st; static byte inw; @@ -390,10 +372,9 @@ int Z_moveobj(obj_t *p) { return st; } -void Z_splash(obj_t *p,int n) { - Z_sound(bulsnd[0],128); - DOT_water(p->x,p->y-p->h/2,p->xv+p->vx,p->yv+p->vy,n, - (intptr_t)walp[wfront]-1); +void Z_splash (obj_t *p, int n) { + Z_sound(bulsnd[0], 128); + DOT_water(p->x, p->y-p->h / 2, p->xv + p->vx, p->yv + p->vy, n, R_get_special_id(wfront) - 1); } void Z_calc_time(dword t,word *h,word *m,word *s) @@ -411,7 +392,7 @@ void Z_calc_time(dword t,word *h,word *m,word *s) #define SWAP_VAR(a, b) do { unsigned char t = a; a = b; b = t; } while(0) -int16_t short2swap (int16_t x) { +static int16_t short2swap (int16_t x) { union { uint8_t a[2]; int16_t x; @@ -421,7 +402,7 @@ int16_t short2swap (int16_t x) { return y.x; } -int32_t int2swap (int32_t x) { +static int32_t int2swap (int32_t x) { union { uint8_t a[4]; int32_t x;