The RPG Maker Resource Kit

RMRK RPG Maker Creation => XP => Topic started by: Heretic86 on May 21, 2016, 12:24:06 AM

Title: New Dynamic Lights Script for XP...
Post by: Heretic86 on May 21, 2016, 12:24:06 AM
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fdownloads.chaos-project.com%2Fheretic86%2Fimages%2FDynamicLights1.jpg&hash=941536ba1ce81e9753426146092c05cfb43173f7)

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fdownloads.chaos-project.com%2Fheretic86%2Fimages%2FDynamicLights2.jpg&hash=47352607b964787d19044be72210801f209d55f6)

New script I am working on.

Two things:
#1 - Any requested features?
#2 - Do you know of any other Dynamic Light Scripts I can take a look at?

What do you all think so far?

---

EDIT:  Oops!  I forgot to edit this post to put up a link to the FINISHED version of this script, complete with DEMO!

http://rmrk.net/index.php?topic=48400.0
Title: Re: New Dynamic Lights Script for XP...
Post by: swick on June 24, 2016, 06:00:04 AM
it looks awesome give it to me
Title: Re: New Dynamic Lights Script for XP...
Post by: Heretic86 on June 27, 2016, 08:20:31 PM
I will once its stable.

My c++ skills suck bowling balls thru stir straws and the script currently is very unstable.  This is the effect that will be produced in the long run once stable:

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fdownloads.chaos-project.com%2Fheretic86%2FSpotLight.gif&hash=a0b58f05967d762de2aef27bffdc24b658ef5b8e)

If there are any c++ folks here, care to take a look at the source code?
Spoiler for:
Code: [Select]
// KK20Rotate.cpp : Defines the exported functions for the DLL application.
//

#include "stdafx.h"

typedef union {
unsigned int pixel;
struct {
unsigned char blue;
unsigned char green;
unsigned char red;
unsigned char alpha;
};
} RGSSRGBA;

typedef struct {
DWORD flags;
DWORD klass;
void(*dmark) (void*);
void(*dfree) (void*);
BYTE *data; //B = 0, G = 1, R = 2, A = 3
} RGSSCOLOR;

typedef struct {
DWORD unk1;
DWORD unk2;
BITMAPINFOHEADER *infoheader;
RGSSRGBA *firstRow;
RGSSRGBA *lastRow;
} RGSSBMINFO;

typedef struct {
DWORD unk1;
DWORD unk2;
RGSSBMINFO *bminfo;
} BITMAPSTRUCT;

typedef struct {
DWORD flags;
DWORD klass;
void(*dmark) (void*);
void(*dfree) (void*);
BITMAPSTRUCT *bm;
} RGSSBITMAP;

extern "C" _declspec (dllexport) bool RotateRGSSBmp(long bmp, float * matrix)
{
RGSSBMINFO *bitmap = ((RGSSBITMAP*)(bmp << 1))->bm->bminfo;

long width, height;
RGSSRGBA *row;
RGSSRGBA *rowcopy;
long x, y;
float nx, ny;
float cx, cy;
unsigned char red, green, blue, alpha;

float transx, transy, transw;

if (!bitmap)
return false;
width = bitmap->infoheader->biWidth;
height = bitmap->infoheader->biHeight;
cx = (float)width / 2 + 0.0001;
cy = (float)height / 2 + 0.0001;

rowcopy = new RGSSRGBA[width*height];
row = bitmap->lastRow;
memcpy(rowcopy, row, width*height * 4);

RGSSRGBA *sourcepos;

for (y = 0; y < height; y++)
{
for (x = 0; x < width; x++)
{
nx = x - cx;
ny = y - cy;

transx = (float)(matrix[0] * nx + matrix[1] * ny + matrix[2]);
transy = (float)(matrix[3] * nx + matrix[4] * ny + matrix[5]);
transw = (float)(matrix[6] * nx + matrix[7] * ny + matrix[8]);

// Dividing by zero is bad
if (transw == 0)
transw = (float)0.001;

transx = (transx + cx) / transw;
transy = (transy + cy) / transw;

if (transx < 0 || transx > width || transy < 0 || transy > height)
{
red = 0;
green = 0;
blue = 0;
alpha = 0;
}
else
{
sourcepos = rowcopy + (int)transx + ((int)transy * width);

red = sourcepos->red;
green = sourcepos->green;
blue = sourcepos->blue;
alpha = sourcepos->alpha;
}

row->red = red;
row->green = green;
row->blue = blue;
row->alpha = alpha;

row++;
}
}

delete[]rowcopy;

return true;
}

Title: Re: New Dynamic Lights Script for XP...
Post by: Heretic86 on July 02, 2016, 07:45:34 AM
A couple of Screenshots showing off Pendulum Lights...

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fdownloads.chaos-project.com%2Fheretic86%2Fimages%2FPenLightH.gif&hash=d96c0a0a846864b15397e41a0cbe18fc9147e912)

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fdownloads.chaos-project.com%2Fheretic86%2Fimages%2FPenLight.gif&hash=39de37d386bf4f604216dcea16a0de9d523499fa)

--- Edit ---

I put up a Prototype Demo for DOWNLOAD if anyone is interested in taking a look and offering suggestions or feedback during the development process...

PROTOTYPE DOWNLOAD
- Redacted, Obsolete -
http://rmrk.net/index.php?topic=48400.0 - Full Release Version

Feedback would be appreciated...

.
Title: Re: New Dynamic Lights Script for XP...
Post by: Heretic86 on July 07, 2016, 11:04:18 AM
* Modified *

Pre Release Version has been removed as it is now obsolete.  Full Version has been released with all Legal restrictions removed.  Available as a part of Heretic's Collection:

http://rmrk.net/index.php?topic=48400.0

And for my next magic trick, maybe I'll change my Avatar?  :P