void etoileinit(void)
{
//  init_parameters();
	allocParts();
  frames=0;
//  changep();
  return ;
}
Example #2
0
void SS5Player::play(const AnimeRef* animeRef, int startFrameNo)
{
	SS_ASSERT(animeRef);
	if (m_currentAnimeRef != animeRef){
		m_currentAnimeRef = animeRef;
		
		allocParts(animeRef->m_numParts);
		setPartsParentage();
	}

	setCurrentFrame(startFrameNo);
	setFrame(startFrameNo);
	
	//play実行時に最初のフレームのユーザーデータを確認する
	checkUserData(startFrameNo);
	checkEvent(startFrameNo);
}
Example #3
0
// FIXME: Make sure this works...I didn't check it
APalette::APalette(APalette *orig)
{
  init();
  if(!orig) { /*errorFlag=true;*/ return; }
  //if(orig->errorFlag) { errorFlag=true; return; }
  histComputed=orig->histComputed;
  tooBig=orig->tooBig;
  numColors=orig->numColors;
  significantBits=orig->significantBits;
  bitsHint=orig->bitsHint;  hBrite=orig->hBrite;
  changed=orig->changed;  blackBackground=orig->blackBackground;
#ifdef DEBUG_VERBOSE
  dBug<<"Palette cons(APalette)\n";
#endif // DEBUG_VERBOSE
  allocParts();
  for(unsigned int t=0;t<numColors;t++) {
    r[t]=orig->r[t];
    g[t]=orig->g[t];
    b[t]=orig->b[t];
    used[t]=orig->used[t];
  }
}
Example #4
0
void APalette::resize(unsigned int newSize)
{
  if(readOnly) return;
  /*
  if(error()) {
#ifdef DEBUG_VERBOSE
    dBug<<"Palette error, couldn't resize!\n";
#endif // DEBUG_VERBOSE
    return;
  }
  */
  if(newSize==numColors) return;  // Already that size...
  bool e=isEmpty();
  APalette *p=new APalette(numColors);
  if(!p) {
#ifdef DEBUG_VERBOSE
    dBug<<"resize:Couldn't get temp palette!\n";
#endif // DEBUG_VERBOSE
    return;
  }
  /*
  if(p->error()) {
#ifdef DEBUG_VERBOSE
    dBug<<"temp copy palette error!\n"; delete p; return;
#endif // DEBUG_VERBOSE
  }
  */
  p->copy(this);
  freeParts();
  numColors=newSize;
  allocParts();
  copy(p);
  if(e) {
    setToDefaultRGB();
    //setToDefaultGrayscale();
  }
  delete p;
  touch();
}
Example #5
0
APalette::APalette(unsigned int num,unsigned int bitsNum)
{
  init();
  // If we're requested to calculate the number of colors from
  // bits per pixel, do so.
  if(!num) {
    num=1;
    for(unsigned int t=0;t<bitsNum;t++) num*=2;
  }
  // Always have at least 2 colors.
  if(num<2) num=2;
  numColors=num;
#ifdef DEBUG_VERBOSE
  dBug<<"Palette cons("<<num<<")\n";
#endif // DEBUG_VERBOSE
  if(numColors>512) {
    //AMsgWindow("TrueColor Palette!","Palette with more than 8 bits created!");
    tooBig=true;
  }
  allocParts();
  // Set default to default colors
  setToDefaultRGB();
  //setToDefaultGrayscale();
}
int load_parameters(const char * filename)
{
  FILE *f = fopen(filename,"r");
  if(f==NULL)
    return 0;
  char buf[1024];
  char *ptr, *word;
  const char *err;
  int line = 1, mode = 0;

  char *oldlocal = setlocale (LC_NUMERIC, "C");


  if(ps)
    freeparams();
  p_parsed.name = 0;

  fgets(buf,1024, f);

  while(!feof(f))
    {
      ptr = buf;
      word = nextword(ptr);
      if(word[0]!= '#')
	{
	  switch (mode)
	    {
	    case 0: //Begin
	      if(strcmp(word, "Begin") == 0)
		{
		  word = nextword(ptr);
		  if(strcmp(word, "Effect") == 0)
		    {
		      mode = 1;
		      word = nextword(ptr);
		      p_parsed.name = 0;
		      if(strcmp(word, "inherits") == 0)
			{
			  word = nextword(ptr);
			  for(int i=0;i<nump;i++)
			    {
			      if(strcmp(ps[i].name, word)==0)
				{
				  p_parsed = ps[i];
				  p_parsed.name = visual_strdup(p_parsed.name);
				  break;
				}
			    }
			}
		    }
		  else
		    {
		      err= "unknown Begin";
		      goto error;
		    }

		}

	    case 1:
	      if(strcmp(word, "End") == 0)
			{
			  word = nextword(ptr);

			  if(strcmp(word, "Effect") == 0)
				{
				  if(p_parsed.name==0)
					{
					  err = "no name for this effect";
					  goto error;
					}
				  mode = 0;
				  if(nump++==0)
					ps = (parameters *) malloc(nump* sizeof(parameters));
				  else
					ps = (parameters *) realloc(ps,nump* sizeof(parameters));
				  ps[nump-1] = p_parsed;

				}

			}
	      else
		{
		  char *var,  *egal, *val;
		  int i;
		  var = word;
		  egal = nextword(ptr);
		  val = nextword(ptr);
		  for(i=0;i<numpp;i++)
		    {
		      if(strcmp(var, pp[i].pname)==0)
			{
			  switch (pp[i].type)
			    {
			    case PARAM_INT:
			      sscanf(val, "%d", (int *)pp[i].where);
			      break;
			    case PARAM_FLOAT:
				  float val2 ;
				  val2 = atof(val);
				  *((float *)pp[i].where) = val2;
			      break;
			    case PARAM_CHAR:
			      sscanf(val, "%c", (char *)pp[i].where);
			      break;
			    case PARAM_STR:
			      if(*(char **)pp[i].where)
				free(*(char **)pp[i].where);
			      *(char **)pp[i].where = visual_strdup(val);
			      break;
			    }
			  break;
			}
		    }
		  if(i==numpp && *egal == '=')
		    {
		      err= "unknown parameter";
		      goto error;
		    }
		}
	    }
	}
      fgets(buf,1024, f);line++;
    }
  if(mode == 1)
    {
      err = " missing End Effect";
      goto error;
    }
  setlocale (LC_NUMERIC, oldlocal);


  fclose(f);
  newconfig = 1;
  allocParts();
  changep();
  return 1;
 error:
  setlocale (LC_NUMERIC, oldlocal);
  fclose(f);
  return 0;
}