1 //============================================================================
2 //
3 //   SSSS    tt          lll  lll
4 //  SS  SS   tt           ll   ll
5 //  SS     tttttt  eeee   ll   ll   aaaa
6 //   SSSS    tt   ee  ee  ll   ll      aa
7 //      SS   tt   eeeeee  ll   ll   aaaaa  --  "An Atari 2600 VCS Emulator"
8 //  SS  SS   tt   ee      ll   ll  aa  aa
9 //   SSSS     ttt  eeeee llll llll  aaaaa
10 //
11 // Copyright (c) 1995-2021 by Bradford W. Mott, Stephen Anthony
12 // and the Stella Team
13 //
14 // See the file "License.txt" for information on usage and redistribution of
15 // this file, and for a DISCLAIMER OF ALL WARRANTIES.
16 //============================================================================
17 
18 #include "DrawCounterDecodes.hxx"
19 
20 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
playerDecodes() const21 const uInt8* const* DrawCounterDecodes::playerDecodes() const
22 {
23   return myPlayerDecodes;
24 }
25 
26 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
missileDecodes() const27 const uInt8* const* DrawCounterDecodes::missileDecodes() const
28 {
29   return myMissileDecodes;
30 }
31 
32 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
get()33 DrawCounterDecodes& DrawCounterDecodes::DrawCounterDecodes::get()
34 {
35   return myInstance;
36 }
37 
38 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DrawCounterDecodes()39 DrawCounterDecodes::DrawCounterDecodes()
40 {
41   uInt8 *decodeTables[] = {myDecodes0, myDecodes1, myDecodes2, myDecodes3, myDecodes4, myDecodes6};
42 
43   for (uInt8 *decodes : decodeTables)
44   {
45     memset(decodes, 0, 160);              // TJ: magic number 160 = pixel/scanline
46     decodes[156] = 1;                     // TJ: set for all copy pattern (first copy)
47   }
48 
49   myDecodes1[12] = 2;                     // TJ: two copies close (+16)
50   myDecodes2[28] = 2;                     // TJ: two copies med (+32)
51   myDecodes3[12] = 2; myDecodes3[28] = 3; // TJ: three copies close (+16, +32)
52   myDecodes4[60] = 2;                     // TJ: two copies wide (+64)
53   myDecodes6[28] = 2; myDecodes6[60] = 3; // TJ: three copies medium (+32, +64)
54 
55   // TJ: assigning decodes to players
56   myPlayerDecodes[0] = myDecodes0;
57   myPlayerDecodes[1] = myDecodes1;
58   myPlayerDecodes[2] = myDecodes2;
59   myPlayerDecodes[3] = myDecodes3;
60   myPlayerDecodes[4] = myDecodes4;
61   myPlayerDecodes[5] = myDecodes0;
62   myPlayerDecodes[6] = myDecodes6;
63   myPlayerDecodes[7] = myDecodes0;
64 
65   // TJ: assigning decodes to missiles
66   myMissileDecodes[0] = myDecodes0;
67   myMissileDecodes[1] = myDecodes1;
68   myMissileDecodes[2] = myDecodes2;
69   myMissileDecodes[3] = myDecodes3;
70   myMissileDecodes[4] = myDecodes4;
71   myMissileDecodes[5] = myDecodes0;
72   myMissileDecodes[6] = myDecodes6;
73   myMissileDecodes[7] = myDecodes0;
74 }
75 
76 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
77 DrawCounterDecodes DrawCounterDecodes::myInstance;
78