コード例 #1
0
ファイル: lua_v1.cpp プロジェクト: gmacon/residual
void L1_SetHardwareState() {
	// changing only in config setup (software/hardware rendering)
	bool accel = getbool(1);
	if (accel)
		g_registry->set("soft_renderer", "false");
	else
		g_registry->set("soft_renderer", "true");
}
コード例 #2
0
ファイル: lua_v1.cpp プロジェクト: gmacon/residual
void L1_TurnLightOn() {
	lua_Object lightObj = lua_getparam(1);

	Scene *scene = g_grim->getCurrScene();
	bool isOn = getbool(2);
	if (lua_isnumber(lightObj)) {
		scene->setLightEnabled((int)lua_getnumber(lightObj), isOn);
	} else if (lua_isstring(lightObj)) {
		scene->setLightEnabled(lua_getstring(lightObj), isOn);
	}
}
コード例 #3
0
void Lua_V1::NewObjectState() {
	int setupID = (int)lua_getnumber(lua_getparam(1));
	int val = (int)lua_getnumber(lua_getparam(2));
	ObjectState::Position pos = (ObjectState::Position)val;
	const char *bitmap = lua_getstring(lua_getparam(3));
	const char *zbitmap = NULL;
	if (!lua_isnil(lua_getparam(4)))
		zbitmap = lua_getstring(lua_getparam(4));
	bool transparency = getbool(5);

	ObjectState *state = g_grim->getCurrSet()->addObjectState(setupID, pos, bitmap, zbitmap, transparency);
	lua_pushusertag(state->getId(), MKTAG('S','T','A','T'));
}
コード例 #4
0
void Lua_V2::StopActorChores() {
	lua_Object actorObj = lua_getparam(1);
	// Guesswork for boolean parameter
	bool ignoreLoopingChores = getbool(2);

	if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R'))
		return;

	Actor *actor = getactor(actorObj);
	if (!actor)
		return;

	actor->stopAllChores(ignoreLoopingChores);
}
コード例 #5
0
void Lua_V2::EnableActorPuck() {
	lua_Object actorObj = lua_getparam(1);

	if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R'))
		return;

	Actor *actor = getactor(actorObj);
	if (!actor)
		return;

	bool enable = getbool(2);

	// FIXME: Implement.
	warning("Lua_V2::EnableActorPuck: stub, actor: %s enable: %s", actor->getName().c_str(), enable ? "TRUE" : "FALSE");
}
コード例 #6
0
void Lua_V1::StartFullscreenMovie() {
	lua_Object name = lua_getparam(1);
	if (!lua_isstring(name)) {
		lua_pushnil();
		return;
	}
	Lua_V1::CleanBuffer();

	GrimEngine::EngineMode prevEngineMode = g_grim->getMode();
	g_grim->setMode(GrimEngine::SmushMode);
	bool looping = getbool(2);
	bool result = g_movie->play(lua_getstring(name), looping, 0, 0);
	if (!result)
		g_grim->setMode(prevEngineMode);
	pushbool(result);
}
コード例 #7
0
void Lua_V2::StopActorChores() {
	lua_Object actorObj = lua_getparam(1);
	// Guesswork for boolean parameter
	bool ignoreLoopingChores = getbool(2);

	if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R'))
		return;

	Actor *actor = getactor(actorObj);
	if (!actor)
		return;

	actor->stopAllChores(ignoreLoopingChores);

	// Reset the wearChore as well
	EMICostume *cost = static_cast<EMICostume *>(actor->getCurrentCostume());
	if (cost != nullptr)
		cost->setWearChoreActive(false);
}
コード例 #8
0
void Lua_V1::StartMovie() {
	lua_Object name = lua_getparam(1);
	if (!lua_isstring(name)) {
		lua_pushnil();
		return;
	}
	int x = 0, y = 0;
	if (!lua_isnil(lua_getparam(3)))
		x = (int)lua_getnumber(lua_getparam(3));
	if (!lua_isnil(lua_getparam(4)))
		y = (int)lua_getnumber(lua_getparam(4));

	GrimEngine::EngineMode prevEngineMode = g_grim->getMode();
	g_grim->setMode(GrimEngine::NormalMode);

	bool looping = getbool(2);
	bool result = g_movie->play(lua_getstring(name), looping, x, y);
	if (!result)
		g_grim->setMode(prevEngineMode);
	pushbool(result);
}
コード例 #9
0
void Lua_V2::IsActorChoring() {
	lua_Object actorObj = lua_getparam(1);
	bool excludeLoop = getbool(2);

	if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R'))
		return;

	Actor *actor = getactor(actorObj);
	Costume *costume = actor->getCurrentCostume();

	if (!costume) {
		lua_pushnil();
		return;
	}

	for (int i = 0; i < costume->getNumChores(); i++) {
		int chore = costume->isChoring(i, excludeLoop);
		if (chore != -1) {
			// Ignore talk chores.
			bool isTalk = false;
			for (int j = 0; j < 10; j++) {
				if (costume == actor->getTalkCostume(j) && actor->getTalkChore(j) == chore) {
					isTalk = true;
					break;
				}
			}
			if (isTalk)
				continue;

			lua_pushnumber(chore);
			
			pushbool(true);
			return;
		}
	}

	lua_pushnil();
}
コード例 #10
0
 bool VariantContainer<T>::ToBool(void) const
 {
     return getbool( );
 }
