58 float w =
sprite.getWidth();
59 float h =
sprite.getHeight();
60 int cols = (int) (w / cellSize);
61 int rows = (int) (h / cellSize);
64 float cellX = (int) (Math.random() * cols);
65 float cellY = (int) (Math.random() * rows);
67 float ctw =
sprite.getTextureWidth() / (float) cols;
68 float cth =
sprite.getTextureHeight() / (float) rows;
70 sprite.setTexX(cellX * ctw);
71 sprite.setTexY(cellY * cth);
76 glow.setTexX(cellX * ctw);
77 glow.setTexY(cellY * cth);
78 glow.setTexWidth(ctw);
79 glow.setTexHeight(cth);
93 facing = (float) Math.random() * 360f;
94 angVel = (float) Math.random() * 360f - 180f;
96 float r = (float) Math.random();
97 r = (float) Math.sqrt(r);
98 float dist = r * spawnRadius;
100 loc = Misc.getUnitVectorAtDegreeAngle((
float)Math.random() * 360f);
103 vel = Misc.getUnitVectorAtDegreeAngle((
float)Math.random() * 360f);
107 vel.x += off - (float) Math.random() * 0.5f * off;
108 vel.y += off - (float) Math.random() * 0.5f * off;
109 if ((
float) Math.random() > 0.5f) {
114 float speed = 10f + (float) Math.random() * 10f;
117 timeLeft = 1f + (float) Math.random();
124 if (alphaMult <= 0)
return;
126 SectorEntityToken lightSource =
entity.getLightSource();
127 if (lightSource !=
null &&
entity.getLightColor() !=
null) {
130 sprite.setColor(Color.white);
135 sprite.setAlphaMult(alphaMult *
fader.getBrightness());
138 if (lightSource !=
null && !
entity.getLightSource().hasTag(Tags.AMBIENT_LS)) {
143 GL11.glColorMask(
false,
false,
false,
true);
145 GL11.glTranslatef(
loc.x,
loc.y, 0);
146 Misc.renderQuadAlpha(0 - w/2f - 1f, 0 - h/2f - 1f, w + 2f, h + 2f, Misc.zeroColor, 0f);
148 sprite.setBlendFunc(GL11.GL_ONE, GL11.GL_ZERO);
151 float lightDir = Misc.getAngleInDegreesStrict(
entity.getLocation(), lightSource.getLocation());
154 shadowMask.setBlendFunc(GL11.GL_ZERO, GL11.GL_SRC_ALPHA);
157 GL11.glColorMask(
true,
true,
true,
false);
158 shadowMask.setBlendFunc(GL11.GL_DST_ALPHA, GL11.GL_ONE_MINUS_DST_ALPHA);