wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Warcraft III Modding > Developer's Corner > Warcraft Editing Tools
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 07-10-2007, 12:57 AM   #151
UnMi
User
 
UnMi's Avatar
 
Join Date: Aug 2006
Posts: 213

Submissions (1)

UnMi is on a distinguished road (18)

Default

Hmm, I'm using 4.2, have checked everything besides tweaks and it stops when "Cleaning more functions/variables (2) (war3map.j)" and gives the error:
"Access violation at address 004803D4 in module "VXJWTSOPT.exe'. Read of address 04D248BC."
UnMi is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 07-10-2007, 02:52 AM   #152
Tossrock
User
 
Tossrock's Avatar
 
Join Date: Sep 2003
Posts: 54

Tossrock has little to show at this moment (0)

Default

The relevant struct data

Collapse JASS:
globals
    constant real FRAMES = 40
    constant real HOOKSPACING = 27
    constant real TRIGTOQUADCUTOFF = 900
    constant real TIMEREXEC = 1/FRAMES
    constant real halfpi = 3.14159 / 2
    real BARRICADEOFFSET = 100
    group HOOKHEADS
endglobals

struct PudgeData

//Basic hook stats
    real SPEED = SPEEDBASE/FRAMES
    real RADIUS = RADIUSBASE
    real DAMAGE = DAMAGEBASE
    real RANGE = RANGEBASE

    unit hookout

    integer SPEEDUPS=0
    integer RADIUSUPS=0
    integer RANGEUPS=0
    integer DAMAGEUPS=0

//Status stuff
    boolean unhookable = false
    boolean grappling = false
    boolean beingHooked = false
    effect HookBlockEffect

//Miscellaneous
    integer spree = 0
    integer DeathTime = 0

//Item stuff
    real CURRENTNAIX = 0
    real CURRENTSTRYG = 0
    real CURRENTBARATH = 0

//Powerup related
    real hyperfac = 1
    boolean flamehook = false
    boolean multihook = false
    boolean thunderhook = false
    boolean hominghook = false

endstruct

struct MeatHook
    timer t = null
    LinkedList list = 0
    PudgeData pd = 0
    boolean hitTarget = false
    boolean grapple
    boolean isagrapple = false
    unit caster = null
    unit target = null
    player p = null
    trigger HeadDetect

    //Real values and such
    real angle = 0
    real distance = 0
    real distinterval = 0
    real CosAngle = 0
    real SinAngle = 0
    real oldtx = 0
    real oldty = 0

    //Hook Parts and Such
    unit hookHead
    method onDestroy takes nothing returns nothing
        if .t!=null then
            call FHLocals(.t)
            call DestroyTimer(.t)
            set .t = null
        endif
        if .list!=0 then
            call LinkedList.destroy(.list)
        endif
        if .pd!=0 then
            set .pd = 0
        endif
        if .target != null then
            set .target = null
        endif
        if .caster != null then
            set .caster = null
        endif
        if .HeadDetect!=null then
            call FHLocals(.HeadDetect)
            call DestroyTrigger(.HeadDetect)
            set .HeadDetect = null
        endif
        if .p!=null then
            set .p = null
        endif
        if .hitTarget == true then
            set .hitTarget = false
        endif
        if .grapple == true then
            set .grapple = false
        endif
    endmethod

    static method HitUnitT takes nothing returns nothing
        local unit target = GetTriggerUnit()
        local trigger trig = GetTriggeringTrigger()
        local MeatHook this = GHInt(trig,"hook")
        local PudgeData tdata = GHInt(target,"data")
        local real damage
        local real theta
        local real tangent
        local real deflection
        local Barricade barricade
//Grappling or Deflection
        if IsUnitType(target, UNIT_TYPE_STRUCTURE) then
            if .isagrapple then
                if .pd.thunderhook then
                    call SpawnNova(.caster,GetUnitX(target),GetUnitY(target))
                endif
                set .hitTarget = true
                call SetUnitTimeScalePercent( .hookHead, 0)
                if not(.pd.grappling) then
                    set .pd.grappling = true
                    set .grapple = true
                else
                    call KillUnit(.caster)
                    call PlaySoundBJ(gg_snd_headshot)
                    set .pd.grappling = false
                    call TimedEffectPt(GetUnitX(.caster),GetUnitY(.caster),5,"Units\\Undead\\Abomination\\AbominationExplosion.mdl")
                    call ShowUnitHide(.caster)
                endif
                call FHLocals(trig)
                call DestroyTrigger(trig)
            else