コード例 #11
0
ファイル: config.c プロジェクト: guinness1/Byzantium
static struct network_conf *
parse_nconf(gnc_t gnc, void *closure)
{
    int c;
    char *token;
    struct network_conf *nconf;

    nconf = calloc(1, sizeof(struct network_conf));
    if(nconf == NULL)
        goto error;

    c = gnc(closure);
    if(c < -1)
        goto error;

    c = skip_whitespace(c, gnc, closure);
    if(c < -1 || c == '\n' || c == '#')
        goto error;

    c = getstring(c, &token, gnc, closure);
    if(c < -1 || token == NULL)
        goto error;

    nconf->ifname = token;

    while(c >= 0 && c != '\n') {
        c = skip_whitespace(c, gnc, closure);
        if(c == '\n' || c == '#') {
            c = skip_to_eol(c, gnc, closure);
            break;
        }
        c = getword(c, &token, gnc, closure);
        if(c < -1)
            goto error;

        if(strcmp(token, "rxcost") == 0) {
            int cost;
            c = getint(c, &cost, gnc, closure);
            if(c < -1 || cost <= 0 || cost > 0xFFFF)
                goto error;
            nconf->cost = cost;
        } else if(strcmp(token, "hello-interval") == 0) {
            int interval;
            c = getmsec(c, &interval, gnc, closure);
            if(c < -1 || interval <= 0 || interval > 10 * 0xFFFF)
                goto error;
            nconf->hello_interval = interval;
        } else if(strcmp(token, "update-interval") == 0) {
            int interval;
            c = getmsec(c, &interval, gnc, closure);
            if(c < -1 || interval <= 0 || interval > 10 * 0xFFFF)
                goto error;
            nconf->update_interval = interval;
        } else if(strcmp(token, "wired") == 0) {
            int v;
            c = getbool(c, &v, gnc, closure);
            if(c < -1)
                goto error;
            nconf->wired = v;
        } else if(strcmp(token, "link-quality") == 0) {
            int v;
            c = getbool(c, &v, gnc, closure);
            if(c < -1)
                goto error;
            nconf->lq = v;
        } else if(strcmp(token, "split-horizon") == 0) {
            int v;
            c = getbool(c, &v, gnc, closure);
            if(c < -1)
                goto error;
            nconf->split_horizon = v;
        } else {
            goto error;
        }
        free(token);
    }

    return nconf;

 error:
    free(nconf);
    return NULL;
}
コード例 #12
0
void Lua_V1::PreRender() {
	g_driver->renderBitmaps(getbool(1));
	g_driver->renderZBitmaps(getbool(2));
}
コード例 #13
0
ファイル: gdbmsetopt.c プロジェクト: 4honor/QConf
int
gdbm_setopt (GDBM_FILE dbf, int optflag, void *optval, int optlen)
{
  int n;
  size_t sz;
  
  switch (optflag)
    {
      /* Cache size: */
      
      case GDBM_SETCACHESIZE:
        /* Optval will point to the new size of the cache. */
        if (dbf->bucket_cache != NULL)
          {
            gdbm_errno = GDBM_OPT_ALREADY_SET;
            return -1;
          }

	if (get_size (optval, optlen, &sz))
	  return -1;
        return _gdbm_init_cache (dbf, (sz > 9) ? sz : 10);

      case GDBM_GETCACHESIZE:
	if (!optval || optlen != sizeof (size_t))
	  {
	    gdbm_errno = GDBM_OPT_ILLEGAL;
	    return -1;
	  }
	*(size_t*) optval = dbf->cache_size;
	break;
	
      	/* Obsolete form of GDBM_SETSYNCMODE. */
      case GDBM_FASTMODE:
	if ((n = getbool (optval, optlen)) == -1)
	  return -1;
	dbf->fast_write = n;
	break;

	/* SYNC mode: */
	
      case GDBM_SETSYNCMODE:
      	/* Optval will point to either true or false. */
	if ((n = getbool (optval, optlen)) == -1)
	  return -1;
	dbf->fast_write = !n;
	break;

      case GDBM_GETSYNCMODE:
	if (!optval || optlen != sizeof (int))
	  {
	    gdbm_errno = GDBM_OPT_ILLEGAL;
	    return -1;
	  }
	*(int*) optval = !dbf->fast_write;
	break;

	/* CENTFREE - set or get the stat of the central block repository */
      case GDBM_SETCENTFREE:
      	/* Optval will point to either true or false. */
	if ((n = getbool (optval, optlen)) == -1)
	  return -1;
	dbf->central_free = n;
	break;

      case GDBM_GETCENTFREE:
	if (!optval || optlen != sizeof (int))
	  {
	    gdbm_errno = GDBM_OPT_ILLEGAL;
	    return -1;
	  }
	*(int*) optval = !dbf->central_free;
	break;

	/* Coalesce state: */
      case GDBM_SETCOALESCEBLKS:
      	/* Optval will point to either true or false. */
	if ((n = getbool (optval, optlen)) == -1)
	  return -1;
	dbf->coalesce_blocks = n;
	break;

      case GDBM_GETCOALESCEBLKS:
	if (!optval || optlen != sizeof (int))
	  {
	    gdbm_errno = GDBM_OPT_ILLEGAL;
	    return -1;
	  }
	*(int*) optval = dbf->coalesce_blocks;
	break;

	/* Mmap mode */
      case GDBM_SETMMAP:
#if HAVE_MMAP
	if ((n = getbool (optval, optlen)) == -1)
	  return -1;
	__fsync (dbf);
	if (n == dbf->memory_mapping)
	  return 0;
	if (n)
	  {
	    if (_gdbm_mapped_init (dbf) == 0)
	      dbf->memory_mapping = TRUE;
	    else
	      return -1;
	  }
	else
	  {
	    _gdbm_mapped_unmap (dbf);
	    dbf->memory_mapping = FALSE;
	  }
#else
	gdbm_errno = GDBM_OPT_ILLEGAL;
	return -1;
#endif
	break;
	
      case GDBM_GETMMAP:
	if (!optval || optlen != sizeof (int))
	  {
	    gdbm_errno = GDBM_OPT_ILLEGAL;
	    return -1;
	  }
	*(int*) optval = dbf->memory_mapping;
	break;

	/* Maximum size of a memory mapped region */
      case GDBM_SETMAXMAPSIZE:
#if HAVE_MMAP
	{
	  size_t page_size = sysconf (_SC_PAGESIZE);

	  if (get_size (optval, optlen, &sz))
	    return -1;
	  dbf->mapped_size_max = ((sz + page_size - 1) / page_size) *
	                          page_size;
	  _gdbm_mapped_init (dbf);
	  break;
	}
#else
	gdbm_errno = GDBM_OPT_ILLEGAL;
	return -1;
#endif
	
      case GDBM_GETMAXMAPSIZE:
	if (!optval || optlen != sizeof (size_t))
	  {
	    gdbm_errno = GDBM_OPT_ILLEGAL;
	    return -1;
	  }
	*(size_t*) optval = dbf->mapped_size_max;
	break;

	/* Flags */
      case GDBM_GETFLAGS:
	if (!optval || optlen != sizeof (int))
	  {
	    gdbm_errno = GDBM_OPT_ILLEGAL;
	    return -1;
	  }
	else
	  {
	    int flags = dbf->read_write;
	    if (!dbf->fast_write)
	      flags |= GDBM_SYNC;
	    if (!dbf->file_locking)
	      flags |= GDBM_NOLOCK;
	    if (!dbf->memory_mapping)
	      flags |= GDBM_NOMMAP;
	    *(int*) optval = flags;
	  }
	break;

      case GDBM_GETDBNAME:
	if (!optval || optlen != sizeof (char*))
	  {
	    gdbm_errno = GDBM_OPT_ILLEGAL;
	    return -1;
	  }
	else
	  {
	    char *p = strdup (dbf->name);
	    if (!p)
	      {
		gdbm_errno = GDBM_MALLOC_ERROR;
		return -1;
	      }
	    *(char**) optval = p;
	  }
	break;
	
      default:
        gdbm_errno = GDBM_OPT_ILLEGAL;
        return -1;
    }

  return 0;
}
コード例 #14
0
ファイル: setlocale.c プロジェクト: NanXiao/illumos-joyent
static char *
getlocale_monetary(char *locale, struct lconv *lconvp, char *newlocale)
{
	int fd;
	struct stat buf;
	char *str;
	char *p;

	if ((fd = openlocale("LC_MONETARY", LC_MONETARY, locale, newlocale)) < 0)
		return (NULL);
	if (fd == 0)
		return ("");
	if ((fstat(fd, &buf)) != 0)
		return (NULL);
	if ((str = (char*)malloc((unsigned)buf.st_size + 2)) == NULL)
		return (NULL);

	if ((read(fd, str, (int)buf.st_size)) != buf.st_size) {
		free((malloc_t)str);
		return (NULL);
	}

	/* Set last character of str to '\0' */
	p = &str[buf.st_size];
	*p++ = '\n';
	*p = '\0';

	/* p will "walk thru" str */
	p = str;

	p = getstr(p, &lconvp->int_curr_symbol);
	if (p == NULL)
		goto fail;
	p = getstr(p, &lconvp->currency_symbol);
	if (p == NULL)
		goto fail;
	p = getstr(p, &lconvp->mon_decimal_point);
	if (p == NULL)
		goto fail;
	p = getstr(p, &lconvp->mon_thousands_sep);
	if (p == NULL)
		goto fail;
	p = getgrouping(p, &lconvp->mon_grouping);
	if (p == NULL)
		goto fail;
	p = getstr(p, &lconvp->positive_sign);
	if (p == NULL)
		goto fail;
	p = getstr(p, &lconvp->negative_sign);
	if (p == NULL)
		goto fail;
	p = getnum(p, &lconvp->frac_digits);
	if (p == NULL)
		goto fail;
	p = getbool(p, &lconvp->p_cs_precedes);
	if (p == NULL)
		goto fail;
	p = getbool(p, &lconvp->p_sep_by_space);
	if (p == NULL)
		goto fail;
	p = getbool(p, &lconvp->n_cs_precedes);
	if (p == NULL)
		goto fail;
	p = getbool(p, &lconvp->n_sep_by_space);
	if (p == NULL)
		goto fail;
	p = getnum(p, &lconvp->p_sign_posn);
	if (p == NULL)
		goto fail;
	p = getnum(p, &lconvp->n_sign_posn);
	if (p == NULL)
		goto fail;
	(void) close(fd);

	return (str);

fail:
	(void) close(fd);
	free((malloc_t)str);
	return (NULL);
}
コード例 #15
0
ファイル: lua_v1.cpp プロジェクト: Harrypoppins/grim_mouse
void Lua_V1::SetHardwareState() {
	// changing only in config setup (software/hardware rendering)
	bool accel = getbool(1);
	ConfMan.setBool("soft_renderer", !accel);
	g_grim->changeHardwareState();
}
コード例 #16
0
ファイル: ux_init.c プロジェクト: nosyndicate/frotzen
/*
 * getconfig
 *
 * Parse a <variable> <whitespace> <value> config file.
 * The til-end-of-line comment character is the COMMENT define.  I use '#'
 * here.  This code originally appeared in my q2-wrapper program.  Find it
 * at metalab.cs.unc.edu or assorted Quake2 websites.
 *
 * This section must be modified whenever new options are added to
 * the config file.  Ordinarily I would use yacc and lex, but the grammar
 * is too simple to involve those resources, and I can't really expect all
 * compile targets to have those two tools installed.
 *
 */
