2nd attemp
looks like the code in my previous message got chopped off.
why isn't this working? I'm trying to clear the screen, wait for a key and
redraw.
///////////////////////////////////
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "pxp.h"
#include "exprtn.h"
/* Variable definitions */
#define COLOR 1
/* Dialog description */
DlgEntry cdialog[]=
{
/* Text strings to be displayed in dialog box */
0, "TITLE=\"Test\"",
0, "TITLE=\"by John Doe, Version 1.0\"",
/* Setup for 'radio-button' and associated variable */
COLOR, "RADIO=\"AXP Color:\", \"Default\", \"From Object\"",
0, NULL
};
/* Version test value */
/* Every external process must have a unique version number */
#define VERSION 0x71FF
/* State Structure definition */
/* Any variables whose values are set via dialog interface must be
declared within the 'State' struct. */
typedef struct
{
ulong version;
int obj_color;
} State;
/* the "state" struct MUST start with a "ulong" which is the version#,
to prevent using data from old versions of this program. This
verification is performed automatically. */
static State init_state = { VERSION, 1 }; /* initial state settings */
static State state = { VERSION, 1 }; /* default settings */
static int ix, thismtl;
static float minx, miny, minz, maxx, maxy, maxz;
/*—————————————————————-*/
/* Following function sets the appropriate 'State' variables based on the
input from the dialog */
void ClientSetStateVar(int id, void *ptr)
{
OVL o; /* Union of possible values that the dialog can return */
ulong *ul;
char *s;
ul=(ulong *)ptr;
s=(char *)ptr;
o.ul = *ul;
switch(id)
{
case COLOR: state.obj_color=o.i; break; /* State variables set here based
on Union variable */
}
}
/* Following function sets the appropriate value of the Union 'OVL' variable
to return values stored in the 'State' variable */
ulong ClientGetStateVar(int id)
{
OVL o; /* Union of the values which can be requested by 3D Studio from the
'State' structure */
switch(id)
{
case COLOR: o.i=state.obj_color; break; /* Union variable set to
appropriate value from 'state'
variable */
}
return(o.ul); /* The variable requested by 3D Studio is returned to 3D
Studio via the 'ulong' field of the 'Union' structure
'OVL'. */
}
/* Following function allows 3D Studio to determine the size of any variable
in the dialog */
int ClientVarSize(int id)
{
return(1);
}
/* Following function allows 3D Studio to determine the size of the 'State'
structure and returns a pointer to the 'State' struct */
char *ClientGetState(int *size)
{
*size = sizeof(State);
return((char *)&state);
}
/* Following function allows 3D Studio to reset the state of the external
process */
void ClientResetState()
{
state = init_state;
}
/* Following function performs any calculations or packet-commands necessary
before the EXP can begin */
void ClientStartup(EXPbuf *buf)
{
buf->opcode=EXP_NOP; /* Packet command sent to 3D Studio */
buf->usercode=0x0200; /* IPAS routine to return to this label in the
case checking */
buf->status=1;
//strcpy(buf->data.string, "Pick a mesh object to box");
}
/* Following function contains user codes which process data */
void ClientUserCode(EXPbuf *buf)
{
switch(buf->usercode)
{
case 0x0200:
gfx_clearscreen();
gfx_key_wait(ix);
gfx_redraw();
buf->opcode=buf->usercode=EXP_TERMINATE; /* all commands necessary to
signal termination of IPAS
routine */
buf->status=0; /* Set status to 'exit' */
break;
}
}
void ClientTerminate(void)
{
/* free any data structures, etc. */
}
/* The following function allows 3D Studio to get the address of the string
containing the dialogue. The IPAS programmer will not have to call this
function or modify the following code, but will have to include it */
DlgEntry *ClientDialog(int n)
{
return(&cdialog[n]);
}
//////////////////////////////////////////////////////////////////////////
any help appreciated.