//Reflection

//Round buildings
                if GetUnitTypeId(target)!= 'h00B' and GetUnitTypeId(target)!='h00G' then
                    set theta = Atan2(GetUnitY(target)-GetUnitY(.hookHead),GetUnitX(target)-GetUnitX(.hookHead))
                    if theta > .angle then
                        set tangent = theta + 3.14159/2
                    else
                        set tangent = theta - 3.14159/2
                    endif
                    set deflection = theta - tangent
                    set tangent = ModuloReal(tangent + 3.14159, 6.28318)
                    set .angle = tangent + deflection
                endif

                if GetUnitTypeId(target) == 'h00B' or GetUnitTypeId(target)=='h00H' then
                    set barricade = GetUnitUserData(target)
                    call barricade.OnHit(this)
endif
                endif
        else

//Hit something

            if not(.isagrapple) and not(tdata.unhookable) then
                if not(tdata.beingHooked) or tdata == 0 then
                    set .target = target
                    set .hitTarget = true
                    set tdata.beingHooked = true
                    if .pd.thunderhook then
                        call SpawnNova(.caster,GetUnitX(target),GetUnitY(target))
                    endif
                else
                    if .pd.thunderhook then
                        call SpawnNova(.caster,GetUnitX(target),GetUnitY(target))
                    endif
                    set .hitTarget = true
                    set tdata.beingHooked = false
                    call PlaySoundBJ( gg_snd_headshot )
                    call UnitDamageTargetBJ( .caster, target, 100000, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL)
                    call TimedEffectPt(GetUnitX(target),GetUnitY(target),5,"Units\\Undead\\Abomination\\AbominationExplosion.mdl")
                    set .target = null
                    call ShowUnitHide(target)
                endif

//Hit Enemy
                if (IsUnitEnemy(target,.p) and GetUnitTypeId(target)!='nglm') then
                    set .oldtx = GetUnitX(target)
                    set .oldty = GetUnitY(target)
                    set damage = .pd.DAMAGE
                    call SetUnitTimeScalePercent( .hookHead, 0)

//Spiritbreaker
                    if .pd.CURRENTBARATH > 0 then
                        set damage = damage+(.pd.SPEED*FRAMES-700)*.pd.CURRENTBARATH
                        call TimedEffectPt(GetUnitX(target),GetUnitY(target), 3, "Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl")
                    endif
                    call TimedEffectUnit(target,"chest",3, "Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl")

//Naix
                    if .pd.CURRENTNAIX > 0 and IsUnitAliveBJ(.caster) then
                        call TimedEffectUnit(.caster,"chest",3,"Abilities\\Spells\\Human\\Heal\\HealTarget.mdl")
                        call SetUnitState(.caster, UNIT_STATE_LIFE, GetUnitState(.caster, UNIT_STATE_LIFE)+(.pd.CURRENTNAIX*damage))
                    endif
                    call UnitDamageTargetBJ( .caster, target, damage, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL )
                endif
                call DestroyTrigger(trig)
            endif
        endif

        set target = null
        set trig = null
    endmethod

    method HitUnit takes unit target returns nothing
        //local unit target = GetTriggerUnit()
        //local trigger trig = GetTriggeringTrigger()
        //local MeatHook this = GHInt(trig,"hook")
        local PudgeData tdata = GHInt(target,"data")
        local real damage
        local real theta
        local real tangent
        local real deflection
        local Barricade barricade
