~ubuntu-branches/debian/experimental/mednafen/experimental

« back to all changes in this revision

Viewing changes to src/nes/input/zapper.cpp

  • Committer: Package Import Robot
  • Author(s): Stephen Kitt
  • Date: 2014-11-08 11:36:07 UTC
  • mfrom: (1.2.18) (10.1.16 sid)
  • Revision ID: package-import@ubuntu.com-20141108113607-3lbwsamqqhrso4hp
Tags: 0.9.36.5-1
* New upstream release, uploaded to expermiental for the Jessie freeze.
* Standards-Version 3.9.6, no change required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 
31
31
static ZAPPER ZD[2];
32
32
 
33
 
static void ZapperFrapper(int w, uint8 *bg, uint8 *spr, uint32 linets, int final)
 
33
static void ZapperFrapper(int w, uint8 *bg, uint32 linets, int final)
34
34
{
35
35
 int xs,xe;
36
36
 int zx,zy;
38
38
 xs=linets;
39
39
 xe=final;
40
40
 
41
 
 if(xe > 256) xe = 256;
 
41
 if(xe > 256)
 
42
  xe = 256;
 
43
 
42
44
 zx=ZD[w].mzx;
43
45
 zy=ZD[w].mzy;
44
46
 
50
52
    uint32 sum;
51
53
    if(xs<=(zx+4) && xs>=(zx-4))
52
54
    {
53
 
     a1=bg[xs];
54
 
     a1 &= 0x3F;
55
 
 
 
55
     a1 = bg[xs] & 0x3F;
56
56
     sum = ActiveNESPalette[a1].r + ActiveNESPalette[a1].g + ActiveNESPalette[a1].b;
 
57
 
57
58
     if(sum>=100*3)
58
59
     {
59
60
      ZD[w].zaphit = timestampbase + timestamp;
104
105
                return ret;
105
106
}
106
107
 
107
 
static void DrawZapper(int w, MDFN_Surface *surface)
 
108
static void DrawZapper(int w, uint8* pix, int pix_y)
108
109
{
109
 
 MDFN_DrawGunSight(surface, ZD[w].mzx, ZD[w].mzy);
 
110
 NESCURSOR_DrawGunSight(w, pix, pix_y, ZD[w].mzx, ZD[w].mzy);
110
111
}
111
112
 
112
113
static void UpdateZapper(int w, void *data)
113
114
{
114
115
 uint8 *data_8 = (uint8 *)data;
115
 
 uint32 new_x = (int32)MDFN_de32lsb(data_8 + 0) >> 16;
116
 
 uint32 new_y = (int32)MDFN_de32lsb(data_8 + 4) >> 16;
117
 
 uint8 new_b = *(uint8 *)(data_8 + 8);
118
 
 
119
 
 NESPPU_TranslateMouseXY(new_x, new_y);
 
116
 uint32 new_x = (int16)MDFN_de16lsb(data_8 + 0);
 
117
 uint32 new_y = (int16)MDFN_de16lsb(data_8 + 2);
 
118
 uint8 new_b = *(uint8 *)(data_8 + 4);
120
119
 
121
120
 if(ZD[w].bogo)
122
121
  ZD[w].bogo--;
123
122
 
124
 
 if(new_b&3 && (!(ZD[w].mzb&3)))
 
123
 if((new_b&3) && (!(ZD[w].mzb&3)))
125
124
  ZD[w].bogo=5;
126
125
 
127
126
 ZD[w].mzx = new_x;