예제 #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;
}
예제 #2
0
// 0 = click mouse or key to skip
// 1 = key only
// 2 = can't skip at all
// 3 = only on keypress, no auto timer
// 4 = mouseclick only
void SetSkipSpeech (int newval) {
    if ((newval < 0) || (newval > 4))
        quit("!SetSkipSpeech: invalid skip mode specified (0-4)");

    DEBUG_CONSOLE("SkipSpeech style set to %d", newval);
    play.cant_skip_speech = user_to_internal_skip_speech(newval);
}
예제 #3
0
void NewRoom(int nrnum) {
    if (nrnum < 0)
        quitprintf("!NewRoom: room change requested to invalid room number %d.", nrnum);

    if (displayed_room < 0) {
        // called from game_start; change the room where the game will start
        playerchar->room = nrnum;
        return;
    }


    DEBUG_CONSOLE("Room change requested to room %d", nrnum);
    EndSkippingUntilCharStops();

    can_run_delayed_command();

    if (play.stop_dialog_at_end != DIALOG_NONE) {
        if (play.stop_dialog_at_end == DIALOG_RUNNING)
            play.stop_dialog_at_end = DIALOG_NEWROOM + nrnum;
        else {
            quitprintf("!NewRoom: two NewRoom/RunDialog/StopDialog requests within dialog; last was called in \"%s\", line %d",
                last_in_dialog_request_script_pos.Section.GetCStr(), last_in_dialog_request_script_pos.Line);
        }
        return;
    }

    get_script_position(last_in_dialog_request_script_pos);

    if (in_leaves_screen >= 0) {
        // NewRoom called from the Player Leaves Screen event -- just
        // change which room it will go to
        in_leaves_screen = nrnum;
    }
    else if (in_enters_screen) {
        setevent(EV_NEWROOM,nrnum);
        return;
    }
    else if (in_inv_screen) {
        inv_screen_newroom = nrnum;
        return;
    }
    else if ((inside_script==0) & (in_graph_script==0)) {
        new_room(nrnum,playerchar);
        return;
    }
    else if (inside_script) {
        curscript->queue_action(ePSANewRoom, nrnum, "NewRoom");
        // we might be within a MoveCharacterBlocking -- the room
        // change should abort it
        if ((playerchar->walking > 0) && (playerchar->walking < TURNING_AROUND)) {
            // nasty hack - make sure it doesn't move the character
            // to a walkable area
            mls[playerchar->walking].direct = 1;
            StopMoving(game.playercharacter);
        }
    }
    else if (in_graph_script)
        gs_to_newroom = nrnum;
}
예제 #4
0
void GUIControl_SetSize(GUIObject *guio, int newwid, int newhit) {
  if ((newwid < 2) || (newhit < 2))
    quit("!SetGUIObjectSize: new size is too small (must be at least 2x2)");

  DEBUG_CONSOLE("SetGUIObject %d,%d size %d,%d", guio->guin, guio->objn, newwid, newhit);
  GUIControl_SetWidth(guio, newwid);
  GUIControl_SetHeight(guio, newhit);
}
예제 #5
0
/* *** SCRIPT SYMBOL: [GUI] InterfaceOff *** */
void InterfaceOff(int ifn) {
  if ((ifn<0) | (ifn>=game.numgui)) quit("!GUIOff: invalid GUI specified");
  if ((guis[ifn].on==0) && (guis[ifn].popup!=POPUP_MOUSEY)) {
    DEBUG_CONSOLE("GUIOff(%d) ignored (already off)", ifn);
    return;
  }
  DEBUG_CONSOLE("GUI %d turned off", ifn);
  guis[ifn].on=0;
  if (guis[ifn].mouseover>=0) {
    // Make sure that the overpic is turned off when the GUI goes off
    guis[ifn].objs[guis[ifn].mouseover]->MouseLeave();
    guis[ifn].mouseover = -1;
  }
  guis[ifn].control_positions_changed();
  guis_need_update = 1;
  // modal interface
  if (guis[ifn].popup==POPUP_SCRIPT) UnPauseGame();
  else if (guis[ifn].popup==POPUP_MOUSEY) guis[ifn].on=-1;
}
예제 #6
0
/* *** SCRIPT SYMBOL: [Button] Button::set_MouseOverGraphic *** */
void Button_SetMouseOverGraphic(GUIButton *guil, int slotn) {
  DEBUG_CONSOLE("GUI %d Button %d mouseover set to slot %d", guil->guin, guil->objn, slotn);

  if ((guil->isover != 0) && (guil->ispushed == 0))
    guil->usepic = slotn;
  guil->overpic = slotn;

  guis_need_update = 1;
  FindAndRemoveButtonAnimation(guil->guin, guil->objn);
}
예제 #7
0
/* *** SCRIPT SYMBOL: [Button] Button::set_PushedGraphic *** */
void Button_SetPushedGraphic(GUIButton *guil, int slotn) {
  DEBUG_CONSOLE("GUI %d Button %d pushed set to slot %d", guil->guin, guil->objn, slotn);

  if (guil->ispushed)
    guil->usepic = slotn;
  guil->pushedpic = slotn;

  guis_need_update = 1;
  FindAndRemoveButtonAnimation(guil->guin, guil->objn);
}
예제 #8
0
/* *** SCRIPT SYMBOL: [GUI] InterfaceOn *** */
void InterfaceOn(int ifn) {
  if ((ifn<0) | (ifn>=game.numgui))
    quit("!GUIOn: invalid GUI specified");

  EndSkippingUntilCharStops();

  if (guis[ifn].on == 1) {
    DEBUG_CONSOLE("GUIOn(%d) ignored (already on)", ifn);
    return;
  }
  guis_need_update = 1;
  guis[ifn].on=1;
  DEBUG_CONSOLE("GUI %d turned on", ifn);
  // modal interface
  if (guis[ifn].popup==POPUP_SCRIPT) PauseGame();
  else if (guis[ifn].popup==POPUP_MOUSEY) guis[ifn].on=0;
  // clear the cached mouse position
  guis[ifn].control_positions_changed();
  guis[ifn].poll();
}
예제 #9
0
void SetWalkBehindBase(int wa,int bl) {
  if ((wa < 1) || (wa >= MAX_OBJ))
    quit("!SetWalkBehindBase: invalid walk-behind area specified");

  if (bl != croom->walkbehind_base[wa]) {
    walk_behind_baselines_changed = 1;
    invalidate_cached_walkbehinds();
    croom->walkbehind_base[wa] = bl;
    DEBUG_CONSOLE("Walk-behind %d baseline changed to %d", wa, bl);
  }
}
예제 #10
0
void System_SetGamma(int newValue) {
    if ((newValue < 0) || (newValue > 200))
        quitprintf("!System.Gamma: value must be between 0-200 (not %d)", newValue);

    if (play.gamma_adjustment != newValue) {
        DEBUG_CONSOLE("Gamma control set to %d", newValue);
        play.gamma_adjustment = newValue;

        if (gfxDriver->SupportsGammaControl())
            gfxDriver->SetGamma(newValue);
    }
}
예제 #11
0
/* *** SCRIPT SYMBOL: [Button] Button::set_NormalGraphic *** */
void Button_SetNormalGraphic(GUIButton *guil, int slotn) {
  DEBUG_CONSOLE("GUI %d Button %d normal set to slot %d", guil->guin, guil->objn, slotn);
  // normal pic - update if mouse is not over, or if there's no overpic
  if (((guil->isover == 0) || (guil->overpic < 1)) && (guil->ispushed == 0))
    guil->usepic = slotn;
  guil->pic = slotn;
  // update the clickable area to the same size as the graphic
  guil->wid = spritewidth[slotn];
  guil->hit = spriteheight[slotn];

  guis_need_update = 1;
  FindAndRemoveButtonAnimation(guil->guin, guil->objn);
}
예제 #12
0
void SetAmbientTint (int red, int green, int blue, int opacity, int luminance) {
    if ((red < 0) || (green < 0) || (blue < 0) ||
        (red > 255) || (green > 255) || (blue > 255) ||
        (opacity < 0) || (opacity > 100) ||
        (luminance < 0) || (luminance > 100))
        quit("!SetTint: invalid parameter. R,G,B must be 0-255, opacity & luminance 0-100");

    DEBUG_CONSOLE("Set ambient tint RGB(%d,%d,%d) %d%%", red, green, blue, opacity);

    play.rtint_red = red;
    play.rtint_green = green;
    play.rtint_blue = blue;
    play.rtint_level = opacity;
    play.rtint_light = (luminance * 25) / 10;
}
예제 #13
0
void ResetRoom(int nrnum) {
    if (nrnum == displayed_room)
        quit("!ResetRoom: cannot reset current room");
    if ((nrnum<0) | (nrnum>=MAX_ROOMS))
        quit("!ResetRoom: invalid room number");

    if (isRoomStatusValid(nrnum))
    {
        RoomStatus* roomstat = getRoomStatus(nrnum);
        if (roomstat->beenhere)
        {
            if (roomstat->tsdata != NULL)
                free(roomstat->tsdata);
            roomstat->tsdata = NULL;
            roomstat->tsdatasize = 0;
        }
        roomstat->beenhere = 0;
    }

    DEBUG_CONSOLE("Room %d reset to original state", nrnum);
}
예제 #14
0
파일: window.cpp 프로젝트: Gr390ry/Shade
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance
	, LPSTR lpszCmdParam, int nCmdShow)
{
#if defined (DEBUG) | defined (_DEBUG)
	_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif

	//아이콘 로드
	HICON hIcon = reinterpret_cast<HICON>(::LoadImage(hInstance, MAKEINTRESOURCE(IDI_ICON2),
											IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR));
	WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L,
					GetModuleHandle(NULL),
					hIcon,
					NULL, 
					NULL, 
					NULL,
					GENERIC::gAppName.c_str(),
					hIcon };
	RegisterClassEx(&wc);

	DWORD style = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX;
	HWND hWnd = CreateWindow(GENERIC::gAppName.c_str(), GENERIC::gAppName.c_str(),
		style, CW_USEDEFAULT, 0, GENERIC::windowWidth, GENERIC::windowHeight,
		GetDesktopWindow(), NULL, wc.hInstance, NULL);


	Console::Get()->Initialize("Debug Console", hInstance, hPrevInstance, lpszCmdParam, nCmdShow);
	DEBUG_CONSOLE("Hello!\n");	

	gAppPuased = false;
	InitializeObjects(hWnd);
	SetWindowRect(hWnd);
	ShowWindow(hWnd, SW_SHOWDEFAULT);
	UpdateWindow(hWnd);	

	MSG msg;
	ZeroMemory(&msg, sizeof(msg));

	

	while (msg.message != WM_QUIT)
	{
		if (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}

		GameTimer::Get()->UpdateTickCount();


		if (!gAppPuased)
		{
			float tick = GameTimer::Get()->DeltaTime();

			General::Get()->Update(tick);
			//RenderDevice::Get()->UpdateScene(tick);
			RenderDevice::Get()->Render11();
			CalculateFrameStats(hWnd);
		}
		else
		{
			Sleep(1);
		}		
	}

	RenderDevice::Get()->Release();
	UnregisterClass(GENERIC::gAppName.c_str(), wc.hInstance);
	return 0;
}
예제 #15
0
void EnableHotspot(int hsnum) {
    if ((hsnum<1) | (hsnum>=MAX_HOTSPOTS))
        quit("!EnableHotspot: invalid hotspot specified");
    croom->hotspot_enabled[hsnum]=1;
    DEBUG_CONSOLE("Hotspot %d re-enabled", hsnum);
}
예제 #16
0
void ReleaseViewport() {
    play.offsets_locked = 0;
    DEBUG_CONSOLE("Viewport released back to engine control");
}
예제 #17
0
void IAGSEngine::PrintDebugConsole (const char *text) {
  DEBUG_CONSOLE("[PLUGIN] %s", text);
}
예제 #18
0
void walk_character(int chac,int tox,int toy,int ignwal, bool autoWalkAnims) {
  CharacterInfo*chin=&game.chars[chac];
  if (chin->room!=displayed_room)
    quit("!MoveCharacter: character not in current room");

  chin->flags &= ~CHF_MOVENOTWALK;

  int toxPassedIn = tox, toyPassedIn = toy;
  int charX = convert_to_low_res(chin->x);
  int charY = convert_to_low_res(chin->y);
  tox = convert_to_low_res(tox);
  toy = convert_to_low_res(toy);

  if ((tox == charX) && (toy == charY)) {
    StopMoving(chac);
    DEBUG_CONSOLE("%s already at destination, not moving", chin->scrname);
    return;
  }

  if ((chin->animating) && (autoWalkAnims))
    chin->animating = 0;

  if (chin->idleleft < 0) {
    ReleaseCharacterView(chac);
    chin->idleleft=chin->idletime;
  }
  // stop them to make sure they're on a walkable area
  // but save their frame first so that if they're already
  // moving it looks smoother
  int oldframe = chin->frame;
  int waitWas = 0, animWaitWas = 0;
  // if they are currently walking, save the current Wait
  if (chin->walking)
  {
    waitWas = chin->walkwait;
    animWaitWas = charextra[chac].animwait;
  }

  StopMoving (chac);
  chin->frame = oldframe;
  // use toxPassedIn cached variable so the hi-res co-ordinates
  // are still displayed as such
  DEBUG_CONSOLE("%s: Start move to %d,%d", chin->scrname, toxPassedIn, toyPassedIn);

  int move_speed_x = chin->walkspeed;
  int move_speed_y = chin->walkspeed;

  if (chin->walkspeed_y != UNIFORM_WALK_SPEED)
    move_speed_y = chin->walkspeed_y;

  if ((move_speed_x == 0) && (move_speed_y == 0)) {
    debug_log("Warning: MoveCharacter called for '%s' with walk speed 0", chin->name);
  }

  set_route_move_speed(move_speed_x, move_speed_y);
  set_color_depth(8);
  int mslot=find_route(charX, charY, tox, toy, prepare_walkable_areas(chac), chac+CHMLSOFFS, 1, ignwal);
  set_color_depth(final_col_dep);
  if (mslot>0) {
    chin->walking = mslot;
    mls[mslot].direct = ignwal;

    if ((game.options[OPT_NATIVECOORDINATES] != 0) &&
        (game.default_resolution > 2))
    {
      convert_move_path_to_high_res(&mls[mslot]);
    }
    // cancel any pending waits on current animations
    // or if they were already moving, keep the current wait - 
    // this prevents a glitch if MoveCharacter is called when they
    // are already moving
    if (autoWalkAnims)
    {
      chin->walkwait = waitWas;
      charextra[chac].animwait = animWaitWas;

      if (mls[mslot].pos[0] != mls[mslot].pos[1]) {
        fix_player_sprite(&mls[mslot],chin);
      }
    }
    else
      chin->flags |= CHF_MOVENOTWALK;
  }
  else if (autoWalkAnims) // pathfinder couldn't get a route, stand them still
    chin->frame = 0;
}