1 /* FCE Ultra - NES/Famicom Emulator
3 * Copyright notice for this file:
4 * Copyright (C) 2002 Ben Parnell
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
36 static void FP_FASTAPASS(3) ZapperThingy(int w, uint8 *buf, int line)
40 if(line==0) ZD[w].colok=1<<16; /* Disable it. */
42 ZD[w].coloklast=ZD[w].colok;
44 if(ZD[w].mzb&2) return;
45 if((line>=ZD[w].mzy-3 && line<=ZD[w].mzy+3) && mzx<256)
51 if((mzx+x)<0 || (mzx+x)>255) continue;
53 sum=palo[a].r+palo[a].g+palo[a].b;
57 ZD[w].colok=timestamp+mzx/3;
65 static INLINE int CheckColor(int w)
67 if( (timestamp>=ZD[w].coloklast && timestamp<=(ZD[w].coloklast+100)) ||
68 (timestamp>=ZD[w].colok && timestamp<=(ZD[w].colok+100)) )
73 static uint8 FP_FASTAPASS(1) ReadZapperVS(int w)
77 if(ZD[w].zap_readbit==4) ret=1;
79 if(ZD[w].zap_readbit==7)
84 if(ZD[w].zap_readbit==6)
93 static void FP_FASTAPASS(1) StrobeZapperVS(int w)
98 static uint8 FP_FASTAPASS(1) ReadZapper(int w)
108 static void FASTAPASS(3) DrawZapper(int w, uint8 *buf, int arg)
111 FCEU_DrawCursor(buf, ZD[w].mzx,ZD[w].mzy);
114 static void FP_FASTAPASS(3) UpdateZapper(int w, void *data, int arg)
120 if(ptr[2]&3 && (!(ZD[w].mzb&3)))
127 if(ZD[w].mzb&2 || ZD[w].mzx>=256 || ZD[w].mzy>=240)
131 static INPUTC ZAPC={ReadZapper,0,0,UpdateZapper,ZapperThingy,DrawZapper};
132 static INPUTC ZAPVSC={ReadZapperVS,0,StrobeZapperVS,UpdateZapper,ZapperThingy,DrawZapper};
134 INPUTC *FCEU_InitZapper(int w)
136 memset(&ZD[w],0,sizeof(ZAPPER));
137 if(FCEUGameInfo.type==GIT_VSUNI)