Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions neo/d3xp/menus/MenuHandler_Shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void idMenuHandler_Shell::Update()
ClearWidgetActionRepeater();
}

if( nextState != state )
if( nextState != state && gui->IsContructed() )
{

if( introGui != NULL && introGui->IsActive() )
Expand Down Expand Up @@ -162,7 +162,7 @@ void idMenuHandler_Shell::Update()
}
}

if( activeScreen != nextScreen )
if( activeScreen != nextScreen && gui->IsContructed() )
{

ClearWidgetActionRepeater();
Expand Down
96 changes: 74 additions & 22 deletions neo/swf/SWF.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
Copyright (C) 2013 Robert Beckebans
Copyright (C) 2023 Harrie van Ginneken

This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").

Expand Down Expand Up @@ -41,8 +42,10 @@ If you have questions concerning this license or the applicable additional terms
#include "SWF_ParmList.h"
#include "SWF_ScriptFunction.h"
#include "SWF_SpriteInstance.h"
#include "SWF_EventDispatcher.h"
#include "SWF_ShapeParser.h"
#include "SWF_TextInstance.h"
#include "SWF_Abc.h"

class idSWFDictionaryEntry
{
Expand All @@ -65,6 +68,9 @@ class idSWFDictionaryEntry
// the compressed images are normalize to reduce compression artifacts,
// color must be scaled down by this
idVec4 channelScale;
idSWFScriptVar scriptClass;
bool resolved;
idStrPtr name;
};

struct purgableSwfImage_t
Expand Down Expand Up @@ -153,6 +159,11 @@ class idSWF
return *( mainspriteInstance->GetScriptObject() );
}

bool IsContructed()
{
return mainspriteInstance->constructed;
}

void Invoke( const char* functionName, const idSWFParmList& parms );
void Invoke( const char* functionName, const idSWFParmList& parms, idSWFScriptVar& scriptVar );
void Invoke( const char* functionName, const idSWFParmList& parms, bool& functionExists );
Expand Down Expand Up @@ -215,6 +226,8 @@ class idSWF

idSWFScriptObject* HitTest( idSWFSpriteInstance* spriteInstance, const swfRenderState_t& renderState, int x, int y, idSWFScriptObject* parentObject );

SWF_AbcFile abcFile;
static bool isMouseInClientArea;
private:
idStr filename;
ID_TIME_T timestamp;
Expand Down Expand Up @@ -251,7 +264,7 @@ class idSWF

static int mouseX; // mouse x coord for all flash files
static int mouseY; // mouse y coord for all flash files
static bool isMouseInClientArea;


idSWFScriptObject* mouseObject;
idSWFScriptObject* hoverObject;
Expand All @@ -269,44 +282,75 @@ class idSWF
idBlockAlloc< idSWFSpriteInstance, 16 > spriteInstanceAllocator;
idBlockAlloc< idSWFTextInstance, 16 > textInstanceAllocator;

#define SWF_NATIVE_FUNCTION_SWF_NOASAPI_DECLARE( x ) \
class idSWFScriptFunction_##x : public idSWFScriptFunction_Nested< idSWF > { \
public: \
idSWFScriptVar Call( idSWFScriptObject * thisObject, const idSWFParmList & parms ); \
} scriptFunction_##x;

#define SWF_NATIVE_FUNCTION_SWF_ASAPI_DECLARE( x ) \
class idSWFScriptFunction_##x : public idSWFScriptFunction_Nested< idSWF > { \
public: \
idSWFScriptFunction_##x(){ static bool once = false; if (!once) {idSwfActionScriptAPI::actionScriptAPIs.Alloc() = this; once = true;}}\
idSWFScriptVar Call( idSWFScriptObject * thisObject, const idSWFParmList & parms ); \
const char * GetActionScriptAPI( idStr & out ) ;\
} scriptFunction_##x;