static int getconfig(char *configfile)
{
	FILE	*fp;

	int	num, num2;

	char	varname[LINELEN + 1];
	char	value[LINELEN + 1];


	/*
	 * We shouldn't care if the config file is unreadable or not
	 * present.  Just use the defaults.
	 *
	 */

	if ((fp = fopen(configfile, "r")) == NULL)
		return FALSE;

	while (fgets(varname, LINELEN, fp) != NULL) {

		/* If we don't get a whole line, dump the rest of the line */
		if (varname[strlen(varname)-1] != '\n')
			while (fgetc(fp) != '\n')
			;

		/* Remove trailing whitespace and newline */
		for (num = strlen(varname) - 1; isspace(varname[num]); num--)
		;
		varname[num+1] = 0;

		/* Drop everything past the comment character */
		for (num = 0; num <= strlen(varname)+1; num++) {
			if (varname[num] == COMMENT)
				varname[num] = 0;
		}

		/* Find end of variable name */
		for (num = 0; !isspace(varname[num]) && num < LINELEN; num++);

		for (num2 = num; isspace(varname[num2]) && num2 < LINELEN; num2++);

		/* Find the beginning of the value */
		strncpy(value, &varname[num2], LINELEN);
		varname[num] = 0; /* chop off value from the var name */

		/* varname now contains the variable name */


		/* First, boolean config stuff */
		if (strcmp(varname, "attrib_set") == 0) {
			f_setup.attribute_assignment = getbool(value);
		}
		else if (strcmp(varname, "attrib_test") == 0) {
			f_setup.attribute_testing = getbool(value);
		}

		else if (strcmp(varname, "ignore_fatal") == 0) {
			f_setup.ignore_errors = getbool(value);
		}

		else if (strcmp(varname, "color") == 0) {
			u_setup.disable_color = !getbool(value);
		}
		else if (strcmp(varname, "colour") == 0) {
			u_setup.disable_color = !getbool(value);
		}
		else if (strcmp(varname, "force_color") == 0) {
			u_setup.force_color = getbool(value);
		}
		else if (strcmp(varname, "obj_move") == 0) {
			f_setup.object_movement = getbool(value);
		}
		else if (strcmp(varname, "obj_loc") == 0) {
			f_setup.object_locating = getbool(value);
		}
		else if (strcmp(varname, "piracy") == 0) {
			f_setup.piracy = getbool(value);
		}
		else if (strcmp(varname, "ascii") == 0) {
			u_setup.plain_ascii = getbool(value);
		}
		else if (strcmp(varname, "sound") == 0) {
			f_setup.sound = getbool(value);
		}
		else if (strcmp(varname, "tandy") == 0) {
			u_setup.tandy_bit = getbool(value);
		}
		else if (strcmp(varname, "expand_abb") == 0) {
			f_setup.expand_abbreviations = getbool(value);
		}

		/* now for stringtype yet still numeric variables */
		else if (strcmp(varname, "background") == 0) {
			u_setup.background_color = getcolor(value);
		}
		else if (strcmp(varname, "foreground") == 0) {
			u_setup.foreground_color = getcolor(value);
		}
		else if (strcmp(varname, "context_lines") == 0) {
			f_setup.context_lines = atoi(value);
		}
		else if (strcmp(varname, "screen_height") == 0) {
			u_setup.screen_height = atoi(value);
		}
		else if (strcmp(varname, "left_margin") == 0) {
			f_setup.left_margin = atoi(value);
		}
		else if (strcmp(varname, "right_margin") == 0) {
			f_setup.right_margin = atoi(value);
		}
		else if (strcmp(varname, "randseed") == 0) {
			u_setup.random_seed = atoi(value);
		}
		else if (strcmp(varname, "script_width") == 0) {
			f_setup.script_cols = atoi(value);
		}
		else if (strcmp(varname, "undo_slots") == 0) {
			f_setup.undo_slots = atoi(value);
		}
		else if (strcmp(varname, "screen_width") == 0) {
			u_setup.screen_width = atoi(value);
		}
		/* default is set in main() by call to init_err() */
		else if (strcmp(varname, "errormode") == 0) {
			f_setup.err_report_mode = geterrmode(value);
		}

		/* now for really stringtype variable */

		else if (strcmp(varname, "zcode_path") == 0) {
			f_setup.zcode_path = malloc(strlen(value) * sizeof(char) + 1);
			strncpy(f_setup.zcode_path, value, strlen(value) * sizeof(char));
		}

		/* The big nasty if-else thingy is finished */
	} /* while */

	return TRUE;
} /* getconfig() */
コード例 #17
0
/* ------------------------------------------------------------------------------------ */
Procedural* Particles_Create(char *TextureName, geWorld *World, const char *InputParams)
{
    Procedural *Proc;
    int i;
    char ParamWork[8192],*pstr;
    geBitmap	*ppBitmap;

	Proc = GE_RAM_ALLOCATE_STRUCT(Procedural);

	if(!Proc)
		return (Procedural*)NULL;

	memset(Proc, 0, sizeof(Procedural));

	ppBitmap = geWorld_GetBitmapByName(World, TextureName);

	/**** read Params *****/

// changed RF064 by QD
	if(!strcmp(InputParams, "Params_Oil"))
	{
		strcpy(ParamWork, Params_Oil);
	}
	else if(!strcmp(InputParams, "Params_Jet"))
	{
		strcpy(ParamWork,Params_Jet);
	}
	else if(!strcmp(InputParams, "Params_Steam"))
	{
		strcpy(ParamWork,Params_Steam);
	}
	else if(!strcmp(InputParams, "Params_Explosion") || strlen(InputParams) < 20 )
	{
		strcpy(ParamWork,DefaultParams);
	}
// end change RF064 by QD
	else
	{
		strcpy(ParamWork,InputParams);
	}

	pstr = strtok(ParamWork,strbreakers);

	Proc->NumParticles = getint(pstr);
	Proc->NumSources = getint(pstr);

	/**** make Bitmap *****/

	if(!Particles_InitBitmap(ppBitmap))
		goto fail;

	Proc->Bitmap = ppBitmap;

	Proc->SizeX  = geBitmap_Width(Proc->Bitmap);
	Proc->SizeY = geBitmap_Height(Proc->Bitmap);
	geBitmap_GetInfo(Proc->Bitmap, &(Proc->BmInfo), (geBitmap_Info*)NULL);
	Proc->SizeZ = min(Proc->SizeX, Proc->SizeY);

	/**** make Particles *****/

	Proc->Particles = (Particle*)geRam_AllocateClear(Proc->NumParticles * sizeof(Particle));

	if(!(Proc->Particles))
		goto fail;

	for(i=0; i<Proc->NumParticles; i++)
	{
		Proc->Particles[i].shade = -1;
	}

	Proc->NumActiveParticles = 0;

	/**** make Sources *****/

	Proc->Sources = (ParticleSource*)geRam_AllocateClear(Proc->NumSources * sizeof(ParticleSource));

	if(!(Proc->Sources))
		goto fail;

	/**** More Params *****/

	// <> for stock schemes, take a few colors as parameters

	if(matchstr(pstr, "oil"))
	{
		nextparam(pstr);
		Proc->NumColors = Proc->NumShades = 16;
		Proc->PixelRGBA = PixelRGBA_OilColor;
	}
	else if(matchstr(pstr, "fire"))
	{
		nextparam(pstr);
		Proc->NumColors = 1;
		Proc->NumShades = 256;
		Proc->PixelRGBA = PixelRGBA_FireColor;
	}
	else if(matchstr(pstr, "opaquefire"))
	{
		nextparam(pstr);
		Proc->NumColors = 1;
		Proc->NumShades = 256;
		Proc->PixelRGBA = PixelRGBA_OpaqueFireColor;
	}
	else if(matchstr(pstr, "steam"))
	{
		nextparam(pstr);
		Proc->NumColors = 1;
		Proc->NumShades = 256;
		Proc->PixelRGBA = PixelRGBA_SteamColor;
	}
	else
	{
		Proc->NumColors = getint(pstr);
		Proc->NumShades = getint(pstr);
		Proc->PixelRGBA = PixelRGBA_OilColor;
		// <>
		// way to read in general spline of colors ?
	}

	if((Proc->NumColors * Proc->NumShades) < 256)
	{
		Proc->NumColors = min(Proc->NumColors, 256);
		Proc->NumShades = 256 / Proc->NumColors;
	}

	Proc->NumSmoothes	= getint(pstr);
	Proc->SmoothRadius	= getint(pstr);

	if(matchstr(pstr, "bounce"))
	{
		Proc->Capper = Capper_Bounce;
		Proc->SmoothWrap = GE_FALSE;
	}
	else if(matchstr(pstr,"wrap"))
	{
		Proc->Capper = Capper_Wrap;
		Proc->SmoothWrap = GE_TRUE;
	}
	else if(matchstr(pstr,"hard"))
	{
		Proc->Capper = Capper_Hard;
		Proc->SmoothWrap = GE_FALSE;
	}
	else
	{
		goto fail;
	}

	nextparam(pstr);

	Proc->DoMagnetic = getbool(pstr);

	if(Proc->DoMagnetic)
	{
		getvec(pstr, &(Proc->MagneticField));
	}

	Proc->DoAttractor = getbool(pstr);

	if(Proc->DoAttractor)
	{
		Proc->AttractorStrength = getfloat(pstr); // negative for repulsive
		Proc->AttractorIsAxis = getbool(pstr);

		if(Proc->AttractorIsAxis)
		{
			getvec(pstr, &(Proc->AttractorAxis));
			geVec3d_Normalize(&(Proc->AttractorAxis));
		}

		getvec(pstr, &(Proc->AttractorPos));
		scalevec(&(Proc->AttractorPos));
	}

	/**** LUT's *****/

	if(!Particles_InitPalette(Proc))
		goto fail;

	for(i=0; i<Proc->NumSources; i++)
	{
		ParticleSource *pSource;
		Particle *pParticle;

		pSource = Proc->Sources + i;

		// base
		pParticle = &(pSource->Base);

		getvec(pstr, pParticle->p);
		getvec(pstr, pParticle->v);

		scalevec(pParticle->p);
		scalevec(pParticle->v);

		pParticle->DeathTime = getfloat(pstr);
		pParticle->color = getint(pstr);
		pParticle->shade = Proc->NumShades - 1;
		pParticle->CurDeathTime = 0.0f;

		// random
		pParticle = &(pSource->Random);

		getvec(pstr,pParticle->p);
		getvec(pstr,pParticle->v);

		scalevec(pParticle->p);
		scalevec(pParticle->v);

		absvec(pParticle->p);
		absvec(pParticle->v);

		pParticle->DeathTime = getfloat(pstr);
		pParticle->color = getint(pstr);
		pParticle->shade = getint(pstr);
		pParticle->CurDeathTime = 0.0f;

		pSource->RandomVMagnitude = geVec3d_Normalize((geVec3d*)(pParticle->v));

		pSource->Delay = getfloat(pstr); // seconds
		pSource->Base.Drag = getfloat(pstr);
		pSource->CurTime = pSource->Delay;
	}

	return Proc;

fail:

	Particles_Destroy(Proc);
	return (Procedural*)NULL;
}