Commit Graph

431 Commits

Author SHA1 Message Date
Steve Checkoway e87789da7c Rename XToString2 to XToString. 2006-10-15 00:09:18 +00:00
Steve Checkoway 04bff6bc1d Use XToString2. 2006-10-15 00:00:22 +00:00
Glenn Maynard 00d1fc742c special case no longer needed 2006-10-11 01:29:15 +00:00
Glenn Maynard f588a033a8 avoid ambiguity with template AppendAttr 2006-10-09 05:13:08 +00:00
Glenn Maynard e0b788de16 unneeded LuaHelpers::RunAtExpressionS 2006-10-09 01:22:17 +00:00
Glenn Maynard 6322ded0dc move command parsing into LuaHelpers. It's not Actor-specific other
than a few compatibility hacks.
2006-10-08 22:24:15 +00:00
Glenn Maynard 6808723b85 XNodeValue base class, Copy() 2006-10-06 06:26:53 +00:00
Glenn Maynard 6112f7c925 fix smpackage linker error 2006-10-05 19:48:29 +00:00
Chris Danford 8df0b80dbe fix smpackage compile 2006-10-05 08:21:41 +00:00
Glenn Maynard 66bb6ad544 fix copy 2006-10-05 00:10:18 +00:00
Glenn Maynard 4acc41f47c fix it used stale 2006-10-04 22:38:59 +00:00
Steve Checkoway 2b8a7f4a14 Silence warning with g++ 4. (Somehow it can't tell that this must exit before the end of the function. I suspect it's the goto.) 2006-10-03 06:29:32 +00:00
Glenn Maynard 1a89ddfccd pointer to attributes 2006-10-03 00:07:01 +00:00
Glenn Maynard 85eb3e0a05 more useful error messages 2006-09-29 07:24:40 +00:00
Glenn Maynard c690fdcfe4 unify registration 2006-09-29 00:01:32 +00:00
Glenn Maynard f4975f1f54 simpler Lua boilerplate 2006-09-27 20:30:29 +00:00
Steve Checkoway 1345a2cd5f LogType -> string. Done. 2006-09-24 03:57:40 +00:00
Glenn Maynard c441d10bc0 set name 2006-09-23 03:31:44 +00:00
Glenn Maynard 546500a5d3 unwrap
sensible behavior for ignore
2006-09-23 03:31:17 +00:00
Glenn Maynard 09afb81741 GetMetric pushes the metric directly. This is faster, avoiding
converting the metric to a string and then back into Lua, and
works with any type; with "Class::Metric=math.sin",
THEME:GetMetric("Class","Metric") will return the function sin().
2006-09-22 21:23:13 +00:00
Glenn Maynard 4ae6eb6070 unused functions 2006-09-22 20:53:36 +00:00
Glenn Maynard d720b18eaa use LuaHelpers::FromStack to generalize metrics 2006-09-22 20:05:37 +00:00
Glenn Maynard d55c71f5cf Don't ReplaceMarkers metrics. Only do that for language strings. 2006-09-22 19:36:17 +00:00
Glenn Maynard f8b3a17c6f split out ThemeManager::PushMetric 2006-09-22 19:05:56 +00:00
Glenn Maynard 874a4fc2bb use ParseActorCommands(L) and RunExpression 2006-09-22 19:01:13 +00:00
Glenn Maynard d98c17eac6 move code 2006-09-22 09:52:08 +00:00
Glenn Maynard 1bb569f8c4 LuaReference and apActorCommands are the same thing; apActorCommands
just sticks the result in AutoPtrCopyOnWrite.  apActorCommands might be
eliminated; it's reference counting a garbage collected object.  (It
used to be more useful, when we stored actual command lists; now I'm
not sure whether it is.  Need to benchmark LuaRef copying to see.)

So, we shouldn't be treating them differently, but we are:
GetMetric(apActorCommands) parses actor commands, and GetMetric(LuaRef)
does not.  I don't like that distinction; actor commands can be passed
around as a LuaReference, and other references can be put in
apActorCommands.  "Whether it's in a smart pointer" is a strange
way to decide which overload to use.

Also, we should have a consistent way to know whether a metric is to
be parsed as a command or as a Lua expression, based on the data
itself and not the code being used to read it.  Let's use the name:
all commands end with "Command".  We already depend on this elsewhere,
in ActorUtil::LoadAllCommandsFromName.

