Commit 40fff317 authored by Christian Costa's avatar Christian Costa Committed by Alexandre Julliard

d3dxof: Finish support for multi-dimensional array.

parent eaaced6c
...@@ -1100,6 +1100,11 @@ static BOOL parse_template_members_list(parse_buffer * buf) ...@@ -1100,6 +1100,11 @@ static BOOL parse_template_members_list(parse_buffer * buf)
{ {
while (check_TOKEN(buf) == TOKEN_OBRACKET) while (check_TOKEN(buf) == TOKEN_OBRACKET)
{ {
if (nb_dims >= MAX_ARRAY_DIM)
{
FIXME("Too many dimensions (%d) for multi-dimensional array\n", nb_dims + 1);
return FALSE;
}
get_TOKEN(buf); get_TOKEN(buf);
if (check_TOKEN(buf) == TOKEN_INTEGER) if (check_TOKEN(buf) == TOKEN_INTEGER)
{ {
...@@ -1842,29 +1847,20 @@ static BOOL parse_object_members_list(parse_buffer * buf) ...@@ -1842,29 +1847,20 @@ static BOOL parse_object_members_list(parse_buffer * buf)
for (i = 0; i < pt->nb_members; i++) for (i = 0; i < pt->nb_members; i++)
{ {
int nb_elems, k; int k;
int nb_elems = 1;
if (pt->members[i].nb_dims > 1) buf->pxo->members[i].start = buf->cur_pdata;
{
FIXME("Arrays with dimension > 1 not yet supported\n"); for (k = 0; k < pt->members[i].nb_dims; k++)
return FALSE;
}
else if (pt->members[i].nb_dims)
{ {
if (!pt->members[i].dim_fixed[0]) if (pt->members[i].dim_fixed[k])
{ nb_elems *= pt->members[i].dim_value[k];
if (!i)
{
FIXME("Array with variable must be preceded by the size\n");
return FALSE;
}
nb_elems = last_dword;
}
else else
nb_elems = pt->members[i].dim_value[0]; nb_elems *= *(DWORD*)buf->pxo->members[pt->members[i].dim_value[k]].start;
} }
else
nb_elems = 1; TRACE("Elements to consider: %d\n", nb_elems);
for (k = 0; k < nb_elems; k++) for (k = 0; k < nb_elems; k++)
{ {
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include "dxfile.h" #include "dxfile.h"
#define MAX_NAME_LEN 32 #define MAX_NAME_LEN 32
#define MAX_ARRAY_DIM 1 #define MAX_ARRAY_DIM 4
#define MAX_MEMBERS 50 #define MAX_MEMBERS 50
#define MAX_CHILDS 20 #define MAX_CHILDS 20
#define MAX_TEMPLATES 200 #define MAX_TEMPLATES 200
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment