Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 66125b2e10 | |||
| e6becffc4c | |||
| d281e57879 | |||
| 5196a970a0 | |||
| efcbc92e7a |
+25
-25
@@ -1000,18 +1000,18 @@ void transform32_std(PyObject *pysrc, PyObject *pydst,
|
||||
|
||||
unsigned int amul = (int) (a * 256);
|
||||
|
||||
lsx = corner_x * 256;
|
||||
lsy = corner_y * 256;
|
||||
lsx = corner_x * 65536;
|
||||
lsy = corner_y * 65536;
|
||||
|
||||
xdx *= 256;
|
||||
ydx *= 256;
|
||||
xdy *= 256;
|
||||
ydy *= 256;
|
||||
xdx *= 65536;
|
||||
ydx *= 65536;
|
||||
xdy *= 65536;
|
||||
ydy *= 65536;
|
||||
|
||||
|
||||
// Scaled subtracted srcw and srch.
|
||||
float fsw = (srcw - 2) * 256;
|
||||
float fsh = (srch - 2) * 256;
|
||||
float fsw = (srcw - 1) * 65536 - 1;
|
||||
float fsh = (srch - 1) * 65536 - 1;
|
||||
|
||||
for (y = 0; y < dsth; y++, lsx += xdy, lsy += ydy) {
|
||||
|
||||
@@ -1058,7 +1058,7 @@ void transform32_std(PyObject *pysrc, PyObject *pydst,
|
||||
|
||||
sx = lsx + minx * xdx;
|
||||
sy = lsy + minx * ydx;
|
||||
|
||||
|
||||
int sxi = (int) sx;
|
||||
int syi = (int) sy;
|
||||
int xdxi = (int) xdx;
|
||||
@@ -1066,13 +1066,13 @@ void transform32_std(PyObject *pysrc, PyObject *pydst,
|
||||
|
||||
while (d <= dend) {
|
||||
int px, py;
|
||||
px = sxi >> 8;
|
||||
py = syi >> 8;
|
||||
px = sxi >> 16;
|
||||
py = syi >> 16;
|
||||
|
||||
unsigned char *sp = srcpixels + py * srcpitch + px * 4;
|
||||
|
||||
int yfrac = syi & 0xff; // ((short) sy) & 0xff;
|
||||
int xfrac = sxi & 0xff; // ((short) sx) & 0xff;
|
||||
int yfrac = (syi >> 8) & 0xff; // ((short) sy) & 0xff;
|
||||
int xfrac = (sxi >> 8) & 0xff; // ((short) sx) & 0xff;
|
||||
|
||||
unsigned int pal = *(unsigned int *) sp;
|
||||
unsigned int pbl = *(unsigned int *) (sp + 4);
|
||||
@@ -1164,17 +1164,17 @@ int transform32_mmx(PyObject *pysrc, PyObject *pydst,
|
||||
// Compute the coloring multiplier.
|
||||
unsigned int amul = (unsigned int) (a * 256);
|
||||
|
||||
lsx = corner_x * 256;
|
||||
lsy = corner_y * 256;
|
||||
lsx = corner_x * 65536;
|
||||
lsy = corner_y * 65536;
|
||||
|
||||
xdx *= 256;
|
||||
ydx *= 256;
|
||||
xdy *= 256;
|
||||
ydy *= 256;
|
||||
xdx *= 65536;
|
||||
ydx *= 65536;
|
||||
xdy *= 65536;
|
||||
ydy *= 65536;
|
||||
|
||||
// Scaled subtracted srcw and srch.
|
||||
float fsw = (srcw - 2) * 256;
|
||||
float fsh = (srch - 2) * 256;
|
||||
float fsw = (srcw - 1) * 65536 - 1;
|
||||
float fsh = (srch - 1) * 65536 - 1;
|
||||
|
||||
for (y = 0; y < dsth; y++, lsx += xdy, lsy += ydy) {
|
||||
|
||||
@@ -1235,13 +1235,13 @@ int transform32_mmx(PyObject *pysrc, PyObject *pydst,
|
||||
|
||||
while (d <= dend) {
|
||||
|
||||
px = sxi >> 8;
|
||||
py = syi >> 8;
|
||||
px = sxi >> 16;
|
||||
py = syi >> 16;
|
||||
|
||||
unsigned char *sp = srcpixels + py * srcpitch + px * 4;
|
||||
|
||||
unsigned int yfrac = syi & 0xff; // ((short) sy) & 0xff;
|
||||
unsigned int xfrac = sxi & 0xff; // ((short) sx) & 0xff;
|
||||
unsigned int yfrac = (syi >> 8) & 0xff; // ((short) sy) & 0xff;
|
||||
unsigned int xfrac = (sxi >> 8) & 0xff; // ((short) sx) & 0xff;
|
||||
|
||||
// Put xfrac in mm5, yfrac in m6
|
||||
pxor_r2r(mm5, mm5);
|
||||
|
||||
+27
-13
@@ -111,9 +111,6 @@ struct Channel {
|
||||
/* The queued up sample. */
|
||||
struct VideoState *queued;
|
||||
|
||||
/* A sample that's dying, and needs to be deallocated. */
|
||||
struct VideoState *dying;
|
||||
|
||||
/* The name of the queued up sample. */
|
||||
PyObject *queued_name;
|
||||
|
||||
@@ -172,6 +169,13 @@ struct Channel {
|
||||
unsigned int vol2_done;
|
||||
};
|
||||
|
||||
struct Dying {
|
||||
struct VideoState *stream;
|
||||
struct Dying *next;
|
||||
};
|
||||
|
||||
static struct Dying *dying = NULL;
|
||||
|
||||
/*
|
||||
* The number of channels the system knows about.
|
||||
*/
|
||||
@@ -443,10 +447,15 @@ static void callback(void *userdata, Uint8 *stream, int length) {
|
||||
if (c->stop_bytes == 0 || bytes == 0) {
|
||||
|
||||
int old_tight = c->playing_tight;
|
||||
|
||||
struct Dying *d;
|
||||
|
||||
post_event(c);
|
||||
|
||||
c->dying = c->playing;
|
||||
d = malloc(sizeof(struct Dying));
|
||||
d->next = dying;
|
||||
d->stream = c->playing;
|
||||
dying = d;
|
||||
|
||||
decref(c->playing_name);
|
||||
|
||||
c->playing = c->queued;
|
||||
@@ -491,7 +500,6 @@ static int check_channel(int c) {
|
||||
channels[i].queued = NULL;
|
||||
channels[i].playing_name = NULL;
|
||||
channels[i].queued_name = NULL;
|
||||
channels[i].dying = NULL;
|
||||
channels[i].volume = SDL_MIX_MAXVOLUME;
|
||||
channels[i].paused = 1;
|
||||
channels[i].event = 0;
|
||||
@@ -1089,14 +1097,20 @@ void PSS_periodic() {
|
||||
|
||||
int i;
|
||||
|
||||
for (i = 0; i < num_channels; i++) {
|
||||
if (channels[i].dying) {
|
||||
ENTER();
|
||||
ffpy_stream_close(channels[i].dying);
|
||||
channels[i].dying = NULL;
|
||||
EXIT();
|
||||
}
|
||||
if (!dying) {
|
||||
return;
|
||||
}
|
||||
|
||||
ENTER();
|
||||
|
||||
while (dying) {
|
||||
struct Dying *d = dying;
|
||||
ffpy_stream_close(d->stream);
|
||||
dying = d->next;
|
||||
free(d);
|
||||
}
|
||||
|
||||
EXIT();
|
||||
}
|
||||
|
||||
/* This should be called in response to an FF_ALLOC_EVENT, with a pygame
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@
|
||||
# ***** ***** ***** ***** ***** ***** **** ***** ***** ***** *****
|
||||
# Be sure to change script_version in launcher/script_version.rpy, too!
|
||||
# Also check to see if we have to update renpy.py.
|
||||
version = "Ren'Py 6.9.1d"
|
||||
version = "Ren'Py 6.9.1f"
|
||||
script_version = 5003000
|
||||
savegame_suffix = "-LT1.save"
|
||||
|
||||
|
||||
+20
-10
@@ -181,7 +181,7 @@ class Channel(object):
|
||||
This stores information about the currently-playing music.
|
||||
"""
|
||||
|
||||
def __init__(self, name, default_loop, stop_on_mute):
|
||||
def __init__(self, name, default_loop, stop_on_mute, tight):
|
||||
|
||||
# The name assigned to this channel. This is used to look up
|
||||
# information about the channel in the MusicContext object.
|
||||
@@ -237,6 +237,9 @@ class Channel(object):
|
||||
|
||||
# Should we stop playing on mute?
|
||||
self.stop_on_mute = stop_on_mute
|
||||
|
||||
# Is this channel tight?
|
||||
self.tight = tight
|
||||
|
||||
if default_loop is None:
|
||||
# By default, should we loop the music?
|
||||
@@ -337,14 +340,18 @@ class Channel(object):
|
||||
break
|
||||
|
||||
# Otherwise, we might be able to enqueue something.
|
||||
topq = self.queue[0]
|
||||
topq = self.queue.pop(0)
|
||||
|
||||
# At this point, we've decided to try to play
|
||||
# top. So let's see how far we can get.
|
||||
|
||||
# Update the queue
|
||||
self.queue = self.queue[1:]
|
||||
# Blacklist of old file formats we used to support, but we now
|
||||
# ignore.
|
||||
lfn = topq.filename.lower()
|
||||
for i in (".mod", ".xm", ".mid", ".midi"):
|
||||
if lfn.endswith(i):
|
||||
topq = None
|
||||
|
||||
if not topq:
|
||||
continue
|
||||
|
||||
try:
|
||||
topf = load(topq.filename)
|
||||
|
||||
@@ -431,7 +438,7 @@ class Channel(object):
|
||||
pss.fadeout(self.number, int(secs * 1000))
|
||||
|
||||
|
||||
def enqueue(self, filenames, loop=True, synchro_start=False, fadein=0, tight=False):
|
||||
def enqueue(self, filenames, loop=True, synchro_start=False, fadein=0, tight=None):
|
||||
|
||||
for filename in filenames:
|
||||
renpy.game.persistent._seen_audio[filename] = True
|
||||
@@ -439,6 +446,9 @@ class Channel(object):
|
||||
if not pcm_ok:
|
||||
return
|
||||
|
||||
if tight is None:
|
||||
tight = self.tight
|
||||
|
||||
for filename in filenames:
|
||||
qe = QueueEntry(filename, int(fadein * 1000), tight)
|
||||
self.queue.append(qe)
|
||||
@@ -496,11 +506,11 @@ all_channels = [ ]
|
||||
channels = { }
|
||||
|
||||
|
||||
def register_channel(name, mixer=None, loop=None, stop_on_mute=True):
|
||||
def register_channel(name, mixer=None, loop=None, stop_on_mute=True, tight=False):
|
||||
if not renpy.game.init_phase:
|
||||
raise Exception("Can't register channel outside of init phase.")
|
||||
|
||||
c = Channel(name, loop, stop_on_mute)
|
||||
c = Channel(name, loop, stop_on_mute, tight)
|
||||
c.mixer = mixer
|
||||
all_channels.append(c)
|
||||
channels[name] = c
|
||||
|
||||
@@ -35,7 +35,7 @@ from renpy.audio.audio import get_channel, get_serial
|
||||
# Part of the public api:
|
||||
from renpy.audio.audio import register_channel, alias_channel
|
||||
|
||||
def play(filenames, channel="music", loop=None, fadeout=None, synchro_start=False, fadein=0, tight=False, if_changed=False):
|
||||
def play(filenames, channel="music", loop=None, fadeout=None, synchro_start=False, fadein=0, tight=None, if_changed=False):
|
||||
"""
|
||||
This stops the music currently playing on the numbered channel, dequeues
|
||||
any queued music, and begins playing the specified file or files. If loop
|
||||
@@ -108,7 +108,7 @@ def play(filenames, channel="music", loop=None, fadeout=None, synchro_start=Fals
|
||||
raise
|
||||
|
||||
|
||||
def queue(filenames, channel="music", loop=None, clear_queue=True, fadein=0, tight=False):
|
||||
def queue(filenames, channel="music", loop=None, clear_queue=True, fadein=0, tight=None):
|
||||
"""
|
||||
This queues the given filenames on the specified channel. If
|
||||
clear_queue is True, then the queue is cleared, making these files
|
||||
|
||||
@@ -1024,7 +1024,7 @@ class Display(object):
|
||||
contents of the window.
|
||||
"""
|
||||
|
||||
surf = renpy.display.module.scale(self.window, scale)
|
||||
surf = renpy.display.scale.smoothscale(self.window, scale)
|
||||
|
||||
sio = cStringIO.StringIO()
|
||||
renpy.display.module.save_png(surf, sio, 0)
|
||||
|
||||
+5
-4
@@ -687,7 +687,7 @@ class FrameImage(ImageBase):
|
||||
tilew, tileh = srcsize
|
||||
dstw, dsth = dstsize
|
||||
|
||||
surf2 = pygame.Surface(dstsize, 0, surf)
|
||||
surf2 = renpy.display.scale.PygameSurface(dstsize, 0, surf)
|
||||
|
||||
for y in range(0, dsth, tileh):
|
||||
for x in range(0, dstw, tilew):
|
||||
@@ -707,6 +707,7 @@ class FrameImage(ImageBase):
|
||||
# Blit.
|
||||
dest.blit(surf, (dx0, dy0))
|
||||
|
||||
|
||||
# Top row.
|
||||
draw(0, xb, 0, yb)
|
||||
draw(xb, -xb, 0, yb)
|
||||
@@ -721,7 +722,7 @@ class FrameImage(ImageBase):
|
||||
draw(0, xb, -yb, 0)
|
||||
draw(xb, -xb, -yb, 0)
|
||||
draw(-xb, 0, -yb, 0)
|
||||
|
||||
|
||||
# And, finish up.
|
||||
return rv
|
||||
|
||||
@@ -775,7 +776,7 @@ class Scale(ImageBase):
|
||||
if self.bilinear:
|
||||
try:
|
||||
renpy.display.render.blit_lock.acquire()
|
||||
rv = pygame.transform.smoothscale(child, (self.width, self.height))
|
||||
rv = renpy.display.scale.smoothscale(child, (self.width, self.height))
|
||||
finally:
|
||||
renpy.display.render.blit_lock.release()
|
||||
else:
|
||||
@@ -820,7 +821,7 @@ class FactorScale(ImageBase):
|
||||
if self.bilinear:
|
||||
try:
|
||||
renpy.display.render.blit_lock.acquire()
|
||||
rv = pygame.transform.smoothscale(surf, (width, height))
|
||||
rv = renpy.display.scale.smoothscale(surf, (width, height))
|
||||
finally:
|
||||
renpy.display.render.blit_lock.release()
|
||||
|
||||
|
||||
@@ -1278,7 +1278,7 @@ class Render(object):
|
||||
vc = [ ]
|
||||
rv = True
|
||||
else:
|
||||
if not source.get_masks()[3]:
|
||||
if not child.get_masks()[3]:
|
||||
vc = [ ]
|
||||
rv = True
|
||||
|
||||
|
||||
+64
-6
@@ -67,7 +67,6 @@ def real_bilinear(src, size):
|
||||
def real_transform_scale(surf, size):
|
||||
global real_transform_scale
|
||||
real_transform_scale = pygame.transform.scale
|
||||
|
||||
return real_transform_scale(surf, size)
|
||||
|
||||
# Loads an image, without scaling it.
|
||||
@@ -88,6 +87,54 @@ def image_save_unscaled(surf, dest):
|
||||
pygame.image.save(surf, dest)
|
||||
|
||||
|
||||
if _renpy:
|
||||
real_renpy_pixellate = _renpy.pixellate
|
||||
real_renpy_transform = _renpy.transform
|
||||
|
||||
def real_smoothscale(src, size, dest=None):
|
||||
"""
|
||||
This scales src up or down to size. This uses both the pixellate
|
||||
and the bilinear operations to handle the scaling.
|
||||
"""
|
||||
|
||||
width, height = size
|
||||
srcwidth, srcheight = src.get_size()
|
||||
iwidth, iheight = srcwidth, srcheight
|
||||
|
||||
if dest is None:
|
||||
dest = PygameSurface(size, src.get_flags(), src)
|
||||
|
||||
if width == 0 or height == 0:
|
||||
return dest
|
||||
|
||||
xshrink = 1
|
||||
yshrink = 1
|
||||
|
||||
while iwidth >= width * 2:
|
||||
xshrink *= 2
|
||||
iwidth /= 2
|
||||
|
||||
while iheight >= height * 2:
|
||||
yshrink *= 2
|
||||
iheight /= 2
|
||||
|
||||
if iwidth != srcwidth or iheight != srcheight:
|
||||
inter = PygameSurface((iwidth, iheight), src.get_flags(), src)
|
||||
real_renpy_pixellate(src, inter, xshrink, yshrink, 1, 1)
|
||||
src = inter
|
||||
|
||||
real_renpy_transform(src, dest,
|
||||
0, 0,
|
||||
1.0 * iwidth / width , 0,
|
||||
0, 1.0 * iheight / height,
|
||||
)
|
||||
|
||||
return dest
|
||||
|
||||
else:
|
||||
real_smoothscale = pygame.transform.smoothscale
|
||||
|
||||
smoothscale = real_smoothscale
|
||||
|
||||
|
||||
def init():
|
||||
@@ -191,7 +238,7 @@ def load_scaling():
|
||||
if scale_fast:
|
||||
scaled = old_transform_scale(full, v2p(full.get_size()))
|
||||
else:
|
||||
scaled = old_transform_smoothscale(full, v2p(full.get_size()))
|
||||
scaled = real_smoothscale(full, v2p(full.get_size()))
|
||||
|
||||
return Surface(scaled, wh=full.get_size())
|
||||
|
||||
@@ -468,12 +515,11 @@ def load_scaling():
|
||||
def image_load(*args, **kwargs):
|
||||
|
||||
full = old_image_load(*args, **kwargs)
|
||||
full = full.convert_alpha()
|
||||
|
||||
if full.get_bitsize() < 24:
|
||||
full = full.convert() # Less than 24 bits means no alpha.
|
||||
|
||||
return surface_scale(full)
|
||||
|
||||
|
||||
pygame.image.load = image_load
|
||||
|
||||
old_transform_scale = pygame.transform.scale
|
||||
@@ -526,7 +572,7 @@ def load_scaling():
|
||||
|
||||
# Ignoring scale2x and chop. The former due to a pending api change,
|
||||
# the latter due to general uselessness.
|
||||
|
||||
|
||||
PygameFont = font_module.Font
|
||||
|
||||
class Font(object):
|
||||
@@ -763,7 +809,19 @@ def load_scaling():
|
||||
pygame.draw.aaline = draw_wrap(pygame.draw.aaline)
|
||||
pygame.draw.aalines = draw_wrap(pygame.draw.aalines)
|
||||
|
||||
# Smoothscale:
|
||||
|
||||
def smoothscale(surf, size, dest=None):
|
||||
if dest is not None:
|
||||
dest = dest.surface
|
||||
|
||||
rv = real_smoothscale(surf.surface, v2p(size), dest)
|
||||
|
||||
if rv is None:
|
||||
return rv
|
||||
else:
|
||||
return Surface(rv, wh=size)
|
||||
|
||||
# Now, put everything from this function's namespace into the
|
||||
# module namespace.
|
||||
|
||||
|
||||
@@ -286,8 +286,7 @@ class Pixellate(Transition):
|
||||
|
||||
rdr = render(visible, width, height, st, at)
|
||||
|
||||
# No alpha support.
|
||||
surf = rdr.pygame_surface(False)
|
||||
surf = rdr.pygame_surface()
|
||||
|
||||
if surf.get_size() != self.surface_size:
|
||||
self.surface_size = surf.get_size()
|
||||
@@ -349,8 +348,8 @@ class Dissolve(Transition):
|
||||
bottom = render(self.old_widget, width, height, st, at)
|
||||
top = render(self.new_widget, width, height, st, at)
|
||||
|
||||
bottom_surface = bottom.pygame_surface(self.alpha)
|
||||
top_surface = top.pygame_surface(self.alpha)
|
||||
bottom_surface = bottom.pygame_surface()
|
||||
top_surface = top.pygame_surface()
|
||||
|
||||
width = min(top.width, bottom.width)
|
||||
height = min(top.height, bottom.height)
|
||||
@@ -1064,8 +1063,8 @@ class ImageDissolve(Transition):
|
||||
bottom = render(self.old_widget, width, height, st, at)
|
||||
top = render(self.new_widget, width, height, st, at)
|
||||
|
||||
bottom_surface = bottom.pygame_surface(self.alpha)
|
||||
top_surface = top.pygame_surface(self.alpha)
|
||||
bottom_surface = bottom.pygame_surface()
|
||||
top_surface = top.pygame_surface()
|
||||
|
||||
iw, ih = image.get_size()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user