Banner
Views: 660,745,247
Time:
12 users online: Berk, o Erik, Hasuke, Landonb8x, MiracleWater, NotMeEitherYou, randombot999, Supercookie07, Tob, VilelaBot, watermelonjones, WhiteYoshiEgg - Guests: 75 - Bots: 666Users: 35,383 (1,263 active)
Latest: NotMeEitherYou
Not logged in.
Smw's sine/cosine table feedback
Forum Index - SMW Hacking - Resource & Tool Releases - SMW Data Repository - Smw's sine/cosine table feedback
Pages: « 1 »
(Closest forum I could find. If moved, please PM me, thanks.)

Hey, I'm working on making a document (and a tutorial) on how to use smw's sine/cosine table.

Here is the BETA.

How is it?

--------------------
Give thanks to RPG hacker for working on Asar.
Quote
GreenHammerBro (ID: 18802) for discovering smw's sine/cosine table.

Not to be harsh but you didn't discover the trigonometry table. Many people have worked with it before. I'll assume you misworded or something.
I'll check more later, haven't worked with stuff like this in SMW before so it might come handy.

edit: in your example code in the html file you missed a STZ $01 after ...PositiveHalf, but it's there in the ASM file.

--------------------
The most beautiful thoughts are always beside the darkest.
in order to understand the sin/cos table, you need to understand the basics of trigonometry (speaking in general, not to you)

given a radius (distance from the center of a circle) and an angle, the table allows you to obtain X and Y distance from the center (aka position on the circle)


radius * sin(angle) = Ydisp
radius * cos(angle) = Xdisp

note that cos(angle) = sin(angle+90deg)

to obtain the sine of an angle, multiply it by 2 and use it as an index into the table (the value you get is the sine * 256)

for cosine, add 128 to your angle, multiply by 2, and then use it as an index

multiply this result with your radius, and then take the high byte of the result as your Ydisp (or Xdisp)

and yeah, if the angle is above 255 (since it goes from 0-511), you need to inverse the result


i made this a while ago, it basically uses the same SMW table but i cut out the high bytes (since most were 0). ironically i manually calculated the values in the table before realizing that it's the same as SMW's


and yeah, dont claim you discovered the sin/cos table. plenty of other things make use of it

--------------------
僕の日本語を失礼します。
Oops, I'm going to make some changes to it to turn it into a tutorial. Also, I mentioned that SMW 's "unit circle" is a value of 256, this is because radix point "(decimal of") aren't allowed, as they are rounded to zero. It has to use a value out of 256 in order to get a fractional unit.

--------------------
Give thanks to RPG hacker for working on Asar.
The sin table at $07F7DB is really just a 8bit fixed point decimal values. That contain the first 180 degree (or pi in radians). In 256 word long entries.
Given the geometry of a sin, the other 180 degree are just the value times -1.
As such, you can simply multiply the table entry with any other value to get the x/y offset.

So really, all you need to know to work with them is basic geometry and understanding of fixed point decimal values.

--------------------
Anime statistic on MyAnimeList:
400 animes completed ✓
6000 episodes completed ✓
100 Days completed ✓
... what even am I doing with my life?
Pages: « 1 »
Forum Index - SMW Hacking - Resource & Tool Releases - SMW Data Repository - Smw's sine/cosine table feedback

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2018 - SMW Central
Legal Information - Privacy Policy - Link To Us


Total queries: 21

Menu

Follow Us On

  • Facebook
  • Twitter
  • YouTube

Affiliates

  • Talkhaus
  • SMBX Community
  • GTx0
  • Super Luigi Bros
  • ROMhacking.net
  • MFGG
  • Gaming Reinvented