示例#1
0
void hrAdventureScreen::loadMap(hrH3MReader *reader)
{
    Q_ASSERT(reader);
    clearMap();
    size.setSize(QSize(reader->getSize(), reader->getSize()));

    hasUnderground = reader->hasUnderground();

    hrCache& cache = hrCache::Get();

    for (int i = 0; i < size.width() * size.height(); i++)
    {
        hrTile tile = reader->getTile(i);
        tilesGround.append(tile);
        loadTile(tile);
        if (hasUnderground)
        {
            tile = reader->getTile(i, true);
            tilesUnderground.append(tile);
            loadTile(tile);
        }
    }
    for (int i = 0; i < reader->getObjectsCount(); i++)
    {
        hrSceneObject object = reader->getObject(i);

        hrGraphicsItem item;
        if (!itemsObject.contains(object.getId()))
        {
            QString name = reader->getObjectName(object.getId());
            item = cache.loadItem(name);
            itemsObject[object.getId()] = item;
        }
        else
        {
            item = itemsObject[object.getId()];
        }
        object.setFrames(item.countFrames);
        object.setSize(coord::toCell(item.getSize()));

        if (!object.isUnderground())
            objectsGround.append(object);
        else
            objectsUnderground.append(object);
    }
    std::sort(objectsGround.begin(), objectsGround.end());
    std::sort(objectsUnderground.begin(), objectsUnderground.end());

    loadCursor("cradvntr.def");
    setCursor(CURSOR_POINTER);

    animateTimer.start(200);
}
示例#2
0
GHOST_TSuccess GHOST_WindowWin32::setWindowCursorShape(GHOST_TStandardCursor cursorShape)
{
	if (m_customCursor) {
		DestroyCursor(m_customCursor);
		m_customCursor = NULL;
	}

	if (::GetForegroundWindow() == m_hWnd) {
		loadCursor(getCursorVisibility(), cursorShape);
	}

	return GHOST_kSuccess;
}
示例#3
0
文件: kbusyptr.cpp 项目: xwizard/kde1
//-----------------------------------------------------------------------------
KBusyPtr :: KBusyPtr ()
{
  app = KApplication::getKApplication();

  busyLevel  = 0;
  numCursors = 0;
  frameDelay = 500;
  cursorList = NULL;
  bitmapList = NULL;
  //animated   = TRUE;
  animated   = FALSE;

  loadCursor("stopwatch.xbm","stopwatchMask.xbm");

  //connect(timer, SIGNAL(timeout()), this, SLOT(timeout()));
}
示例#4
0
//--------------------------------------------------------------------
// initialize application
void GuiTestAll::appInit()
{
  // get the important directories
  mgString shaderDir;
  m_options.getFileName("shaderDir", m_options.m_sourceFileName, "docs/shaders", shaderDir);
  mgString uiDir;
  m_options.getFileName("uiDir", m_options.m_sourceFileName, "docs/ui", uiDir);
  mgString fontDir;
  m_options.getFileName("fontDir", m_options.m_sourceFileName, "docs/fonts", fontDir);

  mgInitDisplayServices(shaderDir, fontDir);

  mgDisplay->setDPI(m_options.getInteger("dpi", 0));
  mgDisplay->setFOV(m_options.getDouble("FOV", 60.0));

  mgString title;
  title.format("%s, %s", mgProgramName, mgProgramVersion);
  mgPlatform->setWindowTitle(title);

  // load the shaders we use
  mgVertex::loadShader("litTexture");
  mgVertexTA::loadShader("litTextureArray");

  // load cursor pattern
  loadCursor();
  setDeskMode(true);

  initMovement();
  m_lastAnimate = mgOSGetTime();  // now!

  // rotation angle for cube
  m_angle = 0.0;

  // load texture patterns
  loadTextures();

  // create vertex and index buffers
  m_cubeIndexes = NULL;
  m_cubeVertexes = NULL;
  m_floorVertexes = NULL;

  m_surface = mgDisplay->createOverlaySurface();

  mgString fileName;
  m_options.getFileName("helpFile", m_options.m_sourceFileName, "help.xml", fileName);
  m_ui = new SampleUI(m_surface, fileName);
}
示例#5
0
//--------------------------------------------------------------
// initialize application
void SeaOfMemes::appInit()
{
  // get the important directories
  mgString shaderDir;
  m_options.getFileName("shaderDir", m_options.m_sourceFileName, "docs/shaders", shaderDir);
  mgString uiDir;
  m_options.getFileName("uiDir", m_options.m_sourceFileName, "docs/ui", uiDir);
  mgString fontDir;
  m_options.getFileName("fontDir", m_options.m_sourceFileName, "docs/fonts", fontDir);

  mgInitDisplayServices(shaderDir, fontDir);

  mgDisplay->setDPI(m_options.getInteger("dpi", 0));
  mgDisplay->setFOV(m_options.getDouble("FOV", 60.0));

  // load cursors
  loadCursor();

  setDeskMode(true);

  // take units from option
  m_unitsMetric = m_options.getBoolean("metricUnits", true);

  // create the sky
  m_matColor = mgPoint3(1, 1, 1);
  m_lightDir = mgPoint3(1.0, 0.25, 0.0);
  m_lightDir.normalize();

  m_sky = new NebulaSky(m_options);
  m_sky->setSunDir(m_lightDir);

  m_world = new SolarSystem(m_options);

  m_helpUI = new HelpUI(m_options);
  m_helpUI->setDebugApp(this);

  m_speedUI = new SpeedUI(m_options);
  m_speedUI->setUnits(m_unitsMetric ? UNITS_KM : UNITS_MILES);

  appCreateBuffers();

  // initialize movement
  initMovement();
  m_lastAnimate = 0.0;
}
示例#6
0
int main(int argc, char *argv[]){
  wormy.disp = XOpenDisplay(NULL);
  if (loadCursor("mouse.png", 3, 5, 45.0, 90.0) != 0) return 1;

  struct timespec tm = { 0, 1e+7 };
  int x, y, cx, cy;
  unsigned int mask;
  Window root, child;

  while(nanosleep(&tm, NULL) == 0){
    XQueryPointer(wormy.disp, DefaultRootWindow(wormy.disp),
                  &root, &child, &x, &y, &cx, &cy, &mask);
    /*fprintf(stderr, "x: %d, y: %d\n", x, y);*/
    mouseMove(x, y);
    XFlush(wormy.disp);
  }

  cleanup();
  return 0;
}
示例#7
0
//--------------------------------------------------------------
// initialize application
void MovementApp::appInit()
{
  // get the important directories
  mgString shaderDir;
  m_options.getFileName("shaderDir", m_options.m_sourceFileName, "docs/shaders", shaderDir);
  mgString uiDir;
  m_options.getFileName("uiDir", m_options.m_sourceFileName, "docs/ui", uiDir);
  mgString fontDir;
  m_options.getFileName("fontDir", m_options.m_sourceFileName, "docs/fonts", fontDir);

  mgInitDisplayServices(shaderDir, fontDir);

  mgDisplay->setDPI(m_options.getInteger("dpi", 0));
  mgDisplay->setFOV(m_options.getDouble("FOV", 60.0));

  // load cursor pattern
  loadCursor();
  setDeskMode(true);

  initMovement();
  m_lastAnimate = mgOSGetTime();  // now!
}
示例#8
0
WzMainWindow::WzMainWindow(QSize resolution, const QGLFormat &format, QWidget *parent) : QtGameWidget(resolution, format, parent)
{
	myself = this;
	notReadyToPaint = true;
	tickCount.start();
	for (int i = 0; i < CURSOR_MAX; cursors[i++] = NULL) ;
	setAutoFillBackground(false);
	setAutoBufferSwap(false);
	setMouseTracking(true);

	// Mac apps typically don't have window icons unless document-based.
#if !defined(WZ_OS_MAC)
	setWindowIcon(QIcon(QPixmap::fromImage(QImage("wz::images/warzone2100.png", "PNG"))));
#endif
	setWindowTitle(PACKAGE_NAME);

	loadCursor(CURSOR_EMBARK, "wz::images/intfac/image_cursor_embark.png");
	loadCursor(CURSOR_DEST, "wz::images/intfac/image_cursor_dest.png");
	loadCursor(CURSOR_DEFAULT, "wz::images/intfac/image_cursor_default.png");
	loadCursor(CURSOR_BUILD, "wz::images/intfac/image_cursor_build.png");
	loadCursor(CURSOR_SCOUT, "wz::images/intfac/image_cursor_scout.png");
	loadCursor(CURSOR_DISEMBARK, "wz::images/intfac/image_cursor_disembark.png");
	loadCursor(CURSOR_ATTACK, "wz::images/intfac/image_cursor_attack.png");
	loadCursor(CURSOR_GUARD, "wz::images/intfac/image_cursor_guard.png");
	loadCursor(CURSOR_FIX, "wz::images/intfac/image_cursor_fix.png");
	loadCursor(CURSOR_SELECT, "wz::images/intfac/image_cursor_select.png");
//	loadCursor(CURSOR_REPAIR, 64, 160, buffer);		// FIX ME: This IS in infac.img, but the define is MIA
	loadCursor(CURSOR_SEEKREPAIR, "wz::images/intfac/image_cursor_repair.png");  // FIX ME: This is NOT in infac.img!
	loadCursor(CURSOR_PICKUP, "wz::images/intfac/image_cursor_pickup.png");
	loadCursor(CURSOR_NOTPOSSIBLE, "wz::images/intfac/image_cursor_notpos.png");
	loadCursor(CURSOR_MOVE, "wz::images/intfac/image_cursor_move.png");
	loadCursor(CURSOR_LOCKON, "wz::images/intfac/image_cursor_lockon.png");
//	loadCursor(CURSOR_ECM, 224, 160, buffer);		// FIX ME: Not defined yet!
	loadCursor(CURSOR_JAM, "wz::images/intfac/image_cursor_ecm.png");  // FIX ME: This is NOT in infac.img, and is using IMAGE CURSOR ECM ?
	loadCursor(CURSOR_ATTACH, "wz::images/intfac/image_cursor_attach.png");
	loadCursor(CURSOR_BRIDGE, "wz::images/intfac/image_cursor_bridge.png");
	loadCursor(CURSOR_BOMB, "wz::images/intfac/image_cursor_bomb.png");

	// Reused (unused) cursors
	cursors[CURSOR_ARROW] = new QCursor(Qt::ArrowCursor);
	cursors[CURSOR_MENU] = new QCursor(Qt::ArrowCursor);
	cursors[CURSOR_BOMB] = new QCursor(Qt::ArrowCursor);
	cursors[CURSOR_EDGEOFMAP] = new QCursor(Qt::ArrowCursor);
	cursors[CURSOR_SIGHT] = new QCursor(Qt::ArrowCursor);
	cursors[CURSOR_TARGET] = new QCursor(Qt::ArrowCursor);
	cursors[CURSOR_UARROW] = new QCursor(Qt::SizeVerCursor);
	cursors[CURSOR_DARROW] = new QCursor(Qt::SizeVerCursor);
	cursors[CURSOR_LARROW] = new QCursor(Qt::SizeHorCursor);
	cursors[CURSOR_RARROW] = new QCursor(Qt::SizeHorCursor);

	// Fonts
	regularFont.setFamily("DejaVu Sans");
	regularFont.setPixelSize(12);
	boldFont.setFamily("DejaVu Sans");
	boldFont.setPixelSize(21);
	boldFont.setWeight(QFont::DemiBold);
	smallFont.setFamily("DejaVu Sans");
	smallFont.setPixelSize(9);

	// Want focusOutEvent messages.
	setFocusPolicy(Qt::StrongFocus);

	// set radix character (again) to the period (".")
	setlocale(LC_NUMERIC, "C");

#if !defined(WZ_OS_MAC)
	// Want áéíóú inputMethodEvent messages.
	setAttribute(Qt::WA_InputMethodEnabled, true);
#else
	// But not on the Mac (no ALT+H on US Extended Keyboards)
	setAttribute(Qt::WA_InputMethodEnabled, false);
#endif
}
int ONScripter::loadSaveFile2( int file_version )
{
    deleteNestInfo();
    
    int i, j;
    
    readInt(); // 1
    if ( readInt() == 1 ) sentence_font.is_bold = true;
    else                  sentence_font.is_bold = false;
    if ( readInt() == 1 ) sentence_font.is_shadow = true;
    else                  sentence_font.is_shadow = false;

    readInt(); // 0
    rmode_flag = (readInt()==1)?true:false;
    sentence_font.color[0] = readInt();
    sentence_font.color[1] = readInt();
    sentence_font.color[2] = readInt();
    cursor_info[0].remove();

    char *tmp_name = NULL;
    readStr( &tmp_name );
    loadCursor(0, tmp_name, 0, 0);
    readStr( &tmp_name );
    loadCursor(1, tmp_name, 0, 0);
    if (tmp_name) delete[] tmp_name;

    window_effect.effect = readInt();
    window_effect.duration = readInt();
    readStr( &window_effect.anim.image_name ); // probably

    sentence_font.clear();
    sentence_font.ttf_font  = NULL;
    sentence_font.top_xy[0] = readInt();
    sentence_font.top_xy[1] = readInt();
    sentence_font.num_xy[0] = readInt();
    sentence_font.num_xy[1] = readInt();
    sentence_font.font_size_xy[0] = readInt();
    sentence_font.font_size_xy[1] = readInt();
    sentence_font.pitch_xy[0] = readInt();
    sentence_font.pitch_xy[1] = readInt();
    for ( i=0 ; i<3 ; i++ )
        sentence_font.window_color[2-i] = readChar();
    if ( readChar() == 0x00 ) sentence_font.is_transparent = true;
    else                      sentence_font.is_transparent = false;
    sentence_font.wait_time = readInt();

    AnimationInfo *ai = &sentence_font_info;
    ai->orig_pos.x = readInt();
    ai->orig_pos.y = readInt();
    ai->orig_pos.w = readInt() + 1 - ai->orig_pos.x;
    ai->orig_pos.h = readInt() + 1 - ai->orig_pos.y;
    ai->scalePosXY( screen_ratio1, screen_ratio2 );
    ai->scalePosWH( screen_ratio1, screen_ratio2 );
    readStr( &ai->image_name );
    if ( !sentence_font.is_transparent && ai->image_name ){
        parseTaggedString( ai );
        setupAnimationInfo( ai );
    }

    if ( readInt() == 1 ) cursor_info[0].abs_flag = false;
    else                  cursor_info[0].abs_flag = true;
    if ( readInt() == 1 ) cursor_info[1].abs_flag = false;
    else                  cursor_info[1].abs_flag = true;
    cursor_info[0].orig_pos.x = readInt();
    cursor_info[1].orig_pos.x = readInt();
    cursor_info[0].orig_pos.y = readInt();
    cursor_info[1].orig_pos.y = readInt();
    cursor_info[0].scalePosXY( screen_ratio1, screen_ratio2 );
    cursor_info[1].scalePosXY( screen_ratio1, screen_ratio2 );

    // load background surface
    bg_info.remove();
    readStr( &bg_info.file_name );
    createBackground();

    for ( i=0 ; i<3 ; i++ ){
        tachi_info[i].remove();
        readStr( &tachi_info[i].image_name );
        if ( tachi_info[i].image_name ){
            parseTaggedString( &tachi_info[i] );
            setupAnimationInfo( &tachi_info[i] );
        }
    }

    for ( i=0 ; i<3 ; i++ ) 
        tachi_info[i].orig_pos.x = readInt();
    for ( i=0 ; i<3 ; i++ ) 
        tachi_info[i].orig_pos.y = readInt();
    for ( i=0 ; i<3 ; i++ ) 
        tachi_info[i].scalePosXY( screen_ratio1, screen_ratio2 );

    readInt(); // 0
    readInt(); // 0
    readInt(); // 0
    
    if (file_version >= 203){
        readInt(); // -1
        readInt(); // -1
        readInt(); // -1
    }
    
    for ( i=0 ; i<MAX_SPRITE_NUM ; i++ ){
        AnimationInfo *ai = &sprite_info[i];
        
        ai->remove();
        readStr( &ai->image_name );
        if ( ai->image_name ){
            parseTaggedString( ai );
            setupAnimationInfo( ai );
        }
        ai->orig_pos.x = readInt();
        ai->orig_pos.y = readInt();
        ai->scalePosXY( screen_ratio1, screen_ratio2 );
        if ( readInt() == 1 ) ai->visible = true;
        else                  ai->visible = false;
        ai->current_cell = readInt();
        if (file_version >= 203){
            j = readInt();
            if (j == -1)
                ai->trans = 256;
            else
                ai->trans = j;
        }
    }

    readVariables( 0, script_h.global_variable_border );

    // nested info
    int num_nest =readInt();
    last_nest_info = &root_nest_info;
    if (num_nest > 0){
        file_io_buf_ptr += (num_nest-1)*4;
        while( num_nest > 0 ){
            NestInfo *info = new NestInfo();
            if (last_nest_info == &root_nest_info) last_nest_info = info;
        
            i = readInt();
            if (i > 0){
                info->nest_mode = NestInfo::LABEL;
                info->next_script = script_h.getAddress( i );
                file_io_buf_ptr -= 8;
                num_nest--;
            }
            else{
                info->nest_mode = NestInfo::FOR;
                info->next_script = script_h.getAddress( -i );
                file_io_buf_ptr -= 16;
                info->var_no = readInt();
                info->to = readInt();
                info->step = readInt();
                file_io_buf_ptr -= 16;
                num_nest -= 4;
            }
            info->next = root_nest_info.next;
            if (root_nest_info.next) root_nest_info.next->previous = info;
            root_nest_info.next = info;
            info->previous = &root_nest_info;
        }
        num_nest = readInt();
        file_io_buf_ptr += num_nest*4;
    }

    if (readInt() == 1) monocro_flag = true;
    else                monocro_flag = false;
    for ( i=0 ; i<3 ; i++ )
        monocro_color[2-i] = readInt();
    for ( i=0 ; i<256 ; i++ ){
        monocro_color_lut[i][0] = (monocro_color[0] * i) >> 8;
        monocro_color_lut[i][1] = (monocro_color[1] * i) >> 8;
        monocro_color_lut[i][2] = (monocro_color[2] * i) >> 8;
    }
    nega_mode = readInt();
    
    // ----------------------------------------
    // Sound
    stopCommand();
    loopbgmstopCommand();
    stopAllDWAVE();

    readStr( &midi_file_name ); // MIDI file
    readStr( &wave_file_name ); // wave, waveloop
    i = readInt();
    if ( i >= 0 ) current_cd_track = i;

    // play, playonce MIDI
    if ( readInt() == 1 ){
        midi_play_loop_flag = true;
        current_cd_track = -2;
        playSound(midi_file_name, SOUND_MIDI, midi_play_loop_flag);
    }
    else
        midi_play_loop_flag = false;
    
    // wave, waveloop
    if ( readInt() == 1 ) wave_play_loop_flag = true;
    else                  wave_play_loop_flag = false;
    if ( wave_file_name && wave_play_loop_flag )
        playSound(wave_file_name, SOUND_CHUNK, wave_play_loop_flag, MIX_WAVE_CHANNEL);

    // play, playonce
    if ( readInt() == 1 ) cd_play_loop_flag = true;
    else                  cd_play_loop_flag = false;
    if ( current_cd_track >= 0 ) playCDAudio();

    // bgm, mp3, mp3loop
    if ( readInt() == 1 ) music_play_loop_flag = true;
    else                  music_play_loop_flag = false;
    if ( readInt() == 1 ) mp3save_flag = true;
    else                  mp3save_flag = false;
    readStr( &music_file_name );
    if ( music_file_name ){
        playSound(music_file_name, SOUND_MUSIC | SOUND_MIDI,
                  music_play_loop_flag, MIX_BGM_CHANNEL);
    }

    erase_text_window_mode = readInt();
    readInt(); // 1

    barclearCommand();
    for ( i=0 ; i<MAX_PARAM_NUM ; i++ ){
        j = readInt();
        if ( j != 0 ){
            ai = bar_info[i] = new AnimationInfo();
            ai->trans_mode = AnimationInfo::TRANS_COPY;
            ai->num_of_cells = 1;

            ai->param = j;
            ai->orig_pos.x = readInt();
            ai->orig_pos.y = readInt();
            ai->max_width  = readInt();
            ai->orig_pos.w = 0;
            ai->orig_pos.h = readInt();
            ai->max_param  = readInt();

            ai->scalePosXY( screen_ratio1, screen_ratio2 );

            for ( j=0 ; j<3 ; j++ )
                ai->color[2-j] = readChar();
            readChar(); // 0x00

            int w = ai->max_width * ai->param / ai->max_param;
            if ( ai->max_width > 0 && w > 0 ) ai->orig_pos.w = w;

            ai->scalePosWH( screen_ratio1, screen_ratio2 );
            ai->allocImage( ai->pos.w, ai->pos.h );
            ai->fill( ai->color[0], ai->color[1], ai->color[2], 0xff );
        }
        else{
            readInt(); // -1
            readInt(); // 0
            readInt(); // 0
            readInt(); // 0
            readInt(); // 0
            readInt(); // 0
        }
    }

    prnumclearCommand();
    for ( i=0 ; i<MAX_PARAM_NUM ; i++ ){
        j = readInt();
        if ( prnum_info[i] ){
            ai = prnum_info[i] = new AnimationInfo();
            ai->trans_mode = AnimationInfo::TRANS_STRING;
            ai->num_of_cells = 1;
            ai->color_list = new uchar3[1];

            ai->param = j;
            ai->orig_pos.x = readInt();
            ai->orig_pos.y = readInt();
            ai->scalePosXY( screen_ratio1, screen_ratio2 );
            ai->font_size_xy[0] = readInt();
            ai->font_size_xy[1] = readInt();
            for ( j=0 ; j<3 ; j++ )
                ai->color_list[0][2-j] = readChar();
            readChar(); // 0x00

            char num_buf[7];
            script_h.getStringFromInteger( num_buf, ai->param, 3 );
            setStr( &ai->file_name, num_buf );

            setupAnimationInfo( ai );
        }
        else{
            readInt(); // -1
            readInt(); // 0
            readInt(); // 0
            readInt(); // 0
            readInt(); // 0
        }
    }

    readInt(); // 1
    readInt(); // 0
    readInt(); // 1
    btndef_info.remove();
    readStr( &btndef_info.image_name );
    if ( btndef_info.image_name && btndef_info.image_name[0] != '\0' ){
        parseTaggedString( &btndef_info );
        setupAnimationInfo( &btndef_info );
        SDL_SetAlpha( btndef_info.image_surface, DEFAULT_BLIT_FLAG, SDL_ALPHA_OPAQUE );
    }

    if ( file_version >= 202 )
        readArrayVariable();
    
    readInt(); // 0
    if ( readChar() == 1 ) erase_text_window_mode = 2;
    readChar(); // 0
    readChar(); // 0
    readChar(); // 0
    readStr( &loop_bgm_name[0] );
    readStr( &loop_bgm_name[1] );
    if ( loop_bgm_name[0] ) {
        if ( loop_bgm_name[1] )
            playSound(loop_bgm_name[1],
                      SOUND_PRELOAD|SOUND_CHUNK, false, MIX_LOOPBGM_CHANNEL1);
        playSound(loop_bgm_name[0],
                  SOUND_CHUNK, false, MIX_LOOPBGM_CHANNEL0);
    }

    if ( file_version >= 201 ){
        if ( readInt() == 1 ) rubyon_flag = true;
        else                  rubyon_flag = false;
        sentence_font.rubyon_flag = rubyon_flag;
        ruby_struct.font_size_xy[0] = readInt();
        ruby_struct.font_size_xy[1] = readInt();
        readStr( &ruby_struct.font_name );
    }

    if (file_version >= 204){
        readInt();
        
        for ( i=0 ; i<MAX_SPRITE2_NUM ; i++ ){
            ai = &sprite2_info[i];

            ai->remove();
            readStr( &ai->image_name );
            if ( ai->image_name ){
                parseTaggedString( ai );
                setupAnimationInfo( ai );
            }
            ai->orig_pos.x = readInt();
            ai->orig_pos.y = readInt();
            ai->scalePosXY( screen_ratio1, screen_ratio2 );
            ai->scale_x = readInt();
            ai->scale_y = readInt();
            ai->rot     = readInt();
            if ( readInt() == 1 ) ai->visible = true;
            else                  ai->visible = false;
            j = readInt();
            if (j == -1)
                ai->trans = 256;
            else
                ai->trans = j;
            ai->blending_mode = readInt();
            ai->calcAffineMatrix();
        }
        
        readInt();
        readInt();
        if (file_version >= 205) readInt(); // 1
        readInt();
        readInt();
        readInt();
        readInt();
        if (file_version >= 205) readChar(); // 0
    }

    if (file_version >= 206){
        readInt(); // 0
        readInt(); // 160
        readInt(); // 320
        readInt(); // 480
        if (file_version >= 207)
            underline_value = readInt();
        else
            readInt(); // 480
    }
    
    int text_num = readInt();
    start_page = current_page;
    for ( i=0 ; i<text_num ; i++ ){
        clearCurrentPage();
        do{
            current_page->text[current_page->text_count] = readChar();
        }
        while( current_page->text[current_page->text_count++] );
        if (file_version == 203) readChar(); // 0
        current_page->text_count--;
        current_page = current_page->next;
    }
    clearCurrentPage();

    if (file_version >= 205){
        Page *page = start_page;
        j = readInt();
        for (i=0 ; i<j ; i++){
            readStr(&page->tag);
            page = page->next;
        }
    }
    else if (file_version >= 204){
        readInt();
        readInt();
    }
    
    i = readInt();
    current_label_info = script_h.getLabelByLine( i );
    current_line = i - current_label_info.start_line;
    //printf("load %d:%d(%d-%d)\n", current_label_info.start_line, current_line, i, current_label_info.start_line);
    char *buf = script_h.getAddressByLine( i );
    
    j = readInt();
    for ( i=0 ; i<j ; i++ ){
        while( *buf != ':' ) buf++;
        buf++;
    }
    script_h.setCurrent( buf );

    display_mode = shelter_display_mode = DISPLAY_MODE_TEXT;
    clickstr_state = CLICK_NONE;
    draw_cursor_flag = false;
    
    return 0;
}
示例#10
0
UI_Main::UI_Main( int vidWidth, int vidHeight, int protocol, int sharedSeed, bool demoPlaying, const char *demoName )
	// pointers to zero
	: asmodule(0), rocketModule(0),
	levelshot_fmt(0), datetime_fmt(0), duration_fmt(0), filetype_fmt(0), colorcode_fmt(0), 
	crosshair_fmt(0), empty_fmt(0),
	serverBrowser(0), gameTypes(0), maps(0), vidProfiles(0), huds(0), videoModes(0), 
	demos(0), mods(0), 
	playerModels(0), crosshairs(0), 
	navigator(0), /* backwards development compatibility: */ currentLoader(0),

	// other members
	mousex(0), mousey(0), gameProtocol(protocol),
	menuVisible(false), forceMenu(false), showNavigationStack(false), demoInfo(demoName), sharedSeed(sharedSeed)
{
	// instance
	self = this;

	Vector4Set( colorWhite, 1, 1, 1, 1 );
	ui_basepath = trap::Cvar_Get( "ui_basepath", "/ui/baseui", CVAR_ARCHIVE );
	ui_cursor = trap::Cvar_Get( "ui_cursor", "cursors/default.rml", CVAR_DEVELOPER );
	ui_developer = trap::Cvar_Get( "developer", "0", 0 );

	// temp fix for missing background on start.. populate refreshState with some nice values
	refreshState.clientState = CA_UNINITIALIZED;
	refreshState.width = vidWidth;
	refreshState.height = vidHeight;
	refreshState.drawBackground = true;

	demoInfo.setPlaying( demoPlaying );

	if( !initRocket() )
		throw std::runtime_error( "UI: Failed to initialize libRocket" );

	registerRocketCustoms();

	createDataSources();
	createFormatters();

	navigator = __new__( NavigationStack )();
	streamCache = __new__( StreamCache )();

	streamCache->Init();

	if( !initAS() )
		throw std::runtime_error( "UI: Failed to initialize AngelScript" );

	// this after instantiation
	ASUI::BindGlobals( self->getAS() );

	// load cursor document
	loadCursor();

	// this has to be called after AS API is fully loaded
	preloadUI();

	// commands
	trap::Cmd_AddCommand( "ui_reload", ReloadUI_Cmd_f );
	trap::Cmd_AddCommand( "ui_dumpapi", DumpAPI_f );
	trap::Cmd_AddCommand( "ui_printdocs", PrintDocuments_Cmd );

	trap::Cmd_AddCommand( "menu_force", M_Menu_Force_f );
	trap::Cmd_AddCommand( "menu_open", M_Menu_Open_f );
	trap::Cmd_AddCommand( "menu_close", M_Menu_Close_f );

	trap::Cmd_AddCommand( "menu_tvchannel_add", &M_Menu_AddTVChannel_f );
	trap::Cmd_AddCommand( "menu_tvchannel_remove", &M_Menu_RemoveTVChannel_f );
}
示例#11
0
 void Tool::setCursorVirtualScene(std::string fileName, int hotSpotX, int hotSpotY)
 {
     cursorVirtualScene = loadCursor(fileName, hotSpotX, hotSpotY);
 }
