- change license of wipe code

There’s nothing really left here of id’s original code
This commit is contained in:
Christoph Oelckers 2022-04-25 17:30:37 +02:00
parent ccdf5fb23c
commit a067eacc79
2 changed files with 44 additions and 65 deletions

View file

@ -1,27 +1,37 @@
//----------------------------------------------------------------------------- /*
// ** wipe.cpp
// Copyright 1993-1996 id Software ** Screen wipe implementation
// Copyright 1999-2016 Randy Heit **
// **---------------------------------------------------------------------------
// This program is free software: you can redistribute it and/or modify ** Copyright 1998-2016 Randy Heit
// it under the terms of the GNU General Public License as published by ** Copyright 2005-2022 Christoph Oelckers
// the Free Software Foundation, either version 3 of the License, or ** All rights reserved.
// (at your option) any later version. **
// ** Redistribution and use in source and binary forms, with or without
// This program is distributed in the hope that it will be useful, ** modification, are permitted provided that the following conditions
// but WITHOUT ANY WARRANTY; without even the implied warranty of ** are met:
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
// GNU General Public License for more details. ** 1. Redistributions of source code must retain the above copyright
// ** notice, this list of conditions and the following disclaimer.
// You should have received a copy of the GNU General Public License ** 2. Redistributions in binary form must reproduce the above copyright
// along with this program. If not, see http://www.gnu.org/licenses/ ** notice, this list of conditions and the following disclaimer in the
// ** documentation and/or other materials provided with the distribution.
//----------------------------------------------------------------------------- ** 3. The name of the author may not be used to endorse or promote products
// ** derived from this software without specific prior written permission.
// DESCRIPTION: **
// Mission begin melt/wipe screen special effect. ** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
// ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
//----------------------------------------------------------------------------- ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**---------------------------------------------------------------------------
**
*/
#include "v_video.h" #include "v_video.h"
#include "m_random.h" #include "m_random.h"
@ -252,15 +262,10 @@ bool Wiper_Crossfade::Run(int ticks)
Wiper_Melt::Wiper_Melt() Wiper_Melt::Wiper_Melt()
{ {
int i, r;
// setup initial column positions
// (y<0 => not ready to scroll yet)
y[0] = -(M_Random() & 15); y[0] = -(M_Random() & 15);
for (i = 1; i < WIDTH; ++i) for (int i = 1; i < WIDTH; ++i)
{ {
r = (M_Random()%3) - 1; y[i] = clamp(y[i-1] + (M_Random() % 3) - 1, -15, 0);
y[i] = clamp(y[i-1] + r, -15, 0);
} }
} }
@ -282,16 +287,15 @@ bool Wiper_Melt::Run(int ticks)
{ {
done = true; done = true;
for (int i = 0; i < WIDTH; i++) for (int i = 0; i < WIDTH; i++)
{
if (y[i] < HEIGHT)
{ {
if (y[i] < 0) if (y[i] < 0)
{
y[i]++; y[i]++;
done = false; else if (y[i] < 16)
} y[i] += y[i] + 1;
else if (y[i] < HEIGHT) else
{ y[i] = min<int>(y[i] + 8, HEIGHT);
int dy = (y[i] < 16) ? y[i] + 1 : 8;
y[i] = min<int>(y[i] + dy, HEIGHT);
done = false; done = false;
} }
if (ticks == 0) if (ticks == 0)
@ -308,7 +312,6 @@ bool Wiper_Melt::Run(int ticks)
} rect; } rect;
// Only draw for the final tick. // Only draw for the final tick.
// No need for optimization. Wipes won't ever be drawn with anything else.
int w = startScreen->GetTexelWidth(); int w = startScreen->GetTexelWidth();
int h = startScreen->GetTexelHeight(); int h = startScreen->GetTexelHeight();

View file

@ -1,32 +1,8 @@
//-----------------------------------------------------------------------------
//
// Copyright 1993-1996 id Software
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see http://www.gnu.org/licenses/
//
//-----------------------------------------------------------------------------
//
// DESCRIPTION:
// Mission start screen wipe/melt, special effects.
//
//-----------------------------------------------------------------------------
#ifndef __F_WIPE_H__ #ifndef __F_WIPE_H__
#define __F_WIPE_H__ #define __F_WIPE_H__
#include "stdint.h" #include "stdint.h"
#include <functional>
class FTexture; class FTexture;
int wipe_CalcBurn(uint8_t *buffer, int width, int height, int density); int wipe_CalcBurn(uint8_t *buffer, int width, int height, int density);