Exemplo n.º 1
0
void SetViewport(int offsx,int offsy) {
    DEBUG_CONSOLE("Viewport locked to %d,%d", offsx, offsy);
    offsetx = multiply_up_coordinate(offsx);
    offsety = multiply_up_coordinate(offsy);
    check_viewport_coords();
    play.offsets_locked = 1;
}
Exemplo n.º 2
0
void check_viewport_coords() 
{
    if (offsetx<0) offsetx=0;
    if (offsety<0) offsety=0;

    int roomWidth = multiply_up_coordinate(thisroom.width);
    int roomHeight = multiply_up_coordinate(thisroom.height);
    if (offsetx + scrnwid > roomWidth)
        offsetx = roomWidth - scrnwid;
    if (offsety + scrnhit > roomHeight)
        offsety = roomHeight - scrnhit;
}
Exemplo n.º 3
0
void check_viewport_coords() 
{
    if (offsetx<0) offsetx=0;
    if (offsety<0) offsety=0;

    int roomWidth = multiply_up_coordinate(thisroom.width);
    int roomHeight = multiply_up_coordinate(thisroom.height);
    if (offsetx + play.viewport.GetWidth() > roomWidth)
        offsetx = roomWidth - play.viewport.GetWidth();
    if (offsety + play.viewport.GetHeight() > roomHeight)
        offsety = roomHeight - play.viewport.GetHeight();
}
Exemplo n.º 4
0
void update_viewport()
{
    if ((thisroom.width > BASEWIDTH) || (thisroom.height > BASEHEIGHT)) {
        if (play.offsets_locked == 0) {
            offsetx = multiply_up_coordinate(playerchar->x) - scrnwid/2;
            offsety = multiply_up_coordinate(playerchar->y) - scrnhit/2;
        }
        check_viewport_coords();
    }
    else {
        offsetx=0;
        offsety=0;
    }
}
Exemplo n.º 5
0
void DisplayTopBar(int ypos, int ttexcol, int backcol, char *title, char*texx, ...) {

    strcpy(topBar.text, get_translation(title));

    char displbuf[3001];
    va_list ap;
    va_start(ap,texx);
    my_sprintf(displbuf, get_translation(texx), ap);
    va_end(ap);

    if (ypos > 0)
        play.top_bar_ypos = ypos;
    if (ttexcol > 0)
        play.top_bar_textcolor = ttexcol;
    if (backcol > 0)
        play.top_bar_backcolor = backcol;

    topBar.wantIt = 1;
    topBar.font = FONT_NORMAL;
    topBar.height = wgetfontheight(topBar.font);
    topBar.height += multiply_up_coordinate(play.top_bar_borderwidth) * 2 + get_fixed_pixel_size(1);

    // they want to customize the font
    if (play.top_bar_font >= 0)
        topBar.font = play.top_bar_font;

    // DisplaySpeech normally sets this up, but since we're not going via it...
    if (play.cant_skip_speech & SKIP_AUTOTIMER)
        play.messagetime = GetTextDisplayTime(texx);

    DisplayAtY(play.top_bar_ypos, displbuf);
}
Exemplo n.º 6
0
void DisplayAtY (int ypos, char *texx) {
    if ((ypos < -1) || (ypos >= GetMaxScreenHeight()))
        quitprintf("!DisplayAtY: invalid Y co-ordinate supplied (used: %d; valid: 0..%d)", ypos, GetMaxScreenHeight());

    // Display("") ... a bit of a stupid thing to do, so ignore it
    if (texx[0] == 0)
        return;

    if (ypos > 0)
        ypos = multiply_up_coordinate(ypos);

    if (game.options[OPT_ALWAYSSPCH])
        DisplaySpeechAt(-1, (ypos > 0) ? divide_down_coordinate(ypos) : ypos, -1, game.playercharacter, texx);
    else { 
        // Normal "Display" in text box

        if (screen_is_dirty) {
            // erase any previous DisplaySpeech
            play.disabled_user_interface ++;
            mainloop();
            play.disabled_user_interface --;
        }

        _display_at(-1,ypos,scrnwid/2+scrnwid/4,get_translation(texx),1,0, 0, 0, false);
    }
}
Exemplo n.º 7
0
int GetTextHeight(char *text, int fontnum, int width) {
  VALIDATE_STRING(text);
  if ((fontnum < 0) || (fontnum >= game.numfonts))
    quit("!GetTextHeight: invalid font number.");

  int texthit = wgetfontheight(fontnum);

  break_up_text_into_lines(multiply_up_coordinate(width), fontnum, text);

  return divide_down_coordinate(texthit * numlines);
}
Exemplo n.º 8
0
void DisplayAt(int xxp,int yyp,int widd,char*texx, ...) {
    char displbuf[STD_BUFFER_SIZE];
    va_list ap;
    va_start(ap,texx);
    my_sprintf(displbuf, get_translation(texx), ap);
    va_end(ap);

    multiply_up_coordinates(&xxp, &yyp);
    widd = multiply_up_coordinate(widd);

    if (widd<1) widd=scrnwid/2;
    if (xxp<0) xxp=scrnwid/2-widd/2;
    _display_at(xxp,yyp,widd,displbuf,1,0, 0, 0, false);
}
Exemplo n.º 9
0
void IAGSEngine::RoomToViewport (int32 *x, int32 *y) {
  if (x)
    x[0] = multiply_up_coordinate(x[0]) - offsetx;
  if (y)
    y[0] = multiply_up_coordinate(y[0]) - offsety;
}
Exemplo n.º 10
0
/* *** SCRIPT SYMBOL: [GUI] GUI::set_Y *** */
void GUI_SetY(ScriptGUI *tehgui, int yy) {
  if (yy >= thisroom.height)
    quit("!GUI.Y: co-ordinates specified are out of range.");

  tehgui->gui->y = multiply_up_coordinate(yy);
}
Exemplo n.º 11
0
/* *** SCRIPT SYMBOL: [GUI] GUI::set_X *** */
void GUI_SetX(ScriptGUI *tehgui, int xx) {
  if (xx >= thisroom.width)
    quit("!GUI.X: co-ordinates specified are out of range.");

  tehgui->gui->x = multiply_up_coordinate(xx);
}
Exemplo n.º 12
0
void GUIControl_SetHeight(GUIObject *guio, int newhit) {
  guio->hit = multiply_up_coordinate(newhit);
  guio->Resized();
  guis[guio->guin].control_positions_changed();
  guis_need_update = 1;
}
Exemplo n.º 13
0
void GUIControl_SetWidth(GUIObject *guio, int newwid) {
  guio->wid = multiply_up_coordinate(newwid);
  guio->Resized();
  guis[guio->guin].control_positions_changed();
  guis_need_update = 1;
}
Exemplo n.º 14
0
void GUIControl_SetY(GUIObject *guio, int yy) {
  guio->y = multiply_up_coordinate(yy);
  guis[guio->guin].control_positions_changed();
  guis_need_update = 1;
}