示例#12
0
 void Tool::setCursorCamera(std::string fileName, int hotSpotX, int hotSpotY)
 {
     cursorCamera = loadCursor(fileName, hotSpotX, hotSpotY);
 }
示例#13
0
WzMainWindow::WzMainWindow(QSize resolution, const QGLFormat &format, QWidget *parent) : QtGameWidget(resolution, format, parent)
{
	myself = this;
	notReadyToPaint = true;
	tickCount.start();
	for (int i = 0; i < CURSOR_MAX; cursors[i++] = NULL) ;
	setAutoFillBackground(false);
	setAutoBufferSwap(false);
	setMouseTracking(true);

	// Mac apps typically don't have window icons unless document-based.
#if !defined(WZ_OS_MAC)
	setWindowIcon(QIcon(QPixmap::fromImage(QImage("wz::images/warzone2100.png", "PNG"))));
#endif
	setWindowTitle(PACKAGE_NAME);

	QImageReader buffer("wz::images/intfac5.png", "PNG");
	if (!buffer.canRead())
	{
		debug(LOG_ERROR, "Failed to read cursor image: %s", buffer.errorString().toAscii().constData());
	}
	loadCursor(CURSOR_EMBARK, 0, 128, buffer);
	loadCursor(CURSOR_DEST, 32, 128, buffer);
	loadCursor(CURSOR_DEFAULT, 64, 128, buffer);
	loadCursor(CURSOR_BUILD, 96, 128, buffer);
	loadCursor(CURSOR_SCOUT, 128, 128, buffer);
	loadCursor(CURSOR_DISEMBARK, 160, 128, buffer);
	loadCursor(CURSOR_ATTACK, 192, 128, buffer);
	loadCursor(CURSOR_GUARD, 224, 128, buffer);
	loadCursor(CURSOR_FIX, 0, 160, buffer);
	loadCursor(CURSOR_SELECT, 32, 160, buffer);
//	loadCursor(CURSOR_REPAIR, 64, 160, buffer);		// FIX ME: This IS in infac.img, but the define is MIA
	loadCursor(CURSOR_SEEKREPAIR, 64, 160, buffer);	// FIX ME: This is NOT in infac.img!
	loadCursor(CURSOR_PICKUP, 96, 160, buffer);
	loadCursor(CURSOR_NOTPOSSIBLE, 128, 160, buffer);
	loadCursor(CURSOR_MOVE, 160, 160, buffer);
	loadCursor(CURSOR_LOCKON, 192, 160, buffer);
//	loadCursor(CURSOR_ECM, 224, 160, buffer);		// FIX ME: Not defined yet!
	loadCursor(CURSOR_JAM, 224, 160, buffer);		// FIX ME: This is NOT in infac.img, and is using IMAGE CURSOR ECM ?
	loadCursor(CURSOR_ATTACH, 0, 192, buffer);
	loadCursor(CURSOR_BRIDGE, 32, 192, buffer);
	loadCursor(CURSOR_BOMB, 64, 192, buffer);

	// Reused (unused) cursors
	cursors[CURSOR_ARROW] = new QCursor(Qt::ArrowCursor);
	cursors[CURSOR_MENU] = new QCursor(Qt::ArrowCursor);
	cursors[CURSOR_BOMB] = new QCursor(Qt::ArrowCursor);
	cursors[CURSOR_EDGEOFMAP] = new QCursor(Qt::ArrowCursor);
	cursors[CURSOR_SIGHT] = new QCursor(Qt::ArrowCursor);
	cursors[CURSOR_TARGET] = new QCursor(Qt::ArrowCursor);
	cursors[CURSOR_UARROW] = new QCursor(Qt::SizeVerCursor);
	cursors[CURSOR_DARROW] = new QCursor(Qt::SizeVerCursor);
	cursors[CURSOR_LARROW] = new QCursor(Qt::SizeHorCursor);
	cursors[CURSOR_RARROW] = new QCursor(Qt::SizeHorCursor);

	// Fonts
	regularFont.setFamily("DejaVu Sans");
	regularFont.setPixelSize(12);
	boldFont.setFamily("DejaVu Sans");
	boldFont.setPixelSize(21);
	boldFont.setWeight(QFont::DemiBold);
	smallFont.setFamily("DejaVu Sans");
	smallFont.setPixelSize(9);

	// Want focusOutEvent messages.
	setFocusPolicy(Qt::StrongFocus);

	// set radix character (again) to the period (".")
	setlocale(LC_NUMERIC, "C");

#if !defined(WZ_OS_MAC)
	// Want áéíóú inputMethodEvent messages.
	setAttribute(Qt::WA_InputMethodEnabled, true);
#else
	// But not on the Mac (no ALT+H on US Extended Keyboards)
	setAttribute(Qt::WA_InputMethodEnabled, false);
#endif
}