fix zapper in newppu, fix right mouse click = shoot offscreen, and fix right mouse button not working for zapper under any circumstances in win32
This commit is contained in:
parent
ef2f43449b
commit
dec0608adf
|
@ -1303,6 +1303,10 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
||||||
ClientToScreen(hAppWnd, (LPPOINT) &pt); //Convert client area x,y to screen x,y
|
ClientToScreen(hAppWnd, (LPPOINT) &pt); //Convert client area x,y to screen x,y
|
||||||
TrackPopupMenu(hfceuxcontextsub,0,(pt.x),(pt.y),TPM_RIGHTBUTTON,hWnd,0); //Create menu
|
TrackPopupMenu(hfceuxcontextsub,0,(pt.x),(pt.y),TPM_RIGHTBUTTON,hWnd,0); //Create menu
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mouseb=wParam;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_MOVE:
|
case WM_MOVE:
|
||||||
|
|
|
@ -76,16 +76,52 @@ static void ZapperFrapper(int w, uint8 *bg, uint8 *spr, uint32 linets, int final
|
||||||
}
|
}
|
||||||
endo:
|
endo:
|
||||||
ZD[w].zappo=final;
|
ZD[w].zappo=final;
|
||||||
|
|
||||||
|
//if this was a miss, clear out the hit
|
||||||
|
if(ZD[w].mzb&2)
|
||||||
|
ZD[w].zaphit=0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE int CheckColor(int w)
|
static INLINE int CheckColor(int w)
|
||||||
{
|
{
|
||||||
FCEUPPU_LineUpdate();
|
FCEUPPU_LineUpdate();
|
||||||
|
|
||||||
if((ZD[w].zaphit+100)>=(timestampbase+timestamp)
|
if(newppu)
|
||||||
&& !(ZD[w].mzb&2)) return(0);
|
{
|
||||||
|
int x = (int)ZD[w].mzx;
|
||||||
|
int y = (int)ZD[w].mzy;
|
||||||
|
int b = (int)ZD[w].mzb;
|
||||||
|
bool block = (b&2)!=0;
|
||||||
|
|
||||||
return(1);
|
int mousetime = y*256+x;
|
||||||
|
int nowtime = scanline*256 + g_rasterpos;
|
||||||
|
|
||||||
|
if(!block && mousetime < nowtime && mousetime >= nowtime - 384)
|
||||||
|
{
|
||||||
|
extern uint8 *XBuf;
|
||||||
|
uint8 *pix = XBuf+(ZD[w].mzy<<8);
|
||||||
|
uint8 a1 = pix[ZD[w].mzx];
|
||||||
|
a1&=63;
|
||||||
|
uint32 sum=palo[a1].r+palo[a1].g+palo[a1].b;
|
||||||
|
//return ZD[w].zaphit = sum != 0;
|
||||||
|
ZD[w].zaphit = (sum>=100*3)?1:0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ZD[w].zaphit = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ZD[w].zaphit?0:1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if((ZD[w].zaphit+100)>=(timestampbase+timestamp))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8 ReadZapperVS(int w)
|
static uint8 ReadZapperVS(int w)
|
||||||
|
@ -133,14 +169,25 @@ static void UpdateZapper(int w, void *data, int arg)
|
||||||
{
|
{
|
||||||
uint32 *ptr=(uint32 *)data;
|
uint32 *ptr=(uint32 *)data;
|
||||||
|
|
||||||
if(ZD[w].bogo)
|
bool newclicked = (ptr[2]&3)!=0;
|
||||||
ZD[w].bogo--;
|
bool oldclicked = (ZD[w].lastInput)!=0;
|
||||||
if(ptr[2]&3 && (!(ZD[w].mzb&3)))
|
|
||||||
ZD[w].bogo=5;
|
if(ZD[w].bogo)
|
||||||
|
{
|
||||||
|
ZD[w].bogo--;
|
||||||
|
}
|
||||||
|
|
||||||
|
ZD[w].lastInput = ptr[2]&3;
|
||||||
|
|
||||||
|
//woah.. this looks like broken bit logic.
|
||||||
|
if(newclicked && !oldclicked)
|
||||||
|
{
|
||||||
|
ZD[w].bogo=5;
|
||||||
|
ZD[w].mzb=ptr[2];
|
||||||
|
ZD[w].mzx=ptr[0];
|
||||||
|
ZD[w].mzy=ptr[1];
|
||||||
|
}
|
||||||
|
|
||||||
ZD[w].mzx=ptr[0];
|
|
||||||
ZD[w].mzy=ptr[1];
|
|
||||||
ZD[w].mzb=ptr[2];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LogZapper(int w, MovieRecord* mr)
|
static void LogZapper(int w, MovieRecord* mr)
|
||||||
|
|
|
@ -10,6 +10,7 @@ struct ZAPPER
|
||||||
uint8 bogo;
|
uint8 bogo;
|
||||||
int zappo;
|
int zappo;
|
||||||
uint64 zaphit;
|
uint64 zaphit;
|
||||||
|
uint32 lastInput;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -345,6 +345,7 @@ static int maxsprites=8;
|
||||||
|
|
||||||
//scanline is equal to the current visible scanline we're on.
|
//scanline is equal to the current visible scanline we're on.
|
||||||
int scanline;
|
int scanline;
|
||||||
|
int g_rasterpos;
|
||||||
static uint32 scanlines_per_frame;
|
static uint32 scanlines_per_frame;
|
||||||
|
|
||||||
uint8 PPU[4];
|
uint8 PPU[4];
|
||||||
|
@ -2244,6 +2245,7 @@ int FCEUX_PPU_Loop(int skip) {
|
||||||
for(int sl=0;sl<241;sl++) {
|
for(int sl=0;sl<241;sl++) {
|
||||||
spr_read.start_scanline();
|
spr_read.start_scanline();
|
||||||
|
|
||||||
|
g_rasterpos = 0;
|
||||||
ppur.status.sl = sl;
|
ppur.status.sl = sl;
|
||||||
|
|
||||||
const int yp = sl-1;
|
const int yp = sl-1;
|
||||||
|
@ -2270,7 +2272,6 @@ int FCEUX_PPU_Loop(int skip) {
|
||||||
for(int xt=0;xt<32;xt++) {
|
for(int xt=0;xt<32;xt++) {
|
||||||
bgdata.main[xt+2].Read();
|
bgdata.main[xt+2].Read();
|
||||||
|
|
||||||
|
|
||||||
//ok, we're also going to draw here.
|
//ok, we're also going to draw here.
|
||||||
//unless we're on the first dummy scanline
|
//unless we're on the first dummy scanline
|
||||||
if(sl != 0) {
|
if(sl != 0) {
|
||||||
|
@ -2283,7 +2284,7 @@ int FCEUX_PPU_Loop(int skip) {
|
||||||
//check all the conditions that can cause things to render in these 8px
|
//check all the conditions that can cause things to render in these 8px
|
||||||
const bool renderspritenow = SpriteON && rendersprites && (xt>0 || SpriteLeft8);
|
const bool renderspritenow = SpriteON && rendersprites && (xt>0 || SpriteLeft8);
|
||||||
const bool renderbgnow = ScreenON && renderbg && (xt>0 || BGLeft8);
|
const bool renderbgnow = ScreenON && renderbg && (xt>0 || BGLeft8);
|
||||||
for(int xp=0;xp<8;xp++,rasterpos++) {
|
for(int xp=0;xp<8;xp++,rasterpos++,g_rasterpos++) {
|
||||||
|
|
||||||
//bg pos is different from raster pos due to its offsetability.
|
//bg pos is different from raster pos due to its offsetability.
|
||||||
//so adjust for that here
|
//so adjust for that here
|
||||||
|
@ -2518,7 +2519,8 @@ int FCEUX_PPU_Loop(int skip) {
|
||||||
//first one on every second frame, then this delay simply doesn't exist.
|
//first one on every second frame, then this delay simply doesn't exist.
|
||||||
if (ppur.status.end_cycle == 341)
|
if (ppur.status.end_cycle == 341)
|
||||||
runppu(1);
|
runppu(1);
|
||||||
}
|
|
||||||
|
} //scanline loop
|
||||||
|
|
||||||
if(MMC5Hack && PPUON) MMC5_hb(240);
|
if(MMC5Hack && PPUON) MMC5_hb(240);
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ extern uint8 FASTCALL FFCEUX_PPURead_Default(uint32 A);
|
||||||
void FFCEUX_PPUWrite_Default(uint32 A, uint8 V);
|
void FFCEUX_PPUWrite_Default(uint32 A, uint8 V);
|
||||||
|
|
||||||
extern int scanline;
|
extern int scanline;
|
||||||
|
extern int g_rasterpos;
|
||||||
extern uint8 PPU[4];
|
extern uint8 PPU[4];
|
||||||
|
|
||||||
enum PPUPHASE {
|
enum PPUPHASE {
|
||||||
|
|
Loading…
Reference in New Issue