Fix target joystick calibration arguments and scene transitions
Avoid a demonstrated CMOC -O2 removed-index-reload error with independent calibration and position pointers. Keep established joystick readiness across menus, stabilize shared fire/keyboard scans, and protect input sampling from IRQ interference. Ship pristine QUADPSL04.DSK. Native right-port emulated analog/button checks pass for both directions, four lasting T-piece turns, and steering after keyboard resume. Host input/store/rules/video regressions and unchanged memory guards pass. Preserve personal score disks and record physical/128 KB/audio limits.
This commit is contained in:
1 parent
2e163049d1
commit
a07c41555a
22 files changed
+446
-100
No files matched your search
@@ -28,7 +28,7 @@ static const Q8 setting_names[]={48,49,50,51,52,53,54,55,56,57,8,58,59,47};
|
||||
|
||||
static void enter(Q8 next)
|
||||
{
|
||||
ui_scene=255;scene=next;selected=0;dirty=1;q_input_reset(&input);
|
||||
ui_scene=255;scene=next;selected=0;dirty=1;q_input_release(&input);
|
||||
gravity_ms=0;soft_before=0;
|
||||
if(next==PLAY)draw_flags=3;
|
||||
if(next==INITIALS){initial_guard=1;last_initial=0;}
|
||||
@@ -38,7 +38,7 @@ static void tone(Q8 event)
|
||||
{
|
||||
/* Half the desired Hz compensates this API for stock CoCo 3 fast mode. */
|
||||
static const Q16 half_frequencies[7]={210,440,120,330,440,550,90};
|
||||
static const Q8 durations[7]={5,5,5,6,8,10,12};
|
||||
static Q8 durations[7]={5,5,5,6,8,10,12};
|
||||
if(preferences.sound){
|
||||
/* JOYSTK and audio share the mux: select DAC only for this effect. */
|
||||
initSound();
|
||||
@@ -57,14 +57,22 @@ static void new_game(void)
|
||||
static QActions sample(Q16 ms)
|
||||
{
|
||||
const byte *axes;
|
||||
const Q8 *center,*position;
|
||||
Q16 keys;
|
||||
Q8 i,port=preferences.port,index=port==1?2:0,button=0;
|
||||
/* BASIC's IRQ and analog/keyboard polling share the PIA selector. */
|
||||
disableInterrupts();
|
||||
Player_disableSound();
|
||||
axes=readJoystickPositions();for(i=0;i<4;++i)joystick_axes[i]=axes[i];
|
||||
joystick_buttons=readJoystickButtons();
|
||||
Player_disableSound(); /* Reassert idle silence after the shared analog-input APIs. */
|
||||
keys=keyboard_read(&joystick_buttons,scene==PLAY?(Q8)(KEYBOARD_PLAY|(preferences.clockwise<<1)):scene==INITIALS?(Q8)KEYBOARD_INITIALS:(Q8)0);
|
||||
Player_disableSound();
|
||||
enableInterrupts();
|
||||
if(port<2)button=!(joystick_buttons&(port==1?JOYSTK_BUTTON_1_LEFT:JOYSTK_BUTTON_1_RIGHT));
|
||||
return q_input_step(&input,keyboard_read(joystick_buttons,scene==PLAY?(Q8)(KEYBOARD_PLAY|(preferences.clockwise<<1)):scene==INITIALS?(Q8)KEYBOARD_INITIALS:(Q8)0),button,joystick_axes[index],joystick_axes[index+1],
|
||||
preferences.centers[index],preferences.centers[index+1],port<2,ms,scene==PLAY,preferences.clockwise);
|
||||
/* Keep independent base pointers: CMOC -O2 can remove the index reload
|
||||
* between adjacent byte-array arguments and use the prior byte as index. */
|
||||
center=preferences.centers+index;position=joystick_axes+index;
|
||||
return q_input_step(&input,keys,button,position[0],position[1],
|
||||
center[0],center[1],port<2,ms,scene==PLAY,preferences.clockwise);
|
||||
}
|
||||
|
||||
static const char *ui_label(Q8 id)
|
||||
@@ -95,8 +103,8 @@ static Q8 save_changes(signed char category,const QScore *scores,Q8 reset_all)
|
||||
static void show_store_status(void)
|
||||
{
|
||||
if(save_status==Q_STORE_RECOVERED)video_text(1,23,"RECOVERED PREVIOUS SAVE");
|
||||
else if(save_status==Q_STORE_CORRUPT)video_text(1,23,"BAD SAVE DATA - CHECK DISK");
|
||||
else if(save_status)video_text(1,23,"DISK ERROR - CHANGES NOT SAVED");
|
||||
else if(save_status==Q_STORE_CORRUPT)video_text(1,23,"BAD SAVE - CHECK DISK");
|
||||
else if(save_status)video_text(1,23,"DISK ERROR - NOT SAVED");
|
||||
}
|
||||
|
||||
static void game_over(void)
|
||||
@@ -176,8 +184,8 @@ static const Q8 captions[][3]={
|
||||
|
||||
static void fixed_captions(void)
|
||||
{
|
||||
Q8 i;for(i=0;i<sizeof(captions)/sizeof(captions[0]);++i)
|
||||
if((captions[i][0]>>3)==scene)video_text(captions[i][0]&7,captions[i][1],ui_label(captions[i][2]));
|
||||
const Q8 *p=(const Q8 *)&captions,*end=p+sizeof(captions);
|
||||
for(;p!=end;p+=3)if((*p>>3)==scene)video_text(*p&7,p[1],ui_label(p[2]));
|
||||
}
|
||||
|
||||
static void picture(void)
|
||||
@@ -267,9 +275,8 @@ static void change_setting(signed char delta)
|
||||
case 7:preferences.game.difficult=!preferences.game.difficult;break;
|
||||
case 8:preferences.custom_seed=!preferences.custom_seed;break;
|
||||
case 9:seed_digit=0;enter(SEED_EDIT);return;
|
||||
case 10:preferences.port=(preferences.port+(delta>0?1:2))%3;break;
|
||||
case 11:preferences.centers[0]=joystick_axes[0];preferences.centers[1]=joystick_axes[1];
|
||||
preferences.centers[2]=joystick_axes[2];preferences.centers[3]=joystick_axes[3];break;
|
||||
case 10:preferences.port=(preferences.port+(delta>0?1:2))%3;q_input_reset(&input);break;
|
||||
case 11:memcpy(preferences.centers,joystick_axes,4);q_input_reset(&input);break;
|
||||
case 12:preferences.hz=preferences.hz==60?50:60;clock_fraction=0;break;
|
||||
default:save_changes(-1,0,0);enter(parent);return;
|
||||
}
|
||||
@@ -323,10 +330,10 @@ int main(void)
|
||||
{
|
||||
Q16 now,last,ms,scaled,ticks;QActions action;Q8 i,changed,info,old_over,full_scene;
|
||||
initCoCoSupport();setHighSpeed(FALSE);
|
||||
if(!isCoCo3){putstr("COCO 3 VERSION - 128 KB MINIMUM\n",sizeof("COCO 3 VERSION - 128 KB MINIMUM\n")-1);return 1;}
|
||||
if(!isCoCo3){putstr("COCO 3 - 128 KB MINIMUM\n",sizeof("COCO 3 - 128 KB MINIMUM\n")-1);return 1;}
|
||||
if(!video_open(1))return 2;
|
||||
q_preferences_default(&preferences);
|
||||
setHighSpeed(TRUE);Player_disableSound();video_text(4,12,"READING SAVED SCORES");
|
||||
setHighSpeed(TRUE);Player_disableSound();video_text(4,12,"READING SCORES");
|
||||
save_status=disk_store_open(&preferences);
|
||||
video_style(preferences.style,preferences.grid);q_input_reset(&input);last=getTimer();
|
||||
for(;;){
|
||||
|
||||
Reference in new issue
Block a user