Lace
Reaction score
0

Profile posts Postings Media Albums About

  • Hey Lace, you use PDN, got any cool plugins you recommend? Some of my favourites are the seamless texture maker and the animation helper, good for spritework and such. Also the smudge is a good one to have since it's not built-in, and other than that I've got a jumble of random distortions.
    I dunno, because I didn't make anything up this time?
    I guess I just emphasized it to make it seem important.
    Figured it out bro. the *real* NPC Create pushes.

    NPC Create:
    push init slot (0x200 entity slots, starts checking from # pushed.)
    push Parent ; This is to push [ebp+8] in ASM to relate entities to one another, goes into +A8
    push Direction
    push yvel
    push xvel
    push y
    push x
    push num
    call 46efd0
    add esp,20
    Well I needed to make an ASCII string to push on the image loader, but I wasn't sure how. I wanted to see if I could push the characters onto the stack and access them there so I didn't have to utilize the ram but I couldn't make it work.
    I had a question about doing TSC things and you weren't there to answer it :[
    But anyway run that and tell me if it works.
    Please show up to answer my question about strings in ASM :s
    EDIT: I sorta figured it out using regular ram [4bba00-4bba09] but I'd like to be able to utilize the string on the stack, without wasting those. Is it possible?
    EDITEDIT: Meh. Test it? http://www.mediafire.com/?ojzmq1yhxfd
    Hmmm...
    There's an event that runs on load, right?
    I'll just add some FLJ's in there.
    And glee. :D
    I is glad.
    Will allow consistency across sprites. :3
    I is eagerly awaiting. <3
    The truth is...
    I am Iron Man.

    Yeah, excuse accepted this time.

    Hmmm...
    Basically I just need all the TSC commands done.
    And the infinite Mimiga Mask (BTW - Will it use multiple sprite sheets, or just a vertically expanded single one?)...
    Aaaaaand...
    Weapons can be done at your leisure.

    BTW, I'd kinda like an engine for testing purposes with all the appropriate TSC gobblety-gook and the mimi-mask thingy.

    Also, how will the mimi mask save?
    Is it possible to add it to the equip section?
    Or will it use flags?
    The tangent of 90-180/s is half the height over half the side length (I call side length b).

    tan(90-180/s) = (h/2) / (b/2) = h/b
    b = h/tan(90-180/s)
    p = s*b = s*h/tan(90-180/s)

    You're supposed to divide by the tangent, not multiply. And dividing by the tangent is the same as multiplying by the cotangent, hence:
    Me said:
    2) p = s * h * cot(90-180/s)

    If you think about it, as s becomes very large, the angle 90-180/s approaches 90, meaning that tan(90-180/s) becomes very large. Assuming you keep the height constant, and you keep increasing the number of sides, the perimeter should just converge to that of a circle, but when you multiply two numbers that keep getting larger and larger (namely s and tan(90-180/s)) you get something that just keeps getting larger, with no limit. If you divide them, however, then they converge to a limit (namely pi).

    Also, even if you change it to dividing by tangent, it still doesn't work for odd numbers of sides, because the height of the small triangles doesn't equal .5h, it's actually slightly less than .5h because the center-vertex distance is greater than the center-midpoint distance.
    So, I would start by breaking the polygon into s congruent isosceles triangles, each with base b, height r, side length l, and angle a (at base).

    a = 90-180/s
    (b/2)^2 + r^2 = l^2
    sin(a) = r/l
    p = b*s
    1) If s is odd: h = r + l
    2) If s is even, and you measure height between sides: h = r + r
    3) If s is even, and you measure height between corners: h = l + l

    r = l*sin(a)
    l = r*csc(a)

    1)
    h = r * (1+csc(a)) = l * (1+sin(a))
    (b/2)^2 = (h/(1+sin(a)))^2 - (h/(1+csc(a)))^2
    (b/2)^2 = h^2 * (csc(a)-sin(a)) / (2+sin(a)+csc(a))
    (b/2)^2 = h^2 * (cos^2(a)) / (sin^2(a) + 2sin(a) + 1)
    b/2 = h * cos(a) / (sin(a)+1)
    p = 2 * s * h * cos(90-180/s) / (sin(90-180/s)+1)

    So your formula doesn't quite work for odd numbers of sides.

    2)
    r = h/2
    l = h*csc(a)/2
    (b/2)^2 = (h*csc(a)/2)^2 - (h/2)^2
    (b/2)^2 = (h/2)^2 * (csc^2(a) - 1)
    b/2 = h/2 * cot(a)
    p = s * h * cot(90-180/s)

    Your formula comes very close to working here, except it's cotangent, not tangent.

    3)
    l = h/2
    r = h*sin(a)/2
    (b/2)^2 = (h/2)^2 - (h*sin(a)/2)^2
    (b/2)^2 = (h/2)^2 * (1 - sin^2(a))
    b/2 = h/2 * cos(a)
    p = s * h * cos(90-180/s)

    Once again, very close to yours, but not quite the same...

    Let's see check and see if mine works for squares/triangles:

    1)
    s = 3
    If I'm right, I should get p = h*6/sqrt(3)
    p = 2 * s * h * cos(90-180/s) / (sin(90-180/s)+1)
    90-180/s = 30
    cos30 = sqrt(3)/2
    sin30 = 1/2
    p = 2 * 3 * h * sqrt(3)/2 / (1/2 + 1) = 6 * h * sqrt(3)/2 * 2/3
    sqrt(3)/2 * 2/3 = 1/sqrt(3)
    p = 6 * h / sqrt(3)
    So it works.

    2)
    s = 4
    Should get p = h*4
    p = s * h * cot(90-180/s)
    90-180/s = 45
    cot45 = 1
    p = 4 * h * 1 = 4 * h
    Also works.

    3)
    s = 4
    Should get p = h*4/sqrt(2) = h*2*sqrt(2)
    p = s * h * cos(90-180/s)
    90-180/s = 45
    cos45 = 1/sqrt(2)
    p = 4 * h * 1/sqrt(2) = 4 * h / sqrt(2)
    Also works.

    Looks like I win :p

    As for your other question, you can't just average the small and large diameters to get the average diameter; that would only work if the relationship between angle and diameter were linear (which it's not). But both the small and large diameters should converge on h, so that doesn't explain why you're getting strange answers. Try it with my formulas and see if it works (it shouldn't matter which one you use; all three should converge to the same value for very large values of s).
    I changed the 4bb...whatever to 49e184 (I think that'd be flags 7996-8000?) and it works like a charm.
    Well, for your formula, it depends on whether the number of sides is even or odd. If it's even, do you define height as the distance between opposite sides, or between opposite corners?

    I'll figure it out later today, once I have more time...
  • Loading…
  • Loading…
  • Loading…
  • Loading…
Top