2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-14 14:37:41 +00:00

Compare commits

..

26 Commits

Author SHA1 Message Date
23f4d22b9b Make Python.Cheat little bit safer 2012-07-24 23:40:43 +02:00
c3589e3fc4 Remove Python.RunFile 2012-07-24 21:17:51 +02:00
431bb5ff90 Merged in Skoader/cwe-ou/window-size (pull request #18)
Fix improperly calculated window size in initial Windowed mode.

User visible effect: This changeset removes an (in)visible grid of seams or blurriness in the client window. They are most noticeable when moving the cursor over them.

Window shouldn't have a resizing border.
2012-10-13 00:47:35 +02:00
1d309e3ce5 Merged in Skoader/cwe-ou/window-cursor (pull request #21, update for #17)
Free the cursor

Allows the cursor to leave the client window and disables mouse recentering at load time.
2012-10-13 00:33:55 +02:00
78bfdad9c4 Merged in cwalther/cwe/cursors2 (pull request #10)
Improved Cursors

This is the second attempt at getting the following improvements to the Uru mouse cursors into CWE-ou:

* fix the blurriness
* add a subtle shadow to fix cursors being invisible on light backgrounds
* cleaner, more regular appearance

A (slightly outdated) picture for comparison is at http://forums.openuru.org/viewtopic.php?t=558&p=4265#p4265 , and anyone who has played on Gehn, TOC, or any other shard using the H'uru client has already seen the new cursors.

In order to do this properly, in a way that will continue to work in a cross-platform future, a lot of work done by Deledrius in the H'uru fork is included: He added PNG support to Plasma and introduced a client resource manager that loads resources such as the cursors, but also voice chat indicators and the loading linking book animation, which were also replaced by higher-quality recreations, fromfile instead of from Windows resources. resource.data

This also opens the way for other applications of PNG, such as saving the local copies of KI pictures in a lossless format instead of the heavily compressed JPEG we currently have.

Note: the new code requires a newer version of libpng than included with the CWE sources. Like other library dependencies, this must be installed separately. Instructions for that are at http://wiki.openuru.org/index.php?title=Build_the_client_with_MSVC_2003#Build_steps .
2012-10-13 00:28:09 +02:00
368d757bf8 Merged in Lyrositor/cwe-ou/jpeg (pull request #15)
Fix various JPEG issues.

These three commits fix various issues with JPEG images in Uru.
2012-10-13 00:14:10 +02:00
ca58d0e701 Merged in Lyrositor/cwe-ou/clickables-afk (pull request #14)
Allow clickables to function while sitting or AFK.

Fix from Hoikas. Original pull request: https://github.com/H-uru/Plasma/pull/176
2012-10-13 00:10:46 +02:00
a3592d9a0a Merged in Skoader/cwe-ou/msvc10 (pull request #11)
Update for Visual Studio 2010

Update for MSVC10 as briefly discussed in the forums.

This was done over several commits to make it easier to identify the changes that were required and to assist the review process. It adds VC10 project files for the client, most of the Plasma apps and the required Plasma libraries.

Dependencies. The new projects are configured to find 3rd party libraries in the same locations as the 2003 projects with the following exceptions - VS2010 doesn't like the old speex lib in the repository, and will instead look in - xiph/include/speex and xiph/lib. And the ogg and vorbis libraries are also expected to be in the same directory - xiph/include/ogg, xiph/include/vorbis and xiph/lib.

Project Configurations. Configurations have been setup for debug and release builds of the both the internal and external live client.
2012-10-13 00:08:52 +02:00
3cf35d0bc0 Merged in Lyrositor/cwe-ou (pull request #12)
Fixed console documentation

Fixed console documentation. Prompting for brief HTML documentation no longer appends a new group to the previous one (see https://github.com/H-uru/Plasma/issues/170). This has been tested both by myself and by H'uru members.
2012-10-13 00:04:54 +02:00
76ee9975b7 Window shouldn't have a resizing border.
This removes the WS_THICKFRAME & WS_MAXIMIZEBOX window styles in windowed mode.
2012-10-02 12:11:30 +10:00
7f3d416290 Fix no cursor when not the top level window.
WM_MOUSEMOVE messages were only processed when the window was active.
2012-09-27 22:40:37 +10:00
ec29c270e4 Fix clicking on the title bar does not activate the window. 2012-09-27 22:32:41 +10:00
357d4aa7d1 Fix no cursor on window frame and title bar.
Remove mouse capture and handle visibility via WM_SETCURSOR messages instead of
window activation events.
2012-09-27 22:25:38 +10:00
eba0968808 Avoid truncated window size after going from fullscreen to a window of the same size.
Must set the window size after the display resolution, otherwise Windows may clamp it to a smaller size than specified.
2012-06-17 00:38:07 +02:00
97b9503cb1 Merge MOULa build 912 from Cyan
- Update Scripts/Python/plasma/* with our changes from MOULSCRIPT-ou (apparently their build process uses or produces these, ours doesn't).
- Bump build ID.
2012-06-15 10:24:25 +02:00
68ba122afe Build 912 2012-06-14 17:09:15 -07:00
743419d9e5 Better centering and header consistency. 2012-05-13 09:14:47 -04:00
5951a11e86 Add static keyword back. 2012-05-13 08:51:32 -04:00
46810aa990 Fixed console documentation. Prompting for brief HTML documentation no longer appends a new group to the previous one (see https://github.com/H-uru/Plasma/issues/170). 2012-05-11 17:21:40 -04:00
fdc8e28c2f Allow clickables to function while sitting or AFK.
Less special casing FTW!
2012-03-09 23:30:31 -05:00
1cac4f85da Fix a potential crash in pyVaultImageNode.
Fixes a crash which can occur when attempting to fetch
an unsupported image type.
2012-02-09 23:47:22 -08:00
487f63f60b Fix mouse recentering.
Existing fix didn't apply until after SecurePreloader completed.
This disables the mouse recentering earlier.
2012-01-20 05:18:04 -08:00
f4b3a43026 Fix improperly calculated window size in initial Windowed mode. 2011-07-20 23:07:46 -07:00
3c552912fa Removed ClipCursor which prevented cursor from leaving client window.
Disabled cursor being re-centered during progress screen.
2011-07-10 19:10:51 -07:00
c3657d20a4 Fix incorrect JPEG file IO. 2011-05-10 02:56:28 -07:00
a87b691e33 Fix output height in plJPEG writer 2011-04-10 14:27:10 -07:00
18 changed files with 263 additions and 208 deletions

View File

@ -5480,6 +5480,22 @@ This event record is used to pass a ptKey variable to another python program"""
def addVarNumber(self,name,number):
"""Add a number variable event record to the Notify message
Method will try to pick appropriate variable type
This event record is used to pass a number variable to another python program"""
pass
def addVarFloat(self,name,number):
"""Add a float variable event record to the Notify message
This event record is used to pass a number variable to another python program"""
pass
def addVarInt(self,name,number):
"""Add a integer variable event record to the Notify message
This event record is used to pass a number variable to another python program"""
pass
def addVarNull(self,name):
"""Add a null (no data) variable event record to the Notify message
This event record is used to pass a number variable to another python program"""
pass

View File

@ -215,8 +215,10 @@ class PtNotificationType:
class PtNotifyDataType:
"""(none)"""
kNumber = 1
kFloat = 1
kKey = 2
kInt = 3
kNull = 4
class PtSDLReadWriteOptions:
"""(none)"""

View File

@ -69,7 +69,7 @@ kOfferLinkingBook=PtEventType.kOfferLinkingBook # [1]=offerer, [2]=link panel ID
# OnNotify Var Event Data Types
kVarNumberType=PtNotifyDataType.kNumber
kVarNumberType=PtNotifyDataType.kFloat
kVarKeyType=PtNotifyDataType.kKey
# OnNotify MultiStageEvent - what event types
kEnterStage=PtMultiStageEventType.kEnterStage
@ -179,8 +179,12 @@ def PtAddEvent(notify,event):
elif event[0] == kControlKeyEvent:
notify.addControlKeyEvent(event[1],event[2])
elif event[0] == kVariableEvent:
if event[2] == kVarNumberType:
notify.addVarNumber(event[1],event[3])
if event[2] == PtNotifyDataType.kFloat:
notify.addVarFloat(event[1],event[3])
elif event[2] == PtNotifyDataType.kInt:
notify.addVarInt(event[1],event[3])
elif event[2] == PtNotifyDataType.kNull:
notify.addVarNull(event[1])
elif event[2] == kVarKeyType:
notify.addVarKey(event[1],event[3])
elif event[0] == kFacingEvent:

View File

@ -767,7 +767,7 @@ hsBool plClient::MsgReceive(plMessage* msg)
{
ISetGraphicsDefaults();
ResetDisplayDevice(plPipeline::fDefaultPipeParams.Width, plPipeline::fDefaultPipeParams.Height, plPipeline::fDefaultPipeParams.ColorDepth, plPipeline::fDefaultPipeParams.Windowed,
plPipeline::fDefaultPipeParams.AntiAliasingAmount, plPipeline::fDefaultPipeParams.AnisotropicLevel, plPipeline::fDefaultPipeParams.VSync, true);
plPipeline::fDefaultPipeParams.AntiAliasingAmount, plPipeline::fDefaultPipeParams.AnisotropicLevel, plPipeline::fDefaultPipeParams.VSync);
}
break;
@ -1546,6 +1546,7 @@ hsBool plClient::StartInit()
pfGameGUIMgr::GetInstance()->SetAspectRatio( aspectratio );
plMouseDevice::Instance()->SetDisplayResolution((float)fPipeline->Width(), (float)fPipeline->Height());
plInputManager::SetRecenterMouse(false);
// create the listener for the audio system:
plListener* pLMod = TRACKED_NEW plListener;
@ -2164,55 +2165,61 @@ hsG3DDeviceModeRecord plClient::ILoadDevMode(const char* devModeFile)
return dmr;
}
void plClient::ResetDisplayDevice(int Width, int Height, int ColorDepth, hsBool Windowed, int NumAASamples, int MaxAnisotropicSamples, hsBool VSync, hsBool windowOnly)
void plClient::ResetDisplayDevice(int Width, int Height, int ColorDepth, hsBool Windowed, int NumAASamples, int MaxAnisotropicSamples, hsBool VSync)
{
if(!fPipeline) return;
int BorderWidth = 0, BorderHeight = 0, CaptionHeight = 0;
WindowActivate(false);
int ActualWidth;
int ActualHeight;
if( Windowed )
{
BorderWidth = GetSystemMetrics( SM_CXSIZEFRAME );
BorderHeight = GetSystemMetrics( SM_CYSIZEFRAME );
CaptionHeight = GetSystemMetrics( SM_CYCAPTION );
ActualWidth = Width + BorderWidth * 2;
ActualHeight = Height + BorderHeight * 2 + CaptionHeight;
SetWindowLong( fWindowHndl, GWL_STYLE,
WS_POPUP | WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VISIBLE);
SetWindowLong(fWindowHndl, GWL_EXSTYLE, 0);
}
else
{
SetWindowLong(fWindowHndl, GWL_STYLE,
WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_MAXIMIZE | WS_VISIBLE);
SetWindowLong(fWindowHndl, GWL_EXSTYLE, WS_EX_APPWINDOW);
}
if(!windowOnly)
fPipeline->ResetDisplayDevice(Width, Height, ColorDepth, Windowed, NumAASamples, MaxAnisotropicSamples, VSync);
float aspectratio = (float)Width / (float)Height;
plMouseDevice::Instance()->SetDisplayResolution((float)Width, (float)Height);
pfGameGUIMgr::GetInstance()->SetAspectRatio( aspectratio );
UINT flags = SWP_NOCOPYBITS | SWP_NOMOVE | SWP_SHOWWINDOW;
if(Windowed)
{
SetWindowPos( fWindowHndl, HWND_NOTOPMOST, 0, 0, ActualWidth, ActualHeight, flags );
}
else
{
SetWindowPos( fWindowHndl, HWND_TOP, 0, 0, Width, Height, flags );
::ClipCursor(nil);
}
fPipeline->ResetDisplayDevice(Width, Height, ColorDepth, Windowed, NumAASamples, MaxAnisotropicSamples, VSync);
ResizeDisplayDevice(Width, Height, Windowed);
WindowActivate(true);
}
void plClient::ResizeDisplayDevice(int Width, int Height, hsBool Windowed)
{
if (plMouseDevice::Instance())
plMouseDevice::Instance()->SetDisplayResolution((float)Width, (float)Height);
float aspectratio = (float)Width / (float)Height;
if (pfGameGUIMgr::GetInstance())
pfGameGUIMgr::GetInstance()->SetAspectRatio( aspectratio );
UInt32 winStyle, winExStyle;
if( Windowed )
{
// WS_VISIBLE appears necessary to avoid leaving behind framebuffer junk when going from windowed to a smaller window
winStyle = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_VISIBLE;
winExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
} else {
winStyle = WS_POPUP;
winExStyle = WS_EX_APPWINDOW;
}
SetWindowLong(fWindowHndl, GWL_STYLE, winStyle);
SetWindowLong(fWindowHndl, GWL_EXSTYLE, winExStyle);
UInt32 flags = SWP_NOCOPYBITS | SWP_SHOWWINDOW | SWP_FRAMECHANGED;
UInt32 OutsideWidth, OutsideHeight;
HWND insertAfter;
if( Windowed )
{
RECT winRect = { 0, 0, Width, Height };
AdjustWindowRectEx(&winRect, winStyle, false, winExStyle);
OutsideWidth = winRect.right - winRect.left;
OutsideHeight = winRect.bottom - winRect.top;
insertAfter = HWND_NOTOPMOST;
} else {
OutsideWidth = Width;
OutsideHeight = Height;
insertAfter = HWND_TOP;
}
SetWindowPos( fWindowHndl, insertAfter, 0, 0, OutsideWidth, OutsideHeight, flags );
}
void WriteBool(hsStream *stream, char *name, hsBool on )
{

View File

@ -292,7 +292,8 @@ public:
virtual hsBool WindowActive() const { return fWindowActive; }
void SetMessagePumpProc( plMessagePumpProc proc ) { fMessagePumpProc = proc; }
void ResetDisplayDevice(int Width, int Height, int ColorDepth, hsBool Windowed, int NumAASamples, int MaxAnisotropicSamples, hsBool VSync = false, hsBool windowOnly = false);
void ResetDisplayDevice(int Width, int Height, int ColorDepth, hsBool Windowed, int NumAASamples, int MaxAnisotropicSamples, hsBool VSync = false);
void ResizeDisplayDevice(int Width, int Height, hsBool Windowed);
void IDetectAudioVideoSettings();
void IWriteDefaultGraphicsSettings(const wchar* destFile);

View File

@ -58,6 +58,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "../plNetClient/plNetClientMgr.h"
#include "../plNetClient/plNetLinkingMgr.h"
#include "../plInputCore/plInputManager.h"
#include "../plInputCore/plInputDevice.h"
#include "../plUnifiedTime/plUnifiedTime.h"
#include "plPipeline.h"
#include "../plResMgr/plResManager.h"
@ -453,7 +454,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_LBUTTONUP :
case WM_RBUTTONUP :
case WM_MBUTTONUP : // The middle mouse button was released.
case WM_MOUSEMOVE :
case 0x020A: // fuc&ing windows b.s...
{
if (gClient && gClient->WindowActive() && gClient->GetInputManager())
@ -463,6 +463,13 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
}
break;
case WM_MOUSEMOVE:
{
if (gClient && gClient->GetInputManager())
gClient->GetInputManager()->HandleWin32ControlEvent(message, wParam, lParam, hWnd);
}
break;
#if 0
case WM_KILLFOCUS:
SetForegroundWindow(hWnd);
@ -498,6 +505,31 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
}
break;
case WM_SETCURSOR:
{
static bool winCursor = true;
if (LOWORD(lParam) == HTCLIENT)
{
if (winCursor)
{
winCursor = false;
ShowCursor(FALSE);
plMouseDevice::ShowCursor();
}
}
else
{
if (!winCursor)
{
winCursor = true;
ShowCursor(TRUE);
plMouseDevice::HideCursor();
}
}
return TRUE;
}
break;
case WM_ACTIVATE:
{
bool active = (LOWORD(wParam) == WA_ACTIVE || LOWORD(wParam) == WA_CLICKACTIVE);
@ -509,28 +541,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
(LOWORD(wParam) == WA_CLICKACTIVE) ? "true" : "false");
if (gClient && !minimized && !gClient->GetDone())
{
if (LOWORD(wParam) == WA_CLICKACTIVE)
{
// See if they've clicked on the frame, in which case they just want to
// move, not activate, us.
POINT pt;
GetCursorPos(&pt);
ScreenToClient(hWnd, &pt);
RECT rect;
GetClientRect(hWnd, &rect);
if( (pt.x < rect.left)
||(pt.x >= rect.right)
||(pt.y < rect.top)
||(pt.y >= rect.bottom) )
{
active = false;
}
}
gClient->WindowActivate(active);
}
else
{
gPendingActivate = true;
@ -794,11 +805,6 @@ bool InitClient( HWND hWnd )
#ifdef DETACH_EXE
hInstance = ((LPCREATESTRUCT) lParam)->hInstance;
#endif
// If in fullscreen mode, get rid of the window borders. Note: this won't take
// effect until the next SetWindowPos call
#ifdef DETACH_EXE
// This Function loads the EXE into Virtual memory...supposedly
HRESULT hr = DetachFromMedium(hInstance, DMDFM_ALWAYS | DMDFM_ALLPAGES);
@ -808,34 +814,7 @@ bool InitClient( HWND hWnd )
gClient->SetDone(true);
else
{
if( gClient->GetPipeline()->IsFullScreen() )
{
SetWindowLong(hWnd, GWL_STYLE, WS_POPUP);
SetWindowLong(hWnd, GWL_EXSTYLE, WS_EX_TOPMOST);
SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
gWinBorderDX = gWinBorderDY = gWinMenuDY = 0;
}
else {
SetWindowLong(hWnd, GWL_STYLE, WS_OVERLAPPED | WS_CAPTION);
SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}
int goodWidth = gClient->GetPipeline()->Width() + gWinBorderDX * 2;
int goodHeight = gClient->GetPipeline()->Height() + gWinBorderDY * 2 + gWinMenuDY;
SetWindowPos(
hWnd,
nil,
0,
0,
goodWidth,
goodHeight,
SWP_NOCOPYBITS
| SWP_NOMOVE
| SWP_NOOWNERZORDER
| SWP_NOZORDER
| SWP_FRAMECHANGED
);
gClient->ResizeDisplayDevice(gClient->GetPipeline()->Width(), gClient->GetPipeline()->Height(), !gClient->GetPipeline()->IsFullScreen());
}
if( gPendingActivate )

View File

@ -155,8 +155,7 @@ void ErrorMinimizeAppWindow () {
// If the application's topmost window is a fullscreen
// popup window, minimize it before displaying an error
HWND appWindow = GetActiveWindow();
if ( ((GetWindowLong(appWindow, GWL_STYLE) & WS_POPUP) != 0) &&
((GetWindowLong(appWindow, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0) )
if ( ((GetWindowLong(appWindow, GWL_STYLE) & WS_POPUP) != 0) )
SetWindowPos(
appWindow,
HWND_NOTOPMOST,

View File

@ -752,7 +752,7 @@ public:
if(strncmp("SampleCmd",c->GetName(), 9) != 0)
{
fprintf(fFile, "<P><I>%s </I><BR>%s </P>\n",c->GetSignature(),
fprintf(fFile, "<p><em>%s </em><br />%s </p>\n",c->GetSignature(),
c->GetHelp());
}
}
@ -760,10 +760,11 @@ public:
{
// if(g->GetFirstCommand() != nil)
{
fprintf(fFile, "<P><B><H%s>Command %sGroup %s </B></H2></P>\n",
fprintf(fFile, "<p><strong><h%s>Command %sGroup %s </strong></h%s></p>\n",
(depth > 0) ? "3" : "2",
(depth > 0) ? "Sub" :"" ,
g->GetName());
g->GetName(),
(depth > 0) ? "3" : "2");
}
return true;
}
@ -781,7 +782,7 @@ public:
if(strncmp("SampleCmd",c->GetName(), 9) != 0)
{
fprintf(fFile, "<I>%s.%s </I> - %s <BR>\n",fGrpName,c->GetSignature(),
fprintf(fFile, "<em>%s.%s </em> - %s <br />\n",fGrpName,c->GetSignature(),
c->GetHelp());
}
}
@ -789,11 +790,14 @@ public:
{
// if(g->GetFirstCommand() != nil)
{
fprintf(fFile, "<BR>\n");
fprintf(fFile, "<br />\n");
if(depth <1)
strcpy(fGrpName, g->GetName());
else
{
pfConsoleCmdGroup *parentGrp;
parentGrp = g->GetParent();
strcpy(fGrpName, parentGrp->GetName());
strcat(fGrpName,".");
strcat(fGrpName,g->GetName());
}
@ -822,7 +826,7 @@ PF_CONSOLE_CMD( Console, CreateDocumentation, "string fileName",
}
fprintf(f, "<CENTER> <H2> Console Commands for Plasma 2.0 Client </H2> <I>Built %s on %s.</I></CENTER><BR>",
fprintf(f, "<h2 style=\"text-align: center;\"> Console Commands for Plasma 2.0 Client </h2> <em style=\"display: block; text-align: center;\">Built %s on %s.</em><br />",
pnBuildDates::fBuildTime, pnBuildDates::fBuildDate );
DocGenIterator iter(f);
@ -852,7 +856,7 @@ PF_CONSOLE_CMD( Console, CreateBriefDocumentation, "string fileName",
return;
}
fprintf(f, "<CENTER> <H3> Console Commands for Plasma 2.0 Client </H3> <I>Built %s on %s.</I></CENTER><BR>",
fprintf(f, "<h2 style=\"text-align: center;\"> Console Commands for Plasma 2.0 Client </h2> <em style=\"display: block; text-align: center;\">Built %s on %s.</em><br />",
pnBuildDates::fBuildTime, pnBuildDates::fBuildDate );
BriefDocGenIterator iter(f);
group = pfConsoleCmdGroup::GetBaseGroup();
@ -6997,38 +7001,6 @@ PF_CONSOLE_CMD( KI, // Group name
PF_CONSOLE_GROUP( Python ) // Defines a main command group
PF_CONSOLE_CMD( Python, // Group name
RunFile, // Function name
"string filename", // Params
"Run the specified Python file program" ) // Help string
{
// now evaluate this mess they made
PyObject* mymod = PythonInterface::FindModule("__main__");
// make sure the filename doesn't have the .py extension (import doesn't need it)
char importname[200];
int i;
for (i=0; i<199; i++ )
{
char ch = ((const char*)params[0])[i];
// if we are at the end of the string or at a dot, truncate here
if ( ch == '.' || ch == 0 )
break;
else
importname[i] = ((const char*)params[0])[i];
}
importname[i] = 0;
// create the line to execute the file
char runline[256];
sprintf(runline,"import %s", importname);
PythonInterface::RunString(runline,mymod);
std::string output;
// get the messages
PythonInterface::getOutputAndReset(&output);
PrintString(output.c_str());
}
#include "../pfPython/cyMisc.h"
PF_CONSOLE_CMD( Python, // Group name
@ -7070,16 +7042,18 @@ PF_CONSOLE_CMD( Python,
"string functions, ...", // Params
"Run a cheat command" )
{
const char* extraParms = "";
std::string extraParms;
if (numParams > 1)
extraParms = params[1];
// now evaluate this mess they made
PyObject* mymod = PythonInterface::FindModule("__main__");
{
extraParms = "(";
extraParms.append(params[1]);
extraParms.append(",)");
}
else
extraParms = "()";
PythonInterface::RunFunctionSafe("xCheat", params[0], extraParms.c_str());
// create the line to execute the file
char runline[256];
sprintf(runline,"import xCheat;xCheat.%s('%s')", (const char*)params[0],extraParms);
PythonInterface::RunString(runline,mymod);
std::string output;
// get the messages
PythonInterface::getOutputAndReset(&output);

View File

@ -1718,6 +1718,20 @@ void PythonInterface::WriteToStdErr(const char* text)
}
}
PyObject* PythonInterface::ImportModule(const char* module)
{
PyObject* result = nil;
PyObject* name = PyString_FromString(module);
if (name != nil)
{
result = PyImport_Import(name);
Py_DECREF(name);
}
return result;
}
/////////////////////////////////////////////////////////////////////////////
//
// Function : FindModule
@ -2061,6 +2075,78 @@ hsBool PythonInterface::RunPYC(PyObject* code, PyObject* module)
return true;
}
/////////////////////////////////////////////////////////////////////////////
//
// Function : RunFunction
// PARAMETERS : module - module name to run 'name' in
// : name - name of function
// : args - tuple with arguments
//
//
PyObject* PythonInterface::RunFunction(PyObject* module, const char* name, PyObject* args)
{
if (module == NULL)
return NULL;
PyObject* function = PyObject_GetAttrString(module, const_cast<char*>(name));
PyObject* result = NULL;
if (function != nil)
{
result = PyObject_Call(function, args, NULL);
Py_DECREF(function);
}
return result;
}
PyObject* PythonInterface::ParseArgs(const char* args)
{
PyObject* result = NULL;
PyObject* scope = PyDict_New();
if (scope)
{
//- Py_eval_input makes this function accept only single expresion (not statement)
//- When using empty scope, functions and classes like 'file' or '__import__' are not visible
result = PyRun_String(args, Py_eval_input, scope, NULL);
Py_DECREF(scope);
}
return result;
}
bool PythonInterface::RunFunctionSafe(const char* module, const char* function, const char* args)
{
PyObject* moduleObj = ImportModule(module);
bool result = false;
if (moduleObj)
{
PyObject* argsObj = ParseArgs(args);
if (argsObj)
{
PyObject* callResult = RunFunction(moduleObj, function, argsObj);
if (callResult)
{
result = true;
Py_DECREF(callResult);
}
Py_DECREF(argsObj);
}
Py_DECREF(moduleObj);
}
if (!result)
{
PyErr_Print();
if (Py_FlushLine())
PyErr_Clear();
}
return result;
}
/////////////////////////////////////////////////////////////////////////////
//
// Function : GetpyKeyFromPython
@ -2073,4 +2159,4 @@ pyKey* PythonInterface::GetpyKeyFromPython(PyObject* pkey)
if (!pyKey::Check(pkey))
return nil;
return pyKey::ConvertFrom(pkey);
}
}

View File

@ -138,6 +138,8 @@ public:
// Writes 'text' to stderr specified in the python interface
static void WriteToStdErr(const char* text);
static PyObject* ImportModule(const char* module);
// Find module. If it doesn't exist then don't create, return nil.
static PyObject* FindModule(char* module);
@ -219,6 +221,12 @@ public:
//
static hsBool RunPYC(PyObject* code, PyObject* module);
static PyObject* RunFunction(PyObject* module, const char* name, PyObject* args);
static PyObject* ParseArgs(const char* args);
static bool RunFunctionSafe(const char* module, const char* function, const char* args);
/////////////////////////////////////////////////////////////////////////////
//
// Function : GetpyKeyFromPython

View File

@ -171,6 +171,8 @@ PyObject* pyVaultImageNode::Image_GetImage( void )
else
fMipmapKey->RefObject();
}
else
PYTHON_RETURN_NONE;
}
return pyImage::New(fMipmap);

View File

@ -57,7 +57,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// This line must NEVER be modified manually; it is automatically updated
// by the build server.
#define BUILD_ID 906
#define BUILD_ID 912
COMPILER_ASSERT(BUILD_ID != 0);

View File

@ -170,12 +170,6 @@ void plAvBrainGeneric::Activate(plArmatureModBase *avMod)
{
plArmatureBrain::Activate(avMod);
if ((GetType() == kEmote || GetType() == kAFK || GetType() == kSitOnGround) && fAvMod->IsLocalAvatar())
{
plInputIfaceMgrMsg* msg = TRACKED_NEW plInputIfaceMgrMsg(plInputIfaceMgrMsg::kDisableClickables );
plgDispatch::MsgSend(msg);
}
int numStages = fStages->size();
if (!numStages)
return;
@ -315,12 +309,6 @@ void plAvBrainGeneric::Deactivate()
}
plArmatureBrain::Deactivate();
if ((GetType() == kEmote || GetType() == kAFK || GetType() == kSitOnGround) && fAvMod->IsLocalAvatar())
{
plInputIfaceMgrMsg* msg = TRACKED_NEW plInputIfaceMgrMsg(plInputIfaceMgrMsg::kEnableClickables );
plgDispatch::MsgSend(msg);
}
}
// GETRECIPIENT

View File

@ -930,28 +930,3 @@ hsBool plMouseDevice::MsgReceive(plMessage* msg)
return false;
}
void plMouseDevice::HandleWindowActivate(bool bActive, HWND hWnd)
{
if ( bActive )
{
RECT rect;
::GetClientRect(hWnd,&rect);
// rect.right /= plInputManager::GetInstance()->GetMouseScale();
// rect.bottom /= plInputManager::GetInstance()->GetMouseScale();
::MapWindowPoints( hWnd, NULL, (POINT *)&rect, 2 );
::ClipCursor(&rect);
::ShowCursor( FALSE );
SetCapture(hWnd);
}
else
{
ReleaseCapture();
::ClipCursor(nil);
::ShowCursor( TRUE );
}
}

View File

@ -172,7 +172,6 @@ public:
~plMouseDevice();
const char* GetInputName() { return "mouse"; }
void HandleWindowActivate(bool bActive, HWND hWnd);
hsBool HasControlFlag(int f) const { return fControlFlags.IsBitSet(f); }
void SetControlFlag(int f)

View File

@ -563,10 +563,7 @@ void plDInputMgr::AddDevice(IDirectInputDevice8* device)
void plDInputMgr::ConfigureDevice()
{
::ClipCursor(nil);
::ShowCursor( TRUE );
ReleaseCapture();
DICOLORSET dics;
ZeroMemory(&dics, sizeof(DICOLORSET));
@ -587,13 +584,7 @@ void plDInputMgr::ConfigureDevice()
for (int i = 0; i < fDI->fSticks.Count(); i++)
fDI->fSticks[i]->fDevice->SetActionMap( fDI->fActionFormat, NULL, DIDSAM_FORCESAVE );
RECT rect;
::GetClientRect(fhWnd,&rect);
::ClientToScreen(fhWnd,(LPPOINT)&rect);
::ClipCursor(&rect);
::ShowCursor( FALSE );
SetCapture(fhWnd);
}
hsBool plDInputMgr::MsgReceive(plMessage* msg)

View File

@ -328,11 +328,25 @@ plMipmap* plJPEG::ReadFromFile( const char *fileName )
plMipmap* plJPEG::ReadFromFile( const wchar *fileName )
{
// we use a stream because the IJL can't handle unicode
hsUNIXStream out;
if (!out.Open(fileName, L"rb"))
hsRAMStream tempstream;
hsUNIXStream in;
if (!in.Open(fileName, L"rb"))
return false;
plMipmap* ret = IRead(&out);
out.Close();
// The stream reader for JPEGs expects a 32-bit size at the start,
// so insert that into the stream before passing it on
in.FastFwd();
UInt32 fsize = in.GetPosition();
UInt8 *tempbuffer = TRACKED_NEW UInt8[fsize];
in.Rewind();
in.Read(fsize, tempbuffer);
tempstream.WriteSwap32(fsize);
tempstream.Write(fsize, tempbuffer);
delete [] tempbuffer;
tempstream.Rewind();
plMipmap* ret = IRead(&tempstream);
in.Close();
return ret;
}
@ -419,7 +433,7 @@ hsBool plJPEG::IWrite( plMipmap *source, hsStream *outStream )
jcProps.jquality = fWriteQuality;
#else
cinfo.jpeg_width = source->GetWidth(); // default
cinfo.jpeg_width = source->GetHeight(); // default
cinfo.jpeg_height = source->GetHeight(); // default
cinfo.jpeg_color_space = JCS_YCbCr; // default
// not sure how to set 4:1:1 but supposedly it's the default
jpeg_set_quality( &cinfo, fWriteQuality, TRUE );
@ -487,10 +501,23 @@ hsBool plJPEG::WriteToFile( const char *fileName, plMipmap *sourceData )
hsBool plJPEG::WriteToFile( const wchar *fileName, plMipmap *sourceData )
{
// we use a stream because the IJL can't handle unicode
hsRAMStream tempstream;
hsUNIXStream out;
if (!out.Open(fileName, L"wb"))
return false;
hsBool ret = IWrite(sourceData, &out);
hsBool ret = IWrite(sourceData, &tempstream);
if (ret)
{
// The stream writer for JPEGs prepends a 32-bit size,
// so remove that from the stream before saving to a file
tempstream.Rewind();
UInt32 fsize = tempstream.ReadSwap32();
UInt8 *tempbuffer = TRACKED_NEW UInt8[fsize];
tempstream.Read(fsize, tempbuffer);
out.Write(fsize, tempbuffer);
delete [] tempbuffer;
}
out.Close();
return ret;
}

View File

@ -2233,7 +2233,6 @@ hsBool plDXPipeline::IResetDevice()
{
IClearShadowSlaves();
ReleaseCapture();
Sleep(100);
HRESULT coopLev = fD3DDevice->TestCooperativeLevel();
if( coopLev == D3DERR_DEVICELOST )
@ -2281,8 +2280,6 @@ hsBool plDXPipeline::IResetDevice()
/// all device-specific stuff needs to be recreated
plDeviceRecreateMsg* clean = TRACKED_NEW plDeviceRecreateMsg();
plgDispatch::MsgSend(clean);
SetCapture(fSettings.fHWnd);
}
fDevWasLost = true;
fDeviceLost = false;