~ubuntu-branches/ubuntu/intrepid/onscripter/intrepid

« back to all changes in this revision

Viewing changes to ONScripterLabel_rmenu.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michael Bienia
  • Date: 2008-02-12 20:22:19 UTC
  • mfrom: (0.1.2 lenny) (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080212202219-jx4xdi0izczp0pcy
Tags: 20080121-0ubuntu1
* Fake-sync onscripter 0.0.20080121-1 from Debian unstable (LP: #187890).
  Drop the leading zeroes from the version due to different versioning in
  Debian and Ubuntu.
* debian/control:
  + Modify Maintainer value to match DebianMaintainerField spec.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 *
3
3
 *  ONScripterLabel_rmenu.cpp - Right click menu handler of ONScripter
4
4
 *
5
 
 *  Copyright (c) 2001-2005 Ogapee. All rights reserved.
 
5
 *  Copyright (c) 2001-2008 Ogapee. All rights reserved.
6
6
 *
7
7
 *  ogapee@aqua.dti2.ne.jp
8
8
 *
26
26
#if defined(ENABLE_1BYTE_CHAR) && defined(FORCE_1BYTE_CHAR)
27
27
#define MESSAGE_SAVE_EXIST "`%s%s    Date %s/%s    Time %s:%s"
28
28
#define MESSAGE_SAVE_EMPTY "`%s%s    ------------------------"
29
 
#define MESSAGE_SAVE_CONFIRM "`%s%s will be saved. Are you sure?"
30
 
#define MESSAGE_LOAD_CONFIRM "`%s%s will be loaded. Are you sure?"
31
 
#define MESSAGE_RESET_CONFIRM "`The game will be reset. Are you sure?"
32
 
#define MESSAGE_END_CONFIRM "`Are you sure you want to exit?"
 
29
#define MESSAGE_SAVE_CONFIRM "`Save in slot %s%s?"
 
30
#define MESSAGE_LOAD_CONFIRM "`Load from slot %s%s?"
 
31
#define MESSAGE_RESET_CONFIRM "`Return to Title Menu?"
 
32
#define MESSAGE_END_CONFIRM "`Quit?"
33
33
#define MESSAGE_YES "Yes"
34
34
#define MESSAGE_NO "No"
35
35
#else
55
55
    event_mode = IDLE_EVENT_MODE;
56
56
    system_menu_enter_flag = true;
57
57
    yesno_caller = SYSTEM_NULL;
58
 
    next_display_mode = TEXT_DISPLAY_MODE;
 
58
    shelter_display_mode = display_mode;
 
59
    display_mode = TEXT_DISPLAY_MODE;
59
60
    shelter_draw_cursor_flag = draw_cursor_flag;
60
61
    draw_cursor_flag = false;
61
62
}
63
64
void ONScripterLabel::leaveSystemCall( bool restore_flag )
64
65
{
65
66
    current_font = &sentence_font;
66
 
    next_display_mode = display_mode;
 
67
    display_mode = shelter_display_mode;
67
68
    system_menu_mode = SYSTEM_NULL;
68
69
    system_menu_enter_flag = false;
69
70
    yesno_caller = SYSTEM_NULL;
71
72
 
72
73
    if ( restore_flag ){
73
74
        
74
 
        current_text_buffer = cached_text_buffer;
 
75
        current_page = cached_page;
75
76
        restoreTextBuffer();
76
77
        root_button_link.next = shelter_button_link;
77
78
        root_select_link.next = shelter_select_link;
151
152
 
152
153
        if ( current_button_state.button == -1 ){
153
154
            if ( menuselectvoice_file_name[MENUSELECTVOICE_CANCEL] )
154
 
                playWave( menuselectvoice_file_name[MENUSELECTVOICE_CANCEL], false, MIX_WAVE_CHANNEL );
 
155
                playSound(menuselectvoice_file_name[MENUSELECTVOICE_CANCEL], 
 
156
                          SOUND_WAVE|SOUND_OGG, false, MIX_WAVE_CHANNEL);
155
157
            leaveSystemCall();
156
158
            return;
157
159
        }
158
160
    
159
161
        if ( menuselectvoice_file_name[MENUSELECTVOICE_CLICK] )
160
 
            playWave( menuselectvoice_file_name[MENUSELECTVOICE_CLICK], false, MIX_WAVE_CHANNEL );
 
162
            playSound(menuselectvoice_file_name[MENUSELECTVOICE_CLICK], 
 
163
                      SOUND_WAVE|SOUND_OGG, false, MIX_WAVE_CHANNEL);
161
164
 
162
165
        link = root_rmenu_link.next;
163
166
        while ( link ){
172
175
    }
173
176
    else{
174
177
        if ( menuselectvoice_file_name[MENUSELECTVOICE_OPEN] )
175
 
            playWave( menuselectvoice_file_name[MENUSELECTVOICE_OPEN], false, MIX_WAVE_CHANNEL );
 
178
            playSound(menuselectvoice_file_name[MENUSELECTVOICE_OPEN],
 
179
                      SOUND_WAVE|SOUND_OGG, false, MIX_WAVE_CHANNEL);
176
180
 
177
181
        system_menu_mode = SYSTEM_MENU;
178
182
        yesno_caller = SYSTEM_MENU;
225
229
        leaveSystemCall();
226
230
    }
227
231
    else{
228
 
        yesno_caller |= SYSTEM_RESET;
 
232
        yesno_caller = SYSTEM_RESET;
229
233
        system_menu_mode = SYSTEM_YESNO;
230
234
        advancePhase();
231
235
    }
237
241
        leaveSystemCall();
238
242
    }
239
243
    else{
240
 
        yesno_caller |= SYSTEM_END;
 
244
        yesno_caller = SYSTEM_END;
241
245
        system_menu_mode = SYSTEM_YESNO;
242
246
        advancePhase();
243
247
    }
251
255
        leaveSystemCall();
252
256
    }
253
257
    else{
 
258
        display_mode = NORMAL_DISPLAY_MODE;
254
259
        flush(mode_saya_flag ? REFRESH_SAYA_MODE : REFRESH_NORMAL_MODE);
255
260
 
256
261
        event_mode = WAIT_BUTTON_MODE;
304
309
        flush( refreshMode() );
305
310
        
306
311
        bool nofile_flag;
307
 
        char *buffer = new char[ strlen( save_item_name ) + 30 + 1 ];
 
312
        char *buffer = new char[ strlen( save_item_name ) + 31 + 1 ];
308
313
 
309
314
        for ( unsigned int i=1 ; i<=num_save_file ; i++ ){
310
315
            searchSaveFile( save_file_info, i );
375
380
        flush( refreshMode() );
376
381
        
377
382
        bool nofile_flag;
378
 
        char *buffer = new char[ strlen( save_item_name ) + 30 + 1 ];
 
383
        char *buffer = new char[ strlen( save_item_name ) + 31 + 1 ];
379
384
    
380
385
        for ( unsigned int i=1 ; i<=num_save_file ; i++ ){
381
386
            SaveFileInfo save_file_info;
424
429
 
425
430
        if ( current_button_state.button == 1 ){ // yes is selected
426
431
            if ( menuselectvoice_file_name[MENUSELECTVOICE_YES] )
427
 
                playWave( menuselectvoice_file_name[MENUSELECTVOICE_YES], false, MIX_WAVE_CHANNEL );
 
432
                playSound(menuselectvoice_file_name[MENUSELECTVOICE_YES],
 
433
                          SOUND_WAVE|SOUND_OGG, false, MIX_WAVE_CHANNEL);
428
434
            if ( yesno_caller == SYSTEM_SAVE ){
429
435
                saveSaveFile( yesno_selected_file_no );
430
436
                leaveSystemCall();
443
449
                text_on_flag = false;
444
450
                indent_offset = 0;
445
451
                line_enter_status = 0;
 
452
                page_enter_status = 0;
446
453
                string_buffer_offset = 0;
 
454
                break_flag = false;
447
455
 
448
456
                if (loadgosub_label)
449
457
                    gosubReal( loadgosub_label, script_h.getCurrent() );
450
458
                readToken();
451
459
            }
452
 
            else if ( yesno_caller & SYSTEM_RESET ){
 
460
            else if ( yesno_caller ==  SYSTEM_RESET ){
453
461
                resetCommand();
454
462
                readToken();
455
463
                event_mode = IDLE_EVENT_MODE;
456
464
                leaveSystemCall( false );
457
465
            }
458
 
            else if ( yesno_caller & SYSTEM_END ){
 
466
            else if ( yesno_caller ==  SYSTEM_END ){
459
467
 
460
468
                endCommand();
461
469
            }
462
470
        }
463
471
        else{
464
472
            if ( menuselectvoice_file_name[MENUSELECTVOICE_NO] )
465
 
                playWave( menuselectvoice_file_name[MENUSELECTVOICE_NO], false, MIX_WAVE_CHANNEL );
 
473
                playSound(menuselectvoice_file_name[MENUSELECTVOICE_NO],
 
474
                          SOUND_WAVE|SOUND_OGG, false, MIX_WAVE_CHANNEL);
466
475
            system_menu_mode = yesno_caller & 0xf;
 
476
            if (yesno_caller == SYSTEM_RESET)
 
477
                leaveSystemCall();
467
478
            advancePhase();
468
479
        }
469
480
    }
484
495
                     save_item_name,
485
496
                     save_file_info.sjis_no );
486
497
        }
487
 
        else if ( yesno_caller & SYSTEM_RESET )
 
498
        else if ( yesno_caller ==  SYSTEM_RESET )
488
499
            strcpy( name, MESSAGE_RESET_CONFIRM );
489
 
        else if ( yesno_caller & SYSTEM_END )
 
500
        else if ( yesno_caller ==  SYSTEM_END )
490
501
            strcpy( name, MESSAGE_END_CONFIRM );
491
502
        
492
503
        
527
538
    
528
539
    /* ---------------------------------------- */
529
540
    /* Previous button check */
530
 
    if ( (current_text_buffer->previous->buffer2_count > 0 ) &&
531
 
         current_text_buffer != start_text_buffer ){
 
541
    if ( (current_page->previous->text_count > 0 ) &&
 
542
         current_page != start_page ){
532
543
        ButtonLink *button = new ButtonLink();
533
544
        root_button_link.insert( button );
534
545
    
563
574
 
564
575
    /* ---------------------------------------- */
565
576
    /* Next button check */
566
 
    if ( current_text_buffer->next != cached_text_buffer ){
 
577
    if ( current_page->next != cached_page ){
567
578
        ButtonLink *button = new ButtonLink();
568
579
        root_button_link.insert( button );
569
580
    
605
616
    current_font = &sentence_font;
606
617
    if ( event_mode & WAIT_BUTTON_MODE ){
607
618
        if ( current_button_state.button == 0 ||
608
 
             ( current_text_buffer == start_text_buffer &&
 
619
             ( current_page == start_page &&
609
620
               current_button_state.button == -2 ) )
610
621
            return;
611
622
        if ( current_button_state.button == -1 ||
612
623
             ( current_button_state.button == -3 &&
613
 
               current_text_buffer->next == cached_text_buffer ) ||
 
624
               current_page->next == cached_page ) ||
614
625
             current_button_state.button <= -4 )
615
626
        {
616
627
            event_mode = IDLE_EVENT_MODE;
625
636
        
626
637
        if ( current_button_state.button == 1 ||
627
638
             current_button_state.button == -2 ){
628
 
            current_text_buffer = current_text_buffer->previous;
 
639
            current_page = current_page->previous;
629
640
        }
630
641
        else
631
 
            current_text_buffer = current_text_buffer->next;
 
642
            current_page = current_page->next;
632
643
    }
633
644
    else{
634
 
        current_text_buffer = current_text_buffer->previous;
635
 
        if ( current_text_buffer->buffer2_count == 0 ){
 
645
        current_page = current_page->previous;
 
646
        if ( current_page->text_count == 0 ){
636
647
            if ( lookback_sp[0] >= 0 )
637
648
                sprite_info[ lookback_sp[0] ].visible = false;
638
649
            if ( lookback_sp[1] >= 0 )