//Grappling or Deflection
        if IsUnitType(target, UNIT_TYPE_STRUCTURE) then
            if .isagrapple then
                if .pd.thunderhook then
                    call SpawnNova(.caster,GetUnitX(target),GetUnitY(target))
                endif
                set .hitTarget = true
                call SetUnitTimeScalePercent( .hookHead, 0)
                if not(.pd.grappling) then
                    set .pd.grappling = true
                    set .grapple = true
                else
                    call KillUnit(.caster)
                    call PlaySoundBJ(gg_snd_headshot)
                    set .pd.grappling = false
                    call TimedEffectPt(GetUnitX(.caster),GetUnitY(.caster),5,"Units\\Undead\\Abomination\\AbominationExplosion.mdl")
                    call ShowUnitHide(.caster)
                endif
                //call FHLocals(trig)
                //call DestroyTrigger(trig)
            else
//Reflection

//Round buildings
                if GetUnitTypeId(target)!= 'h00B' and GetUnitTypeId(target)!='h00G' then
                    set theta = Atan2(GetUnitY(target)-GetUnitY(.hookHead),GetUnitX(target)-GetUnitX(.hookHead))
                    if theta > .angle then
                        set tangent = theta + 3.14159/2
                    else
                        set tangent = theta - 3.14159/2
                    endif
                    set deflection = theta - tangent
                    set tangent = ModuloReal(tangent + 3.14159, 6.28318)
                    set .angle = tangent + deflection
                endif

                if GetUnitTypeId(target) == 'h00B' or GetUnitTypeId(target)=='h00H' then
                    set barricade = GetUnitUserData(target)
                    call barricade.OnHit(this)
endif
                endif
        else

//Hit something

            if not(.isagrapple) and not(tdata.unhookable) then
                if not(tdata.beingHooked) or tdata == 0 then
                    set .target = target
                    set .hitTarget = true
                    set tdata.beingHooked = true
                    if .pd.thunderhook then
                        call SpawnNova(.caster,GetUnitX(target),GetUnitY(target))
                    endif
                else
                    if .pd.thunderhook then
                        call SpawnNova(.caster,GetUnitX(target),GetUnitY(target))
                    endif
                    set .hitTarget = true
                    set tdata.beingHooked = false
                    call PlaySoundBJ( gg_snd_headshot )
                    call UnitDamageTargetBJ( .caster, target, 100000, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL)
                    call TimedEffectPt(GetUnitX(target),GetUnitY(target),5,"Units\\Undead\\Abomination\\AbominationExplosion.mdl")
                    set .target = null
                    call ShowUnitHide(target)
                endif

//Hit Enemy
                if (IsUnitEnemy(target,.p) and GetUnitTypeId(target)!='nglm') then
                    set .oldtx = GetUnitX(target)
                    set .oldty = GetUnitY(target)
                    set damage = .pd.DAMAGE
                    call SetUnitTimeScalePercent( .hookHead, 0)

//Spiritbreaker
                    if .pd.CURRENTBARATH > 0 then
                        set damage = damage+(.pd.SPEED*FRAMES-700)*.pd.CURRENTBARATH
                        call TimedEffectPt(GetUnitX(target),GetUnitY(target), 3, "Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl")
                    endif
                    call TimedEffectUnit(target,"chest",3, "Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl")

//Naix
                    if .pd.CURRENTNAIX > 0 and IsUnitAliveBJ(.caster) then
                        call TimedEffectUnit(.caster,"chest",3,"Abilities\\Spells\\Human\\Heal\\HealTarget.mdl")
                        call SetUnitState(.caster, UNIT_STATE_LIFE, GetUnitState(.caster, UNIT_STATE_LIFE)+(.pd.CURRENTNAIX*damage))
                    endif
                    call UnitDamageTargetBJ( .caster, target, damage, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL )
                endif
                //call DestroyTrigger(trig)
            endif
        endif

        //set target = null
        //set trig = null
    endmethod

    static method ValidHookTarget takes nothing returns boolean
        local unit target = GetTriggerUnit()
        local trigger trig = GetTriggeringTrigger()
        local MeatHook this= GHInt(trig,"hook")
        local integer id = GetUnitTypeId(target)
        local boolean b = (IsUnitAliveBJ(target) and id!= 'oeye' and id != 'h001' and id !='h002' and target!=.caster)
        set target = null
        set trig = null
        return b
    endmethod

    static method HookReverse takes nothing returns nothing
        local timer t = GetExpiredTimer()
        local MeatHook this = GHInt(t,"this")
        local PudgeData tdata = GHInt(.target,"data")
        local Node node
        local unit hookGraphic
        local real hooky
        local real hookx
        local real cx = GetUnitX(.caster)
        local real cy = GetUnitY(.caster)
        local unit lastlink
        local real angle
        local real tx
        local real ty
        local real distancedamage
        local unit fire

        local boolean b = false
        local real tempsin
        local real tempcos
        local real tempsin2
        local real tempcos2
        local unit u
        local group g
        local real x
        local real x1
        local real x2
        local real x3
        local real x4
        local real y
        local real y1
        local real y2
        local real y3
        local real y4