#define SWF_NATIVE_FUNCTION_SWF_ASAPI_RETURNVAL_DECLARE( x, type, val ) \
class idSWFScriptFunction_##x : public idSWFScriptFunction_Nested< idSWF > { \
public: \
idSWFScriptFunction_##x(){ static bool once = false; if (!once) {idSwfActionScriptAPI::actionScriptAPIs.Alloc() = this; once = true;}}\
idSWFScriptVar Call( idSWFScriptObject * thisObject, const idSWFParmList & parms ); \
const char * GetActionScriptAPI( idStr & out ) { out = "/** \n * Generated by RBDoom3BFG \n*/\npackage{\n\tpublic function "; out+= #x;out+= +"( ... parms) : ";out+=#type;out+=" { trace(\""; out+= #x; out+="( \" + parms + \" )\");return ";out+= #val;out+=";};\n}"; return #x;} \
} scriptFunction_##x;

#define SWF_NATIVE_FUNCTION_SWF_DECLARE( x ) \
class idSWFScriptFunction_##x : public idSWFScriptFunction_Nested< idSWF > { \
public: \
idSWFScriptFunction_##x(){ static bool once = false; if (!once) {idSwfActionScriptAPI::actionScriptAPIs.Alloc() = this; once = true;}}\
idSWFScriptVar Call( idSWFScriptObject * thisObject, const idSWFParmList & parms ); \
const char * GetActionScriptAPI( idStr & out ) { out = "/** \n * Generated by RBDoom3BFG \n*/\npackage{\n\tpublic function "; out+= #x;out+= +"( ... parms) :void { trace(\""; out+= #x; out+="( \" + parms + \" )\")};\n}"; return #x;} \
} scriptFunction_##x;

SWF_NATIVE_FUNCTION_SWF_DECLARE( shortcutKeys_clear );
SWF_NATIVE_FUNCTION_SWF_DECLARE( deactivate );
SWF_NATIVE_FUNCTION_SWF_DECLARE( inhibitControl );
SWF_NATIVE_FUNCTION_SWF_DECLARE( useInhibit );
SWF_NATIVE_FUNCTION_SWF_DECLARE( precacheSound );
SWF_NATIVE_FUNCTION_SWF_ASAPI_RETURNVAL_DECLARE( precacheSound, String, parms[0] );
SWF_NATIVE_FUNCTION_SWF_DECLARE( playSound );
SWF_NATIVE_FUNCTION_SWF_DECLARE( stopSounds );
SWF_NATIVE_FUNCTION_SWF_DECLARE( getPlatform );
SWF_NATIVE_FUNCTION_SWF_DECLARE( getTruePlatform );
SWF_NATIVE_FUNCTION_SWF_DECLARE( getLocalString );
SWF_NATIVE_FUNCTION_SWF_DECLARE( swapPS3Buttons );
SWF_NATIVE_FUNCTION_SWF_DECLARE( getCVarInteger );
SWF_NATIVE_FUNCTION_SWF_DECLARE( setCVarInteger );
SWF_NATIVE_FUNCTION_SWF_DECLARE( strReplace );

SWF_NATIVE_FUNCTION_SWF_DECLARE( acos );
SWF_NATIVE_FUNCTION_SWF_DECLARE( cos );
SWF_NATIVE_FUNCTION_SWF_DECLARE( sin );
SWF_NATIVE_FUNCTION_SWF_DECLARE( round );
SWF_NATIVE_FUNCTION_SWF_DECLARE( pow );
SWF_NATIVE_FUNCTION_SWF_DECLARE( sqrt );
SWF_NATIVE_FUNCTION_SWF_DECLARE( abs );
SWF_NATIVE_FUNCTION_SWF_DECLARE( rand );
SWF_NATIVE_FUNCTION_SWF_DECLARE( floor );
SWF_NATIVE_FUNCTION_SWF_DECLARE( ceil );

