#
###
# Application: Pycadia
# File:        constants.py
# Description: Constants for pycadia (spacewarpy and vektoroids)
# Copyright (c) 2002-2003   Andy Balcombe <http://www.anti-particle.com>
###
#
# 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 Library 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#

from pygame.locals import *
import config

class PycadiaConstants:
    """Pycadia Constants class"""
    def __init__(self):
        #get config
        sCfgFile, self.cfg = config.PycadiaConfig()
        #set screen flags
        if self.cfg.getint('display', 'fullscreen'):
            self.SCREEN_FLAGS = FULLSCREEN
        else:
            self.SCREEN_FLAGS = 0
        #set screen size rect
        x = self.cfg.getint('display', 'screensize_x')
        y = self.cfg.getint('display', 'screensize_y')
        self.SCREENRECT = Rect(0, 0, x, y)
        #other opts
        self.DEBUG = 0
        self.FRAMES_PER_SEC = self.cfg.getint('display', 'target_fps')
        self.DRAG = 0
        self.NUMBER_OF_DEGREES = 360 * 4
        self.SHIP_ROTATE_SPEED = 12
        self.SHIP_MAX_SPEED = 15
        self.SHIP_ACCEL = 2.0
        self.MAX_BRIGHT = 255
        self.MIN_BRIGHT = 0
        self.NORM_BRIGHT = 150

        
class SpaceWarpyConstants(PycadiaConstants):
    """SpaceWarpy Constants class"""
    def __init__(self):
        PycadiaConstants.__init__(self)
        self.PLAYER1_START = (100, 100)
        self.PLAYER1_SPIN = 270 * 4
        #self.PLAYER2_START = (100, 200)
        self.PLAYER2_START = (self.SCREENRECT.width-100, self.SCREENRECT.height-100)
        self.PLAYER2_SPIN = 90 * 4
        self.PLAYER_LIVES = self.cfg.getint('spacewarpy', 'player_lives')
        self.SUN_POSITION = (self.SCREENRECT.width/2, self.SCREENRECT.height/2)
        self.SUN_GRAVITY = float(self.cfg.get('spacewarpy', 'gravity')) * -300 #-600
        self.SUN_DISTCLAMP = 40
        self.MAX_SHOTS = self.cfg.getint('spacewarpy', 'max_shots')
        self.SHOT_SPEED = 7.5
        self.SHOT_LIFE = float(self.cfg.get('spacewarpy', 'shot_life')) * self.FRAMES_PER_SEC
        self.ASTEROID_HITS = self.cfg.getint('spacewarpy', 'asteroid_destroy')
        self.ASTEROID_APPEAR = self.cfg.getint('spacewarpy', 'asteroid_delay') * self.FRAMES_PER_SEC

        
class VektoroidsConstants(PycadiaConstants):
    """Vektoroids Constants class"""
    def __init__(self):
        PycadiaConstants.__init__(self)
        self.MAX_SHOTS = self.cfg.getint('vektoroids', 'max_shots')
        self.SHOT_SPEED = 7.5
        self.SHOT_LIFE = float(self.cfg.get('vektoroids', 'shot_life')) * self.FRAMES_PER_SEC
        self.PLAYER1_START = (self.SCREENRECT.width/2, self.SCREENRECT.height/2)
        self.PLAYER1_SPIN = 270 * 4
        self.PLAYER_LIVES = self.cfg.getint('vektoroids', 'player_lives')
        self.ASTEROID_HITS = self.cfg.getint('vektoroids', 'asteroid_destroy')
        self.ASTEROID_WAVE = self.cfg.getint('vektoroids', 'asteroid_wave') 
        self.SUN_POSITION = (0,0)
        self.SUN_GRAVITY = 0
        self.SUN_DISTCLAMP = 40

