Navigation Menu

Skip to content

Commit

Permalink
Refactor: Switched each games' p_lights.c to C++
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Jan 30, 2014
1 parent 844c07b commit ce5f6a3
Show file tree
Hide file tree
Showing 12 changed files with 511 additions and 616 deletions.
2 changes: 1 addition & 1 deletion doomsday/plugins/doom/doom.pro
Expand Up @@ -79,7 +79,7 @@ SOURCES += \
src/m_random.c \
src/p_enemy.c \
src/p_inter.c \
src/p_lights.c \
src/p_lights.cpp \
src/p_maputl.c \
src/p_mobj.c \
src/p_oldsvg.c \
Expand Down
134 changes: 74 additions & 60 deletions doomsday/plugins/doom/include/p_lights.h
@@ -1,32 +1,26 @@
/**\file
*\section License
* License: GPL
* Online License Link: http://www.gnu.org/licenses/gpl.html
/** @file p_lights.h Handle Sector base lighting effects.
*
*\author Copyright © 2009-2013 Daniel Swanson <danij@dengine.net>
* @authors Copyright © 2009-2013 Daniel Swanson <danij@dengine.net>
*
* 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 2 of the License, or
* (at your option) any later version.
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
*
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301 USA
* <small>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 2 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, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA</small>
*/

/**
* p_lights.h: Handle Sector base lighting effects.
*/
#ifndef LIBDOOM_PLAY_LIGHTS_H
#define LIBDOOM_PLAY_LIGHTS_H

#ifndef __P_LIGHTS_H__
#define __P_LIGHTS_H__
#include "doomsday.h"

#ifndef __JDOOM__
# error "Using jDoom headers without __JDOOM__"
Expand All @@ -38,63 +32,83 @@
#define SLOWDARK (35)

typedef struct {
thinker_t thinker;
Sector* sector;
int count;
float maxLight;
float minLight;
thinker_t thinker;
Sector *sector;
int count;
float maxLight;
float minLight;

#ifdef __cplusplus
void write(Writer *writer) const;
int read(Reader *reader, int mapVersion);
#endif
} fireflicker_t;

typedef struct {
thinker_t thinker;
Sector* sector;
int count;
float maxLight;
float minLight;
int maxTime;
int minTime;
thinker_t thinker;
Sector *sector;
int count;
float maxLight;
float minLight;
int maxTime;
int minTime;

#ifdef __cplusplus
void write(Writer *writer) const;
int read(Reader *reader, int mapVersion);
#endif
} lightflash_t;

typedef struct {
thinker_t thinker;
Sector* sector;
int count;
float minLight;
float maxLight;
int darkTime;
int brightTime;
thinker_t thinker;
Sector *sector;
int count;
float minLight;
float maxLight;
int darkTime;
int brightTime;

#ifdef __cplusplus
void write(Writer *writer) const;
int read(Reader *reader, int mapVersion);
#endif
} strobe_t;

typedef struct {
thinker_t thinker;
Sector* sector;
float minLight;
float maxLight;
int direction;
thinker_t thinker;
Sector *sector;
float minLight;
float maxLight;
int direction;

#ifdef __cplusplus
void write(Writer *writer) const;
int read(Reader *reader, int mapVersion);
#endif
} glow_t;

#ifdef __cplusplus
extern "C" {
#endif

void T_FireFlicker(void *flickPtr);
void P_SpawnFireFlicker(Sector* sector);
void T_FireFlicker(void *flickPtr);
void P_SpawnFireFlicker(Sector *sector);

void T_LightFlash(lightflash_t* flash);
void P_SpawnLightFlash(Sector* sector);
void T_LightFlash(lightflash_t *flash);
void P_SpawnLightFlash(Sector *sector);

void T_StrobeFlash(strobe_t* flash);
void P_SpawnStrobeFlash(Sector* sector, int fastOrSlow,
int inSync);
void T_Glow(glow_t* g);
void P_SpawnGlowingLight(Sector* sector);
void T_StrobeFlash(strobe_t *flash);
void P_SpawnStrobeFlash(Sector *sector, int fastOrSlow, int inSync);

void EV_StartLightStrobing(Line* line);
void EV_TurnTagLightsOff(Line* line);
void EV_LightTurnOn(Line* line, float bright);
void T_Glow(glow_t* g);
void P_SpawnGlowingLight(Sector *sector);

void EV_StartLightStrobing(Line *line);
void EV_TurnTagLightsOff(Line *line);
void EV_LightTurnOn(Line *line, float bright);

#ifdef __cplusplus
} // extern "C"
#endif

#endif
#endif // LIBDOOM_PLAY_LIGHTS_H

0 comments on commit ce5f6a3

Please sign in to comment.