Thread: ARGB
View Single Post
Old 08-05-2008, 10:41 PM   #6
Toadcop
BuranX
 
Toadcop's Avatar
 
Join Date: Jul 2006
Posts: 1,886

Submissions (4)

Toadcop is just really nice (299)Toadcop is just really nice (299)

Approved Map: TcXSpell Making Session 10 Winner

Send a message via ICQ to Toadcop
Default

now 1 million question. in which way it's better than for example

struct argb
integer a
integer r
integer g
integer b
endstruct

??? ok you can do this with out any sturct simple parrarel arrays. (avoid the allocation stuff)

yes the only good stuff is
Collapse JASS:
    static method mix takes ARGB c1, ARGB c2, real s returns ARGB
      //widest function ever
      return ARGB( R2I(c2.blue*s+c1.blue*(1-s)+0.5) + R2I(c2.green*s+c1.green*(1-s)+0.5)*0x100 + R2I(c2.red*s+c1.red*(1-s)+0.5)*0x10000 + R2I(c2.alpha*s+c1.alpha*(1-s)+0.5)*0x1000000)
    endmethod
but it's pure math.
+ no the widest func is (as far i didn't wrote a another one xD)

Collapse JASS:
function TcX_getweapon_dps_BX takes xunit xu returns real
    local xupar xpar=xu.params
    local real dps=0
  if tcx_mod==1 and xu.weap_current>0 then
   if xu.weap_current<9 then
    if xu.weap_current<5 then
     if xu.weap_current<3 then  
      if xu.weap_current<2 then
        set dps=((AmplifyValue2BX(((xweap_saw_dmg_1+(xpar.min[STAT_DMG_PHYS]+(xpar.min[STAT_DMG_PHYS_LVL]*xu.lvl)+xu.mindmg)*FLOAT_POINT_PREC)+(xweap_saw_dmg_1+(xpar.max[STAT_DMG_PHYS]+(xpar.max[STAT_DMG_PHYS_LVL]*xu.lvl)+xu.maxdmg)*FLOAT_POINT_PREC))*0.5,xu.dmgperc+(xpar.par[STAT_DMG_PHYS_PERC]+(xpar.par[STAT_DMG_PHYS_PERC_LVL]*xu.lvl))*FLOAT_POINT_PREC))*xu.dmgmultx*xu.dmgmult*xu.dmgmultphys)/(weaponcooldown[X_saw]/xu.attackspeedmul)
      else
        set dps=((AmplifyValue2BX(((xweap_machinegun_dmg_1+(xpar.min[STAT_DMG_PHYS]+(xpar.min[STAT_DMG_PHYS_LVL]*xu.lvl)+xu.mindmg)*FLOAT_POINT_PREC)+(xweap_machinegun_dmg_1+(xpar.max[STAT_DMG_PHYS]+(xpar.max[STAT_DMG_PHYS_LVL]*xu.lvl)+xu.maxdmg)*FLOAT_POINT_PREC))*0.5,xu.dmgperc+(xpar.par[STAT_DMG_PHYS_PERC]+(xpar.par[STAT_DMG_PHYS_PERC_LVL]*xu.lvl))*FLOAT_POINT_PREC))*xu.dmgmultx*xu.dmgmult*xu.dmgmultphys)/(weaponcooldown[X_machinegun]/xu.attackspeedmul)
      endif
     else
      if xu.weap_current<4 then
        set dps=((AmplifyValue2BX(((xweap_shotgun_dmg_1+(xpar.min[STAT_DMG_PHYS]+(xpar.min[STAT_DMG_PHYS_LVL]*xu.lvl)+xu.mindmg)*FLOAT_POINT_PREC)+(xweap_shotgun_dmg_1+(xpar.max[STAT_DMG_PHYS]+(xpar.max[STAT_DMG_PHYS_LVL]*xu.lvl)+xu.maxdmg)*FLOAT_POINT_PREC))*0.5,xu.dmgperc+(xpar.par[STAT_DMG_PHYS_PERC]+(xpar.par[STAT_DMG_PHYS_PERC_LVL]*xu.lvl))*FLOAT_POINT_PREC))*xu.dmgmultx*xu.dmgmult*xu.dmgmultphys)/(weaponcooldown[X_shotgun]/xu.attackspeedmul)*xweap_shotgun_maxpellets
      else
        set dps=((AmplifyValue2BX(((xweap_shaft_dmg_1+(xpar.min[STAT_DMG_ELEC]+(xpar.min[STAT_DMG_ELEC_LVL]*xu.lvl)+xu.mindmg)*FLOAT_POINT_PREC)+(xweap_shaft_dmg_1+(xpar.max[STAT_DMG_ELEC]+(xpar.max[STAT_DMG_ELEC_LVL]*xu.lvl)+xu.maxdmg)*FLOAT_POINT_PREC))*0.5,xu.dmgperc+(xpar.par[STAT_DMG_ELEC_PERC]+(xpar.par[STAT_DMG_ELEC_PERC_LVL]*xu.lvl))*FLOAT_POINT_PREC))*xu.dmgmultx*xu.dmgmult*xu.dmgmultelec)/(weaponcooldown[X_shaft]/xu.attackspeedmul)
      endif
     endif
    else
     if xu.weap_current<7 then  
      if xu.weap_current<6 then
        set dps=((AmplifyValue2BX(((xweap_granade_dmg_1+(xpar.min[STAT_DMG_TERM]+(xpar.min[STAT_DMG_TERM_LVL]*xu.lvl)+xu.mindmg)*FLOAT_POINT_PREC)+(xweap_granade_dmg_1+(xpar.max[STAT_DMG_TERM]+(xpar.max[STAT_DMG_TERM_LVL]*xu.lvl)+xu.maxdmg)*FLOAT_POINT_PREC))*0.5,xu.dmgperc+(xpar.par[STAT_DMG_TERM_PERC]+(xpar.par[STAT_DMG_TERM_PERC_LVL]*xu.lvl))*FLOAT_POINT_PREC))*xu.dmgmultx*xu.dmgmult*xu.dmgmultterm)/(weaponcooldown[X_granade]/xu.attackspeedmul)
      else
        set dps=((AmplifyValue2BX(((xweap_plasma_dmg_1+(xpar.min[STAT_DMG_PLAS]+(xpar.min[STAT_DMG_PLAS_LVL]*xu.lvl)+xu.mindmg)*FLOAT_POINT_PREC)+(xweap_plasma_dmg_1+(xpar.max[STAT_DMG_PLAS]+(xpar.max[STAT_DMG_PLAS_LVL]*xu.lvl)+xu.maxdmg)*FLOAT_POINT_PREC))*0.5,xu.dmgperc+(xpar.par[STAT_DMG_PLAS_PERC]+(xpar.par[STAT_DMG_PLAS_PERC_LVL]*xu.lvl))*FLOAT_POINT_PREC))*xu.dmgmultx*xu.dmgmult*xu.dmgmultplas)/(weaponcooldown[X_plasma]/xu.attackspeedmul)
      endif
     else
      if xu.weap_current<8 then
        set dps=((AmplifyValue2BX(((xweap_rocket_dmg_1+(xpar.min[STAT_DMG_TERM]+(xpar.min[STAT_DMG_TERM_LVL]*xu.lvl)+xu.mindmg)*FLOAT_POINT_PREC)+(xweap_rocket_dmg_1+(xpar.max[STAT_DMG_TERM]+(xpar.max[STAT_DMG_TERM_LVL]*xu.lvl)+xu.maxdmg)*FLOAT_POINT_PREC))*0.5,xu.dmgperc+(xpar.par[STAT_DMG_TERM_PERC]+(xpar.par[STAT_DMG_TERM_PERC_LVL]*xu.lvl))*FLOAT_POINT_PREC))*xu.dmgmultx*xu.dmgmult*xu.dmgmultterm)/(weaponcooldown[X_rocket]/xu.attackspeedmul)
      else
        set dps=((AmplifyValue2BX(((xweap_railgun_dmg_1+(xpar.min[STAT_DMG_SPEC]+(xpar.min[STAT_DMG_SPEC_LVL]*xu.lvl)+xu.mindmg)*FLOAT_POINT_PREC)+(xweap_railgun_dmg_1+(xpar.max[STAT_DMG_SPEC]+(xpar.max[STAT_DMG_SPEC_LVL]*xu.lvl)+xu.maxdmg)*FLOAT_POINT_PREC))*0.5,xu.dmgperc+(xpar.par[STAT_DMG_SPEC_PERC]+(xpar.par[STAT_DMG_SPEC_PERC_LVL]*xu.lvl))*FLOAT_POINT_PREC))*xu.dmgmultx*xu.dmgmult*xu.dmgmultspec)/(weaponcooldown[X_railgun]/xu.attackspeedmul)
      endif
     endif
    endif
   else

    if xu.weap_current<13 then
     if xu.weap_current<11 then  
      if xu.weap_current<10 then
        set dps=((AmplifyValue2BX(((xweap_deathdisc_dmg_1+(xpar.min[STAT_DMG_PHYS]+(xpar.min[STAT_DMG_PHYS_LVL]*xu.lvl)+xu.mindmg)*FLOAT_POINT_PREC)+(xweap_deathdisc_dmg_1+(xpar.max[STAT_DMG_PHYS]+(xpar.max[STAT_DMG_PHYS_LVL]*xu.lvl)+xu.maxdmg)*FLOAT_POINT_PREC))*0.5,xu.dmgperc+(xpar.par[STAT_DMG_PHYS_PERC]+(xpar.par[STAT_DMG_PHYS_PERC_LVL]*xu.lvl))*FLOAT_POINT_PREC))*xu.dmgmultx*xu.dmgmult*xu.dmgmultphys)/(weaponcooldown[X_bloodysaw]/xu.attackspeedmul)
      else
        set dps=((AmplifyValue2BX(((xweap_chaingun_dmg_1+(xpar.min[STAT_DMG_PHYS]+(xpar.min[STAT_DMG_PHYS_LVL]*xu.lvl)+xu.mindmg)*FLOAT_POINT_PREC)+(xweap_chaingun_dmg_1+(xpar.max[STAT_DMG_PHYS]+(xpar.max[STAT_DMG_PHYS_LVL]*xu.lvl)+xu.maxdmg)*FLOAT_POINT_PREC))*0.5,xu.dmgperc+(xpar.par[STAT_DMG_PHYS_PERC]+(xpar.par[STAT_DMG_PHYS_PERC_LVL]*xu.lvl))*FLOAT_POINT_PREC))*xu.dmgmultx*xu.dmgmult*xu.dmgmultphys)/(weaponcooldown[X_chaingun]/xu.attackspeedmul)
      endif
     else
      if xu.weap_current<12 then
        set dps=((AmplifyValue2BX(((xweap_flamegun_dmg_1+(xpar.min[STAT_DMG_TERM]+(xpar.min[STAT_DMG_TERM_LVL]*xu.lvl)+xu.mindmg)*FLOAT_POINT_PREC)+(xweap_flamegun_dmg_1+(xpar.max[STAT_DMG_TERM]+(xpar.max[STAT_DMG_TERM_LVL]*xu.lvl)+xu.maxdmg)*FLOAT_POINT_PREC))*0.5,xu.dmgperc+(xpar.par[STAT_DMG_TERM_PERC]+(xpar.par[STAT_DMG_TERM_PERC_LVL]*xu.lvl))*FLOAT_POINT_PREC))*xu.dmgmultx*xu.dmgmult*xu.dmgmultterm)/(weaponcooldown[X_flamegun]/xu.attackspeedmul)
      else
        set dps=((AmplifyValue2BX(((xweap_shaftex_dmg_1+(xpar.min[STAT_DMG_ELEC]+(xpar.min[STAT_DMG_ELEC_LVL]*xu.lvl)+xu.mindmg)*FLOAT_POINT_PREC)+(xweap_shaftex_dmg_1+(xpar.max[STAT_DMG_ELEC]+(xpar.max[STAT_DMG_ELEC_LVL]*xu.lvl)+xu.maxdmg)*FLOAT_POINT_PREC))*0.5,xu.dmgperc+(xpar.par[STAT_DMG_ELEC_PERC]+(xpar.par[STAT_DMG_ELEC_PERC_LVL]*xu.lvl))*FLOAT_POINT_PREC))*xu.dmgmultx*xu.dmgmult*xu.dmgmultelec)/(weaponcooldown[X_shaftex]/xu.attackspeedmul)
      endif
     endif
    else
     if xu.weap_current<15 then  
      if xu.weap_current<14 then
        set dps=((AmplifyValue2BX(((xweap_wispgun_dmg_1+(xpar.min[STAT_DMG_SPEC]+(xpar.min[STAT_DMG_SPEC_LVL]*xu.lvl)+xu.mindmg)*FLOAT_POINT_PREC)+(xweap_wispgun_dmg_1+(xpar.max[STAT_DMG_SPEC]+(xpar.max[STAT_DMG_SPEC_LVL]*xu.lvl)+xu.maxdmg)*FLOAT_POINT_PREC))*0.5,xu.dmgperc+(xpar.par[STAT_DMG_SPEC_PERC]+(xpar.par[STAT_DMG_SPEC_PERC_LVL]*xu.lvl))*FLOAT_POINT_PREC))*xu.dmgmultx*xu.dmgmult*xu.dmgmultspec)/(weaponcooldown[X_wispgun]/xu.attackspeedmul)
      else
        set dps=((AmplifyValue2BX(((xweap_plasmaex_dmg_1+(xpar.min[STAT_DMG_PLAS]+(xpar.min[STAT_DMG_PLAS_LVL]*xu.lvl)+xu.mindmg)*FLOAT_POINT_PREC)+(xweap_plasmaex_dmg_1+(xpar.max[STAT_DMG_PLAS]+(xpar.max[STAT_DMG_PLAS_LVL]*xu.lvl)+xu.maxdmg)*FLOAT_POINT_PREC))*0.5,xu.dmgperc+(xpar.par[STAT_DMG_PLAS_PERC]+(xpar.par[STAT_DMG_PLAS_PERC_LVL]*xu.lvl))*FLOAT_POINT_PREC))*xu.dmgmultx*xu.dmgmult*xu.dmgmultplas)/(weaponcooldown[X_plasmaex]/xu.attackspeedmul)
      endif
     else
      if xu.weap_current<16 then
        set dps=((AmplifyValue2BX(((xweap_bfg_dmg_1+(xpar.min[STAT_DMG_PLAS]+(xpar.min[STAT_DMG_PLAS_LVL]*xu.lvl)+xu.mindmg)*FLOAT_POINT_PREC)+(xweap_bfg_dmg_1+(xpar.max[STAT_DMG_PLAS]+(xpar.max[STAT_DMG_PLAS_LVL]*xu.lvl)+xu.maxdmg)*FLOAT_POINT_PREC))*0.5,xu.dmgperc+(xpar.par[STAT_DMG_PLAS_PERC]+(xpar.par[STAT_DMG_PLAS_PERC_LVL]*xu.lvl))*FLOAT_POINT_PREC))*xu.dmgmultx*xu.dmgmult*xu.dmgmultplas)/(weaponcooldown[X_bfg]/xu.attackspeedmul)
      else
        set dps=((AmplifyValue2BX(((xweap_railgunex_dmg_1+(xpar.min[STAT_DMG_SPEC]+(xpar.min[STAT_DMG_SPEC_LVL]*xu.lvl)+xu.mindmg)*FLOAT_POINT_PREC)+(xweap_railgunex_dmg_1+(xpar.max[STAT_DMG_SPEC]+(xpar.max[STAT_DMG_SPEC_LVL]*xu.lvl)+xu.maxdmg)*FLOAT_POINT_PREC))*0.5,xu.dmgperc+(xpar.par[STAT_DMG_SPEC_PERC]+(xpar.par[STAT_DMG_SPEC_PERC_LVL]*xu.lvl))*FLOAT_POINT_PREC))*xu.dmgmultx*xu.dmgmult*xu.dmgmultspec)/(weaponcooldown[X_railgunex]/xu.attackspeedmul)
      endif
     endif
    endif

      
   endif
  endif
   return dps
endfunction

well imo it's too simple. (this script)
__________________
Toadcop is offline   Reply With Quote