Previous 199869 Revisions Next

r31833 Friday 29th August, 2014 at 19:57:02 UTC by Angelo Salese
Ported OG's fix in m68k based games. Seibu Cup Soccer players now turns around right, at the expense of being mostly without the head (!). SD Gundam has less erratic Homing Missiles and third mid-boss doesn't go to wonderland anymore.
[src/mame/machine]seicop.c

trunk/src/mame/machine/seicop.c
r31832r31833
22792279         break;
22802280
22812281      /* triggered before 0x6200 in Seibu Cup, looks like an angle value ... */
2282      case (0x01c/2): m_cop_angle_compare = INT8(m_cop_mcu_ram[0x1c/2]);  break;
2283      case (0x01e/2): m_cop_angle_mod_val = INT8(m_cop_mcu_ram[0x1e/2]); break;
2282      case (0x01c/2): m_cop_angle_compare = UINT16(m_cop_mcu_ram[0x1c/2]);  break;
2283      case (0x01e/2): m_cop_angle_mod_val = UINT16(m_cop_mcu_ram[0x1e/2]); break;
22842284
22852285      /* BCD Protection */
22862286      case (0x020/2):
r31832r31833
28102810         //(cupsoc)   | 8 | f3e7 | 6200 | 3a0 3a6 380 aa0 2a6
28112811         if(COP_CMD(0x3a0,0x3a6,0x380,0xaa0,0x2a6,0x000,0x000,0x000,8,0xf3e7))
28122812         {
2813            INT8 cur_angle;
2814
2813            UINT8 cur_angle;
2814            UINT16 flags;
2815           
28152816            /* 0 [1] */
28162817            /* 0xc [1] */
28172818            /* 0 [0] */
r31832r31833
28192820            /* 0xc [1] */
28202821
28212822            cur_angle = space.read_byte(m_cop_register[1] + (0xc ^ 3));
2823            flags = space.read_word(m_cop_register[1]);
28222824            //space.write_byte(m_cop_register[1] + (0^3),space.read_byte(m_cop_register[1] + (0^3)) & 0xfb); //correct?
28232825
2824            if(cur_angle >= m_cop_angle_compare)
2826            m_cop_angle_compare &= 0xff;
2827            m_cop_angle_mod_val &= 0xff;
2828            flags &= 0x04;           
2829           
2830            int delta = cur_angle - m_cop_angle_compare;
2831            if(delta >= 128)
2832               delta -= 256;
2833            else if(delta < -128)
2834               delta += 256;
2835            if(delta < 0)
28252836            {
2826               cur_angle -= m_cop_angle_mod_val;
2827               if(cur_angle <= m_cop_angle_compare)
2837               if(delta >= -m_cop_angle_mod_val)
28282838               {
28292839                  cur_angle = m_cop_angle_compare;
2830                  //space.write_byte(m_cop_register[1] + (0^3),space.read_byte(m_cop_register[1] + (0^3)) | 2);
2831               }
2832            }
2833            else if(cur_angle <= m_cop_angle_compare)
2840                  flags |= 0x0004;
2841               }
2842               else
2843                  cur_angle += m_cop_angle_mod_val;
2844            }
2845            else
28342846            {
2835               cur_angle += m_cop_angle_mod_val;
2836               if(cur_angle >= m_cop_angle_compare)
2847               if(delta <= m_cop_angle_mod_val)
28372848               {
28382849                  cur_angle = m_cop_angle_compare;
2839                  //space.write_byte(m_cop_register[1] + (0^3),space.read_byte(m_cop_register[1] + (0^3)) | 2);
2840               }
2850                  flags |= 0x0004;
2851               }
2852               else
2853                  cur_angle -= m_cop_angle_mod_val;
28412854            }
28422855
2856            space.write_byte(m_cop_register[1] + (0 ^ 2),flags);
28432857            space.write_byte(m_cop_register[1] + (0xc ^ 3),cur_angle);
28442858            return;
28452859         }
r31832r31833
28492863         /* FIXME: still doesn't work ... */
28502864         if(COP_CMD(0x380,0x39a,0x380,0xa80,0x29a,0x000,0x000,0x000,8,0xf3e7))
28512865         {
2852            INT8 cur_angle;
2866            UINT8 cur_angle;
2867            UINT16 flags;
2868           
2869            cur_angle = space.read_byte(m_cop_register[0] + (0x34 ^ 3));
2870            flags = space.read_word(m_cop_register[0] + (0 ^ 2));
2871            //space.write_byte(m_cop_register[1] + (0^3),space.read_byte(m_cop_register[1] + (0^3)) & 0xfb); //correct?
28532872
2854            cur_angle = INT8(space.read_byte(m_cop_register[0] + (0x34 ^ 3)));
2855            //space.write_byte(m_cop_register[0] + (0^3),space.read_byte(m_cop_register[0] + (0^3)) & 0xfb); //correct?
2856            /*
2857            0x00      0x00          0x60            0x00
2858            0x00      0x20          0x60            0x20
2859            0x00      0x40          0x60            0x60
2860            0x00      0x60          0x60            0x60
2861            0x00      0x80          0x60            0xa0
2862            0x00      0xa0          0x60            0xa0
2863            0x00      0xc0          0x60            0xc0
2864            0x00      0xe0          0x60            0xe0
2865            */
2866
2867            if(cur_angle > m_cop_angle_compare)
2873            m_cop_angle_compare &= 0xff;
2874            m_cop_angle_mod_val &= 0xff;
2875            flags &= 0x04;           
2876           
2877            int delta = cur_angle - m_cop_angle_compare;
2878            if(delta >= 128)
2879               delta -= 256;
2880            else if(delta < -128)
2881               delta += 256;
2882            if(delta < 0)
28682883            {
2869               cur_angle -= m_cop_angle_mod_val;
2870
2871               if(cur_angle < m_cop_angle_compare)
2884               if(delta >= -m_cop_angle_mod_val)
2885               {
28722886                  cur_angle = m_cop_angle_compare;
2873            }
2874            else if(cur_angle < m_cop_angle_compare)
2887                  flags |= 0x0004;
2888               }
2889               else
2890                  cur_angle += m_cop_angle_mod_val;
2891            }
2892            else
28752893            {
2876               cur_angle += m_cop_angle_mod_val;
2877
2878               if(cur_angle > m_cop_angle_compare)
2894               if(delta <= m_cop_angle_mod_val)
2895               {
28792896                  cur_angle = m_cop_angle_compare;
2897                  flags |= 0x0004;
2898               }
2899               else
2900                  cur_angle -= m_cop_angle_mod_val;
28802901            }
28812902
2882            space.write_byte(m_cop_register[0] + (0x34 ^ 3),cur_angle);
2903            space.write_byte(m_cop_register[0] + (0 ^ 3),flags);
2904            space.write_word(m_cop_register[0] + (0x34 ^ 3),cur_angle);
28832905            return;
28842906         }
28852907

Previous 199869 Revisions Next


© 1997-2024 The MAME Team