From 4fa3f742692053401d351107969cc596fc8eece7 Mon Sep 17 00:00:00 2001 From: Robert Beckebans Date: Thu, 11 Jul 2024 21:03:42 +0200 Subject: [PATCH] ( ) -> () in neo/swf/ --- neo/swf/SWF_Abc.cpp | 158 ++++++++++++++++---------------- neo/swf/SWF_Bitstream.h | 2 +- neo/swf/SWF_Dictionary.cpp | 2 +- neo/swf/SWF_EventDispatcher.cpp | 10 +- neo/swf/SWF_EventDispatcher.h | 2 +- neo/swf/SWF_Events.cpp | 110 +++++++++++----------- neo/swf/SWF_Interpreter.cpp | 106 ++++++++++----------- neo/swf/SWF_Main.cpp | 28 +++--- neo/swf/SWF_ScriptFunction.cpp | 2 +- neo/swf/SWF_ScriptFunction.h | 2 +- neo/swf/SWF_ScriptObject.cpp | 2 +- neo/swf/SWF_SpriteInstance.cpp | 12 +-- neo/swf/SWF_TextInstance.cpp | 4 +- 13 files changed, 220 insertions(+), 220 deletions(-) diff --git a/neo/swf/SWF_Abc.cpp b/neo/swf/SWF_Abc.cpp index b8ca6cbb06..bbeccf0089 100644 --- a/neo/swf/SWF_Abc.cpp +++ b/neo/swf/SWF_Abc.cpp @@ -176,42 +176,42 @@ void SWF_AbcFile::traceConstantPool( swfConstant_pool_info& constant_pool ) { trace( "^8[^7%i^8]\t ^7%i \n", cnt++, t ); } - trace( "^8uIntegers ^7: %i\n", constant_pool.uIntegers.Num( ) ); + trace( "^8uIntegers ^7: %i\n", constant_pool.uIntegers.Num() ); cnt = 0; for( auto& t : constant_pool.uIntegers ) { trace( "^8[^7%i^8]\t ^7%i \n", cnt++, ( int )t ); } - trace( "^8doubles ^7: %i\n", constant_pool.doubles.Num( ) ); + trace( "^8doubles ^7: %i\n", constant_pool.doubles.Num() ); cnt = 0; for( auto& t : constant_pool.doubles ) { trace( "^8[^7%i^8]\t ^7%f \n", cnt++, ( float ) t ); } - trace( "^8utf8Strings ^7: %i\n", constant_pool.utf8Strings.Num( ) ); + trace( "^8utf8Strings ^7: %i\n", constant_pool.utf8Strings.Num() ); cnt = 0; for( auto& t : constant_pool.utf8Strings ) { - trace( "^8[^7%i^8]\t ^7%s \n", cnt++, t.c_str( ) ); + trace( "^8[^7%i^8]\t ^7%s \n", cnt++, t.c_str() ); } - trace( "^8namespaceNames ^7: %i\n", constant_pool.namespaceNames.Num( ) ); + trace( "^8namespaceNames ^7: %i\n", constant_pool.namespaceNames.Num() ); cnt = 0; for( auto& t : constant_pool.namespaceNames ) { - trace( "^8[^7%i^8]\t ^7%s \n", cnt++, t->c_str( ) ); + trace( "^8[^7%i^8]\t ^7%s \n", cnt++, t->c_str() ); } - trace( "^8namespaceSets ^7: %i\n", constant_pool.namespaceSets.Num( ) ); + trace( "^8namespaceSets ^7: %i\n", constant_pool.namespaceSets.Num() ); cnt = 0; for( auto& t : constant_pool.namespaceSets ) { for( auto& ts : t ) { - trace( "^8[^7%i^8]\t ^7%s \n", cnt++, ts->c_str( ) ); + trace( "^8[^7%i^8]\t ^7%s \n", cnt++, ts->c_str() ); } } - trace( "^8multinameInfos ^7: %i\n", constant_pool.multinameInfos.Num( ) ); + trace( "^8multinameInfos ^7: %i\n", constant_pool.multinameInfos.Num() ); cnt = 0; for( auto& t : constant_pool.multinameInfos ) { @@ -248,19 +248,19 @@ void ReadMultiName( idSWFBitStream& bitstream , swfMultiname& target ) break; case TypeName: - target.nameIndex = bitstream.ReadEncodedU32( ); - target.nameIndexT = bitstream.ReadEncodedU32( ); - target.indexT = bitstream.ReadEncoded( ); + target.nameIndex = bitstream.ReadEncodedU32(); + target.nameIndexT = bitstream.ReadEncodedU32(); + target.indexT = bitstream.ReadEncoded(); break; case Multiname: case MultinameA: - target.nameIndex = bitstream.ReadEncodedU32( ); - target.index = bitstream.ReadEncodedU32( ); + target.nameIndex = bitstream.ReadEncodedU32(); + target.index = bitstream.ReadEncodedU32(); break; case MultinameL: case MultinameLA: - target.index = bitstream.ReadEncodedU32( ); + target.index = bitstream.ReadEncodedU32(); break; default: common->FatalError( "Invalid Multiname type" ); @@ -271,78 +271,78 @@ void ReadMultiName( idSWFBitStream& bitstream , swfMultiname& target ) void ReadConstantPoolInfo( idSWFBitStream& bitstream , swfConstant_pool_info& target ) { /*cpool_info{}*/ - uint32 int_count = bitstream.ReadEncodedU32( ) ; - target.integers.Alloc( ) = 0; + uint32 int_count = bitstream.ReadEncodedU32() ; + target.integers.Alloc() = 0; for( uint i = 1; i < int_count; i++ ) { - target.integers.Alloc( ) = bitstream.ReadEncoded( ); + target.integers.Alloc() = bitstream.ReadEncoded(); } - uint32 uint_count = bitstream.ReadEncodedU32( ); - target.uIntegers.Alloc( ) = 0; + uint32 uint_count = bitstream.ReadEncodedU32(); + target.uIntegers.Alloc() = 0; for( uint i = 1; i < uint_count; i++ ) { - target.uIntegers.Alloc( ) = bitstream.ReadEncodedU32( ); + target.uIntegers.Alloc() = bitstream.ReadEncodedU32(); } - uint32 double_count = bitstream.ReadEncodedU32( ); - target.doubles.Alloc( ) = 0.0; + uint32 double_count = bitstream.ReadEncodedU32(); + target.doubles.Alloc() = 0.0; for( uint i = 1; i < double_count; i++ ) { //WARNING IEEE-754 target.doubles.Alloc() = *( double* )bitstream.ReadData( 8 ); } - uint32 string_count = bitstream.ReadEncodedU32( ); - target.utf8Strings.Alloc( ).Append( "*" ); + uint32 string_count = bitstream.ReadEncodedU32(); + target.utf8Strings.Alloc().Append( "*" ); for( uint i = 1; i < string_count; i++ ) { - uint32 str_len = bitstream.ReadEncodedU32( ); - target.utf8Strings.Alloc( ).Append( ( char* ) bitstream.ReadData( str_len ), str_len ); + uint32 str_len = bitstream.ReadEncodedU32(); + target.utf8Strings.Alloc().Append( ( char* ) bitstream.ReadData( str_len ), str_len ); } - uint32 namespace_count = bitstream.ReadEncodedU32( ); - target.namespaceNames.Alloc( ) = &target.utf8Strings[0]; + uint32 namespace_count = bitstream.ReadEncodedU32(); + target.namespaceNames.Alloc() = &target.utf8Strings[0]; for( uint i = 1; i < namespace_count; i++ ) { target.namespaceKinds.Alloc() = ( swfConstantKind_t )bitstream.ReadU8(); - uint32 str_idx = bitstream.ReadEncodedU32( ); - target.namespaceNames.Alloc( ) = &target.utf8Strings[( int )str_idx]; + uint32 str_idx = bitstream.ReadEncodedU32(); + target.namespaceNames.Alloc() = &target.utf8Strings[( int )str_idx]; } - uint32 namespace_set_count = bitstream.ReadEncodedU32( ); - target.namespaceSets.Alloc( ).Alloc() = target.namespaceNames[0]; + uint32 namespace_set_count = bitstream.ReadEncodedU32(); + target.namespaceSets.Alloc().Alloc() = target.namespaceNames[0]; for( uint i = 1; i < namespace_set_count; i++ ) { - uint32 count = bitstream.ReadEncodedU32( ); + uint32 count = bitstream.ReadEncodedU32(); auto& newSet = target.namespaceSets.Alloc(); for( uint j = 0; j < count; j++ ) { - uint32 idx = bitstream.ReadEncodedU32( ); + uint32 idx = bitstream.ReadEncodedU32(); newSet.Alloc() = target.namespaceNames[( int )idx]; } } - uint32 multiname_count = bitstream.ReadEncodedU32( ); - auto& empty = target.multinameInfos.Alloc( ); + uint32 multiname_count = bitstream.ReadEncodedU32(); + auto& empty = target.multinameInfos.Alloc(); empty.index = 0; empty.nameIndex = 0; empty.type = unused_0x00; for( uint i = 1; i < multiname_count; i++ ) { - auto& newMn = target.multinameInfos.Alloc( ); + auto& newMn = target.multinameInfos.Alloc(); ReadMultiName( bitstream, newMn ); } } void SWF_AbcFile::ReadOptionInfo( idSWFBitStream& bitstream, swfOption_info& newOption ) { - newOption.option_count = bitstream.ReadEncodedU32( ); + newOption.option_count = bitstream.ReadEncodedU32(); for( uint i = 0; i < newOption.option_count; i++ ) { - auto& newItem = newOption.options.Alloc( ); - newItem.val = bitstream.ReadEncodedU32( ); - newItem.kind = constant_pool.namespaceKinds[bitstream.ReadEncodedU32( )]; + auto& newItem = newOption.options.Alloc(); + newItem.val = bitstream.ReadEncodedU32(); + newItem.kind = constant_pool.namespaceKinds[bitstream.ReadEncodedU32()]; } } @@ -385,24 +385,24 @@ void SWF_AbcFile::ReadTraitData( idSWFBitStream& bitstream, swfTraits_info& newT { newTraitsData.data = Mem_ClearedAlloc( sizeof( swfTrait_method ), TAG_SWF ); swfTrait_method& method = *( swfTrait_method* )( newTraitsData.data ); - method.disp_id = bitstream.ReadEncodedU32( ); - method.method = &methods[bitstream.ReadEncodedU32( )]; + method.disp_id = bitstream.ReadEncodedU32(); + method.method = &methods[bitstream.ReadEncodedU32()]; } break; case swfTraits_info::Trait_Class: { newTraitsData.data = Mem_ClearedAlloc( sizeof( swfTrait_class ), TAG_SWF ); swfTrait_class& tclass = *( swfTrait_class* )( newTraitsData.data ); - tclass.slot_id = bitstream.ReadEncodedU32( ); - tclass.classi = &classes[bitstream.ReadEncodedU32( )]; + tclass.slot_id = bitstream.ReadEncodedU32(); + tclass.classi = &classes[bitstream.ReadEncodedU32()]; } break; case swfTraits_info::Trait_Function: { newTraitsData.data = Mem_ClearedAlloc( sizeof( swfTrait_function ), TAG_SWF ); swfTrait_function& func = *( swfTrait_function* )( newTraitsData.data ); - func.slot_id = bitstream.ReadEncodedU32( ); - func.func = &methods[bitstream.ReadEncodedU32( )]; + func.slot_id = bitstream.ReadEncodedU32(); + func.func = &methods[bitstream.ReadEncodedU32()]; } break; @@ -474,7 +474,7 @@ idSWFScriptObject::swfNamedVar_t* SWF_AbcFile::GetTrait( const swfTraits_info& t case QnameA: { idStr& typeName = constant_pool.utf8Strings[slot.vindex]; - if( globals->HasProperty( typeName.c_str( ) ) ) + if( globals->HasProperty( typeName.c_str() ) ) { newVar->value.SetObject( globals->GetObject( typeName ) ); } @@ -519,7 +519,7 @@ idSWFScriptObject::swfNamedVar_t* SWF_AbcFile::GetTrait( const swfTraits_info& t else { idStr& typeName = constant_pool.utf8Strings[slot.type_name->nameIndex]; - if( globals->HasProperty( typeName.c_str( ) ) ) + if( globals->HasProperty( typeName.c_str() ) ) { auto* newobj = idSWFScriptObject::Alloc(); newobj->SetPrototype( globals->GetObject( typeName.c_str() ) ); @@ -556,19 +556,19 @@ idSWFScriptObject::swfNamedVar_t* SWF_AbcFile::GetTrait( const swfTraits_info& t slashPos = owner.Find( ":" ); if( slashPos != -1 ) { - owner = idStr( owner.c_str( ), slashPos + 1, owner.Length() ); + owner = idStr( owner.c_str(), slashPos + 1, owner.Length() ); } if( globals->HasProperty( owner.c_str() ) ) { - idSWFScriptFunction_Script* func = idSWFScriptFunction_Script::Alloc( ); + idSWFScriptFunction_Script* func = idSWFScriptFunction_Script::Alloc(); func->SetAbcFile( this ); func->SetData( method.method ); newVar->value = idSWFScriptVar( func ) ; } else { - newVar->value.SetUndefined( ); + newVar->value.SetUndefined(); } break; @@ -579,8 +579,8 @@ idSWFScriptObject::swfNamedVar_t* SWF_AbcFile::GetTrait( const swfTraits_info& t int a = 0; //newTraitsData.data = Mem_ClearedAlloc( sizeof( swfTrait_class ) ); //swfTrait_class &tclass = *( swfTrait_class * ) ( newTraitsData.data ); - //tclass.slot_id = bitstream.ReadEncodedU32( ); - //tclass.classi = &classes[bitstream.ReadEncodedU32( )]; + //tclass.slot_id = bitstream.ReadEncodedU32(); + //tclass.classi = &classes[bitstream.ReadEncodedU32()]; } break; case swfTraits_info::Trait_Function: @@ -588,8 +588,8 @@ idSWFScriptObject::swfNamedVar_t* SWF_AbcFile::GetTrait( const swfTraits_info& t int a = 0; //newTraitsData.data = Mem_ClearedAlloc( sizeof( swfTrait_function ) ); //swfTrait_function &func = *( swfTrait_function * ) ( newTraitsData.data ); - //func.slot_id = bitstream.ReadEncodedU32( ); - //func.func = &methods[bitstream.ReadEncodedU32( )]; + //func.slot_id = bitstream.ReadEncodedU32(); + //func.func = &methods[bitstream.ReadEncodedU32()]; } break; @@ -603,7 +603,7 @@ idSWFScriptObject::swfNamedVar_t* SWF_AbcFile::GetTrait( const swfTraits_info& t void SWF_AbcFile::ReadTraitsInfo( idSWFBitStream& bitstream, swfTraits_info& newTraitsData ) { - newTraitsData.name = &constant_pool.multinameInfos[bitstream.ReadEncodedU32( )]; + newTraitsData.name = &constant_pool.multinameInfos[bitstream.ReadEncodedU32()]; //The kind field contains two four-bit fields. The lower four bits determine the kind of this trait. The // upper four bits comprise a bit vector providing attributes of the trait. See the following tables and // sections for full descriptions. @@ -634,12 +634,12 @@ void SWF_AbcFile::ReadClassInfo( idSWFBitStream& bitstream, swfClass_info& newCl } -//The last entry in that array is the entry point for the ABC file; that is, the last entry’s -//initialization method contains the first bytecode that’s run when the ABC file is executed. +//The last entry in that array is the entry point for the ABC file; that is, the last entry�s +//initialization method contains the first bytecode that�s run when the ABC file is executed. void SWF_AbcFile::ReadScriptInfo( idSWFBitStream& bitstream, swfScript_info& newScriptData ) { - uint32 init = bitstream.ReadEncodedU32( ); - uint32 trait_count = bitstream.ReadEncodedU32( ); + uint32 init = bitstream.ReadEncodedU32(); + uint32 trait_count = bitstream.ReadEncodedU32(); newScriptData.init = &methods[init]; trace( "%s \n", newScriptData.init->name->c_str() ); newScriptData.traits.AssureSize( trait_count ); @@ -662,7 +662,7 @@ void SWF_AbcFile::ReadMethodBodyInfo( idSWFBitStream& bitstream, swfMethod_body_ newMethodBody.codeLength = bitstream.ReadEncodedU32(); newMethodBody.code.Load( bitstream.ReadData( newMethodBody.codeLength ), newMethodBody.codeLength, true ); // ( byte * ) Mem_ClearedAlloc( sizeof( byte ) * newMethodBody.codeLength ); extern void swf_PrintStream( SWF_AbcFile * file , idSWFBitStream & bitstream ); - if( swf_abc_verbose.GetInteger( ) == 2 ) + if( swf_abc_verbose.GetInteger() == 2 ) { common->Printf( "============================\n" ); common->Printf( "Method %s 's bytecode \n", newMethodBody.method->name->c_str() ); @@ -670,23 +670,23 @@ void SWF_AbcFile::ReadMethodBodyInfo( idSWFBitStream& bitstream, swfMethod_body_ swf_PrintStream( this, newMethodBody.code ); } //memcpy(newMethodBody.code,bitstream.ReadData(newMethodBody.codeLength),newMethodBody.codeLength); - uint32 exception_count = bitstream.ReadEncodedU32( ); + uint32 exception_count = bitstream.ReadEncodedU32(); for( uint i = 0; i < exception_count; i++ ) { - auto& newExceptionInfo = newMethodBody.exceptions.Alloc( ); + auto& newExceptionInfo = newMethodBody.exceptions.Alloc(); ReadExceptionInfo( bitstream, newExceptionInfo ); } - uint32 trait_count = bitstream.ReadEncodedU32( ); + uint32 trait_count = bitstream.ReadEncodedU32(); for( uint i = 0; i < trait_count; i++ ) { - auto& newTrait = newMethodBody.traits.Alloc( ); + auto& newTrait = newMethodBody.traits.Alloc(); ReadTraitsInfo( bitstream, newTrait ); } } void SWF_AbcFile::ReadExceptionInfo( idSWFBitStream& bitstream, swfException_info& newException ) { - newException.from = bitstream.ReadEncodedU32( ); + newException.from = bitstream.ReadEncodedU32(); newException.to = bitstream.ReadEncodedU32(); newException.target = bitstream.ReadEncodedU32(); newException.exc_type = &constant_pool.utf8Strings[bitstream.ReadEncodedU32()]; @@ -718,7 +718,7 @@ void SWF_AbcFile::ReadInstanceInfo( idSWFBitStream& bitstream, swfInstance_info& newInstancedata.iinit = &methods[bitstream.ReadEncodedU32()]; - uint32 trait_count = bitstream.ReadEncodedU32( ); + uint32 trait_count = bitstream.ReadEncodedU32(); for( uint i = 0; i < trait_count; i++ ) { @@ -757,7 +757,7 @@ void SWF_AbcFile::ReadMethodInfo( idSWFBitStream& bitstream , swfMethod_info& ne for( uint i = 0; i < newMethod.paramCount; i++ ) { - idx = bitstream.ReadEncodedU32( ); + idx = bitstream.ReadEncodedU32(); newMethod.paramNames.Alloc() = &constant_pool.utf8Strings[idx]; trace( "newMethod.param %s \n", constant_pool.utf8Strings[idx].c_str() ); @@ -784,7 +784,7 @@ void SWF_AbcFile::LoadBinary( idFile* file ) void idSWF::DoABC( idSWFBitStream& bitstream ) { SWF_AbcFile& newAbcFile = abcFile; - int strmSize = bitstream.Length( ) + 6; // codeLength(uin16) + recordLength(uin32) + int strmSize = bitstream.Length() + 6; // codeLength(uin16) + recordLength(uin32) if( !newAbcFile.AbcTagData.Length() ) { @@ -793,8 +793,8 @@ void idSWF::DoABC( idSWFBitStream& bitstream ) uint32 flags = bitstream.ReadU32(); idStr name = bitstream.ReadString(); - int dataSize = bitstream.Length( ) - name.Length( ); - common->Printf( "DoABC %s flags %i tagsize %i bytecode size %i \n", name.c_str( ), flags, strmSize, dataSize ); + int dataSize = bitstream.Length() - name.Length(); + common->Printf( "DoABC %s flags %i tagsize %i bytecode size %i \n", name.c_str(), flags, strmSize, dataSize ); bitstream.ReadLittle( newAbcFile.minor_version ); bitstream.ReadLittle( newAbcFile.major_version ); @@ -802,7 +802,7 @@ void idSWF::DoABC( idSWFBitStream& bitstream ) ReadConstantPoolInfo( bitstream, newAbcFile.constant_pool ); SWF_AbcFile::traceConstantPool( newAbcFile.constant_pool ); - uint32 method_count = bitstream.ReadEncodedU32( ) ; + uint32 method_count = bitstream.ReadEncodedU32() ; newAbcFile.methods.AssureSize( method_count ); trace( "method_count %i \n", method_count ); for( uint i = 0; i < method_count; i++ ) @@ -811,7 +811,7 @@ void idSWF::DoABC( idSWFBitStream& bitstream ) newAbcFile.ReadMethodInfo( bitstream, newMethod ); } - uint32 meta_count = bitstream.ReadEncodedU32( ); + uint32 meta_count = bitstream.ReadEncodedU32(); newAbcFile.metadatas.AssureSize( meta_count ); trace( "meta_count %i \n", meta_count ); for( uint i = 0; i < meta_count; i++ ) @@ -837,7 +837,7 @@ void idSWF::DoABC( idSWFBitStream& bitstream ) newAbcFile.ReadClassInfo( bitstream, newClass ); } - uint32 script_count = bitstream.ReadEncodedU32( ); + uint32 script_count = bitstream.ReadEncodedU32(); newAbcFile.scripts.AssureSize( script_count ); trace( "script_count %i \n", script_count ); for( uint i = 0; i < script_count; i++ ) @@ -846,7 +846,7 @@ void idSWF::DoABC( idSWFBitStream& bitstream ) newAbcFile.ReadScriptInfo( bitstream, newScript ); } - uint32 methBody_count = bitstream.ReadEncodedU32( ); + uint32 methBody_count = bitstream.ReadEncodedU32(); newAbcFile.method_bodies.AssureSize( methBody_count ); trace( "methBody_count %i \n", methBody_count ); for( uint i = 0; i < methBody_count; i++ ) @@ -870,8 +870,8 @@ void idSWF::SymbolClass( idSWFBitStream& bitstream ) for( uint i = 0 ; i < numSymbols; i++ ) { auto& newSymbol = symbolClasses.symbols.Alloc(); - newSymbol.tag = bitstream.ReadU16( ); - newSymbol.name = bitstream.ReadString( ); + newSymbol.tag = bitstream.ReadU16(); + newSymbol.name = bitstream.ReadString(); trace( "SymbolClass ^5%i ^7tag ^5%i ^2%s \n", i, newSymbol.tag, newSymbol.name.c_str() ); } } diff --git a/neo/swf/SWF_Bitstream.h b/neo/swf/SWF_Bitstream.h index 920e245bff..e4a3333c0f 100644 --- a/neo/swf/SWF_Bitstream.h +++ b/neo/swf/SWF_Bitstream.h @@ -94,7 +94,7 @@ class idSWFBitStream T result = 0; for( int i = 0; i < 5; i++ ) { - byte b = ReadU8( ); + byte b = ReadU8(); result |= ( b & 0x7F ) << ( 7 * i ); if( ( b & 0x80 ) == 0 ) { diff --git a/neo/swf/SWF_Dictionary.cpp b/neo/swf/SWF_Dictionary.cpp index f5b4415996..d99394ba78 100644 --- a/neo/swf/SWF_Dictionary.cpp +++ b/neo/swf/SWF_Dictionary.cpp @@ -45,7 +45,7 @@ idSWFDictionaryEntry::idSWFDictionaryEntry() : imageSize( 0, 0 ), imageAtlasOffset( 0, 0 ), channelScale( 1.0f, 1.0f, 1.0f, 1.0f ), - scriptClass( ), + scriptClass(), resolved( false ), name( NULL ) { diff --git a/neo/swf/SWF_EventDispatcher.cpp b/neo/swf/SWF_EventDispatcher.cpp index aa7d1c1486..e90cd95b89 100644 --- a/neo/swf/SWF_EventDispatcher.cpp +++ b/neo/swf/SWF_EventDispatcher.cpp @@ -62,8 +62,8 @@ SWF_EVENTDISPATCHER_NATIVE_VAR_DEFINE_GET( MouseEvent ) static idSWFScriptObject* mouseEventObj = nullptr; if( mouseEventObj == nullptr ) { - mouseEventObj = idSWFScriptObject::Alloc( ); - idSWFScriptObject* eventParms = idSWFScriptObject::Alloc( ); + mouseEventObj = idSWFScriptObject::Alloc(); + idSWFScriptObject* eventParms = idSWFScriptObject::Alloc(); eventParms->Set( "type", "MouseEvent" ); mouseEventObj->Set( "[MouseEvent]", eventParms ); @@ -95,8 +95,8 @@ SWF_EVENTDISPATCHER_NATIVE_VAR_DEFINE_GET( Event ) static idSWFScriptObject* eventObj = nullptr; if( eventObj == nullptr ) { - eventObj = idSWFScriptObject::Alloc( ); - idSWFScriptObject* eventParms = idSWFScriptObject::Alloc( ); + eventObj = idSWFScriptObject::Alloc(); + idSWFScriptObject* eventParms = idSWFScriptObject::Alloc(); eventParms->Set( "type", "Event" ); eventObj->Set( "[Event]", eventParms ); @@ -176,7 +176,7 @@ SWF_EVENTDISPATCHER_FUNCTION_DEFINE( addEventListener ) dispatcher->value.GetObject()->Set( parms[0].ToString(), parms[1] ); common->DPrintf( "{%s} AddEventListener(%s,%s)\n", thisObject->GetSprite()->name.c_str(), parms[0].ToString().c_str(), parms[1].ToString().c_str() ); //add listener - return idSWFScriptVar( ); + return idSWFScriptVar(); } diff --git a/neo/swf/SWF_EventDispatcher.h b/neo/swf/SWF_EventDispatcher.h index 1d8cce05e8..38204416d9 100644 --- a/neo/swf/SWF_EventDispatcher.h +++ b/neo/swf/SWF_EventDispatcher.h @@ -38,7 +38,7 @@ If you have questions concerning this license or the applicable additional terms class idSWFScriptObject_EventDispatcherPrototype : public idSWFScriptObject { public: - idSWFScriptObject_EventDispatcherPrototype( ); + idSWFScriptObject_EventDispatcherPrototype(); #define SWF_EVENTDISPATCHER_FUNCTION_DECLARE( x ) \ class idSWFScriptFunction_##x : public idSWFScriptFunction { \ public: \ diff --git a/neo/swf/SWF_Events.cpp b/neo/swf/SWF_Events.cpp index 1f568f5ee9..3bd05f54ba 100644 --- a/neo/swf/SWF_Events.cpp +++ b/neo/swf/SWF_Events.cpp @@ -34,7 +34,7 @@ idSWFScriptObject* GetMouseEventDispatcher( idSWFScriptObject* object ) idSWFScriptObject* dispatcher = nullptr; if( object->HasValidProperty( "__eventDispatcher__" ) ) { - dispatcher = object->Get( "__eventDispatcher__" ).GetObject( ); + dispatcher = object->Get( "__eventDispatcher__" ).GetObject(); if( dispatcher->HasValidProperty( "click" ) || dispatcher->HasValidProperty( "contextMenu" ) || dispatcher->HasValidProperty( "doubleClick" ) @@ -327,34 +327,34 @@ bool idSWF::HandleEvent( const sysEvent_t* event ) if( !eventDispatcher.IsUndefined() && !var.IsFunction() ) { - var = eventDispatcher.GetObject( )->Get( "click" ); - if( !var.IsFunction( ) ) + var = eventDispatcher.GetObject()->Get( "click" ); + if( !var.IsFunction() ) { - var = eventDispatcher.GetObject( )->Get( "mouseDown" ); + var = eventDispatcher.GetObject()->Get( "mouseDown" ); } } - if( var.IsFunction( ) ) + if( var.IsFunction() ) { idSWFScriptVar eventArg; - auto* eventObj = globals->Get( "EventDispatcher" ).GetObject( ) - ->Get( "MouseEvent" ).GetObject( ) - ->Get( "[MouseEvent]" ).GetObject( ); - eventArg.SetObject( idSWFScriptObject::Alloc( ) ); - eventArg.GetObject( )->DeepCopy( eventObj ); + auto* eventObj = globals->Get( "EventDispatcher" ).GetObject() + ->Get( "MouseEvent" ).GetObject() + ->Get( "[MouseEvent]" ).GetObject(); + eventArg.SetObject( idSWFScriptObject::Alloc() ); + eventArg.GetObject()->DeepCopy( eventObj ); idSWFParmList parms; parms.Append( eventArg ); parms.Append( event->inputDevice ); - if( !( ( idSWFScriptFunction_Script* ) var.GetFunction( ) )->GetScope( )->Num( ) ) + if( !( ( idSWFScriptFunction_Script* ) var.GetFunction() )->GetScope()->Num() ) { - ( ( idSWFScriptFunction_Script* ) var.GetFunction( ) )->GetScope( )->Append( globals ); + ( ( idSWFScriptFunction_Script* ) var.GetFunction() )->GetScope()->Append( globals ); } - var.GetFunction( )->Call( hitObject, parms ); - parms.Clear( ); + var.GetFunction()->Call( hitObject, parms ); + parms.Clear(); return true; } var = hitObject->Get( "onPress" ); - if( var.IsFunction( ) ) + if( var.IsFunction() ) { idSWFParmList parms; parms.Append( event->inputDevice ); @@ -387,27 +387,27 @@ bool idSWF::HandleEvent( const sysEvent_t* event ) { eventDispatcher = mouseObject->Get( "__eventDispatcher__" ); - if( !eventDispatcher.IsUndefined( ) && !var.IsFunction( ) ) + if( !eventDispatcher.IsUndefined() && !var.IsFunction() ) { - var = eventDispatcher.GetObject( )->Get( "mouseUp" ); + var = eventDispatcher.GetObject()->Get( "mouseUp" ); } - if( var.IsFunction( ) ) + if( var.IsFunction() ) { idSWFScriptVar eventArg; - auto* eventObj = globals->Get( "EventDispatcher" ).GetObject( ) - ->Get( "MouseEvent" ).GetObject( ) - ->Get( "[MouseEvent]" ).GetObject( ); - eventArg.SetObject( idSWFScriptObject::Alloc( ) ); - eventArg.GetObject( )->DeepCopy( eventObj ); + auto* eventObj = globals->Get( "EventDispatcher" ).GetObject() + ->Get( "MouseEvent" ).GetObject() + ->Get( "[MouseEvent]" ).GetObject(); + eventArg.SetObject( idSWFScriptObject::Alloc() ); + eventArg.GetObject()->DeepCopy( eventObj ); idSWFParmList parms; parms.Append( eventArg ); - if( !( ( idSWFScriptFunction_Script* ) var.GetFunction( ) )->GetScope( )->Num( ) ) + if( !( ( idSWFScriptFunction_Script* ) var.GetFunction() )->GetScope()->Num() ) { - ( ( idSWFScriptFunction_Script* ) var.GetFunction( ) )->GetScope( )->Append( globals ); + ( ( idSWFScriptFunction_Script* ) var.GetFunction() )->GetScope()->Append( globals ); } - var.GetFunction( )->Call( mouseObject, parms ); - parms.Clear( ); - mouseObject->Release( ); + var.GetFunction()->Call( mouseObject, parms ); + parms.Clear(); + mouseObject->Release(); mouseObject = NULL; return true; } @@ -608,31 +608,31 @@ bool idSWF::HandleEvent( const sysEvent_t* event ) idSWFScriptVar var = hoverObject->Get( "onRollOut" ); eventDispatcher = hoverObject->Get( "__eventDispatcher__" ); - if( !eventDispatcher.IsUndefined( ) && !var.IsFunction( ) ) + if( !eventDispatcher.IsUndefined() && !var.IsFunction() ) { - var = eventDispatcher.GetObject( )->Get( "mouseOut" ); - if( var.IsFunction( ) ) + var = eventDispatcher.GetObject()->Get( "mouseOut" ); + if( var.IsFunction() ) { idSWFScriptVar eventArg; - auto* eventObj = globals->Get( "EventDispatcher" ).GetObject( ) - ->Get( "MouseEvent" ).GetObject( ) - ->Get( "[MouseEvent]" ).GetObject( ); - eventArg.SetObject( idSWFScriptObject::Alloc( ) ); - eventArg.GetObject( )->DeepCopy( eventObj ); + auto* eventObj = globals->Get( "EventDispatcher" ).GetObject() + ->Get( "MouseEvent" ).GetObject() + ->Get( "[MouseEvent]" ).GetObject(); + eventArg.SetObject( idSWFScriptObject::Alloc() ); + eventArg.GetObject()->DeepCopy( eventObj ); idSWFParmList parms; parms.Append( eventArg ); - if( !( ( idSWFScriptFunction_Script* ) var.GetFunction( ) )->GetScope( )->Num( ) ) + if( !( ( idSWFScriptFunction_Script* ) var.GetFunction() )->GetScope()->Num() ) { - ( ( idSWFScriptFunction_Script* ) var.GetFunction( ) )->GetScope( )->Append( globals ); + ( ( idSWFScriptFunction_Script* ) var.GetFunction() )->GetScope()->Append( globals ); } - var.GetFunction( )->Call( hoverObject, parms ); - parms.Clear( ); + var.GetFunction()->Call( hoverObject, parms ); + parms.Clear(); retVal = true; } } - else if( var.IsFunction( ) ) + else if( var.IsFunction() ) { - var.GetFunction( )->Call( hoverObject, idSWFParmList( ) ); + var.GetFunction()->Call( hoverObject, idSWFParmList() ); retVal = true; } hoverObject->Release(); @@ -646,31 +646,31 @@ bool idSWF::HandleEvent( const sysEvent_t* event ) idSWFScriptVar var = hitObject->Get( "onRollOver" ); eventDispatcher = hoverObject->Get( "__eventDispatcher__" ); - if( !eventDispatcher.IsUndefined( ) && !var.IsFunction( ) ) + if( !eventDispatcher.IsUndefined() && !var.IsFunction() ) { - var = eventDispatcher.GetObject( )->Get( "mouseOver" ); + var = eventDispatcher.GetObject()->Get( "mouseOver" ); if( var.IsFunction() ) { idSWFScriptVar eventArg; - auto* eventObj = globals->Get( "EventDispatcher" ).GetObject( ) - ->Get( "MouseEvent" ).GetObject( ) - ->Get( "[MouseEvent]" ).GetObject( ); - eventArg.SetObject( idSWFScriptObject::Alloc( ) ); - eventArg.GetObject( )->DeepCopy( eventObj ); + auto* eventObj = globals->Get( "EventDispatcher" ).GetObject() + ->Get( "MouseEvent" ).GetObject() + ->Get( "[MouseEvent]" ).GetObject(); + eventArg.SetObject( idSWFScriptObject::Alloc() ); + eventArg.GetObject()->DeepCopy( eventObj ); idSWFParmList parms; parms.Append( eventArg ); - if( !( ( idSWFScriptFunction_Script* ) var.GetFunction( ) )->GetScope( )->Num( ) ) + if( !( ( idSWFScriptFunction_Script* ) var.GetFunction() )->GetScope()->Num() ) { - ( ( idSWFScriptFunction_Script* ) var.GetFunction( ) )->GetScope( )->Append( globals ); + ( ( idSWFScriptFunction_Script* ) var.GetFunction() )->GetScope()->Append( globals ); } - var.GetFunction( )->Call( hoverObject, parms ); - parms.Clear( ); + var.GetFunction()->Call( hoverObject, parms ); + parms.Clear(); retVal = true; } } - else if( var.IsFunction( ) ) + else if( var.IsFunction() ) { - var.GetFunction( )->Call( hitObject, idSWFParmList( ) ); + var.GetFunction()->Call( hitObject, idSWFParmList() ); retVal = true; } } diff --git a/neo/swf/SWF_Interpreter.cpp b/neo/swf/SWF_Interpreter.cpp index bebe0e2a73..8f945ed41e 100644 --- a/neo/swf/SWF_Interpreter.cpp +++ b/neo/swf/SWF_Interpreter.cpp @@ -276,7 +276,7 @@ void swf_PrintStream( SWF_AbcFile* file, idSWFBitStream& bitstream ) DoWordCode( restargc ); DoWordCode( restarg ); default: - common->Printf( "default %s %s\n", type.c_str( ) , info ? info->name : "Empty" ); + common->Printf( "default %s %s\n", type.c_str() , info ? info->name : "Empty" ); } static const char* tabs[] = { " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "}; if( info && info->operandCount > 0 ) @@ -284,7 +284,7 @@ void swf_PrintStream( SWF_AbcFile* file, idSWFBitStream& bitstream ) bitstream.ReadData( info->operandCount ); } common->Printf( " %s %s o %s%i \t s %s%i \n" , - info ? info->name : type.c_str( ), + info ? info->name : type.c_str(), tabs[int( 18 - ( int( idStr::Length( info->name ) ) ) )], info->operandCount > 0 ? "^2" : "^1" , info->operandCount, @@ -328,21 +328,21 @@ void idSWFScriptFunction_Script::findproperty( SWF_AbcFile* file, idSWFStack& st void idSWFScriptFunction_Script::findpropstrict( SWF_AbcFile* file, idSWFStack& stack, idSWFBitStream& bitstream ) { const auto& cp = file->constant_pool; - const auto& mn = file->constant_pool.multinameInfos[bitstream.ReadEncodedU32( )]; + const auto& mn = file->constant_pool.multinameInfos[bitstream.ReadEncodedU32()]; const idStrPtr propName = ( idStrPtr ) &cp.utf8Strings[mn.nameIndex]; //search up scope stack. - for( int i = scope.Num( ) - 1; i >= 0; i-- ) + for( int i = scope.Num() - 1; i >= 0; i-- ) { auto* s = scope[i]; while( s ) - if( s->HasProperty( propName->c_str( ) ) ) + if( s->HasProperty( propName->c_str() ) ) { - stack.Alloc( ) = s->Get( propName->c_str( ) ); + stack.Alloc() = s->Get( propName->c_str() ); return; } - else if( s->GetPrototype( ) && s->GetPrototype( )->GetPrototype( ) ) + else if( s->GetPrototype() && s->GetPrototype()->GetPrototype() ) { - s = s->GetPrototype( )->GetPrototype( ); + s = s->GetPrototype()->GetPrototype(); } else { @@ -357,21 +357,21 @@ void idSWFScriptFunction_Script::findpropstrict( SWF_AbcFile* file, idSWFStack& void idSWFScriptFunction_Script::getlex( SWF_AbcFile* file, idSWFStack& stack, idSWFBitStream& bitstream ) { const auto& cp = file->constant_pool; - const auto& mn = file->constant_pool.multinameInfos[bitstream.ReadEncodedU32( )]; + const auto& mn = file->constant_pool.multinameInfos[bitstream.ReadEncodedU32()]; const idStrPtr propName = ( idStrPtr ) &cp.utf8Strings[mn.nameIndex]; //search up scope stack. - for( int i = scope.Num( ) - 1; i >= 0; i-- ) + for( int i = scope.Num() - 1; i >= 0; i-- ) { auto* s = scope[i]; while( s ) - if( s->HasProperty( propName->c_str( ) ) ) + if( s->HasProperty( propName->c_str() ) ) { - stack.Alloc( ) = s->Get( propName->c_str( ) ); + stack.Alloc() = s->Get( propName->c_str() ); return; } - else if( s->GetPrototype( ) && s->GetPrototype( )->GetPrototype() ) + else if( s->GetPrototype() && s->GetPrototype()->GetPrototype() ) { - s = s->GetPrototype( )->GetPrototype(); + s = s->GetPrototype()->GetPrototype(); } else { @@ -413,7 +413,7 @@ void idSWFScriptFunction_Script::getlocal0( SWF_AbcFile* file, idSWFStack& stack //Classes are constructed implicitly void idSWFScriptFunction_Script::newclass( SWF_AbcFile* file, idSWFStack& stack, idSWFBitStream& bitstream ) { - const auto& ci = file->classes[bitstream.ReadEncodedU32( )]; + const auto& ci = file->classes[bitstream.ReadEncodedU32()]; idSWFScriptVar base = stack.A(); stack.Pop( 1 ); idSWFScriptVar* thisObj = ®isters[0]; @@ -423,7 +423,7 @@ void idSWFScriptFunction_Script::newclass( SWF_AbcFile* file, idSWFStack& stack, void idSWFScriptFunction_Script::callpropvoid( SWF_AbcFile* file, idSWFStack& stack, idSWFBitStream& bitstream ) { const auto& cp = file->constant_pool; - const auto& mn = file->constant_pool.multinameInfos[bitstream.ReadEncodedU32( )]; + const auto& mn = file->constant_pool.multinameInfos[bitstream.ReadEncodedU32()]; const idStrPtr funcName = ( idStrPtr ) &cp.utf8Strings[mn.nameIndex]; uint32 arg_count = bitstream.ReadEncodedU32(); @@ -436,7 +436,7 @@ void idSWFScriptFunction_Script::callpropvoid( SWF_AbcFile* file, idSWFStack& st } idSWFParmList parms( arg_count ); - for( int i = 0; i < parms.Num( ); i++ ) + for( int i = 0; i < parms.Num(); i++ ) { parms[parms.Num() - 1 - i] = stack.A(); stack.Pop( 1 ); @@ -489,7 +489,7 @@ idSWFScriptVar idSWFScriptFunction_Script::RunAbc( idSWFScriptObject* thisObject } abcCallstackLevel++; - while( bitstream.Tell( ) < bitstream.Length( ) ) + while( bitstream.Tell() < bitstream.Length() ) { #define ExecWordCode( n ) case OP_##n: n(abcFile,stack,bitstream); continue; #define InlineWordCode( n ) case OP_##n: @@ -938,28 +938,28 @@ idSWFScriptVar idSWFScriptFunction_Script::RunAbc( idSWFScriptObject* thisObject InlineWordCode( pushstring ) { const auto& cp = abcFile->constant_pool.utf8Strings; - const auto& mn = cp[bitstream.ReadEncodedU32( )]; + const auto& mn = cp[bitstream.ReadEncodedU32()]; stack.Append( idSWFScriptString( mn ) ); continue; } InlineWordCode( pushint ) { const auto& cp = abcFile->constant_pool.integers; - const auto& val = cp[bitstream.ReadEncodedU32( )]; + const auto& val = cp[bitstream.ReadEncodedU32()]; stack.Append( idSWFScriptVar( val ) ); continue; } InlineWordCode( pushuint ) { const auto& cp = abcFile->constant_pool.uIntegers; - const auto& val = cp[bitstream.ReadEncodedU32( )]; + const auto& val = cp[bitstream.ReadEncodedU32()]; stack.Append( idSWFScriptVar( ( int )val ) ); continue; } InlineWordCode( pushdouble ) { const auto& cp = abcFile->constant_pool.doubles; - const auto& val = cp[bitstream.ReadEncodedU32( )]; + const auto& val = cp[bitstream.ReadEncodedU32()]; stack.Append( idSWFScriptVar( ( float )val ) ); continue; } @@ -1006,25 +1006,25 @@ idSWFScriptVar idSWFScriptFunction_Script::RunAbc( idSWFScriptObject* thisObject { //fold this with callpropvoid. const auto& cp = abcFile->constant_pool; - const auto& mn = abcFile->constant_pool.multinameInfos[bitstream.ReadEncodedU32( )]; + const auto& mn = abcFile->constant_pool.multinameInfos[bitstream.ReadEncodedU32()]; const idStrPtr funcName = ( idStrPtr ) &cp.utf8Strings[mn.nameIndex]; - uint32 arg_count = bitstream.ReadEncodedU32( ); + uint32 arg_count = bitstream.ReadEncodedU32(); idSWFParmList parms( arg_count ); - for( int i = 0; i < parms.Num( ); i++ ) + for( int i = 0; i < parms.Num(); i++ ) { - parms[parms.Num() - 1 - i] = stack.A( ); + parms[parms.Num() - 1 - i] = stack.A(); stack.Pop( 1 ); } - idSWFScriptVar& item = stack.A( ); + idSWFScriptVar& item = stack.A(); - if( item.IsFunction( ) ) + if( item.IsFunction() ) { stack.Pop( 1 ); - stack.Alloc() = item.GetFunction( )->Call( registers[0].GetObject( ), parms ); + stack.Alloc() = item.GetFunction()->Call( registers[0].GetObject(), parms ); } - else if( item.IsObject( ) ) + else if( item.IsObject() ) { auto func = item.GetObject()->Get( funcName->c_str() ); if( !func.IsFunction() ) // search up scope @@ -1052,9 +1052,9 @@ idSWFScriptVar idSWFScriptFunction_Script::RunAbc( idSWFScriptObject* thisObject } } } - if( func.IsFunction( ) ) + if( func.IsFunction() ) { - stack.Alloc() = func.GetFunction( )->Call( item.GetObject( ), parms ); + stack.Alloc() = func.GetFunction()->Call( item.GetObject(), parms ); } } continue; @@ -1075,7 +1075,7 @@ idSWFScriptVar idSWFScriptFunction_Script::RunAbc( idSWFScriptObject* thisObject } InlineWordCode( constructsuper ) { - uint32 args = bitstream.ReadEncodedU32( ); + uint32 args = bitstream.ReadEncodedU32(); stack.Pop( args ); continue; } @@ -1083,9 +1083,9 @@ idSWFScriptVar idSWFScriptFunction_Script::RunAbc( idSWFScriptObject* thisObject { //no need to call constructors for props that const auto& cp = abcFile->constant_pool; - const auto& mn = abcFile->constant_pool.multinameInfos[bitstream.ReadEncodedU32( )]; + const auto& mn = abcFile->constant_pool.multinameInfos[bitstream.ReadEncodedU32()]; const idStrPtr propName = ( idStrPtr ) &cp.utf8Strings[mn.nameIndex]; - uint32 arg_count = bitstream.ReadEncodedU32( ); + uint32 arg_count = bitstream.ReadEncodedU32(); if( *propName == "Array" ) { for( int i = 0; i < arg_count; i++ ) @@ -1231,10 +1231,10 @@ idSWFScriptVar idSWFScriptFunction_Script::RunAbc( idSWFScriptObject* thisObject InlineWordCode( initproperty ) { const auto& cp = abcFile->constant_pool; - const auto& mn = cp.multinameInfos[bitstream.ReadEncodedU32( )]; + const auto& mn = cp.multinameInfos[bitstream.ReadEncodedU32()]; const auto& n = cp.utf8Strings[mn.nameIndex]; - idSWFScriptVar value = stack.A( ); + idSWFScriptVar value = stack.A(); stack.Pop( 1 ); stack.A().GetObject()->Set( n, value ); continue; @@ -1314,9 +1314,9 @@ idSWFScriptVar idSWFScriptFunction_Script::RunAbc( idSWFScriptObject* thisObject InlineWordCode( negate_i ) InlineWordCode( negate ) { - auto& val = stack.A( ); + auto& val = stack.A(); idSWFScriptVar result; - switch( val.GetType( ) ) + switch( val.GetType() ) { case idSWFScriptVar::SWF_VAR_FLOAT: val.SetFloat( -val.ToFloat() ); @@ -1325,16 +1325,16 @@ idSWFScriptVar idSWFScriptFunction_Script::RunAbc( idSWFScriptObject* thisObject val.SetInteger( -val.ToInteger() ); continue; default: - common->Warning( " Tried to increment incompatible type %s", val.TypeOf( ) ); + common->Warning( " Tried to increment incompatible type %s", val.TypeOf() ); } continue; } InlineWordCode( increment_i ) InlineWordCode( increment ) { - auto& val = stack.A( ); + auto& val = stack.A(); idSWFScriptVar result; - switch( val.GetType( ) ) + switch( val.GetType() ) { case idSWFScriptVar::SWF_VAR_FLOAT: val.SetFloat( val.ToFloat() + 1.0f ); @@ -1343,7 +1343,7 @@ idSWFScriptVar idSWFScriptFunction_Script::RunAbc( idSWFScriptObject* thisObject val.SetInteger( val.ToInteger() + 1 ); continue; default: - common->Warning( " Tried to increment incompatible type %s", val.TypeOf( ) ); + common->Warning( " Tried to increment incompatible type %s", val.TypeOf() ); } continue; } @@ -1414,22 +1414,22 @@ idSWFScriptVar idSWFScriptFunction_Script::RunAbc( idSWFScriptObject* thisObject auto& lH = stack.B(); auto& rH = stack.A(); idSWFScriptVar result; - switch( lH.GetType( ) ) + switch( lH.GetType() ) { case idSWFScriptVar::SWF_VAR_STRING: - result.SetString( lH.ToString( ) + rH.ToString( ) ); + result.SetString( lH.ToString() + rH.ToString() ); break; case idSWFScriptVar::SWF_VAR_FLOAT: - result.SetFloat( lH.ToFloat( ) + rH.ToFloat( ) ); + result.SetFloat( lH.ToFloat() + rH.ToFloat() ); break; case idSWFScriptVar::SWF_VAR_INTEGER: - result.SetInteger( lH.ToInteger( ) + rH.ToInteger( ) ); + result.SetInteger( lH.ToInteger() + rH.ToInteger() ); break; case idSWFScriptVar::SWF_VAR_FUNCTION: - result.SetString( lH.ToString( ) + rH.ToString( ) ); + result.SetString( lH.ToString() + rH.ToString() ); break; default: - common->Warning( " Tried to add incompatible types %s + %s", lH.TypeOf( ), rH.TypeOf( ) ); + common->Warning( " Tried to add incompatible types %s + %s", lH.TypeOf(), rH.TypeOf() ); } stack.Pop( 2 ); @@ -1442,16 +1442,16 @@ idSWFScriptVar idSWFScriptFunction_Script::RunAbc( idSWFScriptObject* thisObject auto& lH = stack.A(); auto& rH = stack.B(); idSWFScriptVar result; - switch( lH.GetType( ) ) + switch( lH.GetType() ) { case idSWFScriptVar::SWF_VAR_FLOAT: - result.SetFloat( lH.ToFloat( ) - rH.ToFloat( ) ); + result.SetFloat( lH.ToFloat() - rH.ToFloat() ); break; case idSWFScriptVar::SWF_VAR_INTEGER: - result.SetInteger( lH.ToInteger( ) - rH.ToInteger( ) ); + result.SetInteger( lH.ToInteger() - rH.ToInteger() ); break; default: - common->Warning( " Tried to subtract incompatible types %s + %s", lH.TypeOf( ), rH.TypeOf( ) ); + common->Warning( " Tried to subtract incompatible types %s + %s", lH.TypeOf(), rH.TypeOf() ); } stack.Pop( 2 ); diff --git a/neo/swf/SWF_Main.cpp b/neo/swf/SWF_Main.cpp index 91a0afb81c..154da31462 100644 --- a/neo/swf/SWF_Main.cpp +++ b/neo/swf/SWF_Main.cpp @@ -91,7 +91,7 @@ void idSWF::CreateAbcObjects( idSWFScriptObject* globals ) init->SetData( classInfo.cinit ); tmp->Set( "__initializer__", idSWFScriptVar( init ) ); init->SetAbcFile( &abcFile ); - idSWFScriptFunction_Script* constr = idSWFScriptFunction_Script::Alloc( ); + idSWFScriptFunction_Script* constr = idSWFScriptFunction_Script::Alloc(); constr->SetData( instanceInfo.iinit ); tmp->Set( "__constructor__", idSWFScriptVar( constr ) ); constr->SetAbcFile( &abcFile ); @@ -116,7 +116,7 @@ void idSWF::CreateAbcObjects( idSWFScriptObject* globals ) fullClassName += abcFile.constant_pool.utf8Strings[instanceInfo.name->nameIndex]; idStr& className = abcFile.constant_pool.utf8Strings[instanceInfo.name->nameIndex]; idSWFScriptObject* tmp = globals->GetObject( fullClassName ); - auto* target = idSWFScriptObject::Alloc( ); + auto* target = idSWFScriptObject::Alloc(); auto* var = tmp->GetVariable( "[" + fullClassName + "]", true ); for( swfTraits_info& trait : instanceInfo.traits ) @@ -453,14 +453,14 @@ idSWF::idSWF( const char* filename_, idSoundWorld* soundWorld_, bool exportJSON, globals->Set( "_global", globals ); SWF_NATIVE_API_OBJECT_DECLARE( _global ); - auto* accessibilityPropertiesObj = idSWFScriptObject::Alloc( ); - //accessibilityPropertiesObj->Set( "", idSWFScriptObject::Alloc( ) ); + auto* accessibilityPropertiesObj = idSWFScriptObject::Alloc(); + //accessibilityPropertiesObj->Set( "", idSWFScriptObject::Alloc() ); - auto* dispatcherObj = idSWFScriptObject::Alloc( ); + auto* dispatcherObj = idSWFScriptObject::Alloc(); dispatcherObj->SetPrototype( &eventDispatcherScriptObjectPrototype ); extern idSWFScriptObject_SpriteInstancePrototype spriteInstanceScriptObjectPrototype; - auto* movieclipObj = idSWFScriptObject::Alloc( ); + auto* movieclipObj = idSWFScriptObject::Alloc(); movieclipObj->SetPrototype( &spriteInstanceScriptObjectPrototype ); if( spriteInstanceScriptObjectPrototype.GetPrototype() == NULL ) @@ -476,13 +476,13 @@ idSWF::idSWF( const char* filename_, idSoundWorld* soundWorld_, bool exportJSON, globals->Set( "Array", arrayObj ); globals->Set( "Object", &scriptFunction_Object ); globals->Set( "EventDispatcher", dispatcherObj ); - globals->Set( "DisplayObject", idSWFScriptObject::Alloc( ) ); - globals->Set( "InteractiveObject", idSWFScriptObject::Alloc( ) ); + globals->Set( "DisplayObject", idSWFScriptObject::Alloc() ); + globals->Set( "InteractiveObject", idSWFScriptObject::Alloc() ); globals->Set( "AccessibilityProperties", accessibilityPropertiesObj ); globals->Set( "Dictionary", idSWFScriptObject::Alloc() ); - globals->Set( "DisplayObjectContainer", idSWFScriptObject::Alloc( ) ); - globals->Set( "Sprite", idSWFScriptObject::Alloc( ) ); - globals->Set( "DisplayObjectContainer", idSWFScriptObject::Alloc( ) ); + globals->Set( "DisplayObjectContainer", idSWFScriptObject::Alloc() ); + globals->Set( "Sprite", idSWFScriptObject::Alloc() ); + globals->Set( "DisplayObjectContainer", idSWFScriptObject::Alloc() ); globals->Set( "MovieClip", movieclipObj ); CreateAbcObjects( globals ); @@ -490,7 +490,7 @@ idSWF::idSWF( const char* filename_, idSoundWorld* soundWorld_, bool exportJSON, mainspriteInstance = spriteInstanceAllocator.Alloc(); mainspriteInstance->abcFile = &abcFile; - mainspriteInstance->scriptObject = idSWFScriptObject::Alloc( ); + mainspriteInstance->scriptObject = idSWFScriptObject::Alloc(); //stage class. for( auto& symbol : symbolClasses.symbols ) @@ -501,11 +501,11 @@ idSWF::idSWF( const char* filename_, idSoundWorld* soundWorld_, bool exportJSON, idStr objName; mainspriteInstance->name.ExtractFileExtension( objName ); - auto* super = globals->Get( symbol.name ).GetObject( ); + auto* super = globals->Get( symbol.name ).GetObject(); auto dcopy = super->Get( "[" + symbol.name + "]" ); if( dcopy.IsObject() ) { - mainspriteInstance->scriptObject->DeepCopy( dcopy.GetObject( ) ); + mainspriteInstance->scriptObject->DeepCopy( dcopy.GetObject() ); } mainspriteInstance->scriptObject->SetPrototype( super ); diff --git a/neo/swf/SWF_ScriptFunction.cpp b/neo/swf/SWF_ScriptFunction.cpp index 36a158f631..6cc6e6eaad 100644 --- a/neo/swf/SWF_ScriptFunction.cpp +++ b/neo/swf/SWF_ScriptFunction.cpp @@ -306,7 +306,7 @@ idSWFScriptVar idSWFScriptFunction_Script::Call( idSWFScriptObject* thisObject, assert( methodInfo->body ); auto* body = methodInfo->body; registers[0].SetObject( thisObject ); - idSWFBitStream abcStream( body->code.Ptr( ), body->codeLength, false ); + idSWFBitStream abcStream( body->code.Ptr(), body->codeLength, false ); retVal = RunAbc( thisObject, stack, abcStream ); //-- FIXME diff --git a/neo/swf/SWF_ScriptFunction.h b/neo/swf/SWF_ScriptFunction.h index d3b6c87a30..eaef35cdd1 100644 --- a/neo/swf/SWF_ScriptFunction.h +++ b/neo/swf/SWF_ScriptFunction.h @@ -247,7 +247,7 @@ class idSWFScriptFunction_Script : public idSWFScriptFunction { abcFile = _file; } - swfMethod_info* GetMethodInfo( ) + swfMethod_info* GetMethodInfo() { return methodInfo; } diff --git a/neo/swf/SWF_ScriptObject.cpp b/neo/swf/SWF_ScriptObject.cpp index b310766b79..ecacac5399 100644 --- a/neo/swf/SWF_ScriptObject.cpp +++ b/neo/swf/SWF_ScriptObject.cpp @@ -63,7 +63,7 @@ void idSWFScriptObject::DeepCopy( idSWFScriptObject* _object ) { if( _object != NULL ) { - for( int i = 0; i < _object->NumVariables( ); i++ ) + for( int i = 0; i < _object->NumVariables(); i++ ) { Set( _object->EnumVariable( i ), _object->Get( _object->EnumVariable( i ) ) ); } diff --git a/neo/swf/SWF_SpriteInstance.cpp b/neo/swf/SWF_SpriteInstance.cpp index 9c4a967c76..cc2f11e8dc 100644 --- a/neo/swf/SWF_SpriteInstance.cpp +++ b/neo/swf/SWF_SpriteInstance.cpp @@ -221,8 +221,8 @@ swfDisplayEntry_t* idSWFSpriteInstance::AddDisplayEntry( int depth, int characte display.spriteInstance->abcFile = this->abcFile; if( dictEntry->scriptClass.IsValid() ) { - display.spriteInstance->scriptObject = idSWFScriptObject::Alloc( ); - auto* super = dictEntry->scriptClass.GetObject( ); + display.spriteInstance->scriptObject = idSWFScriptObject::Alloc(); + auto* super = dictEntry->scriptClass.GetObject(); auto dcopy = super->Get( *dictEntry->name ); if( dcopy.IsObject() ) @@ -240,9 +240,9 @@ swfDisplayEntry_t* idSWFSpriteInstance::AddDisplayEntry( int depth, int characte { display.textInstance = sprite->swf->textInstanceAllocator.Alloc(); - if( dictEntry->scriptClass.IsValid( ) ) + if( dictEntry->scriptClass.IsValid() ) { - auto* super = dictEntry->scriptClass.GetObject( ); + auto* super = dictEntry->scriptClass.GetObject(); auto dcopy = super->Get( *dictEntry->name ); if( dcopy.IsObject() ) { @@ -256,8 +256,8 @@ swfDisplayEntry_t* idSWFSpriteInstance::AddDisplayEntry( int depth, int characte } else if( dictEntry->type == SWF_DICT_TEXT ) { - //display.textInstance = sprite->swf->textInstanceAllocator.Alloc( ); - //display.textInstance->Init( dictEntry->text, sprite->GetSWF( ) ); + //display.textInstance = sprite->swf->textInstanceAllocator.Alloc(); + //display.textInstance->Init( dictEntry->text, sprite->GetSWF() ); } } return &display; diff --git a/neo/swf/SWF_TextInstance.cpp b/neo/swf/SWF_TextInstance.cpp index f8379458a3..a15794c0ac 100644 --- a/neo/swf/SWF_TextInstance.cpp +++ b/neo/swf/SWF_TextInstance.cpp @@ -131,12 +131,12 @@ void idSWFTextInstance::Init( idSWFText* _text, idSWF* _swf ) inputTextStartChar = 0; - renderDelay = swf_textRndLetterDelay.GetInteger( ); + renderDelay = swf_textRndLetterDelay.GetInteger(); needsSoundUpdate = false; useDropShadow = false; useStroke = false; strokeStrength = 1.0f; - strokeWeight = swf_textStrokeSize.GetFloat( ); + strokeWeight = swf_textStrokeSize.GetFloat(); scriptObject.SetPrototype( &textInstanceScriptObjectPrototype ); scriptObject.SetText( this );