MCPcopy Create free account
hub / github.com/TASEmulators/fceux / CheckColor

Function CheckColor

src/input/zapper.cpp:86–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86static INLINE int CheckColor(int w)
87{
88 FCEUPPU_LineUpdate();
89
90 if(newppu)
91 {
92 int x = (int)ZD[w].mzx;
93 int y = (int)ZD[w].mzy;
94 int b = (int)ZD[w].mzb;
95 bool block = (b&2)!=0;
96
97 int mousetime = y*256+x;
98 int nowtime = scanline*256 + g_rasterpos;
99
100 if(!block && mousetime < nowtime && mousetime >= nowtime - 384)
101 {
102 extern uint8 *XBuf;
103 uint8 *pix = XBuf+(ZD[w].mzy<<8);
104 uint8 a1 = pix[ZD[w].mzx];
105 a1&=63;
106 uint32 sum=palo[a1].r+palo[a1].g+palo[a1].b;
107 //return ZD[w].zaphit = sum != 0;
108 ZD[w].zaphit = (sum>=100*3)?1:0;
109 }
110 else
111 {
112 ZD[w].zaphit = 0;
113 }
114
115 return ZD[w].zaphit?0:1;
116 }
117
118
119 if((ZD[w].zaphit+100)>=(timestampbase+timestamp))
120 {
121 return 0;
122 }
123
124 return 1;
125}
126
127static uint8 ReadZapperVS(int w)
128{

Callers 2

ReadZapperVSFunction · 0.70
ReadZapperFunction · 0.70

Calls 1

FCEUPPU_LineUpdateFunction · 0.85

Tested by

no test coverage detected