//Cleanup
        if .list.size == 0 then
            set .pd.grappling = false
            set tdata.beingHooked = false
            if not(IsUnitDeadBJ(.caster)) then
                call ResetUnitAnimation(.caster)
            endif
            call PauseTimer(t)
            call FHLocals(t)
            if .HeadDetect!=null then
                call FHLocals(.HeadDetect)
                call DestroyTrigger(.HeadDetect)
            endif
            if not(.isagrapple) then
                set .pd.hookout = CreateUnit(.p,'h00C',0,0,0)
            endif
            if not(GetUnitItem(.caster,'I00W')==null) and IsUnitEnemy(.target,.p)then
                call AddRupture(.target,.caster,MAXSTRYGDURATION)
            endif
            //call UnitRemoveAbility(.caster,'Bslo')
            call DestroyTimer(t)
            call LinkedList.destroy(.list)
            call MeatHook.destroy(this)
        else

//Non Grappling target movement
            if not(.grapple) then
                if .target!=null and .hookHead != null then
                    call SetUnitX(.target,GetUnitX(.hookHead))
                    call SetUnitY(.target,GetUnitY(.hookHead))

//Stryg Stuff
                    if .pd.CURRENTSTRYG > 0 and IsUnitEnemy(.target,.p) and GetWidgetLife(.target)>.415 and GetUnitTypeId(.target)!='nglm' then
                        set tx = GetUnitX(.target)
                        set ty = GetUnitY(.target)
                        set distancedamage = SquareRoot((tx-.oldtx)*(tx-.oldtx)+(ty-.oldty)*(ty-.oldty))*.pd.CURRENTSTRYG
                        call UnitDamageTargetBJ( .caster, .target, distancedamage, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL )
                        call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Human\\HumanBlood\\BloodElfSpellThiefBlood.mdl",.target,"chest"))
                        set .oldtx = tx
                        set .oldty = ty
                    endif
                endif

//Flame stuff
                if .pd.flamehook then
                    set fire = CreateUnit(.p,'h007',GetUnitX(.hookHead),GetUnitY(.hookHead),0)
                    call SetUnitX(fire,GetUnitX(.hookHead))
                    call SetUnitY(fire,GetUnitY(.hookHead))
                    call KillUnitTimed(fire,10)
                endif

//Hook Retraction
                set node = .list.end
                loop
                    exitwhen node == 0
                    set hookGraphic = node.part
                    set hooky = GetUnitY(hookGraphic)
                    set hookx = GetUnitX(hookGraphic)  
                    if hookGraphic == .list.end.part then
                        set angle = Atan2(cy-hooky,cx-hookx)

                    else
                        set angle = Atan2(GetUnitY(lastlink)-hooky,GetUnitX(lastlink)-hookx)
