Home Technical Talk

MaxScript help with Strips

Hey there everyone, I'm hoping to get some help here cause I really need some to help with learning 3DS MaxScript. I recently started working with it to do model importing scripts from games, and may eventually move on to create exporters under the same bases, but that's for another time. For the time being, I need help reading strips in Max. A guy named chroxx has a function for reading strips, but it won't work these the models I'm looking into. All I really need is a base function to work from, or some help with what to do in regards to building faces. The strips hold more data than just the vertex references, which is why I need some help. The format, NJCM, has several different types of strips, which I already know how to work with. I just need to make functions to read them. Here's what those look like:
0x40 STRIP Triangle Strip Data
This is the good stuff - Geometry!

Flags : Bits 0-1
0x00 = No User Flags Present
0x01 = 1 User Flag WORD present
0x02 = 2 User Flag WORDs present
0x03 = 3 User Flag WORDs Present

WORD : Size of Chunk in WORDS (Size * 2 = Bytes)

WORD : Bits 14-15 User Offset (I have no clue what this
does)
Bits 0-13 Number of Strips in Chunk

-STRIP DATA STARTS HERE-

SHORT : Number of points in Strip
Number of Triangles = Number of Points - 2
If Value is positive, then strip winds CCW.
If Value is Negative, them strip winds CW.
Use the Absolute Value of this for the number of

There are 9 types of Strips...
Data is stored as SHORT type

0x40 STRIP_CS I0, I1, I2, UserFlags ( x Flags)
I3, UserFlags ( x FLags)...

0x41 STRIP_CS_UVN I0, U0, V0,
I1, U1, V1,
I2, U2, V2, WORD UserFLags (x FLags)
I3, U3, V3, UserFlags (x Flags)...

0x42 STRIP_CS_UVH I0, U0, V0,
I1, U1, V1,
I2, U2, V2, WORD UserFLags (x FLags)
I3, U3, V3, UserFlags (x Flags)

0x43 STRIP_CS_VN I0, nx0, ny0, nz0,
I1, nx1, ny1, nz1,
I2, nx2, ny2, nz2, UserFlags (x Flags)
I3, nx3, ny3, nz3, UserFlags (x Flags)...

0x44 STRIP_CS_UVN_VN I0, U0, V0, nx0, ny0, nz0
I1, U1, V1, nx1, ny1, nz1
I2, U2, V2, nx2, ny2, nz2, UserFlags ( x Flags)
I3, U3, V3, nx3, ny3, nz3, UserFlags ( x Flags)

0x45 STRIP_CS_UVH_VN I0, U0, V0, nx0, ny0, nz0
I1, U1, V1, nx1, ny1, nz1
I2, U2, V2, nx2, ny2, nz2, UserFlags ( x Flags)
I3, U3, V3, nx3, ny3, nz3, UserFlags ( x Flags)

0x46 STRIP_CS_DS I0, AR0, GB0
I1, AR1, GB1
I2, AR2, GB2, UserFlags( x Flags)
I3, AR3, GB3, UserFlags( x Flags) ...
0x47 STRIP_CS_UVN_DS I0, U0, V0, AR0, GB0
I1, U1, V1, AR1, GB1
I2, U2, V2, AR2, GB2, UserFlags( x Flags)
I3, U3, V3, AR3, GB3, UserFlags( x Flags) ...

0x48 STRIP_CS_UVH_DS I0, U0, V0, AR0, GB0
I1, U1, V1, AR1, GB1
I2, U2, V2, AR2, GB2, UserFlags( x Flags)
I3, U3, V3, AR3, GB3, UserFlags( x Flags) ...

I(n) is a Vertex Index - this is the Index of the
Vertex in the vertex buffer.
U(n),V(n) are the UV coordinates.
There are 2 formats, UVN, and UVH.
UVN Coordinates are stored 0x00 - 0xFF. Divide by
255 to get the Floating point value.
UVH Coordinates are Stored 0x0000 - 0x03FF. Divide
by 1023 to get the floating point value.
AR(n),GB(n) Are halves of a ARGB8888 Color Value.

I can read this stuff in hex by itself, which is the good part as far as I'm aware. And another thing is any model that has a secondary mesh, as these models have them in most cases, starts off as a new type to read using the header above. Most of the time there's another header of four bytes in regards to the texture the mesh uses. Any help with reading these is greatly appreciated. OH! Before I forget, the game is SA2 on the Dreamcast, so everything is in Little Endian. Anyway, thanks in advance!

{BTW, I didn't know if this was the right place to ask, but I don't know of anywhere else with MaxScript experience to help.}
Sign In or Register to comment.