From 57188b9136b75c46693b8f26b5c286c12583f2d6 Mon Sep 17 00:00:00 2001 From: Andriy Shinkarchuck Date: Sun, 24 Jul 2011 19:52:46 +0300 Subject: [PATCH] anim.c moved to repo. Added license notification --- anim.c | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100755 anim.c diff --git a/anim.c b/anim.c new file mode 100755 index 0000000..39bb63c --- /dev/null +++ b/anim.c @@ -0,0 +1,106 @@ +/* + 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 +*/ + +#include "glob.h" +#include +#include +#include +//#include +#include "error.h" + +enum{AB_END,AB_SCREEN,AB_UPDATE}; + +typedef struct{ + short t,st; + unsigned len; +}anm_blk_t; + +#define SQ 4 + +static byte cnum[256]; + +static void init_cpack(void) { + int i; + + for(i=0;i<256;++i) cnum[i]=i; +} + +static byte cpack(byte n) { + byte c; + + c=cnum[n]; + if(n) memmove(cnum+1,cnum,n); + cnum[0]=c; + return c; +} + +static byte *unpack(byte *d,byte *s,int l) { + for(;l>0;--l,++d,++s) { + if(*s==0) {memset(d,cpack(0),(dword)(*(++s))+1);d+=(dword)*s;l-=(dword)*s;} + else *d=cpack(*s); + } + return s; +} + +static byte *line(int y,byte *u) { + int x,n,sy; + + for(x=0;xt==AB_END) return 0; + switch(anm->t) { + case AB_SCREEN: + unpack(scra,(byte*)(anm+1),64000); + break; + case AB_UPDATE: + for(u=(byte*)(anm+1),y=0;y<200/SQ;) + if(*u&0x80) { + for(x=(*u&0x7F)+1,++u;x;--x,++y) + u=line(y*320*SQ,u); + }else{y+=*u+1;++u;} + break; + default: ERR_fatal("«®å®© ANM-ä ©«"); + } + anm=((anm_blk_t*)((byte*)anm+anm->len))+1; + if(anm->t==AB_END) return 0; + return 1; +} -- 2.29.2