//Hit checking
                        if .pd.SPEED >= TRIGTOQUADCUTOFF/FRAMES then
                        if not(.hitTarget) and hookGraphic==.hookHead then
                        set x = GetUnitX(hookGraphic)
                        set y = GetUnitY(hookGraphic)
                        set tempcos = Cos(angle+halfpi)
                        set tempsin = Sin(angle+halfpi)
                        set tempcos2 = Cos(angle)
                        set tempsin2 = Sin(angle)
                        set x1 = x + .pd.RADIUS * tempcos
                        set x2 = x - .pd.RADIUS * tempcos
                        set x3 = x + .pd.SPEED*tempcos2 + .pd.RADIUS * tempcos
                        set x4 = x + .pd.SPEED*tempcos2 - .pd.RADIUS * tempcos

                        set y1 = y + .pd.RADIUS * tempsin
                        set y2 = y - .pd.RADIUS * tempsin
                        set y3 = y + .pd.SPEED*tempsin2 + .pd.RADIUS * tempsin
                        set y4 = y + .pd.SPEED*tempsin2 - .pd.RADIUS * tempsin
                        set g = CreateGroup()
                        call GroupAddGroup(OBJS,g)
                        loop
                            set u = FirstOfGroup(g)
                            exitwhen u==null or b
                            if IsPointInQuadFast(GetUnitX(u),GetUnitY(u),x1,y1,x2,y2,x4,y4,x3,y3) and u!=.caster then
                                call this.HitUnit(u)
                                set b = true
                            endif
                            call GroupRemoveUnit(g,u)
                        endloop
                        call DestroyGroup(g)
                        endif
                        endif
                    endif

                    if ((hookx-cx)*(hookx-cx)+(hooky-cy)*(hooky-cy)) <= 2500 and node==.list.end then
                        call .list.remove(node, node.prev)
                    endif  
    
                    call SetUnitX(hookGraphic, GetUnitX(hookGraphic)+(.pd.SPEED*Cos(angle))/.pd.hyperfac)
                    call SetUnitY(hookGraphic, GetUnitY(hookGraphic)+(.pd.SPEED*Sin(angle))/.pd.hyperfac)
                    call SetUnitFacing(hookGraphic,angle*(bj_RADTODEG)+180)

                    set lastlink = hookGraphic
                    set node = node.prev
                endloop

//Grapple movement
            else
                set hookx = GetUnitX(.list.end.part)
                set hooky = GetUnitY(.list.end.part)
                set angle = Atan2(hooky-cy,hookx-cx)
                call SetUnitX(.caster,cx+(.pd.SPEED*Cos(angle))/.pd.hyperfac)
                call SetUnitY(.caster,cy+(.pd.SPEED*Sin(angle))/.pd.hyperfac)
                set node = .list.end
                loop
                    exitwhen node == 0
                    set hookGraphic = node.part  
                    set hooky = GetUnitY(hookGraphic)
                    set hookx = GetUnitX(hookGraphic)
                    if ((hookx-cx)*(hookx-cx)+(hooky-cy)*(hooky-cy)) <= 10000 then
                        call .list.remove(node, node.prev)
                    endif
                    set node = node.prev
                endloop   
            endif
        endif
        set g = null
        set fire = null
        set t = null
        set hookGraphic = null
        set lastlink = null
    endmethod

    static method HookForward takes nothing returns nothing
        local timer t = GetExpiredTimer()
        local MeatHook this = GHInt(t,"this")
        local Node frontnode = .list.front
        local unit lastlink
        local Node node
        local unit hookGraphic
        local real cx = GetUnitX(.caster)
        local real cy = GetUnitY(.caster)
        local real x
        local real y
        local real lang
        local real scale
        local real x1
        local real x2
        local real x3
        local real x4
        local real y1
        local real y2
        local real y3
        local real y4
        local real tempcos
        local real tempsin
        local real tempsin2
        local real tempcos2
        local boolean b = false
        local group g
        local unit u
        set .distinterval = .distinterval + (.pd.SPEED/.pd.hyperfac)
//Head Creation
        if .list.size == 0 then
            set scale = ((.pd.RADIUS+10)/RADIUSBASE)*100
            set frontnode = .list.add()
            if not(.isagrapple) then
                set hookGraphic = CreateUnit(.p,'h002',cx+((.pd.SPEED+3)*.CosAngle),cy+((.pd.SPEED+3)*.SinAngle),.angle*bj_RADTODEG)
            else
                set hookGraphic = CreateUnit(.p,'h00D',cx+((.pd.SPEED+3)*.CosAngle),cy+((.pd.SPEED+3)*.SinAngle),.angle*bj_RADTODEG)
            endif
            set .hookHead = hookGraphic
            set frontnode.part = hookGraphic
            call SetUnitScalePercent( hookGraphic, scale, scale, scale )
            call SetUnitUserData(hookGraphic,this)
            call GroupAddUnit(HOOKHEADS,hookGraphic)
            call SetUnitUserData(hookGraphic,this)
