1 /* FCE Ultra - NES/Famicom Emulator
3 * Copyright notice for this file:
4 * Copyright (C) 2002 Xodnizel
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) ZapperFrapper(int w, uint8 *bg, uint8 *spr, uint32 linets, int final)
41 if(!bg) // New line, so reset stuff.
54 if(scanline>=(zy-4) && scanline<=(zy+4))
60 if(xs<=(zx+4) && xs>=(zx-4))
68 if(!(a2&0x40) || (a1&64))
73 sum=palo[a1].r+palo[a1].g+palo[a1].b;
76 ZD[w].zaphit=((uint64)linets+(xs+16)*(PAL?15:16))/48+timestampbase;
87 static INLINE int CheckColor(int w)
89 //FCEUPPU_LineUpdate();
91 if((ZD[w].zaphit+100)>=(timestampbase+timestamp)
92 && !(ZD[w].mzb&2)) return(0);
97 static uint8 FP_FASTAPASS(1) ReadZapperVS(int w)
101 if(ZD[w].zap_readbit==4) ret=1;
103 if(ZD[w].zap_readbit==7)
108 if(ZD[w].zap_readbit==6)
118 static void FP_FASTAPASS(1) StrobeZapperVS(int w)
123 static uint8 FP_FASTAPASS(1) ReadZapper(int w)
133 static void FASTAPASS(3) DrawZapper(int w, uint8 *buf, int arg)
136 FCEU_DrawGunSight(buf, ZD[w].mzx,ZD[w].mzy);
139 static void FP_FASTAPASS(3) UpdateZapper(int w, void *data, int arg)
141 uint32 *ptr=(uint32 *)data;
143 //FCEU_DispMessage("%3d:%3d",ZD[w].mzx,ZD[w].mzy);
146 if(ptr[2]&3 && (!(ZD[w].mzb&3)))
154 static INPUTC ZAPC={ReadZapper,0,0,UpdateZapper,ZapperFrapper,DrawZapper};
155 static INPUTC ZAPVSC={ReadZapperVS,0,StrobeZapperVS,UpdateZapper,ZapperFrapper,DrawZapper};
157 INPUTC *FCEU_InitZapper(int w)
159 memset(&ZD[w],0,sizeof(ZAPPER));
160 if(FCEUGameInfo.type == GIT_VSUNI)