SWF_NATIVE_FUNCTION_SWF_DECLARE( toUpper );
SWF_NATIVE_FUNCTION_SWF_ASAPI_RETURNVAL_DECLARE( getPlatform, Number, 2 );
SWF_NATIVE_FUNCTION_SWF_ASAPI_RETURNVAL_DECLARE( getTruePlatform, Number, 2 );
SWF_NATIVE_FUNCTION_SWF_ASAPI_RETURNVAL_DECLARE( getLocalString, String, parms[0] );
SWF_NATIVE_FUNCTION_SWF_ASAPI_RETURNVAL_DECLARE( swapPS3Buttons, Boolean, false );
SWF_NATIVE_FUNCTION_SWF_ASAPI_RETURNVAL_DECLARE( getCVarInteger, Number , 1 );
SWF_NATIVE_FUNCTION_SWF_NOASAPI_DECLARE( setCVarInteger );
SWF_NATIVE_FUNCTION_SWF_ASAPI_RETURNVAL_DECLARE( strReplace, String, parms[0].replace( parms[1], parms[2] ) );
SWF_NATIVE_FUNCTION_SWF_NOASAPI_DECLARE( trace );
SWF_NATIVE_FUNCTION_SWF_NOASAPI_DECLARE( ArrayToString );
SWF_NATIVE_FUNCTION_SWF_NOASAPI_DECLARE( registerUserMouse );
SWF_NATIVE_FUNCTION_SWF_NOASAPI_DECLARE( String );

SWF_NATIVE_FUNCTION_SWF_ASAPI_RETURNVAL_DECLARE( acos, Number, Math.acos( parms[0] ) );
SWF_NATIVE_FUNCTION_SWF_ASAPI_RETURNVAL_DECLARE( cos, Number, Math.cos( parms[0] ) );
SWF_NATIVE_FUNCTION_SWF_NOASAPI_DECLARE( sin );
SWF_NATIVE_FUNCTION_SWF_NOASAPI_DECLARE( round );
SWF_NATIVE_FUNCTION_SWF_NOASAPI_DECLARE( pow );
SWF_NATIVE_FUNCTION_SWF_NOASAPI_DECLARE( sqrt );
SWF_NATIVE_FUNCTION_SWF_NOASAPI_DECLARE( abs );
SWF_NATIVE_FUNCTION_SWF_NOASAPI_DECLARE( rand );
SWF_NATIVE_FUNCTION_SWF_NOASAPI_DECLARE( floor );
SWF_NATIVE_FUNCTION_SWF_NOASAPI_DECLARE( ceil );
SWF_NATIVE_FUNCTION_SWF_ASAPI_RETURNVAL_DECLARE( random, Number, Math.random( parms ) );

SWF_NATIVE_FUNCTION_SWF_NOASAPI_DECLARE( toUpper );

SWF_NATIVE_VAR_DECLARE_NESTED_READONLY( platform, idSWFScriptFunction_getPlatform, Call( object, idSWFParmList() ) );
SWF_NATIVE_VAR_DECLARE_NESTED( blackbars, idSWF );
SWF_NATIVE_VAR_DECLARE_NESTED( crop, idSWF );

class idSWFScriptFunction_Object;
SWF_NATIVE_VAR_DECLARE_NESTED_READONLY( Object, idSWFScriptFunction_Object, Call( object, idSWFParmList() ) );
class idSWFScriptFunction_Object : public idSWFScriptFunction
{
public:
Expand Down Expand Up @@ -516,6 +560,12 @@ class idSWF
// SWF_Zlib.cpp
//----------------------------------
bool Inflate( const byte* input, int inputSize, byte* output, int outputSize );
//----------------------------------
// SWF_Abc.cpp
//----------------------------------
void DoABC( idSWFBitStream& bitstream ) ;
void SymbolClass( idSWFBitStream& bitstream ) ;

// RB begin
bool Deflate( const byte* input, int inputSize, byte* output, int& outputSize );
// RB end
Expand All @@ -531,6 +581,8 @@ class idSWF
static const char* GetTagName( swfTag_t tag );
static const char* GetActionName( swfAction_t action );

void CreateAbcObjects( idSWFScriptObject* globals );
SWF_SymbolClass symbolClasses;
};

#endif // !__SWF_H__
Loading