//Hit detection trigger
            if .pd.SPEED < TRIGTOQUADCUTOFF/FRAMES then
                set .HeadDetect = CreateTrigger()
                call SHInt(.HeadDetect,"hook",this)
                call TriggerRegisterUnitInRangeSimple( .HeadDetect, .pd.RADIUS, .hookHead )
                call TriggerAddCondition( .HeadDetect, Condition( function MeatHook.ValidHookTarget) )
                call TriggerAddAction( .HeadDetect, function MeatHook.HitUnitT)
            endif
            
        else
//Normal creation
            if .distinterval >= HOOKSPACING then
                set .distinterval = 0
                set node = .list.add()
                if .pd.flamehook then
                    set hookGraphic = CreateUnit(.p,'h007',cx,cy,Atan2(GetUnitY(node.prev.part)-cy,GetUnitX(node.prev.part)-cx)*bj_RADTODEG)
                else
                    set hookGraphic = CreateUnit(.p,'h001',cx,cy,Atan2(GetUnitY(node.prev.part)-cy,GetUnitX(node.prev.part)-cx)*bj_RADTODEG)
                endif
                set node.part = hookGraphic
            endif
        endif
        
//Chain Movement
        set node = frontnode
        loop
            exitwhen node == 0
            set hookGraphic = node.part
            if hookGraphic == .hookHead then
                set lang = .angle

//Hit Checking
                if .pd.SPEED >= TRIGTOQUADCUTOFF/FRAMES then
                set x = GetUnitX(hookGraphic)
                set y = GetUnitY(hookGraphic)
                set tempcos = Cos(lang+halfpi)
                set tempsin = Sin(lang+halfpi)
                set tempcos2 = Cos(lang)
                set tempsin2 = Sin(lang)
                set x1 = x + .pd.RADIUS * tempcos
                set x2 = x - .pd.RADIUS * tempcos
                set x3 = x + .pd.SPEED*tempcos2 + .pd.RADIUS * tempcos
                set x4 = x + .pd.SPEED*tempcos2 - .pd.RADIUS * tempcos

                set y1 = y + .pd.RADIUS * tempsin
                set y2 = y - .pd.RADIUS * tempsin
                set y3 = y + .pd.SPEED*tempsin2 + .pd.RADIUS * tempsin
                set y4 = y + .pd.SPEED*tempsin2 - .pd.RADIUS * tempsin
                set g = CreateGroup()
                call GroupAddGroup(OBJS,g)
                loop
                    set u = FirstOfGroup(g)
                    exitwhen u==null or b
                    if IsPointInQuadFast(GetUnitX(u),GetUnitY(u),x1,y1,x2,y2,x4,y4,x3,y3) and u!=.caster then
                        call this.HitUnit(u)
                        set b = true
                    endif
                    call GroupRemoveUnit(g,u)
                endloop
                call DestroyGroup(g)
                endif
            else
                set lang = Atan2(GetUnitY(lastlink)-GetUnitY(hookGraphic),GetUnitX(lastlink)-GetUnitX(hookGraphic))
            endif
            set x = GetUnitX(hookGraphic)+(.pd.SPEED*Cos(lang)/.pd.hyperfac)
            set y = GetUnitY(hookGraphic)+(.pd.SPEED*Sin(lang)/.pd.hyperfac)

//Reflection off walls
            if hookGraphic == .hookHead then
                if x<GetRectMinX(gg_rct_game) or x>GetRectMaxX(gg_rct_game) then
                    if  .angle < 0 then
                        set .angle = (-halfpi) + ((-halfpi)-.angle)
                    else
                        set .angle = (halfpi) - (.angle-(halfpi))
                    endif                 
                elseif y<GetRectMinY(gg_rct_game) or y>GetRectMaxY(gg_rct_game) then
                    if  .angle < halfpi then
                        set .angle = 0-.angle
                    else
                        set .angle = -.angle
                    endif
                endif
            endif

            call SetUnitX(hookGraphic, x)
            call SetUnitY(hookGraphic, y)
            call SetUnitFacing(hookGraphic,lang*bj_RADTODEG)


            set lastlink = hookGraphic
            set node = node.next
        endloop
        set .distance = .distance + (.pd.SPEED/.pd.hyperfac)
    
        if .distance >= .pd.RANGE or .hitTarget then
            call PauseTimer(t)
            call TimerStart(t,TIMEREXEC,true,function MeatHook.HookReverse)
        endif
        set g = null
        set t = null
        set lastlink = null
        set hookGraphic = null
    endmethod

    method SpawnHook takes unit caster, real angle returns nothing
        set .list = LinkedList.create()
        set .t = CreateTimer()
        set .caster = caster
        set .angle = angle
        set .CosAngle = Cos(angle)
        set .SinAngle = Sin(angle)
        set .pd = GHInt(caster,"data")
        set .p = GetOwningPlayer(caster)
        call SHInt(.t,"this",this)
        call TimerStart(.t, TIMEREXEC, true, function MeatHook.HookForward)
    endmethod

