Changed the way shadow layers will be handled because we only have a list of
components when creating our character and we need to be able to determine which shadow layers are needed from the set of active components. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3739 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -251,6 +251,9 @@ public class CharacterManager
|
||||
Log.debug("Compositing action [action=" + action +
|
||||
", descrip=" + descrip + "].");
|
||||
|
||||
// this will be used to construct any shadow layers
|
||||
HashMap shadows = null;
|
||||
|
||||
// create colorized versions of all of the source action frames
|
||||
ComponentFrames[] sources = new ComponentFrames[ccount];
|
||||
for (int ii = 0; ii < ccount; ii++) {
|
||||
@@ -268,16 +271,16 @@ public class CharacterManager
|
||||
sources[ii].frames = (zations == null || zations[ii] == null) ?
|
||||
source : source.cloneColorized(zations[ii]);
|
||||
|
||||
// load up the shadow images if they are needed
|
||||
if (sources[ii].ccomp.componentClass.shadowed) {
|
||||
sources[ii].shadowFrames = sources[ii].ccomp.getFrames(
|
||||
action + StandardActions.SHADOW_SUFFIX);
|
||||
if (sources[ii].shadowFrames == null) {
|
||||
Log.warning("Missing shadow frames for action " +
|
||||
"[action=" + action +
|
||||
", comp=" + sources[ii].ccomp + "].");
|
||||
}
|
||||
}
|
||||
// // load up the shadow images if they are needed
|
||||
// if (sources[ii].ccomp.componentClass.isShadowed()) {
|
||||
// sources[ii].shadowFrames = sources[ii].ccomp.getFrames(
|
||||
// action + StandardActions.SHADOW_SUFFIX);
|
||||
// if (sources[ii].shadowFrames == null) {
|
||||
// Log.warning("Missing shadow frames for action " +
|
||||
// "[action=" + action +
|
||||
// ", comp=" + sources[ii].ccomp + "].");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
// use those to create an entity that will lazily composite things
|
||||
|
||||
@@ -117,24 +117,14 @@ public class ComponentClass implements Serializable
|
||||
* be null if a system does not use recolorable components. */
|
||||
public String[] colors;
|
||||
|
||||
/** Indicates whether or not components in this class have an associated
|
||||
* shadow image. */
|
||||
public boolean shadowed;
|
||||
/** Indicates the class name of the shadow layer to which this component
|
||||
* class contributes a shadow. */
|
||||
public String shadow;
|
||||
|
||||
/** Null for a normal component, the color of the pre-composited shadow for
|
||||
* the special "shadow" component class. */
|
||||
public Color shadowColor;
|
||||
|
||||
/** Zero for a normal component, defines the (inclusive) lower bound of the
|
||||
* range of components whose shadow will be included in this pre-composited
|
||||
* shadow layer for a shadow component. */
|
||||
public int minShadowPri;
|
||||
|
||||
/** Zero for a normal component, defines the (inclusive) upper bound of the
|
||||
* range of components whose shadow will be included in this pre-composited
|
||||
* shadow layer for a shadow component. */
|
||||
public int maxShadowPri;
|
||||
|
||||
/**
|
||||
* Creates an uninitialized instance suitable for unserialization or
|
||||
* population during XML parsing.
|
||||
@@ -177,6 +167,25 @@ public class ComponentClass implements Serializable
|
||||
_overrides.insertSorted(override);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this component class contributes a shadow to a
|
||||
* particular shadow layer. Note: this is different from <em>being</em> a
|
||||
* shadow layer which is determined by calling {@link #isShadow}.
|
||||
*/
|
||||
public boolean isShadowed ()
|
||||
{
|
||||
return (shadow != null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this component class is a shadow layer rather than a
|
||||
* normal component class.
|
||||
*/
|
||||
public boolean isShadow ()
|
||||
{
|
||||
return (shadowColor != null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Classes with the same name are the same.
|
||||
*/
|
||||
@@ -211,10 +220,8 @@ public class ComponentClass implements Serializable
|
||||
if (shadowColor != null) {
|
||||
buf.append(", shadow=");
|
||||
buf.append(StringUtil.toString(shadowColor.getComponents(null)));
|
||||
buf.append(" (").append(minShadowPri).append("-");
|
||||
buf.append(maxShadowPri).append(")");
|
||||
} else {
|
||||
buf.append(", shadowed=").append(shadowed);
|
||||
} else if (shadow != null) {
|
||||
buf.append(", shadow=").append(shadow);
|
||||
}
|
||||
return buf.append("]").toString();
|
||||
}
|
||||
|
||||
@@ -46,10 +46,6 @@ public class CompositedActionFrames
|
||||
|
||||
public ActionFrames frames;
|
||||
|
||||
public ActionFrames shadowFrames;
|
||||
|
||||
public ActionFrames cropFrames;
|
||||
|
||||
public String toString () {
|
||||
return ccomp + ":" + frames;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user