Exemple #1
0
void Feature::resetFeatureScript(uint16 enabled, uint16 scrbId) {
	if (!scrbId)
		scrbId = _scrbId;
	if (scrbId != _scrbId || _needsReset) {
		if (_needsReset)
			_data.bounds = Common::Rect();
		_scrbId = scrbId;
		_view->getnthScriptSetGroup(_data.scrbIndex, _data.compoundSHAPIndex, scrbId);
	}
	if (_data.scrbIndex == 0xFFFF) {
		_data.enabled = 0;
		_data.bitmapIds[0] = 0;
		_data.scrbIndex = 0;
		_data.compoundSHAPIndex = 0;
		resetFrame();
		return;
	}

	resetScript();
	resetFrame();
	_nextTime = 0; // New feature code uses _view->_lastIdleTime, but should be equivalent.
	_data.enabled = enabled;
	_dirty = 1;

	finishResetFeatureScript();

	_needsReset = 0;

	if (_region) {
		// TODO: mark _region as dirty
	} else {
		// TODO: mark _data.bounds as dirty
	}
}
Exemple #2
0
bool ScEngine::resetObject(BaseObject *Object) {
	// terminate all scripts waiting for this object
	for (uint32 i = 0; i < _scripts.size(); i++) {
		if (_scripts[i]->_state == SCRIPT_WAITING && _scripts[i]->_waitObject == Object) {
			if (!_gameRef->_compatKillMethodThreads) {
				resetScript(_scripts[i]);
			}

			bool isThread = _scripts[i]->_methodThread || _scripts[i]->_thread;
			_scripts[i]->finish(!isThread); // 1.9b1 - top-level script kills its threads as well
		}
	}
	return STATUS_OK;
}
Exemple #3
0
// 																		<<<<<<<<<<-------------- TODO: Check this out...dose some intresting things
static void
skip_percent_comment(void)
{

#ifndef TTYEDEN
    Script     *script;
    extern Script *st_script, *dd_script;
    extern int  run(short, void *, char *);
    extern void dd_lex(int), st_lex(int);
#ifdef WANT_SASAMI
    extern Script *sa_script;
    extern void sa_input(char);
#endif /* WANT_SASAMI */
#ifdef DISTRIB
    extern void lsd_lex(int);
#endif /* DISTRIB */
#endif /* not TTYEDEN */

    /* skip_percent_comment is called when we are starting a new line
       and nextc=='%' [Ash] */

    char       *s;
    int         start = yyleng;

    safe_input();		/* read in the initial '%' */

    for (;;) {

	s = yytext + start;

	/* safe_input until we have an end-of-line or EOF */
	if ((nextc != '\n') && (nextc != '\r') && (nextc != 0)) {
	  safe_input();
	  continue;
	} else {
	  /* now we've found the end of the line, terminate it correctly */
	  end_text1();
	}

	if ((nextc == '\n') || (nextc == '\r')) {
	  if (notationSwitch(s)) {
	    char execstr[100];
	    int c;
	    
	    changeNotation(NEWOTHER);

	    /* Notation now changed to a non-default one.  Slurp in
	       the rest of the text until (just before) the next
	       change of notation and parse it.  [Ash] */
	    for (nextc = peek();
		 (nextc != '\0') && (nextc != EOF);
		 nextc = peek()) {
	      
	      if (Inp_Dev->newline && nextc == '%') {
		/* Trying to fix sqleddi "prepare to eat and then eat"
		   bug [Ash, 23rd October 2002] */
		/*
		  strcpy(execstr, "notationChar('\\\n');");
		  run(STRING_DEV, execstr, 0);
		*/
		
		nextc = '\n';
		return;
	      } else if (Inp_Dev->newline && nextc == '#') {
		c = keyin();
		if (nextc == '#') {
		  /* "##" comment input: ignore to end of line */
		  do {c = keyin();} while (!Inp_Dev->newline);
		  
		} else {
		  /* input line starts with #, but second character is
		     not #.  Pass the first # to the Eden parser, and
		     parse the second character the next time round
		     the loop. */
		  strcpy(execstr, "notationChar('#');");
		  run(STRING_DEV, execstr, 0);
		}
	      } else {
		/* Something in the sqleddi model causes C's idea
                   about the status of the current notation to get
                   confused.  As this piece of code is executing, we
                   must be in a NEWOTHER notation, so set it
                   explicitly.  [Ash, 24th October 2002] */
#ifdef TTYEDEN
		changeNotation(NEWOTHER);
#endif
		c = keyin();
		/* fprintf(stderr, "KEYIN %d\n", c); */
		
		if (c == '\'')
		  strcpy(execstr, "notationChar('\\\'');");
		else if (c == '\\')
		  strcpy(execstr, "notationChar('\\\\');");
		else
		  sprintf(execstr, "notationChar('%c');", c);
		
		run(STRING_DEV, execstr, 0);
	      }
	      
	    } /* end for */
	    
#ifdef TTYEDEN
	    /* ttyeden does not currently keep track of the current
	       notation properly.  It should still be %eddi after an
	       included file has changed to that notation and not back
	       again, but this would require some work on the lexer.
	       At least we can ensure that the prompt is correct here.
	       [Ash] */
	    /*
	      if ((nextc == EOF) || (nextc == '\0')) {
	      fprintf(stderr, "EOF FUDGE\n");
	      notationSwitch("%eden");
	      currentNotation = EDEN;
	      }
	    */

	    currentNotation = EDEN;
	    /* peek() does not seem to manage to successfully push
	       back the EOF character in TTYEDEN and so keyin() would
	       cause another character to be read.  Stop immediately
	       instead.  [Ash] */
	    return;
#else
	    keyin();	/* read the null character */
	    /* treat end-of-file as end-of-line */
	    /* the code feeding the parser with \n below is a
	       reinterpretation of something Chris Brown put in, but
	       it doesn't seem to be required any more */
	    /*
	     * strcpy(execstr, "notationChar('\\n');");
	     * run(STRING_DEV, execstr, 0);
	     */
	    setprompt();
#endif
	    
	  } /* end if notationSwitch(s) */


#ifndef TTYEDEN
	  /* DoNaLD -------------------------------------------- */
	  /* %donald0 is an alternative alias for %donald, so that we
	     can replace %donald with a new translator but still
	     access this builtin as %donald0 */
	  else if ((strncmp(s, "%donald0", 8) == 0) ||
		   (strncmp(s, "%donald", 7) == 0)) {
	    changeNotation(DONALD);
	    dd_script = script = newScript();
	    for (nextc = peek(); nextc != '\0'; nextc = peek()) {
	      if (Inp_Dev->newline && (nextc == '%' || nextc == '>'
				       || nextc == '<')) {
		if (nextc == '>' || nextc == '<') {
		  input();
		  getAgentName();
		}
		else {
		  nextc = '\n';
		  if (script->text[0] != '\0') {
		    appAgentName--;
		    /* printf("from donald 1"); */
		    pushEntryStack(DONALD);
		    run(STRING_DEV, script->text, 0);
		    popEntryStack();
		    appAgentName++;
		  }
		  deleteScript(script);
		  return;
		} /* end if (nextc == '>' || nextc == '<') */
	      } /* end if (Inp_Dev->newline...) */
	      else {
		dd_lex(keyin());
		if (script->ready) {
		  if (script->text[0] != '\0') {
		    appAgentName--;
		    /* printf("from donald 2"); */
		    pushEntryStack(DONALD);
		    run(STRING_DEV, script->text, 0);
		    dd_script = script;
		    popEntryStack();
		    /* printf("from donald 3"); */
		    appAgentName++;
		  }
		  resetScript(script);
		} /* end if (script->ready) */
	      } /* end if (Inp_Dev->newline...) (two versions) */
	    } /* end for (nextc = peek()...) */


	    keyin();	/* read the null character */
	    dd_lex('\n');	/* treat end-of-file as end-of-line */

	    if (script->text[0] != '\0') {
	      appAgentName--;
	      pushEntryStack(DONALD);
	      run(STRING_DEV, script->text, 0);
	      popEntryStack();
	      /* printf("from donald 4"); */
	      appAgentName++;
	    }
	    deleteScript(script);
	  } /* end if (strncmp(s, "%donald", 7) == 0) */


	  /* SCOUT -------------------------------------------- */
	  else if (strncmp(s, "%scout", 6) == 0) {	/* is SCOUT */
	    scoutScreenInitOpen();
	    changeNotation(SCOUT);
	    st_script = script = newScript();
	    for (nextc = peek(); nextc != '\0'; nextc = peek()) {
	      if (Inp_Dev->newline && (nextc == '%' || nextc == '>'
				       || nextc == '<')) {
		if (nextc == '>' || nextc == '<') {
		  input();
		  getAgentName();
		} else {
		  nextc = '\n';
		  if (script->text[0] != '\0') {
		    appAgentName--;
		    /* printf("from scout 1"); */
		    pushEntryStack(SCOUT);
		    run(STRING_DEV, script->text, 0);
		    popEntryStack();
		    appAgentName++;
		  }
		  deleteScript(script);
		  return;
		}
	      } /* end if (Inp_Dev->newline...) */
	      else {
		st_lex(keyin());
		if (script->ready) {
		  if (script->text[0] != '\0') {
		    appAgentName--;
		    /* printf("from scout 2 %s\n", script->text); */
		    pushEntryStack(SCOUT);
		    run(STRING_DEV, script->text, 0);
		    st_script = script;
		    popEntryStack();
		    appAgentName++;
		  }
		  resetScript(script);
		}
	      }
	    } /* end for (nextc = peek();... */

	    keyin();	/* read the null character */
	    st_lex('\n');	/* treat end-of-file as end-of-line */
	    if (script->text[0] != '\0') {
	      appAgentName--;
	      pushEntryStack(SCOUT);
	      run(STRING_DEV, script->text, 0);
	      popEntryStack();
	      appAgentName++;
	    }
	    deleteScript(script);
	  } /* end if (strncmp(s, "%scout", 6)... */

#ifdef WANT_SASAMI

	  /* Sasami -------------------------------------------- */

	  else if (strncmp(s, "%sasami", 7) == 0) {
	    changeNotation(SASAMI);
	    sa_script = script = newScript();
	    for (nextc = peek(); nextc != '\0'; nextc = peek())	{
	      if (Inp_Dev->newline && (nextc == '%' || nextc == '>' ||
				       nextc == '<')) {
		/* This is a %, > or < statement and shouldn't be
                   passed to Sasami */
		if (nextc == '>' || nextc == '<') {
		  input();
		  getAgentName();
		} else {
		  nextc = '\n';
		  if (script->text[0] != '\0') {
		    appAgentName--;
		    /* printf("from sasami 1"); */
		    pushEntryStack(SASAMI);
		    run(STRING_DEV, script->text, 0);
		    popEntryStack();
		    appAgentName++;
		  }
		  deleteScript(script);
		  return;
		}
	      } else {
		/* This must be something worth sending to Sasami */
		sa_input(keyin());
		/* Now run the EDEN script that Sasami's produced (if
                   there is one) */
		if (script->ready) {
		  if (script->text[0] != '\0') {
		    appAgentName--;
		    /* printf("from sasami 2"); */
		    pushEntryStack(SASAMI);
		    run(STRING_DEV, script->text, 0);
		    sa_script = script;
		    popEntryStack();
		    /* printf("from sasami 3"); */
		    appAgentName++;
		  }
		  resetScript(script);
		}
	      }
	    }

	    /* OK - finished with the input, so send an EOL to make
	       sure that the parser runs the last input line, and
	       exit. */

	    keyin();	/* read the null character */

	    sa_input('\n');	/* treat end-of-file as end-of-line */

	    if (script->text[0] != '\0') {
	      appAgentName--;
	      pushEntryStack(SASAMI);
	      run(STRING_DEV, script->text, 0);
	      popEntryStack();
	      /* printf("from sasami 4"); */
	      appAgentName++;
	    }
	    deleteScript(script);
	  } /* end if (strncmp(s, "%sasami", 7) == 0) */
#endif /* WANT_SASAMI */

#ifdef DISTRIB
	  /* LSD -------------------------------------------- */
	  else if (strncmp(s, "%lsd", 4) == 0) {
	    changeNotation(LSD);
	    for (nextc = peek(); nextc != '\0'; nextc = peek()) {
	      if (Inp_Dev->newline && (nextc == '%' || nextc == '>'
				       || nextc == '<')) {
		if (nextc == '>' || nextc == '<') {
		  input();
		  getAgentName();
		} else {
		  nextc = '\n';
		  return;
		}
	      } else {
		lsd_lex(keyin());
	      }
	    }
	    keyin();	/* read the null character */
	    lsd_lex('\n');	/* treat end-of-file as end-of-line */
	  } /* end if (strncmp(s, "%lsd", 4)... */
#endif /* DISTRIB */

	  /* This push and pop facility ("%+eden") appears be used
             only in Donald [Ash] */

	  /* Push entry -------------------------------------------- */
	  else if (s[1] == '+') {
	    /*  appAgentName=0; */
	    if ((strncmp(s + 2, "donald0", 7) == 0) ||
		(strncmp(s + 2, "donald", 6) == 0)) {	/* is DoNaLD */
	      pushEntryStack(DONALD);
	    } else if (strncmp(s + 2, "scout", 5) == 0) {	/* is SCOUT */
	      pushEntryStack(SCOUT);
	    } else if (strncmp(s + 2, "eden", 4) == 0) {	/* is EDEN */
	      pushEntryStack(EDEN);
#ifdef WANT_SASAMI
	    } else if (strncmp(s + 2, "sasami", 6) == 0) {	/* is Sasami */
	      pushEntryStack(SASAMI);
#endif /* WANT_SASAMI */
	    }
	  } /* end if (s[1] == '+') */


	  /* Pop entry -------------------------------------------- */
	  else if (s[1] == '-') {
	    if ((strncmp(s + 2, "donald0", 7) == 0)
		|| strncmp(s + 2, "donald", 6) == 0
		|| strncmp(s + 2, "scout", 5) == 0	/* is SCOUT */
#ifdef WANT_SASAMI
		|| strncmp(s + 2, "sasami", 6) == 0	/* is Sasami */
#endif
		|| strncmp(s + 2, "eden", 4) == 0) {	/* is EDEN */
	      popEntryStack();
	      /*  appAgentName=1; */
	    }
	  } /* end if (s[1] == '-') */

#endif /* not TTYEDEN */

	  /* Eden -------------------------------------------- */
	  else {
	    changeNotation(EDEN);
	  }

	  return;

	} else if (nextc == 0) {
	  /* EOF */
#ifdef TTYEDEN
	  /* Dummy if start to make the else's below work... [Ash] */
	  if (0) {}
#else
	  if ((strncmp(s, "%donald0", 8) == 0) ||
	      (strncmp(s, "%donald", 7) == 0)) {	/* is DoNaLD */
	    changeNotation(DONALD);
	  }
	  else if (strncmp(s, "%scout", 6) == 0) {	/* is SCOUT */
	    changeNotation(SCOUT);
	  }
#ifdef WANT_SASAMI
	  else if (strncmp(s, "%sasami", 7) == 0) {	/* is Sasami */
	    changeNotation(SASAMI);
	  }
#endif /* WANT_SASAMI */
#endif /* not TTYEDEN */
          else if (notationSwitch(s)) {
	    changeNotation(NEWOTHER);
	  } else {		/* is EDEN */
	    changeNotation(EDEN);
	  }
	  return;
	} /* end if nextc==0 */
    } /* end for ;; */
} /* end skip_percent_comment */