endstruct

struct LinkedList
    Node front =0
    Node end =0
    Node rem = 0
    integer size = 0

    method add takes nothing returns Node
        local Node current = Node.create()
        if .size == 0 then
            set .front = current
        elseif .size == 1 then
            set current.prev = .front
            set .front.next = current
        elseif .size > 1 then
            set current.prev = .end
            set .end.next = current
        endif
        set .rem = current
        set .end=current
        set .size = this.size+1
        return current
    endmethod

    method remove takes Node r, Node par returns nothing
        if r.next!=0 and r.prev!=0 then
            set r.prev.next = r.next
            set r.next.prev = r.prev
        endif
        if .front == r then
            set .front = r.next
        endif
        if .end == r then
            set .end = r.prev
        endif
        call RemoveUnit(r.part)
        set .size = .size -1
        set r.rem = par
    endmethod

    method onDestroy takes nothing returns nothing
        local Node node = .rem
        local Node storage
        loop
            exitwhen node==0
            set storage = node.rem
            call Node.destroy(node)
            set node = storage
        endloop
    endmethod
endstruct

struct Node
    unit part=null
    Node next=0
    Node prev=0
    Node rem = 0
    method onDestroy takes nothing returns nothing
        if .rem !=0 then
            set .rem = 0
        endif
        if .next!=0 then
            set .next=0
        endif
        if .prev!=0 then
            set .prev=0
        endif
        if .part!=null then
            call RemoveUnit(.part)
        endif
    endmethod
endstruct

The spell event

Collapse JASS:
function MHConditions takes nothing returns boolean
    return ( GetSpellAbilityId() == 'A000' )
endfunction

function MHActions takes nothing returns nothing
    local unit caster = GetTriggerUnit()
    local location targetLoc = GetSpellTargetLoc()
    local real tx = GetLocationX(targetLoc)
    local real ty = GetLocationY(targetLoc)
    local real cx = GetUnitX(caster)
    local real cy = GetUnitY(caster)
    local real angle = Atan2((ty-cy),(tx-cx))
    local MeatHook hook = MeatHook.create()
    local PudgeData pd = GHInt(caster,"data")
    call RemoveUnit(pd.hookout)
    call SetUnitAnimationByIndex( caster, 2 )
    call hook.SpawnHook(caster,angle)
    set caster = null
    call RemoveLocation(targetLoc)
    set targetLoc = null
endfunction

//===========================================================================

function InitTrig_Meat_Hook takes nothing returns nothing
    set gg_trg_Meat_Hook = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Meat_Hook, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Meat_Hook, Condition( function MHConditions ) )
    call TriggerAddAction( gg_trg_Meat_Hook, function MHActions )
endfunction


Sorry it's so long

Last edited by Tossrock : 07-10-2007 at 02:57 AM.
Tossrock is offline   Reply With Quote
Old 07-10-2007, 04:18 PM   #153
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

Hi tossrock

In some place you got: constant real FRAMES = 40
As a temp fix until I update the optimizer, change it to constant real FRAMES = 40.0
There is some nasty issue with constant inlining I never thought of, real vs integer division.
edit: in your map I found plenty of real constant variables that don't have the . it might be a good idea to make all those constants have real values

---
Now I got fixed tossrock's and grupoapunte's bugs, would like to know if I can fix UnMi's problem before releasing 4.3
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 08-24-2007, 01:28 AM   #154
lordrd
User
 
