void InstallPatches(void) { WORD i; Forbid(); for(i = 0; pi[i].library; i++) { SetFunction(GetLib(pi[i].library), -pi[i].whichfunc * LIB_VECTSIZE, __AROS_GETVECADDR(GetLib(pi[i].patchlibrary), pi[i].whichpatchfunc)); } Permit(); patches_installed = TRUE; }
void Square::Update() { if ( GetNonWallCount() == 0 && IsOnScreen() ) _timer--; else _timer = GetLib().RandInt( 80 ) + 40; if ( _timer == 0 ) Damage( 4, false, 0 ); Vec2 pos = GetPosition(); if ( pos._x < 0 && _dir._x <= 0 ) { _dir._x = -_dir._x; if ( _dir._x <= 0 ) _dir._x = 1; } if ( pos._y < 0 && _dir._y <= 0 ) { _dir._y = -_dir._y; if ( _dir._y <= 0 ) _dir._y = 1; } if ( pos._x > Lib::WIDTH && _dir._x >= 0 ) { _dir._x = -_dir._x; if ( _dir._x >= 0 ) _dir._x = -1; } if ( pos._y > Lib::HEIGHT && _dir._y >= 0 ) { _dir._y = -_dir._y; if ( _dir._y >= 0 ) _dir._y = -1; } _dir.Normalise(); Move( _dir * SPEED ); SetRotation( _dir.Angle() ); }
void Shielder::Update() { fixed s = _power ? M_PT_ZERO_ONE * 12 : M_PT_ZERO_ONE * 4; Rotate( s ); GetShape( 9 ).Rotate( -2 * s ); for ( int i = 0; i < 8; i++ ) GetShape( i ).Rotate( -s ); bool onScreen = false; if ( GetPosition()._x < 0 ) _dir.Set( 1, 0 ); else if ( GetPosition()._x > Lib::WIDTH ) _dir.Set( -1, 0 ); else if ( GetPosition()._y < 0 ) _dir.Set( 0, 1 ); else if ( GetPosition()._y > Lib::HEIGHT ) _dir.Set( 0, -1 ); else onScreen = true; if ( !onScreen && _rotate ) { _timer = 0; _rotate = false; } fixed speed = SPEED + ( _power ? M_PT_ONE * 3 : M_PT_ONE * 2 ) * ( 16 - GetHP() ); if ( _rotate ) { Vec2 d( _dir ); d.Rotate( ( _rDir ? 1 : -1 ) * ( TIMER - _timer ) * M_PI / ( M_TWO * TIMER ) ); _timer--; if ( _timer <= 0 ) { _timer = 0; _rotate = false; _dir.Rotate( ( _rDir ? 1 : -1 ) * M_PI / M_TWO ); } Move( d * speed ); } else { _timer++; if ( _timer > TIMER * 2 ) { _timer = TIMER; _rotate = true; _rDir = GetLib().RandInt( 2 ) != 0; } if ( IsOnScreen() && _timer % TIMER == TIMER / 2 && _power ) { Player* p = GetNearestPlayer(); Vec2 v = GetPosition(); Vec2 d = p->GetPosition() - v; d.Normalise(); Spawn( new SBBossShot( v, d * M_THREE, 0x33cc99ff ) ); PlaySoundRandom( Lib::SOUND_BOSS_FIRE ); } Move( _dir * speed ); } _dir.Normalise(); }
void Tractor::Render() const { Enemy::Render(); if ( _spinning ) { for ( unsigned int i = 0; i < _players.size(); i++ ) { if ( ( ( _timer + i * 4 ) / 4 ) % 2 && !( ( Player* )_players[ i ] )->IsKilled() ) { GetLib().RenderLine( Vec2f( GetPosition() ), Vec2f( _players[ i ]->GetPosition() ), 0xcc33ccff ); } } } }
fnPInvoke PInvoke_GetFunction(tMetaData *pMetaData, tMD_ImplMap *pImplMap) { tLoadedLib *pLib; STRING libName; void *pProc; libName = MetaData_GetModuleRefName(pMetaData, pImplMap->importScope); pLib = GetLib(libName); if (pLib == NULL) { // Library not found, so we can't find the function return NULL; } #if WIN32 pProc = GetProcAddress(pLib->pLib, pImplMap->importName); #else pProc = dlsym(pLib->pLib, pImplMap->importName); #endif return pProc; }
bool CheckFreetypeFont(const Pipe &pipe) { OpenArgs args(pipe); return !FT_Open_Face(GetLib(), args.Get(), -1, 0); }