Note that "actor commands" are not specific to the Actor system,
other than a few compatibility hacks; they're just a shorthand
for writing Lua functions.
2006-09-22 07:50:05 +00:00
Glenn Maynard 09a0981eaf handle Fallback metrics like the rest 2006-09-22 07:00:26 +00:00
Glenn Maynard 59ad3f8222 ThemeManager::GetClassFallback 2006-09-22 06:41:27 +00:00
Glenn Maynard 4a9b1736f5 flip GetMetric(ref) and GetMetricR(), so there's an interface exposed that doens't
copy the reference.  Copying refs isn't expensive, but it does lock Lua.
2006-09-22 04:46:47 +00:00
Glenn Maynard f90088d616 Currently all metrics except for strings and commands are valid
Lua expressions, and commands simply allow a shorthand that generates
valid Lua expressions.  Make strings Lua expressions.

This essentially reverses strings; rather than:
  Metric1=Text
  Metric2=@Text()

specify:

  Metric1="Text"
  Metric2=Text()

This means that every metric (except Fallback, currently) can be
treated as a Lua expression, except for Command metrics that just
need a bit of preprocessing.
2006-09-22 04:35:11 +00:00
Glenn Maynard 1b8b029eef re-add "get metric as Lua expression" 2006-09-22 03:31:38 +00:00
Glenn Maynard 489fe6262d no @expr for colors 2006-09-22 02:36:19 +00:00
Glenn Maynard 141f48b032 Handle colors as Lua expressions, like int/float/bool metrics: "{1,1,1,1}"
instead of "1,1,1,1".
2006-09-22 02:35:42 +00:00
Glenn Maynard 30d394b665 Remove RunAtExpressionS (@expr) for most metric types. They're evaluated
as expressions anyway.  Still used for strings and colors, which aren't.
(Strings should be, and color metrics should be removed, I think.)
2006-09-21 20:18:23 +00:00
Glenn Maynard f04a03c321 don't use 0 and 1 for bools; use valid Lua expressions 2006-09-21 20:14:14 +00:00
Glenn Maynard 479aca5ff4 don't FontCharAliases::ReplaceMarkers for non-strings (GetMetricI, etc) 2006-09-21 20:13:21 +00:00
Glenn Maynard e0e29285fe RegisterTypes() less 2006-09-21 04:58:41 +00:00
Glenn Maynard eb376fca1d simplify singleton registration. Add the singleton global
to Lua when the singleton is constructed, and not in the
binding class.  The binding just adds the class bindings
(the same as for a non-singleton class).  This way, the
binding is available to Lua as soon as the class is constructed.
2006-09-21 04:20:08 +00:00
Glenn Maynard 8526204155 remove unused overload 2006-09-21 03:33:35 +00:00
Glenn Maynard b30aaa63a7 ActorCommands.h -> Actor.h (for the type) or ActorUtil.h
(for ParseActorCommands)
2006-09-21 02:38:01 +00:00
Glenn Maynard 3a57dca6c4 ActorCommands -> ActorUtil::ParseActorCommands 2006-09-21 02:24:22 +00:00
Glenn Maynard d04a5920fa LuaExpression -> LuaReference 2006-09-21 02:09:44 +00:00
Glenn Maynard 8548f1cb33 simplify ActorCommands 2006-09-21 01:39:38 +00:00
Glenn Maynard ab1fd34e76 Previously, changing themes attempted to preserve Lua data by
serializing data and tables while reinstantiating Lua.  That's
ugly, and can't serialize some things (eg. functions).

Instead, when changing themes, shut down the high-level objects
and unregister as much as we can from Lua, change the theme,
then reregister things.  This doesn't clean the slate as much;
globals won't be erased, etc.

A better way would be to clear everything that uses Lua
(delete singletons), then reload it all.  Singleton creation is
a bit of a mess currently so that would break a lot, and we
don't want to reload songs.
2006-09-20 23:45:38 +00:00
Glenn Maynard 41028ca167 NextTheme -> GetNextTheme 2006-09-20 23:10:15 +00:00
Glenn Maynard 65c9a8bd17 unused header 2006-09-20 23:07:00 +00:00
Glenn Maynard abacb7ef9d ThemeManager::ClearSubscribers 2006-09-20 23:05:52 +00:00
Steve Checkoway 7f6ccd1688 Cleanup. Don't return NULL when RString is expected. 2006-09-18 10:04:05 +00:00
Steve Checkoway b1ccf2e5ff The correct syntax for theme metrics is "class::name". 2006-09-17 05:37:42 +00:00