Join Date: Jun 2007
Posts: 6

lordrd has little to show at this moment (0)

Question Map Protection

Why wc3mapoptimizer4.4 give me this error?
Attached Images
File Type: jpg PRINT_6.jpg (89.7 KB, 93 views)
lordrd is offline   Reply With Quote
Old 08-24-2007, 03:07 AM   #155
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

you are supposed to give it a path for war3patch.mpq
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 09-01-2007, 05:32 AM   #156
vile
n00b map maker
 
Join Date: Jul 2005
Posts: 599

Submissions (5)

vile will become famous soon enough (60)vile will become famous soon enough (60)vile will become famous soon enough (60)

Send a message via ICQ to vile Send a message via AIM to vile Send a message via MSN to vile
Default

there is a bug when trying to save tweak sets. you cant.
__________________
Check out my maps:
Age of Myths
Deadly Games
Magic & Steel New Project is kicking in!

TEASER TRAILER
vile is offline   Reply With Quote
Old 10-18-2007, 10:39 AM   #158
markone
User
 
markone's Avatar
 
Join Date: Jul 2007
Posts: 35

markone has little to show at this moment (3)

Send a message via MSN to markone
Default

gr8 tool man,

i was reading readme :) and its says that wc3optim works just if map have less then 30000 lines, my map dday:Judgement have 29000, so if u could increase line number in some of next updates,

thx
__________________
markone is offline   Reply With Quote
Old 10-18-2007, 02:43 PM   #159
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

The readme is outdated, I think the new limit is about 90000, in a next version I should make it not have any limit, cause it is just lame to have a limit, jasshelper is such an improvement in code over the optimizer... You can learn a lot in two years.
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 10-18-2007, 05:00 PM   #160
markone
User
 
markone's Avatar
 
Join Date: Jul 2007
Posts: 35

markone has little to show at this moment (3)

Send a message via MSN to markone
Default

ok then i dont have to worry abt it :)

so readme is 2 years old ??
__________________
markone is offline   Reply With Quote
Old 10-19-2007, 03:04 PM   #161
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

Very few parts are outdated, the rest aren't.
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 12-02-2007, 01:23 PM   #162
DA_skunk
User
 
Join Date: Dec 2007
Posts: 10

DA_skunk has little to show at this moment (0)

Send a message via Yahoo to DA_skunk
Default

Its great but (just a sugestion) you could add a thing where it adds "Protected version" Or "Not protected version" to the map discription if they chose to protect it?

It mostly works fine, there was one bug in it that when a hero had Rejuvenation as a hero ability, it worked fine before it was protected, then after protecting it if you tryied to learn any ability with that hero it would crash the game. (I removed Rejuvenation and then it didnt crash, so I wasnt a differnt ability)

But I havent worked on that map in a long time, and I don't know were the old version that was bugged like that even IS anymore. And, so far the maps fine without Rejuvenation, so I dont mind that much anyways.
__________________
Don't kill me, I didn't do anything, I'm just plain stupid!
DA_skunk is offline   Reply With Quote
Old 12-10-2007, 05:35 PM   #163
emjlr3
Rehabbing
 
emjlr3's Avatar
 
Join Date: Jun 2005
Posts: 1,386

Submissions (14)

emjlr3 is a jewel in the rough (151)emjlr3 is a jewel in the rough (151)

Mapping Contest First Place

Send a message via AIM to emjlr3 Send a message via MSN to emjlr3
Default

just to make sure I am on the right page

with newer versions, as opposed to checking what extra obfuscation options you want, you are selecting the ones you do not want, correct?
__________________
emjlr3 is offline   Reply With Quote
Old 12-23-2007, 08:09 PM   #164
StealthOfKing
User
 
Join Date: May 2007
Posts: 19

StealthOfKing has little to show at this moment (0)

Default

Collapse JASS:
globals
    constant real TEST_VAR_1 = 12.5
    constant real TEST_VAR_2 = TEST_VAR_1
endglobals

Any references to TEST_VAR_2 fails after optimisation (using constant inlining).

Last edited by StealthOfKing : 12-23-2007 at 08:09 PM.
StealthOfKing is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 02:20 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services