⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chasehq.c

📁 十七种模拟器源代码 非常有用的作课程设计不可缺少的
💻 C
📖 第 1 页 / 共 5 页
字号:
}void ExecuteChaseHQFrame(void){/*Analog Controls Description by WarlockRAINE is based on the upright deluxe version. I call it deluxe because it has a more expensive steering wheel, which behaves like the PC standard. This version is selectable by forcing dipswitches A1 and A2 to:A1 - HA2 - LMachine Input RAM MapAddress [0x022804] ------------------0 - Unknown1 - Unknown2 - Coin 13 - Coin 24 - Service5 - Analog Brake6 - Analog Brake7 - Analog BrakeAddress [0x022806] ------------------0 - Turbo1 - Tilt2 - Unknwown3 - P1 Start4 - Gear5 - Analog Accelerator6 - Analog Accelerator7 - Analog AcceleratorAddress [0x02281A]+[0x022818]  -----------------------------Steering WheelSteering Wheel Behaviour (Linear)---------------------------------256 possible statesFull Left  - FF80Half Left  - FFC0Center     - 0000Half Right - 0040Full Right - 0080Pedals Behaviour (Non-Linear)-----------------------------8 possible states(Speed - RAM)0 - 000xxxxx1 - 001xxxxx2 - 011xxxxx3 - 010xxxxx4 - 110xxxxx5 - 111xxxxx6 - 101xxxxx7 - 100xxxxx*/// Analog Controls Support by Warlock   static int accel,brake;   static int analog_mask[9] = { 0x00, 0x20, 0x60, 0x40, 0xC0, 0xE0, 0xA0, 0x80, 0x80 };   static int gear=0;   static int gearflip=0;/*----[Start of Gear Options]----*/// User requests arcade version gear controlif (RAM[0x022801] &0x01){ if(RAM_INPUT[0x20]!=0){RAM_INPUT[0x06] |= 0x10;}  else {RAM_INPUT[0x06] &= ~0x10;}}// User requests home version gear controlelse{   // Gear Control Hack   if(RAM_INPUT[0x20]!=0){      if(gearflip==0){         gearflip=1;         gear^=1;         if(gear==1) print_ingame(60,"Changed to High Gear");         else        print_ingame(60,"Changed to Low Gear");      }   }   else{      gearflip=0;   }   if(gear==1) RAM_INPUT[0x06] &= ~0x10;   else        RAM_INPUT[0x06] |=  0x10;  }/*----[End of Gear Options]----*//*----[Start of Steering Wheel Emulation]----*/// User requests Keyboard Controlif (RAM[0x022801] &0x02){   RAM_INPUT[0x18] |=  0x80;   RAM_INPUT[0x1A] |=  0x80;}// User requests Standard PC Joystick/Wheel Controlelse{   RAM_INPUT[0x18] =  joy[0].stick[0].axis[0].pos;   RAM_INPUT[0x1A] =  joy[0].stick[0].axis[0].pos>>8;}/*----[End of Steering Wheel Emulation]----*//*----[Start of Pedals Emulation]----*/// User requests Keyboard Accelerator Controlif (RAM[0x022801] &0x04){//Player presses accelerator on keyboard if (RAM[0x022807]) { RAM[0x022806]=(RAM[0x022806] & 0x1f) | 0x80;} else {RAM[0x022806]=(RAM[0x022806] & 0x1f) | 0x00;}}// User requests analog accelerator controlelse{accel=-joy[0].stick[0].axis[1].pos/16;if (accel >= 0) {RAM[0x022806] = ((RAM[0x022806] & 0x1f) | analog_mask[accel]);}}// User requests keyboard brake Controlif (RAM[0x022801] &0x08){//Player presses brake on keyboard if (RAM[0x022809]) { RAM[0x022804]=(RAM[0x022804] & 0x1f) | 0x80;} else {RAM[0x022804]=(RAM[0x022804] & 0x1f) | 0x00;}}// User requests analog brake controlelse{brake=joy[0].stick[0].axis[1].pos/16;if (brake >= 0) {RAM[0x022804] = ((RAM[0x022804] & 0x1f) | analog_mask[brake]);}}/*----[End of Pedals Emulation]----*/   // CPU Emulation   cpu_execute_cycles(CPU_68K_0, CPU_FRAME_MHz(16,60));		// M68000 16MHz (60fps)#ifdef RAINE_DEBUG      print_debug("PC0:%06x SR:%04x\n",s68000context.pc,s68000context.sr);#endif   cpu_interrupt(CPU_68K_0, 5);   cpu_execute_cycles(CPU_68K_1, CPU_FRAME_MHz(16,60));		// M68000 16MHz (60fps)   #ifdef RAINE_DEBUG      print_debug("PC1:%06x SR:%04x\n",s68000context.pc,s68000context.sr);   #endif   cpu_interrupt(CPU_68K_1, 4);   Taito2610_Frame();				// Z80 and YM2610   //print_ingame(60,"%04x",ReadWord(&RAM[0x39FFE]));   check_layer_switches();}static void render_z_system_sprites(int start, int end){   int x,y,ta,tb,zz;   int zx,zy,rx,ry,xx,zzx,zzy;   UINT8 *map,*SPR_MAP;   UINT8 *zoom_dat_x;   UINT8 *zoom_dat_y;   // OBJECT Z-SYSTEM   // ---------------   for(zz=0x22000+start;zz<0x22000+end;zz+=8){      zx=(RAM[zz+2]>>0)&0x7F;      zy=(RAM[zz+1]>>1)&0x7F;      if((zx!=0)&&(zy!=0)){         ta = ReadWord(&RAM[zz+6])&0x7FF;         if(ta!=0){            x=(32+ReadWord(&RAM[zz+4]))&0x1FF;            //y=(32+ReadWord(&RAM[zz+0])+(0x3F-(zy>>1)))&0x1FF;            y=(((128-16)+32+7)+(ReadWord(&RAM[zz+0])-zy))&0x1FF;            MAP_PALETTE_MAPPED_NEW(               (ReadWord(&RAM[zz+2])>>7)&0xFF,               16,               map            );            if((zx&0x40)!=0){					// [128x128]            zoom_dat_x = zoom16_ofs+(zx<<3);            zoom_dat_y = zoom16_ofs+(zy<<3);            SPR_MAP = OBJECT_MAP + (ta<<7);            switch(RAM[zz+5]&0xC0){            case 0x00:            xx=x;            for(ry=0;ry<8;ry++){            zzy = zoom_dat_y[ry];            if((y>16)&&(y<240+32)){            ta=0;            for(rx=0;rx<8;rx++){            zzx = zoom_dat_x[rx];            if((x>16)&&(x<320+32)){               tb=ReadWord(&SPR_MAP[ta])&0x3FFF;               if(GFX_OBJ_A_SOLID[tb]!=0){			// No pixels; skip                  if(GFX_OBJ_A_SOLID[tb]==1)			// Some pixels; trans                     Draw16x16_Trans_Mapped_ZoomXY_Rot(&GFX_OBJ_A[tb<<8],x,y,map,zzx,zzy);                  else						// all pixels; solid                     Draw16x16_Mapped_ZoomXY_Rot(&GFX_OBJ_A[tb<<8],x,y,map,zzx,zzy);               }            }            ta+=2;            x = (x+zzx)&0x1FF;            }            }            y = (y+zzy)&0x1FF;            SPR_MAP+=16;            x=xx;            }            break;            case 0x40:            x+=(zx+1);            xx=x;            for(ry=0;ry<8;ry++){            zzy = zoom_dat_y[ry];            if((y>16)&&(y<240+32)){            ta=0;            for(rx=0;rx<8;rx++){            zzx = zoom_dat_x[rx];            x = (x-zzx)&0x1FF;            if((x>16)&&(x<320+32)){               tb=ReadWord(&SPR_MAP[ta])&0x3FFF;               if(GFX_OBJ_A_SOLID[tb]!=0){			// No pixels; skip                  if(GFX_OBJ_A_SOLID[tb]==1)			// Some pixels; trans                     Draw16x16_Trans_Mapped_ZoomXY_FlipY_Rot(&GFX_OBJ_A[tb<<8],x,y,map,zzx,zzy);                  else						// all pixels; solid                     Draw16x16_Mapped_ZoomXY_FlipY_Rot(&GFX_OBJ_A[tb<<8],x,y,map,zzx,zzy);               }            }            ta+=2;            }            }            y = (y+zzy)&0x1FF;            SPR_MAP+=16;            x=xx;            }            break;            case 0x80:            y+=zy;            xx=x;            for(ry=0;ry<8;ry++){            zzy = zoom_dat_y[ry];            y = (y-zzy)&0x1FF;            if((y>16)&&(y<240+32)){            ta=0;            for(rx=0;rx<8;rx++){            zzx = zoom_dat_x[rx];            if((x>16)&&(x<320+32)){               tb=ReadWord(&SPR_MAP[ta])&0x3FFF;               if(GFX_OBJ_A_SOLID[tb]!=0){			// No pixels; skip                  if(GFX_OBJ_A_SOLID[tb]==1)			// Some pixels; trans                     Draw16x16_Trans_Mapped_ZoomXY_FlipX_Rot(&GFX_OBJ_A[tb<<8],x,y,map,zzx,zzy);                  else						// all pixels; solid                     Draw16x16_Mapped_ZoomXY_FlipX_Rot(&GFX_OBJ_A[tb<<8],x,y,map,zzx,zzy);               }            }            ta+=2;            x = (x+zzx)&0x1FF;            }            }            SPR_MAP+=16;            x=xx;            }            break;            case 0xC0:            x+=(zx+1);            y+=zy;            xx=x;            for(ry=0;ry<8;ry++){            zzy = zoom_dat_y[ry];            y = (y-zzy)&0x1FF;            if((y>16)&&(y<240+32)){            ta=0;            for(rx=0;rx<8;rx++){            zzx = zoom_dat_x[rx];            x = (x-zzx)&0x1FF;            if((x>16)&&(x<320+32)){               tb=ReadWord(&SPR_MAP[ta])&0x3FFF;               if(GFX_OBJ_A_SOLID[tb]!=0){			// No pixels; skip                  if(GFX_OBJ_A_SOLID[tb]==1)			// Some pixels; trans                     Draw16x16_Trans_Mapped_ZoomXY_FlipXY_Rot(&GFX_OBJ_A[tb<<8],x,y,map,zzx,zzy);                  else						// all pixels; solid                     Draw16x16_Mapped_ZoomXY_FlipXY_Rot(&GFX_OBJ_A[tb<<8],x,y,map,zzx,zzy);               }            }            ta+=2;            }            }            SPR_MAP+=16;            x=xx;            }            break;            }            }            else{            if((zy&0x20)!=0){					// [64x128]            zoom_dat_x = zoom16_ofs+(((zx<<1)|1)<<3);            zoom_dat_y = zoom16_ofs+(zy<<3);            SPR_MAP = OBJECT_MAP + 0x40000 + (ta<<6);            switch(RAM[zz+5]&0xC0){            case 0x00:            xx=x;            for(ry=0;ry<8;ry++){            zzy = zoom_dat_y[ry];            if((y>16)&&(y<240+32)){            ta=0;            for(rx=0;rx<4;rx++){            zzx = zoom_dat_x[rx];            if((x>16)&&(x<320+32)){               tb=ReadWord(&SPR_MAP[ta])&0x3FFF;               if(GFX_OBJ_B_SOLID[tb]!=0){			// No pixels; skip 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -